From: Pavel Boldin Date: Sun, 12 Apr 2015 13:09:31 +0000 (+0300) Subject: Update to MySQL 5.6.23 and wsrep 25.10 X-Git-Tag: mos-9.0~1 X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F12%2F7712%2F1;p=packages%2Ftrusty%2Fmysql-wsrep-5.6.git Update to MySQL 5.6.23 and wsrep 25.10 Amongst other things this fixes the (Heisen)bug caused by mixing mutexes and atomic operations to manage a variable in a thread safe manner. The wsrep patch was created by diffing original mysql-5.6.23 against [1] provided by galeracluster and fixing conflicts with existing patches. [1] http://releases.galeracluster.com/source/mysql-wsrep-5.6.23-25.10.tar.gz Related-Bug: #1462998 Related-Bug: #1438516 Change-Id: I3eff2760f8e0696a9798f9d2e99bfe78e8a6e314 --- diff --git a/debian/changelog b/debian/changelog index 90d81c31..53896f0e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,14 @@ +mysql-wsrep-5.6 (5.6.23-1~u14.04+mos1) mos7.0; urgency=medium + + * Update to MySQL 5.6.23: + - remove d/p/CVE-2014-0001.patch as it was merged. + * Update to wsrep 25.10 (Closes: #1438516): + - fix misuse of thread-safe functions in innodb-wsrep, + - patch obtained by diffing mysql-5.6.23 against mysql-wsrep-5.6.23-25.10 + and resolving conflicts. + + -- Pavel Boldin Sun, 12 Apr 2015 17:40:48 +0300 + mysql-wsrep-5.6 (5.6.16-2~u14.04+mos2) mos6.1; urgency=low * Fix version according to Fuel versioning policy: diff --git a/debian/patches/CVE-2014-0001.patch b/debian/patches/CVE-2014-0001.patch deleted file mode 100644 index 93c75317..00000000 --- a/debian/patches/CVE-2014-0001.patch +++ /dev/null @@ -1,14 +0,0 @@ -Description: Fix buffer overflow in client/mysql.cc via a long server version string. -Origin: https://bugzilla.redhat.com/show_bug.cgi?id=1054592 - ---- a/client/mysql.cc -+++ b/client/mysql.cc -@@ -1315,7 +1315,7 @@ int main(int argc,char *argv[]) - - put_info("Welcome to the MySQL monitor. Commands end with ; or \\g.", - INFO_INFO); -- sprintf((char*) glob_buffer.ptr(), -+ snprintf((char*) glob_buffer.ptr(), glob_buffer.alloced_length(), - "Your MySQL connection id is %lu\nServer version: %s\n", - mysql_thread_id(&mysql), server_version_string(&mysql)); - put_info((char*) glob_buffer.ptr(),INFO_INFO); diff --git a/debian/patches/mysql-5.6.16_wsrep_25.5.patch b/debian/patches/mysql-5.6.16_wsrep_25.5.patch deleted file mode 100644 index 89f194fb..00000000 --- a/debian/patches/mysql-5.6.16_wsrep_25.5.patch +++ /dev/null @@ -1,22742 +0,0 @@ -=== modified file 'CMakeLists.txt' ---- old/CMakeLists.txt 2013-12-18 10:17:16 +0000 -+++ new/CMakeLists.txt 2014-03-11 21:17:40 +0000 -@@ -193,6 +193,7 @@ - INCLUDE(install_macros) - INCLUDE(install_layout) - INCLUDE(mysql_add_executable) -+INCLUDE(wsrep) - - # Handle options - OPTION(DISABLE_SHARED -@@ -326,6 +327,11 @@ - OPTION(INNODB_COMPILER_HINTS "Compile InnoDB with compiler hints" ON) - MARK_AS_ADVANCED(INNODB_COMPILER_HINTS) - -+OPTION(WITH_INNODB_DISALLOW_WRITES "InnoDB freeze writes patch from Google" ${WITH_WSREP}) -+IF (WITH_INNODB_DISALLOW_WRITES) -+ SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWITH_INNODB_DISALLOW_WRITES") -+ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DWITH_INNODB_DISALLOW_WRITES") -+ENDIF() - OPTION(INNODB_PAGE_ATOMIC_REF_COUNT "Use atomics for the page reference count" - ON) - MARK_AS_ADVANCED(INNODB_PAGE_ATOMIC_REF_COUNT) -@@ -453,6 +459,9 @@ - ADD_SUBDIRECTORY(mysys) - ADD_SUBDIRECTORY(mysys_ssl) - ADD_SUBDIRECTORY(libmysql) -+IF(WITH_WSREP) -+ADD_SUBDIRECTORY(wsrep) -+ENDIF() - - IF(WITH_UNIT_TESTS) - ADD_SUBDIRECTORY(unittest) -@@ -551,7 +560,7 @@ - INSTALL(FILES README DESTINATION ${INSTALL_DOCREADMEDIR} COMPONENT Readme) - INSTALL(FILES ${CMAKE_BINARY_DIR}/Docs/INFO_SRC ${CMAKE_BINARY_DIR}/Docs/INFO_BIN DESTINATION ${INSTALL_DOCDIR}) - IF(UNIX) -- INSTALL(FILES Docs/INSTALL-BINARY DESTINATION ${INSTALL_DOCREADMEDIR} COMPONENT Readme) -+ INSTALL(FILES Docs/INSTALL-BINARY Docs/README-wsrep DESTINATION ${INSTALL_DOCREADMEDIR} COMPONENT Readme) - ENDIF() - # MYSQL_DOCS_LOCATON is used in "make dist", points to the documentation directory - SET(MYSQL_DOCS_LOCATION "" CACHE PATH "Location from where documentation is copied") -@@ -559,6 +568,7 @@ - INSTALL(DIRECTORY Docs/ DESTINATION ${INSTALL_DOCDIR} - COMPONENT Documentation - PATTERN "INSTALL-BINARY" EXCLUDE -+ PATTERN "README-wsrep" EXCLUDE - PATTERN "Makefile.*" EXCLUDE - PATTERN "glibc*" EXCLUDE - PATTERN "linuxthreads.txt" EXCLUDE - -=== added file 'Docs/README-wsrep' ---- old/Docs/README-wsrep 1970-01-01 00:00:00 +0000 -+++ new/Docs/README-wsrep 2013-09-01 09:27:10 +0000 -@@ -0,0 +1,487 @@ -+Codership Oy -+http://www.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 -+ -+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 -+ -+ 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 /24 --destination /32 --dport 3306 -j ACCEPT -+# iptables --insert RH-Firewall-1-INPUT 1 --proto tcp --source /24 --destination /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=''; -+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 -+
[: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
part -+ will be used to listen for SST (see below). And the whole
[: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 most tested. -+ - rsync: much faster on large datasets. -+ - 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: -+ datadir= -+ [client] -+ 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 -+ : -+ 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. -+ - -=== modified file 'cmake/configure.pl' ---- old/cmake/configure.pl 2013-02-26 05:45:28 +0000 -+++ new/cmake/configure.pl 2013-07-02 22:16:00 +0000 -@@ -223,6 +223,16 @@ - $cmakeargs = $cmakeargs." \"-DWITH_COMMENT=".substr($option,13)."\""; - next; - } -+ if ($option =~ /layout=/) -+ { -+ $cmakeargs = $cmakeargs." -DINSTALL_LAYOUT=".substr($option,7); -+ next; -+ } -+ if ($option =~ /with-unix-socket-path=/) -+ { -+ $cmakeargs = $cmakeargs." -DMYSQL_UNIX_ADDR=".substr($option,22); -+ next; -+ } - if ($option =~ /mysql-maintainer-mode/) - { - $cmakeargs = $cmakeargs." -DMYSQL_MAINTAINER_MODE=" . - -=== modified file 'cmake/install_macros.cmake' ---- old/cmake/install_macros.cmake 2013-06-25 06:54:02 +0000 -+++ new/cmake/install_macros.cmake 2014-03-08 05:20:50 +0000 -@@ -13,8 +13,34 @@ - # along with this program; if not, write to the Free Software - # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -+if(APPLE) -+ LIST(APPEND CMAKE_CXX_LINK_EXECUTABLE "dsymutil ") -+ LIST(APPEND CMAKE_C_LINK_EXECUTABLE "dsymutil ") -+ LIST(APPEND CMAKE_CXX_CREATE_SHARED_LIBRARY "dsymutil ") -+ LIST(APPEND CMAKE_C_CREATE_SHARED_LIBRARY "dsymutil ") -+ LIST(APPEND CMAKE_CXX_CREATE_SHARED_MODULE "dsymutil ") -+ LIST(APPEND CMAKE_C_CREATE_SHARED_MODULE "dsymutil ") -+ENDIF() -+ - GET_FILENAME_COMPONENT(MYSQL_CMAKE_SCRIPT_DIR ${CMAKE_CURRENT_LIST_FILE} PATH) - INCLUDE(${MYSQL_CMAKE_SCRIPT_DIR}/cmake_parse_arguments.cmake) -+MACRO (INSTALL_DSYM_DIRECTORIES targets) -+ IF(APPLE) -+ FOREACH(target ${targets}) -+ GET_TARGET_PROPERTY(location ${target} LOCATION) -+ GET_TARGET_PROPERTY(type ${target} TYPE) -+ # It's a dirty hack, but cmake too stupid and mysql cmake files too buggy */ -+ STRING(REGEX REPLACE "/liblibmysql.dylib$" "/libmysqlclient.${SHARED_LIB_MAJOR_VERSION}.dylib" location ${location}) -+ IF(DEBUG_EXTNAME) -+ STRING(REGEX REPLACE "/mysqld$" "/mysqld-debug" location ${location}) -+ ENDIF() -+ IF(type MATCHES "EXECUTABLE" OR type MATCHES "MODULE" OR type MATCHES "SHARED_LIBRARY") -+ INSTALL(DIRECTORY "${location}.dSYM" DESTINATION ${INSTALL_LOCATION} COMPONENT Debuginfo) -+ ENDIF() -+ ENDFOREACH() -+ ENDIF() -+ENDMACRO() -+ - MACRO (INSTALL_DEBUG_SYMBOLS targets) - IF(MSVC) - FOREACH(target ${targets}) -@@ -232,6 +258,7 @@ - INSTALL(TARGETS ${TARGETS} DESTINATION ${ARG_DESTINATION} ${COMP}) - SET(INSTALL_LOCATION ${ARG_DESTINATION} ) - INSTALL_DEBUG_SYMBOLS("${TARGETS}") -+ INSTALL_DSYM_DIRECTORIES("${TARGETS}") - SET(INSTALL_LOCATION) - ENDFUNCTION() - - -=== modified file 'cmake/os/FreeBSD.cmake' ---- old/cmake/os/FreeBSD.cmake 2010-06-23 14:19:19 +0000 -+++ new/cmake/os/FreeBSD.cmake 2013-09-01 09:27:10 +0000 -@@ -22,3 +22,5 @@ - - # The below was used for really old versions of FreeBSD, roughly: before 5.1.9 - # ADD_DEFINITIONS(-DHAVE_BROKEN_REALPATH) -+ -+SET(HAVE_SYS_TIMEB_H CACHE INTERNAL "") - -=== added file 'cmake/wsrep.cmake' ---- old/cmake/wsrep.cmake 1970-01-01 00:00:00 +0000 -+++ new/cmake/wsrep.cmake 2014-03-11 16:56:46 +0000 -@@ -0,0 +1,59 @@ -+# Copyright (c) 2011, Codership Oy . -+# -+# 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 "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)" OFF) -+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) -+ENDIF() -+ -+# - -=== modified file 'include/my_md5.h' ---- old/include/my_md5.h 2013-03-20 05:56:02 +0000 -+++ new/include/my_md5.h 2013-07-03 10:10:34 +0000 -@@ -43,7 +43,11 @@ - *to++= _dig_vec_lower[((uchar) *str) & 0x0F]; - } - } -- -+#ifdef WITH_WSREP -+void *wsrep_md5_init(); -+void wsrep_md5_update(void *ctx, char* buf, int len); -+ void wsrep_compute_md5_hash(char *digest, void *ctx); -+#endif - #ifdef __cplusplus - } - #endif - -=== modified file 'include/thr_lock.h' ---- old/include/thr_lock.h 2011-09-07 10:08:09 +0000 -+++ new/include/thr_lock.h 2014-01-09 15:46:55 +0000 -@@ -20,6 +20,15 @@ - #ifdef __cplusplus - extern "C" { - #endif -+#ifdef WITH_WSREP -+#include -+ typedef my_bool (* wsrep_thd_is_brute_force_fun)(void *, my_bool); -+ typedef int (* wsrep_abort_thd_fun)(void *, void *, my_bool); -+ typedef int (* wsrep_on_fun)(void *); -+ void wsrep_thr_lock_init( -+ wsrep_thd_is_brute_force_fun bf_fun, wsrep_abort_thd_fun abort_fun, -+ my_bool debug, my_bool convert_LOCK_to_trx, wsrep_on_fun on_fun); -+#endif - - #include - #include -@@ -89,6 +98,10 @@ - { - pthread_t thread; - my_thread_id thread_id; -+#ifdef WITH_WSREP -+ void *mysql_thd; // THD pointer -+ my_bool in_lock_tables; // true, if inside locking session -+#endif - } THR_LOCK_INFO; - - - -=== modified file 'mysql-test/r/information_schema.result' ---- old/mysql-test/r/information_schema.result 2012-10-25 09:54:03 +0000 -+++ new/mysql-test/r/information_schema.result 2013-01-06 18:49:20 +0000 -@@ -1664,9 +1664,7 @@ - drop table if exists t1;drop table if exists t1; - drop table if exists t1;drop table if exists t1; - drop table if exists t1;drop table if exists t1; --drop table if exists t1;drop table if exists --Warnings: --Warning 1265 Data truncated for column 'VARIABLE_VALUE' at row 1 -+drop table if exists t1;drop table if exists t1; - set global init_connect=""; - create table t0 select * from information_schema.global_status where VARIABLE_NAME='COM_SELECT'; - SELECT 1; - -=== modified file 'mysql-test/r/show_check.result' ---- old/mysql-test/r/show_check.result 2013-01-30 17:19:19 +0000 -+++ new/mysql-test/r/show_check.result 2013-07-02 22:16:00 +0000 -@@ -101,19 +101,19 @@ - show variables like "wait_timeout%"; - Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr - def information_schema VARIABLES VARIABLES VARIABLE_NAME Variable_name 253 64 12 N 1 0 8 --def information_schema VARIABLES VARIABLES VARIABLE_VALUE Value 253 1024 5 Y 0 0 8 -+def information_schema VARIABLES VARIABLES VARIABLE_VALUE Value 253 2048 5 Y 0 0 8 - Variable_name Value - wait_timeout 28800 - show variables like "WAIT_timeout%"; - Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr - def information_schema VARIABLES VARIABLES VARIABLE_NAME Variable_name 253 64 12 N 1 0 8 --def information_schema VARIABLES VARIABLES VARIABLE_VALUE Value 253 1024 5 Y 0 0 8 -+def information_schema VARIABLES VARIABLES VARIABLE_VALUE Value 253 2048 5 Y 0 0 8 - Variable_name Value - wait_timeout 28800 - show variables like "this_doesn't_exists%"; - Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr - def information_schema VARIABLES VARIABLES VARIABLE_NAME Variable_name 253 64 0 N 1 0 8 --def information_schema VARIABLES VARIABLES VARIABLE_VALUE Value 253 1024 0 Y 0 0 8 -+def information_schema VARIABLES VARIABLES VARIABLE_VALUE Value 253 2048 0 Y 0 0 8 - Variable_name Value - show table status from test like "this_doesn't_exists%"; - Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr - -=== modified file 'mysql-test/suite/innodb/r/innodb-autoinc.result' ---- old/mysql-test/suite/innodb/r/innodb-autoinc.result 2012-08-27 10:23:48 +0000 -+++ new/mysql-test/suite/innodb/r/innodb-autoinc.result 2013-01-06 18:49:20 +0000 -@@ -201,6 +201,7 @@ - Variable_name Value - auto_increment_increment 100 - auto_increment_offset 10 -+wsrep_auto_increment_control ON - DROP TABLE IF EXISTS t1; - Warnings: - Note 1051 Unknown table 'test.t1' -@@ -234,6 +235,7 @@ - Variable_name Value - auto_increment_increment 1 - auto_increment_offset 1 -+wsrep_auto_increment_control ON - DROP TABLE IF EXISTS t1; - Warnings: - Note 1051 Unknown table 'test.t1' -@@ -273,6 +275,7 @@ - Variable_name Value - auto_increment_increment 1 - auto_increment_offset 1 -+wsrep_auto_increment_control ON - DROP TABLE IF EXISTS t1; - Warnings: - Note 1051 Unknown table 'test.t1' -@@ -286,6 +289,7 @@ - Variable_name Value - auto_increment_increment 100 - auto_increment_offset 10 -+wsrep_auto_increment_control ON - INSERT INTO t1 VALUES (-2), (NULL),(2),(NULL); - INSERT INTO t1 VALUES (250),(NULL); - SELECT * FROM t1; -@@ -319,6 +323,7 @@ - Variable_name Value - auto_increment_increment 1 - auto_increment_offset 1 -+wsrep_auto_increment_control ON - DROP TABLE IF EXISTS t1; - Warnings: - Note 1051 Unknown table 'test.t1' -@@ -334,6 +339,7 @@ - Variable_name Value - auto_increment_increment 100 - auto_increment_offset 10 -+wsrep_auto_increment_control ON - INSERT INTO t1 VALUES (-2); - Warnings: - Warning 1264 Out of range value for column 'c1' at row 1 -@@ -374,6 +380,7 @@ - Variable_name Value - auto_increment_increment 1 - auto_increment_offset 1 -+wsrep_auto_increment_control ON - DROP TABLE IF EXISTS t1; - Warnings: - Note 1051 Unknown table 'test.t1' -@@ -389,6 +396,7 @@ - Variable_name Value - auto_increment_increment 100 - auto_increment_offset 10 -+wsrep_auto_increment_control ON - INSERT INTO t1 VALUES (-2),(NULL),(2),(NULL); - Warnings: - Warning 1264 Out of range value for column 'c1' at row 1 -@@ -423,6 +431,7 @@ - Variable_name Value - auto_increment_increment 1 - auto_increment_offset 1 -+wsrep_auto_increment_control ON - DROP TABLE IF EXISTS t1; - Warnings: - Note 1051 Unknown table 'test.t1' -@@ -438,6 +447,7 @@ - Variable_name Value - auto_increment_increment 2 - auto_increment_offset 10 -+wsrep_auto_increment_control ON - INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL); - SELECT * FROM t1; - c1 -@@ -456,6 +466,7 @@ - Variable_name Value - auto_increment_increment 1 - auto_increment_offset 1 -+wsrep_auto_increment_control ON - DROP TABLE IF EXISTS t1; - Warnings: - Note 1051 Unknown table 'test.t1' -@@ -471,6 +482,7 @@ - Variable_name Value - auto_increment_increment 2 - auto_increment_offset 10 -+wsrep_auto_increment_control ON - INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL); - ERROR HY000: Failed to read auto-increment value from storage engine - SELECT * FROM t1; -@@ -484,6 +496,7 @@ - Variable_name Value - auto_increment_increment 1 - auto_increment_offset 1 -+wsrep_auto_increment_control ON - DROP TABLE IF EXISTS t1; - Warnings: - Note 1051 Unknown table 'test.t1' -@@ -499,6 +512,7 @@ - Variable_name Value - auto_increment_increment 5 - auto_increment_offset 7 -+wsrep_auto_increment_control ON - INSERT INTO t1 VALUES (NULL),(NULL), (NULL); - ERROR HY000: Failed to read auto-increment value from storage engine - SELECT * FROM t1; -@@ -512,6 +526,7 @@ - Variable_name Value - auto_increment_increment 1 - auto_increment_offset 1 -+wsrep_auto_increment_control ON - DROP TABLE IF EXISTS t1; - Warnings: - Note 1051 Unknown table 'test.t1' -@@ -531,6 +546,7 @@ - Variable_name Value - auto_increment_increment 3 - auto_increment_offset 3 -+wsrep_auto_increment_control ON - INSERT INTO t1 VALUES (NULL),(NULL), (NULL); - SELECT * FROM t1; - c1 -@@ -548,6 +564,7 @@ - Variable_name Value - auto_increment_increment 1 - auto_increment_offset 1 -+wsrep_auto_increment_control ON - DROP TABLE IF EXISTS t1; - Warnings: - Note 1051 Unknown table 'test.t1' -@@ -566,6 +583,7 @@ - Variable_name Value - auto_increment_increment 65535 - auto_increment_offset 65535 -+wsrep_auto_increment_control ON - INSERT INTO t1 VALUES (NULL),(NULL); - ERROR 22003: Out of range value for column 't1' at row 167 - SELECT * FROM t1; -@@ -579,6 +597,7 @@ - Variable_name Value - auto_increment_increment 1 - auto_increment_offset 1 -+wsrep_auto_increment_control ON - CREATE TABLE t1 (c1 DOUBLE NOT NULL AUTO_INCREMENT, c2 INT, PRIMARY KEY (c1)) ENGINE=InnoDB; - INSERT INTO t1 VALUES(NULL, 1); - INSERT INTO t1 VALUES(NULL, 2); -@@ -866,6 +885,7 @@ - Variable_name Value - auto_increment_increment 1 - auto_increment_offset 1 -+wsrep_auto_increment_control ON - CREATE TABLE t1 (c1 TINYINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; - INSERT INTO t1 VALUES (1, NULL); - INSERT INTO t1 VALUES (-1, 'innodb'); - -=== modified file 'mysql-test/suite/perfschema/r/dml_setup_instruments.result' ---- old/mysql-test/suite/perfschema/r/dml_setup_instruments.result 2013-10-11 15:31:42 +0000 -+++ new/mysql-test/suite/perfschema/r/dml_setup_instruments.result 2013-12-11 10:24:00 +0000 -@@ -34,6 +34,7 @@ - and name not in ( - 'wait/synch/cond/sql/COND_handler_count', - 'wait/synch/cond/sql/DEBUG_SYNC::cond') -+and name not like 'wait/synch/cond/sql/COND_wsrep_%' - order by name limit 10; - NAME ENABLED TIMED - wait/synch/cond/sql/COND_flush_thread_cache YES YES - -=== modified file 'mysql-test/suite/perfschema/t/dml_setup_instruments.test' ---- old/mysql-test/suite/perfschema/t/dml_setup_instruments.test 2012-04-03 11:53:52 +0000 -+++ new/mysql-test/suite/perfschema/t/dml_setup_instruments.test 2012-12-20 16:13:02 +0000 -@@ -36,7 +36,8 @@ - and name not in ( - 'wait/synch/cond/sql/COND_handler_count', - 'wait/synch/cond/sql/DEBUG_SYNC::cond') -- order by name limit 10; -+ and name not like 'wait/synch/cond/sql/COND_wsrep_%' -+order by name limit 10; - - --disable_result_log - select * from performance_schema.setup_instruments - -=== modified file 'mysql-test/suite/rpl/r/rpl_auto_increment.result' ---- old/mysql-test/suite/rpl/r/rpl_auto_increment.result 2013-05-29 10:37:30 +0000 -+++ new/mysql-test/suite/rpl/r/rpl_auto_increment.result 2013-08-21 19:07:07 +0000 -@@ -40,6 +40,7 @@ - Variable_name Value - auto_increment_increment 100 - auto_increment_offset 10 -+wsrep_auto_increment_control ON - create table t1 (a int not null auto_increment, primary key (a)) engine=myisam; - insert into t1 values (NULL),(5),(NULL); - insert into t1 values (250),(NULL); - -=== modified file 'mysys/thr_lock.c' ---- old/mysys/thr_lock.c 2011-09-07 10:08:09 +0000 -+++ new/mysys/thr_lock.c 2014-01-09 15:46:55 +0000 -@@ -82,7 +82,24 @@ - my_bool thr_lock_inited=0; - ulong locks_immediate = 0L, locks_waited = 0L; - enum thr_lock_type thr_upgraded_concurrent_insert_lock = TL_WRITE; -- -+#ifdef WITH_WSREP -+static wsrep_thd_is_brute_force_fun wsrep_thd_is_brute_force= NULL; -+static wsrep_abort_thd_fun wsrep_abort_thd= NULL; -+static my_bool wsrep_debug; -+static my_bool wsrep_convert_LOCK_to_trx; -+static wsrep_on_fun wsrep_on = NULL; -+ -+void wsrep_thr_lock_init( -+ wsrep_thd_is_brute_force_fun bf_fun, wsrep_abort_thd_fun abort_fun, -+ my_bool debug, my_bool convert_LOCK_to_trx, wsrep_on_fun on_fun -+) { -+ wsrep_thd_is_brute_force = bf_fun; -+ wsrep_abort_thd = abort_fun; -+ wsrep_debug = debug; -+ wsrep_convert_LOCK_to_trx= convert_LOCK_to_trx; -+ wsrep_on = on_fun; -+} -+#endif - /* The following constants are only for debug output */ - #define MAX_THREADS 100 - #define MAX_LOCKS 100 -@@ -536,6 +553,108 @@ - DBUG_RETURN(result); - } - -+#ifdef WITH_WSREP -+/* -+ * If brute force applier would need to wait for a thr lock, -+ * it needs to make sure that it will get the lock without (too much) -+ * delay. -+ * We identify here the owners of blocking locks and ask them to -+ * abort. We then put our lock request in the first place in the -+ * wait queue. When lock holders abort (one by one) the lock release -+ * algorithm should grant the lock to us. We rely on this and proceed -+ * to wait_for_locks(). -+ * wsrep_break_locks() should be called in all the cases, where lock -+ * wait would happen. -+ * -+ * TODO: current implementation might not cover all possible lock wait -+ * situations. This needs an review still. -+ * TODO: lock release, might favor some other lock (instead our bf). -+ * This needs an condition to check for bf locks first. -+ * TODO: we still have a debug fprintf, this should be removed -+ */ -+static inline my_bool -+wsrep_break_lock( -+ THR_LOCK_DATA *data, struct st_lock_list *lock_queue1, -+ struct st_lock_list *lock_queue2, struct st_lock_list *wait_queue) -+{ -+ if (wsrep_on(data->owner->mysql_thd) && -+ wsrep_thd_is_brute_force && -+ wsrep_thd_is_brute_force(data->owner->mysql_thd, TRUE)) -+ { -+ THR_LOCK_DATA *holder; -+ -+ /* if locking session conversion to transaction has been enabled, -+ we know that this conflicting lock must be read lock and furthermore, -+ lock holder is read-only. It is safe to wait for him. -+ */ -+#ifdef TODO -+ if (wsrep_convert_LOCK_to_trx && -+ (THD*)(data->owner->mysql_thd)->in_lock_tables) -+ { -+ if (wsrep_debug) -+ fprintf(stderr,"WSREP wsrep_break_lock read lock untouched\n"); -+ return FALSE; -+ } -+#endif -+ if (wsrep_debug) -+ fprintf(stderr,"WSREP wsrep_break_lock aborting locks\n"); -+ -+ /* aborting lock holder(s) here */ -+ for (holder=(lock_queue1) ? lock_queue1->data : NULL; -+ holder; -+ holder=holder->next) -+ { -+ if (!wsrep_thd_is_brute_force(holder->owner->mysql_thd, TRUE)) -+ { -+ wsrep_abort_thd(data->owner->mysql_thd, -+ holder->owner->mysql_thd, FALSE); -+ } -+ else -+ { -+ if (wsrep_debug) -+ fprintf(stderr,"WSREP wsrep_break_lock skipping BF lock conflict\n"); -+ return FALSE; -+ } -+ } -+ for (holder=(lock_queue2) ? lock_queue2->data : NULL; -+ holder; -+ holder=holder->next) -+ { -+ if (!wsrep_thd_is_brute_force(holder->owner->mysql_thd, TRUE)) -+ { -+ wsrep_abort_thd(data->owner->mysql_thd, -+ holder->owner->mysql_thd, FALSE); -+ } -+ else -+ { -+ if (wsrep_debug) -+ fprintf(stderr,"WSREP wsrep_break_lock skipping BF lock conflict\n"); -+ return FALSE; -+ } -+ } -+ -+ /* Add our lock to the head of the wait queue */ -+ if (*(wait_queue->last)==wait_queue->data) -+ { -+ wait_queue->last=&data->next; -+ assert(wait_queue->data==0); -+ } -+ else -+ { -+ assert(wait_queue->data!=0); -+ wait_queue->data->prev=&data->next; -+ } -+ data->next=wait_queue->data; -+ data->prev=&wait_queue->data; -+ wait_queue->data=data; -+ data->cond=get_cond(); -+ -+ statistic_increment(locks_immediate,&THR_LOCK_lock); -+ return TRUE; -+ } -+ return FALSE; -+} -+#endif - - enum enum_thr_lock_result - thr_lock(THR_LOCK_DATA *data, THR_LOCK_INFO *owner, -@@ -544,6 +663,9 @@ - THR_LOCK *lock=data->lock; - enum enum_thr_lock_result result= THR_LOCK_SUCCESS; - struct st_lock_list *wait_queue; -+#ifdef WITH_WSREP -+ my_bool wsrep_lock_inserted= FALSE; -+#endif - MYSQL_TABLE_WAIT_VARIABLES(locker, state) /* no ';' */ - DBUG_ENTER("thr_lock"); - -@@ -613,6 +735,13 @@ - } - if (lock->write.data->type == TL_WRITE_ONLY) - { -+#ifdef WITH_WSREP -+ if (wsrep_break_lock(data, &lock->write, NULL, &lock->read_wait)) -+ { -+ wsrep_lock_inserted= TRUE; -+ goto wsrep_read_wait; -+ } -+#endif - /* We are not allowed to get a READ lock in this case */ - data->type=TL_UNLOCK; - result= THR_LOCK_ABORTED; /* Can't wait for this one */ -@@ -640,6 +769,13 @@ - lock but a high priority write waiting in the write_wait queue. - In the latter case we should yield the lock to the writer. - */ -+#ifdef WITH_WSREP -+ if (wsrep_break_lock(data, &lock->write, NULL, &lock->read_wait)) -+ { -+ wsrep_lock_inserted= TRUE; -+ } -+ wsrep_read_wait: -+#endif - wait_queue= &lock->read_wait; - } - else /* Request for WRITE lock */ -@@ -648,12 +784,25 @@ - { - if (lock->write.data && lock->write.data->type == TL_WRITE_ONLY) - { -+#ifdef WITH_WSREP -+ if (wsrep_break_lock(data, &lock->write, NULL, &lock->write_wait)) -+ { -+ wsrep_lock_inserted=TRUE; -+ goto wsrep_write_wait; -+ } -+#endif - data->type=TL_UNLOCK; - result= THR_LOCK_ABORTED; /* Can't wait for this one */ - goto end; - } - if (lock->write.data || lock->read.data) - { -+#ifdef WITH_WSREP -+ if (wsrep_break_lock(data, &lock->write, NULL, &lock->write_wait)) -+ { -+ goto end; -+ } -+#endif - /* Add delayed write lock to write_wait queue, and return at once */ - (*lock->write_wait.last)=data; - data->prev=lock->write_wait.last; -@@ -678,6 +827,13 @@ - /* Allow lock owner to bypass TL_WRITE_ONLY. */ - if (!thr_lock_owner_equal(data->owner, lock->write.data->owner)) - { -+#ifdef WITH_WSREP -+ if (wsrep_break_lock(data, &lock->write, NULL, &lock->write_wait)) -+ { -+ wsrep_lock_inserted=TRUE; -+ goto wsrep_write_wait; -+ } -+#endif - /* We are not allowed to get a lock in this case */ - data->type=TL_UNLOCK; - result= THR_LOCK_ABORTED; /* Can't wait for this one */ -@@ -781,9 +937,20 @@ - DBUG_PRINT("lock",("write locked 3 by thread: 0x%lx type: %d", - lock->read.data->owner->thread_id, data->type)); - } -+#ifdef WITH_WSREP -+ if (wsrep_break_lock(data, &lock->write, NULL, &lock->write_wait)) -+ { -+ wsrep_lock_inserted= TRUE; -+ } -+ wsrep_write_wait: -+#endif - wait_queue= &lock->write_wait; - } - /* Can't get lock yet; Wait for it */ -+#ifdef WITH_WSREP -+ if (wsrep_on(data->owner->mysql_thd) && wsrep_lock_inserted) -+ DBUG_RETURN(wait_for_lock(wait_queue, data, 1, lock_wait_timeout)); -+#endif - result= wait_for_lock(wait_queue, data, 0, lock_wait_timeout); - MYSQL_END_TABLE_LOCK_WAIT(locker); - DBUG_RETURN(result); - -=== modified file 'mysys_ssl/my_default.cc' ---- old/mysys_ssl/my_default.cc 2013-03-20 05:56:02 +0000 -+++ new/mysys_ssl/my_default.cc 2013-10-11 17:08:12 +0000 -@@ -111,6 +111,11 @@ - - static my_bool defaults_already_read= FALSE; - -+#ifdef WITH_WSREP -+/* The only purpose of this global array is to hold full name of my.cnf -+ * which seems to be otherwise unavailable */ -+char wsrep_defaults_file[FN_REFLEN + 10]={0,}; -+#endif /* WITH_WREP */ - /* Set to TRUE, if --no-defaults is found. */ - static my_bool found_no_defaults= FALSE; - -@@ -895,6 +900,11 @@ - if ( !(fp = mysql_file_fopen(key_file_cnf, name, O_RDONLY, MYF(0)))) - return 1; /* Ignore wrong files */ - } -+#ifdef WITH_WSREP -+ /* make sure we do this only once - for top-level file */ -+ if ('\0' == wsrep_defaults_file[0]) -+ strncpy(wsrep_defaults_file, name, sizeof(wsrep_defaults_file) - 1); -+#endif /* WITH_WSREP */ - - while (mysql_file_getline(buff, sizeof(buff) - 1, fp)) - { - -=== modified file 'mysys_ssl/my_md5.cc' ---- old/mysys_ssl/my_md5.cc 2012-06-28 13:48:07 +0000 -+++ new/mysys_ssl/my_md5.cc 2013-09-04 17:36:53 +0000 -@@ -66,3 +66,34 @@ - my_md5_hash((unsigned char*)digest, (unsigned const char*)buf, len); - #endif /* HAVE_YASSL */ - } -+#ifdef WITH_WSREP -+void *wsrep_md5_init() -+{ -+#if defined(HAVE_YASSL) -+ TaoCrypt::MD5 *hasher= new TaoCrypt::MD5; -+ return (void*)hasher; -+#elif defined(HAVE_OPENSSL) -+ MD5_CTX *ctx = new MD5_CTX(); -+ MD5_Init (ctx); -+ return (void *)ctx; -+#endif /* HAVE_YASSL */ -+} -+void wsrep_md5_update(void *ctx, char* buf, int len) -+{ -+#if defined(HAVE_YASSL) -+ ((TaoCrypt::MD5 *)ctx)->Update((TaoCrypt::byte *) buf, len); -+#elif defined(HAVE_OPENSSL) -+ MD5_Update((MD5_CTX*)(ctx), buf, len); -+#endif /* HAVE_YASSL */ -+} -+void wsrep_compute_md5_hash(char *digest, void *ctx) -+{ -+#if defined(HAVE_YASSL) -+ ((TaoCrypt::MD5*)ctx)->Final((TaoCrypt::byte *) digest); -+ delete (TaoCrypt::MD5*)ctx; -+#elif defined(HAVE_OPENSSL) -+ MD5_Final ((unsigned char*)digest, (MD5_CTX*)ctx); -+ delete (MD5_CTX*)ctx; -+#endif /* HAVE_YASSL */ -+} -+#endif - -=== modified file 'plugin/innodb_memcached/daemon_memcached/CMakeLists.txt' ---- old/plugin/innodb_memcached/daemon_memcached/CMakeLists.txt 2013-12-03 02:09:33 +0000 -+++ new/plugin/innodb_memcached/daemon_memcached/CMakeLists.txt 2014-03-11 21:17:40 +0000 -@@ -78,7 +78,7 @@ - MYSQL_ADD_PLUGIN(libmemcached ${MEMCACHED_SOURCES} - MODULE_ONLY MODULE_OUTPUT_NAME "libmemcached") - --TARGET_LINK_LIBRARIES(libmemcached ${LIBEVENT_LIBRARY}) -+TARGET_LINK_LIBRARIES(libmemcached ${LIBEVENT_LIBRARY} ${LIBEVENT_LIBRARIES}) - TARGET_LINK_LIBRARIES(libmemcached memcached_utilities) - - IF(ENABLE_MEMCACHED_SASL) - -=== modified file 'scripts/CMakeLists.txt' ---- old/scripts/CMakeLists.txt 2014-01-06 06:03:08 +0000 -+++ new/scripts/CMakeLists.txt 2014-03-11 21:17:40 +0000 -@@ -323,6 +323,15 @@ - INSTALL_SCRIPT(${CMAKE_CURRENT_BINARY_DIR}/${file}.pl COMPONENT Server_Scripts) - ENDFOREACH() - ELSE() -+ IF(WITH_WSREP) -+ SET(WSREP_BINARIES -+ wsrep_sst_common -+ wsrep_sst_mysqldump -+ wsrep_sst_rsync -+ wsrep_sst_xtrabackup -+ wsrep_sst_xtrabackup-v2 -+ ) -+ ENDIF() - # On Unix, most of the files end up in the bin directory - SET(mysql_config_COMPONENT COMPONENT Development) - SET(BIN_SCRIPTS -@@ -339,6 +348,7 @@ - mysqldumpslow - mysqld_multi - mysqld_safe -+ ${WSREP_BINARIES} - ) - FOREACH(file ${BIN_SCRIPTS}) - IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${file}.sh) - -=== modified file 'scripts/mysqld_safe.sh' ---- old/scripts/mysqld_safe.sh 2013-09-21 02:32:44 +0000 -+++ new/scripts/mysqld_safe.sh 2013-12-11 10:24:00 +0000 -@@ -144,7 +144,7 @@ - } - - eval_log_error () { -- cmd="$1" -+ local cmd="$1" - case $logging in - file) cmd="$cmd >> "`shell_quote_string "$err_log"`" 2>&1" ;; - syslog) -@@ -172,6 +172,78 @@ - echo "$1" | sed -e 's,\([^a-zA-Z0-9/_.=-]\),\\\1,g' - } - -+wsrep_pick_url() { -+ [ $# -eq 0 ] && return 0 -+ -+ log_error "WSREP: 'wsrep_urls' is DEPRECATED! Use wsrep_cluster_address to specify multiple addresses instead." -+ -+ if ! which nc >/dev/null; then -+ log_error "ERROR: nc tool not found in PATH! Make sure you have it installed." -+ return 1 -+ fi -+ -+ local url -+ # Assuming URL in the form scheme://host:port -+ # If host and port are not NULL, the liveness of URL is assumed to be tested -+ # If port part is absent, the url is returned literally and unconditionally -+ # If every URL has port but none is reachable, nothing is returned -+ for url in `echo $@ | sed s/,/\ /g` 0; do -+ local host=`echo $url | cut -d \: -f 2 | sed s/^\\\/\\\///` -+ local port=`echo $url | cut -d \: -f 3` -+ [ -z "$port" ] && break -+ nc -z "$host" $port >/dev/null && break -+ done -+ -+ if [ "$url" == "0" ]; then -+ log_error "ERROR: none of the URLs in '$@' is reachable." -+ return 1 -+ fi -+ -+ echo $url -+} -+ -+# Run mysqld with --wsrep-recover and parse recovered position from log. -+# Position will be stored in wsrep_start_position_opt global. -+wsrep_start_position_opt="" -+wsrep_recover_position() { -+ local mysqld_cmd="$@" -+ local euid=$(id -u) -+ local ret=0 -+ -+ local wr_logfile=$(mktemp $DATADIR/wsrep_recovery.XXXXXX) -+ -+ [ "$euid" = "0" ] && chown $user $wr_logfile -+ chmod 600 $wr_logfile -+ -+ local wr_pidfile="$DATADIR/"`@HOSTNAME@`"-recover.pid" -+ -+ local wr_options="--log_error='$wr_logfile' --pid-file='$wr_pidfile'" -+ -+ log_notice "WSREP: Running position recovery with $wr_options" -+ -+ eval_log_error "$mysqld_cmd --wsrep_recover $wr_options" -+ -+ local rp="$(grep 'WSREP: Recovered position:' $wr_logfile)" -+ if [ -z "$rp" ]; then -+ local skipped="$(grep WSREP $wr_logfile | grep 'skipping position recovery')" -+ if [ -z "$skipped" ]; then -+ log_error "WSREP: Failed to recover position: " `cat $wr_logfile`; -+ ret=1 -+ else -+ log_notice "WSREP: Position recovery skipped" -+ fi -+ else -+ local start_pos="$(echo $rp | sed 's/.*WSREP\:\ Recovered\ position://' \ -+ | sed 's/^[ \t]*//')" -+ log_notice "WSREP: Recovered position $start_pos" -+ wsrep_start_position_opt="--wsrep_start_position=$start_pos" -+ fi -+ -+ rm $wr_logfile -+ -+ return $ret -+} -+ - parse_arguments() { - # We only need to pass arguments through to the server if we don't - # handle them here. So, we collect unrecognized options (passed on -@@ -227,7 +299,13 @@ - --skip-syslog) want_syslog=0 ;; - --syslog-tag=*) syslog_tag="$val" ;; - --timezone=*) TZ="$val"; export TZ; ;; -- -+ --wsrep[-_]urls=*) wsrep_urls="$val"; ;; -+ --wsrep[-_]provider=*) -+ if test -n "$val" && test "$val" != "none" -+ then -+ wsrep_restart=1 -+ fi -+ ;; - --help) usage ;; - - *) -@@ -766,7 +844,8 @@ - done - cmd="$cmd $args" - # Avoid 'nohup: ignoring input' warning --test -n "$NOHUP_NICENESS" && cmd="$cmd < /dev/null" -+nohup_redir="" -+test -n "$NOHUP_NICENESS" && nohup_redir=" < /dev/null" - - log_notice "Starting $MYSQLD daemon with databases from $DATADIR" - -@@ -777,13 +856,28 @@ - # flag whether a usable sleep command exists - have_sleep=1 - -+# maximum number of wsrep restarts -+max_wsrep_restarts=0 -+ - while true - do - rm -f $safe_mysql_unix_port "$pid_file" # Some extra safety - - start_time=`date +%M%S` - -- eval_log_error "$cmd" -+ # this sets wsrep_start_position_opt -+ wsrep_recover_position "$cmd" -+ -+ [ $? -ne 0 ] && exit 1 # -+ -+ [ -n "$wsrep_urls" ] && url=`wsrep_pick_url $wsrep_urls` # check connect address -+ -+ if [ -z "$url" ] -+ then -+ eval_log_error "$cmd $wsrep_start_position_opt $nohup_redir" -+ else -+ eval_log_error "$cmd $wsrep_start_position_opt --wsrep_cluster_address=$url $nohup_redir" -+ fi - - if [ $want_syslog -eq 0 -a ! -f "$err_log" ]; then - touch "$err_log" # hypothetical: log was renamed but not -@@ -853,6 +947,20 @@ - I=`expr $I + 1` - done - fi -+ -+ if [ -n "$wsrep_restart" ] -+ then -+ if [ $wsrep_restart -le $max_wsrep_restarts ] -+ then -+ wsrep_restart=`expr $wsrep_restart + 1` -+ log_notice "WSREP: sleeping 15 seconds before restart" -+ sleep 15 -+ else -+ log_notice "WSREP: not restarting wsrep node automatically" -+ break -+ fi -+ fi -+ - log_notice "mysqld restarted" - done - - -=== added file 'scripts/wsrep_sst_common.sh' ---- old/scripts/wsrep_sst_common.sh 1970-01-01 00:00:00 +0000 -+++ new/scripts/wsrep_sst_common.sh 2014-03-08 05:20:50 +0000 -@@ -0,0 +1,133 @@ -+# Copyright (C) 2012 Codership Oy -+# -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; version 2 of the License. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program; see the file COPYING. If not, write to the -+# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston -+# MA 02110-1301 USA. -+ -+# This is a common command line parser to be sourced by other SST scripts -+ -+set -u -+ -+WSREP_SST_OPT_BYPASS=0 -+WSREP_SST_OPT_BINLOG="" -+WSREP_SST_OPT_DATA="" -+ -+while [ $# -gt 0 ]; do -+case "$1" in -+ '--address') -+ readonly WSREP_SST_OPT_ADDR="$2" -+ shift -+ ;; -+ '--auth') -+ WSREP_SST_OPT_AUTH="$2" -+ shift -+ ;; -+ '--bypass') -+ WSREP_SST_OPT_BYPASS=1 -+ ;; -+ '--datadir') -+ readonly WSREP_SST_OPT_DATA="$2" -+ shift -+ ;; -+ '--defaults-file') -+ readonly WSREP_SST_OPT_CONF="$2" -+ shift -+ ;; -+ '--host') -+ readonly WSREP_SST_OPT_HOST="$2" -+ shift -+ ;; -+ '--local-port') -+ readonly WSREP_SST_OPT_LPORT="$2" -+ shift -+ ;; -+ '--parent') -+ readonly WSREP_SST_OPT_PARENT="$2" -+ shift -+ ;; -+ '--password') -+ readonly WSREP_SST_OPT_PSWD="$2" -+ shift -+ ;; -+ '--port') -+ readonly WSREP_SST_OPT_PORT="$2" -+ shift -+ ;; -+ '--role') -+ readonly WSREP_SST_OPT_ROLE="$2" -+ shift -+ ;; -+ '--socket') -+ readonly WSREP_SST_OPT_SOCKET="$2" -+ shift -+ ;; -+ '--user') -+ readonly WSREP_SST_OPT_USER="$2" -+ shift -+ ;; -+ '--gtid') -+ readonly WSREP_SST_OPT_GTID="$2" -+ shift -+ ;; -+ '--binlog') -+ WSREP_SST_OPT_BINLOG="$2" -+ shift -+ ;; -+ *) # must be command -+ # usage -+ # exit 1 -+ ;; -+esac -+shift -+done -+readonly WSREP_SST_OPT_BYPASS -+readonly WSREP_SST_OPT_BINLOG -+ -+# For Bug:1200727 -+if my_print_defaults -c $WSREP_SST_OPT_CONF sst | grep -q "wsrep_sst_auth";then -+ if [ -z $WSREP_SST_OPT_AUTH -o $WSREP_SST_OPT_AUTH = "(null)" ];then -+ WSREP_SST_OPT_AUTH=$(my_print_defaults -c $WSREP_SST_OPT_CONF sst | grep -- "--wsrep_sst_auth" | cut -d= -f2) -+ fi -+fi -+ -+if [ -n "${WSREP_SST_OPT_DATA:-}" ] -+then -+ SST_PROGRESS_FILE="$WSREP_SST_OPT_DATA/sst_in_progress" -+else -+ SST_PROGRESS_FILE="" -+fi -+ -+ -+wsrep_log() -+{ -+ # echo everything to stderr so that it gets into common error log -+ # deliberately made to look different from the rest of the log -+ local readonly tst="$(date +%Y%m%d\ %H:%M:%S.%N | cut -b -21)" -+ echo "WSREP_SST: $* ($tst)" >&2 -+} -+ -+wsrep_log_error() -+{ -+ wsrep_log "[ERROR] $*" -+} -+ -+wsrep_log_info() -+{ -+ wsrep_log "[INFO] $*" -+} -+ -+wsrep_cleanup_progress_file() -+{ -+ [ -n "$SST_PROGRESS_FILE" ] && rm -f "$SST_PROGRESS_FILE" 2>/dev/null -+} -+ - -=== added file 'scripts/wsrep_sst_mysqldump.sh' ---- old/scripts/wsrep_sst_mysqldump.sh 1970-01-01 00:00:00 +0000 -+++ new/scripts/wsrep_sst_mysqldump.sh 2013-09-04 17:36:53 +0000 -@@ -0,0 +1,126 @@ -+#!/bin/sh -e -+# Copyright (C) 2009 Codership Oy -+# -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; version 2 of the License. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program; see the file COPYING. If not, write to the -+# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston -+# MA 02110-1301 USA. -+ -+# This is a reference script for mysqldump-based state snapshot tansfer -+ -+. $(dirname $0)/wsrep_sst_common -+ -+EINVAL=22 -+ -+local_ip() -+{ -+ PATH=$PATH:/usr/sbin:/usr/bin:/sbin:/bin -+ -+ [ "$1" = "127.0.0.1" ] && return 0 -+ [ "$1" = "localhost" ] && return 0 -+ [ "$1" = "$(hostname -s)" ] && return 0 -+ [ "$1" = "$(hostname -f)" ] && return 0 -+ [ "$1" = "$(hostname -d)" ] && return 0 -+ -+ # Now if ip program is not found in the path, we can't return 0 since -+ # it would block any address. Thankfully grep should fail in this case -+ ip route get "$1" | grep local >/dev/null && return 0 -+ -+ return 1 -+} -+ -+if test -z "$WSREP_SST_OPT_USER"; then wsrep_log_error "USER cannot be nil"; exit $EINVAL; fi -+if test -z "$WSREP_SST_OPT_HOST"; then wsrep_log_error "HOST cannot be nil"; exit $EINVAL; fi -+if test -z "$WSREP_SST_OPT_PORT"; then wsrep_log_error "PORT cannot be nil"; exit $EINVAL; fi -+if test -z "$WSREP_SST_OPT_LPORT"; then wsrep_log_error "LPORT cannot be nil"; exit $EINVAL; fi -+if test -z "$WSREP_SST_OPT_SOCKET";then wsrep_log_error "SOCKET cannot be nil";exit $EINVAL; fi -+if test -z "$WSREP_SST_OPT_GTID"; then wsrep_log_error "GTID cannot be nil"; exit $EINVAL; fi -+ -+if local_ip $WSREP_SST_OPT_HOST && \ -+ [ "$WSREP_SST_OPT_PORT" = "$WSREP_SST_OPT_LPORT" ] -+then -+ wsrep_log_error \ -+ "destination address '$WSREP_SST_OPT_HOST:$WSREP_SST_OPT_PORT' matches source address." -+ exit $EINVAL -+fi -+ -+# Check client version -+if ! mysql --version | grep 'Distrib 5.6' >/dev/null -+then -+ mysql --version >&2 -+ wsrep_log_error "this operation requires MySQL client version 5.6.x" -+ exit $EINVAL -+fi -+ -+AUTH="-u$WSREP_SST_OPT_USER" -+if test -n "$WSREP_SST_OPT_PSWD"; then AUTH="$AUTH -p$WSREP_SST_OPT_PSWD"; fi -+ -+STOP_WSREP="SET wsrep_on=OFF;" -+ -+# NOTE: we don't use --routines here because we're dumping mysql.proc table -+MYSQLDUMP="mysqldump $AUTH -S$WSREP_SST_OPT_SOCKET \ -+--add-drop-database --add-drop-table --skip-add-locks --create-options \ -+--disable-keys --extended-insert --skip-lock-tables --quick --set-charset \ -+--skip-comments --flush-privileges --all-databases" -+ -+# mysqldump cannot restore CSV tables, fix this issue -+CSV_TABLES_FIX=" -+set sql_mode=''; -+ -+USE mysql; -+ -+SET @str = IF (@@have_csv = 'YES', 'CREATE TABLE IF NOT EXISTS general_log (event_time TIMESTAMP NOT NULL, user_host MEDIUMTEXT NOT NULL, thread_id INTEGER NOT NULL, server_id INTEGER UNSIGNED NOT NULL, command_type VARCHAR(64) NOT NULL,argument MEDIUMTEXT NOT NULL) engine=CSV CHARACTER SET utf8 comment=\"General log\"', 'SET @dummy = 0'); -+ -+PREPARE stmt FROM @str; -+EXECUTE stmt; -+DROP PREPARE stmt; -+ -+SET @str = IF (@@have_csv = 'YES', 'CREATE TABLE IF NOT EXISTS slow_log (start_time TIMESTAMP NOT NULL, user_host MEDIUMTEXT NOT NULL, query_time TIME NOT NULL, lock_time TIME NOT NULL, rows_sent INTEGER NOT NULL, rows_examined INTEGER NOT NULL, db VARCHAR(512) NOT NULL, last_insert_id INTEGER NOT NULL, insert_id INTEGER NOT NULL, server_id INTEGER UNSIGNED NOT NULL, sql_text MEDIUMTEXT NOT NULL) engine=CSV CHARACTER SET utf8 comment=\"Slow log\"', 'SET @dummy = 0'); -+ -+PREPARE stmt FROM @str; -+EXECUTE stmt; -+DROP PREPARE stmt;" -+ -+SET_START_POSITION="SET GLOBAL wsrep_start_position='$WSREP_SST_OPT_GTID';" -+ -+MYSQL="mysql $AUTH -h$WSREP_SST_OPT_HOST -P$WSREP_SST_OPT_PORT "\ -+"--disable-reconnect --connect_timeout=10" -+ -+# need to disable logging when loading the dump -+# reason is that dump contains ALTER TABLE for log tables, and -+# this causes an error if logging is enabled -+GENERAL_LOG_OPT=`$MYSQL --skip-column-names -e"$STOP_WSREP SELECT @@GENERAL_LOG"` -+SLOW_LOG_OPT=`$MYSQL --skip-column-names -e"$STOP_WSREP SELECT @@SLOW_QUERY_LOG"` -+$MYSQL -e"$STOP_WSREP SET GLOBAL GENERAL_LOG=OFF" -+$MYSQL -e"$STOP_WSREP SET GLOBAL SLOW_QUERY_LOG=OFF" -+ -+# commands to restore log settings -+RESTORE_GENERAL_LOG="SET GLOBAL GENERAL_LOG=$GENERAL_LOG_OPT;" -+RESTORE_SLOW_QUERY_LOG="SET GLOBAL SLOW_QUERY_LOG=$SLOW_LOG_OPT;" -+ -+# reset master for 5.6 to clear GTID_EXECUTED -+RESET_MASTER="RESET MASTER;" -+ -+ -+if [ $WSREP_SST_OPT_BYPASS -eq 0 ] -+then -+# commented out from dump command for 5.6: && echo $CSV_TABLES_FIX \ -+ (echo $STOP_WSREP && echo $RESET_MASTER && $MYSQLDUMP \ -+ && echo $RESTORE_GENERAL_LOG && echo $RESTORE_SLOW_QUERY_LOG \ -+ && echo $SET_START_POSITION \ -+ || echo "SST failed to complete;") | $MYSQL -+else -+ wsrep_log_info "Bypassing state dump." -+ echo $SET_START_POSITION | $MYSQL -+fi -+ -+# - -=== added file 'scripts/wsrep_sst_rsync.sh' ---- old/scripts/wsrep_sst_rsync.sh 1970-01-01 00:00:00 +0000 -+++ new/scripts/wsrep_sst_rsync.sh 2014-02-28 00:37:33 +0000 -@@ -0,0 +1,320 @@ -+#!/bin/bash -ue -+ -+# Copyright (C) 2010 Codership Oy -+# -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; version 2 of the License. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program; see the file COPYING. If not, write to the -+# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston -+# MA 02110-1301 USA. -+ -+# This is a reference script for rsync-based state snapshot tansfer -+ -+RSYNC_PID= -+RSYNC_CONF= -+OS=$(uname) -+[ "$OS" == "Darwin" ] && export -n LD_LIBRARY_PATH -+ -+. $(dirname $0)/wsrep_sst_common -+ -+cleanup_joiner() -+{ -+ wsrep_log_info "Joiner cleanup." -+ local PID=$(cat "$RSYNC_PID" 2>/dev/null || echo 0) -+ [ "0" != "$PID" ] && kill $PID && sleep 0.5 && kill -9 $PID >/dev/null 2>&1 \ -+ || : -+ rm -rf "$RSYNC_CONF" -+ rm -rf "$MAGIC_FILE" -+ rm -rf "$RSYNC_PID" -+ wsrep_log_info "Joiner cleanup done." -+ if [ "${WSREP_SST_OPT_ROLE}" = "joiner" ];then -+ wsrep_cleanup_progress_file -+ fi -+} -+ -+check_pid() -+{ -+ local pid_file=$1 -+ [ -r "$pid_file" ] && ps -p $(cat $pid_file) >/dev/null 2>&1 -+} -+ -+check_pid_and_port() -+{ -+ local pid_file=$1 -+ local rsync_pid=$(cat $pid_file) -+ local rsync_port=$2 -+ -+ if [ "$OS" == "Darwin" -o "$OS" == "FreeBSD" ]; then -+ # no netstat --program(-p) option in Darwin and FreeBSD -+ check_pid $pid_file && \ -+ lsof -i -Pn 2>/dev/null | \ -+ grep "(LISTEN)" | grep ":$rsync_port" | grep -w '^rsync[[:space:]]\+'"$rsync_pid" >/dev/null -+ else -+ check_pid $pid_file && \ -+ netstat -lnpt 2>/dev/null | \ -+ grep LISTEN | grep \:$rsync_port | grep $rsync_pid/rsync >/dev/null -+ fi -+} -+ -+MAGIC_FILE="$WSREP_SST_OPT_DATA/rsync_sst_complete" -+rm -rf "$MAGIC_FILE" -+ -+BINLOG_TAR_FILE="$WSREP_SST_OPT_DATA/wsrep_sst_binlog.tar" -+BINLOG_N_FILES=1 -+rm -f "$BINLOG_TAR_FILE" || : -+ -+if ! [ -z $WSREP_SST_OPT_BINLOG ] -+then -+ BINLOG_DIRNAME=$(dirname $WSREP_SST_OPT_BINLOG) -+ BINLOG_FILENAME=$(basename $WSREP_SST_OPT_BINLOG) -+fi -+ -+WSREP_LOG_DIR=${WSREP_LOG_DIR:-""} -+# if WSREP_LOG_DIR env. variable is not set, try to get it from my.cnf -+if [ -z "$WSREP_LOG_DIR" ]; then -+ SCRIPT_DIR="$(cd $(dirname "$0"); pwd -P)" -+ WSREP_LOG_DIR=$($SCRIPT_DIR/my_print_defaults --defaults-file \ -+ "$WSREP_SST_OPT_CONF" mysqld server mysqld-5.6 \ -+ | grep -- '--innodb[-_]log[-_]group[-_]home[-_]dir=' \ -+ | cut -b 29- ) -+fi -+ -+if [ -n "$WSREP_LOG_DIR" ]; then -+ # handle both relative and absolute paths -+ WSREP_LOG_DIR=$(cd $WSREP_SST_OPT_DATA; mkdir -p "$WSREP_LOG_DIR"; cd $WSREP_LOG_DIR; pwd -P) -+else -+ # default to datadir -+ WSREP_LOG_DIR=$(cd $WSREP_SST_OPT_DATA; pwd -P) -+fi -+ -+# Old filter - include everything except selected -+# FILTER=(--exclude '*.err' --exclude '*.pid' --exclude '*.sock' \ -+# --exclude '*.conf' --exclude core --exclude 'galera.*' \ -+# --exclude grastate.txt --exclude '*.pem' \ -+# --exclude '*.[0-9][0-9][0-9][0-9][0-9][0-9]' --exclude '*.index') -+ -+# New filter - exclude everything except dirs (schemas) and innodb files -+FILTER=(-f '- /lost+found' -f '- /.fseventsd' -f '- /.Trashes' -+ -f '+ /wsrep_sst_binlog.tar' -f '+ /ib_lru_dump' -f '+ /ibdata*' -f '+ /*/' -f '- /*') -+ -+if [ "$WSREP_SST_OPT_ROLE" = "donor" ] -+then -+ -+ if [ $WSREP_SST_OPT_BYPASS -eq 0 ] -+ then -+ -+ FLUSHED="$WSREP_SST_OPT_DATA/tables_flushed" -+ rm -rf "$FLUSHED" -+ -+ # Use deltaxfer only for WAN -+ inv=$(basename $0) -+ [ "$inv" = "wsrep_sst_rsync_wan" ] && WHOLE_FILE_OPT="" \ -+ || WHOLE_FILE_OPT="--whole-file" -+ -+ echo "flush tables" -+ -+ # wait for tables flushed and state ID written to the file -+ while [ ! -r "$FLUSHED" ] && ! grep -q ':' "$FLUSHED" >/dev/null 2>&1 -+ do -+ sleep 0.2 -+ done -+ -+ STATE="$(cat $FLUSHED)" -+ rm -rf "$FLUSHED" -+ -+ sync -+ -+ if ! [ -z $WSREP_SST_OPT_BINLOG ] -+ then -+ # Prepare binlog files -+ pushd $BINLOG_DIRNAME &> /dev/null -+ binlog_files_full=$(tail -n $BINLOG_N_FILES ${BINLOG_FILENAME}.index) -+ binlog_files="" -+ for ii in $binlog_files_full -+ do -+ binlog_files="$binlog_files $(basename $ii)" -+ done -+ if ! [ -z "$binlog_files" ] -+ then -+ wsrep_log_info "Preparing binlog files for transfer:" -+ tar -cvf $BINLOG_TAR_FILE $binlog_files >&2 -+ fi -+ popd &> /dev/null -+ fi -+ -+ # first, the normal directories, so that we can detect incompatible protocol -+ RC=0 -+ rsync --owner --group --perms --links --specials \ -+ --ignore-times --inplace --dirs --delete --quiet \ -+ $WHOLE_FILE_OPT "${FILTER[@]}" "$WSREP_SST_OPT_DATA/" \ -+ rsync://$WSREP_SST_OPT_ADDR >&2 || RC=$? -+ -+ if [ "$RC" -ne 0 ]; then -+ wsrep_log_error "rsync returned code $RC:" -+ -+ case $RC in -+ 12) RC=71 # EPROTO -+ wsrep_log_error \ -+ "rsync server on the other end has incompatible protocol. " \ -+ "Make sure you have the same version of rsync on all nodes." -+ ;; -+ 22) RC=12 # ENOMEM -+ ;; -+ *) RC=255 # unknown error -+ ;; -+ esac -+ exit $RC -+ fi -+ -+ # second, we transfer InnoDB log files -+ rsync --owner --group --perms --links --specials \ -+ --ignore-times --inplace --dirs --delete --quiet \ -+ $WHOLE_FILE_OPT -f '+ /ib_logfile[0-9]*' -f '- **' "$WSREP_LOG_DIR/" \ -+ rsync://$WSREP_SST_OPT_ADDR-log_dir >&2 || RC=$? -+ -+ if [ $RC -ne 0 ]; then -+ wsrep_log_error "rsync innodb_log_group_home_dir returned code $RC:" -+ exit 255 # unknown error -+ fi -+ -+ # then, we parallelize the transfer of database directories, use . so that pathconcatenation works -+ pushd "$WSREP_SST_OPT_DATA" >/dev/null -+ -+ count=1 -+ [ "$OS" == "Linux" ] && count=$(grep -c processor /proc/cpuinfo) -+ [ "$OS" == "Darwin" -o "$OS" == "FreeBSD" ] && count=$(sysctl -n hw.ncpu) -+ -+ find . -maxdepth 1 -mindepth 1 -type d -print0 | xargs -I{} -0 -P $count \ -+ rsync --owner --group --perms --links --specials \ -+ --ignore-times --inplace --recursive --delete --quiet \ -+ $WHOLE_FILE_OPT --exclude '*/ib_logfile*' "$WSREP_SST_OPT_DATA"/{}/ \ -+ rsync://$WSREP_SST_OPT_ADDR/{} >&2 || RC=$? -+ -+ popd >/dev/null -+ -+ if [ $RC -ne 0 ]; then -+ wsrep_log_error "find/rsync returned code $RC:" -+ exit 255 # unknown error -+ fi -+ -+ else # BYPASS -+ wsrep_log_info "Bypassing state dump." -+ STATE="$WSREP_SST_OPT_GTID" -+ fi -+ -+ echo "continue" # now server can resume updating data -+ -+ echo "$STATE" > "$MAGIC_FILE" -+ rsync --archive --quiet --checksum "$MAGIC_FILE" rsync://$WSREP_SST_OPT_ADDR -+ -+ echo "done $STATE" -+ -+elif [ "$WSREP_SST_OPT_ROLE" = "joiner" ] -+then -+ touch $SST_PROGRESS_FILE -+ MYSQLD_PID=$WSREP_SST_OPT_PARENT -+ -+ MODULE="rsync_sst" -+ -+ RSYNC_PID="$WSREP_SST_OPT_DATA/$MODULE.pid" -+ -+ if check_pid $RSYNC_PID -+ then -+ wsrep_log_error "rsync daemon already running." -+ exit 114 # EALREADY -+ fi -+ rm -rf "$RSYNC_PID" -+ -+ ADDR=$WSREP_SST_OPT_ADDR -+ RSYNC_PORT=$(echo $ADDR | awk -F ':' '{ print $2 }') -+ if [ -z "$RSYNC_PORT" ] -+ then -+ RSYNC_PORT=4444 -+ ADDR="$(echo $ADDR | awk -F ':' '{ print $1 }'):$RSYNC_PORT" -+ fi -+ -+ trap "exit 32" HUP PIPE -+ trap "exit 3" INT TERM ABRT -+ trap cleanup_joiner EXIT -+ -+ RSYNC_CONF="$WSREP_SST_OPT_DATA/$MODULE.conf" -+ -+cat << EOF > "$RSYNC_CONF" -+pid file = $RSYNC_PID -+use chroot = no -+read only = no -+timeout = 300 -+[$MODULE] -+ path = $WSREP_SST_OPT_DATA -+[$MODULE-log_dir] -+ path = $WSREP_LOG_DIR -+EOF -+ -+# rm -rf "$DATA"/ib_logfile* # we don't want old logs around -+ -+ # listen at all interfaces (for firewalled setups) -+ rsync --daemon --port $RSYNC_PORT --config "$RSYNC_CONF" -+ -+ until check_pid_and_port $RSYNC_PID $RSYNC_PORT -+ do -+ sleep 0.2 -+ done -+ -+ echo "ready $ADDR/$MODULE" -+ -+ # wait for SST to complete by monitoring magic file -+ while [ ! -r "$MAGIC_FILE" ] && check_pid "$RSYNC_PID" && \ -+ ps -p $MYSQLD_PID >/dev/null -+ do -+ sleep 1 -+ done -+ -+ if ! ps -p $MYSQLD_PID >/dev/null -+ then -+ wsrep_log_error \ -+ "Parent mysqld process (PID:$MYSQLD_PID) terminated unexpectedly." -+ exit 32 -+ fi -+ -+ if ! [ -z $WSREP_SST_OPT_BINLOG ] -+ then -+ -+ pushd $BINLOG_DIRNAME &> /dev/null -+ if [ -f $BINLOG_TAR_FILE ] -+ then -+ # Clean up old binlog files first -+ rm -f ${BINLOG_FILENAME}.* -+ wsrep_log_info "Extracting binlog files:" -+ tar -xvf $BINLOG_TAR_FILE >&2 -+ for ii in $(ls -1 ${BINLOG_FILENAME}.*) -+ do -+ echo ${BINLOG_DIRNAME}/${ii} >> ${BINLOG_FILENAME}.index -+ done -+ fi -+ popd &> /dev/null -+ fi -+ if [ -r "$MAGIC_FILE" ] -+ then -+ cat "$MAGIC_FILE" # output UUID:seqno -+ else -+ # this message should cause joiner to abort -+ echo "rsync process ended without creating '$MAGIC_FILE'" -+ fi -+ wsrep_cleanup_progress_file -+# cleanup_joiner -+else -+ wsrep_log_error "Unrecognized role: '$WSREP_SST_OPT_ROLE'" -+ exit 22 # EINVAL -+fi -+ -+rm -f $BINLOG_TAR_FILE || : -+ -+exit 0 - -=== added file 'scripts/wsrep_sst_xtrabackup-v2.sh' ---- old/scripts/wsrep_sst_xtrabackup-v2.sh 1970-01-01 00:00:00 +0000 -+++ new/scripts/wsrep_sst_xtrabackup-v2.sh 2014-03-12 14:45:00 +0000 -@@ -0,0 +1,875 @@ -+#!/bin/bash -ue -+# Copyright (C) 2013 Percona Inc -+# -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; version 2 of the License. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program; see the file COPYING. If not, write to the -+# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston -+# MA 02110-1301 USA. -+ -+# Documentation: http://www.percona.com/doc/percona-xtradb-cluster/manual/xtrabackup_sst.html -+# Make sure to read that before proceeding! -+ -+ -+ -+ -+. $(dirname $0)/wsrep_sst_common -+ -+ealgo="" -+ekey="" -+ekeyfile="" -+encrypt=0 -+nproc=1 -+ecode=0 -+XTRABACKUP_PID="" -+SST_PORT="" -+REMOTEIP="" -+tcert="" -+tpem="" -+tkey="" -+sockopt="" -+progress="" -+ttime=0 -+totime=0 -+lsn="" -+incremental=0 -+ecmd="" -+rlimit="" -+# Initially -+stagemsg="${WSREP_SST_OPT_ROLE}" -+cpat="" -+speciald=0 -+ib_home_dir="" -+ib_log_dir="" -+ -+sfmt="tar" -+strmcmd="" -+tfmt="" -+tcmd="" -+rebuild=0 -+rebuildcmd="" -+payload=0 -+pvformat="-F '%N => Rate:%r Avg:%a Elapsed:%t %e Bytes: %b %p' " -+pvopts="-f -i 10 -N $WSREP_SST_OPT_ROLE " -+STATDIR="" -+uextra=0 -+disver="" -+ -+scomp="" -+sdecomp="" -+ -+if which pv &>/dev/null && pv --help | grep -q FORMAT;then -+ pvopts+=$pvformat -+fi -+pcmd="pv $pvopts" -+declare -a RC -+ -+INNOBACKUPEX_BIN=innobackupex -+readonly AUTH=(${WSREP_SST_OPT_AUTH//:/ }) -+DATA="${WSREP_SST_OPT_DATA}" -+INFO_FILE="xtrabackup_galera_info" -+IST_FILE="xtrabackup_ist" -+MAGIC_FILE="${DATA}/${INFO_FILE}" -+ -+# Setting the path for ss and ip -+export PATH="/usr/sbin:/sbin:$PATH" -+ -+timeit(){ -+ local stage=$1 -+ shift -+ local cmd="$@" -+ local x1 x2 took extcode -+ -+ if [[ $ttime -eq 1 ]];then -+ x1=$(date +%s) -+ wsrep_log_info "Evaluating $cmd" -+ eval "$cmd" -+ extcode=$? -+ x2=$(date +%s) -+ took=$(( x2-x1 )) -+ wsrep_log_info "NOTE: $stage took $took seconds" -+ totime=$(( totime+took )) -+ else -+ wsrep_log_info "Evaluating $cmd" -+ eval "$cmd" -+ extcode=$? -+ fi -+ return $extcode -+} -+ -+get_keys() -+{ -+ # $encrypt -eq 1 is for internal purposes only -+ if [[ $encrypt -ge 2 || $encrypt -eq -1 ]];then -+ return -+ fi -+ -+ if [[ $encrypt -eq 0 ]];then -+ if my_print_defaults -c $WSREP_SST_OPT_CONF xtrabackup | grep -q encrypt;then -+ wsrep_log_error "Unexpected option combination. SST may fail. Refer to http://www.percona.com/doc/percona-xtradb-cluster/manual/xtrabackup_sst.html " -+ fi -+ return -+ fi -+ -+ if [[ $sfmt == 'tar' ]];then -+ wsrep_log_info "NOTE: Xtrabackup-based encryption - encrypt=1 - cannot be enabled with tar format" -+ encrypt=-1 -+ return -+ fi -+ -+ wsrep_log_info "Xtrabackup based encryption enabled in my.cnf - Supported only from Xtrabackup 2.1.4" -+ -+ if [[ -z $ealgo ]];then -+ wsrep_log_error "FATAL: Encryption algorithm empty from my.cnf, bailing out" -+ exit 3 -+ fi -+ -+ if [[ -z $ekey && ! -r $ekeyfile ]];then -+ wsrep_log_error "FATAL: Either key or keyfile must be readable" -+ exit 3 -+ fi -+ -+ if [[ -z $ekey ]];then -+ ecmd="xbcrypt --encrypt-algo=$ealgo --encrypt-key-file=$ekeyfile" -+ else -+ ecmd="xbcrypt --encrypt-algo=$ealgo --encrypt-key=$ekey" -+ fi -+ -+ if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]];then -+ ecmd+=" -d" -+ fi -+ -+ stagemsg+="-XB-Encrypted" -+} -+ -+get_transfer() -+{ -+ if [[ -z $SST_PORT ]];then -+ TSST_PORT=4444 -+ else -+ TSST_PORT=$SST_PORT -+ fi -+ -+ if [[ $tfmt == 'nc' ]];then -+ if [[ ! -x `which nc` ]];then -+ wsrep_log_error "nc(netcat) not found in path: $PATH" -+ exit 2 -+ fi -+ wsrep_log_info "Using netcat as streamer" -+ if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]];then -+ tcmd="nc -dl ${TSST_PORT}" -+ else -+ tcmd="nc ${REMOTEIP} ${TSST_PORT}" -+ fi -+ else -+ tfmt='socat' -+ wsrep_log_info "Using socat as streamer" -+ if [[ ! -x `which socat` ]];then -+ wsrep_log_error "socat not found in path: $PATH" -+ exit 2 -+ fi -+ -+ if [[ $encrypt -eq 2 || $encrypt -eq 3 ]] && ! socat -V | grep -q WITH_OPENSSL;then -+ wsrep_log_info "NOTE: socat is not openssl enabled, falling back to plain transfer" -+ encrypt=-1 -+ fi -+ -+ if [[ $encrypt -eq 2 ]];then -+ wsrep_log_info "Using openssl based encryption with socat: with crt and pem" -+ if [[ -z $tpem || -z $tcert ]];then -+ wsrep_log_error "Both PEM and CRT files required" -+ exit 22 -+ fi -+ stagemsg+="-OpenSSL-Encrypted-2" -+ if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]];then -+ wsrep_log_info "Decrypting with PEM $tpem, CA: $tcert" -+ tcmd="socat -u openssl-listen:${TSST_PORT},reuseaddr,cert=$tpem,cafile=${tcert}${sockopt} stdio" -+ else -+ wsrep_log_info "Encrypting with PEM $tpem, CA: $tcert" -+ tcmd="socat -u stdio openssl-connect:${REMOTEIP}:${TSST_PORT},cert=$tpem,cafile=${tcert}${sockopt}" -+ fi -+ elif [[ $encrypt -eq 3 ]];then -+ wsrep_log_info "Using openssl based encryption with socat: with key and crt" -+ if [[ -z $tpem || -z $tkey ]];then -+ wsrep_log_error "Both certificate and key files required" -+ exit 22 -+ fi -+ stagemsg+="-OpenSSL-Encrypted-3" -+ if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]];then -+ wsrep_log_info "Decrypting with certificate $tpem, key $tkey" -+ tcmd="socat -u openssl-listen:${TSST_PORT},reuseaddr,cert=$tpem,key=${tkey},verify=0${sockopt} stdio" -+ else -+ wsrep_log_info "Encrypting with certificate $tpem, key $tkey" -+ tcmd="socat -u stdio openssl-connect:${REMOTEIP}:${TSST_PORT},cert=$tpem,key=${tkey},verify=0${sockopt}" -+ fi -+ -+ else -+ if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]];then -+ tcmd="socat -u TCP-LISTEN:${TSST_PORT},reuseaddr${sockopt} stdio" -+ else -+ tcmd="socat -u stdio TCP:${REMOTEIP}:${TSST_PORT}${sockopt}" -+ fi -+ fi -+ fi -+ -+} -+ -+parse_cnf() -+{ -+ local group=$1 -+ local var=$2 -+ reval=$(my_print_defaults -c $WSREP_SST_OPT_CONF $group | awk -F= '{if ($1 ~ /_/) { gsub(/_/,"-",$1); print $1"="$2 } else { print $0 }}' | grep -- "--$var=" | cut -d= -f2-) -+ if [[ -z $reval ]];then -+ [[ -n $3 ]] && reval=$3 -+ fi -+ echo $reval -+} -+ -+get_footprint() -+{ -+ pushd $WSREP_SST_OPT_DATA 1>/dev/null -+ payload=$(du --block-size=1 -c **/*.ibd **/*.MYI **/*.MYI ibdata1 | awk 'END { print $1 }') -+ if my_print_defaults -c $WSREP_SST_OPT_CONF xtrabackup | grep -q -- "--compress";then -+ # QuickLZ has around 50% compression ratio -+ # When compression/compaction used, the progress is only an approximate. -+ payload=$(( payload*1/2 )) -+ fi -+ popd 1>/dev/null -+ pcmd+=" -s $payload" -+ adjust_progress -+} -+ -+adjust_progress() -+{ -+ if [[ -n $progress && $progress != '1' ]];then -+ if [[ -e $progress ]];then -+ pcmd+=" 2>>$progress" -+ else -+ pcmd+=" 2>$progress" -+ fi -+ elif [[ -z $progress && -n $rlimit ]];then -+ # When rlimit is non-zero -+ pcmd="pv -q" -+ fi -+ -+ if [[ -n $rlimit && "$WSREP_SST_OPT_ROLE" == "donor" ]];then -+ wsrep_log_info "Rate-limiting SST to $rlimit" -+ pcmd+=" -L \$rlimit" -+ fi -+} -+ -+read_cnf() -+{ -+ sfmt=$(parse_cnf sst streamfmt "xbstream") -+ tfmt=$(parse_cnf sst transferfmt "socat") -+ tcert=$(parse_cnf sst tca "") -+ tpem=$(parse_cnf sst tcert "") -+ tkey=$(parse_cnf sst tkey "") -+ encrypt=$(parse_cnf sst encrypt 0) -+ sockopt=$(parse_cnf sst sockopt "") -+ progress=$(parse_cnf sst progress "") -+ rebuild=$(parse_cnf sst rebuild 0) -+ ttime=$(parse_cnf sst time 0) -+ cpat=$(parse_cnf sst cpat '.*galera\.cache$\|.*sst_in_progress$\|.*grastate\.dat$\|.*\.err$\|.*\.log$\|.*RPM_UPGRADE_MARKER$\|.*RPM_UPGRADE_HISTORY$') -+ incremental=$(parse_cnf sst incremental 0) -+ ealgo=$(parse_cnf xtrabackup encrypt "") -+ ekey=$(parse_cnf xtrabackup encrypt-key "") -+ ekeyfile=$(parse_cnf xtrabackup encrypt-key-file "") -+ scomp=$(parse_cnf sst compressor "") -+ sdecomp=$(parse_cnf sst decompressor "") -+ -+ -+ # Refer to http://www.percona.com/doc/percona-xtradb-cluster/manual/xtrabackup_sst.html -+ if [[ -z $ealgo ]];then -+ ealgo=$(parse_cnf sst encrypt-algo "") -+ ekey=$(parse_cnf sst encrypt-key "") -+ ekeyfile=$(parse_cnf sst encrypt-key-file "") -+ fi -+ rlimit=$(parse_cnf sst rlimit "") -+ uextra=$(parse_cnf sst use-extra 0) -+ speciald=$(parse_cnf sst sst-special-dirs 1) -+ iopts=$(parse_cnf sst inno-backup-opts "") -+ iapts=$(parse_cnf sst inno-apply-opts "") -+ impts=$(parse_cnf sst inno-move-opts "") -+} -+ -+get_stream() -+{ -+ if [[ $sfmt == 'xbstream' ]];then -+ wsrep_log_info "Streaming with xbstream" -+ if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]];then -+ strmcmd="xbstream -x" -+ else -+ strmcmd="xbstream -c \${INFO_FILE}" -+ fi -+ else -+ sfmt="tar" -+ wsrep_log_info "Streaming with tar" -+ if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]];then -+ strmcmd="tar xfi - " -+ else -+ strmcmd="tar cf - \${INFO_FILE} " -+ fi -+ -+ fi -+} -+ -+get_proc() -+{ -+ set +e -+ nproc=$(grep -c processor /proc/cpuinfo) -+ [[ -z $nproc || $nproc -eq 0 ]] && nproc=1 -+ set -e -+} -+ -+sig_joiner_cleanup() -+{ -+ wsrep_log_error "Removing $MAGIC_FILE file due to signal" -+ rm -f "$MAGIC_FILE" -+} -+ -+cleanup_joiner() -+{ -+ # Since this is invoked just after exit NNN -+ local estatus=$? -+ if [[ $estatus -ne 0 ]];then -+ wsrep_log_error "Cleanup after exit with status:$estatus" -+ fi -+ if [ "${WSREP_SST_OPT_ROLE}" = "joiner" ];then -+ wsrep_log_info "Removing the sst_in_progress file" -+ wsrep_cleanup_progress_file -+ fi -+ if [[ -n $progress && -p $progress ]];then -+ wsrep_log_info "Cleaning up fifo file $progress" -+ rm $progress -+ fi -+ if [[ -n ${STATDIR:-} ]];then -+ [[ -d $STATDIR ]] && rm -rf $STATDIR -+ fi -+} -+ -+check_pid() -+{ -+ local pid_file="$1" -+ [ -r "$pid_file" ] && ps -p $(cat "$pid_file") >/dev/null 2>&1 -+} -+ -+cleanup_donor() -+{ -+ # Since this is invoked just after exit NNN -+ local estatus=$? -+ if [[ $estatus -ne 0 ]];then -+ wsrep_log_error "Cleanup after exit with status:$estatus" -+ fi -+ -+ if [[ -n $XTRABACKUP_PID ]];then -+ if check_pid $XTRABACKUP_PID -+ then -+ wsrep_log_error "xtrabackup process is still running. Killing... " -+ kill_xtrabackup -+ fi -+ -+ rm -f $XTRABACKUP_PID -+ fi -+ rm -f ${DATA}/${IST_FILE} -+ -+ if [[ -n $progress && -p $progress ]];then -+ wsrep_log_info "Cleaning up fifo file $progress" -+ rm $progress -+ fi -+} -+ -+kill_xtrabackup() -+{ -+ local PID=$(cat $XTRABACKUP_PID) -+ [ -n "$PID" -a "0" != "$PID" ] && kill $PID && (kill $PID && kill -9 $PID) || : -+ rm -f "$XTRABACKUP_PID" -+} -+ -+setup_ports() -+{ -+ if [[ "$WSREP_SST_OPT_ROLE" == "donor" ]];then -+ SST_PORT=$(echo $WSREP_SST_OPT_ADDR | awk -F '[:/]' '{ print $2 }') -+ REMOTEIP=$(echo $WSREP_SST_OPT_ADDR | awk -F ':' '{ print $1 }') -+ lsn=$(echo $WSREP_SST_OPT_ADDR | awk -F '[:/]' '{ print $4 }') -+ else -+ SST_PORT=$(echo ${WSREP_SST_OPT_ADDR} | awk -F ':' '{ print $2 }') -+ fi -+} -+ -+# waits ~10 seconds for nc to open the port and then reports ready -+# (regardless of timeout) -+wait_for_listen() -+{ -+ local PORT=$1 -+ local ADDR=$2 -+ local MODULE=$3 -+ for i in {1..50} -+ do -+ ss -p state listening "( sport = :$PORT )" | grep -qE 'socat|nc' && break -+ sleep 0.2 -+ done -+ if [[ $incremental -eq 1 ]];then -+ echo "ready ${ADDR}/${MODULE}/$lsn" -+ else -+ echo "ready ${ADDR}/${MODULE}" -+ fi -+} -+ -+check_extra() -+{ -+ local use_socket=1 -+ if [[ $uextra -eq 1 ]];then -+ if my_print_defaults -c $WSREP_SST_OPT_CONF mysqld | tr '_' '-' | grep -- "--thread-handling=" | grep -q 'pool-of-threads';then -+ local eport=$(my_print_defaults -c $WSREP_SST_OPT_CONF mysqld | tr '_' '-' | grep -- "--extra-port=" | cut -d= -f2) -+ if [[ -n $eport ]];then -+ # Xtrabackup works only locally. -+ # Hence, setting host to 127.0.0.1 unconditionally. -+ wsrep_log_info "SST through extra_port $eport" -+ INNOEXTRA+=" --host=127.0.0.1 --port=$eport " -+ use_socket=0 -+ else -+ wsrep_log_error "Extra port $eport null, failing" -+ exit 1 -+ fi -+ else -+ wsrep_log_info "Thread pool not set, ignore the option use_extra" -+ fi -+ fi -+ if [[ $use_socket -eq 1 ]] && [[ -n "${WSREP_SST_OPT_SOCKET}" ]];then -+ INNOEXTRA+=" --socket=${WSREP_SST_OPT_SOCKET}" -+ fi -+} -+ -+recv_joiner() -+{ -+ local dir=$1 -+ local msg=$2 -+ -+ pushd ${dir} 1>/dev/null -+ set +e -+ timeit "$msg" "$tcmd | $strmcmd; RC=( "\${PIPESTATUS[@]}" )" -+ set -e -+ popd 1>/dev/null -+ -+ -+ for ecode in "${RC[@]}";do -+ if [[ $ecode -ne 0 ]];then -+ wsrep_log_error "Error while getting data from donor node: " \ -+ "exit codes: ${RC[@]}" -+ exit 32 -+ fi -+ done -+ -+ if [ ! -r "${MAGIC_FILE}" ];then -+ # this message should cause joiner to abort -+ wsrep_log_error "xtrabackup process ended without creating '${MAGIC_FILE}'" -+ wsrep_log_info "Contents of datadir" -+ wsrep_log_info "$(ls -l ${dir}/*)" -+ exit 32 -+ fi -+} -+ -+ -+send_donor() -+{ -+ local dir=$1 -+ local msg=$2 -+ -+ pushd ${dir} 1>/dev/null -+ set +e -+ timeit "$msg" "$strmcmd | $tcmd; RC=( "\${PIPESTATUS[@]}" )" -+ set -e -+ popd 1>/dev/null -+ -+ -+ for ecode in "${RC[@]}";do -+ if [[ $ecode -ne 0 ]];then -+ wsrep_log_error "Error while getting data from donor node: " \ -+ "exit codes: ${RC[@]}" -+ exit 32 -+ fi -+ done -+ -+} -+ -+if [[ ! -x `which innobackupex` ]];then -+ wsrep_log_error "innobackupex not in path: $PATH" -+ exit 2 -+fi -+ -+rm -f "${MAGIC_FILE}" -+ -+if [[ ! ${WSREP_SST_OPT_ROLE} == 'joiner' && ! ${WSREP_SST_OPT_ROLE} == 'donor' ]];then -+ wsrep_log_error "Invalid role ${WSREP_SST_OPT_ROLE}" -+ exit 22 -+fi -+ -+read_cnf -+setup_ports -+get_stream -+get_transfer -+ -+if ${INNOBACKUPEX_BIN} /tmp --help | grep -q -- '--version-check'; then -+ disver="--no-version-check" -+fi -+ -+ -+INNOEXTRA="" -+INNOAPPLY="${INNOBACKUPEX_BIN} $disver $iapts --apply-log \$rebuildcmd \${DATA} &>\${DATA}/innobackup.prepare.log" -+INNOMOVE="${INNOBACKUPEX_BIN} --defaults-file=${WSREP_SST_OPT_CONF} $disver $impts --move-back --force-non-empty-directories \${DATA} &>\${DATA}/innobackup.move.log" -+INNOBACKUP="${INNOBACKUPEX_BIN} --defaults-file=${WSREP_SST_OPT_CONF} $disver $iopts \$INNOEXTRA --galera-info --stream=\$sfmt \${TMPDIR} 2>\${DATA}/innobackup.backup.log" -+ -+if [ "$WSREP_SST_OPT_ROLE" = "donor" ] -+then -+ trap cleanup_donor EXIT -+ -+ if [ $WSREP_SST_OPT_BYPASS -eq 0 ] -+ then -+ -+ TMPDIR="${TMPDIR:-/tmp}" -+ -+ if [ "${AUTH[0]}" != "(null)" ]; then -+ INNOEXTRA+=" --user=${AUTH[0]}" -+ fi -+ -+ if [ ${#AUTH[*]} -eq 2 ]; then -+ INNOEXTRA+=" --password=${AUTH[1]}" -+ elif [ "${AUTH[0]}" != "(null)" ]; then -+ # Empty password, used for testing, debugging etc. -+ INNOEXTRA+=" --password=" -+ fi -+ -+ get_keys -+ if [[ $encrypt -eq 1 ]];then -+ if [[ -n $ekey ]];then -+ INNOEXTRA+=" --encrypt=$ealgo --encrypt-key=$ekey " -+ else -+ INNOEXTRA+=" --encrypt=$ealgo --encrypt-key-file=$ekeyfile " -+ fi -+ fi -+ -+ if [[ -n $lsn ]];then -+ INNOEXTRA+=" --incremental --incremental-lsn=$lsn " -+ fi -+ -+ check_extra -+ -+ wsrep_log_info "Streaming GTID file before SST" -+ -+ echo "${WSREP_SST_OPT_GTID}" > "${MAGIC_FILE}" -+ -+ ttcmd="$tcmd" -+ -+ if [[ $encrypt -eq 1 ]];then -+ if [[ -n $scomp ]];then -+ tcmd=" $ecmd | $scomp | $tcmd " -+ else -+ tcmd=" $ecmd | $tcmd " -+ fi -+ elif [[ -n $scomp ]];then -+ tcmd=" $scomp | $tcmd " -+ fi -+ -+ -+ send_donor $DATA "${stagemsg}-gtid" -+ -+ tcmd="$ttcmd" -+ if [[ -n $progress ]];then -+ get_footprint -+ tcmd="$pcmd | $tcmd" -+ elif [[ -n $rlimit ]];then -+ adjust_progress -+ tcmd="$pcmd | $tcmd" -+ fi -+ -+ wsrep_log_info "Sleeping before data transfer for SST" -+ sleep 10 -+ -+ wsrep_log_info "Streaming the backup to joiner at ${REMOTEIP} ${SST_PORT:-4444}" -+ -+ if [[ -n $scomp ]];then -+ tcmd="$scomp | $tcmd" -+ fi -+ -+ set +e -+ timeit "${stagemsg}-SST" "$INNOBACKUP | $tcmd; RC=( "\${PIPESTATUS[@]}" )" -+ set -e -+ -+ if [ ${RC[0]} -ne 0 ]; then -+ wsrep_log_error "${INNOBACKUPEX_BIN} finished with error: ${RC[0]}. " \ -+ "Check ${DATA}/innobackup.backup.log" -+ exit 22 -+ elif [[ ${RC[$(( ${#RC[@]}-1 ))]} -eq 1 ]];then -+ wsrep_log_error "$tcmd finished with error: ${RC[1]}" -+ exit 22 -+ fi -+ -+ # innobackupex implicitly writes PID to fixed location in ${TMPDIR} -+ XTRABACKUP_PID="${TMPDIR}/xtrabackup_pid" -+ -+ -+ else # BYPASS FOR IST -+ -+ wsrep_log_info "Bypassing the SST for IST" -+ echo "continue" # now server can resume updating data -+ echo "${WSREP_SST_OPT_GTID}" > "${MAGIC_FILE}" -+ echo "1" > "${DATA}/${IST_FILE}" -+ get_keys -+ if [[ $encrypt -eq 1 ]];then -+ if [[ -n $scomp ]];then -+ tcmd=" $ecmd | $scomp | $tcmd " -+ else -+ tcmd=" $ecmd | $tcmd " -+ fi -+ elif [[ -n $scomp ]];then -+ tcmd=" $scomp | $tcmd " -+ fi -+ strmcmd+=" \${IST_FILE}" -+ -+ send_donor $DATA "${stagemsg}-IST" -+ -+ fi -+ -+ echo "done ${WSREP_SST_OPT_GTID}" -+ wsrep_log_info "Total time on donor: $totime seconds" -+ -+elif [ "${WSREP_SST_OPT_ROLE}" = "joiner" ] -+then -+ [[ -e $SST_PROGRESS_FILE ]] && wsrep_log_info "Stale sst_in_progress file: $SST_PROGRESS_FILE" -+ [[ -n $SST_PROGRESS_FILE ]] && touch $SST_PROGRESS_FILE -+ -+ if [[ $speciald -eq 1 ]];then -+ ib_home_dir=$(parse_cnf mysqld innodb-data-home-dir "") -+ ib_log_dir=$(parse_cnf mysqld innodb-log-group-home-dir "") -+ if [[ -z $ib_home_dir && -z $ib_log_dir ]];then -+ speciald=0 -+ fi -+ fi -+ -+ stagemsg="Joiner-Recv" -+ -+ if [[ ! -e ${DATA}/ibdata1 ]];then -+ incremental=0 -+ fi -+ -+ if [[ $incremental -eq 1 ]];then -+ wsrep_log_info "Incremental SST enabled: NOT SUPPORTED yet" -+ lsn=$(grep to_lsn xtrabackup_checkpoints | cut -d= -f2 | tr -d ' ') -+ wsrep_log_info "Recovered LSN: $lsn" -+ fi -+ -+ sencrypted=1 -+ nthreads=1 -+ -+ MODULE="xtrabackup_sst" -+ -+ rm -f "${DATA}/${IST_FILE}" -+ -+ # May need xtrabackup_checkpoints later on -+ rm -f ${DATA}/xtrabackup_binary ${DATA}/xtrabackup_galera_info ${DATA}/xtrabackup_logfile -+ -+ ADDR=${WSREP_SST_OPT_ADDR} -+ if [ -z "${SST_PORT}" ] -+ then -+ SST_PORT=4444 -+ ADDR="$(echo ${WSREP_SST_OPT_ADDR} | awk -F ':' '{ print $1 }'):${SST_PORT}" -+ fi -+ -+ wait_for_listen ${SST_PORT} ${ADDR} ${MODULE} & -+ -+ trap sig_joiner_cleanup HUP PIPE INT TERM -+ trap cleanup_joiner EXIT -+ -+ if [[ -n $progress ]];then -+ adjust_progress -+ tcmd+=" | $pcmd" -+ fi -+ -+ if [[ $incremental -eq 1 ]];then -+ BDATA=$DATA -+ DATA=$(mktemp -d) -+ MAGIC_FILE="${DATA}/${INFO_FILE}" -+ fi -+ -+ get_keys -+ if [[ $encrypt -eq 1 && $sencrypted -eq 1 ]];then -+ if [[ -n $sdecomp ]];then -+ strmcmd=" $sdecomp | $ecmd | $strmcmd" -+ else -+ strmcmd=" $ecmd | $strmcmd" -+ fi -+ elif [[ -n $sdecomp ]];then -+ strmcmd=" $sdecomp | $strmcmd" -+ fi -+ -+ STATDIR=$(mktemp -d) -+ MAGIC_FILE="${STATDIR}/${INFO_FILE}" -+ recv_joiner $STATDIR "${stagemsg}-gtid" 1 -+ -+ if ! ps -p ${WSREP_SST_OPT_PARENT} &>/dev/null -+ then -+ wsrep_log_error "Parent mysqld process (PID:${WSREP_SST_OPT_PARENT}) terminated unexpectedly." -+ exit 32 -+ fi -+ -+ if [ ! -r "${STATDIR}/${IST_FILE}" ] -+ then -+ wsrep_log_info "Proceeding with SST" -+ -+ if [[ $speciald -eq 1 && -d ${DATA}/.sst ]];then -+ wsrep_log_info "WARNING: Stale temporary SST directory: ${DATA}/.sst from previous SST" -+ fi -+ -+ if [[ $incremental -ne 1 ]];then -+ if [[ $speciald -eq 1 ]];then -+ wsrep_log_info "Cleaning the existing datadir and innodb-data/log directories" -+ find $ib_home_dir $ib_log_dir $DATA -mindepth 1 -regex $cpat -prune -o -exec rm -rfv {} 1>&2 \+ -+ else -+ wsrep_log_info "Cleaning the existing datadir" -+ find $DATA -mindepth 1 -regex $cpat -prune -o -exec rm -rfv {} 1>&2 \+ -+ fi -+ tempdir=$(parse_cnf mysqld log-bin "") -+ if [[ -n ${tempdir:-} ]];then -+ binlog_dir=$(dirname $tempdir) -+ binlog_file=$(basename $tempdir) -+ if [[ -n ${binlog_dir:-} && $binlog_dir != '.' && $binlog_dir != $DATA ]];then -+ pattern="$binlog_dir/$binlog_file\.[0-9]+$" -+ wsrep_log_info "Cleaning the binlog directory $binlog_dir as well" -+ find $binlog_dir -maxdepth 1 -type f -regex $pattern -exec rm -fv {} 1>&2 \+ -+ rm $binlog_dir/*.index || true -+ fi -+ fi -+ -+ else -+ wsrep_log_info "Removing existing ib_logfile files" -+ rm -f ${BDATA}/ib_logfile* -+ fi -+ -+ -+ if [[ $speciald -eq 1 ]];then -+ mkdir -p ${DATA}/.sst -+ TDATA=${DATA} -+ DATA="${DATA}/.sst" -+ fi -+ -+ -+ MAGIC_FILE="${DATA}/${INFO_FILE}" -+ recv_joiner $DATA "${stagemsg}-SST" 0 -+ -+ get_proc -+ -+ # Rebuild indexes for compact backups -+ if grep -q 'compact = 1' ${DATA}/xtrabackup_checkpoints;then -+ wsrep_log_info "Index compaction detected" -+ rebuild=1 -+ fi -+ -+ if [[ $rebuild -eq 1 ]];then -+ nthreads=$(parse_cnf xtrabackup rebuild-threads $nproc) -+ wsrep_log_info "Rebuilding during prepare with $nthreads threads" -+ rebuildcmd="--rebuild-indexes --rebuild-threads=$nthreads" -+ fi -+ -+ if test -n "$(find ${DATA} -maxdepth 1 -type f -name '*.qp' -print -quit)";then -+ -+ wsrep_log_info "Compressed qpress files found" -+ -+ if [[ ! -x `which qpress` ]];then -+ wsrep_log_error "qpress not found in path: $PATH" -+ exit 22 -+ fi -+ -+ if [[ -n $progress ]] && pv --help | grep -q 'line-mode';then -+ count=$(find ${DATA} -type f -name '*.qp' | wc -l) -+ count=$(( count*2 )) -+ if pv --help | grep -q FORMAT;then -+ pvopts="-f -s $count -l -N Decompression -F '%N => Rate:%r Elapsed:%t %e Progress: [%b/$count]'" -+ else -+ pvopts="-f -s $count -l -N Decompression" -+ fi -+ pcmd="pv $pvopts" -+ adjust_progress -+ dcmd="$pcmd | xargs -n 2 qpress -T${nproc}d" -+ else -+ dcmd="xargs -n 2 qpress -T${nproc}d" -+ fi -+ -+ -+ # Decompress the qpress files -+ wsrep_log_info "Decompression with $nproc threads" -+ timeit "Joiner-Decompression" "find ${DATA} -type f -name '*.qp' -printf '%p\n%h\n' | $dcmd" -+ extcode=$? -+ -+ if [[ $extcode -eq 0 ]];then -+ wsrep_log_info "Removing qpress files after decompression" -+ find ${DATA} -type f -name '*.qp' -delete -+ if [[ $? -ne 0 ]];then -+ wsrep_log_error "Something went wrong with deletion of qpress files. Investigate" -+ fi -+ else -+ wsrep_log_error "Decompression failed. Exit code: $extcode" -+ exit 22 -+ fi -+ fi -+ -+ if [[ $incremental -eq 1 ]];then -+ # Added --ibbackup=xtrabackup_55 because it fails otherwise citing connection issues. -+ INNOAPPLY="${INNOBACKUPEX_BIN} $disver --defaults-file=${WSREP_SST_OPT_CONF} \ -+ --ibbackup=xtrabackup_55 --apply-log $rebuildcmd --redo-only $BDATA --incremental-dir=${DATA} &>>${BDATA}/innobackup.prepare.log" -+ fi -+ -+ wsrep_log_info "Preparing the backup at ${DATA}" -+ timeit "Xtrabackup prepare stage" "$INNOAPPLY" -+ -+ if [ $? -ne 0 ]; -+ then -+ wsrep_log_error "${INNOBACKUPEX_BIN} apply finished with errors. Check ${DATA}/innobackup.prepare.log" -+ exit 22 -+ fi -+ -+ if [[ $speciald -eq 1 ]];then -+ MAGIC_FILE="${TDATA}/${INFO_FILE}" -+ set +e -+ rm $TDATA/innobackup.prepare.log $TDATA/innobackup.move.log -+ set -e -+ wsrep_log_info "Moving the backup to ${TDATA}" -+ timeit "Xtrabackup move stage" "$INNOMOVE" -+ if [[ $? -eq 0 ]];then -+ wsrep_log_info "Move successful, removing ${DATA}" -+ rm -rf $DATA -+ DATA=${TDATA} -+ else -+ wsrep_log_error "Move failed, keeping ${DATA} for further diagnosis" -+ wsrep_log_error "Check ${DATA}/innobackup.move.log for details" -+ fi -+ fi -+ -+ if [[ $incremental -eq 1 ]];then -+ wsrep_log_info "Cleaning up ${DATA} after incremental SST" -+ [[ -d ${DATA} ]] && rm -rf ${DATA} -+ DATA=$BDATA -+ fi -+ -+ else -+ wsrep_log_info "${IST_FILE} received from donor: Running IST" -+ fi -+ -+ if [[ ! -r ${MAGIC_FILE} ]];then -+ wsrep_log_error "SST magic file ${MAGIC_FILE} not found/readable" -+ exit 2 -+ fi -+ -+ cat "${MAGIC_FILE}" # output UUID:seqno -+ wsrep_log_info "Total time on joiner: $totime seconds" -+fi -+ -+exit 0 - -=== added file 'scripts/wsrep_sst_xtrabackup.sh' ---- old/scripts/wsrep_sst_xtrabackup.sh 1970-01-01 00:00:00 +0000 -+++ new/scripts/wsrep_sst_xtrabackup.sh 2014-03-12 14:45:00 +0000 -@@ -0,0 +1,715 @@ -+#!/bin/bash -ue -+# Copyright (C) 2013 Percona Inc -+# -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; version 2 of the License. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program; see the file COPYING. If not, write to the -+# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston -+# MA 02110-1301 USA. -+ -+# Optional dependencies and options documented here: http://www.percona.com/doc/percona-xtradb-cluster/manual/xtrabackup_sst.html -+# Make sure to read that before proceeding! -+ -+ -+ -+ -+. $(dirname $0)/wsrep_sst_common -+ -+ealgo="" -+ekey="" -+ekeyfile="" -+encrypt=0 -+nproc=1 -+ecode=0 -+XTRABACKUP_PID="" -+SST_PORT="" -+REMOTEIP="" -+tcert="" -+tpem="" -+sockopt="" -+progress="" -+ttime=0 -+totime=0 -+lsn="" -+incremental=0 -+ecmd="" -+rlimit="" -+ -+sfmt="tar" -+strmcmd="" -+tfmt="" -+tcmd="" -+rebuild=0 -+rebuildcmd="" -+payload=0 -+pvformat="-F '%N => Rate:%r Avg:%a Elapsed:%t %e Bytes: %b %p' " -+pvopts="-f -i 10 -N $WSREP_SST_OPT_ROLE " -+uextra=0 -+ -+if which pv &>/dev/null && pv --help | grep -q FORMAT;then -+ pvopts+=$pvformat -+fi -+pcmd="pv $pvopts" -+declare -a RC -+ -+INNOBACKUPEX_BIN=innobackupex -+readonly AUTH=(${WSREP_SST_OPT_AUTH//:/ }) -+DATA="${WSREP_SST_OPT_DATA}" -+INFO_FILE="xtrabackup_galera_info" -+IST_FILE="xtrabackup_ist" -+MAGIC_FILE="${DATA}/${INFO_FILE}" -+ -+# Setting the path for ss and ip -+export PATH="/usr/sbin:/sbin:$PATH" -+ -+timeit(){ -+ local stage=$1 -+ shift -+ local cmd="$@" -+ local x1 x2 took extcode -+ -+ if [[ $ttime -eq 1 ]];then -+ x1=$(date +%s) -+ wsrep_log_info "Evaluating $cmd" -+ eval "$cmd" -+ extcode=$? -+ x2=$(date +%s) -+ took=$(( x2-x1 )) -+ wsrep_log_info "NOTE: $stage took $took seconds" -+ totime=$(( totime+took )) -+ else -+ wsrep_log_info "Evaluating $cmd" -+ eval "$cmd" -+ extcode=$? -+ fi -+ return $extcode -+} -+ -+get_keys() -+{ -+ if [[ $encrypt -eq 2 ]];then -+ return -+ fi -+ -+ if [[ $encrypt -eq 0 ]];then -+ if my_print_defaults -c $WSREP_SST_OPT_CONF xtrabackup | grep -q encrypt;then -+ wsrep_log_error "Unexpected option combination. SST may fail. Refer to http://www.percona.com/doc/percona-xtradb-cluster/manual/xtrabackup_sst.html " -+ fi -+ return -+ fi -+ -+ if [[ $sfmt == 'tar' ]];then -+ wsrep_log_info "NOTE: Xtrabackup-based encryption - encrypt=1 - cannot be enabled with tar format" -+ encrypt=0 -+ return -+ fi -+ -+ wsrep_log_info "Xtrabackup based encryption enabled in my.cnf - Supported only from Xtrabackup 2.1.4" -+ -+ if [[ -z $ealgo ]];then -+ wsrep_log_error "FATAL: Encryption algorithm empty from my.cnf, bailing out" -+ exit 3 -+ fi -+ -+ if [[ -z $ekey && ! -r $ekeyfile ]];then -+ wsrep_log_error "FATAL: Either key or keyfile must be readable" -+ exit 3 -+ fi -+ -+ if [[ -z $ekey ]];then -+ ecmd="xbcrypt --encrypt-algo=$ealgo --encrypt-key-file=$ekeyfile" -+ else -+ ecmd="xbcrypt --encrypt-algo=$ealgo --encrypt-key=$ekey" -+ fi -+ -+ if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]];then -+ ecmd+=" -d" -+ fi -+} -+ -+get_transfer() -+{ -+ if [[ -z $SST_PORT ]];then -+ TSST_PORT=4444 -+ else -+ TSST_PORT=$SST_PORT -+ fi -+ -+ if [[ $tfmt == 'nc' ]];then -+ if [[ ! -x `which nc` ]];then -+ wsrep_log_error "nc(netcat) not found in path: $PATH" -+ exit 2 -+ fi -+ wsrep_log_info "Using netcat as streamer" -+ if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]];then -+ tcmd="nc -dl ${TSST_PORT}" -+ else -+ tcmd="nc ${REMOTEIP} ${TSST_PORT}" -+ fi -+ else -+ tfmt='socat' -+ wsrep_log_info "Using socat as streamer" -+ if [[ ! -x `which socat` ]];then -+ wsrep_log_error "socat not found in path: $PATH" -+ exit 2 -+ fi -+ -+ if [[ $encrypt -eq 2 ]] && ! socat -V | grep -q OPENSSL;then -+ wsrep_log_info "NOTE: socat is not openssl enabled, falling back to plain transfer" -+ encrypt=0 -+ fi -+ -+ if [[ $encrypt -eq 2 ]];then -+ wsrep_log_info "Using openssl based encryption with socat" -+ if [[ -z $tpem || -z $tcert ]];then -+ wsrep_log_error "Both PEM and CRT files required" -+ exit 22 -+ fi -+ if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]];then -+ wsrep_log_info "Decrypting with PEM $tpem, CA: $tcert" -+ tcmd="socat -u openssl-listen:${TSST_PORT},reuseaddr,cert=$tpem,cafile=${tcert}${sockopt} stdio" -+ else -+ wsrep_log_info "Encrypting with PEM $tpem, CA: $tcert" -+ tcmd="socat -u stdio openssl-connect:${REMOTEIP}:${TSST_PORT},cert=$tpem,cafile=${tcert}${sockopt}" -+ fi -+ else -+ if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]];then -+ tcmd="socat -u TCP-LISTEN:${TSST_PORT},reuseaddr${sockopt} stdio" -+ else -+ tcmd="socat -u stdio TCP:${REMOTEIP}:${TSST_PORT}${sockopt}" -+ fi -+ fi -+ fi -+ -+} -+ -+parse_cnf() -+{ -+ local group=$1 -+ local var=$2 -+ reval=$(my_print_defaults -c $WSREP_SST_OPT_CONF $group | awk -F= '{if ($1 ~ /_/) { gsub(/_/,"-",$1); print $1"="$2 } else { print $0 }}' | grep -- "--$var=" | cut -d= -f2-) -+ if [[ -z $reval ]];then -+ [[ -n $3 ]] && reval=$3 -+ fi -+ echo $reval -+} -+ -+get_footprint() -+{ -+ pushd $WSREP_SST_OPT_DATA 1>/dev/null -+ payload=$(du --block-size=1 -c **/*.ibd **/*.MYI **/*.MYI ibdata1 | awk 'END { print $1 }') -+ if my_print_defaults -c $WSREP_SST_OPT_CONF xtrabackup | grep -q -- "--compress";then -+ # QuickLZ has around 50% compression ratio -+ # When compression/compaction used, the progress is only an approximate. -+ payload=$(( payload*1/2 )) -+ fi -+ popd 1>/dev/null -+ pcmd+=" -s $payload" -+ adjust_progress -+} -+ -+adjust_progress() -+{ -+ if [[ -n $progress && $progress != '1' ]];then -+ if [[ -e $progress ]];then -+ pcmd+=" 2>>$progress" -+ else -+ pcmd+=" 2>$progress" -+ fi -+ elif [[ -z $progress && -n $rlimit ]];then -+ # When rlimit is non-zero -+ pcmd="pv -q" -+ fi -+ -+ if [[ -n $rlimit && "$WSREP_SST_OPT_ROLE" == "donor" ]];then -+ wsrep_log_info "Rate-limiting SST to $rlimit" -+ pcmd+=" -L \$rlimit" -+ fi -+} -+ -+read_cnf() -+{ -+ sfmt=$(parse_cnf sst streamfmt "tar") -+ tfmt=$(parse_cnf sst transferfmt "socat") -+ tcert=$(parse_cnf sst tca "") -+ tpem=$(parse_cnf sst tcert "") -+ encrypt=$(parse_cnf sst encrypt 0) -+ sockopt=$(parse_cnf sst sockopt "") -+ progress=$(parse_cnf sst progress "") -+ rebuild=$(parse_cnf sst rebuild 0) -+ ttime=$(parse_cnf sst time 0) -+ incremental=$(parse_cnf sst incremental 0) -+ ealgo=$(parse_cnf xtrabackup encrypt "") -+ ekey=$(parse_cnf xtrabackup encrypt-key "") -+ ekeyfile=$(parse_cnf xtrabackup encrypt-key-file "") -+ -+ # Refer to http://www.percona.com/doc/percona-xtradb-cluster/manual/xtrabackup_sst.html -+ if [[ -z $ealgo ]];then -+ ealgo=$(parse_cnf sst encrypt-algo "") -+ ekey=$(parse_cnf sst encrypt-key "") -+ ekeyfile=$(parse_cnf sst encrypt-key-file "") -+ fi -+ rlimit=$(parse_cnf sst rlimit "") -+ uextra=$(parse_cnf sst use_extra 0) -+} -+ -+get_stream() -+{ -+ if [[ $sfmt == 'xbstream' ]];then -+ wsrep_log_info "Streaming with xbstream" -+ if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]];then -+ strmcmd="xbstream -x" -+ else -+ strmcmd="xbstream -c \${INFO_FILE} \${IST_FILE}" -+ fi -+ else -+ sfmt="tar" -+ wsrep_log_info "Streaming with tar" -+ if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]];then -+ strmcmd="tar xfi - --recursive-unlink -h" -+ else -+ strmcmd="tar cf - \${INFO_FILE} \${IST_FILE}" -+ fi -+ -+ fi -+} -+ -+get_proc() -+{ -+ set +e -+ nproc=$(grep -c processor /proc/cpuinfo) -+ [[ -z $nproc || $nproc -eq 0 ]] && nproc=1 -+ set -e -+} -+ -+sig_joiner_cleanup() -+{ -+ wsrep_log_error "Removing $MAGIC_FILE file due to signal" -+ rm -f "$MAGIC_FILE" -+} -+ -+cleanup_joiner() -+{ -+ # Since this is invoked just after exit NNN -+ local estatus=$? -+ if [[ $estatus -ne 0 ]];then -+ wsrep_log_error "Cleanup after exit with status:$estatus" -+ fi -+ if [ "${WSREP_SST_OPT_ROLE}" = "joiner" ];then -+ wsrep_log_info "Removing the sst_in_progress file" -+ wsrep_cleanup_progress_file -+ fi -+ if [[ -n $progress && -p $progress ]];then -+ wsrep_log_info "Cleaning up fifo file $progress" -+ rm $progress -+ fi -+} -+ -+check_pid() -+{ -+ local pid_file="$1" -+ [ -r "$pid_file" ] && ps -p $(cat "$pid_file") >/dev/null 2>&1 -+} -+ -+cleanup_donor() -+{ -+ # Since this is invoked just after exit NNN -+ local estatus=$? -+ if [[ $estatus -ne 0 ]];then -+ wsrep_log_error "Cleanup after exit with status:$estatus" -+ fi -+ -+ if [[ -n $XTRABACKUP_PID ]];then -+ if check_pid $XTRABACKUP_PID -+ then -+ wsrep_log_error "xtrabackup process is still running. Killing... " -+ kill_xtrabackup -+ fi -+ -+ rm -f $XTRABACKUP_PID -+ fi -+ rm -f ${DATA}/${IST_FILE} -+ -+ if [[ -n $progress && -p $progress ]];then -+ wsrep_log_info "Cleaning up fifo file $progress" -+ rm $progress -+ fi -+} -+ -+kill_xtrabackup() -+{ -+ local PID=$(cat $XTRABACKUP_PID) -+ [ -n "$PID" -a "0" != "$PID" ] && kill $PID && (kill $PID && kill -9 $PID) || : -+ rm -f "$XTRABACKUP_PID" -+} -+ -+setup_ports() -+{ -+ if [[ "$WSREP_SST_OPT_ROLE" == "donor" ]];then -+ SST_PORT=$(echo $WSREP_SST_OPT_ADDR | awk -F '[:/]' '{ print $2 }') -+ REMOTEIP=$(echo $WSREP_SST_OPT_ADDR | awk -F ':' '{ print $1 }') -+ lsn=$(echo $WSREP_SST_OPT_ADDR | awk -F '[:/]' '{ print $4 }') -+ else -+ SST_PORT=$(echo ${WSREP_SST_OPT_ADDR} | awk -F ':' '{ print $2 }') -+ fi -+} -+ -+# waits ~10 seconds for nc to open the port and then reports ready -+# (regardless of timeout) -+wait_for_listen() -+{ -+ local PORT=$1 -+ local ADDR=$2 -+ local MODULE=$3 -+ for i in {1..50} -+ do -+ ss -p state listening "( sport = :$PORT )" | grep -qE 'socat|nc' && break -+ sleep 0.2 -+ done -+ if [[ $incremental -eq 1 ]];then -+ echo "ready ${ADDR}/${MODULE}/$lsn" -+ else -+ echo "ready ${ADDR}/${MODULE}" -+ fi -+} -+ -+check_extra() -+{ -+ local use_socket=1 -+ if [[ $uextra -eq 1 ]];then -+ if my_print_defaults -c $WSREP_SST_OPT_CONF mysqld | tr '_' '-' | grep -- "--thread-handling=" | grep -q 'pool-of-threads';then -+ local eport=$(my_print_defaults -c $WSREP_SST_OPT_CONF mysqld | tr '_' '-' | grep -- "--extra-port=" | cut -d= -f2) -+ if [[ -n $eport ]];then -+ # Xtrabackup works only locally. -+ # Hence, setting host to 127.0.0.1 unconditionally. -+ wsrep_log_info "SST through extra_port $eport" -+ INNOEXTRA+=" --host=127.0.0.1 --port=$eport " -+ use_socket=0 -+ else -+ wsrep_log_error "Extra port $eport null, failing" -+ exit 1 -+ fi -+ else -+ wsrep_log_info "Thread pool not set, ignore the option use_extra" -+ fi -+ fi -+ if [[ $use_socket -eq 1 ]] && [[ -n "${WSREP_SST_OPT_SOCKET}" ]];then -+ INNOEXTRA+=" --socket=${WSREP_SST_OPT_SOCKET}" -+ fi -+} -+ -+if [[ ! -x `which innobackupex` ]];then -+ wsrep_log_error "innobackupex not in path: $PATH" -+ exit 2 -+fi -+ -+rm -f "${MAGIC_FILE}" -+ -+if [[ ! ${WSREP_SST_OPT_ROLE} == 'joiner' && ! ${WSREP_SST_OPT_ROLE} == 'donor' ]];then -+ wsrep_log_error "Invalid role ${WSREP_SST_OPT_ROLE}" -+ exit 22 -+fi -+ -+read_cnf -+setup_ports -+get_stream -+get_transfer -+ -+INNOEXTRA="" -+INNOAPPLY="${INNOBACKUPEX_BIN} --defaults-file=${WSREP_SST_OPT_CONF} --apply-log \$rebuildcmd \${DATA} &>\${DATA}/innobackup.prepare.log" -+INNOBACKUP="${INNOBACKUPEX_BIN} --defaults-file=${WSREP_SST_OPT_CONF} \$INNOEXTRA --galera-info --stream=\$sfmt \${TMPDIR} 2>\${DATA}/innobackup.backup.log" -+ -+if [ "$WSREP_SST_OPT_ROLE" = "donor" ] -+then -+ trap cleanup_donor EXIT -+ -+ if [ $WSREP_SST_OPT_BYPASS -eq 0 ] -+ then -+ TMPDIR="${TMPDIR:-/tmp}" -+ -+ if [ "${AUTH[0]}" != "(null)" ]; then -+ INNOEXTRA+=" --user=${AUTH[0]}" -+ fi -+ -+ if [ ${#AUTH[*]} -eq 2 ]; then -+ INNOEXTRA+=" --password=${AUTH[1]}" -+ elif [ "${AUTH[0]}" != "(null)" ]; then -+ # Empty password, used for testing, debugging etc. -+ INNOEXTRA+=" --password=" -+ fi -+ -+ get_keys -+ if [[ $encrypt -eq 1 ]];then -+ if [[ -n $ekey ]];then -+ INNOEXTRA+=" --encrypt=$ealgo --encrypt-key=$ekey " -+ else -+ INNOEXTRA+=" --encrypt=$ealgo --encrypt-key-file=$ekeyfile " -+ fi -+ fi -+ -+ if [[ -n $lsn ]];then -+ INNOEXTRA+=" --incremental --incremental-lsn=$lsn " -+ fi -+ -+ check_extra -+ -+ wsrep_log_info "Streaming the backup to joiner at ${REMOTEIP} ${SST_PORT}" -+ -+ if [[ -n $progress ]];then -+ get_footprint -+ tcmd="$pcmd | $tcmd" -+ elif [[ -n $rlimit ]];then -+ adjust_progress -+ tcmd="$pcmd | $tcmd" -+ fi -+ -+ set +e -+ timeit "Donor-Transfer" "$INNOBACKUP | $tcmd; RC=( "\${PIPESTATUS[@]}" )" -+ set -e -+ -+ if [ ${RC[0]} -ne 0 ]; then -+ wsrep_log_error "${INNOBACKUPEX_BIN} finished with error: ${RC[0]}. " \ -+ "Check ${DATA}/innobackup.backup.log" -+ exit 22 -+ elif [[ ${RC[$(( ${#RC[@]}-1 ))]} -eq 1 ]];then -+ wsrep_log_error "$tcmd finished with error: ${RC[1]}" -+ exit 22 -+ fi -+ -+ # innobackupex implicitly writes PID to fixed location in ${TMPDIR} -+ XTRABACKUP_PID="${TMPDIR}/xtrabackup_pid" -+ -+ -+ else # BYPASS FOR IST -+ -+ wsrep_log_info "Bypassing the SST for IST" -+ STATE="${WSREP_SST_OPT_GTID}" -+ echo "continue" # now server can resume updating data -+ echo "${STATE}" > "${MAGIC_FILE}" -+ echo "1" > "${DATA}/${IST_FILE}" -+ get_keys -+ pushd ${DATA} 1>/dev/null -+ set +e -+ if [[ $encrypt -eq 1 ]];then -+ tcmd=" $ecmd | $tcmd" -+ fi -+ timeit "Donor-IST-Unencrypted-transfer" "$strmcmd | $tcmd; RC=( "\${PIPESTATUS[@]}" )" -+ set -e -+ popd 1>/dev/null -+ -+ for ecode in "${RC[@]}";do -+ if [[ $ecode -ne 0 ]];then -+ wsrep_log_error "Error while streaming data to joiner node: " \ -+ "exit codes: ${RC[@]}" -+ exit 1 -+ fi -+ done -+ fi -+ -+ echo "done ${WSREP_SST_OPT_GTID}" -+ wsrep_log_info "Total time on donor: $totime seconds" -+ -+elif [ "${WSREP_SST_OPT_ROLE}" = "joiner" ] -+then -+ [[ -e $SST_PROGRESS_FILE ]] && wsrep_log_info "Stale sst_in_progress file: $SST_PROGRESS_FILE" -+ touch $SST_PROGRESS_FILE -+ -+ if [[ ! -e ${DATA}/ibdata1 ]];then -+ incremental=0 -+ fi -+ -+ if [[ $incremental -eq 1 ]];then -+ wsrep_log_info "Incremental SST enabled" -+ #lsn=$(/pxc/bin/mysqld --defaults-file=$WSREP_SST_OPT_CONF --basedir=/pxc --wsrep-recover 2>&1 | grep -o 'log sequence number .*' | cut -d " " -f 4 | head -1) -+ lsn=$(grep to_lsn xtrabackup_checkpoints | cut -d= -f2 | tr -d ' ') -+ wsrep_log_info "Recovered LSN: $lsn" -+ fi -+ -+ sencrypted=1 -+ nthreads=1 -+ -+ MODULE="xtrabackup_sst" -+ -+ # May need xtrabackup_checkpoints later on -+ rm -f ${DATA}/xtrabackup_binary ${DATA}/xtrabackup_galera_info ${DATA}/xtrabackup_logfile -+ -+ ADDR=${WSREP_SST_OPT_ADDR} -+ if [ -z "${SST_PORT}" ] -+ then -+ SST_PORT=4444 -+ ADDR="$(echo ${WSREP_SST_OPT_ADDR} | awk -F ':' '{ print $1 }'):${SST_PORT}" -+ fi -+ -+ wait_for_listen ${SST_PORT} ${ADDR} ${MODULE} & -+ -+ trap sig_joiner_cleanup HUP PIPE INT TERM -+ trap cleanup_joiner EXIT -+ -+ if [[ -n $progress ]];then -+ adjust_progress -+ tcmd+=" | $pcmd" -+ fi -+ -+ if [[ $incremental -eq 1 ]];then -+ BDATA=$DATA -+ DATA=$(mktemp -d) -+ MAGIC_FILE="${DATA}/${INFO_FILE}" -+ fi -+ -+ get_keys -+ set +e -+ if [[ $encrypt -eq 1 && $sencrypted -eq 1 ]];then -+ strmcmd=" $ecmd | $strmcmd" -+ fi -+ -+ pushd ${DATA} 1>/dev/null -+ timeit "Joiner-Recv-Unencrypted" "$tcmd | $strmcmd; RC=( "\${PIPESTATUS[@]}" )" -+ popd 1>/dev/null -+ -+ set -e -+ -+ if [[ $sfmt == 'xbstream' ]];then -+ # Special handling till lp:1193240 is fixed" -+ if [[ ${RC[$(( ${#RC[@]}-1 ))]} -eq 1 ]];then -+ wsrep_log_error "Xbstream failed" -+ wsrep_log_error "Data directory ${DATA} may not be empty: lp:1193240" \ -+ "Manual intervention required in that case" -+ exit 32 -+ fi -+ fi -+ -+ wait %% # join for wait_for_listen thread -+ -+ for ecode in "${RC[@]}";do -+ if [[ $ecode -ne 0 ]];then -+ wsrep_log_error "Error while getting data from donor node: " \ -+ "exit codes: ${RC[@]}" -+ exit 32 -+ fi -+ done -+ -+ if [ ! -r "${MAGIC_FILE}" ] -+ then -+ # this message should cause joiner to abort -+ wsrep_log_error "xtrabackup process ended without creating '${MAGIC_FILE}'" -+ wsrep_log_info "Contents of datadir" -+ wsrep_log_info "$(ls -l ${DATA}/**/*)" -+ exit 32 -+ fi -+ -+ if ! ps -p ${WSREP_SST_OPT_PARENT} &>/dev/null -+ then -+ wsrep_log_error "Parent mysqld process (PID:${WSREP_SST_OPT_PARENT}) terminated unexpectedly." -+ exit 32 -+ fi -+ -+ if [ ! -r "${DATA}/${IST_FILE}" ] -+ then -+ wsrep_log_info "Proceeding with SST" -+ wsrep_log_info "Removing existing ib_logfile files" -+ if [[ $incremental -ne 1 ]];then -+ rm -f ${DATA}/ib_logfile* -+ else -+ rm -f ${BDATA}/ib_logfile* -+ fi -+ -+ get_proc -+ -+ # Rebuild indexes for compact backups -+ if grep -q 'compact = 1' ${DATA}/xtrabackup_checkpoints;then -+ wsrep_log_info "Index compaction detected" -+ rebuild=1 -+ fi -+ -+ if [[ $rebuild -eq 1 ]];then -+ nthreads=$(parse_cnf xtrabackup rebuild-threads $nproc) -+ wsrep_log_info "Rebuilding during prepare with $nthreads threads" -+ rebuildcmd="--rebuild-indexes --rebuild-threads=$nthreads" -+ fi -+ -+ if test -n "$(find ${DATA} -maxdepth 1 -type f -name '*.qp' -print -quit)";then -+ -+ wsrep_log_info "Compressed qpress files found" -+ -+ if [[ ! -x `which qpress` ]];then -+ wsrep_log_error "qpress not found in path: $PATH" -+ exit 22 -+ fi -+ -+ if [[ -n $progress ]] && pv --help | grep -q 'line-mode';then -+ count=$(find ${DATA} -type f -name '*.qp' | wc -l) -+ count=$(( count*2 )) -+ if pv --help | grep -q FORMAT;then -+ pvopts="-f -s $count -l -N Decompression -F '%N => Rate:%r Elapsed:%t %e Progress: [%b/$count]'" -+ else -+ pvopts="-f -s $count -l -N Decompression" -+ fi -+ pcmd="pv $pvopts" -+ adjust_progress -+ dcmd="$pcmd | xargs -n 2 qpress -T${nproc}d" -+ else -+ dcmd="xargs -n 2 qpress -T${nproc}d" -+ fi -+ -+ wsrep_log_info "Removing existing ibdata1 file" -+ rm -f ${DATA}/ibdata1 -+ -+ # Decompress the qpress files -+ wsrep_log_info "Decompression with $nproc threads" -+ timeit "Decompression" "find ${DATA} -type f -name '*.qp' -printf '%p\n%h\n' | $dcmd" -+ extcode=$? -+ -+ if [[ $extcode -eq 0 ]];then -+ wsrep_log_info "Removing qpress files after decompression" -+ find ${DATA} -type f -name '*.qp' -delete -+ if [[ $? -ne 0 ]];then -+ wsrep_log_error "Something went wrong with deletion of qpress files. Investigate" -+ fi -+ else -+ wsrep_log_error "Decompression failed. Exit code: $extcode" -+ exit 22 -+ fi -+ fi -+ -+ if [[ $incremental -eq 1 ]];then -+ # Added --ibbackup=xtrabackup_55 because it fails otherwise citing connection issues. -+ INNOAPPLY="${INNOBACKUPEX_BIN} --defaults-file=${WSREP_SST_OPT_CONF} \ -+ --ibbackup=xtrabackup_55 --apply-log $rebuildcmd --redo-only $BDATA --incremental-dir=${DATA} &>>${BDATA}/innobackup.prepare.log" -+ fi -+ -+ wsrep_log_info "Preparing the backup at ${DATA}" -+ timeit "Xtrabackup prepare stage" "$INNOAPPLY" -+ -+ if [[ $incremental -eq 1 ]];then -+ wsrep_log_info "Cleaning up ${DATA} after incremental SST" -+ [[ -d ${DATA} ]] && rm -rf ${DATA} -+ DATA=$BDATA -+ fi -+ -+ if [ $? -ne 0 ]; -+ then -+ wsrep_log_error "${INNOBACKUPEX_BIN} finished with errors. Check ${DATA}/innobackup.prepare.log" -+ exit 22 -+ fi -+ else -+ wsrep_log_info "${IST_FILE} received from donor: Running IST" -+ fi -+ -+ if [[ ! -r ${MAGIC_FILE} ]];then -+ wsrep_log_error "SST magic file ${MAGIC_FILE} not found/readable" -+ exit 2 -+ fi -+ -+ cat "${MAGIC_FILE}" # output UUID:seqno -+ wsrep_log_info "Total time on joiner: $totime seconds" -+fi -+ -+exit 0 - -=== modified file 'sql/CMakeLists.txt' ---- old/sql/CMakeLists.txt 2014-01-06 06:03:08 +0000 -+++ new/sql/CMakeLists.txt 2014-03-11 21:17:40 +0000 -@@ -13,6 +13,10 @@ - # along with this program; if not, write to the Free Software - # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -+IF(WITH_WSREP) -+ SET(WSREP_INCLUDES ${CMAKE_SOURCE_DIR}/wsrep) -+ENDIF() -+ - INCLUDE_DIRECTORIES( - ${CMAKE_SOURCE_DIR}/include - ${CMAKE_SOURCE_DIR}/sql -@@ -20,6 +24,7 @@ - ${ZLIB_INCLUDE_DIR} - ${SSL_INCLUDE_DIRS} - ${CMAKE_BINARY_DIR}/sql -+ ${WSREP_INCLUDES} - ) - - SET(GEN_SOURCES -@@ -171,7 +176,24 @@ - - SET(SQL_EXPORTED_SOURCES ${SQL_SHARED_SOURCES} PARENT_SCOPE) - -+IF(WITH_WSREP) -+ SET(WSREP_SOURCES -+ wsrep_check_opts.cc -+ wsrep_hton.cc -+ wsrep_mysqld.cc -+ wsrep_notify.cc -+ wsrep_sst.cc -+ wsrep_utils.cc -+ wsrep_var.cc -+ wsrep_binlog.cc -+ wsrep_applier.cc -+ wsrep_thd.cc -+ ) -+ SET(WSREP_LIB wsrep) -+ENDIF() -+ - SET(SQL_SOURCE -+ ${WSREP_SOURCES} - ${GEN_SOURCES} - ${MYSYS_LIBWRAP_SOURCE} - ${SQL_SHARED_SOURCES} -@@ -208,6 +230,7 @@ - TARGET_LINK_LIBRARIES(sql ${MYSQLD_STATIC_PLUGIN_LIBS} - mysys mysys_ssl dbug strings vio regex - ${LIBWRAP} ${LIBCRYPT} ${LIBDL} -+ ${WSREP_LIB} - ${SSL_LIBRARIES}) - - # -@@ -246,7 +269,6 @@ - ) - ADD_DEPENDENCIES(sqlgunitlib GenError) - -- - IF(WIN32) - SET(MYSQLD_SOURCE main.cc nt_servc.cc nt_servc.h message.rc) - ELSE() - -=== modified file 'sql/binlog.cc' ---- old/sql/binlog.cc 2014-01-06 05:23:19 +0000 -+++ new/sql/binlog.cc 2014-03-11 21:17:40 +0000 -@@ -60,7 +60,11 @@ - static bool unsafe_warning_suppression_is_activated= false; - static int limit_unsafe_warning_count= 0; - -+#ifndef WITH_WSREP - static handlerton *binlog_hton; -+#else -+handlerton *binlog_hton; // we need it in wsrep_binlog.cc -+#endif - bool opt_binlog_order_commits= true; - - const char *log_bin_index= 0; -@@ -775,7 +779,9 @@ - If opt_bin_log is not set, binlog_hton->slot == -1 and hence - thd_get_ha_data(thd, hton) segfaults. - */ -+#ifndef WITH_WSREP - DBUG_ASSERT(opt_bin_log); -+#endif - return (binlog_cache_mngr *)thd_get_ha_data(thd, binlog_hton); - } - -@@ -861,7 +867,11 @@ - DBUG_ENTER("binlog_trans_log_savepos"); - DBUG_ASSERT(pos != NULL); - binlog_cache_mngr *const cache_mngr= thd_get_cache_mngr(thd); -+#ifdef WITH_WSREP -+ DBUG_ASSERT((WSREP_EMULATE_BINLOG(thd)) || mysql_bin_log.is_open()); -+#else - DBUG_ASSERT(mysql_bin_log.is_open()); -+#endif /* WITH_WSREP */ - *pos= cache_mngr->trx_cache.get_byte_position(); - DBUG_PRINT("return", ("position: %lu", (ulong) *pos)); - DBUG_VOID_RETURN; -@@ -877,7 +887,16 @@ - static int binlog_init(void *p) - { - binlog_hton= (handlerton *)p; -+#ifdef WITH_WSREP -+ if (WSREP_ON) -+ binlog_hton->state= SHOW_OPTION_YES; -+ else -+ { -+#endif /* WITH_WSREP */ - binlog_hton->state=opt_bin_log ? SHOW_OPTION_YES : SHOW_OPTION_NO; -+#ifdef WITH_WSREP -+ } -+#endif /* WITH_WSREP */ - binlog_hton->db_type=DB_TYPE_BINLOG; - binlog_hton->savepoint_offset= sizeof(my_off_t); - binlog_hton->close_connection= binlog_close_connection; -@@ -892,10 +911,24 @@ - return 0; - } - -+#ifdef WITH_WSREP -+#include "wsrep_binlog.h" -+#endif /* WITH_WSREP */ - static int binlog_close_connection(handlerton *hton, THD *thd) - { - DBUG_ENTER("binlog_close_connection"); - binlog_cache_mngr *const cache_mngr= thd_get_cache_mngr(thd); -+#ifdef WITH_WSREP -+ if (!cache_mngr->is_binlog_empty()) { -+ IO_CACHE* cache= get_trans_log(thd); -+ uchar *buf; -+ size_t len=0; -+ wsrep_write_cache_buf(cache, &buf, &len); -+ WSREP_WARN("binlog cache not empty (%lu bytes) at connection close %lu", -+ len, thd->thread_id); -+ wsrep_dump_rbr_buf(thd, buf, len); -+ } -+#endif /* WITH_WSREP */ - DBUG_ASSERT(cache_mngr->is_binlog_empty()); - DBUG_ASSERT(cache_mngr->trx_cache.is_group_cache_empty() && - cache_mngr->stmt_cache.is_group_cache_empty()); -@@ -1646,7 +1679,11 @@ - if (error == 0 && stuff_logged) - error= ordered_commit(thd, all, /* skip_commit */ true); - -+#ifdef WITH_WSREP -+ if (!WSREP_EMULATE_BINLOG(thd) && check_write_error(thd)) -+#else - if (check_write_error(thd)) -+#endif - { - /* - "all == true" means that a "rollback statement" triggered the error and -@@ -5023,7 +5060,11 @@ - bool is_transactional) - { - DBUG_ENTER("MYSQL_BIN_LOG::flush_and_set_pending_rows_event(event)"); -+#ifdef WITH_WSREP -+ DBUG_ASSERT(WSREP_EMULATE_BINLOG(thd) || mysql_bin_log.is_open()); -+#else - DBUG_ASSERT(mysql_bin_log.is_open()); -+#endif /* WITH_WSREP */ - DBUG_PRINT("enter", ("event: 0x%lx", (long) event)); - - int error= 0; -@@ -5098,7 +5139,13 @@ - mostly called if is_open() *was* true a few instructions before, but it - could have changed since. - */ -+#ifdef WITH_WSREP -+ /* applier and replayer can skip writing binlog events */ -+ if ((WSREP_EMULATE_BINLOG(thd) && (thd->wsrep_exec_mode != REPL_RECV)) || -+ is_open()) -+#else - if (likely(is_open())) -+#endif - { - #ifdef HAVE_REPLICATION - /* -@@ -5245,6 +5292,15 @@ - { - int error= 0; - DBUG_ENTER("MYSQL_BIN_LOG::rotate"); -+#ifdef WITH_WSREP -+ if (WSREP_ON && wsrep_to_isolation) -+ { -+ *check_purge= false; -+ WSREP_DEBUG("avoiding binlog rotate due to TO isolation: %d", -+ wsrep_to_isolation); -+ DBUG_RETURN(0); -+ } -+#endif - - DBUG_ASSERT(!is_relay_log); - mysql_mutex_assert_owner(&LOCK_log); -@@ -5724,6 +5780,9 @@ - bool MYSQL_BIN_LOG::write_cache(THD *thd, binlog_cache_data *cache_data) - { - DBUG_ENTER("MYSQL_BIN_LOG::write_cache(THD *, binlog_cache_data *, bool)"); -+#ifdef WITH_WSREP -+ if (WSREP_EMULATE_BINLOG(thd)) DBUG_RETURN(0); -+#endif /* WITH_WSREP */ - - IO_CACHE *cache= &cache_data->cache_log; - bool incident= cache_data->has_incident(); -@@ -6179,7 +6238,13 @@ - DBUG_ENTER("MYSQL_BIN_LOG::commit"); - - binlog_cache_mngr *cache_mngr= thd_get_cache_mngr(thd); -+#ifdef WITH_WSREP -+ my_xid xid= (wsrep_is_wsrep_xid(&thd->transaction.xid_state.xid) ? -+ wsrep_xid_seqno(&thd->transaction.xid_state.xid) : -+ thd->transaction.xid_state.xid.get_my_xid()); -+#else - my_xid xid= thd->transaction.xid_state.xid.get_my_xid(); -+#endif /* WITH_WSREP */ - int error= RESULT_SUCCESS; - bool stuff_logged= false; - -@@ -6765,6 +6830,16 @@ - my_off_t total_bytes= 0; - bool do_rotate= false; - -+#ifdef WITH_WSREP -+ if (WSREP_EMULATE_BINLOG(thd)) -+ { -+ /* -+ Skip group commit, just do storage engine commit. -+ */ -+ DBUG_RETURN(ha_commit_low(thd, all)); -+ } -+#endif /* WITH_WSREP */ -+ - /* - These values are used while flushing a transaction, so clear - everything. -@@ -6959,6 +7034,24 @@ - */ - bool in_transaction= FALSE; - -+#ifdef WITH_WSREP -+ /* -+ Read current wsrep position from storage engines to have consistent -+ end position for binlog scan. -+ */ -+ XID xid; -+ memset(&xid, 0, sizeof(xid)); -+ xid.formatID= -1; -+ wsrep_get_SE_checkpoint(&xid); -+ char uuid_str[40]; -+ wsrep_uuid_print(wsrep_xid_uuid(&xid), uuid_str, sizeof(uuid_str)); -+ WSREP_INFO("Binlog recovery, found wsrep position %s:%lld", uuid_str, -+ (long long)wsrep_xid_seqno(&xid)); -+ const wsrep_seqno_t last_xid_seqno= wsrep_xid_seqno(&xid); -+ wsrep_seqno_t cur_xid_seqno=WSREP_SEQNO_UNDEFINED; -+#endif /* WITH_WSREP */ -+ -+ - if (! fdle->is_valid() || - my_hash_init(&xids, &my_charset_bin, TC_LOG_PAGE_SIZE/3, 0, - sizeof(my_xid), 0, 0, MYF(0))) -@@ -6967,7 +7060,12 @@ - init_alloc_root(&mem_root, TC_LOG_PAGE_SIZE, TC_LOG_PAGE_SIZE); - - while ((ev= Log_event::read_log_event(log, 0, fdle, TRUE)) -- && ev->is_valid()) -+ && ev->is_valid() -+#ifdef WITH_WSREP -+ && (last_xid_seqno == WSREP_SEQNO_UNDEFINED || -+ last_xid_seqno != cur_xid_seqno) -+#endif -+ ) - { - if (ev->get_type_code() == QUERY_EVENT && - !strcmp(((Query_log_event*)ev)->query, "BEGIN")) -@@ -6988,6 +7086,9 @@ - sizeof(xev->xid)); - if (!x || my_hash_insert(&xids, x)) - goto err2; -+#ifdef WITH_WSREP -+ cur_xid_seqno= xev->xid; -+#endif /* WITH_WSREP */ - } - - /* -@@ -7032,6 +7133,11 @@ - delete ev; - } - -+#ifdef WITH_WSREP -+ WSREP_INFO("Binlog recovery scan stopped at Xid event %lld", -+ (long long)cur_xid_seqno); -+#endif /* WITH_WSREP */ -+ - if (ha_recover(&xids)) - goto err2; - -@@ -7056,7 +7162,9 @@ - - // If opt_bin_log==0, it is not safe to call thd_get_cache_mngr - // because binlog_hton has not been completely set up. -+#ifndef WITH_WSREP - DBUG_ASSERT(opt_bin_log); -+#endif - binlog_cache_mngr *cache_mngr= thd_get_cache_mngr(this); - - // cache_mngr is NULL until we call thd->binlog_setup_trx_data, so -@@ -7249,7 +7357,12 @@ - table->s->table_map_id.id())); - - /* Pre-conditions */ -+#ifdef WITH_WSREP -+ DBUG_ASSERT(is_current_stmt_binlog_format_row() && -+ (WSREP_EMULATE_BINLOG(this) || mysql_bin_log.is_open())); -+#else - DBUG_ASSERT(is_current_stmt_binlog_format_row() && mysql_bin_log.is_open()); -+#endif /* WITH_WSREP */ - DBUG_ASSERT(table->s->table_map_id.is_valid()); - - Table_map_log_event -@@ -7537,9 +7650,16 @@ - binlogging is off, or if the statement is filtered out from the - binlog by filtering rules. - */ -+#ifdef WITH_WSREP -+ if ((WSREP_EMULATE_BINLOG(this) || -+ (mysql_bin_log.is_open() && (variables.option_bits & OPTION_BIN_LOG))) && -+ !(WSREP_BINLOG_FORMAT(variables.binlog_format) == BINLOG_FORMAT_STMT && -+ !binlog_filter->db_ok(db))) -+#else - if (mysql_bin_log.is_open() && (variables.option_bits & OPTION_BIN_LOG) && - !(variables.binlog_format == BINLOG_FORMAT_STMT && - !binlog_filter->db_ok(db))) -+#endif /* WITH_WSREP */ - { - /* - Compute one bit field with the union of all the engine -@@ -7783,7 +7903,7 @@ - */ - my_error((error= ER_BINLOG_ROW_INJECTION_AND_STMT_ENGINE), MYF(0)); - } -- else if (variables.binlog_format == BINLOG_FORMAT_ROW && -+ else if (WSREP_BINLOG_FORMAT(variables.binlog_format) == BINLOG_FORMAT_ROW && - sqlcom_can_generate_row_events(this)) - { - /* -@@ -7812,8 +7932,8 @@ - else - { - /* binlog_format = STATEMENT */ -- if (variables.binlog_format == BINLOG_FORMAT_STMT) -- { -+ if (WSREP_BINLOG_FORMAT(variables.binlog_format) == BINLOG_FORMAT_STMT) -+ { - if (lex->is_stmt_row_injection()) - { - /* -@@ -7829,7 +7949,14 @@ - 5. Error: Cannot modify table that uses a storage engine - limited to row-logging when binlog_format = STATEMENT - */ -+#ifdef WITH_WSREP -+ if (!WSREP(this) || wsrep_exec_mode == LOCAL_STATE) -+ { -+#endif /* WITH_WSREP */ - my_error((error= ER_BINLOG_STMT_MODE_AND_ROW_ENGINE), MYF(0), ""); -+#ifdef WITH_WSREP -+ } -+#endif /* WITH_WSREP */ - } - else if (is_write && (unsafe_flags= lex->get_stmt_unsafe_flags()) != 0) - { -@@ -7975,7 +8102,7 @@ - "and binlog_filter->db_ok(db) = %d", - mysql_bin_log.is_open(), - (variables.option_bits & OPTION_BIN_LOG), -- variables.binlog_format, -+ WSREP_BINLOG_FORMAT(variables.binlog_format), - binlog_filter->db_ok(db))); - #endif - -@@ -8285,7 +8412,12 @@ - uchar const *record, - const uchar* extra_row_info) - { -+#ifdef WITH_WSREP -+ DBUG_ASSERT(is_current_stmt_binlog_format_row() && -+ ((WSREP_EMULATE_BINLOG(this) || mysql_bin_log.is_open()))); -+#else - DBUG_ASSERT(is_current_stmt_binlog_format_row() && mysql_bin_log.is_open()); -+#endif /* WITH_WSREP */ - - /* - Pack records into format for transfer. We are allocating more -@@ -8315,7 +8447,13 @@ - const uchar *after_record, - const uchar* extra_row_info) - { -+#ifdef WITH_WSREP -+ DBUG_ASSERT(is_current_stmt_binlog_format_row() && -+ ((WSREP_EMULATE_BINLOG(this) || mysql_bin_log.is_open()))); -+#else - DBUG_ASSERT(is_current_stmt_binlog_format_row() && mysql_bin_log.is_open()); -+#endif /* WITH_WSREP */ -+ - int error= 0; - - /** -@@ -8381,7 +8519,13 @@ - uchar const *record, - const uchar* extra_row_info) - { -+#ifdef WITH_WSREP -+ DBUG_ASSERT(is_current_stmt_binlog_format_row() && -+ ((WSREP_EMULATE_BINLOG(this) || mysql_bin_log.is_open()))); -+#else - DBUG_ASSERT(is_current_stmt_binlog_format_row() && mysql_bin_log.is_open()); -+#endif /* WITH_WSREP */ -+ - int error= 0; - - /** -@@ -8499,7 +8643,11 @@ - mode: it might be the case that we left row-based mode before - flushing anything (e.g., if we have explicitly locked tables). - */ -- if (!mysql_bin_log.is_open()) -+#ifdef WITH_WSREP -+ if (!(WSREP_EMULATE_BINLOG(this) || mysql_bin_log.is_open())) -+#else -+ if (!mysql_bin_log.is_open()) -+#endif /* WITH_WSREP */ - DBUG_RETURN(0); - - /* -@@ -8768,7 +8916,12 @@ - DBUG_ENTER("THD::binlog_query"); - DBUG_PRINT("enter", ("qtype: %s query: '%s'", - show_query_type(qtype), query_arg)); -+#ifdef WITH_WSREP -+ DBUG_ASSERT(query_arg && (WSREP_EMULATE_BINLOG(this) -+ || mysql_bin_log.is_open())); -+#else - DBUG_ASSERT(query_arg && mysql_bin_log.is_open()); -+#endif /* WITH_WSREP */ - - if (get_binlog_local_stmt_filter() == BINLOG_FILTER_SET) - { -@@ -8872,6 +9025,64 @@ - } - - #endif /* !defined(MYSQL_CLIENT) */ -+#ifdef WITH_WSREP -+IO_CACHE * get_trans_log(THD * thd) -+{ -+ binlog_cache_mngr *const cache_mngr= thd_get_cache_mngr(thd); -+ if (cache_mngr) -+ { -+ return cache_mngr->get_binlog_cache_log(true); -+ } -+ else -+ { -+ WSREP_DEBUG("binlog cache not initialized, conn :%ld", thd->thread_id); -+ return NULL; -+ } -+} -+ -+bool wsrep_trans_cache_is_empty(THD *thd) -+{ -+ binlog_cache_mngr *const cache_mngr= -+ (binlog_cache_mngr*) thd_get_ha_data(thd, binlog_hton); -+ return (!cache_mngr || cache_mngr->trx_cache.is_binlog_empty()); -+} -+ -+void thd_binlog_flush_pending_rows_event(THD *thd, bool stmt_end) -+{ -+ thd->binlog_flush_pending_rows_event(stmt_end); -+} -+void thd_binlog_trx_reset(THD * thd) -+{ -+ /* -+ todo: fix autocommit select to not call the caller -+ */ -+ if (thd_get_ha_data(thd, binlog_hton) != NULL) -+ { -+ binlog_cache_mngr *const cache_mngr= thd_get_cache_mngr(thd); -+ if (cache_mngr) cache_mngr->trx_cache.reset(); -+ } -+ thd->clear_binlog_table_maps(); -+} -+ -+TC_LOG::enum_result wsrep_thd_binlog_commit(THD* thd, bool all) -+{ -+ /* applier and replayer can skip binlog commit */ -+ if (WSREP_EMULATE_BINLOG(thd) && (thd->wsrep_exec_mode != REPL_RECV)) -+ return mysql_bin_log.commit(thd, all); -+ else -+ return (ha_commit_low(thd, all) ? -+ TC_LOG::RESULT_ABORTED : TC_LOG::RESULT_SUCCESS); -+} -+ -+int wsrep_thd_binlog_rollback(THD* thd, bool all) -+{ -+ /* applier and replayer can skip binlog rollback */ -+ if (WSREP_EMULATE_BINLOG(thd) && (thd->wsrep_exec_mode != REPL_RECV)) -+ return mysql_bin_log.rollback(thd, all); -+ else -+ return ha_rollback_low(thd, all); -+} -+#endif /* WITH_WSREP */ - - struct st_mysql_storage_engine binlog_storage_engine= - { MYSQL_HANDLERTON_INTERFACE_VERSION }; - -=== modified file 'sql/events.cc' ---- old/sql/events.cc 2014-01-06 06:03:08 +0000 -+++ new/sql/events.cc 2014-03-11 21:17:40 +0000 -@@ -1183,7 +1183,19 @@ - close_mysql_tables(thd); - DBUG_RETURN(ret); - } -+#ifdef WITH_WSREP -+int wsrep_create_event_query(THD *thd, uchar** buf, size_t* buf_len) -+{ -+ String log_query; - -+ if (create_query_string(thd, &log_query)) -+ { -+ WSREP_WARN("events create string failed: %s", thd->query()); -+ return 1; -+ } -+ return wsrep_to_buf_helper(thd, log_query.ptr(), log_query.length(), buf, buf_len); -+} -+#endif /* WITH_WSREP */ - /** - @} (End of group Event_Scheduler) - */ - -=== modified file 'sql/ha_partition.cc' ---- old/sql/ha_partition.cc 2013-11-20 12:44:46 +0000 -+++ new/sql/ha_partition.cc 2014-03-11 21:17:40 +0000 -@@ -375,7 +375,13 @@ - // we can do this since we only support a single engine type - return m_file[0]->table_type(); - } -- -+#ifdef WITH_WSREP -+int ha_partition::wsrep_db_type() const -+{ -+ // we can do this since we only support a single engine type -+ return ha_legacy_type(m_file[0]->ht); -+} -+#endif /* WITH_WSREP */ - - /* - Destructor method - -=== modified file 'sql/ha_partition.h' ---- old/sql/ha_partition.h 2013-10-21 06:44:47 +0000 -+++ new/sql/ha_partition.h 2014-02-26 14:44:13 +0000 -@@ -1238,6 +1238,9 @@ - ------------------------------------------------------------------------- - virtual void append_create_info(String *packet) - */ -+#ifdef WITH_WSREP -+ virtual int wsrep_db_type() const; -+#endif /* WITH_WSREP */ - }; - - #endif /* HA_PARTITION_INCLUDED */ - -=== modified file 'sql/handler.cc' ---- old/sql/handler.cc 2013-12-28 16:38:40 +0000 -+++ new/sql/handler.cc 2014-03-11 21:17:40 +0000 -@@ -60,7 +60,9 @@ - return (log(x) / M_LN2); - } - #endif -- -+#ifdef WITH_WSREP -+#include "wsrep_mysqld.h" -+#endif - /* - While we have legacy_db_type, we have this array to - check for dups and to find handlerton from legacy_db_type. -@@ -1218,10 +1220,27 @@ - { - if ((err= ht->prepare(ht, thd, all))) - { -+#ifdef WITH_WSREP -+ if (WSREP(thd) && ht->db_type== DB_TYPE_WSREP) -+ { -+ error= 1; -+ /* avoid sending error, if we need to replay */ -+ if (thd->wsrep_conflict_state!= MUST_REPLAY) -+ { -+ my_error(ER_LOCK_DEADLOCK, MYF(0), err); -+ } -+ } -+ else -+ { -+ /* not wsrep hton, bail to native mysql behavior */ -+#endif - my_error(ER_ERROR_DURING_COMMIT, MYF(0), err); - ha_rollback_trans(thd, all); - error=1; - break; -+#ifdef WITH_WSREP -+ } -+#endif - } - } - else -@@ -1232,7 +1251,6 @@ - } - } - } -- - DBUG_RETURN(error); - } - -@@ -1407,7 +1425,12 @@ - MDL_EXPLICIT); - - DBUG_PRINT("debug", ("Acquire MDL commit lock")); -+#ifdef WITH_WSREP -+ if (!WSREP(thd) && -+ thd->mdl_context.acquire_lock(&mdl_request, -+#else - if (thd->mdl_context.acquire_lock(&mdl_request, -+#endif /* WITH_WSREP */ - thd->variables.lock_wait_timeout)) - { - ha_rollback_trans(thd, all); -@@ -1481,7 +1504,19 @@ - int error=0; - THD_TRANS *trans=all ? &thd->transaction.all : &thd->transaction.stmt; - Ha_trx_info *ha_info= trans->ha_list, *ha_info_next; -+ - DBUG_ENTER("ha_commit_low"); -+#ifdef WITH_WSREP -+#ifdef WSREP_PROC_INFO -+ char info[64]= { 0, }; -+ snprintf (info, sizeof(info) - 1, "ha_commit_one_phase(%lld)", -+ (long long)wsrep_thd_trx_seqno(thd)); -+#else -+ const char info[]="ha_commit_one_phase()"; -+#endif /* WSREP_PROC_INFO */ -+ char* tmp_info= NULL; -+ if (WSREP(thd)) tmp_info= (char *)thd_proc_info(thd, info); -+#endif /* WITH_WSREP */ - - if (ha_info) - { -@@ -1511,7 +1546,10 @@ - } - /* Free resources and perform other cleanup even for 'empty' transactions. */ - if (all) -- thd->transaction.cleanup(); -+ thd->transaction.cleanup(); -+#ifdef WITH_WSREP -+ if (WSREP(thd)) thd_proc_info(thd, tmp_info); -+#endif /* WITH_WSREP */ - /* - When the transaction has been committed, we clear the commit_low - flag. This allow other parts of the system to check if commit_low -@@ -1626,7 +1664,7 @@ - - /* Always cleanup. Even if nht==0. There may be savepoints. */ - if (is_real_trans) -- thd->transaction.cleanup(); -+ thd->transaction.cleanup(); - if (all) - thd->transaction_rollback_request= FALSE; - -@@ -1797,7 +1835,13 @@ - got, ha_resolve_storage_engine_name(hton)); - for (int i=0; i < got; i ++) - { -+#ifdef WITH_WSREP -+ my_xid x=(wsrep_is_wsrep_xid(&info->list[i]) ? -+ wsrep_xid_seqno(&info->list[i]) : -+ info->list[i].get_my_xid()); -+#else - my_xid x=info->list[i].get_my_xid(); -+#endif /* WITH_WSREP */ - if (!x) // not "mine" - that is generated by external TM - { - #ifndef DBUG_OFF -@@ -1866,7 +1910,9 @@ - for now, only InnoDB supports 2pc. It means we can always safely - rollback all pending transactions, without risking inconsistent data - */ -+#ifndef WITH_WSREP - DBUG_ASSERT(total_ha_2pc == (ulong) opt_bin_log+1); // only InnoDB and binlog -+#endif - tc_heuristic_recover= TC_HEURISTIC_RECOVER_ROLLBACK; // forcing ROLLBACK - info.dry_run=FALSE; - #endif -@@ -2102,8 +2148,35 @@ - continue; - if ((err= ht->prepare(ht, thd, all))) - { -+#ifdef WITH_WSREP -+ if (WSREP(thd) && ht->db_type== DB_TYPE_WSREP) -+ { -+ error= 1; -+ switch (err) -+ { -+ case WSREP_TRX_SIZE_EXCEEDED: -+ /* give user size exeeded erro from wsrep_api.h */ -+ my_error(ER_ERROR_DURING_COMMIT, MYF(0), WSREP_SIZE_EXCEEDED); -+ break; -+ case WSREP_TRX_CERT_FAIL: -+ case WSREP_TRX_ERROR: -+ /* avoid sending error, if we need to replay */ -+ if (thd->wsrep_conflict_state!= MUST_REPLAY) -+ { -+ my_error(ER_LOCK_DEADLOCK, MYF(0), err); -+ } -+ } -+ } -+ -+ else -+ { -+ /* not wsrep hton, bail to native mysql behavior */ -+#endif - my_error(ER_ERROR_DURING_COMMIT, MYF(0), err); - error= 1; -+#ifdef WITH_WSREP -+ } -+#endif - } - status_var_increment(thd->status_var.ha_prepare_count); - } -@@ -3328,7 +3401,12 @@ - variables->auto_increment_increment); - auto_inc_intervals_count++; - /* Row-based replication does not need to store intervals in binlog */ -+#ifdef WITH_WSREP -+ if (((WSREP_EMULATE_BINLOG(thd)) || mysql_bin_log.is_open()) && -+ !thd->is_current_stmt_binlog_format_row()) -+#else - if (mysql_bin_log.is_open() && !thd->is_current_stmt_binlog_format_row()) -+#endif /* WITH_WSREP */ - thd->auto_inc_intervals_in_cur_stmt_for_binlog.append(auto_inc_interval_for_cur_row.minimum(), - auto_inc_interval_for_cur_row.values(), - variables->auto_increment_increment); -@@ -4613,7 +4691,9 @@ - int error=0; - DBUG_ENTER("ha_enable_transaction"); - DBUG_PRINT("enter", ("on: %d", (int) on)); -- -+#ifdef WITH_WSREP -+ if (thd->wsrep_applier) DBUG_RETURN(0); -+#endif - if ((thd->transaction.flags.enabled= on)) - { - /* -@@ -7009,7 +7089,13 @@ - return (thd->is_current_stmt_binlog_format_row() && - table->s->cached_row_logging_check && - (thd->variables.option_bits & OPTION_BIN_LOG) && -+#ifdef WITH_WSREP -+ /* applier and replayer should not binlog */ -+ ((WSREP_EMULATE_BINLOG(thd) && (thd->wsrep_exec_mode != REPL_RECV)) || -+ mysql_bin_log.is_open())); -+#else - mysql_bin_log.is_open()); -+#endif - } - - -@@ -7110,6 +7196,17 @@ - bool error= 0; - THD *const thd= table->in_use; - -+#ifdef WITH_WSREP -+ /* only InnoDB tables will be replicated through binlog emulation */ -+ if (WSREP_EMULATE_BINLOG(thd) && -+ table->file->ht->db_type != DB_TYPE_INNODB && -+ !(table->file->ht->db_type == DB_TYPE_PARTITION_DB && -+ (((ha_partition*)(table->file))->wsrep_db_type() == DB_TYPE_INNODB))) -+ // !strcmp(table->file->table_type(), "InnoDB")) -+ { -+ return 0; -+ } -+#endif /* WITH_WSREP */ - if (check_table_binlog_row_based(thd, table)) - { - DBUG_DUMP("read_set 10", (uchar*) table->read_set->bitmap, -@@ -7430,6 +7527,64 @@ - DBUG_VOID_RETURN; - } - -+#ifdef WITH_WSREP -+/** -+ @details -+ This function makes the storage engine to force the victim transaction -+ to abort. Currently, only innodb has this functionality, but any SE -+ implementing the wsrep API should provide this service to support -+ multi-master operation. -+ -+ @param bf_thd brute force THD asking for the abort -+ @param victim_thd victim THD to be aborted -+ -+ @return -+ always 0 -+*/ -+ -+int ha_wsrep_abort_transaction(THD *bf_thd, THD *victim_thd, my_bool signal) -+{ -+ DBUG_ENTER("ha_wsrep_abort_transaction"); -+ if (!WSREP(bf_thd) && -+ !(wsrep_OSU_method_options == WSREP_OSU_RSU && -+ bf_thd->wsrep_exec_mode == TOTAL_ORDER)) { -+ DBUG_RETURN(0); -+ } -+ -+ handlerton *hton= installed_htons[DB_TYPE_INNODB]; -+ if (hton && hton->wsrep_abort_transaction) -+ { -+ hton->wsrep_abort_transaction(hton, bf_thd, victim_thd, signal); -+ } -+ else -+ { -+ WSREP_WARN("cannot abort InnoDB transaction"); -+ } -+ -+ DBUG_RETURN(0); -+} -+ -+void ha_wsrep_fake_trx_id(THD *thd) -+{ -+ DBUG_ENTER("ha_wsrep_fake_trx_id"); -+ if (!WSREP(thd)) -+ { -+ DBUG_VOID_RETURN; -+ } -+ -+ handlerton *hton= installed_htons[DB_TYPE_INNODB]; -+ if (hton && hton->wsrep_fake_trx_id) -+ { -+ hton->wsrep_fake_trx_id(hton, thd); -+ } -+ else -+ { -+ WSREP_WARN("cannot get get fake InnoDB transaction ID"); -+ } -+ -+ DBUG_VOID_RETURN; -+} -+#endif /* WITH_WSREP */ - #ifdef TRANS_LOG_MGM_EXAMPLE_CODE - /* - Example of transaction log management functions based on assumption that logs - -=== modified file 'sql/handler.h' ---- old/sql/handler.h 2013-12-28 16:38:40 +0000 -+++ new/sql/handler.h 2014-03-11 21:17:40 +0000 -@@ -392,6 +392,7 @@ - DB_TYPE_MARIA, - /** Performance schema engine. */ - DB_TYPE_PERFORMANCE_SCHEMA, -+ DB_TYPE_WSREP, - DB_TYPE_FIRST_DYNAMIC=42, - DB_TYPE_DEFAULT=127 // Must be last - }; -@@ -924,6 +925,11 @@ - const char *wild, bool dir, List *files); - int (*table_exists_in_engine)(handlerton *hton, THD* thd, const char *db, - const char *name); -+ int (*wsrep_abort_transaction)(handlerton *hton, THD *bf_thd, -+ THD *victim_thd, my_bool signal); -+ int (*wsrep_set_checkpoint)(handlerton *hton, const XID* xid); -+ int (*wsrep_get_checkpoint)(handlerton *hton, XID* xid); -+ void (*wsrep_fake_trx_id)(handlerton *hton, THD *thd); - int (*make_pushed_join)(handlerton *hton, THD* thd, - const AQP::Join_plan* plan); - -@@ -3325,6 +3331,9 @@ - extern const char *ha_row_type[]; - extern MYSQL_PLUGIN_IMPORT const char *tx_isolation_names[]; - extern MYSQL_PLUGIN_IMPORT const char *binlog_format_names[]; -+#ifdef WITH_WSREP -+extern MYSQL_PLUGIN_IMPORT const char *wsrep_binlog_format_names[]; -+#endif /* WITH_WSREP */ - extern TYPELIB tx_isolation_typelib; - extern const char *myisam_stats_method_names[]; - extern ulong total_ha, total_ha_2pc; -@@ -3433,6 +3442,10 @@ - bool ha_rollback_to_savepoint_can_release_mdl(THD *thd); - int ha_savepoint(THD *thd, SAVEPOINT *sv); - int ha_release_savepoint(THD *thd, SAVEPOINT *sv); -+#ifdef WITH_WSREP -+int ha_wsrep_abort_transaction(THD *bf_thd, THD *victim_thd, my_bool signal); -+void ha_wsrep_fake_trx_id(THD *thd); -+#endif /* WITH_WSREP */ - - /* Build pushed joins in handlers implementing this feature */ - int ha_make_pushed_joins(THD *thd, const AQP::Join_plan* plan); -@@ -3464,6 +3477,9 @@ - #define ha_binlog_log_query(a,b,c,d,e,f,g) do {} while (0) - #define ha_binlog_wait(a) do {} while (0) - #endif -+#ifdef WITH_WSREP -+void wsrep_brute_force_aborts(); -+#endif - - /* It is required by basic binlog features on both MySQL server and libmysqld */ - int ha_binlog_end(THD *thd); - -=== modified file 'sql/item_func.cc' ---- old/sql/item_func.cc 2013-10-30 23:22:43 +0000 -+++ new/sql/item_func.cc 2013-12-11 10:24:00 +0000 -@@ -2616,7 +2616,19 @@ - TODO: do not do reinit 'rand' for every execute of PS/SP if - args[0] is a constant. - */ -+#ifdef WITH_WSREP -+ uint32 tmp; -+ if (WSREP(current_thd)) -+ { -+ if (current_thd->wsrep_exec_mode==REPL_RECV) -+ tmp= current_thd->wsrep_rand; -+ else -+ tmp= current_thd->wsrep_rand= (uint32) arg->val_int(); -+ } else -+ tmp= (uint32) arg->val_int(); -+#else - uint32 tmp= (uint32) arg->val_int(); -+#endif - randominit(rand, (uint32) (tmp*0x10001L+55555555L), - (uint32) (tmp*0x10000001L)); - } - -=== modified file 'sql/lock.cc' ---- old/sql/lock.cc 2012-11-30 14:35:31 +0000 -+++ new/sql/lock.cc 2013-02-12 21:54:12 +0000 -@@ -83,6 +83,10 @@ - #include - #include - -+#ifdef WITH_WSREP -+#include "wsrep_mysqld.h" -+#endif /* WITH_WSREP */ -+ - /** - @defgroup Locking Locking - @{ -@@ -314,6 +318,10 @@ - /* Copy the lock data array. thr_multi_lock() reorders its contents. */ - memcpy(sql_lock->locks + sql_lock->lock_count, sql_lock->locks, - sql_lock->lock_count * sizeof(*sql_lock->locks)); -+#ifdef WITH_WSREP -+ //thd->main_lock_id.info->in_lock_tables= thd->in_lock_tables; -+ thd->lock_info.in_lock_tables= thd->in_lock_tables; -+#endif /* Lock on the copied half of the lock data array. */ - /* Lock on the copied half of the lock data array. */ - rc= thr_lock_errno_to_mysql[(int) thr_multi_lock(sql_lock->locks + - sql_lock->lock_count, -@@ -1014,11 +1022,15 @@ - { - thd->mdl_context.release_lock(m_mdl_blocks_commits_lock); - m_mdl_blocks_commits_lock= NULL; -+#ifdef WITH_WSREP -+ wsrep_locked_seqno= WSREP_SEQNO_UNDEFINED; -+ wsrep->resume(wsrep); -+#endif /* WITH_WSREP */ - } - thd->mdl_context.release_lock(m_mdl_global_shared_lock); - m_mdl_global_shared_lock= NULL; - m_state= GRL_NONE; -- -+ - DBUG_VOID_RETURN; - } - -@@ -1046,6 +1058,20 @@ - If we didn't succeed lock_global_read_lock(), or if we already suceeded - make_global_read_lock_block_commit(), do nothing. - */ -+ -+#ifdef WITH_WSREP -+ if (m_mdl_blocks_commits_lock) -+ { -+ WSREP_DEBUG("GRL was in block commit mode when entering " -+ "make_global_read_lock_block_commit"); -+ thd->mdl_context.release_lock(m_mdl_blocks_commits_lock); -+ m_mdl_blocks_commits_lock= NULL; -+ wsrep_locked_seqno= WSREP_SEQNO_UNDEFINED; -+ wsrep->resume(wsrep); -+ m_state= GRL_ACQUIRED; -+ } -+#endif /* WITH_WSREP */ -+ - if (m_state != GRL_ACQUIRED) - DBUG_RETURN(0); - -@@ -1058,6 +1084,22 @@ - m_mdl_blocks_commits_lock= mdl_request.ticket; - m_state= GRL_ACQUIRED_AND_BLOCKS_COMMIT; - -+#ifdef WITH_WSREP -+ long long ret = wsrep->pause(wsrep); -+ if (ret >= 0) -+ { -+ wsrep_locked_seqno= ret; -+ } -+ else if (ret != -ENOSYS) /* -ENOSYS - no provider */ -+ { -+ WSREP_ERROR("Failed to pause provider: %lld (%s)", -ret, strerror(-ret)); -+ -+ /* m_mdl_blocks_commits_lock is always NULL here */ -+ wsrep_locked_seqno= WSREP_SEQNO_UNDEFINED; -+ my_error(ER_LOCK_DEADLOCK, MYF(0)); -+ DBUG_RETURN(TRUE); -+ } -+#endif /* WITH_WSREP */ - DBUG_RETURN(FALSE); - } - - -=== modified file 'sql/log.cc' ---- old/sql/log.cc 2014-01-06 06:03:08 +0000 -+++ new/sql/log.cc 2014-03-11 21:17:40 +0000 -@@ -39,6 +39,9 @@ - #include - #include - #include // For test_if_number -+#ifdef WITH_WSREP -+#include "wsrep_mysqld.h" -+#endif /* WITH_WSREP */ - - #ifdef _WIN32 - #include "message.h" -@@ -300,7 +303,6 @@ - } - } - -- - /* Check if a given table is opened log table */ - int check_if_log_table(size_t db_len, const char *db, size_t table_name_len, - const char *table_name, bool check_if_opened) -@@ -2402,6 +2404,7 @@ - - /********* transaction coordinator log for 2pc - mmap() based solution *******/ - -+ - /* - the log consists of a file, mmapped to a memory. - file is divided on pages of tc_log_page_size size. -@@ -2517,8 +2520,14 @@ - mysql_mutex_init(key_PAGE_lock, &pg->lock, MY_MUTEX_INIT_FAST); - mysql_cond_init(key_PAGE_cond, &pg->cond, 0); - pg->start=(my_xid *)(data + i*tc_log_page_size); -+#ifdef WITH_WSREP -+ if (!WSREP_ON) -+#endif /* WITH_WSREP */ - pg->end=(my_xid *)(pg->start + tc_log_page_size); - pg->size=pg->free=tc_log_page_size/sizeof(my_xid); -+#ifdef WITH_WSREP -+ if (WSREP_ON) pg->end=pg->start + pg->size; -+#endif /* WITH_WSREP */ - } - pages[0].size=pages[0].free= - (tc_log_page_size-TC_LOG_HEADER_SIZE)/sizeof(my_xid); - -=== modified file 'sql/log.h' ---- old/sql/log.h 2014-01-06 05:23:19 +0000 -+++ new/sql/log.h 2014-03-11 21:17:40 +0000 -@@ -104,6 +104,14 @@ - virtual int prepare(THD *thd, bool all) = 0; - }; - -+#ifdef WITH_WSREP -+/* -+ Wrappers to MYSQL_BIN_LOG commit()/rollback() when wsrep_emulate_bin_log -+ is on. -+ */ -+TC_LOG::enum_result wsrep_thd_binlog_commit(THD* thd, bool all); -+int wsrep_thd_binlog_rollback(THD * thd, bool all); -+#endif /* WITH_WSREP */ - - class TC_LOG_DUMMY: public TC_LOG // use it to disable the logging - { -@@ -112,10 +120,18 @@ - int open(const char *opt_name) { return 0; } - void close() { } - enum_result commit(THD *thd, bool all) { -+#ifdef WITH_WSREP -+ return wsrep_thd_binlog_commit(thd, all); -+#else - return ha_commit_low(thd, all) ? RESULT_ABORTED : RESULT_SUCCESS; -+#endif /* WITH_WSREP */ - } - int rollback(THD *thd, bool all) { -+#ifdef WITH_WSREP -+ return wsrep_thd_binlog_rollback(thd, all); -+#else - return ha_rollback_low(thd, all); -+#endif /* WITH_WSREP */ - } - int prepare(THD *thd, bool all) { - return ha_prepare_low(thd, all); -@@ -542,12 +558,28 @@ - }; - - enum enum_binlog_format { -+ /* -+ statement-based except for cases where only row-based can work (UUID() -+ etc): -+ */ - BINLOG_FORMAT_MIXED= 0, ///< statement if safe, otherwise row - autodetected - BINLOG_FORMAT_STMT= 1, ///< statement-based - BINLOG_FORMAT_ROW= 2, ///< row-based - BINLOG_FORMAT_UNSPEC=3 ///< thd_binlog_format() returns it when binlog is closed - }; - -+#ifdef WITH_WSREP -+IO_CACHE* get_trans_log(THD * thd); -+bool wsrep_trans_cache_is_empty(THD *thd); -+void thd_binlog_flush_pending_rows_event(THD *thd, bool stmt_end); -+void thd_binlog_trx_reset(THD * thd); -+ -+#define WSREP_BINLOG_FORMAT(my_format) \ -+ ((wsrep_forced_binlog_format != BINLOG_FORMAT_UNSPEC) ? \ -+ wsrep_forced_binlog_format : my_format) -+#else -+#define WSREP_BINLOG_FORMAT(my_format) my_format -+#endif /* WITH_WSREP */ - int query_error_code(THD *thd, bool not_killed); - uint purge_log_get_error_code(int res); - - -=== modified file 'sql/log_event.cc' ---- old/sql/log_event.cc 2013-12-17 16:56:45 +0000 -+++ new/sql/log_event.cc 2014-03-11 21:17:40 +0000 -@@ -47,6 +47,9 @@ - #include "sql_show.h" // append_identifier - #include - -+#if WITH_WSREP -+#include "wsrep_mysqld.h" -+#endif - #endif /* MYSQL_CLIENT */ - - #include -@@ -3533,6 +3536,14 @@ - master_data_written(0), mts_accessed_dbs(0) - { - -+#ifdef WITH_WSREP -+ /* -+ If Query_log_event will contain non trans keyword (not BEGIN, COMMIT, -+ SAVEPOINT or ROLLBACK) we disable PA for this transaction. -+ */ -+ if (!is_trans_keyword()) -+ thd->wsrep_PA_safe= false; -+#endif /* WITH_WSREP */ - memset(&user, 0, sizeof(user)); - memset(&host, 0, sizeof(host)); - -@@ -10951,6 +10962,18 @@ - if (open_and_lock_tables(thd, rli->tables_to_lock, FALSE, 0)) - { - uint actual_error= thd->get_stmt_da()->sql_errno(); -+#ifdef WITH_WSREP -+ if (WSREP(thd)) -+ { -+ WSREP_WARN("BF applier failed to open_and_lock_tables: %u, fatal: %d " -+ "wsrep = (exec_mode: %d conflict_state: %d seqno: %lld)", -+ thd->get_stmt_da()->sql_errno(), -+ thd->is_fatal_error, -+ thd->wsrep_exec_mode, -+ thd->wsrep_conflict_state, -+ (long long)wsrep_thd_trx_seqno(thd)); -+ } -+#endif - if (thd->is_slave_error || thd->is_fatal_error) - { - /* -@@ -11898,7 +11921,12 @@ - DBUG_ENTER("check_table_map"); - enum_tbl_map_status res= OK_TO_PROCESS; - -+#ifdef WITH_WSREP -+ if ((rli->info_thd->slave_thread /* filtering is for slave only */ || -+ (WSREP(rli->info_thd) && rli->info_thd->wsrep_applier)) && -+#else - if (rli->info_thd->slave_thread /* filtering is for slave only */ && -+#endif /* WITH_WSREP */ - (!rpl_filter->db_ok(table_list->db) || - (rpl_filter->is_on() && !rpl_filter->tables_ok("", table_list)))) - res= FILTERED_OUT; -@@ -12593,8 +12621,23 @@ - Write_rows_log_event::do_exec_row(const Relay_log_info *const rli) - { - DBUG_ASSERT(m_table != NULL); -+#ifdef WITH_WSREP -+#ifdef WSREP_PROC_INFO -+ char info[64]; -+ info[sizeof(info) - 1] = '\0'; -+ snprintf(info, sizeof(info) - 1, "Write_rows_log_event::write_row(%lld)", -+ (long long) wsrep_thd_trx_seqno(thd)); -+ const char* tmp = (WSREP(thd)) ? thd_proc_info(thd, info) : NULL; -+#else -+ const char* tmp = (WSREP(thd)) ? -+ thd_proc_info(thd,"Write_rows_log_event::write_row()") : NULL; -+#endif /* WSREP_PROC_INFO */ -+#endif /* WITH_WSREP */ - int error= write_row(rli, slave_exec_mode == SLAVE_EXEC_MODE_IDEMPOTENT); - -+#ifdef WITH_WSREP -+ if (WSREP(thd)) thd_proc_info(thd, tmp); -+#endif /* WITH_WSREP */ - if (error && !thd->is_error()) - { - DBUG_ASSERT(0); - -=== modified file 'sql/mdl.cc' ---- old/sql/mdl.cc 2013-10-31 21:42:33 +0000 -+++ new/sql/mdl.cc 2014-01-09 15:46:55 +0000 -@@ -24,6 +24,17 @@ - #include - #include - -+#ifdef WITH_WSREP -+#include "wsrep_mysqld.h" -+#include "wsrep_thd.h" -+extern "C" my_thread_id wsrep_thd_thread_id(THD *thd); -+extern "C" char *wsrep_thd_query(THD *thd); -+void sql_print_information(const char *format, ...) -+ ATTRIBUTE_FORMAT(printf, 1, 2); -+extern bool -+wsrep_grant_mdl_exception(MDL_context *requestor_ctx, -+ MDL_ticket *ticket); -+#endif /* WITH_WSREP */ - #ifdef HAVE_PSI_INTERFACE - static PSI_mutex_key key_MDL_map_mutex; - static PSI_mutex_key key_MDL_wait_LOCK_wait_status; -@@ -1389,11 +1400,54 @@ - called by other threads. - */ - DBUG_ASSERT(ticket->get_lock()); -+#ifdef WITH_WSREP -+ if ((this == &(ticket->get_lock()->m_waiting)) && -+ wsrep_thd_is_BF((void *)(ticket->get_ctx()->wsrep_get_thd()), false)) -+ { -+ Ticket_iterator itw(ticket->get_lock()->m_waiting); -+ Ticket_iterator itg(ticket->get_lock()->m_granted); -+ -+ MDL_ticket *waiting, *granted; -+ MDL_ticket *prev=NULL; -+ bool added= false; -+ -+ while ((waiting= itw++) && !added) -+ { -+ if (!wsrep_thd_is_BF((void *)(waiting->get_ctx()->wsrep_get_thd()), true)) -+ { -+ WSREP_DEBUG("MDL add_ticket inserted before: %lu %s", -+ wsrep_thd_thread_id(waiting->get_ctx()->wsrep_get_thd()), -+ wsrep_thd_query(waiting->get_ctx()->wsrep_get_thd())); -+ m_list.insert_after(prev, ticket); -+ added= true; -+ } -+ prev= waiting; -+ } -+ if (!added) m_list.push_back(ticket); -+ -+ while ((granted= itg++)) -+ { -+ if (granted->get_ctx() != ticket->get_ctx() && -+ granted->is_incompatible_when_granted(ticket->get_type())) -+ { -+ if (!wsrep_grant_mdl_exception(ticket->get_ctx(), granted)) -+ { -+ WSREP_DEBUG("MDL victim killed at add_ticket"); -+ } -+ } -+ } -+ } -+ else -+ { -+#endif /* WITH_WSREP */ - /* - Add ticket to the *back* of the queue to ensure fairness - among requests with the same priority. - */ - m_list.push_back(ticket); -+#ifdef WITH_WSREP -+ } -+#endif /* WITH_WSREP */ - m_bitmap|= MDL_BIT(ticket->get_type()); - } - -@@ -1709,7 +1763,6 @@ - 0 - }; - -- - /** - Check if request for the metadata lock can be satisfied given its - current state. -@@ -1734,6 +1787,9 @@ - bool can_grant= FALSE; - bitmap_t waiting_incompat_map= incompatible_waiting_types_bitmap()[type_arg]; - bitmap_t granted_incompat_map= incompatible_granted_types_bitmap()[type_arg]; -+#ifdef WITH_WSREP -+ bool wsrep_can_grant= TRUE; -+#endif /* WITH_WSREP */ - - /* - New lock request can be satisfied iff: -@@ -1756,12 +1812,59 @@ - { - if (ticket->get_ctx() != requestor_ctx && - ticket->is_incompatible_when_granted(type_arg)) -+#ifdef WITH_WSREP -+ { -+ if (wsrep_thd_is_BF((void *)(requestor_ctx->wsrep_get_thd()),false) && -+ key.mdl_namespace() == MDL_key::GLOBAL) -+ { -+ WSREP_DEBUG("global lock granted for BF: %lu %s", -+ wsrep_thd_thread_id(requestor_ctx->wsrep_get_thd()), -+ wsrep_thd_query(requestor_ctx->wsrep_get_thd())); -+ can_grant = true; -+ } -+ else if (!wsrep_grant_mdl_exception(requestor_ctx, ticket)) -+ { -+ wsrep_can_grant= FALSE; -+ if (wsrep_log_conflicts) -+ { -+ MDL_lock * lock = ticket->get_lock(); -+ WSREP_INFO( -+ "MDL conflict db=%s table=%s ticket=%d solved by %s", -+ lock->key.db_name(), lock->key.name(), ticket->get_type(), "abort" -+ ); -+ } -+ } -+ else -+ { -+ can_grant= TRUE; -+ } -+ } -+#else - break; -+#endif /* WITH_WSREP */ - } -+#ifdef WITH_WSREP -+ if ((ticket == NULL) && wsrep_can_grant) -+#else - if (ticket == NULL) /* Incompatible locks are our own. */ -+#endif /* WITH_WSREP */ -+ - can_grant= TRUE; - } - } -+#ifdef WITH_WSREP -+ else -+ { -+ if (wsrep_thd_is_BF((void *)(requestor_ctx->wsrep_get_thd()), false) && -+ key.mdl_namespace() == MDL_key::GLOBAL) -+ { -+ WSREP_DEBUG("global lock granted for BF (waiting queue): %lu %s", -+ wsrep_thd_thread_id(requestor_ctx->wsrep_get_thd()), -+ wsrep_thd_query(requestor_ctx->wsrep_get_thd())); -+ can_grant = true; -+ } -+ } -+#endif /* WITH_WSREP */ - return can_grant; - } - -@@ -2780,6 +2883,12 @@ - } - - -+#ifdef WITH_WSREP -+void MDL_context::release_explicit_locks() -+{ -+ release_locks_stored_before(MDL_EXPLICIT, NULL); -+} -+#endif - /** - Release all explicit locks in the context which correspond to the - same name/object as this lock request. -@@ -3068,3 +3177,32 @@ - ticket->m_duration= MDL_TRANSACTION; - #endif - } -+#ifdef WITH_WSREP -+void MDL_ticket::wsrep_report(bool debug) -+{ -+ if (debug) -+ { -+ WSREP_DEBUG("MDL ticket: type: %s space: %s db: %s name: %s", -+ (get_type() == MDL_INTENTION_EXCLUSIVE) ? "intention exclusive" : -+ ((get_type() == MDL_SHARED) ? "shared" : -+ ((get_type() == MDL_SHARED_HIGH_PRIO ? "shared high prio" : -+ ((get_type() == MDL_SHARED_READ) ? "shared read" : -+ ((get_type() == MDL_SHARED_WRITE) ? "shared write" : -+ ((get_type() == MDL_SHARED_NO_WRITE) ? "shared no write" : -+ ((get_type() == MDL_SHARED_NO_READ_WRITE) ? "shared no read write" : -+ ((get_type() == MDL_EXCLUSIVE) ? "exclusive" : -+ "UNKNOWN")))))))), -+ (m_lock->key.mdl_namespace() == MDL_key::GLOBAL) ? "GLOBAL" : -+ ((m_lock->key.mdl_namespace() == MDL_key::SCHEMA) ? "SCHEMA" : -+ ((m_lock->key.mdl_namespace() == MDL_key::TABLE) ? "TABLE" : -+ ((m_lock->key.mdl_namespace() == MDL_key::TABLE) ? "FUNCTION" : -+ ((m_lock->key.mdl_namespace() == MDL_key::TABLE) ? "PROCEDURE" : -+ ((m_lock->key.mdl_namespace() == MDL_key::TABLE) ? "TRIGGER" : -+ ((m_lock->key.mdl_namespace() == MDL_key::TABLE) ? "EVENT" : -+ ((m_lock->key.mdl_namespace() == MDL_key::COMMIT) ? "COMMIT" : -+ (char *)"UNKNOWN"))))))), -+ m_lock->key.db_name(), -+ m_lock->key.name()); -+ } -+} -+#endif /* WITH_WSREP */ - -=== modified file 'sql/mdl.h' ---- old/sql/mdl.h 2012-12-19 16:23:13 +0000 -+++ new/sql/mdl.h 2013-11-04 23:09:13 +0000 -@@ -577,6 +577,9 @@ - MDL_ticket *next_in_lock; - MDL_ticket **prev_in_lock; - public: -+#ifdef WITH_WSREP -+ void wsrep_report(bool debug); -+#endif /* WITH_WSREP */ - bool has_pending_conflicting_lock() const; - - MDL_context *get_ctx() const { return m_ctx; } -@@ -763,6 +766,13 @@ - m_tickets[MDL_EXPLICIT].is_empty()); - } - -+#ifdef WITH_WSREP -+ inline bool has_transactional_locks() const -+ { -+ return !m_tickets[MDL_TRANSACTION].is_empty(); -+ } -+#endif /* WITH_WSREP */ -+ - MDL_savepoint mdl_savepoint() - { - return MDL_savepoint(m_tickets[MDL_STATEMENT].front(), -@@ -775,6 +785,9 @@ - - void release_statement_locks(); - void release_transactional_locks(); -+#ifdef WITH_WSREP -+ void release_explicit_locks(); -+#endif - void rollback_to_savepoint(const MDL_savepoint &mdl_savepoint); - - MDL_context_owner *get_owner() { return m_owner; } -@@ -908,6 +921,9 @@ - MDL_ticket **out_ticket); - - public: -+#ifdef WITH_WSREP -+ THD *wsrep_get_thd() const { return get_thd(); } -+#endif /* WITH_WSREP */ - void find_deadlock(); - - bool visit_subgraph(MDL_wait_for_graph_visitor *dvisitor); - -=== modified file 'sql/mysqld.cc' ---- old/sql/mysqld.cc 2014-01-06 06:03:08 +0000 -+++ new/sql/mysqld.cc 2014-03-11 21:17:40 +0000 -@@ -71,6 +71,12 @@ - #include "probes_mysql.h" - #include "scheduler.h" - #include "debug_sync.h" -+#ifdef WITH_WSREP -+#include "wsrep_mysqld.h" -+#include "wsrep_var.h" -+#include "wsrep_thd.h" -+#include "wsrep_sst.h" -+#endif - #include "sql_callback.h" - #include "opt_trace_context.h" - -@@ -486,6 +492,10 @@ - my_bool opt_master_verify_checksum= 0; - my_bool opt_slave_sql_verify_checksum= 1; - const char *binlog_format_names[]= {"MIXED", "STATEMENT", "ROW", NullS}; -+#ifdef WITH_WSREP -+const char *wsrep_binlog_format_names[]= -+ {"MIXED", "STATEMENT", "ROW", "NONE", NullS}; -+#endif /*WITH_WSREP */ - my_bool enforce_gtid_consistency; - ulong gtid_mode; - const char *gtid_mode_names[]= -@@ -747,6 +757,23 @@ - mysql_mutex_t LOCK_server_started; - mysql_cond_t COND_server_started; - -+#ifdef WITH_WSREP -+mysql_mutex_t LOCK_wsrep_ready; -+mysql_cond_t COND_wsrep_ready; -+mysql_mutex_t LOCK_wsrep_sst; -+mysql_cond_t COND_wsrep_sst; -+mysql_mutex_t LOCK_wsrep_sst_init; -+mysql_cond_t COND_wsrep_sst_init; -+mysql_mutex_t LOCK_wsrep_rollback; -+mysql_cond_t COND_wsrep_rollback; -+wsrep_aborting_thd_t wsrep_aborting_thd= NULL; -+mysql_mutex_t LOCK_wsrep_replaying; -+mysql_cond_t COND_wsrep_replaying; -+mysql_mutex_t LOCK_wsrep_slave_threads; -+mysql_mutex_t LOCK_wsrep_desync; -+int wsrep_replaying= 0; -+static void wsrep_close_threads(THD* thd); -+#endif /* WITH_WSREP */ - int mysqld_server_started= 0; - - File_parser_dummy_hook file_parser_dummy_hook; -@@ -1403,6 +1430,11 @@ - /* We skip slave threads & scheduler on this first loop through. */ - if (tmp->slave_thread) - continue; -+#ifdef WITH_WSREP -+ /* skip wsrep system threads as well */ -+ if (WSREP(tmp) && (tmp->wsrep_exec_mode==REPL_RECV || tmp->wsrep_applier)) -+ continue; -+#endif /* WITH_WSREP */ - if (tmp->get_command() == COM_BINLOG_DUMP || - tmp->get_command() == COM_BINLOG_DUMP_GTID) - { -@@ -1505,6 +1537,33 @@ - tmp->main_security_ctx.user : "")); - close_connection(tmp); - } -+#ifdef WITH_WSREP -+ /* -+ * TODO: this code block may turn out redundant. wsrep->disconnect() -+ * should terminate slave threads gracefully, and we don't need -+ * to signal them here. -+ * The code here makes sure mysqld will not hang during shutdown -+ * even if wsrep provider has problems in shutting down. -+ */ -+ if (WSREP(tmp) && tmp->wsrep_exec_mode==REPL_RECV) -+ { -+ sql_print_information("closing wsrep system thread"); -+ tmp->killed= THD::KILL_CONNECTION; -+ MYSQL_CALLBACK(thread_scheduler, post_kill_notification, (tmp)); -+ if (tmp->mysys_var) -+ { -+ tmp->mysys_var->abort=1; -+ mysql_mutex_lock(&tmp->mysys_var->mutex); -+ if (tmp->mysys_var->current_cond) -+ { -+ mysql_mutex_lock(tmp->mysys_var->current_mutex); -+ mysql_cond_broadcast(tmp->mysys_var->current_cond); -+ mysql_mutex_unlock(tmp->mysys_var->current_mutex); -+ } -+ mysql_mutex_unlock(&tmp->mysys_var->mutex); -+ } -+ } -+#endif - } - DBUG_PRINT("quit",("Unlocking LOCK_thread_count")); - mysql_mutex_unlock(&LOCK_thread_count); -@@ -1654,8 +1713,14 @@ - } - } - #endif -+#ifdef WITH_WSREP -+ if (WSREP_ON) wsrep_stop_replication(NULL); -+#endif - - close_connections(); -+#ifdef WITH_WSREP -+ if (WSREP_ON) wsrep_deinit(); -+#endif - if (sig != MYSQL_KILL_SIGNAL && - sig != 0) - unireg_abort(1); /* purecov: inspected */ -@@ -1750,6 +1815,23 @@ - usage(); - if (exit_code) - sql_print_error("Aborting\n"); -+ -+#ifdef WITH_WSREP -+ if (wsrep) -+ { -+ /* This is an abort situation, we cannot expect to gracefully close all -+ * wsrep threads here, we can only diconnect from service */ -+ wsrep_close_client_connections(FALSE); -+ shutdown_in_progress= 1; -+ THD* thd(0); -+ wsrep->disconnect(wsrep); -+ WSREP_INFO("Service disconnected."); -+ wsrep_close_threads(thd); /* this won't close all threads */ -+ sleep(1); /* so give some time to exit for those which can */ -+ WSREP_INFO("Some threads may fail to exit."); -+ } -+#endif // WITH_WSREP -+ - clean_up(!opt_help && (exit_code || !opt_bootstrap)); /* purecov: inspected */ - DBUG_PRINT("quit",("done with cleanup in unireg_abort")); - mysqld_exit(exit_code); -@@ -1996,6 +2078,20 @@ - mysql_cond_destroy(&COND_thread_cache); - mysql_cond_destroy(&COND_flush_thread_cache); - mysql_cond_destroy(&COND_manager); -+#ifdef WITH_WSREP -+ (void) mysql_mutex_destroy(&LOCK_wsrep_ready); -+ (void) mysql_cond_destroy(&COND_wsrep_ready); -+ (void) mysql_mutex_destroy(&LOCK_wsrep_sst); -+ (void) mysql_cond_destroy(&COND_wsrep_sst); -+ (void) mysql_mutex_destroy(&LOCK_wsrep_sst_init); -+ (void) mysql_cond_destroy(&COND_wsrep_sst_init); -+ (void) mysql_mutex_destroy(&LOCK_wsrep_rollback); -+ (void) mysql_cond_destroy(&COND_wsrep_rollback); -+ (void) mysql_mutex_destroy(&LOCK_wsrep_replaying); -+ (void) mysql_cond_destroy(&COND_wsrep_replaying); -+ (void) mysql_mutex_destroy(&LOCK_wsrep_slave_threads); -+ (void) mysql_mutex_destroy(&LOCK_wsrep_desync); -+#endif - } - #endif /*EMBEDDED_LIBRARY*/ - -@@ -2444,6 +2540,9 @@ - socket_errno); - unireg_abort(1); - } -+#if defined(WITH_WSREP) && defined(HAVE_FCNTL) && defined(FD_CLOEXEC) -+ (void) fcntl(mysql_socket_getfd(ip_sock), F_SETFD, FD_CLOEXEC); -+#endif /* WITH_WSREP */ - } - - #ifdef _WIN32 -@@ -2540,6 +2639,9 @@ - if (mysql_socket_listen(unix_sock, (int)back_log) < 0) - sql_print_warning("listen() on Unix socket failed with error %d", - socket_errno); -+#if defined(WITH_WSREP) && defined(HAVE_FCNTL) && defined(FD_CLOEXEC) -+ (void) fcntl(mysql_socket_getfd(unix_sock), F_SETFD, FD_CLOEXEC); -+#endif /* WITH_WSREP */ - } - #endif - DBUG_PRINT("info",("server started")); -@@ -2559,7 +2661,11 @@ - @note - For the connection that is doing shutdown, this is called twice - */ -+#ifdef WITH_WSREP -+void close_connection(THD *thd, uint sql_errno, bool lock) -+#else - void close_connection(THD *thd, uint sql_errno) -+#endif - { - DBUG_ENTER("close_connection"); - -@@ -3787,6 +3893,13 @@ - strmake(default_logfile_name, glob_hostname, - sizeof(default_logfile_name)-5); - -+#ifdef WITH_WSREP -+ if (0 == wsrep_node_name || 0 == wsrep_node_name[0]) -+ { -+ my_free((void *)wsrep_node_name); -+ wsrep_node_name= my_strdup(glob_hostname, MYF(MY_WME)); -+ } -+#endif /* WITH_WSREP */ - strmake(pidfile_name, default_logfile_name, sizeof(pidfile_name)-5); - strmov(fn_ext(pidfile_name),".pid"); // Add proper extension - -@@ -3846,7 +3959,11 @@ - compile_time_assert(sizeof(com_status_vars)/sizeof(com_status_vars[0]) - 1 == - SQLCOM_END + 8); - #endif -- -+#ifdef WITH_WSREP -+ /* This is a protection against mutually incompatible option values. */ -+ if (WSREP_ON && wsrep_check_opts (remaining_argc, remaining_argv)) -+ return 1; -+#endif /* WITH_WSREP */ - if (get_options(&remaining_argc, &remaining_argv)) - return 1; - set_server_version(); -@@ -4253,6 +4370,27 @@ - sql_print_error("Can't create thread-keys"); - return 1; - } -+#ifdef WITH_WSREP -+ mysql_mutex_init(key_LOCK_wsrep_ready, -+ &LOCK_wsrep_ready, MY_MUTEX_INIT_FAST); -+ mysql_cond_init(key_COND_wsrep_ready, &COND_wsrep_ready, NULL); -+ mysql_mutex_init(key_LOCK_wsrep_sst, -+ &LOCK_wsrep_sst, MY_MUTEX_INIT_FAST); -+ mysql_cond_init(key_COND_wsrep_sst, &COND_wsrep_sst, NULL); -+ mysql_mutex_init(key_LOCK_wsrep_sst_init, -+ &LOCK_wsrep_sst_init, MY_MUTEX_INIT_FAST); -+ mysql_cond_init(key_COND_wsrep_sst_init, &COND_wsrep_sst_init, NULL); -+ mysql_mutex_init(key_LOCK_wsrep_rollback, -+ &LOCK_wsrep_rollback, MY_MUTEX_INIT_FAST); -+ mysql_cond_init(key_COND_wsrep_rollback, &COND_wsrep_rollback, NULL); -+ mysql_mutex_init(key_LOCK_wsrep_replaying, -+ &LOCK_wsrep_replaying, MY_MUTEX_INIT_FAST); -+ mysql_cond_init(key_COND_wsrep_replaying, &COND_wsrep_replaying, NULL); -+ mysql_mutex_init(key_LOCK_wsrep_slave_threads, -+ &LOCK_wsrep_slave_threads, MY_MUTEX_INIT_FAST); -+ mysql_mutex_init(key_LOCK_wsrep_desync, -+ &LOCK_wsrep_desync, MY_MUTEX_INIT_FAST); -+#endif - return 0; - } - -@@ -4584,7 +4722,6 @@ - return false; - } - -- - static int init_server_components() - { - DBUG_ENTER("init_server_components"); -@@ -4682,7 +4819,11 @@ - sql_print_warning("You need to use --log-bin to make " - "--log-slave-updates work."); - } -+#ifdef WITH_WSREP -+ if (!WSREP_ON && binlog_format_used && !opt_bin_log) -+#else - if (binlog_format_used && !opt_bin_log) -+#endif - sql_print_warning("You need to use --log-bin to make " - "--binlog-format work."); - -@@ -4765,10 +4906,67 @@ - my_free(opt_bin_logname); - opt_bin_logname=my_strdup(buf, MYF(0)); - } -+#ifdef WITH_WSREP /* WSREP BEFORE SE */ -+ /* -+ Wsrep initialization must happen at this point, because: -+ - opt_bin_logname must be known when starting replication -+ since SST may need it -+ - SST may modify binlog index file, so it must be opened -+ after SST has happened -+ */ -+ } -+ if (!wsrep_recovery) -+ { -+ if (opt_bootstrap) // bootsrap option given - disable wsrep functionality -+ { -+ wsrep_provider_init(WSREP_NONE); -+ if (wsrep_init()) unireg_abort(1); -+ } -+ else // full wsrep initialization -+ { -+ // add basedir/bin to PATH to resolve wsrep script names -+ char* const tmp_path((char*)alloca(strlen(mysql_home) + -+ strlen("/bin") + 1)); -+ if (tmp_path) -+ { -+ strcpy(tmp_path, mysql_home); -+ strcat(tmp_path, "/bin"); -+ wsrep_prepend_PATH(tmp_path); -+ } -+ else -+ { -+ WSREP_ERROR("Could not append %s/bin to PATH", mysql_home); -+ } -+ -+ if (wsrep_before_SE()) -+ { -+ set_ports(); // this is also called in network_init() later but we need -+ // to know mysqld_port now - lp:1071882 -+ wsrep_init_startup(true); -+ } -+ } -+ } -+ if (opt_bin_log) -+ { -+ /* -+ Variable ln is not defined at this scope. We use opt_bin_logname instead. -+ It should be the same as ln since -+ - mysql_bin_log.generate_name() returns first argument if new log name -+ is not generated -+ - if new log name is generated, return value is assigned to ln and copied -+ to opt_bin_logname above -+ */ -+ if (mysql_bin_log.open_index_file(opt_binlog_index_name, opt_bin_logname, -+ TRUE)) -+ { -+ unireg_abort(1); -+ } -+#else - if (mysql_bin_log.open_index_file(opt_binlog_index_name, ln, TRUE)) - { - unireg_abort(1); - } -+#endif /* WITH_WSREP */ - } - - if (opt_bin_log) -@@ -4826,6 +5024,7 @@ - unireg_abort(1); - } - -+#ifdef WITH_WSREP - if (plugin_init(&remaining_argc, remaining_argv, - (opt_noacl ? PLUGIN_INIT_SKIP_PLUGIN_TABLE : 0) | - (opt_help ? PLUGIN_INIT_SKIP_INITIALIZATION : 0))) -@@ -4834,7 +5033,7 @@ - unireg_abort(1); - } - plugins_are_initialized= TRUE; /* Don't separate from init function */ -- -+#endif /* WITH_WSREP */ - /* we do want to exit if there are any other unknown options */ - if (remaining_argc > 1) - { -@@ -4929,16 +5128,34 @@ - &global_system_variables.temp_table_plugin)) - unireg_abort(1); - -+#ifdef WITH_WSREP -+ if (!opt_bin_log) -+ { -+ wsrep_emulate_bin_log= 1; -+ } -+#endif - if (total_ha_2pc > 1 || (1 == total_ha_2pc && opt_bin_log)) - { - if (opt_bin_log) - tc_log= &mysql_bin_log; - else -+#ifdef WITH_WSREP -+ if (WSREP_ON) -+ tc_log= &tc_log_dummy; -+ else -+#endif /* WITH_WSREP */ - tc_log= &tc_log_mmap; - } - else - tc_log= &tc_log_dummy; - -+#ifdef WITH_WSREP -+ WSREP_DEBUG("Initial TC log open: %s", -+ (tc_log == &mysql_bin_log) ? "binlog" : -+ (tc_log == &tc_log_mmap) ? "mmap" : -+ (tc_log == &tc_log_dummy) ? "dummy" : "unknown" -+ ); -+#endif - if (tc_log->open(opt_bin_log ? opt_bin_logname : opt_tc_log_file)) - { - sql_print_error("Can't init tc log"); -@@ -5029,8 +5246,6 @@ - init_update_queries(); - DBUG_RETURN(0); - } -- -- - #ifndef EMBEDDED_LIBRARY - - static void create_shutdown_thread() -@@ -5052,6 +5267,422 @@ - - #endif /* EMBEDDED_LIBRARY */ - -+#ifdef WITH_WSREP -+typedef void (*wsrep_thd_processor_fun)(THD *); -+ -+pthread_handler_t start_wsrep_THD(void *arg) -+{ -+ THD *thd; -+ wsrep_thd_processor_fun processor= (wsrep_thd_processor_fun)arg; -+ -+ if (my_thread_init()) -+ { -+ WSREP_ERROR("Could not initialize thread"); -+ return(NULL); -+ } -+ -+ if (!(thd= new THD(true, true))) -+ { -+ return(NULL); -+ } -+ mysql_mutex_lock(&LOCK_thread_count); -+ thd->thread_id=thread_id++; -+ -+ thd->real_id=pthread_self(); // Keep purify happy -+ add_global_thread(thd); -+ thread_created++; -+ -+ my_net_init(&thd->net,(st_vio*) 0); -+ -+ DBUG_PRINT("wsrep",(("creating thread %lld"), (long long)thd->thread_id)); -+ thd->prior_thr_create_utime= thd->start_utime= my_micro_time(); -+ (void) mysql_mutex_unlock(&LOCK_thread_count); -+ -+ /* from bootstrap()... */ -+ thd->bootstrap=1; -+ thd->max_client_packet_length= thd->net.max_packet; -+ thd->security_ctx->master_access= ~(ulong)0; -+ -+ /* from handle_one_connection... */ -+ pthread_detach_this_thread(); -+ -+ mysql_thread_set_psi_id(thd->thread_id); -+ thd->thr_create_utime= my_micro_time(); -+ if (MYSQL_CALLBACK_ELSE(thread_scheduler, init_new_connection_thread, (), 0)) -+ { -+ close_connection(thd, ER_OUT_OF_RESOURCES, 1); -+ statistic_increment(aborted_connects,&LOCK_status); -+ MYSQL_CALLBACK(thread_scheduler, end_thread, (thd, 0)); -+ -+ return(NULL); -+ } -+ -+ /* now that we've called my_thread_init(), it is safe to call DBUG_* */ -+ -+ thd->thread_stack= (char*) &thd; -+ if (thd->store_globals()) -+ { -+ close_connection(thd, ER_OUT_OF_RESOURCES, 1); -+ statistic_increment(aborted_connects,&LOCK_status); -+ MYSQL_CALLBACK(thread_scheduler, end_thread, (thd, 0)); -+ delete thd; -+ -+ return(NULL); -+ } -+ -+ /* from handle_bootstrap() */ -+ -+ thd->system_thread= SYSTEM_THREAD_SLAVE_SQL; -+ thd->security_ctx->skip_grants(); -+ -+ /* handle_one_connection() again... */ -+ //thd->version= refresh_version; -+ thd->proc_info= 0; -+ thd->set_command(COM_SLEEP); -+ thd->set_time(); -+ thd->init_for_queries(); -+ -+ mysql_mutex_lock(&LOCK_connection_count); -+ ++connection_count; -+ mysql_mutex_unlock(&LOCK_connection_count); -+ -+ processor(thd); -+ -+ close_connection(thd, 0, 1); -+ -+ // Note: We can't call THD destructor without crashing -+ // if plugins have not been initialized. However, in most of the -+ // cases this means that pre SE initialization SST failed and -+ // we are going to exit anyway. -+ if (plugins_are_initialized) -+ { -+ net_end(&thd->net); -+ MYSQL_CALLBACK(thread_scheduler, end_thread, (thd, 1)); -+ } -+ else -+ { -+ // TODO: lightweight cleanup to get rid of: -+ // 'Error in my_thread_global_end(): 2 threads didn't exit' -+ // at server shutdown -+ } -+ return(NULL); -+} -+ -+/**/ -+static bool abort_replicated(THD *thd) -+{ -+ bool ret_code= false; -+ if (thd->wsrep_query_state== QUERY_COMMITTING) -+ { -+ if (wsrep_debug) WSREP_INFO("aborting replicated trx: %lu", thd->real_id); -+ -+ (void)wsrep_abort_thd(thd, thd, TRUE); -+ ret_code= true; -+ } -+ return ret_code; -+} -+/**/ -+static inline bool is_client_connection(THD *thd) -+{ -+#if REMOVE -+// REMOVE THIS LATER (lp:777201). Below we had to add an explicit check for -+// wsrep_applier since wsrep_exec_mode didn't seem to always work -+if (thd->wsrep_applier && thd->wsrep_exec_mode != REPL_RECV) -+WSREP_WARN("applier has wsrep_exec_mode = %d", thd->wsrep_exec_mode); -+ -+ if ( thd->slave_thread || /* declared as mysql slave */ -+ thd->system_thread || /* declared as system thread */ -+ !thd->vio_ok() || /* server internal thread */ -+ thd->wsrep_exec_mode==REPL_RECV || /* applier or replaying thread */ -+ thd->wsrep_applier || /* wsrep slave applier */ -+ !thd->variables.wsrep_on) /* client, but fenced outside wsrep */ -+ return false; -+ -+ return true; -+#else -+ return (thd->wsrep_client_thread && thd->variables.wsrep_on); -+#endif /* REMOVE */ -+} -+ -+static inline bool is_replaying_connection(THD *thd) -+{ -+ bool ret; -+ -+ mysql_mutex_lock(&thd->LOCK_wsrep_thd); -+ ret= (thd->wsrep_conflict_state == REPLAYING) ? true : false; -+ mysql_mutex_unlock(&thd->LOCK_wsrep_thd); -+ -+ return ret; -+} -+ -+static inline bool is_committing_connection(THD *thd) -+{ -+ bool ret; -+ -+ mysql_mutex_lock(&thd->LOCK_wsrep_thd); -+ ret= (thd->wsrep_query_state == QUERY_COMMITTING) ? true : false; -+ mysql_mutex_unlock(&thd->LOCK_wsrep_thd); -+ -+ return ret; -+} -+ -+static bool have_client_connections() -+{ -+ Thread_iterator it= global_thread_list->begin(); -+ for (; it != global_thread_list->end(); ++it) -+ { -+ THD *tmp= *it; -+ DBUG_PRINT("quit",("Informing thread %ld that it's time to die", -+ tmp->thread_id)); -+ if (is_client_connection(tmp) && tmp->killed == THD::KILL_CONNECTION) -+ { -+ (void)abort_replicated(tmp); -+ return true; -+ } -+ } -+ return false; -+} -+ -+/* -+ returns the number of wsrep appliers running. -+ However, the caller (thd parameter) is not taken in account -+ */ -+static int have_wsrep_appliers(THD *thd) -+{ -+ int ret= 0; -+ -+ Thread_iterator it= global_thread_list->begin(); -+ for (; it != global_thread_list->end(); ++it) -+ { -+ THD *tmp= *it; -+ ret+= (tmp != thd && tmp->wsrep_applier); -+ } -+ return ret; -+} -+ -+static void wsrep_close_thread(THD *thd) -+{ -+ thd->killed= THD::KILL_CONNECTION; -+ MYSQL_CALLBACK(thread_scheduler, post_kill_notification, (thd)); -+ if (thd->mysys_var) -+ { -+ thd->mysys_var->abort=1; -+ mysql_mutex_lock(&thd->mysys_var->mutex); -+ if (thd->mysys_var->current_cond) -+ { -+ mysql_mutex_lock(thd->mysys_var->current_mutex); -+ mysql_cond_broadcast(thd->mysys_var->current_cond); -+ mysql_mutex_unlock(thd->mysys_var->current_mutex); -+ } -+ mysql_mutex_unlock(&thd->mysys_var->mutex); -+ } -+} -+ -+static my_bool have_committing_connections() -+{ -+ Thread_iterator it= global_thread_list->begin(); -+ for (; it != global_thread_list->end(); ++it) -+ { -+ THD *tmp= *it; -+ -+ if (!is_client_connection(tmp)) -+ continue; -+ -+ if (is_committing_connection(tmp)) -+ { -+ mysql_mutex_unlock(&LOCK_thread_count); -+ return TRUE; -+ } -+ } -+ return FALSE; -+} -+ -+int wsrep_wait_committing_connections_close(int wait_time) -+{ -+ int sleep_time= 100; -+ -+ while (have_committing_connections() && wait_time > 0) -+ { -+ WSREP_DEBUG("wait for committing transaction to close: %d", wait_time); -+ my_sleep(sleep_time); -+ wait_time -= sleep_time; -+ } -+ if (have_committing_connections()) -+ { -+ return 1; -+ } -+ return 0; -+} -+ -+void wsrep_close_client_connections(my_bool wait_to_end) -+{ -+ /* -+ First signal all threads that it's time to die -+ */ -+ -+ /* Kill blocked pthreads */ -+ kill_blocked_pthreads_flag++; -+ kill_blocked_pthreads(); -+ -+ mysql_mutex_lock(&LOCK_thread_count); // For unlink from list -+ -+ Thread_iterator it= global_thread_list->begin(); -+ for (; it != global_thread_list->end(); ++it) -+ { -+ THD *tmp= *it; -+ DBUG_PRINT("quit",("Informing thread %ld that it's time to die", -+ tmp->thread_id)); -+ /* We skip slave threads & scheduler on this first loop through. */ -+ if (!is_client_connection(tmp)) -+ continue; -+ -+ if (is_replaying_connection(tmp)) -+ { -+ tmp->killed= THD::KILL_CONNECTION; -+ continue; -+ } -+ -+ /* replicated transactions must be skipped */ -+ if (abort_replicated(tmp)) -+ continue; -+ -+ WSREP_DEBUG("closing connection %ld", tmp->thread_id); -+ wsrep_close_thread(tmp); -+ } -+ mysql_mutex_unlock(&LOCK_thread_count); -+ -+ if (get_thread_count() > 0) -+ sleep(2); // Give threads time to die -+ -+ mysql_mutex_lock(&LOCK_thread_count); -+ /* -+ Force remaining threads to die by closing the connection to the client -+ */ -+ -+ for (it= global_thread_list->begin(); it != global_thread_list->end(); ++it) -+ { -+ THD *tmp= *it; -+#ifndef __bsdi__ // Bug in BSDI kernel -+ if (is_client_connection(tmp) && -+ !abort_replicated(tmp) && -+ !is_replaying_connection(tmp)) -+ { -+ WSREP_INFO("killing local connection: %ld",tmp->thread_id); -+ close_connection(tmp,0,0); -+ } -+#endif -+ } -+ -+ DBUG_PRINT("quit",("Waiting for threads to die (count=%u)", get_thread_count())); -+ if (wsrep_debug) -+ WSREP_INFO("waiting for client connections to close: %u", -+ get_thread_count()); -+ -+ while (wait_to_end && have_client_connections()) -+ { -+ mysql_cond_wait(&COND_thread_count, &LOCK_thread_count); -+ DBUG_PRINT("quit",("One thread died (count=%u)", get_thread_count())); -+ } -+ -+ mysql_mutex_unlock(&LOCK_thread_count); -+ -+ /* All client connection threads have now been aborted */ -+} -+ -+void wsrep_close_applier(THD *thd) -+{ -+ WSREP_DEBUG("closing applier %ld", thd->thread_id); -+ wsrep_close_thread(thd); -+} -+ -+static void wsrep_close_threads(THD *thd) -+{ -+ mysql_mutex_lock(&LOCK_thread_count); // For unlink from list -+ -+ Thread_iterator it= global_thread_list->begin(); -+ for (; it != global_thread_list->end(); ++it) -+ { -+ THD *tmp= *it; -+ DBUG_PRINT("quit",("Informing thread %ld that it's time to die", -+ tmp->thread_id)); -+ /* We skip slave threads & scheduler on this first loop through. */ -+ if (tmp->wsrep_applier && tmp != thd) -+ { -+ WSREP_DEBUG("closing wsrep thread %ld", tmp->thread_id); -+ wsrep_close_thread (tmp); -+ } -+ } -+ -+ mysql_mutex_unlock(&LOCK_thread_count); -+} -+ -+void wsrep_close_applier_threads(int count) -+{ -+ mysql_mutex_lock(&LOCK_thread_count); // For unlink from list -+ -+ Thread_iterator it= global_thread_list->begin(); -+ for (; it != global_thread_list->end(); ++it) -+ { -+ THD *tmp= *it; -+ DBUG_PRINT("quit",("Informing thread %ld that it's time to die", -+ tmp->thread_id)); -+ /* We skip slave threads & scheduler on this first loop through. */ -+ if (tmp->wsrep_applier) -+ { -+ WSREP_DEBUG("closing wsrep applier thread %ld", tmp->thread_id); -+ tmp->wsrep_applier_closing= TRUE; -+ count--; -+ } -+ } -+ -+ mysql_mutex_unlock(&LOCK_thread_count); -+} -+ -+void wsrep_wait_appliers_close(THD *thd) -+{ -+ /* Wait for wsrep appliers to gracefully exit */ -+ mysql_mutex_lock(&LOCK_thread_count); -+ while (have_wsrep_appliers(thd) > 1) -+ // 1 is for rollbacker thread which needs to be killed explicitly. -+ // This gotta be fixed in a more elegant manner if we gonna have arbitrary -+ // number of non-applier wsrep threads. -+ { -+ mysql_cond_wait(&COND_thread_count,&LOCK_thread_count); -+ DBUG_PRINT("quit",("One applier died (count=%u)", get_thread_count())); -+ } -+ mysql_mutex_unlock(&LOCK_thread_count); -+ /* Now kill remaining wsrep threads: rollbacker */ -+ wsrep_close_threads (thd); -+ /* and wait for them to die */ -+ mysql_mutex_lock(&LOCK_thread_count); -+ while (have_wsrep_appliers(thd) > 0) -+ { -+ mysql_cond_wait(&COND_thread_count,&LOCK_thread_count); -+ DBUG_PRINT("quit",("One thread died (count=%u)", get_thread_count())); -+ } -+ mysql_mutex_unlock(&LOCK_thread_count); -+ -+ /* All wsrep applier threads have now been aborted. However, if this thread -+ is also applier, we are still running... -+ */ -+} -+ -+void wsrep_kill_mysql(THD *thd) -+{ -+ if (mysqld_server_started) -+ { -+ if (!shutdown_in_progress) -+ { -+ WSREP_INFO("starting shutdown"); -+ kill_mysql(); -+ } -+ } -+ else -+ { -+ unireg_abort(1); -+ } -+} -+#endif /* WITH_WSREP */ - - #if (defined(_WIN32) || defined(HAVE_SMEM)) && !defined(EMBEDDED_LIBRARY) - static void handle_connections_methods() -@@ -5188,6 +5819,9 @@ - return 1; - } - #endif -+#ifdef WITH_WSREP -+ wsrep_filter_new_cluster (&argc, argv); -+#endif /* WITH_WSREP */ - - orig_argc= argc; - orig_argv= argv; -@@ -5521,6 +6155,14 @@ - my_str_free= &my_str_free_mysqld; - my_str_realloc= &my_str_realloc_mysqld; - -+#ifdef WITH_WSREP /* WSREP AFTER SE */ -+ if (wsrep_recovery) -+ { -+ select_thread_in_use= 0; -+ wsrep_recover(); -+ unireg_abort(0); -+ } -+#endif /* WITH_WSREP */ - /* - init signals & alarm - After this we can't quit by a simple unireg_abort -@@ -5599,6 +6241,31 @@ - if (Events::init(opt_noacl || opt_bootstrap)) - unireg_abort(1); - -+#ifdef WITH_WSREP /* WSREP AFTER SE */ -+ if (opt_bootstrap) -+ { -+ /*! bootstrap wsrep init was taken care of above */ -+ } -+ else -+ { -+ wsrep_SE_initialized(); -+ -+ if (wsrep_before_SE()) -+ { -+ /*! in case of no SST wsrep waits in view handler callback */ -+ wsrep_SE_init_grab(); -+ wsrep_SE_init_done(); -+ /*! in case of SST wsrep waits for wsrep->sst_received */ -+ wsrep_sst_continue(); -+ } -+ else -+ { -+ wsrep_init_startup (false); -+ } -+ -+ wsrep_create_appliers(wsrep_slave_threads - 1); -+ } -+#endif /* WITH_WSREP */ - if (opt_bootstrap) - { - select_thread_in_use= 0; // Allow 'kill' to work -@@ -5660,6 +6327,9 @@ - #ifdef EXTRA_DEBUG2 - sql_print_error("Before Lock_thread_count"); - #endif -+#ifdef WITH_WSREP -+ WSREP_DEBUG("Before Lock_thread_count"); -+#endif - mysql_mutex_lock(&LOCK_thread_count); - DBUG_PRINT("quit", ("Got thread_count mutex")); - select_thread_in_use=0; // For close_connections -@@ -5925,6 +6595,9 @@ - DBUG_ENTER("bootstrap"); - - THD *thd= new THD; -+#ifdef WITH_WSREP -+ thd->variables.wsrep_on= 0; -+#endif - thd->bootstrap=1; - my_net_init(&thd->net,(st_vio*) 0); - thd->max_client_packet_length= thd->net.max_packet; -@@ -6064,7 +6737,11 @@ - my_snprintf(error_message_buff, sizeof(error_message_buff), - ER_THD(thd, ER_CANT_CREATE_THREAD), error); - net_send_error(thd, ER_CANT_CREATE_THREAD, error_message_buff, NULL); -+#ifdef WITH_WSREP -+ close_connection(thd,0,0); -+#else - close_connection(thd); -+#endif - delete thd; - return; - /* purecov: end */ -@@ -6116,7 +6793,11 @@ - with no sqlstate. - A client expecting a SQLSTATE will not find any, and assume 'HY000'. - */ -+#ifdef WITH_WSREP -+ close_connection(thd, ER_CON_COUNT_ERROR, 1); -+#else - close_connection(thd, ER_CON_COUNT_ERROR); -+#endif - delete thd; - statistic_increment(connection_errors_max_connection, &LOCK_status); - DBUG_VOID_RETURN; -@@ -6336,6 +7017,9 @@ - sleep(1); // Give other threads some time - continue; - } -+#if defined(WITH_WSREP) && defined(HAVE_FCNTL) && defined(FD_CLOEXEC) -+ (void) fcntl(mysql_socket_getfd(new_sock), F_SETFD, FD_CLOEXEC); -+#endif /* WITH_WSREP */ - - #ifdef HAVE_LIBWRAP - { -@@ -6515,7 +7199,11 @@ - if (!(thd->net.vio= vio_new_win32pipe(hConnectedPipe)) || - my_net_init(&thd->net, thd->net.vio)) - { -+#ifdef WITH_WSREP -+ close_connection(thd, ER_OUT_OF_RESOURCES, 1); -+#else - close_connection(thd, ER_OUT_OF_RESOURCES); -+#endif - delete thd; - continue; - } -@@ -6710,7 +7398,11 @@ - event_conn_closed)) || - my_net_init(&thd->net, thd->net.vio)) - { -+#ifdef WITH_WSREP -+ close_connection(thd, ER_OUT_OF_RESOURCES, 1); -+#else - close_connection(thd, ER_OUT_OF_RESOURCES); -+#endif - errmsg= 0; - goto errorconn; - } -@@ -8013,6 +8705,20 @@ - #ifdef ENABLED_PROFILING - {"Uptime_since_flush_status",(char*) &show_flushstatustime, SHOW_FUNC}, - #endif -+#ifdef WITH_WSREP -+ {"wsrep_connected", (char*) &wsrep_connected, SHOW_BOOL}, -+ {"wsrep_ready", (char*) &wsrep_ready, SHOW_BOOL}, -+ {"wsrep_cluster_state_uuid", (char*) &wsrep_cluster_state_uuid,SHOW_CHAR_PTR}, -+ {"wsrep_cluster_conf_id", (char*) &wsrep_cluster_conf_id, SHOW_LONGLONG}, -+ {"wsrep_cluster_status", (char*) &wsrep_cluster_status, SHOW_CHAR_PTR}, -+ {"wsrep_cluster_size", (char*) &wsrep_cluster_size, SHOW_LONG_NOFLUSH}, -+ {"wsrep_local_index", (char*) &wsrep_local_index, SHOW_LONG_NOFLUSH}, -+ {"wsrep_local_bf_aborts", (char*) &wsrep_show_bf_aborts, SHOW_FUNC}, -+ {"wsrep_provider_name", (char*) &wsrep_provider_name, SHOW_CHAR_PTR}, -+ {"wsrep_provider_version", (char*) &wsrep_provider_version, SHOW_CHAR_PTR}, -+ {"wsrep_provider_vendor", (char*) &wsrep_provider_vendor, SHOW_CHAR_PTR}, -+ {"wsrep", (char*) &wsrep_show_status, SHOW_FUNC}, -+#endif - {NullS, NullS, SHOW_LONG} - }; - -@@ -8340,6 +9046,10 @@ - tmpenv = DEFAULT_MYSQL_HOME; - (void) strmake(mysql_home, tmpenv, sizeof(mysql_home)-1); - #endif -+#ifdef WITH_WSREP -+ if (WSREP_ON && wsrep_init_vars()) -+ return 1; -+#endif - return 0; - } - -@@ -8540,6 +9250,14 @@ - case OPT_LOWER_CASE_TABLE_NAMES: - lower_case_table_names_used= 1; - break; -+#ifdef WITH_WSREP -+ case OPT_WSREP_START_POSITION: -+ wsrep_start_position_init (argument); -+ break; -+ case OPT_WSREP_SST_AUTH: -+ wsrep_sst_auth_init (argument); -+ break; -+#endif - #if defined(ENABLED_DEBUG_SYNC) - case OPT_DEBUG_SYNC_TIMEOUT: - /* -@@ -9293,6 +10011,9 @@ - - /* Reset some global variables */ - reset_status_vars(); -+#ifdef WITH_WSREP -+ wsrep->stats_reset(wsrep); -+#endif /* WITH_WSREP */ - - /* Reset the counters of all key caches (default and named). */ - process_key_caches(reset_key_cache_counters); -@@ -9356,6 +10077,12 @@ - key_structure_guard_mutex, key_TABLE_SHARE_LOCK_ha_data, - key_LOCK_error_messages, key_LOG_INFO_lock, key_LOCK_thread_count, - key_LOCK_log_throttle_qni; -+#ifdef WITH_WSREP -+PSI_mutex_key key_LOCK_wsrep_rollback, key_LOCK_wsrep_thd, -+ key_LOCK_wsrep_replaying, key_LOCK_wsrep_ready, key_LOCK_wsrep_sst, -+ key_LOCK_wsrep_sst_thread, key_LOCK_wsrep_sst_init, -+ key_LOCK_wsrep_slave_threads, key_LOCK_wsrep_desync; -+#endif - PSI_mutex_key key_RELAYLOG_LOCK_commit; - PSI_mutex_key key_RELAYLOG_LOCK_commit_queue; - PSI_mutex_key key_RELAYLOG_LOCK_done; -@@ -9440,6 +10167,18 @@ - { &key_LOCK_error_messages, "LOCK_error_messages", PSI_FLAG_GLOBAL}, - { &key_LOG_INFO_lock, "LOG_INFO::lock", 0}, - { &key_LOCK_thread_count, "LOCK_thread_count", PSI_FLAG_GLOBAL}, -+#ifdef WITH_WSREP -+ { &key_LOCK_wsrep_ready, "LOCK_wsrep_ready", PSI_FLAG_GLOBAL}, -+ { &key_LOCK_wsrep_sst, "LOCK_wsrep_sst", PSI_FLAG_GLOBAL}, -+ { &key_LOCK_wsrep_sst_thread, "wsrep_sst_thread", 0}, -+ { &key_LOCK_wsrep_sst_init, "LOCK_wsrep_sst_init", PSI_FLAG_GLOBAL}, -+ { &key_LOCK_wsrep_sst, "LOCK_wsrep_sst", PSI_FLAG_GLOBAL}, -+ { &key_LOCK_wsrep_rollback, "LOCK_wsrep_rollback", PSI_FLAG_GLOBAL}, -+ { &key_LOCK_wsrep_thd, "THD::LOCK_wsrep_thd", 0}, -+ { &key_LOCK_wsrep_replaying, "LOCK_wsrep_replaying", PSI_FLAG_GLOBAL}, -+ { &key_LOCK_wsrep_slave_threads, "LOCK_wsrep_slave_threads", PSI_FLAG_GLOBAL}, -+ { &key_LOCK_wsrep_desync, "LOCK_wsrep_desync", PSI_FLAG_GLOBAL}, -+#endif - { &key_LOCK_log_throttle_qni, "LOCK_log_throttle_qni", PSI_FLAG_GLOBAL}, - { &key_gtid_ensure_index_mutex, "Gtid_state", PSI_FLAG_GLOBAL}, - { &key_LOCK_thread_created, "LOCK_thread_created", PSI_FLAG_GLOBAL } -@@ -9494,6 +10233,12 @@ - key_cond_slave_parallel_worker, - key_TABLE_SHARE_cond, key_user_level_lock_cond, - key_COND_thread_count, key_COND_thread_cache, key_COND_flush_thread_cache; -+#ifdef WITH_WSREP -+PSI_cond_key key_COND_wsrep_rollback, key_COND_wsrep_thd, -+ key_COND_wsrep_replaying, key_COND_wsrep_ready, key_COND_wsrep_sst, -+ key_COND_wsrep_sst_init, key_COND_wsrep_sst_thread; -+ -+#endif /* WITH_WSREP */ - PSI_cond_key key_RELAYLOG_update_cond; - PSI_cond_key key_BINLOG_COND_done; - PSI_cond_key key_RELAYLOG_COND_done; -@@ -9538,6 +10283,15 @@ - { &key_user_level_lock_cond, "User_level_lock::cond", 0}, - { &key_COND_thread_count, "COND_thread_count", PSI_FLAG_GLOBAL}, - { &key_COND_thread_cache, "COND_thread_cache", PSI_FLAG_GLOBAL}, -+#ifdef WITH_WSREP -+ { &key_COND_wsrep_ready, "COND_wsrep_ready", PSI_FLAG_GLOBAL}, -+ { &key_COND_wsrep_sst, "COND_wsrep_sst", PSI_FLAG_GLOBAL}, -+ { &key_COND_wsrep_sst_init, "COND_wsrep_sst_init", PSI_FLAG_GLOBAL}, -+ { &key_COND_wsrep_sst_thread, "wsrep_sst_thread", 0}, -+ { &key_COND_wsrep_rollback, "COND_wsrep_rollback", PSI_FLAG_GLOBAL}, -+ { &key_COND_wsrep_thd, "THD::COND_wsrep_thd", 0}, -+ { &key_COND_wsrep_replaying, "COND_wsrep_replaying", PSI_FLAG_GLOBAL}, -+#endif - { &key_COND_flush_thread_cache, "COND_flush_thread_cache", PSI_FLAG_GLOBAL}, - { &key_gtid_ensure_index_cond, "Gtid_state", PSI_FLAG_GLOBAL} - }; - -=== modified file 'sql/mysqld.h' ---- old/sql/mysqld.h 2014-01-06 06:03:08 +0000 -+++ new/sql/mysqld.h 2014-03-11 21:17:40 +0000 -@@ -65,7 +65,11 @@ - some places */ - /* Function prototypes */ - void kill_mysql(void); -+#ifdef WITH_WSREP -+void close_connection(THD *thd, uint sql_errno= 0, bool lock=1); -+#else - void close_connection(THD *thd, uint sql_errno= 0); -+#endif - void handle_connection_in_main_thread(THD *thd); - void create_thread_to_handle_connection(THD *thd); - void destroy_thd(THD *thd); -@@ -299,6 +303,10 @@ - extern PSI_mutex_key key_PAGE_lock, key_LOCK_sync, key_LOCK_active, - key_LOCK_pool; - #endif /* HAVE_MMAP */ -+#ifdef WITH_WSREP -+extern PSI_mutex_key key_LOCK_wsrep_thd; -+extern PSI_cond_key key_COND_wsrep_thd; -+#endif /* HAVE_WSREP */ - - #ifdef HAVE_OPENSSL - extern PSI_mutex_key key_LOCK_des_key_file; -@@ -645,6 +653,14 @@ - OPT_WANT_CORE, - OPT_ENGINE_CONDITION_PUSHDOWN, - OPT_LOG_ERROR, -+#ifdef WITH_WSREP -+ OPT_WSREP_PROVIDER, -+ OPT_WSREP_PROVIDER_OPTIONS, -+ OPT_WSREP_CLUSTER_ADDRESS, -+ OPT_WSREP_START_POSITION, -+ OPT_WSREP_SST_AUTH, -+ OPT_WSREP_RECOVER, -+#endif /* WITH_WSREP */ - OPT_MAX_LONG_DATA_SIZE, - OPT_PLUGIN_LOAD, - OPT_PLUGIN_LOAD_ADD, -@@ -753,4 +769,9 @@ - - extern const char *MY_BIND_ALL_ADDRESSES; - -+#ifdef WITH_WSREP -+#include "my_pthread.h" -+pthread_handler_t start_wsrep_THD(void*); -+#endif /* WITH_WSREP */ -+ - #endif /* MYSQLD_INCLUDED */ - -=== modified file 'sql/protocol.cc' ---- old/sql/protocol.cc 2012-11-07 13:41:30 +0000 -+++ new/sql/protocol.cc 2013-01-06 18:49:20 +0000 -@@ -485,6 +485,14 @@ - - void Protocol::end_statement() - { -+#ifdef WITH_WSREP -+ /*sanity check, can be removed before 1.0 release */ -+ if (WSREP(thd) && thd->wsrep_conflict_state== REPLAYING) -+ { -+ WSREP_ERROR("attempting net_end_statement while replaying"); -+ return; -+ } -+#endif - DBUG_ENTER("Protocol::end_statement"); - DBUG_ASSERT(! thd->get_stmt_da()->is_sent()); - bool error= FALSE; - -=== modified file 'sql/rpl_gtid_cache.cc' ---- old/sql/rpl_gtid_cache.cc 2013-10-09 11:17:06 +0000 -+++ new/sql/rpl_gtid_cache.cc 2013-12-11 10:24:00 +0000 -@@ -147,7 +147,22 @@ - else - { - automatic_type= GTID_GROUP; -+#ifdef WITH_WSREP -+ /* -+ Replace sidno with wsrep_sidno -+ if transaction went through wsrep commit -+ */ -+ if (WSREP(thd) && thd->wsrep_trx_meta.gtid.seqno != -1) -+ { -+ automatic_gtid.sidno= wsrep_sidno; -+ } -+ else -+ { -+#endif /* WITH_WSREP */ - automatic_gtid.sidno= gtid_state->get_server_sidno(); -+#ifdef WITH_WSREP -+ } -+#endif /* WITH_WSREP */ - gtid_state->lock_sidno(automatic_gtid.sidno); - automatic_gtid.gno= - gtid_state->get_automatic_gno(automatic_gtid.sidno); - -=== modified file 'sql/rpl_slave.cc' ---- old/sql/rpl_slave.cc 2014-01-06 06:03:08 +0000 -+++ new/sql/rpl_slave.cc 2014-03-11 21:17:40 +0000 -@@ -55,6 +55,9 @@ - #include "rpl_rli_pdb.h" - #include "global_threads.h" - -+#ifdef WITH_WSREP -+#include "wsrep_mysqld.h" -+#endif - #ifdef HAVE_REPLICATION - - #include "rpl_tblmap.h" -@@ -3483,6 +3486,94 @@ - rli->mts_recovery_index)); - } - #endif -+#ifdef WITH_WSREP -+ if (wsrep_preordered_opt && WSREP_ON && -+ (ev->get_type_code() == QUERY_EVENT || -+ ev->get_type_code() == XID_EVENT || -+ ev->get_type_code() == TABLE_MAP_EVENT || -+ ev->get_type_code() == WRITE_ROWS_EVENT || -+ ev->get_type_code() == UPDATE_ROWS_EVENT || -+ ev->get_type_code() == DELETE_ROWS_EVENT || -+ ev->get_type_code() == GTID_LOG_EVENT)) -+ { -+ if (ev->get_type_code() == GTID_LOG_EVENT) -+ { -+ thd->wsrep_po_sid= *((Gtid_log_event*)ev)->get_sid(); -+ } -+ wsrep_status_t err; -+ if (thd->wsrep_po_cnt == 0) -+ { -+ /* First event in write set, write format description event -+ as a write set header so that the receiver will know how -+ to interpret following events. */ -+ Log_event* fde= rli->get_rli_description_event(); -+ ulong len= uint4korr(fde->temp_buf + EVENT_LEN_OFFSET); -+ wsrep_buf_t data= {fde->temp_buf, len}; -+ if ((err= wsrep->preordered_collect( -+ wsrep, &thd->wsrep_po_handle, &data, 1, true)) != WSREP_OK) -+ { -+ WSREP_ERROR("wsrep preordered collect failed: %d", err); -+ if (err == WSREP_TRX_FAIL && -+ wsrep->preordered_commit(wsrep, &thd->wsrep_po_handle, NULL, -+ 0, 0, false)) -+ { -+ WSREP_WARN("failed to cancel preordered write set"); -+ } -+ DBUG_RETURN(SLAVE_APPLY_EVENT_AND_UPDATE_POS_APPLY_ERROR); -+ } -+ } -+ ++thd->wsrep_po_cnt; -+ ulong len= uint4korr(ev->temp_buf + EVENT_LEN_OFFSET); -+ wsrep_buf_t data= {ev->temp_buf, len}; -+ if ((err= wsrep->preordered_collect(wsrep, &thd->wsrep_po_handle, -+ &data, 1, 1)) != WSREP_OK) -+ { -+ WSREP_ERROR("wsrep preordered collect failed: %d", err); -+ DBUG_RETURN(SLAVE_APPLY_EVENT_AND_UPDATE_POS_APPLY_ERROR); -+ } -+ -+ if (ev->get_type_code() == QUERY_EVENT && -+ ((Query_log_event*)ev)->starts_group()) -+ { -+ thd->wsrep_po_in_trans= TRUE; -+ } -+ else if (ev->get_type_code() == XID_EVENT || -+ (ev->get_type_code() == QUERY_EVENT && -+ (thd->wsrep_po_in_trans == FALSE || -+ ((Query_log_event*)ev)->ends_group()))) -+ { -+ int flags= WSREP_FLAG_COMMIT | (thd->wsrep_po_in_trans == FALSE ? -+ WSREP_FLAG_ISOLATION : 0); -+ thd->wsrep_po_in_trans= FALSE; -+ thd->wsrep_po_cnt= 0; -+ wsrep_uuid_t source; -+ memcpy(source.data, thd->wsrep_po_sid.bytes, sizeof(source.data)); -+ if ((err= wsrep->preordered_commit(wsrep, &thd->wsrep_po_handle, -+ &source, flags, 1, true)) != WSREP_OK) -+ { -+ WSREP_ERROR("failed to commit preordered event: %d", err); -+ DBUG_RETURN(SLAVE_APPLY_EVENT_AND_UPDATE_POS_APPLY_ERROR); -+ } -+ } -+ reason= Log_event::EVENT_SKIP_IGNORE; -+ skip_event= TRUE; -+ } -+ else if (WSREP_ON && (ev->get_type_code() == XID_EVENT || -+ (ev->get_type_code() == QUERY_EVENT && thd->wsrep_mysql_replicated > 0 && -+ (!strncasecmp(((Query_log_event*)ev)->query , "BEGIN", 5) || -+ !strncasecmp(((Query_log_event*)ev)->query , "COMMIT", 6) )))) -+ { -+ if (++thd->wsrep_mysql_replicated < (int)wsrep_mysql_replication_bundle) -+ { -+ WSREP_DEBUG("skipping wsrep commit %d", thd->wsrep_mysql_replicated); -+ reason = Log_event::EVENT_SKIP_IGNORE; -+ } -+ else -+ { -+ thd->wsrep_mysql_replicated = 0; -+ } -+ } -+#endif /* WITH_WSREP */ - if (reason == Log_event::EVENT_SKIP_COUNT) - { - sql_slave_skip_counter= --rli->slave_skip_counter; -@@ -5635,6 +5726,18 @@ - } - #endif - -+#ifdef WITH_WSREP -+ thd->wsrep_exec_mode= LOCAL_STATE; -+ /* synchronize with wsrep replication */ -+ if (WSREP_ON) -+ { -+ thd->wsrep_po_handle= WSREP_PO_INITIALIZER; -+ thd->wsrep_po_cnt= 0; -+ thd->wsrep_po_in_trans= FALSE; -+ memset(&thd->wsrep_po_sid, 0, sizeof(thd->wsrep_po_sid)); -+ wsrep_ready_wait(); -+ } -+#endif - DBUG_PRINT("master_info",("log_file_name: %s position: %s", - rli->get_group_master_log_name(), - llstr(rli->get_group_master_log_pos(),llbuff))); -@@ -5798,6 +5901,16 @@ - rli->recovery_groups_inited= false; - } - -+#ifdef WITH_WSREP -+ if (WSREP_ON) -+ { -+ if (wsrep->preordered_commit(wsrep, &thd->wsrep_po_handle, -+ NULL, 0, 0, false)) -+ { -+ WSREP_WARN("preordered cleanup failed"); -+ } -+ } -+#endif /* WITH_WSREP */ - /* - Some events set some playgrounds, which won't be cleared because thread - stops. Stopping of this thread may not be known to these events ("stop" - -=== modified file 'sql/set_var.h' ---- old/sql/set_var.h 2014-01-06 06:03:08 +0000 -+++ new/sql/set_var.h 2014-03-11 21:17:40 +0000 -@@ -256,6 +256,9 @@ - int check(THD *thd); - int update(THD *thd); - int light_check(THD *thd); -+#ifdef WITH_WSREP -+ int wsrep_store_variable(THD *thd); -+#endif - void print(THD *thd, String *str); /* To self-print */ - #ifdef OPTIMIZER_TRACE - virtual bool is_var_optimizer_trace() const -@@ -354,6 +357,9 @@ - - const CHARSET_INFO *get_old_charset_by_name(const char *old_name); - -+#ifdef WITH_WSREP -+int sql_set_wsrep_variables(THD *thd, List *var_list); -+#endif - int sys_var_init(); - int sys_var_add_options(std::vector *long_options, int parse_flags); - void sys_var_end(void); - -=== modified file 'sql/sp.cc' ---- old/sql/sp.cc 2013-08-12 05:34:44 +0000 -+++ new/sql/sp.cc 2013-10-08 19:45:08 +0000 -@@ -2734,3 +2734,37 @@ - return NULL; - } - } -+#ifdef WITH_WSREP -+int wsrep_create_sp(THD *thd, uchar** buf, size_t* buf_len) -+{ -+ String log_query; -+ sp_head *sp = thd->lex->sphead; -+ ulong saved_mode= thd->variables.sql_mode; -+ String retstr(64); -+ retstr.set_charset(system_charset_info); -+ -+ log_query.set_charset(system_charset_info); -+ -+ if (sp->m_type == TYPE_ENUM_FUNCTION) -+ { -+ sp_returns_type(thd, retstr, sp); -+ } -+ -+ if (!create_string(thd, &log_query, -+ sp->m_type, -+ (sp->m_explicit_name ? sp->m_db.str : NULL), -+ (sp->m_explicit_name ? sp->m_db.length : 0), -+ sp->m_name.str, sp->m_name.length, -+ sp->m_params.str, sp->m_params.length, -+ retstr.c_ptr(), retstr.length(), -+ sp->m_body.str, sp->m_body.length, -+ sp->m_chistics, &(thd->lex->definer->user), -+ &(thd->lex->definer->host), -+ saved_mode)) -+ { -+ WSREP_WARN("SP create string failed: %s", thd->query()); -+ return 1; -+ } -+ return wsrep_to_buf_helper(thd, log_query.ptr(), log_query.length(), buf, buf_len); -+} -+#endif /* WITH_WSREP */ - -=== modified file 'sql/sql_acl.cc' ---- old/sql/sql_acl.cc 2014-01-06 06:03:08 +0000 -+++ new/sql/sql_acl.cc 2014-03-11 21:17:40 +0000 -@@ -2285,6 +2285,9 @@ - return(1); - } - if (!thd->slave_thread && -+#ifdef WITH_WSREP -+ (!WSREP(thd) || !thd->wsrep_applier) && -+#endif /* WITH_WSREP */ - (strcmp(thd->security_ctx->user, user) || - my_strcasecmp(system_charset_info, host, - thd->security_ctx->priv_host))) -@@ -2292,7 +2295,12 @@ - if (check_access(thd, UPDATE_ACL, "mysql", NULL, NULL, 1, 0)) - return(1); - } -+#ifdef WITH_WSREP -+ if ((!WSREP(thd) || !thd->wsrep_applier) && -+ !thd->slave_thread && !thd->security_ctx->user[0]) -+#else - if (!thd->slave_thread && !thd->security_ctx->user[0]) -+#endif /* WITH_WSREP */ - { - my_message(ER_PASSWORD_ANONYMOUS_USER, ER(ER_PASSWORD_ANONYMOUS_USER), - MYF(0)); -@@ -2373,7 +2381,7 @@ - TABLE *table; - /* Buffer should be extended when password length is extended. */ - char buff[512]; -- ulong query_length; -+ ulong query_length=0; - bool save_binlog_row_based; - uchar user_key[MAX_KEY_LENGTH]; - char *plugin_temp= NULL; -@@ -2381,6 +2389,9 @@ - uint new_password_len= (uint) strlen(new_password); - bool result= 1; - enum mysql_user_table_field password_field= MYSQL_USER_FIELD_PASSWORD; -+#ifdef WITH_WSREP -+ const CSET_STRING query_save = thd->query_string; -+#endif /* WITH_WSREP */ - DBUG_ENTER("change_password"); - DBUG_PRINT("enter",("host: '%s' user: '%s' new_password: '%s'", - host,user,new_password)); -@@ -2388,6 +2399,18 @@ - - if (check_change_password(thd, host, user, new_password, new_password_len)) - DBUG_RETURN(1); -+#ifdef WITH_WSREP -+ if (WSREP(thd) && !thd->wsrep_applier) -+ { -+ query_length= sprintf(buff, "SET PASSWORD FOR '%-.120s'@'%-.120s'='%-.120s'", -+ user ? user : "", -+ host ? host : "", -+ new_password); -+ thd->set_query_inner(buff, query_length, system_charset_info); -+ -+ WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, (char*)"user", NULL); -+ } -+#endif /* WITH_WSREP */ - - tables.init_one_table("mysql", 5, "user", 4, "user", TL_WRITE); - -@@ -2658,13 +2681,26 @@ - table->file->has_transactions()); - end: - result|= acl_trans_commit_and_close_tables(thd); -+#ifdef WITH_WSREP -+ if (WSREP(thd) && !thd->wsrep_applier) -+ { -+ WSREP_TO_ISOLATION_END; - -+ thd->query_string = query_save; -+ thd->wsrep_exec_mode = LOCAL_STATE; -+ } -+#endif /* WITH_WSREP */ - /* Restore the state of binlog format */ - DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row()); - if (save_binlog_row_based) - thd->set_current_stmt_binlog_format_row(); - - DBUG_RETURN(result); -+#ifdef WITH_WSREP -+ error: -+ WSREP_ERROR("Replication of SET PASSWORD failed: %s", buff); -+ DBUG_RETURN(result); -+#endif /* WITH_WSREP */ - } - - - -=== modified file 'sql/sql_alter.cc' ---- old/sql/sql_alter.cc 2012-08-02 20:43:29 +0000 -+++ new/sql/sql_alter.cc 2013-01-06 18:49:20 +0000 -@@ -18,6 +18,9 @@ - // mysql_exchange_partition - #include "sql_base.h" // open_temporary_tables - #include "sql_alter.h" -+#ifdef WITH_WSREP -+#include "wsrep_mysqld.h" -+#endif /* WITH_WSREP */ - - - Alter_info::Alter_info(const Alter_info &rhs, MEM_ROOT *mem_root) -@@ -304,6 +307,20 @@ - - thd->enable_slow_log= opt_log_slow_admin_statements; - -+#ifdef WITH_WSREP -+ TABLE *find_temporary_table(THD *thd, const TABLE_LIST *tl); -+ -+ if ((!thd->is_current_stmt_binlog_format_row() || -+ !find_temporary_table(thd, first_table)) && -+ wsrep_to_isolation_begin(thd, -+ lex->name.str ? select_lex->db : NULL, -+ lex->name.str ? lex->name.str : NULL, -+ first_table)) -+ { -+ WSREP_WARN("ALTER TABLE isolation failure"); -+ DBUG_RETURN(TRUE); -+ } -+#endif /* WITH_WSREP */ - result= mysql_alter_table(thd, select_lex->db, lex->name.str, - &create_info, - first_table, -@@ -312,6 +329,8 @@ - select_lex->order_list.first, - lex->ignore); - -+#ifdef WITH_WSREP -+#endif /* WITH_WSREP */ - DBUG_RETURN(result); - } - - -=== modified file 'sql/sql_base.cc' ---- old/sql/sql_base.cc 2013-10-30 23:22:43 +0000 -+++ new/sql/sql_base.cc 2013-12-11 10:24:00 +0000 -@@ -57,6 +57,9 @@ - #include - #endif - #include "table_cache.h" // Table_cache_manager, Table_cache -+#ifdef WITH_WSREP -+#include "wsrep_mysqld.h" -+#endif /* WITH_WSREP */ - - - bool -@@ -4181,7 +4184,7 @@ - */ - bool log_on= mysql_bin_log.is_open() && thd->variables.sql_log_bin; - ulong binlog_format= thd->variables.binlog_format; -- if ((log_on == FALSE) || (binlog_format == BINLOG_FORMAT_ROW) || -+ if ((log_on == FALSE) || (WSREP_BINLOG_FORMAT(binlog_format) == BINLOG_FORMAT_ROW) || - (table_list->table->s->table_category == TABLE_CATEGORY_LOG) || - (table_list->table->s->table_category == TABLE_CATEGORY_RPL_INFO) || - (table_list->table->s->table_category == TABLE_CATEGORY_PERFORMANCE) || -@@ -5120,6 +5123,22 @@ - goto err; - } - } -+#ifdef WITH_WSREP -+ if ((thd->lex->sql_command== SQLCOM_INSERT || -+ thd->lex->sql_command== SQLCOM_INSERT_SELECT || -+ thd->lex->sql_command== SQLCOM_REPLACE || -+ thd->lex->sql_command== SQLCOM_REPLACE_SELECT || -+ thd->lex->sql_command== SQLCOM_UPDATE || -+ thd->lex->sql_command== SQLCOM_UPDATE_MULTI || -+ thd->lex->sql_command== SQLCOM_LOAD || -+ thd->lex->sql_command== SQLCOM_DELETE) && -+ wsrep_replicate_myisam && -+ (*start)->table && (*start)->table->file->ht->db_type == DB_TYPE_MYISAM) -+ { -+ WSREP_TO_ISOLATION_BEGIN(NULL, NULL, (*start)); -+ } -+ error: -+#endif - - /* Set appropriate TABLE::lock_type. */ - if (tbl && tables->lock_type != TL_UNLOCK && -@@ -5851,7 +5870,7 @@ - We can solve these problems in mixed mode by switching to binlogging - if at least one updated table is used by sub-statement - */ -- if (thd->variables.binlog_format != BINLOG_FORMAT_ROW && tables && -+ if (WSREP_BINLOG_FORMAT(thd->variables.binlog_format) != BINLOG_FORMAT_ROW && tables && - has_write_table_with_auto_increment(thd->lex->first_not_own_table())) - thd->lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_AUTOINC_COLUMNS); - } -@@ -9175,9 +9194,13 @@ - else - table_cache_manager.assert_owner_all_and_tdc(); - -+#ifdef WITH_WSREP -+ /* if thd was BF aborted, exclusive locks were canceled */ -+#else - DBUG_ASSERT(remove_type == TDC_RT_REMOVE_UNUSED || - thd->mdl_context.is_lock_owner(MDL_key::TABLE, db, table_name, - MDL_EXCLUSIVE)); -+#endif /* WITH_WSREP */ - - key_length= create_table_def_key(thd, key, db, table_name, false); - - -=== modified file 'sql/sql_builtin.cc.in' ---- old/sql/sql_builtin.cc.in 2011-09-07 10:08:09 +0000 -+++ new/sql/sql_builtin.cc.in 2012-12-20 16:13:02 +0000 -@@ -23,7 +23,11 @@ - extern - #endif - builtin_plugin -- @mysql_mandatory_plugins@ @mysql_optional_plugins@ builtin_binlog_plugin, builtin_mysql_password_plugin; -+ @mysql_mandatory_plugins@ @mysql_optional_plugins@ builtin_binlog_plugin, -+#ifdef WITH_WSREP -+ builtin_wsrep_plugin@mysql_plugin_defs@, -+#endif /* WITH_WSREP */ -+ builtin_mysql_password_plugin; - - struct st_mysql_plugin *mysql_optional_plugins[]= - { -@@ -32,5 +36,9 @@ - - struct st_mysql_plugin *mysql_mandatory_plugins[]= - { -- builtin_binlog_plugin, builtin_mysql_password_plugin, @mysql_mandatory_plugins@ 0 -+ builtin_binlog_plugin, -+#ifdef WITH_WSREP -+ builtin_wsrep_plugin@mysql_plugin_defs@, -+#endif /* WITH_WSREP */ -+ builtin_mysql_password_plugin, @mysql_mandatory_plugins@ 0 - }; - -=== modified file 'sql/sql_class.cc' ---- old/sql/sql_class.cc 2013-10-30 23:22:43 +0000 -+++ new/sql/sql_class.cc 2014-01-26 15:09:40 +0000 -@@ -57,6 +57,10 @@ - #include "debug_sync.h" - #include "sql_parse.h" // is_update_query - #include "sql_callback.h" -+#ifdef WITH_WSREP -+#include "wsrep_mysqld.h" -+#include "wsrep_thd.h" -+#endif - #include "lock.h" - #include "global_threads.h" - #include "mysqld.h" -@@ -816,6 +820,176 @@ - return buffer; - } - -+#ifdef WITH_WSREP -+extern int wsrep_on(void *thd) -+{ -+ return (int)(WSREP(((THD*)thd))); -+} -+extern "C" bool wsrep_thd_is_wsrep_on(THD *thd) -+{ -+ return thd->variables.wsrep_on; -+} -+ -+extern "C" bool wsrep_consistency_check(void *thd) -+{ -+ return ((THD*)thd)->wsrep_consistency_check == CONSISTENCY_CHECK_RUNNING; -+} -+ -+extern "C" void wsrep_thd_set_exec_mode(THD *thd, enum wsrep_exec_mode mode) -+{ -+ thd->wsrep_exec_mode= mode; -+} -+extern "C" void wsrep_thd_set_query_state( -+ THD *thd, enum wsrep_query_state state) -+{ -+ thd->wsrep_query_state= state; -+} -+extern "C" void wsrep_thd_set_conflict_state( -+ THD *thd, enum wsrep_conflict_state state) -+{ -+ thd->wsrep_conflict_state= state; -+} -+ -+ -+extern "C" enum wsrep_exec_mode wsrep_thd_exec_mode(THD *thd) -+{ -+ return thd->wsrep_exec_mode; -+} -+ -+extern "C" const char *wsrep_thd_exec_mode_str(THD *thd) -+{ -+ return -+ (!thd) ? "void" : -+ (thd->wsrep_exec_mode == LOCAL_STATE) ? "local" : -+ (thd->wsrep_exec_mode == REPL_RECV) ? "applier" : -+ (thd->wsrep_exec_mode == TOTAL_ORDER) ? "total order" : -+ (thd->wsrep_exec_mode == LOCAL_COMMIT) ? "local commit" : "void"; -+} -+ -+extern "C" enum wsrep_query_state wsrep_thd_query_state(THD *thd) -+{ -+ return thd->wsrep_query_state; -+} -+ -+extern "C" const char *wsrep_thd_query_state_str(THD *thd) -+{ -+ return -+ (!thd) ? "void" : -+ (thd->wsrep_query_state == QUERY_IDLE) ? "idle" : -+ (thd->wsrep_query_state == QUERY_EXEC) ? "executing" : -+ (thd->wsrep_query_state == QUERY_COMMITTING) ? "committing" : -+ (thd->wsrep_query_state == QUERY_EXITING) ? "exiting" : -+ (thd->wsrep_query_state == QUERY_ROLLINGBACK) ? "rolling back" : "void"; -+} -+ -+extern "C" enum wsrep_conflict_state wsrep_thd_conflict_state(THD *thd) -+{ -+ return thd->wsrep_conflict_state; -+} -+extern "C" const char *wsrep_thd_conflict_state_str(THD *thd) -+{ -+ return -+ (!thd) ? "void" : -+ (thd->wsrep_conflict_state == NO_CONFLICT) ? "no conflict" : -+ (thd->wsrep_conflict_state == MUST_ABORT) ? "must abort" : -+ (thd->wsrep_conflict_state == ABORTING) ? "aborting" : -+ (thd->wsrep_conflict_state == MUST_REPLAY) ? "must replay" : -+ (thd->wsrep_conflict_state == REPLAYING) ? "replaying" : -+ (thd->wsrep_conflict_state == RETRY_AUTOCOMMIT) ? "retrying" : -+ (thd->wsrep_conflict_state == CERT_FAILURE) ? "cert failure" : "void"; -+} -+ -+extern "C" wsrep_ws_handle_t* wsrep_thd_ws_handle(THD *thd) -+{ -+ return &thd->wsrep_ws_handle; -+} -+ -+extern "C"void wsrep_thd_LOCK(THD *thd) -+{ -+ mysql_mutex_lock(&thd->LOCK_wsrep_thd); -+} -+extern "C"void wsrep_thd_UNLOCK(THD *thd) -+{ -+ mysql_mutex_unlock(&thd->LOCK_wsrep_thd); -+} -+extern "C" time_t wsrep_thd_query_start(THD *thd) -+{ -+ return thd->query_start(); -+} -+extern "C" uint32 wsrep_thd_wsrep_rand(THD *thd) -+{ -+ return thd->wsrep_rand; -+} -+extern "C" my_thread_id wsrep_thd_thread_id(THD *thd) -+{ -+ return thd->thread_id; -+} -+extern "C" wsrep_seqno_t wsrep_thd_trx_seqno(THD *thd) -+{ -+ return (thd) ? thd->wsrep_trx_meta.gtid.seqno : WSREP_SEQNO_UNDEFINED; -+} -+extern "C" query_id_t wsrep_thd_query_id(THD *thd) -+{ -+ return thd->query_id; -+} -+extern "C" char *wsrep_thd_query(THD *thd) -+{ -+ return (thd) ? thd->query() : NULL; -+} -+extern "C" query_id_t wsrep_thd_wsrep_last_query_id(THD *thd) -+{ -+ return thd->wsrep_last_query_id; -+} -+extern "C" void wsrep_thd_set_wsrep_last_query_id(THD *thd, query_id_t id) -+{ -+ thd->wsrep_last_query_id= id; -+} -+extern "C" void wsrep_thd_awake(THD *thd, my_bool signal) -+{ -+ if (signal) -+ { -+ mysql_mutex_lock(&thd->LOCK_thd_data); -+ thd->awake(THD::KILL_QUERY); -+ mysql_mutex_unlock(&thd->LOCK_thd_data); -+ } -+ else -+ { -+ mysql_mutex_lock(&LOCK_wsrep_replaying); -+ mysql_cond_broadcast(&COND_wsrep_replaying); -+ mysql_mutex_unlock(&LOCK_wsrep_replaying); -+ } -+} -+extern "C" int wsrep_thd_retry_counter(THD *thd) -+{ -+ return(thd->wsrep_retry_counter); -+} -+ -+extern int -+wsrep_trx_order_before(void *thd1, void *thd2) -+{ -+ if (wsrep_thd_trx_seqno((THD*)thd1) < wsrep_thd_trx_seqno((THD*)thd2)) { -+ WSREP_DEBUG("BF conflict, order: %lld %lld\n", -+ (long long)wsrep_thd_trx_seqno((THD*)thd1), -+ (long long)wsrep_thd_trx_seqno((THD*)thd2)); -+ return 1; -+ } -+ WSREP_DEBUG("waiting for BF, trx order: %lld %lld\n", -+ (long long)wsrep_thd_trx_seqno((THD*)thd1), -+ (long long)wsrep_thd_trx_seqno((THD*)thd2)); -+ return 0; -+} -+extern "C" int -+wsrep_trx_is_aborting(void *thd_ptr) -+{ -+ if (thd_ptr) { -+ if ((((THD *)thd_ptr)->wsrep_conflict_state == MUST_ABORT) || -+ (((THD *)thd_ptr)->wsrep_conflict_state == ABORTING)) { -+ return 1; -+ } -+ } -+ return 0; -+} -+#endif - - /** - Implementation of Drop_table_error_handler::handle_condition(). -@@ -843,7 +1017,6 @@ - sql_errno == ER_TRG_NO_DEFINER); - } - -- - void Open_tables_state::set_open_tables_state(Open_tables_state *state) - { - this->open_tables= state->open_tables; -@@ -878,7 +1051,11 @@ - } - - -+#ifdef WITH_WSREP -+THD::THD(bool enable_plugins, bool is_applier) -+#else - THD::THD(bool enable_plugins) -+#endif - :Statement(&main_lex, &main_mem_root, STMT_CONVENTIONAL_EXECUTION, - /* statement id */ 0), - rli_fake(0), rli_slave(NULL), -@@ -911,6 +1088,16 @@ - bootstrap(0), - derived_tables_processing(FALSE), - sp_runtime_ctx(NULL), -+#ifdef WITH_WSREP -+ wsrep_applier(is_applier), -+ wsrep_applier_closing(FALSE), -+ wsrep_client_thread(0), -+ wsrep_po_handle(WSREP_PO_INITIALIZER), -+ wsrep_po_cnt(0), -+ wsrep_po_in_trans(FALSE), -+ wsrep_apply_format(0), -+ wsrep_apply_toi(false), -+#endif - m_parser_state(NULL), - #if defined(ENABLED_DEBUG_SYNC) - debug_sync_control(0), -@@ -1000,6 +1187,22 @@ - set_command(COM_CONNECT); - *scramble= '\0'; - -+#ifdef WITH_WSREP -+ mysql_mutex_init(key_LOCK_wsrep_thd, &LOCK_wsrep_thd, MY_MUTEX_INIT_FAST); -+ mysql_cond_init(key_COND_wsrep_thd, &COND_wsrep_thd, NULL); -+ wsrep_ws_handle.trx_id = WSREP_UNDEFINED_TRX_ID; -+ wsrep_ws_handle.opaque = NULL; -+ wsrep_retry_counter = 0; -+ wsrep_PA_safe = true; -+ wsrep_retry_query = NULL; -+ wsrep_retry_query_len = 0; -+ wsrep_retry_command = COM_CONNECT; -+ wsrep_consistency_check = NO_CONSISTENCY_CHECK; -+ wsrep_status_vars = 0; -+ wsrep_mysql_replicated = 0; -+ wsrep_TOI_pre_query = NULL; -+ wsrep_TOI_pre_query_len = 0; -+#endif - /* Call to init() below requires fully initialized Open_tables_state. */ - reset_open_tables_state(); - -@@ -1032,6 +1235,13 @@ - randominit(&rand, tmp + (ulong) &rand, tmp + (ulong) ::global_query_id); - substitute_null_with_insert_id = FALSE; - thr_lock_info_init(&lock_info); /* safety: will be reset after start */ -+#ifdef WITH_WSREP -+ lock_info.mysql_thd= (void *)this; -+ lock_info.in_lock_tables= false; -+#ifdef WSREP_PROC_INFO -+ wsrep_info[sizeof(wsrep_info) - 1] = '\0'; /* make sure it is 0-terminated */ -+#endif /* WSREP_PROC_INFO */ -+#endif /* WITH_WSREP */ - - m_internal_handler= NULL; - m_binlog_invoker= FALSE; -@@ -1378,6 +1588,22 @@ - reset_current_stmt_binlog_format_row(); - reset_binlog_local_stmt_filter(); - memset(&status_var, 0, sizeof(status_var)); -+#ifdef WITH_WSREP -+ wsrep_exec_mode= wsrep_applier ? REPL_RECV : LOCAL_STATE; -+ wsrep_conflict_state= NO_CONFLICT; -+ wsrep_query_state= QUERY_IDLE; -+ wsrep_last_query_id= 0; -+ wsrep_trx_meta.gtid= WSREP_GTID_UNDEFINED; -+ wsrep_trx_meta.depends_on= WSREP_SEQNO_UNDEFINED; -+ wsrep_converted_lock_session= false; -+ wsrep_retry_counter= 0; -+ wsrep_rli= NULL; -+ wsrep_PA_safe= true; -+ wsrep_consistency_check = NO_CONSISTENCY_CHECK; -+ wsrep_mysql_replicated = 0; -+ wsrep_TOI_pre_query = NULL; -+ wsrep_TOI_pre_query_len = 0; -+#endif - binlog_row_event_extra_data= 0; - - if (variables.sql_log_bin) -@@ -1570,6 +1796,13 @@ - plugin_thdvar_cleanup(this); - - m_release_resources_done= true; -+#ifdef WITH_WSREP -+ mysql_mutex_lock(&LOCK_wsrep_thd); -+ mysql_mutex_unlock(&LOCK_wsrep_thd); -+ mysql_mutex_destroy(&LOCK_wsrep_thd); -+ if (wsrep_rli) delete wsrep_rli; -+ if (wsrep_status_vars) wsrep->stats_free(wsrep, wsrep_status_vars); -+#endif - } - - -@@ -1863,7 +2096,19 @@ - (e.g. see partitioning code). - */ - if (!thd_table->needs_reopen()) -+#ifdef WITH_WSREP -+ { -+ signalled|= mysql_lock_abort_for_thread(this, thd_table); -+ if (this && WSREP(this) && wsrep_thd_is_BF((void *)this, FALSE)) -+ { -+ WSREP_DEBUG("remove_table_from_cache: %llu", -+ (unsigned long long) this->real_id); -+ wsrep_abort_thd((void *)this, (void *)in_use, FALSE); -+ } -+ } -+#else - signalled|= mysql_lock_abort_for_thread(this, thd_table); -+#endif - } - mysql_mutex_unlock(&in_use->LOCK_thd_data); - } -@@ -2428,6 +2673,13 @@ - bool select_send::send_result_set_metadata(List &list, uint flags) - { - bool res; -+#ifdef WITH_WSREP -+ if (WSREP(thd) && thd->wsrep_retry_query) -+ { -+ WSREP_DEBUG("skipping select metadata"); -+ return FALSE; -+ } -+#endif /* WITH_WSREP */ - if (!(res= thd->protocol->send_result_set_metadata(&list, flags))) - is_result_set_started= 1; - return res; -@@ -4196,8 +4448,13 @@ - - extern "C" int thd_binlog_format(const MYSQL_THD thd) - { -+#ifdef WITH_WSREP -+ if (((WSREP(thd) && wsrep_emulate_bin_log) || mysql_bin_log.is_open()) && -+ (thd->variables.option_bits & OPTION_BIN_LOG)) -+#else - if (mysql_bin_log.is_open() && (thd->variables.option_bits & OPTION_BIN_LOG)) -- return (int) thd->variables.binlog_format; -+#endif -+ return (int) WSREP_BINLOG_FORMAT(thd->variables.binlog_format); - else - return BINLOG_FORMAT_UNSPEC; - } - -=== modified file 'sql/sql_class.h' ---- old/sql/sql_class.h 2013-12-03 09:53:16 +0000 -+++ new/sql/sql_class.h 2014-03-11 21:17:40 +0000 -@@ -69,6 +69,18 @@ - #define THD_STAGE_INFO(thd, stage) \ - (thd)->enter_stage(& stage, NULL, __func__, __FILE__, __LINE__) - -+#ifdef WITH_WSREP -+#include "wsrep_mysqld.h" -+struct wsrep_thd_shadow { -+ ulonglong options; -+ uint server_status; -+ enum wsrep_exec_mode wsrep_exec_mode; -+ Vio *vio; -+ ulong tx_isolation; -+ char *db; -+ size_t db_length; -+}; -+#endif - class Reprepare_observer; - class Relay_log_info; - -@@ -544,6 +556,11 @@ - my_bool sysdate_is_now; - my_bool binlog_rows_query_log_events; - -+#ifdef WITH_WSREP -+ my_bool wsrep_on; -+ my_bool wsrep_causal_reads; -+ ulong wsrep_retry_autocommit; -+#endif - double long_query_time_double; - - my_bool pseudo_slave_mode; -@@ -2315,7 +2332,8 @@ - int is_current_stmt_binlog_format_row() const { - DBUG_ASSERT(current_stmt_binlog_format == BINLOG_FORMAT_STMT || - current_stmt_binlog_format == BINLOG_FORMAT_ROW); -- return current_stmt_binlog_format == BINLOG_FORMAT_ROW; -+ return (WSREP_BINLOG_FORMAT((ulong)current_stmt_binlog_format) == -+ BINLOG_FORMAT_ROW); - } - /** Tells whether the given optimizer_switch flag is on */ - inline bool optimizer_switch_flag(ulonglong flag) const -@@ -3108,6 +3126,45 @@ - query_id_t first_query_id; - } binlog_evt_union; - -+#ifdef WITH_WSREP -+ const bool wsrep_applier; /* dedicated slave applier thread */ -+ bool wsrep_applier_closing; /* applier marked to close */ -+ bool wsrep_client_thread; /* to identify client threads*/ -+ enum wsrep_exec_mode wsrep_exec_mode; -+ query_id_t wsrep_last_query_id; -+ enum wsrep_query_state wsrep_query_state; -+ enum wsrep_conflict_state wsrep_conflict_state; -+ mysql_mutex_t LOCK_wsrep_thd; -+ mysql_cond_t COND_wsrep_thd; -+ // changed from wsrep_seqno_t to wsrep_trx_meta_t in wsrep API rev 75 -+ // wsrep_seqno_t wsrep_trx_seqno; -+ wsrep_trx_meta_t wsrep_trx_meta; -+ uint32 wsrep_rand; -+ Relay_log_info* wsrep_rli; -+ bool wsrep_converted_lock_session; -+ wsrep_ws_handle_t wsrep_ws_handle; -+#ifdef WSREP_PROC_INFO -+ char wsrep_info[128]; /* string for dynamic proc info */ -+#endif /* WSREP_PROC_INFO */ -+ ulong wsrep_retry_counter; // of autocommit -+ bool wsrep_PA_safe; -+ char* wsrep_retry_query; -+ size_t wsrep_retry_query_len; -+ enum enum_server_command wsrep_retry_command; -+ enum wsrep_consistency_check_mode -+ wsrep_consistency_check; -+ wsrep_stats_var* wsrep_status_vars; -+ int wsrep_mysql_replicated; -+ const char* wsrep_TOI_pre_query; /* a query to apply before -+ the actual TOI query */ -+ size_t wsrep_TOI_pre_query_len; -+ wsrep_po_handle_t wsrep_po_handle; -+ size_t wsrep_po_cnt; -+ my_bool wsrep_po_in_trans; -+ rpl_sid wsrep_po_sid; -+ void* wsrep_apply_format; -+ bool wsrep_apply_toi; /* applier processing in TOI */ -+#endif /* WITH_WSREP */ - /** - Internal parser state. - Note that since the parser is not re-entrant, we keep only one parser -@@ -3143,7 +3200,11 @@ - // We don't want to load/unload plugins for unit tests. - bool m_enable_plugins; - -+#ifdef WITH_WSREP -+ THD(bool enable_plugins= true, bool is_applier = false); -+#else - THD(bool enable_plugins= true); -+#endif - - /* - The THD dtor is effectively split in two: -@@ -3651,7 +3712,7 @@ - tests fail and so force them to propagate the - lex->binlog_row_based_if_mixed upwards to the caller. - */ -- if ((variables.binlog_format == BINLOG_FORMAT_MIXED) && -+ if ((WSREP_BINLOG_FORMAT(variables.binlog_format) == BINLOG_FORMAT_MIXED)&& - (in_sub_stmt == 0)) - set_current_stmt_binlog_format_row(); - -@@ -3693,7 +3754,7 @@ - show_system_thread(system_thread))); - if (in_sub_stmt == 0) - { -- if (variables.binlog_format == BINLOG_FORMAT_ROW) -+ if (WSREP_BINLOG_FORMAT(variables.binlog_format) == BINLOG_FORMAT_ROW) - set_current_stmt_binlog_format_row(); - else if (temporary_tables == NULL) - clear_current_stmt_binlog_format_row(); - -=== modified file 'sql/sql_connect.cc' ---- old/sql/sql_connect.cc 2014-01-06 06:03:08 +0000 -+++ new/sql/sql_connect.cc 2014-03-11 21:17:40 +0000 -@@ -57,6 +57,9 @@ - #else - #define MIN_HANDSHAKE_SIZE 6 - #endif /* HAVE_OPENSSL && !EMBEDDED_LIBRARY */ -+#ifdef WITH_WSREP -+#include "wsrep_mysqld.h" -+#endif - - /* - Get structure for logging connection data for the current user -@@ -706,7 +709,11 @@ - { - if (thd->store_globals()) - { -+#ifdef WITH_WSREP -+ close_connection(thd, ER_OUT_OF_RESOURCES, 1); -+#else - close_connection(thd, ER_OUT_OF_RESOURCES); -+#endif - statistic_increment(aborted_connects,&LOCK_status); - MYSQL_CALLBACK(thread_scheduler, end_thread, (thd, 0)); - return 1; // Error -@@ -772,6 +779,17 @@ - void end_connection(THD *thd) - { - NET *net= &thd->net; -+#ifdef WITH_WSREP -+ if (WSREP(thd)) -+ { -+ wsrep_status_t rcode= wsrep->free_connection(wsrep, thd->thread_id); -+ if (rcode) { -+ WSREP_WARN("wsrep failed to free connection context: %lu, code: %d", -+ thd->thread_id, rcode); -+ } -+ } -+ thd->wsrep_client_thread= 0; -+#endif - plugin_thdvar_cleanup(thd); - - /* -@@ -912,6 +930,9 @@ - (char *) thd->security_ctx->host_or_ip); - - prepare_new_connection_state(thd); -+#ifdef WITH_WSREP -+ thd->wsrep_client_thread= 1; -+#endif /* WITH_WSREP */ - return FALSE; - } - -@@ -933,7 +954,11 @@ - - if (MYSQL_CALLBACK_ELSE(thread_scheduler, init_new_connection_thread, (), 0)) - { -+#ifdef WITH_WSREP -+ close_connection(thd, ER_OUT_OF_RESOURCES, 1); -+#else - close_connection(thd, ER_OUT_OF_RESOURCES); -+#endif - statistic_increment(aborted_connects,&LOCK_status); - MYSQL_CALLBACK(thread_scheduler, end_thread, (thd, 0)); - return; -@@ -983,9 +1008,21 @@ - break; - } - end_connection(thd); -+#ifdef WITH_WSREP -+ if (WSREP(thd)) -+ { -+ mysql_mutex_lock(&thd->LOCK_wsrep_thd); -+ thd->wsrep_query_state= QUERY_EXITING; -+ mysql_mutex_unlock(&thd->LOCK_wsrep_thd); -+ } -+#endif - - end_thread: -+#ifdef WITH_WSREP -+ close_connection(thd, 0, 1); -+#else - close_connection(thd); -+#endif - if (MYSQL_CALLBACK_ELSE(thread_scheduler, end_thread, (thd, 1), 0)) - return; // Probably no-threads - - -=== modified file 'sql/sql_delete.cc' ---- old/sql/sql_delete.cc 2013-10-30 23:22:43 +0000 -+++ new/sql/sql_delete.cc 2013-12-11 10:24:00 +0000 -@@ -450,7 +450,11 @@ - /* See similar binlogging code in sql_update.cc, for comments */ - if ((error < 0) || thd->transaction.stmt.cannot_safely_rollback()) - { -+#ifdef WITH_WSREP -+ if ((WSREP_EMULATE_BINLOG(thd) || mysql_bin_log.is_open())) -+#else - if (mysql_bin_log.is_open()) -+#endif - { - int errcode= 0; - if (error < 0) -@@ -895,7 +899,11 @@ - /* - there is only side effects; to binlog with the error - */ -+#ifdef WITH_WSREP -+ if (WSREP_EMULATE_BINLOG(thd) || mysql_bin_log.is_open()) -+#else - if (mysql_bin_log.is_open()) -+#endif - { - int errcode= query_error_code(thd, thd->killed == THD::NOT_KILLED); - /* possible error of writing binary log is ignored deliberately */ -@@ -1066,7 +1074,11 @@ - } - if ((local_error == 0) || thd->transaction.stmt.cannot_safely_rollback()) - { -+#ifdef WITH_WSREP -+ if (WSREP_EMULATE_BINLOG(thd) || mysql_bin_log.is_open()) -+#else - if (mysql_bin_log.is_open()) -+#endif - { - int errcode= 0; - if (local_error == 0) - -=== modified file 'sql/sql_insert.cc' ---- old/sql/sql_insert.cc 2013-10-30 23:22:43 +0000 -+++ new/sql/sql_insert.cc 2013-12-11 10:24:00 +0000 -@@ -1124,7 +1124,11 @@ - thd->transaction.stmt.cannot_safely_rollback() || - was_insert_delayed) - { -+#ifdef WITH_WSREP -+ if (WSREP_EMULATE_BINLOG(thd) || mysql_bin_log.is_open()) -+#else - if (mysql_bin_log.is_open()) -+#endif - { - int errcode= 0; - if (error <= 0) -@@ -3773,7 +3777,13 @@ - DBUG_PRINT("enter", ("trans_table=%d, table_type='%s'", - trans_table, table->file->table_type())); - -+#ifdef WITH_WSREP -+ error= (thd->wsrep_conflict_state == MUST_ABORT || -+ thd->wsrep_conflict_state == CERT_FAILURE) ? -1 : -+ (bulk_insert_started ? -+#else - error= (bulk_insert_started ? -+#endif /* WITH_WSREP */ - table->file->ha_end_bulk_insert() : 0); - if (!error && thd->is_error()) - error= thd->get_stmt_da()->sql_errno(); -@@ -3800,8 +3810,13 @@ - events are in the transaction cache and will be written when - ha_autocommit_or_rollback() is issued below. - */ -+#ifdef WITH_WSREP -+ if ((WSREP_EMULATE_BINLOG(thd) || mysql_bin_log.is_open()) && -+ (!error || thd->transaction.stmt.cannot_safely_rollback())) -+#else - if (mysql_bin_log.is_open() && - (!error || thd->transaction.stmt.cannot_safely_rollback())) -+#endif - { - int errcode= 0; - if (!error) -@@ -3886,7 +3901,11 @@ - transactional_table= table->file->has_transactions(); - if (thd->transaction.stmt.cannot_safely_rollback()) - { -+#ifdef WITH_WSREP -+ if (WSREP_EMULATE_BINLOG(thd) || mysql_bin_log.is_open()) -+#else - if (mysql_bin_log.is_open()) -+#endif - { - int errcode= query_error_code(thd, thd->killed == THD::NOT_KILLED); - /* error of writing binary log is ignored */ -@@ -4293,7 +4312,11 @@ - /* show_database */ TRUE); - DBUG_ASSERT(result == 0); /* store_create_info() always return 0 */ - -+#ifdef WITH_WSREP -+ if (WSREP_EMULATE_BINLOG(thd) || mysql_bin_log.is_open()) -+#else - if (mysql_bin_log.is_open()) -+#endif /* WITH_WSREP */ - { - int errcode= query_error_code(thd, thd->killed == THD::NOT_KILLED); - result= thd->binlog_query(THD::STMT_QUERY_TYPE, -@@ -4303,6 +4326,9 @@ - /* suppress_use */ FALSE, - errcode); - } -+#ifdef WITH_WSREP -+ ha_wsrep_fake_trx_id(thd); -+#endif - return result; - } - -@@ -4368,6 +4394,18 @@ - { - trans_commit_stmt(thd); - trans_commit_implicit(thd); -+#ifdef WITH_WSREP -+ mysql_mutex_lock(&thd->LOCK_wsrep_thd); -+ if (thd->wsrep_conflict_state != NO_CONFLICT) -+ { -+ WSREP_DEBUG("select_create commit failed, thd: %lu err: %d %s", -+ thd->thread_id, thd->wsrep_conflict_state, thd->query()); -+ mysql_mutex_unlock(&thd->LOCK_wsrep_thd); -+ abort_result_set(); -+ return TRUE; -+ } -+ mysql_mutex_unlock(&thd->LOCK_wsrep_thd); -+#endif /* WITH_WSREP */ - } - - table->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY); - -=== modified file 'sql/sql_lex.cc' ---- old/sql/sql_lex.cc 2013-12-16 07:40:11 +0000 -+++ new/sql/sql_lex.cc 2014-03-11 21:17:40 +0000 -@@ -1507,6 +1507,17 @@ - } - else - { -+#ifdef WITH_WSREP -+ if (version == 99997 && thd->wsrep_exec_mode == LOCAL_STATE) -+ { -+ WSREP_DEBUG("consistency check: %s", thd->query()); -+ thd->wsrep_consistency_check= CONSISTENCY_CHECK_DECLARED; -+ lip->yySkipn(5); -+ lip->set_echo(TRUE); -+ state=MY_LEX_START; -+ break; /* Do not treat contents as a comment. */ -+ } -+#endif /* WITH_WSREP */ - /* - Patch and skip the conditional comment to avoid it - being propagated infinitely (eg. to a slave). - -=== modified file 'sql/sql_parse.cc' ---- old/sql/sql_parse.cc 2013-10-30 23:22:43 +0000 -+++ new/sql/sql_parse.cc 2014-01-09 15:46:55 +0000 -@@ -107,6 +107,12 @@ - - #define FLAGSTR(V,F) ((V)&(F)?#F" ":"") - -+#ifdef WITH_WSREP -+#include "wsrep_mysqld.h" -+#include "wsrep_thd.h" -+static void wsrep_mysql_parse(THD *thd, char *rawbuf, uint length, -+ Parser_state *parser_state); -+#endif /* WITH_WSREP */ - /** - @defgroup Runtime_Environment Runtime Environment - @{ -@@ -823,7 +829,11 @@ - if (my_thread_init() || thd->store_globals()) - { - #ifndef EMBEDDED_LIBRARY -+#ifdef WITH_WSREP -+ close_connection(thd, ER_OUT_OF_RESOURCES, 1); -+#else - close_connection(thd, ER_OUT_OF_RESOURCES); -+#endif /* WITH_WSREP */ - #endif - thd->fatal_error(); - goto end; -@@ -915,7 +925,18 @@ - enum enum_server_command command; - - DBUG_ENTER("do_command"); -- -+#ifdef WITH_WSREP -+ if (WSREP(thd)) -+ { -+ mysql_mutex_lock(&thd->LOCK_wsrep_thd); -+ thd->wsrep_query_state= QUERY_IDLE; -+ if (thd->wsrep_conflict_state==MUST_ABORT) -+ { -+ wsrep_client_rollback(thd); -+ } -+ mysql_mutex_unlock(&thd->LOCK_wsrep_thd); -+ } -+#endif /* WITH_WSREP */ - /* - indicator of uninitialized lex => normal flow of errors handling - (see my_message_sql) -@@ -954,7 +975,6 @@ - matter here, because the read/recv() below doesn't use it. - */ - DEBUG_SYNC(thd, "before_do_command_net_read"); -- - /* - Because of networking layer callbacks in place, - this call will maintain the following instrumentation: -@@ -970,12 +990,47 @@ - packet_length= my_net_read(net); - thd->m_server_idle= false; - -+#ifdef WITH_WSREP -+ if (WSREP(thd)) { -+ mysql_mutex_lock(&thd->LOCK_wsrep_thd); -+ /* these THD's are aborted or are aborting during being idle */ -+ if (thd->wsrep_conflict_state == ABORTING) -+ { -+ while (thd->wsrep_conflict_state == ABORTING) { -+ mysql_mutex_unlock(&thd->LOCK_wsrep_thd); -+ my_sleep(1000); -+ mysql_mutex_lock(&thd->LOCK_wsrep_thd); -+ } -+ thd->store_globals(); -+ } -+ else if (thd->wsrep_conflict_state == ABORTED) -+ { -+ thd->store_globals(); -+ } -+ -+ thd->wsrep_query_state= QUERY_EXEC; -+ mysql_mutex_unlock(&thd->LOCK_wsrep_thd); -+ } -+ if (WSREP(thd) && packet_length == packet_error) -+#else - if (packet_length == packet_error) -+#endif /* WITH_WSREP */ - { - DBUG_PRINT("info",("Got error %d reading command from socket %s", - net->error, - vio_description(net->vio))); - -+#ifdef WITH_WSREP -+ if (WSREP(thd)) { -+ mysql_mutex_lock(&thd->LOCK_wsrep_thd); -+ if (thd->wsrep_conflict_state == MUST_ABORT) -+ { -+ DBUG_PRINT("wsrep",("aborted for wsrep rollback: %lu", thd->real_id)); -+ wsrep_client_rollback(thd); -+ } -+ mysql_mutex_unlock(&thd->LOCK_wsrep_thd); -+ } -+#endif /* WITH_WSREP */ - /* Instrument this broken statement as "statement/com/error" */ - thd->m_statement_psi= MYSQL_REFINE_STATEMENT(thd->m_statement_psi, - com_statement_info[COM_END].m_key); -@@ -1028,6 +1083,33 @@ - vio_description(net->vio), command, - command_name[command].str)); - -+#ifdef WITH_WSREP -+ if (WSREP(thd)) { -+ /* -+ * bail out if DB snapshot has not been installed. We however, -+ * allow queries "SET" and "SHOW", they are trapped later in execute_command -+ */ -+ if (thd->variables.wsrep_on && !thd->wsrep_applier && !wsrep_ready && -+ command != COM_QUERY && -+ command != COM_PING && -+ command != COM_QUIT && -+ command != COM_PROCESS_INFO && -+ command != COM_PROCESS_KILL && -+ command != COM_SET_OPTION && -+ command != COM_SHUTDOWN && -+ command != COM_SLEEP && -+ command != COM_STATISTICS && -+ command != COM_TIME && -+ command != COM_END -+ ) { -+ my_error(ER_UNKNOWN_COM_ERROR, MYF(0), -+ "WSREP has not yet prepared node for application use"); -+ thd->protocol->end_statement(); -+ return_value= FALSE; -+ goto out; -+ } -+ } -+#endif /* WITH_WSREP */ - /* Restore read timeout value */ - my_net_set_read_timeout(net, thd->variables.net_read_timeout); - -@@ -1035,6 +1117,22 @@ - - return_value= dispatch_command(command, thd, packet+1, (uint) (packet_length-1)); - -+#ifdef WITH_WSREP -+ if (WSREP(thd)) { -+ while (thd->wsrep_conflict_state== RETRY_AUTOCOMMIT) -+ { -+ return_value= dispatch_command(command, thd, thd->wsrep_retry_query, -+ thd->wsrep_retry_query_len); -+ } -+ } -+ if (thd->wsrep_retry_query && thd->wsrep_conflict_state != REPLAYING) -+ { -+ my_free(thd->wsrep_retry_query); -+ thd->wsrep_retry_query = NULL; -+ thd->wsrep_retry_query_len = 0; -+ thd->wsrep_retry_command = COM_CONNECT; -+ } -+#endif /* WITH_WSREP */ - out: - /* The statement instrumentation must be closed in all cases. */ - DBUG_ASSERT(thd->m_statement_psi == NULL); -@@ -1110,6 +1208,33 @@ - DBUG_RETURN(FALSE); - } - -+#ifdef WITH_WSREP -+static my_bool wsrep_read_only_option(THD *thd, TABLE_LIST *all_tables) -+{ -+ int opt_readonly_saved = opt_readonly; -+ ulong flag_saved = (ulong)(thd->security_ctx->master_access & SUPER_ACL); -+ -+ opt_readonly = 0; -+ thd->security_ctx->master_access &= ~SUPER_ACL; -+ -+ my_bool ret = !deny_updates_if_read_only_option(thd, all_tables); -+ -+ opt_readonly = opt_readonly_saved; -+ thd->security_ctx->master_access |= flag_saved; -+ -+ return ret; -+} -+ -+static void wsrep_copy_query(THD *thd) -+{ -+ thd->wsrep_retry_command = thd->get_command(); -+ thd->wsrep_retry_query_len = thd->query_length(); -+ thd->wsrep_retry_query = (char *)my_malloc( -+ thd->wsrep_retry_query_len + 1, MYF(0)); -+ strncpy(thd->wsrep_retry_query, thd->query(), thd->wsrep_retry_query_len); -+ thd->wsrep_retry_query[thd->wsrep_retry_query_len] = '\0'; -+} -+#endif /* WITH_WSREP */ - /** - Perform one connection-level (COM_XXXX) command. - -@@ -1138,7 +1263,42 @@ - bool error= 0; - DBUG_ENTER("dispatch_command"); - DBUG_PRINT("info",("packet: '%*.s'; command: %d", packet_length, packet, command)); -+#ifdef WITH_WSREP -+ if (WSREP(thd)) { -+ if (!thd->in_multi_stmt_transaction_mode()) -+ { -+ thd->wsrep_PA_safe= true; -+ } - -+ mysql_mutex_lock(&thd->LOCK_wsrep_thd); -+ thd->wsrep_query_state= QUERY_EXEC; -+ if (thd->wsrep_conflict_state== RETRY_AUTOCOMMIT) -+ { -+ thd->wsrep_conflict_state= NO_CONFLICT; -+ } -+ if (thd->wsrep_conflict_state== MUST_ABORT) -+ { -+ wsrep_client_rollback(thd); -+ } -+ if (thd->wsrep_conflict_state== ABORTED) -+ { -+ my_error(ER_LOCK_DEADLOCK, MYF(0), "wsrep aborted transaction"); -+ WSREP_DEBUG("Deadlock error for: %s", thd->query()); -+ mysql_mutex_unlock(&thd->LOCK_wsrep_thd); -+ thd->killed = THD::NOT_KILLED; -+ thd->mysys_var->abort = 0; -+ thd->wsrep_conflict_state = NO_CONFLICT; -+ thd->wsrep_retry_counter = 0; -+ /* -+ Increment threads running to compensate dec_thread_running() called -+ after dispatch_end label. -+ */ -+ inc_thread_running(); -+ goto dispatch_end; -+ } -+ mysql_mutex_unlock(&thd->LOCK_wsrep_thd); -+ } -+#endif /* WITH_WSREP */ - /* SHOW PROFILE instrumentation, begin */ - #if defined(ENABLED_PROFILING) - thd->profiling.start_new_query(); -@@ -1321,6 +1481,37 @@ - - DBUG_PRINT("query",("%-.4096s",thd->query())); - -+#ifdef WITH_WSREP -+ -+ if (WSREP(thd)) { -+ if (!thd->in_multi_stmt_transaction_mode()) -+ { -+ thd->wsrep_PA_safe= true; -+ } -+ -+ mysql_mutex_lock(&thd->LOCK_wsrep_thd); -+ thd->wsrep_query_state= QUERY_EXEC; -+ if (thd->wsrep_conflict_state== RETRY_AUTOCOMMIT) -+ { -+ thd->wsrep_conflict_state= NO_CONFLICT; -+ } -+ -+ if (thd->wsrep_conflict_state== MUST_ABORT) -+ { -+ wsrep_client_rollback(thd); -+ } -+ if (thd->wsrep_conflict_state== ABORTED) -+ { -+ my_error(ER_LOCK_DEADLOCK, MYF(0), "wsrep aborted transaction"); -+ WSREP_DEBUG("Deadlock error for: %s", thd->query()); -+ mysql_mutex_unlock(&thd->LOCK_wsrep_thd); -+ thd->killed= THD::NOT_KILLED; -+ thd->mysys_var->abort= 0; -+ goto dispatch_end; -+ } -+ mysql_mutex_unlock(&thd->LOCK_wsrep_thd); -+ } -+#endif /* WITH_WSREP */ - #if defined(ENABLED_PROFILING) - thd->profiling.set_query_source(thd->query(), thd->query_length()); - #endif -@@ -1331,7 +1522,11 @@ - if (parser_state.init(thd, thd->query(), thd->query_length())) - break; - -+#ifdef WITH_WSREP -+ wsrep_mysql_parse(thd, thd->query(), thd->query_length(), &parser_state); -+#else - mysql_parse(thd, thd->query(), thd->query_length(), &parser_state); -+#endif /* WITH_WSREP */ - - while (!thd->killed && (parser_state.m_lip.found_semicolon != NULL) && - ! thd->is_error()) -@@ -1403,10 +1598,19 @@ - Count each statement from the client. - */ - statistic_increment(thd->status_var.questions, &LOCK_status); -+#ifdef WITH_WSREP -+ if (!WSREP(thd)) -+ thd->set_time(); /* Reset the query start time. */ -+#else - thd->set_time(); /* Reset the query start time. */ -+#endif /* WITH_WSREP */ - parser_state.reset(beginning_of_next_stmt, length); - /* TODO: set thd->lex->sql_command to SQLCOM_END here */ -+#ifdef WITH_WSREP -+ wsrep_mysql_parse(thd, beginning_of_next_stmt, length, &parser_state); -+#else - mysql_parse(thd, beginning_of_next_stmt, length, &parser_state); -+#endif /* WITH_WSREP */ - } - - DBUG_PRINT("info",("query ready")); -@@ -1748,6 +1952,26 @@ - my_message(ER_UNKNOWN_COM_ERROR, ER(ER_UNKNOWN_COM_ERROR), MYF(0)); - break; - } -+#ifdef WITH_WSREP -+ dispatch_end: -+ -+ if (WSREP(thd)) { -+ /* wsrep BF abort in query exec phase */ -+ mysql_mutex_lock(&thd->LOCK_wsrep_thd); -+ if ((thd->wsrep_conflict_state != REPLAYING) && -+ (thd->wsrep_conflict_state != RETRY_AUTOCOMMIT)) { -+ mysql_mutex_unlock(&thd->LOCK_wsrep_thd); -+ -+ thd->update_server_status(); -+ thd->protocol->end_statement(); -+ query_cache_end_of_result(thd); -+ } -+ else -+ { -+ mysql_mutex_unlock(&thd->LOCK_wsrep_thd); -+ } -+ } else { /* if (WSREP(thd))... */ -+#endif /* WITH_WSREP */ - - done: - DBUG_ASSERT(thd->derived_tables == NULL && -@@ -1760,6 +1984,9 @@ - thd->send_kill_message(); - thd->protocol->end_statement(); - query_cache_end_of_result(thd); -+#ifdef WITH_WSREP -+ } -+#endif /* WITH_WSREP */ - - if (!thd->is_error() && !thd->killed_errno()) - mysql_audit_general(thd, MYSQL_AUDIT_GENERAL_RESULT, 0, 0); -@@ -2258,6 +2485,13 @@ - return TRUE; - } - -+#ifdef WITH_WSREP -+static bool wsrep_is_show_query(enum enum_sql_command command) -+{ -+ DBUG_ASSERT(command >= 0 && command <= SQLCOM_END); -+ return (sql_command_flags[command] & CF_STATUS_COMMAND) != 0; -+} -+#endif /* WITH_WSREP */ - - /** - Execute command saved in thd and lex->sql_command. -@@ -2490,7 +2724,6 @@ - #ifdef HAVE_REPLICATION - } /* endif unlikely slave */ - #endif -- - status_var_increment(thd->status_var.com_stat[lex->sql_command]); - - Opt_trace_start ots(thd, all_tables, lex->sql_command, &lex->var_list, -@@ -2499,6 +2732,45 @@ - - Opt_trace_object trace_command(&thd->opt_trace); - Opt_trace_array trace_command_steps(&thd->opt_trace, "steps"); -+#ifdef WITH_WSREP -+ if (WSREP(thd)) { -+ /* -+ change LOCK TABLE WRITE to transaction -+ */ -+ if (lex->sql_command== SQLCOM_LOCK_TABLES && wsrep_convert_LOCK_to_trx) -+ { -+ for (TABLE_LIST *table= all_tables; table; table= table->next_global) -+ { -+ if (table->lock_type >= TL_WRITE_ALLOW_WRITE) -+ { -+ lex->sql_command= SQLCOM_BEGIN; -+ thd->wsrep_converted_lock_session= true; -+ break; -+ } -+ } -+ } -+ if (lex->sql_command== SQLCOM_UNLOCK_TABLES && -+ thd->wsrep_converted_lock_session) -+ { -+ thd->wsrep_converted_lock_session= false; -+ lex->sql_command= SQLCOM_COMMIT; -+ lex->tx_release= TVL_NO; -+ } -+ -+ /* -+ * bail out if DB snapshot has not been installed. We however, -+ * allow SET and SHOW queries -+ */ -+ if (thd->variables.wsrep_on && !thd->wsrep_applier && !wsrep_ready && -+ lex->sql_command != SQLCOM_SET_OPTION && -+ !wsrep_is_show_query(lex->sql_command)) -+ { -+ my_error(ER_UNKNOWN_COM_ERROR, MYF(0), -+ "WSREP has not yet prepared node for application use"); -+ goto error; -+ } -+ } -+#endif /* WITH_WSREP */ - - DBUG_ASSERT(thd->transaction.stmt.cannot_safely_rollback() == FALSE); - -@@ -2539,7 +2811,13 @@ - - /* Commit the normal transaction if one is active. */ - if (trans_commit_implicit(thd)) -+ { -+ thd->mdl_context.release_transactional_locks(); -+#ifdef WITH_WSREP -+ WSREP_DEBUG("implicit commit failed, MDL released: %lu", thd->thread_id); -+#endif /* WITH_WSREP */ - goto error; -+ } - /* Release metadata locks acquired in this transaction. */ - thd->mdl_context.release_transactional_locks(); - } -@@ -2609,6 +2887,9 @@ - &old_status_var); - thd->status_var= old_status_var; - mysql_mutex_unlock(&LOCK_status); -+#ifdef WITH_WSREP -+ if (lex->sql_command == SQLCOM_SHOW_STATUS) wsrep_free_status(thd); -+#endif /* WITH_WSREP */ - break; - } - case SQLCOM_SHOW_EVENTS: -@@ -2626,12 +2907,22 @@ - case SQLCOM_SHOW_PLUGINS: - case SQLCOM_SHOW_FIELDS: - case SQLCOM_SHOW_KEYS: -+#ifndef WITH_WSREP - case SQLCOM_SHOW_VARIABLES: - case SQLCOM_SHOW_CHARSETS: - case SQLCOM_SHOW_COLLATIONS: - case SQLCOM_SHOW_STORAGE_ENGINES: - case SQLCOM_SHOW_PROFILE: -+#endif /* WITH_WSREP */ - case SQLCOM_SELECT: -+#ifdef WITH_WSREP -+ if (WSREP_CLIENT(thd) && wsrep_causal_wait(thd)) goto error; -+ case SQLCOM_SHOW_VARIABLES: -+ case SQLCOM_SHOW_CHARSETS: -+ case SQLCOM_SHOW_COLLATIONS: -+ case SQLCOM_SHOW_STORAGE_ENGINES: -+ case SQLCOM_SHOW_PROFILE: -+#endif /* WITH_WSREP */ - { - thd->status_var.last_query_cost= 0.0; - thd->status_var.last_query_partial_plans= 0; -@@ -2931,7 +3222,7 @@ - */ - if (thd->query_name_consts && - mysql_bin_log.is_open() && -- thd->variables.binlog_format == BINLOG_FORMAT_STMT && -+ WSREP_BINLOG_FORMAT(thd->variables.binlog_format) == BINLOG_FORMAT_STMT && - !mysql_bin_log.is_query_in_union(thd, thd->query_id)) - { - List_iterator_fast it(select_lex->item_list); -@@ -3047,6 +3338,15 @@ - } - else - { -+#ifdef WITH_WSREP -+ /* in STATEMENT format, we probably have to replicate also temporary -+ tables, like mysql replication does -+ */ -+ if (!thd->is_current_stmt_binlog_format_row() || -+ !(create_info.options & HA_LEX_CREATE_TMP_TABLE)) -+ WSREP_TO_ISOLATION_BEGIN(create_table->db, create_table->table_name, -+ NULL) -+#endif /* WITH_WSREP */ - /* Regular CREATE TABLE */ - res= mysql_create_table(thd, create_table, - &create_info, &alter_info); -@@ -3080,6 +3380,7 @@ - DBUG_ASSERT(first_table == all_tables && first_table != 0); - if (check_one_table_access(thd, INDEX_ACL, all_tables)) - goto error; /* purecov: inspected */ -+ WSREP_TO_ISOLATION_BEGIN(first_table->db, first_table->table_name, NULL) - /* - Currently CREATE INDEX or DROP INDEX cause a full table rebuild - and thus classify as slow administrative statements just like -@@ -3172,8 +3473,11 @@ - goto error; - } - -+ WSREP_TO_ISOLATION_BEGIN(0, 0, first_table) - if (mysql_rename_tables(thd, first_table, 0)) -+ { - goto error; -+ } - break; - } - #ifndef EMBEDDED_LIBRARY -@@ -3199,6 +3503,10 @@ - goto error; - #else - { -+#ifdef WITH_WSREP -+ if (WSREP_CLIENT(thd) && wsrep_causal_wait(thd)) goto error; -+#endif /* WITH_WSREP */ -+ - /* - Access check: - SHOW CREATE TABLE require any privileges on the table level (ie -@@ -3261,6 +3569,10 @@ - case SQLCOM_CHECKSUM: - { - DBUG_ASSERT(first_table == all_tables && first_table != 0); -+#ifdef WITH_WSREP -+ if (WSREP_CLIENT(thd) && wsrep_causal_wait(thd)) goto error; -+#endif /* WITH_WSREP */ -+ - if (check_table_access(thd, SELECT_ACL, all_tables, - FALSE, UINT_MAX, FALSE)) - goto error; /* purecov: inspected */ -@@ -3461,6 +3773,15 @@ - DBUG_ASSERT(first_table == all_tables && first_table != 0); - if ((res= insert_precheck(thd, all_tables))) - break; -+#ifdef WITH_WSREP -+ if (lex->sql_command == SQLCOM_INSERT_SELECT && -+ thd->wsrep_consistency_check == CONSISTENCY_CHECK_DECLARED) -+ { -+ thd->wsrep_consistency_check = CONSISTENCY_CHECK_RUNNING; -+ WSREP_TO_ISOLATION_BEGIN(first_table->db, first_table->table_name, NULL); -+ } -+ -+#endif - /* - INSERT...SELECT...ON DUPLICATE KEY UPDATE/REPLACE SELECT/ - INSERT...IGNORE...SELECT can be unsafe, unless ORDER BY PRIMARY KEY -@@ -3627,6 +3948,18 @@ - if (check_table_access(thd, DROP_ACL, all_tables, FALSE, UINT_MAX, FALSE)) - goto error; /* purecov: inspected */ - } -+#ifdef WITH_WSREP -+ for (TABLE_LIST *table= all_tables; table; table= table->next_global) -+ { -+ if (!lex->drop_temporary && -+ (!thd->is_current_stmt_binlog_format_row() || -+ !find_temporary_table(thd, table))) -+ { -+ WSREP_TO_ISOLATION_BEGIN(NULL, NULL, all_tables); -+ break; -+ } -+ } -+#endif /* WITH_WSREP */ - /* DDL and binlog write order are protected by metadata locks. */ - res= mysql_rm_table(thd, first_table, lex->drop_if_exists, - lex->drop_temporary); -@@ -3664,7 +3997,6 @@ - - if (!mysql_change_db(thd, &db_str, FALSE)) - my_ok(thd); -- - break; - } - -@@ -3827,6 +4159,7 @@ - #endif - if (check_access(thd, CREATE_ACL, lex->name.str, NULL, NULL, 1, 0)) - break; -+ WSREP_TO_ISOLATION_BEGIN(lex->name.str, NULL, NULL) - res= mysql_create_db(thd,(lower_case_table_names == 2 ? alias : - lex->name.str), &create_info, 0); - break; -@@ -3851,6 +4184,7 @@ - #endif - if (check_access(thd, DROP_ACL, lex->name.str, NULL, NULL, 1, 0)) - break; -+ WSREP_TO_ISOLATION_BEGIN(lex->name.str, NULL, NULL) - res= mysql_rm_db(thd, lex->name.str, lex->drop_if_exists, 0); - break; - } -@@ -3874,6 +4208,7 @@ - res= 1; - break; - } -+ WSREP_TO_ISOLATION_BEGIN(db->str, NULL, NULL) - res= mysql_upgrade_db(thd, db); - if (!res) - my_ok(thd); -@@ -3901,6 +4236,7 @@ - #endif - if (check_access(thd, ALTER_ACL, db->str, NULL, NULL, 1, 0)) - break; -+ WSREP_TO_ISOLATION_BEGIN(db->str, NULL, NULL) - res= mysql_alter_db(thd, db->str, &create_info); - break; - } -@@ -3930,6 +4266,7 @@ - if (res) - break; - -+ WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL) - switch (lex->sql_command) { - case SQLCOM_CREATE_EVENT: - { -@@ -3964,6 +4301,7 @@ - lex->spname->m_name); - break; - case SQLCOM_DROP_EVENT: -+ WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL) - if (!(res= Events::drop_event(thd, - lex->spname->m_db, lex->spname->m_name, - lex->drop_if_exists))) -@@ -3978,6 +4316,7 @@ - if (check_access(thd, INSERT_ACL, "mysql", NULL, NULL, 1, 0)) - break; - #ifdef HAVE_DLOPEN -+ WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL) - if (!(res = mysql_create_function(thd, &lex->udf))) - my_ok(thd); - #else -@@ -3992,6 +4331,7 @@ - if (check_access(thd, INSERT_ACL, "mysql", NULL, NULL, 1, 1) && - check_global_access(thd,CREATE_USER_ACL)) - break; -+ WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL) - /* Conditionally writes to binlog */ - if (!(res= mysql_create_user(thd, lex->users_list))) - my_ok(thd); -@@ -4003,6 +4343,7 @@ - check_global_access(thd,CREATE_USER_ACL)) - break; - /* Conditionally writes to binlog */ -+ WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL) - if (!(res= mysql_drop_user(thd, lex->users_list))) - my_ok(thd); - break; -@@ -4013,6 +4354,7 @@ - check_global_access(thd,CREATE_USER_ACL)) - break; - /* Conditionally writes to binlog */ -+ WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL) - if (!(res= mysql_rename_user(thd, lex->users_list))) - my_ok(thd); - break; -@@ -4027,6 +4369,7 @@ - thd->binlog_invoker(); - - /* Conditionally writes to binlog */ -+ WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL) - if (!(res = mysql_revoke_all(thd, lex->users_list))) - my_ok(thd); - break; -@@ -4093,6 +4436,7 @@ - lex->type == TYPE_ENUM_PROCEDURE, 0)) - goto error; - /* Conditionally writes to binlog */ -+ WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL) - res= mysql_routine_grant(thd, all_tables, - lex->type == TYPE_ENUM_PROCEDURE, - lex->users_list, grants, -@@ -4106,6 +4450,7 @@ - all_tables, FALSE, UINT_MAX, FALSE)) - goto error; - /* Conditionally writes to binlog */ -+ WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL) - res= mysql_table_grant(thd, all_tables, lex->users_list, - lex->columns, lex->grant, - lex->sql_command == SQLCOM_REVOKE); -@@ -4121,6 +4466,7 @@ - } - else - { -+ WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL) - /* Conditionally writes to binlog */ - res = mysql_grant(thd, select_lex->db, lex->users_list, lex->grant, - lex->sql_command == SQLCOM_REVOKE, -@@ -4249,7 +4595,13 @@ - #endif - case SQLCOM_BEGIN: - if (trans_begin(thd, lex->start_transaction_opt)) -+ { -+ thd->mdl_context.release_transactional_locks(); -+#ifdef WITH_WSREP -+ WSREP_DEBUG("BEGIN failed, MDL released: %lu", thd->thread_id); -+#endif /* WITH_WSREP */ - goto error; -+ } - my_ok(thd); - break; - case SQLCOM_COMMIT: -@@ -4263,7 +4615,13 @@ - (thd->variables.completion_type == 2 && - lex->tx_release != TVL_NO)); - if (trans_commit(thd)) -+ { -+ thd->mdl_context.release_transactional_locks(); -+#ifdef WITH_WSREP -+ WSREP_DEBUG("COMMIT failed, MDL released: %lu", thd->thread_id); -+#endif /* WITH_WSREP */ - goto error; -+ } - thd->mdl_context.release_transactional_locks(); - /* Begin transaction with the same isolation level. */ - if (tx_chain) -@@ -4280,7 +4638,20 @@ - /* Disconnect the current client connection. */ - if (tx_release) - thd->killed= THD::KILL_CONNECTION; -+#ifdef WITH_WSREP -+ if (WSREP(thd)) { -+ -+ if (thd->wsrep_conflict_state == NO_CONFLICT || -+ thd->wsrep_conflict_state == REPLAYING) -+ { -+ my_ok(thd); -+ } -+ } else { -+#endif /* WITH_WSREP */ - my_ok(thd); -+#ifdef WITH_WSREP -+ } -+#endif /* WITH_WSREP */ - break; - } - case SQLCOM_ROLLBACK: -@@ -4294,7 +4665,13 @@ - (thd->variables.completion_type == 2 && - lex->tx_release != TVL_NO)); - if (trans_rollback(thd)) -+ { -+ thd->mdl_context.release_transactional_locks(); -+#ifdef WITH_WSREP -+ WSREP_DEBUG("rollback failed, MDL released: %lu", thd->thread_id); -+#endif /* WITH_WSREP */ - goto error; -+ } - thd->mdl_context.release_transactional_locks(); - /* Begin transaction with the same isolation level. */ - if (tx_chain) -@@ -4311,7 +4688,17 @@ - /* Disconnect the current client connection. */ - if (tx_release) - thd->killed= THD::KILL_CONNECTION; -+#ifdef WITH_WSREP -+ if (WSREP(thd)) { -+ if (thd->wsrep_conflict_state == NO_CONFLICT) { -+ my_ok(thd); -+ } -+ } else { -+#endif /* WITH_WSREP */ - my_ok(thd); -+#ifdef WITH_WSREP -+ } -+#endif /* WITH_WSREP */ - break; - } - case SQLCOM_RELEASE_SAVEPOINT: -@@ -4377,6 +4764,7 @@ - if (sp_process_definer(thd)) - goto create_sp_error; - -+ WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL) - res= (sp_result= sp_create_routine(thd, lex->sphead)); - switch (sp_result) { - case SP_OK: { -@@ -4593,6 +4981,7 @@ - already puts on CREATE FUNCTION. - */ - /* Conditionally writes to binlog */ -+ WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL) - int sp_result= sp_update_routine(thd, sp_type, lex->spname, - &lex->sp_chistics); - if (thd->killed) -@@ -4664,6 +5053,7 @@ - lex->sql_command == SQLCOM_DROP_PROCEDURE, - false)) - goto error; -+ WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL) - - enum_sp_type sp_type= (lex->sql_command == SQLCOM_DROP_PROCEDURE) ? - SP_TYPE_PROCEDURE : SP_TYPE_FUNCTION; -@@ -4784,6 +5174,7 @@ - Note: SQLCOM_CREATE_VIEW also handles 'ALTER VIEW' commands - as specified through the thd->lex->create_view_mode flag. - */ -+ WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL) - res= mysql_create_view(thd, first_table, thd->lex->create_view_mode); - break; - } -@@ -4792,12 +5183,14 @@ - if (check_table_access(thd, DROP_ACL, all_tables, FALSE, UINT_MAX, FALSE)) - goto error; - /* Conditionally writes to binlog. */ -+ WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL) - res= mysql_drop_view(thd, first_table, thd->lex->drop_mode); - break; - } - case SQLCOM_CREATE_TRIGGER: - { - /* Conditionally writes to binlog. */ -+ WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL) - res= mysql_create_or_drop_trigger(thd, all_tables, 1); - - break; -@@ -4805,6 +5198,7 @@ - case SQLCOM_DROP_TRIGGER: - { - /* Conditionally writes to binlog. */ -+ WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL) - res= mysql_create_or_drop_trigger(thd, all_tables, 0); - break; - } -@@ -4825,7 +5219,13 @@ - break; - case SQLCOM_XA_COMMIT: - if (trans_xa_commit(thd)) -+ { -+ thd->mdl_context.release_transactional_locks(); -+#ifdef WITH_WSREP -+ WSREP_DEBUG("XA commit failed, MDL released: %lu", thd->thread_id); -+#endif /* WITH_WSREP */ - goto error; -+ } - thd->mdl_context.release_transactional_locks(); - /* - We've just done a commit, reset transaction -@@ -4837,7 +5237,13 @@ - break; - case SQLCOM_XA_ROLLBACK: - if (trans_xa_rollback(thd)) -+ { -+ thd->mdl_context.release_transactional_locks(); -+#ifdef WITH_WSREP -+ WSREP_DEBUG("XA rollback failed, MDL released: %lu", thd->thread_id); -+#endif /* WITH_WSREP */ - goto error; -+ } - thd->mdl_context.release_transactional_locks(); - /* - We've just done a rollback, reset transaction -@@ -4857,11 +5263,13 @@ - my_ok(thd); - break; - case SQLCOM_INSTALL_PLUGIN: -+ WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL) - if (! (res= mysql_install_plugin(thd, &thd->lex->comment, - &thd->lex->ident))) - my_ok(thd); - break; - case SQLCOM_UNINSTALL_PLUGIN: -+ WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL) - if (! (res= mysql_uninstall_plugin(thd, &thd->lex->comment))) - my_ok(thd); - break; -@@ -5003,6 +5411,9 @@ - /* Free tables */ - THD_STAGE_INFO(thd, stage_closing_tables); - close_thread_tables(thd); -+#ifdef WITH_WSREP -+ thd->wsrep_consistency_check= NO_CONSISTENCY_CHECK; -+#endif /* WITH_WSREP */ - - #ifndef DBUG_OFF - if (lex->sql_command != SQLCOM_SET_OPTION && ! thd->in_sub_stmt) -@@ -5048,6 +5459,22 @@ - { - thd->mdl_context.release_statement_locks(); - } -+ WSREP_TO_ISOLATION_END; -+ -+#ifdef WITH_WSREP -+ /* -+ Force release of transactional locks if not in active MST and wsrep is on. -+ */ -+ if (WSREP(thd) && -+ ! thd->in_sub_stmt && -+ ! thd->in_active_multi_stmt_transaction() && -+ thd->mdl_context.has_transactional_locks()) -+ { -+ WSREP_DEBUG("Forcing release of transactional locks for thd %lu", -+ thd->thread_id); -+ thd->mdl_context.release_transactional_locks(); -+ } -+#endif /* WITH_WSREP */ - - DBUG_RETURN(res || thd->is_error()); - } -@@ -5864,6 +6291,26 @@ - thd->auto_inc_intervals_in_cur_stmt_for_binlog.empty(); - thd->stmt_depends_on_first_successful_insert_id_in_prev_stmt= 0; - -+#ifdef WITH_WSREP -+ /* -+ Autoinc variables should be adjusted only for locally executed -+ transactions. Appliers and replayers are either processing ROW -+ events or get autoinc variable values from Query_log_event. -+ */ -+ if (WSREP(thd) && thd->wsrep_exec_mode == LOCAL_STATE) { -+ if (wsrep_auto_increment_control) -+ { -+ if (thd->variables.auto_increment_offset != -+ global_system_variables.auto_increment_offset) -+ thd->variables.auto_increment_offset= -+ global_system_variables.auto_increment_offset; -+ if (thd->variables.auto_increment_increment != -+ global_system_variables.auto_increment_increment) -+ thd->variables.auto_increment_increment= -+ global_system_variables.auto_increment_increment; -+ } -+ } -+#endif /* WITH_WSREP */ - thd->query_start_used= thd->query_start_usec_used= 0; - thd->is_fatal_error= thd->time_zone_used= 0; - /* -@@ -6089,6 +6536,99 @@ - lex->query_tables_last= &lex->query_tables; - } - -+#ifdef WITH_WSREP -+static void wsrep_mysql_parse(THD *thd, char *rawbuf, uint length, -+ Parser_state *parser_state) -+{ -+ bool is_autocommit= -+ !thd->in_multi_stmt_transaction_mode() && -+ thd->wsrep_conflict_state == NO_CONFLICT && -+ !thd->wsrep_applier && -+ wsrep_read_only_option(thd, thd->lex->query_tables); -+ -+ do -+ { -+ if (thd->wsrep_conflict_state== RETRY_AUTOCOMMIT) -+ { -+ thd->wsrep_conflict_state= NO_CONFLICT; -+ } -+ mysql_parse(thd, rawbuf, length, parser_state); -+ -+ if (WSREP(thd)) { -+ /* wsrep BF abort in query exec phase */ -+ mysql_mutex_lock(&thd->LOCK_wsrep_thd); -+ if (thd->wsrep_conflict_state == MUST_ABORT) { -+ wsrep_client_rollback(thd); -+ -+ WSREP_DEBUG("abort in exec query state, avoiding autocommit"); -+ } -+ -+ /* checking if BF trx must be replayed */ -+ if (thd->wsrep_conflict_state== MUST_REPLAY) -+ { -+ wsrep_replay_transaction(thd); -+ } -+ -+ /* setting error code for BF aborted trxs */ -+ if (thd->wsrep_conflict_state == ABORTED || -+ thd->wsrep_conflict_state == CERT_FAILURE) -+ { -+ mysql_reset_thd_for_next_command(thd); -+ thd->killed= THD::NOT_KILLED; -+ if (is_autocommit && -+ thd->lex->sql_command != SQLCOM_SELECT && -+ (thd->wsrep_retry_counter < thd->variables.wsrep_retry_autocommit)) -+ { -+ WSREP_DEBUG("wsrep retrying AC query: %s", -+ (thd->query()) ? thd->query() : "void"); -+ -+ close_thread_tables(thd); -+ -+ thd->wsrep_conflict_state= RETRY_AUTOCOMMIT; -+ thd->wsrep_retry_counter++; // grow -+ wsrep_copy_query(thd); -+ thd->set_time(); -+ parser_state->reset(rawbuf, length); -+ } -+ else -+ { -+ WSREP_DEBUG("%s, thd: %lu is_AC: %d, retry: %lu - %lu SQL: %s", -+ (thd->wsrep_conflict_state == ABORTED) ? -+ "BF Aborted" : "cert failure", -+ thd->thread_id, is_autocommit, thd->wsrep_retry_counter, -+ thd->variables.wsrep_retry_autocommit, thd->query()); -+ my_error(ER_LOCK_DEADLOCK, MYF(0), "wsrep aborted transaction"); -+ thd->killed= THD::NOT_KILLED; -+ thd->wsrep_conflict_state= NO_CONFLICT; -+ if (thd->wsrep_conflict_state != REPLAYING) -+ thd->wsrep_retry_counter= 0; // reset -+ } -+ } -+ else -+ { -+ set_if_smaller(thd->wsrep_retry_counter, 0); // reset; eventually ok -+ } -+ mysql_mutex_unlock(&thd->LOCK_wsrep_thd); -+ } -+ } while (thd->wsrep_conflict_state== RETRY_AUTOCOMMIT); -+ -+ if (thd->wsrep_retry_query) -+ { -+ WSREP_DEBUG("releasing retry_query: " -+ "conf %d sent %d kill %d errno %d SQL %s", -+ thd->wsrep_conflict_state, -+ thd->get_stmt_da()->is_sent(), -+ thd->killed, -+ thd->get_stmt_da()->is_error() ? -+ thd->get_stmt_da()->sql_errno() : 0, -+ thd->wsrep_retry_query); -+ my_free(thd->wsrep_retry_query); -+ thd->wsrep_retry_query = NULL; -+ thd->wsrep_retry_query_len = 0; -+ thd->wsrep_retry_command = COM_CONNECT; -+ } -+} -+#endif /* WITH_WSREP */ - - /* - When you modify mysql_parse(), you may need to mofify -@@ -7114,8 +7654,14 @@ - slayage if both are string-equal. - */ - -+#ifdef WITH_WSREP -+ if (((thd->security_ctx->master_access & SUPER_ACL) || -+ thd->security_ctx->user_matches(tmp->security_ctx)) && -+ !wsrep_thd_is_BF((void *)tmp, true)) -+#else - if ((thd->security_ctx->master_access & SUPER_ACL) || - thd->security_ctx->user_matches(tmp->security_ctx)) -+#endif /* WITH_WSREP */ - { - /* process the kill only if thread is not already undergoing any kill - connection. - -=== modified file 'sql/sql_parse.h' ---- old/sql/sql_parse.h 2012-05-31 23:23:37 +0000 -+++ new/sql/sql_parse.h 2013-01-14 18:03:14 +0000 -@@ -207,6 +207,22 @@ - { - return (cs->mbminlen == 1); - } -+#ifdef WITH_WSREP -+ -+#define WSREP_MYSQL_DB (char *)"mysql" -+#define WSREP_TO_ISOLATION_BEGIN(db_, table_, table_list_) \ -+ if (WSREP(thd) && wsrep_to_isolation_begin(thd, db_, table_, table_list_)) goto error; -+ -+#define WSREP_TO_ISOLATION_END \ -+ if (WSREP(thd) || (thd && thd->wsrep_exec_mode==TOTAL_ORDER)) \ -+ wsrep_to_isolation_end(thd); -+ -+#else -+ -+#define WSREP_TO_ISOLATION_BEGIN(db_, table_, table_list_) -+#define WSREP_TO_ISOLATION_END -+ -+#endif /* WITH_WSREP */ - - extern "C" bool sqlcom_can_generate_row_events(const THD *thd); - - -=== modified file 'sql/sql_partition_admin.cc' ---- old/sql/sql_partition_admin.cc 2014-01-06 06:03:08 +0000 -+++ new/sql/sql_partition_admin.cc 2014-03-11 21:17:40 +0000 -@@ -767,6 +767,19 @@ - if (check_one_table_access(thd, DROP_ACL, first_table)) - DBUG_RETURN(TRUE); - -+#ifdef WITH_WSREP -+ TABLE *find_temporary_table(THD *thd, const TABLE_LIST *tl); -+ -+ if ((!thd->is_current_stmt_binlog_format_row() || -+ !find_temporary_table(thd, first_table)) && -+ wsrep_to_isolation_begin( -+ thd, first_table->db, first_table->table_name, NULL) -+ ) -+ { -+ WSREP_WARN("ALTER TABLE isolation failure"); -+ DBUG_RETURN(TRUE); -+ } -+#endif /* WITH_WSREP */ - if (open_tables(thd, &first_table, &table_counter, 0)) - DBUG_RETURN(true); - - -=== modified file 'sql/sql_plugin.cc' ---- old/sql/sql_plugin.cc 2014-01-06 06:03:08 +0000 -+++ new/sql/sql_plugin.cc 2014-03-11 21:17:40 +0000 -@@ -2759,7 +2759,11 @@ - thd->variables.dynamic_variables_size= 0; - thd->variables.dynamic_variables_ptr= 0; - -+#ifdef WITH_WSREP -+ if ((!WSREP(thd) || !thd->wsrep_applier) && enable_plugins) -+#else - if (enable_plugins) -+#endif - { - mysql_mutex_lock(&LOCK_plugin); - thd->variables.table_plugin= - -=== modified file 'sql/sql_prepare.cc' ---- old/sql/sql_prepare.cc 2013-10-30 23:22:43 +0000 -+++ new/sql/sql_prepare.cc 2013-12-11 10:24:00 +0000 -@@ -3584,7 +3584,9 @@ - return res; - } - -- -+#ifdef WITH_WSREP -+void wsrep_replay_transaction(THD *thd); -+#endif /* WITH_WSREP */ - /** - Execute a prepared statement. Re-prepare it a limited number - of times if necessary. -@@ -3661,6 +3663,22 @@ - thd->push_reprepare_observer(stmt_reprepare_observer); - - error= execute(expanded_query, open_cursor) || thd->is_error(); -+#ifdef WITH_WSREP -+ mysql_mutex_lock(&thd->LOCK_wsrep_thd); -+ switch (thd->wsrep_conflict_state) -+ { -+ case CERT_FAILURE: -+ WSREP_DEBUG("PS execute fail for CERT_FAILURE: thd: %ld err: %d", -+ thd->thread_id, thd->get_stmt_da()->sql_errno() ); -+ thd->wsrep_conflict_state = NO_CONFLICT; -+ break; -+ -+ case MUST_REPLAY: -+ (void)wsrep_replay_transaction(thd); -+ default: break; -+ } -+ mysql_mutex_unlock(&thd->LOCK_wsrep_thd); -+#endif /* WITH_WSREP */ - - thd->pop_reprepare_observer(); - - -=== modified file 'sql/sql_reload.cc' ---- old/sql/sql_reload.cc 2012-05-30 10:03:45 +0000 -+++ new/sql/sql_reload.cc 2013-01-06 18:49:20 +0000 -@@ -229,7 +229,18 @@ - thd->global_read_lock.unlock_global_read_lock(thd); - return 1; - } -- } -+#ifdef WITH_WSREP -+ /* -+ We need to do it second time after wsrep appliers were blocked in -+ make_global_read_lock_block_commit(thd) above since they could have -+ modified the tables too. -+ */ -+ if (WSREP(thd) && -+ close_cached_tables(thd, tables, (options & REFRESH_FAST) ? -+ FALSE : TRUE, TRUE)) -+ result= 1; -+#endif /* WITH_WSREP */ -+ } - else - { - if (thd && thd->locked_tables_mode) - -=== modified file 'sql/sql_show.cc' ---- old/sql/sql_show.cc 2013-10-30 23:22:43 +0000 -+++ new/sql/sql_show.cc 2013-12-11 10:24:00 +0000 -@@ -61,6 +61,9 @@ - using std::max; - using std::min; - -+#if !defined(MYSQL_MAX_VARIABLE_VALUE_LEN) -+#define MYSQL_MAX_VARIABLE_VALUE_LEN 1024 -+#endif // !defined(MYSQL_MAX_VARIABLE_VALUE_LEN) - #define STR_OR_NIL(S) ((S) ? (S) : "") - - #ifdef WITH_PARTITION_STORAGE_ENGINE -@@ -7792,7 +7795,8 @@ - { - {"VARIABLE_NAME", 64, MYSQL_TYPE_STRING, 0, 0, "Variable_name", - SKIP_OPEN_TABLE}, -- {"VARIABLE_VALUE", 1024, MYSQL_TYPE_STRING, 0, 1, "Value", SKIP_OPEN_TABLE}, -+ {"VARIABLE_VALUE", MYSQL_MAX_VARIABLE_VALUE_LEN, MYSQL_TYPE_STRING, 0, 1, -+ "Value", SKIP_OPEN_TABLE}, - {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE} - }; - - -=== modified file 'sql/sql_table.cc' ---- old/sql/sql_table.cc 2013-11-14 05:04:27 +0000 -+++ new/sql/sql_table.cc 2014-03-11 21:17:40 +0000 -@@ -5225,6 +5225,60 @@ - uint not_used; - DBUG_ENTER("mysql_create_like_table"); - -+#ifdef WITH_WSREP -+ if (WSREP(thd) && !thd->wsrep_applier) -+ { -+ TABLE *tmp_table; -+ bool is_tmp_table= FALSE; -+ -+ for (tmp_table= thd->temporary_tables; tmp_table; tmp_table=tmp_table->next) -+ { -+ if (!strcmp(src_table->db, tmp_table->s->db.str) && -+ !strcmp(src_table->table_name, tmp_table->s->table_name.str)) -+ { -+ is_tmp_table= TRUE; -+ break; -+ } -+ } -+ if (create_info->options & HA_LEX_CREATE_TMP_TABLE) -+ { -+ /* CREATE TEMPORARY TABLE LIKE must be skipped from replication */ -+ WSREP_DEBUG("CREATE TEMPORARY TABLE LIKE... skipped replication\n %s", -+ thd->query()); -+ } -+ else if (!is_tmp_table) -+ { -+ /* this is straight CREATE TABLE LIKE... eith no tmp tables */ -+ WSREP_TO_ISOLATION_BEGIN(table->db, table->table_name, NULL); -+ } -+ else -+ { -+ /* here we have CREATE TABLE LIKE -+ the temporary table definition will be needed in slaves to -+ enable the create to succeed -+ */ -+ TABLE_LIST tbl; -+ memset(&tbl, 0, sizeof(tbl)); -+ tbl.db= src_table->db; -+ tbl.table_name= tbl.alias= src_table->table_name; -+ tbl.table= tmp_table; -+ char buf[2048]; -+ String query(buf, sizeof(buf), system_charset_info); -+ query.length(0); // Have to zero it since constructor doesn't -+ -+ (void) store_create_info(thd, &tbl, &query, NULL, TRUE); -+ WSREP_DEBUG("TMP TABLE: %s", query.ptr()); -+ -+ thd->wsrep_TOI_pre_query= query.ptr(); -+ thd->wsrep_TOI_pre_query_len= query.length(); -+ -+ WSREP_TO_ISOLATION_BEGIN(table->db, table->table_name, NULL); -+ -+ thd->wsrep_TOI_pre_query= NULL; -+ thd->wsrep_TOI_pre_query_len= 0; -+ } -+ } -+#endif - - /* - We the open source table to get its description in HA_CREATE_INFO -@@ -5398,6 +5452,11 @@ - - err: - DBUG_RETURN(res); -+#ifdef WITH_WSREP -+ error: -+ thd->wsrep_TOI_pre_query= NULL; -+ DBUG_RETURN(TRUE); -+#endif /* WITH_WSREP */ - } - - - -=== modified file 'sql/sql_trigger.cc' ---- old/sql/sql_trigger.cc 2014-01-06 06:03:08 +0000 -+++ new/sql/sql_trigger.cc 2014-03-11 21:17:40 +0000 -@@ -434,8 +434,14 @@ - binlogged, so they share the same danger, so trust_function_creators - applies to them too. - */ -+#ifdef WITH_WSREP -+ if (!trust_function_creators && -+ (WSREP_EMULATE_BINLOG(thd) || mysql_bin_log.is_open()) && -+ !(thd->security_ctx->master_access & SUPER_ACL)) -+#else - if (!trust_function_creators && mysql_bin_log.is_open() && - !(thd->security_ctx->master_access & SUPER_ACL)) -+#endif /* WITH_WSREP */ - { - my_error(ER_BINLOG_CREATE_ROUTINE_NEED_SUPER, MYF(0)); - DBUG_RETURN(TRUE); -@@ -2497,3 +2503,55 @@ - - DBUG_RETURN(FALSE); - } -+#ifdef WITH_WSREP -+int wsrep_create_trigger_query(THD *thd, uchar** buf, size_t* buf_len) -+{ -+ LEX *lex= thd->lex; -+ String stmt_query; -+ -+ LEX_STRING definer_user; -+ LEX_STRING definer_host; -+ -+ if (!lex->definer) -+ { -+ if (!thd->slave_thread) -+ { -+ if (!(lex->definer= create_default_definer(thd))) -+ return 1; -+ } -+ } -+ -+ if (lex->definer) -+ { -+ /* SUID trigger. */ -+ -+ definer_user= lex->definer->user; -+ definer_host= lex->definer->host; -+ } -+ else -+ { -+ /* non-SUID trigger. */ -+ -+ definer_user.str= 0; -+ definer_user.length= 0; -+ -+ definer_host.str= 0; -+ definer_host.length= 0; -+ } -+ -+ stmt_query.append(STRING_WITH_LEN("CREATE ")); -+ -+ append_definer(thd, &stmt_query, &definer_user, &definer_host); -+ -+ LEX_STRING stmt_definition; -+ stmt_definition.str= (char*) thd->lex->stmt_definition_begin; -+ stmt_definition.length= thd->lex->stmt_definition_end -+ - thd->lex->stmt_definition_begin; -+ trim_whitespace(thd->charset(), & stmt_definition); -+ -+ stmt_query.append(stmt_definition.str, stmt_definition.length); -+ -+ return wsrep_to_buf_helper(thd, stmt_query.c_ptr(), stmt_query.length(), -+ buf, buf_len); -+} -+#endif /* WITH_WSREP */ - -=== modified file 'sql/sql_truncate.cc' ---- old/sql/sql_truncate.cc 2012-12-10 18:02:18 +0000 -+++ new/sql/sql_truncate.cc 2014-02-28 06:51:51 +0000 -@@ -24,6 +24,9 @@ - #include "sql_parse.h" // check_one_table_access() - #include "sql_truncate.h" - #include "sql_show.h" //append_identifier() -+#ifdef WITH_WSREP -+#include "wsrep_mysqld.h" -+#endif /* WITH_WSREP */ - - - /** -@@ -440,6 +443,12 @@ - { - bool hton_can_recreate; - -+#ifdef WITH_WSREP -+ if (WSREP(thd) && wsrep_to_isolation_begin(thd, -+ table_ref->db, -+ table_ref->table_name, NULL)) -+ DBUG_RETURN(TRUE); -+#endif /* WITH_WSREP */ - if (lock_table(thd, table_ref, &hton_can_recreate)) - DBUG_RETURN(TRUE); - -@@ -517,7 +526,6 @@ - - if (! (res= truncate_table(thd, first_table))) - my_ok(thd); -- - DBUG_RETURN(res); - } - - -=== modified file 'sql/sql_update.cc' ---- old/sql/sql_update.cc 2013-10-30 23:22:43 +0000 -+++ new/sql/sql_update.cc 2013-12-11 10:24:00 +0000 -@@ -987,7 +987,11 @@ - */ - if ((error < 0) || thd->transaction.stmt.cannot_safely_rollback()) - { -+#ifdef WITH_WSREP -+ if (WSREP_EMULATE_BINLOG(thd) || mysql_bin_log.is_open()) -+#else - if (mysql_bin_log.is_open()) -+#endif - { - int errcode= 0; - if (error < 0) -@@ -2202,7 +2206,11 @@ - The query has to binlog because there's a modified non-transactional table - either from the query's list or via a stored routine: bug#13270,23333 - */ -+#ifdef WITH_WSREP -+ if (WSREP_EMULATE_BINLOG(thd) || mysql_bin_log.is_open()) -+#else - if (mysql_bin_log.is_open()) -+#endif - { - /* - THD::killed status might not have been set ON at time of an error -@@ -2434,7 +2442,11 @@ - - if (local_error == 0 || thd->transaction.stmt.cannot_safely_rollback()) - { -+#ifdef WITH_WSREP -+ if (WSREP_EMULATE_BINLOG(thd) || mysql_bin_log.is_open()) -+#else - if (mysql_bin_log.is_open()) -+#endif - { - int errcode= 0; - if (local_error == 0) - -=== modified file 'sql/sys_vars.cc' ---- old/sql/sys_vars.cc 2013-10-30 23:22:43 +0000 -+++ new/sql/sys_vars.cc 2013-12-11 10:24:00 +0000 -@@ -3178,6 +3178,10 @@ - if (trans_commit_stmt(thd) || trans_commit(thd)) - { - thd->variables.option_bits&= ~OPTION_AUTOCOMMIT; -+ thd->mdl_context.release_transactional_locks(); -+#ifdef WITH_WSREP -+ WSREP_DEBUG("autocommit, MDL TRX lock released: %lu", thd->thread_id); -+#endif /* WITH_WSREP */ - return true; - } - /* -@@ -4172,6 +4176,246 @@ - "time_zone", "time_zone", - SESSION_VAR(time_zone), NO_CMD_LINE, - DEFAULT(&default_tz), NO_MUTEX_GUARD, IN_BINLOG); -+#ifdef WITH_WSREP -+#include "wsrep_var.h" -+#include "wsrep_sst.h" -+#include "wsrep_binlog.h" -+ -+static Sys_var_charptr Sys_wsrep_provider( -+ "wsrep_provider", "Path to replication provider library", -+ PREALLOCATED GLOBAL_VAR(wsrep_provider), CMD_LINE(REQUIRED_ARG, OPT_WSREP_PROVIDER), -+ IN_FS_CHARSET, DEFAULT(wsrep_provider), -+ // IN_FS_CHARSET, DEFAULT(wsrep_provider_default), -+ NO_MUTEX_GUARD, NOT_IN_BINLOG, -+ ON_CHECK(wsrep_provider_check), ON_UPDATE(wsrep_provider_update)); -+ -+static Sys_var_charptr Sys_wsrep_provider_options( -+ "wsrep_provider_options", "provider specific options", -+ PREALLOCATED GLOBAL_VAR(wsrep_provider_options), -+ CMD_LINE(REQUIRED_ARG, OPT_WSREP_PROVIDER_OPTIONS), -+ IN_FS_CHARSET, DEFAULT(wsrep_provider_options), -+ NO_MUTEX_GUARD, NOT_IN_BINLOG, -+ ON_CHECK(wsrep_provider_options_check), -+ ON_UPDATE(wsrep_provider_options_update)); -+ -+static Sys_var_charptr Sys_wsrep_data_home_dir( -+ "wsrep_data_home_dir", "home directory for wsrep provider", -+ READ_ONLY GLOBAL_VAR(wsrep_data_home_dir), CMD_LINE(REQUIRED_ARG), -+ IN_FS_CHARSET, DEFAULT(""), -+ NO_MUTEX_GUARD, NOT_IN_BINLOG); -+ -+static Sys_var_charptr Sys_wsrep_cluster_name( -+ "wsrep_cluster_name", "Name for the cluster", -+ PREALLOCATED GLOBAL_VAR(wsrep_cluster_name), CMD_LINE(REQUIRED_ARG), -+ IN_FS_CHARSET, DEFAULT(wsrep_cluster_name), -+ NO_MUTEX_GUARD, NOT_IN_BINLOG, -+ ON_CHECK(wsrep_cluster_name_check), -+ ON_UPDATE(wsrep_cluster_name_update)); -+ -+static PolyLock_mutex PLock_wsrep_slave_threads(&LOCK_wsrep_slave_threads); -+static Sys_var_charptr Sys_wsrep_cluster_address ( -+ "wsrep_cluster_address", "Address to initially connect to cluster", -+ PREALLOCATED GLOBAL_VAR(wsrep_cluster_address), -+ CMD_LINE(REQUIRED_ARG, OPT_WSREP_CLUSTER_ADDRESS), -+ IN_FS_CHARSET, DEFAULT(wsrep_cluster_address), -+ &PLock_wsrep_slave_threads, NOT_IN_BINLOG, -+ ON_CHECK(wsrep_cluster_address_check), -+ ON_UPDATE(wsrep_cluster_address_update)); -+ -+static Sys_var_charptr Sys_wsrep_node_name ( -+ "wsrep_node_name", "Node name", -+ PREALLOCATED GLOBAL_VAR(wsrep_node_name), CMD_LINE(REQUIRED_ARG), -+ IN_FS_CHARSET, DEFAULT(wsrep_node_name), -+ NO_MUTEX_GUARD, NOT_IN_BINLOG); -+ -+static Sys_var_charptr Sys_wsrep_node_address ( -+ "wsrep_node_address", "Node address", -+ PREALLOCATED GLOBAL_VAR(wsrep_node_address), CMD_LINE(REQUIRED_ARG), -+ IN_FS_CHARSET, DEFAULT(wsrep_node_address), -+ NO_MUTEX_GUARD, NOT_IN_BINLOG, -+ ON_CHECK(wsrep_node_address_check), -+ ON_UPDATE(wsrep_node_address_update)); -+ -+static Sys_var_charptr Sys_wsrep_node_incoming_address( -+ "wsrep_node_incoming_address", "Client connection address", -+ PREALLOCATED GLOBAL_VAR(wsrep_node_incoming_address),CMD_LINE(REQUIRED_ARG), -+ IN_FS_CHARSET, DEFAULT(wsrep_node_incoming_address), -+ NO_MUTEX_GUARD, NOT_IN_BINLOG); -+ -+static Sys_var_ulong Sys_wsrep_slave_threads( -+ "wsrep_slave_threads", "Number of slave appliers to launch", -+ GLOBAL_VAR(wsrep_slave_threads), CMD_LINE(REQUIRED_ARG), -+ VALID_RANGE(1, 512), DEFAULT(1), BLOCK_SIZE(1), -+ &PLock_wsrep_slave_threads, NOT_IN_BINLOG, -+ ON_CHECK(wsrep_slave_threads_check), -+ ON_UPDATE(wsrep_slave_threads_update)); -+ -+static Sys_var_charptr Sys_wsrep_dbug_option( -+ "wsrep_dbug_option", "DBUG options to provider library", -+ GLOBAL_VAR(wsrep_dbug_option),CMD_LINE(REQUIRED_ARG), -+ IN_FS_CHARSET, DEFAULT(""), -+ NO_MUTEX_GUARD, NOT_IN_BINLOG); -+ -+static Sys_var_mybool Sys_wsrep_debug( -+ "wsrep_debug", "To enable debug level logging", -+ GLOBAL_VAR(wsrep_debug), CMD_LINE(OPT_ARG), DEFAULT(FALSE)); -+ -+static Sys_var_mybool Sys_wsrep_convert_LOCK_to_trx( -+ "wsrep_convert_LOCK_to_trx", "To convert locking sessions " -+ "into transactions", -+ GLOBAL_VAR(wsrep_convert_LOCK_to_trx), -+ CMD_LINE(OPT_ARG), DEFAULT(FALSE)); -+ -+static Sys_var_ulong Sys_wsrep_retry_autocommit( -+ "wsrep_retry_autocommit", "Max number of times to retry " -+ "a failed autocommit statement", -+ SESSION_VAR(wsrep_retry_autocommit), CMD_LINE(REQUIRED_ARG), -+ VALID_RANGE(0, 10000), DEFAULT(1), BLOCK_SIZE(1)); -+ -+static Sys_var_mybool Sys_wsrep_auto_increment_control( -+ "wsrep_auto_increment_control", "To automatically control the " -+ "assignment of autoincrement variables", -+ GLOBAL_VAR(wsrep_auto_increment_control), -+ CMD_LINE(OPT_ARG), DEFAULT(TRUE)); -+ -+static Sys_var_mybool Sys_wsrep_drupal_282555_workaround( -+ "wsrep_drupal_282555_workaround", "To use a workaround for" -+ "bad autoincrement value", -+ GLOBAL_VAR(wsrep_drupal_282555_workaround), -+ CMD_LINE(OPT_ARG), DEFAULT(FALSE)); -+ -+static Sys_var_charptr sys_wsrep_sst_method( -+ "wsrep_sst_method", "State snapshot transfer method", -+ GLOBAL_VAR(wsrep_sst_method),CMD_LINE(REQUIRED_ARG), -+ IN_FS_CHARSET, DEFAULT(wsrep_sst_method), NO_MUTEX_GUARD, NOT_IN_BINLOG, -+ ON_CHECK(wsrep_sst_method_check), -+ ON_UPDATE(wsrep_sst_method_update)); -+ -+static Sys_var_charptr Sys_wsrep_sst_receive_address( -+ "wsrep_sst_receive_address", "Address where node is waiting for " -+ "SST contact", -+ GLOBAL_VAR(wsrep_sst_receive_address),CMD_LINE(REQUIRED_ARG), -+ IN_FS_CHARSET, DEFAULT(wsrep_sst_receive_address), NO_MUTEX_GUARD, -+ NOT_IN_BINLOG, -+ ON_CHECK(wsrep_sst_receive_address_check), -+ ON_UPDATE(wsrep_sst_receive_address_update)); -+ -+static Sys_var_charptr Sys_wsrep_sst_auth( -+ "wsrep_sst_auth", "Authentication for SST connection", -+ PREALLOCATED GLOBAL_VAR(wsrep_sst_auth), CMD_LINE(REQUIRED_ARG, OPT_WSREP_SST_AUTH), -+ IN_FS_CHARSET, DEFAULT(wsrep_sst_auth), NO_MUTEX_GUARD, -+ NOT_IN_BINLOG, -+ ON_CHECK(wsrep_sst_auth_check), -+ ON_UPDATE(wsrep_sst_auth_update)); -+ -+static Sys_var_charptr Sys_wsrep_sst_donor( -+ "wsrep_sst_donor", "preferred donor node for the SST", -+ GLOBAL_VAR(wsrep_sst_donor),CMD_LINE(REQUIRED_ARG), -+ IN_FS_CHARSET, DEFAULT(""), NO_MUTEX_GUARD, NOT_IN_BINLOG, -+ ON_CHECK(wsrep_sst_donor_check), -+ ON_UPDATE(wsrep_sst_donor_update)); -+ -+static Sys_var_mybool Sys_wsrep_sst_donor_rejects_queries( -+ "wsrep_sst_donor_rejects_queries", "Reject client queries " -+ "when donating state snapshot transfer", -+ GLOBAL_VAR(wsrep_sst_donor_rejects_queries), -+ CMD_LINE(OPT_ARG), DEFAULT(FALSE)); -+ -+static Sys_var_mybool Sys_wsrep_on ( -+ "wsrep_on", "To enable wsrep replication ", -+ SESSION_VAR(wsrep_on), -+ CMD_LINE(OPT_ARG), DEFAULT(TRUE), -+ NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0), -+ ON_UPDATE(wsrep_on_update)); -+ -+static Sys_var_charptr Sys_wsrep_start_position ( -+ "wsrep_start_position", "global transaction position to start from ", -+ PREALLOCATED GLOBAL_VAR(wsrep_start_position), -+ CMD_LINE(REQUIRED_ARG, OPT_WSREP_START_POSITION), -+ IN_FS_CHARSET, DEFAULT(wsrep_start_position), -+ NO_MUTEX_GUARD, NOT_IN_BINLOG, -+ ON_CHECK(wsrep_start_position_check), -+ ON_UPDATE(wsrep_start_position_update)); -+ -+static Sys_var_ulong Sys_wsrep_max_ws_size ( -+ "wsrep_max_ws_size", "Max write set size (bytes)", -+ GLOBAL_VAR(wsrep_max_ws_size), CMD_LINE(REQUIRED_ARG), -+ /* Upper limit is 65K short of 4G to avoid overlows on 32-bit systems */ -+ VALID_RANGE(1024, WSREP_MAX_WS_SIZE), DEFAULT(1073741824UL), BLOCK_SIZE(1)); -+ -+static Sys_var_ulong Sys_wsrep_max_ws_rows ( -+ "wsrep_max_ws_rows", "Max number of rows in write set", -+ GLOBAL_VAR(wsrep_max_ws_rows), CMD_LINE(REQUIRED_ARG), -+ VALID_RANGE(1, 1048576), DEFAULT(131072), BLOCK_SIZE(1)); -+ -+static Sys_var_charptr Sys_wsrep_notify_cmd( -+ "wsrep_notify_cmd", "", -+ GLOBAL_VAR(wsrep_notify_cmd),CMD_LINE(REQUIRED_ARG), -+ IN_FS_CHARSET, DEFAULT(""), NO_MUTEX_GUARD, NOT_IN_BINLOG); -+ -+static Sys_var_mybool Sys_wsrep_certify_nonPK( -+ "wsrep_certify_nonPK", "Certify tables with no primary key", -+ GLOBAL_VAR(wsrep_certify_nonPK), -+ CMD_LINE(OPT_ARG), DEFAULT(TRUE)); -+ -+static Sys_var_mybool Sys_wsrep_causal_reads( -+ "wsrep_causal_reads", "Enable \"strictly synchronous\" semantics for read operations", -+ SESSION_VAR(wsrep_causal_reads), -+ CMD_LINE(OPT_ARG), DEFAULT(FALSE)); -+ -+static const char *wsrep_OSU_method_names[]= { "TOI", "RSU", NullS }; -+static Sys_var_enum Sys_wsrep_OSU_method( -+ "wsrep_OSU_method", "Method for Online Schema Upgrade", -+ GLOBAL_VAR(wsrep_OSU_method_options), CMD_LINE(OPT_ARG), -+ wsrep_OSU_method_names, DEFAULT(WSREP_OSU_TOI), -+ NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0), -+ ON_UPDATE(0)); -+ -+static PolyLock_mutex PLock_wsrep_desync(&LOCK_wsrep_desync); -+static Sys_var_mybool Sys_wsrep_desync ( -+ "wsrep_desync", "To desynchronize the node from the cluster", -+ GLOBAL_VAR(wsrep_desync), -+ CMD_LINE(OPT_ARG), DEFAULT(FALSE), -+ &PLock_wsrep_desync, NOT_IN_BINLOG, -+ ON_CHECK(wsrep_desync_check), -+ ON_UPDATE(wsrep_desync_update)); -+ -+static Sys_var_enum Sys_wsrep_forced_binlog_format( -+ "wsrep_forced_binlog_format", "binlog format to take effect over user's choice", -+ GLOBAL_VAR(wsrep_forced_binlog_format), -+ CMD_LINE(REQUIRED_ARG, OPT_BINLOG_FORMAT), -+ wsrep_binlog_format_names, DEFAULT(BINLOG_FORMAT_UNSPEC), -+ NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0), -+ ON_UPDATE(0)); -+ -+static Sys_var_mybool Sys_wsrep_recover_datadir( -+ "wsrep_recover", "Recover database state after crash and exit", -+ READ_ONLY GLOBAL_VAR(wsrep_recovery), -+ CMD_LINE(OPT_ARG, OPT_WSREP_RECOVER), DEFAULT(FALSE)); -+ -+static Sys_var_mybool Sys_wsrep_replicate_myisam( -+ "wsrep_replicate_myisam", "To enable myisam replication", -+ GLOBAL_VAR(wsrep_replicate_myisam), CMD_LINE(OPT_ARG), DEFAULT(FALSE)); -+ -+static Sys_var_mybool Sys_wsrep_log_conflicts( -+ "wsrep_log_conflicts", "To log multi-master conflicts", -+ GLOBAL_VAR(wsrep_log_conflicts), CMD_LINE(OPT_ARG), DEFAULT(FALSE)); -+ -+static Sys_var_ulong Sys_wsrep_mysql_replication_bundle( -+ "wsrep_mysql_replication_bundle", "mysql replication group commit ", -+ GLOBAL_VAR(wsrep_mysql_replication_bundle), CMD_LINE(REQUIRED_ARG), -+ VALID_RANGE(0, 1000), DEFAULT(0), BLOCK_SIZE(1)); -+ -+static Sys_var_mybool Sys_wsrep_preordered( -+ "wsrep_preordered", "To enable preordered write set processing", -+ GLOBAL_VAR(wsrep_preordered_opt), CMD_LINE(OPT_ARG), DEFAULT(FALSE)); -+ -+static Sys_var_mybool Sys_wsrep_load_data_splitting( -+ "wsrep_load_data_splitting", "To commit LOAD DATA " -+ "transaction after every 10K rows inserted", -+ GLOBAL_VAR(wsrep_load_data_splitting), -+ CMD_LINE(OPT_ARG), DEFAULT(TRUE)); -+#endif /* WITH_WSREP */ - - static bool fix_host_cache_size(sys_var *, THD *, enum_var_type) - { - -=== modified file 'sql/table.cc' ---- old/sql/table.cc 2014-01-06 06:03:08 +0000 -+++ new/sql/table.cc 2014-03-11 21:17:40 +0000 -@@ -5303,8 +5303,17 @@ - in mark_columns_per_binlog_row_image, if not, then use - the hidden primary key - */ -+#ifdef WITH_WSREP -+ /* this does not affect wsrep patch as long as we use RBR only, -+ but this condition is just preparing for possible future STATEMENT -+ format support -+ */ -+ if (!((WSREP_EMULATE_BINLOG(current_thd) || mysql_bin_log.is_open()) && -+ in_use && in_use->is_current_stmt_binlog_format_row())) -+#else - if (!(mysql_bin_log.is_open() && in_use && - in_use->is_current_stmt_binlog_format_row())) -+#endif /* WITH_WSREP */ - file->use_hidden_primary_key(); - } - else -@@ -5370,8 +5379,17 @@ - in mark_columns_per_binlog_row_image, if not, then use - the hidden primary key - */ -+#ifdef WITH_WSREP -+ /* this does not affect wsrep patch as long as we use RBR only, -+ but this condition is just preparing for possible future STATEMENT -+ format support -+ */ -+ if (!((WSREP_EMULATE_BINLOG(current_thd) || mysql_bin_log.is_open()) && -+ in_use && in_use->is_current_stmt_binlog_format_row())) -+#else - if (!(mysql_bin_log.is_open() && in_use && - in_use->is_current_stmt_binlog_format_row())) -+#endif /* WITH_WSREP */ - file->use_hidden_primary_key(); - } - else -@@ -5423,9 +5441,15 @@ - If in RBR we may need to mark some extra columns, - depending on the binlog-row-image command line argument. - */ -+#ifdef WITH_WSREP -+ if (((WSREP_EMULATE_BINLOG(current_thd) || mysql_bin_log.is_open()) && -+ in_use && in_use->is_current_stmt_binlog_format_row() && -+ !ha_check_storage_engine_flag(s->db_type(), HTON_NO_BINLOG_ROW_OPT))) -+#else - if ((mysql_bin_log.is_open() && in_use && - in_use->is_current_stmt_binlog_format_row() && - !ha_check_storage_engine_flag(s->db_type(), HTON_NO_BINLOG_ROW_OPT))) -+#endif /* WITH_WSREP */ - { - - THD *thd= current_thd; - -=== modified file 'sql/transaction.cc' ---- old/sql/transaction.cc 2013-12-28 16:38:40 +0000 -+++ new/sql/transaction.cc 2014-03-11 21:17:40 +0000 -@@ -102,6 +102,9 @@ - by ha_rollback()/THD::transaction::cleanup(). - */ - thd->transaction.xid_state.rm_error= 0; -+#ifdef WITH_WSREP -+ wsrep_register_hton(thd, TRUE); -+#endif /* WITH_WSREP */ - if (ha_rollback_trans(thd, true)) - { - my_error(ER_XAER_RMERR, MYF(0)); -@@ -140,10 +143,16 @@ - (thd->variables.option_bits & OPTION_TABLE_LOCK)) - { - thd->variables.option_bits&= ~OPTION_TABLE_LOCK; -+#ifdef WITH_WSREP -+ wsrep_register_hton(thd, TRUE); -+#endif /* WITH_WSREP */ - thd->server_status&= - ~(SERVER_STATUS_IN_TRANS | SERVER_STATUS_IN_TRANS_READONLY); - DBUG_PRINT("info", ("clearing SERVER_STATUS_IN_TRANS")); - res= MY_TEST(ha_commit_trans(thd, TRUE)); -+#ifdef WITH_WSREP -+ wsrep_post_commit(thd, TRUE); -+#endif /* WITH_WSREP */ - } - - thd->variables.option_bits&= ~OPTION_BEGIN; -@@ -181,6 +190,12 @@ - thd->tx_read_only= false; - } - -+#ifdef WITH_WSREP -+ thd->wsrep_PA_safe= true; -+ if (WSREP_CLIENT(thd) && wsrep_causal_wait(thd)) -+ DBUG_RETURN(TRUE); -+#endif /* WITH_WSREP */ -+ - thd->variables.option_bits|= OPTION_BEGIN; - thd->server_status|= SERVER_STATUS_IN_TRANS; - if (thd->tx_read_only) -@@ -222,12 +237,18 @@ - if (trans_check_state(thd)) - DBUG_RETURN(TRUE); - -+#ifdef WITH_WSREP -+ wsrep_register_hton(thd, TRUE); -+#endif /* WITH_WSREP */ - thd->server_status&= - ~(SERVER_STATUS_IN_TRANS | SERVER_STATUS_IN_TRANS_READONLY); - DBUG_PRINT("info", ("clearing SERVER_STATUS_IN_TRANS")); - res= ha_commit_trans(thd, TRUE); - thd->variables.option_bits&= ~OPTION_BEGIN; - thd->transaction.all.reset_unsafe_rollback_flags(); -+#ifdef WITH_WSREP -+ wsrep_post_commit(thd, TRUE); -+#endif /* WITH_WSREP */ - thd->lex->start_transaction_opt= 0; - - DBUG_RETURN(MY_TEST(res)); -@@ -275,10 +296,16 @@ - /* Safety if one did "drop table" on locked tables */ - if (!thd->locked_tables_mode) - thd->variables.option_bits&= ~OPTION_TABLE_LOCK; -- thd->server_status&= -+#ifdef WITH_WSREP -+ wsrep_register_hton(thd, TRUE); -+#endif /* WITH_WSREP */ -+ thd->server_status&= - ~(SERVER_STATUS_IN_TRANS | SERVER_STATUS_IN_TRANS_READONLY); - DBUG_PRINT("info", ("clearing SERVER_STATUS_IN_TRANS")); - res= MY_TEST(ha_commit_trans(thd, TRUE)); -+#ifdef WITH_WSREP -+ wsrep_post_commit(thd, TRUE); -+#endif /* WITH_WSREP */ - } - else if (tc_log) - tc_log->commit(thd, true); -@@ -312,6 +339,9 @@ - { - int res; - DBUG_ENTER("trans_rollback"); -+#ifdef WITH_WSREP -+ thd->wsrep_PA_safe= true; -+#endif /* WITH_WSREP */ - - #ifndef DBUG_OFF - char buf1[256], buf2[256]; -@@ -326,6 +356,9 @@ - if (trans_check_state(thd)) - DBUG_RETURN(TRUE); - -+#ifdef WITH_WSREP -+ wsrep_register_hton(thd, TRUE); -+#endif /* WITH_WSREP */ - thd->server_status&= - ~(SERVER_STATUS_IN_TRANS | SERVER_STATUS_IN_TRANS_READONLY); - DBUG_PRINT("info", ("clearing SERVER_STATUS_IN_TRANS")); -@@ -366,6 +399,9 @@ - */ - DBUG_ASSERT(thd->transaction.stmt.is_empty() && !thd->in_sub_stmt); - -+#ifdef WITH_WSREP -+ wsrep_register_hton(thd, true); -+#endif /* WITH_WSREP */ - thd->server_status&= - ~(SERVER_STATUS_IN_TRANS | SERVER_STATUS_IN_TRANS_READONLY); - DBUG_PRINT("info", ("clearing SERVER_STATUS_IN_TRANS")); -@@ -431,12 +467,20 @@ - - if (thd->transaction.stmt.ha_list) - { -+#ifdef WITH_WSREP -+ wsrep_register_hton(thd, FALSE); -+#endif /* WITH_WSREP */ - res= ha_commit_trans(thd, FALSE); - if (! thd->in_active_multi_stmt_transaction()) -+#ifdef WITH_WSREP - { -+#endif /* WITH_WSREP */ - thd->tx_isolation= (enum_tx_isolation) thd->variables.tx_isolation; - thd->tx_read_only= thd->variables.tx_read_only; -+#ifdef WITH_WSREP -+ wsrep_post_commit(thd, FALSE); - } -+#endif /* WITH_WSREP */ - } - else if (tc_log) - tc_log->commit(thd, false); -@@ -481,6 +525,9 @@ - - if (thd->transaction.stmt.ha_list) - { -+#ifdef WITH_WSREP -+ wsrep_register_hton(thd, FALSE); -+#endif /* WITH_WSREP */ - ha_rollback_trans(thd, FALSE); - if (! thd->in_active_multi_stmt_transaction()) - { -@@ -652,9 +699,16 @@ - For backward-compatibility reasons we always release MDL if binary - logging is off. - */ -+#ifdef WITH_WSREP -+ bool mdl_can_safely_rollback_to_savepoint= -+ (!((WSREP_EMULATE_BINLOG(thd) || mysql_bin_log.is_open()) -+ && thd->variables.sql_log_bin) || -+ ha_rollback_to_savepoint_can_release_mdl(thd)); -+#else - bool mdl_can_safely_rollback_to_savepoint= - (!(mysql_bin_log.is_open() && thd->variables.sql_log_bin) || - ha_rollback_to_savepoint_can_release_mdl(thd)); -+#endif /* WITH_WSREP */ - - if (ha_rollback_to_savepoint(thd, sv)) - res= TRUE; -@@ -663,6 +717,12 @@ - - thd->transaction.savepoints= sv; - -+ /* -+ Release metadata locks that were acquired during this savepoint unit -+ unless binlogging is on. Releasing locks with binlogging on can break -+ replication as it allows other connections to drop these tables before -+ rollback to savepoint is written to the binlog. -+ */ - if (!res && mdl_can_safely_rollback_to_savepoint) - thd->mdl_context.rollback_to_savepoint(sv->mdl_savepoint); - -@@ -871,9 +931,15 @@ - } - else if (xa_state == XA_IDLE && thd->lex->xa_opt == XA_ONE_PHASE) - { -+#ifdef WITH_WSREP -+ wsrep_register_hton(thd, TRUE); -+#endif /* WITH_WSREP */ - int r= ha_commit_trans(thd, TRUE); - if ((res= MY_TEST(r))) - my_error(r == 1 ? ER_XA_RBROLLBACK : ER_XAER_RMERR, MYF(0)); -+#ifdef WITH_WSREP -+ wsrep_post_commit(thd, TRUE); -+#endif /* WITH_WSREP */ - } - else if (xa_state == XA_PREPARED && thd->lex->xa_opt == XA_NONE) - { -@@ -892,6 +958,9 @@ - if (thd->mdl_context.acquire_lock(&mdl_request, - thd->variables.lock_wait_timeout)) - { -+#ifdef WITH_WSREP -+ wsrep_register_hton(thd, TRUE); -+#endif /* WITH_WSREP */ - ha_rollback_trans(thd, TRUE); - my_error(ER_XAER_RMERR, MYF(0)); - } - -=== added file 'sql/wsrep_applier.cc' ---- old/sql/wsrep_applier.cc 1970-01-01 00:00:00 +0000 -+++ new/sql/wsrep_applier.cc 2013-11-10 11:44:07 +0000 -@@ -0,0 +1,363 @@ -+/* Copyright (C) 2013 Codership Oy -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; version 2 of the License. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License along -+ with this program; if not, write to the Free Software Foundation, Inc., -+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -+ -+#include "wsrep_priv.h" -+#include "wsrep_binlog.h" // wsrep_dump_rbr_buf() -+ -+#include "log_event.h" // class THD, EVENT_LEN_OFFSET, etc. -+#include "wsrep_applier.h" -+ -+/* -+ read the first event from (*buf). The size of the (*buf) is (*buf_len). -+ At the end (*buf) is shitfed to point to the following event or NULL and -+ (*buf_len) will be changed to account just being read bytes of the 1st event. -+*/ -+ -+static Log_event* wsrep_read_log_event( -+ char **arg_buf, size_t *arg_buf_len, -+ const Format_description_log_event *description_event) -+{ -+ DBUG_ENTER("wsrep_read_log_event"); -+ char *head= (*arg_buf); -+ -+ uint data_len = uint4korr(head + EVENT_LEN_OFFSET); -+ char *buf= (*arg_buf); -+ const char *error= 0; -+ Log_event *res= 0; -+ -+ if (data_len > wsrep_max_ws_size) -+ { -+ error = "Event too big"; -+ goto err; -+ } -+ -+ res= Log_event::read_log_event(buf, data_len, &error, description_event, 0); -+ -+err: -+ if (!res) -+ { -+ DBUG_ASSERT(error != 0); -+ sql_print_error("Error in Log_event::read_log_event(): " -+ "'%s', data_len: %d, event_type: %d", -+ error,data_len,head[EVENT_TYPE_OFFSET]); -+ } -+ (*arg_buf)+= data_len; -+ (*arg_buf_len)-= data_len; -+ DBUG_RETURN(res); -+} -+ -+#include "transaction.h" // trans_commit(), trans_rollback() -+#include "rpl_rli.h" // class Relay_log_info; -+#include "sql_base.h" // close_temporary_table() -+ -+static inline void -+wsrep_set_apply_format(THD* thd, Format_description_log_event* ev) -+{ -+ if (thd->wsrep_apply_format) -+ { -+ delete (Format_description_log_event*)thd->wsrep_apply_format; -+ } -+ thd->wsrep_apply_format= ev; -+} -+ -+static inline Format_description_log_event* -+wsrep_get_apply_format(THD* thd) -+{ -+ if (thd->wsrep_apply_format) -+ return (Format_description_log_event*) thd->wsrep_apply_format; -+ return thd->wsrep_rli->get_rli_description_event(); -+} -+ -+static wsrep_cb_status_t wsrep_apply_events(THD* thd, -+ const void* events_buf, -+ size_t buf_len) -+{ -+ char *buf= (char *)events_buf; -+ int rcode= 0; -+ int event= 1; -+ -+ DBUG_ENTER("wsrep_apply_events"); -+ -+ if (thd->killed == THD::KILL_CONNECTION) -+ { -+ WSREP_INFO("applier has been aborted, skipping apply_rbr: %lld", -+ (long long) wsrep_thd_trx_seqno(thd)); -+ DBUG_RETURN(WSREP_CB_FAILURE); -+ } -+ -+ mysql_mutex_lock(&thd->LOCK_wsrep_thd); -+ thd->wsrep_query_state= QUERY_EXEC; -+ if (thd->wsrep_conflict_state!= REPLAYING) -+ thd->wsrep_conflict_state= NO_CONFLICT; -+ mysql_mutex_unlock(&thd->LOCK_wsrep_thd); -+ -+ if (!buf_len) WSREP_DEBUG("empty rbr buffer to apply: %lld", -+ (long long) wsrep_thd_trx_seqno(thd)); -+ -+ while(buf_len) -+ { -+ int exec_res; -+ Log_event* ev= wsrep_read_log_event(&buf, &buf_len, -+ wsrep_get_apply_format(thd)); -+ -+ if (!ev) -+ { -+ WSREP_ERROR("applier could not read binlog event, seqno: %lld, len: %zd", -+ (long long)wsrep_thd_trx_seqno(thd), buf_len); -+ rcode= 1; -+ goto error; -+ } -+ -+ switch (ev->get_type_code()) { -+ case FORMAT_DESCRIPTION_EVENT: -+ wsrep_set_apply_format(thd, (Format_description_log_event*)ev); -+ continue; -+ case GTID_LOG_EVENT: -+ { -+ Gtid_log_event* gev= (Gtid_log_event*)ev; -+ if (gev->get_gno() == 0) -+ { -+ /* Skip GTID log event to make binlog to generate LTID on commit */ -+ delete ev; -+ continue; -+ } -+ } -+ default: -+ break; -+ } -+ -+ thd->server_id = ev->server_id; // use the original server id for logging -+ thd->set_time(); // time the query -+ wsrep_xid_init(&thd->transaction.xid_state.xid, -+ &thd->wsrep_trx_meta.gtid.uuid, -+ thd->wsrep_trx_meta.gtid.seqno); -+ thd->lex->current_select= 0; -+ if (!ev->when.tv_sec) -+ my_micro_time_to_timeval(my_micro_time(), &ev->when); -+ ev->thd = thd; -+ exec_res = ev->apply_event(thd->wsrep_rli); -+ DBUG_PRINT("info", ("exec_event result: %d", exec_res)); -+ -+ if (exec_res) -+ { -+ WSREP_WARN("RBR event %d %s apply warning: %d, %lld", -+ event, ev->get_type_str(), exec_res, -+ (long long) wsrep_thd_trx_seqno(thd)); -+ rcode= exec_res; -+ /* stop processing for the first error */ -+ delete ev; -+ goto error; -+ } -+ event++; -+ -+ if (thd->wsrep_conflict_state!= NO_CONFLICT && -+ thd->wsrep_conflict_state!= REPLAYING) -+ WSREP_WARN("conflict state after RBR event applying: %d, %lld", -+ thd->wsrep_query_state, (long long)wsrep_thd_trx_seqno(thd)); -+ -+ if (thd->wsrep_conflict_state == MUST_ABORT) { -+ WSREP_WARN("RBR event apply failed, rolling back: %lld", -+ (long long) wsrep_thd_trx_seqno(thd)); -+ trans_rollback(thd); -+ thd->locked_tables_list.unlock_locked_tables(thd); -+ /* Release transactional metadata locks. */ -+ thd->mdl_context.release_transactional_locks(); -+ thd->wsrep_conflict_state= NO_CONFLICT; -+ DBUG_RETURN(WSREP_CB_FAILURE); -+ } -+ -+ delete ev; -+ } -+ -+ error: -+ mysql_mutex_lock(&thd->LOCK_wsrep_thd); -+ thd->wsrep_query_state= QUERY_IDLE; -+ mysql_mutex_unlock(&thd->LOCK_wsrep_thd); -+ -+ assert(thd->wsrep_exec_mode== REPL_RECV); -+ -+ if (thd->killed == THD::KILL_CONNECTION) -+ WSREP_INFO("applier aborted: %lld", (long long)wsrep_thd_trx_seqno(thd)); -+ -+ if (rcode) DBUG_RETURN(WSREP_CB_FAILURE); -+ DBUG_RETURN(WSREP_CB_SUCCESS); -+} -+ -+wsrep_cb_status_t wsrep_apply_cb(void* const ctx, -+ const void* const buf, -+ size_t const buf_len, -+ uint32_t const flags, -+ const wsrep_trx_meta_t* meta) -+{ -+ THD* const thd((THD*)ctx); -+ -+ thd->wsrep_trx_meta = *meta; -+ -+#ifdef WSREP_PROC_INFO -+ snprintf(thd->wsrep_info, sizeof(thd->wsrep_info) - 1, -+ "applying write set %lld: %p, %zu", -+ (long long)wsrep_thd_trx_seqno(thd), buf, buf_len); -+ thd_proc_info(thd, thd->wsrep_info); -+#else -+ thd_proc_info(thd, "applying write set"); -+#endif /* WSREP_PROC_INFO */ -+ -+ if (flags & WSREP_FLAG_ISOLATION) -+ { -+ thd->wsrep_apply_toi= true; -+ /* -+ Don't run in transaction mode with TOI actions. -+ */ -+ thd->variables.option_bits&= ~OPTION_BEGIN; -+ thd->server_status&= ~SERVER_STATUS_IN_TRANS; -+ } -+ wsrep_cb_status_t rcode(wsrep_apply_events(thd, buf, buf_len)); -+ -+#ifdef WSREP_PROC_INFO -+ snprintf(thd->wsrep_info, sizeof(thd->wsrep_info) - 1, -+ "applied write set %lld", (long long)wsrep_thd_trx_seqno(thd)); -+ thd_proc_info(thd, thd->wsrep_info); -+#else -+ thd_proc_info(thd, "applied write set"); -+#endif /* WSREP_PROC_INFO */ -+ -+ if (WSREP_CB_SUCCESS != rcode) -+ { -+ wsrep_dump_rbr_buf(thd, buf, buf_len); -+ } -+ -+ TABLE *tmp; -+ while ((tmp = thd->temporary_tables)) -+ { -+ WSREP_DEBUG("Applier %lu, has temporary tables: %s.%s", -+ thd->thread_id, -+ (tmp->s) ? tmp->s->db.str : "void", -+ (tmp->s) ? tmp->s->table_name.str : "void"); -+ close_temporary_table(thd, tmp, 1, 1); -+ } -+ -+ return rcode; -+} -+ -+static wsrep_cb_status_t wsrep_commit(THD* const thd, -+ wsrep_seqno_t const global_seqno) -+{ -+#ifdef WSREP_PROC_INFO -+ snprintf(thd->wsrep_info, sizeof(thd->wsrep_info) - 1, -+ "committing %lld", (long long)wsrep_thd_trx_seqno(thd)); -+ thd_proc_info(thd, thd->wsrep_info); -+#else -+ thd_proc_info(thd, "committing"); -+#endif /* WSREP_PROC_INFO */ -+ -+ wsrep_cb_status_t const rcode(trans_commit(thd) ? -+ WSREP_CB_FAILURE : WSREP_CB_SUCCESS); -+ -+#ifdef WSREP_PROC_INFO -+ snprintf(thd->wsrep_info, sizeof(thd->wsrep_info) - 1, -+ "committed %lld", (long long)wsrep_thd_trx_seqno(thd)); -+ thd_proc_info(thd, thd->wsrep_info); -+#else -+ thd_proc_info(thd, "committed"); -+#endif /* WSREP_PROC_INFO */ -+ -+ if (WSREP_CB_SUCCESS == rcode) -+ { -+ thd->wsrep_rli->cleanup_context(thd, 0); -+ thd->variables.gtid_next.set_automatic(); -+ // TODO: mark snapshot with global_seqno. -+ } -+ -+ return rcode; -+} -+ -+static wsrep_cb_status_t wsrep_rollback(THD* const thd, -+ wsrep_seqno_t const global_seqno) -+{ -+#ifdef WSREP_PROC_INFO -+ snprintf(thd->wsrep_info, sizeof(thd->wsrep_info) - 1, -+ "rolling back %lld", (long long)wsrep_thd_trx_seqno(thd)); -+ thd_proc_info(thd, thd->wsrep_info); -+#else -+ thd_proc_info(thd, "rolling back"); -+#endif /* WSREP_PROC_INFO */ -+ -+ wsrep_cb_status_t const rcode(trans_rollback(thd) ? -+ WSREP_CB_FAILURE : WSREP_CB_SUCCESS); -+ -+#ifdef WSREP_PROC_INFO -+ snprintf(thd->wsrep_info, sizeof(thd->wsrep_info) - 1, -+ "rolled back %lld", (long long)wsrep_thd_trx_seqno(thd)); -+ thd_proc_info(thd, thd->wsrep_info); -+#else -+ thd_proc_info(thd, "rolled back"); -+#endif /* WSREP_PROC_INFO */ -+ thd->wsrep_rli->cleanup_context(thd, 0); -+ thd->variables.gtid_next.set_automatic(); -+ -+ return rcode; -+} -+ -+wsrep_cb_status_t wsrep_commit_cb(void* const ctx, -+ uint32_t const flags, -+ const wsrep_trx_meta_t* meta, -+ wsrep_bool_t* const exit, -+ bool const commit) -+{ -+ THD* const thd((THD*)ctx); -+ -+ assert(meta->gtid.seqno == wsrep_thd_trx_seqno(thd)); -+ -+ wsrep_cb_status_t rcode; -+ -+ if (commit) -+ rcode = wsrep_commit(thd, meta->gtid.seqno); -+ else -+ rcode = wsrep_rollback(thd, meta->gtid.seqno); -+ -+ wsrep_set_apply_format(thd, NULL); -+ thd->mdl_context.release_transactional_locks(); -+ free_root(thd->mem_root,MYF(MY_KEEP_PREALLOC)); -+ thd->tx_isolation= (enum_tx_isolation) thd->variables.tx_isolation; -+ -+ if (wsrep_slave_count_change < 0 && commit && WSREP_CB_SUCCESS == rcode) -+ { -+ mysql_mutex_lock(&LOCK_wsrep_slave_threads); -+ if (wsrep_slave_count_change < 0) -+ { -+ wsrep_slave_count_change++; -+ *exit = true; -+ } -+ mysql_mutex_unlock(&LOCK_wsrep_slave_threads); -+ } -+ -+ if (*exit == false && thd->wsrep_applier) -+ { -+ /* From trans_begin() */ -+ thd->variables.option_bits|= OPTION_BEGIN; -+ thd->server_status|= SERVER_STATUS_IN_TRANS; -+ thd->wsrep_apply_toi= false; -+ } -+ -+ return rcode; -+} -+ -+ -+wsrep_cb_status_t wsrep_unordered_cb(void* const ctx, -+ const void* const data, -+ size_t const size) -+{ -+ return WSREP_CB_SUCCESS; -+} - -=== added file 'sql/wsrep_applier.h' ---- old/sql/wsrep_applier.h 1970-01-01 00:00:00 +0000 -+++ new/sql/wsrep_applier.h 2013-11-02 17:14:27 +0000 -@@ -0,0 +1,38 @@ -+/* Copyright 2013 Codership Oy -+ -+ 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -+ -+#ifndef WSREP_APPLIER_H -+#define WSREP_APPLIER_H -+ -+#include -+ -+/* wsrep callback prototypes */ -+ -+wsrep_cb_status_t wsrep_apply_cb(void *ctx, -+ const void* buf, size_t buf_len, -+ uint32_t flags, -+ const wsrep_trx_meta_t* meta); -+ -+wsrep_cb_status_t wsrep_commit_cb(void *ctx, -+ uint32_t flags, -+ const wsrep_trx_meta_t* meta, -+ wsrep_bool_t* exit, -+ bool commit); -+ -+wsrep_cb_status_t wsrep_unordered_cb(void* ctx, -+ const void* data, -+ size_t size); -+ -+#endif /* WSREP_APPLIER_H */ - -=== added file 'sql/wsrep_binlog.cc' ---- old/sql/wsrep_binlog.cc 1970-01-01 00:00:00 +0000 -+++ new/sql/wsrep_binlog.cc 2014-03-06 16:29:47 +0000 -@@ -0,0 +1,358 @@ -+/* Copyright (C) 2013 Codership Oy -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; version 2 of the License. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License along -+ with this program; if not, write to the Free Software Foundation, Inc., -+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -+ -+#include "wsrep_binlog.h" -+#include "wsrep_priv.h" -+ -+/* -+ Write the contents of a cache to a memory buffer. -+ -+ This function quite the same as MYSQL_BIN_LOG::write_cache(), -+ with the exception that here we write in buffer instead of log file. -+ */ -+int wsrep_write_cache_buf(IO_CACHE *cache, uchar **buf, size_t *buf_len) -+{ -+ *buf= NULL; -+ *buf_len= 0; -+ -+ my_off_t const saved_pos(my_b_tell(cache)); -+ -+ if (reinit_io_cache(cache, READ_CACHE, 0, 0, 0)) -+ { -+ WSREP_ERROR("failed to initialize io-cache"); -+ return ER_ERROR_ON_WRITE; -+ } -+ -+ uint length = my_b_bytes_in_cache(cache); -+ if (unlikely(0 == length)) length = my_b_fill(cache); -+ -+ size_t total_length = 0; -+ -+ if (likely(length > 0)) do -+ { -+ total_length += length; -+ /* -+ Bail out if buffer grows too large. -+ A temporary fix to avoid allocating indefinitely large buffer, -+ not a real limit on a writeset size which includes other things -+ like header and keys. -+ */ -+ if (total_length > wsrep_max_ws_size) -+ { -+ WSREP_WARN("transaction size limit (%lu) exceeded: %zu", -+ wsrep_max_ws_size, total_length); -+ goto error; -+ } -+ -+ uchar* tmp = (uchar *)my_realloc(*buf, total_length, MYF(0)); -+ if (!tmp) -+ { -+ WSREP_ERROR("could not (re)allocate buffer: %zu + %u", -+ *buf_len, length); -+ goto error; -+ } -+ *buf = tmp; -+ -+ memcpy(*buf + *buf_len, cache->read_pos, length); -+ *buf_len = total_length; -+ cache->read_pos = cache->read_end; -+ } while ((cache->file >= 0) && (length = my_b_fill(cache))); -+ -+ if (reinit_io_cache(cache, WRITE_CACHE, saved_pos, 0, 0)) -+ { -+ WSREP_WARN("failed to initialize io-cache"); -+ goto cleanup; -+ } -+ -+ if (reinit_io_cache(cache, WRITE_CACHE, saved_pos, 0, 0)) -+ { -+ WSREP_ERROR("failed to initialize io-cache"); -+ goto cleanup; -+ } -+ -+ return 0; -+ -+error: -+ if (reinit_io_cache(cache, WRITE_CACHE, saved_pos, 0, 0)) -+ { -+ WSREP_WARN("failed to initialize io-cache"); -+ } -+cleanup: -+ my_free(*buf); -+ *buf= NULL; -+ *buf_len= 0; -+ return ER_ERROR_ON_WRITE; -+} -+ -+#define STACK_SIZE 4096 /* 4K - for buffer preallocated on the stack: -+ * many transactions would fit in there -+ * so there is no need to reach for the heap */ -+ -+/* Returns minimum multiple of HEAP_PAGE_SIZE that is >= length */ -+static inline size_t -+heap_size(size_t length) -+{ -+ return (length + HEAP_PAGE_SIZE - 1)/HEAP_PAGE_SIZE*HEAP_PAGE_SIZE; -+} -+ -+/* append data to writeset */ -+static inline wsrep_status_t -+wsrep_append_data(wsrep_t* const wsrep, -+ wsrep_ws_handle_t* const ws, -+ const void* const data, -+ size_t const len) -+{ -+ struct wsrep_buf const buff = { data, len }; -+ wsrep_status_t const rc(wsrep->append_data(wsrep, ws, &buff, 1, -+ WSREP_DATA_ORDERED, true)); -+ if (rc != WSREP_OK) -+ { -+ WSREP_WARN("append_data() returned %d", rc); -+ } -+ -+ return rc; -+} -+ -+/* -+ Write the contents of a cache to wsrep provider. -+ -+ This function quite the same as MYSQL_BIN_LOG::write_cache(), -+ with the exception that here we write in buffer instead of log file. -+ -+ This version reads all of cache into single buffer and then appends to a -+ writeset at once. -+ */ -+static int wsrep_write_cache_once(wsrep_t* const wsrep, -+ THD* const thd, -+ IO_CACHE* const cache, -+ size_t* const len) -+{ -+ my_off_t const saved_pos(my_b_tell(cache)); -+ -+ if (reinit_io_cache(cache, READ_CACHE, 0, 0, 0)) -+ { -+ WSREP_ERROR("failed to initialize io-cache"); -+ return ER_ERROR_ON_WRITE; -+ } -+ -+ int err(WSREP_OK); -+ -+ size_t total_length(0); -+ uchar stack_buf[STACK_SIZE]; /* to avoid dynamic allocations for few data*/ -+ uchar* heap_buf(NULL); -+ uchar* buf(stack_buf); -+ size_t allocated(sizeof(stack_buf)); -+ size_t used(0); -+ -+ uint length(my_b_bytes_in_cache(cache)); -+ if (unlikely(0 == length)) length = my_b_fill(cache); -+ -+ if (likely(length > 0)) do -+ { -+ total_length += length; -+ /* -+ Bail out if buffer grows too large. -+ A temporary fix to avoid allocating indefinitely large buffer, -+ not a real limit on a writeset size which includes other things -+ like header and keys. -+ */ -+ if (unlikely(total_length > wsrep_max_ws_size)) -+ { -+ WSREP_WARN("transaction size limit (%lu) exceeded: %zu", -+ wsrep_max_ws_size, total_length); -+ err = WSREP_TRX_SIZE_EXCEEDED; -+ goto cleanup; -+ } -+ -+ if (total_length > allocated) -+ { -+ size_t const new_size(heap_size(total_length)); -+ uchar* tmp = (uchar *)my_realloc(heap_buf, new_size, MYF(0)); -+ if (!tmp) -+ { -+ WSREP_ERROR("could not (re)allocate buffer: %zu + %u", -+ allocated, length); -+ err = WSREP_TRX_SIZE_EXCEEDED; -+ goto cleanup; -+ } -+ -+ heap_buf = tmp; -+ buf = heap_buf; -+ allocated = new_size; -+ -+ if (used <= STACK_SIZE && used > 0) // there's data in stack_buf -+ { -+ DBUG_ASSERT(buf == stack_buf); -+ memcpy(heap_buf, stack_buf, used); -+ } -+ } -+ -+ memcpy(buf + used, cache->read_pos, length); -+ used = total_length; -+ cache->read_pos = cache->read_end; -+ } while ((cache->file >= 0) && (length = my_b_fill(cache))); -+ -+ if (used > 0) -+ err = wsrep_append_data(wsrep, &thd->wsrep_ws_handle, buf, used); -+ -+ if (WSREP_OK == err) *len = total_length; -+ -+cleanup: -+ if (reinit_io_cache(cache, WRITE_CACHE, saved_pos, 0, 0)) -+ { -+ WSREP_ERROR("failed to reinitialize io-cache"); -+ } -+ -+ if (unlikely(WSREP_OK != err)) wsrep_dump_rbr_buf(thd, buf, used); -+ -+ my_free(heap_buf); -+ return err; -+} -+ -+/* -+ Write the contents of a cache to wsrep provider. -+ -+ This function quite the same as MYSQL_BIN_LOG::write_cache(), -+ with the exception that here we write in buffer instead of log file. -+ -+ This version uses incremental data appending as it reads it from cache. -+ */ -+static int wsrep_write_cache_inc(wsrep_t* const wsrep, -+ THD* const thd, -+ IO_CACHE* const cache, -+ size_t* const len) -+{ -+ my_off_t const saved_pos(my_b_tell(cache)); -+ -+ if (reinit_io_cache(cache, READ_CACHE, 0, 0, 0)) -+ { -+ WSREP_ERROR("failed to initialize io-cache"); -+ return WSREP_TRX_ERROR; -+ } -+ -+ int err(WSREP_OK); -+ -+ size_t total_length(0); -+ -+ uint length(my_b_bytes_in_cache(cache)); -+ if (unlikely(0 == length)) length = my_b_fill(cache); -+ -+ if (likely(length > 0)) do -+ { -+ total_length += length; -+ /* bail out if buffer grows too large -+ not a real limit on a writeset size which includes other things -+ like header and keys. -+ */ -+ if (unlikely(total_length > wsrep_max_ws_size)) -+ { -+ WSREP_WARN("transaction size limit (%lu) exceeded: %zu", -+ wsrep_max_ws_size, total_length); -+ err = WSREP_TRX_SIZE_EXCEEDED; -+ goto cleanup; -+ } -+ -+ if(WSREP_OK != (err=wsrep_append_data(wsrep, &thd->wsrep_ws_handle, -+ cache->read_pos, length))) -+ goto cleanup; -+ -+ cache->read_pos = cache->read_end; -+ } while ((cache->file >= 0) && (length = my_b_fill(cache))); -+ -+ if (WSREP_OK == err) *len = total_length; -+ -+cleanup: -+ if (reinit_io_cache(cache, WRITE_CACHE, saved_pos, 0, 0)) -+ { -+ WSREP_ERROR("failed to reinitialize io-cache"); -+ } -+ -+ return err; -+} -+ -+/* -+ Write the contents of a cache to wsrep provider. -+ -+ This function quite the same as MYSQL_BIN_LOG::write_cache(), -+ with the exception that here we write in buffer instead of log file. -+ */ -+int wsrep_write_cache(wsrep_t* const wsrep, -+ THD* const thd, -+ IO_CACHE* const cache, -+ size_t* const len) -+{ -+ if (wsrep_incremental_data_collection) { -+ return wsrep_write_cache_inc(wsrep, thd, cache, len); -+ } -+ else { -+ return wsrep_write_cache_once(wsrep, thd, cache, len); -+ } -+} -+ -+void wsrep_dump_rbr_buf(THD *thd, const void* rbr_buf, size_t buf_len) -+{ -+ char filename[PATH_MAX]= {0}; -+ int len= snprintf(filename, PATH_MAX, "%s/GRA_%ld_%lld.log", -+ wsrep_data_home_dir, thd->thread_id, -+ (long long)wsrep_thd_trx_seqno(thd)); -+ if (len >= PATH_MAX) -+ { -+ WSREP_ERROR("RBR dump path too long: %d, skipping dump.", len); -+ return; -+ } -+ -+ FILE *of= fopen(filename, "wb"); -+ if (of) -+ { -+ fwrite (rbr_buf, buf_len, 1, of); -+ fclose(of); -+ } -+ else -+ { -+ WSREP_ERROR("Failed to open file '%s': %d (%s)", -+ filename, errno, strerror(errno)); -+ } -+} -+ -+extern handlerton *binlog_hton; -+ -+/* -+ wsrep exploits binlog's caches even if binlogging itself is not -+ activated. In such case connection close needs calling -+ actual binlog's method. -+ Todo: split binlog hton from its caches to use ones by wsrep -+ without referring to binlog's stuff. -+*/ -+int wsrep_binlog_close_connection(THD* thd) -+{ -+ DBUG_ENTER("wsrep_binlog_close_connection"); -+ if (thd_get_ha_data(thd, binlog_hton) != NULL) -+ binlog_hton->close_connection (binlog_hton, thd); -+ DBUG_RETURN(0); -+} -+ -+int wsrep_binlog_savepoint_set(THD *thd, void *sv) -+{ -+ if (!wsrep_emulate_bin_log) return 0; -+ int rcode = binlog_hton->savepoint_set(binlog_hton, thd, sv); -+ return rcode; -+} -+ -+int wsrep_binlog_savepoint_rollback(THD *thd, void *sv) -+{ -+ if (!wsrep_emulate_bin_log) return 0; -+ int rcode = binlog_hton->savepoint_rollback(binlog_hton, thd, sv); -+ return rcode; -+} - -=== added file 'sql/wsrep_binlog.h' ---- old/sql/wsrep_binlog.h 1970-01-01 00:00:00 +0000 -+++ new/sql/wsrep_binlog.h 2013-10-05 11:11:40 +0000 -@@ -0,0 +1,53 @@ -+/* Copyright (C) 2013 Codership Oy -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; version 2 of the License. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License along -+ with this program; if not, write to the Free Software Foundation, Inc., -+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -+ -+#ifndef WSREP_BINLOG_H -+#define WSREP_BINLOG_H -+ -+#include "sql_class.h" // THD, IO_CACHE -+ -+#define HEAP_PAGE_SIZE 65536 /* 64K */ -+#define WSREP_MAX_WS_SIZE (0xFFFFFFFFUL - HEAP_PAGE_SIZE) -+ -+/* -+ Write the contents of a cache to a memory buffer. -+ -+ This function quite the same as MYSQL_BIN_LOG::write_cache(), -+ with the exception that here we write in buffer instead of log file. -+ */ -+int wsrep_write_cache_buf(IO_CACHE *cache, uchar **buf, size_t *buf_len); -+ -+/* -+ Write the contents of a cache to wsrep provider. -+ -+ This function quite the same as MYSQL_BIN_LOG::write_cache(), -+ with the exception that here we write in buffer instead of log file. -+ -+ @param len total amount of data written -+ @return wsrep error status -+ */ -+int wsrep_write_cache (wsrep_t* wsrep, -+ THD* thd, -+ IO_CACHE* cache, -+ size_t* len); -+ -+/* Dump replication buffer to disk */ -+void wsrep_dump_rbr_buf(THD *thd, const void* rbr_buf, size_t buf_len); -+ -+int wsrep_binlog_close_connection(THD* thd); -+int wsrep_binlog_savepoint_set(THD *thd, void *sv); -+int wsrep_binlog_savepoint_rollback(THD *thd, void *sv); -+ -+#endif /* WSREP_BINLOG_H */ - -=== added file 'sql/wsrep_check_opts.cc' ---- old/sql/wsrep_check_opts.cc 1970-01-01 00:00:00 +0000 -+++ new/sql/wsrep_check_opts.cc 2014-02-27 11:52:26 +0000 -@@ -0,0 +1,379 @@ -+/* Copyright 2011 Codership Oy -+ -+ 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -+ -+//#include -+#include -+//#include -+//#include -+ -+#include "wsrep_mysqld.h" -+ -+#include -+#include -+#include -+#include -+ -+/* This file is about checking for correctness of mysql configuration options */ -+ -+struct opt -+{ -+ const char* const name; -+ const char* value; -+}; -+ -+/* A list of options to check. -+ * At first we assume default values and then see if they are changed on CLI or -+ * in my.cnf */ -+static struct opt opts[] = -+{ -+ { "wsrep_slave_threads", "1" }, // mysqld.cc -+ { "bind_address", "0.0.0.0" }, // mysqld.cc -+ { "wsrep_sst_method", "rsync" }, // mysqld.cc -+ { "wsrep_sst_receive_address","AUTO"}, // mysqld.cc -+ { "binlog_format", "ROW" }, // mysqld.cc -+ { "wsrep_provider", "none" }, // mysqld.cc -+ { "query_cache_type", "0" }, // mysqld.cc -+ { "query_cache_size", "0" }, // mysqld.cc -+ { "locked_in_memory", "0" }, // mysqld.cc -+ { "wsrep_cluster_address", "0" }, // mysqld.cc -+ { "locks_unsafe_for_binlog", "0" }, // ha_innodb.cc -+ { "autoinc_lock_mode", "1" }, // ha_innodb.cc -+ { 0, 0 } -+}; -+ -+enum -+{ -+ WSREP_SLAVE_THREADS, -+ BIND_ADDRESS, -+ WSREP_SST_METHOD, -+ WSREP_SST_RECEIVE_ADDRESS, -+ BINLOG_FORMAT, -+ WSREP_PROVIDER, -+ QUERY_CACHE_TYPE, -+ QUERY_CACHE_SIZE, -+ LOCKED_IN_MEMORY, -+ WSREP_CLUSTER_ADDRESS, -+ LOCKS_UNSAFE_FOR_BINLOG, -+ AUTOINC_LOCK_MODE -+}; -+ -+ -+/* A class to make a copy of argv[] vector */ -+struct argv_copy -+{ -+ int const argc_; -+ char** argv_; -+ -+ argv_copy (int const argc, const char* const argv[]) : -+ argc_ (argc), -+ argv_ (reinterpret_cast(calloc(argc_, sizeof(char*)))) -+ { -+ if (argv_) -+ { -+ for (int i = 0; i < argc_; ++i) -+ { -+ argv_[i] = strdup(argv[i]); -+ -+ if (!argv_[i]) -+ { -+ argv_free (); // free whatever bee allocated -+ return; -+ } -+ } -+ } -+ } -+ -+ ~argv_copy () { argv_free (); } -+ -+private: -+ argv_copy (const argv_copy&); -+ argv_copy& operator= (const argv_copy&); -+ -+ void argv_free() -+ { -+ if (argv_) -+ { -+ for (int i = 0; (i < argc_) && argv_[i] ; ++i) free (argv_[i]); -+ free (argv_); -+ argv_ = 0; -+ } -+ } -+}; -+ -+/* a short corresponding to '--' byte sequence */ -+static short const long_opt_prefix ('-' + ('-' << 8)); -+ -+/* Normalizes long options to have '_' instead of '-' */ -+static int -+normalize_opts (argv_copy& a) -+{ -+ if (a.argv_) -+ { -+ for (int i = 0; i < a.argc_; ++i) -+ { -+ char* ptr = a.argv_[i]; -+ if (long_opt_prefix == *(short*)ptr) // long option -+ { -+ ptr += 2; -+ const char* end = strchr(ptr, '='); -+ -+ if (!end) end = ptr + strlen(ptr); -+ -+ for (; ptr != end; ++ptr) if ('-' == *ptr) *ptr = '_'; -+ } -+ } -+ -+ return 0; -+ } -+ -+ return EINVAL; -+} -+ -+/* Find required options in the argument list and change their values */ -+static int -+find_opts (argv_copy& a, struct opt* const opts) -+{ -+ for (int i = 0; i < a.argc_; ++i) -+ { -+ char* ptr = a.argv_[i] + 2; // we're interested only in long options -+ -+ struct opt* opt = opts; -+ for (; 0 != opt->name; ++opt) -+ { -+ if (!strstr(ptr, opt->name)) continue; // try next option -+ -+ /* 1. try to find value after the '=' */ -+ opt->value = strchr(ptr, '=') + 1; -+ -+ /* 2. if no '=', try next element in the argument vector */ -+ if (reinterpret_cast(1) == opt->value) -+ { -+ /* also check that the next element is not an option itself */ -+ if (i + 1 < a.argc_ && *(a.argv_[i + 1]) != '-') -+ { -+ ++i; -+ opt->value = a.argv_[i]; -+ } -+ else opt->value = ""; // no value supplied (like boolean opt) -+ } -+ -+ break; // option found, break inner loop -+ } -+ } -+ -+ return 0; -+} -+ -+/* Parses string for an integer. Returns 0 on success. */ -+int get_long_long (const struct opt& opt, long long* const val, int const base) -+{ -+ const char* const str = opt.value; -+ -+ if ('\0' != *str) -+ { -+ char* endptr; -+ -+ *val = strtoll (str, &endptr, base); -+ -+ if ('k' == *endptr || 'K' == *endptr) -+ { -+ *val *= 1024L; -+ endptr++; -+ } -+ else if ('m' == *endptr || 'M' == *endptr) -+ { -+ *val *= 1024L * 1024L; -+ endptr++; -+ } -+ else if ('g' == *endptr || 'G' == *endptr) -+ { -+ *val *= 1024L * 1024L * 1024L; -+ endptr++; -+ } -+ -+ if ('\0' == *endptr) return 0; // the whole string was a valid integer -+ } -+ -+ WSREP_ERROR ("Bad value for *%s: '%s'. Should be integer.", -+ opt.name, opt.value); -+ -+ return EINVAL; -+} -+ -+/* This is flimzy coz hell knows how mysql interprets boolean strings... -+ * and, no, I'm not going to become versed in how mysql handles options - -+ * I'd rather sing. -+ -+ Aha, http://dev.mysql.com/doc/refman/5.1/en/dynamic-system-variables.html: -+ Variables that have a type of “boolean” can be set to 0, 1, ON or OFF. (If you -+ set them on the command line or in an option file, use the numeric values.) -+ -+ So it is '0' for FALSE, '1' or empty string for TRUE -+ -+ */ -+int get_bool (const struct opt& opt, bool* const val) -+{ -+ const char* str = opt.value; -+ -+ while (isspace(*str)) ++str; // skip initial whitespaces -+ -+ ssize_t str_len = strlen(str); -+ switch (str_len) -+ { -+ case 0: -+ *val = true; -+ return 0; -+ case 1: -+ if ('0' == *str || '1' == *str) -+ { -+ *val = ('1' == *str); -+ return 0; -+ } -+ } -+ -+ WSREP_ERROR ("Bad value for *%s: '%s'. Should be '0', '1' or empty string.", -+ opt.name, opt.value); -+ -+ return EINVAL; -+} -+ -+static int -+check_opts (int const argc, const char* const argv[], struct opt opts[]) -+{ -+ /* First, make a copy of argv to be able to manipulate it */ -+ argv_copy a(argc, argv); -+ -+ if (!a.argv_) -+ { -+ WSREP_ERROR ("Could not copy argv vector: not enough memory."); -+ return ENOMEM; -+ } -+ -+ int err = normalize_opts (a); -+ if (err) -+ { -+ WSREP_ERROR ("Failed to normalize options."); -+ return err; -+ } -+ -+ err = find_opts (a, opts); -+ if (err) -+ { -+ WSREP_ERROR ("Failed to parse options."); -+ return err; -+ } -+ -+ /* At this point we have updated default values in our option list to -+ what has been specified on the command line / my.cnf */ -+ -+ long long slave_threads; -+ err = get_long_long (opts[WSREP_SLAVE_THREADS], &slave_threads, 10); -+ if (err) return err; -+ -+ int rcode = 0; -+ -+ if (slave_threads > 1) -+ /* Need to check AUTOINC_LOCK_MODE and LOCKS_UNSAFE_FOR_BINLOG */ -+ { -+ long long autoinc_lock_mode; -+ err = get_long_long (opts[AUTOINC_LOCK_MODE], &autoinc_lock_mode, 10); -+ if (err) return err; -+ -+ bool locks_unsafe_for_binlog; -+ err = get_bool (opts[LOCKS_UNSAFE_FOR_BINLOG],&locks_unsafe_for_binlog); -+ if (err) return err; -+ -+ if (autoinc_lock_mode != 2) -+ { -+ WSREP_ERROR ("Parallel applying (wsrep_slave_threads > 1) requires" -+ " innodb_autoinc_lock_mode = 2."); -+ rcode = EINVAL; -+ } -+ } -+ -+ bool locked_in_memory; -+ err = get_bool (opts[LOCKED_IN_MEMORY], &locked_in_memory); -+ if (err) { WSREP_ERROR("get_bool error: %s", strerror(err)); return err; } -+ if (locked_in_memory) -+ { -+ WSREP_ERROR ("Memory locking is not supported (locked_in_memory=%s)", -+ locked_in_memory ? "ON" : "OFF"); -+ rcode = EINVAL; -+ } -+ -+ if (!strcasecmp(opts[WSREP_SST_METHOD].value,"mysqldump")) -+ { -+ if (!strcasecmp(opts[BIND_ADDRESS].value, "127.0.0.1") || -+ !strcasecmp(opts[BIND_ADDRESS].value, "localhost")) -+ { -+ WSREP_ERROR ("wsrep_sst_method is set to 'mysqldump' yet " -+ "mysqld bind_address is set to '%s', which makes it " -+ "impossible to receive state transfer from another " -+ "node, since mysqld won't accept such connections. " -+ "If you wish to use mysqldump state transfer method, " -+ "set bind_address to allow mysql client connections " -+ "from other cluster members (e.g. 0.0.0.0).", -+ opts[BIND_ADDRESS].value); -+ rcode = EINVAL; -+ } -+ } -+ else -+ { -+ // non-mysqldump SST requires wsrep_cluster_address on startup -+ if (strlen(opts[WSREP_CLUSTER_ADDRESS].value) == 0) -+ { -+ WSREP_ERROR ("%s SST method requires wsrep_cluster_address to be " -+ "configured on startup.",opts[WSREP_SST_METHOD].value); -+ rcode = EINVAL; -+ } -+ } -+ -+ if (strcasecmp(opts[WSREP_SST_RECEIVE_ADDRESS].value, "AUTO")) -+ { -+ if (!strncasecmp(opts[WSREP_SST_RECEIVE_ADDRESS].value, -+ "127.0.0.1", strlen("127.0.0.1")) || -+ !strncasecmp(opts[WSREP_SST_RECEIVE_ADDRESS].value, -+ "localhost", strlen("localhost"))) -+ { -+ WSREP_WARN ("wsrep_sst_receive_address is set to '%s' which " -+ "makes it impossible for another host to reach this " -+ "one. Please set it to the address which this node " -+ "can be connected at by other cluster members.", -+ opts[WSREP_SST_RECEIVE_ADDRESS].value); -+// rcode = EINVAL; -+ } -+ } -+ -+ if (strcasecmp(opts[WSREP_PROVIDER].value, "none")) -+ { -+ if (strcasecmp(opts[BINLOG_FORMAT].value, "ROW")) -+ { -+ WSREP_ERROR ("Only binlog_format = 'ROW' is currently supported. " -+ "Configured value: '%s'. Please adjust your " -+ "configuration.", opts[BINLOG_FORMAT].value); -+ -+ rcode = EINVAL; -+ } -+ } -+ -+ return rcode; -+} -+ -+int -+wsrep_check_opts (int const argc, char* const* const argv) -+{ -+ return check_opts (argc, argv, opts); -+} -+ - -=== added file 'sql/wsrep_hton.cc' ---- old/sql/wsrep_hton.cc 1970-01-01 00:00:00 +0000 -+++ new/sql/wsrep_hton.cc 2014-03-06 16:29:47 +0000 -@@ -0,0 +1,569 @@ -+/* Copyright 2008 Codership Oy -+ -+ 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -+ -+#include -+#include "sql_base.h" -+#include "binlog.h" -+#include "rpl_filter.h" -+#include -+#include "wsrep_mysqld.h" -+#include "wsrep_binlog.h" -+#include -+#include -+ -+extern ulonglong thd_to_trx_id(THD *thd); -+ -+extern "C" int thd_binlog_format(const MYSQL_THD thd); -+// todo: share interface with ha_innodb.c -+ -+enum wsrep_trx_status wsrep_run_wsrep_commit(THD *thd, handlerton *hton, -+ bool all); -+ -+/* -+ Cleanup after local transaction commit/rollback, replay or TOI. -+*/ -+void wsrep_cleanup_transaction(THD *thd) -+{ -+ if (wsrep_emulate_bin_log) thd_binlog_trx_reset(thd); -+ thd->wsrep_ws_handle.trx_id= WSREP_UNDEFINED_TRX_ID; -+ thd->wsrep_trx_meta.gtid= WSREP_GTID_UNDEFINED; -+ thd->wsrep_trx_meta.depends_on= WSREP_SEQNO_UNDEFINED; -+ thd->wsrep_exec_mode= LOCAL_STATE; -+ return; -+} -+ -+/* -+ wsrep hton -+*/ -+handlerton *wsrep_hton; -+ -+ -+/* -+ Registers wsrep hton at commit time if transaction has registered htons -+ for supported engine types. -+ -+ Hton should not be registered for TOTAL_ORDER operations. -+ -+ Registration is needed for both LOCAL_MODE and REPL_RECV transactions to run -+ commit in 2pc so that wsrep position gets properly recorded in storage -+ engines. -+ -+ Note that all hton calls should immediately return for threads that are -+ in REPL_RECV mode as their states are controlled by wsrep appliers or -+ replaying code. Only threads in LOCAL_MODE should run wsrep callbacks -+ from hton methods. -+*/ -+void wsrep_register_hton(THD* thd, bool all) -+{ -+ if (thd->wsrep_exec_mode != TOTAL_ORDER && !thd->wsrep_apply_toi) -+ { -+ THD_TRANS *trans=all ? &thd->transaction.all : &thd->transaction.stmt; -+ for (Ha_trx_info *i= trans->ha_list; WSREP(thd) && i; i = i->next()) -+ { -+ if (i->ht()->db_type == DB_TYPE_INNODB) -+ { -+ trans_register_ha(thd, all, wsrep_hton); -+ -+ /* follow innodb read/write settting -+ * but, as an exception: CTAS with empty result set will not be -+ * replicated unless we declare wsrep hton as read/write here -+ */ -+ if (i->is_trx_read_write() || -+ (thd->lex->sql_command == SQLCOM_CREATE_TABLE && -+ thd->wsrep_exec_mode == LOCAL_STATE)) -+ { -+ thd->ha_data[wsrep_hton->slot].ha_info[all].set_trx_read_write(); -+ } -+ break; -+ } -+ } -+ } -+} -+ -+/* -+ Calls wsrep->post_commit() for locally executed transactions that have -+ got seqno from provider (must commit) and don't require replaying. -+ */ -+void wsrep_post_commit(THD* thd, bool all) -+{ -+ if (thd->wsrep_exec_mode == LOCAL_COMMIT) -+ { -+ DBUG_ASSERT(thd->wsrep_trx_meta.gtid.seqno != WSREP_SEQNO_UNDEFINED); -+ if (wsrep->post_commit(wsrep, &thd->wsrep_ws_handle)) -+ { -+ DBUG_PRINT("wsrep", ("set committed fail")); -+ WSREP_WARN("set committed fail: %llu %d", -+ (long long)thd->real_id, thd->get_stmt_da()->status()); -+ } -+ wsrep_cleanup_transaction(thd); -+ } -+} -+ -+/* -+ wsrep exploits binlog's caches even if binlogging itself is not -+ activated. In such case connection close needs calling -+ actual binlog's method. -+ Todo: split binlog hton from its caches to use ones by wsrep -+ without referring to binlog's stuff. -+*/ -+static int -+wsrep_close_connection(handlerton* hton, THD* thd) -+{ -+ DBUG_ENTER("wsrep_close_connection"); -+ -+ if (thd->wsrep_exec_mode == REPL_RECV) -+ { -+ DBUG_RETURN(0); -+ } -+ DBUG_RETURN(wsrep_binlog_close_connection (thd)); -+} -+ -+/* -+ prepare/wsrep_run_wsrep_commit can fail in two ways -+ - certification test or an equivalent. As a result, -+ the current transaction just rolls back -+ Error codes: -+ WSREP_TRX_CERT_FAIL, WSREP_TRX_SIZE_EXCEEDED, WSREP_TRX_ERROR -+ - a post-certification failure makes this server unable to -+ commit its own WS and therefore the server must abort -+*/ -+static int wsrep_prepare(handlerton *hton, THD *thd, bool all) -+{ -+ DBUG_ENTER("wsrep_prepare"); -+ -+ if (thd->wsrep_exec_mode == REPL_RECV) -+ { -+ DBUG_RETURN(0); -+ } -+ -+ DBUG_ASSERT(thd->ha_data[wsrep_hton->slot].ha_info[all].is_trx_read_write()); -+ DBUG_ASSERT(thd->wsrep_exec_mode == LOCAL_STATE); -+ DBUG_ASSERT(thd->wsrep_trx_meta.gtid.seqno == WSREP_SEQNO_UNDEFINED); -+ -+ if ((all || -+ !thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) && -+ (thd->variables.wsrep_on && !wsrep_trans_cache_is_empty(thd))) -+ { -+ DBUG_RETURN (wsrep_run_wsrep_commit(thd, hton, all)); -+ } -+ DBUG_RETURN(0); -+} -+ -+static int wsrep_savepoint_set(handlerton *hton, THD *thd, void *sv) -+{ -+ DBUG_ENTER("wsrep_savepoint_set"); -+ -+ if (thd->wsrep_exec_mode == REPL_RECV) -+ { -+ DBUG_RETURN(0); -+ } -+ -+ if (!wsrep_emulate_bin_log) DBUG_RETURN(0); -+ int rcode = wsrep_binlog_savepoint_set(thd, sv); -+ DBUG_RETURN(rcode); -+} -+ -+static int wsrep_savepoint_rollback(handlerton *hton, THD *thd, void *sv) -+{ -+ DBUG_ENTER("wsrep_savepoint_rollback"); -+ -+ if (thd->wsrep_exec_mode == REPL_RECV) -+ { -+ DBUG_RETURN(0); -+ } -+ -+ if (!wsrep_emulate_bin_log) DBUG_RETURN(0); -+ int rcode = wsrep_binlog_savepoint_rollback(thd, sv); -+ DBUG_RETURN(rcode); -+} -+ -+static int wsrep_rollback(handlerton *hton, THD *thd, bool all) -+{ -+ DBUG_ENTER("wsrep_rollback"); -+ -+ if (thd->wsrep_exec_mode == REPL_RECV) -+ { -+ DBUG_RETURN(0); -+ } -+ -+ mysql_mutex_lock(&thd->LOCK_wsrep_thd); -+ switch (thd->wsrep_exec_mode) -+ { -+ case TOTAL_ORDER: -+ case REPL_RECV: -+ mysql_mutex_unlock(&thd->LOCK_wsrep_thd); -+ WSREP_DEBUG("Avoiding wsrep rollback for failed DDL: %s", thd->query()); -+ DBUG_RETURN(0); -+ default: break; -+ } -+ -+ if ((all || !thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) && -+ (thd->variables.wsrep_on && thd->wsrep_conflict_state != MUST_REPLAY)) -+ { -+ if (wsrep->post_rollback(wsrep, &thd->wsrep_ws_handle)) -+ { -+ DBUG_PRINT("wsrep", ("setting rollback fail")); -+ WSREP_ERROR("settting rollback fail: thd: %llu SQL: %s", -+ (long long)thd->real_id, thd->query()); -+ } -+ wsrep_cleanup_transaction(thd); -+ } -+ mysql_mutex_unlock(&thd->LOCK_wsrep_thd); -+ DBUG_RETURN(0); -+} -+ -+int wsrep_commit(handlerton *hton, THD *thd, bool all) -+{ -+ DBUG_ENTER("wsrep_commit"); -+ -+ if (thd->wsrep_exec_mode == REPL_RECV) -+ { -+ DBUG_RETURN(0); -+ } -+ -+ mysql_mutex_lock(&thd->LOCK_wsrep_thd); -+ if ((all || !thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) && -+ (thd->variables.wsrep_on && thd->wsrep_conflict_state != MUST_REPLAY)) -+ { -+ if (thd->wsrep_exec_mode == LOCAL_COMMIT) -+ { -+ DBUG_ASSERT(thd->ha_data[wsrep_hton->slot].ha_info[all].is_trx_read_write()); -+ /* -+ Call to wsrep->post_commit() (moved to wsrep_post_commit()) must -+ be done only after commit has done for all involved htons. -+ */ -+ DBUG_PRINT("wsrep", ("commit")); -+ } -+ else -+ { -+ /* -+ Transaction didn't go through wsrep->pre_commit() so just roll back -+ possible changes to clean state. -+ */ -+ if (wsrep->post_rollback(wsrep, &thd->wsrep_ws_handle)) -+ { -+ DBUG_PRINT("wsrep", ("setting rollback fail")); -+ WSREP_ERROR("settting rollback fail: thd: %llu SQL: %s", -+ (long long)thd->real_id, thd->query()); -+ } -+ wsrep_cleanup_transaction(thd); -+ } -+ } -+ mysql_mutex_unlock(&thd->LOCK_wsrep_thd); -+ DBUG_RETURN(0); -+} -+ -+ -+extern Rpl_filter* binlog_filter; -+extern my_bool opt_log_slave_updates; -+ -+enum wsrep_trx_status -+wsrep_run_wsrep_commit(THD *thd, handlerton *hton, bool all) -+{ -+ int rcode= -1; -+ size_t data_len= 0; -+ IO_CACHE *cache; -+ int replay_round= 0; -+ -+ if (thd->get_stmt_da()->is_error()) { -+ WSREP_ERROR("commit issue, error: %d %s", -+ thd->get_stmt_da()->sql_errno(), thd->get_stmt_da()->message()); -+ } -+ -+ DBUG_ENTER("wsrep_run_wsrep_commit"); -+ -+ if (thd->slave_thread && !opt_log_slave_updates) DBUG_RETURN(WSREP_TRX_OK); -+ -+ if (thd->wsrep_exec_mode == REPL_RECV) { -+ -+ mysql_mutex_lock(&thd->LOCK_wsrep_thd); -+ if (thd->wsrep_conflict_state == MUST_ABORT) { -+ if (wsrep_debug) -+ WSREP_INFO("WSREP: must abort for BF"); -+ DBUG_PRINT("wsrep", ("BF apply commit fail")); -+ thd->wsrep_conflict_state = NO_CONFLICT; -+ mysql_mutex_unlock(&thd->LOCK_wsrep_thd); -+ // -+ // TODO: test all calls of the rollback. -+ // rollback must happen automagically innobase_rollback(hton, thd, 1); -+ // -+ DBUG_RETURN(WSREP_TRX_ERROR); -+ } -+ mysql_mutex_unlock(&thd->LOCK_wsrep_thd); -+ } -+ -+ if (thd->wsrep_exec_mode != LOCAL_STATE) DBUG_RETURN(WSREP_TRX_OK); -+ -+ if (thd->wsrep_consistency_check == CONSISTENCY_CHECK_RUNNING) { -+ WSREP_DEBUG("commit for consistency check: %s", thd->query()); -+ DBUG_RETURN(WSREP_TRX_OK); -+ } -+ -+ DBUG_PRINT("wsrep", ("replicating commit")); -+ -+ mysql_mutex_lock(&thd->LOCK_wsrep_thd); -+ if (thd->wsrep_conflict_state == MUST_ABORT) { -+ DBUG_PRINT("wsrep", ("replicate commit fail")); -+ thd->wsrep_conflict_state = ABORTED; -+ mysql_mutex_unlock(&thd->LOCK_wsrep_thd); -+ if (wsrep_debug) { -+ WSREP_INFO("innobase_commit, abort %s", -+ (thd->query()) ? thd->query() : "void"); -+ } -+ DBUG_RETURN(WSREP_TRX_CERT_FAIL); -+ } -+ -+ mysql_mutex_lock(&LOCK_wsrep_replaying); -+ -+ while (wsrep_replaying > 0 && -+ thd->wsrep_conflict_state == NO_CONFLICT && -+ thd->killed == THD::NOT_KILLED && -+ !shutdown_in_progress) -+ { -+ -+ mysql_mutex_unlock(&LOCK_wsrep_replaying); -+ mysql_mutex_unlock(&thd->LOCK_wsrep_thd); -+ -+ mysql_mutex_lock(&thd->mysys_var->mutex); -+ thd_proc_info(thd, "wsrep waiting on replaying"); -+ thd->mysys_var->current_mutex= &LOCK_wsrep_replaying; -+ thd->mysys_var->current_cond= &COND_wsrep_replaying; -+ mysql_mutex_unlock(&thd->mysys_var->mutex); -+ -+ mysql_mutex_lock(&LOCK_wsrep_replaying); -+ // Using timedwait is a hack to avoid deadlock in case if BF victim -+ // misses the signal. -+ struct timespec wtime = {0, 1000000}; -+ mysql_cond_timedwait(&COND_wsrep_replaying, &LOCK_wsrep_replaying, -+ &wtime); -+ -+ if (replay_round++ % 100000 == 0) -+ WSREP_DEBUG("commit waiting for replaying: replayers %d, thd: (%lu) " -+ "conflict: %d (round: %d)", -+ wsrep_replaying, thd->thread_id, -+ thd->wsrep_conflict_state, replay_round); -+ -+ mysql_mutex_unlock(&LOCK_wsrep_replaying); -+ -+ mysql_mutex_lock(&thd->mysys_var->mutex); -+ thd->mysys_var->current_mutex= 0; -+ thd->mysys_var->current_cond= 0; -+ mysql_mutex_unlock(&thd->mysys_var->mutex); -+ -+ mysql_mutex_lock(&thd->LOCK_wsrep_thd); -+ mysql_mutex_lock(&LOCK_wsrep_replaying); -+ } -+ mysql_mutex_unlock(&LOCK_wsrep_replaying); -+ -+ if (thd->wsrep_conflict_state == MUST_ABORT) { -+ DBUG_PRINT("wsrep", ("replicate commit fail")); -+ thd->wsrep_conflict_state = ABORTED; -+ mysql_mutex_unlock(&thd->LOCK_wsrep_thd); -+ WSREP_DEBUG("innobase_commit abort after replaying wait %s", -+ (thd->query()) ? thd->query() : "void"); -+ DBUG_RETURN(WSREP_TRX_CERT_FAIL); -+ } -+ -+ thd->wsrep_query_state = QUERY_COMMITTING; -+ mysql_mutex_unlock(&thd->LOCK_wsrep_thd); -+ -+ cache = get_trans_log(thd); -+ rcode = 0; -+ if (cache) { -+ thd->binlog_flush_pending_rows_event(true); -+ rcode = wsrep_write_cache(wsrep, thd, cache, &data_len); -+ if (WSREP_OK != rcode) { -+ WSREP_ERROR("rbr write fail, data_len: %zu, %d", data_len, rcode); -+ DBUG_RETURN(WSREP_TRX_SIZE_EXCEEDED); -+ } -+ } -+ -+ if (data_len == 0) -+ { -+ if (thd->get_stmt_da()->is_ok() && -+ thd->get_stmt_da()->affected_rows() > 0 && -+ !binlog_filter->is_on()) -+ { -+ WSREP_DEBUG("empty rbr buffer, query: %s, " -+ "affected rows: %llu, " -+ "changed tables: %d, " -+ "sql_log_bin: %d, " -+ "wsrep status (%d %d %d)", -+ thd->query(), thd->get_stmt_da()->affected_rows(), -+ stmt_has_updated_trans_table(thd), thd->variables.sql_log_bin, -+ thd->wsrep_exec_mode, thd->wsrep_query_state, -+ thd->wsrep_conflict_state); -+ } -+ else -+ { -+ WSREP_DEBUG("empty rbr buffer, query: %s", thd->query()); -+ } -+ thd->wsrep_query_state= QUERY_EXEC; -+ DBUG_RETURN(WSREP_TRX_OK); -+ } -+ -+ if (WSREP_UNDEFINED_TRX_ID == thd->wsrep_ws_handle.trx_id) -+ { -+ WSREP_WARN("SQL statement was ineffective, THD: %lu, buf: %zu\n" -+ "QUERY: %s\n" -+ " => Skipping replication", -+ thd->thread_id, data_len, thd->query()); -+ rcode = WSREP_TRX_FAIL; -+ } -+ else if (!rcode) -+ { -+ if (WSREP_OK == rcode) -+ rcode = wsrep->pre_commit(wsrep, -+ (wsrep_conn_id_t)thd->thread_id, -+ &thd->wsrep_ws_handle, -+ WSREP_FLAG_COMMIT | -+ ((thd->wsrep_PA_safe) ? -+ 0ULL : WSREP_FLAG_PA_UNSAFE), -+ &thd->wsrep_trx_meta); -+ -+ if (rcode == WSREP_TRX_MISSING) { -+ WSREP_WARN("Transaction missing in provider, thd: %ld, SQL: %s", -+ thd->thread_id, thd->query()); -+ rcode = WSREP_TRX_FAIL; -+ } else if (rcode == WSREP_BF_ABORT) { -+ WSREP_DEBUG("thd %lu seqno %lld BF aborted by provider, will replay", -+ thd->thread_id, (long long)thd->wsrep_trx_meta.gtid.seqno); -+ mysql_mutex_lock(&thd->LOCK_wsrep_thd); -+ thd->wsrep_conflict_state = MUST_REPLAY; -+ DBUG_ASSERT(wsrep_thd_trx_seqno(thd) > 0); -+ mysql_mutex_unlock(&thd->LOCK_wsrep_thd); -+ mysql_mutex_lock(&LOCK_wsrep_replaying); -+ wsrep_replaying++; -+ WSREP_DEBUG("replaying increased: %d, thd: %lu", -+ wsrep_replaying, thd->thread_id); -+ mysql_mutex_unlock(&LOCK_wsrep_replaying); -+ } -+ } else { -+ WSREP_ERROR("I/O error reading from thd's binlog iocache: " -+ "errno=%d, io cache code=%d", my_errno, cache->error); -+ DBUG_ASSERT(0); // failure like this can not normally happen -+ DBUG_RETURN(WSREP_TRX_ERROR); -+ } -+ -+ mysql_mutex_lock(&thd->LOCK_wsrep_thd); -+ switch(rcode) { -+ case 0: -+ /* -+ About MUST_ABORT: We assume that even if thd conflict state was set -+ to MUST_ABORT, underlying transaction was not rolled back or marked -+ as deadlock victim in QUERY_COMMITTING state. Conflict state is -+ set to NO_CONFLICT and commit proceeds as usual. -+ */ -+ if (thd->wsrep_conflict_state == MUST_ABORT) -+ thd->wsrep_conflict_state= NO_CONFLICT; -+ -+ if (thd->wsrep_conflict_state != NO_CONFLICT) -+ { -+ WSREP_WARN("thd %lu seqno %lld: conflict state %d after post commit", -+ thd->thread_id, -+ (long long)thd->wsrep_trx_meta.gtid.seqno, -+ thd->wsrep_conflict_state); -+ } -+ thd->wsrep_exec_mode= LOCAL_COMMIT; -+ DBUG_ASSERT(thd->wsrep_trx_meta.gtid.seqno != WSREP_SEQNO_UNDEFINED); -+ /* Override XID iff it was generated by mysql */ -+ if (thd->transaction.xid_state.xid.get_my_xid()) -+ { -+ wsrep_xid_init(&thd->transaction.xid_state.xid, -+ &thd->wsrep_trx_meta.gtid.uuid, -+ thd->wsrep_trx_meta.gtid.seqno); -+ } -+ DBUG_PRINT("wsrep", ("replicating commit success")); -+ break; -+ case WSREP_BF_ABORT: -+ DBUG_ASSERT(thd->wsrep_trx_meta.gtid.seqno != WSREP_SEQNO_UNDEFINED); -+ case WSREP_TRX_FAIL: -+ WSREP_DEBUG("commit failed for reason: %d", rcode); -+ DBUG_PRINT("wsrep", ("replicating commit fail")); -+ -+ thd->wsrep_query_state= QUERY_EXEC; -+ -+ if (thd->wsrep_conflict_state == MUST_ABORT) { -+ thd->wsrep_conflict_state= ABORTED; -+ } -+ else -+ { -+ WSREP_DEBUG("conflict state: %d", thd->wsrep_conflict_state); -+ if (thd->wsrep_conflict_state == NO_CONFLICT) -+ { -+ thd->wsrep_conflict_state = CERT_FAILURE; -+ WSREP_LOG_CONFLICT(NULL, thd, FALSE); -+ } -+ } -+ mysql_mutex_unlock(&thd->LOCK_wsrep_thd); -+ -+ DBUG_RETURN(WSREP_TRX_CERT_FAIL); -+ -+ case WSREP_CONN_FAIL: -+ WSREP_ERROR("connection failure"); -+ DBUG_RETURN(WSREP_TRX_ERROR); -+ default: -+ WSREP_ERROR("unknown connection failure"); -+ DBUG_RETURN(WSREP_TRX_ERROR); -+ } -+ -+ thd->wsrep_query_state= QUERY_EXEC; -+ mysql_mutex_unlock(&thd->LOCK_wsrep_thd); -+ -+ DBUG_RETURN(WSREP_TRX_OK); -+} -+ -+ -+static int wsrep_hton_init(void *p) -+{ -+ wsrep_hton= (handlerton *)p; -+ //wsrep_hton->state=opt_bin_log ? SHOW_OPTION_YES : SHOW_OPTION_NO; -+ wsrep_hton->state= SHOW_OPTION_YES; -+ wsrep_hton->db_type=DB_TYPE_WSREP; -+ wsrep_hton->savepoint_offset= sizeof(my_off_t); -+ wsrep_hton->close_connection= wsrep_close_connection; -+ wsrep_hton->savepoint_set= wsrep_savepoint_set; -+ wsrep_hton->savepoint_rollback= wsrep_savepoint_rollback; -+ wsrep_hton->commit= wsrep_commit; -+ wsrep_hton->rollback= wsrep_rollback; -+ wsrep_hton->prepare= wsrep_prepare; -+ wsrep_hton->flags= HTON_NOT_USER_SELECTABLE | HTON_HIDDEN; // todo: fix flags -+ wsrep_hton->slot= 0; -+ return 0; -+} -+ -+ -+struct st_mysql_storage_engine wsrep_storage_engine= -+{ MYSQL_HANDLERTON_INTERFACE_VERSION }; -+ -+ -+mysql_declare_plugin(wsrep) -+{ -+ MYSQL_STORAGE_ENGINE_PLUGIN, -+ &wsrep_storage_engine, -+ "wsrep", -+ "Codership Oy", -+ "A pseudo storage engine to represent transactions in multi-master " -+ "synchornous replication", -+ PLUGIN_LICENSE_GPL, -+ wsrep_hton_init, /* Plugin Init */ -+ NULL, /* Plugin Deinit */ -+ 0x0100 /* 1.0 */, -+ NULL, /* status variables */ -+ NULL, /* system variables */ -+ NULL, /* config options */ -+ 0, /* flags */ -+} -+mysql_declare_plugin_end; - -=== added file 'sql/wsrep_mysqld.cc' ---- old/sql/wsrep_mysqld.cc 1970-01-01 00:00:00 +0000 -+++ new/sql/wsrep_mysqld.cc 2014-03-13 09:13:20 +0000 -@@ -0,0 +1,1484 @@ -+/* Copyright 2008-2013 Codership Oy -+ -+ 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -+ -+#include -+#include -+#include -+#include "wsrep_priv.h" -+#include "wsrep_thd.h" -+#include "wsrep_sst.h" -+#include "wsrep_utils.h" -+#include "wsrep_var.h" -+#include "wsrep_binlog.h" -+#include "wsrep_applier.h" -+#include -+#include -+#include "log_event.h" -+ -+wsrep_t *wsrep = NULL; -+my_bool wsrep_emulate_bin_log = FALSE; // activating parts of binlog interface -+/* Sidno in global_sid_map corresponding to group uuid */ -+rpl_sidno wsrep_sidno= -1; -+my_bool wsrep_preordered_opt= FALSE; -+ -+/* -+ * Begin configuration options and their default values -+ */ -+ -+const char* wsrep_data_home_dir = NULL; -+const char* wsrep_dbug_option = ""; -+ -+long wsrep_slave_threads = 1; // # of slave action appliers wanted -+int wsrep_slave_count_change = 0; // # of appliers to stop or start -+my_bool wsrep_debug = 0; // enable debug level logging -+my_bool wsrep_convert_LOCK_to_trx = 1; // convert locking sessions to trx -+ulong wsrep_retry_autocommit = 5; // retry aborted autocommit trx -+my_bool wsrep_auto_increment_control = 1; // control auto increment variables -+my_bool wsrep_drupal_282555_workaround = 1; // retry autoinc insert after dupkey -+my_bool wsrep_incremental_data_collection = 0; // incremental data collection -+ulong wsrep_max_ws_size = 1073741824UL;//max ws (RBR buffer) size -+ulong wsrep_max_ws_rows = 65536; // max number of rows in ws -+int wsrep_to_isolation = 0; // # of active TO isolation threads -+my_bool wsrep_certify_nonPK = 1; // certify, even when no primary key -+long wsrep_max_protocol_version = 2; // maximum protocol version to use -+ulong wsrep_forced_binlog_format = BINLOG_FORMAT_UNSPEC; -+my_bool wsrep_recovery = 0; // recovery -+my_bool wsrep_replicate_myisam = 0; // enable myisam replication -+my_bool wsrep_log_conflicts = 0; -+ulong wsrep_mysql_replication_bundle = 0; -+my_bool wsrep_desync = 0; // desynchronize the node from the -+ // cluster -+my_bool wsrep_load_data_splitting = 1; // commit load data every 10K intervals -+ -+/* -+ * End configuration options -+ */ -+ -+static const wsrep_uuid_t cluster_uuid = WSREP_UUID_UNDEFINED; -+static char cluster_uuid_str[40]= { 0, }; -+static const char* cluster_status_str[WSREP_VIEW_MAX] = -+{ -+ "Primary", -+ "non-Primary", -+ "Disconnected" -+}; -+ -+static char provider_name[256]= { 0, }; -+static char provider_version[256]= { 0, }; -+static char provider_vendor[256]= { 0, }; -+ -+/* -+ * wsrep status variables -+ */ -+my_bool wsrep_connected = FALSE; -+my_bool wsrep_ready = FALSE; // node can accept queries -+const char* wsrep_cluster_state_uuid = cluster_uuid_str; -+long long wsrep_cluster_conf_id = WSREP_SEQNO_UNDEFINED; -+const char* wsrep_cluster_status = cluster_status_str[WSREP_VIEW_DISCONNECTED]; -+long wsrep_cluster_size = 0; -+long wsrep_local_index = -1; -+long long wsrep_local_bf_aborts = 0; -+const char* wsrep_provider_name = provider_name; -+const char* wsrep_provider_version = provider_version; -+const char* wsrep_provider_vendor = provider_vendor; -+/* End wsrep status variables */ -+ -+wsrep_uuid_t local_uuid = WSREP_UUID_UNDEFINED; -+wsrep_seqno_t local_seqno = WSREP_SEQNO_UNDEFINED; -+wsp::node_status local_status; -+long wsrep_protocol_version = 2; -+ -+// Boolean denoting if server is in initial startup phase. This is needed -+// to make sure that main thread waiting in wsrep_sst_wait() is signaled -+// if there was no state gap on receiving first view event. -+static my_bool wsrep_startup = TRUE; -+ -+ -+static void wsrep_log_cb(wsrep_log_level_t level, const char *msg) { -+ switch (level) { -+ case WSREP_LOG_INFO: -+ sql_print_information("WSREP: %s", msg); -+ break; -+ case WSREP_LOG_WARN: -+ sql_print_warning("WSREP: %s", msg); -+ break; -+ case WSREP_LOG_ERROR: -+ case WSREP_LOG_FATAL: -+ sql_print_error("WSREP: %s", msg); -+ break; -+ case WSREP_LOG_DEBUG: -+ sql_print_information ("[Debug] WSREP: %s", msg); -+ default: -+ break; -+ } -+} -+ -+static void wsrep_log_states (wsrep_log_level_t const level, -+ const wsrep_uuid_t* const group_uuid, -+ wsrep_seqno_t const group_seqno, -+ const wsrep_uuid_t* const node_uuid, -+ wsrep_seqno_t const node_seqno) -+{ -+ char uuid_str[37]; -+ char msg[256]; -+ -+ wsrep_uuid_print (group_uuid, uuid_str, sizeof(uuid_str)); -+ snprintf (msg, 255, "WSREP: Group state: %s:%lld", -+ uuid_str, (long long)group_seqno); -+ wsrep_log_cb (level, msg); -+ -+ wsrep_uuid_print (node_uuid, uuid_str, sizeof(uuid_str)); -+ snprintf (msg, 255, "WSREP: Local state: %s:%lld", -+ uuid_str, (long long)node_seqno); -+ wsrep_log_cb (level, msg); -+} -+ -+static my_bool set_SE_checkpoint(THD* unused, plugin_ref plugin, void* arg) -+{ -+ XID* xid= reinterpret_cast(arg); -+ handlerton* hton= plugin_data(plugin, handlerton *); -+ if (hton->db_type == DB_TYPE_INNODB) -+ { -+ const wsrep_uuid_t* uuid(wsrep_xid_uuid(xid)); -+ char uuid_str[40] = {0, }; -+ wsrep_uuid_print(uuid, uuid_str, sizeof(uuid_str)); -+ WSREP_DEBUG("Set WSREPXid for InnoDB: %s:%lld", -+ uuid_str, (long long)wsrep_xid_seqno(xid)); -+ hton->wsrep_set_checkpoint(hton, xid); -+ } -+ return FALSE; -+} -+ -+void wsrep_set_SE_checkpoint(XID* xid) -+{ -+ plugin_foreach(NULL, set_SE_checkpoint, MYSQL_STORAGE_ENGINE_PLUGIN, xid); -+} -+ -+static my_bool get_SE_checkpoint(THD* unused, plugin_ref plugin, void* arg) -+{ -+ XID* xid= reinterpret_cast(arg); -+ handlerton* hton= plugin_data(plugin, handlerton *); -+ if (hton->db_type == DB_TYPE_INNODB) -+ { -+ hton->wsrep_get_checkpoint(hton, xid); -+ const wsrep_uuid_t* uuid(wsrep_xid_uuid(xid)); -+ char uuid_str[40] = {0, }; -+ wsrep_uuid_print(uuid, uuid_str, sizeof(uuid_str)); -+ WSREP_DEBUG("Read WSREPXid from InnoDB: %s:%lld", -+ uuid_str, (long long)wsrep_xid_seqno(xid)); -+ -+ } -+ return FALSE; -+} -+ -+void wsrep_get_SE_checkpoint(XID* xid) -+{ -+ plugin_foreach(NULL, get_SE_checkpoint, MYSQL_STORAGE_ENGINE_PLUGIN, xid); -+} -+ -+void wsrep_init_sidno(const wsrep_uuid_t& uuid) -+{ -+ /* generate new Sid map entry from inverted uuid */ -+ rpl_sid sid; -+ wsrep_uuid_t ltid_uuid; -+ for (size_t i= 0; i < sizeof(ltid_uuid.data); ++i) -+ { -+ ltid_uuid.data[i] = ~local_uuid.data[i]; -+ } -+ sid.copy_from(ltid_uuid.data); -+ global_sid_lock->wrlock(); -+ wsrep_sidno= global_sid_map->add_sid(sid); -+ WSREP_INFO("inited wsrep sidno %d", wsrep_sidno); -+ global_sid_lock->unlock(); -+} -+ -+ -+static wsrep_cb_status_t -+wsrep_view_handler_cb (void* app_ctx, -+ void* recv_ctx, -+ const wsrep_view_info_t* view, -+ const char* state, -+ size_t state_len, -+ void** sst_req, -+ size_t* sst_req_len) -+{ -+ *sst_req = NULL; -+ *sst_req_len = 0; -+ -+ wsrep_member_status_t new_status= local_status.get(); -+ -+ if (memcmp(&cluster_uuid, &view->state_id.uuid, sizeof(wsrep_uuid_t))) -+ { -+ memcpy((wsrep_uuid_t*)&cluster_uuid, &view->state_id.uuid, -+ sizeof(cluster_uuid)); -+ -+ wsrep_uuid_print (&cluster_uuid, cluster_uuid_str, -+ sizeof(cluster_uuid_str)); -+ } -+ -+ wsrep_cluster_conf_id= view->view; -+ wsrep_cluster_status= cluster_status_str[view->status]; -+ wsrep_cluster_size= view->memb_num; -+ wsrep_local_index= view->my_idx; -+ -+ WSREP_INFO("New cluster view: global state: %s:%lld, view# %lld: %s, " -+ "number of nodes: %ld, my index: %ld, protocol version %d", -+ wsrep_cluster_state_uuid, (long long)view->state_id.seqno, -+ (long long)wsrep_cluster_conf_id, wsrep_cluster_status, -+ wsrep_cluster_size, wsrep_local_index, view->proto_ver); -+ -+ /* Proceed further only if view is PRIMARY */ -+ if (WSREP_VIEW_PRIMARY != view->status) { -+ wsrep_ready_set(FALSE); -+ new_status= WSREP_MEMBER_UNDEFINED; -+ /* Always record local_uuid and local_seqno in non-prim since this -+ * may lead to re-initializing provider and start position is -+ * determined according to these variables */ -+ // WRONG! local_uuid should be the last primary configuration uuid we were -+ // a member of. local_seqno should be updated in commit calls. -+ // local_uuid= cluster_uuid; -+ // local_seqno= view->first - 1; -+ goto out; -+ } -+ -+ switch (view->proto_ver) -+ { -+ case 0: -+ case 1: -+ case 2: -+ // version change -+ if (view->proto_ver != wsrep_protocol_version) -+ { -+ my_bool wsrep_ready_saved= wsrep_ready; -+ wsrep_ready_set(FALSE); -+ WSREP_INFO("closing client connections for " -+ "protocol change %ld -> %d", -+ wsrep_protocol_version, view->proto_ver); -+ wsrep_close_client_connections(TRUE); -+ wsrep_protocol_version= view->proto_ver; -+ wsrep_ready_set(wsrep_ready_saved); -+ } -+ break; -+ default: -+ WSREP_ERROR("Unsupported application protocol version: %d", -+ view->proto_ver); -+ unireg_abort(1); -+ } -+ -+ if (view->state_gap) -+ { -+ WSREP_WARN("Gap in state sequence. Need state transfer."); -+ -+ /* After that wsrep will call wsrep_sst_prepare. */ -+ /* keep ready flag 0 until we receive the snapshot */ -+ wsrep_ready_set(FALSE); -+ -+ /* Close client connections to ensure that they don't interfere -+ * with SST */ -+ WSREP_DEBUG("[debug]: closing client connections for PRIM"); -+ wsrep_close_client_connections(TRUE); -+ -+ ssize_t const req_len= wsrep_sst_prepare (sst_req); -+ -+ if (req_len < 0) -+ { -+ WSREP_ERROR("SST preparation failed: %zd (%s)", -req_len, -+ strerror(-req_len)); -+ new_status= WSREP_MEMBER_UNDEFINED; -+ } -+ else -+ { -+ assert(sst_req != NULL); -+ *sst_req_len= req_len; -+ new_status= WSREP_MEMBER_JOINER; -+ } -+ } -+ else -+ { -+ /* -+ * NOTE: Initialize wsrep_group_uuid here only if it wasn't initialized -+ * before - OR - it was reinitilized on startup (lp:992840) -+ */ -+ if (wsrep_startup) -+ { -+ if (wsrep_before_SE()) -+ { -+ wsrep_SE_init_grab(); -+ // Signal mysqld init thread to continue -+ wsrep_sst_complete (&cluster_uuid, view->state_id.seqno, false); -+ // and wait for SE initialization -+ wsrep_SE_init_wait(); -+ } -+ else -+ { -+ local_uuid= cluster_uuid; -+ local_seqno= view->state_id.seqno; -+ } -+ /* Init storage engine XIDs from first view */ -+ XID xid; -+ wsrep_xid_init(&xid, &local_uuid, local_seqno); -+ wsrep_set_SE_checkpoint(&xid); -+ new_status= WSREP_MEMBER_JOINED; -+ wsrep_init_sidno(local_uuid); -+ } -+ -+ // just some sanity check -+ if (memcmp (&local_uuid, &cluster_uuid, sizeof (wsrep_uuid_t))) -+ { -+ WSREP_ERROR("Undetected state gap. Can't continue."); -+ wsrep_log_states(WSREP_LOG_FATAL, &cluster_uuid, view->state_id.seqno, -+ &local_uuid, -1); -+ unireg_abort(1); -+ } -+ } -+ -+ if (wsrep_auto_increment_control) -+ { -+ global_system_variables.auto_increment_offset= view->my_idx + 1; -+ global_system_variables.auto_increment_increment= view->memb_num; -+ } -+ -+ { /* capabilities may be updated on new configuration */ -+ uint64_t const caps(wsrep->capabilities (wsrep)); -+ -+ my_bool const idc((caps & WSREP_CAP_INCREMENTAL_WRITESET) != 0); -+ if (TRUE == wsrep_incremental_data_collection && FALSE == idc) -+ { -+ WSREP_WARN("Unsupported protocol downgrade: " -+ "incremental data collection disabled. Expect abort."); -+ } -+ wsrep_incremental_data_collection = idc; -+ } -+ -+out: -+ wsrep_startup= FALSE; -+ local_status.set(new_status, view); -+ -+ return WSREP_CB_SUCCESS; -+} -+ -+void wsrep_ready_set (my_bool x) -+{ -+ WSREP_DEBUG("Setting wsrep_ready to %d", x); -+ if (mysql_mutex_lock (&LOCK_wsrep_ready)) abort(); -+ if (wsrep_ready != x) -+ { -+ wsrep_ready= x; -+ mysql_cond_signal (&COND_wsrep_ready); -+ } -+ mysql_mutex_unlock (&LOCK_wsrep_ready); -+} -+ -+// Wait until wsrep has reached ready state -+void wsrep_ready_wait () -+{ -+ if (mysql_mutex_lock (&LOCK_wsrep_ready)) abort(); -+ while (!wsrep_ready) -+ { -+ WSREP_INFO("Waiting to reach ready state"); -+ mysql_cond_wait (&COND_wsrep_ready, &LOCK_wsrep_ready); -+ } -+ WSREP_INFO("ready state reached"); -+ mysql_mutex_unlock (&LOCK_wsrep_ready); -+} -+ -+static void wsrep_synced_cb(void* app_ctx) -+{ -+ WSREP_INFO("Synchronized with group, ready for connections"); -+ bool signal_main= false; -+ if (mysql_mutex_lock (&LOCK_wsrep_ready)) abort(); -+ if (!wsrep_ready) -+ { -+ wsrep_ready= TRUE; -+ mysql_cond_signal (&COND_wsrep_ready); -+ signal_main= true; -+ -+ } -+ local_status.set(WSREP_MEMBER_SYNCED); -+ mysql_mutex_unlock (&LOCK_wsrep_ready); -+ -+ if (signal_main) -+ { -+ wsrep_SE_init_grab(); -+ // Signal mysqld init thread to continue -+ wsrep_sst_complete (&local_uuid, local_seqno, false); -+ // and wait for SE initialization -+ wsrep_SE_init_wait(); -+ } -+} -+ -+static void wsrep_init_position() -+{ -+ /* read XIDs from storage engines */ -+ XID xid; -+ memset(&xid, 0, sizeof(xid)); -+ xid.formatID= -1; -+ wsrep_get_SE_checkpoint(&xid); -+ -+ if (xid.formatID == -1) -+ { -+ WSREP_INFO("Read nil XID from storage engines, skipping position init"); -+ return; -+ } -+ else if (!wsrep_is_wsrep_xid(&xid)) -+ { -+ WSREP_WARN("Read non-wsrep XID from storage engines, skipping position init"); -+ return; -+ } -+ -+ const wsrep_uuid_t* uuid= wsrep_xid_uuid(&xid); -+ const wsrep_seqno_t seqno= wsrep_xid_seqno(&xid); -+ -+ char uuid_str[40] = {0, }; -+ wsrep_uuid_print(uuid, uuid_str, sizeof(uuid_str)); -+ WSREP_INFO("Initial position: %s:%lld", uuid_str, (long long)seqno); -+ -+ -+ if (!memcmp(&local_uuid, &WSREP_UUID_UNDEFINED, sizeof(local_uuid)) && -+ local_seqno == WSREP_SEQNO_UNDEFINED) -+ { -+ // Initial state -+ local_uuid= *uuid; -+ local_seqno= seqno; -+ } -+ else if (memcmp(&local_uuid, uuid, sizeof(local_uuid)) || -+ local_seqno != seqno) -+ { -+ WSREP_WARN("Initial position was provided by configuration or SST, " -+ "avoiding override"); -+ } -+} -+ -+int wsrep_init() -+{ -+ int rcode= -1; -+ -+ wsrep_ready_set(FALSE); -+ assert(wsrep_provider); -+ -+ wsrep_init_position(); -+ -+ if ((rcode= wsrep_load(wsrep_provider, &wsrep, wsrep_log_cb)) != WSREP_OK) -+ { -+ if (strcasecmp(wsrep_provider, WSREP_NONE)) -+ { -+ WSREP_ERROR("wsrep_load(%s) failed: %s (%d). Reverting to no provider.", -+ wsrep_provider, strerror(rcode), rcode); -+ strcpy((char*)wsrep_provider, WSREP_NONE); // damn it's a dirty hack -+ (void) wsrep_init(); -+ return rcode; -+ } -+ else /* this is for recursive call above */ -+ { -+ WSREP_ERROR("Could not revert to no provider: %s (%d). Need to abort.", -+ strerror(rcode), rcode); -+ unireg_abort(1); -+ } -+ } -+ -+ if (strlen(wsrep_provider)== 0 || -+ !strcmp(wsrep_provider, WSREP_NONE)) -+ { -+ // enable normal operation in case no provider is specified -+ wsrep_ready_set(TRUE); -+ global_system_variables.wsrep_on = 0; -+ return 0; -+ } -+ else -+ { -+ global_system_variables.wsrep_on = 1; -+ strncpy(provider_name, -+ wsrep->provider_name, sizeof(provider_name) - 1); -+ strncpy(provider_version, -+ wsrep->provider_version, sizeof(provider_version) - 1); -+ strncpy(provider_vendor, -+ wsrep->provider_vendor, sizeof(provider_vendor) - 1); -+ } -+ -+ if (!wsrep_data_home_dir || strlen(wsrep_data_home_dir) == 0) -+ wsrep_data_home_dir = mysql_real_data_home; -+ -+ char node_addr[512]= { 0, }; -+ size_t const node_addr_max= sizeof(node_addr) - 1; -+ if (!wsrep_node_address || !strcmp(wsrep_node_address, "")) -+ { -+ size_t const ret= wsrep_guess_ip(node_addr, node_addr_max); -+ if (!(ret > 0 && ret < node_addr_max)) -+ { -+ WSREP_WARN("Failed to guess base node address. Set it explicitly via " -+ "wsrep_node_address."); -+ node_addr[0]= '\0'; -+ } -+ } -+ else -+ { -+ strncpy(node_addr, wsrep_node_address, node_addr_max); -+ } -+ -+ char inc_addr[512]= { 0, }; -+ size_t const inc_addr_max= sizeof (inc_addr); -+ if ((!wsrep_node_incoming_address || -+ !strcmp (wsrep_node_incoming_address, WSREP_NODE_INCOMING_AUTO))) -+ { -+ unsigned int my_bind_ip= INADDR_ANY; // default if not set -+ if (my_bind_addr_str && strlen(my_bind_addr_str)) -+ { -+ my_bind_ip= wsrep_check_ip(my_bind_addr_str); -+ } -+ -+ if (INADDR_ANY != my_bind_ip) -+ { -+ if (INADDR_NONE != my_bind_ip && INADDR_LOOPBACK != my_bind_ip) -+ { -+ snprintf(inc_addr, inc_addr_max, "%s:%u", -+ my_bind_addr_str, (int)mysqld_port); -+ } // else leave inc_addr an empty string - mysqld is not listening for -+ // client connections on network interfaces. -+ } -+ else // mysqld binds to 0.0.0.0, take IP from wsrep_node_address if possible -+ { -+ size_t const node_addr_len= strlen(node_addr); -+ if (node_addr_len > 0) -+ { -+ const char* const colon= strrchr(node_addr, ':'); -+ if (strchr(node_addr, ':') == colon) // 1 or 0 ':' -+ { -+ size_t const ip_len= colon ? colon - node_addr : node_addr_len; -+ if (ip_len + 7 /* :55555\0 */ < inc_addr_max) -+ { -+ memcpy (inc_addr, node_addr, ip_len); -+ snprintf(inc_addr + ip_len, inc_addr_max - ip_len, ":%u", -+ (int)mysqld_port); -+ } -+ else -+ { -+ WSREP_WARN("Guessing address for incoming client connections: " -+ "address too long."); -+ inc_addr[0]= '\0'; -+ } -+ } -+ else -+ { -+ WSREP_WARN("Guessing address for incoming client connections: " -+ "too many colons :) ."); -+ inc_addr[0]= '\0'; -+ } -+ } -+ -+ if (!strlen(inc_addr)) -+ { -+ WSREP_WARN("Guessing address for incoming client connections failed. " -+ "Try setting wsrep_node_incoming_address explicitly."); -+ } -+ } -+ } -+ else if (!strchr(wsrep_node_incoming_address, ':')) // no port included -+ { -+ if ((int)inc_addr_max <= -+ snprintf(inc_addr, inc_addr_max, "%s:%u", -+ wsrep_node_incoming_address,(int)mysqld_port)) -+ { -+ WSREP_WARN("Guessing address for incoming client connections: " -+ "address too long."); -+ inc_addr[0]= '\0'; -+ } -+ } -+ else -+ { -+ size_t const need = strlen (wsrep_node_incoming_address); -+ if (need >= inc_addr_max) { -+ WSREP_WARN("wsrep_node_incoming_address too long: %zu", need); -+ inc_addr[0]= '\0'; -+ } -+ else { -+ memcpy (inc_addr, wsrep_node_incoming_address, need); -+ } -+ } -+ -+ struct wsrep_init_args wsrep_args; -+ -+ struct wsrep_gtid const state_id = { local_uuid, local_seqno }; -+ -+ wsrep_args.data_dir = wsrep_data_home_dir; -+ wsrep_args.node_name = (wsrep_node_name) ? wsrep_node_name : ""; -+ wsrep_args.node_address = node_addr; -+ wsrep_args.node_incoming = inc_addr; -+ wsrep_args.options = (wsrep_provider_options) ? -+ wsrep_provider_options : ""; -+ wsrep_args.proto_ver = wsrep_max_protocol_version; -+ -+ wsrep_args.state_id = &state_id; -+ -+ wsrep_args.logger_cb = wsrep_log_cb; -+ wsrep_args.view_handler_cb = wsrep_view_handler_cb; -+ wsrep_args.apply_cb = wsrep_apply_cb; -+ wsrep_args.commit_cb = wsrep_commit_cb; -+ wsrep_args.unordered_cb = wsrep_unordered_cb; -+ wsrep_args.sst_donate_cb = wsrep_sst_donate_cb; -+ wsrep_args.synced_cb = wsrep_synced_cb; -+ -+ rcode = wsrep->init(wsrep, &wsrep_args); -+ -+ if (rcode) -+ { -+ DBUG_PRINT("wsrep",("wsrep::init() failed: %d", rcode)); -+ WSREP_ERROR("wsrep::init() failed: %d, must shutdown", rcode); -+ free(wsrep); -+ wsrep = NULL; -+ } -+ -+ return rcode; -+} -+ -+extern int wsrep_on(void *); -+ -+void wsrep_init_startup (bool first) -+{ -+ if (wsrep_init()) unireg_abort(1); -+ -+ wsrep_thr_lock_init(wsrep_thd_is_BF, wsrep_abort_thd, -+ wsrep_debug, wsrep_convert_LOCK_to_trx, wsrep_on); -+ -+ /* Skip replication start if no cluster address */ -+ if (!wsrep_cluster_address || strlen(wsrep_cluster_address) == 0) return; -+ -+ if (first) wsrep_sst_grab(); // do it so we can wait for SST below -+ -+ if (!wsrep_start_replication()) unireg_abort(1); -+ -+ wsrep_create_rollbacker(); -+ wsrep_create_appliers(1); -+ -+ if (first && !wsrep_sst_wait()) unireg_abort(1);// wait until SST is completed -+} -+ -+ -+void wsrep_deinit() -+{ -+ wsrep_unload(wsrep); -+ wsrep= 0; -+ provider_name[0]= '\0'; -+ provider_version[0]= '\0'; -+ provider_vendor[0]= '\0'; -+} -+ -+void wsrep_recover() -+{ -+ if (!memcmp(&local_uuid, &WSREP_UUID_UNDEFINED, sizeof(wsrep_uuid_t)) && -+ local_seqno == -2) -+ { -+ char uuid_str[40]; -+ wsrep_uuid_print(&local_uuid, uuid_str, sizeof(uuid_str)); -+ WSREP_INFO("Position %s:%lld given at startup, skipping position recovery", -+ uuid_str, (long long)local_seqno); -+ return; -+ } -+ XID xid; -+ memset(&xid, 0, sizeof(xid)); -+ xid.formatID= -1; -+ wsrep_get_SE_checkpoint(&xid); -+ char uuid_str[40]; -+ wsrep_uuid_print(wsrep_xid_uuid(&xid), uuid_str, sizeof(uuid_str)); -+ WSREP_INFO("Recovered position: %s:%lld", uuid_str, -+ (long long)wsrep_xid_seqno(&xid)); -+} -+ -+ -+void wsrep_stop_replication(THD *thd) -+{ -+ WSREP_INFO("Stop replication"); -+ if (!wsrep) -+ { -+ WSREP_INFO("Provider was not loaded, in stop replication"); -+ return; -+ } -+ -+ /* disconnect from group first to get wsrep_ready == FALSE */ -+ WSREP_DEBUG("Provider disconnect"); -+ wsrep->disconnect(wsrep); -+ -+ wsrep_connected= FALSE; -+ -+ wsrep_close_client_connections(TRUE); -+ -+ /* wait until appliers have stopped */ -+ wsrep_wait_appliers_close(thd); -+ -+ return; -+} -+ -+/* This one is set to true when --wsrep-new-cluster is found in the command -+ * line arguments */ -+static my_bool wsrep_new_cluster= FALSE; -+#define WSREP_NEW_CLUSTER "--wsrep-new-cluster" -+/* Finds and hides --wsrep-new-cluster from the arguments list -+ * by moving it to the end of the list and decrementing argument count */ -+void wsrep_filter_new_cluster (int* argc, char* argv[]) -+{ -+ int i; -+ for (i= *argc - 1; i > 0; i--) -+ { -+ /* make a copy of the argument to convert possible underscores to hyphens. -+ * the copy need not to be longer than WSREP_NEW_CLUSTER option */ -+ char arg[sizeof(WSREP_NEW_CLUSTER) + 2]= { 0, }; -+ strncpy(arg, argv[i], sizeof(arg) - 1); -+ char* underscore; -+ while (NULL != (underscore= strchr(arg, '_'))) *underscore= '-'; -+ -+ if (!strcmp(arg, WSREP_NEW_CLUSTER)) -+ { -+ wsrep_new_cluster= TRUE; -+ *argc -= 1; -+ /* preserve the order of remaining arguments AND -+ * preserve the original argument pointers - just in case */ -+ char* wnc= argv[i]; -+ memmove(&argv[i], &argv[i + 1], (*argc - i)*sizeof(argv[i])); -+ argv[*argc]= wnc; /* this will be invisible to the rest of the program */ -+ } -+ } -+} -+ -+bool wsrep_start_replication() -+{ -+ wsrep_status_t rcode; -+ -+ /* -+ if provider is trivial, don't even try to connect, -+ but resume local node operation -+ */ -+ if (strlen(wsrep_provider)== 0 || -+ !strcmp(wsrep_provider, WSREP_NONE)) -+ { -+ // enable normal operation in case no provider is specified -+ wsrep_ready_set(TRUE); -+ return true; -+ } -+ -+ if (!wsrep_cluster_address || strlen(wsrep_cluster_address)== 0) -+ { -+ // if provider is non-trivial, but no address is specified, wait for address -+ wsrep_ready_set(FALSE); -+ return true; -+ } -+ -+ bool const bootstrap(TRUE == wsrep_new_cluster); -+ wsrep_new_cluster= FALSE; -+ -+ WSREP_INFO("Start replication"); -+ -+ if ((rcode = wsrep->connect(wsrep, -+ wsrep_cluster_name, -+ wsrep_cluster_address, -+ wsrep_sst_donor, -+ bootstrap))) -+ { -+ if (-ESOCKTNOSUPPORT == rcode) -+ { -+ DBUG_PRINT("wsrep",("unrecognized cluster address: '%s', rcode: %d", -+ wsrep_cluster_address, rcode)); -+ WSREP_ERROR("unrecognized cluster address: '%s', rcode: %d", -+ wsrep_cluster_address, rcode); -+ } -+ else -+ { -+ DBUG_PRINT("wsrep",("wsrep->connect() failed: %d", rcode)); -+ WSREP_ERROR("wsrep::connect() failed: %d", rcode); -+ } -+ -+ return false; -+ } -+ else -+ { -+ wsrep_connected= TRUE; -+ -+ char* opts= wsrep->options_get(wsrep); -+ if (opts) -+ { -+ wsrep_provider_options_init(opts); -+ free(opts); -+ } -+ else -+ { -+ WSREP_WARN("Failed to get wsrep options"); -+ } -+ } -+ -+ return true; -+} -+ -+bool -+wsrep_causal_wait (THD* thd) -+{ -+ if (thd->variables.wsrep_causal_reads && thd->variables.wsrep_on && -+ !thd->in_active_multi_stmt_transaction() && -+ thd->wsrep_conflict_state != REPLAYING) -+ { -+ // This allows autocommit SELECTs and a first SELECT after SET AUTOCOMMIT=0 -+ // TODO: modify to check if thd has locked any rows. -+ wsrep_gtid_t gtid; -+ wsrep_status_t ret= wsrep->causal_read (wsrep, >id); -+ -+ if (unlikely(WSREP_OK != ret)) -+ { -+ const char* msg; -+ int err; -+ -+ // Possibly relevant error codes: -+ // ER_CHECKREAD, ER_ERROR_ON_READ, ER_INVALID_DEFAULT, ER_EMPTY_QUERY, -+ // ER_FUNCTION_NOT_DEFINED, ER_NOT_ALLOWED_COMMAND, ER_NOT_SUPPORTED_YET, -+ // ER_FEATURE_DISABLED, ER_QUERY_INTERRUPTED -+ -+ switch (ret) -+ { -+ case WSREP_NOT_IMPLEMENTED: -+ msg= "consistent reads by wsrep backend. " -+ "Please unset wsrep_causal_reads variable."; -+ err= ER_NOT_SUPPORTED_YET; -+ break; -+ default: -+ msg= "Causal wait failed."; -+ err= ER_LOCK_WAIT_TIMEOUT; // NOTE: the above msg won't be displayed -+ // with ER_LOCK_WAIT_TIMEOUT -+ } -+ -+ my_error(err, MYF(0), msg); -+ -+ return true; -+ } -+ } -+ -+ return false; -+} -+ -+/* -+ * Helpers to deal with TOI key arrays -+ */ -+typedef struct wsrep_key_arr -+{ -+ wsrep_key_t* keys; -+ size_t keys_len; -+} wsrep_key_arr_t; -+ -+ -+static void wsrep_keys_free(wsrep_key_arr_t* key_arr) -+{ -+ for (size_t i= 0; i < key_arr->keys_len; ++i) -+ { -+ my_free((void*)key_arr->keys[i].key_parts); -+ } -+ my_free(key_arr->keys); -+ key_arr->keys= 0; -+ key_arr->keys_len= 0; -+} -+ -+ -+/*! -+ * @param db Database string -+ * @param table Table string -+ * @param key Array of wsrep_key_t -+ * @param key_len In: number of elements in key array, Out: number of -+ * elements populated -+ * -+ * @return true if preparation was successful, otherwise false. -+ */ -+ -+static bool wsrep_prepare_key_for_isolation(const char* db, -+ const char* table, -+ wsrep_buf_t* key, -+ size_t* key_len) -+{ -+ if (*key_len < 2) return false; -+ -+ switch (wsrep_protocol_version) -+ { -+ case 0: -+ *key_len= 0; -+ break; -+ case 1: -+ case 2: -+ { -+ *key_len= 0; -+ if (db) -+ { -+ // sql_print_information("%s.%s", db, table); -+ if (db) -+ { -+ key[*key_len].ptr= db; -+ key[*key_len].len= strlen(db); -+ ++(*key_len); -+ if (table) -+ { -+ key[*key_len].ptr= table; -+ key[*key_len].len= strlen(table); -+ ++(*key_len); -+ } -+ } -+ } -+ break; -+ } -+ default: -+ return false; -+ } -+ -+ return true; -+} -+ -+/* Prepare key list from db/table and table_list */ -+static bool wsrep_prepare_keys_for_isolation(THD* thd, -+ const char* db, -+ const char* table, -+ const TABLE_LIST* table_list, -+ wsrep_key_arr_t* ka) -+{ -+ ka->keys= 0; -+ ka->keys_len= 0; -+ -+ extern TABLE* find_temporary_table(THD*, const TABLE_LIST*); -+ -+ if (db || table) -+ { -+ TABLE_LIST tmp_table; -+ MDL_request mdl_request; -+ -+ memset(&tmp_table, 0, sizeof(tmp_table)); -+ tmp_table.table_name= (char*)table; -+ tmp_table.db= (char*)db; -+ tmp_table.mdl_request.init(MDL_key::GLOBAL, (db) ? db : "", -+ (table) ? table : "", -+ MDL_INTENTION_EXCLUSIVE, MDL_STATEMENT); -+ -+ if (!table || !find_temporary_table(thd, &tmp_table)) -+ { -+ if (!(ka->keys= (wsrep_key_t*)my_malloc(sizeof(wsrep_key_t), MYF(0)))) -+ { -+ WSREP_ERROR("Can't allocate memory for key_array"); -+ goto err; -+ } -+ ka->keys_len= 1; -+ if (!(ka->keys[0].key_parts= (wsrep_buf_t*) -+ my_malloc(sizeof(wsrep_buf_t)*2, MYF(0)))) -+ { -+ WSREP_ERROR("Can't allocate memory for key_parts"); -+ goto err; -+ } -+ ka->keys[0].key_parts_num= 2; -+ if (!wsrep_prepare_key_for_isolation( -+ db, table, -+ (wsrep_buf_t*)ka->keys[0].key_parts, -+ &ka->keys[0].key_parts_num)) -+ { -+ WSREP_ERROR("Preparing keys for isolation failed"); -+ goto err; -+ } -+ } -+ } -+ -+ for (const TABLE_LIST* table= table_list; table; table= table->next_global) -+ { -+ if (!find_temporary_table(thd, table)) -+ { -+ wsrep_key_t* tmp; -+ tmp= (wsrep_key_t*)my_realloc( -+ ka->keys, (ka->keys_len + 1) * sizeof(wsrep_key_t), MYF(0)); -+ if (!tmp) -+ { -+ WSREP_ERROR("Can't allocate memory for key_array"); -+ goto err; -+ } -+ ka->keys= tmp; -+ if (!(ka->keys[ka->keys_len].key_parts= (wsrep_buf_t*) -+ my_malloc(sizeof(wsrep_buf_t)*2, MYF(0)))) -+ { -+ WSREP_ERROR("Can't allocate memory for key_parts"); -+ goto err; -+ } -+ ka->keys[ka->keys_len].key_parts_num= 2; -+ ++ka->keys_len; -+ if (!wsrep_prepare_key_for_isolation( -+ table->db, table->table_name, -+ (wsrep_buf_t*)ka->keys[ka->keys_len - 1].key_parts, -+ &ka->keys[ka->keys_len - 1].key_parts_num)) -+ { -+ WSREP_ERROR("Preparing keys for isolation failed"); -+ goto err; -+ } -+ } -+ } -+ return true; -+err: -+ wsrep_keys_free(ka); -+ return false; -+} -+ -+ -+bool wsrep_prepare_key_for_innodb(const uchar* cache_key, -+ size_t cache_key_len, -+ const uchar* row_id, -+ size_t row_id_len, -+ wsrep_buf_t* key, -+ size_t* key_len) -+{ -+ if (*key_len < 3) return false; -+ -+ *key_len= 0; -+ switch (wsrep_protocol_version) -+ { -+ case 0: -+ { -+ key[0].ptr = cache_key; -+ key[0].len = cache_key_len; -+ -+ *key_len = 1; -+ break; -+ } -+ case 1: -+ case 2: -+ { -+ key[0].ptr = cache_key; -+ key[0].len = strlen( (char*)cache_key ); -+ -+ key[1].ptr = cache_key + strlen( (char*)cache_key ) + 1; -+ key[1].len = strlen( (char*)(key[1].ptr) ); -+ -+ *key_len = 2; -+ break; -+ } -+ default: -+ return false; -+ } -+ -+ key[*key_len].ptr = row_id; -+ key[*key_len].len = row_id_len; -+ ++(*key_len); -+ -+ return true; -+} -+ -+ -+/* -+ * Construct Query_log_Event from thd query and serialize it -+ * into buffer. -+ * -+ * Return 0 in case of success, 1 in case of error. -+ */ -+int wsrep_to_buf_helper( -+ THD* thd, const char *query, uint query_len, uchar** buf, size_t* buf_len) -+{ -+ IO_CACHE tmp_io_cache; -+ if (open_cached_file(&tmp_io_cache, mysql_tmpdir, TEMP_PREFIX, -+ 65536, MYF(MY_WME))) -+ return 1; -+ int ret(0); -+ -+ if (thd->variables.gtid_next.type == GTID_GROUP) -+ { -+ Gtid_log_event gtid_ev(thd, FALSE, &thd->variables.gtid_next); -+ if (!gtid_ev.is_valid()) ret= 0; -+ if (!ret && gtid_ev.write(&tmp_io_cache)) ret= 1; -+ } -+ -+ /* if there is prepare query, add event for it */ -+ if (!ret && thd->wsrep_TOI_pre_query) -+ { -+ Query_log_event ev(thd, thd->wsrep_TOI_pre_query, -+ thd->wsrep_TOI_pre_query_len, -+ FALSE, FALSE, FALSE, 0); -+ if (ev.write(&tmp_io_cache)) ret= 1; -+ } -+ -+ /* continue to append the actual query */ -+ Query_log_event ev(thd, query, query_len, FALSE, FALSE, FALSE, 0); -+ if (!ret && ev.write(&tmp_io_cache)) ret= 1; -+ if (!ret && wsrep_write_cache_buf(&tmp_io_cache, buf, buf_len)) ret= 1; -+ close_cached_file(&tmp_io_cache); -+ return ret; -+} -+ -+#include "sql_show.h" -+static int -+create_view_query(THD *thd, uchar** buf, size_t* buf_len) -+{ -+ LEX *lex= thd->lex; -+ SELECT_LEX *select_lex= &lex->select_lex; -+ TABLE_LIST *first_table= select_lex->table_list.first; -+ TABLE_LIST *views = first_table; -+ -+ String buff; -+ const LEX_STRING command[3]= -+ {{ C_STRING_WITH_LEN("CREATE ") }, -+ { C_STRING_WITH_LEN("ALTER ") }, -+ { C_STRING_WITH_LEN("CREATE OR REPLACE ") }}; -+ -+ buff.append(command[thd->lex->create_view_mode].str, -+ command[thd->lex->create_view_mode].length); -+ -+ if (!lex->definer) -+ { -+ /* -+ DEFINER-clause is missing; we have to create default definer in -+ persistent arena to be PS/SP friendly. -+ If this is an ALTER VIEW then the current user should be set as -+ the definer. -+ */ -+ -+ if (!(lex->definer= create_default_definer(thd))) -+ { -+ WSREP_WARN("view default definer issue"); -+ } -+ } -+ -+ views->algorithm = lex->create_view_algorithm; -+ views->definer.user = lex->definer->user; -+ views->definer.host = lex->definer->host; -+ views->view_suid = lex->create_view_suid; -+ views->with_check = lex->create_view_check; -+ -+ view_store_options(thd, views, &buff); -+ buff.append(STRING_WITH_LEN("VIEW ")); -+ /* Test if user supplied a db (ie: we did not use thd->db) */ -+ if (views->db && views->db[0] && -+ (thd->db == NULL || strcmp(views->db, thd->db))) -+ { -+ append_identifier(thd, &buff, views->db, -+ views->db_length); -+ buff.append('.'); -+ } -+ append_identifier(thd, &buff, views->table_name, -+ views->table_name_length); -+ if (lex->view_list.elements) -+ { -+ List_iterator_fast names(lex->view_list); -+ LEX_STRING *name; -+ int i; -+ -+ for (i= 0; (name= names++); i++) -+ { -+ buff.append(i ? ", " : "("); -+ append_identifier(thd, &buff, name->str, name->length); -+ } -+ buff.append(')'); -+ } -+ buff.append(STRING_WITH_LEN(" AS ")); -+ //buff.append(views->source.str, views->source.length); -+ buff.append(thd->lex->create_view_select.str, -+ thd->lex->create_view_select.length); -+ //int errcode= query_error_code(thd, TRUE); -+ //if (thd->binlog_query(THD::STMT_QUERY_TYPE, -+ // buff.ptr(), buff.length(), FALSE, FALSE, FALSE, errcod -+ return wsrep_to_buf_helper(thd, buff.ptr(), buff.length(), buf, buf_len); -+} -+ -+static int wsrep_TOI_begin(THD *thd, char *db_, char *table_, -+ const TABLE_LIST* table_list) -+{ -+ wsrep_status_t ret(WSREP_WARNING); -+ uchar* buf(0); -+ size_t buf_len(0); -+ int buf_err; -+ -+ WSREP_DEBUG("TO BEGIN: %lld, %d : %s", (long long)wsrep_thd_trx_seqno(thd), -+ thd->wsrep_exec_mode, thd->query() ); -+ switch (thd->lex->sql_command) -+ { -+ case SQLCOM_CREATE_VIEW: -+ buf_err= create_view_query(thd, &buf, &buf_len); -+ break; -+ case SQLCOM_CREATE_PROCEDURE: -+ case SQLCOM_CREATE_SPFUNCTION: -+ buf_err= wsrep_create_sp(thd, &buf, &buf_len); -+ break; -+ case SQLCOM_CREATE_TRIGGER: -+ buf_err= wsrep_create_trigger_query(thd, &buf, &buf_len); -+ break; -+ case SQLCOM_CREATE_EVENT: -+ buf_err= wsrep_create_event_query(thd, &buf, &buf_len); -+ break; -+ default: -+ buf_err= wsrep_to_buf_helper(thd, thd->query(), thd->query_length(), &buf, -+ &buf_len); -+ break; -+ } -+ -+ wsrep_key_arr_t key_arr= {0, 0}; -+ struct wsrep_buf buff = { buf, buf_len }; -+ if (!buf_err && -+ wsrep_prepare_keys_for_isolation(thd, db_, table_, table_list, &key_arr)&& -+ WSREP_OK == (ret = wsrep->to_execute_start(wsrep, thd->thread_id, -+ key_arr.keys, key_arr.keys_len, -+ &buff, 1, -+ &thd->wsrep_trx_meta))) -+ { -+ thd->wsrep_exec_mode= TOTAL_ORDER; -+ wsrep_to_isolation++; -+ if (buf) my_free(buf); -+ wsrep_keys_free(&key_arr); -+ WSREP_DEBUG("TO BEGIN: %lld, %d",(long long)wsrep_thd_trx_seqno(thd), -+ thd->wsrep_exec_mode); -+ } -+ else { -+ /* jump to error handler in mysql_execute_command() */ -+ WSREP_WARN("TO isolation failed for: %d, sql: %s. Check wsrep " -+ "connection state and retry the query.", -+ ret, (thd->query()) ? thd->query() : "void"); -+ my_error(ER_LOCK_DEADLOCK, MYF(0), "WSREP replication failed. Check " -+ "your wsrep connection state and retry the query."); -+ if (buf) my_free(buf); -+ wsrep_keys_free(&key_arr); -+ return -1; -+ } -+ return 0; -+} -+ -+static void wsrep_TOI_end(THD *thd) { -+ wsrep_status_t ret; -+ wsrep_to_isolation--; -+ -+ WSREP_DEBUG("TO END: %lld, %d : %s", (long long)wsrep_thd_trx_seqno(thd), -+ thd->wsrep_exec_mode, (thd->query()) ? thd->query() : "void"); -+ if (WSREP_OK == (ret = wsrep->to_execute_end(wsrep, thd->thread_id))) { -+ WSREP_DEBUG("TO END: %lld", (long long)wsrep_thd_trx_seqno(thd)); -+ } -+ else { -+ WSREP_WARN("TO isolation end failed for: %d, sql: %s", -+ ret, (thd->query()) ? thd->query() : "void"); -+ } -+} -+ -+static int wsrep_RSU_begin(THD *thd, char *db_, char *table_) -+{ -+ wsrep_status_t ret(WSREP_WARNING); -+ WSREP_DEBUG("RSU BEGIN: %lld, %d : %s", (long long)wsrep_thd_trx_seqno(thd), -+ thd->wsrep_exec_mode, thd->query() ); -+ -+ ret = wsrep->desync(wsrep); -+ if (ret != WSREP_OK) -+ { -+ WSREP_WARN("RSU desync failed %d for %s", ret, thd->query()); -+ my_error(ER_LOCK_DEADLOCK, MYF(0)); -+ return(ret); -+ } -+ mysql_mutex_lock(&LOCK_wsrep_replaying); -+ wsrep_replaying++; -+ mysql_mutex_unlock(&LOCK_wsrep_replaying); -+ -+ if (wsrep_wait_committing_connections_close(5000)) -+ { -+ /* no can do, bail out from DDL */ -+ WSREP_WARN("RSU failed due to pending transactions, %s", thd->query()); -+ mysql_mutex_lock(&LOCK_wsrep_replaying); -+ wsrep_replaying--; -+ mysql_mutex_unlock(&LOCK_wsrep_replaying); -+ -+ ret = wsrep->resync(wsrep); -+ if (ret != WSREP_OK) -+ { -+ WSREP_WARN("resync failed %d for %s", ret, thd->query()); -+ } -+ my_error(ER_LOCK_DEADLOCK, MYF(0)); -+ return(1); -+ } -+ -+ wsrep_seqno_t seqno = wsrep->pause(wsrep); -+ if (seqno == WSREP_SEQNO_UNDEFINED) -+ { -+ WSREP_WARN("pause failed %lld for %s", (long long)seqno, thd->query()); -+ return(1); -+ } -+ WSREP_DEBUG("paused at %lld", (long long)seqno); -+ thd->variables.wsrep_on = 0; -+ return 0; -+} -+ -+static void wsrep_RSU_end(THD *thd) -+{ -+ wsrep_status_t ret(WSREP_WARNING); -+ WSREP_DEBUG("RSU END: %lld, %d : %s", (long long)wsrep_thd_trx_seqno(thd), -+ thd->wsrep_exec_mode, thd->query() ); -+ -+ -+ mysql_mutex_lock(&LOCK_wsrep_replaying); -+ wsrep_replaying--; -+ mysql_mutex_unlock(&LOCK_wsrep_replaying); -+ -+ ret = wsrep->resume(wsrep); -+ if (ret != WSREP_OK) -+ { -+ WSREP_WARN("resume failed %d for %s", ret, thd->query()); -+ } -+ ret = wsrep->resync(wsrep); -+ if (ret != WSREP_OK) -+ { -+ WSREP_WARN("resync failed %d for %s", ret, thd->query()); -+ return; -+ } -+ thd->variables.wsrep_on = 1; -+} -+ -+int wsrep_to_isolation_begin(THD *thd, char *db_, char *table_, -+ const TABLE_LIST* table_list) -+{ -+ -+ /* -+ No isolation for applier or replaying threads. -+ */ -+ if (thd->wsrep_exec_mode == REPL_RECV) return 0; -+ -+ int ret= 0; -+ mysql_mutex_lock(&thd->LOCK_wsrep_thd); -+ -+ if (thd->wsrep_conflict_state == MUST_ABORT) -+ { -+ WSREP_INFO("thread: %lu, %s has been aborted due to multi-master conflict", -+ thd->thread_id, thd->query()); -+ mysql_mutex_unlock(&thd->LOCK_wsrep_thd); -+ return WSREP_TRX_FAIL; -+ } -+ mysql_mutex_unlock(&thd->LOCK_wsrep_thd); -+ -+ DBUG_ASSERT(thd->wsrep_exec_mode == LOCAL_STATE); -+ DBUG_ASSERT(thd->wsrep_trx_meta.gtid.seqno == WSREP_SEQNO_UNDEFINED); -+ -+ if (thd->global_read_lock.can_acquire_protection()) -+ { -+ WSREP_DEBUG("Aborting TOI: Global Read-Lock (FTWRL) in place: %s %lu", -+ thd->query(), thd->thread_id); -+ return -1; -+ } -+ -+ if (wsrep_debug && thd->mdl_context.has_locks()) -+ { -+ WSREP_DEBUG("thread holds MDL locks at TI begin: %s %lu", -+ thd->query(), thd->thread_id); -+ } -+ -+ /* -+ It makes sense to set auto_increment_* to defaults in TOI operations. -+ Must be done before wsrep_TOI_begin() since Query_log_event encapsulating -+ TOI statement and auto inc variables for wsrep replication is constructed -+ there. Variables are reset back in THD::reset_for_next_command() before -+ processing of next command. -+ */ -+ if (wsrep_auto_increment_control) -+ { -+ thd->variables.auto_increment_offset = 1; -+ thd->variables.auto_increment_increment = 1; -+ } -+ -+ if (thd->variables.wsrep_on && thd->wsrep_exec_mode==LOCAL_STATE) -+ { -+ switch (wsrep_OSU_method_options) { -+ case WSREP_OSU_TOI: ret = wsrep_TOI_begin(thd, db_, table_, -+ table_list); break; -+ case WSREP_OSU_RSU: ret = wsrep_RSU_begin(thd, db_, table_); break; -+ } -+ if (!ret) -+ { -+ thd->wsrep_exec_mode= TOTAL_ORDER; -+ } -+ } -+ return ret; -+} -+ -+void wsrep_to_isolation_end(THD *thd) -+{ -+ if (thd->wsrep_exec_mode == TOTAL_ORDER) -+ { -+ switch(wsrep_OSU_method_options) -+ { -+ case WSREP_OSU_TOI: wsrep_TOI_end(thd); break; -+ case WSREP_OSU_RSU: wsrep_RSU_end(thd); break; -+ } -+ wsrep_cleanup_transaction(thd); -+ } -+} -+ -+#define WSREP_MDL_LOG(severity, msg, req, gra) \ -+ WSREP_##severity( \ -+ "%s\n" \ -+ "request: (%lu \tseqno %lld \twsrep (%d, %d, %d) cmd %d %d \t%s)\n" \ -+ "granted: (%lu \tseqno %lld \twsrep (%d, %d, %d) cmd %d %d \t%s)", \ -+ msg, \ -+ req->thread_id, (long long)wsrep_thd_trx_seqno(req), \ -+ req->wsrep_exec_mode, req->wsrep_query_state, req->wsrep_conflict_state, \ -+ req->get_command(), req->lex->sql_command, req->query(), \ -+ gra->thread_id, (long long)wsrep_thd_trx_seqno(gra), \ -+ gra->wsrep_exec_mode, gra->wsrep_query_state, gra->wsrep_conflict_state, \ -+ gra->get_command(), gra->lex->sql_command, gra->query()); -+ -+bool -+wsrep_grant_mdl_exception(MDL_context *requestor_ctx, -+ MDL_ticket *ticket -+) { -+ if (!WSREP_ON) return FALSE; -+ -+ THD *request_thd = requestor_ctx->wsrep_get_thd(); -+ THD *granted_thd = ticket->get_ctx()->wsrep_get_thd(); -+ bool ret = FALSE; -+ -+ mysql_mutex_lock(&request_thd->LOCK_wsrep_thd); -+ if (request_thd->wsrep_exec_mode == TOTAL_ORDER || -+ request_thd->wsrep_exec_mode == REPL_RECV) -+ { -+ mysql_mutex_unlock(&request_thd->LOCK_wsrep_thd); -+ WSREP_MDL_LOG(DEBUG, "MDL conflict ", request_thd, granted_thd); -+ ticket->wsrep_report(wsrep_debug); -+ -+ mysql_mutex_lock(&granted_thd->LOCK_wsrep_thd); -+ if (granted_thd->wsrep_exec_mode == TOTAL_ORDER || -+ granted_thd->wsrep_exec_mode == REPL_RECV) -+ { -+ WSREP_MDL_LOG(INFO, "MDL BF-BF conflict", request_thd, granted_thd); -+ ticket->wsrep_report(true); -+ mysql_mutex_unlock(&granted_thd->LOCK_wsrep_thd); -+ ret = TRUE; -+ } -+ else if (granted_thd->lex->sql_command == SQLCOM_FLUSH) -+ { -+ WSREP_DEBUG("mdl granted over FLUSH BF"); -+ ticket->wsrep_report(wsrep_debug); -+ mysql_mutex_unlock(&granted_thd->LOCK_wsrep_thd); -+ ret = TRUE; -+ } -+ else if (request_thd->lex->sql_command == SQLCOM_DROP_TABLE) -+ { -+ WSREP_DEBUG("DROP caused BF abort"); -+ ticket->wsrep_report(wsrep_debug); -+ mysql_mutex_unlock(&granted_thd->LOCK_wsrep_thd); -+ wsrep_abort_thd((void*)request_thd, (void*)granted_thd, 1); -+ ret = FALSE; -+ } -+ else if (granted_thd->wsrep_query_state == QUERY_COMMITTING) -+ { -+ WSREP_DEBUG("mdl granted, but commiting thd abort scheduled"); -+ ticket->wsrep_report(wsrep_debug); -+ mysql_mutex_unlock(&granted_thd->LOCK_wsrep_thd); -+ wsrep_abort_thd((void*)request_thd, (void*)granted_thd, 1); -+ ret = FALSE; -+ } -+ else -+ { -+ WSREP_MDL_LOG(DEBUG, "MDL conflict-> BF abort", request_thd, granted_thd); -+ ticket->wsrep_report(wsrep_debug); -+ mysql_mutex_unlock(&granted_thd->LOCK_wsrep_thd); -+ wsrep_abort_thd((void*)request_thd, (void*)granted_thd, 1); -+ ret = FALSE; -+ } -+ } -+ else -+ { -+ mysql_mutex_unlock(&request_thd->LOCK_wsrep_thd); -+ } -+ return ret; -+} - -=== added file 'sql/wsrep_mysqld.h' ---- old/sql/wsrep_mysqld.h 1970-01-01 00:00:00 +0000 -+++ new/sql/wsrep_mysqld.h 2014-03-06 16:29:47 +0000 -@@ -0,0 +1,307 @@ -+/* Copyright 2008-2013 Codership Oy -+ -+ 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -+ -+#ifndef WSREP_MYSQLD_H -+#define WSREP_MYSQLD_H -+ -+#include "mysqld.h" -+typedef struct st_mysql_show_var SHOW_VAR; -+#include -+#include "rpl_gtid.h" -+#include "../wsrep/wsrep_api.h" -+ -+#define WSREP_UNDEFINED_TRX_ID ULONGLONG_MAX -+ -+class set_var; -+class THD; -+ -+enum wsrep_exec_mode { -+ LOCAL_STATE, -+ REPL_RECV, -+ TOTAL_ORDER, -+ LOCAL_COMMIT -+}; -+ -+enum wsrep_query_state { -+ QUERY_IDLE, -+ QUERY_EXEC, -+ QUERY_COMMITTING, -+ QUERY_EXITING, -+ QUERY_ROLLINGBACK, -+}; -+ -+enum wsrep_conflict_state { -+ NO_CONFLICT, -+ MUST_ABORT, -+ ABORTING, -+ ABORTED, -+ MUST_REPLAY, -+ REPLAYING, -+ RETRY_AUTOCOMMIT, -+ CERT_FAILURE, -+}; -+ -+enum wsrep_consistency_check_mode { -+ NO_CONSISTENCY_CHECK, -+ CONSISTENCY_CHECK_DECLARED, -+ CONSISTENCY_CHECK_RUNNING, -+}; -+ -+ -+// Global wsrep parameters -+extern wsrep_t* wsrep; -+ -+// MySQL wsrep options -+extern const char* wsrep_provider; -+extern const char* wsrep_provider_options; -+extern const char* wsrep_cluster_name; -+extern const char* wsrep_cluster_address; -+extern const char* wsrep_node_name; -+extern const char* wsrep_node_address; -+extern const char* wsrep_node_incoming_address; -+extern const char* wsrep_data_home_dir; -+extern const char* wsrep_dbug_option; -+extern long wsrep_slave_threads; -+extern int wsrep_slave_count_change; -+extern MYSQL_PLUGIN_IMPORT my_bool wsrep_debug; -+extern my_bool wsrep_convert_LOCK_to_trx; -+extern ulong wsrep_retry_autocommit; -+extern my_bool wsrep_auto_increment_control; -+extern my_bool wsrep_drupal_282555_workaround; -+extern my_bool wsrep_incremental_data_collection; -+extern const char* wsrep_start_position; -+extern ulong wsrep_max_ws_size; -+extern ulong wsrep_max_ws_rows; -+extern const char* wsrep_notify_cmd; -+extern my_bool wsrep_certify_nonPK; -+extern long wsrep_max_protocol_version; -+extern long wsrep_protocol_version; -+extern ulong wsrep_forced_binlog_format; -+extern ulong wsrep_OSU_method_options; -+extern my_bool wsrep_desync; -+extern my_bool wsrep_recovery; -+extern my_bool wsrep_replicate_myisam; -+extern my_bool wsrep_log_conflicts; -+extern ulong wsrep_mysql_replication_bundle; -+extern my_bool wsrep_load_data_splitting; -+ -+enum enum_wsrep_OSU_method { WSREP_OSU_TOI, WSREP_OSU_RSU }; -+ -+// MySQL status variables -+extern my_bool wsrep_connected; -+extern my_bool wsrep_ready; -+extern const char* wsrep_cluster_state_uuid; -+extern long long wsrep_cluster_conf_id; -+extern const char* wsrep_cluster_status; -+extern long wsrep_cluster_size; -+extern long wsrep_local_index; -+extern long long wsrep_local_bf_aborts; -+extern const char* wsrep_provider_name; -+extern const char* wsrep_provider_version; -+extern const char* wsrep_provider_vendor; -+ -+int wsrep_show_status(THD *thd, SHOW_VAR *var, char *buff); -+void wsrep_free_status(THD *thd); -+ -+/* Filters out --wsrep-new-cluster oprtion from argv[] -+ * should be called in the very beginning of main() */ -+void wsrep_filter_new_cluster (int* argc, char* argv[]); -+ -+int wsrep_init(); -+void wsrep_deinit(); -+void wsrep_recover(); -+bool wsrep_before_SE(); // initialize wsrep before storage -+ // engines (true) or after (false) -+/* wsrep initialization sequence at startup -+ * @param before wsrep_before_SE() value */ -+void wsrep_init_startup(bool before); -+ -+ -+extern "C" enum wsrep_exec_mode wsrep_thd_exec_mode(THD *thd); -+extern "C" enum wsrep_conflict_state wsrep_thd_conflict_state(THD *thd); -+extern "C" enum wsrep_query_state wsrep_thd_query_state(THD *thd); -+extern "C" const char * wsrep_thd_exec_mode_str(THD *thd); -+extern "C" const char * wsrep_thd_conflict_state_str(THD *thd); -+extern "C" const char * wsrep_thd_query_state_str(THD *thd); -+extern "C" wsrep_ws_handle_t* wsrep_thd_ws_handle(THD *thd); -+ -+extern "C" void wsrep_thd_set_exec_mode(THD *thd, enum wsrep_exec_mode mode); -+extern "C" void wsrep_thd_set_query_state( -+ THD *thd, enum wsrep_query_state state); -+extern "C" void wsrep_thd_set_conflict_state( -+ THD *thd, enum wsrep_conflict_state state); -+ -+extern "C" void wsrep_thd_set_trx_to_replay(THD *thd, uint64 trx_id); -+ -+extern "C" void wsrep_thd_LOCK(THD *thd); -+extern "C" void wsrep_thd_UNLOCK(THD *thd); -+extern "C" uint32 wsrep_thd_wsrep_rand(THD *thd); -+extern "C" time_t wsrep_thd_query_start(THD *thd); -+extern "C" my_thread_id wsrep_thd_thread_id(THD *thd); -+extern "C" int64_t wsrep_thd_trx_seqno(THD *thd); -+extern "C" query_id_t wsrep_thd_query_id(THD *thd); -+extern "C" char * wsrep_thd_query(THD *thd); -+extern "C" query_id_t wsrep_thd_wsrep_last_query_id(THD *thd); -+extern "C" void wsrep_thd_set_wsrep_last_query_id(THD *thd, query_id_t id); -+extern "C" void wsrep_thd_awake(THD *thd, my_bool signal); -+extern "C" int wsrep_thd_retry_counter(THD *thd); -+ -+ -+extern void wsrep_close_client_connections(my_bool wait_to_end); -+extern int wsrep_wait_committing_connections_close(int wait_time); -+extern void wsrep_close_applier(THD *thd); -+extern void wsrep_wait_appliers_close(THD *thd); -+extern void wsrep_close_applier_threads(int count); -+extern void wsrep_kill_mysql(THD *thd); -+ -+/* new defines */ -+extern void wsrep_stop_replication(THD *thd); -+extern bool wsrep_start_replication(); -+extern bool wsrep_causal_wait(THD* thd); -+extern int wsrep_check_opts (int argc, char* const* argv); -+extern void wsrep_prepend_PATH (const char* path); -+ -+/* Other global variables */ -+extern wsrep_seqno_t wsrep_locked_seqno; -+ -+#define WSREP_ON \ -+ (global_system_variables.wsrep_on) -+ -+#define WSREP(thd) \ -+ (WSREP_ON && (thd && thd->variables.wsrep_on)) -+ -+#define WSREP_CLIENT(thd) \ -+ (WSREP(thd) && thd->wsrep_client_thread) -+ -+#define WSREP_EMULATE_BINLOG(thd) \ -+ (WSREP(thd) && wsrep_emulate_bin_log) -+ -+// MySQL logging functions don't seem to understand long long length modifer. -+// This is a workaround. It also prefixes all messages with "WSREP" -+#define WSREP_LOG(fun, ...) \ -+ { \ -+ char msg[1024] = {'\0'}; \ -+ snprintf(msg, sizeof(msg) - 1, ## __VA_ARGS__); \ -+ fun("WSREP: %s", msg); \ -+ } -+ -+#define WSREP_DEBUG(...) \ -+ if (wsrep_debug) WSREP_LOG(sql_print_information, ##__VA_ARGS__) -+#define WSREP_INFO(...) WSREP_LOG(sql_print_information, ##__VA_ARGS__) -+#define WSREP_WARN(...) WSREP_LOG(sql_print_warning, ##__VA_ARGS__) -+#define WSREP_ERROR(...) WSREP_LOG(sql_print_error, ##__VA_ARGS__) -+ -+#define WSREP_LOG_CONFLICT_THD(thd, role) \ -+ WSREP_LOG(sql_print_information, \ -+ "%s: \n " \ -+ " THD: %lu, mode: %s, state: %s, conflict: %s, seqno: %lld\n " \ -+ " SQL: %s", \ -+ role, wsrep_thd_thread_id(thd), wsrep_thd_exec_mode_str(thd), \ -+ wsrep_thd_query_state_str(thd), \ -+ wsrep_thd_conflict_state_str(thd), (long long)wsrep_thd_trx_seqno(thd), \ -+ wsrep_thd_query(thd) \ -+ ); -+ -+#define WSREP_LOG_CONFLICT(bf_thd, victim_thd, bf_abort) \ -+ if (wsrep_debug || wsrep_log_conflicts) \ -+ { \ -+ WSREP_LOG(sql_print_information, "cluster conflict due to %s for threads:",\ -+ (bf_abort) ? "high priority abort" : "certification failure" \ -+ ); \ -+ if (bf_thd) WSREP_LOG_CONFLICT_THD(bf_thd, "Winning thread"); \ -+ if (victim_thd) WSREP_LOG_CONFLICT_THD(victim_thd, "Victim thread"); \ -+ } -+ -+extern void wsrep_ready_wait(); -+ -+enum wsrep_trx_status { -+ WSREP_TRX_OK, -+ WSREP_TRX_CERT_FAIL, /* certification failure, must abort */ -+ WSREP_TRX_SIZE_EXCEEDED, /* trx size exceeded */ -+ WSREP_TRX_ERROR, /* native mysql error */ -+}; -+ -+extern enum wsrep_trx_status -+wsrep_run_wsrep_commit(THD *thd, handlerton *hton, bool all); -+class Ha_trx_info; -+struct THD_TRANS; -+void wsrep_register_hton(THD* thd, bool all); -+void wsrep_post_commit(THD* thd, bool all); -+void wsrep_brute_force_killer(THD *thd); -+int wsrep_hire_brute_force_killer(THD *thd, uint64_t trx_id); -+ -+extern "C" bool wsrep_consistency_check(void *thd_ptr); -+ -+/* this is visible for client build so that innodb plugin gets this */ -+typedef struct wsrep_aborting_thd { -+ struct wsrep_aborting_thd *next; -+ THD *aborting_thd; -+} *wsrep_aborting_thd_t; -+ -+extern mysql_mutex_t LOCK_wsrep_ready; -+extern mysql_cond_t COND_wsrep_ready; -+extern mysql_mutex_t LOCK_wsrep_sst; -+extern mysql_cond_t COND_wsrep_sst; -+extern mysql_mutex_t LOCK_wsrep_sst_init; -+extern mysql_cond_t COND_wsrep_sst_init; -+extern mysql_mutex_t LOCK_wsrep_rollback; -+extern mysql_cond_t COND_wsrep_rollback; -+extern int wsrep_replaying; -+extern mysql_mutex_t LOCK_wsrep_replaying; -+extern mysql_cond_t COND_wsrep_replaying; -+extern mysql_mutex_t LOCK_wsrep_slave_threads; -+extern mysql_mutex_t LOCK_wsrep_desync; -+extern wsrep_aborting_thd_t wsrep_aborting_thd; -+extern my_bool wsrep_emulate_bin_log; -+extern int wsrep_to_isolation; -+extern rpl_sidno wsrep_sidno; -+extern my_bool wsrep_preordered_opt; -+#ifdef HAVE_PSI_INTERFACE -+extern PSI_mutex_key key_LOCK_wsrep_ready; -+extern PSI_mutex_key key_COND_wsrep_ready; -+extern PSI_mutex_key key_LOCK_wsrep_sst; -+extern PSI_cond_key key_COND_wsrep_sst; -+extern PSI_mutex_key key_LOCK_wsrep_sst_init; -+extern PSI_cond_key key_COND_wsrep_sst_init; -+extern PSI_mutex_key key_LOCK_wsrep_sst_thread; -+extern PSI_cond_key key_COND_wsrep_sst_thread; -+extern PSI_mutex_key key_LOCK_wsrep_rollback; -+extern PSI_cond_key key_COND_wsrep_rollback; -+extern PSI_mutex_key key_LOCK_wsrep_replaying; -+extern PSI_cond_key key_COND_wsrep_replaying; -+extern PSI_mutex_key key_LOCK_wsrep_slave_threads; -+extern PSI_mutex_key key_LOCK_wsrep_desync; -+#endif /* HAVE_PSI_INTERFACE */ -+struct TABLE_LIST; -+int wsrep_to_isolation_begin(THD *thd, char *db_, char *table_, -+ const TABLE_LIST* table_list); -+void wsrep_to_isolation_end(THD *thd); -+void wsrep_cleanup_transaction(THD *thd); -+int wsrep_to_buf_helper( -+ THD* thd, const char *query, uint query_len, uchar** buf, size_t* buf_len); -+int wsrep_create_sp(THD *thd, uchar** buf, size_t* buf_len); -+int wsrep_create_trigger_query(THD *thd, uchar** buf, size_t* buf_len); -+int wsrep_create_event_query(THD *thd, uchar** buf, size_t* buf_len); -+ -+struct xid_t; -+void wsrep_get_SE_checkpoint(xid_t*); -+void wsrep_set_SE_checkpoint(xid_t*); -+void wsrep_init_sidno(const wsrep_uuid_t&); -+void wsrep_xid_init(xid_t*, const wsrep_uuid_t*, wsrep_seqno_t); -+const wsrep_uuid_t* wsrep_xid_uuid(const xid_t*); -+wsrep_seqno_t wsrep_xid_seqno(const xid_t*); -+int wsrep_is_wsrep_xid(const void* xid); -+ -+#endif /* WSREP_MYSQLD_H */ - -=== added file 'sql/wsrep_notify.cc' ---- old/sql/wsrep_notify.cc 1970-01-01 00:00:00 +0000 -+++ new/sql/wsrep_notify.cc 2013-10-02 14:02:46 +0000 -@@ -0,0 +1,108 @@ -+/* Copyright 2010 Codership Oy -+ -+ 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -+ -+#include -+#include "wsrep_priv.h" -+#include "wsrep_utils.h" -+ -+const char* wsrep_notify_cmd=""; -+ -+static const char* _status_str(wsrep_member_status_t status) -+{ -+ switch (status) -+ { -+ case WSREP_MEMBER_UNDEFINED: return "Undefined"; -+ case WSREP_MEMBER_JOINER: return "Joiner"; -+ case WSREP_MEMBER_DONOR: return "Donor"; -+ case WSREP_MEMBER_JOINED: return "Joined"; -+ case WSREP_MEMBER_SYNCED: return "Synced"; -+ default: return "Error(?)"; -+ } -+} -+ -+void wsrep_notify_status (wsrep_member_status_t status, -+ const wsrep_view_info_t* view) -+{ -+ if (!wsrep_notify_cmd || 0 == strlen(wsrep_notify_cmd)) -+ { -+ WSREP_INFO("wsrep_notify_cmd is not defined, skipping notification."); -+ return; -+ } -+ -+ char cmd_buf[1 << 16]; // this can be long -+ long cmd_len = sizeof(cmd_buf) - 1; -+ char* cmd_ptr = cmd_buf; -+ long cmd_off = 0; -+ -+ cmd_off += snprintf (cmd_ptr + cmd_off, cmd_len - cmd_off, "%s", -+ wsrep_notify_cmd); -+ -+ if (status >= WSREP_MEMBER_UNDEFINED && status < WSREP_MEMBER_ERROR) -+ { -+ cmd_off += snprintf (cmd_ptr + cmd_off, cmd_len - cmd_off, " --status %s", -+ _status_str(status)); -+ } -+ else -+ { -+ /* here we preserve provider error codes */ -+ cmd_off += snprintf (cmd_ptr + cmd_off, cmd_len - cmd_off, -+ " --status 'Error(%d)'", status); -+ } -+ -+ if (0 != view) -+ { -+ char uuid_str[40]; -+ -+ wsrep_uuid_print (&view->state_id.uuid, uuid_str, sizeof(uuid_str)); -+ cmd_off += snprintf (cmd_ptr + cmd_off, cmd_len - cmd_off, -+ " --uuid %s", uuid_str); -+ -+ cmd_off += snprintf (cmd_ptr + cmd_off, cmd_len - cmd_off, -+ " --primary %s", view->view >= 0 ? "yes" : "no"); -+ -+ cmd_off += snprintf (cmd_ptr + cmd_off, cmd_len - cmd_off, -+ " --index %d", view->my_idx); -+ -+ cmd_off += snprintf (cmd_ptr + cmd_off, cmd_len - cmd_off, " --members"); -+ -+ for (int i = 0; i < view->memb_num; i++) -+ { -+ wsrep_uuid_print (&view->members[i].id, uuid_str, sizeof(uuid_str)); -+ cmd_off += snprintf (cmd_ptr + cmd_off, cmd_len - cmd_off, -+ "%c%s/%s/%s", i > 0 ? ',' : ' ', -+ uuid_str, view->members[i].name, -+ view->members[i].incoming); -+ } -+ } -+ -+ if (cmd_off == cmd_len) -+ { -+ WSREP_ERROR("Notification buffer too short (%ld). Aborting notification.", -+ cmd_len); -+ return; -+ } -+ -+ wsp::process p(cmd_ptr, "r"); -+ -+ p.wait(); -+ int err = p.error(); -+ -+ if (err) -+ { -+ WSREP_ERROR("Notification command failed: %d (%s): \"%s\"", -+ err, strerror(err), cmd_ptr); -+ } -+} -+ - -=== added file 'sql/wsrep_priv.h' ---- old/sql/wsrep_priv.h 1970-01-01 00:00:00 +0000 -+++ new/sql/wsrep_priv.h 2013-10-05 11:11:40 +0000 -@@ -0,0 +1,51 @@ -+/* Copyright 2010 Codership Oy -+ -+ 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -+ */ -+ -+//! @file declares symbols private to wsrep integration layer -+ -+#ifndef WSREP_PRIV_H -+#define WSREP_PRIV_H -+ -+#include "wsrep_mysqld.h" -+#include "../wsrep/wsrep_api.h" -+ -+#include -+#include -+#include -+ -+void wsrep_ready_set (my_bool x); -+ -+ssize_t wsrep_sst_prepare (void** msg); -+wsrep_cb_status wsrep_sst_donate_cb (void* app_ctx, -+ void* recv_ctx, -+ const void* msg, size_t msg_len, -+ const wsrep_gtid_t* state_id, -+ const char* state, size_t state_len, -+ bool bypass); -+ -+extern wsrep_uuid_t local_uuid; -+extern wsrep_seqno_t local_seqno; -+ -+// a helper function -+void wsrep_sst_received(wsrep_t*, const wsrep_uuid_t*, wsrep_seqno_t, -+ const void*, size_t); -+/*! SST thread signals init thread about sst completion */ -+void wsrep_sst_complete(const wsrep_uuid_t*, wsrep_seqno_t, bool); -+ -+void wsrep_notify_status (wsrep_member_status_t new_status, -+ const wsrep_view_info_t* view = 0); -+ -+#endif /* WSREP_PRIV_H */ - -=== added file 'sql/wsrep_sst.cc' ---- old/sql/wsrep_sst.cc 1970-01-01 00:00:00 +0000 -+++ new/sql/wsrep_sst.cc 2014-03-08 05:20:50 +0000 -@@ -0,0 +1,1091 @@ -+/* Copyright 2008-2012 Codership Oy -+ -+ 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -+ -+#include "wsrep_sst.h" -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include "wsrep_priv.h" -+#include "wsrep_utils.h" -+#include -+#include -+ -+extern const char wsrep_defaults_file[]; -+ -+#define WSREP_SST_OPT_ROLE "--role" -+#define WSREP_SST_OPT_ADDR "--address" -+#define WSREP_SST_OPT_AUTH "--auth" -+#define WSREP_SST_OPT_DATA "--datadir" -+#define WSREP_SST_OPT_CONF "--defaults-file" -+#define WSREP_SST_OPT_PARENT "--parent" -+#define WSREP_SST_OPT_BINLOG "--binlog" -+ -+// mysqldump-specific options -+#define WSREP_SST_OPT_USER "--user" -+#define WSREP_SST_OPT_PSWD "--password" -+#define WSREP_SST_OPT_HOST "--host" -+#define WSREP_SST_OPT_PORT "--port" -+#define WSREP_SST_OPT_LPORT "--local-port" -+ -+// donor-specific -+#define WSREP_SST_OPT_SOCKET "--socket" -+#define WSREP_SST_OPT_GTID "--gtid" -+#define WSREP_SST_OPT_BYPASS "--bypass" -+ -+#define WSREP_SST_MYSQLDUMP "mysqldump" -+#define WSREP_SST_RSYNC "rsync" -+#define WSREP_SST_SKIP "skip" -+#define WSREP_SST_XTRABACKUP "xtrabackup" -+#define WSREP_SST_XTRABACKUP_V2 "xtrabackup-v2" -+#define WSREP_SST_DEFAULT WSREP_SST_RSYNC -+#define WSREP_SST_ADDRESS_AUTO "AUTO" -+#define WSREP_SST_AUTH_MASK "********" -+ -+const char* wsrep_sst_method = WSREP_SST_DEFAULT; -+const char* wsrep_sst_receive_address = WSREP_SST_ADDRESS_AUTO; -+const char* wsrep_sst_donor = ""; -+ char* wsrep_sst_auth = NULL; -+ -+// container for real auth string -+static const char* sst_auth_real = NULL; -+my_bool wsrep_sst_donor_rejects_queries = FALSE; -+ -+bool wsrep_sst_method_check (sys_var *self, THD* thd, set_var* var) -+{ -+ char buff[FN_REFLEN]; -+ String str(buff, sizeof(buff), system_charset_info), *res; -+ const char* c_str = NULL; -+ -+ if ((res = var->value->val_str(&str)) && -+ (c_str = res->c_ptr()) && -+ strlen(c_str) > 0) -+ return 0; -+ -+ my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), "wsrep_sst_method", c_str ? c_str : "NULL"); -+ return 1; -+} -+ -+bool wsrep_sst_method_update (sys_var *self, THD* thd, enum_var_type type) -+{ -+ return 0; -+} -+ -+static bool sst_receive_address_check (const char* str) -+{ -+ if (!strncasecmp(str, "127.0.0.1", strlen("127.0.0.1")) || -+ !strncasecmp(str, "localhost", strlen("localhost"))) -+ { -+ return 1; -+ } -+ -+ return 0; -+} -+ -+bool wsrep_sst_receive_address_check (sys_var *self, THD* thd, set_var* var) -+{ -+ const char* c_str = var->value->str_value.c_ptr(); -+ -+ if (sst_receive_address_check (c_str)) -+ { -+ my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), "wsrep_sst_receive_address", c_str ? c_str : "NULL"); -+ return 1; -+ } -+ -+ return 0; -+} -+ -+bool wsrep_sst_receive_address_update (sys_var *self, THD* thd, -+ enum_var_type type) -+{ -+ return 0; -+} -+ -+bool wsrep_sst_auth_check (sys_var *self, THD* thd, set_var* var) -+{ -+ return 0; -+} -+static bool sst_auth_real_set (const char* value) -+{ -+ const char* v = strdup (value); -+ -+ if (v) -+ { -+ if (sst_auth_real) free (const_cast(sst_auth_real)); -+ sst_auth_real = v; -+ -+ if (strlen(sst_auth_real)) -+ { -+ if (wsrep_sst_auth) -+ { -+ my_free ((void*)wsrep_sst_auth); -+ wsrep_sst_auth = my_strdup(WSREP_SST_AUTH_MASK, MYF(0)); -+ //strncpy (wsrep_sst_auth, WSREP_SST_AUTH_MASK, -+ // sizeof(wsrep_sst_auth) - 1); -+ } -+ else -+ wsrep_sst_auth = my_strdup (WSREP_SST_AUTH_MASK, MYF(0)); -+ } -+ return 0; -+ } -+ -+ return 1; -+} -+ -+bool wsrep_sst_auth_update (sys_var *self, THD* thd, enum_var_type type) -+{ -+ return sst_auth_real_set (wsrep_sst_auth); -+} -+ -+void wsrep_sst_auth_init (const char* value) -+{ -+ if (wsrep_sst_auth == value) wsrep_sst_auth = NULL; -+ if (value) sst_auth_real_set (value); -+} -+ -+bool wsrep_sst_donor_check (sys_var *self, THD* thd, set_var* var) -+{ -+ return 0; -+} -+ -+bool wsrep_sst_donor_update (sys_var *self, THD* thd, enum_var_type type) -+{ -+ return 0; -+} -+ -+static wsrep_uuid_t cluster_uuid = WSREP_UUID_UNDEFINED; -+ -+bool wsrep_before_SE() -+{ -+ return (wsrep_provider != NULL -+ && strcmp (wsrep_provider, WSREP_NONE) -+ && strcmp (wsrep_sst_method, WSREP_SST_SKIP) -+ && strcmp (wsrep_sst_method, WSREP_SST_MYSQLDUMP)); -+} -+ -+static bool sst_complete = false; -+static bool sst_needed = false; -+ -+void wsrep_sst_grab () -+{ -+ WSREP_INFO("wsrep_sst_grab()"); -+ if (mysql_mutex_lock (&LOCK_wsrep_sst)) abort(); -+ sst_complete = false; -+ mysql_mutex_unlock (&LOCK_wsrep_sst); -+} -+ -+// Wait for end of SST -+bool wsrep_sst_wait () -+{ -+ if (mysql_mutex_lock (&LOCK_wsrep_sst)) abort(); -+ while (!sst_complete) -+ { -+ WSREP_INFO("Waiting for SST to complete."); -+ mysql_cond_wait (&COND_wsrep_sst, &LOCK_wsrep_sst); -+ } -+ -+ if (local_seqno >= 0) -+ { -+ WSREP_INFO("SST complete, seqno: %lld", (long long) local_seqno); -+ } -+ else -+ { -+ WSREP_ERROR("SST failed: %d (%s)", -+ int(-local_seqno), strerror(-local_seqno)); -+ } -+ -+ mysql_mutex_unlock (&LOCK_wsrep_sst); -+ -+ return (local_seqno >= 0); -+} -+ -+// Signal end of SST -+void wsrep_sst_complete (const wsrep_uuid_t* sst_uuid, -+ wsrep_seqno_t sst_seqno, -+ bool needed) -+{ -+ if (mysql_mutex_lock (&LOCK_wsrep_sst)) abort(); -+ if (!sst_complete) -+ { -+ sst_complete = true; -+ sst_needed = needed; -+ local_uuid = *sst_uuid; -+ local_seqno = sst_seqno; -+ mysql_cond_signal (&COND_wsrep_sst); -+ } -+ else -+ { -+ /* This can happen when called from wsrep_synced_cb(). -+ At the moment there is no way to check there -+ if main thread is still waiting for signal, -+ so wsrep_sst_complete() is called from there -+ each time wsrep_ready changes from FALSE -> TRUE. -+ */ -+ WSREP_DEBUG("Nobody is waiting for SST."); -+ } -+ mysql_mutex_unlock (&LOCK_wsrep_sst); -+} -+ -+void wsrep_sst_received (wsrep_t* const wsrep, -+ const wsrep_uuid_t* const uuid, -+ wsrep_seqno_t const seqno, -+ const void* const state, -+ size_t const state_len) -+{ -+ int const rcode(seqno < 0 ? seqno : 0); -+ wsrep_gtid_t const state_id = { -+ *uuid, (rcode ? WSREP_SEQNO_UNDEFINED : seqno) -+ }; -+ wsrep_init_sidno(state_id.uuid); -+ wsrep->sst_received(wsrep, &state_id, state, state_len, rcode); -+} -+ -+// Let applier threads to continue -+void wsrep_sst_continue () -+{ -+ if (sst_needed) -+ { -+ WSREP_INFO("Signalling provider to continue."); -+ wsrep_sst_received (wsrep, &local_uuid, local_seqno, NULL, 0); -+ } -+} -+ -+struct sst_thread_arg -+{ -+ const char* cmd; -+ int err; -+ char* ret_str; -+ mysql_mutex_t lock; -+ mysql_cond_t cond; -+ -+ sst_thread_arg (const char* c) : cmd(c), err(-1), ret_str(0) -+ { -+ mysql_mutex_init(key_LOCK_wsrep_sst_thread, &lock, MY_MUTEX_INIT_FAST); -+ mysql_cond_init(key_COND_wsrep_sst_thread, &cond, NULL); -+ } -+ -+ ~sst_thread_arg() -+ { -+ mysql_cond_destroy (&cond); -+ mysql_mutex_unlock (&lock); -+ mysql_mutex_destroy (&lock); -+ } -+}; -+ -+static int sst_scan_uuid_seqno (const char* str, -+ wsrep_uuid_t* uuid, wsrep_seqno_t* seqno) -+{ -+ int offt = wsrep_uuid_scan (str, strlen(str), uuid); -+ if (offt > 0 && strlen(str) > (unsigned int)offt && ':' == str[offt]) -+ { -+ *seqno = strtoll (str + offt + 1, NULL, 10); -+ if (*seqno != LLONG_MAX || errno != ERANGE) -+ { -+ return 0; -+ } -+ } -+ -+ WSREP_ERROR("Failed to parse uuid:seqno pair: '%s'", str); -+ return EINVAL; -+} -+ -+// get rid of trailing \n -+static char* my_fgets (char* buf, size_t buf_len, FILE* stream) -+{ -+ char* ret= fgets (buf, buf_len, stream); -+ -+ if (ret) -+ { -+ size_t len = strlen(ret); -+ if (len > 0 && ret[len - 1] == '\n') ret[len - 1] = '\0'; -+ } -+ -+ return ret; -+} -+ -+/* -+ Generate opt_binlog_opt_val for sst_donate_other(), sst_prepare_other(). -+ -+ Returns zero on success, negative error code otherwise. -+ -+ String containing binlog name is stored in param ret if binlog is enabled -+ and GTID mode is on, otherwise empty string. Returned string should be -+ freed with my_free(). -+ */ -+static int generate_binlog_opt_val(char** ret) -+{ -+ DBUG_ASSERT(ret); -+ *ret= NULL; -+ if (opt_bin_log && gtid_mode > 0) -+ { -+ assert(opt_bin_logname); -+ *ret= strcmp(opt_bin_logname, "0") ? -+ my_strdup(opt_bin_logname, MYF(0)) : my_strdup("", MYF(0)); -+ } -+ else -+ { -+ *ret= my_strdup("", MYF(0)); -+ } -+ if (!*ret) return -ENOMEM; -+ return 0; -+} -+ -+static void* sst_joiner_thread (void* a) -+{ -+ sst_thread_arg* arg= (sst_thread_arg*) a; -+ int err= 1; -+ -+ { -+ const char magic[] = "ready"; -+ const size_t magic_len = sizeof(magic) - 1; -+ const size_t out_len = 512; -+ char out[out_len]; -+ -+ WSREP_INFO("Running: '%s'", arg->cmd); -+ -+ wsp::process proc (arg->cmd, "r"); -+ -+ if (proc.pipe() && !proc.error()) -+ { -+ const char* tmp= my_fgets (out, out_len, proc.pipe()); -+ -+ if (!tmp || strlen(tmp) < (magic_len + 2) || -+ strncasecmp (tmp, magic, magic_len)) -+ { -+ WSREP_ERROR("Failed to read '%s ' from: %s\n\tRead: '%s'", -+ magic, arg->cmd, tmp); -+ proc.wait(); -+ if (proc.error()) err = proc.error(); -+ } -+ else -+ { -+ err = 0; -+ } -+ } -+ else -+ { -+ err = proc.error(); -+ WSREP_ERROR("Failed to execute: %s : %d (%s)", -+ arg->cmd, err, strerror(err)); -+ } -+ -+ // signal sst_prepare thread with ret code, -+ // it will go on sending SST request -+ mysql_mutex_lock (&arg->lock); -+ if (!err) -+ { -+ arg->ret_str = strdup (out + magic_len + 1); -+ if (!arg->ret_str) err = ENOMEM; -+ } -+ arg->err = -err; -+ mysql_cond_signal (&arg->cond); -+ mysql_mutex_unlock (&arg->lock); //! @note arg is unusable after that. -+ -+ if (err) return NULL; /* lp:808417 - return immediately, don't signal -+ * initializer thread to ensure single thread of -+ * shutdown. */ -+ -+ wsrep_uuid_t ret_uuid = WSREP_UUID_UNDEFINED; -+ wsrep_seqno_t ret_seqno = WSREP_SEQNO_UNDEFINED; -+ -+ // in case of successfull receiver start, wait for SST completion/end -+ char* tmp = my_fgets (out, out_len, proc.pipe()); -+ -+ proc.wait(); -+ err= EINVAL; -+ -+ if (!tmp) -+ { -+ WSREP_ERROR("Failed to read uuid:seqno from joiner script."); -+ if (proc.error()) err = proc.error(); -+ } -+ else -+ { -+ err= sst_scan_uuid_seqno (out, &ret_uuid, &ret_seqno); -+ } -+ -+ if (err) -+ { -+ ret_uuid= WSREP_UUID_UNDEFINED; -+ ret_seqno= -err; -+ } -+ -+ // Tell initializer thread that SST is complete -+ wsrep_sst_complete (&ret_uuid, ret_seqno, true); -+ } -+ -+ return NULL; -+} -+ -+static ssize_t sst_prepare_other (const char* method, -+ const char* addr_in, -+ const char** addr_out) -+{ -+ ssize_t cmd_len= 1024; -+ char cmd_str[cmd_len]; -+ const char* sst_dir= mysql_real_data_home; -+ const char* binlog_opt= ""; -+ char* binlog_opt_val= NULL; -+ -+ int ret; -+ if ((ret= generate_binlog_opt_val(&binlog_opt_val))) -+ { -+ WSREP_ERROR("sst_prepare_other(): generate_binlog_opt_val() failed: %d", -+ ret); -+ return ret; -+ } -+ if (strlen(binlog_opt_val)) binlog_opt= WSREP_SST_OPT_BINLOG; -+ -+ -+ ret= snprintf (cmd_str, cmd_len, -+ "wsrep_sst_%s " -+ WSREP_SST_OPT_ROLE" 'joiner' " -+ WSREP_SST_OPT_ADDR" '%s' " -+ WSREP_SST_OPT_AUTH" '%s' " -+ WSREP_SST_OPT_DATA" '%s' " -+ WSREP_SST_OPT_CONF" '%s' " -+ WSREP_SST_OPT_PARENT" '%d'" -+ " %s '%s' ", -+ method, addr_in, (sst_auth_real) ? sst_auth_real : "", -+ sst_dir, wsrep_defaults_file, (int)getpid(), -+ binlog_opt, binlog_opt_val); -+ my_free(binlog_opt_val); -+ -+ if (ret < 0 || ret >= cmd_len) -+ { -+ WSREP_ERROR("sst_prepare_other(): snprintf() failed: %d", ret); -+ return (ret < 0 ? ret : -EMSGSIZE); -+ } -+ -+ pthread_t tmp; -+ sst_thread_arg arg(cmd_str); -+ mysql_mutex_lock (&arg.lock); -+ ret = pthread_create (&tmp, NULL, sst_joiner_thread, &arg); -+ if (ret) -+ { -+ WSREP_ERROR("sst_prepare_other(): pthread_create() failed: %d (%s)", -+ ret, strerror(ret)); -+ return ret; -+ } -+ mysql_cond_wait (&arg.cond, &arg.lock); -+ -+ *addr_out= arg.ret_str; -+ -+ if (!arg.err) -+ ret = strlen(*addr_out); -+ else -+ { -+ assert (arg.err < 0); -+ ret = arg.err; -+ } -+ -+ pthread_detach (tmp); -+ -+ return ret; -+} -+ -+extern uint mysqld_port; -+ -+/*! Just tells donor where to send mysqldump */ -+static ssize_t sst_prepare_mysqldump (const char* addr_in, -+ const char** addr_out) -+{ -+ ssize_t ret = strlen (addr_in); -+ -+ if (!strrchr(addr_in, ':')) -+ { -+ ssize_t s = ret + 7; -+ char* tmp = (char*) malloc (s); -+ -+ if (tmp) -+ { -+ ret= snprintf (tmp, s, "%s:%u", addr_in, mysqld_port); -+ -+ if (ret > 0 && ret < s) -+ { -+ *addr_out= tmp; -+ return ret; -+ } -+ if (ret > 0) /* buffer too short */ ret = -EMSGSIZE; -+ free (tmp); -+ } -+ else { -+ ret= -ENOMEM; -+ } -+ -+ WSREP_ERROR ("Could not prepare state transfer request: " -+ "adding default port failed: %zd.", ret); -+ } -+ else { -+ *addr_out= addr_in; -+ } -+ -+ return ret; -+} -+ -+static bool SE_initialized = false; -+ -+ssize_t wsrep_sst_prepare (void** msg) -+{ -+ const ssize_t ip_max= 256; -+ char ip_buf[ip_max]; -+ const char* addr_in= NULL; -+ const char* addr_out= NULL; -+ -+ if (!strcmp(wsrep_sst_method, WSREP_SST_SKIP)) -+ { -+ ssize_t ret = strlen(WSREP_STATE_TRANSFER_TRIVIAL) + 1; -+ *msg = strdup(WSREP_STATE_TRANSFER_TRIVIAL); -+ if (!msg) -+ { -+ WSREP_ERROR("Could not allocate %zd bytes for state request", ret); -+ unireg_abort(1); -+ } -+ return ret; -+ } -+ -+ // Figure out SST address. Common for all SST methods -+ if (wsrep_sst_receive_address && -+ strcmp (wsrep_sst_receive_address, WSREP_SST_ADDRESS_AUTO)) -+ { -+ addr_in= wsrep_sst_receive_address; -+ } -+ else if (wsrep_node_address && strlen(wsrep_node_address)) -+ { -+ const char* const colon= strchr (wsrep_node_address, ':'); -+ if (colon) -+ { -+ ptrdiff_t const len= colon - wsrep_node_address; -+ strncpy (ip_buf, wsrep_node_address, len); -+ ip_buf[len]= '\0'; -+ addr_in= ip_buf; -+ } -+ else -+ { -+ addr_in= wsrep_node_address; -+ } -+ } -+ else -+ { -+ ssize_t ret= wsrep_guess_ip (ip_buf, ip_max); -+ -+ if (ret && ret < ip_max) -+ { -+ addr_in= ip_buf; -+ } -+ else -+ { -+ WSREP_ERROR("Could not prepare state transfer request: " -+ "failed to guess address to accept state transfer at. " -+ "wsrep_sst_receive_address must be set manually."); -+ unireg_abort(1); -+ } -+ } -+ -+ ssize_t addr_len= -ENOSYS; -+ if (!strcmp(wsrep_sst_method, WSREP_SST_MYSQLDUMP)) -+ { -+ addr_len= sst_prepare_mysqldump (addr_in, &addr_out); -+ if (addr_len < 0) unireg_abort(1); -+ } -+ else -+ { -+ /*! A heuristic workaround until we learn how to stop and start engines */ -+ if (SE_initialized) -+ { -+ // we already did SST at initializaiton, now engines are running -+ // sql_print_information() is here because the message is too long -+ // for WSREP_INFO. -+ sql_print_information ("WSREP: " -+ "You have configured '%s' state snapshot transfer method " -+ "which cannot be performed on a running server. " -+ "Wsrep provider won't be able to fall back to it " -+ "if other means of state transfer are unavailable. " -+ "In that case you will need to restart the server.", -+ wsrep_sst_method); -+ *msg = 0; -+ return 0; -+ } -+ -+ addr_len = sst_prepare_other (wsrep_sst_method, addr_in, &addr_out); -+ if (addr_len < 0) -+ { -+ WSREP_ERROR("Failed to prepare for '%s' SST. Unrecoverable.", -+ wsrep_sst_method); -+ unireg_abort(1); -+ } -+ } -+ -+ size_t const method_len(strlen(wsrep_sst_method)); -+ size_t const msg_len (method_len + addr_len + 2 /* + auth_len + 1*/); -+ -+ *msg = malloc (msg_len); -+ if (NULL != *msg) { -+ char* const method_ptr(reinterpret_cast(*msg)); -+ strcpy (method_ptr, wsrep_sst_method); -+ char* const addr_ptr(method_ptr + method_len + 1); -+ strcpy (addr_ptr, addr_out); -+ -+ WSREP_INFO ("Prepared SST request: %s|%s", method_ptr, addr_ptr); -+ } -+ else { -+ WSREP_ERROR("Failed to allocate SST request of size %zu. Can't continue.", -+ msg_len); -+ unireg_abort(1); -+ } -+ -+ if (addr_out != addr_in) /* malloc'ed */ free ((char*)addr_out); -+ -+ return msg_len; -+} -+ -+// helper method for donors -+static int sst_run_shell (const char* cmd_str, int max_tries) -+{ -+ int ret = 0; -+ -+ for (int tries=1; tries <= max_tries; tries++) -+ { -+ wsp::process proc (cmd_str, "r"); -+ -+ if (NULL != proc.pipe()) -+ { -+ proc.wait(); -+ } -+ -+ if ((ret = proc.error())) -+ { -+ WSREP_ERROR("Try %d/%d: '%s' failed: %d (%s)", -+ tries, max_tries, proc.cmd(), ret, strerror(ret)); -+ sleep (1); -+ } -+ else -+ { -+ WSREP_DEBUG("SST script successfully completed."); -+ break; -+ } -+ } -+ -+ return -ret; -+} -+ -+static void sst_reject_queries(my_bool close_conn) -+{ -+ wsrep_ready_set (FALSE); // this will be resotred when donor becomes synced -+ WSREP_INFO("Rejecting client queries for the duration of SST."); -+ if (TRUE == close_conn) wsrep_close_client_connections(FALSE); -+} -+ -+static int sst_mysqldump_check_addr (const char* user, const char* pswd, -+ const char* host, const char* port) -+{ -+ return 0; -+} -+ -+static int sst_donate_mysqldump (const char* addr, -+ const wsrep_uuid_t* uuid, -+ const char* uuid_str, -+ wsrep_seqno_t seqno, -+ bool bypass) -+{ -+ size_t host_len; -+ const char* port = strchr (addr, ':'); -+ -+ if (port) -+ { -+ port += 1; -+ host_len = port - addr; -+ } -+ else -+ { -+ port = ""; -+ host_len = strlen (addr) + 1; -+ } -+ -+ char host[host_len]; -+ -+ strncpy (host, addr, host_len - 1); -+ host[host_len - 1] = '\0'; -+ -+ const char* auth = sst_auth_real; -+ const char* pswd = (auth) ? strchr (auth, ':') : NULL; -+ size_t user_len; -+ -+ if (pswd) -+ { -+ pswd += 1; -+ user_len = pswd - auth; -+ } -+ else -+ { -+ pswd = ""; -+ user_len = (auth) ? strlen (auth) + 1 : 1; -+ } -+ -+ char user[user_len]; -+ -+ strncpy (user, (auth) ? auth : "", user_len - 1); -+ user[user_len - 1] = '\0'; -+ -+ int ret = sst_mysqldump_check_addr (user, pswd, host, port); -+ if (!ret) -+ { -+ size_t cmd_len= 1024; -+ char cmd_str[cmd_len]; -+ -+ if (!bypass && wsrep_sst_donor_rejects_queries) sst_reject_queries(TRUE); -+ -+ snprintf (cmd_str, cmd_len, -+ "wsrep_sst_mysqldump " -+ WSREP_SST_OPT_USER" '%s' " -+ WSREP_SST_OPT_PSWD" '%s' " -+ WSREP_SST_OPT_HOST" '%s' " -+ WSREP_SST_OPT_PORT" '%s' " -+ WSREP_SST_OPT_LPORT" '%u' " -+ WSREP_SST_OPT_SOCKET" '%s' " -+ WSREP_SST_OPT_GTID" '%s:%lld'" -+ "%s", -+ user, pswd, host, port, mysqld_port, mysqld_unix_port, uuid_str, -+ (long long)seqno, bypass ? " "WSREP_SST_OPT_BYPASS : ""); -+ -+ WSREP_DEBUG("Running: '%s'", cmd_str); -+ -+ ret= sst_run_shell (cmd_str, 3); -+ } -+ -+ wsrep_gtid_t const state_id = { *uuid, (ret ? WSREP_SEQNO_UNDEFINED : seqno)}; -+ -+ wsrep->sst_sent (wsrep, &state_id, ret); -+ -+ return ret; -+} -+ -+wsrep_seqno_t wsrep_locked_seqno= WSREP_SEQNO_UNDEFINED; -+ -+static int run_sql_command(THD *thd, const char *query) -+{ -+ thd->set_query((char *)query, strlen(query)); -+ -+ Parser_state ps; -+ if (ps.init(thd, thd->query(), thd->query_length())) -+ { -+ WSREP_ERROR("SST query: %s failed", query); -+ return -1; -+ } -+ -+ mysql_parse(thd, thd->query(), thd->query_length(), &ps); -+ if (thd->is_error()) -+ { -+ int const err= thd->get_stmt_da()->sql_errno(); -+ WSREP_WARN ("error executing '%s': %d (%s)%s", -+ query, err, thd->get_stmt_da()->message(), -+ err == ER_UNKNOWN_SYSTEM_VARIABLE ? -+ ". Was mysqld built with --with-innodb-disallow-writes ?" : ""); -+ thd->clear_error(); -+ return -1; -+ } -+ return 0; -+} -+ -+static int sst_flush_tables(THD* thd) -+{ -+ WSREP_INFO("Flushing tables for SST..."); -+ -+ int err; -+ int not_used; -+ if (run_sql_command(thd, "FLUSH TABLES WITH READ LOCK")) -+ { -+ WSREP_ERROR("Failed to flush and lock tables"); -+ err = -1; -+ } -+ else -+ { -+ /* make sure logs are flushed after global read lock acquired */ -+ err= reload_acl_and_cache(thd, REFRESH_ENGINE_LOG | REFRESH_BINARY_LOG, -+ (TABLE_LIST*) 0, ¬_used); -+ } -+ -+ if (err) -+ { -+ WSREP_ERROR("Failed to flush tables: %d (%s)", err, strerror(err)); -+ } -+ else -+ { -+ WSREP_INFO("Tables flushed."); -+ const char base_name[]= "tables_flushed"; -+ ssize_t const full_len= strlen(mysql_real_data_home) + strlen(base_name)+2; -+ char real_name[full_len]; -+ sprintf(real_name, "%s/%s", mysql_real_data_home, base_name); -+ char tmp_name[full_len + 4]; -+ sprintf(tmp_name, "%s.tmp", real_name); -+ -+ FILE* file= fopen(tmp_name, "w+"); -+ if (0 == file) -+ { -+ err= errno; -+ WSREP_ERROR("Failed to open '%s': %d (%s)", tmp_name, err,strerror(err)); -+ } -+ else -+ { -+ fprintf(file, "%s:%lld\n", -+ wsrep_cluster_state_uuid, (long long)wsrep_locked_seqno); -+ fsync(fileno(file)); -+ fclose(file); -+ if (rename(tmp_name, real_name) == -1) -+ { -+ err= errno; -+ WSREP_ERROR("Failed to rename '%s' to '%s': %d (%s)", -+ tmp_name, real_name, err,strerror(err)); -+ } -+ } -+ } -+ -+ return err; -+} -+ -+static void sst_disallow_writes (THD* thd, bool yes) -+{ -+ char query_str[64] = { 0, }; -+ ssize_t const query_max = sizeof(query_str) - 1; -+ snprintf (query_str, query_max, "SET GLOBAL innodb_disallow_writes=%d", -+ yes ? 1 : 0); -+ -+ if (run_sql_command(thd, query_str)) -+ { -+ WSREP_ERROR("Failed to disallow InnoDB writes"); -+ } -+} -+ -+static void* sst_donor_thread (void* a) -+{ -+ sst_thread_arg* arg= (sst_thread_arg*)a; -+ -+ WSREP_INFO("Running: '%s'", arg->cmd); -+ -+ int err= 1; -+ bool locked= false; -+ -+ const char* out= NULL; -+ const size_t out_len= 128; -+ char out_buf[out_len]; -+ -+ wsrep_uuid_t ret_uuid= WSREP_UUID_UNDEFINED; -+ wsrep_seqno_t ret_seqno= WSREP_SEQNO_UNDEFINED; // seqno of complete SST -+ -+ wsp::thd thd(FALSE); // we turn off wsrep_on for this THD so that it can -+ // operate with wsrep_ready == OFF -+ wsp::process proc(arg->cmd, "r"); -+ -+ err= proc.error(); -+ -+/* Inform server about SST script startup and release TO isolation */ -+ mysql_mutex_lock (&arg->lock); -+ arg->err = -err; -+ mysql_cond_signal (&arg->cond); -+ mysql_mutex_unlock (&arg->lock); //! @note arg is unusable after that. -+ -+ if (proc.pipe() && !err) -+ { -+wait_signal: -+ out= my_fgets (out_buf, out_len, proc.pipe()); -+ -+ if (out) -+ { -+ const char magic_flush[]= "flush tables"; -+ const char magic_cont[]= "continue"; -+ const char magic_done[]= "done"; -+ -+ if (!strcasecmp (out, magic_flush)) -+ { -+ err= sst_flush_tables (thd.ptr); -+ if (!err) -+ { -+ sst_disallow_writes (thd.ptr, true); -+ locked= true; -+ goto wait_signal; -+ } -+ } -+ else if (!strcasecmp (out, magic_cont)) -+ { -+ if (locked) -+ { -+ sst_disallow_writes (thd.ptr, false); -+ thd.ptr->global_read_lock.unlock_global_read_lock (thd.ptr); -+ locked= false; -+ } -+ err= 0; -+ goto wait_signal; -+ } -+ else if (!strncasecmp (out, magic_done, strlen(magic_done))) -+ { -+ err= sst_scan_uuid_seqno (out + strlen(magic_done) + 1, -+ &ret_uuid, &ret_seqno); -+ } -+ else -+ { -+ WSREP_WARN("Received unknown signal: '%s'", out); -+ } -+ } -+ else -+ { -+ WSREP_ERROR("Failed to read from: %s", proc.cmd()); -+ proc.wait(); -+ } -+ if (!err && proc.error()) err= proc.error(); -+ } -+ else -+ { -+ WSREP_ERROR("Failed to execute: %s : %d (%s)", -+ proc.cmd(), err, strerror(err)); -+ } -+ -+ if (locked) // don't forget to unlock server before return -+ { -+ sst_disallow_writes (thd.ptr, false); -+ thd.ptr->global_read_lock.unlock_global_read_lock (thd.ptr); -+ } -+ -+ // signal to donor that SST is over -+ struct wsrep_gtid const state_id = { -+ ret_uuid, err ? WSREP_SEQNO_UNDEFINED : ret_seqno -+ }; -+ wsrep->sst_sent (wsrep, &state_id, -err); -+ proc.wait(); -+ -+ return NULL; -+} -+ -+ -+ -+static int sst_donate_other (const char* method, -+ const char* addr, -+ const char* uuid, -+ wsrep_seqno_t seqno, -+ bool bypass) -+{ -+ ssize_t cmd_len = 4096; -+ char cmd_str[cmd_len]; -+ const char* binlog_opt= ""; -+ char* binlog_opt_val= NULL; -+ -+ int ret; -+ if ((ret= generate_binlog_opt_val(&binlog_opt_val))) -+ { -+ WSREP_ERROR("sst_donate_other(): generate_binlog_opt_val() failed: %d",ret); -+ return ret; -+ } -+ if (strlen(binlog_opt_val)) binlog_opt= WSREP_SST_OPT_BINLOG; -+ -+ ret= snprintf (cmd_str, cmd_len, -+ "wsrep_sst_%s " -+ WSREP_SST_OPT_ROLE" 'donor' " -+ WSREP_SST_OPT_ADDR" '%s' " -+ WSREP_SST_OPT_AUTH" '%s' " -+ WSREP_SST_OPT_SOCKET" '%s' " -+ WSREP_SST_OPT_DATA" '%s' " -+ WSREP_SST_OPT_CONF" '%s' " -+ " %s '%s' " -+ WSREP_SST_OPT_GTID" '%s:%lld'" -+ "%s", -+ method, addr, sst_auth_real, mysqld_unix_port, -+ mysql_real_data_home, wsrep_defaults_file, -+ binlog_opt, binlog_opt_val, -+ uuid, (long long) seqno, -+ bypass ? " "WSREP_SST_OPT_BYPASS : ""); -+ my_free(binlog_opt_val); -+ -+ if (ret < 0 || ret >= cmd_len) -+ { -+ WSREP_ERROR("sst_donate_other(): snprintf() failed: %d", ret); -+ return (ret < 0 ? ret : -EMSGSIZE); -+ } -+ -+ if (!bypass && wsrep_sst_donor_rejects_queries) sst_reject_queries(FALSE); -+ -+ pthread_t tmp; -+ sst_thread_arg arg(cmd_str); -+ mysql_mutex_lock (&arg.lock); -+ ret = pthread_create (&tmp, NULL, sst_donor_thread, &arg); -+ if (ret) -+ { -+ WSREP_ERROR("sst_donate_other(): pthread_create() failed: %d (%s)", -+ ret, strerror(ret)); -+ return ret; -+ } -+ mysql_cond_wait (&arg.cond, &arg.lock); -+ -+ WSREP_INFO("sst_donor_thread signaled with %d", arg.err); -+ return arg.err; -+} -+ -+wsrep_cb_status_t wsrep_sst_donate_cb (void* app_ctx, void* recv_ctx, -+ const void* msg, size_t msg_len, -+ const wsrep_gtid_t* current_gtid, -+ const char* state, size_t state_len, -+ bool bypass) -+{ -+ /* This will be reset when sync callback is called. -+ * Should we set wsrep_ready to FALSE here too? */ -+// wsrep_notify_status(WSREP_MEMBER_DONOR); -+ local_status.set(WSREP_MEMBER_DONOR); -+ -+ const char* method = (char*)msg; -+ size_t method_len = strlen (method); -+ const char* data = method + method_len + 1; -+ -+ char uuid_str[37]; -+ wsrep_uuid_print (¤t_gtid->uuid, uuid_str, sizeof(uuid_str)); -+ -+ int ret; -+ if (!strcmp (WSREP_SST_MYSQLDUMP, method)) -+ { -+ ret = sst_donate_mysqldump(data, ¤t_gtid->uuid, uuid_str, -+ current_gtid->seqno, bypass); -+ } -+ else -+ { -+ ret = sst_donate_other(method, data, uuid_str, current_gtid->seqno,bypass); -+ } -+ -+ return (ret > 0 ? WSREP_CB_SUCCESS : WSREP_CB_FAILURE); -+} -+ -+void wsrep_SE_init_grab() -+{ -+ if (mysql_mutex_lock (&LOCK_wsrep_sst_init)) abort(); -+} -+ -+void wsrep_SE_init_wait() -+{ -+ while (SE_initialized == false) -+ { -+ mysql_cond_wait (&COND_wsrep_sst_init, &LOCK_wsrep_sst_init); -+ } -+ mysql_mutex_unlock (&LOCK_wsrep_sst_init); -+} -+ -+void wsrep_SE_init_done() -+{ -+ mysql_cond_signal (&COND_wsrep_sst_init); -+ mysql_mutex_unlock (&LOCK_wsrep_sst_init); -+} -+ -+void wsrep_SE_initialized() -+{ -+ SE_initialized = true; -+} - -=== added file 'sql/wsrep_sst.h' ---- old/sql/wsrep_sst.h 1970-01-01 00:00:00 +0000 -+++ new/sql/wsrep_sst.h 2013-10-02 14:02:46 +0000 -@@ -0,0 +1,40 @@ -+/* Copyright (C) 2013 Codership Oy -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; version 2 of the License. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License along -+ with this program; if not, write to the Free Software Foundation, Inc., -+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -+ -+#ifndef WSREP_SST_H -+#define WSREP_SST_H -+ -+#include // my_bool -+ -+/* system variables */ -+extern const char* wsrep_sst_method; -+extern const char* wsrep_sst_receive_address; -+extern const char* wsrep_sst_donor; -+extern char* wsrep_sst_auth; -+extern my_bool wsrep_sst_donor_rejects_queries; -+ -+/*! Synchronizes applier thread start with init thread */ -+extern void wsrep_sst_grab(); -+/*! Init thread waits for SST completion */ -+extern bool wsrep_sst_wait(); -+/*! Signals wsrep that initialization is complete, writesets can be applied */ -+extern void wsrep_sst_continue(); -+ -+extern void wsrep_SE_init_grab(); /*! grab init critical section */ -+extern void wsrep_SE_init_wait(); /*! wait for SE init to complete */ -+extern void wsrep_SE_init_done(); /*! signal that SE init is complte */ -+extern void wsrep_SE_initialized(); /*! mark SE initialization complete */ -+ -+#endif /* WSREP_SST_H */ - -=== added file 'sql/wsrep_thd.cc' ---- old/sql/wsrep_thd.cc 1970-01-01 00:00:00 +0000 -+++ new/sql/wsrep_thd.cc 2014-01-09 15:46:55 +0000 -@@ -0,0 +1,553 @@ -+/* Copyright (C) 2013 Codership Oy -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; version 2 of the License. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License along -+ with this program; if not, write to the Free Software Foundation, Inc., -+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -+ -+#include "wsrep_thd.h" -+ -+#include "transaction.h" -+#include "rpl_rli.h" -+#include "log_event.h" -+#include "sql_parse.h" -+#include "global_threads.h" // LOCK_thread_count, etc. -+#include "sql_base.h" // close_thread_tables() -+#include "mysqld.h" // start_wsrep_THD(); -+ -+static long long wsrep_bf_aborts_counter = 0; -+ -+int wsrep_show_bf_aborts (THD *thd, SHOW_VAR *var, char *buff) -+{ -+ wsrep_local_bf_aborts = my_atomic_load64(&wsrep_bf_aborts_counter); -+ var->type = SHOW_LONGLONG; -+ var->value = (char*)&wsrep_local_bf_aborts; -+ return 0; -+} -+ -+/* must have (&thd->LOCK_wsrep_thd) */ -+void wsrep_client_rollback(THD *thd) -+{ -+ WSREP_DEBUG("client rollback due to BF abort for (%ld), query: %s", -+ thd->thread_id, thd->query()); -+ -+ my_atomic_add64(&wsrep_bf_aborts_counter, 1); -+ -+ thd->wsrep_conflict_state= ABORTING; -+ mysql_mutex_unlock(&thd->LOCK_wsrep_thd); -+ trans_rollback(thd); -+ -+ if (thd->locked_tables_mode && thd->lock) -+ { -+ WSREP_DEBUG("unlocking tables for BF abort (%ld)", thd->thread_id); -+ thd->locked_tables_list.unlock_locked_tables(thd); -+ thd->variables.option_bits&= ~(OPTION_TABLE_LOCK); -+ } -+ -+ if (thd->global_read_lock.is_acquired()) -+ { -+ WSREP_DEBUG("unlocking GRL for BF abort (%ld)", thd->thread_id); -+ thd->global_read_lock.unlock_global_read_lock(thd); -+ } -+ -+ /* Release transactional metadata locks. */ -+ thd->mdl_context.release_transactional_locks(); -+ -+ /* release explicit MDL locks */ -+ thd->mdl_context.release_explicit_locks(); -+ -+ if (thd->get_binlog_table_maps()) -+ { -+ WSREP_DEBUG("clearing binlog table map for BF abort (%ld)", thd->thread_id); -+ thd->clear_binlog_table_maps(); -+ } -+ mysql_mutex_lock(&thd->LOCK_wsrep_thd); -+ thd->wsrep_conflict_state= ABORTED; -+} -+ -+#define NUMBER_OF_FIELDS_TO_IDENTIFY_COORDINATOR 1 -+#define NUMBER_OF_FIELDS_TO_IDENTIFY_WORKER 2 -+#include "rpl_info_factory.h" -+ -+static Relay_log_info* wsrep_relay_log_init(const char* log_fname) -+{ -+ uint rli_option = INFO_REPOSITORY_DUMMY; -+ Relay_log_info *rli= NULL; -+ rli = Rpl_info_factory::create_rli(rli_option, false); -+ rli->set_rli_description_event( -+ new Format_description_log_event(BINLOG_VERSION)); -+ -+ return (rli); -+ -+#ifdef REMOVED -+ Rpl_info_handler* handler_src= NULL; -+ Rpl_info_handler* handler_dest= NULL; -+ ulong *key_info_idx= NULL; -+ const char *msg= "Failed to allocate memory for the relay log info " -+ "structure"; -+ -+ DBUG_ENTER("Rpl_info_factory::create_rli"); -+ -+ if (!(rli= new Relay_log_info(false -+#ifdef HAVE_PSI_INTERFACE -+ ,&key_relay_log_info_run_lock, -+ &key_relay_log_info_data_lock, -+ &key_relay_log_info_sleep_lock, -+ &key_relay_log_info_data_cond, -+ &key_relay_log_info_start_cond, -+ &key_relay_log_info_stop_cond, -+ &key_relay_log_info_sleep_cond -+#endif /* HAVE_PSI_INTERFACE */ -+ ))) -+ goto err; -+ -+ if (!(key_info_idx= new ulong[NUMBER_OF_FIELDS_TO_IDENTIFY_COORDINATOR])) -+ goto err; -+ key_info_idx[0]= server_id; -+ rli->set_idx_info(key_info_idx, NUMBER_OF_FIELDS_TO_IDENTIFY_COORDINATOR); -+ -+ if(Rpl_info_factory::init_rli_repositories(rli, rli_option, &handler_src, -+ &handler_dest, &msg)) -+ goto err; -+ -+ if (Rpl_info_factory::decide_repository(rli, rli_option, &handler_src, -+ &handler_dest, &msg)) -+ goto err; -+ -+ DBUG_RETURN(rli); -+err: -+ delete handler_src; -+ delete handler_dest; -+ delete []key_info_idx; -+ if (rli) -+ { -+ /* -+ The handler was previously deleted so we need to remove -+ any reference to it. -+ */ -+ rli->set_idx_info(NULL, 0); -+ rli->set_rpl_info_handler(NULL); -+ rli->set_rpl_info_type(INVALID_INFO_REPOSITORY); -+ delete rli; -+ } -+ WSREP_ERROR("Error creating relay log info: %s.", msg); -+ DBUG_RETURN(NULL); -+#endif /* REMOVED */ -+} -+ -+static void wsrep_prepare_bf_thd(THD *thd, struct wsrep_thd_shadow* shadow) -+{ -+ shadow->options = thd->variables.option_bits; -+ shadow->server_status = thd->server_status; -+ shadow->wsrep_exec_mode = thd->wsrep_exec_mode; -+ shadow->vio = thd->net.vio; -+ -+ if (opt_log_slave_updates) -+ thd->variables.option_bits|= OPTION_BIN_LOG; -+ else -+ thd->variables.option_bits&= ~(OPTION_BIN_LOG); -+ -+ if (!thd->wsrep_rli) thd->wsrep_rli= wsrep_relay_log_init("wsrep_relay"); -+ thd->wsrep_rli->info_thd = thd; -+ -+ thd->wsrep_exec_mode= REPL_RECV; -+ thd->net.vio= 0; -+ thd->clear_error(); -+ -+ shadow->tx_isolation = thd->variables.tx_isolation; -+ thd->variables.tx_isolation = ISO_READ_COMMITTED; -+ thd->tx_isolation = ISO_READ_COMMITTED; -+ -+ shadow->db = thd->db; -+ shadow->db_length = thd->db_length; -+ thd->reset_db(NULL, 0); -+} -+ -+static void wsrep_return_from_bf_mode(THD *thd, struct wsrep_thd_shadow* shadow) -+{ -+ thd->variables.option_bits = shadow->options; -+ thd->server_status = shadow->server_status; -+ thd->wsrep_exec_mode = shadow->wsrep_exec_mode; -+ thd->net.vio = shadow->vio; -+ thd->variables.tx_isolation = shadow->tx_isolation; -+ thd->reset_db(shadow->db, shadow->db_length); -+} -+ -+void wsrep_replay_transaction(THD *thd) -+{ -+ /* checking if BF trx must be replayed */ -+ if (thd->wsrep_conflict_state== MUST_REPLAY) { -+ DBUG_ASSERT(wsrep_thd_trx_seqno(thd)); -+ if (thd->wsrep_exec_mode!= REPL_RECV) { -+ if (thd->get_stmt_da()->is_sent()) -+ { -+ WSREP_ERROR("replay issue, thd has reported status already"); -+ } -+ thd->get_stmt_da()->reset_diagnostics_area(); -+ -+ thd->wsrep_conflict_state= REPLAYING; -+ mysql_mutex_unlock(&thd->LOCK_wsrep_thd); -+ -+ mysql_reset_thd_for_next_command(thd); -+ thd->killed= THD::NOT_KILLED; -+ close_thread_tables(thd); -+ if (thd->locked_tables_mode && thd->lock) -+ { -+ WSREP_DEBUG("releasing table lock for replaying (%ld)", -+ thd->thread_id); -+ thd->locked_tables_list.unlock_locked_tables(thd); -+ thd->variables.option_bits&= ~(OPTION_TABLE_LOCK); -+ } -+ thd->mdl_context.release_transactional_locks(); -+ /* -+ Replaying will call MYSQL_START_STATEMENT when handling -+ BEGIN Query_log_event so end statement must be called before -+ replaying. -+ */ -+ MYSQL_END_STATEMENT(thd->m_statement_psi, thd->get_stmt_da()); -+ thd->m_statement_psi= NULL; -+ thd_proc_info(thd, "wsrep replaying trx"); -+ WSREP_DEBUG("replay trx: %s %lld", -+ thd->query() ? thd->query() : "void", -+ (long long)wsrep_thd_trx_seqno(thd)); -+ struct wsrep_thd_shadow shadow; -+ wsrep_prepare_bf_thd(thd, &shadow); -+ -+ /* From trans_begin() */ -+ thd->variables.option_bits|= OPTION_BEGIN; -+ thd->server_status|= SERVER_STATUS_IN_TRANS; -+ -+ int rcode = wsrep->replay_trx(wsrep, -+ &thd->wsrep_ws_handle, -+ (void *)thd); -+ -+ wsrep_return_from_bf_mode(thd, &shadow); -+ if (thd->wsrep_conflict_state!= REPLAYING) -+ WSREP_WARN("lost replaying mode: %d", thd->wsrep_conflict_state ); -+ -+ mysql_mutex_lock(&thd->LOCK_wsrep_thd); -+ -+ switch (rcode) -+ { -+ case WSREP_OK: -+ thd->wsrep_conflict_state= NO_CONFLICT; -+ wsrep->post_commit(wsrep, &thd->wsrep_ws_handle); -+ WSREP_DEBUG("trx_replay successful for: %ld %llu", -+ thd->thread_id, (long long)thd->real_id); -+ if (thd->get_stmt_da()->is_sent()) -+ { -+ WSREP_WARN("replay ok, thd has reported status"); -+ } -+ else if (thd->get_stmt_da()->is_set()) -+ { -+ if (thd->get_stmt_da()->status() != Diagnostics_area::DA_OK) -+ { -+ WSREP_WARN("replay ok, thd has error status %d", -+ thd->get_stmt_da()->status()); -+ } -+ } -+ else -+ { -+ my_ok(thd); -+ } -+ break; -+ case WSREP_TRX_FAIL: -+ if (thd->get_stmt_da()->is_sent()) -+ { -+ WSREP_ERROR("replay failed, thd has reported status"); -+ } -+ else -+ { -+ WSREP_DEBUG("replay failed, rolling back"); -+ //my_error(ER_LOCK_DEADLOCK, MYF(0), "wsrep aborted transaction"); -+ } -+ thd->wsrep_conflict_state= ABORTED; -+ wsrep->post_rollback(wsrep, &thd->wsrep_ws_handle); -+ break; -+ default: -+ WSREP_ERROR("trx_replay failed for: %d, query: %s", -+ rcode, thd->query() ? thd->query() : "void"); -+ /* we're now in inconsistent state, must abort */ -+ mysql_mutex_unlock(&thd->LOCK_wsrep_thd); -+ unireg_abort(1); -+ break; -+ } -+ -+ wsrep_cleanup_transaction(thd); -+ -+ mysql_mutex_lock(&LOCK_wsrep_replaying); -+ wsrep_replaying--; -+ WSREP_DEBUG("replaying decreased: %d, thd: %lu", -+ wsrep_replaying, thd->thread_id); -+ mysql_cond_broadcast(&COND_wsrep_replaying); -+ mysql_mutex_unlock(&LOCK_wsrep_replaying); -+ } -+ } -+} -+ -+static void wsrep_replication_process(THD *thd) -+{ -+ int rcode; -+ DBUG_ENTER("wsrep_replication_process"); -+ -+ struct wsrep_thd_shadow shadow; -+ -+ wsrep_prepare_bf_thd(thd, &shadow); -+ -+ /* From trans_begin() */ -+ thd->variables.option_bits|= OPTION_BEGIN; -+ thd->server_status|= SERVER_STATUS_IN_TRANS; -+ -+ rcode = wsrep->recv(wsrep, (void *)thd); -+ DBUG_PRINT("wsrep",("wsrep_repl returned: %d", rcode)); -+ -+ WSREP_INFO("applier thread exiting (code:%d)", rcode); -+ -+ switch (rcode) { -+ case WSREP_OK: -+ case WSREP_NOT_IMPLEMENTED: -+ case WSREP_CONN_FAIL: -+ /* provider does not support slave operations / disconnected from group, -+ * just close applier thread */ -+ break; -+ case WSREP_NODE_FAIL: -+ /* data inconsistency => SST is needed */ -+ /* Note: we cannot just blindly restart replication here, -+ * SST might require server restart if storage engines must be -+ * initialized after SST */ -+ WSREP_ERROR("node consistency compromised, aborting"); -+ wsrep_kill_mysql(thd); -+ break; -+ case WSREP_WARNING: -+ case WSREP_TRX_FAIL: -+ case WSREP_TRX_MISSING: -+ /* these suggests a bug in provider code */ -+ WSREP_WARN("bad return from recv() call: %d", rcode); -+ /* fall through to node shutdown */ -+ case WSREP_FATAL: -+ /* Cluster connectivity is lost. -+ * -+ * If applier was killed on purpose (KILL_CONNECTION), we -+ * avoid mysql shutdown. This is because the killer will then handle -+ * shutdown processing (or replication restarting) -+ */ -+ if (thd->killed != THD::KILL_CONNECTION) -+ { -+ wsrep_kill_mysql(thd); -+ } -+ break; -+ } -+ -+ mysql_mutex_lock(&LOCK_thread_count); -+ wsrep_close_applier(thd); -+ mysql_cond_broadcast(&COND_thread_count); -+ mysql_mutex_unlock(&LOCK_thread_count); -+ -+ TABLE *tmp; -+ while ((tmp = thd->temporary_tables)) -+ { -+ WSREP_WARN("Applier %lu, has temporary tables at exit: %s.%s", -+ thd->thread_id, -+ (tmp->s) ? tmp->s->db.str : "void", -+ (tmp->s) ? tmp->s->table_name.str : "void"); -+ } -+ wsrep_return_from_bf_mode(thd, &shadow); -+ DBUG_VOID_RETURN; -+} -+ -+void wsrep_create_appliers(long threads) -+{ -+ if (!wsrep_connected) -+ { -+ /* see wsrep_replication_start() for the logic */ -+ if (wsrep_cluster_address && strlen(wsrep_cluster_address) && -+ wsrep_provider && strcasecmp(wsrep_provider, "none")) -+ { -+ WSREP_ERROR("Trying to launch slave threads before creating " -+ "connection at '%s'", wsrep_cluster_address); -+ assert(0); -+ } -+ return; -+ } -+ -+ long wsrep_threads=0; -+ pthread_t hThread; -+ while (wsrep_threads++ < threads) { -+ if (pthread_create( -+ &hThread, &connection_attrib, -+ start_wsrep_THD, (void*)wsrep_replication_process)) -+ WSREP_WARN("Can't create thread to manage wsrep replication"); -+ } -+} -+ -+static void wsrep_rollback_process(THD *thd) -+{ -+ DBUG_ENTER("wsrep_rollback_process"); -+ -+ mysql_mutex_lock(&LOCK_wsrep_rollback); -+ wsrep_aborting_thd= NULL; -+ -+ while (thd->killed == THD::NOT_KILLED) { -+ thd_proc_info(thd, "wsrep aborter idle"); -+ thd->mysys_var->current_mutex= &LOCK_wsrep_rollback; -+ thd->mysys_var->current_cond= &COND_wsrep_rollback; -+ -+ mysql_cond_wait(&COND_wsrep_rollback,&LOCK_wsrep_rollback); -+ -+ WSREP_DEBUG("WSREP rollback thread wakes for signal"); -+ -+ mysql_mutex_lock(&thd->mysys_var->mutex); -+ thd_proc_info(thd, "wsrep aborter active"); -+ thd->mysys_var->current_mutex= 0; -+ thd->mysys_var->current_cond= 0; -+ mysql_mutex_unlock(&thd->mysys_var->mutex); -+ -+ /* check for false alarms */ -+ if (!wsrep_aborting_thd) -+ { -+ WSREP_DEBUG("WSREP rollback thread has empty abort queue"); -+ } -+ /* process all entries in the queue */ -+ while (wsrep_aborting_thd) { -+ THD *aborting; -+ wsrep_aborting_thd_t next = wsrep_aborting_thd->next; -+ aborting = wsrep_aborting_thd->aborting_thd; -+ my_free(wsrep_aborting_thd); -+ wsrep_aborting_thd= next; -+ /* -+ * must release mutex, appliers my want to add more -+ * aborting thds in our work queue, while we rollback -+ */ -+ mysql_mutex_unlock(&LOCK_wsrep_rollback); -+ -+ mysql_mutex_lock(&aborting->LOCK_wsrep_thd); -+ if (aborting->wsrep_conflict_state== ABORTED) -+ { -+ WSREP_DEBUG("WSREP, thd already aborted: %llu state: %d", -+ (long long)aborting->real_id, -+ aborting->wsrep_conflict_state); -+ -+ mysql_mutex_unlock(&aborting->LOCK_wsrep_thd); -+ mysql_mutex_lock(&LOCK_wsrep_rollback); -+ continue; -+ } -+ aborting->wsrep_conflict_state= ABORTING; -+ -+ mysql_mutex_unlock(&aborting->LOCK_wsrep_thd); -+ -+ aborting->store_globals(); -+ -+ mysql_mutex_lock(&aborting->LOCK_wsrep_thd); -+ wsrep_client_rollback(aborting); -+ WSREP_DEBUG("WSREP rollbacker aborted thd: (%lu %llu)", -+ aborting->thread_id, (long long)aborting->real_id); -+ mysql_mutex_unlock(&aborting->LOCK_wsrep_thd); -+ -+ mysql_mutex_lock(&LOCK_wsrep_rollback); -+ } -+ } -+ -+ mysql_mutex_unlock(&LOCK_wsrep_rollback); -+ sql_print_information("WSREP: rollbacker thread exiting"); -+ -+ DBUG_PRINT("wsrep",("wsrep rollbacker thread exiting")); -+ DBUG_VOID_RETURN; -+} -+ -+void wsrep_create_rollbacker() -+{ -+ if (wsrep_provider && strcasecmp(wsrep_provider, "none")) -+ { -+ pthread_t hThread; -+ /* create rollbacker */ -+ if (pthread_create( &hThread, &connection_attrib, -+ start_wsrep_THD, (void*)wsrep_rollback_process)) -+ WSREP_WARN("Can't create thread to manage wsrep rollback"); -+ } -+} -+ -+my_bool wsrep_thd_is_BF(void *thd_ptr, my_bool sync) -+{ -+ my_bool status = FALSE; -+ if (thd_ptr) -+ { -+ THD* thd = (THD*)thd_ptr; -+ if (sync) mysql_mutex_lock(&thd->LOCK_wsrep_thd); -+ -+ status = ((thd->wsrep_exec_mode == REPL_RECV) || -+ (thd->wsrep_exec_mode == TOTAL_ORDER)); -+ if (sync) mysql_mutex_unlock(&thd->LOCK_wsrep_thd); -+ } -+ return status; -+} -+ -+extern "C" -+my_bool wsrep_thd_is_BF_or_commit(void *thd_ptr, my_bool sync) -+{ -+ bool status = FALSE; -+ if (thd_ptr) -+ { -+ THD* thd = (THD*)thd_ptr; -+ if (sync) mysql_mutex_lock(&thd->LOCK_wsrep_thd); -+ -+ status = ((thd->wsrep_exec_mode == REPL_RECV) || -+ (thd->wsrep_exec_mode == TOTAL_ORDER) || -+ (thd->wsrep_exec_mode == LOCAL_COMMIT)); -+ if (sync) mysql_mutex_unlock(&thd->LOCK_wsrep_thd); -+ } -+ return status; -+} -+ -+extern "C" -+my_bool wsrep_thd_is_local(void *thd_ptr, my_bool sync) -+{ -+ bool status = FALSE; -+ if (thd_ptr) -+ { -+ THD* thd = (THD*)thd_ptr; -+ if (sync) mysql_mutex_lock(&thd->LOCK_wsrep_thd); -+ -+ status = (thd->wsrep_exec_mode == LOCAL_STATE); -+ if (sync) mysql_mutex_unlock(&thd->LOCK_wsrep_thd); -+ } -+ return status; -+} -+ -+int wsrep_abort_thd(void *bf_thd_ptr, void *victim_thd_ptr, my_bool signal) -+{ -+ THD *victim_thd = (THD *) victim_thd_ptr; -+ THD *bf_thd = (THD *) bf_thd_ptr; -+ DBUG_ENTER("wsrep_abort_thd"); -+ -+ if ( (WSREP(bf_thd) || -+ ( (WSREP_ON || wsrep_OSU_method_options == WSREP_OSU_RSU) && -+ bf_thd->wsrep_exec_mode == TOTAL_ORDER) ) && -+ victim_thd) -+ { -+ WSREP_DEBUG("wsrep_abort_thd, by: %llu, victim: %llu", (bf_thd) ? -+ (long long)bf_thd->real_id : 0, (long long)victim_thd->real_id); -+ ha_wsrep_abort_transaction(bf_thd, victim_thd, signal); -+ } -+ else -+ { -+ WSREP_DEBUG("wsrep_abort_thd not effective: %p %p", bf_thd, victim_thd); -+ } -+ -+ DBUG_RETURN(1); -+} -+ -+int wsrep_thd_in_locking_session(void *thd_ptr) -+{ -+ if (thd_ptr && ((THD *)thd_ptr)->in_lock_tables) { -+ return 1; -+ } -+ return 0; -+} - -=== added file 'sql/wsrep_thd.h' ---- old/sql/wsrep_thd.h 1970-01-01 00:00:00 +0000 -+++ new/sql/wsrep_thd.h 2014-01-09 15:46:55 +0000 -@@ -0,0 +1,36 @@ -+/* Copyright (C) 2013 Codership Oy -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; version 2 of the License. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License along -+ with this program; if not, write to the Free Software Foundation, Inc., -+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -+ -+#ifndef WSREP_THD_H -+#define WSREP_THD_H -+ -+#include "sql_class.h" -+ -+int wsrep_show_bf_aborts (THD *thd, SHOW_VAR *var, char *buff); -+void wsrep_client_rollback(THD *thd); -+void wsrep_replay_transaction(THD *thd); -+void wsrep_create_appliers(long threads); -+void wsrep_create_rollbacker(); -+ -+int wsrep_abort_thd(void *bf_thd_ptr, void *victim_thd_ptr, -+ my_bool signal); -+ -+extern my_bool wsrep_thd_is_BF(void *thd_ptr, my_bool sync); -+//extern "C" my_bool wsrep_thd_is_BF(void *thd_ptr, my_bool sync); -+extern "C" my_bool wsrep_thd_is_BF_or_commit(void *thd_ptr, my_bool sync); -+extern "C" my_bool wsrep_thd_is_local(void *thd_ptr, my_bool sync); -+int wsrep_thd_in_locking_session(void *thd_ptr); -+ -+#endif /* WSREP_THD_H */ - -=== added file 'sql/wsrep_utils.cc' ---- old/sql/wsrep_utils.cc 1970-01-01 00:00:00 +0000 -+++ new/sql/wsrep_utils.cc 2014-03-13 09:13:20 +0000 -@@ -0,0 +1,520 @@ -+/* Copyright 2010 Codership Oy -+ -+ 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -+ */ -+ -+//! @file some utility functions and classes not directly related to replication -+ -+#ifndef _GNU_SOURCE -+#define _GNU_SOURCE // POSIX_SPAWN_USEVFORK flag -+#endif -+ -+#include "wsrep_utils.h" -+#include "wsrep_mysqld.h" -+ -+#include -+ -+#include // posix_spawn() -+#include // pipe() -+#include // errno -+#include // strerror() -+#include // waitpid() -+#include -+#include -+#include // getaddrinfo() -+ -+extern char** environ; // environment variables -+ -+static wsp::string wsrep_PATH; -+ -+void -+wsrep_prepend_PATH (const char* path) -+{ -+ int count = 0; -+ -+ while (environ[count]) -+ { -+ if (strncmp (environ[count], "PATH=", 5)) -+ { -+ count++; -+ continue; -+ } -+ -+ char* const old_path (environ[count]); -+ -+ if (strstr (old_path, path)) return; // path already there -+ -+ size_t const new_path_len(strlen(old_path) + strlen(":") + -+ strlen(path) + 1); -+ -+ char* const new_path (reinterpret_cast(malloc(new_path_len))); -+ -+ if (new_path) -+ { -+ snprintf (new_path, new_path_len, "PATH=%s:%s", path, -+ old_path + strlen("PATH=")); -+ -+ wsrep_PATH.set (new_path); -+ environ[count] = new_path; -+ } -+ else -+ { -+ WSREP_ERROR ("Failed to allocate 'PATH' environment variable " -+ "buffer of size %zu.", new_path_len); -+ } -+ -+ return; -+ } -+ -+ WSREP_ERROR ("Failed to find 'PATH' environment variable. " -+ "State snapshot transfer may not be working."); -+} -+ -+namespace wsp -+{ -+ -+#define PIPE_READ 0 -+#define PIPE_WRITE 1 -+#define STDIN_FD 0 -+#define STDOUT_FD 1 -+ -+#ifndef POSIX_SPAWN_USEVFORK -+# define POSIX_SPAWN_USEVFORK 0 -+#endif -+ -+process::process (const char* cmd, const char* type) -+ : str_(cmd ? strdup(cmd) : strdup("")), io_(NULL), err_(EINVAL), pid_(0) -+{ -+ if (0 == str_) -+ { -+ WSREP_ERROR ("Can't allocate command line of size: %zu", strlen(cmd)); -+ err_ = ENOMEM; -+ return; -+ } -+ -+ if (0 == strlen(str_)) -+ { -+ WSREP_ERROR ("Can't start a process: null or empty command line."); -+ return; -+ } -+ -+ if (NULL == type || (strcmp (type, "w") && strcmp(type, "r"))) -+ { -+ WSREP_ERROR ("type argument should be either \"r\" or \"w\"."); -+ return; -+ } -+ -+ int pipe_fds[2] = { -1, }; -+ if (::pipe(pipe_fds)) -+ { -+ err_ = errno; -+ WSREP_ERROR ("pipe() failed: %d (%s)", err_, strerror(err_)); -+ return; -+ } -+ -+ // which end of pipe will be returned to parent -+ int const parent_end (strcmp(type,"w") ? PIPE_READ : PIPE_WRITE); -+ int const child_end (parent_end == PIPE_READ ? PIPE_WRITE : PIPE_READ); -+ int const close_fd (parent_end == PIPE_READ ? STDOUT_FD : STDIN_FD); -+ -+ char* const pargv[4] = { strdup("sh"), strdup("-c"), strdup(str_), NULL }; -+ if (!(pargv[0] && pargv[1] && pargv[2])) -+ { -+ err_ = ENOMEM; -+ WSREP_ERROR ("Failed to allocate pargv[] array."); -+ goto cleanup_pipe; -+ } -+ -+ posix_spawnattr_t attr; -+ err_ = posix_spawnattr_init (&attr); -+ if (err_) -+ { -+ WSREP_ERROR ("posix_spawnattr_init() failed: %d (%s)", -+ err_, strerror(err_)); -+ goto cleanup_pipe; -+ } -+ -+ err_ = posix_spawnattr_setflags (&attr, POSIX_SPAWN_SETSIGDEF | -+ POSIX_SPAWN_USEVFORK); -+ if (err_) -+ { -+ WSREP_ERROR ("posix_spawnattr_setflags() failed: %d (%s)", -+ err_, strerror(err_)); -+ goto cleanup_attr; -+ } -+ -+ posix_spawn_file_actions_t fact; -+ err_ = posix_spawn_file_actions_init (&fact); -+ if (err_) -+ { -+ WSREP_ERROR ("posix_spawn_file_actions_init() failed: %d (%s)", -+ err_, strerror(err_)); -+ goto cleanup_attr; -+ } -+ -+ // close child's stdout|stdin depending on what we returning -+ err_ = posix_spawn_file_actions_addclose (&fact, close_fd); -+ if (err_) -+ { -+ WSREP_ERROR ("posix_spawn_file_actions_addclose() failed: %d (%s)", -+ err_, strerror(err_)); -+ goto cleanup_fact; -+ } -+ -+ // substitute our pipe descriptor in place of the closed one -+ err_ = posix_spawn_file_actions_adddup2 (&fact, -+ pipe_fds[child_end], close_fd); -+ if (err_) -+ { -+ WSREP_ERROR ("posix_spawn_file_actions_addup2() failed: %d (%s)", -+ err_, strerror(err_)); -+ goto cleanup_fact; -+ } -+ -+ err_ = posix_spawnp (&pid_, pargv[0], &fact, &attr, pargv, environ); -+ if (err_) -+ { -+ WSREP_ERROR ("posix_spawnp(%s) failed: %d (%s)", -+ pargv[2], err_, strerror(err_)); -+ pid_ = 0; // just to make sure it was not messed up in the call -+ goto cleanup_fact; -+ } -+ -+ io_ = fdopen (pipe_fds[parent_end], type); -+ -+ if (io_) -+ { -+ pipe_fds[parent_end] = -1; // skip close on cleanup -+ } -+ else -+ { -+ err_ = errno; -+ WSREP_ERROR ("fdopen() failed: %d (%s)", err_, strerror(err_)); -+ } -+ -+cleanup_fact: -+ int err; // to preserve err_ code -+ err = posix_spawn_file_actions_destroy (&fact); -+ if (err) -+ { -+ WSREP_ERROR ("posix_spawn_file_actions_destroy() failed: %d (%s)\n", -+ err, strerror(err)); -+ } -+ -+cleanup_attr: -+ err = posix_spawnattr_destroy (&attr); -+ if (err) -+ { -+ WSREP_ERROR ("posix_spawnattr_destroy() failed: %d (%s)", -+ err, strerror(err)); -+ } -+ -+cleanup_pipe: -+ if (pipe_fds[0] >= 0) close (pipe_fds[0]); -+ if (pipe_fds[1] >= 0) close (pipe_fds[1]); -+ -+ free (pargv[0]); -+ free (pargv[1]); -+ free (pargv[2]); -+} -+ -+process::~process () -+{ -+ if (io_) -+ { -+ assert (pid_); -+ assert (str_); -+ -+ WSREP_WARN("Closing pipe to child process: %s, PID(%ld) " -+ "which might still be running.", str_, (long)pid_); -+ -+ if (fclose (io_) == -1) -+ { -+ err_ = errno; -+ WSREP_ERROR("fclose() failed: %d (%s)", err_, strerror(err_)); -+ } -+ } -+ -+ if (str_) free (const_cast(str_)); -+} -+ -+int -+process::wait () -+{ -+ if (pid_) -+ { -+ int status; -+ if (-1 == waitpid(pid_, &status, 0)) -+ { -+ err_ = errno; assert (err_); -+ WSREP_ERROR("Waiting for process failed: %s, PID(%ld): %d (%s)", -+ str_, (long)pid_, err_, strerror (err_)); -+ } -+ else -+ { // command completed, check exit status -+ if (WIFEXITED (status)) { -+ err_ = WEXITSTATUS (status); -+ } -+ else { // command didn't complete with exit() -+ WSREP_ERROR("Process was aborted."); -+ err_ = errno ? errno : ECHILD; -+ } -+ -+ if (err_) { -+ switch (err_) /* Translate error codes to more meaningful */ -+ { -+ case 126: err_ = EACCES; break; /* Permission denied */ -+ case 127: err_ = ENOENT; break; /* No such file or directory */ -+ } -+ WSREP_ERROR("Process completed with error: %s: %d (%s)", -+ str_, err_, strerror(err_)); -+ } -+ -+ pid_ = 0; -+ if (io_) fclose (io_); -+ io_ = NULL; -+ } -+ } -+ else { -+ assert (NULL == io_); -+ WSREP_ERROR("Command did not run: %s", str_); -+ } -+ -+ return err_; -+} -+ -+thd::thd (my_bool won) : init(), ptr(new THD) -+{ -+ if (ptr) -+ { -+ ptr->thread_stack= (char*) &ptr; -+ ptr->store_globals(); -+ ptr->variables.option_bits&= ~OPTION_BIN_LOG; // disable binlog -+ ptr->variables.wsrep_on = won; -+ ptr->security_ctx->master_access= ~(ulong)0; -+ lex_start(ptr); -+ } -+} -+ -+thd::~thd () -+{ -+ if (ptr) -+ { -+ delete ptr; -+ my_pthread_setspecific_ptr (THR_THD, 0); -+ } -+} -+ -+} // namespace wsp -+ -+/* Returns INADDR_NONE, INADDR_ANY, INADDR_LOOPBACK or something else */ -+unsigned int wsrep_check_ip (const char* const addr) -+{ -+ if (addr && 0 == strcasecmp(addr, MY_BIND_ALL_ADDRESSES)) return INADDR_ANY; -+ -+ unsigned int ret = INADDR_NONE; -+ struct addrinfo *res, hints; -+ -+ memset (&hints, 0, sizeof(hints)); -+ hints.ai_flags= AI_PASSIVE/*|AI_ADDRCONFIG*/; -+ hints.ai_socktype= SOCK_STREAM; -+ hints.ai_family= AF_UNSPEC; -+ -+ int gai_ret = getaddrinfo(addr, NULL, &hints, &res); -+ if (0 == gai_ret) -+ { -+ if (AF_INET == res->ai_family) /* IPv4 */ -+ { -+ struct sockaddr_in* a= (struct sockaddr_in*)res->ai_addr; -+ ret= htonl(a->sin_addr.s_addr); -+ } -+ else /* IPv6 */ -+ { -+ struct sockaddr_in6* a= (struct sockaddr_in6*)res->ai_addr; -+ if (IN6_IS_ADDR_UNSPECIFIED(&a->sin6_addr)) -+ ret= INADDR_ANY; -+ else if (IN6_IS_ADDR_LOOPBACK(&a->sin6_addr)) -+ ret= INADDR_LOOPBACK; -+ else -+ ret= 0xdeadbeef; -+ } -+ freeaddrinfo (res); -+ } -+ else { -+ WSREP_ERROR ("getaddrinfo() failed on '%s': %d (%s)", -+ addr, gai_ret, gai_strerror(gai_ret)); -+ } -+ -+ // uint8_t* b= (uint8_t*)&ret; -+ // fprintf (stderr, "########## wsrep_check_ip returning: %hhu.%hhu.%hhu.%hhu\n", -+ // b[0], b[1], b[2], b[3]); -+ -+ return ret; -+} -+ -+size_t wsrep_guess_ip (char* buf, size_t buf_len) -+{ -+ size_t ip_len = 0; -+ -+ if (my_bind_addr_str && strlen(my_bind_addr_str)) -+ { -+ unsigned int const ip_type= wsrep_check_ip(my_bind_addr_str); -+ -+ if (INADDR_NONE == ip_type) { -+ WSREP_ERROR("Networking not configured, cannot receive state transfer."); -+ return 0; -+ } -+ -+ if (INADDR_ANY != ip_type) {; -+ strncpy (buf, my_bind_addr_str, buf_len); -+ return strlen(buf); -+ } -+ } -+ -+ // mysqld binds to all interfaces - try IP from wsrep_node_address -+ if (wsrep_node_address && wsrep_node_address[0] != '\0') { -+ const char* const colon_ptr = strchr(wsrep_node_address, ':'); -+ -+ if (colon_ptr) -+ ip_len = colon_ptr - wsrep_node_address; -+ else -+ ip_len = strlen(wsrep_node_address); -+ -+ if (ip_len >= buf_len) { -+ WSREP_WARN("default_ip(): buffer too short: %zu <= %zd", buf_len, ip_len); -+ return 0; -+ } -+ -+ memcpy (buf, wsrep_node_address, ip_len); -+ buf[ip_len] = '\0'; -+ return ip_len; -+ } -+ -+ // try to find the address of the first one -+#if (TARGET_OS_LINUX == 1) -+ const char cmd[] = "/sbin/ifconfig | " -+// "grep -m1 -1 -E '^[a-z]?eth[0-9]' | tail -n 1 | " -+ "grep -E '^[[:space:]]+inet addr:' | grep -m1 -v 'inet addr:127' | " -+ "sed 's/:/ /' | awk '{ print $3 }'"; -+#elif defined(__sun__) -+ const char cmd[] = "/sbin/ifconfig -a | " -+ "/usr/gnu/bin/grep -m1 -1 -E 'net[0-9]:' | tail -n 1 | awk '{ print $2 }'"; -+#elif defined(__APPLE__) || defined(__FreeBSD__) -+ const char cmd[] = "/sbin/route -nv get 8.8.8.8 | tail -n1 | awk '{print $(NF)}'"; -+#else -+ char *cmd; -+#error "OS not supported" -+#endif -+ wsp::process proc (cmd, "r"); -+ -+ if (NULL != proc.pipe()) { -+ char* ret; -+ -+ ret = fgets (buf, buf_len, proc.pipe()); -+ -+ if (proc.wait()) return 0; -+ -+ if (NULL == ret) { -+ WSREP_ERROR("Failed to read output of: '%s'", cmd); -+ return 0; -+ } -+ } -+ else { -+ WSREP_ERROR("Failed to execute: '%s'", cmd); -+ return 0; -+ } -+ -+ // clear possible \n at the end of ip string left by fgets() -+ ip_len = strlen (buf); -+ if (ip_len > 0 && '\n' == buf[ip_len - 1]) { -+ ip_len--; -+ buf[ip_len] = '\0'; -+ } -+ -+ if (INADDR_NONE == inet_addr(buf)) { -+ if (strlen(buf) != 0) { -+ WSREP_WARN("Shell command returned invalid address: '%s'", buf); -+ } -+ return 0; -+ } -+ -+ return ip_len; -+} -+ -+size_t wsrep_guess_address(char* buf, size_t buf_len) -+{ -+ size_t addr_len = wsrep_guess_ip (buf, buf_len); -+ -+ if (addr_len && addr_len < buf_len) { -+ addr_len += snprintf (buf + addr_len, buf_len - addr_len, -+ ":%u", mysqld_port); -+ } -+ -+ return addr_len; -+} -+ -+/* -+ * WSREPXid -+ */ -+ -+#define WSREP_XID_PREFIX "WSREPXid" -+#define WSREP_XID_PREFIX_LEN MYSQL_XID_PREFIX_LEN -+#define WSREP_XID_UUID_OFFSET 8 -+#define WSREP_XID_SEQNO_OFFSET (WSREP_XID_UUID_OFFSET + sizeof(wsrep_uuid_t)) -+#define WSREP_XID_GTRID_LEN (WSREP_XID_SEQNO_OFFSET + sizeof(wsrep_seqno_t)) -+ -+void wsrep_xid_init(XID* xid, const wsrep_uuid_t* uuid, wsrep_seqno_t seqno) -+{ -+ xid->formatID= 1; -+ xid->gtrid_length= WSREP_XID_GTRID_LEN; -+ xid->bqual_length= 0; -+ memset(xid->data, 0, sizeof(xid->data)); -+ memcpy(xid->data, WSREP_XID_PREFIX, WSREP_XID_PREFIX_LEN); -+ memcpy(xid->data + WSREP_XID_UUID_OFFSET, uuid, sizeof(wsrep_uuid_t)); -+ memcpy(xid->data + WSREP_XID_SEQNO_OFFSET, &seqno, sizeof(wsrep_seqno_t)); -+} -+ -+const wsrep_uuid_t* wsrep_xid_uuid(const XID* xid) -+{ -+ if (wsrep_is_wsrep_xid(xid)) -+ return reinterpret_cast(xid->data -+ + WSREP_XID_UUID_OFFSET); -+ else -+ return &WSREP_UUID_UNDEFINED; -+} -+ -+wsrep_seqno_t wsrep_xid_seqno(const XID* xid) -+{ -+ -+ if (wsrep_is_wsrep_xid(xid)) -+ { -+ wsrep_seqno_t seqno; -+ memcpy(&seqno, xid->data + WSREP_XID_SEQNO_OFFSET, sizeof(wsrep_seqno_t)); -+ return seqno; -+ } -+ else -+ { -+ return WSREP_SEQNO_UNDEFINED; -+ } -+} -+ -+extern -+int wsrep_is_wsrep_xid(const void* xid_ptr) -+{ -+ const XID* xid= reinterpret_cast(xid_ptr); -+ return (xid->formatID == 1 && -+ xid->gtrid_length == WSREP_XID_GTRID_LEN && -+ xid->bqual_length == 0 && -+ !memcmp(xid->data, WSREP_XID_PREFIX, WSREP_XID_PREFIX_LEN)); -+} - -=== added file 'sql/wsrep_utils.h' ---- old/sql/wsrep_utils.h 1970-01-01 00:00:00 +0000 -+++ new/sql/wsrep_utils.h 2013-10-02 14:02:46 +0000 -@@ -0,0 +1,208 @@ -+/* Copyright (C) 2013 Codership Oy -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; version 2 of the License. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License along -+ with this program; if not, write to the Free Software Foundation, Inc., -+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -+ -+#ifndef WSREP_UTILS_H -+#define WSREP_UTILS_H -+ -+#include "wsrep_priv.h" -+ -+unsigned int wsrep_check_ip (const char* addr); -+size_t wsrep_guess_ip (char* buf, size_t buf_len); -+size_t wsrep_guess_address(char* buf, size_t buf_len); -+ -+namespace wsp { -+class node_status -+{ -+public: -+ node_status() : status(WSREP_MEMBER_UNDEFINED) {} -+ void set(wsrep_member_status_t new_status, -+ const wsrep_view_info_t* view = 0) -+ { -+ if (status != new_status || 0 != view) -+ { -+ wsrep_notify_status(new_status, view); -+ status = new_status; -+ } -+ } -+ wsrep_member_status_t get() const { return status; } -+private: -+ wsrep_member_status_t status; -+}; -+} /* namespace wsp */ -+ -+extern wsp::node_status local_status; -+ -+namespace wsp { -+/* A small class to run external programs. */ -+class process -+{ -+private: -+ const char* const str_; -+ FILE* io_; -+ int err_; -+ pid_t pid_; -+ -+public: -+/*! @arg type is a pointer to a null-terminated string which must contain -+ either the letter 'r' for reading or the letter 'w' for writing. -+ */ -+ process (const char* cmd, const char* type); -+ ~process (); -+ -+ FILE* pipe () { return io_; } -+ int error() { return err_; } -+ int wait (); -+ const char* cmd() { return str_; } -+}; -+ -+class thd -+{ -+ class thd_init -+ { -+ public: -+ thd_init() { my_thread_init(); } -+ ~thd_init() { my_thread_end(); } -+ } -+ init; -+ -+ thd (const thd&); -+ thd& operator= (const thd&); -+ -+public: -+ -+ thd(my_bool wsrep_on); -+ ~thd(); -+ THD* const ptr; -+}; -+ -+class string -+{ -+public: -+ string() : string_(0) {} -+ void set(char* str) { if (string_) free (string_); string_ = str; } -+ ~string() { set (0); } -+private: -+ char* string_; -+}; -+ -+#ifdef REMOVED -+class lock -+{ -+ pthread_mutex_t* const mtx_; -+ -+public: -+ -+ lock (pthread_mutex_t* mtx) : mtx_(mtx) -+ { -+ int err = pthread_mutex_lock (mtx_); -+ -+ if (err) -+ { -+ WSREP_ERROR("Mutex lock failed: %s", strerror(err)); -+ abort(); -+ } -+ } -+ -+ virtual ~lock () -+ { -+ int err = pthread_mutex_unlock (mtx_); -+ -+ if (err) -+ { -+ WSREP_ERROR("Mutex unlock failed: %s", strerror(err)); -+ abort(); -+ } -+ } -+ -+ inline void wait (pthread_cond_t* cond) -+ { -+ pthread_cond_wait (cond, mtx_); -+ } -+ -+private: -+ -+ lock (const lock&); -+ lock& operator=(const lock&); -+ -+}; -+ -+class monitor -+{ -+ int mutable refcnt; -+ pthread_mutex_t mutable mtx; -+ pthread_cond_t mutable cond; -+ -+public: -+ -+ monitor() : refcnt(0) -+ { -+ pthread_mutex_init (&mtx, NULL); -+ pthread_cond_init (&cond, NULL); -+ } -+ -+ ~monitor() -+ { -+ pthread_mutex_destroy (&mtx); -+ pthread_cond_destroy (&cond); -+ } -+ -+ void enter() const -+ { -+ lock l(&mtx); -+ -+ while (refcnt) -+ { -+ l.wait(&cond); -+ } -+ refcnt++; -+ } -+ -+ void leave() const -+ { -+ lock l(&mtx); -+ -+ refcnt--; -+ if (refcnt == 0) -+ { -+ pthread_cond_signal (&cond); -+ } -+ } -+ -+private: -+ -+ monitor (const monitor&); -+ monitor& operator= (const monitor&); -+}; -+ -+class critical -+{ -+ const monitor& mon; -+ -+public: -+ -+ critical(const monitor& m) : mon(m) { mon.enter(); } -+ -+ ~critical() { mon.leave(); } -+ -+private: -+ -+ critical (const critical&); -+ critical& operator= (const critical&); -+}; -+#endif -+ -+} // namespace wsrep -+ -+#endif /* WSREP_UTILS_H */ - -=== added file 'sql/wsrep_var.cc' ---- old/sql/wsrep_var.cc 1970-01-01 00:00:00 +0000 -+++ new/sql/wsrep_var.cc 2014-01-03 19:49:19 +0000 -@@ -0,0 +1,597 @@ -+/* Copyright 2008 Codership Oy -+ -+ 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -+ -+#include "wsrep_var.h" -+ -+#include -+#include -+#include -+#include -+#include -+#include "wsrep_priv.h" -+#include "wsrep_thd.h" -+#include -+#include -+#include -+ -+#define WSREP_START_POSITION_ZERO "00000000-0000-0000-0000-000000000000:-1" -+#define WSREP_CLUSTER_NAME "my_wsrep_cluster" -+ -+const char* wsrep_provider = 0; -+const char* wsrep_provider_options = 0; -+const char* wsrep_cluster_address = 0; -+const char* wsrep_cluster_name = 0; -+const char* wsrep_node_name = 0; -+const char* wsrep_node_address = 0; -+const char* wsrep_node_incoming_address = 0; -+const char* wsrep_start_position = 0; -+ulong wsrep_OSU_method_options; -+ -+int wsrep_init_vars() -+{ -+ wsrep_provider = my_strdup(WSREP_NONE, MYF(MY_WME)); -+ wsrep_provider_options= my_strdup("", MYF(MY_WME)); -+ wsrep_cluster_address = my_strdup("", MYF(MY_WME)); -+ wsrep_cluster_name = my_strdup(WSREP_CLUSTER_NAME, MYF(MY_WME)); -+ wsrep_node_name = my_strdup("", MYF(MY_WME)); -+ wsrep_node_address = my_strdup("", MYF(MY_WME)); -+ wsrep_node_incoming_address= my_strdup(WSREP_NODE_INCOMING_AUTO, MYF(MY_WME)); -+ wsrep_start_position = my_strdup(WSREP_START_POSITION_ZERO, MYF(MY_WME)); -+ -+ global_system_variables.binlog_format=BINLOG_FORMAT_ROW; -+ return 0; -+} -+ -+bool wsrep_on_update (sys_var *self, THD* thd, enum_var_type var_type) -+{ -+ if (var_type == OPT_GLOBAL) { -+ // FIXME: this variable probably should be changed only per session -+ thd->variables.wsrep_on = global_system_variables.wsrep_on; -+ } -+ return false; -+} -+ -+void wsrep_causal_reads_update (sys_var *self, THD* thd, enum_var_type var_type) -+{ -+ if (var_type == OPT_GLOBAL) { -+ thd->variables.wsrep_causal_reads = global_system_variables.wsrep_causal_reads; -+ } -+} -+ -+static int wsrep_start_position_verify (const char* start_str) -+{ -+ size_t start_len; -+ wsrep_uuid_t uuid; -+ ssize_t uuid_len; -+ -+ start_len = strlen (start_str); -+ if (start_len < 34) -+ return 1; -+ -+ uuid_len = wsrep_uuid_scan (start_str, start_len, &uuid); -+ if (uuid_len < 0 || (start_len - uuid_len) < 2) -+ return 1; -+ -+ if (start_str[uuid_len] != ':') // separator should follow UUID -+ return 1; -+ -+ char* endptr; -+ wsrep_seqno_t const seqno __attribute__((unused)) // to avoid GCC warnings -+ (strtoll(&start_str[uuid_len + 1], &endptr, 10)); -+ -+ if (*endptr == '\0') return 0; // remaining string was seqno -+ -+ return 1; -+} -+ -+bool wsrep_start_position_check (sys_var *self, THD* thd, set_var* var) -+{ -+ char buff[FN_REFLEN]; -+ String str(buff, sizeof(buff), system_charset_info), *res; -+ const char* start_str = NULL; -+ -+ if (!(res = var->value->val_str(&str))) goto err; -+ -+ start_str = res->c_ptr(); -+ -+ if (!start_str) goto err; -+ -+ if (!wsrep_start_position_verify(start_str)) return 0; -+ -+err: -+ -+ my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), var->var->name.str, -+ start_str ? start_str : "NULL"); -+ return 1; -+} -+ -+void wsrep_set_local_position (const char* value) -+{ -+ size_t value_len = strlen (value); -+ size_t uuid_len = wsrep_uuid_scan (value, value_len, &local_uuid); -+ -+ local_seqno = strtoll (value + uuid_len + 1, NULL, 10); -+ -+ XID xid; -+ wsrep_xid_init(&xid, &local_uuid, local_seqno); -+ wsrep_set_SE_checkpoint(&xid); -+ WSREP_INFO ("wsrep_start_position var submitted: '%s'", wsrep_start_position); -+} -+ -+bool wsrep_start_position_update (sys_var *self, THD* thd, enum_var_type type) -+{ -+ // since this value passed wsrep_start_position_check, don't check anything -+ // here -+ wsrep_set_local_position (wsrep_start_position); -+ -+ if (wsrep) { -+ wsrep_sst_received (wsrep, &local_uuid, local_seqno, NULL, 0); -+ } -+ -+ return 0; -+} -+ -+void wsrep_start_position_init (const char* val) -+{ -+ if (NULL == val || wsrep_start_position_verify (val)) -+ { -+ WSREP_ERROR("Bad initial value for wsrep_start_position: %s", -+ (val ? val : "")); -+ return; -+ } -+ -+ wsrep_set_local_position (val); -+} -+ -+static bool refresh_provider_options() -+{ -+ WSREP_DEBUG("refresh_provider_options: %s", -+ (wsrep_provider_options) ? wsrep_provider_options : "null"); -+ char* opts= wsrep->options_get(wsrep); -+ if (opts) -+ { -+ if (wsrep_provider_options) my_free((void *)wsrep_provider_options); -+ wsrep_provider_options = (char*)my_memdup(opts, strlen(opts) + 1, -+ MYF(MY_WME)); -+ } -+ else -+ { -+ WSREP_ERROR("Failed to get provider options"); -+ return true; -+ } -+ return false; -+} -+ -+static int wsrep_provider_verify (const char* provider_str) -+{ -+ MY_STAT f_stat; -+ char path[FN_REFLEN]; -+ -+ if (!provider_str || strlen(provider_str)== 0) -+ return 1; -+ -+ if (!strcmp(provider_str, WSREP_NONE)) -+ return 0; -+ -+ if (!unpack_filename(path, provider_str)) -+ return 1; -+ -+ /* check that provider file exists */ -+ memset(&f_stat, 0, sizeof(MY_STAT)); -+ if (!my_stat(path, &f_stat, MYF(0))) -+ { -+ return 1; -+ } -+ return 0; -+} -+ -+bool wsrep_provider_check (sys_var *self, THD* thd, set_var* var) -+{ -+ char buff[FN_REFLEN]; -+ String str(buff, sizeof(buff), system_charset_info), *res; -+ const char* provider_str = NULL; -+ -+ if (!(res = var->value->val_str(&str))) goto err; -+ -+ provider_str = res->c_ptr(); -+ -+ if (!provider_str) goto err; -+ -+ if (!wsrep_provider_verify(provider_str)) return 0; -+ -+err: -+ -+ my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), var->var->name.str, -+ provider_str ? provider_str : "NULL"); -+ return 1; -+} -+ -+bool wsrep_provider_update (sys_var *self, THD* thd, enum_var_type type) -+{ -+ bool rcode= false; -+ -+ bool wsrep_on_saved= thd->variables.wsrep_on; -+ thd->variables.wsrep_on= false; -+ -+ WSREP_DEBUG("wsrep_provider_update: %s", wsrep_provider); -+ -+ /* stop replication is heavy operation, and includes closing all client -+ connections. Closing clients may need to get LOCK_global_system_variables -+ at least in MariaDB. -+ -+ Note: releasing LOCK_global_system_variables may cause race condition, if -+ there can be several concurrent clients changing wsrep_provider -+ */ -+ mysql_mutex_unlock(&LOCK_global_system_variables); -+ wsrep_stop_replication(thd); -+ mysql_mutex_lock(&LOCK_global_system_variables); -+ -+ wsrep_deinit(); -+ -+ char* tmp= strdup(wsrep_provider); // wsrep_init() rewrites provider -+ //when fails -+ if (wsrep_init()) -+ { -+ my_error(ER_CANT_OPEN_LIBRARY, MYF(0), tmp); -+ rcode = true; -+ } -+ free(tmp); -+ -+ // we sure don't want to use old address with new provider -+ wsrep_cluster_address_init(NULL); -+ wsrep_provider_options_init(NULL); -+ -+ thd->variables.wsrep_on= wsrep_on_saved; -+ -+ refresh_provider_options(); -+ -+ return rcode; -+} -+ -+void wsrep_provider_init (const char* value) -+{ -+ WSREP_DEBUG("wsrep_provider_init: %s -> %s", -+ (wsrep_provider) ? wsrep_provider : "null", -+ (value) ? value : "null"); -+ if (NULL == value || wsrep_provider_verify (value)) -+ { -+ WSREP_ERROR("Bad initial value for wsrep_provider: %s", -+ (value ? value : "")); -+ return; -+ } -+ -+ if (wsrep_provider) my_free((void *)wsrep_provider); -+ wsrep_provider = my_strdup(value, MYF(0)); -+} -+ -+bool wsrep_provider_options_check(sys_var *self, THD* thd, set_var* var) -+{ -+ return 0; -+} -+ -+bool wsrep_provider_options_update(sys_var *self, THD* thd, enum_var_type type) -+{ -+ wsrep_status_t ret= wsrep->options_set(wsrep, wsrep_provider_options); -+ if (ret != WSREP_OK) -+ { -+ WSREP_ERROR("Set options returned %d", ret); -+ refresh_provider_options(); -+ return true; -+ } -+ return refresh_provider_options(); -+} -+ -+void wsrep_provider_options_init(const char* value) -+{ -+ if (wsrep_provider_options && wsrep_provider_options != value) -+ my_free((void *)wsrep_provider_options); -+ wsrep_provider_options = (value) ? my_strdup(value, MYF(0)) : NULL; -+} -+ -+static int wsrep_cluster_address_verify (const char* cluster_address_str) -+{ -+ /* There is no predefined address format, it depends on provider. */ -+ return 0; -+} -+ -+bool wsrep_cluster_address_check (sys_var *self, THD* thd, set_var* var) -+{ -+ char buff[FN_REFLEN]; -+ String str(buff, sizeof(buff), system_charset_info), *res; -+ const char* cluster_address_str = NULL; -+ -+ if (!(res = var->value->val_str(&str))) goto err; -+ -+ cluster_address_str = res->c_ptr(); -+ -+ if (!wsrep_cluster_address_verify(cluster_address_str)) return 0; -+ -+ err: -+ -+ my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), var->var->name.str, -+ cluster_address_str ? cluster_address_str : "NULL"); -+ return 1 ; -+} -+ -+bool wsrep_cluster_address_update (sys_var *self, THD* thd, enum_var_type type) -+{ -+ bool wsrep_on_saved= thd->variables.wsrep_on; -+ thd->variables.wsrep_on= false; -+ -+ /* stop replication is heavy operation, and includes closing all client -+ connections. Closing clients may need to get LOCK_global_system_variables -+ at least in MariaDB. -+ -+ Note: releasing LOCK_global_system_variables may cause race condition, if -+ there can be several concurrent clients changing wsrep_provider -+ */ -+ mysql_mutex_unlock(&LOCK_global_system_variables); -+ wsrep_stop_replication(thd); -+ mysql_mutex_lock(&LOCK_global_system_variables); -+ -+ if (wsrep_start_replication()) -+ { -+ wsrep_create_rollbacker(); -+ wsrep_create_appliers(wsrep_slave_threads); -+ } -+ -+ thd->variables.wsrep_on= wsrep_on_saved; -+ -+ return false; -+} -+ -+void wsrep_cluster_address_init (const char* value) -+{ -+ WSREP_DEBUG("wsrep_cluster_address_init: %s -> %s", -+ (wsrep_cluster_address) ? wsrep_cluster_address : "null", -+ (value) ? value : "null"); -+ -+ if (wsrep_cluster_address) my_free ((void*)wsrep_cluster_address); -+ wsrep_cluster_address = (value) ? my_strdup(value, MYF(0)) : NULL; -+} -+ -+bool wsrep_cluster_name_check (sys_var *self, THD* thd, set_var* var) -+{ -+ char buff[FN_REFLEN]; -+ String str(buff, sizeof(buff), system_charset_info), *res; -+ const char* cluster_name_str = NULL; -+ -+ if (!(res = var->value->val_str(&str))) goto err; -+ -+ cluster_name_str = res->c_ptr(); -+ -+ if (!cluster_name_str || strlen(cluster_name_str) == 0) goto err; -+ -+ return 0; -+ -+ err: -+ -+ my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), var->var->name.str, -+ cluster_name_str ? cluster_name_str : "NULL"); -+ return 1; -+} -+ -+bool wsrep_cluster_name_update (sys_var *self, THD* thd, enum_var_type type) -+{ -+ return 0; -+} -+ -+bool wsrep_node_name_check (sys_var *self, THD* thd, set_var* var) -+{ -+ char buff[FN_REFLEN]; -+ String str(buff, sizeof(buff), system_charset_info), *res; -+ const char* node_name_str = NULL; -+ -+ if (!(res = var->value->val_str(&str))) goto err; -+ -+ node_name_str = res->c_ptr(); -+ -+ if (!node_name_str || strlen(node_name_str) == 0) goto err; -+ -+ return 0; -+ -+ err: -+ -+ my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), var->var->name.str, -+ node_name_str ? node_name_str : "NULL"); -+ return 1; -+} -+ -+bool wsrep_node_name_update (sys_var *self, THD* thd, enum_var_type type) -+{ -+ return 0; -+} -+ -+// TODO: do something more elaborate, like checking connectivity -+bool wsrep_node_address_check (sys_var *self, THD* thd, set_var* var) -+{ -+ char buff[FN_REFLEN]; -+ String str(buff, sizeof(buff), system_charset_info), *res; -+ const char* node_address_str = NULL; -+ -+ if (!(res = var->value->val_str(&str))) goto err; -+ -+ node_address_str = res->c_ptr(); -+ -+ if (!node_address_str || strlen(node_address_str) == 0) goto err; -+ -+ return 0; -+ -+ err: -+ -+ my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), var->var->name.str, -+ node_address_str ? node_address_str : "NULL"); -+ return 1; -+} -+ -+bool wsrep_node_address_update (sys_var *self, THD* thd, enum_var_type type) -+{ -+ return 0; -+} -+ -+void wsrep_node_address_init (const char* value) -+{ -+ if (wsrep_node_address && strcmp(wsrep_node_address, value)) -+ my_free ((void*)wsrep_node_address); -+ -+ wsrep_node_address = (value) ? my_strdup(value, MYF(0)) : NULL; -+} -+ -+bool wsrep_slave_threads_check (sys_var *self, THD* thd, set_var* var) -+{ -+ mysql_mutex_lock(&LOCK_wsrep_slave_threads); -+ wsrep_slave_count_change = var->value->val_int() - wsrep_slave_threads; -+ mysql_mutex_unlock(&LOCK_wsrep_slave_threads); -+ -+ return 0; -+} -+ -+bool wsrep_slave_threads_update (sys_var *self, THD* thd, enum_var_type type) -+{ -+ if (wsrep_slave_count_change > 0) -+ { -+ wsrep_create_appliers(wsrep_slave_count_change); -+ wsrep_slave_count_change = 0; -+ } -+ return false; -+} -+ -+bool wsrep_desync_check (sys_var *self, THD* thd, set_var* var) -+{ -+ bool new_wsrep_desync = var->value->val_bool(); -+ if (wsrep_desync == new_wsrep_desync) { -+ if (new_wsrep_desync) { -+ push_warning (thd, Sql_condition::WARN_LEVEL_WARN, -+ ER_WRONG_VALUE_FOR_VAR, -+ "'wsrep_desync' is already ON."); -+ } else { -+ push_warning (thd, Sql_condition::WARN_LEVEL_WARN, -+ ER_WRONG_VALUE_FOR_VAR, -+ "'wsrep_desync' is already OFF."); -+ } -+ } -+ return 0; -+} -+ -+bool wsrep_desync_update (sys_var *self, THD* thd, enum_var_type type) -+{ -+ wsrep_status_t ret(WSREP_WARNING); -+ if (wsrep_desync) { -+ ret = wsrep->desync (wsrep); -+ if (ret != WSREP_OK) { -+ WSREP_WARN ("SET desync failed %d for %s", ret, thd->query()); -+ my_error (ER_CANNOT_USER, MYF(0), "'desync'", thd->query()); -+ return true; -+ } -+ } else { -+ ret = wsrep->resync (wsrep); -+ if (ret != WSREP_OK) { -+ WSREP_WARN ("SET resync failed %d for %s", ret, thd->query()); -+ my_error (ER_CANNOT_USER, MYF(0), "'resync'", thd->query()); -+ return true; -+ } -+ } -+ return false; -+} -+ -+/* -+ * Status variables stuff below -+ */ -+static inline void -+wsrep_assign_to_mysql (SHOW_VAR* mysql, wsrep_stats_var* wsrep) -+{ -+ mysql->name = wsrep->name; -+ switch (wsrep->type) { -+ case WSREP_VAR_INT64: -+ mysql->value = (char*) &wsrep->value._int64; -+ mysql->type = SHOW_LONGLONG; -+ break; -+ case WSREP_VAR_STRING: -+ mysql->value = (char*) &wsrep->value._string; -+ mysql->type = SHOW_CHAR_PTR; -+ break; -+ case WSREP_VAR_DOUBLE: -+ mysql->value = (char*) &wsrep->value._double; -+ mysql->type = SHOW_DOUBLE; -+ break; -+ } -+} -+ -+#if DYNAMIC -+// somehow this mysql status thing works only with statically allocated arrays. -+static SHOW_VAR* mysql_status_vars = NULL; -+static int mysql_status_len = -1; -+#else -+static SHOW_VAR mysql_status_vars[512 + 1]; -+static const int mysql_status_len = 512; -+#endif -+ -+static void export_wsrep_status_to_mysql(THD* thd) -+{ -+ int wsrep_status_len, i; -+ -+ thd->wsrep_status_vars = wsrep->stats_get(wsrep); -+ -+ if (!thd->wsrep_status_vars) { -+ return; -+ } -+ -+ for (wsrep_status_len = 0; -+ thd->wsrep_status_vars[wsrep_status_len].name != NULL; -+ wsrep_status_len++); -+ -+#if DYNAMIC -+ if (wsrep_status_len != mysql_status_len) { -+ void* tmp = realloc (mysql_status_vars, -+ (wsrep_status_len + 1) * sizeof(SHOW_VAR)); -+ if (!tmp) { -+ -+ sql_print_error ("Out of memory for wsrep status variables." -+ "Number of variables: %d", wsrep_status_len); -+ return; -+ } -+ -+ mysql_status_len = wsrep_status_len; -+ mysql_status_vars = (SHOW_VAR*)tmp; -+ } -+ /* @TODO: fix this: */ -+#else -+ if (mysql_status_len < wsrep_status_len) wsrep_status_len= mysql_status_len; -+#endif -+ -+ for (i = 0; i < wsrep_status_len; i++) -+ wsrep_assign_to_mysql (mysql_status_vars + i, thd->wsrep_status_vars + i); -+ -+ mysql_status_vars[wsrep_status_len].name = NullS; -+ mysql_status_vars[wsrep_status_len].value = NullS; -+ mysql_status_vars[wsrep_status_len].type = SHOW_LONG; -+} -+ -+int wsrep_show_status (THD *thd, SHOW_VAR *var, char *buff) -+{ -+ export_wsrep_status_to_mysql(thd); -+ var->type= SHOW_ARRAY; -+ var->value= (char *) &mysql_status_vars; -+ return 0; -+} -+ -+void wsrep_free_status (THD* thd) -+{ -+ if (thd->wsrep_status_vars) -+ { -+ wsrep->stats_free (wsrep, thd->wsrep_status_vars); -+ thd->wsrep_status_vars = 0; -+ } -+} - -=== added file 'sql/wsrep_var.h' ---- old/sql/wsrep_var.h 1970-01-01 00:00:00 +0000 -+++ new/sql/wsrep_var.h 2013-10-11 17:08:12 +0000 -@@ -0,0 +1,83 @@ -+/* Copyright (C) 2013 Codership Oy -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; version 2 of the License. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License along -+ with this program; if not, write to the Free Software Foundation, Inc., -+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -+ -+#ifndef WSREP_VAR_H -+#define WSREP_VAR_H -+ -+#define WSREP_NODE_INCOMING_AUTO "AUTO" -+ -+// MySQL variables funcs -+ -+#include "sql_priv.h" -+class sys_var; -+class set_var; -+class THD; -+ -+int wsrep_init_vars(); -+ -+#define CHECK_ARGS (sys_var *self, THD* thd, set_var *var) -+#define UPDATE_ARGS (sys_var *self, THD* thd, enum_var_type type) -+#define DEFAULT_ARGS (THD* thd, enum_var_type var_type) -+#define INIT_ARGS (const char* opt) -+ -+extern bool wsrep_on_update UPDATE_ARGS; -+extern void wsrep_causal_reads_update UPDATE_ARGS; -+extern bool wsrep_start_position_check CHECK_ARGS; -+extern bool wsrep_start_position_update UPDATE_ARGS; -+extern void wsrep_start_position_init INIT_ARGS; -+ -+extern bool wsrep_provider_check CHECK_ARGS; -+extern bool wsrep_provider_update UPDATE_ARGS; -+extern void wsrep_provider_init INIT_ARGS; -+ -+extern bool wsrep_provider_options_check CHECK_ARGS; -+extern bool wsrep_provider_options_update UPDATE_ARGS; -+extern void wsrep_provider_options_init INIT_ARGS; -+ -+extern bool wsrep_cluster_address_check CHECK_ARGS; -+extern bool wsrep_cluster_address_update UPDATE_ARGS; -+extern void wsrep_cluster_address_init INIT_ARGS; -+ -+extern bool wsrep_cluster_name_check CHECK_ARGS; -+extern bool wsrep_cluster_name_update UPDATE_ARGS; -+ -+extern bool wsrep_node_name_check CHECK_ARGS; -+extern bool wsrep_node_name_update UPDATE_ARGS; -+ -+extern bool wsrep_node_address_check CHECK_ARGS; -+extern bool wsrep_node_address_update UPDATE_ARGS; -+extern void wsrep_node_address_init INIT_ARGS; -+ -+extern bool wsrep_sst_method_check CHECK_ARGS; -+extern bool wsrep_sst_method_update UPDATE_ARGS; -+extern void wsrep_sst_method_init INIT_ARGS; -+ -+extern bool wsrep_sst_receive_address_check CHECK_ARGS; -+extern bool wsrep_sst_receive_address_update UPDATE_ARGS; -+ -+extern bool wsrep_sst_auth_check CHECK_ARGS; -+extern bool wsrep_sst_auth_update UPDATE_ARGS; -+extern void wsrep_sst_auth_init INIT_ARGS; -+ -+extern bool wsrep_sst_donor_check CHECK_ARGS; -+extern bool wsrep_sst_donor_update UPDATE_ARGS; -+ -+extern bool wsrep_slave_threads_check CHECK_ARGS; -+extern bool wsrep_slave_threads_update UPDATE_ARGS; -+ -+extern bool wsrep_desync_check CHECK_ARGS; -+extern bool wsrep_desync_update UPDATE_ARGS; -+ -+#endif /* WSREP_VAR_H */ - -=== modified file 'storage/innobase/dict/dict0dict.cc' ---- old/storage/innobase/dict/dict0dict.cc 2013-12-11 14:13:33 +0000 -+++ new/storage/innobase/dict/dict0dict.cc 2014-03-11 21:17:40 +0000 -@@ -3236,7 +3236,29 @@ - - return(NULL); - } -- -+#ifdef WITH_WSREP -+dict_index_t* -+wsrep_dict_foreign_find_index( -+/*====================*/ -+ dict_table_t* table, /*!< in: table */ -+ const char** col_names, /*!< in: column names, or NULL -+ to use table->col_names */ -+ const char** columns,/*!< in: array of column names */ -+ ulint n_cols, /*!< in: number of columns */ -+ dict_index_t* types_idx, /*!< in: NULL or an index to whose types the -+ column types must match */ -+ ibool check_charsets, -+ /*!< in: whether to check charsets. -+ only has an effect if types_idx != NULL */ -+ ulint check_null) -+ /*!< in: nonzero if none of the columns must -+ be declared NOT NULL */ -+{ -+ return dict_foreign_find_index( -+ table, col_names, columns, n_cols, types_idx, check_charsets, -+ check_null); -+} -+#endif /* WITH_WSREP */ - /**********************************************************************//** - Report an error in a foreign key definition. */ - static - -=== modified file 'storage/innobase/handler/ha_innodb.cc' ---- old/storage/innobase/handler/ha_innodb.cc 2013-12-29 11:40:21 +0000 -+++ new/storage/innobase/handler/ha_innodb.cc 2014-03-11 21:17:40 +0000 -@@ -95,6 +95,9 @@ - #include "fts0priv.h" - #include "page0zip.h" - -+#ifdef WITH_WSREP -+#include "dict0priv.h" -+#endif /* WITH_WSREP */ - enum_tx_isolation thd_get_trx_isolation(const THD* thd); - - #include "ha_innodb.h" -@@ -103,6 +106,35 @@ - # ifndef MYSQL_PLUGIN_IMPORT - # define MYSQL_PLUGIN_IMPORT /* nothing */ - # endif /* MYSQL_PLUGIN_IMPORT */ -+#ifdef WITH_WSREP -+#include "../storage/innobase/include/ut0byte.h" -+#include -+#include -+extern my_bool wsrep_certify_nonPK; -+class binlog_trx_data; -+extern handlerton *binlog_hton; -+ -+extern MYSQL_PLUGIN_IMPORT mysql_mutex_t LOCK_wsrep_rollback; -+extern MYSQL_PLUGIN_IMPORT mysql_cond_t COND_wsrep_rollback; -+extern MYSQL_PLUGIN_IMPORT wsrep_aborting_thd_t wsrep_aborting_thd; -+ -+static inline wsrep_ws_handle_t* -+wsrep_ws_handle(THD* thd, const trx_t* trx) { -+ return wsrep_ws_handle_for_trx(wsrep_thd_ws_handle(thd), -+ (wsrep_trx_id_t)trx->id); -+} -+ -+extern bool wsrep_prepare_key_for_innodb(const uchar *cache_key, -+ size_t cache_key_len, -+ const uchar* row_id, -+ size_t row_id_len, -+ wsrep_buf_t* key, -+ size_t* key_len); -+ -+extern handlerton * wsrep_hton; -+extern TC_LOG* tc_log; -+extern void wsrep_cleanup_transaction(THD *thd); -+#endif /* WITH_WSREP */ - - /** to protect innobase_open_files */ - static mysql_mutex_t innobase_share_mutex; -@@ -1152,6 +1184,10 @@ - /*===========================*/ - trx_t* trx) /*!< in: transaction handle */ - { -+#ifdef WITH_WSREP -+ if (wsrep_on(trx->mysql_thd) && -+ wsrep_thd_is_BF(trx->mysql_thd, FALSE)) return; -+#endif /* WITH_WSREP */ - if (srv_thread_concurrency) { - if (trx->n_tickets_to_enter_innodb > 0) { - -@@ -1186,6 +1222,10 @@ - #ifdef UNIV_SYNC_DEBUG - ut_ad(!sync_thread_levels_nonempty_trx(trx->has_search_latch)); - #endif /* UNIV_SYNC_DEBUG */ -+#ifdef WITH_WSREP -+ if (wsrep_on(trx->mysql_thd) && -+ wsrep_thd_is_BF(trx->mysql_thd, FALSE)) return; -+#endif /* WITH_WSREP */ - - /* This is to avoid making an unnecessary function call. */ - if (trx->declared_to_be_inside_innodb -@@ -1306,6 +1346,15 @@ - { - return(*(trx_t**) thd_ha_data(thd, innodb_hton_ptr)); - } -+#ifdef WITH_WSREP -+ulonglong -+thd_to_trx_id( -+/*=======*/ -+ THD* thd) /*!< in: MySQL thread */ -+{ -+ return(thd_to_trx(thd)->id); -+} -+#endif - - /********************************************************************//** - Call this function when mysqld passes control to the client. That is to -@@ -1335,6 +1384,15 @@ - return(0); - } - -+#ifdef WITH_WSREP -+static int -+wsrep_abort_transaction(handlerton* hton, THD *bf_thd, THD *victim_thd, -+ my_bool signal); -+static void -+wsrep_fake_trx_id(handlerton* hton, THD *thd); -+static int innobase_wsrep_set_checkpoint(handlerton* hton, const XID* xid); -+static int innobase_wsrep_get_checkpoint(handlerton* hton, XID* xid); -+#endif - /********************************************************************//** - Increments innobase_active_counter and every INNOBASE_WAKE_INTERVALth - time calls srv_active_wake_master_thread. This function should be used -@@ -1789,6 +1847,9 @@ - innobase_mysql_tmpfile(void) - /*========================*/ - { -+#ifdef WITH_INNODB_DISALLOW_WRITES -+ os_event_wait(srv_allow_writes_event); -+#endif /* WITH_INNODB_DISALLOW_WRITES */ - int fd2 = -1; - File fd; - -@@ -2818,6 +2879,12 @@ - innobase_release_temporary_latches; - - innobase_hton->data = &innodb_api_cb; -+#ifdef WITH_WSREP -+ innobase_hton->wsrep_abort_transaction=wsrep_abort_transaction; -+ innobase_hton->wsrep_set_checkpoint=innobase_wsrep_set_checkpoint; -+ innobase_hton->wsrep_get_checkpoint=innobase_wsrep_get_checkpoint; -+ innobase_hton->wsrep_fake_trx_id=wsrep_fake_trx_id; -+#endif /* WITH_WSREP */ - - ut_a(DATA_MYSQL_TRUE_VARCHAR == (ulint)MYSQL_TYPE_VARCHAR); - -@@ -3380,10 +3447,30 @@ - /*================*/ - trx_t* trx) /*!< in: transaction handle */ - { -+#ifdef WITH_WSREP -+ THD* thd = (THD*)trx->mysql_thd; -+ const char* tmp = 0; -+ if (wsrep_on((void*)thd)) { -+#ifdef WSREP_PROC_INFO -+ char info[64]; -+ info[sizeof(info) - 1] = '\0'; -+ snprintf(info, sizeof(info) - 1, -+ "innobase_commit_low():trx_commit_for_mysql(%lld)", -+ (long long) wsrep_thd_trx_seqno(thd)); -+ tmp = thd_proc_info(thd, info); -+ -+#else -+ tmp = thd_proc_info(thd, "innobase_commit_low()"); -+#endif /* WSREP_PROC_INFO */ -+ } -+#endif /* WITH_WSREP */ - if (trx_is_started(trx)) { - - trx_commit_for_mysql(trx); - } -+#ifdef WITH_WSREP -+ if (wsrep_on((void*)thd)) { thd_proc_info(thd, tmp); } -+#endif /* WITH_WSREP */ - } - - /*****************************************************************//** -@@ -4040,7 +4127,11 @@ - case 8192: - return(1536); - default: -+#ifdef WITH_WSREP -+ return(3500); -+#else - return(3500); -+#endif - } - } - -@@ -5140,6 +5231,96 @@ - { - return((uint) (field->ptr - table->record[0])); - } -+#ifdef WITH_WSREP -+UNIV_INTERN -+void -+wsrep_innobase_mysql_sort( -+/*===============*/ -+ /* out: str contains sort string */ -+ int mysql_type, /* in: MySQL type */ -+ uint charset_number, /* in: number of the charset */ -+ unsigned char* str, /* in: data field */ -+ unsigned int str_length) /* in: data field length, -+ not UNIV_SQL_NULL */ -+{ -+ CHARSET_INFO* charset; -+ enum_field_types mysql_tp; -+ -+ DBUG_ASSERT(str_length != UNIV_SQL_NULL); -+ -+ mysql_tp = (enum_field_types) mysql_type; -+ -+ switch (mysql_tp) { -+ -+ case MYSQL_TYPE_BIT: -+ case MYSQL_TYPE_STRING: -+ case MYSQL_TYPE_VAR_STRING: -+ case MYSQL_TYPE_TINY_BLOB: -+ case MYSQL_TYPE_MEDIUM_BLOB: -+ case MYSQL_TYPE_BLOB: -+ case MYSQL_TYPE_LONG_BLOB: -+ case MYSQL_TYPE_VARCHAR: -+ { -+ uchar tmp_str[REC_VERSION_56_MAX_INDEX_COL_LEN]; -+ uint tmp_length = REC_VERSION_56_MAX_INDEX_COL_LEN; -+ -+ /* Use the charset number to pick the right charset struct for -+ the comparison. Since the MySQL function get_charset may be -+ slow before Bar removes the mutex operation there, we first -+ look at 2 common charsets directly. */ -+ -+ if (charset_number == default_charset_info->number) { -+ charset = default_charset_info; -+ } else if (charset_number == my_charset_latin1.number) { -+ charset = &my_charset_latin1; -+ } else { -+ charset = get_charset(charset_number, MYF(MY_WME)); -+ -+ if (charset == NULL) { -+ sql_print_error("InnoDB needs charset %lu for doing " -+ "a comparison, but MySQL cannot " -+ "find that charset.", -+ (ulong) charset_number); -+ ut_a(0); -+ } -+ } -+ -+ ut_a(str_length <= tmp_length); -+ memcpy(tmp_str, str, str_length); -+ -+ tmp_length = charset->coll->strnxfrm(charset, str, str_length, -+ str_length, tmp_str, tmp_length, 0); -+ DBUG_ASSERT(tmp_length <= str_length); -+ -+ break; -+ } -+ case MYSQL_TYPE_DECIMAL : -+ case MYSQL_TYPE_TINY : -+ case MYSQL_TYPE_SHORT : -+ case MYSQL_TYPE_LONG : -+ case MYSQL_TYPE_FLOAT : -+ case MYSQL_TYPE_DOUBLE : -+ case MYSQL_TYPE_NULL : -+ case MYSQL_TYPE_TIMESTAMP : -+ case MYSQL_TYPE_LONGLONG : -+ case MYSQL_TYPE_INT24 : -+ case MYSQL_TYPE_DATE : -+ case MYSQL_TYPE_TIME : -+ case MYSQL_TYPE_DATETIME : -+ case MYSQL_TYPE_YEAR : -+ case MYSQL_TYPE_NEWDATE : -+ case MYSQL_TYPE_NEWDECIMAL : -+ case MYSQL_TYPE_ENUM : -+ case MYSQL_TYPE_SET : -+ case MYSQL_TYPE_GEOMETRY : -+ break; -+ default: -+ break; -+ } -+ -+ return; -+} -+#endif // WITH_WSREP - - /*************************************************************//** - InnoDB uses this function to compare two data fields for which the data type -@@ -5649,6 +5830,264 @@ - /*******************************************************************//** - Stores a key value for a row to a buffer. - @return key value length as stored in buff */ -+#ifdef WITH_WSREP -+UNIV_INTERN -+uint -+wsrep_store_key_val_for_row( -+/*===============================*/ -+ TABLE* table, -+ uint keynr, /*!< in: key number */ -+ char* buff, /*!< in/out: buffer for the key value (in MySQL -+ format) */ -+ uint buff_len,/*!< in: buffer length */ -+ const uchar* record, -+ ibool* key_is_null)/*!< out: full key was null */ -+{ -+ KEY* key_info = table->key_info + keynr; -+ KEY_PART_INFO* key_part = key_info->key_part; -+ KEY_PART_INFO* end = -+ key_part + key_info->user_defined_key_parts; -+ char* buff_start = buff; -+ enum_field_types mysql_type; -+ Field* field; -+ -+ DBUG_ENTER("wsrep_store_key_val_for_row"); -+ -+ memset(buff, 0, buff_len); -+ *key_is_null = TRUE; -+ -+ for (; key_part != end; key_part++) { -+ -+ uchar sorted[REC_VERSION_56_MAX_INDEX_COL_LEN] = {'\0'}; -+ ibool part_is_null = FALSE; -+ -+ if (key_part->null_bit) { -+ if (record[key_part->null_offset] -+ & key_part->null_bit) { -+ *buff = 1; -+ part_is_null = TRUE; -+ } else { -+ *buff = 0; -+ } -+ buff++; -+ } -+ if (!part_is_null) *key_is_null = FALSE; -+ -+ field = key_part->field; -+ mysql_type = field->type(); -+ -+ if (mysql_type == MYSQL_TYPE_VARCHAR) { -+ /* >= 5.0.3 true VARCHAR */ -+ ulint lenlen; -+ ulint len; -+ const byte* data; -+ ulint key_len; -+ ulint true_len; -+ const CHARSET_INFO* cs; -+ int error=0; -+ -+ key_len = key_part->length; -+ -+ if (part_is_null) { -+ buff += key_len + 2; -+ -+ continue; -+ } -+ cs = field->charset(); -+ -+ lenlen = (ulint) -+ (((Field_varstring*)field)->length_bytes); -+ -+ data = row_mysql_read_true_varchar(&len, -+ (byte*) (record -+ + (ulint)get_field_offset(table, field)), -+ lenlen); -+ -+ true_len = len; -+ -+ /* For multi byte character sets we need to calculate -+ the true length of the key */ -+ -+ if (len > 0 && cs->mbmaxlen > 1) { -+ true_len = (ulint) cs->cset->well_formed_len(cs, -+ (const char *) data, -+ (const char *) data + len, -+ (uint) (key_len / cs->mbmaxlen), -+ &error); -+ } -+ -+ /* In a column prefix index, we may need to truncate -+ the stored value: */ -+ -+ if (true_len > key_len) { -+ true_len = key_len; -+ } -+ -+ memcpy(sorted, data, true_len); -+ wsrep_innobase_mysql_sort( -+ mysql_type, cs->number, sorted, true_len); -+ -+ if (wsrep_protocol_version > 1) { -+ memcpy(buff, sorted, true_len); -+ /* Note that we always reserve the maximum possible -+ length of the true VARCHAR in the key value, though -+ only len first bytes after the 2 length bytes contain -+ actual data. The rest of the space was reset to zero -+ in the bzero() call above. */ -+ buff += true_len; -+ } else { -+ buff += key_len; -+ } -+ } else if (mysql_type == MYSQL_TYPE_TINY_BLOB -+ || mysql_type == MYSQL_TYPE_MEDIUM_BLOB -+ || mysql_type == MYSQL_TYPE_BLOB -+ || mysql_type == MYSQL_TYPE_LONG_BLOB -+ /* MYSQL_TYPE_GEOMETRY data is treated -+ as BLOB data in innodb. */ -+ || mysql_type == MYSQL_TYPE_GEOMETRY) { -+ -+ const CHARSET_INFO* cs; -+ ulint key_len; -+ ulint true_len; -+ int error=0; -+ ulint blob_len; -+ const byte* blob_data; -+ -+ ut_a(key_part->key_part_flag & HA_PART_KEY_SEG); -+ -+ key_len = key_part->length; -+ -+ if (part_is_null) { -+ buff += key_len + 2; -+ -+ continue; -+ } -+ -+ cs = field->charset(); -+ -+ blob_data = row_mysql_read_blob_ref(&blob_len, -+ (byte*) (record -+ + (ulint)get_field_offset(table, field)), -+ (ulint) field->pack_length()); -+ -+ true_len = blob_len; -+ -+ ut_a(get_field_offset(table, field) -+ == key_part->offset); -+ -+ /* For multi byte character sets we need to calculate -+ the true length of the key */ -+ -+ if (blob_len > 0 && cs->mbmaxlen > 1) { -+ true_len = (ulint) cs->cset->well_formed_len(cs, -+ (const char *) blob_data, -+ (const char *) blob_data -+ + blob_len, -+ (uint) (key_len / cs->mbmaxlen), -+ &error); -+ } -+ -+ /* All indexes on BLOB and TEXT are column prefix -+ indexes, and we may need to truncate the data to be -+ stored in the key value: */ -+ -+ if (true_len > key_len) { -+ true_len = key_len; -+ } -+ -+ memcpy(sorted, blob_data, true_len); -+ wsrep_innobase_mysql_sort( -+ mysql_type, cs->number, sorted, true_len); -+ -+ memcpy(buff, sorted, true_len); -+ -+ /* Note that we always reserve the maximum possible -+ length of the BLOB prefix in the key value. */ -+ if (wsrep_protocol_version > 1) { -+ buff += true_len; -+ } else { -+ buff += key_len; -+ } -+ } else { -+ /* Here we handle all other data types except the -+ true VARCHAR, BLOB and TEXT. Note that the column -+ value we store may be also in a column prefix -+ index. */ -+ -+ const CHARSET_INFO* cs = NULL; -+ ulint true_len; -+ ulint key_len; -+ const uchar* src_start; -+ int error=0; -+ enum_field_types real_type; -+ -+ key_len = key_part->length; -+ -+ if (part_is_null) { -+ buff += key_len; -+ -+ continue; -+ } -+ -+ src_start = record + key_part->offset; -+ real_type = field->real_type(); -+ true_len = key_len; -+ -+ /* Character set for the field is defined only -+ to fields whose type is string and real field -+ type is not enum or set. For these fields check -+ if character set is multi byte. */ -+ -+ if (real_type != MYSQL_TYPE_ENUM -+ && real_type != MYSQL_TYPE_SET -+ && ( mysql_type == MYSQL_TYPE_VAR_STRING -+ || mysql_type == MYSQL_TYPE_STRING)) { -+ -+ cs = field->charset(); -+ -+ /* For multi byte character sets we need to -+ calculate the true length of the key */ -+ -+ if (key_len > 0 && cs->mbmaxlen > 1) { -+ -+ true_len = (ulint) -+ cs->cset->well_formed_len(cs, -+ (const char *)src_start, -+ (const char *)src_start -+ + key_len, -+ (uint) (key_len / -+ cs->mbmaxlen), -+ &error); -+ } -+ memcpy(sorted, src_start, true_len); -+ wsrep_innobase_mysql_sort( -+ mysql_type, cs->number, sorted, true_len); -+ memcpy(buff, sorted, true_len); -+ } else { -+ memcpy(buff, src_start, true_len); -+ } -+ buff += true_len; -+ -+ /* Pad the unused space with spaces. */ -+ -+#ifdef REMOVED -+ if (true_len < key_len) { -+ ulint pad_len = key_len - true_len; -+ ut_a(!(pad_len % cs->mbminlen)); -+ -+ cs->cset->fill(cs, buff, pad_len, -+ 0x20 /* space */); -+ buff += pad_len; -+ } -+#endif /* REMOVED */ -+ } -+ } -+ -+ ut_a(buff <= buff_start + buff_len); -+ -+ DBUG_RETURN((uint)(buff - buff_start)); -+} -+#endif /* WITH_WSREP */ - UNIV_INTERN - uint - ha_innobase::store_key_val_for_row( -@@ -6476,6 +6915,9 @@ - dberr_t error; - int error_result= 0; - ibool auto_inc_used= FALSE; -+#ifdef WITH_WSREP -+ ibool auto_inc_inserted= FALSE; /* if NULL was inserted */ -+#endif - ulint sql_command; - trx_t* trx = thd_to_trx(user_thd); - -@@ -6509,8 +6951,20 @@ - if ((sql_command == SQLCOM_ALTER_TABLE - || sql_command == SQLCOM_OPTIMIZE - || sql_command == SQLCOM_CREATE_INDEX -+#ifdef WITH_WSREP -+ || (wsrep_on(user_thd) && wsrep_load_data_splitting && -+ sql_command == SQLCOM_LOAD && -+ !thd_test_options( -+ user_thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) -+#endif /* WITH_WSREP */ - || sql_command == SQLCOM_DROP_INDEX) - && num_write_row >= 10000) { -+#ifdef WITH_WSREP -+ if (wsrep_on(user_thd) && sql_command == SQLCOM_LOAD) { -+ WSREP_DEBUG("forced trx split for LOAD: %s", -+ wsrep_thd_query(user_thd)); -+ } -+#endif /* WITH_WSREP */ - /* ALTER TABLE is COMMITted at every 10000 copied rows. - The IX table lock for the original table has to be re-issued. - As this method will be called on a temporary table where the -@@ -6544,6 +6998,21 @@ - */ - ; - } else if (src_table == prebuilt->table) { -+#ifdef WITH_WSREP -+ switch (wsrep_run_wsrep_commit(user_thd, wsrep_hton, 1)) -+ { -+ case WSREP_TRX_OK: -+ break; -+ case WSREP_TRX_SIZE_EXCEEDED: -+ case WSREP_TRX_CERT_FAIL: -+ case WSREP_TRX_ERROR: -+ DBUG_RETURN(1); -+ } -+ -+ if (tc_log->commit(user_thd, 1)) -+ DBUG_RETURN(1); -+ wsrep_post_commit(user_thd, TRUE); -+#endif /* WITH_WSREP */ - /* Source table is not in InnoDB format: - no need to re-acquire locks on it. */ - -@@ -6554,6 +7023,20 @@ - /* We will need an IX lock on the destination table. */ - prebuilt->sql_stat_start = TRUE; - } else { -+#ifdef WITH_WSREP -+ switch (wsrep_run_wsrep_commit(user_thd, wsrep_hton, 1)) -+ { -+ case WSREP_TRX_OK: -+ break; -+ case WSREP_TRX_SIZE_EXCEEDED: -+ case WSREP_TRX_CERT_FAIL: -+ case WSREP_TRX_ERROR: -+ DBUG_RETURN(1); -+ } -+ if (tc_log->commit(user_thd, 1)) -+ DBUG_RETURN(1); -+ wsrep_post_commit(user_thd, TRUE); -+#endif /* WITH_WSREP */ - /* Ensure that there are no other table locks than - LOCK_IX and LOCK_AUTO_INC on the destination table. */ - -@@ -6583,6 +7066,9 @@ - innobase_get_auto_increment(). */ - prebuilt->autoinc_error = DB_SUCCESS; - -+#ifdef WITH_WSREP -+ auto_inc_inserted= (table->next_number_field->val_int() == 0); -+#endif - if ((error_result = update_auto_increment())) { - /* We don't want to mask autoinc overflow errors. */ - -@@ -6661,6 +7147,32 @@ - case SQLCOM_REPLACE_SELECT: - goto set_max_autoinc; - -+#ifdef WITH_WSREP -+ /* workaround for LP bug #355000, retrying the insert */ -+ case SQLCOM_INSERT: -+ if (wsrep_on(current_thd) && -+ auto_inc_inserted && -+ wsrep_drupal_282555_workaround && -+ wsrep_thd_retry_counter(current_thd) == 0 && -+ !thd_test_options(current_thd, -+ OPTION_NOT_AUTOCOMMIT | -+ OPTION_BEGIN)) { -+ WSREP_DEBUG( -+ "retrying insert: %s", -+ (*wsrep_thd_query(current_thd)) ? -+ wsrep_thd_query(current_thd) : -+ (char *)"void"); -+ error= DB_SUCCESS; -+ wsrep_thd_set_conflict_state( -+ current_thd, MUST_ABORT); -+ innobase_srv_conc_exit_innodb( -+ prebuilt->trx); -+ /* jump straight to func exit over -+ * later wsrep hooks */ -+ goto func_exit; -+ } -+ break; -+#endif - default: - break; - } -@@ -6719,6 +7231,20 @@ - error_result = convert_error_code_to_mysql(error, - prebuilt->table->flags, - user_thd); -+#ifdef WITH_WSREP -+ if (!error_result && wsrep_thd_exec_mode(user_thd) == LOCAL_STATE && -+ wsrep_on(user_thd) && !wsrep_consistency_check(user_thd) && -+ (sql_command != SQLCOM_LOAD || -+ thd_binlog_format(user_thd) == BINLOG_FORMAT_ROW)) { -+ -+ if (wsrep_append_keys(user_thd, false, record, NULL)) { -+ DBUG_PRINT("wsrep", ("row key failed")); -+ error_result = HA_ERR_INTERNAL_ERROR; -+ goto wsrep_error; -+ } -+ } -+wsrep_error: -+#endif - - if (error_result == HA_FTS_INVALID_DOCID) { - my_error(HA_FTS_INVALID_DOCID, MYF(0)); -@@ -6729,7 +7255,88 @@ - - DBUG_RETURN(error_result); - } -+#ifdef WITH_WSREP -+#if defined(HAVE_YASSL) -+#include "my_config.h" -+#include "md5.hpp" -+#elif defined(HAVE_OPENSSL) -+#include -+#endif -+static -+int -+wsrep_calc_row_hash( -+/*================*/ -+ byte* digest, /*!< in/out: md5 sum */ -+ const uchar* row, /*!< in: row in MySQL format */ -+ TABLE* table, /*!< in: table in MySQL data -+ dictionary */ -+ row_prebuilt_t* prebuilt, /*!< in: InnoDB prebuilt struct */ -+ THD* thd) /*!< in: user thread */ -+{ -+ Field* field; -+ enum_field_types field_mysql_type; -+ uint n_fields; -+ ulint len; -+ const byte* ptr; -+ ulint col_type; -+ uint i; -+ -+ -+ void *ctx = wsrep_md5_init(); -+ -+ n_fields = table->s->fields; -+ -+ for (i = 0; i < n_fields; i++) { -+ byte null_byte=0; -+ byte true_byte=1; -+ -+ field = table->field[i]; - -+ ptr = (const byte*) row + get_field_offset(table, field); -+ len = field->pack_length(); -+ -+ field_mysql_type = field->type(); -+ -+ col_type = prebuilt->table->cols[i].mtype; -+ -+ switch (col_type) { -+ -+ case DATA_BLOB: -+ ptr = row_mysql_read_blob_ref(&len, ptr, len); -+ -+ break; -+ -+ case DATA_VARCHAR: -+ case DATA_BINARY: -+ case DATA_VARMYSQL: -+ if (field_mysql_type == MYSQL_TYPE_VARCHAR) { -+ /* This is a >= 5.0.3 type true VARCHAR where -+ the real payload data length is stored in -+ 1 or 2 bytes */ -+ -+ ptr = row_mysql_read_true_varchar( -+ &len, ptr, -+ (ulint) -+ (((Field_varstring*)field)->length_bytes)); -+ -+ } -+ -+ break; -+ default: -+ ; -+ } -+ -+ if (field->is_null_in_record(row)) { -+ wsrep_md5_update(ctx, (char*)&null_byte, 1); -+ } else { -+ wsrep_md5_update(ctx, (char*)&true_byte, 1); -+ wsrep_md5_update(ctx, (char*)ptr, len); -+ } -+ } -+ wsrep_compute_md5_hash((char*)digest, ctx); -+ return(0); -+} -+#endif /* WITH_WSREP */ - /**********************************************************************//** - Checks which fields have changed in a row and stores information - of them to an update vector. -@@ -7138,6 +7745,20 @@ - - innobase_active_small(); - -+#ifdef WITH_WSREP -+ if (!err && wsrep_thd_exec_mode(user_thd) == LOCAL_STATE && -+ wsrep_on(user_thd)) { -+ -+ DBUG_PRINT("wsrep", ("update row key")); -+ -+ if (wsrep_append_keys(user_thd, false, old_row, new_row)) { -+ DBUG_PRINT("wsrep", ("row key failed")); -+ err = HA_ERR_INTERNAL_ERROR; -+ goto wsrep_error; -+ } -+ } -+wsrep_error: -+#endif - DBUG_RETURN(err); - } - -@@ -7185,6 +7806,18 @@ - - innobase_active_small(); - -+#ifdef WITH_WSREP -+ if (error == DB_SUCCESS && wsrep_thd_exec_mode(user_thd) == LOCAL_STATE && -+ wsrep_on(user_thd)) { -+ -+ if (wsrep_append_keys(user_thd, false, record, NULL)) { -+ DBUG_PRINT("wsrep", ("delete fail")); -+ error = DB_ERROR; -+ goto wsrep_error; -+ } -+ } -+wsrep_error: -+#endif - DBUG_RETURN(convert_error_code_to_mysql( - error, prebuilt->table->flags, user_thd)); - } -@@ -8344,7 +8977,390 @@ - - rnd_end(); - } -+#ifdef WITH_WSREP -+dict_index_t* -+wsrep_dict_foreign_find_index( -+ dict_table_t* table, -+ const char** col_names, -+ const char** columns, -+ ulint n_cols, -+ dict_index_t* types_idx, -+ ibool check_charsets, -+ ulint check_null); -+ -+extern -+dberr_t -+wsrep_append_foreign_key( -+/*===========================*/ -+ trx_t* trx, /*!< in: trx */ -+ dict_foreign_t* foreign, /*!< in: foreign key constraint */ -+ const rec_t* rec, /*!mysql_thd; -+ int rcode = 0; -+ char cache_key[513] = {'\0'}; -+ int cache_key_len; -+ bool const copy = true; -+ ut_a(trx); -+ -+ if (!wsrep_on(trx->mysql_thd) || -+ wsrep_thd_exec_mode(thd) != LOCAL_STATE) -+ return DB_SUCCESS; -+ -+ if (!thd || !foreign || -+ (!foreign->referenced_table && !foreign->foreign_table)) -+ { -+ WSREP_INFO("FK: %s missing in: %s", -+ (!thd) ? "thread" : -+ ((!foreign) ? "constraint" : -+ ((!foreign->referenced_table) ? -+ "referenced table" : "foreign table")), -+ (thd && wsrep_thd_query(thd)) ? -+ wsrep_thd_query(thd) : "void"); -+ return DB_ERROR; -+ } -+ -+ if ( !((referenced) ? -+ foreign->referenced_table : foreign->foreign_table)) -+ { -+ WSREP_DEBUG("pulling %s table into cache", -+ (referenced) ? "referenced" : "foreign"); -+ mutex_enter(&(dict_sys->mutex)); -+ if (referenced) -+ { -+ foreign->referenced_table = -+ dict_table_get_low( -+ foreign->referenced_table_name_lookup); -+ if (foreign->referenced_table) -+ { -+ foreign->referenced_index = -+ wsrep_dict_foreign_find_index( -+ foreign->referenced_table, NULL, -+ foreign->referenced_col_names, -+ foreign->n_fields, -+ foreign->foreign_index, -+ TRUE, FALSE); -+ } -+ } -+ else -+ { -+ foreign->foreign_table = -+ dict_table_get_low( -+ foreign->foreign_table_name_lookup); -+ if (foreign->foreign_table) -+ { -+ foreign->foreign_index = -+ wsrep_dict_foreign_find_index( -+ foreign->foreign_table, NULL, -+ foreign->foreign_col_names, -+ foreign->n_fields, -+ foreign->referenced_index, -+ TRUE, FALSE); -+ } -+ } -+ mutex_exit(&(dict_sys->mutex)); -+ } -+ -+ if ( !((referenced) ? -+ foreign->referenced_table : foreign->foreign_table)) -+ { -+ WSREP_WARN("FK: %s missing in query: %s", -+ (!foreign->referenced_table) ? -+ "referenced table" : "foreign table", -+ (wsrep_thd_query(thd)) ? -+ wsrep_thd_query(thd) : "void"); -+ return DB_ERROR; -+ } -+ byte key[WSREP_MAX_SUPPORTED_KEY_LENGTH+1]; -+ ulint len = WSREP_MAX_SUPPORTED_KEY_LENGTH; -+ -+ dict_index_t *idx_target = (referenced) ? -+ foreign->referenced_index : index; -+ dict_index_t *idx = (referenced) ? -+ UT_LIST_GET_FIRST(foreign->referenced_table->indexes) : -+ UT_LIST_GET_FIRST(foreign->foreign_table->indexes); -+ int i = 0; -+ while (idx != NULL && idx != idx_target) { -+ if (innobase_strcasecmp (idx->name, innobase_index_reserve_name) != 0) { -+ i++; -+ } -+ idx = UT_LIST_GET_NEXT(indexes, idx); -+ } -+ ut_a(idx); -+ key[0] = (char)i; -+ -+ rcode = wsrep_rec_get_foreign_key( -+ &key[1], &len, rec, index, idx, -+ wsrep_protocol_version > 1); -+ if (rcode != DB_SUCCESS) { -+ WSREP_ERROR( -+ "FK key set failed: %d (%lu %lu), index: %s %s, %s", -+ rcode, referenced, shared, -+ (index && index->name) ? index->name : -+ "void index", -+ (index && index->table_name) ? index->table_name : -+ "void table", -+ wsrep_thd_query(thd)); -+ return DB_ERROR; -+ } -+ strncpy(cache_key, -+ (wsrep_protocol_version > 1) ? -+ ((referenced) ? -+ foreign->referenced_table->name : -+ foreign->foreign_table->name) : -+ foreign->foreign_table->name, sizeof(cache_key) - 1); -+ cache_key_len = strlen(cache_key); -+// #define WSREP_DEBUG_PRINT -+#ifdef WSREP_DEBUG_PRINT -+ ulint j; -+ fprintf(stderr, "FK parent key, table: %s %s len: %lu ", -+ cache_key, (shared) ? "shared" : "exclusive", len+1); -+ for (j=0; jreferenced_table->name, -+ foreign->foreign_table->name); -+ } -+ -+ wsrep_buf_t wkey_part[3]; -+ wsrep_key_t wkey = {wkey_part, 3}; -+ if (!wsrep_prepare_key_for_innodb( -+ (const uchar*)cache_key, -+ cache_key_len + 1, -+ (const uchar*)key, len+1, -+ wkey_part, -+ &wkey.key_parts_num)) { -+ WSREP_WARN("key prepare failed for cascaded FK: %s", -+ (wsrep_thd_query(thd)) ? -+ wsrep_thd_query(thd) : "void"); -+ return DB_ERROR; -+ } -+ rcode = wsrep->append_key( -+ wsrep, -+ wsrep_ws_handle(thd, trx), -+ &wkey, -+ 1, -+ shared ? WSREP_KEY_SHARED : WSREP_KEY_EXCLUSIVE, -+ copy); -+ if (rcode) { -+ DBUG_PRINT("wsrep", ("row key failed: %d", rcode)); -+ WSREP_ERROR("Appending cascaded fk row key failed: %s, %d", -+ (wsrep_thd_query(thd)) ? -+ wsrep_thd_query(thd) : "void", rcode); -+ return DB_ERROR; -+ } -+ -+ return DB_SUCCESS; -+} -+ -+static int -+wsrep_append_key( -+/*==================*/ -+ THD *thd, -+ trx_t *trx, -+ TABLE_SHARE *table_share, -+ TABLE *table, -+ const char* key, -+ uint16_t key_len, -+ bool shared -+) -+{ -+ DBUG_ENTER("wsrep_append_key"); -+ bool const copy = true; -+#ifdef WSREP_DEBUG_PRINT -+ fprintf(stderr, "%s conn %ld, trx %llu, keylen %d, table %s ", -+ (shared) ? "Shared" : "Exclusive", -+ wsrep_thd_thread_id(thd), (long long)trx->id, key_len, -+ table_share->table_name.str); -+ for (int i=0; itable_cache_key.str, -+ table_share->table_cache_key.length, -+ (const uchar*)key, key_len, -+ wkey_part, -+ &wkey.key_parts_num)) { -+ WSREP_WARN("key prepare failed for: %s", -+ (wsrep_thd_query(thd)) ? -+ wsrep_thd_query(thd) : "void"); -+ DBUG_RETURN(-1); -+ } -+ -+ int rcode = wsrep->append_key( -+ wsrep, -+ wsrep_ws_handle(thd, trx), -+ &wkey, -+ 1, -+ shared ? WSREP_KEY_SHARED : WSREP_KEY_EXCLUSIVE, -+ copy); -+ if (rcode) { -+ DBUG_PRINT("wsrep", ("row key failed: %d", rcode)); -+ WSREP_WARN("Appending row key failed: %s, %d", -+ (wsrep_thd_query(thd)) ? -+ wsrep_thd_query(thd) : "void", rcode); -+ DBUG_RETURN(-1); -+ } -+ DBUG_RETURN(0); -+} -+ -+extern void compute_md5_hash(char *digest, const char *buf, int len); -+#define MD5_HASH compute_md5_hash -+ -+int -+ha_innobase::wsrep_append_keys( -+/*==================*/ -+ THD *thd, -+ bool shared, -+ const uchar* record0, /* in: row in MySQL format */ -+ const uchar* record1) /* in: row in MySQL format */ -+{ -+ int rcode; -+ DBUG_ENTER("wsrep_append_keys"); -+ -+ bool key_appended = false; -+ trx_t *trx = thd_to_trx(thd); -+ -+ if (table_share && table_share->tmp_table != NO_TMP_TABLE) { -+ WSREP_DEBUG("skipping tmp table DML: THD: %lu tmp: %d SQL: %s", -+ wsrep_thd_thread_id(thd), -+ table_share->tmp_table, -+ (wsrep_thd_query(thd)) ? -+ wsrep_thd_query(thd) : "void"); -+ DBUG_RETURN(0); -+ } -+ -+ if (wsrep_protocol_version == 0) { -+ uint len; -+ char keyval[WSREP_MAX_SUPPORTED_KEY_LENGTH+1] = {'\0'}; -+ char *key = &keyval[0]; -+ KEY *key_info = table->key_info; -+ ibool is_null; -+ -+ len = wsrep_store_key_val_for_row( -+ table, 0, key, key_info->key_length, record0, &is_null); -+ -+ if (!is_null) { -+ rcode = wsrep_append_key( -+ thd, trx, table_share, table, keyval, -+ len, shared); -+ if (rcode) DBUG_RETURN(rcode); -+ } -+ else -+ { -+ WSREP_DEBUG("NULL key skipped (proto 0): %s", -+ wsrep_thd_query(thd)); -+ } -+ } else { -+ ut_a(table->s->keys <= 256); -+ uint i; -+ bool hasPK= false; -+ -+ for (i=0; is->keys && !hasPK; ++i) { -+ KEY* key_info = table->key_info + i; -+ if (key_info->flags & HA_NOSAME) hasPK = true; -+ } -+ -+ for (i=0; is->keys; ++i) { -+ uint len; -+ char keyval0[WSREP_MAX_SUPPORTED_KEY_LENGTH+1] = {'\0'}; -+ char keyval1[WSREP_MAX_SUPPORTED_KEY_LENGTH+1] = {'\0'}; -+ char* key0 = &keyval0[1]; -+ char* key1 = &keyval1[1]; -+ KEY* key_info = table->key_info + i; -+ ibool is_null; -+ -+ dict_index_t* idx = innobase_get_index(i); -+ dict_table_t* tab = (idx) ? idx->table : NULL; -+ -+ keyval0[0] = (char)i; -+ keyval1[0] = (char)i; -+ -+ if (!tab) { -+ WSREP_WARN("MySQL-InnoDB key mismatch %s %s", -+ table->s->table_name.str, -+ key_info->name); -+ } -+ if (!hasPK || key_info->flags & HA_NOSAME || -+ ((tab && -+ dict_table_get_referenced_constraint(tab, idx)) || -+ (!tab && referenced_by_foreign_key()))) { -+ -+ len = wsrep_store_key_val_for_row( -+ table, i, key0, key_info->key_length, -+ record0, &is_null); -+ if (!is_null) { -+ rcode = wsrep_append_key( -+ thd, trx, table_share, table, -+ keyval0, len+1, shared); -+ if (rcode) DBUG_RETURN(rcode); -+ -+ if (key_info->flags & HA_NOSAME || shared) -+ key_appended = true; -+ } -+ else -+ { -+ WSREP_DEBUG("NULL key skipped: %s", -+ wsrep_thd_query(thd)); -+ } -+ if (record1) { -+ len = wsrep_store_key_val_for_row( -+ table, i, key1, key_info->key_length, -+ record1, &is_null); -+ if (!is_null && memcmp(key0, key1, len)) { -+ rcode = wsrep_append_key( -+ thd, trx, table_share, -+ table, -+ keyval1, len+1, shared); -+ if (rcode) DBUG_RETURN(rcode); -+ } -+ } -+ } -+ } -+ } - -+ /* if no PK, calculate hash of full row, to be the key value */ -+ if (!key_appended && wsrep_certify_nonPK) { -+ uchar digest[16]; -+ int rcode; -+ -+ wsrep_calc_row_hash(digest, record0, table, prebuilt, thd); -+ if ((rcode = wsrep_append_key(thd, trx, table_share, table, -+ (const char*) digest, 16, -+ shared))) { -+ DBUG_RETURN(rcode); -+ } -+ -+ if (record1) { -+ wsrep_calc_row_hash( -+ digest, record1, table, prebuilt, thd); -+ if ((rcode = wsrep_append_key(thd, trx, table_share, -+ table, -+ (const char*) digest, -+ 16, shared))) { -+ DBUG_RETURN(rcode); -+ } -+ } -+ DBUG_RETURN(0); -+ } -+ -+ DBUG_RETURN(0); -+} -+#endif - /*********************************************************************//** - Stores a reference to the current row to 'ref' field of the handle. Note - that in the case where we have generated the clustered index for the -@@ -12078,11 +13094,18 @@ - /* used by test case */ - DBUG_EXECUTE_IF("no_innodb_binlog_errors", skip = true;); - if (!skip) { -+#ifdef WITH_WSREP -+ if (!wsrep_on(thd) || wsrep_thd_exec_mode(thd) == LOCAL_STATE) -+ { -+#endif /* WITH_WSREP */ - my_error(ER_BINLOG_STMT_MODE_AND_ROW_ENGINE, MYF(0), - " InnoDB is limited to row-logging when " - "transaction isolation level is " - "READ COMMITTED or READ UNCOMMITTED."); - DBUG_RETURN(HA_ERR_LOGGING_IMPOSSIBLE); -+#ifdef WITH_WSREP -+ } -+#endif /* WITH_WSREP */ - } - } - -@@ -13513,6 +14536,9 @@ - to the session variable take effect only in the next transaction */ - if (!trx->support_xa) { - -+#ifdef WITH_WSREP -+ thd_get_xid(thd, (MYSQL_XID*) &trx->xid); -+#endif // WITH_WSREP - return(0); - } - -@@ -15525,6 +16551,291 @@ - static struct st_mysql_storage_engine innobase_storage_engine= - { MYSQL_HANDLERTON_INTERFACE_VERSION }; - -+#ifdef WITH_WSREP -+void -+wsrep_abort_slave_trx(wsrep_seqno_t bf_seqno, wsrep_seqno_t victim_seqno) -+{ -+ WSREP_ERROR("Trx %lld tries to abort slave trx %lld. This could be " -+ "caused by:\n\t" -+ "1) unsupported configuration options combination, please check documentation.\n\t" -+ "2) a bug in the code.\n\t" -+ "3) a database corruption.\n Node consistency compromized, " -+ "need to abort. Restart the node to resync with cluster.", -+ (long long)bf_seqno, (long long)victim_seqno); -+ abort(); -+} -+ -+int -+wsrep_innobase_kill_one_trx(void * const bf_thd_ptr, -+ const trx_t * const bf_trx, -+ trx_t *victim_trx, ibool signal) -+{ -+ ut_ad(lock_mutex_own()); -+ ut_ad(trx_mutex_own(victim_trx)); -+ ut_ad(bf_thd_ptr); -+ ut_ad(victim_trx); -+ -+ DBUG_ENTER("wsrep_innobase_kill_one_trx"); -+ THD *bf_thd = bf_thd_ptr ? (THD*) bf_thd_ptr : NULL; -+ THD *thd = (THD *) victim_trx->mysql_thd; -+ int64_t bf_seqno = (bf_thd) ? wsrep_thd_trx_seqno(bf_thd) : 0; -+ -+ if (!thd) { -+ DBUG_PRINT("wsrep", ("no thd for conflicting lock")); -+ WSREP_WARN("no THD for trx: %llu", (long long)victim_trx->id); -+ DBUG_RETURN(1); -+ } -+ if (!bf_thd) { -+ DBUG_PRINT("wsrep", ("no BF thd for conflicting lock")); -+ WSREP_WARN("no BF THD for trx: %llu", -+ (bf_trx) ? (long long)bf_trx->id : 0); -+ DBUG_RETURN(1); -+ } -+ -+ WSREP_LOG_CONFLICT(bf_thd, thd, TRUE); -+ -+ WSREP_DEBUG("BF kill (%lu, seqno: %lld), victim: (%llu) trx: %llu", -+ signal, (long long)bf_seqno, -+ (long long)wsrep_thd_thread_id(thd), -+ (long long)victim_trx->id); -+ -+ WSREP_DEBUG("Aborting query: %s", -+ (thd && wsrep_thd_query(thd)) ? wsrep_thd_query(thd) : "void"); -+ -+ wsrep_thd_LOCK(thd); -+ -+ if (wsrep_thd_query_state(thd) == QUERY_EXITING) { -+ WSREP_DEBUG("kill trx EXITING for %llu", -+ (long long)victim_trx->id); -+ wsrep_thd_UNLOCK(thd); -+ DBUG_RETURN(0); -+ } -+ if(wsrep_thd_exec_mode(thd) != LOCAL_STATE) { -+ WSREP_DEBUG("withdraw for BF trx: %llu, state: %d", -+ (long long)victim_trx->id, -+ wsrep_thd_conflict_state(thd)); -+ } -+ -+ switch (wsrep_thd_conflict_state(thd)) { -+ case NO_CONFLICT: -+ wsrep_thd_set_conflict_state(thd, MUST_ABORT); -+ break; -+ case MUST_ABORT: -+ WSREP_DEBUG("victim %llu in MUST ABORT state", -+ (long long)victim_trx->id); -+ wsrep_thd_UNLOCK(thd); -+ wsrep_thd_awake(thd, signal); -+ DBUG_RETURN(0); -+ break; -+ case ABORTED: -+ case ABORTING: // fall through -+ default: -+ WSREP_DEBUG("victim %llu in state %d", -+ (long long)victim_trx->id, -+ wsrep_thd_conflict_state(thd)); -+ wsrep_thd_UNLOCK(thd); -+ DBUG_RETURN(0); -+ break; -+ } -+ -+ switch (wsrep_thd_query_state(thd)) { -+ case QUERY_COMMITTING: -+ enum wsrep_status rcode; -+ -+ WSREP_DEBUG("kill trx QUERY_COMMITTING for %llu", -+ (long long)victim_trx->id); -+ wsrep_thd_awake(thd, signal); -+ -+ if (wsrep_thd_exec_mode(thd) == REPL_RECV) { -+ wsrep_abort_slave_trx(bf_seqno, -+ wsrep_thd_trx_seqno(thd)); -+ } else { -+ rcode = wsrep->abort_pre_commit( -+ wsrep, bf_seqno, -+ (wsrep_trx_id_t)victim_trx->id -+ ); -+ -+ switch (rcode) { -+ case WSREP_WARNING: -+ WSREP_DEBUG("cancel commit warning: %llu", -+ (long long)victim_trx->id); -+ wsrep_thd_UNLOCK(thd); -+ DBUG_RETURN(1); -+ break; -+ case WSREP_OK: -+ break; -+ default: -+ WSREP_ERROR( -+ "cancel commit bad exit: %d %llu", -+ rcode, -+ (long long)victim_trx->id); -+ /* unable to interrupt, must abort */ -+ /* note: kill_mysql() will block, if we cannot. -+ * kill the lock holder first. -+ */ -+ abort(); -+ break; -+ } -+ } -+ break; -+ case QUERY_EXEC: -+ /* it is possible that victim trx is itself waiting for some -+ * other lock. We need to cancel this waiting -+ */ -+ WSREP_DEBUG("kill trx QUERY_EXEC for %llu", (long long)victim_trx->id); -+ -+ victim_trx->lock.was_chosen_as_deadlock_victim= TRUE; -+ if (victim_trx->lock.wait_lock) { -+ WSREP_DEBUG("victim has wait flag: %ld", -+ wsrep_thd_thread_id(thd)); -+ lock_t* wait_lock = victim_trx->lock.wait_lock; -+ if (wait_lock) { -+ WSREP_DEBUG("canceling wait lock"); -+ victim_trx->lock.was_chosen_as_deadlock_victim= TRUE; -+ lock_cancel_waiting_and_release(wait_lock); -+ } -+ -+ wsrep_thd_awake(thd, signal); -+ } else { -+ /* abort currently executing query */ -+ DBUG_PRINT("wsrep",("sending KILL_QUERY to: %ld", -+ wsrep_thd_thread_id(thd))); -+ WSREP_DEBUG("kill query for: %ld", -+ wsrep_thd_thread_id(thd)); -+ wsrep_thd_awake(thd, signal); -+ -+ /* for BF thd, we need to prevent him from committing */ -+ if (wsrep_thd_exec_mode(thd) == REPL_RECV) { -+ wsrep_abort_slave_trx(bf_seqno, -+ wsrep_thd_trx_seqno(thd)); -+ } -+ } -+ break; -+ case QUERY_IDLE: -+ { -+ bool skip_abort= false; -+ wsrep_aborting_thd_t abortees; -+ -+ WSREP_DEBUG("kill IDLE for %llu", (long long)victim_trx->id); -+ -+ if (wsrep_thd_exec_mode(thd) == REPL_RECV) { -+ WSREP_DEBUG("kill BF IDLE, seqno: %lld", -+ (long long)wsrep_thd_trx_seqno(thd)); -+ wsrep_thd_UNLOCK(thd); -+ wsrep_abort_slave_trx(bf_seqno, -+ wsrep_thd_trx_seqno(thd)); -+ DBUG_RETURN(0); -+ } -+ /* This will lock thd from proceeding after net_read() */ -+ wsrep_thd_set_conflict_state(thd, ABORTING); -+ -+ mysql_mutex_lock(&LOCK_wsrep_rollback); -+ -+ abortees = wsrep_aborting_thd; -+ while (abortees && !skip_abort) { -+ /* check if we have a kill message for this already */ -+ if (abortees->aborting_thd == thd) { -+ skip_abort = true; -+ WSREP_WARN("duplicate thd aborter %lu", -+ wsrep_thd_thread_id(thd)); -+ } -+ abortees = abortees->next; -+ } -+ if (!skip_abort) { -+ wsrep_aborting_thd_t aborting = (wsrep_aborting_thd_t) -+ my_malloc(sizeof(struct wsrep_aborting_thd), -+ MYF(0)); -+ aborting->aborting_thd = thd; -+ aborting->next = wsrep_aborting_thd; -+ wsrep_aborting_thd = aborting; -+ DBUG_PRINT("wsrep",("enqueuing trx abort for %lu", -+ wsrep_thd_thread_id(thd))); -+ WSREP_DEBUG("enqueuing trx abort for (%lu)", -+ wsrep_thd_thread_id(thd)); -+ } -+ -+ DBUG_PRINT("wsrep",("signalling wsrep rollbacker")); -+ WSREP_DEBUG("signaling aborter"); -+ mysql_cond_signal(&COND_wsrep_rollback); -+ mysql_mutex_unlock(&LOCK_wsrep_rollback); -+ -+ break; -+ } -+ default: -+ WSREP_WARN("bad wsrep query state: %d", -+ wsrep_thd_query_state(thd)); -+ break; -+ } -+ wsrep_thd_UNLOCK(thd); -+ -+ DBUG_RETURN(0); -+} -+static int -+wsrep_abort_transaction(handlerton* hton, THD *bf_thd, THD *victim_thd, -+ my_bool signal) -+{ -+ DBUG_ENTER("wsrep_innobase_abort_thd"); -+ trx_t* victim_trx = thd_to_trx(victim_thd); -+ trx_t* bf_trx = (bf_thd) ? thd_to_trx(bf_thd) : NULL; -+ WSREP_DEBUG("abort transaction: BF: %s victim: %s", -+ wsrep_thd_query(bf_thd), -+ wsrep_thd_query(victim_thd)); -+ -+ if (victim_trx) -+ { -+ lock_mutex_enter(); -+ trx_mutex_enter(victim_trx); -+ int rcode = wsrep_innobase_kill_one_trx(bf_thd, bf_trx, -+ victim_trx, signal); -+ trx_mutex_exit(victim_trx); -+ lock_mutex_exit(); -+ wsrep_srv_conc_cancel_wait(victim_trx); -+ -+ DBUG_RETURN(rcode); -+ } else { -+ WSREP_DEBUG("victim does not have transaction"); -+ wsrep_thd_LOCK(victim_thd); -+ wsrep_thd_set_conflict_state(victim_thd, MUST_ABORT); -+ wsrep_thd_UNLOCK(victim_thd); -+ wsrep_thd_awake(victim_thd, signal); -+ } -+ DBUG_RETURN(-1); -+} -+ -+static int innobase_wsrep_set_checkpoint(handlerton* hton, const XID* xid) -+{ -+ DBUG_ASSERT(hton == innodb_hton_ptr); -+ if (wsrep_is_wsrep_xid(xid)) { -+ mtr_t mtr; -+ mtr_start(&mtr); -+ trx_sysf_t* sys_header = trx_sysf_get(&mtr); -+ trx_sys_update_wsrep_checkpoint(xid, sys_header, &mtr); -+ mtr_commit(&mtr); -+ return 0; -+ } else { -+ return 1; -+ } -+} -+ -+static int innobase_wsrep_get_checkpoint(handlerton* hton, XID* xid) -+{ -+ DBUG_ASSERT(hton == innodb_hton_ptr); -+ trx_sys_read_wsrep_checkpoint(xid); -+ return 0; -+} -+ -+static void -+wsrep_fake_trx_id( -+/*==================*/ -+ handlerton *hton, -+ THD *thd) /*!< in: user thread handle */ -+{ -+ trx_id_t trx_id = trx_sys_get_new_trx_id(); -+ -+ (void *)wsrep_ws_handle_for_trx(wsrep_thd_ws_handle(thd), trx_id); -+} -+ -+#endif /* WITH_WSREP */ - /* plugin options */ - - static MYSQL_SYSVAR_ENUM(checksum_algorithm, srv_checksum_algorithm, -@@ -16236,6 +17547,40 @@ - NULL, NULL, FALSE); - #endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */ - -+#ifdef WITH_INNODB_DISALLOW_WRITES -+/******************************************************* -+ * innobase_disallow_writes variable definition * -+ *******************************************************/ -+ -+/* Must always init to FALSE. */ -+static my_bool innobase_disallow_writes = FALSE; -+ -+/************************************************************************** -+An "update" method for innobase_disallow_writes variable. */ -+static -+void -+innobase_disallow_writes_update( -+/*============================*/ -+ THD* thd, /* in: thread handle */ -+ st_mysql_sys_var* var, /* in: pointer to system -+ variable */ -+ void* var_ptr, /* out: pointer to dynamic -+ variable */ -+ const void* save) /* in: temporary storage */ -+{ -+ *(my_bool*)var_ptr = *(my_bool*)save; -+ ut_a(srv_allow_writes_event); -+ if (*(my_bool*)var_ptr) -+ os_event_reset(srv_allow_writes_event); -+ else -+ os_event_set(srv_allow_writes_event); -+} -+ -+static MYSQL_SYSVAR_BOOL(disallow_writes, innobase_disallow_writes, -+ PLUGIN_VAR_NOCMDOPT, -+ "Tell InnoDB to stop any writes to disk", -+ NULL, innobase_disallow_writes_update, FALSE); -+#endif /* WITH_INNODB_DISALLOW_WRITES */ - static MYSQL_SYSVAR_BOOL(random_read_ahead, srv_random_read_ahead, - PLUGIN_VAR_NOCMDARG, - "Whether to use read ahead for random access within an extent.", -@@ -16444,6 +17789,9 @@ - MYSQL_SYSVAR(change_buffering_debug), - MYSQL_SYSVAR(disable_background_merge), - #endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */ -+#ifdef WITH_INNODB_DISALLOW_WRITES -+ MYSQL_SYSVAR(disallow_writes), -+#endif /* WITH_INNODB_DISALLOW_WRITES */ - MYSQL_SYSVAR(random_read_ahead), - MYSQL_SYSVAR(read_ahead_threshold), - MYSQL_SYSVAR(read_only), - -=== modified file 'storage/innobase/handler/ha_innodb.h' ---- old/storage/innobase/handler/ha_innodb.h 2013-06-10 20:44:22 +0000 -+++ new/storage/innobase/handler/ha_innodb.h 2013-08-27 17:07:50 +0000 -@@ -102,6 +102,10 @@ - void innobase_initialize_autoinc(); - dict_index_t* innobase_get_index(uint keynr); - -+#ifdef WITH_WSREP -+ int wsrep_append_keys(THD *thd, bool shared, -+ const uchar* record0, const uchar* record1); -+#endif - /* Init values for the class: */ - public: - ha_innobase(handlerton *hton, TABLE_SHARE *table_arg); -@@ -447,6 +451,38 @@ - __attribute__((nonnull)); - } /* extern "C" */ - -+#ifdef WITH_WSREP -+#include -+extern "C" bool wsrep_thd_is_wsrep_on(THD *thd); -+ -+extern "C" enum wsrep_exec_mode wsrep_thd_exec_mode(THD *thd); -+extern "C" enum wsrep_conflict_state wsrep_thd_conflict_state(THD *thd); -+extern "C" enum wsrep_query_state wsrep_thd_query_state(THD *thd); -+extern "C" const char * wsrep_thd_exec_mode_str(THD *thd); -+extern "C" const char * wsrep_thd_conflict_state_str(THD *thd); -+extern "C" const char * wsrep_thd_query_state_str(THD *thd); -+extern "C" wsrep_ws_handle_t* wsrep_thd_ws_handle(THD *thd); -+ -+extern "C" void wsrep_thd_set_exec_mode(THD *thd, enum wsrep_exec_mode mode); -+extern "C" void wsrep_thd_set_query_state( -+ THD *thd, enum wsrep_query_state state); -+extern "C" void wsrep_thd_set_conflict_state( -+ THD *thd, enum wsrep_conflict_state state); -+ -+extern "C" void wsrep_thd_set_trx_to_replay(THD *thd, uint64 trx_id); -+ -+extern "C"void wsrep_thd_LOCK(THD *thd); -+extern "C"void wsrep_thd_UNLOCK(THD *thd); -+extern "C" uint32 wsrep_thd_wsrep_rand(THD *thd); -+extern "C" time_t wsrep_thd_query_start(THD *thd); -+extern "C" my_thread_id wsrep_thd_thread_id(THD *thd); -+extern "C" int64_t wsrep_thd_trx_seqno(THD *thd); -+extern "C" query_id_t wsrep_thd_query_id(THD *thd); -+extern "C" char * wsrep_thd_query(THD *thd); -+extern "C" query_id_t wsrep_thd_wsrep_last_query_id(THD *thd); -+extern "C" void wsrep_thd_set_wsrep_last_query_id(THD *thd, query_id_t id); -+extern "C" void wsrep_thd_awake(THD *thd, my_bool signal); -+#endif - struct trx_t; - - extern const struct _ft_vft ft_vft_result; - -=== modified file 'storage/innobase/handler/handler0alter.cc' ---- old/storage/innobase/handler/handler0alter.cc 2013-12-20 05:52:30 +0000 -+++ new/storage/innobase/handler/handler0alter.cc 2014-03-11 21:17:40 +0000 -@@ -46,6 +46,10 @@ - #include "srv0mon.h" - #include "fts0priv.h" - #include "pars0pars.h" -+#ifdef WITH_WSREP -+//#include "wsrep_api.h" -+#include // PROCESS_ACL -+#endif - #include "row0sel.h" - #include "ha_innodb.h" - - -=== modified file 'storage/innobase/include/dict0mem.h' ---- old/storage/innobase/include/dict0mem.h 2013-12-11 14:13:33 +0000 -+++ new/storage/innobase/include/dict0mem.h 2014-03-11 21:17:40 +0000 -@@ -467,6 +467,9 @@ - - /** Defines the maximum fixed length column size */ - #define DICT_MAX_FIXED_COL_LEN DICT_ANTELOPE_MAX_INDEX_COL_LEN -+#ifdef WITH_WSREP -+#define WSREP_MAX_SUPPORTED_KEY_LENGTH 3500 -+#endif /* WITH_WSREP */ - - /** Data structure for a field in an index */ - struct dict_field_t{ - -=== modified file 'storage/innobase/include/ha_prototypes.h' ---- old/storage/innobase/include/ha_prototypes.h 2013-11-14 02:16:21 +0000 -+++ new/storage/innobase/include/ha_prototypes.h 2014-03-11 21:17:40 +0000 -@@ -273,6 +273,20 @@ - /*================*/ - char* a); /*!< in/out: string to put in lower case */ - -+#ifdef WITH_WSREP -+UNIV_INTERN -+int -+wsrep_innobase_kill_one_trx(void *thd_ptr, -+ const trx_t *bf_trx, trx_t *victim_trx, ibool signal); -+my_bool wsrep_thd_is_BF(void *thd_ptr, my_bool sync); -+int wsrep_trx_order_before(void *thd1, void *thd2); -+void wsrep_innobase_mysql_sort(int mysql_type, uint charset_number, -+ unsigned char* str, unsigned int str_length); -+UNIV_INTERN -+int -+wsrep_on(void *thd_ptr); -+int wsrep_is_wsrep_xid(const void*); -+#endif /* WITH_WSREP */ - /**********************************************************************//** - Determines the connection character set. - @return connection character set */ - -=== modified file 'storage/innobase/include/lock0lock.h' ---- old/storage/innobase/include/lock0lock.h 2013-06-10 20:44:22 +0000 -+++ new/storage/innobase/include/lock0lock.h 2014-01-09 15:46:55 +0000 -@@ -897,9 +897,6 @@ - #if (LOCK_WAIT|LOCK_GAP|LOCK_REC_NOT_GAP|LOCK_INSERT_INTENTION|LOCK_CONV_BY_OTHER)&LOCK_MODE_MASK - # error - #endif --#if (LOCK_WAIT|LOCK_GAP|LOCK_REC_NOT_GAP|LOCK_INSERT_INTENTION|LOCK_CONV_BY_OTHER)&LOCK_TYPE_MASK --# error --#endif - /* @} */ - - /** Checks if this is a waiting lock created by lock->trx itself. -@@ -979,6 +976,16 @@ - mutex_exit(&lock_sys->wait_mutex); \ - } while (0) - -+#ifdef WITH_WSREP -+/*********************************************************************//** -+Cancels a waiting lock request and releases possible other transactions -+waiting behind it. */ -+UNIV_INTERN -+void -+lock_cancel_waiting_and_release( -+/*============================*/ -+ lock_t* lock); /*!< in/out: waiting lock request */ -+#endif /* WITH_WSREP */ - #ifndef UNIV_NONINL - #include "lock0lock.ic" - #endif - -=== modified file 'storage/innobase/include/rem0rec.h' ---- old/storage/innobase/include/rem0rec.h 2013-12-16 06:59:20 +0000 -+++ new/storage/innobase/include/rem0rec.h 2014-03-11 21:17:40 +0000 -@@ -981,6 +981,15 @@ - two upmost bits in a two byte offset for special purposes */ - #define REC_MAX_DATA_SIZE (16 * 1024) - -+#ifdef WITH_WSREP -+dberr_t wsrep_rec_get_foreign_key( -+ byte *buf, /* out: extracted key */ -+ ulint *buf_len, /* in/out: length of buf */ -+ const rec_t* rec, /* in: physical record */ -+ dict_index_t* index_for, /* in: index for foreign table */ -+ dict_index_t* index_ref, /* in: index for referenced table */ -+ ibool new_protocol); /* in: protocol > 1 */ -+#endif /* WITH_WSREP */ - #ifndef UNIV_NONINL - #include "rem0rec.ic" - #endif - -=== modified file 'storage/innobase/include/srv0srv.h' ---- old/storage/innobase/include/srv0srv.h 2013-11-29 12:56:54 +0000 -+++ new/storage/innobase/include/srv0srv.h 2014-03-11 21:17:40 +0000 -@@ -257,6 +257,10 @@ - extern uint srv_flush_log_at_timeout; - extern char srv_adaptive_flushing; - -+#ifdef WITH_INNODB_DISALLOW_WRITES -+/* When this event is reset we do not allow any file writes to take place. */ -+extern os_event_t srv_allow_writes_event; -+#endif /* WITH_INNODB_DISALLOW_WRITES */ - /* If this flag is TRUE, then we will load the indexes' (and tables') metadata - even if they are marked as "corrupted". Mostly it is for DBA to process - corrupted index and table */ -@@ -884,5 +888,13 @@ - # define srv_start_raw_disk_in_use 0 - # define srv_file_per_table 1 - #endif /* !UNIV_HOTBACKUP */ -+#ifdef WITH_WSREP -+UNIV_INTERN -+void -+wsrep_srv_conc_cancel_wait( -+/*==================*/ -+ trx_t* trx); /*!< in: transaction object associated with the -+ thread */ -+#endif /* WITH_WSREP */ - - #endif - -=== modified file 'storage/innobase/include/sync0sync.ic' ---- old/storage/innobase/include/sync0sync.ic 2013-06-10 20:44:22 +0000 -+++ new/storage/innobase/include/sync0sync.ic 2013-08-21 19:07:07 +0000 -@@ -204,8 +204,10 @@ - ulint line) /*!< in: line where locked */ - { - ut_ad(mutex_validate(mutex)); -+#ifndef WITH_WSREP -+ /* this cannot be be granted when BF trx kills a trx in lock wait state */ - ut_ad(!mutex_own(mutex)); -- -+#endif /* WITH_WSREP */ - /* Note that we do not peek at the value of lock_word before trying - the atomic test_and_set; we could peek, and possibly save time. */ - - -=== modified file 'storage/innobase/include/trx0sys.h' ---- old/storage/innobase/include/trx0sys.h 2013-06-10 20:44:22 +0000 -+++ new/storage/innobase/include/trx0sys.h 2013-11-07 12:24:22 +0000 -@@ -41,6 +41,9 @@ - #include "ut0bh.h" - #include "read0types.h" - #include "page0types.h" -+#ifdef WITH_WSREP -+#include "trx0xa.h" -+#endif /* WITH_WSREP */ - #include "ut0bh.h" - - typedef UT_LIST_BASE_NODE_T(trx_t) trx_list_t; -@@ -293,6 +296,9 @@ - ib_int64_t offset, /*!< in: position in that log file */ - ulint field, /*!< in: offset of the MySQL log info field in - the trx sys header */ -+#ifdef WITH_WSREP -+ trx_sysf_t* sys_header, /*!< in: trx sys header */ -+#endif /* WITH_WSREP */ - mtr_t* mtr); /*!< in: mtr */ - /*****************************************************************//** - Prints to stderr the MySQL binlog offset info in the trx system header if -@@ -301,6 +307,19 @@ - void - trx_sys_print_mysql_binlog_offset(void); - /*===================================*/ -+#ifdef WITH_WSREP -+/** Update WSREP checkpoint XID in sys header. */ -+void -+trx_sys_update_wsrep_checkpoint( -+ const XID* xid, /*!< in: WSREP XID */ -+ trx_sysf_t* sys_header, /*!< in: sys_header */ -+ mtr_t* mtr); /*!< in: mtr */ -+ -+void -+/** Read WSREP checkpoint XID from sys header. */ -+trx_sys_read_wsrep_checkpoint( -+ XID* xid); /*!< out: WSREP XID */ -+#endif /* WITH_WSREP */ - /*****************************************************************//** - Prints to stderr the MySQL master log offset info in the trx system header if - the magic number shows it valid. */ -@@ -529,6 +548,20 @@ - within that file */ - #define TRX_SYS_MYSQL_LOG_NAME 12 /*!< MySQL log file name */ - -+#ifdef WITH_WSREP -+/* The offset to WSREP XID headers */ -+#define TRX_SYS_WSREP_XID_INFO (UNIV_PAGE_SIZE - 3500) -+#define TRX_SYS_WSREP_XID_MAGIC_N_FLD 0 -+#define TRX_SYS_WSREP_XID_MAGIC_N 0x77737265 -+ -+/* XID field: formatID, gtrid_len, bqual_len, xid_data */ -+#define TRX_SYS_WSREP_XID_LEN (4 + 4 + 4 + XIDDATASIZE) -+#define TRX_SYS_WSREP_XID_FORMAT 4 -+#define TRX_SYS_WSREP_XID_GTRID_LEN 8 -+#define TRX_SYS_WSREP_XID_BQUAL_LEN 12 -+#define TRX_SYS_WSREP_XID_DATA 16 -+#endif /* WITH_WSREP*/ -+ - /** Doublewrite buffer */ - /* @{ */ - /** The offset of the doublewrite buffer header on the trx system header page */ - -=== modified file 'storage/innobase/include/trx0sys.ic' ---- old/storage/innobase/include/trx0sys.ic 2013-06-10 20:44:22 +0000 -+++ new/storage/innobase/include/trx0sys.ic 2013-11-04 22:43:00 +0000 -@@ -445,7 +445,10 @@ - trx_sys_get_new_trx_id(void) - /*========================*/ - { -+#ifndef WITH_WSREP -+ /* wsrep_fake_trx_id violates this assert */ - ut_ad(mutex_own(&trx_sys->mutex)); -+#endif /* WITH_WSREP */ - - /* VERY important: after the database is started, max_trx_id value is - divisible by TRX_SYS_TRX_ID_WRITE_MARGIN, and the following if - -=== modified file 'storage/innobase/include/trx0trx.h' ---- old/storage/innobase/include/trx0trx.h 2013-12-11 08:05:55 +0000 -+++ new/storage/innobase/include/trx0trx.h 2014-03-11 21:17:40 +0000 -@@ -1004,6 +1004,9 @@ - /*------------------------------*/ - char detailed_error[256]; /*!< detailed error message for last - error, or empty. */ -+#ifdef WITH_WSREP -+ os_event_t wsrep_event; /* event waited for in srv_conc_slot */ -+#endif /* WITH_WSREP */ - }; - - /* Transaction isolation levels (trx->isolation_level) */ - -=== modified file 'storage/innobase/lock/lock0lock.cc' ---- old/storage/innobase/lock/lock0lock.cc 2013-06-10 20:44:22 +0000 -+++ new/storage/innobase/lock/lock0lock.cc 2014-02-25 11:33:04 +0000 -@@ -50,6 +50,10 @@ - #include "dict0boot.h" - #include - -+#ifdef WITH_WSREP -+extern my_bool wsrep_debug; -+extern my_bool wsrep_log_conflicts; -+#endif - /* Restricts the length of search we will do in the waits-for - graph of transactions */ - #define LOCK_MAX_N_STEPS_IN_DEADLOCK_CHECK 1000000 -@@ -950,6 +954,9 @@ - ibool - lock_rec_has_to_wait( - /*=================*/ -+#ifdef WITH_WSREP -+ ibool for_locking, /*!< is caller locking or releasing */ -+#endif /* WITH_WSREP */ - const trx_t* trx, /*!< in: trx of new lock */ - ulint type_mode,/*!< in: precise mode of the new lock - to set: LOCK_S or LOCK_X, possibly -@@ -1020,6 +1027,44 @@ - return(FALSE); - } - -+#ifdef WITH_WSREP -+ /* if BF thread is locking and has conflict with another BF -+ thread, we need to look at trx ordering and lock types */ -+ if (for_locking && -+ wsrep_thd_is_BF(trx->mysql_thd, FALSE) && -+ wsrep_thd_is_BF(lock2->trx->mysql_thd, TRUE)) { -+ -+ if (wsrep_debug) { -+ fprintf(stderr, "\n BF-BF lock conflict \n"); -+ lock_rec_print(stderr, lock2); -+ } -+ -+ if (wsrep_trx_order_before(trx->mysql_thd, -+ lock2->trx->mysql_thd) && -+ (type_mode & LOCK_MODE_MASK) == LOCK_X && -+ (lock2->type_mode & LOCK_MODE_MASK) == LOCK_X) -+ { -+ /* exclusive lock conflicts are not accepted */ -+ fprintf(stderr, "BF-BF X lock conflict\n"); -+ lock_rec_print(stderr, lock2); -+ abort(); -+ } else { -+ /* if lock2->index->n_uniq <= -+ lock2->index->n_user_defined_cols -+ operation is on uniq index -+ */ -+ if (wsrep_debug) fprintf(stderr, -+ "BF conflict, modes: %lu %lu, " -+ "idx: %s-%s n_uniq %u n_user %u\n", -+ type_mode, lock2->type_mode, -+ lock2->index->name, -+ lock2->index->table_name, -+ lock2->index->n_uniq, -+ lock2->index->n_user_defined_cols); -+ return FALSE; -+ } -+ } -+#endif /* WITH_WSREP */ - return(TRUE); - } - -@@ -1050,7 +1095,11 @@ - /* If this lock request is for a supremum record - then the second bit on the lock bitmap is set */ - -+#ifdef WITH_WSREP -+ return(lock_rec_has_to_wait(FALSE, lock1->trx, -+#else - return(lock_rec_has_to_wait(lock1->trx, -+#endif /* WITH_WSREP */ - lock1->type_mode, lock2, - lock_rec_get_nth_bit( - lock1, 1))); -@@ -1519,6 +1568,11 @@ - return(NULL); - } - -+#ifdef WITH_WSREP -+static -+void -+lock_rec_discard(lock_t* in_lock); -+#endif - #ifdef UNIV_DEBUG - /*********************************************************************//** - Checks if some other transaction has a lock request in the queue. -@@ -1567,6 +1621,57 @@ - } - #endif /* UNIV_DEBUG */ - -+#ifdef WITH_WSREP -+static void -+wsrep_kill_victim(const trx_t * const trx, const lock_t *lock) { -+ ut_ad(lock_mutex_own()); -+ ut_ad(trx_mutex_own(lock->trx)); -+ my_bool bf_this = wsrep_thd_is_BF(trx->mysql_thd, FALSE); -+ my_bool bf_other = wsrep_thd_is_BF(lock->trx->mysql_thd, TRUE); -+ if ((bf_this && !bf_other) || -+ (bf_this && bf_other && wsrep_trx_order_before( -+ trx->mysql_thd, lock->trx->mysql_thd))) { -+ -+ if (lock->trx->lock.que_state == TRX_QUE_LOCK_WAIT) { -+ if (wsrep_debug) -+ fprintf(stderr, "WSREP: BF victim waiting\n"); -+ /* cannot release lock, until our lock -+ is in the queue*/ -+ } else if (lock->trx != trx) { -+ if (wsrep_log_conflicts) { -+ mutex_enter(&trx_sys->mutex); -+ if (bf_this) -+ fputs("\n*** Priority TRANSACTION:\n", -+ stderr); -+ else -+ fputs("\n*** Victim TRANSACTION:\n", -+ stderr); -+ trx_print_latched(stderr, trx, 3000); -+ -+ if (bf_other) -+ fputs("\n*** Priority TRANSACTION:\n", -+ stderr); -+ else -+ fputs("\n*** Victim TRANSACTION:\n", -+ stderr); -+ trx_print_latched(stderr, lock->trx, 3000); -+ -+ mutex_exit(&trx_sys->mutex); -+ fputs("*** WAITING FOR THIS LOCK TO BE GRANTED:\n", -+ stderr); -+ -+ if (lock_get_type(lock) == LOCK_REC) { -+ lock_rec_print(stderr, lock); -+ } else { -+ lock_table_print(stderr, lock); -+ } -+ } -+ wsrep_innobase_kill_one_trx(trx->mysql_thd, -+ (const trx_t*) trx, lock->trx, TRUE); -+ } -+ } -+} -+#endif - /*********************************************************************//** - Checks if some other transaction has a conflicting explicit lock request - in the queue, so that we have to wait. -@@ -1595,7 +1700,14 @@ - lock != NULL; - lock = lock_rec_get_next_const(heap_no, lock)) { - -+#ifdef WITH_WSREP -+ if (lock_rec_has_to_wait(TRUE, trx, mode, lock, is_supremum)) { -+ trx_mutex_enter(lock->trx); -+ wsrep_kill_victim(trx, lock); -+ trx_mutex_exit(lock->trx); -+#else - if (lock_rec_has_to_wait(trx, mode, lock, is_supremum)) { -+#endif /* WITH_WSREP */ - return(lock); - } - } -@@ -1724,6 +1836,27 @@ - } - - /*============== RECORD LOCK CREATION AND QUEUE MANAGEMENT =============*/ -+#ifdef WITH_WSREP -+static -+void -+wsrep_print_wait_locks( -+/*============*/ -+ lock_t* c_lock) /* conflicting lock to print */ -+{ -+ if (wsrep_debug && c_lock->trx->lock.wait_lock != c_lock) { -+ fprintf(stderr, "WSREP: c_lock != wait lock\n"); -+ if (lock_get_type_low(c_lock) & LOCK_TABLE) -+ lock_table_print(stderr, c_lock); -+ else -+ lock_rec_print(stderr, c_lock); -+ -+ if (lock_get_type_low(c_lock->trx->lock.wait_lock) & LOCK_TABLE) -+ lock_table_print(stderr, c_lock->trx->lock.wait_lock); -+ else -+ lock_rec_print(stderr, c_lock->trx->lock.wait_lock); -+ } -+} -+#endif /* WITH_WSREP */ - - /*********************************************************************//** - Creates a new record lock and inserts it to the lock queue. Does NOT check -@@ -1733,6 +1866,10 @@ - lock_t* - lock_rec_create( - /*============*/ -+#ifdef WITH_WSREP -+ lock_t* const c_lock, /* conflicting lock */ -+ que_thr_t* thr, -+#endif - ulint type_mode,/*!< in: lock mode and wait - flag, type is ignored and - replaced by LOCK_REC */ -@@ -1804,9 +1941,78 @@ - - ut_ad(index->table->n_ref_count > 0 || !index->table->can_be_evicted); - -+#ifdef WITH_WSREP -+ if (c_lock && wsrep_thd_is_BF(trx->mysql_thd, FALSE)) { -+ lock_t *hash = (lock_t *)c_lock->hash; -+ lock_t *prev = NULL; -+ -+ while (hash && -+ wsrep_thd_is_BF(((lock_t *)hash)->trx->mysql_thd, TRUE) && -+ wsrep_trx_order_before( -+ ((lock_t *)hash)->trx->mysql_thd, -+ trx->mysql_thd)) { -+ prev = hash; -+ hash = (lock_t *)hash->hash; -+ } -+ lock->hash = hash; -+ if (prev) { -+ prev->hash = lock; -+ } else { -+ c_lock->hash = lock; -+ } -+ /* -+ * delayed conflict resolution '...kill_one_trx' was not called, -+ * if victim was waiting for some other lock -+ */ -+ trx_mutex_enter(c_lock->trx); -+ if (c_lock->trx->lock.que_state == TRX_QUE_LOCK_WAIT) { -+ -+ c_lock->trx->lock.was_chosen_as_deadlock_victim = TRUE; -+ -+ if (wsrep_debug) wsrep_print_wait_locks(c_lock); -+ -+ trx->lock.que_state = TRX_QUE_LOCK_WAIT; -+ lock_set_lock_and_trx_wait(lock, trx); -+ UT_LIST_ADD_LAST(trx_locks, trx->lock.trx_locks, lock); -+ -+ ut_ad(thr != NULL); -+ trx->lock.wait_thr = thr; -+ thr->state = QUE_THR_LOCK_WAIT; -+ -+ /* have to release trx mutex for the duration of -+ victim lock release. This will eventually call -+ lock_grant, which wants to grant trx mutex again -+ */ -+ if (caller_owns_trx_mutex) trx_mutex_exit(trx); -+ lock_cancel_waiting_and_release( -+ c_lock->trx->lock.wait_lock); -+ if (caller_owns_trx_mutex) trx_mutex_enter(trx); -+ -+ /* trx might not wait for c_lock, but some other lock -+ does not matter if wait_lock was released above -+ */ -+ if (c_lock->trx->lock.wait_lock == c_lock) { -+ lock_reset_lock_and_trx_wait(lock); -+ } -+ trx_mutex_exit(c_lock->trx); -+ -+ if (wsrep_debug) fprintf( -+ stderr, -+ "WSREP: c_lock canceled %llu\n", -+ (ulonglong) c_lock->trx->id); -+ -+ /* have to bail out here to avoid lock_set_lock... */ -+ return(lock); -+ } -+ trx_mutex_exit(c_lock->trx); -+ } else { -+ HASH_INSERT(lock_t, hash, lock_sys->rec_hash, -+ lock_rec_fold(space, page_no), lock); -+ } -+#else - HASH_INSERT(lock_t, hash, lock_sys->rec_hash, - lock_rec_fold(space, page_no), lock); -- -+#endif /* WITH_WSREP */ - if (!caller_owns_trx_mutex) { - trx_mutex_enter(trx); - } -@@ -1840,6 +2046,9 @@ - dberr_t - lock_rec_enqueue_waiting( - /*=====================*/ -+#ifdef WITH_WSREP -+ lock_t* c_lock, /* conflicting lock */ -+#endif - ulint type_mode,/*!< in: lock mode this - transaction is requesting: - LOCK_S or LOCK_X, possibly -@@ -1899,9 +2108,20 @@ - /* Enqueue the lock request that will wait - to be granted, note that we already own - the trx mutex. */ -+#ifdef WITH_WSREP -+ if (wsrep_on(trx->mysql_thd) && -+ trx->lock.was_chosen_as_deadlock_victim) { -+ return(DB_DEADLOCK); -+ } - lock = lock_rec_create( -+ c_lock, thr, - type_mode | LOCK_WAIT, block, heap_no, - index, trx, TRUE); -+#else -+ lock = lock_rec_create( -+ type_mode | LOCK_WAIT, block, heap_no, -+ index, trx, TRUE); -+#endif /* WITH_WSREP */ - } else { - ut_ad(lock->type_mode & LOCK_WAIT); - ut_ad(lock->type_mode & LOCK_CONV_BY_OTHER); -@@ -2008,7 +2228,19 @@ - const lock_t* other_lock - = lock_rec_other_has_expl_req(mode, 0, LOCK_WAIT, - block, heap_no, trx); -+#ifdef WITH_WSREP -+ /* this can potentionally assert with wsrep */ -+ if (wsrep_on(trx->mysql_thd)) { -+ if (wsrep_debug && other_lock) { -+ fprintf(stderr, -+ "WSREP: InnoDB assert ignored\n"); -+ } -+ } else { -+ ut_a(!other_lock); -+ } -+#else - ut_a(!other_lock); -+#endif /* WITH_WSREP */ - } - #endif /* UNIV_DEBUG */ - -@@ -2059,9 +2291,15 @@ - } - - somebody_waits: -+#ifdef WITH_WSREP -+ return(lock_rec_create(NULL, NULL, -+ type_mode, block, heap_no, index, trx, -+ caller_owns_trx_mutex)); -+#else - return(lock_rec_create( - type_mode, block, heap_no, index, trx, - caller_owns_trx_mutex)); -+#endif - } - - /** Record locking request status */ -@@ -2124,9 +2362,13 @@ - if (lock == NULL) { - if (!impl) { - /* Note that we don't own the trx mutex. */ -+#ifdef WITH_WSREP -+ lock = lock_rec_create(NULL, thr, -+ mode, block, heap_no, index, trx, FALSE); -+#else - lock = lock_rec_create( - mode, block, heap_no, index, trx, FALSE); -- -+#endif - } - status = LOCK_REC_SUCCESS_CREATED; - } else { -@@ -2179,6 +2421,9 @@ - que_thr_t* thr) /*!< in: query thread */ - { - trx_t* trx; -+#ifdef WITH_WSREP -+ lock_t* c_lock(NULL); -+#endif - lock_t* lock; - dberr_t err = DB_SUCCESS; - -@@ -2223,10 +2468,15 @@ - /* The trx already has a strong enough lock on rec: do - nothing */ - -+#ifdef WITH_WSREP -+ } else if ((c_lock = (lock_t *)lock_rec_other_has_conflicting( -+ static_cast(mode), -+ block, heap_no, trx))) { -+#else - } else if (lock_rec_other_has_conflicting( - static_cast(mode), - block, heap_no, trx)) { -- -+#endif /* WITH_WSREP */ - /* If another transaction has a non-gap conflicting - request in the queue, as this transaction does not - have a lock strong enough already granted on the -@@ -2234,9 +2484,16 @@ - - ut_ad(lock == NULL); - enqueue_waiting: -+#ifdef WITH_WSREP -+ /* c_lock is NULL here if jump to enqueue_waiting happened -+ but it's ok because lock is not NULL in that case and c_lock -+ is not used. */ -+ err = lock_rec_enqueue_waiting(c_lock, -+ mode, block, heap_no, lock, index, thr); -+#else - err = lock_rec_enqueue_waiting( - mode, block, heap_no, lock, index, thr); -- -+#endif /* WITH_WSREP */ - } else if (!impl) { - /* Set the requested lock on the record, note that - we already own the transaction mutex. */ -@@ -3731,9 +3988,19 @@ - /* The joining transaction is 'smaller', - choose it as the victim and roll it back. */ - -+#ifdef WITH_WSREP -+ if (wsrep_thd_is_BF(ctx->start->mysql_thd, TRUE)) -+ return(ctx->wait_lock->trx); -+ else -+#endif /* WITH_WSREP */ - return(ctx->start); - } - -+#ifdef WITH_WSREP -+ if (wsrep_thd_is_BF(ctx->wait_lock->trx->mysql_thd, TRUE)) -+ return(ctx->start); -+ else -+#endif /* WITH_WSREP */ - return(ctx->wait_lock->trx); - } - -@@ -3864,6 +4131,11 @@ - ctx->too_deep = TRUE; - - /* Select the joining transaction as the victim. */ -+#ifdef WITH_WSREP -+ if (wsrep_thd_is_BF(ctx->start->mysql_thd, TRUE)) -+ return(ctx->wait_lock->trx->id); -+ else -+#endif /* WITH_WSREP */ - return(ctx->start->id); - - } else if (lock->trx->lock.que_state == TRX_QUE_LOCK_WAIT) { -@@ -3881,6 +4153,11 @@ - - ctx->too_deep = TRUE; - -+#ifdef WITH_WSREP -+ if (wsrep_thd_is_BF(ctx->start->mysql_thd, TRUE)) -+ return(lock->trx->id); -+ else -+#endif /* WITH_WSREP */ - return(ctx->start->id); - } - -@@ -3997,11 +4274,20 @@ - if (ctx.too_deep) { - - ut_a(trx == ctx.start); -+ -+#ifdef WITH_WSREP -+ if (!wsrep_thd_is_BF(ctx.start->mysql_thd, TRUE)) -+ { -+#endif /* WITH_WSREP */ - ut_a(victim_trx_id == trx->id); - - if (!srv_read_only_mode) { - lock_deadlock_joining_trx_print(trx, lock); - } -+#ifdef WITH_WSREP -+ } else -+ /* BF processor */; -+#endif /* WITH_WSREP */ - - MONITOR_INC(MONITOR_DEADLOCK); - -@@ -4039,6 +4325,9 @@ - lock_t* - lock_table_create( - /*==============*/ -+#ifdef WITH_WSREP -+ lock_t* c_lock, /* conflicting lock */ -+#endif - dict_table_t* table, /*!< in/out: database table - in dictionary cache */ - ulint type_mode,/*!< in: lock mode possibly ORed with -@@ -4083,7 +4372,46 @@ - ut_ad(table->n_ref_count > 0 || !table->can_be_evicted); - - UT_LIST_ADD_LAST(trx_locks, trx->lock.trx_locks, lock); -+#ifdef WITH_WSREP -+ if (c_lock && wsrep_thd_is_BF(trx->mysql_thd, FALSE)) { -+ UT_LIST_INSERT_AFTER( -+ un_member.tab_lock.locks, table->locks, c_lock, lock); -+ } else { -+ UT_LIST_ADD_LAST(un_member.tab_lock.locks, table->locks, lock); -+ } -+ -+ if (c_lock) trx_mutex_enter(c_lock->trx); -+ if (c_lock && c_lock->trx->lock.que_state == TRX_QUE_LOCK_WAIT) { -+ -+ c_lock->trx->lock.was_chosen_as_deadlock_victim = TRUE; -+ -+ if (wsrep_debug) wsrep_print_wait_locks(c_lock); -+ -+ /* have to release trx mutex for the duration of -+ victim lock release. This will eventually call -+ lock_grant, which wants to grant trx mutex again -+ */ -+ /* caller has trx_mutex, have to release for lock cancel */ -+ trx_mutex_exit(trx); -+ lock_cancel_waiting_and_release(c_lock->trx->lock.wait_lock); -+ trx_mutex_enter(trx); -+ -+ /* trx might not wait for c_lock, but some other lock -+ does not matter if wait_lock was released above -+ */ -+ if (c_lock->trx->lock.wait_lock == c_lock) { -+ lock_reset_lock_and_trx_wait(lock); -+ } -+ -+ if (wsrep_debug) { -+ fprintf(stderr, "WSREP: c_lock canceled %llu\n", -+ (ulonglong) c_lock->trx->id); -+ } -+ } -+ if (c_lock) trx_mutex_exit(c_lock->trx); -+#else - UT_LIST_ADD_LAST(un_member.tab_lock.locks, table->locks, lock); -+#endif /* WITH_WSREP */ - - if (UNIV_UNLIKELY(type_mode & LOCK_WAIT)) { - -@@ -4240,12 +4568,15 @@ - dberr_t - lock_table_enqueue_waiting( - /*=======================*/ -+#ifdef WITH_WSREP -+ lock_t* c_lock, /* conflicting lock */ -+#endif - ulint mode, /*!< in: lock mode this transaction is - requesting */ - dict_table_t* table, /*!< in/out: table */ - que_thr_t* thr) /*!< in: query thread */ - { -- trx_t* trx; -+ trx_t* trx; - lock_t* lock; - trx_id_t victim_trx_id; - -@@ -4284,7 +4615,14 @@ - - /* Enqueue the lock request that will wait to be granted */ - -+#ifdef WITH_WSREP -+ if (trx->lock.was_chosen_as_deadlock_victim) { -+ return(DB_DEADLOCK); -+ } -+ lock = lock_table_create(c_lock, table, mode | LOCK_WAIT, trx); -+#else - lock = lock_table_create(table, mode | LOCK_WAIT, trx); -+#endif - - /* Release the mutex to obey the latching order. - This is safe, because lock_deadlock_check_and_resolve() -@@ -4356,6 +4694,13 @@ - && !lock_mode_compatible(lock_get_mode(lock), mode) - && (wait || !lock_get_wait(lock))) { - -+#ifdef WITH_WSREP -+ if (wsrep_debug) -+ fprintf(stderr, "WSREP: table lock abort"); -+ trx_mutex_enter(lock->trx); -+ wsrep_kill_victim((trx_t *)trx, (lock_t *)lock); -+ trx_mutex_exit(lock->trx); -+#endif - return(lock); - } - } -@@ -4417,9 +4762,18 @@ - mode: this trx may have to wait */ - - if (wait_for != NULL) { -+#ifdef WITH_WSREP -+ err = lock_table_enqueue_waiting((lock_t *)wait_for, -+ mode | flags, table, thr); -+#else - err = lock_table_enqueue_waiting(mode | flags, table, thr); -+#endif /* WITH_WSREP */ - } else { -+#ifdef WITH_WSREP -+ lock_table_create((lock_t *)wait_for, table, mode | flags, trx); -+#else - lock_table_create(table, mode | flags, trx); -+#endif /* WITH_WSREP */ - - ut_a(!flags || mode == LOCK_S || mode == LOCK_X); - -@@ -4457,7 +4811,11 @@ - trx, LOCK_WAIT, table, LOCK_IX)); - - trx_mutex_enter(trx); -+#ifdef WITH_WSREP -+ lock_table_create(NULL, table, LOCK_IX, trx); -+#else - lock_table_create(table, LOCK_IX, trx); -+#endif /* WITH_WSREP */ - lock_mutex_exit(); - trx_mutex_exit(trx); - } -@@ -5585,6 +5943,7 @@ - - if (!lock_rec_get_gap(lock) && !lock_get_wait(lock)) { - -+#ifndef WITH_WSREP - enum lock_mode mode; - - if (lock_get_mode(lock) == LOCK_S) { -@@ -5594,6 +5953,7 @@ - } - ut_a(!lock_rec_other_has_expl_req( - mode, 0, 0, block, heap_no, lock->trx)); -+#endif /* WITH_WSREP */ - - } else if (lock_get_wait(lock) && !lock_rec_get_gap(lock)) { - -@@ -5897,6 +6257,9 @@ - lock_t* lock; - dberr_t err; - ulint next_rec_heap_no; -+#ifdef WITH_WSREP -+ lock_t *c_lock; -+#endif - - ut_ad(block->frame == page_align(rec)); - ut_ad(!dict_index_is_online_ddl(index) -@@ -5953,17 +6316,29 @@ - had to wait for their insert. Both had waiting gap type lock requests - on the successor, which produced an unnecessary deadlock. */ - -+#ifdef WITH_WSREP -+ if ((c_lock = (lock_t *)lock_rec_other_has_conflicting( -+ static_cast( -+ LOCK_X | LOCK_GAP | LOCK_INSERT_INTENTION), -+ block, next_rec_heap_no, trx))) { -+#else - if (lock_rec_other_has_conflicting( - static_cast( - LOCK_X | LOCK_GAP | LOCK_INSERT_INTENTION), - block, next_rec_heap_no, trx)) { -- -+#endif /* WITH_WSREP */ - /* Note that we may get DB_SUCCESS also here! */ - trx_mutex_enter(trx); - -+#ifdef WITH_WSREP -+ err = lock_rec_enqueue_waiting(c_lock, -+ LOCK_X | LOCK_GAP | LOCK_INSERT_INTENTION, -+ block, next_rec_heap_no, NULL, index, thr); -+#else - err = lock_rec_enqueue_waiting( - LOCK_X | LOCK_GAP | LOCK_INSERT_INTENTION, - block, next_rec_heap_no, NULL, index, thr); -+#endif /* WITH_WSREP */ - - trx_mutex_exit(trx); - } else { -@@ -6068,6 +6443,11 @@ - implicit lock. Because cannot lock at this moment.*/ - - if (rec_get_deleted_flag(rec, rec_offs_comp(offsets)) -+#ifdef WITH_WSREP -+ && !wsrep_thd_is_BF(impl_trx->mysql_thd, FALSE) -+ /* BF-BF conflict is possible if advancing into -+ lock_rec_other_has_conflicting*/ -+#endif /* WITH_WSREP */ - && lock_rec_other_has_conflicting( - static_cast - (LOCK_X | LOCK_REC_NOT_GAP), block, - -=== modified file 'storage/innobase/lock/lock0wait.cc' ---- old/storage/innobase/lock/lock0wait.cc 2013-04-18 14:25:27 +0000 -+++ new/storage/innobase/lock/lock0wait.cc 2014-01-09 15:46:55 +0000 -@@ -184,6 +184,28 @@ - return(NULL); - } - -+#ifdef WITH_WSREP -+/*********************************************************************//** -+check if lock timeout was for priority thread, -+as a side effect trigger lock monitor -+@return false for regular lock timeout */ -+static ibool -+wsrep_is_BF_lock_timeout( -+/*====================*/ -+ trx_t* trx) /* in: trx to check for lock priority */ -+{ -+ if (wsrep_on(trx->mysql_thd) && -+ wsrep_thd_is_BF(trx->mysql_thd, FALSE)) { -+ fprintf(stderr, "WSREP: BF lock wait long\n"); -+ srv_print_innodb_monitor = TRUE; -+ srv_print_innodb_lock_monitor = TRUE; -+ os_event_set(srv_monitor_event); -+ return TRUE; -+ } -+ return FALSE; -+ } -+#endif /* WITH_WSREP */ -+ - /***************************************************************//** - Puts a user OS thread to wait for a lock to be released. If an error - occurs during the wait trx->error_state associated with thr is -@@ -375,9 +397,15 @@ - - if (lock_wait_timeout < 100000000 - && wait_time > (double) lock_wait_timeout) { -+#ifdef WITH_WSREP -+ if (!wsrep_is_BF_lock_timeout(trx)) { -+#endif /* WITH_WSREP */ - - trx->error_state = DB_LOCK_WAIT_TIMEOUT; - -+#ifdef WITH_WSREP -+ } -+#endif /* WITH_WSREP */ - MONITOR_INC(MONITOR_TIMEOUT); - } - -@@ -461,8 +489,14 @@ - if (trx->lock.wait_lock) { - - ut_a(trx->lock.que_state == TRX_QUE_LOCK_WAIT); -+#ifdef WITH_WSREP -+ if (!wsrep_is_BF_lock_timeout(trx)) { -+#endif /* WITH_WSREP */ - - lock_cancel_waiting_and_release(trx->lock.wait_lock); -+#ifdef WITH_WSREP -+ } -+#endif /* WITH_WSREP */ - } - - lock_mutex_exit(); - -=== modified file 'storage/innobase/os/os0file.cc' ---- old/storage/innobase/os/os0file.cc 2013-12-04 10:28:27 +0000 -+++ new/storage/innobase/os/os0file.cc 2014-03-11 21:17:40 +0000 -@@ -87,6 +87,12 @@ - /* In simulated aio, merge at most this many consecutive i/os */ - #define OS_AIO_MERGE_N_CONSECUTIVE 64 - -+#ifdef WITH_INNODB_DISALLOW_WRITES -+#define WAIT_ALLOW_WRITES() os_event_wait(srv_allow_writes_event) -+#else -+#define WAIT_ALLOW_WRITES() do { } while (0) -+#endif /* WITH_INNODB_DISALLOW_WRITES */ -+ - /********************************************************************** - - InnoDB AIO Implementation: -@@ -763,7 +769,9 @@ - /*========================*/ - { - FILE* file = NULL; -- int fd = innobase_mysql_tmpfile(); -+ int fd; -+ WAIT_ALLOW_WRITES(); -+ fd = innobase_mysql_tmpfile(); - - ut_ad(!srv_read_only_mode); - -@@ -1089,6 +1097,7 @@ - return(TRUE); - #else - int rcode; -+ WAIT_ALLOW_WRITES(); - - rcode = mkdir(pathname, 0770); - -@@ -1215,6 +1224,8 @@ - - #else /* __WIN__ */ - int create_flag; -+ if (create_mode != OS_FILE_OPEN && create_mode != OS_FILE_OPEN_RAW) -+ WAIT_ALLOW_WRITES(); - - ut_a(!(create_mode & OS_FILE_ON_ERROR_SILENT)); - ut_a(!(create_mode & OS_FILE_ON_ERROR_NO_EXIT)); -@@ -1382,6 +1393,8 @@ - int create_flag; - - ut_a(name); -+ if (create_mode != OS_FILE_OPEN && create_mode != OS_FILE_OPEN_RAW) -+ WAIT_ALLOW_WRITES(); - - ut_a(!(create_mode & OS_FILE_ON_ERROR_SILENT)); - ut_a(!(create_mode & OS_FILE_ON_ERROR_NO_EXIT)); -@@ -1673,6 +1686,8 @@ - #else /* __WIN__ */ - int create_flag; - const char* mode_str = NULL; -+ if (create_mode != OS_FILE_OPEN && create_mode != OS_FILE_OPEN_RAW) -+ WAIT_ALLOW_WRITES(); - - on_error_no_exit = create_mode & OS_FILE_ON_ERROR_NO_EXIT - ? TRUE : FALSE; -@@ -1852,6 +1867,7 @@ - goto loop; - #else - int ret; -+ WAIT_ALLOW_WRITES(); - - ret = unlink(name); - -@@ -1916,6 +1932,7 @@ - goto loop; - #else - int ret; -+ WAIT_ALLOW_WRITES(); - - ret = unlink(name); - -@@ -1969,6 +1986,7 @@ - return(FALSE); - #else - int ret; -+ WAIT_ALLOW_WRITES(); - - ret = rename(oldpath, newpath); - -@@ -2180,6 +2198,7 @@ - HANDLE h = (HANDLE) _get_osfhandle(fileno(file)); - return(SetEndOfFile(h)); - #else /* __WIN__ */ -+ WAIT_ALLOW_WRITES(); - return(!ftruncate(fileno(file), ftell(file))); - #endif /* __WIN__ */ - } -@@ -2274,6 +2293,7 @@ - return(FALSE); - #else - int ret; -+ WAIT_ALLOW_WRITES(); - - #if defined(HAVE_DARWIN_THREADS) - # ifndef F_FULLFSYNC -@@ -2955,6 +2975,7 @@ - return(FALSE); - #else - ssize_t ret; -+ WAIT_ALLOW_WRITES(); - - ret = os_file_pwrite(file, buf, n, offset); - - -=== modified file 'storage/innobase/rem/rem0rec.cc' ---- old/storage/innobase/rem/rem0rec.cc 2013-12-16 06:59:20 +0000 -+++ new/storage/innobase/rem/rem0rec.cc 2014-03-11 21:17:40 +0000 -@@ -33,6 +33,9 @@ - #include "mtr0mtr.h" - #include "mtr0log.h" - #include "fts0fts.h" -+#ifdef WITH_WSREP -+#include -+#endif /* WITH_WSREP */ - - /* PHYSICAL RECORD (OLD STYLE) - =========================== -@@ -1961,3 +1964,133 @@ - } - # endif /* UNIV_DEBUG */ - #endif /* !UNIV_HOTBACKUP */ -+#ifdef WITH_WSREP -+dberr_t -+wsrep_rec_get_foreign_key( -+ byte *buf, /* out: extracted key */ -+ ulint *buf_len, /* in/out: length of buf */ -+ const rec_t* rec, /* in: physical record */ -+ dict_index_t* index_for, /* in: index in foreign table */ -+ dict_index_t* index_ref, /* in: index in referenced table */ -+ ibool new_protocol) /* in: protocol > 1 */ -+{ -+ const byte* data; -+ ulint len; -+ ulint key_len = 0; -+ ulint i; -+ uint key_parts; -+ mem_heap_t* heap = NULL; -+ ulint offsets_[REC_OFFS_NORMAL_SIZE]; -+ const ulint* offsets; -+ -+ ut_ad(index_for); -+ ut_ad(index_ref); -+ -+ rec_offs_init(offsets_); -+ offsets = rec_get_offsets(rec, index_for, offsets_, -+ ULINT_UNDEFINED, &heap); -+ -+ ut_ad(rec_offs_validate(rec, NULL, offsets)); -+ -+ ut_ad(rec); -+ -+ key_parts = dict_index_get_n_unique_in_tree(index_for); -+ for (i = 0; -+ i < key_parts && -+ (index_for->type & DICT_CLUSTERED || i < key_parts - 1); -+ i++) { -+ dict_field_t* field_f = -+ dict_index_get_nth_field(index_for, i); -+ const dict_col_t* col_f = dict_field_get_col(field_f); -+ dict_field_t* field_r = -+ dict_index_get_nth_field(index_ref, i); -+ const dict_col_t* col_r = dict_field_get_col(field_r); -+ -+ data = rec_get_nth_field(rec, offsets, i, &len); -+ if (key_len + ((len != UNIV_SQL_NULL) ? len + 1 : 1) > -+ *buf_len) { -+ fprintf (stderr, -+ "WSREP: FK key len exceeded %lu %lu %lu\n", -+ key_len, len, *buf_len); -+ goto err_out; -+ } -+ -+ if (len == UNIV_SQL_NULL) { -+ ut_a(!(col_f->prtype & DATA_NOT_NULL)); -+ *buf++ = 1; -+ key_len++; -+ } else if (!new_protocol) { -+ if (!(col_r->prtype & DATA_NOT_NULL)) { -+ *buf++ = 0; -+ key_len++; -+ } -+ memcpy(buf, data, len); -+ wsrep_innobase_mysql_sort( -+ (int)(col_f->prtype & DATA_MYSQL_TYPE_MASK), -+ (uint)dtype_get_charset_coll(col_f->prtype), -+ buf, len); -+ } else { /* new protocol */ -+ if (!(col_r->prtype & DATA_NOT_NULL)) { -+ *buf++ = 0; -+ key_len++; -+ } -+ switch (col_f->mtype) { -+ case DATA_INT: { -+ byte* ptr = buf+len; -+ for (;;) { -+ ptr--; -+ *ptr = *data; -+ if (ptr == buf) { -+ break; -+ } -+ data++; -+ } -+ -+ if (!(col_f->prtype & DATA_UNSIGNED)) { -+ buf[len-1] = (byte) (buf[len-1] ^ 128); -+ } -+ -+ break; -+ } -+ case DATA_VARCHAR: -+ case DATA_VARMYSQL: -+ case DATA_CHAR: -+ case DATA_MYSQL: -+ /* Copy the actual data */ -+ ut_memcpy(buf, data, len); -+ wsrep_innobase_mysql_sort( -+ (int) -+ (col_f->prtype & DATA_MYSQL_TYPE_MASK), -+ (uint) -+ dtype_get_charset_coll(col_f->prtype), -+ buf, len); -+ break; -+ case DATA_BLOB: -+ case DATA_BINARY: -+ memcpy(buf, data, len); -+ break; -+ default: -+ break; -+ } -+ -+ key_len += len; -+ buf += len; -+ } -+ } -+ -+ rec_validate(rec, offsets); -+ -+ if (UNIV_LIKELY_NULL(heap)) { -+ mem_heap_free(heap); -+ } -+ -+ *buf_len = key_len; -+ return DB_SUCCESS; -+ -+ err_out: -+ if (UNIV_LIKELY_NULL(heap)) { -+ mem_heap_free(heap); -+ } -+ return DB_ERROR; -+} -+#endif // WITH_WSREP - -=== modified file 'storage/innobase/row/row0ins.cc' ---- old/storage/innobase/row/row0ins.cc 2013-06-25 03:50:18 +0000 -+++ new/storage/innobase/row/row0ins.cc 2014-02-16 22:08:57 +0000 -@@ -918,6 +918,14 @@ - innobase_invalidate_query_cache(thr_get_trx(thr), buf, len); - mem_free(buf); - } -+#ifdef WITH_WSREP -+dberr_t wsrep_append_foreign_key(trx_t *trx, -+ dict_foreign_t* foreign, -+ const rec_t* clust_rec, -+ dict_index_t* clust_index, -+ ibool referenced, -+ ibool shared); -+#endif /* WITH_WSREP */ - - /*********************************************************************//** - Perform referential actions or checks when a parent row is deleted or updated -@@ -1269,6 +1277,18 @@ - - cascade->state = UPD_NODE_UPDATE_CLUSTERED; - -+#ifdef WITH_WSREP -+ err = wsrep_append_foreign_key( -+ thr_get_trx(thr), -+ foreign, -+ clust_rec, -+ clust_index, -+ FALSE, FALSE); -+ if (err != DB_SUCCESS) { -+ fprintf(stderr, -+ "WSREP: foreign key append failed: %lu\n", err); -+ } else -+#endif - err = row_update_cascade_for_mysql(thr, cascade, - foreign->foreign_table); - -@@ -1601,7 +1621,14 @@ - - if (check_ref) { - err = DB_SUCCESS; -- -+#ifdef WITH_WSREP -+ err = wsrep_append_foreign_key( -+ thr_get_trx(thr), -+ foreign, -+ rec, -+ check_index, -+ check_ref, TRUE); -+#endif /* WITH_WSREP */ - goto end_scan; - } else if (foreign->type != 0) { - /* There is an ON UPDATE or ON DELETE -@@ -1978,6 +2005,10 @@ - lock_type, block, rec, index, offsets, thr); - } else { - -+#ifdef WITH_WSREP -+ /* appliers don't need dupkey checks */ -+ if (!wsrep_thd_is_BF(thr_get_trx(thr)->mysql_thd, 0)) -+#endif /* WITH_WSREP */ - err = row_ins_set_shared_rec_lock( - lock_type, block, rec, index, offsets, thr); - } - -=== modified file 'storage/innobase/row/row0upd.cc' ---- old/storage/innobase/row/row0upd.cc 2013-06-25 03:50:18 +0000 -+++ new/storage/innobase/row/row0upd.cc 2014-01-09 15:46:55 +0000 -@@ -51,6 +51,9 @@ - #include "pars0sym.h" - #include "eval0eval.h" - #include "buf0lru.h" -+#ifdef WITH_WSREP -+extern my_bool wsrep_debug; -+#endif - - - /* What kind of latch and lock can we assume when the control comes to -@@ -170,6 +173,50 @@ - return(is_referenced); - } - -+#ifdef WITH_WSREP -+static -+ibool -+wsrep_row_upd_index_is_foreign( -+/*========================*/ -+ dict_index_t* index, /*!< in: index */ -+ trx_t* trx) /*!< in: transaction */ -+{ -+ dict_table_t* table = index->table; -+ dict_foreign_t* foreign; -+ ibool froze_data_dict = FALSE; -+ ibool is_referenced = FALSE; -+ -+ if (!UT_LIST_GET_FIRST(table->foreign_list)) { -+ -+ return(FALSE); -+ } -+ -+ if (trx->dict_operation_lock_mode == 0) { -+ row_mysql_freeze_data_dictionary(trx); -+ froze_data_dict = TRUE; -+ } -+ -+ foreign = UT_LIST_GET_FIRST(table->foreign_list); -+ -+ while (foreign) { -+ if (foreign->foreign_index == index) { -+ -+ is_referenced = TRUE; -+ goto func_exit; -+ } -+ -+ foreign = UT_LIST_GET_NEXT(foreign_list, foreign); -+ } -+ -+func_exit: -+ if (froze_data_dict) { -+ row_mysql_unfreeze_data_dictionary(trx); -+ } -+ -+ return(is_referenced); -+} -+#endif /* WITH_WSREP */ -+ - /*********************************************************************//** - Checks if possible foreign key constraints hold after a delete of the record - under pcur. -@@ -287,7 +334,6 @@ - } - - err = DB_SUCCESS; -- - func_exit: - if (got_s_lock) { - row_mysql_unfreeze_data_dictionary(trx); -@@ -299,6 +345,126 @@ - - return(err); - } -+#ifdef WITH_WSREP -+static -+dberr_t -+wsrep_row_upd_check_foreign_constraints( -+/*=================================*/ -+ upd_node_t* node, /*!< in: row update node */ -+ btr_pcur_t* pcur, /*!< in: cursor positioned on a record; NOTE: the -+ cursor position is lost in this function! */ -+ dict_table_t* table, /*!< in: table in question */ -+ dict_index_t* index, /*!< in: index of the cursor */ -+ ulint* offsets,/*!< in/out: rec_get_offsets(pcur.rec, index) */ -+ que_thr_t* thr, /*!< in: query thread */ -+ mtr_t* mtr) /*!< in: mtr */ -+{ -+ dict_foreign_t* foreign; -+ mem_heap_t* heap; -+ dtuple_t* entry; -+ trx_t* trx; -+ const rec_t* rec; -+ ulint n_ext; -+ dberr_t err; -+ ibool got_s_lock = FALSE; -+ -+ if (UT_LIST_GET_FIRST(table->foreign_list) == NULL) { -+ -+ return(DB_SUCCESS); -+ } -+ -+ trx = thr_get_trx(thr); -+ -+ /* TODO: make native slave thread bail out here */ -+ -+ rec = btr_pcur_get_rec(pcur); -+ ut_ad(rec_offs_validate(rec, index, offsets)); -+ -+ heap = mem_heap_create(500); -+ -+ entry = row_rec_to_index_entry(rec, index, offsets, -+ &n_ext, heap); -+ -+ mtr_commit(mtr); -+ -+ mtr_start(mtr); -+ -+ if (trx->dict_operation_lock_mode == 0) { -+ got_s_lock = TRUE; -+ -+ row_mysql_freeze_data_dictionary(trx); -+ } -+ -+ foreign = UT_LIST_GET_FIRST(table->foreign_list); -+ -+ while (foreign) { -+ /* Note that we may have an update which updates the index -+ record, but does NOT update the first fields which are -+ referenced in a foreign key constraint. Then the update does -+ NOT break the constraint. */ -+ -+ if (foreign->foreign_index == index -+ && (node->is_delete -+ || row_upd_changes_first_fields_binary( -+ entry, index, node->update, -+ foreign->n_fields))) { -+ -+ if (foreign->referenced_table == NULL) { -+ foreign->referenced_table = -+ dict_table_open_on_name( -+ foreign->referenced_table_name_lookup, -+ FALSE, FALSE, DICT_ERR_IGNORE_NONE); -+ } -+ -+ if (foreign->referenced_table) { -+ mutex_enter(&(dict_sys->mutex)); -+ -+ (foreign->referenced_table -+ ->n_foreign_key_checks_running)++; -+ -+ mutex_exit(&(dict_sys->mutex)); -+ } -+ -+ /* NOTE that if the thread ends up waiting for a lock -+ we will release dict_operation_lock temporarily! -+ But the counter on the table protects 'foreign' from -+ being dropped while the check is running. */ -+ -+ err = row_ins_check_foreign_constraint( -+ TRUE, foreign, table, entry, thr); -+ -+ if (foreign->referenced_table) { -+ mutex_enter(&(dict_sys->mutex)); -+ -+ ut_a(foreign->referenced_table -+ ->n_foreign_key_checks_running > 0); -+ -+ (foreign->referenced_table -+ ->n_foreign_key_checks_running)--; -+ -+ mutex_exit(&(dict_sys->mutex)); -+ } -+ -+ if (err != DB_SUCCESS) { -+ -+ goto func_exit; -+ } -+ } -+ -+ foreign = UT_LIST_GET_NEXT(foreign_list, foreign); -+ } -+ -+ err = DB_SUCCESS; -+func_exit: -+ if (got_s_lock) { -+ row_mysql_unfreeze_data_dictionary(trx); -+ } -+ -+ mem_heap_free(heap); -+ -+ return(err); -+} -+#endif /* WITH_WSREP */ - - /*********************************************************************//** - Creates an update node for a query graph. -@@ -1673,6 +1839,9 @@ - index = node->index; - - referenced = row_upd_index_is_referenced(index, trx); -+#ifdef WITH_WSREP -+ ibool foreign = wsrep_row_upd_index_is_foreign(index, trx); -+#endif /* WITH_WSREP */ - - heap = mem_heap_create(1024); - -@@ -1800,6 +1969,9 @@ - row_ins_sec_index_entry() below */ - if (!rec_get_deleted_flag( - rec, dict_table_is_comp(index->table))) { -+#ifdef WITH_WSREP -+ que_node_t *parent = que_node_get_parent(node); -+#endif /* WITH_WSREP */ - err = btr_cur_del_mark_set_sec_rec( - 0, btr_cur, TRUE, thr, &mtr); - -@@ -1817,6 +1989,37 @@ - node, &pcur, index->table, - index, offsets, thr, &mtr); - } -+#ifdef WITH_WSREP -+ if (err == DB_SUCCESS && !referenced && -+ !(parent && que_node_get_type(parent) == -+ QUE_NODE_UPDATE && -+ ((upd_node_t*)parent)->cascade_node == node) && -+ foreign -+ ) { -+ ulint* offsets = -+ rec_get_offsets( -+ rec, index, NULL, ULINT_UNDEFINED, -+ &heap); -+ err = wsrep_row_upd_check_foreign_constraints( -+ node, &pcur, index->table, -+ index, offsets, thr, &mtr); -+ switch (err) { -+ case DB_SUCCESS: -+ case DB_NO_REFERENCED_ROW: -+ err = DB_SUCCESS; -+ break; -+ case DB_DEADLOCK: -+ if (wsrep_debug) fprintf (stderr, -+ "WSREP: sec index FK check fail for deadlock"); -+ break; -+ default: -+ fprintf (stderr, -+ "WSREP: referenced FK check fail: %d", -+ (int)err); -+ break; -+ } -+ } -+#endif /* WITH_WSREP */ - } - break; - } -@@ -1973,6 +2176,9 @@ - que_thr_t* thr, /*!< in: query thread */ - ibool referenced,/*!< in: TRUE if index may be referenced in - a foreign key constraint */ -+#ifdef WITH_WSREP -+ ibool foreign, /*!< in: TRUE if index is foreign key index */ -+#endif /* WITH_WSREP */ - mtr_t* mtr) /*!< in/out: mtr; gets committed here */ - { - mem_heap_t* heap; -@@ -1986,6 +2192,9 @@ - rec_t* rec; - ulint* offsets = NULL; - -+#ifdef WITH_WSREP -+ que_node_t *parent = que_node_get_parent(node); -+#endif /* WITH_WSREP */ - ut_ad(node); - ut_ad(dict_index_is_clust(index)); - -@@ -2062,6 +2271,34 @@ - goto err_exit; - } - } -+#ifdef WITH_WSREP -+ if (!referenced && -+ !(parent && que_node_get_type(parent) == QUE_NODE_UPDATE && -+ ((upd_node_t*)parent)->cascade_node == node) && -+ foreign -+ ) { -+ err = wsrep_row_upd_check_foreign_constraints( -+ node, pcur, table, index, offsets, thr, mtr); -+ switch (err) { -+ case DB_SUCCESS: -+ case DB_NO_REFERENCED_ROW: -+ err = DB_SUCCESS; -+ break; -+ case DB_DEADLOCK: -+ if (wsrep_debug) fprintf (stderr, -+ "WSREP: insert FK check fail for deadlock"); -+ break; -+ default: -+ fprintf (stderr, -+ "WSREP: referenced FK check fail: %d", -+ (int)err); -+ break; -+ } -+ if (err != DB_SUCCESS) { -+ goto err_exit; -+ } -+ } -+#endif /* WITH_WSREP */ - } - - mtr_commit(mtr); -@@ -2289,11 +2526,18 @@ - ibool referenced, - /*!< in: TRUE if index may be referenced in - a foreign key constraint */ -+#ifdef WITH_WSREP -+ ibool foreign,/*!< in: TRUE if index is foreign key index */ -+#endif /* WITH_WSREP */ - mtr_t* mtr) /*!< in: mtr; gets committed here */ - { - btr_pcur_t* pcur; - btr_cur_t* btr_cur; - dberr_t err; -+#ifdef WITH_WSREP -+ rec_t* rec; -+ que_node_t *parent = que_node_get_parent(node); -+#endif /* WITH_WSREP */ - - ut_ad(node); - ut_ad(dict_index_is_clust(index)); -@@ -2310,8 +2554,16 @@ - /* Mark the clustered index record deleted; we do not have to check - locks, because we assume that we have an x-lock on the record */ - -+#ifdef WITH_WSREP -+ rec = btr_cur_get_rec(btr_cur); -+#endif /* WITH_WSREP */ -+ - err = btr_cur_del_mark_set_clust_rec( -+#ifdef WITH_WSREP -+ btr_cur_get_block(btr_cur), rec, -+#else - btr_cur_get_block(btr_cur), btr_cur_get_rec(btr_cur), -+#endif /* WITH_WSREP */ - index, offsets, thr, mtr); - if (err == DB_SUCCESS && referenced) { - /* NOTE that the following call loses the position of pcur ! */ -@@ -2319,6 +2571,32 @@ - err = row_upd_check_references_constraints( - node, pcur, index->table, index, offsets, thr, mtr); - } -+#ifdef WITH_WSREP -+ if (err == DB_SUCCESS && !referenced && -+ !(parent && que_node_get_type(parent) == QUE_NODE_UPDATE && -+ ((upd_node_t*)parent)->cascade_node == node) && -+ thr_get_trx(thr) && -+ foreign -+ ) { -+ err = wsrep_row_upd_check_foreign_constraints( -+ node, pcur, index->table, index, offsets, thr, mtr); -+ switch (err) { -+ case DB_SUCCESS: -+ case DB_NO_REFERENCED_ROW: -+ err = DB_SUCCESS; -+ break; -+ case DB_DEADLOCK: -+ if (wsrep_debug) fprintf (stderr, -+ "WSREP: clust rec FK check fail for deadlock"); -+ break; -+ default: -+ fprintf (stderr, -+ "WSREP: clust rec referenced FK check fail: %d", -+ (int)err); -+ break; -+ } -+ } -+#endif /* WITH_WSREP */ - - mtr_commit(mtr); - -@@ -2351,6 +2629,10 @@ - index = dict_table_get_first_index(node->table); - - referenced = row_upd_index_is_referenced(index, thr_get_trx(thr)); -+#ifdef WITH_WSREP -+ ibool foreign = wsrep_row_upd_index_is_foreign( -+ index, thr_get_trx(thr)); -+#endif /* WITH_WSREP */ - - pcur = node->pcur; - -@@ -2445,7 +2727,11 @@ - - if (node->is_delete) { - err = row_upd_del_mark_clust_rec( -+#ifdef WITH_WSREP -+ node, index, offsets, thr, referenced, foreign, &mtr); -+#else - node, index, offsets, thr, referenced, &mtr); -+#endif /* WITH_WSREP */ - - if (err == DB_SUCCESS) { - node->state = UPD_NODE_UPDATE_ALL_SEC; -@@ -2490,7 +2776,11 @@ - externally! */ - - err = row_upd_clust_rec_by_insert( -+#ifdef WITH_WSREP -+ node, index, thr, referenced, foreign, &mtr); -+#else - node, index, thr, referenced, &mtr); -+#endif /* WITH_WSREP */ - - if (err != DB_SUCCESS) { - - -=== modified file 'storage/innobase/srv/srv0conc.cc' ---- old/storage/innobase/srv/srv0conc.cc 2012-11-16 20:48:21 +0000 -+++ new/storage/innobase/srv/srv0conc.cc 2013-10-11 07:10:49 +0000 -@@ -42,6 +42,10 @@ - #include "trx0trx.h" - - #include "mysql/plugin.h" -+#ifdef WITH_WSREP -+extern "C" int wsrep_trx_is_aborting(void *thd_ptr); -+extern my_bool wsrep_debug; -+#endif - - /** Number of times a thread is allowed to enter InnoDB within the same - SQL query after it has once got the ticket. */ -@@ -86,6 +90,9 @@ - reserved may still be TRUE at that - point */ - srv_conc_node_t srv_conc_queue; /*!< queue node */ -+#ifdef WITH_WSREP -+ void *thd; /*!< to see priority */ -+#endif - }; - - /** Queue of threads waiting to get in */ -@@ -145,6 +152,9 @@ - - conc_slot->event = os_event_create(); - ut_a(conc_slot->event); -+#ifdef WITH_WSREP -+ conc_slot->thd = NULL; -+#endif /* WITH_WSREP */ - } - #endif /* !HAVE_ATOMIC_BUILTINS */ - } -@@ -202,6 +212,16 @@ - - for (;;) { - ulint sleep_in_us; -+#ifdef WITH_WSREP -+ if (wsrep_on(trx->mysql_thd) && -+ wsrep_trx_is_aborting(trx->mysql_thd)) { -+ if (wsrep_debug) -+ fprintf(stderr, -+ "srv_conc_enter due to MUST_ABORT"); -+ srv_conc_force_enter_innodb(trx); -+ return; -+ } -+#endif /* WITH_WSREP */ - - if (srv_conc.n_active < (lint) srv_thread_concurrency) { - ulint n_active; -@@ -319,6 +339,9 @@ - slot = NULL; - - if (srv_conc.n_active < (lint) srv_thread_concurrency) { -+#ifdef WITH_WSREP -+ srv_conc_slot_t* wsrep_slot; -+#endif - /* Look for a slot where a thread is waiting and no other - thread has yet released the thread */ - -@@ -329,6 +352,19 @@ - /* No op */ - } - -+#ifdef WITH_WSREP -+ /* look for aborting trx, they must be released asap */ -+ wsrep_slot= slot; -+ while (wsrep_slot && (wsrep_slot->wait_ended == TRUE || -+ !wsrep_trx_is_aborting(wsrep_slot->thd))) { -+ wsrep_slot = UT_LIST_GET_NEXT(srv_conc_queue, wsrep_slot); -+ } -+ if (wsrep_slot) { -+ slot = wsrep_slot; -+ if (wsrep_debug) -+ fprintf(stderr, "WSREP: releasing aborting thd\n"); -+ } -+#endif - if (slot != NULL) { - slot->wait_ended = TRUE; - -@@ -384,6 +420,13 @@ - - return; - } -+#ifdef WITH_WSREP -+ if (wsrep_on(trx->mysql_thd) && -+ wsrep_trx_is_aborting(trx->mysql_thd)) { -+ srv_conc_force_enter_innodb(trx); -+ return; -+ } -+#endif - - /* If the transaction is not holding resources, let it sleep - for srv_thread_sleep_delay microseconds, and try again then */ -@@ -450,6 +493,9 @@ - /* Add to the queue */ - slot->reserved = TRUE; - slot->wait_ended = FALSE; -+#ifdef WITH_WSREP -+ slot->thd = trx->mysql_thd; -+#endif - - UT_LIST_ADD_LAST(srv_conc_queue, srv_conc_queue, slot); - -@@ -457,6 +503,18 @@ - - srv_conc.n_waiting++; - -+#ifdef WITH_WSREP -+ if (wsrep_on(trx->mysql_thd) && -+ wsrep_trx_is_aborting(trx->mysql_thd)) { -+ os_fast_mutex_unlock(&srv_conc_mutex); -+ if (wsrep_debug) -+ fprintf(stderr, "srv_conc_enter due to MUST_ABORT"); -+ trx->declared_to_be_inside_innodb = TRUE; -+ trx->n_tickets_to_enter_innodb = srv_n_free_tickets_to_enter; -+ return; -+ } -+ trx->wsrep_event = slot->event; -+#endif /* WITH_WSREP */ - os_fast_mutex_unlock(&srv_conc_mutex); - - /* Go to wait for the event; when a thread leaves InnoDB it will -@@ -471,6 +529,9 @@ - thd_wait_begin(trx->mysql_thd, THD_WAIT_USER_LOCK); - - os_event_wait(slot->event); -+#ifdef WITH_WSREP -+ trx->wsrep_event = NULL; -+#endif /* WITH_WSREP */ - thd_wait_end(trx->mysql_thd); - - trx->op_info = ""; -@@ -483,6 +544,9 @@ - incremented the thread counter on behalf of this thread */ - - slot->reserved = FALSE; -+#ifdef WITH_WSREP -+ slot->thd = NULL; -+#endif - - UT_LIST_REMOVE(srv_conc_queue, srv_conc_queue, slot); - -@@ -593,5 +657,32 @@ - /*==============================*/ - { - return(srv_conc.n_active); -- } -+} -+ -+#ifdef WITH_WSREP -+UNIV_INTERN -+void -+wsrep_srv_conc_cancel_wait( -+/*==================*/ -+ trx_t* trx) /*!< in: transaction object associated with the -+ thread */ -+{ -+#ifdef HAVE_ATOMIC_BUILTINS -+ /* aborting transactions will enter innodb by force in -+ srv_conc_enter_innodb_with_atomics(). No need to cancel here, -+ thr will wake up after os_sleep and let to enter innodb -+ */ -+ if (wsrep_debug) -+ fprintf(stderr, "WSREP: conc slot cancel, no atomics\n"); -+#else -+ os_fast_mutex_lock(&srv_conc_mutex); -+ if (trx->wsrep_event) { -+ if (wsrep_debug) -+ fprintf(stderr, "WSREP: conc slot cancel\n"); -+ os_event_set(trx->wsrep_event); -+ } -+ os_fast_mutex_unlock(&srv_conc_mutex); -+#endif -+} -+#endif /* WITH_WSREP */ - - -=== modified file 'storage/innobase/srv/srv0srv.cc' ---- old/storage/innobase/srv/srv0srv.cc 2013-11-29 12:56:54 +0000 -+++ new/storage/innobase/srv/srv0srv.cc 2014-03-11 21:17:40 +0000 -@@ -71,6 +71,10 @@ - #include "mysql/plugin.h" - #include "mysql/service_thd_wait.h" - -+#ifdef WITH_WSREP -+extern int wsrep_debug; -+extern int wsrep_trx_is_aborting(void *thd_ptr); -+#endif - /* The following is the maximum allowed duration of a lock wait. */ - UNIV_INTERN ulint srv_fatal_semaphore_wait_threshold = 600; - -@@ -207,6 +211,10 @@ - with mutex_enter(), which will wait until it gets the mutex. */ - #define MUTEX_NOWAIT(mutex_skipped) ((mutex_skipped) < MAX_MUTEX_NOWAIT) - -+#ifdef WITH_INNODB_DISALLOW_WRITES -+UNIV_INTERN os_event_t srv_allow_writes_event; -+#endif /* WITH_INNODB_DISALLOW_WRITES */ -+ - /** The sort order table of the MySQL latin1_swedish_ci character set - collation */ - UNIV_INTERN const byte* srv_latin1_ordering; -@@ -975,6 +983,14 @@ - - srv_conc_init(); - -+#ifdef WITH_INNODB_DISALLOW_WRITES -+ /* Writes have to be enabled on init or else we hang. Thus, we -+ always set the event here regardless of innobase_disallow_writes. -+ That flag will always be 0 at this point because it isn't settable -+ via my.cnf or command line arg. */ -+ srv_allow_writes_event = os_event_create(); -+ os_event_set(srv_allow_writes_event); -+#endif /* WITH_INNODB_DISALLOW_WRITES */ - /* Initialize some INFORMATION SCHEMA internal structures */ - trx_i_s_cache_init(trx_i_s_cache); - -@@ -1735,7 +1751,20 @@ - - if (sync_array_print_long_waits(&waiter, &sema) - && sema == old_sema && os_thread_eq(waiter, old_waiter)) { -+#if defined(WITH_WSREP) && defined(WITH_INNODB_DISALLOW_WRITES) -+ if (srv_allow_writes_event->is_set) { -+#endif /* WITH_WSREP */ - fatal_cnt++; -+#if defined(WITH_WSREP) && defined(WITH_INNODB_DISALLOW_WRITES) -+ } else { -+ fprintf(stderr, -+ "WSREP: avoiding InnoDB self crash due to long " -+ "semaphore wait of > %lu seconds\n" -+ "Server is processing SST donor operation, " -+ "fatal_cnt now: %lu", -+ (ulong) srv_fatal_semaphore_wait_threshold, fatal_cnt); -+ } -+#endif /* WITH_WSREP */ - if (fatal_cnt > 10) { - - fprintf(stderr, - -=== modified file 'storage/innobase/trx/trx0roll.cc' ---- old/storage/innobase/trx/trx0roll.cc 2013-06-10 20:44:22 +0000 -+++ new/storage/innobase/trx/trx0roll.cc 2013-10-10 14:15:10 +0000 -@@ -43,6 +43,9 @@ - #include "row0mysql.h" - #include "lock0lock.h" - #include "pars0pars.h" -+#ifdef WITH_WSREP -+#include "ha_prototypes.h" -+#endif /* WITH_WSREP */ - #include "srv0mon.h" - #include "trx0sys.h" - -@@ -382,6 +385,11 @@ - - trx->op_info = ""; - -+#ifdef WITH_WSREP_OUT -+ if (wsrep_on(trx->mysql_thd)) { -+ trx->lock.was_chosen_as_deadlock_victim = FALSE; -+ } -+#endif /* WITH_WSREP */ - return(err); - } - -@@ -1020,6 +1028,11 @@ - if (trx->update_undo) { - trx_undo_truncate_end(trx, trx->update_undo, limit); - } -+#ifdef WITH_WSREP_OUT -+ if (wsrep_on(trx->mysql_thd)) { -+ trx->lock.was_chosen_as_deadlock_victim = FALSE; -+ } -+#endif /* WITH_WSREP */ - } - - /***********************************************************************//** - -=== modified file 'storage/innobase/trx/trx0sys.cc' ---- old/storage/innobase/trx/trx0sys.cc 2013-10-03 09:47:17 +0000 -+++ new/storage/innobase/trx/trx0sys.cc 2014-01-30 10:56:16 +0000 -@@ -44,6 +44,10 @@ - #include "os0file.h" - #include "read0read.h" - -+#ifdef WITH_WSREP -+#include "ha_prototypes.h" /* wsrep_is_wsrep_xid() */ -+#endif /* */ -+ - /** The file format tag structure with id and name. */ - struct file_format_t { - ulint id; /*!< id of the file format */ -@@ -174,7 +178,12 @@ - mtr_t mtr; - trx_sysf_t* sys_header; - -+#ifndef WITH_WSREP -+ /* wsrep_fake_trx_id violates this assert -+ * Copied from trx_sys_get_new_trx_id -+ */ - ut_ad(mutex_own(&trx_sys->mutex)); -+#endif /* WITH_WSREP */ - - if (!srv_read_only_mode) { - mtr_start(&mtr); -@@ -202,10 +211,14 @@ - ib_int64_t offset, /*!< in: position in that log file */ - ulint field, /*!< in: offset of the MySQL log info field in - the trx sys header */ -+#ifdef WITH_WSREP -+ trx_sysf_t* sys_header, /*!< in: trx sys header */ -+#endif /* WITH_WSREP */ - mtr_t* mtr) /*!< in: mtr */ - { -+#ifndef WITH_WSREP - trx_sysf_t* sys_header; -- -+#endif /* !WITH_WSREP */ - if (ut_strlen(file_name) >= TRX_SYS_MYSQL_LOG_NAME_LEN) { - - /* We cannot fit the name to the 512 bytes we have reserved */ -@@ -213,7 +226,9 @@ - return; - } - -+#ifndef WITH_WSREP - sys_header = trx_sysf_get(mtr); -+#endif /* !WITH_WSREP */ - - if (mach_read_from_4(sys_header + field - + TRX_SYS_MYSQL_LOG_MAGIC_N_FLD) -@@ -300,6 +315,125 @@ - mtr_commit(&mtr); - } - -+#ifdef WITH_WSREP -+ -+#ifdef UNIV_DEBUG -+static long long trx_sys_cur_xid_seqno = -1; -+static unsigned char trx_sys_cur_xid_uuid[16]; -+ -+long long read_wsrep_xid_seqno(const XID* xid) -+{ -+ long long seqno; -+ memcpy(&seqno, xid->data + 24, sizeof(long long)); -+ return seqno; -+} -+ -+void read_wsrep_xid_uuid(const XID* xid, unsigned char* buf) -+{ -+ memcpy(buf, xid->data + 8, 16); -+} -+ -+#endif /* UNIV_DEBUG */ -+ -+void -+trx_sys_update_wsrep_checkpoint( -+ const XID* xid, /*!< in: transaction XID */ -+ trx_sysf_t* sys_header, /*!< in: sys_header */ -+ mtr_t* mtr) /*!< in: mtr */ -+{ -+ -+#ifdef UNIV_DEBUG -+ { -+ /* Check that seqno is monotonically increasing */ -+ unsigned char xid_uuid[16]; -+ long long xid_seqno = read_wsrep_xid_seqno(xid); -+ read_wsrep_xid_uuid(xid, xid_uuid); -+ if (!memcmp(xid_uuid, trx_sys_cur_xid_uuid, 8)) -+ { -+ ut_ad(xid_seqno > trx_sys_cur_xid_seqno); -+ trx_sys_cur_xid_seqno = xid_seqno; -+ } -+ else -+ { -+ memcpy(trx_sys_cur_xid_uuid, xid_uuid, 16); -+ } -+ trx_sys_cur_xid_seqno = xid_seqno; -+ } -+#endif /* UNIV_DEBUG */ -+ -+ ut_ad(xid && mtr && sys_header); -+ ut_a(xid->formatID == -1 || wsrep_is_wsrep_xid(xid)); -+ -+ if (mach_read_from_4(sys_header + TRX_SYS_WSREP_XID_INFO -+ + TRX_SYS_WSREP_XID_MAGIC_N_FLD) -+ != TRX_SYS_WSREP_XID_MAGIC_N) { -+ mlog_write_ulint(sys_header + TRX_SYS_WSREP_XID_INFO -+ + TRX_SYS_WSREP_XID_MAGIC_N_FLD, -+ TRX_SYS_WSREP_XID_MAGIC_N, -+ MLOG_4BYTES, mtr); -+ } -+ -+ mlog_write_ulint(sys_header + TRX_SYS_WSREP_XID_INFO -+ + TRX_SYS_WSREP_XID_FORMAT, -+ (int)xid->formatID, -+ MLOG_4BYTES, mtr); -+ mlog_write_ulint(sys_header + TRX_SYS_WSREP_XID_INFO -+ + TRX_SYS_WSREP_XID_GTRID_LEN, -+ (int)xid->gtrid_length, -+ MLOG_4BYTES, mtr); -+ mlog_write_ulint(sys_header + TRX_SYS_WSREP_XID_INFO -+ + TRX_SYS_WSREP_XID_BQUAL_LEN, -+ (int)xid->bqual_length, -+ MLOG_4BYTES, mtr); -+ mlog_write_string(sys_header + TRX_SYS_WSREP_XID_INFO -+ + TRX_SYS_WSREP_XID_DATA, -+ (const unsigned char*) xid->data, -+ XIDDATASIZE, mtr); -+ -+} -+ -+void -+trx_sys_read_wsrep_checkpoint(XID* xid) -+/*===================================*/ -+{ -+ trx_sysf_t* sys_header; -+ mtr_t mtr; -+ ulint magic; -+ -+ ut_ad(xid); -+ -+ mtr_start(&mtr); -+ -+ sys_header = trx_sysf_get(&mtr); -+ -+ if ((magic = mach_read_from_4(sys_header + TRX_SYS_WSREP_XID_INFO -+ + TRX_SYS_WSREP_XID_MAGIC_N_FLD)) -+ != TRX_SYS_WSREP_XID_MAGIC_N) { -+ memset(xid, 0, sizeof(*xid)); -+ xid->formatID = -1; -+ trx_sys_update_wsrep_checkpoint(xid, sys_header, &mtr); -+ mtr_commit(&mtr); -+ return; -+ } -+ -+ xid->formatID = (int)mach_read_from_4( -+ sys_header -+ + TRX_SYS_WSREP_XID_INFO + TRX_SYS_WSREP_XID_FORMAT); -+ xid->gtrid_length = (int)mach_read_from_4( -+ sys_header -+ + TRX_SYS_WSREP_XID_INFO + TRX_SYS_WSREP_XID_GTRID_LEN); -+ xid->bqual_length = (int)mach_read_from_4( -+ sys_header -+ + TRX_SYS_WSREP_XID_INFO + TRX_SYS_WSREP_XID_BQUAL_LEN); -+ ut_memcpy(xid->data, -+ sys_header + TRX_SYS_WSREP_XID_INFO + TRX_SYS_WSREP_XID_DATA, -+ XIDDATASIZE); -+ -+ mtr_commit(&mtr); -+} -+ -+#endif /* WITH_WSREP */ -+ - /*****************************************************************//** - Prints to stderr the MySQL master log offset info in the trx system header if - the magic number shows it valid. */ - -=== modified file 'storage/innobase/trx/trx0trx.cc' ---- old/storage/innobase/trx/trx0trx.cc 2013-12-11 08:05:55 +0000 -+++ new/storage/innobase/trx/trx0trx.cc 2014-03-11 21:17:40 +0000 -@@ -158,7 +158,10 @@ - trx->lock.table_locks = ib_vector_create( - heap_alloc, sizeof(void**), 32); - -- return(trx); -+#ifdef WITH_WSREP -+ trx->wsrep_event = NULL; -+#endif /* WITH_WSREP */ -+ return(trx); - } - - /********************************************************************//** -@@ -853,6 +856,11 @@ - srv_undo_logs, srv_undo_tablespaces); - } - -+#ifdef WITH_WSREP -+ memset(&trx->xid, 0, sizeof(trx->xid)); -+ trx->xid.formatID = -1; -+#endif /* WITH_WSREP */ -+ - /* The initial value for trx->no: TRX_ID_MAX is used in - read_view_open_now: */ - -@@ -967,6 +975,9 @@ - trx_t* trx, /*!< in/out: transaction */ - mtr_t* mtr) /*!< in/out: mini-transaction */ - { -+#ifdef WITH_WSREP -+ trx_sysf_t* sys_header; -+#endif /* WITH_WSREP */ - trx_rseg_t* rseg; - - rseg = trx->rseg; -@@ -1013,6 +1024,15 @@ - - MONITOR_INC(MONITOR_TRX_COMMIT_UNDO); - -+#ifdef WITH_WSREP -+ sys_header = trx_sysf_get(mtr); -+ /* Update latest MySQL wsrep XID in trx sys header. */ -+ if (wsrep_is_wsrep_xid(&trx->xid)) -+ { -+ trx_sys_update_wsrep_checkpoint(&trx->xid, sys_header, mtr); -+ } -+#endif /* WITH_WSREP */ -+ - /* Update the latest MySQL binlog name and offset info - in trx sys header if MySQL binlogging is on or the database - server is a MySQL replication slave */ -@@ -1023,7 +1043,11 @@ - trx_sys_update_mysql_binlog_offset( - trx->mysql_log_file_name, - trx->mysql_log_offset, -- TRX_SYS_MYSQL_LOG_INFO, mtr); -+ TRX_SYS_MYSQL_LOG_INFO, -+#ifdef WITH_WSREP -+ sys_header, -+#endif /* WITH_WSREP */ -+ mtr); - - trx->mysql_log_file_name = NULL; - } -@@ -1312,6 +1336,11 @@ - ut_ad(!trx->in_ro_trx_list); - ut_ad(!trx->in_rw_trx_list); - -+#ifdef WITH_WSREP -+ if (wsrep_on(trx->mysql_thd)) { -+ trx->lock.was_chosen_as_deadlock_victim = FALSE; -+ } -+#endif - trx->dict_operation = TRX_DICT_OP_NONE; - - trx->error_state = DB_SUCCESS; -@@ -1496,6 +1525,10 @@ - - switch (trx->state) { - case TRX_STATE_NOT_STARTED: -+#ifdef WITH_WSREP -+ ut_d(trx->start_file = __FILE__); -+ ut_d(trx->start_line = __LINE__); -+#endif /* WITH_WSREP */ - trx_start_low(trx); - /* fall through */ - case TRX_STATE_ACTIVE: -@@ -2222,6 +2255,10 @@ - transaction, doesn't. */ - trx->support_xa = thd_supports_xa(trx->mysql_thd); - -+#ifdef WITH_WSREP -+ ut_d(trx->start_file = __FILE__); -+ ut_d(trx->start_line = __LINE__); -+#endif /* WITH_WSREP */ - trx_start_low(trx); - /* fall through */ - case TRX_STATE_ACTIVE: -@@ -2244,6 +2281,10 @@ - { - switch (trx->state) { - case TRX_STATE_NOT_STARTED: -+#ifdef WITH_WSREP -+ ut_d(trx->start_file = __FILE__); -+ ut_d(trx->start_line = __LINE__); -+#endif /* WITH_WSREP */ - trx_start_low(trx); - /* fall through */ - case TRX_STATE_ACTIVE: -@@ -2278,6 +2319,10 @@ - - trx->ddl = true; - -+#ifdef WITH_WSREP -+ ut_d(trx->start_file = __FILE__); -+ ut_d(trx->start_line = __LINE__); -+#endif /* WITH_WSREP */ - trx_start_low(trx); - return; - - -=== modified file 'support-files/CMakeLists.txt' ---- old/support-files/CMakeLists.txt 2012-10-10 13:05:43 +0000 -+++ new/support-files/CMakeLists.txt 2013-06-25 21:51:49 +0000 -@@ -93,4 +93,12 @@ - DESTINATION ${inst_location} COMPONENT SupportFiles - PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ - GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) -+ CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/wsrep_notify.sh -+ ${CMAKE_CURRENT_BINARY_DIR}/wsrep_notify @ONLY) -+ INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/wsrep_notify -+ DESTINATION ${inst_location} COMPONENT SupportFiles -+ PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ -+ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) -+ CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/wsrep.cnf.sh -+ ${CMAKE_CURRENT_BINARY_DIR}/wsrep.cnf @ONLY) - ENDIF() - -=== modified file 'support-files/build-tags' ---- old/support-files/build-tags 2013-06-14 14:57:08 +0000 -+++ new/support-files/build-tags 2013-08-21 19:07:07 +0000 -@@ -10,3 +10,7 @@ - do - etags -o TAGS --append $f - done -+(cd storage/galera && svn ls -R) | grep $filter | while read f; -+do -+ etags -o TAGS --append storage/galera/$f -+done -\ No newline at end of file - -=== modified file 'support-files/mysql.server.sh' ---- old/support-files/mysql.server.sh 2013-04-09 08:33:35 +0000 -+++ new/support-files/mysql.server.sh 2013-09-23 19:04:40 +0000 -@@ -379,6 +379,12 @@ - fi - fi - ;; -+ 'bootstrap') -+ # Bootstrap the cluster, start the first node -+ # that initiate the cluster -+ echo $echo_n "Bootstrapping the cluster" -+ $0 start $other_args --wsrep-new-cluster -+ ;; - *) - # usage - basename=`basename "$0"` - -=== modified file 'support-files/mysql.spec.sh' ---- old/support-files/mysql.spec.sh 2013-10-30 03:15:35 +0000 -+++ new/support-files/mysql.spec.sh 2014-03-11 16:56:46 +0000 -@@ -69,6 +69,14 @@ - # - - # ---------------------------------------------------------------------------- -+# wsrep builds -+# ---------------------------------------------------------------------------- -+%if %{defined with_wsrep} -+%define mysql_version @VERSION@_wsrep_@WSREP_API_VERSION@.@WSREP_PATCH_VERSION@ -+%define wsrep_version @WSREP_VERSION@ -+%endif -+ -+# ---------------------------------------------------------------------------- - # Commercial builds - # ---------------------------------------------------------------------------- - %if %{undefined commercial} -@@ -116,6 +124,13 @@ - %endif - - # ---------------------------------------------------------------------------- -+# Packager -+# ---------------------------------------------------------------------------- -+%if %{undefined mysql_packager} -+%define mysql_packager MySQL Build Team -+%endif -+ -+# ---------------------------------------------------------------------------- - # Distribution support - # ---------------------------------------------------------------------------- - %if %{undefined distro_specific} -@@ -283,6 +298,10 @@ - ############################################################################## - - %package -n MySQL-server%{product_suffix} -+%if %{defined with_wsrep} -+Version: %{mysql_version} -+#Release: %{wsrep_version}.%{release} -+%endif - Summary: MySQL: a very fast and reliable SQL database server - Group: Applications/Databases - Requires: %{distro_requires} -@@ -319,6 +338,9 @@ - This package includes the MySQL server binary as well as related utilities - to run and administer a MySQL server. - -+%if %{defined with_wsrep} -+Built with wsrep patch %{wsrep_version}. -+%endif - If you want to access and work with the database, you have to install - package "MySQL-client%{product_suffix}" as well! - -@@ -409,6 +431,7 @@ - and applications need to dynamically load and use MySQL. - - # ---------------------------------------------------------------------------- -+%if %{undefined with_wsrep} - %package -n MySQL-embedded%{product_suffix} - Summary: MySQL - Embedded library - Group: Applications/Databases -@@ -438,6 +461,7 @@ - client/server version. - - For a description of MySQL see the base MySQL RPM or http://www.mysql.com/ -+%endif - - ############################################################################## - %prep -@@ -518,6 +542,9 @@ - -DFEATURE_SET="%{feature_set}" \ - %{ssl_option} \ - -DCOMPILATION_COMMENT="%{compilation_comment_debug}" \ -+%if %{defined with_wsrep} -+ -DWITH_WSREP=1 ${MEMCACHED_OPT} \ -+%endif - -DMYSQL_SERVER_SUFFIX="%{server_suffix}" - echo BEGIN_DEBUG_CONFIG ; egrep '^#define' include/config.h ; echo END_DEBUG_CONFIG - make ${MAKE_JFLAG} VERBOSE=1 -@@ -534,6 +561,9 @@ - -DFEATURE_SET="%{feature_set}" \ - %{ssl_option} \ - -DCOMPILATION_COMMENT="%{compilation_comment_release}" \ -+%if %{defined with_wsrep} -+ -DWITH_WSREP=1 ${MEMCACHED_OPT} \ -+%endif - -DMYSQL_SERVER_SUFFIX="%{server_suffix}" - echo BEGIN_NORMAL_CONFIG ; egrep '^#define' include/config.h ; echo END_NORMAL_CONFIG - make ${MAKE_JFLAG} VERBOSE=1 -@@ -579,11 +609,20 @@ - - # Create a symlink "rcmysql", pointing to the init.script. SuSE users - # will appreciate that, as all services usually offer this. --ln -s %{_sysconfdir}/init.d/mysql $RBR%{_sbindir}/rcmysql -+ln -sf %{_sysconfdir}/init.d/mysql $RBR%{_sbindir}/rcmysql -+ -+%if %{defined with_wsrep} -+# Create a wsrep_sst_rsync_wan symlink. -+install -d $RBR%{_bindir} -+ln -sf wsrep_sst_rsync $RBR%{_bindir}/wsrep_sst_rsync_wan -+%endif - - # Touch the place where the my.cnf config file might be located - # Just to make sure it's in the file list and marked as a config file - touch $RBR%{_sysconfdir}/my.cnf -+%if %{defined with_wsrep} -+touch $RBR%{_sysconfdir}/wsrep.cnf -+%endif - - # Install SELinux files in datadir - install -m 600 $MBD/%{src_dir}/support-files/RHEL4-SElinux/mysql.{fc,te} \ -@@ -1053,6 +1092,11 @@ - %doc %{src_dir}/Docs/INFO_SRC* - %doc release/Docs/INFO_BIN* - %doc release/support-files/my-default.cnf -+%if %{defined with_wsrep} -+%doc %{src_dir}/Docs/README-wsrep -+%doc release/support-files/wsrep.cnf -+%doc release/support-files/wsrep_notify -+%endif - - %if 0%{?commercial} - %doc %attr(644, root, root) %{_infodir}/mysql.info* -@@ -1088,6 +1132,9 @@ - %doc %attr(644, root, man) %{_mandir}/man1/resolveip.1* - - %ghost %config(noreplace,missingok) %{_sysconfdir}/my.cnf -+%if %{defined with_wsrep} -+%ghost %config(noreplace,missingok) %{_sysconfdir}/wsrep.cnf -+%endif - - %attr(755, root, root) %{_bindir}/innochecksum - %attr(755, root, root) %{_bindir}/my_print_defaults -@@ -1114,6 +1161,14 @@ - %attr(755, root, root) %{_bindir}/replace - %attr(755, root, root) %{_bindir}/resolve_stack_dump - %attr(755, root, root) %{_bindir}/resolveip -+%if %{defined with_wsrep} -+%attr(755, root, root) %{_bindir}/wsrep_sst_common -+%attr(755, root, root) %{_bindir}/wsrep_sst_mysqldump -+%attr(755, root, root) %{_bindir}/wsrep_sst_rsync -+%attr(755, root, root) %{_bindir}/wsrep_sst_rsync_wan -+%attr(755, root, root) %{_bindir}/wsrep_sst_xtrabackup -+%attr(755, root, root) %{_bindir}/wsrep_sst_xtrabackup-v2 -+%endif - - %attr(755, root, root) %{_sbindir}/mysqld - %attr(755, root, root) %{_sbindir}/mysqld-debug -@@ -1194,8 +1249,10 @@ - %defattr(-, root, root, 0755) - %attr(-, root, root) %{_datadir}/mysql-test - %attr(755, root, root) %{_bindir}/mysql_client_test -+%if %{undefined with_wsrep} - %attr(755, root, root) %{_bindir}/mysql_client_test_embedded - %attr(755, root, root) %{_bindir}/mysqltest_embedded -+%endif - %doc %attr(644, root, man) %{_mandir}/man1/mysql_client_test.1* - %doc %attr(644, root, man) %{_mandir}/man1/mysql-stress-test.pl.1* - %doc %attr(644, root, man) %{_mandir}/man1/mysql-test-run.pl.1* -@@ -1203,11 +1260,13 @@ - %doc %attr(644, root, man) %{_mandir}/man1/mysqltest_embedded.1* - - # ---------------------------------------------------------------------------- -+%if %{undefined with_wsrep} - %files -n MySQL-embedded%{product_suffix} - %defattr(-, root, root, 0755) - %attr(755, root, root) %{_bindir}/mysql_embedded - %attr(644, root, root) %{_libdir}/mysql/libmysqld.a - %attr(644, root, root) %{_libdir}/mysql/libmysqld-debug.a -+%endif - - ############################################################################## - # The spec file changelog only includes changes made to the spec file -@@ -1263,6 +1322,10 @@ - - - Removal all traces of the readline library from mysql (BUG 13738013) - -+* Wed Dec 07 2011 Alexey Yurchenko -+ -+- wsrep-related cleanups. -+ - * Wed Sep 28 2011 Joerg Bruehe - - - Fix duplicate mentioning of "mysql_plugin" and its manual page, -@@ -1321,7 +1384,6 @@ - - Fix bug#12561297: Added the MySQL embedded binary - - * Thu Jul 07 2011 Joerg Bruehe -- - - Fix bug#45415: "rpm upgrade recreates test database" - Let the creation of the "test" database happen only during a new installation, - not in an RPM upgrade. - -=== added file 'support-files/wsrep.cnf.sh' ---- old/support-files/wsrep.cnf.sh 1970-01-01 00:00:00 +0000 -+++ new/support-files/wsrep.cnf.sh 2013-09-01 09:27:10 +0000 -@@ -0,0 +1,129 @@ -+# This file contains wsrep-related mysqld options. It should be included -+# in the main MySQL configuration file. -+# -+# Options that need to be customized: -+# - wsrep_provider -+# - wsrep_cluster_address -+# - wsrep_sst_auth -+# The rest of defaults should work out of the box. -+ -+## -+## mysqld options _MANDATORY_ for correct opration of the cluster -+## -+[mysqld] -+ -+# (This must be substituted by wsrep_format) -+binlog_format=ROW -+ -+# Currently only InnoDB storage engine is supported -+default-storage-engine=innodb -+ -+# to avoid issues with 'bulk mode inserts' using autoinc -+innodb_autoinc_lock_mode=2 -+ -+# This is a must for paralell applying -+innodb_locks_unsafe_for_binlog=1 -+ -+# Query Cache is not supported with wsrep -+query_cache_size=0 -+query_cache_type=0 -+ -+# Override bind-address -+# In some systems bind-address defaults to 127.0.0.1, and with mysqldump SST -+# it will have (most likely) disastrous consequences on donor node -+bind-address=0.0.0.0 -+ -+## -+## WSREP options -+## -+ -+# Full path to wsrep provider library or 'none' -+wsrep_provider=none -+ -+# Provider specific configuration options -+#wsrep_provider_options= -+ -+# Logical cluster name. Should be the same for all nodes. -+wsrep_cluster_name="my_wsrep_cluster" -+ -+# Group communication system handle -+#wsrep_cluster_address="dummy://" -+ -+# Human-readable node name (non-unique). Hostname by default. -+#wsrep_node_name= -+ -+# Base replication [:port] of the node. -+# The values supplied will be used as defaults for state transfer receiving, -+# listening ports and so on. Default: address of the first network interface. -+#wsrep_node_address= -+ -+# Address for incoming client connections. Autodetect by default. -+#wsrep_node_incoming_address= -+ -+# How many threads will process writesets from other nodes -+wsrep_slave_threads=1 -+ -+# DBUG options for wsrep provider -+#wsrep_dbug_option -+ -+# Generate fake primary keys for non-PK tables (required for multi-master -+# and parallel applying operation) -+wsrep_certify_nonPK=1 -+ -+# Maximum number of rows in write set -+wsrep_max_ws_rows=131072 -+ -+# Maximum size of write set -+wsrep_max_ws_size=1073741824 -+ -+# to enable debug level logging, set this to 1 -+wsrep_debug=0 -+ -+# convert locking sessions into transactions -+wsrep_convert_LOCK_to_trx=0 -+ -+# how many times to retry deadlocked autocommits -+wsrep_retry_autocommit=1 -+ -+# change auto_increment_increment and auto_increment_offset automatically -+wsrep_auto_increment_control=1 -+ -+# retry autoinc insert, which failed for duplicate key error -+wsrep_drupal_282555_workaround=0 -+ -+# enable "strictly synchronous" semantics for read operations -+wsrep_causal_reads=0 -+ -+# Command to call when node status or cluster membership changes. -+# Will be passed all or some of the following options: -+# --status - new status of this node -+# --uuid - UUID of the cluster -+# --primary - whether the component is primary or not ("yes"/"no") -+# --members - comma-separated list of members -+# --index - index of this node in the list -+wsrep_notify_cmd= -+ -+## -+## WSREP State Transfer options -+## -+ -+# State Snapshot Transfer method -+wsrep_sst_method=rsync -+ -+# Address which donor should send State Snapshot to. -+# Should be the address of THIS node. DON'T SET IT TO DONOR ADDRESS!!! -+# (SST method dependent. Defaults to the first IP of the first interface) -+#wsrep_sst_receive_address= -+ -+# SST authentication string. This will be used to send SST to joining nodes. -+# Depends on SST method. For mysqldump method it is root: -+wsrep_sst_auth=root: -+ -+# Desired SST donor name. -+#wsrep_sst_donor= -+ -+# Reject client queries when donating SST (false) -+#wsrep_sst_donor_rejects_queries=0 -+ -+# Protocol version to use -+# wsrep_protocol_version= - -=== added file 'support-files/wsrep_notify.sh' ---- old/support-files/wsrep_notify.sh 1970-01-01 00:00:00 +0000 -+++ new/support-files/wsrep_notify.sh 2013-01-08 07:41:24 +0000 -@@ -0,0 +1,102 @@ -+#!/bin/sh -eu -+ -+# This is a simple example of wsrep notification script (wsrep_notify_cmd). -+# It will create 'wsrep' schema and two tables in it: 'membeship' and 'status' -+# and fill them on every membership or node status change. -+# -+# Edit parameters below to specify the address and login to server. -+ -+USER=root -+PSWD=rootpass -+HOST=127.0.0.1 -+PORT=3306 -+ -+SCHEMA="wsrep" -+MEMB_TABLE="$SCHEMA.membership" -+STATUS_TABLE="$SCHEMA.status" -+ -+BEGIN=" -+SET wsrep_on=0; -+DROP SCHEMA IF EXISTS $SCHEMA; CREATE SCHEMA $SCHEMA; -+CREATE TABLE $MEMB_TABLE ( -+ idx INT UNIQUE PRIMARY KEY, -+ uuid CHAR(40) UNIQUE, /* node UUID */ -+ name VARCHAR(32), /* node name */ -+ addr VARCHAR(256) /* node address */ -+) ENGINE=MEMORY; -+CREATE TABLE $STATUS_TABLE ( -+ size INT, /* component size */ -+ idx INT, /* this node index */ -+ status CHAR(16), /* this node status */ -+ uuid CHAR(40), /* cluster UUID */ -+ prim BOOLEAN /* if component is primary */ -+) ENGINE=MEMORY; -+BEGIN; -+DELETE FROM $MEMB_TABLE; -+DELETE FROM $STATUS_TABLE; -+" -+END="COMMIT;" -+ -+configuration_change() -+{ -+ echo "$BEGIN;" -+ -+ local idx=0 -+ -+ for NODE in $(echo $MEMBERS | sed s/,/\ /g) -+ do -+ echo "INSERT INTO $MEMB_TABLE VALUES ( $idx, " -+ # Don't forget to properly quote string values -+ echo "'$NODE'" | sed s/\\//\',\'/g -+ echo ");" -+ idx=$(( $idx + 1 )) -+ done -+ -+ echo "INSERT INTO $STATUS_TABLE VALUES($idx, $INDEX, '$STATUS', '$CLUSTER_UUID', $PRIMARY);" -+ -+ echo "$END" -+} -+ -+status_update() -+{ -+ echo "SET wsrep_on=0; BEGIN; UPDATE $STATUS_TABLE SET status='$STATUS'; COMMIT;" -+} -+ -+COM=status_update # not a configuration change by default -+ -+while [ $# -gt 0 ] -+do -+ case $1 in -+ --status) -+ STATUS=$2 -+ shift -+ ;; -+ --uuid) -+ CLUSTER_UUID=$2 -+ shift -+ ;; -+ --primary) -+ [ "$2" = "yes" ] && PRIMARY="1" || PRIMARY="0" -+ COM=configuration_change -+ shift -+ ;; -+ --index) -+ INDEX=$2 -+ shift -+ ;; -+ --members) -+ MEMBERS=$2 -+ shift -+ ;; -+ esac -+ shift -+done -+ -+# Undefined means node is shutting down -+if [ "$STATUS" != "Undefined" ] -+then -+ $COM | mysql -B -u$USER -p$PSWD -h$HOST -P$PORT -+fi -+ -+exit 0 -+# - -=== modified file 'vio/viossl.c' ---- old/vio/viossl.c 2014-01-06 06:03:08 +0000 -+++ new/vio/viossl.c 2014-03-11 21:17:40 +0000 -@@ -392,7 +392,9 @@ - SSL_SESSION_set_timeout(SSL_get_session(ssl), timeout); - SSL_set_fd(ssl, sd); - #ifndef HAVE_YASSL -+# if defined SSL_OP_NO_COMPRESSION - SSL_set_options(ssl, SSL_OP_NO_COMPRESSION); -+# endif - #endif - - /* - -=== added directory 'wsrep' -=== added file 'wsrep/CMakeLists.txt' ---- old/wsrep/CMakeLists.txt 1970-01-01 00:00:00 +0000 -+++ new/wsrep/CMakeLists.txt 2013-04-19 12:34:09 +0000 -@@ -0,0 +1,24 @@ -+# Copyright (c) 2012, Codership Oy. 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 -+ -+INCLUDE_DIRECTORIES( "." ) -+ -+SET(WSREP_SOURCES wsrep_gtid.c wsrep_uuid.c wsrep_loader.c wsrep_dummy.c) -+ -+ADD_CONVENIENCE_LIBRARY(wsrep ${WSREP_SOURCES}) -+DTRACE_INSTRUMENT(wsrep) -+ -+#ADD_EXECUTABLE(listener wsrep_listener.c ${WSREP_SOURCES}) -+#TARGET_LINK_LIBRARIES(listener ${LIBDL}) - -=== added file 'wsrep/Makefile.am' ---- old/wsrep/Makefile.am 1970-01-01 00:00:00 +0000 -+++ new/wsrep/Makefile.am 2013-08-22 01:04:29 +0000 -@@ -0,0 +1,7 @@ -+noinst_LIBRARIES = libwsrep.a -+libwsrep_a_SOURCES = wsrep_api.h wsrep_loader.c wsrep_dummy.c wsrep_uuid.c wsrep_gtid.c -+noinst_PROGRAMS = wsrep_listener -+wsrep_listener_SOURCES = wsrep_listener.c -+wsrep_listener_LDADD = $(noinst_LIBRARIES) -+wsrep_listener_LDFLAGS = -static -ldl -+ - -=== added file 'wsrep/wsrep_api.h' ---- old/wsrep/wsrep_api.h 1970-01-01 00:00:00 +0000 -+++ new/wsrep/wsrep_api.h 2014-03-11 14:18:00 +0000 -@@ -0,0 +1,1118 @@ -+/* Copyright (C) 2009-2013 Codership Oy -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; version 2 of the License. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License along -+ with this program; if not, write to the Free Software Foundation, Inc., -+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -+ */ -+ -+/*! -+ @file wsrep API declaration. -+ -+ HOW TO READ THIS FILE. -+ -+ Due to C language rules this header layout doesn't lend itself to intuitive -+ reading. So here's the scoop: in the end this header declares two main types: -+ -+ * struct wsrep_init_args -+ -+ and -+ -+ * struct wsrep -+ -+ wsrep_init_args contains initialization parameters for wsrep provider like -+ names, addresses, etc. and pointers to callbacks. The callbacks will be called -+ by provider when it needs to do something application-specific, like log a -+ message or apply a writeset. It should be passed to init() call from -+ wsrep API. It is an application part of wsrep API contract. -+ -+ struct wsrep is the interface to wsrep provider. It contains all wsrep API -+ calls. It is a provider part of wsrep API contract. -+ -+ Finally, wsrep_load() method loads (dlopens) wsrep provider library. It is -+ defined in wsrep_loader.c unit and is part of libwsrep.a (which is not a -+ wsrep provider, but a convenience library). -+ -+ wsrep_unload() does the reverse. -+ -+*/ -+#ifndef WSREP_H -+#define WSREP_H -+ -+#include -+#include -+#include -+#include -+#include -+ -+#ifdef __cplusplus -+extern "C" { -+#endif -+ -+/************************************************************************** -+ * * -+ * wsrep replication API * -+ * * -+ **************************************************************************/ -+ -+#define WSREP_INTERFACE_VERSION "25" -+ -+/*! Empty backend spec */ -+#define WSREP_NONE "none" -+ -+ -+/*! -+ * @brief log severity levels, passed as first argument to log handler -+ */ -+typedef enum wsrep_log_level -+{ -+ WSREP_LOG_FATAL, //!< Unrecoverable error, application must quit. -+ WSREP_LOG_ERROR, //!< Operation failed, must be repeated. -+ WSREP_LOG_WARN, //!< Unexpected condition, but no operational failure. -+ WSREP_LOG_INFO, //!< Informational message. -+ WSREP_LOG_DEBUG //!< Debug message. Shows only of compiled with debug. -+} wsrep_log_level_t; -+ -+/*! -+ * @brief error log handler -+ * -+ * All messages from wsrep provider are directed to this -+ * handler, if present. -+ * -+ * @param level log level -+ * @param message log message -+ */ -+typedef void (*wsrep_log_cb_t)(wsrep_log_level_t, const char *); -+ -+ -+/*! -+ * Certain provider capabilities application may want to know about -+ */ -+#define WSREP_CAP_MULTI_MASTER ( 1ULL << 0 ) -+#define WSREP_CAP_CERTIFICATION ( 1ULL << 1 ) -+#define WSREP_CAP_PARALLEL_APPLYING ( 1ULL << 2 ) -+#define WSREP_CAP_TRX_REPLAY ( 1ULL << 3 ) -+#define WSREP_CAP_ISOLATION ( 1ULL << 4 ) -+#define WSREP_CAP_PAUSE ( 1ULL << 5 ) -+#define WSREP_CAP_CAUSAL_READS ( 1ULL << 6 ) -+#define WSREP_CAP_CAUSAL_TRX ( 1ULL << 7 ) -+#define WSREP_CAP_INCREMENTAL_WRITESET ( 1ULL << 8 ) -+#define WSREP_CAP_SESSION_LOCKS ( 1ULL << 9 ) -+#define WSREP_CAP_DISTRIBUTED_LOCKS ( 1ULL << 10 ) -+#define WSREP_CAP_CONSISTENCY_CHECK ( 1ULL << 11 ) -+#define WSREP_CAP_UNORDERED ( 1ULL << 12 ) -+#define WSREP_CAP_ANNOTATION ( 1ULL << 13 ) -+#define WSREP_CAP_PREORDERED ( 1ULL << 14 ) -+ -+ -+/*! -+ * Writeset flags -+ * -+ * COMMIT the writeset and all preceding writesets must be committed -+ * ROLLBACK all preceding writesets in a transaction must be rolled back -+ * ISOLATION the writeset must be applied AND committed in isolation -+ * PA_UNSAFE the writeset cannot be applied in parallel -+ * COMMUTATIVE the order in which the writeset is applied does not matter -+ * NATIVE the writeset contains another writeset in this provider format -+ * -+ * Note that some of the flags are mutually exclusive (e.g. COMMIT and -+ * ROLLBACK). -+ */ -+#define WSREP_FLAG_COMMIT ( 1ULL << 0 ) -+#define WSREP_FLAG_ROLLBACK ( 1ULL << 1 ) -+#define WSREP_FLAG_ISOLATION ( 1ULL << 2 ) -+#define WSREP_FLAG_PA_UNSAFE ( 1ULL << 3 ) -+#define WSREP_FLAG_COMMUTATIVE ( 1ULL << 4 ) -+#define WSREP_FLAG_NATIVE ( 1ULL << 5 ) -+ -+ -+typedef uint64_t wsrep_trx_id_t; //!< application transaction ID -+typedef uint64_t wsrep_conn_id_t; //!< application connection ID -+typedef int64_t wsrep_seqno_t; //!< sequence number of a writeset, etc. -+#ifdef __cplusplus -+typedef bool wsrep_bool_t; -+#else -+typedef _Bool wsrep_bool_t; //!< should be the same as standard (C99) bool -+#endif /* __cplusplus */ -+ -+/*! undefined seqno */ -+#define WSREP_SEQNO_UNDEFINED (-1) -+ -+ -+/*! wsrep provider status codes */ -+typedef enum wsrep_status -+{ -+ WSREP_OK = 0, //!< success -+ WSREP_WARNING, //!< minor warning, error logged -+ WSREP_TRX_MISSING, //!< transaction is not known by wsrep -+ WSREP_TRX_FAIL, //!< transaction aborted, server can continue -+ WSREP_BF_ABORT, //!< trx was victim of brute force abort -+ WSREP_SIZE_EXCEEDED, //!< data exceeded maximum supported size -+ WSREP_CONN_FAIL, //!< error in client connection, must abort -+ WSREP_NODE_FAIL, //!< error in node state, wsrep must reinit -+ WSREP_FATAL, //!< fatal error, server must abort -+ WSREP_NOT_IMPLEMENTED //!< feature not implemented -+} wsrep_status_t; -+ -+ -+/*! wsrep callbacks status codes */ -+typedef enum wsrep_cb_status -+{ -+ WSREP_CB_SUCCESS = 0, //!< success (as in "not critical failure") -+ WSREP_CB_FAILURE //!< critical failure (consistency violation) -+ /* Technically, wsrep provider has no use for specific failure codes since -+ * there is nothing it can do about it but abort execution. Therefore any -+ * positive number shall indicate a critical failure. Optionally that value -+ * may be used by provider to come to a consensus about state consistency -+ * in a group of nodes. */ -+} wsrep_cb_status_t; -+ -+ -+/*! -+ * UUID type - for all unique IDs -+ */ -+typedef struct wsrep_uuid { -+ uint8_t data[16]; -+} wsrep_uuid_t; -+ -+/*! Undefined UUID */ -+static const wsrep_uuid_t WSREP_UUID_UNDEFINED = {{0,}}; -+ -+/*! UUID string representation length, terminating '\0' not included */ -+#define WSREP_UUID_STR_LEN 36 -+ -+/*! -+ * Scan UUID from string -+ * @return length of UUID string representation or negative error code -+ */ -+extern int -+wsrep_uuid_scan (const char* str, size_t str_len, wsrep_uuid_t* uuid); -+ -+/*! -+ * Print UUID to string -+ * @return length of UUID string representation or negative error code -+ */ -+extern int -+wsrep_uuid_print (const wsrep_uuid_t* uuid, char* str, size_t str_len); -+ -+#define WSREP_MEMBER_NAME_LEN 32 //!< maximum logical member name length -+#define WSREP_INCOMING_LEN 256 //!< max Domain Name length + 0x00 -+ -+ -+/*! -+ * Global transaction identifier -+ */ -+typedef struct wsrep_gtid -+{ -+ wsrep_uuid_t uuid; /*!< History UUID */ -+ wsrep_seqno_t seqno; /*!< Sequence number */ -+} wsrep_gtid_t; -+ -+/*! Undefined GTID */ -+static const wsrep_gtid_t WSREP_GTID_UNDEFINED = {{{0, }}, -1}; -+ -+/*! Minimum number of bytes guaranteed to store GTID string representation, -+ * terminating '\0' not included (36 + 1 + 20) */ -+#define WSREP_GTID_STR_LEN 57 -+ -+ -+/*! -+ * Scan GTID from string -+ * @return length of GTID string representation or negative error code -+ */ -+extern int -+wsrep_gtid_scan(const char* str, size_t str_len, wsrep_gtid_t* gtid); -+ -+/*! -+ * Print GTID to string -+ * @return length of GTID string representation or negative error code -+ */ -+extern int -+wsrep_gtid_print(const wsrep_gtid_t* gtid, char* str, size_t str_len); -+ -+ -+/*! -+ * Transaction meta data -+ */ -+typedef struct wsrep_trx_meta -+{ -+ wsrep_gtid_t gtid; /*!< Global transaction identifier */ -+ wsrep_seqno_t depends_on; /*!< Sequence number part of the last transaction -+ this transaction depends on */ -+} wsrep_trx_meta_t; -+ -+ -+/*! -+ * member status -+ */ -+typedef enum wsrep_member_status { -+ WSREP_MEMBER_UNDEFINED, //!< undefined state -+ WSREP_MEMBER_JOINER, //!< incomplete state, requested state transfer -+ WSREP_MEMBER_DONOR, //!< complete state, donates state transfer -+ WSREP_MEMBER_JOINED, //!< complete state -+ WSREP_MEMBER_SYNCED, //!< complete state, synchronized with group -+ WSREP_MEMBER_ERROR, //!< this and above is provider-specific error code -+ WSREP_MEMBER_MAX -+} wsrep_member_status_t; -+ -+/*! -+ * static information about a group member (some fields are tentative yet) -+ */ -+typedef struct wsrep_member_info { -+ wsrep_uuid_t id; //!< group-wide unique member ID -+ char name[WSREP_MEMBER_NAME_LEN]; //!< human-readable name -+ char incoming[WSREP_INCOMING_LEN]; //!< address for client requests -+} wsrep_member_info_t; -+ -+/*! -+ * group status -+ */ -+typedef enum wsrep_view_status { -+ WSREP_VIEW_PRIMARY, //!< primary group configuration (quorum present) -+ WSREP_VIEW_NON_PRIMARY, //!< non-primary group configuration (quorum lost) -+ WSREP_VIEW_DISCONNECTED, //!< not connected to group, retrying. -+ WSREP_VIEW_MAX -+} wsrep_view_status_t; -+ -+/*! -+ * view of the group -+ */ -+typedef struct wsrep_view_info { -+ wsrep_gtid_t state_id; //!< global state ID -+ wsrep_seqno_t view; //!< global view number -+ wsrep_view_status_t status; //!< view status -+ wsrep_bool_t state_gap; //!< gap between global and local states -+ int my_idx; //!< index of this member in the view -+ int memb_num; //!< number of members in the view -+ int proto_ver; //!< application protocol agreed on the view -+ wsrep_member_info_t members[1];//!< array of member information -+} wsrep_view_info_t; -+ -+/*! -+ * Magic string to tell provider to engage into trivial (empty) state transfer. -+ * No data will be passed, but the node shall be considered JOINED. -+ * Should be passed in sst_req parameter of wsrep_view_cb_t. -+ */ -+#define WSREP_STATE_TRANSFER_TRIVIAL "trivial" -+ -+/*! -+ * Magic string to tell provider not to engage in state transfer at all. -+ * The member will stay in WSREP_MEMBER_UNDEFINED state but will keep on -+ * receiving all writesets. -+ * Should be passed in sst_req parameter of wsrep_view_cb_t. -+ */ -+#define WSREP_STATE_TRANSFER_NONE "none" -+ -+/*! -+ * @brief group view handler -+ * -+ * This handler is called in total order corresponding to the group -+ * configuration change. It is to provide a vital information about -+ * new group view. If view info indicates existence of discontinuity -+ * between group and member states, state transfer request message -+ * should be filled in by the callback implementation. -+ * -+ * @note Currently it is assumed that sst_req is allocated using -+ * malloc()/calloc()/realloc() and it will be freed by -+ * wsrep implementation. -+ * -+ * @param app_ctx application context -+ * @param recv_ctx receiver context -+ * @param view new view on the group -+ * @param state current state -+ * @param state_len lenght of current state -+ * @param sst_req location to store SST request -+ * @param sst_req_len location to store SST request length or error code, -+ * value of 0 means no SST. -+ */ -+typedef enum wsrep_cb_status (*wsrep_view_cb_t) ( -+ void* app_ctx, -+ void* recv_ctx, -+ const wsrep_view_info_t* view, -+ const char* state, -+ size_t state_len, -+ void** sst_req, -+ size_t* sst_req_len -+); -+ -+ -+/*! -+ * @brief apply callback -+ * -+ * This handler is called from wsrep library to apply replicated writeset -+ * Must support brute force applying for multi-master operation -+ * -+ * @param recv_ctx receiver context pointer provided by the application -+ * @param data data buffer containing the writeset -+ * @param size data buffer size -+ * @param flags WSREP_FLAG_... flags -+ * @param meta transaction meta data of the writeset to be applied -+ * -+ * @return success code: -+ * @retval WSREP_OK -+ * @retval WSREP_NOT_IMPLEMENTED appl. does not support the writeset format -+ * @retval WSREP_ERROR failed to apply the writeset -+ */ -+typedef enum wsrep_cb_status (*wsrep_apply_cb_t) ( -+ void* recv_ctx, -+ const void* data, -+ size_t size, -+ uint32_t flags, -+ const wsrep_trx_meta_t* meta -+); -+ -+ -+/*! -+ * @brief commit callback -+ * -+ * This handler is called to commit the changes made by apply callback. -+ * -+ * @param recv_ctx receiver context pointer provided by the application -+ * @param flags WSREP_FLAG_... flags -+ * @param meta transaction meta data of the writeset to be committed -+ * @param exit set to true to exit recv loop -+ * @param commit true - commit writeset, false - rollback writeset -+ * -+ * @return success code: -+ * @retval WSREP_OK -+ * @retval WSREP_ERROR call failed -+ */ -+typedef enum wsrep_cb_status (*wsrep_commit_cb_t) ( -+ void* recv_ctx, -+ uint32_t flags, -+ const wsrep_trx_meta_t* meta, -+ wsrep_bool_t* exit, -+ wsrep_bool_t commit -+); -+ -+ -+/*! -+ * @brief unordered callback -+ * -+ * This handler is called to execute unordered actions (actions that need not -+ * to be executed in any particular order) attached to writeset. -+ * -+ * @param recv_ctx receiver context pointer provided by the application -+ * @param data data buffer containing the writeset -+ * @param size data buffer size -+ */ -+typedef enum wsrep_cb_status (*wsrep_unordered_cb_t) ( -+ void* recv_ctx, -+ const void* data, -+ size_t size -+); -+ -+ -+/*! -+ * @brief a callback to donate state snapshot -+ * -+ * This handler is called from wsrep library when it needs this node -+ * to deliver state to a new cluster member. -+ * No state changes will be committed for the duration of this call. -+ * Wsrep implementation may provide internal state to be transmitted -+ * to new cluster member for initial state. -+ * -+ * @param app_ctx application context -+ * @param recv_ctx receiver context -+ * @param msg state transfer request message -+ * @param msg_len state transfer request message length -+ * @param gtid current state ID on this node -+ * @param state current wsrep internal state buffer -+ * @param state_len current wsrep internal state buffer len -+ * @param bypass bypass snapshot transfer, only transfer uuid:seqno pair -+ */ -+typedef enum wsrep_cb_status (*wsrep_sst_donate_cb_t) ( -+ void* app_ctx, -+ void* recv_ctx, -+ const void* msg, -+ size_t msg_len, -+ const wsrep_gtid_t* state_id, -+ const char* state, -+ size_t state_len, -+ wsrep_bool_t bypass -+); -+ -+ -+/*! -+ * @brief a callback to signal application that wsrep state is synced -+ * with cluster -+ * -+ * This callback is called after wsrep library has got in sync with -+ * rest of the cluster. -+ * -+ * @param app_ctx application context -+ */ -+typedef void (*wsrep_synced_cb_t) (void* app_ctx); -+ -+ -+/*! -+ * Initialization parameters for wsrep provider. -+ */ -+struct wsrep_init_args -+{ -+ void* app_ctx; //!< Application context for callbacks -+ -+ /* Configuration parameters */ -+ const char* node_name; //!< Symbolic name of this node (e.g. hostname) -+ const char* node_address; //!< Address to be used by wsrep provider -+ const char* node_incoming; //!< Address for incoming client connections -+ const char* data_dir; //!< Directory where wsrep files are kept if any -+ const char* options; //!< Provider-specific configuration string -+ int proto_ver; //!< Max supported application protocol version -+ -+ /* Application initial state information. */ -+ const wsrep_gtid_t* state_id; //!< Application state GTID -+ const char* state; //!< Initial state for wsrep provider -+ size_t state_len; //!< Length of state buffer -+ -+ /* Application callbacks */ -+ wsrep_log_cb_t logger_cb; //!< logging handler -+ wsrep_view_cb_t view_handler_cb; //!< group view change handler -+ -+ /* Applier callbacks */ -+ wsrep_apply_cb_t apply_cb; //!< apply callback -+ wsrep_commit_cb_t commit_cb; //!< commit callback -+ wsrep_unordered_cb_t unordered_cb; //!< callback for unordered actions -+ -+ /* State Snapshot Transfer callbacks */ -+ wsrep_sst_donate_cb_t sst_donate_cb; //!< starting to donate -+ wsrep_synced_cb_t synced_cb; //!< synced with group -+}; -+ -+ -+/*! Type of the stats variable value in struct wsrep_status_var */ -+typedef enum wsrep_var_type -+{ -+ WSREP_VAR_STRING, //!< pointer to null-terminated string -+ WSREP_VAR_INT64, //!< int64_t -+ WSREP_VAR_DOUBLE //!< double -+} -+wsrep_var_type_t; -+ -+/*! Generalized stats variable representation */ -+struct wsrep_stats_var -+{ -+ const char* name; //!< variable name -+ wsrep_var_type_t type; //!< variable value type -+ union { -+ int64_t _int64; -+ double _double; -+ const char* _string; -+ } value; //!< variable value -+}; -+ -+ -+/*! Abstract data buffer structure */ -+typedef struct wsrep_buf -+{ -+ const void* ptr; /*!< Pointer to data buffer */ -+ size_t len; /*!< Length of buffer */ -+} wsrep_buf_t; -+ -+/*! Key struct used to pass certification keys for transaction handling calls. -+ * A key consists of zero or more key parts. */ -+typedef struct wsrep_key -+{ -+ const wsrep_buf_t* key_parts; /*!< Array of key parts */ -+ size_t key_parts_num; /*!< Number of key parts */ -+} wsrep_key_t; -+ -+/*! Key type: -+ * EXCLUSIVE conflicts with any key type -+ * SEMI reserved. If not supported, should be interpeted as EXCLUSIVE -+ * SHARED conflicts only with EXCLUSIVE keys */ -+typedef enum wsrep_key_type -+{ -+ WSREP_KEY_SHARED = 0, -+ WSREP_KEY_SEMI, -+ WSREP_KEY_EXCLUSIVE -+} wsrep_key_type_t; -+ -+/*! Data type: -+ * ORDERED state modification event that should be applied and committed -+ * in order. -+ * UNORDERED some action that does not modify state and execution of which is -+ * optional and does not need to happen in order. -+ * ANNOTATION (human readable) writeset annotation. */ -+typedef enum wsrep_data_type -+{ -+ WSREP_DATA_ORDERED = 0, -+ WSREP_DATA_UNORDERED, -+ WSREP_DATA_ANNOTATION -+} wsrep_data_type_t; -+ -+ -+/*! Transaction handle struct passed for wsrep transaction handling calls */ -+typedef struct wsrep_ws_handle -+{ -+ wsrep_trx_id_t trx_id; //!< transaction ID -+ void* opaque; //!< opaque provider transaction context data -+} wsrep_ws_handle_t; -+ -+/*! -+ * @brief Helper method to reset trx writeset handle state when trx id changes -+ * -+ * Instead of passing wsrep_ws_handle_t directly to wsrep calls, -+ * wrapping handle with this call offloads bookkeeping from -+ * application. -+ */ -+static inline wsrep_ws_handle_t* wsrep_ws_handle_for_trx( -+ wsrep_ws_handle_t* ws_handle, -+ wsrep_trx_id_t trx_id) -+{ -+ if (ws_handle->trx_id != trx_id) -+ { -+ ws_handle->trx_id = trx_id; -+ ws_handle->opaque = NULL; -+ } -+ return ws_handle; -+} -+ -+ -+/*! -+ * A handle for processing preordered actions. -+ * Must be initialized to WSREP_PO_INITIALIZER before use. -+ */ -+typedef struct wsrep_po_handle { void* opaque; } wsrep_po_handle_t; -+ -+static const wsrep_po_handle_t WSREP_PO_INITIALIZER = { NULL }; -+ -+ -+typedef struct wsrep wsrep_t; -+/*! -+ * wsrep interface for dynamically loadable libraries -+ */ -+struct wsrep { -+ -+ const char *version; //!< interface version string -+ -+ /*! -+ * @brief Initializes wsrep provider -+ * -+ * @param wsrep provider handle -+ * @param args wsrep initialization parameters -+ */ -+ wsrep_status_t (*init) (wsrep_t* wsrep, -+ const struct wsrep_init_args* args); -+ -+ /*! -+ * @brief Returns provider capabilities flag bitmap -+ * -+ * @param wsrep provider handle -+ */ -+ uint64_t (*capabilities) (wsrep_t* wsrep); -+ -+ /*! -+ * @brief Passes provider-specific configuration string to provider. -+ * -+ * @param wsrep provider handle -+ * @param conf configuration string -+ * -+ * @retval WSREP_OK configuration string was parsed successfully -+ * @retval WSREP_WARNING could't not parse conf string, no action taken -+ */ -+ wsrep_status_t (*options_set) (wsrep_t* wsrep, const char* conf); -+ -+ /*! -+ * @brief Returns provider-specific string with current configuration values. -+ * -+ * @param wsrep provider handle -+ * -+ * @return a dynamically allocated string with current configuration -+ * parameter values -+ */ -+ char* (*options_get) (wsrep_t* wsrep); -+ -+ /*! -+ * @brief Opens connection to cluster -+ * -+ * Returns when either node is ready to operate as a part of the clsuter -+ * or fails to reach operating status. -+ * -+ * @param wsrep provider handle -+ * @param cluster_name unique symbolic cluster name -+ * @param cluster_url URL-like cluster address (backend://address) -+ * @param state_donor name of the node to be asked for state transfer. -+ * @param bootstrap a flag to request initialization of a new wsrep -+ * service rather then a connection to the existing one. -+ * clister_url may still carry important initialization -+ * parameters, like backend spec and/or listen address. -+ */ -+ wsrep_status_t (*connect) (wsrep_t* wsrep, -+ const char* cluster_name, -+ const char* cluster_url, -+ const char* state_donor, -+ wsrep_bool_t bootstrap); -+ -+ /*! -+ * @brief Closes connection to cluster. -+ * -+ * If state_uuid and/or state_seqno is not NULL, will store final state -+ * in there. -+ * -+ * @param wsrep this wsrep handler -+ */ -+ wsrep_status_t (*disconnect)(wsrep_t* wsrep); -+ -+ /*! -+ * @brief start receiving replication events -+ * -+ * This function never returns -+ * -+ * @param wsrep provider handle -+ * @param recv_ctx receiver context -+ */ -+ wsrep_status_t (*recv)(wsrep_t* wsrep, void* recv_ctx); -+ -+ /*! -+ * @brief Replicates/logs result of transaction to other nodes and allocates -+ * required resources. -+ * -+ * Must be called before transaction commit. Returns success code, which -+ * caller must check. -+ * In case of WSREP_OK, starts commit critical section, transaction can -+ * commit. Otherwise transaction must rollback. -+ * -+ * @param wsrep provider handle -+ * @param ws_handle writeset of committing transaction -+ * @param conn_id connection ID -+ * @param flags fine tuning the replication WSREP_FLAG_* -+ * @param meta transaction meta data -+ * -+ * @retval WSREP_OK cluster-wide commit succeeded -+ * @retval WSREP_TRX_FAIL must rollback transaction -+ * @retval WSREP_CONN_FAIL must close client connection -+ * @retval WSREP_NODE_FAIL must close all connections and reinit -+ */ -+ wsrep_status_t (*pre_commit)(wsrep_t* wsrep, -+ wsrep_conn_id_t conn_id, -+ wsrep_ws_handle_t* ws_handle, -+ uint32_t flags, -+ wsrep_trx_meta_t* meta); -+ -+ /*! -+ * @brief Releases resources after transaction commit. -+ * -+ * Ends commit critical section. -+ * -+ * @param wsrep provider handle -+ * @param ws_handle writeset of committing transaction -+ * @retval WSREP_OK post_commit succeeded -+ */ -+ wsrep_status_t (*post_commit) (wsrep_t* wsrep, -+ wsrep_ws_handle_t* ws_handle); -+ -+ /*! -+ * @brief Releases resources after transaction rollback. -+ * -+ * @param wsrep provider handle -+ * @param ws_handle writeset of committing transaction -+ * @retval WSREP_OK post_rollback succeeded -+ */ -+ wsrep_status_t (*post_rollback)(wsrep_t* wsrep, -+ wsrep_ws_handle_t* ws_handle); -+ -+ /*! -+ * @brief Replay trx as a slave writeset -+ * -+ * If local trx has been aborted by brute force, and it has already -+ * replicated before this abort, we must try if we can apply it as -+ * slave trx. Note that slave nodes see only trx writesets and certification -+ * test based on write set content can be different to DBMS lock conflicts. -+ * -+ * @param wsrep provider handle -+ * @param ws_handle writeset of committing transaction -+ * @param trx_ctx transaction context -+ * -+ * @retval WSREP_OK cluster commit succeeded -+ * @retval WSREP_TRX_FAIL must rollback transaction -+ * @retval WSREP_BF_ABORT brute force abort happened after trx replicated -+ * must rollback transaction and try to replay -+ * @retval WSREP_CONN_FAIL must close client connection -+ * @retval WSREP_NODE_FAIL must close all connections and reinit -+ */ -+ wsrep_status_t (*replay_trx)(wsrep_t* wsrep, -+ wsrep_ws_handle_t* ws_handle, -+ void* trx_ctx); -+ -+ /*! -+ * @brief Abort pre_commit() call of another thread. -+ * -+ * It is possible, that some high-priority transaction needs to abort -+ * another transaction which is in pre_commit() call waiting for resources. -+ * -+ * The kill routine checks that abort is not attmpted against a transaction -+ * which is front of the caller (in total order). -+ * -+ * @param wsrep provider handle -+ * @param bf_seqno seqno of brute force trx, running this cancel -+ * @param victim_trx transaction to be aborted, and which is committing -+ * -+ * @retval WSREP_OK abort secceded -+ * @retval WSREP_WARNING abort failed -+ */ -+ wsrep_status_t (*abort_pre_commit)(wsrep_t* wsrep, -+ wsrep_seqno_t bf_seqno, -+ wsrep_trx_id_t victim_trx); -+ -+ /*! -+ * @brief Appends a row reference to transaction writeset -+ * -+ * Both copy flag and key_type can be ignored by provider (key type -+ * interpreted as WSREP_KEY_EXCLUSIVE). -+ * -+ * @param wsrep provider handle -+ * @param ws_handle writeset handle -+ * @param keys array of keys -+ * @param count length of the array of keys -+ * @param type type ot the key -+ * @param copy can be set to FALSE if keys persist through commit. -+ */ -+ wsrep_status_t (*append_key)(wsrep_t* wsrep, -+ wsrep_ws_handle_t* ws_handle, -+ const wsrep_key_t* keys, -+ size_t count, -+ enum wsrep_key_type type, -+ wsrep_bool_t copy); -+ -+ /*! -+ * @brief Appends data to transaction writeset -+ * -+ * This method can be called any time before commit and it -+ * appends a number of data buffers to transaction writeset. -+ * -+ * Both copy and unordered flags can be ignored by provider. -+ * -+ * @param wsrep provider handle -+ * @param ws_handle writeset handle -+ * @param data array of data buffers -+ * @param count buffer count -+ * @param type type of data -+ * @param copy can be set to FALSE if data persists through commit. -+ */ -+ wsrep_status_t (*append_data)(wsrep_t* wsrep, -+ wsrep_ws_handle_t* ws_handle, -+ const struct wsrep_buf* data, -+ size_t count, -+ enum wsrep_data_type type, -+ wsrep_bool_t copy); -+ -+ /*! -+ * @brief Get causal ordering for read operation -+ * -+ * This call will block until causal ordering with all possible -+ * preceding writes in the cluster is guaranteed. If pointer to -+ * gtid is non-null, the call stores the global transaction ID -+ * of the last transaction which is guaranteed to be ordered -+ * causally before this call. -+ * -+ * @param wsrep provider handle -+ * @param gtid location to store GTID -+ */ -+ wsrep_status_t (*causal_read)(wsrep_t* wsrep, wsrep_gtid_t* gtid); -+ -+ /*! -+ * @brief Clears allocated connection context. -+ * -+ * Whenever a new connection ID is passed to wsrep provider through -+ * any of the API calls, a connection context is allocated for this -+ * connection. This call is to explicitly notify provider fo connection -+ * closing. -+ * -+ * @param wsrep provider handle -+ * @param conn_id connection ID -+ * @param query the 'set database' query -+ * @param query_len length of query (does not end with 0) -+ */ -+ wsrep_status_t (*free_connection)(wsrep_t* wsrep, -+ wsrep_conn_id_t conn_id); -+ -+ /*! -+ * @brief Replicates a query and starts "total order isolation" section. -+ * -+ * Replicates the action spec and returns success code, which caller must -+ * check. Total order isolation continues until to_execute_end() is called. -+ * -+ * @param wsrep provider handle -+ * @param conn_id connection ID -+ * @param keys array of keys -+ * @param keys_num lenght of the array of keys -+ * @param action action buffer array to be executed -+ * @param count action buffer count -+ * @param meta transaction meta data -+ * -+ * @retval WSREP_OK cluster commit succeeded -+ * @retval WSREP_CONN_FAIL must close client connection -+ * @retval WSREP_NODE_FAIL must close all connections and reinit -+ */ -+ wsrep_status_t (*to_execute_start)(wsrep_t* wsrep, -+ wsrep_conn_id_t conn_id, -+ const wsrep_key_t* keys, -+ size_t keys_num, -+ const struct wsrep_buf* action, -+ size_t count, -+ wsrep_trx_meta_t* meta); -+ -+ /*! -+ * @brief Ends the total order isolation section. -+ * -+ * Marks the end of total order isolation. TO locks are freed -+ * and other transactions are free to commit from this point on. -+ * -+ * @param wsrep provider handle -+ * @param conn_id connection ID -+ * -+ * @retval WSREP_OK cluster commit succeeded -+ * @retval WSREP_CONN_FAIL must close client connection -+ * @retval WSREP_NODE_FAIL must close all connections and reinit -+ */ -+ wsrep_status_t (*to_execute_end)(wsrep_t* wsrep, wsrep_conn_id_t conn_id); -+ -+ /*! -+ * @brief Collects preordered replication events into a writeset. -+ * -+ * @param wsrep wsrep provider handle -+ * @param handle a handle associated with a given writeset -+ * @param data an array of data buffers. -+ * @param count length of data buffer array. -+ * @param copy whether provider needs to make a copy of events. -+ * -+ * @retval WSREP_OK cluster-wide commit succeeded -+ * @retval WSREP_TRX_FAIL operation failed (e.g. trx size exceeded limit) -+ * @retval WSREP_NODE_FAIL must close all connections and reinit -+ */ -+ wsrep_status_t (*preordered_collect) (wsrep_t* wsrep, -+ wsrep_po_handle_t* handle, -+ const struct wsrep_buf* data, -+ size_t count, -+ wsrep_bool_t copy); -+ -+ /*! -+ * @brief "Commits" preordered writeset to cluster. -+ * -+ * The contract is that the writeset will be committed in the same (partial) -+ * order this method was called. Frees resources associated with the writeset -+ * handle and reinitializes the handle. -+ * -+ * @param wsrep wsrep provider handle -+ * @param po_handle a handle associated with a given writeset -+ * @param source_id ID of the event producer, also serves as the partial order -+ * or stream ID - events with different source_ids won't be -+ * ordered with respect to each other. -+ * @param flags WSREP_FLAG_... flags -+ * @param pa_range the number of preceding events this event can be processed -+ * in parallel with. A value of 0 means strict serial -+ * processing. Note: commits always happen in wsrep order. -+ * @param commit 'true' to commit writeset to cluster (replicate) or -+ * 'false' to rollback (cancel) the writeset. -+ * -+ * @retval WSREP_OK cluster-wide commit succeeded -+ * @retval WSREP_TRX_FAIL operation failed (e.g. NON-PRIMARY component) -+ * @retval WSREP_NODE_FAIL must close all connections and reinit -+ */ -+ wsrep_status_t (*preordered_commit) (wsrep_t* wsrep, -+ wsrep_po_handle_t* handle, -+ const wsrep_uuid_t* source_id, -+ uint32_t flags, -+ int pa_range, -+ wsrep_bool_t commit); -+ -+ /*! -+ * @brief Signals to wsrep provider that state snapshot has been sent to -+ * joiner. -+ * -+ * @param wsrep provider handle -+ * @param state_id state ID -+ * @param rcode 0 or negative error code of the operation. -+ */ -+ wsrep_status_t (*sst_sent)(wsrep_t* wsrep, -+ const wsrep_gtid_t* state_id, -+ int rcode); -+ -+ /*! -+ * @brief Signals to wsrep provider that new state snapshot has been received. -+ * May deadlock if called from sst_prepare_cb. -+ * -+ * @param wsrep provider handle -+ * @param state_id state ID -+ * @param state initial state provided by SST donor -+ * @param state_len length of state buffer -+ * @param rcode 0 or negative error code of the operation. -+ */ -+ wsrep_status_t (*sst_received)(wsrep_t* wsrep, -+ const wsrep_gtid_t* state_id, -+ const void* state, -+ size_t state_len, -+ int rcode); -+ -+ -+ /*! -+ * @brief Generate request for consistent snapshot. -+ * -+ * If successfull, this call will generate internally SST request -+ * which in turn triggers calling SST donate callback on the nodes -+ * specified in donor_spec. If donor_spec is null, callback is -+ * called only locally. This call will block until sst_sent is called -+ * from callback. -+ * -+ * @param wsrep provider handle -+ * @param msg context message for SST donate callback -+ * @param msg_len length of context message -+ * @param donor_spec list of snapshot donors -+ */ -+ wsrep_status_t (*snapshot)(wsrep_t* wsrep, -+ const void* msg, -+ size_t msg_len, -+ const char* donor_spec); -+ -+ /*! -+ * @brief Returns an array fo status variables. -+ * Array is terminated by Null variable name. -+ * -+ * @param wsrep provider handle -+ * @return array of struct wsrep_status_var. -+ */ -+ struct wsrep_stats_var* (*stats_get) (wsrep_t* wsrep); -+ -+ /*! -+ * @brief Release resources that might be associated with the array. -+ * -+ * @param wsrep provider handle. -+ * @param var_array array returned by stats_get(). -+ */ -+ void (*stats_free) (wsrep_t* wsrep, struct wsrep_stats_var* var_array); -+ -+ /*! -+ * @brief Reset some stats variables to inital value, provider-dependent. -+ * -+ * @param wsrep provider handle. -+ */ -+ void (*stats_reset) (wsrep_t* wsrep); -+ -+ /*! -+ * @brief Pauses writeset applying/committing. -+ * -+ * @return global sequence number of the paused state or negative error code. -+ */ -+ wsrep_seqno_t (*pause) (wsrep_t* wsrep); -+ -+ /*! -+ * @brief Resumes writeset applying/committing. -+ */ -+ wsrep_status_t (*resume) (wsrep_t* wsrep); -+ -+ /*! -+ * @brief Desynchronize from cluster -+ * -+ * Effectively turns off flow control for this node, allowing it -+ * to fall behind the cluster. -+ */ -+ wsrep_status_t (*desync) (wsrep_t* wsrep); -+ -+ /*! -+ * @brief Request to resynchronize with cluster. -+ * -+ * Effectively turns on flow control. Asynchronous - actual synchronization -+ * event to be deliverred via sync_cb. -+ */ -+ wsrep_status_t (*resync) (wsrep_t* wsrep); -+ -+ /*! -+ * @brief Acquire global named lock -+ * -+ * @param wsrep wsrep provider handle -+ * @param name lock name -+ * @param shared shared or exclusive lock -+ * @param owner 64-bit owner ID -+ * @param tout timeout in nanoseconds. -+ * 0 - return immediately, -1 wait forever. -+ * @return wsrep status or negative error code -+ * @retval -EDEADLK lock was already acquired by this thread -+ * @retval -EBUSY lock was busy -+ */ -+ wsrep_status_t (*lock) (wsrep_t* wsrep, -+ const char* name, wsrep_bool_t shared, -+ uint64_t owner, int64_t tout); -+ -+ /*! -+ * @brief Release global named lock -+ * -+ * @param wsrep wsrep provider handle -+ * @param name lock name -+ * @param owner 64-bit owner ID -+ * @return wsrep status or negative error code -+ * @retval -EPERM lock does not belong to this owner -+ */ -+ wsrep_status_t (*unlock) (wsrep_t* wsrep, const char* name, uint64_t owner); -+ -+ /*! -+ * @brief Check if global named lock is locked -+ * -+ * @param wsrep wsrep provider handle -+ * @param name lock name -+ * @param owner if not NULL will contain 64-bit owner ID -+ * @param node if not NULL will contain owner's node UUID -+ * @return true if lock is locked -+ */ -+ wsrep_bool_t (*is_locked) (wsrep_t* wsrep, const char* name, uint64_t* conn, -+ wsrep_uuid_t* node); -+ -+ /*! -+ * wsrep provider name -+ */ -+ const char* provider_name; -+ -+ /*! -+ * wsrep provider version -+ */ -+ const char* provider_version; -+ -+ /*! -+ * wsrep provider vendor name -+ */ -+ const char* provider_vendor; -+ -+ /*! -+ * @brief Frees allocated resources before unloading the library. -+ * @param wsrep provider handle -+ */ -+ void (*free)(wsrep_t* wsrep); -+ -+ void *dlh; //!< reserved for future use -+ void *ctx; //!< reserved for implemetation private context -+}; -+ -+ -+/*! -+ * -+ * @brief Loads wsrep library -+ * -+ * @param spec path to wsrep library. If NULL or WSREP_NONE initialises dummy -+ * pass-through implementation. -+ * @param hptr wsrep handle -+ * @param log_cb callback to handle loader messages. Otherwise writes to stderr. -+ * -+ * @return zero on success, errno on failure -+ */ -+int wsrep_load(const char* spec, wsrep_t** hptr, wsrep_log_cb_t log_cb); -+ -+/*! -+ * @brief Unloads wsrep library and frees associated resources -+ * -+ * @param hptr wsrep handler pointer -+ */ -+void wsrep_unload(wsrep_t* hptr); -+ -+#ifdef __cplusplus -+} -+#endif -+ -+#endif /* WSREP_H */ - -=== added file 'wsrep/wsrep_dummy.c' ---- old/wsrep/wsrep_dummy.c 1970-01-01 00:00:00 +0000 -+++ new/wsrep/wsrep_dummy.c 2013-11-02 17:14:27 +0000 -@@ -0,0 +1,391 @@ -+/* Copyright (C) 2009-2010 Codership Oy -+ -+ 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -+ */ -+ -+/*! @file Dummy wsrep API implementation. */ -+ -+#include "wsrep_api.h" -+ -+#include -+#include -+ -+/*! Dummy backend context. */ -+typedef struct wsrep_dummy -+{ -+ wsrep_log_cb_t log_fn; -+} wsrep_dummy_t; -+ -+/* Get pointer to wsrep_dummy context from wsrep_t pointer */ -+#define WSREP_DUMMY(_p) ((wsrep_dummy_t *) (_p)->ctx) -+ -+/* Trace function usage a-la DBUG */ -+#define WSREP_DBUG_ENTER(_w) do { \ -+ if (WSREP_DUMMY(_w)) { \ -+ if (WSREP_DUMMY(_w)->log_fn) \ -+ WSREP_DUMMY(_w)->log_fn(WSREP_LOG_DEBUG, __FUNCTION__); \ -+ } \ -+ } while (0) -+ -+ -+static void dummy_free(wsrep_t *w) -+{ -+ WSREP_DBUG_ENTER(w); -+ free(w->ctx); -+ w->ctx = NULL; -+} -+ -+static wsrep_status_t dummy_init (wsrep_t* w, -+ const struct wsrep_init_args* args) -+{ -+ WSREP_DUMMY(w)->log_fn = args->logger_cb; -+ WSREP_DBUG_ENTER(w); -+ return WSREP_OK; -+} -+ -+static uint64_t dummy_capabilities (wsrep_t* w __attribute__((unused))) -+{ -+ return 0; -+} -+ -+static wsrep_status_t dummy_options_set( -+ wsrep_t* w, -+ const char* conf __attribute__((unused))) -+{ -+ WSREP_DBUG_ENTER(w); -+ return WSREP_OK; -+} -+ -+static char* dummy_options_get (wsrep_t* w) -+{ -+ WSREP_DBUG_ENTER(w); -+ return NULL; -+} -+ -+static wsrep_status_t dummy_connect( -+ wsrep_t* w, -+ const char* name __attribute__((unused)), -+ const char* url __attribute__((unused)), -+ const char* donor __attribute__((unused)), -+ wsrep_bool_t bootstrap __attribute__((unused))) -+{ -+ WSREP_DBUG_ENTER(w); -+ return WSREP_OK; -+} -+ -+static wsrep_status_t dummy_disconnect(wsrep_t* w) -+{ -+ WSREP_DBUG_ENTER(w); -+ return WSREP_OK; -+} -+ -+static wsrep_status_t dummy_recv(wsrep_t* w, -+ void* recv_ctx __attribute__((unused))) -+{ -+ WSREP_DBUG_ENTER(w); -+ return WSREP_OK; -+} -+ -+static wsrep_status_t dummy_pre_commit( -+ wsrep_t* w, -+ const wsrep_conn_id_t conn_id __attribute__((unused)), -+ wsrep_ws_handle_t* ws_handle __attribute__((unused)), -+ uint32_t flags __attribute__((unused)), -+ wsrep_trx_meta_t* meta __attribute__((unused))) -+{ -+ WSREP_DBUG_ENTER(w); -+ return WSREP_OK; -+} -+ -+static wsrep_status_t dummy_post_commit( -+ wsrep_t* w, -+ wsrep_ws_handle_t* ws_handle __attribute__((unused))) -+{ -+ WSREP_DBUG_ENTER(w); -+ return WSREP_OK; -+} -+ -+static wsrep_status_t dummy_post_rollback( -+ wsrep_t* w, -+ wsrep_ws_handle_t* ws_handle __attribute__((unused))) -+{ -+ WSREP_DBUG_ENTER(w); -+ return WSREP_OK; -+} -+ -+static wsrep_status_t dummy_replay_trx( -+ wsrep_t* w, -+ wsrep_ws_handle_t* ws_handle __attribute__((unused)), -+ void* trx_ctx __attribute__((unused))) -+{ -+ WSREP_DBUG_ENTER(w); -+ return WSREP_OK; -+} -+ -+static wsrep_status_t dummy_abort_pre_commit( -+ wsrep_t* w, -+ const wsrep_seqno_t bf_seqno __attribute__((unused)), -+ const wsrep_trx_id_t trx_id __attribute__((unused))) -+{ -+ WSREP_DBUG_ENTER(w); -+ return WSREP_OK; -+} -+ -+static wsrep_status_t dummy_append_key( -+ wsrep_t* w, -+ wsrep_ws_handle_t* ws_handle __attribute__((unused)), -+ const wsrep_key_t* key __attribute__((unused)), -+ const size_t key_num __attribute__((unused)), -+ const wsrep_key_type_t key_type __attribute__((unused)), -+ const bool copy __attribute__((unused))) -+{ -+ WSREP_DBUG_ENTER(w); -+ return WSREP_OK; -+} -+ -+static wsrep_status_t dummy_append_data( -+ wsrep_t* w, -+ wsrep_ws_handle_t* ws_handle __attribute__((unused)), -+ const struct wsrep_buf* data __attribute__((unused)), -+ const size_t count __attribute__((unused)), -+ const wsrep_data_type_t type __attribute__((unused)), -+ const bool copy __attribute__((unused))) -+{ -+ WSREP_DBUG_ENTER(w); -+ return WSREP_OK; -+} -+ -+static wsrep_status_t dummy_causal_read( -+ wsrep_t* w, -+ wsrep_gtid_t* gtid __attribute__((unused))) -+{ -+ WSREP_DBUG_ENTER(w); -+ return WSREP_OK; -+} -+ -+static wsrep_status_t dummy_free_connection( -+ wsrep_t* w, -+ const wsrep_conn_id_t conn_id __attribute__((unused))) -+{ -+ WSREP_DBUG_ENTER(w); -+ return WSREP_OK; -+} -+ -+static wsrep_status_t dummy_to_execute_start( -+ wsrep_t* w, -+ const wsrep_conn_id_t conn_id __attribute__((unused)), -+ const wsrep_key_t* key __attribute__((unused)), -+ const size_t key_num __attribute__((unused)), -+ const struct wsrep_buf* data __attribute__((unused)), -+ const size_t count __attribute__((unused)), -+ wsrep_trx_meta_t* meta __attribute__((unused))) -+{ -+ WSREP_DBUG_ENTER(w); -+ return WSREP_OK; -+} -+ -+static wsrep_status_t dummy_to_execute_end( -+ wsrep_t* w, -+ const wsrep_conn_id_t conn_id __attribute__((unused))) -+{ -+ WSREP_DBUG_ENTER(w); -+ return WSREP_OK; -+} -+ -+static wsrep_status_t dummy_preordered_collect( -+ wsrep_t* w, -+ wsrep_po_handle_t* handle __attribute__((unused)), -+ const struct wsrep_buf* data __attribute__((unused)), -+ size_t count __attribute__((unused)), -+ wsrep_bool_t copy __attribute__((unused))) -+{ -+ WSREP_DBUG_ENTER(w); -+ return WSREP_OK; -+} -+ -+static wsrep_status_t dummy_preordered_commit( -+ wsrep_t* w, -+ wsrep_po_handle_t* handle __attribute__((unused)), -+ const wsrep_uuid_t* source_id __attribute__((unused)), -+ uint32_t flags __attribute__((unused)), -+ int pa_range __attribute__((unused)), -+ wsrep_bool_t commit __attribute__((unused))) -+{ -+ WSREP_DBUG_ENTER(w); -+ return WSREP_OK; -+} -+ -+static wsrep_status_t dummy_sst_sent( -+ wsrep_t* w, -+ const wsrep_gtid_t* state_id __attribute__((unused)), -+ const int rcode __attribute__((unused))) -+{ -+ WSREP_DBUG_ENTER(w); -+ return WSREP_OK; -+} -+ -+static wsrep_status_t dummy_sst_received( -+ wsrep_t* w, -+ const wsrep_gtid_t* state_id __attribute__((unused)), -+ const void* state __attribute__((unused)), -+ const size_t state_len __attribute__((unused)), -+ const int rcode __attribute__((unused))) -+{ -+ WSREP_DBUG_ENTER(w); -+ return WSREP_OK; -+} -+ -+static wsrep_status_t dummy_snapshot( -+ wsrep_t* w, -+ const void* msg __attribute__((unused)), -+ const size_t msg_len __attribute__((unused)), -+ const char* donor_spec __attribute__((unused))) -+{ -+ WSREP_DBUG_ENTER(w); -+ return WSREP_OK; -+} -+ -+static struct wsrep_stats_var dummy_stats[] = { -+ { NULL, WSREP_VAR_STRING, { 0 } } -+}; -+ -+static struct wsrep_stats_var* dummy_stats_get (wsrep_t* w) -+{ -+ WSREP_DBUG_ENTER(w); -+ return dummy_stats; -+} -+ -+static void dummy_stats_free ( -+ wsrep_t* w, -+ struct wsrep_stats_var* stats __attribute__((unused))) -+{ -+ WSREP_DBUG_ENTER(w); -+} -+ -+static void dummy_stats_reset (wsrep_t* w) -+{ -+ WSREP_DBUG_ENTER(w); -+} -+ -+static wsrep_seqno_t dummy_pause (wsrep_t* w) -+{ -+ WSREP_DBUG_ENTER(w); -+ return -ENOSYS; -+} -+ -+static wsrep_status_t dummy_resume (wsrep_t* w) -+{ -+ WSREP_DBUG_ENTER(w); -+ return WSREP_OK; -+} -+ -+static wsrep_status_t dummy_desync (wsrep_t* w) -+{ -+ WSREP_DBUG_ENTER(w); -+ return WSREP_NOT_IMPLEMENTED; -+} -+ -+static wsrep_status_t dummy_resync (wsrep_t* w) -+{ -+ WSREP_DBUG_ENTER(w); -+ return WSREP_OK; -+} -+ -+static wsrep_status_t dummy_lock (wsrep_t* w, -+ const char* s __attribute__((unused)), -+ bool r __attribute__((unused)), -+ uint64_t o __attribute__((unused)), -+ int64_t t __attribute__((unused))) -+{ -+ WSREP_DBUG_ENTER(w); -+ return WSREP_NOT_IMPLEMENTED; -+} -+ -+static wsrep_status_t dummy_unlock (wsrep_t* w, -+ const char* s __attribute__((unused)), -+ uint64_t o __attribute__((unused))) -+{ -+ WSREP_DBUG_ENTER(w); -+ return WSREP_OK; -+} -+ -+static bool dummy_is_locked (wsrep_t* w, -+ const char* s __attribute__((unused)), -+ uint64_t* o __attribute__((unused)), -+ wsrep_uuid_t* t __attribute__((unused))) -+{ -+ WSREP_DBUG_ENTER(w); -+ return false; -+} -+ -+static wsrep_t dummy_iface = { -+ WSREP_INTERFACE_VERSION, -+ &dummy_init, -+ &dummy_capabilities, -+ &dummy_options_set, -+ &dummy_options_get, -+ &dummy_connect, -+ &dummy_disconnect, -+ &dummy_recv, -+ &dummy_pre_commit, -+ &dummy_post_commit, -+ &dummy_post_rollback, -+ &dummy_replay_trx, -+ &dummy_abort_pre_commit, -+ &dummy_append_key, -+ &dummy_append_data, -+ &dummy_causal_read, -+ &dummy_free_connection, -+ &dummy_to_execute_start, -+ &dummy_to_execute_end, -+ &dummy_preordered_collect, -+ &dummy_preordered_commit, -+ &dummy_sst_sent, -+ &dummy_sst_received, -+ &dummy_snapshot, -+ &dummy_stats_get, -+ &dummy_stats_free, -+ &dummy_stats_reset, -+ &dummy_pause, -+ &dummy_resume, -+ &dummy_desync, -+ &dummy_resync, -+ &dummy_lock, -+ &dummy_unlock, -+ &dummy_is_locked, -+ WSREP_NONE, -+ WSREP_INTERFACE_VERSION, -+ "Codership Oy ", -+ &dummy_free, -+ NULL, -+ NULL -+}; -+ -+int wsrep_dummy_loader(wsrep_t* w) -+{ -+ if (!w) -+ return EINVAL; -+ -+ *w = dummy_iface; -+ -+ // allocate private context -+ if (!(w->ctx = malloc(sizeof(wsrep_dummy_t)))) -+ return ENOMEM; -+ -+ // initialize private context -+ WSREP_DUMMY(w)->log_fn = NULL; -+ -+ return 0; -+} -+ - -=== added file 'wsrep/wsrep_gtid.c' ---- old/wsrep/wsrep_gtid.c 1970-01-01 00:00:00 +0000 -+++ new/wsrep/wsrep_gtid.c 2013-08-27 17:07:50 +0000 -@@ -0,0 +1,74 @@ -+/* Copyright (C) 2013 Codership Oy -+ -+ 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -+ */ -+ -+/*! @file Helper functions to deal with GTID string representations */ -+ -+#include -+#include -+#include -+#include -+ -+#include "wsrep_api.h" -+ -+/*! -+ * Read GTID from string -+ * @return length of GTID string representation or -EINVAL in case of error -+ */ -+int -+wsrep_gtid_scan(const char* str, size_t str_len, wsrep_gtid_t* gtid) -+{ -+ unsigned int offset; -+ char* endptr; -+ -+ if ((offset = wsrep_uuid_scan(str, str_len, >id->uuid)) > 0 && -+ offset < str_len && str[offset] == ':') { -+ ++offset; -+ if (offset < str_len) -+ { -+ errno = 0; -+ gtid->seqno = strtoll(str + offset, &endptr, 0); -+ -+ if (errno == 0) { -+ offset = endptr - str; -+ return offset; -+ } -+ } -+ } -+ *gtid = WSREP_GTID_UNDEFINED; -+ return -EINVAL; -+} -+ -+/*! -+ * Write GTID to string -+ * @return length of GTID stirng representation of -EMSGSIZE if string is too -+ * short -+ */ -+int -+wsrep_gtid_print(const wsrep_gtid_t* gtid, char* str, size_t str_len) -+{ -+ unsigned int offset, ret; -+ if ((offset = wsrep_uuid_print(>id->uuid, str, str_len)) > 0) -+ { -+ ret = snprintf(str + offset, str_len - offset, -+ ":%" PRId64, gtid->seqno); -+ if (ret <= str_len - offset) { -+ return (offset + ret); -+ } -+ -+ } -+ -+ return -EMSGSIZE; -+} - -=== added file 'wsrep/wsrep_loader.c' ---- old/wsrep/wsrep_loader.c 1970-01-01 00:00:00 +0000 -+++ new/wsrep/wsrep_loader.c 2013-09-18 14:56:00 +0000 -@@ -0,0 +1,203 @@ -+/* Copyright (C) 2009-2011 Codership Oy -+ -+ 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -+ */ -+ -+/*! @file wsrep implementation loader */ -+ -+#include -+#include -+#include -+#include -+ -+#include "wsrep_api.h" -+ -+// Logging stuff for the loader -+static const char* log_levels[] = {"FATAL", "ERROR", "WARN", "INFO", "DEBUG"}; -+ -+static void default_logger (wsrep_log_level_t lvl, const char* msg) -+{ -+ fprintf (stderr, "wsrep loader: [%s] %s\n", log_levels[lvl], msg); -+} -+ -+static wsrep_log_cb_t logger = default_logger; -+ -+/************************************************************************** -+ * Library loader -+ **************************************************************************/ -+ -+static int verify(const wsrep_t *wh, const char *iface_ver) -+{ -+ const size_t msg_len = 128; -+ char msg[msg_len]; -+ -+#define VERIFY(_p) if (!(_p)) { \ -+ snprintf(msg, msg_len, "wsrep_load(): verify(): %s\n", # _p); \ -+ logger (WSREP_LOG_ERROR, msg); \ -+ return EINVAL; \ -+ } -+ -+ VERIFY(wh); -+ VERIFY(wh->version); -+ -+ if (strcmp(wh->version, iface_ver)) { -+ snprintf (msg, msg_len, -+ "provider interface version mismatch: need '%s', found '%s'", -+ iface_ver, wh->version); -+ logger (WSREP_LOG_ERROR, msg); -+ return EINVAL; -+ } -+ -+ VERIFY(wh->init); -+ VERIFY(wh->options_set); -+ VERIFY(wh->options_get); -+ VERIFY(wh->connect); -+ VERIFY(wh->disconnect); -+ VERIFY(wh->recv); -+ VERIFY(wh->pre_commit); -+ VERIFY(wh->post_commit); -+ VERIFY(wh->post_rollback); -+ VERIFY(wh->replay_trx); -+ VERIFY(wh->abort_pre_commit); -+ VERIFY(wh->append_key); -+ VERIFY(wh->append_data); -+ VERIFY(wh->free_connection); -+ VERIFY(wh->to_execute_start); -+ VERIFY(wh->to_execute_end); -+ VERIFY(wh->preordered_collect); -+ VERIFY(wh->preordered_commit); -+ VERIFY(wh->sst_sent); -+ VERIFY(wh->sst_received); -+ VERIFY(wh->stats_get); -+ VERIFY(wh->stats_free); -+ VERIFY(wh->stats_reset); -+ VERIFY(wh->pause); -+ VERIFY(wh->resume); -+ VERIFY(wh->desync); -+ VERIFY(wh->resync); -+ VERIFY(wh->lock); -+ VERIFY(wh->unlock); -+ VERIFY(wh->is_locked); -+ VERIFY(wh->provider_name); -+ VERIFY(wh->provider_version); -+ VERIFY(wh->provider_vendor); -+ VERIFY(wh->free); -+ return 0; -+} -+ -+typedef int (*wsrep_loader_fun)(wsrep_t*); -+ -+static wsrep_loader_fun wsrep_dlf(void *dlh, const char *sym) -+{ -+ union { -+ wsrep_loader_fun dlfun; -+ void *obj; -+ } alias; -+ alias.obj = dlsym(dlh, sym); -+ return alias.dlfun; -+} -+ -+extern int wsrep_dummy_loader(wsrep_t *w); -+ -+int wsrep_load(const char *spec, wsrep_t **hptr, wsrep_log_cb_t log_cb) -+{ -+ int ret = 0; -+ void *dlh = NULL; -+ wsrep_loader_fun dlfun; -+ const size_t msg_len = 1024; -+ char msg[msg_len + 1]; -+ msg[msg_len] = 0; -+ -+ if (NULL != log_cb) -+ logger = log_cb; -+ -+ if (!(spec && hptr)) -+ return EINVAL; -+ -+ snprintf (msg, msg_len, -+ "wsrep_load(): loading provider library '%s'", spec); -+ logger (WSREP_LOG_INFO, msg); -+ -+ if (!(*hptr = malloc(sizeof(wsrep_t)))) { -+ logger (WSREP_LOG_FATAL, "wsrep_load(): out of memory"); -+ return ENOMEM; -+ } -+ -+ if (!spec || strcmp(spec, WSREP_NONE) == 0) { -+ if ((ret = wsrep_dummy_loader(*hptr)) != 0) { -+ free (*hptr); -+ *hptr = NULL; -+ } -+ return ret; -+ } -+ -+ if (!(dlh = dlopen(spec, RTLD_NOW | RTLD_LOCAL))) { -+ snprintf(msg, msg_len, "wsrep_load(): dlopen(): %s", dlerror()); -+ logger (WSREP_LOG_ERROR, msg); -+ ret = EINVAL; -+ goto out; -+ } -+ -+ if (!(dlfun = wsrep_dlf(dlh, "wsrep_loader"))) { -+ ret = EINVAL; -+ goto out; -+ } -+ -+ if ((ret = (*dlfun)(*hptr)) != 0) { -+ snprintf(msg, msg_len, "wsrep_load(): loader failed: %s", -+ strerror(ret)); -+ logger (WSREP_LOG_ERROR, msg); -+ goto out; -+ } -+ -+ if ((ret = verify(*hptr, WSREP_INTERFACE_VERSION)) != 0) { -+ snprintf (msg, msg_len, -+ "wsrep_load(): interface version mismatch: my version %s, " -+ "provider version %s", WSREP_INTERFACE_VERSION, -+ (*hptr)->version); -+ logger (WSREP_LOG_ERROR, msg); -+ goto out; -+ } -+ -+ (*hptr)->dlh = dlh; -+ -+out: -+ if (ret != 0) { -+ if (dlh) dlclose(dlh); -+ free(*hptr); -+ *hptr = NULL; -+ } else { -+ snprintf (msg, msg_len, -+ "wsrep_load(): %s %s by %s loaded successfully.", -+ (*hptr)->provider_name, (*hptr)->provider_version, -+ (*hptr)->provider_vendor); -+ logger (WSREP_LOG_INFO, msg); -+ } -+ -+ return ret; -+} -+ -+void wsrep_unload(wsrep_t *hptr) -+{ -+ if (!hptr) { -+ logger (WSREP_LOG_WARN, "wsrep_unload(): null pointer."); -+ } else { -+ if (hptr->free) -+ hptr->free(hptr); -+ if (hptr->dlh) -+ dlclose(hptr->dlh); -+ free(hptr); -+ } -+} -+ - -=== added file 'wsrep/wsrep_uuid.c' ---- old/wsrep/wsrep_uuid.c 1970-01-01 00:00:00 +0000 -+++ new/wsrep/wsrep_uuid.c 2013-08-28 11:07:11 +0000 -@@ -0,0 +1,83 @@ -+/* Copyright (C) 2009 Codership Oy -+ -+ 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -+ */ -+ -+/*! @file Helper functions to deal with history UUID string representations */ -+ -+#include -+#include -+#include -+ -+#include "wsrep_api.h" -+ -+/*! -+ * Read UUID from string -+ * @return length of UUID string representation or -EINVAL in case of error -+ */ -+int -+wsrep_uuid_scan (const char* str, size_t str_len, wsrep_uuid_t* uuid) -+{ -+ unsigned int uuid_len = 0; -+ unsigned int uuid_offt = 0; -+ -+ while (uuid_len + 1 < str_len) { -+ /* We are skipping potential '-' after uuid_offt == 4, 6, 8, 10 -+ * which means -+ * (uuid_offt >> 1) == 2, 3, 4, 5, -+ * which in turn means -+ * (uuid_offt >> 1) - 2 <= 3 -+ * since it is always >= 0, because uuid_offt is unsigned */ -+ if (((uuid_offt >> 1) - 2) <= 3 && str[uuid_len] == '-') { -+ // skip dashes after 4th, 6th, 8th and 10th positions -+ uuid_len += 1; -+ continue; -+ } -+ -+ if (isxdigit(str[uuid_len]) && isxdigit(str[uuid_len + 1])) { -+ // got hex digit, scan another byte to uuid, increment uuid_offt -+ sscanf (str + uuid_len, "%2hhx", uuid->data + uuid_offt); -+ uuid_len += 2; -+ uuid_offt += 1; -+ if (sizeof (uuid->data) == uuid_offt) -+ return uuid_len; -+ } -+ else { -+ break; -+ } -+ } -+ -+ *uuid = WSREP_UUID_UNDEFINED; -+ return -EINVAL; -+} -+ -+/*! -+ * Write UUID to string -+ * @return length of UUID string representation or -EMSGSIZE if string is too -+ * short -+ */ -+int -+wsrep_uuid_print (const wsrep_uuid_t* uuid, char* str, size_t str_len) -+{ -+ if (str_len > 36) { -+ const unsigned char* u = uuid->data; -+ return snprintf(str, str_len, "%02x%02x%02x%02x-%02x%02x-%02x%02x-" -+ "%02x%02x-%02x%02x%02x%02x%02x%02x", -+ u[ 0], u[ 1], u[ 2], u[ 3], u[ 4], u[ 5], u[ 6], u[ 7], -+ u[ 8], u[ 9], u[10], u[11], u[12], u[13], u[14], u[15]); -+ } -+ else { -+ return -EMSGSIZE; -+ } -+} - diff --git a/debian/patches/mysql-5.6.23_wsrep_25.10.patch b/debian/patches/mysql-5.6.23_wsrep_25.10.patch new file mode 100644 index 00000000..39ff8b92 --- /dev/null +++ b/debian/patches/mysql-5.6.23_wsrep_25.10.patch @@ -0,0 +1,43353 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 5be5e92..818313e 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -176,6 +176,7 @@ IF(WITH_DEFAULT_FEATURE_SET) + ENDIF() + + # Add macros ++INCLUDE(wsrep) + INCLUDE(character_sets) + INCLUDE(cpu_info) + INCLUDE(zlib) +@@ -324,6 +325,12 @@ OPTION(OPTIMIZER_TRACE "Support tracing of Optimizer" ON) + OPTION(INNODB_COMPILER_HINTS "Compile InnoDB with compiler hints" ON) + MARK_AS_ADVANCED(INNODB_COMPILER_HINTS) + ++OPTION(WITH_INNODB_DISALLOW_WRITES "InnoDB freeze writes patch from Google" ${WITH_WSREP}) ++IF (WITH_INNODB_DISALLOW_WRITES) ++ MESSAGE(STATUS "INNODB_DISALLOW_WRITES") ++ SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWITH_INNODB_DISALLOW_WRITES") ++ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DWITH_INNODB_DISALLOW_WRITES") ++ENDIF() + OPTION(INNODB_PAGE_ATOMIC_REF_COUNT "Use atomics for the page reference count" + ON) + MARK_AS_ADVANCED(INNODB_PAGE_ATOMIC_REF_COUNT) +@@ -444,6 +451,9 @@ ADD_SUBDIRECTORY(regex) + ADD_SUBDIRECTORY(mysys) + ADD_SUBDIRECTORY(mysys_ssl) + ADD_SUBDIRECTORY(libmysql) ++IF(WITH_WSREP) ++ADD_SUBDIRECTORY(wsrep) ++ENDIF() + + IF(WITH_UNIT_TESTS) + ADD_SUBDIRECTORY(unittest) +@@ -539,7 +549,7 @@ ADD_SUBDIRECTORY(packaging/solaris) + # (see http://public.kitware.com/Bug/view.php?id=11452) + SET(CPACK_MONOLITHIC_INSTALL 1 CACHE INTERNAL "") + +-IF(UNIX) ++IF(UNIX AND NOT WITH_WSREP) + INSTALL(FILES Docs/mysql.info DESTINATION ${INSTALL_INFODIR} OPTIONAL COMPONENT Info) + ENDIF() + # +@@ -554,7 +564,7 @@ IF(NOT INSTALL_LAYOUT MATCHES "RPM") + INSTALL(FILES README DESTINATION ${INSTALL_DOCREADMEDIR} COMPONENT Readme) + INSTALL(FILES ${CMAKE_BINARY_DIR}/Docs/INFO_SRC ${CMAKE_BINARY_DIR}/Docs/INFO_BIN DESTINATION ${INSTALL_DOCDIR}) + IF(UNIX) +- INSTALL(FILES Docs/INSTALL-BINARY DESTINATION ${INSTALL_DOCREADMEDIR} COMPONENT Readme) ++ INSTALL(FILES Docs/INSTALL-BINARY Docs/README-wsrep DESTINATION ${INSTALL_DOCREADMEDIR} COMPONENT Readme) + ENDIF() + # MYSQL_DOCS_LOCATON is used in "make dist", points to the documentation directory + SET(MYSQL_DOCS_LOCATION "" CACHE PATH "Location from where documentation is copied") +@@ -562,6 +572,7 @@ IF(NOT INSTALL_LAYOUT MATCHES "RPM") + INSTALL(DIRECTORY Docs/ DESTINATION ${INSTALL_DOCDIR} + COMPONENT Documentation + PATTERN "INSTALL-BINARY" EXCLUDE ++ PATTERN "README-wsrep" EXCLUDE + PATTERN "Makefile.*" EXCLUDE + PATTERN "glibc*" EXCLUDE + PATTERN "linuxthreads.txt" EXCLUDE +diff --git a/Docs/ChangeLog b/Docs/ChangeLog +index 9988db3..e1775d5 100644 +--- a/Docs/ChangeLog ++++ b/Docs/ChangeLog +@@ -1 +1,2 @@ +-This is a first release, this file is supposed to be empty ++Placeholder ++ +diff --git a/Docs/INFO_SRC b/Docs/INFO_SRC +deleted file mode 100644 +index fbc1a6c..0000000 +--- a/Docs/INFO_SRC ++++ /dev/null +@@ -1,7 +0,0 @@ +-commit: 19ff9770da1307a8b44be40beaa456c4d1149c2a +-date: 2015-01-19 14:26:20 +0100 +-build-date: 2015-01-19 14:38:00 +0100 +-short: 19ff977 +-branch: mysql-5.6.23-release +- +-MySQL source 5.6.23 +diff --git a/WSREP_REVISION b/WSREP_REVISION +new file mode 100644 +index 0000000..72dd598 +--- /dev/null ++++ b/WSREP_REVISION +@@ -0,0 +1 @@ ++6b378be +diff --git a/client/mysqltest.cc b/client/mysqltest.cc +index 2def9bd..1421309 100644 +--- a/client/mysqltest.cc ++++ b/client/mysqltest.cc +@@ -496,7 +496,7 @@ struct st_match_err + + struct st_expected_errors + { +- struct st_match_err err[10]; ++ struct st_match_err err[20]; + uint count; + }; + static struct st_expected_errors saved_expected_errors; +diff --git a/cmake/configure.pl b/cmake/configure.pl +index 22c1329..0a6a3cf 100644 +--- a/cmake/configure.pl ++++ b/cmake/configure.pl +@@ -223,6 +223,16 @@ foreach my $option (@ARGV) + $cmakeargs = $cmakeargs." \"-DWITH_COMMENT=".substr($option,13)."\""; + next; + } ++ if ($option =~ /layout=/) ++ { ++ $cmakeargs = $cmakeargs." -DINSTALL_LAYOUT=".substr($option,7); ++ next; ++ } ++ if ($option =~ /with-unix-socket-path=/) ++ { ++ $cmakeargs = $cmakeargs." -DMYSQL_UNIX_ADDR=".substr($option,22); ++ next; ++ } + if ($option =~ /mysql-maintainer-mode/) + { + $cmakeargs = $cmakeargs." -DMYSQL_MAINTAINER_MODE=" . +diff --git a/cmake/install_layout.cmake b/cmake/install_layout.cmake +index 4adda0b..5cd47af 100644 +--- a/cmake/install_layout.cmake ++++ b/cmake/install_layout.cmake +@@ -146,7 +146,10 @@ SET(INSTALL_BINDIR_RPM "bin") + SET(INSTALL_SBINDIR_RPM "sbin") + SET(INSTALL_SCRIPTDIR_RPM "bin") + # +-IF(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64") ++# Deciding via system processor may give wrong answer in ++# virtual environments that see host CPU directly. ++# IF(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64") ++IF(64BIT) + SET(INSTALL_LIBDIR_RPM "lib64") + SET(INSTALL_PLUGINDIR_RPM "lib64/mysql/plugin") + ELSE() +diff --git a/cmake/install_macros.cmake b/cmake/install_macros.cmake +index 83bd6bd..4f66008 100644 +--- a/cmake/install_macros.cmake ++++ b/cmake/install_macros.cmake +@@ -13,8 +13,34 @@ + # along with this program; if not, write to the Free Software + # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + ++if(APPLE) ++ LIST(APPEND CMAKE_CXX_LINK_EXECUTABLE "dsymutil ") ++ LIST(APPEND CMAKE_C_LINK_EXECUTABLE "dsymutil ") ++ LIST(APPEND CMAKE_CXX_CREATE_SHARED_LIBRARY "dsymutil ") ++ LIST(APPEND CMAKE_C_CREATE_SHARED_LIBRARY "dsymutil ") ++ LIST(APPEND CMAKE_CXX_CREATE_SHARED_MODULE "dsymutil ") ++ LIST(APPEND CMAKE_C_CREATE_SHARED_MODULE "dsymutil ") ++ENDIF() ++ + GET_FILENAME_COMPONENT(MYSQL_CMAKE_SCRIPT_DIR ${CMAKE_CURRENT_LIST_FILE} PATH) + INCLUDE(${MYSQL_CMAKE_SCRIPT_DIR}/cmake_parse_arguments.cmake) ++MACRO (INSTALL_DSYM_DIRECTORIES targets) ++ IF(APPLE) ++ FOREACH(target ${targets}) ++ GET_TARGET_PROPERTY(location ${target} LOCATION) ++ GET_TARGET_PROPERTY(type ${target} TYPE) ++ # It's a dirty hack, but cmake too stupid and mysql cmake files too buggy */ ++ STRING(REGEX REPLACE "/liblibmysql.dylib$" "/libmysqlclient.${SHARED_LIB_MAJOR_VERSION}.dylib" location ${location}) ++ IF(DEBUG_EXTNAME) ++ STRING(REGEX REPLACE "/mysqld$" "/mysqld-debug" location ${location}) ++ ENDIF() ++ IF(type MATCHES "EXECUTABLE" OR type MATCHES "MODULE" OR type MATCHES "SHARED_LIBRARY") ++ INSTALL(DIRECTORY "${location}.dSYM" DESTINATION ${INSTALL_LOCATION} COMPONENT Debuginfo) ++ ENDIF() ++ ENDFOREACH() ++ ENDIF() ++ENDMACRO() ++ + MACRO (INSTALL_DEBUG_SYMBOLS targets) + IF(MSVC) + FOREACH(target ${targets}) +@@ -241,6 +267,7 @@ FUNCTION(MYSQL_INSTALL_TARGETS) + INSTALL(TARGETS ${TARGETS} DESTINATION ${ARG_DESTINATION} ${COMP}) + SET(INSTALL_LOCATION ${ARG_DESTINATION} ) + INSTALL_DEBUG_SYMBOLS("${TARGETS}") ++ INSTALL_DSYM_DIRECTORIES("${TARGETS}") + SET(INSTALL_LOCATION) + ENDFUNCTION() + +diff --git a/cmake/os/FreeBSD.cmake b/cmake/os/FreeBSD.cmake +index e095929..bd72a58 100644 +--- a/cmake/os/FreeBSD.cmake ++++ b/cmake/os/FreeBSD.cmake +@@ -22,3 +22,5 @@ + + # The below was used for really old versions of FreeBSD, roughly: before 5.1.9 + # ADD_DEFINITIONS(-DHAVE_BROKEN_REALPATH) ++ ++SET(HAVE_SYS_TIMEB_H CACHE INTERNAL "") +diff --git a/cmake/os/WindowsCache.cmake b/cmake/os/WindowsCache.cmake +index a1764ad..891c4e4 100644 +--- a/cmake/os/WindowsCache.cmake ++++ b/cmake/os/WindowsCache.cmake +@@ -74,6 +74,7 @@ SET(HAVE_FSYNC CACHE INTERNAL "") + SET(HAVE_FTIME 1 CACHE INTERNAL "") + SET(HAVE_FTRUNCATE CACHE INTERNAL "") + SET(HAVE_GETADDRINFO 1 CACHE INTERNAL "") ++SET(HAVE_GETIFADDRS CACHE INTERNAL "") + SET(HAVE_GETCWD 1 CACHE INTERNAL "") + SET(HAVE_GETHOSTBYADDR_R CACHE INTERNAL "") + SET(HAVE_GETHRTIME CACHE INTERNAL "") +diff --git a/cmake/package_name.cmake b/cmake/package_name.cmake +index 4cb5c95..882259c 100644 +--- a/cmake/package_name.cmake ++++ b/cmake/package_name.cmake +@@ -27,6 +27,8 @@ IF(NOT VERSION) + SET(DEFAULT_MACHINE ${CMAKE_SYSTEM_PROCESSOR}) + IF(SIZEOF_VOIDP EQUAL 8) + SET(64BIT 1) ++ ELSE() ++ SET(64BIT 0) + ENDIF() + + IF(CMAKE_SYSTEM_NAME MATCHES "Windows") +@@ -127,7 +129,14 @@ IF(NOT VERSION) + STRING(REGEX REPLACE "^.*-ndb-" "" NDBVERSION "${VERSION}") + SET(package_name "mysql-cluster${PRODUCT_TAG}-${NDBVERSION}-${SYSTEM_NAME_AND_PROCESSOR}") + ELSE() +- SET(package_name "mysql${PRODUCT_TAG}-${VERSION}-${SYSTEM_NAME_AND_PROCESSOR}") ++ IF(WITH_WSREP) ++ IF(NOT WSREP_VERSION) ++ MESSAGE(FATAL_ERROR "Variable WSREP_VERSION must be set") ++ ENDIF() ++ SET(package_name "mysql-wsrep${PRODUCT_TAG}-${VERSION}-${WSREP_VERSION}-${SYSTEM_NAME_AND_PROCESSOR}") ++ ELSE() ++ SET(package_name "mysql${PRODUCT_TAG}-${VERSION}-${SYSTEM_NAME_AND_PROCESSOR}") ++ ENDIF() + ENDIF() + + MESSAGE(STATUS "Packaging as: ${package_name}") +diff --git a/cmake/wsrep.cmake b/cmake/wsrep.cmake +new file mode 100644 +index 0000000..2c7d799 +--- /dev/null ++++ b/cmake/wsrep.cmake +@@ -0,0 +1,52 @@ ++# Copyright (c) 2011, Codership Oy . ++# ++# 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 "10") ++ ++# Obtain patch revision number ++SET(WSREP_REVISION $ENV{WSREP_REV}) ++IF(NOT WSREP_REVISION) ++ SET(WSREP_REVISION "XXXX" CACHE STRING "WSREP revision") ++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}" ++ CACHE STRING "WSREP version") ++ ++OPTION(WITH_WSREP "WSREP replication API (to use, e.g. Galera Replication library)" OFF) ++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) ++ SET(WITH_INNODB_DISALLOW_WRITES ON) ++ SET(WITH_INNODB_MEMCACHED ON) ++ENDIF() ++ ++# +diff --git a/config.h.cmake b/config.h.cmake +index 987be27..a216b18 100644 +--- a/config.h.cmake ++++ b/config.h.cmake +@@ -155,6 +155,7 @@ + #cmakedefine HAVE_FSYNC 1 + #cmakedefine HAVE_FTIME 1 + #cmakedefine HAVE_GETADDRINFO 1 ++#cmakedefine HAVE_GETIFADDRS 1 + #cmakedefine HAVE_GETCWD 1 + #cmakedefine HAVE_GETHOSTBYADDR_R 1 + #cmakedefine HAVE_GETHRTIME 1 +diff --git a/configure.cmake b/configure.cmake +index e1c1793..a4d4809 100644 +--- a/configure.cmake ++++ b/configure.cmake +@@ -433,6 +433,7 @@ CHECK_FUNCTION_EXISTS (getpassphrase HAVE_GETPASSPHRASE) + CHECK_FUNCTION_EXISTS (getpwnam HAVE_GETPWNAM) + CHECK_FUNCTION_EXISTS (getpwuid HAVE_GETPWUID) + CHECK_FUNCTION_EXISTS (getrlimit HAVE_GETRLIMIT) ++CHECK_FUNCTION_EXISTS (getifaddrs HAVE_GETIFADDRS) + CHECK_FUNCTION_EXISTS (getrusage HAVE_GETRUSAGE) + CHECK_FUNCTION_EXISTS (getwd HAVE_GETWD) + CHECK_FUNCTION_EXISTS (gmtime_r HAVE_GMTIME_R) +diff --git a/include/my_md5.h b/include/my_md5.h +index 452676e..4f89105 100644 +--- a/include/my_md5.h ++++ b/include/my_md5.h +@@ -43,7 +43,11 @@ static inline void array_to_hex(char *to, const unsigned char *str, uint len) + *to++= _dig_vec_lower[((uchar) *str) & 0x0F]; + } + } +- ++#ifdef WITH_WSREP ++void *wsrep_md5_init(); ++void wsrep_md5_update(void *ctx, char* buf, int len); ++ void wsrep_compute_md5_hash(char *digest, void *ctx); ++#endif + #ifdef __cplusplus + } + #endif +diff --git a/include/thr_lock.h b/include/thr_lock.h +index c5638ec..6b0741f 100644 +--- a/include/thr_lock.h ++++ b/include/thr_lock.h +@@ -20,6 +20,15 @@ + #ifdef __cplusplus + extern "C" { + #endif ++#ifdef WITH_WSREP ++#include ++ typedef my_bool (* wsrep_thd_is_brute_force_fun)(void *, my_bool); ++ typedef int (* wsrep_abort_thd_fun)(void *, void *, my_bool); ++ typedef int (* wsrep_on_fun)(void *); ++ void wsrep_thr_lock_init( ++ wsrep_thd_is_brute_force_fun bf_fun, wsrep_abort_thd_fun abort_fun, ++ my_bool debug, my_bool convert_LOCK_to_trx, wsrep_on_fun on_fun); ++#endif + + #include + #include +@@ -89,6 +98,10 @@ typedef struct st_thr_lock_info + { + pthread_t thread; + my_thread_id thread_id; ++#ifdef WITH_WSREP ++ void *mysql_thd; // THD pointer ++ my_bool in_lock_tables; // true, if inside locking session ++#endif + } THR_LOCK_INFO; + + +diff --git a/mysql-test/collections/default.experimental b/mysql-test/collections/default.experimental +index 2519428..1cfa4c5 100644 +--- a/mysql-test/collections/default.experimental ++++ b/mysql-test/collections/default.experimental +@@ -21,9 +21,3 @@ rpl.rpl_gtid_logs_without_rotate_or_stop_event @windows # Bug#16207800 2013-0 + perfschema.socket_summary_by_instance_func # bug#16274580 + innodb.innodb_bug14676111 # bug#17026780 2013-07-08 anitha Originally made experimental due to bug#16371942 which is now fixed. Now fails with mismatch in CLUST_INDEX_SIZE + +-# This file is for marking internal tests as experimental. +-# Use the same way as the "normal" default.experimental +-# The contents of this file will be appended to it in PB2 but not for +-# normal developer builds. +-# Internal tests should *not* be listed in the public default.experimental! +- +diff --git a/mysql-test/collections/default.release b/mysql-test/collections/default.release +deleted file mode 100644 +index 9ac7af5..0000000 +--- a/mysql-test/collections/default.release ++++ /dev/null +@@ -1,16 +0,0 @@ +-# This file contains the old default.release, the plan is to replace that +-# with something like the below (remove space after #): +-# include default.daily +-# include default.weekly +-perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=debug --vardir=var-debug --skip-rpl --report-features --debug-server +-perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=normal --vardir=var-normal --report-features --unit-tests +-perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=ps --vardir=var-ps --ps-protocol +-perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=funcs1+ps --vardir=var-funcs_1_ps --suite=funcs_1 --ps-protocol +-perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=funcs2 --vardir=var-funcs2 --suite=funcs_2 +-perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=partitions --vardir=var-parts --suite=parts +-perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=stress --vardir=var-stress --suite=stress +-perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=jp --vardir=var-jp --suite=jp +-perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=embedded --vardir=var-embedded --embedded-server --skip-rpl +-perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=nist --vardir=var-nist --suite=nist +-perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=nist+ps --vardir=var-nist_ps --suite=nist --ps-protocol +-perl mysql-test-run.pl --timer --force --comment=memcached --vardir=var-memcached --experimental=collections/default.experimental --parallel=auto --retry=0 --suite=memcached +diff --git a/mysql-test/collections/default.release.done b/mysql-test/collections/default.release.done +deleted file mode 100644 +index 3d1016b..0000000 +--- a/mysql-test/collections/default.release.done ++++ /dev/null +@@ -1 +0,0 @@ +-/export/home/pb2/build/sb_0-14135359-1421674846.01/mysql-5.6.23-release-export-7480611_gpl/mysql-test/collections/default.release.in +diff --git a/mysql-test/extra/binlog_tests/binlog.test b/mysql-test/extra/binlog_tests/binlog.test +index 8a36566..c332c01 100644 +--- a/mysql-test/extra/binlog_tests/binlog.test ++++ b/mysql-test/extra/binlog_tests/binlog.test +@@ -337,7 +337,8 @@ dfLtTBcBAAAAIgAAAPkAAAAAABcAAAAAAAcAAf/+AQAAAA== + + SELECT * FROM t1; + --echo # Their values should be ON +-SHOW SESSION VARIABLES LIKE "%_checks"; ++SHOW SESSION VARIABLES LIKE "foreign_key_checks"; ++SHOW SESSION VARIABLES LIKE "unique_checks"; + + --echo + SET @@SESSION.foreign_key_checks= OFF; +@@ -352,7 +353,8 @@ dfLtTBcBAAAAIgAAAM0BAAAAABcAAAAAAAEAAf/+AgAAAA== + + SELECT * FROM t1; + --echo # Their values should be OFF +-SHOW SESSION VARIABLES LIKE "%_checks"; ++SHOW SESSION VARIABLES LIKE "foreign_key_checks"; ++SHOW SESSION VARIABLES LIKE "unique_checks"; + + --echo # INSERT INTO t1 VALUES(2) + --echo # foreign_key_checks=1 and unique_checks=1 +@@ -366,7 +368,8 @@ dfLtTBcBAAAAIgAAAM0BAAAAABcAAAAAAAEAAf/+AgAAAA== + + SELECT * FROM t1; + --echo # Their values should be OFF +-SHOW SESSION VARIABLES LIKE "%_checks"; ++SHOW SESSION VARIABLES LIKE "foreign_key_checks"; ++SHOW SESSION VARIABLES LIKE "unique_checks"; + + DROP TABLE t1; + +diff --git a/mysql-test/include/check-testcase.test b/mysql-test/include/check-testcase.test +index fe5c756..6ef3aec 100644 +--- a/mysql-test/include/check-testcase.test ++++ b/mysql-test/include/check-testcase.test +@@ -6,6 +6,7 @@ + # tescase. In that way, it is possible to check that a testcase does + # not have any unwanted side affects. + ++--source include/wait_until_connected_again.inc + --disable_query_log + + # We want to ensure all slave configuration is restored. But SHOW +diff --git a/mysql-test/include/default_mysqld.cnf b/mysql-test/include/default_mysqld.cnf +index cecd4a6..1c98245 100644 +--- a/mysql-test/include/default_mysqld.cnf ++++ b/mysql-test/include/default_mysqld.cnf +@@ -34,7 +34,7 @@ loose-innodb_lru_scan_depth= 100 + loose-innodb_write_io_threads= 2 + loose-innodb_read_io_threads= 2 + loose-innodb_log_buffer_size= 1M +-loose-innodb_log_file_size= 5M ++innodb_log_file_size= 5M + loose-innodb_additional_mem_pool_size= 1M + loose-innodb_log_files_in_group= 2 + +diff --git a/mysql-test/include/galera_cluster.inc b/mysql-test/include/galera_cluster.inc +new file mode 100644 +index 0000000..bc65222 +--- /dev/null ++++ b/mysql-test/include/galera_cluster.inc +@@ -0,0 +1,10 @@ ++# galera_cluster.inc ++# ================== ++# ++# Description ++# ----------- ++# Configure galera cluster with 2 nodes. ++# ++ ++--let $galera_cluster_size = 2 ++--source include/galera_init.inc +diff --git a/mysql-test/include/galera_connect.inc b/mysql-test/include/galera_connect.inc +new file mode 100644 +index 0000000..bfd9b18 +--- /dev/null ++++ b/mysql-test/include/galera_connect.inc +@@ -0,0 +1,45 @@ ++# galera_connect.inc ++# ================== ++# ++# Description ++# ----------- ++# Open a connection to the specified server number ($galera_server_number). ++# The connection itself would be identified by $galera_connection_name. ++# ++# Parameters ++# ---------- ++# $galera_connection_name ++# Name of the resulting connection. ++# ++# $galera_server_number ++# Sequence number of the node in the galera cluster. ++# ++# $galera_debug ++# Print debug information. ++# ++ ++if (!$galera_connection_name) ++{ ++ --die ERROR IN TEST: $galera_connection_name must be set before sourcing include/galera_connect.inc ++} ++ ++if (!$galera_server_number) ++{ ++ --die ERROR IN TEST: $galera_server_number must be set before sourcing include/galera_connect.inc ++} ++ ++--let $_galera_port= \$NODE_MYPORT_$galera_server_number ++if (!$_galera_port) ++{ ++ --echo Bug in test case: '\$NODE_MYPORT_$galera_server_number' not initialized. Check the test's .cfg file. ++ --die Not all NODE_MYPORT_* environment variables are setup correctly. ++} ++ ++if ($galera_debug) ++{ ++ --echo connect($galera_connection_name,127.0.0.1,root,,test,$_galera_port,) ++} ++ ++# Open a connection ++--connect($galera_connection_name,127.0.0.1,root,,test,$_galera_port,) ++ +diff --git a/mysql-test/include/galera_diff.inc b/mysql-test/include/galera_diff.inc +new file mode 100644 +index 0000000..6043b58 +--- /dev/null ++++ b/mysql-test/include/galera_diff.inc +@@ -0,0 +1,100 @@ ++# galera_diff.inc ++# =============== ++# ++# Description ++# ----------- ++# Compare the output of the given statement on all the nodes of the cluster. ++# ++# Parameters ++# ---------- ++# $galera_diff_statement ++# Statement for which the output would be compared. ++# ++# $galera_diff_database ++# Database against which the above statement would be executed. ++# (Default : test) ++# ++# $galera_diff_servers ++# Comma separated list of servers to executed the diff statement on. If not ++# set, a list of servers will be generated based on $galera_cluster_size. ++# ++# $galerra_debug ++# Print debug information. ++# ++ ++if (!$galera_diff_statement) ++{ ++ --die ERROR IN TEST: $galera_diff_statement must be set before sourcing include/galera_diff.inc ++} ++ ++--let $_galera_diff_database = $galera_diff_database ++if (!$_galera_diff_database) ++{ ++ --let $_galera_diff_database = test ++} ++ ++--let $_galera_diff_servers= $galera_diff_servers ++if (!$_galera_diff_servers) ++{ ++ --let $_i= $galera_cluster_size ++ --let $_galera_diff_servers= ++ while ($_i) ++ { ++ --let $_galera_diff_servers= $_i,$_galera_diff_servers ++ --dec $_i ++ } ++} ++if ($galera_debug) ++{ ++ --echo \$galera_diff_servers= '$_galera_diff_servers' ++} ++ ++if (!$galera_debug) ++{ ++ --disable_query_log ++} ++ ++# Generate file containing $galera_diff_statement. We don't pass the ++# statement on the command line, because it would be subject to shell ++# substitutions. ++--let $write_to_file= GENERATE ++--let $write_var= $galera_diff_statement ++--source include/write_var_to_file.inc ++--let $_galera_diff_statement_file= $write_to_file ++ ++if (!$galera_debug) ++{ ++ --enable_query_log ++} ++ ++# Compare all servers. ++--let $_galera_diff_first= 1 ++while ($_galera_diff_servers) ++{ ++ # Set $_galera_diff_server_i to the first number in the list ++ --let $_galera_diff_server_i= `SELECT SUBSTRING_INDEX('$_galera_diff_servers', ',', 1)` ++ # Remove $_galera_diff_server_i from the list ++ --let $_galera_diff_servers= `SELECT SUBSTRING('$_galera_diff_servers', LENGTH('$_galera_diff_server_i') + 2)` ++ ++ # Execute statement ++ --let $_galera_diff_file= $MYSQLTEST_VARDIR/tmp/_galera_diff_server-$_galera_diff_server_i.tmp ++ --exec $MYSQL --defaults-group-suffix=.$_galera_diff_server_i $_galera_diff_database < $_galera_diff_statement_file > $_galera_diff_file ++ ++ # Compare ++ if (!$_galera_diff_first) ++ { ++ if ($galera_debug) ++ { ++ --echo diffing $_galera_diff_file and $_galera_diff_prev_file ++ } ++ --diff_files $_galera_diff_file $_galera_diff_prev_file ++ --remove_file $_galera_diff_prev_file ++ } ++ --let $_galera_diff_prev_file= $_galera_diff_file ++ --let $_galera_diff_first= 0 ++} ++ ++# Cleanup ++--remove_file $_galera_diff_prev_file ++--remove_file $_galera_diff_statement_file ++ +diff --git a/mysql-test/include/galera_end.inc b/mysql-test/include/galera_end.inc +new file mode 100644 +index 0000000..0fb5479 +--- /dev/null ++++ b/mysql-test/include/galera_end.inc +@@ -0,0 +1,25 @@ ++# galera_end.inc ++# ============== ++# ++# Description ++# ----------- ++# Closes the connections opened via include/galera_init.inc ++# ++# Parameters ++# ---------- ++# $galera_cluster_size ++# Number of nodes in the cluster. ++# ++ ++--let $_galera_node= $galera_cluster_size ++ ++while ($_galera_node) ++{ ++ if ($galera_debug) ++ { ++ --echo Disconnecting node_$_galera_node ++ } ++ --disconnect node_$_galera_node ++ --dec $_galera_node ++} ++ +diff --git a/mysql-test/include/galera_init.inc b/mysql-test/include/galera_init.inc +new file mode 100644 +index 0000000..7c79d6f +--- /dev/null ++++ b/mysql-test/include/galera_init.inc +@@ -0,0 +1,27 @@ ++# galera_init.inc ++# =============== ++# ++# Description ++# ----------- ++# Set up a Galera cluster with $wsrep_cluster_size nodes. ++# ++# Parameters ++# ---------- ++# $galera_cluster_size ++# Number of nodes in the cluster. ++# ++ ++--source include/have_wsrep_provider.inc ++--source include/have_wsrep_enabled.inc ++ ++--let $_galera_node= $galera_cluster_size ++ ++while ($_galera_node) ++{ ++ --let $galera_connection_name= node_$_galera_node ++ --let $galera_server_number= $_galera_node ++ --source include/galera_connect.inc ++ ++ --dec $_galera_node ++} ++ +diff --git a/mysql-test/include/galera_resume.inc b/mysql-test/include/galera_resume.inc +new file mode 100644 +index 0000000..232cb46 +--- /dev/null ++++ b/mysql-test/include/galera_resume.inc +@@ -0,0 +1,9 @@ ++--echo Resuming node ... ++--perl ++ my $pid_filename = $ENV{'_SUSPEND_NODE_PIDFILE'}; ++ my $mysqld_pid = `cat $pid_filename`; ++ chomp($mysqld_pid); ++ system("kill -18 $mysqld_pid"); ++ exit(0); ++EOF ++ +diff --git a/mysql-test/include/galera_suspend.inc b/mysql-test/include/galera_suspend.inc +new file mode 100644 +index 0000000..3495ad2 +--- /dev/null ++++ b/mysql-test/include/galera_suspend.inc +@@ -0,0 +1,14 @@ ++# ++# This macro suspends the current node ++# ++ ++--let _SUSPEND_NODE_PIDFILE = `SELECT @@pid_file` ++--echo Suspending node ... ++ ++--perl ++ my $pid_filename = $ENV{'_SUSPEND_NODE_PIDFILE'}; ++ my $mysqld_pid = `cat $pid_filename`; ++ chomp($mysqld_pid); ++ system("kill -19 $mysqld_pid"); ++ exit(0); ++EOF +diff --git a/mysql-test/include/galera_wait_ready.inc b/mysql-test/include/galera_wait_ready.inc +new file mode 100644 +index 0000000..5652538 +--- /dev/null ++++ b/mysql-test/include/galera_wait_ready.inc +@@ -0,0 +1,3 @@ ++let $wait_timeout = 10; ++let $wait_condition = SELECT 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready' AND VARIABLE_VALUE = 'ON'; ++--source include/wait_condition.inc +diff --git a/mysql-test/include/have_wsrep.inc b/mysql-test/include/have_wsrep.inc +new file mode 100644 +index 0000000..52220ed +--- /dev/null ++++ b/mysql-test/include/have_wsrep.inc +@@ -0,0 +1,8 @@ ++# To be used in a test which requires server to be compiled with wsrep support ++# (-DWITH_WSREP=ON) and wsrep plugin is ACTIVE. ++ ++if (`SELECT COUNT(*)=0 FROM INFORMATION_SCHEMA.PLUGINS WHERE PLUGIN_NAME = 'wsrep' AND PLUGIN_STATUS='ACTIVE'`) ++{ ++ --skip Test requires wsrep plugin. ++} ++ +diff --git a/mysql-test/include/have_wsrep_enabled.inc b/mysql-test/include/have_wsrep_enabled.inc +new file mode 100644 +index 0000000..1b5948f +--- /dev/null ++++ b/mysql-test/include/have_wsrep_enabled.inc +@@ -0,0 +1,10 @@ ++ ++# To be used in a test which requires wsrep plugin to be ACTIVE and enabled ++# (i.e. wsrep_on=ON). It includes have_wsrep.inc. ++ ++--source include/have_wsrep.inc ++ ++--require r/have_wsrep.require ++--disable_query_log ++SHOW VARIABLES LIKE 'wsrep_on'; ++--enable_query_log +diff --git a/mysql-test/include/have_wsrep_provider.inc b/mysql-test/include/have_wsrep_provider.inc +new file mode 100644 +index 0000000..bb5cbc0 +--- /dev/null ++++ b/mysql-test/include/have_wsrep_provider.inc +@@ -0,0 +1,6 @@ ++if (`SELECT COUNT(*)=0 FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE ++ VARIABLE_NAME LIKE 'wsrep_provider' AND VARIABLE_VALUE NOT LIKE 'none'`) ++{ ++ --skip Test requires wsrep provider library (libgalera_smm.so). Did you set $WSREP_PROVIDER? ++} ++ +diff --git a/mysql-test/include/kill_galera.inc b/mysql-test/include/kill_galera.inc +new file mode 100644 +index 0000000..d7f665d +--- /dev/null ++++ b/mysql-test/include/kill_galera.inc +@@ -0,0 +1,20 @@ ++--echo Killing server ... ++ ++# Write file to make mysql-test-run.pl expect the crash, but don't start it ++--let $_server_id= `SELECT @@server_id` ++--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.$_server_id.expect ++--exec echo "wait" > $_expect_file_name ++ ++# Kill the connected server ++--disable_reconnect ++--let KILL_NODE_PIDFILE = `SELECT @@pid_file` ++ ++--perl ++ my $pid_filename = $ENV{'KILL_NODE_PIDFILE'}; ++ my $mysqld_pid = `cat $pid_filename`; ++ chomp($mysqld_pid); ++ system("kill -9 $mysqld_pid"); ++ exit(0); ++EOF ++ ++--source include/wait_until_disconnected.inc +diff --git a/mysql-test/include/mtr_check.sql b/mysql-test/include/mtr_check.sql +index 3bd2583..560dd96 100644 +--- a/mysql-test/include/mtr_check.sql ++++ b/mysql-test/include/mtr_check.sql +@@ -60,15 +60,23 @@ BEGIN + + -- Dump all global variables except those that may change. + -- timestamp changes if time passes. server_uuid changes if server restarts. ++ -- wsrep_start_position can change on mysqldump SST ++ -- auto_increment_offset can change on cluster reconfigurations + SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES + WHERE variable_name NOT IN ('timestamp', 'server_uuid', + 'innodb_file_format_max', +- 'gtid_executed', 'gtid_purged') ++ 'gtid_executed', 'gtid_purged', ++ 'wsrep_start_position', ++ 'auto_increment_offset', ++ 'auto_increment_increment', ++ 'wsrep_data_home_dir') + ORDER BY VARIABLE_NAME; + + -- Dump all databases, there should be none + -- except those that was created during bootstrap +- SELECT * FROM INFORMATION_SCHEMA.SCHEMATA; ++ -- and the mtr_wsrep_notify schema which is populated by the std_data/wsrep_notify.sh script ++ -- and the suite/galera/t/galera_var_notify_cmd.test ++ SELECT * FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME != 'mtr_wsrep_notify'; + + -- The test database should not contain any tables + SELECT table_name AS tables_in_test FROM INFORMATION_SCHEMA.TABLES +diff --git a/mysql-test/include/mtr_warnings.sql b/mysql-test/include/mtr_warnings.sql +index 9de3058..3b7f559 100644 +--- a/mysql-test/include/mtr_warnings.sql ++++ b/mysql-test/include/mtr_warnings.sql +@@ -246,6 +246,40 @@ INSERT INTO global_suppressions VALUES + ("Changed limits: table_cache: *"), + ("Could not increase number of max_open_files to more than *"), + ++ /* ++ Galera suppressions ++ */ ++ ("WSREP:*down context*"), ++ ("WSREP: Failed to send state UUID:*"), ++ ("WSREP: wsrep_sst_receive_address is set to '127.0.0.1"), ++ ("WSREP: option --wsrep-casual-reads is deprecated"), ++ ("WSREP: --wsrep-casual-reads=ON takes precedence over --wsrep-sync-wait=0"), ++ ("WSREP: Could not open saved state file for reading: "), ++ ("WSREP: access file\\(.*gvwstate\\.dat\\) failed\\(No such file or directory\\)"), ++ ("WSREP: Gap in state sequence\\. Need state transfer\\."), ++ ("WSREP: Failed to prepare for incremental state transfer: Local state UUID \\(00000000-0000-0000-0000-000000000000\\) does not match group state UUID"), ++ ("WSREP: No existing UUID has been found, so we assume that this is the first time that this server has been started\\. Generating a new UUID: "), ++ ("WSREP: last inactive check more than"), ++ ("WSREP: binlog cache not empty \\(0 bytes\\) at connection close"), ++ ("WSREP: SQL statement was ineffective"), ++ ("WSREP: Refusing exit for the last slave thread"), ++ ("WSREP: Quorum: No node with complete state"), ++ ("WSREP: Failed to report last committed"), ++ ("Slave SQL: Error 'Duplicate entry"), ++ ("Query apply warning:"), ++ ("WSREP: Ignoring error for TO isolated action:"), ++ ("WSREP: Initial position was provided by configuration or SST, avoiding override"), ++ ("Warning: Using a password on the command line interface can be insecure"), ++ ("InnoDB: Error: Table \"mysql\"\\.\"innodb_table_stats\" not found"), ++ ("but it is impossible to select State Transfer donor: Resource temporarily unavailable"), ++ ("WSREP: Could not find peer"), ++ ("WSREP: discarding established \\(time wait\\)"), ++ ("sending install message failed: Resource temporarily unavailable"), ++ ("WSREP: Ignoring possible split-brain \\(allowed by configuration\\) from view"), ++ ("WSREP: no nodes coming from prim view, prim not possible"), ++ ("WSREP: Failed to prepare for incremental state transfer: Local state seqno is undefined:"), ++ ("WSREP: gcs_caused\\(\\) returned -107 \\(Transport endpoint is not connected\\)"), ++ + ("THE_LAST_SUPPRESSION")|| + + +@@ -292,7 +326,17 @@ BEGIN + END IF; + + -- Cleanup for next test +- TRUNCATE test_suppressions; ++ IF @@wsrep_on = 1 THEN ++ -- The TRUNCATE should not be replicated under Galera ++ -- as it causes the custom suppressions on the other ++ -- nodes to be deleted as well ++ SET wsrep_on = 0; ++ TRUNCATE test_suppressions; ++ SET wsrep_on = 1; ++ ELSE ++ TRUNCATE test_suppressions; ++ END IF; ++ + DROP TABLE error_log; + + END|| +diff --git a/mysql-test/include/mysqld--help.inc b/mysql-test/include/mysqld--help.inc +index e156cfd..8b3b387 100644 +--- a/mysql-test/include/mysqld--help.inc ++++ b/mysql-test/include/mysqld--help.inc +@@ -18,7 +18,7 @@ perl; + # their paths may vary: + @skipvars=qw/basedir open-files-limit general-log-file plugin-dir + pid-file slow-query-log-file +- datadir slave-load-tmpdir tmpdir socket table-definition-cache table-open-cache/; ++ datadir slave-load-tmpdir tmpdir socket table-definition-cache table-open-cache wsrep-node-name/; + + # Plugins which may or may not be there: + @plugins=qw/innodb ndb ndbinfo archive blackhole federated partition ndbcluster debug temp-pool ssl des-key-file +diff --git a/mysql-test/include/not_wsrep.inc b/mysql-test/include/not_wsrep.inc +new file mode 100644 +index 0000000..3314b5c +--- /dev/null ++++ b/mysql-test/include/not_wsrep.inc +@@ -0,0 +1,7 @@ ++# To be used in a test which should be skipped if server is compiled with wsrep ++# support (-DWITH_WSREP=ON) and wsrep plugin is ACTIVE. ++ ++-- require r/not_wsrep.require ++disable_query_log; ++SELECT VERSION() LIKE '%wsrep%' AS 'HAVE_WSREP'; ++enable_query_log; +diff --git a/mysql-test/include/start_mysqld.inc b/mysql-test/include/start_mysqld.inc +index 983c566..4ee3d17 100644 +--- a/mysql-test/include/start_mysqld.inc ++++ b/mysql-test/include/start_mysqld.inc +@@ -1,7 +1,16 @@ + # Include this script only after using shutdown_mysqld.inc + # where $_expect_file_name was initialized. + # Write file to make mysql-test-run.pl start up the server again +---exec echo "restart" > $_expect_file_name ++ ++if ($galera_wsrep_start_position != '') { ++ --echo Using --wsrep-start-position when starting mysqld ... ++ --exec echo "restart:$start_mysqld_params --wsrep-start-position=$galera_wsrep_start_position" > $_expect_file_name ++ --let $galera_wsrep_start_position = 0 ++} ++ ++if ($galera_wsrep_start_position == '') { ++ --exec echo "restart:$start_mysqld_params" > $_expect_file_name ++} + + # Turn on reconnect + --enable_reconnect +@@ -11,4 +20,3 @@ + + # Turn off reconnect again + --disable_reconnect +- +diff --git a/mysql-test/include/wait_until_connected_again.inc b/mysql-test/include/wait_until_connected_again.inc +index c7bb774..005d518 100644 +--- a/mysql-test/include/wait_until_connected_again.inc ++++ b/mysql-test/include/wait_until_connected_again.inc +@@ -1,23 +1,34 @@ + # + # Include this script to wait until the connection to the + # server has been restored or timeout occurs ++ ++# ++# We require two consequtive connection successes in order to ++# work around a race condition on Galera startup where the server ++# can temporarily accept queries before starting to reject them again ++# ++ + --disable_result_log + --disable_query_log + let $counter= 500; + let $mysql_errno= 9999; +-while ($mysql_errno) +-{ +- # Strangely enough, the server might return "Too many connections" +- # while being shutdown, thus 1040 is an "allowed" error +- # See BUG#36228 +- --error 0,1040,1053,2002,2003,2006,2013 +- show status; ++let $successes= 2; ++ ++while ($successes) { ++ while ($mysql_errno) { ++ # Strangely enough, the server might return "Too many connections" ++ # while being shutdown, thus 1040 is an "allowed" error ++ # See BUG#36228 ++ --error 0,1040,1047,1053,1205,2002,2003,2006,2013,1205 ++ show status; + +- dec $counter; +- if (!$counter) +- { +- --die Server failed to restart ++ --dec $counter ++ if (!$counter) { ++ --die Server failed to restart ++ } ++ --sleep 0.1 + } ++ --dec $successes + --sleep 0.1 + } + --enable_query_log +diff --git a/mysql-test/include/wait_until_disconnected.inc b/mysql-test/include/wait_until_disconnected.inc +index 8a989be..56889d1 100644 +--- a/mysql-test/include/wait_until_disconnected.inc ++++ b/mysql-test/include/wait_until_disconnected.inc +@@ -7,7 +7,7 @@ let $counter= 500; + let $mysql_errno= 0; + while (!$mysql_errno) + { +- --error 0,1040,1053,2002,2003,2006,2013 ++ --error 0,1040,1047,1053,2002,2003,2006,2013 + show status; + + dec $counter; +diff --git a/mysql-test/include/write_var_to_file.inc b/mysql-test/include/write_var_to_file.inc +index 8bb9e72..6ee04c7 100644 +--- a/mysql-test/include/write_var_to_file.inc ++++ b/mysql-test/include/write_var_to_file.inc +@@ -54,7 +54,7 @@ if (`SELECT LENGTH(@@secure_file_priv) > 0`) + --copy_file $_wvtf_tmp_file $write_to_file + --remove_file $_wvtf_tmp_file + } +-if (`SELECT LENGTH(@@secure_file_priv) = 0`) ++if (`SELECT LENGTH(@@secure_file_priv) = 0 OR LENGTH(@@secure_file_priv) IS NULL`) + { + --eval SELECT '$write_var' INTO DUMPFILE '$write_to_file' + } +diff --git a/mysql-test/lib/My/Config.pm b/mysql-test/lib/My/Config.pm +index 535df07..642ee0a 100644 +--- a/mysql-test/lib/My/Config.pm ++++ b/mysql-test/lib/My/Config.pm +@@ -178,6 +178,36 @@ sub if_exist { + return $option->value(); + } + ++package My::Config::Group::ENV; ++our @ISA=qw(My::Config::Group); ++ ++use strict; ++use warnings; ++use Carp; ++ ++sub new { ++ my ($class, $group_name)= @_; ++ bless My::Config::Group->new($group_name), $class; ++} ++ ++# ++# Return value for an option in the group, fail if it does not exist ++# ++sub value { ++ my ($self, $option_name)= @_; ++ my $option= $self->option($option_name); ++ ++ if (! defined($option) and defined $ENV{$option_name}) { ++ my $value= $ENV{$option_name}; ++ $option= My::Config::Option->new($option_name, $value); ++ } ++ ++ croak "No option named '$option_name' in group '$self->{name}'" ++ if ! defined($option); ++ ++ return $option->value(); ++} ++ + + package My::Config; + +@@ -197,7 +227,9 @@ sub new { + my ($class, $path)= @_; + my $group_name= undef; + +- my $self= bless { groups => [] }, $class; ++ my $self= bless { groups => [ ++ My::Config::Group::ENV->new('ENV') ++ ] }, $class; + my $F= IO::File->new($path, "<") + or croak "Could not open '$path': $!"; + +diff --git a/mysql-test/lib/My/ConfigFactory.pm b/mysql-test/lib/My/ConfigFactory.pm +index bf2a8fa..fca7f9d 100644 +--- a/mysql-test/lib/My/ConfigFactory.pm ++++ b/mysql-test/lib/My/ConfigFactory.pm +@@ -1,5 +1,5 @@ + # -*- cperl -*- +-# Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved. ++# Copyright (c) 2007, 2011, Oracle and/or its affiliates + # + # This program is free software; you can redistribute it and/or + # modify it under the terms of the GNU Library General Public +@@ -31,12 +31,22 @@ use File::Basename; + # + # Rules to run first of all + # ++ ++sub add_opt_values { ++ my ($self, $config)= @_; ++ ++ # add auto-options ++ $config->insert('OPT', 'port' => sub { fix_port($self, $config) }); ++ $config->insert('mysqld', "loose-skip-plugin-$_" => undef) for (@::optional_plugins); ++} ++ + my @pre_rules= + ( ++ \&add_opt_values, + ); + + +-my @share_locations= ("share/mysql", "sql/share", "share"); ++my @share_locations= ("share/mariadb", "share/mysql", "sql/share", "share"); + + + sub get_basedir { +@@ -89,16 +99,12 @@ sub fix_pidfile { + + sub fix_port { + my ($self, $config, $group_name, $group)= @_; +- my $hostname= $group->value('#host'); +- return $self->{HOSTS}->{$hostname}++; ++ return $self->{PORT}++; + } + + sub fix_host { + my ($self)= @_; +- # Get next host from HOSTS array +- my @hosts= keys(%{$self->{HOSTS}});; +- my $host_no= $self->{NEXT_HOST}++ % @hosts; +- return $hosts[$host_no]; ++ 'localhost' + } + + sub is_unique { +@@ -169,13 +175,6 @@ sub fix_log_slow_queries { + return "$dir/mysqld-slow.log"; + } + +-sub fix_secure_file_priv { +- my ($self)= @_; +- my $vardir= $self->{ARGS}->{vardir}; +- # By default, prevent the started mysqld to access files outside of vardir +- return $vardir; +-} +- + sub fix_std_data { + my ($self, $config, $group_name, $group)= @_; + my $testdir= $self->get_testdir($group); +@@ -239,12 +238,18 @@ my @mysqld_rules= + { 'pid-file' => \&fix_pidfile }, + { '#host' => \&fix_host }, + { 'port' => \&fix_port }, ++ # galera base_port and port used during SST ++ { '#galera_port' => \&fix_port }, ++ # Galera uses base_port + 1 for IST, so we do not use it for things such as SST ++ { '#ist_port' => \&fix_port }, ++ { '#sst_port' => \&fix_port }, + { 'socket' => \&fix_socket }, + { '#log-error' => \&fix_log_error }, +- { 'general_log' => 1 }, +- { 'general_log_file' => \&fix_log }, +- { 'slow_query_log' => 1 }, +- { 'slow_query_log_file' => \&fix_log_slow_queries }, ++ { 'general-log' => 1 }, ++ { 'plugin-dir' => sub { $::plugindir } }, ++ { 'general-log-file' => \&fix_log }, ++ { 'slow-query-log' => 1 }, ++ { 'slow-query-log-file' => \&fix_log_slow_queries }, + { '#user' => sub { return shift->{ARGS}->{user} || ""; } }, + { '#password' => sub { return shift->{ARGS}->{password} || ""; } }, + { 'server-id' => \&fix_server_id, }, +@@ -265,7 +270,7 @@ if (IS_WINDOWS) + sub fix_ndb_mgmd_port { + my ($self, $config, $group_name, $group)= @_; + my $hostname= $group->value('HostName'); +- return $self->{HOSTS}->{$hostname}++; ++ return $self->{PORT}++; + } + + +@@ -307,8 +312,6 @@ my @ndbd_rules= + { 'BackupDataDir' => \&fix_cluster_backup_dir }, + ); + +- +-# + # Rules to run for each memcached in the config + # - will be run in order listed here + # +@@ -396,7 +399,7 @@ sub post_check_client_group { + + if (! defined $option){ + #print $config; +- croak "Could not get value for '$name_from'"; ++ croak "Could not get value for '$name_from' for test $self->{testname}"; + } + $config->insert($client_group_name, $name_to, $option->value()) + } +@@ -419,7 +422,7 @@ sub post_check_client_group { + sub post_check_client_groups { + my ($self, $config)= @_; + +- my $first_mysqld= $config->first_like('mysqld.'); ++ my $first_mysqld= $config->first_like('mysqld\.'); + + return unless $first_mysqld; + +@@ -455,7 +458,7 @@ sub post_check_embedded_group { + my $first_mysqld= $config->first_like('mysqld.') or + croak "Can't run with embedded, config has no mysqld"; + +- my @no_copy = ++ my %no_copy = map { $_ => 1 } + ( + '#log-error', # Embedded server writes stderr to mysqltest's log file + 'slave-net-timeout', # Embedded server are not build with replication +@@ -464,7 +467,7 @@ sub post_check_embedded_group { + + foreach my $option ( $mysqld->options(), $first_mysqld->options() ) { + # Don't copy options whose name is in "no_copy" list +- next if grep ( $option->name() eq $_, @no_copy); ++ next if $no_copy{$option->name()}; + + $config->insert('embedded', $option->name(), $option->value()) + } +@@ -474,20 +477,24 @@ sub post_check_embedded_group { + + sub resolve_at_variable { + my ($self, $config, $group, $option)= @_; ++ local $_ = $option->value(); ++ my ($res, $after); + +- # Split the options value on last . +- my @parts= split(/\./, $option->value()); +- my $option_name= pop(@parts); +- my $group_name= join('.', @parts); +- +- $group_name =~ s/^\@//; # Remove at ++ while (m/(.*?)\@((?:\w+\.)+)(#?[-\w]+)/g) { ++ my ($before, $group_name, $option_name)= ($1, $2, $3); ++ $after = $'; ++ chop($group_name); + + my $from_group= $config->group($group_name) + or croak "There is no group named '$group_name' that ", +- "can be used to resolve '$option_name'"; ++ "can be used to resolve '$option_name' for test '$self->{testname}'"; + +- my $from= $from_group->value($option_name); +- $config->insert($group->name(), $option->name(), $from) ++ my $value= $from_group->value($option_name); ++ $res .= $before.$value; ++ } ++ $res .= $after; ++ ++ $config->insert($group->name(), $option->name(), $res) + } + + +@@ -499,7 +506,7 @@ sub post_fix_resolve_at_variables { + next unless defined $option->value(); + + $self->resolve_at_variable($config, $group, $option) +- if ($option->value() =~ /^\@/); ++ if ($option->value() =~ /\@/); + } + } + } +@@ -641,37 +648,21 @@ sub new_config { + croak "you must pass '$required'" unless defined $args->{$required}; + } + +- # Fill in hosts/port hash +- my $hosts= {}; +- my $baseport= $args->{baseport}; +- $args->{hosts}= [ 'localhost' ] unless exists($args->{hosts}); +- foreach my $host ( @{$args->{hosts}} ) { +- $hosts->{$host}= $baseport; +- } +- + # Open the config template + my $config= My::Config->new($args->{'template_path'}); +- my $extra_template_path= $args->{'extra_template_path'}; +- if ($extra_template_path){ +- $config->append(My::Config->new($extra_template_path)); +- } + my $self= bless { + CONFIG => $config, + ARGS => $args, +- HOSTS => $hosts, +- NEXT_HOST => 0, ++ PORT => $args->{baseport}, + SERVER_ID => 1, ++ testname => $args->{testname}, + }, $class; + +- +- { +- # Run pre rules +- foreach my $rule ( @pre_rules ) { +- &$rule($self, $config); +- } ++ # Run pre rules ++ foreach my $rule ( @pre_rules ) { ++ &$rule($self, $config); + } + +- + $self->run_section_rules($config, + 'cluster_config\.\w*$', + @cluster_config_rules); +@@ -689,9 +680,9 @@ sub new_config { + @mysqld_rules); + + $self->run_section_rules($config, +- 'memcached.', +- @memcached_rules); +- ++ 'memcached.', ++ @memcached_rules); ++ + # [mysqlbinlog] need additional settings + $self->run_rules_for_group($config, + $config->insert('mysqlbinlog'), +diff --git a/mysql-test/lib/My/ConfigFactory.pm.memcached b/mysql-test/lib/My/ConfigFactory.pm.memcached +new file mode 100644 +index 0000000..0b0e468 +--- /dev/null ++++ b/mysql-test/lib/My/ConfigFactory.pm.memcached +@@ -0,0 +1,718 @@ ++# -*- cperl -*- ++# Copyright (c) 2007, 2011, Oracle and/or its affiliates ++# ++# This program is free software; you can redistribute it and/or ++# modify it under the terms of the GNU Library 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 ++# Library 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 ++ ++package My::ConfigFactory; ++ ++use strict; ++use warnings; ++use Carp; ++ ++use My::Config; ++use My::Find; ++use My::Platform; ++ ++use File::Basename; ++ ++ ++# ++# Rules to run first of all ++# ++ ++sub add_opt_values { ++ my ($self, $config)= @_; ++ ++ # add auto-options ++ $config->insert('OPT', 'port' => sub { fix_port($self, $config) }); ++ $config->insert('mysqld', "loose-skip-plugin-$_" => undef) for (@::optional_plugins); ++} ++ ++my @pre_rules= ++( ++ \&add_opt_values, ++); ++ ++ ++my @share_locations= ("share/mariadb", "share/mysql", "sql/share", "share"); ++ ++ ++sub get_basedir { ++ my ($self, $group)= @_; ++ my $basedir= $group->if_exist('basedir') || ++ $self->{ARGS}->{basedir}; ++ return $basedir; ++} ++ ++sub get_testdir { ++ my ($self, $group)= @_; ++ my $testdir= $group->if_exist('testdir') || ++ $self->{ARGS}->{testdir}; ++ return $testdir; ++} ++ ++# Retrive build directory (which is different from basedir in out-of-source build) ++sub get_bindir { ++ if (defined $ENV{MTR_BINDIR}) ++ { ++ return $ENV{MTR_BINDIR}; ++ } ++ my ($self, $group)= @_; ++ return $self->get_basedir($group); ++} ++ ++sub fix_charset_dir { ++ my ($self, $config, $group_name, $group)= @_; ++ return my_find_dir($self->get_basedir($group), ++ \@share_locations, "charsets"); ++} ++ ++sub fix_language { ++ my ($self, $config, $group_name, $group)= @_; ++ return my_find_dir($self->get_bindir($group), ++ \@share_locations); ++} ++ ++sub fix_datadir { ++ my ($self, $config, $group_name)= @_; ++ my $vardir= $self->{ARGS}->{vardir}; ++ return "$vardir/$group_name/data"; ++} ++ ++sub fix_pidfile { ++ my ($self, $config, $group_name, $group)= @_; ++ my $vardir= $self->{ARGS}->{vardir}; ++ return "$vardir/run/$group_name.pid"; ++} ++ ++sub fix_port { ++ my ($self, $config, $group_name, $group)= @_; ++ return $self->{PORT}++; ++} ++ ++sub fix_host { ++ my ($self)= @_; ++ 'localhost' ++} ++ ++sub is_unique { ++ my ($config, $name, $value)= @_; ++ ++ foreach my $group ( $config->groups() ) { ++ if ($group->option($name)) { ++ if ($group->value($name) eq $value){ ++ return 0; ++ } ++ } ++ } ++ return 1; ++} ++ ++sub fix_server_id { ++ my ($self, $config, $group_name, $group)= @_; ++#define in the order that mysqlds are listed in my.cnf ++ ++ my $server_id= $group->if_exist('server-id'); ++ if (defined $server_id){ ++ if (!is_unique($config, 'server-id', $server_id)) { ++ croak "The server-id($server_id) for '$group_name' is not unique"; ++ } ++ return $server_id; ++ } ++ ++ do { ++ $server_id= $self->{SERVER_ID}++; ++ } while(!is_unique($config, 'server-id', $server_id)); ++ ++ #print "$group_name: server_id: $server_id\n"; ++ return $server_id; ++} ++ ++sub fix_socket { ++ my ($self, $config, $group_name, $group)= @_; ++ # Put socket file in tmpdir ++ my $dir= $self->{ARGS}->{tmpdir}; ++ return "$dir/$group_name.sock"; ++} ++ ++sub fix_tmpdir { ++ my ($self, $config, $group_name, $group)= @_; ++ my $dir= $self->{ARGS}->{tmpdir}; ++ return "$dir/$group_name"; ++} ++ ++sub fix_log_error { ++ my ($self, $config, $group_name, $group)= @_; ++ my $dir= $self->{ARGS}->{vardir}; ++ if ( $::opt_valgrind and $::opt_debug ) { ++ return "$dir/log/$group_name.trace"; ++ } else { ++ return "$dir/log/$group_name.err"; ++ } ++} ++ ++sub fix_log { ++ my ($self, $config, $group_name, $group)= @_; ++ my $dir= dirname($group->value('datadir')); ++ return "$dir/mysqld.log"; ++} ++ ++sub fix_log_slow_queries { ++ my ($self, $config, $group_name, $group)= @_; ++ my $dir= dirname($group->value('datadir')); ++ return "$dir/mysqld-slow.log"; ++} ++ ++sub fix_std_data { ++ my ($self, $config, $group_name, $group)= @_; ++ my $testdir= $self->get_testdir($group); ++ return "$testdir/std_data"; ++} ++ ++sub ssl_supported { ++ my ($self)= @_; ++ return $self->{ARGS}->{ssl}; ++} ++ ++sub fix_skip_ssl { ++ return if !ssl_supported(@_); ++ # Add skip-ssl if ssl is supported to avoid ++ # that mysqltest connects with SSL by default ++ return 1; ++} ++ ++sub fix_ssl_ca { ++ return if !ssl_supported(@_); ++ my $std_data= fix_std_data(@_); ++ return "$std_data/cacert.pem" ++} ++ ++sub fix_ssl_server_cert { ++ return if !ssl_supported(@_); ++ my $std_data= fix_std_data(@_); ++ return "$std_data/server-cert.pem" ++} ++ ++sub fix_ssl_client_cert { ++ return if !ssl_supported(@_); ++ my $std_data= fix_std_data(@_); ++ return "$std_data/client-cert.pem" ++} ++ ++sub fix_ssl_server_key { ++ return if !ssl_supported(@_); ++ my $std_data= fix_std_data(@_); ++ return "$std_data/server-key.pem" ++} ++ ++sub fix_ssl_client_key { ++ return if !ssl_supported(@_); ++ my $std_data= fix_std_data(@_); ++ return "$std_data/client-key.pem" ++} ++ ++ ++# ++# Rules to run for each mysqld in the config ++# - will be run in order listed here ++# ++my @mysqld_rules= ++ ( ++ { 'basedir' => sub { return shift->{ARGS}->{basedir}; } }, ++ { 'tmpdir' => \&fix_tmpdir }, ++ { 'character-sets-dir' => \&fix_charset_dir }, ++ { 'lc-messages-dir' => \&fix_language }, ++ { 'datadir' => \&fix_datadir }, ++ { 'pid-file' => \&fix_pidfile }, ++ { '#host' => \&fix_host }, ++ { 'port' => \&fix_port }, ++ # galera base_port and port used during SST ++ { '#galera_port' => \&fix_port }, ++ { '#sst_port' => \&fix_port }, ++ { '#memcached_port' => \&fix_port }, ++ { 'socket' => \&fix_socket }, ++ { '#log-error' => \&fix_log_error }, ++ { 'general-log' => 1 }, ++ { 'plugin-dir' => sub { $::plugindir } }, ++ { 'general-log-file' => \&fix_log }, ++ { 'slow-query-log' => 1 }, ++ { 'slow-query-log-file' => \&fix_log_slow_queries }, ++ { '#user' => sub { return shift->{ARGS}->{user} || ""; } }, ++ { '#password' => sub { return shift->{ARGS}->{password} || ""; } }, ++ { 'server-id' => \&fix_server_id, }, ++ # By default, prevent the started mysqld to access files outside of vardir ++ { 'secure-file-priv' => sub { return shift->{ARGS}->{vardir}; } }, ++ { 'ssl-ca' => \&fix_ssl_ca }, ++ { 'ssl-cert' => \&fix_ssl_server_cert }, ++ { 'ssl-key' => \&fix_ssl_server_key }, ++ ); ++ ++if (IS_WINDOWS) ++{ ++ # For simplicity, we use the same names for shared memory and ++ # named pipes. ++ push(@mysqld_rules, {'shared-memory-base-name' => \&fix_socket}); ++} ++ ++sub fix_ndb_mgmd_port { ++ my ($self, $config, $group_name, $group)= @_; ++ my $hostname= $group->value('HostName'); ++ return $self->{PORT}++; ++} ++ ++ ++sub fix_cluster_dir { ++ my ($self, $config, $group_name, $group)= @_; ++ my $vardir= $self->{ARGS}->{vardir}; ++ my (undef, $process_type, $idx, $suffix)= split(/\./, $group_name); ++ return "$vardir/mysql_cluster.$suffix/$process_type.$idx"; ++} ++ ++ ++sub fix_cluster_backup_dir { ++ my ($self, $config, $group_name, $group)= @_; ++ my $vardir= $self->{ARGS}->{vardir}; ++ my (undef, $process_type, $idx, $suffix)= split(/\./, $group_name); ++ return "$vardir/mysql_cluster.$suffix/"; ++} ++ ++ ++# ++# Rules to run for each ndb_mgmd in the config ++# - will be run in order listed here ++# ++my @ndb_mgmd_rules= ++( ++ { 'PortNumber' => \&fix_ndb_mgmd_port }, ++ { 'DataDir' => \&fix_cluster_dir }, ++); ++ ++ ++# ++# Rules to run for each ndbd in the config ++# - will be run in order listed here ++# ++my @ndbd_rules= ++( ++ { 'HostName' => \&fix_host }, ++ { 'DataDir' => \&fix_cluster_dir }, ++ { 'BackupDataDir' => \&fix_cluster_backup_dir }, ++); ++ ++# Rules to run for each memcached in the config ++# - will be run in order listed here ++# ++my @memcached_rules= ++( ++ { '#host' => \&fix_host }, ++ { 'port' => \&fix_port }, ++); ++ ++# ++# Rules to run for each cluster_config section ++# - will be run in order listed here ++# ++my @cluster_config_rules= ++( ++ { 'ndb_mgmd' => \&fix_host }, ++ { 'ndbd' => \&fix_host }, ++ { 'mysqld' => \&fix_host }, ++ { 'ndbapi' => \&fix_host }, ++); ++ ++ ++# ++# Rules to run for [client] section ++# - will be run in order listed here ++# ++my @client_rules= ++( ++); ++ ++ ++# ++# Rules to run for [mysqltest] section ++# - will be run in order listed here ++# ++my @mysqltest_rules= ++( ++ { 'ssl-ca' => \&fix_ssl_ca }, ++ { 'ssl-cert' => \&fix_ssl_client_cert }, ++ { 'ssl-key' => \&fix_ssl_client_key }, ++ { 'skip-ssl' => \&fix_skip_ssl }, ++); ++ ++ ++# ++# Rules to run for [mysqlbinlog] section ++# - will be run in order listed here ++# ++my @mysqlbinlog_rules= ++( ++ { 'character-sets-dir' => \&fix_charset_dir }, ++); ++ ++ ++# ++# Rules to run for [mysql_upgrade] section ++# - will be run in order listed here ++# ++my @mysql_upgrade_rules= ++( ++ { 'tmpdir' => sub { return shift->{ARGS}->{tmpdir}; } }, ++); ++ ++ ++# ++# Generate a [client.] group to be ++# used for connecting to [mysqld.] ++# ++sub post_check_client_group { ++ my ($self, $config, $client_group_name, $mysqld_group_name)= @_; ++ ++ ++ # Settings needed for client, copied from its "mysqld" ++ my %client_needs= ++ ( ++ port => 'port', ++ socket => 'socket', ++ host => '#host', ++ user => '#user', ++ password => '#password', ++ ); ++ my $group_to_copy_from= $config->group($mysqld_group_name); ++ while (my ($name_to, $name_from)= each( %client_needs )) { ++ my $option= $group_to_copy_from->option($name_from); ++ ++ if (! defined $option){ ++ #print $config; ++ croak "Could not get value for '$name_from' for test $self->{testname}"; ++ } ++ $config->insert($client_group_name, $name_to, $option->value()) ++ } ++ ++ if (IS_WINDOWS) ++ { ++ if (! $self->{ARGS}->{embedded}) ++ { ++ # Shared memory base may or may not be defined (e.g not defined in embedded) ++ my $shm = $group_to_copy_from->option("shared-memory-base-name"); ++ if (defined $shm) ++ { ++ $config->insert($client_group_name,"shared-memory-base-name", $shm->value()); ++ } ++ } ++ } ++} ++ ++ ++sub post_check_client_groups { ++ my ($self, $config)= @_; ++ ++ my $first_mysqld= $config->first_like('mysqld\.'); ++ ++ return unless $first_mysqld; ++ ++ # Always generate [client] pointing to the first ++ # [mysqld.] ++ $self->post_check_client_group($config, ++ 'client', ++ $first_mysqld->name()); ++ ++ # Then generate [client.] for each [mysqld.] ++ foreach my $mysqld ( $config->like('mysqld.') ) { ++ $self->post_check_client_group($config, ++ 'client'.$mysqld->after('mysqld'), ++ $mysqld->name()) ++ } ++ ++} ++ ++ ++# ++# Generate [embedded] by copying the values ++# needed from the default [mysqld] section ++# and from first [mysqld.] ++# ++sub post_check_embedded_group { ++ my ($self, $config)= @_; ++ ++ return unless $self->{ARGS}->{embedded}; ++ ++ my $mysqld= $config->group('mysqld') or ++ croak "Can't run with embedded, config has no default mysqld section"; ++ ++ my $first_mysqld= $config->first_like('mysqld.') or ++ croak "Can't run with embedded, config has no mysqld"; ++ ++ my %no_copy = map { $_ => 1 } ++ ( ++ '#log-error', # Embedded server writes stderr to mysqltest's log file ++ 'slave-net-timeout', # Embedded server are not build with replication ++ 'shared-memory-base-name', # No shared memory for embedded ++ ); ++ ++ foreach my $option ( $mysqld->options(), $first_mysqld->options() ) { ++ # Don't copy options whose name is in "no_copy" list ++ next if $no_copy{$option->name()}; ++ ++ $config->insert('embedded', $option->name(), $option->value()) ++ } ++ ++} ++ ++ ++sub resolve_at_variable { ++ my ($self, $config, $group, $option)= @_; ++ local $_ = $option->value(); ++ my ($res, $after); ++ ++ while (m/(.*?)\@((?:\w+\.)+)(#?[-\w]+)/g) { ++ my ($before, $group_name, $option_name)= ($1, $2, $3); ++ $after = $'; ++ chop($group_name); ++ ++ my $from_group= $config->group($group_name) ++ or croak "There is no group named '$group_name' that ", ++ "can be used to resolve '$option_name' for test '$self->{testname}'"; ++ ++ my $value= $from_group->value($option_name); ++ $res .= $before.$value; ++ } ++ $res .= $after; ++ ++ $config->insert($group->name(), $option->name(), $res) ++} ++ ++ ++sub post_fix_resolve_at_variables { ++ my ($self, $config)= @_; ++ ++ foreach my $group ( $config->groups() ) { ++ foreach my $option ( $group->options()) { ++ next unless defined $option->value(); ++ ++ $self->resolve_at_variable($config, $group, $option) ++ if ($option->value() =~ /\@/); ++ } ++ } ++} ++ ++sub post_fix_mysql_cluster_section { ++ my ($self, $config)= @_; ++ ++ # Add a [mysl_cluster.] section for each ++ # defined [cluster_config.] section ++ foreach my $group ( $config->like('cluster_config\.\w*$') ) ++ { ++ my @urls; ++ # Generate ndb_connectstring for this cluster ++ foreach my $ndb_mgmd ( $config->like('cluster_config.ndb_mgmd.')) { ++ if ($ndb_mgmd->suffix() eq $group->suffix()) { ++ my $host= $ndb_mgmd->value('HostName'); ++ my $port= $ndb_mgmd->value('PortNumber'); ++ push(@urls, "$host:$port"); ++ } ++ } ++ croak "Could not generate valid ndb_connectstring for '$group'" ++ unless @urls > 0; ++ my $ndb_connectstring= join(";", @urls); ++ ++ # Add ndb_connectstring to [mysql_cluster.] ++ $config->insert('mysql_cluster'.$group->suffix(), ++ 'ndb_connectstring', $ndb_connectstring); ++ ++ # Add ndb_connectstring to each mysqld connected to this ++ # cluster ++ foreach my $mysqld ( $config->like('cluster_config.mysqld.')) { ++ if ($mysqld->suffix() eq $group->suffix()) { ++ my $after= $mysqld->after('cluster_config.mysqld'); ++ $config->insert("mysqld$after", ++ 'ndb_connectstring', $ndb_connectstring); ++ } ++ } ++ } ++} ++ ++# ++# Rules to run last of all ++# ++my @post_rules= ++( ++ \&post_check_client_groups, ++ \&post_fix_mysql_cluster_section, ++ \&post_fix_resolve_at_variables, ++ \&post_check_embedded_group, ++); ++ ++ ++sub run_rules_for_group { ++ my ($self, $config, $group, @rules)= @_; ++ foreach my $hash ( @rules ) { ++ while (my ($option, $rule)= each( %{$hash} )) { ++ # Only run this rule if the value is not already defined ++ if (!$config->exists($group->name(), $option)) { ++ my $value; ++ if (ref $rule eq "CODE") { ++ # Call the rule function ++ $value= &$rule($self, $config, $group->name(), ++ $config->group($group->name())); ++ } else { ++ $value= $rule; ++ } ++ if (defined $value) { ++ $config->insert($group->name(), $option, $value, 1); ++ } ++ } ++ } ++ } ++} ++ ++ ++sub run_section_rules { ++ my ($self, $config, $name, @rules)= @_; ++ ++ foreach my $group ( $config->like($name) ) { ++ $self->run_rules_for_group($config, $group, @rules); ++ } ++} ++ ++ ++sub run_generate_sections_from_cluster_config { ++ my ($self, $config)= @_; ++ ++ my @options= ('ndb_mgmd', 'ndbd', ++ 'mysqld', 'ndbapi'); ++ ++ foreach my $group ( $config->like('cluster_config\.\w*$') ) { ++ ++ # Keep track of current index per process type ++ my %idxes; ++ map { $idxes{$_}= 1; } @options; ++ ++ foreach my $option_name ( @options ) { ++ my $value= $group->value($option_name); ++ my @hosts= split(/,/, $value, -1); # -1 => return also empty strings ++ ++ # Add at least one host ++ push(@hosts, undef) unless scalar(@hosts); ++ ++ # Assign hosts unless already fixed ++ @hosts= map { $self->fix_host() unless $_; } @hosts; ++ ++ # Write the hosts value back ++ $group->insert($option_name, join(",", @hosts)); ++ ++ # Generate sections for each host ++ foreach my $host ( @hosts ){ ++ my $idx= $idxes{$option_name}++; ++ ++ my $suffix= $group->suffix(); ++ # Generate a section for ndb_mgmd to read ++ $config->insert("cluster_config.$option_name.$idx$suffix", ++ "HostName", $host); ++ ++ if ($option_name eq 'mysqld'){ ++ my $datadir= ++ $self->fix_cluster_dir($config, ++ "cluster_config.mysqld.$idx$suffix", ++ $group); ++ $config->insert("mysqld.$idx$suffix", ++ 'datadir', "$datadir/data"); ++ } ++ } ++ } ++ } ++} ++ ++ ++sub new_config { ++ my ($class, $args)= @_; ++ ++ my @required_args= ('basedir', 'baseport', 'vardir', 'template_path'); ++ ++ foreach my $required ( @required_args ) { ++ croak "you must pass '$required'" unless defined $args->{$required}; ++ } ++ ++ # Open the config template ++ my $config= My::Config->new($args->{'template_path'}); ++ my $self= bless { ++ CONFIG => $config, ++ ARGS => $args, ++ PORT => $args->{baseport}, ++ SERVER_ID => 1, ++ testname => $args->{testname}, ++ }, $class; ++ ++ # Run pre rules ++ foreach my $rule ( @pre_rules ) { ++ &$rule($self, $config); ++ } ++ ++ $self->run_section_rules($config, ++ 'cluster_config\.\w*$', ++ @cluster_config_rules); ++ $self->run_generate_sections_from_cluster_config($config); ++ ++ $self->run_section_rules($config, ++ 'cluster_config.ndb_mgmd.', ++ @ndb_mgmd_rules); ++ $self->run_section_rules($config, ++ 'cluster_config.ndbd', ++ @ndbd_rules); ++ ++ $self->run_section_rules($config, ++ 'mysqld.', ++ @mysqld_rules); ++ ++ $self->run_section_rules($config, ++ 'memcached.', ++ @memcached_rules); ++ ++ # [mysqlbinlog] need additional settings ++ $self->run_rules_for_group($config, ++ $config->insert('mysqlbinlog'), ++ @mysqlbinlog_rules); ++ ++ # [mysql_upgrade] need additional settings ++ $self->run_rules_for_group($config, ++ $config->insert('mysql_upgrade'), ++ @mysql_upgrade_rules); ++ ++ # Additional rules required for [client] ++ $self->run_rules_for_group($config, ++ $config->insert('client'), ++ @client_rules); ++ ++ ++ # Additional rules required for [mysqltest] ++ $self->run_rules_for_group($config, ++ $config->insert('mysqltest'), ++ @mysqltest_rules); ++ ++ { ++ # Run post rules ++ foreach my $rule ( @post_rules ) { ++ &$rule($self, $config); ++ } ++ } ++ ++ return $config; ++} ++ ++ ++1; ++ +diff --git a/mysql-test/lib/mtr_cases.pm b/mysql-test/lib/mtr_cases.pm +index eed3100..d3a36e8 100644 +--- a/mysql-test/lib/mtr_cases.pm ++++ b/mysql-test/lib/mtr_cases.pm +@@ -509,6 +509,9 @@ sub collect_one_suite($) + my @new_cases; + foreach my $comb (@combinations) + { ++ # ENV is used in My::Config::ENV to store the environment so is not a true combination ++ next if ( $comb->{'name'} eq 'ENV' ); ++ + foreach my $test (@cases) + { + +diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl +index 82b5d1c..da9876a 100755 +--- a/mysql-test/mysql-test-run.pl ++++ b/mysql-test/mysql-test-run.pl +@@ -360,6 +360,8 @@ sub main { + gcov_prepare($basedir); + } + ++ check_wsrep_support(); ++ + if (!$opt_suites) { + $opt_suites= $DEFAULT_SUITES; + } +@@ -2895,7 +2897,6 @@ sub check_ndbcluster_support ($) { + # which is the default case + return; + } +- + if ($opt_skip_ndbcluster) + { + # Compiled with ndbcluster but ndbcluster skipped +@@ -3311,6 +3312,49 @@ sub ndbcluster_start ($) { + } + + ++sub have_wsrep() { ++ my $wsrep_on= $mysqld_variables{'wsrep-on'}; ++ return defined $wsrep_on ++} ++ ++ ++sub check_wsrep_support() { ++ if (have_wsrep()) ++ { ++ mtr_report(" - binaries built with wsrep patch"); ++ ++ # ADD scripts to $PATH to that wsrep_sst_* can be found ++ my ($path) = grep { -f "$_/wsrep_sst_rsync"; } "$::bindir/scripts", $::path_client_bindir; ++ mtr_error("No SST scripts") unless $path; ++ $ENV{PATH}="$path:$ENV{PATH}"; ++ ++ # Check whether WSREP_PROVIDER environment variable is set. ++ if (defined $ENV{'WSREP_PROVIDER'}) { ++ if ((mtr_file_exists($ENV{'WSREP_PROVIDER'}) eq "") && ++ ($ENV{'WSREP_PROVIDER'} ne "none")) { ++ mtr_error("WSREP_PROVIDER env set to an invalid path"); ++ } ++ # WSREP_PROVIDER is valid; set to a valid path or "none"). ++ mtr_verbose("WSREP_PROVIDER env set to $ENV{'WSREP_PROVIDER'}"); ++ } else { ++ # WSREP_PROVIDER env not defined. Lets try to locate the wsrep provider ++ # library. ++ my $file_wsrep_provider= ++ mtr_file_exists("/usr/lib/galera/libgalera_smm.so", ++ "/usr/lib64/galera/libgalera_smm.so"); ++ ++ if ($file_wsrep_provider ne "") { ++ # wsrep provider library found ! ++ mtr_verbose("wsrep provider library found : $file_wsrep_provider"); ++ $ENV{'WSREP_PROVIDER'}= $file_wsrep_provider; ++ } else { ++ mtr_verbose("Could not find wsrep provider library, setting it to 'none'"); ++ $ENV{'WSREP_PROVIDER'}= "none"; ++ } ++ } ++ } ++} ++ + sub create_config_file_for_extern { + my %opts= + ( +@@ -3737,6 +3781,24 @@ sub run_query { + } + + ++sub sleep_until_returns_true($$$) { ++ my ($tinfo, $mysqld, $query)= @_; ++ ++ my $timeout = $opt_start_timeout; ++ my $sleeptime= 100; # Milliseconds ++ my $loops= ($timeout * 1000) / $sleeptime; ++ ++ for ( my $loop= 1; $loop <= $loops; $loop++ ) { ++ my $query_result = run_query($tinfo, $mysqld, $query); ++ if (run_query($tinfo, $mysqld, $query) == 1) { ++ return 0; ++ } ++ } ++ ++ return 1; ++} ++ ++ + sub do_before_run_mysqltest($) + { + my $tinfo= shift; +@@ -5785,6 +5847,13 @@ sub start_servers($) { + } + return 1; + } ++ ++ if (have_wsrep()) { ++ if(sleep_until_returns_true($tinfo, $mysqld, 'SELECT @@wsrep_ready')) { ++ $tinfo->{logfile}= "WSREP did not transition to state READY"; ++ return 1; ++ } ++ } + } + + # Start memcached(s) for each cluster +diff --git a/mysql-test/r/galera_sst_mode.result b/mysql-test/r/galera_sst_mode.result +new file mode 100644 +index 0000000..ea25b32 +--- /dev/null ++++ b/mysql-test/r/galera_sst_mode.result +@@ -0,0 +1,24 @@ ++# ++# Test for mysqldump's galera-sst-mode option ++# ++# ++# MDEV-6490: mysqldump unknown option --galera-sst-mode ++# ++CREATE DATABASE bug6490; ++USE bug6490; ++CREATE TABLE t1(c1 INT); ++INSERT INTO t1 values (1); ++INSERT INTO t1 values (2); ++# Save the current gtid_binlog_state. ++# Take a dump of bug6490 database ++DROP TABLE t1; ++# Load the dump ++RESET MASTER; ++SELECT * from t1; ++c1 ++1 ++2 ++# Compare the two gtid_binlog_state's ++# Cleanup ++DROP DATABASE bug6490; ++# End of test +diff --git a/mysql-test/r/have_wsrep.require b/mysql-test/r/have_wsrep.require +new file mode 100644 +index 0000000..af32ac7 +--- /dev/null ++++ b/mysql-test/r/have_wsrep.require +@@ -0,0 +1,2 @@ ++Variable_name Value ++wsrep_on ON +diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result +index fce2f40..149babc 100644 +--- a/mysql-test/r/information_schema.result ++++ b/mysql-test/r/information_schema.result +@@ -1664,9 +1664,7 @@ drop table if exists t1;drop table if exists t1; + drop table if exists t1;drop table if exists t1; + drop table if exists t1;drop table if exists t1; + drop table if exists t1;drop table if exists t1; +-drop table if exists t1;drop table if exists +-Warnings: +-Warning 1265 Data truncated for column 'VARIABLE_VALUE' at row 1 ++drop table if exists t1;drop table if exists t1; + set global init_connect=""; + create table t0 select * from information_schema.global_status where VARIABLE_NAME='COM_SELECT'; + SELECT 1; +diff --git a/mysql-test/r/mysqld--help-notwin.result b/mysql-test/r/mysqld--help-notwin.result +index 18b21ff..d31ef0f 100644 +--- a/mysql-test/r/mysqld--help-notwin.result ++++ b/mysql-test/r/mysqld--help-notwin.result +@@ -1010,6 +1010,94 @@ The following options may be given as the first argument: + -V, --version Output version information and exit. + --wait-timeout=# The number of seconds the server waits for activity on a + connection before closing it ++ --wsrep-OSU-method[=name] ++ Method for Online Schema Upgrade ++ --wsrep-auto-increment-control ++ To automatically control the assignment of autoincrement ++ variables ++ (Defaults to on; use --skip-wsrep-auto-increment-control to disable.) ++ --wsrep-causal-reads ++ (DEPRECATED) setting this variable is equivalent to ++ setting wsrep_sync_wait READ flag ++ --wsrep-certify-nonPK ++ Certify tables with no primary key ++ (Defaults to on; use --skip-wsrep-certify-nonPK to disable.) ++ --wsrep-cluster-address=name ++ Address to initially connect to cluster ++ --wsrep-cluster-name=name ++ Name for the cluster ++ --wsrep-convert-LOCK-to-trx ++ To convert locking sessions into transactions ++ --wsrep-data-home-dir=name ++ home directory for wsrep provider ++ --wsrep-dbug-option=name ++ DBUG options to provider library ++ --wsrep-debug To enable debug level logging ++ --wsrep-desync To desynchronize the node from the cluster ++ --wsrep-drupal-282555-workaround ++ To use a workaround forbad autoincrement value ++ --wsrep-forced-binlog-format=name ++ binlog format to take effect over user's choice ++ --wsrep-load-data-splitting ++ To commit LOAD DATA transaction after every 10K rows ++ inserted ++ (Defaults to on; use --skip-wsrep-load-data-splitting to disable.) ++ --wsrep-log-conflicts ++ To log multi-master conflicts ++ --wsrep-max-ws-rows=# ++ Max number of rows in write set ++ --wsrep-max-ws-size=# ++ Max write set size (bytes) ++ --wsrep-mysql-replication-bundle=# ++ mysql replication group commit ++ --wsrep-node-address=name ++ Node address ++ --wsrep-node-incoming-address=name ++ Client connection address ++ --wsrep-node-name=name ++ Node name ++ --wsrep-notify-cmd=name ++ --wsrep-on To enable wsrep replication ++ (Defaults to on; use --skip-wsrep-on to disable.) ++ --wsrep-preordered To enable preordered write set processing ++ --wsrep-provider=name ++ Path to replication provider library ++ --wsrep-provider-options=name ++ provider specific options ++ --wsrep-recover Recover database state after crash and exit ++ --wsrep-replicate-myisam ++ To enable myisam replication ++ --wsrep-restart-slave ++ Should MySQL slave be restarted automatically, when node ++ joins back to cluster ++ --wsrep-retry-autocommit=# ++ Max number of times to retry a failed autocommit ++ statement ++ --wsrep-slave-FK-checks ++ Should slave thread do foreign key constraint checks ++ (Defaults to on; use --skip-wsrep-slave-FK-checks to disable.) ++ --wsrep-slave-UK-checks ++ Should slave thread do secondary index uniqueness chesks ++ --wsrep-slave-threads=# ++ Number of slave appliers to launch ++ --wsrep-sst-auth=name ++ Authentication for SST connection ++ --wsrep-sst-donor=name ++ preferred donor node for the SST ++ --wsrep-sst-donor-rejects-queries ++ Reject client queries when donating state snapshot ++ transfer ++ --wsrep-sst-method=name ++ State snapshot transfer method ++ --wsrep-sst-receive-address=name ++ Address where node is waiting for SST contact ++ --wsrep-start-position=name ++ global transaction position to start from ++ --wsrep-sync-wait[=#] ++ Ensure "synchronous" read view before executing an ++ operation of the type specified by bitmask: 1 - ++ READ(includes SELECT, SHOW and BEGIN/START TRANSACTION); ++ 2 - UPDATE and DELETE; 4 - INSERT and REPLACE + + Variables (--variable-name=value) + abort-slave-event-count 0 +@@ -1299,6 +1387,45 @@ updatable-views-with-limit YES + validate-user-plugins TRUE + verbose TRUE + wait-timeout 28800 ++wsrep-OSU-method TOI ++wsrep-auto-increment-control TRUE ++wsrep-causal-reads FALSE ++wsrep-certify-nonPK TRUE ++wsrep-cluster-address ++wsrep-cluster-name my_wsrep_cluster ++wsrep-convert-LOCK-to-trx FALSE ++wsrep-data-home-dir ++wsrep-dbug-option ++wsrep-debug FALSE ++wsrep-desync FALSE ++wsrep-drupal-282555-workaround FALSE ++wsrep-forced-binlog-format NONE ++wsrep-load-data-splitting TRUE ++wsrep-log-conflicts FALSE ++wsrep-max-ws-rows 131072 ++wsrep-max-ws-size 1073741824 ++wsrep-mysql-replication-bundle 0 ++wsrep-node-address ++wsrep-node-incoming-address AUTO ++wsrep-notify-cmd ++wsrep-on FALSE ++wsrep-preordered FALSE ++wsrep-provider none ++wsrep-provider-options ++wsrep-recover FALSE ++wsrep-replicate-myisam FALSE ++wsrep-restart-slave FALSE ++wsrep-retry-autocommit 1 ++wsrep-slave-FK-checks TRUE ++wsrep-slave-UK-checks FALSE ++wsrep-slave-threads 1 ++wsrep-sst-auth (No default value) ++wsrep-sst-donor ++wsrep-sst-donor-rejects-queries FALSE ++wsrep-sst-method rsync ++wsrep-sst-receive-address AUTO ++wsrep-start-position 00000000-0000-0000-0000-000000000000:-1 ++wsrep-sync-wait 0 + + To see what values a running MySQL server is using, type + 'mysqladmin variables' instead of 'mysqld --verbose --help'. +diff --git a/mysql-test/r/not_wsrep.require b/mysql-test/r/not_wsrep.require +new file mode 100644 +index 0000000..7c8e74a +--- /dev/null ++++ b/mysql-test/r/not_wsrep.require +@@ -0,0 +1,2 @@ ++HAVE_WSREP ++0 +diff --git a/mysql-test/r/show_check.result b/mysql-test/r/show_check.result +index 92d3147..8bc7b0e 100644 +--- a/mysql-test/r/show_check.result ++++ b/mysql-test/r/show_check.result +@@ -101,19 +101,19 @@ drop table t1; + show variables like "wait_timeout%"; + Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr + def information_schema VARIABLES VARIABLES VARIABLE_NAME Variable_name 253 64 12 N 1 0 8 +-def information_schema VARIABLES VARIABLES VARIABLE_VALUE Value 253 1024 5 Y 0 0 8 ++def information_schema VARIABLES VARIABLES VARIABLE_VALUE Value 253 2048 5 Y 0 0 8 + Variable_name Value + wait_timeout 28800 + show variables like "WAIT_timeout%"; + Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr + def information_schema VARIABLES VARIABLES VARIABLE_NAME Variable_name 253 64 12 N 1 0 8 +-def information_schema VARIABLES VARIABLES VARIABLE_VALUE Value 253 1024 5 Y 0 0 8 ++def information_schema VARIABLES VARIABLES VARIABLE_VALUE Value 253 2048 5 Y 0 0 8 + Variable_name Value + wait_timeout 28800 + show variables like "this_doesn't_exists%"; + Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr + def information_schema VARIABLES VARIABLES VARIABLE_NAME Variable_name 253 64 0 N 1 0 8 +-def information_schema VARIABLES VARIABLES VARIABLE_VALUE Value 253 1024 0 Y 0 0 8 ++def information_schema VARIABLES VARIABLES VARIABLE_VALUE Value 253 2048 0 Y 0 0 8 + Variable_name Value + show table status from test like "this_doesn't_exists%"; + Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +diff --git a/mysql-test/std_data/wsrep_notify.sh b/mysql-test/std_data/wsrep_notify.sh +new file mode 100644 +index 0000000..7036f60 +--- /dev/null ++++ b/mysql-test/std_data/wsrep_notify.sh +@@ -0,0 +1,99 @@ ++#!/bin/sh -eu ++ ++# This is a simple example of wsrep notification script (wsrep_notify_cmd). ++# It will create 'wsrep' schema and two tables in it: 'membeship' and 'status' ++# and fill them on every membership or node status change. ++# ++# Edit parameters below to specify the address and login to server. ++ ++USER=root ++HOST=127.0.0.1 ++PORT=$NODE_MYPORT_1 ++ ++SCHEMA="mtr_wsrep_notify" ++MEMB_TABLE="$SCHEMA.membership" ++STATUS_TABLE="$SCHEMA.status" ++ ++BEGIN=" ++SET wsrep_on=0; ++CREATE SCHEMA IF NOT EXISTS $SCHEMA; ++CREATE TABLE IF NOT EXISTS $MEMB_TABLE ( ++ idx INT, ++ uuid CHAR(40), /* node UUID */ ++ name VARCHAR(32), /* node name */ ++ addr VARCHAR(256) /* node address */ ++) ENGINE=MEMORY; ++CREATE TABLE IF NOT EXISTS $STATUS_TABLE ( ++ size INT, /* component size */ ++ idx INT, /* this node index */ ++ status CHAR(16), /* this node status */ ++ uuid CHAR(40), /* cluster UUID */ ++ prim BOOLEAN /* if component is primary */ ++) ENGINE=MEMORY; ++BEGIN; ++" ++END="COMMIT;" ++ ++configuration_change() ++{ ++ echo "$BEGIN;" ++ ++ local idx=0 ++ ++ for NODE in $(echo $MEMBERS | sed s/,/\ /g) ++ do ++ echo "INSERT INTO $MEMB_TABLE VALUES ( $idx, " ++ # Don't forget to properly quote string values ++ echo "'$NODE'" | sed s/\\//\',\'/g ++ echo ");" ++ idx=$(( $idx + 1 )) ++ done ++ ++ echo "INSERT INTO $STATUS_TABLE VALUES($idx, $INDEX, '$STATUS', '$CLUSTER_UUID', $PRIMARY);" ++ ++ echo "$END" ++} ++ ++status_update() ++{ ++ echo "SET wsrep_on=0; BEGIN; UPDATE $STATUS_TABLE SET status='$STATUS'; COMMIT;" ++} ++ ++COM=status_update # not a configuration change by default ++ ++while [ $# -gt 0 ] ++do ++ case $1 in ++ --status) ++ STATUS=$2 ++ shift ++ ;; ++ --uuid) ++ CLUSTER_UUID=$2 ++ shift ++ ;; ++ --primary) ++ [ "$2" = "yes" ] && PRIMARY="1" || PRIMARY="0" ++ COM=configuration_change ++ shift ++ ;; ++ --index) ++ INDEX=$2 ++ shift ++ ;; ++ --members) ++ MEMBERS=$2 ++ shift ++ ;; ++ esac ++ shift ++done ++ ++# Undefined means node is shutting down ++if [ "$STATUS" != "Undefined" ] ++then ++ $COM | mysql -B -u$USER -h$HOST -P$PORT ++fi ++ ++exit 0 ++# +diff --git a/mysql-test/suite/binlog/r/binlog_row_binlog.result b/mysql-test/suite/binlog/r/binlog_row_binlog.result +index f60f80c..142a522 100644 +--- a/mysql-test/suite/binlog/r/binlog_row_binlog.result ++++ b/mysql-test/suite/binlog/r/binlog_row_binlog.result +@@ -788,9 +788,11 @@ SELECT * FROM t1; + c1 + 1 + # Their values should be ON +-SHOW SESSION VARIABLES LIKE "%_checks"; ++SHOW SESSION VARIABLES LIKE "foreign_key_checks"; + Variable_name Value + foreign_key_checks ON ++SHOW SESSION VARIABLES LIKE "unique_checks"; ++Variable_name Value + unique_checks ON + + SET @@SESSION.foreign_key_checks= OFF; +@@ -806,9 +808,11 @@ c1 + 1 + 2 + # Their values should be OFF +-SHOW SESSION VARIABLES LIKE "%_checks"; ++SHOW SESSION VARIABLES LIKE "foreign_key_checks"; + Variable_name Value + foreign_key_checks OFF ++SHOW SESSION VARIABLES LIKE "unique_checks"; ++Variable_name Value + unique_checks OFF + # INSERT INTO t1 VALUES(2) + # foreign_key_checks=1 and unique_checks=1 +@@ -824,8 +828,10 @@ c1 + 1 + 2 + # Their values should be OFF +-SHOW SESSION VARIABLES LIKE "%_checks"; ++SHOW SESSION VARIABLES LIKE "foreign_key_checks"; + Variable_name Value + foreign_key_checks OFF ++SHOW SESSION VARIABLES LIKE "unique_checks"; ++Variable_name Value + unique_checks OFF + DROP TABLE t1; +diff --git a/mysql-test/suite/binlog/r/binlog_simplified_binlog_gtid_recovery.result b/mysql-test/suite/binlog/r/binlog_simplified_binlog_gtid_recovery.result +new file mode 100644 +index 0000000..40b50b8 +--- /dev/null ++++ b/mysql-test/suite/binlog/r/binlog_simplified_binlog_gtid_recovery.result +@@ -0,0 +1,47 @@ ++include/rpl_init.inc [topology=none] ++include/rpl_default_connections.inc ++CREATE TABLE t1 ( ++c1 INT NOT NULL PRIMARY KEY ++); ++# Generate master-bin.000002 ++FLUSH LOGS; ++INSERT INTO t1 VALUES (1); ++# Generate master-bin.000003 ++FLUSH LOGS; ++INSERT INTO t1 VALUES (2); ++# Generate master-bin.000004 ++FLUSH LOGS; ++INSERT INTO t1 VALUES (3); ++# Move master-bin.000002 to master-bin.000002.bkp and ++# master-bin.000003 to master-bin.000003.bkp ++# ++# Only master-bin.000001 and master-bin.000004 remain, others are moved ++# , restart the server with enabled simplified-binlog-gtid-recovery ++# and gtid_mode on. If the server scans more than one binary log in ++# every iteration, it will cause read error on the 2nd and 3rd files. ++# ++include/rpl_restart_server.inc [server_number=1 parameters: --simplified-binlog-gtid-recovery=on --gtid-mode=on --enforce-gtid-consistency --log-slave-updates] ++# ++# Verify that GLOBAL.GTID_EXECUTED and GLOBAL.GTID_PURGED are empty ++# after server restarts. ++# ++include/assert.inc [GLOBAL.GTID_EXECUTED must be empty.] ++include/assert.inc [GLOBAL.GTID_PURGED must be empty.] ++DROP TABLE t1; ++# Move master-bin.000004 to master-bin.000004.bkp ++# ++# Only master-bin.000001 and master-bin.000005 remain, others are moved ++# , restart the server with enabled simplified-binlog-gtid-recovery ++# and gtid_mode on again. If the server scans more than one binary ++# log in every iteration, it will cause read error on the 2nd and ++# 4th files. ++# ++include/rpl_restart_server.inc [server_number=1 parameters: --simplified-binlog-gtid-recovery=on --gtid-mode=on --enforce-gtid-consistency --log-slave-updates] ++# ++# Verify that GLOBAL.GTID_EXECUTED contains committed gtid MASTER_UUID:1 ++# and GLOBAL.GTID_PURGED is empty after server restarts again. ++# ++include/assert.inc [committed gtid MASTER_UUID:1] ++include/assert.inc [GLOBAL.GTID_PURGED is empty] ++# Move binary logs back. ++include/rpl_end.inc +diff --git a/mysql-test/suite/binlog/r/binlog_stm_binlog.result b/mysql-test/suite/binlog/r/binlog_stm_binlog.result +index e0cc9ca..8842ace 100644 +--- a/mysql-test/suite/binlog/r/binlog_stm_binlog.result ++++ b/mysql-test/suite/binlog/r/binlog_stm_binlog.result +@@ -557,9 +557,11 @@ SELECT * FROM t1; + c1 + 1 + # Their values should be ON +-SHOW SESSION VARIABLES LIKE "%_checks"; ++SHOW SESSION VARIABLES LIKE "foreign_key_checks"; + Variable_name Value + foreign_key_checks ON ++SHOW SESSION VARIABLES LIKE "unique_checks"; ++Variable_name Value + unique_checks ON + + SET @@SESSION.foreign_key_checks= OFF; +@@ -575,9 +577,11 @@ c1 + 1 + 2 + # Their values should be OFF +-SHOW SESSION VARIABLES LIKE "%_checks"; ++SHOW SESSION VARIABLES LIKE "foreign_key_checks"; + Variable_name Value + foreign_key_checks OFF ++SHOW SESSION VARIABLES LIKE "unique_checks"; ++Variable_name Value + unique_checks OFF + # INSERT INTO t1 VALUES(2) + # foreign_key_checks=1 and unique_checks=1 +@@ -593,8 +597,10 @@ c1 + 1 + 2 + # Their values should be OFF +-SHOW SESSION VARIABLES LIKE "%_checks"; ++SHOW SESSION VARIABLES LIKE "foreign_key_checks"; + Variable_name Value + foreign_key_checks OFF ++SHOW SESSION VARIABLES LIKE "unique_checks"; ++Variable_name Value + unique_checks OFF + DROP TABLE t1; +diff --git a/mysql-test/suite/binlog/t/binlog_simplified_binlog_gtid_recovery.test b/mysql-test/suite/binlog/t/binlog_simplified_binlog_gtid_recovery.test +new file mode 100644 +index 0000000..5337e7b +--- /dev/null ++++ b/mysql-test/suite/binlog/t/binlog_simplified_binlog_gtid_recovery.test +@@ -0,0 +1,120 @@ ++# ==== Purpose ==== ++# ++# BUG#16741603: MYSQLD SCANS ALL BINARY LOGS ON CRASH RECOVERY ++# ++# Verify that the server does not scan more than one binary log ++# in every iteration when initializing GTID sets on server start ++# if simplified-binlog-gtid-recovery is enabled. ++# ++# ++# ==== Implementation ==== ++# ++# 1) Start server and generate four binary logs with gtid_mode off. ++# 2) Move master-bin.000002 to master-bin.000002.bkp and ++# master-bin.000003 to master-bin.000003.bkp ++# 3) Only master-bin.000001 and master-bin.000004 remain, others are moved ++# , restart the server with enabled simplified-binlog-gtid-recovery ++# and gtid_mode on. If the server scans more than one binary log in ++# every iteration, it will cause read error on the 2nd and 3rd files. ++# 4) Verify that GLOBAL.GTID_EXECUTED and GLOBAL.GTID_PURGED are empty ++# after server restarts. ++# 5) Move master-bin.000004 to master-bin.000004.bkp ++# 6) Only master-bin.000001 and master-bin.000005 remain, others are moved ++# , restart the server with enabled simplified-binlog-gtid-recovery ++# and gtid_mode on again. If the server scans more than one binary ++# log in every iteration, it will cause read error on the 2nd and ++# 4th files. ++# 7) Verify that GLOBAL.GTID_EXECUTED contains committed gtid MASTER_UUID:1 ++# and GLOBAL.GTID_PURGED is empty after server restarts again. ++# 8) Move binary logs back. ++# ++ ++--source include/not_gtid_enabled.inc ++ ++# Invoke rpl_init.inc in order to set up the connections needed by ++# rpl_restart_server.inc ++--let $rpl_server_count= 1 ++--let $rpl_topology= none ++--source include/rpl_init.inc ++--source include/rpl_default_connections.inc ++ ++--let $MYSQLD_DATADIR= `select @@datadir` ++--let $master_uuid= `SELECT @@GLOBAL.SERVER_UUID` ++CREATE TABLE t1 ( ++ c1 INT NOT NULL PRIMARY KEY ++); ++ ++--echo # Generate master-bin.000002 ++FLUSH LOGS; ++INSERT INTO t1 VALUES (1); ++--let $binlog_file2= query_get_value(SHOW MASTER STATUS, File, 1) ++ ++--echo # Generate master-bin.000003 ++FLUSH LOGS; ++INSERT INTO t1 VALUES (2); ++--let $binlog_file3= query_get_value(SHOW MASTER STATUS, File, 1) ++ ++--echo # Generate master-bin.000004 ++FLUSH LOGS; ++INSERT INTO t1 VALUES (3); ++--let $binlog_file4= query_get_value(SHOW MASTER STATUS, File, 1) ++ ++--echo # Move master-bin.000002 to master-bin.000002.bkp and ++--echo # master-bin.000003 to master-bin.000003.bkp ++--move_file $MYSQLD_DATADIR/$binlog_file2 $MYSQLD_DATADIR/$binlog_file2.bkp ++--move_file $MYSQLD_DATADIR/$binlog_file3 $MYSQLD_DATADIR/$binlog_file3.bkp ++ ++--echo # ++--echo # Only master-bin.000001 and master-bin.000004 remain, others are moved ++--echo # , restart the server with enabled simplified-binlog-gtid-recovery ++--echo # and gtid_mode on. If the server scans more than one binary log in ++--echo # every iteration, it will cause read error on the 2nd and 3rd files. ++--echo # ++--let $rpl_server_number= 1 ++--let $rpl_server_parameters= --simplified-binlog-gtid-recovery=on --gtid-mode=on --enforce-gtid-consistency --log-slave-updates ++--source include/rpl_restart_server.inc ++ ++--echo # ++--echo # Verify that GLOBAL.GTID_EXECUTED and GLOBAL.GTID_PURGED are empty ++--echo # after server restarts. ++--echo # ++--let $assert_text= GLOBAL.GTID_EXECUTED must be empty. ++--let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "" ++--source include/assert.inc ++--let $assert_text= GLOBAL.GTID_PURGED must be empty. ++--let $assert_cond= "[SELECT @@GLOBAL.GTID_PURGED]" = "" ++--source include/assert.inc ++ ++DROP TABLE t1; ++--echo # Move master-bin.000004 to master-bin.000004.bkp ++--move_file $MYSQLD_DATADIR/$binlog_file4 $MYSQLD_DATADIR/$binlog_file4.bkp ++ ++--echo # ++--echo # Only master-bin.000001 and master-bin.000005 remain, others are moved ++--echo # , restart the server with enabled simplified-binlog-gtid-recovery ++--echo # and gtid_mode on again. If the server scans more than one binary ++--echo # log in every iteration, it will cause read error on the 2nd and ++--echo # 4th files. ++--echo # ++--let $rpl_server_number= 1 ++--let $rpl_server_parameters= --simplified-binlog-gtid-recovery=on --gtid-mode=on --enforce-gtid-consistency --log-slave-updates ++--source include/rpl_restart_server.inc ++ ++--echo # ++--echo # Verify that GLOBAL.GTID_EXECUTED contains committed gtid MASTER_UUID:1 ++--echo # and GLOBAL.GTID_PURGED is empty after server restarts again. ++--echo # ++--let $assert_text= committed gtid MASTER_UUID:1 ++--let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "$master_uuid:1" ++--source include/assert.inc ++--let $assert_text= GLOBAL.GTID_PURGED is empty ++--let $assert_cond= "[SELECT @@GLOBAL.GTID_PURGED]" = "" ++--source include/assert.inc ++ ++--echo # Move binary logs back. ++--move_file $MYSQLD_DATADIR/$binlog_file2.bkp $MYSQLD_DATADIR/$binlog_file2 ++--move_file $MYSQLD_DATADIR/$binlog_file3.bkp $MYSQLD_DATADIR/$binlog_file3 ++--move_file $MYSQLD_DATADIR/$binlog_file4.bkp $MYSQLD_DATADIR/$binlog_file4 ++ ++--source include/rpl_end.inc ++ +diff --git a/mysql-test/suite/funcs_1/r/is_columns_is.result b/mysql-test/suite/funcs_1/r/is_columns_is.result +index f0ab3a7..ec485d4 100644 +--- a/mysql-test/suite/funcs_1/r/is_columns_is.result ++++ b/mysql-test/suite/funcs_1/r/is_columns_is.result +@@ -111,9 +111,9 @@ def information_schema FILES UPDATE_COUNT 13 NULL YES bigint NULL NULL 19 0 NULL + def information_schema FILES UPDATE_TIME 34 NULL YES datetime NULL NULL NULL NULL 0 NULL NULL datetime select + def information_schema FILES VERSION 25 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select + def information_schema GLOBAL_STATUS VARIABLE_NAME 1 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select +-def information_schema GLOBAL_STATUS VARIABLE_VALUE 2 NULL YES varchar 1024 3072 NULL NULL NULL utf8 utf8_general_ci varchar(1024) select ++def information_schema GLOBAL_STATUS VARIABLE_VALUE 2 NULL YES varchar 2048 6144 NULL NULL NULL utf8 utf8_general_ci varchar(2048) select + def information_schema GLOBAL_VARIABLES VARIABLE_NAME 1 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select +-def information_schema GLOBAL_VARIABLES VARIABLE_VALUE 2 NULL YES varchar 1024 3072 NULL NULL NULL utf8 utf8_general_ci varchar(1024) select ++def information_schema GLOBAL_VARIABLES VARIABLE_VALUE 2 NULL YES varchar 2048 6144 NULL NULL NULL utf8 utf8_general_ci varchar(2048) select + def information_schema KEY_COLUMN_USAGE COLUMN_NAME 7 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select + def information_schema KEY_COLUMN_USAGE CONSTRAINT_CATALOG 1 NO varchar 512 1536 NULL NULL NULL utf8 utf8_general_ci varchar(512) select + def information_schema KEY_COLUMN_USAGE CONSTRAINT_NAME 3 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select +@@ -243,9 +243,9 @@ def information_schema SCHEMA_PRIVILEGES PRIVILEGE_TYPE 4 NO varchar 64 192 NUL + def information_schema SCHEMA_PRIVILEGES TABLE_CATALOG 2 NO varchar 512 1536 NULL NULL NULL utf8 utf8_general_ci varchar(512) select + def information_schema SCHEMA_PRIVILEGES TABLE_SCHEMA 3 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select + def information_schema SESSION_STATUS VARIABLE_NAME 1 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select +-def information_schema SESSION_STATUS VARIABLE_VALUE 2 NULL YES varchar 1024 3072 NULL NULL NULL utf8 utf8_general_ci varchar(1024) select ++def information_schema SESSION_STATUS VARIABLE_VALUE 2 NULL YES varchar 2048 6144 NULL NULL NULL utf8 utf8_general_ci varchar(2048) select + def information_schema SESSION_VARIABLES VARIABLE_NAME 1 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select +-def information_schema SESSION_VARIABLES VARIABLE_VALUE 2 NULL YES varchar 1024 3072 NULL NULL NULL utf8 utf8_general_ci varchar(1024) select ++def information_schema SESSION_VARIABLES VARIABLE_VALUE 2 NULL YES varchar 2048 6144 NULL NULL NULL utf8 utf8_general_ci varchar(2048) select + def information_schema STATISTICS CARDINALITY 10 NULL YES bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select + def information_schema STATISTICS COLLATION 9 NULL YES varchar 1 3 NULL NULL NULL utf8 utf8_general_ci varchar(1) select + def information_schema STATISTICS COLUMN_NAME 8 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select +@@ -507,9 +507,9 @@ NULL information_schema FILES CHECKSUM bigint NULL NULL NULL NULL bigint(21) uns + 3.0000 information_schema FILES STATUS varchar 20 60 utf8 utf8_general_ci varchar(20) + 3.0000 information_schema FILES EXTRA varchar 255 765 utf8 utf8_general_ci varchar(255) + 3.0000 information_schema GLOBAL_STATUS VARIABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64) +-3.0000 information_schema GLOBAL_STATUS VARIABLE_VALUE varchar 1024 3072 utf8 utf8_general_ci varchar(1024) ++3.0000 information_schema GLOBAL_STATUS VARIABLE_VALUE varchar 2048 6144 utf8 utf8_general_ci varchar(2048) + 3.0000 information_schema GLOBAL_VARIABLES VARIABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64) +-3.0000 information_schema GLOBAL_VARIABLES VARIABLE_VALUE varchar 1024 3072 utf8 utf8_general_ci varchar(1024) ++3.0000 information_schema GLOBAL_VARIABLES VARIABLE_VALUE varchar 2048 6144 utf8 utf8_general_ci varchar(2048) + 3.0000 information_schema KEY_COLUMN_USAGE CONSTRAINT_CATALOG varchar 512 1536 utf8 utf8_general_ci varchar(512) + 3.0000 information_schema KEY_COLUMN_USAGE CONSTRAINT_SCHEMA varchar 64 192 utf8 utf8_general_ci varchar(64) + 3.0000 information_schema KEY_COLUMN_USAGE CONSTRAINT_NAME varchar 64 192 utf8 utf8_general_ci varchar(64) +@@ -639,9 +639,9 @@ NULL information_schema ROUTINES LAST_ALTERED datetime NULL NULL NULL NULL datet + 3.0000 information_schema SCHEMA_PRIVILEGES PRIVILEGE_TYPE varchar 64 192 utf8 utf8_general_ci varchar(64) + 3.0000 information_schema SCHEMA_PRIVILEGES IS_GRANTABLE varchar 3 9 utf8 utf8_general_ci varchar(3) + 3.0000 information_schema SESSION_STATUS VARIABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64) +-3.0000 information_schema SESSION_STATUS VARIABLE_VALUE varchar 1024 3072 utf8 utf8_general_ci varchar(1024) ++3.0000 information_schema SESSION_STATUS VARIABLE_VALUE varchar 2048 6144 utf8 utf8_general_ci varchar(2048) + 3.0000 information_schema SESSION_VARIABLES VARIABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64) +-3.0000 information_schema SESSION_VARIABLES VARIABLE_VALUE varchar 1024 3072 utf8 utf8_general_ci varchar(1024) ++3.0000 information_schema SESSION_VARIABLES VARIABLE_VALUE varchar 2048 6144 utf8 utf8_general_ci varchar(2048) + 3.0000 information_schema STATISTICS TABLE_CATALOG varchar 512 1536 utf8 utf8_general_ci varchar(512) + 3.0000 information_schema STATISTICS TABLE_SCHEMA varchar 64 192 utf8 utf8_general_ci varchar(64) + 3.0000 information_schema STATISTICS TABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64) +diff --git a/mysql-test/suite/galera/galera_2nodes.cnf b/mysql-test/suite/galera/galera_2nodes.cnf +new file mode 100644 +index 0000000..8adae4c +--- /dev/null ++++ b/mysql-test/suite/galera/galera_2nodes.cnf +@@ -0,0 +1,55 @@ ++# Use default setting for mysqld processes ++!include include/default_mysqld.cnf ++ ++[mysqld.1] ++binlog-format=row ++ ++wsrep_provider=@ENV.WSREP_PROVIDER ++wsrep_cluster_address='gcomm://' ++wsrep_provider_options='base_port=@mysqld.1.#galera_port' ++ ++# enforce read-committed characteristics across the cluster ++wsrep_causal_reads=ON ++wsrep_sync_wait = 7 ++ ++wsrep_node_address=127.0.0.1 ++wsrep_sst_receive_address=127.0.0.2:@mysqld.1.#sst_port ++wsrep_node_incoming_address=127.0.0.1:@mysqld.1.port ++ ++# Required for Galera ++innodb_autoinc_lock_mode=2 ++ ++innodb_flush_log_at_trx_commit=2 ++ ++[mysqld.2] ++binlog-format=row ++ ++wsrep_provider=@ENV.WSREP_PROVIDER ++wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port' ++wsrep_provider_options='base_port=@mysqld.2.#galera_port' ++ ++# enforce read-committed characteristics across the cluster ++wsrep_causal_reads=ON ++wsrep_sync_wait = 7 ++ ++wsrep_node_address=127.0.0.1 ++wsrep_sst_receive_address=127.0.0.2:@mysqld.2.#sst_port ++wsrep_node_incoming_address=127.0.0.1:@mysqld.2.port ++ ++# Required for Galera ++innodb_autoinc_lock_mode=2 ++ ++innodb_flush_log_at_trx_commit=2 ++ ++[ENV] ++NODE_MYPORT_1= @mysqld.1.port ++NODE_MYSOCK_1= @mysqld.1.socket ++ ++NODE_MYPORT_2= @mysqld.2.port ++NODE_MYSOCK_2= @mysqld.2.socket ++ ++NODE_GALERAPORT_1= @mysqld.1.#galera_port ++NODE_GALERAPORT_2= @mysqld.2.#galera_port ++ ++NODE_SSTPORT_1= @mysqld.1.#sst_port ++NODE_SSTPORT_2= @mysqld.2.#sst_port +diff --git a/mysql-test/suite/galera/galera_2nodes_as_master.cnf b/mysql-test/suite/galera/galera_2nodes_as_master.cnf +new file mode 100644 +index 0000000..614ece9 +--- /dev/null ++++ b/mysql-test/suite/galera/galera_2nodes_as_master.cnf +@@ -0,0 +1,71 @@ ++# ++# This .cnf file creates a setup with a 2-node Galera cluster and one stand-alone MySQL server, to be used as a slave ++# ++ ++# Use default setting for mysqld processes ++!include include/default_mysqld.cnf ++ ++[mysqld.1] ++server-id=1 ++binlog-format=row ++log-bin=mysqld-bin ++log_slave_updates ++ ++wsrep_provider=@ENV.WSREP_PROVIDER ++wsrep_cluster_address='gcomm://' ++wsrep_provider_options='base_port=@mysqld.1.#galera_port' ++ ++# enforce read-committed characteristics across the cluster ++wsrep_causal_reads=ON ++wsrep_sync_wait = 7 ++ ++wsrep_node_address=127.0.0.1 ++wsrep_sst_receive_address=127.0.0.2:@mysqld.1.#sst_port ++wsrep_node_incoming_address=127.0.0.1:@mysqld.1.port ++ ++# Required for Galera ++innodb_autoinc_lock_mode=2 ++ ++innodb_flush_log_at_trx_commit=2 ++ ++[mysqld.2] ++server-id=2 ++binlog-format=row ++log-bin=mysqld-bin ++log_slave_updates ++ ++wsrep_provider=@ENV.WSREP_PROVIDER ++wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port' ++wsrep_provider_options='base_port=@mysqld.2.#galera_port' ++ ++# enforce read-committed characteristics across the cluster ++wsrep_causal_reads=ON ++wsrep_sync_wait = 7 ++ ++wsrep_node_address=127.0.0.1 ++wsrep_sst_receive_address=127.0.0.2:@mysqld.2.#sst_port ++wsrep_node_incoming_address=127.0.0.1:@mysqld.2.port ++ ++# Required for Galera ++innodb_autoinc_lock_mode=2 ++ ++innodb_flush_log_at_trx_commit=2 ++ ++[mysqld.3] ++server-id=3 ++ ++[ENV] ++NODE_MYPORT_1= @mysqld.1.port ++NODE_MYSOCK_1= @mysqld.1.socket ++ ++NODE_MYPORT_2= @mysqld.2.port ++NODE_MYSOCK_2= @mysqld.2.socket ++ ++NODE_MYPORT_3= @mysqld.3.port ++NODE_MYSOCK_3= @mysqld.3.socket ++ ++NODE_GALERAPORT_1= @mysqld.1.#galera_port ++NODE_GALERAPORT_2= @mysqld.2.#galera_port ++ ++NODE_SSTPORT_1= @mysqld.1.#sst_port ++NODE_SSTPORT_2= @mysqld.2.#sst_port +diff --git a/mysql-test/suite/galera/galera_2nodes_as_slave.cnf b/mysql-test/suite/galera/galera_2nodes_as_slave.cnf +new file mode 100644 +index 0000000..5d14109 +--- /dev/null ++++ b/mysql-test/suite/galera/galera_2nodes_as_slave.cnf +@@ -0,0 +1,68 @@ ++# ++# This .cnf file creates a setup with 1 standard MySQL server, followed by a 2-node Galera cluster ++# ++ ++# Use default setting for mysqld processes ++!include include/default_mysqld.cnf ++ ++[mysqld.1] ++log-bin=mysqld-bin ++binlog-format=row ++server-id=1 ++ ++[mysqld.2] ++binlog-format=row ++server-id=2 ++ ++wsrep_provider=@ENV.WSREP_PROVIDER ++wsrep_cluster_address='gcomm://' ++wsrep_provider_options='base_port=@mysqld.2.#galera_port' ++ ++# enforce read-committed characteristics across the cluster ++wsrep_causal_reads=ON ++wsrep_sync_wait = 7 ++ ++wsrep_node_address=127.0.0.1 ++wsrep_sst_receive_address=127.0.0.2:@mysqld.2.#sst_port ++wsrep_node_incoming_address=127.0.0.1:@mysqld.2.port ++ ++# Required for Galera ++innodb_autoinc_lock_mode=2 ++ ++innodb_flush_log_at_trx_commit=2 ++ ++[mysqld.3] ++binlog-format=row ++ ++wsrep_provider=@ENV.WSREP_PROVIDER ++wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.2.#galera_port' ++wsrep_provider_options='base_port=@mysqld.3.#galera_port' ++ ++# enforce read-committed characteristics across the cluster ++wsrep_causal_reads=ON ++wsrep_sync_wait = 7 ++ ++wsrep_node_address=127.0.0.1 ++wsrep_sst_receive_address=127.0.0.2:@mysqld.3.#sst_port ++wsrep_node_incoming_address=127.0.0.1:@mysqld.3.port ++ ++# Required for Galera ++innodb_autoinc_lock_mode=2 ++ ++innodb_flush_log_at_trx_commit=2 ++ ++[ENV] ++NODE_MYPORT_1= @mysqld.1.port ++NODE_MYSOCK_1= @mysqld.1.socket ++ ++NODE_MYPORT_2= @mysqld.2.port ++NODE_MYSOCK_2= @mysqld.2.socket ++ ++NODE_MYPORT_3= @mysqld.2.port ++NODE_MYSOCK_3= @mysqld.2.socket ++ ++NODE_GALERAPORT_2= @mysqld.2.#galera_port ++NODE_GALERAPORT_3= @mysqld.3.#galera_port ++ ++NODE_SSTPORT_2= @mysqld.2.#sst_port ++NODE_SSTPORT_3= @mysqld.3.#sst_port +diff --git a/mysql-test/suite/galera/galera_4nodes.cnf b/mysql-test/suite/galera/galera_4nodes.cnf +new file mode 100644 +index 0000000..068c734 +--- /dev/null ++++ b/mysql-test/suite/galera/galera_4nodes.cnf +@@ -0,0 +1,97 @@ ++# Use default setting for mysqld processes ++!include include/default_mysqld.cnf ++ ++[mysqld.1] ++binlog-format=row ++ ++wsrep_provider=@ENV.WSREP_PROVIDER ++wsrep_cluster_address='gcomm://' ++wsrep_provider_options='base_port=@mysqld.1.#galera_port' ++ ++# enforce read-committed characteristics across the cluster ++wsrep_causal_reads=ON ++wsrep_sync_wait = 7 ++ ++wsrep_node_address=127.0.0.1 ++wsrep_sst_receive_address=127.0.0.2:@mysqld.1.#sst_port ++wsrep_node_incoming_address=127.0.0.1:@mysqld.1.port ++ ++# Required for Galera ++innodb_autoinc_lock_mode=2 ++ ++[mysqld.2] ++binlog-format=row ++ ++wsrep_provider=@ENV.WSREP_PROVIDER ++wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port' ++wsrep_provider_options='base_port=@mysqld.2.#galera_port' ++ ++# enforce read-committed characteristics across the cluster ++wsrep_causal_reads=ON ++wsrep_sync_wait = 7 ++ ++wsrep_node_address=127.0.0.1 ++wsrep_sst_receive_address=127.0.0.2:@mysqld.2.#sst_port ++wsrep_node_incoming_address=127.0.0.1:@mysqld.2.port ++ ++# Required for Galera ++innodb_autoinc_lock_mode=2 ++ ++[mysqld.3] ++binlog-format=row ++ ++wsrep_provider=@ENV.WSREP_PROVIDER ++wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port' ++wsrep_provider_options='base_port=@mysqld.3.#galera_port' ++ ++# enforce read-committed characteristics across the cluster ++wsrep_causal_reads=ON ++wsrep_sync_wait = 7 ++ ++wsrep_node_address=127.0.0.1 ++wsrep_sst_receive_address=127.0.0.2:@mysqld.3.#sst_port ++wsrep_node_incoming_address=127.0.0.1:@mysqld.3.port ++ ++# Required for Galera ++innodb_autoinc_lock_mode=2 ++ ++[mysqld.4] ++binlog-format=row ++ ++wsrep_provider=@ENV.WSREP_PROVIDER ++wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port' ++wsrep_provider_options='base_port=@mysqld.4.#galera_port' ++ ++# enforce read-committed characteristics across the cluster ++wsrep_causal_reads=ON ++wsrep_sync_wait = 7 ++ ++wsrep_node_address=127.0.0.1 ++wsrep_sst_receive_address=127.0.0.2:@mysqld.4.#sst_port ++wsrep_node_incoming_address=127.0.0.1:@mysqld.4.port ++ ++# Required for Galera ++innodb_autoinc_lock_mode=2 ++ ++[ENV] ++NODE_MYPORT_1= @mysqld.1.port ++NODE_MYSOCK_1= @mysqld.1.socket ++ ++NODE_MYPORT_2= @mysqld.2.port ++NODE_MYSOCK_2= @mysqld.2.socket ++ ++NODE_MYPORT_3= @mysqld.3.port ++NODE_MYSOCK_3= @mysqld.3.socket ++ ++NODE_MYPORT_4= @mysqld.4.port ++NODE_MYSOCK_4= @mysqld.4.socket ++ ++NODE_GALERAPORT_1= @mysqld.1.#galera_port ++NODE_GALERAPORT_2= @mysqld.2.#galera_port ++NODE_GALERAPORT_3= @mysqld.3.#galera_port ++NODE_GALERAPORT_4= @mysqld.4.#galera_port ++ ++NODE_SSTPORT_1= @mysqld.1.#sst_port ++NODE_SSTPORT_2= @mysqld.2.#sst_port ++NODE_SSTPORT_3= @mysqld.3.#sst_port ++NODE_SSTPORT_4= @mysqld.4.#sst_port +diff --git a/mysql-test/suite/galera/include/galera_have_debug_sync.inc b/mysql-test/suite/galera/include/galera_have_debug_sync.inc +new file mode 100644 +index 0000000..7c01560 +--- /dev/null ++++ b/mysql-test/suite/galera/include/galera_have_debug_sync.inc +@@ -0,0 +1,9 @@ ++--disable_query_log ++ ++--let $galera_have_debug_sync = `SELECT 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_debug_sync_waiters'` ++ ++--if (!$galera_have_debug_sync) { ++ --skip "Test requires Galera debug library with debug_sync functionality" ++} ++ ++--enable_query_log +diff --git a/mysql-test/suite/galera/include/galera_load_provider.inc b/mysql-test/suite/galera/include/galera_load_provider.inc +new file mode 100644 +index 0000000..0ecf43e +--- /dev/null ++++ b/mysql-test/suite/galera/include/galera_load_provider.inc +@@ -0,0 +1,10 @@ ++--echo Loading wsrep provider ... ++ ++--disable_query_log ++--eval SET GLOBAL wsrep_provider = '$wsrep_provider_orig'; ++--eval SET GLOBAL wsrep_cluster_address = '$wsrep_cluster_address_orig'; ++--enable_query_log ++ ++--enable_reconnect ++--source include/wait_until_connected_again.inc ++--source include/galera_wait_ready.inc +diff --git a/mysql-test/suite/galera/include/galera_reset_cluster_address.inc b/mysql-test/suite/galera/include/galera_reset_cluster_address.inc +new file mode 100644 +index 0000000..02937ec +--- /dev/null ++++ b/mysql-test/suite/galera/include/galera_reset_cluster_address.inc +@@ -0,0 +1,12 @@ ++--echo Resetting wsrep_cluster_address ++ ++--let $wsrep_cluster_size_orig = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'` ++ ++SET GLOBAL wsrep_cluster_address = @@wsrep_cluster_address; ++ ++--source include/wait_until_connected_again.inc ++ ++# Wait for wsrep_cluster_size to go back to its original value ++ ++--let $wait_condition = SELECT VARIABLE_VALUE = $wsrep_cluster_size_orig FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' ++--source include/wait_condition.inc +diff --git a/mysql-test/suite/galera/include/galera_sst_restore.inc b/mysql-test/suite/galera/include/galera_sst_restore.inc +new file mode 100644 +index 0000000..a08b148 +--- /dev/null ++++ b/mysql-test/suite/galera/include/galera_sst_restore.inc +@@ -0,0 +1,29 @@ ++# ++# Restore the various options used for SST to their original values ++# so that MTR's end-of-test checks are happy. ++# ++ ++--connection node_1 ++CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query"); ++ ++--disable_query_log ++--eval SET GLOBAL wsrep_sst_auth = '$wsrep_sst_auth_orig'; ++--enable_query_log ++ ++--error 0,ER_CANNOT_USER ++DROP USER sst; ++ ++--connection node_2 ++CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query"); ++CALL mtr.add_suppression("InnoDB: Error: Table \"mysql\"\\.\"innodb_index_stats\" not found"); ++CALL mtr.add_suppression("InnoDB: New log files created"); ++CALL mtr.add_suppression("InnoDB: Creating foreign key constraint system tables"); ++CALL mtr.add_suppression("Can't open and lock time zone table"); ++CALL mtr.add_suppression("Can't open and lock privilege tables"); ++CALL mtr.add_suppression("Info table is not ready to be used"); ++CALL mtr.add_suppression("Native table .* has the wrong structure"); ++ ++--disable_query_log ++--eval SET GLOBAL wsrep_sst_method = '$wsrep_sst_method_orig'; ++--eval SET GLOBAL wsrep_sst_receive_address = '$wsrep_sst_receive_address_orig'; ++--enable_query_log +diff --git a/mysql-test/suite/galera/include/galera_sst_set_mysqldump.inc b/mysql-test/suite/galera/include/galera_sst_set_mysqldump.inc +new file mode 100644 +index 0000000..405c16c +--- /dev/null ++++ b/mysql-test/suite/galera/include/galera_sst_set_mysqldump.inc +@@ -0,0 +1,22 @@ ++# ++# Set all the variables required for the SST to be performed via mysqldump ++# ++ ++--echo Setting SST method to mysqldump ... ++ ++--connection node_1 ++# We need a user with a password to perform SST, otherwise we hit LP #1378253 ++GRANT ALL PRIVILEGES ON *.* TO 'sst' IDENTIFIED BY 'sst'; ++ ++--let $wsrep_sst_auth_orig = `SELECT @@wsrep_sst_auth` ++SET GLOBAL wsrep_sst_auth = 'sst:sst'; ++ ++--connection node_2 ++--let $wsrep_sst_method_orig = `SELECT @@wsrep_sst_method` ++--let $wsrep_sst_receive_address_orig = `SELECT @@wsrep_sst_receive_address` ++ ++--disable_query_log ++# Set wsrep_sst_receive_address to the SQL port ++--eval SET GLOBAL wsrep_sst_receive_address = '127.0.0.2:$NODE_MYPORT_2'; ++--enable_query_log ++SET GLOBAL wsrep_sst_method = 'mysqldump'; +diff --git a/mysql-test/suite/galera/include/galera_st_clean_slave.inc b/mysql-test/suite/galera/include/galera_st_clean_slave.inc +new file mode 100644 +index 0000000..3a49f4f +--- /dev/null ++++ b/mysql-test/suite/galera/include/galera_st_clean_slave.inc +@@ -0,0 +1,115 @@ ++--echo Performing State Transfer on a server that starts from a clean var directory ++--echo This is accomplished by shutting down node #2 and removing its var directory before restarting it ++ ++--connection node_1 ++CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++COMMIT; ++ ++--connection node_2 ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++COMMIT; ++ ++--echo Shutting down server ... ++--source include/shutdown_mysqld.inc ++ ++--connection node_1 ++--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' ++--source include/wait_condition.inc ++ ++--echo Cleaning var directory ... ++--remove_files_wildcard $MYSQLTEST_VARDIR/mysqld.2/data/mtr ++--remove_files_wildcard $MYSQLTEST_VARDIR/mysqld.2/data/performance_schema ++--remove_files_wildcard $MYSQLTEST_VARDIR/mysqld.2/data/test ++--remove_files_wildcard $MYSQLTEST_VARDIR/mysqld.2/data/mysql ++--remove_files_wildcard $MYSQLTEST_VARDIR/mysqld.2/data ++ ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++COMMIT; ++ ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++ ++--connect node_1a_galera_st_clean_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1 ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++ ++--connection node_2 ++--echo Starting server ... ++--source include/start_mysqld.inc ++ ++--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' ++--source include/wait_condition.inc ++ ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++COMMIT; ++ ++--connection node_1 ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++COMMIT; ++ ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++COMMIT; ++ ++--connection node_1a_galera_st_clean_slave ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++ROLLBACK; ++ ++SELECT COUNT(*) = 35 FROM t1; ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++COMMIT; ++SET AUTOCOMMIT=ON; ++ ++--connection node_1 ++SELECT COUNT(*) = 35 FROM t1; ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++DROP TABLE t1; ++COMMIT; ++SET AUTOCOMMIT=ON; +diff --git a/mysql-test/suite/galera/include/galera_st_disconnect_slave.inc b/mysql-test/suite/galera/include/galera_st_disconnect_slave.inc +new file mode 100644 +index 0000000..c886974 +--- /dev/null ++++ b/mysql-test/suite/galera/include/galera_st_disconnect_slave.inc +@@ -0,0 +1,105 @@ ++--echo Performing State Transfer on a server that has been temporarily disconnected ++ ++--connection node_1 ++CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++COMMIT; ++ ++--connection node_2 ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++COMMIT; ++ ++--source suite/galera/include/galera_unload_provider.inc ++ ++--connection node_1 ++--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' ++--source include/wait_condition.inc ++ ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++COMMIT; ++ ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++ ++--connect node_1a_galera_st_disconnect_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1 ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++ ++--connection node_2 ++--source suite/galera/include/galera_load_provider.inc ++ ++--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' ++--source include/wait_condition.inc ++ ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++COMMIT; ++ ++--connection node_1 ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++COMMIT; ++ ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++COMMIT; ++ ++--connection node_1a_galera_st_disconnect_slave ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++ROLLBACK; ++ ++SELECT COUNT(*) = 35 FROM t1; ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++COMMIT; ++SET AUTOCOMMIT=ON; ++ ++--connection node_1 ++SELECT COUNT(*) = 35 FROM t1; ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++DROP TABLE t1; ++COMMIT; ++SET AUTOCOMMIT=ON; +diff --git a/mysql-test/suite/galera/include/galera_st_kill_slave.inc b/mysql-test/suite/galera/include/galera_st_kill_slave.inc +new file mode 100644 +index 0000000..534d7b6 +--- /dev/null ++++ b/mysql-test/suite/galera/include/galera_st_kill_slave.inc +@@ -0,0 +1,110 @@ ++--echo Performing State Transfer on a server that has been killed and restarted ++ ++--connection node_1 ++CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++COMMIT; ++ ++--connection node_2 ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++COMMIT; ++ ++--source include/kill_galera.inc ++ ++--connection node_1 ++--source include/wait_until_connected_again.inc ++--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' ++--source include/wait_condition.inc ++ ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++COMMIT; ++ ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++ ++--connect node_1a_galera_st_kill_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1 ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++ ++--connection node_2 ++--let $galera_wsrep_recover_server_id=2 ++--source suite/galera/include/galera_wsrep_recover.inc ++ ++--echo Starting server ... ++--source include/start_mysqld.inc ++ ++--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' ++--source include/wait_condition.inc ++ ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++COMMIT; ++ ++--connection node_1 ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++COMMIT; ++ ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++COMMIT; ++ ++--connection node_1a_galera_st_kill_slave ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++ROLLBACK; ++ ++SELECT COUNT(*) = 35 FROM t1; ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++COMMIT; ++SET AUTOCOMMIT=ON; ++ ++--connection node_1 ++SELECT COUNT(*) = 35 FROM t1; ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++DROP TABLE t1; ++COMMIT; ++SET AUTOCOMMIT=ON; +diff --git a/mysql-test/suite/galera/include/galera_st_kill_slave_ddl.inc b/mysql-test/suite/galera/include/galera_st_kill_slave_ddl.inc +new file mode 100644 +index 0000000..8b99b1e +--- /dev/null ++++ b/mysql-test/suite/galera/include/galera_st_kill_slave_ddl.inc +@@ -0,0 +1,123 @@ ++--echo Performing State Transfer on a server that has been killed and restarted ++--echo while a DDL was in progress on it ++ ++--connection node_1 ++CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++ ++--connection node_2 ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++COMMIT; ++ ++# Suspend the applier as it applies the ALTER TABLE ++--let $debug_orig = `SELECT @@debug` ++SET GLOBAL debug = 'd,sync.alter_opened_table'; ++ ++--connection node_1 ++ALTER TABLE t1 ADD COLUMN f2 INTEGER; ++ ++--connection node_2 ++SET wsrep_sync_wait = 0; ++--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE = 'debug sync point: now' ++--source include/wait_condition.inc ++ ++--source include/kill_galera.inc ++ ++--connection node_1 ++--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' ++--source include/wait_condition.inc ++ ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); ++COMMIT; ++ ++START TRANSACTION; ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++ ++--connect node_1a_galera_st_kill_slave_ddl, 127.0.0.1, root, , test, $NODE_MYPORT_1 ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++ ++--connection node_2 ++--let $galera_wsrep_recover_server_id=2 ++--source suite/galera/include/galera_wsrep_recover.inc ++ ++--connection node_2 ++--echo Starting server ... ++--source include/start_mysqld.inc ++ ++--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' ++--source include/wait_condition.inc ++ ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); ++COMMIT; ++ ++--connection node_1 ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++COMMIT; ++ ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); ++COMMIT; ++ ++--connection node_1a_galera_st_kill_slave_ddl ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++ROLLBACK; ++ ++SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; ++SELECT COUNT(*) = 35 FROM t1; ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++COMMIT; ++SET AUTOCOMMIT=ON; ++ ++--connection node_1 ++SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; ++SELECT COUNT(*) = 35 FROM t1; ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++DROP TABLE t1; ++COMMIT; ++SET AUTOCOMMIT=ON; +diff --git a/mysql-test/suite/galera/include/galera_st_shutdown_slave.inc b/mysql-test/suite/galera/include/galera_st_shutdown_slave.inc +new file mode 100644 +index 0000000..6c09b0c +--- /dev/null ++++ b/mysql-test/suite/galera/include/galera_st_shutdown_slave.inc +@@ -0,0 +1,107 @@ ++--echo Performing State Transfer on a server that has been shut down cleanly and restarted ++ ++--connection node_1 ++CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++COMMIT; ++ ++--connection node_2 ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++COMMIT; ++ ++--echo Shutting down server ... ++--source include/shutdown_mysqld.inc ++ ++--connection node_1 ++--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' ++--source include/wait_condition.inc ++ ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++COMMIT; ++ ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++ ++--connect node_1a_galera_st_shutdown_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1 ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++ ++--connection node_2 ++--echo Starting server ... ++--source include/start_mysqld.inc ++ ++--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' ++--source include/wait_condition.inc ++ ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++COMMIT; ++ ++--connection node_1 ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++COMMIT; ++ ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++COMMIT; ++ ++--connection node_1a_galera_st_shutdown_slave ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++ROLLBACK; ++ ++SELECT COUNT(*) = 35 FROM t1; ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++COMMIT; ++SET AUTOCOMMIT=ON; ++ ++--connection node_1 ++SELECT COUNT(*) = 35 FROM t1; ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++DROP TABLE t1; ++COMMIT; ++SET AUTOCOMMIT=ON; +diff --git a/mysql-test/suite/galera/include/galera_unload_provider.inc b/mysql-test/suite/galera/include/galera_unload_provider.inc +new file mode 100644 +index 0000000..edc7eb3 +--- /dev/null ++++ b/mysql-test/suite/galera/include/galera_unload_provider.inc +@@ -0,0 +1,7 @@ ++--echo Unloading wsrep provider ... ++ ++--let $wsrep_cluster_address_orig = `SELECT @@wsrep_cluster_address` ++--let $wsrep_provider_orig = `SELECT @@wsrep_provider` ++--let $wsrep_provider_options_orig = `SELECT @@wsrep_provider_options` ++ ++SET GLOBAL wsrep_provider = 'none'; +diff --git a/mysql-test/suite/galera/include/galera_wsrep_recover.inc b/mysql-test/suite/galera/include/galera_wsrep_recover.inc +new file mode 100644 +index 0000000..3126955 +--- /dev/null ++++ b/mysql-test/suite/galera/include/galera_wsrep_recover.inc +@@ -0,0 +1,23 @@ ++--echo Performing --wsrep-recover ... ++--exec $MYSQLD --defaults-group-suffix=.$galera_wsrep_recover_server_id --defaults-file=$MYSQLTEST_VARDIR/my.cnf --wsrep-recover > $MYSQL_TMP_DIR/galera_wsrep_recover.log 2>&1 ++ ++--perl ++ use strict; ++ my $wsrep_start_position_str = "grep 'WSREP: Recovered position:' $ENV{MYSQL_TMP_DIR}/galera_wsrep_recover.log | sed 's/.*WSREP\:\ Recovered\ position://' | sed 's/^[ \t]*//'"; ++ my $wsrep_start_position = `grep 'WSREP: Recovered position:' $ENV{MYSQL_TMP_DIR}/galera_wsrep_recover.log | sed 's/.*WSREP\:\ Recovered\ position://' | sed 's/^[ \t]*//'`; ++ chomp($wsrep_start_position); ++ ++ die if $wsrep_start_position eq ''; ++ ++ open(FILE, ">", "$ENV{MYSQL_TMP_DIR}/galera_wsrep_start_position.inc") or die; ++ print FILE "--let \$galera_wsrep_start_position = $wsrep_start_position\n"; ++ close FILE; ++EOF ++ ++--source $MYSQL_TMP_DIR/galera_wsrep_start_position.inc ++ ++if ($galera_wsrep_start_position == '') { ++ --die "Could not obtain wsrep_start_position." ++} ++ ++--remove_file $MYSQL_TMP_DIR/galera_wsrep_start_position.inc +diff --git a/mysql-test/suite/galera/my.cnf b/mysql-test/suite/galera/my.cnf +new file mode 100644 +index 0000000..ca163a5 +--- /dev/null ++++ b/mysql-test/suite/galera/my.cnf +@@ -0,0 +1 @@ ++!include galera_2nodes.cnf +diff --git a/mysql-test/suite/galera/r/galera_account_management.result b/mysql-test/suite/galera/r/galera_account_management.result +new file mode 100644 +index 0000000..9b3ae9b +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_account_management.result +@@ -0,0 +1,40 @@ ++CREATE USER user1, user2 IDENTIFIED BY 'password'; ++SELECT COUNT(*) = 2 FROM mysql.user WHERE user IN ('user1', 'user2'); ++COUNT(*) = 2 ++1 ++RENAME USER user2 TO user3; ++SELECT COUNT(*) = 0 FROM mysql.user WHERE user = 'user2'; ++COUNT(*) = 0 ++1 ++SELECT COUNT(*) = 1 FROM mysql.user WHERE user = 'user3'; ++COUNT(*) = 1 ++1 ++SET PASSWORD FOR user3 = PASSWORD('foo'); ++SELECT password != '' FROM mysql.user WHERE user = 'user3'; ++password != '' ++1 ++DROP USER user1, user3; ++SELECT COUNT(*) = 0 FROM mysql.user WHERE user IN ('user1', 'user2'); ++COUNT(*) = 0 ++1 ++GRANT ALL ON *.* TO user4 IDENTIFIED BY 'password'; ++SELECT COUNT(*) = 1 FROM mysql.user WHERE user = 'user4'; ++COUNT(*) = 1 ++1 ++SELECT Select_priv = 'Y' FROM mysql.user WHERE user = 'user4'; ++Select_priv = 'Y' ++1 ++CREATE USER user5; ++GRANT PROXY ON user4 TO user5; ++SELECT COUNT(*) = 1 FROM mysql.proxies_priv WHERE user = 'user5'; ++COUNT(*) = 1 ++1 ++REVOKE ALL PRIVILEGES ON *.* FROM user4; ++SELECT Select_priv = 'N' FROM mysql.user WHERE user = 'user4'; ++Select_priv = 'N' ++1 ++REVOKE PROXY ON user4 FROM user5; ++SELECT COUNT(*) = 0 FROM mysql.proxies_priv WHERE user = 'user5'; ++COUNT(*) = 0 ++1 ++DROP USER user4, user5; +diff --git a/mysql-test/suite/galera/r/galera_alter_engine_innodb.result b/mysql-test/suite/galera/r/galera_alter_engine_innodb.result +new file mode 100644 +index 0000000..2b30ac5 +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_alter_engine_innodb.result +@@ -0,0 +1,10 @@ ++CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; ++INSERT INTO t1 VALUES (1); ++ALTER TABLE t1 ENGINE=InnoDB; ++SELECT ENGINE = 'InnoDB' FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'; ++ENGINE = 'InnoDB' ++1 ++SELECT COUNT(*) = 1 FROM t1; ++COUNT(*) = 1 ++1 ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/r/galera_alter_engine_myisam.result b/mysql-test/suite/galera/r/galera_alter_engine_myisam.result +new file mode 100644 +index 0000000..280cb58 +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_alter_engine_myisam.result +@@ -0,0 +1,11 @@ ++SET GLOBAL wsrep_replicate_myisam = TRUE; ++CREATE TABLE t1 (f1 INTEGER) ENGINE=MyISAM; ++INSERT INTO t1 VALUES (1); ++ALTER TABLE t1 ENGINE=InnoDB; ++SELECT ENGINE = 'InnoDB' FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'; ++ENGINE = 'InnoDB' ++1 ++SELECT COUNT(*) = 1 FROM t1; ++COUNT(*) = 1 ++1 ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/r/galera_alter_table_force.result b/mysql-test/suite/galera/r/galera_alter_table_force.result +new file mode 100644 +index 0000000..401ab46 +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_alter_table_force.result +@@ -0,0 +1,10 @@ ++CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; ++INSERT INTO t1 VALUES (1); ++ALTER TABLE t1 FORCE; ++SELECT ENGINE = 'InnoDB' FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'; ++ENGINE = 'InnoDB' ++1 ++SELECT COUNT(*) = 1 FROM t1; ++COUNT(*) = 1 ++1 ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/r/galera_as_master.result b/mysql-test/suite/galera/r/galera_as_master.result +new file mode 100644 +index 0000000..cca5535 +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_as_master.result +@@ -0,0 +1,9 @@ ++START SLAVE USER='root'; ++Warnings: ++Note 1759 Sending passwords in plain text without SSL/TLS is extremely insecure. ++CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; ++INSERT INTO t1 VALUES(1); ++INSERT INTO t1 VALUES(2); ++DROP TABLE t1; ++STOP SLAVE; ++RESET SLAVE ALL; +diff --git a/mysql-test/suite/galera/r/galera_as_master_gtid.result b/mysql-test/suite/galera/r/galera_as_master_gtid.result +new file mode 100644 +index 0000000..8dfe462 +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_as_master_gtid.result +@@ -0,0 +1,59 @@ ++START SLAVE USER='root'; ++Warnings: ++Note 1759 Sending passwords in plain text without SSL/TLS is extremely insecure. ++CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; ++INSERT INTO t1 VALUES(1); ++uuids_do_not_match ++1 ++SHOW BINLOG EVENTS IN 'mysqld-bin.000002' FROM 120; ++Log_name Pos Event_type Server_id End_log_pos Info ++mysqld-bin.000002 120 Previous_gtids 1 151 ++mysqld-bin.000002 151 Gtid 1 199 SET @@SESSION.GTID_NEXT= ':1' ++mysqld-bin.000002 199 Query 1 327 use `test`; CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB ++mysqld-bin.000002 327 Gtid 1 375 SET @@SESSION.GTID_NEXT= ':2' ++mysqld-bin.000002 375 Query 1 452 BEGIN ++mysqld-bin.000002 452 Table_map 1 497 table_id: # (test.t1) ++mysqld-bin.000002 497 Write_rows 1 537 table_id: # flags: STMT_END_F ++mysqld-bin.000002 537 Xid 1 568 COMMIT /* xid=# */ ++INSERT INTO t1 VALUES(2); ++uuids_do_not_match ++1 ++uuids_match ++1 ++SHOW BINLOG EVENTS IN 'mysqld-bin.000003' FROM 120; ++Log_name Pos Event_type Server_id End_log_pos Info ++mysqld-bin.000003 120 Previous_gtids 2 151 ++mysqld-bin.000003 151 Gtid 1 199 SET @@SESSION.GTID_NEXT= ':1' ++mysqld-bin.000003 199 Query 1 327 use `test`; CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB ++mysqld-bin.000003 327 Gtid 1 375 SET @@SESSION.GTID_NEXT= ':2' ++mysqld-bin.000003 375 Query 1 443 BEGIN ++mysqld-bin.000003 443 Table_map 1 488 table_id: # (test.t1) ++mysqld-bin.000003 488 Write_rows 1 528 table_id: # flags: STMT_END_F ++mysqld-bin.000003 528 Xid 1 559 COMMIT /* xid=# */ ++mysqld-bin.000003 559 Gtid 2 607 SET @@SESSION.GTID_NEXT= ':3' ++mysqld-bin.000003 607 Query 2 684 BEGIN ++mysqld-bin.000003 684 Table_map 2 729 table_id: # (test.t1) ++mysqld-bin.000003 729 Write_rows 2 769 table_id: # flags: STMT_END_F ++mysqld-bin.000003 769 Xid 2 800 COMMIT /* xid=# */ ++uuids_do_not_match ++1 ++uuids_match ++1 ++SHOW BINLOG EVENTS IN 'mysqld-bin.000001' FROM 120; ++Log_name Pos Event_type Server_id End_log_pos Info ++mysqld-bin.000001 120 Previous_gtids 3 151 ++mysqld-bin.000001 151 Gtid 1 199 SET @@SESSION.GTID_NEXT= ':1' ++mysqld-bin.000001 199 Query 1 327 use `test`; CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB ++mysqld-bin.000001 327 Gtid 1 375 SET @@SESSION.GTID_NEXT= ':2' ++mysqld-bin.000001 375 Query 1 443 BEGIN ++mysqld-bin.000001 443 Table_map 1 488 table_id: # (test.t1) ++mysqld-bin.000001 488 Write_rows 1 528 table_id: # flags: STMT_END_F ++mysqld-bin.000001 528 Xid 1 559 COMMIT /* xid=# */ ++mysqld-bin.000001 559 Gtid 2 607 SET @@SESSION.GTID_NEXT= ':3' ++mysqld-bin.000001 607 Query 2 675 BEGIN ++mysqld-bin.000001 675 Table_map 2 720 table_id: # (test.t1) ++mysqld-bin.000001 720 Write_rows 2 760 table_id: # flags: STMT_END_F ++mysqld-bin.000001 760 Xid 2 791 COMMIT /* xid=# */ ++DROP TABLE t1; ++STOP SLAVE; ++RESET SLAVE ALL; +diff --git a/mysql-test/suite/galera/r/galera_as_master_gtid_change_master.result b/mysql-test/suite/galera/r/galera_as_master_gtid_change_master.result +new file mode 100644 +index 0000000..80fbccf +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_as_master_gtid_change_master.result +@@ -0,0 +1,15 @@ ++START SLAVE USER='root'; ++Warnings: ++Note 1759 Sending passwords in plain text without SSL/TLS is extremely insecure. ++CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; ++INSERT INTO t1 VALUES(1); ++INSERT INTO t1 VALUES(2); ++STOP SLAVE; ++START SLAVE USER='root'; ++Warnings: ++Note 1759 Sending passwords in plain text without SSL/TLS is extremely insecure. ++INSERT INTO t1 VALUES(3); ++INSERT INTO t1 VALUES(4); ++DROP TABLE t1; ++STOP SLAVE; ++RESET SLAVE ALL; +diff --git a/mysql-test/suite/galera/r/galera_as_slave.result b/mysql-test/suite/galera/r/galera_as_slave.result +new file mode 100644 +index 0000000..f03c813 +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_as_slave.result +@@ -0,0 +1,16 @@ ++START SLAVE USER='root'; ++Warnings: ++Note 1759 Sending passwords in plain text without SSL/TLS is extremely insecure. ++CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; ++INSERT INTO t1 VALUES(1); ++INSERT INTO t1 VALUES (2); ++SELECT COUNT(*) = 2 FROM t1; ++COUNT(*) = 2 ++1 ++INSERT INTO t1 VALUES (3); ++SELECT COUNT(*) = 3 FROM t1; ++COUNT(*) = 3 ++1 ++DROP TABLE t1; ++STOP SLAVE; ++RESET SLAVE ALL; +diff --git a/mysql-test/suite/galera/r/galera_as_slave_gtid.result b/mysql-test/suite/galera/r/galera_as_slave_gtid.result +new file mode 100644 +index 0000000..f7ee666 +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_as_slave_gtid.result +@@ -0,0 +1,18 @@ ++START SLAVE USER='root'; ++Warnings: ++Note 1759 Sending passwords in plain text without SSL/TLS is extremely insecure. ++CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; ++INSERT INTO t1 VALUES(1); ++SELECT LENGTH(@@global.gtid_executed) > 1; ++LENGTH(@@global.gtid_executed) > 1 ++1 ++gtid_executed_equal ++1 ++SELECT COUNT(*) = 1 FROM t1; ++COUNT(*) = 1 ++1 ++gtid_executed_equal ++1 ++DROP TABLE t1; ++STOP SLAVE; ++RESET SLAVE ALL; +diff --git a/mysql-test/suite/galera/r/galera_bf_abort.result b/mysql-test/suite/galera/r/galera_bf_abort.result +new file mode 100644 +index 0000000..c55f1a4 +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_bf_abort.result +@@ -0,0 +1,10 @@ ++CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES (1); ++INSERT INTO t1 VALUES (1); ++INSERT INTO t1 VALUES (2); ++ERROR 40001: Deadlock found when trying to get lock; try restarting transaction ++wsrep_local_aborts_increment ++1 ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/r/galera_bf_abort_for_update.result b/mysql-test/suite/galera/r/galera_bf_abort_for_update.result +new file mode 100644 +index 0000000..3978a3d +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_bf_abort_for_update.result +@@ -0,0 +1,10 @@ ++CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES (1); ++INSERT INTO t1 VALUES (1); ++SELECT * FROM t1 FOR UPDATE; ++ERROR 40001: Deadlock found when trying to get lock; try restarting transaction ++wsrep_local_aborts_increment ++1 ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/r/galera_bf_abort_ftwrl.result b/mysql-test/suite/galera/r/galera_bf_abort_ftwrl.result +new file mode 100644 +index 0000000..e381917 +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_bf_abort_ftwrl.result +@@ -0,0 +1,8 @@ ++CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; ++SET AUTOCOMMIT=OFF; ++FLUSH TABLES WITH READ LOCK;; ++INSERT INTO t1 VALUES (1); ++UNLOCK TABLES; ++wsrep_local_aborts_increment ++1 ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/r/galera_bf_abort_get_lock.result b/mysql-test/suite/galera/r/galera_bf_abort_get_lock.result +new file mode 100644 +index 0000000..2e44a77 +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_bf_abort_get_lock.result +@@ -0,0 +1,12 @@ ++CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; ++SELECT GET_LOCK("foo", 1000); ++GET_LOCK("foo", 1000) ++1 ++SET AUTOCOMMIT=OFF; ++INSERT INTO t1 VALUES (1); ++SELECT GET_LOCK("foo", 1000);; ++INSERT INTO t1 VALUES (1); ++ERROR 40001: Deadlock found when trying to get lock; try restarting transaction ++wsrep_local_aborts_increment ++1 ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/r/galera_bf_abort_lock_table.result b/mysql-test/suite/galera/r/galera_bf_abort_lock_table.result +new file mode 100644 +index 0000000..e657e72 +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_bf_abort_lock_table.result +@@ -0,0 +1,8 @@ ++CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; ++SET AUTOCOMMIT=OFF; ++LOCK TABLE t1 WRITE; ++INSERT INTO t1 VALUES (1);; ++INSERT INTO t1 VALUES (2); ++wsrep_local_aborts_increment ++1 ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/r/galera_bf_abort_sleep.result b/mysql-test/suite/galera/r/galera_bf_abort_sleep.result +new file mode 100644 +index 0000000..8e85a5f +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_bf_abort_sleep.result +@@ -0,0 +1,9 @@ ++CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; ++SET AUTOCOMMIT=OFF; ++INSERT INTO t1 VALUES (1); ++SELECT SLEEP(1000);; ++INSERT INTO t1 VALUES (1); ++ERROR 40001: Deadlock found when trying to get lock; try restarting transaction ++wsrep_local_aborts_increment ++1 ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/r/galera_binlog_cache_size.result b/mysql-test/suite/galera/r/galera_binlog_cache_size.result +new file mode 100644 +index 0000000..9726cf2 +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_binlog_cache_size.result +@@ -0,0 +1,12 @@ ++CREATE TABLE t1 (f1 VARCHAR(767)) ENGINE=InnoDB; ++CREATE TABLE ten (f1 INTEGER); ++INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); ++SET GLOBAL binlog_cache_size=4096; ++SET GLOBAL max_binlog_cache_size=4096; ++SET AUTOCOMMIT=ON; ++START TRANSACTION; ++INSERT INTO t1 SELECT REPEAT('a', 767) FROM ten; ++INSERT INTO t1 SELECT REPEAT('a', 767) FROM ten; ++ERROR HY000: Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage; increase this mysqld variable and try again ++DROP TABLE t1; ++DROP TABLE ten; +diff --git a/mysql-test/suite/galera/r/galera_binlog_checksum.result b/mysql-test/suite/galera/r/galera_binlog_checksum.result +new file mode 100644 +index 0000000..a6ab623 +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_binlog_checksum.result +@@ -0,0 +1,10 @@ ++CREATE TABLE t1 (f1 INT PRIMARY KEY) ENGINE=InnoDB; ++INSERT INTO t1 VALUES (1); ++SELECT COUNT(*) = 1 FROM t1; ++COUNT(*) = 1 ++1 ++UPDATE t1 SET f1 = 2 WHERE f1 = 1; ++SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2; ++COUNT(*) = 1 ++1 ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/r/galera_binlog_event_max_size_max.result b/mysql-test/suite/galera/r/galera_binlog_event_max_size_max.result +new file mode 100644 +index 0000000..4156c0c +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_binlog_event_max_size_max.result +@@ -0,0 +1,9 @@ ++CREATE TABLE ten (f1 INTEGER); ++INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); ++CREATE TABLE t1 (f1 VARCHAR(1000)); ++INSERT INTO t1 SELECT REPEAT('x', 1000) FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4; ++SELECT COUNT(*) = 10000 FROM t1; ++COUNT(*) = 10000 ++1 ++DROP TABLE t1; ++DROP TABLE ten; +diff --git a/mysql-test/suite/galera/r/galera_binlog_event_max_size_min.result b/mysql-test/suite/galera/r/galera_binlog_event_max_size_min.result +new file mode 100644 +index 0000000..984a943 +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_binlog_event_max_size_min.result +@@ -0,0 +1,6 @@ ++CREATE TABLE t1 (f1 VARCHAR(1000)); ++INSERT INTO t1 VALUES (REPEAT('x', 1000)); ++SELECT COUNT(*) = 1 FROM t1 WHERE f1 = REPEAT('x', 1000); ++COUNT(*) = 1 ++1 ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/r/galera_binlog_row_image.result b/mysql-test/suite/galera/r/galera_binlog_row_image.result +new file mode 100644 +index 0000000..a1f0fb4 +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_binlog_row_image.result +@@ -0,0 +1,79 @@ ++SET SESSION binlog_row_image=minimal; ++CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; ++CREATE TABLE t2 (f1 INTEGER NOT NULL UNIQUE) ENGINE=InnoDB; ++CREATE TABLE t3 (f1 VARCHAR(1)) ENGINE=InnoDB; ++INSERT INTO t1 VALUES (1); ++INSERT INTO t2 VALUES (1); ++INSERT INTO t3 VALUES (1); ++SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1; ++COUNT(*) = 1 ++1 ++SELECT COUNT(*) = 1 FROM t2 WHERE f1 = 1; ++COUNT(*) = 1 ++1 ++SELECT COUNT(*) = 1 FROM t3 WHERE f1 = 1; ++COUNT(*) = 1 ++1 ++UPDATE t1 SET f1 = 2 WHERE f1 = 1; ++UPDATE t2 SET f1 = 2 WHERE f1 = 1; ++UPDATE t3 SET f1 = 2 WHERE f1 = 1; ++SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2; ++COUNT(*) = 1 ++1 ++SELECT COUNT(*) = 1 FROM t2 WHERE f1 = 2; ++COUNT(*) = 1 ++1 ++SELECT COUNT(*) = 1 FROM t3 WHERE f1 = 2; ++COUNT(*) = 1 ++1 ++DELETE FROM t1; ++DELETE FROM t2; ++DELETE FROM t3; ++SELECT COUNT(*) = 0 FROM t1; ++COUNT(*) = 0 ++1 ++SELECT COUNT(*) = 0 FROM t2; ++COUNT(*) = 0 ++1 ++SELECT COUNT(*) = 0 FROM t3; ++COUNT(*) = 0 ++1 ++DROP TABLE t1; ++DROP TABLE t2; ++DROP TABLE t3; ++SET SESSION binlog_row_image=noblob; ++CREATE TABLE t1 (f1 BLOB, f2 INTEGER PRIMARY KEY) ENGINE=InnoDB; ++CREATE TABLE t2 (f1 BLOB) ENGINE=InnoDB; ++INSERT INTO t1 VALUES ('abc', 1); ++INSERT INTO t2 VALUES ('abc'); ++SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 'abc'; ++COUNT(*) = 1 ++1 ++SELECT COUNT(*) = 1 FROM t2 WHERE f1 = 'abc'; ++COUNT(*) = 1 ++1 ++UPDATE t1 SET f1 = 'xyz'; ++UPDATE t2 SET f1 = 'xyz'; ++SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 'xyz'; ++COUNT(*) = 1 ++1 ++SELECT COUNT(*) = 1 FROM t2 WHERE f1 = 'xyz'; ++COUNT(*) = 1 ++1 ++UPDATE t1 SET f2 = 2 WHERE f2 = 1; ++SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 2; ++COUNT(*) = 1 ++1 ++SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 'xyz'; ++COUNT(*) = 1 ++1 ++DELETE FROM t1; ++DELETE FROM t2; ++SELECT COUNT(*) = 0 FROM t1; ++COUNT(*) = 0 ++1 ++SELECT COUNT(*) = 0 FROM t2; ++COUNT(*) = 0 ++1 ++DROP TABLE t1; ++DROP TABLE t2; +diff --git a/mysql-test/suite/galera/r/galera_binlog_rows_query_log_events.result b/mysql-test/suite/galera/r/galera_binlog_rows_query_log_events.result +new file mode 100644 +index 0000000..80ae3d0 +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_binlog_rows_query_log_events.result +@@ -0,0 +1,12 @@ ++SET GLOBAL binlog_rows_query_log_events=TRUE; ++CREATE TABLE t1 (f1 INT PRIMARY KEY) ENGINE=InnoDB; ++INSERT INTO t1 VALUES (1); ++SELECT COUNT(*) = 1 FROM t1; ++COUNT(*) = 1 ++1 ++UPDATE t1 SET f1 = 2 WHERE f1 = 1; ++SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2; ++COUNT(*) = 1 ++1 ++SET GLOBAL binlog_rows_query_log_events = 0; ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/r/galera_create_function.result b/mysql-test/suite/galera/r/galera_create_function.result +new file mode 100644 +index 0000000..4d19faf +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_create_function.result +@@ -0,0 +1,55 @@ ++CREATE USER 'user1'; ++CREATE ++DEFINER = 'user1' ++FUNCTION f1 (param INTEGER) ++RETURNS VARCHAR(200) ++COMMENT 'f1_comment' ++LANGUAGE SQL ++NOT DETERMINISTIC ++MODIFIES SQL DATA ++SQL SECURITY DEFINER ++RETURN 'abc'; ++GRANT EXECUTE ON FUNCTION f1 TO user1; ++CREATE ++DEFINER = CURRENT_USER ++FUNCTION f2 (param VARCHAR(100)) ++RETURNS INTEGER ++DETERMINISTIC ++NO SQL ++SQL SECURITY INVOKER ++RETURN 123; ++SHOW CREATE FUNCTION f1; ++Function sql_mode Create Function character_set_client collation_connection Database Collation ++f1 NO_ENGINE_SUBSTITUTION CREATE DEFINER=`user1`@`%` FUNCTION `f1`(param INTEGER) RETURNS varchar(200) CHARSET latin1 ++ MODIFIES SQL DATA ++ COMMENT 'f1_comment' ++RETURN 'abc' latin1 latin1_swedish_ci latin1_swedish_ci ++SHOW CREATE FUNCTION f1; ++Function sql_mode Create Function character_set_client collation_connection Database Collation ++f1 NO_ENGINE_SUBSTITUTION CREATE DEFINER=`user1`@`%` FUNCTION `f1`(param INTEGER) RETURNS varchar(200) CHARSET latin1 ++ MODIFIES SQL DATA ++ COMMENT 'f1_comment' ++RETURN 'abc' latin1 latin1_swedish_ci latin1_swedish_ci ++SHOW CREATE FUNCTION f2; ++Function sql_mode Create Function character_set_client collation_connection Database Collation ++f2 NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `f2`(param VARCHAR(100)) RETURNS int(11) ++ NO SQL ++ DETERMINISTIC ++ SQL SECURITY INVOKER ++RETURN 123 latin1 latin1_swedish_ci latin1_swedish_ci ++SHOW CREATE FUNCTION f2; ++Function sql_mode Create Function character_set_client collation_connection Database Collation ++f2 NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `f2`(param VARCHAR(100)) RETURNS int(11) ++ NO SQL ++ DETERMINISTIC ++ SQL SECURITY INVOKER ++RETURN 123 latin1 latin1_swedish_ci latin1_swedish_ci ++SELECT f1(1) = 'abc'; ++f1(1) = 'abc' ++1 ++SELECT f2('abc') = 123; ++f2('abc') = 123 ++1 ++DROP FUNCTION f1; ++DROP FUNCTION f2; ++DROP USER 'user1'; +diff --git a/mysql-test/suite/galera/r/galera_create_procedure.result b/mysql-test/suite/galera/r/galera_create_procedure.result +new file mode 100644 +index 0000000..997bbba +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_create_procedure.result +@@ -0,0 +1,53 @@ ++CREATE USER 'user1'; ++CREATE TABLE t1 (f1 INTEGER); ++CREATE ++DEFINER = 'user1' ++PROCEDURE p1 (IN param1 INTEGER, OUT param2 INTEGER, INOUT param3 INTEGER) ++COMMENT 'p1_comment' ++LANGUAGE SQL ++NOT DETERMINISTIC ++MODIFIES SQL DATA ++SQL SECURITY DEFINER ++INSERT INTO t1 VALUES (1); ++GRANT EXECUTE ON PROCEDURE p1 TO user1; ++CREATE ++DEFINER = CURRENT_USER ++PROCEDURE p2 (param VARCHAR(100)) ++DETERMINISTIC ++NO SQL ++SQL SECURITY INVOKER BEGIN END ; ++SHOW CREATE PROCEDURE p1; ++Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation ++p1 NO_ENGINE_SUBSTITUTION CREATE DEFINER=`user1`@`%` PROCEDURE `p1`(IN param1 INTEGER, OUT param2 INTEGER, INOUT param3 INTEGER) ++ MODIFIES SQL DATA ++ COMMENT 'p1_comment' ++INSERT INTO t1 VALUES (1) latin1 latin1_swedish_ci latin1_swedish_ci ++SELECT 1 FROM DUAL; ++1 ++1 ++SHOW CREATE PROCEDURE p1; ++Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation ++p1 NO_ENGINE_SUBSTITUTION CREATE DEFINER=`user1`@`%` PROCEDURE `p1`(IN param1 INTEGER, OUT param2 INTEGER, INOUT param3 INTEGER) ++ MODIFIES SQL DATA ++ COMMENT 'p1_comment' ++INSERT INTO t1 VALUES (1) latin1 latin1_swedish_ci latin1_swedish_ci ++SHOW CREATE PROCEDURE p2; ++Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation ++p2 NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `p2`(param VARCHAR(100)) ++ NO SQL ++ DETERMINISTIC ++ SQL SECURITY INVOKER ++BEGIN END latin1 latin1_swedish_ci latin1_swedish_ci ++SHOW CREATE PROCEDURE p2; ++Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation ++p2 NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `p2`(param VARCHAR(100)) ++ NO SQL ++ DETERMINISTIC ++ SQL SECURITY INVOKER ++BEGIN END latin1 latin1_swedish_ci latin1_swedish_ci ++CALL p1(@a, @b, @c); ++CALL p2('abc'); ++DROP PROCEDURE p1; ++DROP PROCEDURE p2; ++DROP USER 'user1'; ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/r/galera_create_table_like.result b/mysql-test/suite/galera/r/galera_create_table_like.result +new file mode 100644 +index 0000000..b335101 +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_create_table_like.result +@@ -0,0 +1,47 @@ ++CREATE SCHEMA schema1; ++CREATE SCHEMA schema2; ++USE schema1; ++CREATE TABLE real_table (f1 INTEGER) ENGINE=InnoDB; ++CREATE TEMPORARY TABLE temp_table (f1 INTEGER) ENGINE=InnoDB; ++CREATE TABLE myisam_table (f1 INTEGER) ENGINE=MyISAM; ++USE schema2; ++CREATE TABLE real_table1 LIKE schema1.real_table; ++CREATE TABLE real_table2 LIKE schema1.temp_table; ++CREATE TABLE real_table3 LIKE schema1.myisam_table; ++CREATE TEMPORARY TABLE temp_table1 LIKE schema1.real_table; ++CREATE TEMPORARY TABLE temp_table2 LIKE schema1.temp_table; ++CREATE TEMPORARY TABLE temp_table3 LIKE schema1.myisam_table; ++SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'real_table' AND TABLE_SCHEMA = 'schema1'; ++COUNT(*) = 1 ++1 ++SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'myisam_table' AND TABLE_SCHEMA = 'schema1'; ++COUNT(*) = 1 ++1 ++SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'temp_table' AND TABLE_SCHEMA = 'schema1'; ++COUNT(*) = 0 ++1 ++SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'real_table1' AND TABLE_SCHEMA = 'schema2'; ++COUNT(*) = 1 ++1 ++SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'real_table2' AND TABLE_SCHEMA = 'schema2'; ++COUNT(*) = 1 ++1 ++SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'real_table3' AND TABLE_SCHEMA = 'schema2'; ++COUNT(*) = 1 ++1 ++SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'temp_table1' AND TABLE_SCHEMA = 'schema2'; ++COUNT(*) = 0 ++1 ++SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'temp_table2' AND TABLE_SCHEMA = 'schema2'; ++COUNT(*) = 0 ++1 ++SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'temp_table3' AND TABLE_SCHEMA = 'schema2'; ++COUNT(*) = 0 ++1 ++DROP TABLE schema1.real_table; ++DROP TABLE schema1.myisam_table; ++DROP TABLE schema2.real_table1; ++DROP TABLE schema2.real_table2; ++DROP TABLE schema2.real_table3; ++DROP SCHEMA schema1; ++DROP SCHEMA schema2; +diff --git a/mysql-test/suite/galera/r/galera_create_trigger.result b/mysql-test/suite/galera/r/galera_create_trigger.result +new file mode 100644 +index 0000000..7e65608 +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_create_trigger.result +@@ -0,0 +1,42 @@ ++CREATE TABLE definer_root (f1 INTEGER, trigger_user VARCHAR(100)) ENGINE=InnoDB; ++CREATE TABLE definer_user (f1 INTEGER, trigger_user VARCHAR(100)) ENGINE=InnoDB; ++CREATE TABLE definer_current_user (f1 INTEGER, trigger_user VARCHAR(100)) ENGINE=InnoDB; ++CREATE TABLE definer_default (f1 INTEGER, trigger_user VARCHAR(100)) ENGINE=InnoDB; ++CREATE USER 'user1'; ++CREATE DEFINER=root@localhost TRIGGER definer_root BEFORE INSERT ON definer_root FOR EACH ROW SET NEW.trigger_user = CURRENT_USER(); ++CREATE DEFINER=user1 TRIGGER definer_user BEFORE INSERT ON definer_user FOR EACH ROW SET NEW.trigger_user = CURRENT_USER(); ++CREATE DEFINER=current_user TRIGGER definer_current_user BEFORE INSERT ON definer_current_user FOR EACH ROW SET NEW.trigger_user = CURRENT_USER(); ++CREATE TRIGGER definer_default BEFORE INSERT ON definer_default FOR EACH ROW SET NEW.trigger_user = CURRENT_USER(); ++INSERT INTO definer_root (f1) VALUES (1); ++SELECT DEFINER = 'root@localhost' FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME = 'definer_root'; ++DEFINER = 'root@localhost' ++1 ++SELECT trigger_user = 'root@localhost' FROM definer_root; ++trigger_user = 'root@localhost' ++1 ++INSERT INTO definer_user (f1) VALUES (1); ++SELECT DEFINER = 'user1@%' FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME = 'definer_user'; ++DEFINER = 'user1@%' ++1 ++SELECT trigger_user = 'user1@%' FROM definer_user; ++trigger_user = 'user1@%' ++1 ++INSERT INTO definer_current_user (f1) VALUES (1); ++SELECT DEFINER = 'root@localhost' FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME = 'definer_current_user'; ++DEFINER = 'root@localhost' ++1 ++SELECT trigger_user = 'root@localhost' FROM definer_current_user; ++trigger_user = 'root@localhost' ++1 ++INSERT INTO definer_default (f1) VALUES (1); ++SELECT DEFINER = 'root@localhost' FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME = 'definer_default'; ++DEFINER = 'root@localhost' ++1 ++SELECT trigger_user = 'root@localhost' FROM definer_default; ++trigger_user = 'root@localhost' ++1 ++DROP TABLE definer_current_user; ++DROP TABLE definer_user; ++DROP TABLE definer_root; ++DROP TABLE definer_default; ++DROP USER 'user1'; +diff --git a/mysql-test/suite/galera/r/galera_defaults.result b/mysql-test/suite/galera/r/galera_defaults.result +new file mode 100644 +index 0000000..8bd2221 +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_defaults.result +@@ -0,0 +1,117 @@ ++SELECT COUNT(*) = 40 FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME LIKE 'wsrep_%'; ++COUNT(*) = 40 ++1 ++SELECT VARIABLE_NAME, VARIABLE_VALUE ++FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES ++WHERE VARIABLE_NAME LIKE 'wsrep_%' ++AND VARIABLE_NAME NOT IN ( ++'WSREP_PROVIDER_OPTIONS', ++'WSREP_SST_RECEIVE_ADDRESS', ++'WSREP_NODE_ADDRESS', ++'WSREP_NODE_NAME', ++'WSREP_PROVIDER', ++'WSREP_DATA_HOME_DIR', ++'WSREP_NODE_INCOMING_ADDRESS', ++'WSREP_START_POSITION' ++) ++ORDER BY VARIABLE_NAME; ++VARIABLE_NAME VARIABLE_VALUE ++WSREP_AUTO_INCREMENT_CONTROL ON ++WSREP_CAUSAL_READS ON ++WSREP_CERTIFY_NONPK ON ++WSREP_CLUSTER_ADDRESS gcomm:// ++WSREP_CLUSTER_NAME my_wsrep_cluster ++WSREP_CONVERT_LOCK_TO_TRX OFF ++WSREP_DBUG_OPTION ++WSREP_DEBUG OFF ++WSREP_DESYNC OFF ++WSREP_DRUPAL_282555_WORKAROUND OFF ++WSREP_FORCED_BINLOG_FORMAT NONE ++WSREP_LOAD_DATA_SPLITTING ON ++WSREP_LOG_CONFLICTS OFF ++WSREP_MAX_WS_ROWS 131072 ++WSREP_MAX_WS_SIZE 1073741824 ++WSREP_MYSQL_REPLICATION_BUNDLE 0 ++WSREP_NOTIFY_CMD ++WSREP_ON ON ++WSREP_OSU_METHOD TOI ++WSREP_PREORDERED OFF ++WSREP_RECOVER OFF ++WSREP_REPLICATE_MYISAM OFF ++WSREP_RESTART_SLAVE OFF ++WSREP_RETRY_AUTOCOMMIT 1 ++WSREP_SLAVE_FK_CHECKS ON ++WSREP_SLAVE_THREADS 1 ++WSREP_SLAVE_UK_CHECKS OFF ++WSREP_SST_AUTH ++WSREP_SST_DONOR ++WSREP_SST_DONOR_REJECTS_QUERIES OFF ++WSREP_SST_METHOD rsync ++WSREP_SYNC_WAIT 7 ++; ; ; cert.log_conflicts = no; debug = no; evs.auto_evict = 0; evs.causal_keepalive_period = PT1S; evs.debug_log_mask = 0x1; evs.delay_margin = PT1S; evs.delayed_keep_period = PT30S; evs.inactive_check_period = PT0.5S; evs.inactive_timeout = PT15S; evs.info_log_mask = 0; evs.install_timeout = PT7.5S; evs.join_retrans_period = PT1S; evs.keepalive_period = PT1S; evs.max_install_timeouts = 3; evs.send_window = 4; evs.stats_report_period = PT1M; evs.suspect_timeout = PT5S; evs.use_aggregate = true; evs.user_send_window = 2; evs.version = 0; evs.view_forget_timeout = P1D; ; gcache.keep_pages_size = 0; gcache.mem_size = 0; ; gcache.page_size = 128M; gcache.size = 128M; gcs.fc_debug = 0; gcs.fc_factor = 1.0; gcs.fc_limit = 16; gcs.fc_master_slave = no; gcs.max_packet_size = 64500; gcs.max_throttle = 0.25; gcs.recv_q_hard_limit = 9223372036854775807; gcs.recv_q_soft_limit = 0.25; gcs.sync_donor = no; ; gmcast.mcast_addr = ; gmcast.mcast_ttl = 1; gmcast.peer_timeout = PT3S; gmcast.segment = 0; gmcast.time_wait = PT5S; gmcast.version = 0; ; pc.announce_timeout = PT3S; pc.checksum = false; pc.ignore_quorum = false; pc.ignore_sb = false; pc.linger = PT20S; pc.npvo = false; pc.recovery = true; pc.version = 0; pc.wait_prim = true; pc.wait_prim_timeout = P30S; pc.weight = 1; protonet.backend = asio; protonet.version = 0; repl.causal_read_timeout = PT30S; repl.commit_order = 3; repl.key_format = FLAT8; repl.max_ws_size = 2147483647; repl.proto_max = 7; socket.checksum = 2; ++SELECT COUNT(*) FROM INFORMATION_SCHEMA.GLOBAL_STATUS ++WHERE VARIABLE_NAME LIKE 'wsrep_%' ++AND VARIABLE_NAME != 'wsrep_debug_sync_waiters'; ++COUNT(*) ++56 ++SELECT VARIABLE_NAME FROM INFORMATION_SCHEMA.GLOBAL_STATUS ++WHERE VARIABLE_NAME LIKE 'wsrep_%' ++AND VARIABLE_NAME != 'wsrep_debug_sync_waiters' ++ORDER BY VARIABLE_NAME; ++VARIABLE_NAME ++WSREP_APPLY_OOOE ++WSREP_APPLY_OOOL ++WSREP_APPLY_WINDOW ++WSREP_CAUSAL_READS ++WSREP_CERT_DEPS_DISTANCE ++WSREP_CERT_INDEX_SIZE ++WSREP_CERT_INTERVAL ++WSREP_CLUSTER_CONF_ID ++WSREP_CLUSTER_SIZE ++WSREP_CLUSTER_STATE_UUID ++WSREP_CLUSTER_STATUS ++WSREP_COMMIT_OOOE ++WSREP_COMMIT_OOOL ++WSREP_COMMIT_WINDOW ++WSREP_CONNECTED ++WSREP_EVS_DELAYED ++WSREP_EVS_EVICT_LIST ++WSREP_EVS_REPL_LATENCY ++WSREP_EVS_STATE ++WSREP_FLOW_CONTROL_PAUSED ++WSREP_FLOW_CONTROL_PAUSED_NS ++WSREP_FLOW_CONTROL_RECV ++WSREP_FLOW_CONTROL_SENT ++WSREP_GCOMM_UUID ++WSREP_INCOMING_ADDRESSES ++WSREP_LAST_COMMITTED ++WSREP_LOCAL_BF_ABORTS ++WSREP_LOCAL_CACHED_DOWNTO ++WSREP_LOCAL_CERT_FAILURES ++WSREP_LOCAL_COMMITS ++WSREP_LOCAL_INDEX ++WSREP_LOCAL_RECV_QUEUE ++WSREP_LOCAL_RECV_QUEUE_AVG ++WSREP_LOCAL_RECV_QUEUE_MAX ++WSREP_LOCAL_RECV_QUEUE_MIN ++WSREP_LOCAL_REPLAYS ++WSREP_LOCAL_SEND_QUEUE ++WSREP_LOCAL_SEND_QUEUE_AVG ++WSREP_LOCAL_SEND_QUEUE_MAX ++WSREP_LOCAL_SEND_QUEUE_MIN ++WSREP_LOCAL_STATE ++WSREP_LOCAL_STATE_COMMENT ++WSREP_LOCAL_STATE_UUID ++WSREP_PROTOCOL_VERSION ++WSREP_PROVIDER_NAME ++WSREP_PROVIDER_VENDOR ++WSREP_PROVIDER_VERSION ++WSREP_READY ++WSREP_RECEIVED ++WSREP_RECEIVED_BYTES ++WSREP_REPLICATED ++WSREP_REPLICATED_BYTES ++WSREP_REPL_DATA_BYTES ++WSREP_REPL_KEYS ++WSREP_REPL_KEYS_BYTES ++WSREP_REPL_OTHER_BYTES +diff --git a/mysql-test/suite/galera/r/galera_delete_limit.result b/mysql-test/suite/galera/r/galera_delete_limit.result +new file mode 100644 +index 0000000..72bee18 +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_delete_limit.result +@@ -0,0 +1,19 @@ ++CREATE TABLE ten (f1 INTEGER) Engine=InnoDB; ++INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); ++CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) Engine=InnoDB; ++INSERT INTO t1 SELECT f1 FROM ten ORDER BY RAND(); ++DELETE FROM t1 ORDER BY RAND() LIMIT 5; ++sum_matches ++1 ++max_matches ++1 ++DROP TABLE t1; ++CREATE TABLE t2 (f1 INTEGER) Engine=InnoDB; ++INSERT INTO t2 SELECT f1 FROM ten ORDER BY RAND(); ++DELETE FROM t2 ORDER BY RAND() LIMIT 5; ++sum_matches ++1 ++max_matches ++1 ++DROP TABLE t2; ++DROP TABLE ten; +diff --git a/mysql-test/suite/galera/r/galera_enum.result b/mysql-test/suite/galera/r/galera_enum.result +new file mode 100644 +index 0000000..e853c5c +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_enum.result +@@ -0,0 +1,37 @@ ++CREATE TABLE t1 (f1 ENUM('', 'one', 'two'), KEY (f1)) ENGINE=InnoDB; ++INSERT INTO t1 VALUES (''); ++INSERT INTO t1 VALUES ('one'), ('two'); ++INSERT INTO t1 VALUES (0), (1), (2); ++Warnings: ++Warning 1265 Data truncated for column 'f1' at row 1 ++SELECT COUNT(*) = 6 FROM t1; ++COUNT(*) = 6 ++1 ++SELECT COUNT(*) = 2 FROM t1 where f1 = ''; ++COUNT(*) = 2 ++1 ++SELECT COUNT(*) = 2 FROM t1 where f1 = 'one'; ++COUNT(*) = 2 ++1 ++DROP TABLE t1; ++CREATE TABLE t1 (f1 ENUM('', 'one', 'two', 'three', 'four') PRIMARY KEY) ENGINE=InnoDB; ++INSERT INTO t1 VALUES (''), ('one'), ('two'); ++SELECT COUNT(*) = 3 FROM t1; ++COUNT(*) = 3 ++1 ++SELECT COUNT(*) = 1 FROM t1 WHERE f1 = ''; ++COUNT(*) = 1 ++1 ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++UPDATE t1 SET f1 = 'three' where f1 = ''; ++SET AUTOCOMMIt=OFF; ++START TRANSACTION; ++UPDATE t1 SET f1 = 'four' where f1 = ''; ++COMMIT; ++COMMIT; ++ERROR 40001: Deadlock found when trying to get lock; try restarting transaction ++SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 'three'; ++COUNT(*) = 1 ++1 ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/r/galera_events.result b/mysql-test/suite/galera/r/galera_events.result +new file mode 100644 +index 0000000..09d8406 +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_events.result +@@ -0,0 +1,18 @@ ++CREATE EVENT event1 ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO SELECT 1; ++SELECT DEFINER= 'root@localhost', ORIGINATOR = 1, STATUS = 'SLAVESIDE_DISABLED', EVENT_TYPE = 'ONE TIME', ON_COMPLETION = 'NOT PRESERVE' FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME = 'event1'; ++DEFINER= 'root@localhost' ORIGINATOR = 1 STATUS = 'SLAVESIDE_DISABLED' EVENT_TYPE = 'ONE TIME' ON_COMPLETION = 'NOT PRESERVE' ++1 1 1 1 1 ++ALTER EVENT event1 DISABLE; ++SELECT DEFINER= 'root@localhost', ORIGINATOR = 1, STATUS = 'SLAVESIDE_DISABLED', EVENT_TYPE = 'ONE TIME', ON_COMPLETION = 'NOT PRESERVE' FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME = 'event1'; ++DEFINER= 'root@localhost' ORIGINATOR = 1 STATUS = 'SLAVESIDE_DISABLED' EVENT_TYPE = 'ONE TIME' ON_COMPLETION = 'NOT PRESERVE' ++1 1 1 1 1 ++SET GLOBAL event_scheduler = ON; ++CREATE EVENT event2 ON SCHEDULE AT CURRENT_TIMESTAMP ON COMPLETION NOT PRESERVE DO SELECT 1; ++SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME = 'event2'; ++COUNT(*) = 0 ++1 ++DROP EVENT event1; ++SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME = 'event1'; ++COUNT(*) = 0 ++1 ++SET GLOBAL event_scheduler = OFF;; +diff --git a/mysql-test/suite/galera/r/galera_fk_cascade_delete.result b/mysql-test/suite/galera/r/galera_fk_cascade_delete.result +new file mode 100644 +index 0000000..89f4301 +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_fk_cascade_delete.result +@@ -0,0 +1,30 @@ ++CREATE TABLE grandparent ( ++id INT NOT NULL PRIMARY KEY ++) ENGINE=InnoDB; ++CREATE TABLE parent ( ++id INT NOT NULL PRIMARY KEY, ++grandparent_id INT, ++FOREIGN KEY (grandparent_id) ++REFERENCES grandparent(id) ++ON DELETE CASCADE ++) ENGINE=InnoDB; ++CREATE TABLE child ( ++id INT NOT NULL PRIMARY KEY, ++parent_id INT, ++FOREIGN KEY (parent_id) ++REFERENCES parent(id) ++ON DELETE CASCADE ++) ENGINE=InnoDB; ++INSERT INTO grandparent VALUES (1),(2); ++INSERT INTO parent VALUES (1,1), (2,2); ++INSERT INTO child VALUES (1,1), (2,2); ++DELETE FROM grandparent WHERE id = 1; ++SELECT COUNT(*) = 0 FROM parent WHERE grandparent_id = 1; ++COUNT(*) = 0 ++1 ++SELECT COUNT(*) = 0 FROM child WHERE parent_id = 1; ++COUNT(*) = 0 ++1 ++DROP TABLE child; ++DROP TABLE parent; ++DROP TABLE grandparent; +diff --git a/mysql-test/suite/galera/r/galera_fk_cascade_update.result b/mysql-test/suite/galera/r/galera_fk_cascade_update.result +new file mode 100644 +index 0000000..2ab2ad3 +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_fk_cascade_update.result +@@ -0,0 +1,30 @@ ++CREATE TABLE grandparent ( ++id INT NOT NULL PRIMARY KEY ++) ENGINE=InnoDB; ++CREATE TABLE parent ( ++id INT NOT NULL PRIMARY KEY, ++grandparent_id INT, ++FOREIGN KEY (grandparent_id) ++REFERENCES grandparent(id) ++ON UPDATE CASCADE ++) ENGINE=InnoDB; ++CREATE TABLE child ( ++id INT NOT NULL PRIMARY KEY, ++grandparent_id INT, ++FOREIGN KEY (grandparent_id) ++REFERENCES parent(grandparent_id) ++ON UPDATE CASCADE ++) ENGINE=InnoDB; ++INSERT INTO grandparent VALUES (1),(2); ++INSERT INTO parent VALUES (1,1), (2,2); ++INSERT INTO child VALUES (1,1), (2,2); ++UPDATE grandparent SET id = 3 WHERE id = 1; ++SELECT COUNT(*) = 1 FROM parent WHERE grandparent_id = 3; ++COUNT(*) = 1 ++1 ++SELECT COUNT(*) = 1 FROM child WHERE grandparent_id = 3; ++COUNT(*) = 1 ++1 ++DROP TABLE child; ++DROP TABLE parent; ++DROP TABLE grandparent; +diff --git a/mysql-test/suite/galera/r/galera_fk_conflict.result b/mysql-test/suite/galera/r/galera_fk_conflict.result +new file mode 100644 +index 0000000..ae6c482 +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_fk_conflict.result +@@ -0,0 +1,23 @@ ++CREATE TABLE parent ( ++id INT PRIMARY KEY, ++KEY (id) ++) ENGINE=InnoDB; ++CREATE TABLE child ( ++id INT PRIMARY KEY, ++parent_id INT, ++FOREIGN KEY (parent_id) ++REFERENCES parent(id) ++) ENGINE=InnoDB; ++INSERT INTO parent VALUES (1), (2); ++INSERT INTO child VALUES (1,1); ++SET AUTOCOMMIT = OFF; ++START TRANSACTION; ++DELETE FROM parent WHERE id = 2; ++SET AUTOCOMMIT = OFF; ++START TRANSACTION; ++INSERT INTO child VALUES (2, 2); ++COMMIT; ++COMMIT; ++ERROR 40001: Deadlock found when trying to get lock; try restarting transaction ++DROP TABLE child; ++DROP TABLE parent; +diff --git a/mysql-test/suite/galera/r/galera_fk_mismatch.result b/mysql-test/suite/galera/r/galera_fk_mismatch.result +new file mode 100644 +index 0000000..07cdb1b +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_fk_mismatch.result +@@ -0,0 +1,25 @@ ++CREATE TABLE parent ( ++id1 INT, ++id2 INT, ++PRIMARY KEY (id1, id2) /* Multipart PK */ ++) ENGINE=InnoDB; ++CREATE TABLE child ( ++id INT PRIMARY KEY, ++parent_id1 INT, ++FOREIGN KEY (parent_id1) ++REFERENCES parent(id1) /* FK is subset of PK above */ ++ON UPDATE CASCADE ++ON DELETE CASCADE ++) ENGINE=InnoDB; ++INSERT INTO parent VALUES (1, 2); ++INSERT INTO child VALUES (1, 1); ++UPDATE parent SET id1 = 3 WHERE id1 = 1; ++SELECT COUNT(*) = 1 FROM child WHERE parent_id1 = 3; ++COUNT(*) = 1 ++1 ++DELETE FROM parent WHERE id1 = 3; ++SELECT COUNT(*) = 0 FROM child WHERE parent_id1 = 3; ++COUNT(*) = 0 ++1 ++DROP TABLE child; ++DROP TABLE parent; +diff --git a/mysql-test/suite/galera/r/galera_fk_multicolumn.result b/mysql-test/suite/galera/r/galera_fk_multicolumn.result +new file mode 100644 +index 0000000..a86b87a +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_fk_multicolumn.result +@@ -0,0 +1,35 @@ ++CREATE TABLE t0 ( ++f1 INT PRIMARY KEY, ++f2 INT UNIQUE ++); ++CREATE TABLE t1 ( ++f1 INT PRIMARY KEY, ++FOREIGN KEY (f1) ++REFERENCES t0(f1) ++ON UPDATE CASCADE ++); ++CREATE TABLE t2 ( ++f2 INT PRIMARY KEY, ++FOREIGN KEY (f2) ++REFERENCES t0(f2) ++ON UPDATE CASCADE ++); ++INSERT INTO t0 VALUES (0, 0); ++INSERT INTO t1 VALUES (0); ++INSERT INTO t2 VALUES (0); ++UPDATE t0 SET f1 = 1, f2 = 2; ++SELECT f1 = 1 FROM t1 WHERE f1 = 1; ++f1 = 1 ++1 ++SELECT f2 = 2 FROM t2 WHERE f2 = 2; ++f2 = 2 ++1 ++SELECT f1 = 1 FROM t1; ++f1 = 1 ++1 ++SELECT f2 = 2 FROM t2; ++f2 = 2 ++1 ++DROP TABLE t2; ++DROP TABLE t1; ++DROP TABLE t0; +diff --git a/mysql-test/suite/galera/r/galera_fk_multitable.result b/mysql-test/suite/galera/r/galera_fk_multitable.result +new file mode 100644 +index 0000000..e77128d +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_fk_multitable.result +@@ -0,0 +1,22 @@ ++CREATE TABLE t0 ( ++f0 INT PRIMARY KEY ++); ++CREATE TABLE t1 ( ++f1 INT PRIMARY KEY, ++f0 INTEGER, ++FOREIGN KEY (f0) ++REFERENCES t0(f0) ++ON DELETE CASCADE ++); ++INSERT INTO t0 VALUES (0), (1); ++INSERT INTO t1 VALUES (0, 0); ++INSERT INTO t1 VALUES (1, 0); ++DELETE t0.*, t1.* FROM t0, t1 WHERE t0.f0 = 0 AND t1.f1 = 0; ++SELECT COUNT(*) = 1 FROM t0; ++COUNT(*) = 1 ++1 ++SELECT COUNT(*) = 0 FROM t1; ++COUNT(*) = 0 ++1 ++DROP TABLE t1; ++DROP TABLE t0; +diff --git a/mysql-test/suite/galera/r/galera_fk_no_pk.result b/mysql-test/suite/galera/r/galera_fk_no_pk.result +new file mode 100644 +index 0000000..e4f9286 +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_fk_no_pk.result +@@ -0,0 +1,28 @@ ++CREATE TABLE parent ( ++id INT, ++KEY (id) ++) ENGINE=InnoDB; ++CREATE TABLE child ( ++id INT, ++parent_id INT, ++FOREIGN KEY (parent_id) ++REFERENCES parent(id) ++ON UPDATE CASCADE ++ON DELETE CASCADE ++) ENGINE=InnoDB; ++INSERT INTO parent VALUES (1), (1), (2), (2); ++INSERT INTO child VALUES (1,1), (2,2), (1,1), (2,2); ++DELETE FROM parent WHERE id = 1; ++SELECT COUNT(*) = 0 FROM child WHERE id = 1; ++COUNT(*) = 0 ++1 ++UPDATE parent SET id = 3 WHERE id = 2; ++SELECT COUNT(*) = 0 FROM child WHERE parent_id = 1; ++COUNT(*) = 0 ++1 ++SELECT parent_id = 3 FROM child WHERE id = 2; ++parent_id = 3 ++1 ++1 ++DROP TABLE child; ++DROP TABLE parent; +diff --git a/mysql-test/suite/galera/r/galera_fk_selfreferential.result b/mysql-test/suite/galera/r/galera_fk_selfreferential.result +new file mode 100644 +index 0000000..25c3704 +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_fk_selfreferential.result +@@ -0,0 +1,13 @@ ++CREATE TABLE t1 ( ++f1 INT NOT NULL PRIMARY KEY, ++f2 INT, ++FOREIGN KEY (f2) ++REFERENCES t1(f1) ++ON DELETE CASCADE ++) ENGINE=InnoDB; ++INSERT INTO t1 VALUES (1, 1), (2, 1); ++DELETE FROM t1 WHERE f1 = 1; ++SELECT COUNT(*) = 0 FROM t1; ++COUNT(*) = 0 ++1 ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/r/galera_fk_setnull.result b/mysql-test/suite/galera/r/galera_fk_setnull.result +new file mode 100644 +index 0000000..f7fb9d0 +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_fk_setnull.result +@@ -0,0 +1,30 @@ ++CREATE TABLE parent ( ++id INT NOT NULL, ++PRIMARY KEY (id) ++) ENGINE=InnoDB; ++CREATE TABLE child ( ++id INT, ++parent_id INT, ++FOREIGN KEY (parent_id) ++REFERENCES parent(id) ++ON UPDATE SET NULL ++ON DELETE SET NULL ++) ENGINE=InnoDB; ++INSERT INTO parent VALUES (1),(2); ++INSERT INTO child VALUES (1,1),(2,2); ++DELETE FROM parent WHERE id = 1; ++SELECT parent_id IS NULL FROM child WHERE id = 1; ++parent_id IS NULL ++1 ++SELECT parent_id IS NULL FROM child WHERE id = 1; ++parent_id IS NULL ++1 ++UPDATE parent SET id = 3 WHERE id = 2; ++SELECT parent_id IS NULL FROM child WHERE id = 2; ++parent_id IS NULL ++1 ++SELECT parent_id IS NULL FROM child WHERE id = 2; ++parent_id IS NULL ++1 ++DROP TABLE child; ++DROP TABLE parent; +diff --git a/mysql-test/suite/galera/r/galera_ftwrl.result b/mysql-test/suite/galera/r/galera_ftwrl.result +new file mode 100644 +index 0000000..c216b52 +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_ftwrl.result +@@ -0,0 +1,16 @@ ++CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB; ++SET GLOBAL wsrep_provider_options = "repl.causal_read_timeout=PT1S"; ++FLUSH TABLES WITH READ LOCK; ++INSERT INTO t1 VALUES (1); ++SHOW TABLES; ++ERROR HY000: Lock wait timeout exceeded; try restarting transaction ++SELECT * FROM t1; ++ERROR HY000: Lock wait timeout exceeded; try restarting transaction ++UNLOCK TABLES; ++SHOW TABLES; ++Tables_in_test ++t1 ++SELECT COUNT(*) = 1 FROM t1; ++COUNT(*) = 1 ++1 ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/r/galera_fulltext.result b/mysql-test/suite/galera/r/galera_fulltext.result +new file mode 100644 +index 0000000..7257769 +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_fulltext.result +@@ -0,0 +1,26 @@ ++CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB; ++INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); ++CREATE TABLE t1 (f1 INT PRIMARY KEY AUTO_INCREMENT, f2 VARCHAR(100), FULLTEXT (f2)) ENGINE=InnoDB; ++SELECT COUNT(*) = 13 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE name LIKE 'test/%'; ++COUNT(*) = 13 ++1 ++INSERT INTO t1 (f2) SELECT 'foobarbaz' FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4; ++SELECT COUNT(f2) = 10000 FROM t1 WHERE MATCH(f2) AGAINST ('foobarbaz'); ++COUNT(f2) = 10000 ++1 ++UPDATE t1 SET f2 = 'abcdefjhk'; ++SELECT COUNT(f2) = 10000 FROM t1 WHERE MATCH(f2) AGAINST ('abcdefjhk'); ++COUNT(f2) = 10000 ++1 ++DROP TABLE t1; ++CREATE TABLE t1 (f1 VARCHAR(100), FULLTEXT (f1)) ENGINE=InnoDB; ++INSERT INTO t1 (f1) SELECT 'foobarbaz' FROM ten AS a1, ten AS a2, ten AS a3; ++SELECT COUNT(f1) = 1000 FROM t1 WHERE MATCH(f1) AGAINST ('foobarbaz'); ++COUNT(f1) = 1000 ++1 ++UPDATE t1 SET f1 = 'abcdefjhk'; ++SELECT COUNT(f1) = 1000 FROM t1 WHERE MATCH(f1) AGAINST ('abcdefjhk'); ++COUNT(f1) = 1000 ++1 ++DROP TABLE t1; ++DROP TABLE ten; +diff --git a/mysql-test/suite/galera/r/galera_gcs_fc_limit.result b/mysql-test/suite/galera/r/galera_gcs_fc_limit.result +new file mode 100644 +index 0000000..99c710f +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_gcs_fc_limit.result +@@ -0,0 +1,17 @@ ++CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; ++INSERT INTO t1 VALUES (1); ++SET GLOBAL wsrep_provider_options = 'gcs.fc_limit=1'; ++FLUSH TABLES WITH READ LOCK; ++INSERT INTO t1 VALUES (2); ++INSERT INTO t1 VALUES (3); ++INSERT INTO t1 VALUES (4); ++INSERT INTO t1 VALUES (5); ++SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE = 'query end' AND INFO = 'INSERT INTO t1 VALUES (5)'; ++COUNT(*) = 1 ++1 ++UNLOCK TABLES; ++INSERT INTO t1 VALUES (6); ++SELECT COUNT(*) = 6 FROM t1; ++COUNT(*) = 6 ++1 ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/r/galera_gcs_max_packet_size.result b/mysql-test/suite/galera/r/galera_gcs_max_packet_size.result +new file mode 100644 +index 0000000..606cb54 +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_gcs_max_packet_size.result +@@ -0,0 +1,15 @@ ++CREATE TABLE ten (f1 INTEGER); ++INSERT INTO ten VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10); ++CREATE TABLE t1 (f1 INT PRIMARY KEY AUTO_INCREMENT, f2 INTEGER) ENGINE=InnoDB; ++CREATE TABLE t2 (f1 VARCHAR(512) UNIQUE) ENGINE=InnoDB; ++INSERT INTO t1 (f2) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4; ++INSERT INTO t2 VALUES (REPEAT('x', 512)); ++SELECT COUNT(*) = 10000 FROM t1; ++COUNT(*) = 10000 ++1 ++SELECT LENGTH(f1) = 512 FROM t2 WHERE f1 = REPEAT('x', 512); ++LENGTH(f1) = 512 ++1 ++DROP TABLE t1; ++DROP TABLE t2; ++DROP TABLE ten; +diff --git a/mysql-test/suite/galera/r/galera_gtid.result b/mysql-test/suite/galera/r/galera_gtid.result +new file mode 100644 +index 0000000..50d561d +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_gtid.result +@@ -0,0 +1,12 @@ ++CREATE TABLE t1 (f1 INT PRIMARY KEY); ++INSERT INTO t1 VALUES (1); ++SELECT COUNT(*) = 1 FROM t1; ++COUNT(*) = 1 ++1 ++UPDATE t1 SET f1 = 2; ++SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2; ++COUNT(*) = 1 ++1 ++gtid_executed_equal ++1 ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/r/galera_insert_ignore.result b/mysql-test/suite/galera/r/galera_insert_ignore.result +new file mode 100644 +index 0000000..2d6e38e +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_insert_ignore.result +@@ -0,0 +1,48 @@ ++SET GLOBAL wsrep_sync_wait = 7; ++SET GLOBAL wsrep_sync_wait = 7; ++CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; ++INSERT INTO t1 VALUES (1); ++INSERT IGNORE INTO t1 VALUES (1), (2); ++SELECT * FROM t1; ++f1 ++1 ++2 ++SELECT * FROM t1; ++f1 ++1 ++2 ++CREATE TABLE t2 (f1 INTEGER) ENGINE=InnoDB; ++INSERT INTO t2 VALUES (0), (2), (3); ++INSERT IGNORE INTO t1 SELECT f1 FROM t2; ++SELECT * FROM t1; ++f1 ++0 ++1 ++2 ++3 ++SELECT * FROM t1; ++f1 ++0 ++1 ++2 ++3 ++CREATE TABLE t3 (f1 INTEGER UNIQUE) Engine=InnoDB; ++INSERT INTO t3 VALUES (NULL); ++INSERT IGNORE INTO t3 VALUES (1), (NULL), (2); ++SELECT * FROM t3; ++f1 ++NULL ++NULL ++1 ++2 ++SELECT * FROM t3; ++f1 ++NULL ++NULL ++1 ++2 ++SET GLOBAL wsrep_sync_wait = (SELECT @@wsrep_sync_wait); ++DROP TABLE t1; ++DROP TABLE t2; ++DROP TABLE t3; ++SET GLOBAL wsrep_sync_wait = (SELECT @@wsrep_sync_wait); +diff --git a/mysql-test/suite/galera/r/galera_insert_multi.result b/mysql-test/suite/galera/r/galera_insert_multi.result +new file mode 100644 +index 0000000..3371778 +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_insert_multi.result +@@ -0,0 +1,58 @@ ++CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; ++INSERT INTO t1 VALUES (1),(2); ++INSERT INTO t1 VALUES (3),(4); ++SELECT COUNT(*) = 4 FROM t1; ++COUNT(*) = 4 ++1 ++SELECT COUNT(*) = 4 FROM t1; ++COUNT(*) = 4 ++1 ++DROP TABLE t1; ++CREATE TABLE t1 (f1 INTEGER, KEY (f1)) ENGINE=InnoDB; ++INSERT INTO t1 VALUES (1),(1); ++INSERT INTO t1 VALUES (2),(2); ++SELECT COUNT(*) = 4 FROM t1; ++COUNT(*) = 4 ++1 ++SELECT COUNT(*) = 4 FROM t1; ++COUNT(*) = 4 ++1 ++DROP TABLE t1; ++CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; ++INSERT INTO t1 VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (1); ++ERROR 23000: Duplicate entry '1' for key 'PRIMARY' ++SELECT COUNT(*) = 0 FROM t1; ++COUNT(*) = 0 ++1 ++SELECT COUNT(*) = 0 FROM t1; ++COUNT(*) = 0 ++1 ++DROP TABLE t1; ++CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; ++SET AUTOCOMMIT = OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES (1), (2); ++SET AUTOCOMMIT = OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES (2), (1); ++COMMIT; ++COMMIT; ++ERROR 40001: Deadlock found when trying to get lock; try restarting transaction ++ROLLBACK; ++INSERT INTO t1 VALUES (1), (2); ++ERROR 23000: Duplicate entry '1' for key 'PRIMARY' ++DROP TABLE t1; ++CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; ++START TRANSACTION; ++INSERT INTO t1 VALUES (1), (2); ++START TRANSACTION; ++INSERT INTO t1 VALUES (2), (1); ++ROLLBACK; ++COMMIT; ++SELECT COUNT(*) = 2 FROM t1; ++COUNT(*) = 2 ++1 ++SELECT COUNT(*) = 2 FROM t1; ++COUNT(*) = 2 ++1 ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/r/galera_ist_innodb_flush_logs.result b/mysql-test/suite/galera/r/galera_ist_innodb_flush_logs.result +new file mode 100644 +index 0000000..5421b23 +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_ist_innodb_flush_logs.result +@@ -0,0 +1,184 @@ ++Performing State Transfer on a server that has been killed and restarted ++CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++COMMIT; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++COMMIT; ++Killing server ... ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++COMMIT; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++Performing --wsrep-recover ... ++Starting server ... ++Using --wsrep-start-position when starting mysqld ... ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++COMMIT; ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++COMMIT; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++COMMIT; ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++ROLLBACK; ++SELECT COUNT(*) = 35 FROM t1; ++COUNT(*) = 35 ++1 ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++COUNT(*) = 0 ++1 ++COMMIT; ++SET AUTOCOMMIT=ON; ++SELECT COUNT(*) = 35 FROM t1; ++COUNT(*) = 35 ++1 ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++COUNT(*) = 0 ++1 ++DROP TABLE t1; ++COMMIT; ++SET AUTOCOMMIT=ON; ++Performing State Transfer on a server that has been killed and restarted ++while a DDL was in progress on it ++CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++COMMIT; ++SET GLOBAL debug = 'd,sync.alter_opened_table'; ++ALTER TABLE t1 ADD COLUMN f2 INTEGER; ++SET wsrep_sync_wait = 0; ++Killing server ... ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); ++COMMIT; ++START TRANSACTION; ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++Performing --wsrep-recover ... ++Starting server ... ++Using --wsrep-start-position when starting mysqld ... ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); ++COMMIT; ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++COMMIT; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); ++COMMIT; ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++ROLLBACK; ++SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; ++COUNT(*) = 2 ++1 ++SELECT COUNT(*) = 35 FROM t1; ++COUNT(*) = 35 ++1 ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++COUNT(*) = 0 ++1 ++COMMIT; ++SET AUTOCOMMIT=ON; ++SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; ++COUNT(*) = 2 ++1 ++SELECT COUNT(*) = 35 FROM t1; ++COUNT(*) = 35 ++1 ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++COUNT(*) = 0 ++1 ++DROP TABLE t1; ++COMMIT; ++SET AUTOCOMMIT=ON; +diff --git a/mysql-test/suite/galera/r/galera_ist_mysqldump.result b/mysql-test/suite/galera/r/galera_ist_mysqldump.result +new file mode 100644 +index 0000000..4b5a8fe +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_ist_mysqldump.result +@@ -0,0 +1,284 @@ ++Setting SST method to mysqldump ... ++GRANT ALL PRIVILEGES ON *.* TO 'sst' IDENTIFIED BY 'sst'; ++SET GLOBAL wsrep_sst_auth = 'sst:sst'; ++SET GLOBAL wsrep_sst_method = 'mysqldump'; ++Performing State Transfer on a server that has been shut down cleanly and restarted ++CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++COMMIT; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++COMMIT; ++Shutting down server ... ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++COMMIT; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++Starting server ... ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++COMMIT; ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++COMMIT; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++COMMIT; ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++ROLLBACK; ++SELECT COUNT(*) = 35 FROM t1; ++COUNT(*) = 35 ++1 ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++COUNT(*) = 0 ++1 ++COMMIT; ++SET AUTOCOMMIT=ON; ++SELECT COUNT(*) = 35 FROM t1; ++COUNT(*) = 35 ++1 ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++COUNT(*) = 0 ++1 ++DROP TABLE t1; ++COMMIT; ++SET AUTOCOMMIT=ON; ++Performing State Transfer on a server that has been killed and restarted ++CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++COMMIT; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++COMMIT; ++Killing server ... ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++COMMIT; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++Performing --wsrep-recover ... ++Starting server ... ++Using --wsrep-start-position when starting mysqld ... ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++COMMIT; ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++COMMIT; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++COMMIT; ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++ROLLBACK; ++SELECT COUNT(*) = 35 FROM t1; ++COUNT(*) = 35 ++1 ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++COUNT(*) = 0 ++1 ++COMMIT; ++SET AUTOCOMMIT=ON; ++SELECT COUNT(*) = 35 FROM t1; ++COUNT(*) = 35 ++1 ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++COUNT(*) = 0 ++1 ++DROP TABLE t1; ++COMMIT; ++SET AUTOCOMMIT=ON; ++Performing State Transfer on a server that has been killed and restarted ++while a DDL was in progress on it ++CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++COMMIT; ++SET GLOBAL debug = 'd,sync.alter_opened_table'; ++ALTER TABLE t1 ADD COLUMN f2 INTEGER; ++SET wsrep_sync_wait = 0; ++Killing server ... ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); ++COMMIT; ++START TRANSACTION; ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++Performing --wsrep-recover ... ++Starting server ... ++Using --wsrep-start-position when starting mysqld ... ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); ++COMMIT; ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++COMMIT; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); ++COMMIT; ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++ROLLBACK; ++SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; ++COUNT(*) = 2 ++1 ++SELECT COUNT(*) = 35 FROM t1; ++COUNT(*) = 35 ++1 ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++COUNT(*) = 0 ++1 ++COMMIT; ++SET AUTOCOMMIT=ON; ++SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; ++COUNT(*) = 2 ++1 ++SELECT COUNT(*) = 35 FROM t1; ++COUNT(*) = 35 ++1 ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++COUNT(*) = 0 ++1 ++DROP TABLE t1; ++COMMIT; ++SET AUTOCOMMIT=ON; ++CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query"); ++DROP USER sst; ++CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query"); ++CALL mtr.add_suppression("InnoDB: Error: Table \"mysql\"\\.\"innodb_index_stats\" not found"); ++CALL mtr.add_suppression("InnoDB: New log files created"); ++CALL mtr.add_suppression("InnoDB: Creating foreign key constraint system tables"); ++CALL mtr.add_suppression("Can't open and lock time zone table"); ++CALL mtr.add_suppression("Can't open and lock privilege tables"); ++CALL mtr.add_suppression("Info table is not ready to be used"); ++CALL mtr.add_suppression("Native table .* has the wrong structure"); +diff --git a/mysql-test/suite/galera/r/galera_ist_restart_joiner.result b/mysql-test/suite/galera/r/galera_ist_restart_joiner.result +new file mode 100644 +index 0000000..f7a1386 +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_ist_restart_joiner.result +@@ -0,0 +1,43 @@ ++CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1)); ++INSERT INTO t1 VALUES (1, 'a'), (2, 'a'), (3, 'a'), (4, 'a'), (5, 'a'),(6, 'a'); ++Unloading wsrep provider ... ++SET GLOBAL wsrep_provider = 'none'; ++UPDATE t1 SET f2 = 'b' WHERE f1 > 1; ++UPDATE t1 SET f2 = 'c' WHERE f1 > 2; ++SET GLOBAL wsrep_provider_options = 'dbug=d,recv_IST_after_apply_trx'; ++SET SESSION wsrep_sync_wait = 0; ++Loading wsrep_provider ... ++SHOW STATUS LIKE 'wsrep_debug_sync_waiters'; ++Variable_name Value ++wsrep_debug_sync_waiters recv_IST_after_apply_trx ++UPDATE t1 SET f2 = 'd' WHERE f1 > 3; ++CREATE TABLE t2 (f1 INTEGER); ++UPDATE t1 SET f2 = 'e' WHERE f1 > 4; ++CREATE TABLE t3 (f1 INTEGER); ++Performing --wsrep-recover ... ++Starting server ... ++Using --wsrep-start-position when starting mysqld ... ++UPDATE t1 SET f2 = 'f' WHERE f1 > 5; ++SELECT * FROM t1; ++f1 f2 ++1 a ++2 b ++3 c ++4 d ++5 e ++6 f ++SELECT * FROM t1; ++f1 f2 ++1 a ++2 b ++3 c ++4 d ++5 e ++6 f ++SELECT COUNT(*) = 0 FROM t2; ++COUNT(*) = 0 ++1 ++SELECT COUNT(*) = 0 FROM t3; ++COUNT(*) = 0 ++1 ++DROP TABLE t1, t2, t3; +diff --git a/mysql-test/suite/galera/r/galera_ist_rsync.result b/mysql-test/suite/galera/r/galera_ist_rsync.result +new file mode 100644 +index 0000000..175e744 +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_ist_rsync.result +@@ -0,0 +1,357 @@ ++Performing State Transfer on a server that has been temporarily disconnected ++CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++COMMIT; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++COMMIT; ++Unloading wsrep provider ... ++SET GLOBAL wsrep_provider = 'none'; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++COMMIT; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++Loading wsrep provider ... ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++COMMIT; ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++COMMIT; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++COMMIT; ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++ROLLBACK; ++SELECT COUNT(*) = 35 FROM t1; ++COUNT(*) = 35 ++1 ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++COUNT(*) = 0 ++1 ++COMMIT; ++SET AUTOCOMMIT=ON; ++SELECT COUNT(*) = 35 FROM t1; ++COUNT(*) = 35 ++1 ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++COUNT(*) = 0 ++1 ++DROP TABLE t1; ++COMMIT; ++SET AUTOCOMMIT=ON; ++Performing State Transfer on a server that has been shut down cleanly and restarted ++CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++COMMIT; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++COMMIT; ++Shutting down server ... ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++COMMIT; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++Starting server ... ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++COMMIT; ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++COMMIT; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++COMMIT; ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++ROLLBACK; ++SELECT COUNT(*) = 35 FROM t1; ++COUNT(*) = 35 ++1 ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++COUNT(*) = 0 ++1 ++COMMIT; ++SET AUTOCOMMIT=ON; ++SELECT COUNT(*) = 35 FROM t1; ++COUNT(*) = 35 ++1 ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++COUNT(*) = 0 ++1 ++DROP TABLE t1; ++COMMIT; ++SET AUTOCOMMIT=ON; ++Performing State Transfer on a server that has been killed and restarted ++CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++COMMIT; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++COMMIT; ++Killing server ... ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++COMMIT; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++Performing --wsrep-recover ... ++Starting server ... ++Using --wsrep-start-position when starting mysqld ... ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++COMMIT; ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++COMMIT; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++COMMIT; ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++ROLLBACK; ++SELECT COUNT(*) = 35 FROM t1; ++COUNT(*) = 35 ++1 ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++COUNT(*) = 0 ++1 ++COMMIT; ++SET AUTOCOMMIT=ON; ++SELECT COUNT(*) = 35 FROM t1; ++COUNT(*) = 35 ++1 ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++COUNT(*) = 0 ++1 ++DROP TABLE t1; ++COMMIT; ++SET AUTOCOMMIT=ON; ++Performing State Transfer on a server that has been killed and restarted ++while a DDL was in progress on it ++CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++COMMIT; ++SET GLOBAL debug = 'd,sync.alter_opened_table'; ++ALTER TABLE t1 ADD COLUMN f2 INTEGER; ++SET wsrep_sync_wait = 0; ++Killing server ... ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); ++COMMIT; ++START TRANSACTION; ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++Performing --wsrep-recover ... ++Starting server ... ++Using --wsrep-start-position when starting mysqld ... ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); ++COMMIT; ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++COMMIT; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); ++COMMIT; ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++ROLLBACK; ++SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; ++COUNT(*) = 2 ++1 ++SELECT COUNT(*) = 35 FROM t1; ++COUNT(*) = 35 ++1 ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++COUNT(*) = 0 ++1 ++COMMIT; ++SET AUTOCOMMIT=ON; ++SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; ++COUNT(*) = 2 ++1 ++SELECT COUNT(*) = 35 FROM t1; ++COUNT(*) = 35 ++1 ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++COUNT(*) = 0 ++1 ++DROP TABLE t1; ++COMMIT; ++SET AUTOCOMMIT=ON; +diff --git a/mysql-test/suite/galera/r/galera_ist_xtrabackup-v2.result b/mysql-test/suite/galera/r/galera_ist_xtrabackup-v2.result +new file mode 100644 +index 0000000..175e744 +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_ist_xtrabackup-v2.result +@@ -0,0 +1,357 @@ ++Performing State Transfer on a server that has been temporarily disconnected ++CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++COMMIT; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++COMMIT; ++Unloading wsrep provider ... ++SET GLOBAL wsrep_provider = 'none'; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++COMMIT; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++Loading wsrep provider ... ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++COMMIT; ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++COMMIT; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++COMMIT; ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++ROLLBACK; ++SELECT COUNT(*) = 35 FROM t1; ++COUNT(*) = 35 ++1 ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++COUNT(*) = 0 ++1 ++COMMIT; ++SET AUTOCOMMIT=ON; ++SELECT COUNT(*) = 35 FROM t1; ++COUNT(*) = 35 ++1 ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++COUNT(*) = 0 ++1 ++DROP TABLE t1; ++COMMIT; ++SET AUTOCOMMIT=ON; ++Performing State Transfer on a server that has been shut down cleanly and restarted ++CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++COMMIT; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++COMMIT; ++Shutting down server ... ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++COMMIT; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++Starting server ... ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++COMMIT; ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++COMMIT; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++COMMIT; ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++ROLLBACK; ++SELECT COUNT(*) = 35 FROM t1; ++COUNT(*) = 35 ++1 ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++COUNT(*) = 0 ++1 ++COMMIT; ++SET AUTOCOMMIT=ON; ++SELECT COUNT(*) = 35 FROM t1; ++COUNT(*) = 35 ++1 ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++COUNT(*) = 0 ++1 ++DROP TABLE t1; ++COMMIT; ++SET AUTOCOMMIT=ON; ++Performing State Transfer on a server that has been killed and restarted ++CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++COMMIT; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++COMMIT; ++Killing server ... ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++COMMIT; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++Performing --wsrep-recover ... ++Starting server ... ++Using --wsrep-start-position when starting mysqld ... ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++COMMIT; ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++COMMIT; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++COMMIT; ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++ROLLBACK; ++SELECT COUNT(*) = 35 FROM t1; ++COUNT(*) = 35 ++1 ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++COUNT(*) = 0 ++1 ++COMMIT; ++SET AUTOCOMMIT=ON; ++SELECT COUNT(*) = 35 FROM t1; ++COUNT(*) = 35 ++1 ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++COUNT(*) = 0 ++1 ++DROP TABLE t1; ++COMMIT; ++SET AUTOCOMMIT=ON; ++Performing State Transfer on a server that has been killed and restarted ++while a DDL was in progress on it ++CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++COMMIT; ++SET GLOBAL debug = 'd,sync.alter_opened_table'; ++ALTER TABLE t1 ADD COLUMN f2 INTEGER; ++SET wsrep_sync_wait = 0; ++Killing server ... ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); ++COMMIT; ++START TRANSACTION; ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++Performing --wsrep-recover ... ++Starting server ... ++Using --wsrep-start-position when starting mysqld ... ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); ++COMMIT; ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++COMMIT; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); ++COMMIT; ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++ROLLBACK; ++SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; ++COUNT(*) = 2 ++1 ++SELECT COUNT(*) = 35 FROM t1; ++COUNT(*) = 35 ++1 ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++COUNT(*) = 0 ++1 ++COMMIT; ++SET AUTOCOMMIT=ON; ++SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; ++COUNT(*) = 2 ++1 ++SELECT COUNT(*) = 35 FROM t1; ++COUNT(*) = 35 ++1 ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++COUNT(*) = 0 ++1 ++DROP TABLE t1; ++COMMIT; ++SET AUTOCOMMIT=ON; +diff --git a/mysql-test/suite/galera/r/galera_kill_ddl.result b/mysql-test/suite/galera/r/galera_kill_ddl.result +new file mode 100644 +index 0000000..8dd3649 +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_kill_ddl.result +@@ -0,0 +1,11 @@ ++SET GLOBAL wsrep_provider_options = 'pc.ignore_sb=true'; ++CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; ++Killing server ... ++ALTER TABLE t1 ADD COLUMN f2 INTEGER; ++SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='t1'; ++COUNT(*) = 2 ++1 ++SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; ++VARIABLE_VALUE = 2 ++1 ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/r/galera_kill_largechanges.result b/mysql-test/suite/galera/r/galera_kill_largechanges.result +new file mode 100644 +index 0000000..a37056a +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_kill_largechanges.result +@@ -0,0 +1,14 @@ ++SET GLOBAL wsrep_provider_options = 'pc.ignore_sb=true'; ++CREATE TABLE ten (f1 INTEGER); ++INSERT INTO ten VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10); ++CREATE TABLE t1 (f1 VARCHAR(128)) ENGINE=InnoDB; ++Killing server ... ++INSERT INTO t1 SELECT REPEAT('a', 128) FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5, ten AS a6; ++SELECT COUNT(*) = 1000000 FROM t1; ++COUNT(*) = 1000000 ++1 ++SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; ++VARIABLE_VALUE = 2 ++1 ++DROP TABLE t1; ++DROP TABLE ten; +diff --git a/mysql-test/suite/galera/r/galera_kill_nochanges.result b/mysql-test/suite/galera/r/galera_kill_nochanges.result +new file mode 100644 +index 0000000..accace9 +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_kill_nochanges.result +@@ -0,0 +1,9 @@ ++CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; ++INSERT INTO t1 VALUES (1); ++SELECT COUNT(*) = 1 FROM t1; ++COUNT(*) = 1 ++1 ++SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; ++VARIABLE_VALUE = 2 ++1 ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/r/galera_kill_smallchanges.result b/mysql-test/suite/galera/r/galera_kill_smallchanges.result +new file mode 100644 +index 0000000..8409740 +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_kill_smallchanges.result +@@ -0,0 +1,11 @@ ++SET GLOBAL wsrep_provider_options = 'pc.ignore_sb=true'; ++CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; ++Killing server ... ++INSERT INTO t1 VALUES (1); ++SELECT COUNT(*) = 1 FROM t1; ++COUNT(*) = 1 ++1 ++SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; ++VARIABLE_VALUE = 2 ++1 ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/r/galera_lock_table.result b/mysql-test/suite/galera/r/galera_lock_table.result +new file mode 100644 +index 0000000..16e9037 +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_lock_table.result +@@ -0,0 +1,21 @@ ++CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB; ++CREATE TABLE t2 (id INT PRIMARY KEY) ENGINE=InnoDB; ++LOCK TABLE t1 READ; ++INSERT INTO t1 VALUES (1); ++INSERT INTO t2 VALUES (1); ++SET SESSION wsrep_sync_wait=0; ++SELECT COUNT(*) = 0 FROM t1; ++COUNT(*) = 0 ++1 ++SELECT COUNT(*) = 0 FROM t2; ++COUNT(*) = 0 ++1 ++UNLOCK TABLES; ++SELECT COUNT(*) = 1 FROM t1; ++COUNT(*) = 1 ++1 ++SELECT COUNT(*) = 1 FROM t2; ++COUNT(*) = 1 ++1 ++DROP TABLE t1; ++DROP TABLE t2; +diff --git a/mysql-test/suite/galera/r/galera_log_bin.result b/mysql-test/suite/galera/r/galera_log_bin.result +new file mode 100644 +index 0000000..9a8513d +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_log_bin.result +@@ -0,0 +1,53 @@ ++CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB; ++INSERT INTO t1 VALUES (1); ++CREATE TABLE t2 (id INT) ENGINE=InnoDB; ++INSERT INTO t2 VALUES (1); ++INSERT INTO t2 VALUES (1); ++SELECT COUNT(*) = 1 FROM t1; ++COUNT(*) = 1 ++1 ++SELECT COUNT(*) = 2 FROM t2; ++COUNT(*) = 2 ++1 ++ALTER TABLE t1 ADD COLUMN f2 INTEGER; ++FLUSH LOGS; ++SHOW BINLOG EVENTS IN '0.000002' FROM 120; ++Log_name Pos Event_type Server_id End_log_pos Info ++0.000002 120 Query 1 244 use `test`; CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB ++0.000002 244 Query 1 321 BEGIN ++0.000002 321 Table_map 1 366 table_id: 103 (test.t1) ++0.000002 366 Write_rows 1 406 table_id: 103 flags: STMT_END_F ++0.000002 406 Xid 1 437 COMMIT /* xid=2 */ ++0.000002 437 Query 1 549 use `test`; CREATE TABLE t2 (id INT) ENGINE=InnoDB ++0.000002 549 Query 1 626 BEGIN ++0.000002 626 Table_map 1 671 table_id: 104 (test.t2) ++0.000002 671 Write_rows 1 711 table_id: 104 flags: STMT_END_F ++0.000002 711 Xid 1 742 COMMIT /* xid=4 */ ++0.000002 742 Query 1 819 BEGIN ++0.000002 819 Table_map 1 864 table_id: 104 (test.t2) ++0.000002 864 Write_rows 1 904 table_id: 104 flags: STMT_END_F ++0.000002 904 Xid 1 935 COMMIT /* xid=5 */ ++0.000002 935 Query 1 1045 use `test`; ALTER TABLE t1 ADD COLUMN f2 INTEGER ++0.000002 1045 Rotate 1 1084 0.000003;pos=4 ++SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; ++COUNT(*) = 2 ++1 ++SHOW BINLOG EVENTS IN '0.000001' FROM 120; ++Log_name Pos Event_type Server_id End_log_pos Info ++0.000001 120 Query 1 244 use `test`; CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB ++0.000001 244 Query 1 312 BEGIN ++0.000001 312 Table_map 1 357 table_id: 81 (test.t1) ++0.000001 357 Write_rows 1 397 table_id: 81 flags: STMT_END_F ++0.000001 397 Xid 1 428 COMMIT /* xid=2 */ ++0.000001 428 Query 1 540 use `test`; CREATE TABLE t2 (id INT) ENGINE=InnoDB ++0.000001 540 Query 1 608 BEGIN ++0.000001 608 Table_map 1 653 table_id: 82 (test.t2) ++0.000001 653 Write_rows 1 693 table_id: 82 flags: STMT_END_F ++0.000001 693 Xid 1 724 COMMIT /* xid=4 */ ++0.000001 724 Query 1 792 BEGIN ++0.000001 792 Table_map 1 837 table_id: 82 (test.t2) ++0.000001 837 Write_rows 1 877 table_id: 82 flags: STMT_END_F ++0.000001 877 Xid 1 908 COMMIT /* xid=5 */ ++0.000001 908 Query 1 1018 use `test`; ALTER TABLE t1 ADD COLUMN f2 INTEGER ++DROP TABLE t1; ++DROP TABLE t2; +diff --git a/mysql-test/suite/galera/r/galera_log_output_csv.result b/mysql-test/suite/galera/r/galera_log_output_csv.result +new file mode 100644 +index 0000000..07a7846 +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_log_output_csv.result +@@ -0,0 +1,21 @@ ++CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; ++INSERT INTO t1 VALUES (1); ++SELECT COUNT(*) > 0 FROM mysql.general_log; ++COUNT(*) > 0 ++1 ++SELECT 1 = 1 FROM t1; ++1 = 1 ++1 ++SELECT COUNT(*) = 1 FROM mysql.slow_log WHERE sql_text = 'SELECT 1 = 1 FROM t1'; ++COUNT(*) = 1 ++1 ++SELECT COUNT(*) > 0 FROM mysql.general_log WHERE argument = 'CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB'; ++COUNT(*) > 0 ++1 ++SELECT 2 = 2 FROM t1; ++2 = 2 ++1 ++SELECT COUNT(*) = 1 FROM mysql.slow_log WHERE sql_text = 'SELECT 2 = 2 FROM t1'; ++COUNT(*) = 1 ++1 ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/r/galera_many_columns.result b/mysql-test/suite/galera/r/galera_many_columns.result +new file mode 100644 +index 0000000..6fa574e +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_many_columns.result +@@ -0,0 +1,32 @@ ++INSERT INTO t1 (f1) VALUES (DEFAULT); ++SELECT f1 = 'ABC', f1017 = 'ABC' FROM t1; ++f1 = 'ABC' f1017 = 'ABC' ++1 1 ++UPDATE t1 SET f1 = 'XYZ', f1017 = 'XYZ' ; ++SELECT f1 = 'XYZ', f1017 = 'XYZ' FROM t1 WHERE f1 = 'XYZ' AND f1017 = 'XYZ'; ++f1 = 'XYZ' f1017 = 'XYZ' ++1 1 ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++UPDATE t1 SET f2 = 'KLM' WHERE f1 = 'XYZ' AND f1017 = 'XYZ'; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++UPDATE t1 SET f2 = 'CDE' WHERE f1 = 'XYZ' AND f1017 = 'XYZ'; ++COMMIT; ++COMMIT; ++ERROR 40001: Deadlock found when trying to get lock; try restarting transaction ++ROLLBACK; ++ROLLBACK; ++START TRANSACTION; ++INSERT INTO t1 (f1, f1017) VALUES ('BCE','BCE'); ++INSERT INTO t1 (f1, f1017) VALUES ('CED','CED'); ++INSERT INTO t1 (f1, f1017) VALUES ('EDF','EDF'); ++INSERT INTO t1 (f1, f1017) VALUES ('FED','FED'); ++ROLLBACK; ++SELECT COUNT(*) = 1 FROM t1; ++COUNT(*) = 1 ++1 ++SELECT COUNT(*) = 1 FROM t1; ++COUNT(*) = 1 ++1 ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/r/galera_many_indexes.result b/mysql-test/suite/galera/r/galera_many_indexes.result +new file mode 100644 +index 0000000..ab6eec5 +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_many_indexes.result +@@ -0,0 +1,123 @@ ++CREATE TABLE t1 (f1 VARCHAR(767) PRIMARY KEY) ENGINE=InnoDB; ++CREATE UNIQUE INDEX i63 ON t1(f1); ++CREATE UNIQUE INDEX i62 ON t1(f1); ++CREATE UNIQUE INDEX i61 ON t1(f1); ++CREATE UNIQUE INDEX i60 ON t1(f1); ++CREATE UNIQUE INDEX i59 ON t1(f1); ++CREATE UNIQUE INDEX i58 ON t1(f1); ++CREATE UNIQUE INDEX i57 ON t1(f1); ++CREATE UNIQUE INDEX i56 ON t1(f1); ++CREATE UNIQUE INDEX i55 ON t1(f1); ++CREATE UNIQUE INDEX i54 ON t1(f1); ++CREATE UNIQUE INDEX i53 ON t1(f1); ++CREATE UNIQUE INDEX i52 ON t1(f1); ++CREATE UNIQUE INDEX i51 ON t1(f1); ++CREATE UNIQUE INDEX i50 ON t1(f1); ++CREATE UNIQUE INDEX i49 ON t1(f1); ++CREATE UNIQUE INDEX i48 ON t1(f1); ++CREATE UNIQUE INDEX i47 ON t1(f1); ++CREATE UNIQUE INDEX i46 ON t1(f1); ++CREATE UNIQUE INDEX i45 ON t1(f1); ++CREATE UNIQUE INDEX i44 ON t1(f1); ++CREATE UNIQUE INDEX i43 ON t1(f1); ++CREATE UNIQUE INDEX i42 ON t1(f1); ++CREATE UNIQUE INDEX i41 ON t1(f1); ++CREATE UNIQUE INDEX i40 ON t1(f1); ++CREATE UNIQUE INDEX i39 ON t1(f1); ++CREATE UNIQUE INDEX i38 ON t1(f1); ++CREATE UNIQUE INDEX i37 ON t1(f1); ++CREATE UNIQUE INDEX i36 ON t1(f1); ++CREATE UNIQUE INDEX i35 ON t1(f1); ++CREATE UNIQUE INDEX i34 ON t1(f1); ++CREATE UNIQUE INDEX i33 ON t1(f1); ++CREATE UNIQUE INDEX i32 ON t1(f1); ++CREATE UNIQUE INDEX i31 ON t1(f1); ++CREATE UNIQUE INDEX i30 ON t1(f1); ++CREATE UNIQUE INDEX i29 ON t1(f1); ++CREATE UNIQUE INDEX i28 ON t1(f1); ++CREATE UNIQUE INDEX i27 ON t1(f1); ++CREATE UNIQUE INDEX i26 ON t1(f1); ++CREATE UNIQUE INDEX i25 ON t1(f1); ++CREATE UNIQUE INDEX i24 ON t1(f1); ++CREATE UNIQUE INDEX i23 ON t1(f1); ++CREATE UNIQUE INDEX i22 ON t1(f1); ++CREATE UNIQUE INDEX i21 ON t1(f1); ++CREATE UNIQUE INDEX i20 ON t1(f1); ++CREATE UNIQUE INDEX i19 ON t1(f1); ++CREATE UNIQUE INDEX i18 ON t1(f1); ++CREATE UNIQUE INDEX i17 ON t1(f1); ++CREATE UNIQUE INDEX i16 ON t1(f1); ++CREATE UNIQUE INDEX i15 ON t1(f1); ++CREATE UNIQUE INDEX i14 ON t1(f1); ++CREATE UNIQUE INDEX i13 ON t1(f1); ++CREATE UNIQUE INDEX i12 ON t1(f1); ++CREATE UNIQUE INDEX i11 ON t1(f1); ++CREATE UNIQUE INDEX i10 ON t1(f1); ++CREATE UNIQUE INDEX i9 ON t1(f1); ++CREATE UNIQUE INDEX i8 ON t1(f1); ++CREATE UNIQUE INDEX i7 ON t1(f1); ++CREATE UNIQUE INDEX i6 ON t1(f1); ++CREATE UNIQUE INDEX i5 ON t1(f1); ++CREATE UNIQUE INDEX i4 ON t1(f1); ++CREATE UNIQUE INDEX i3 ON t1(f1); ++CREATE UNIQUE INDEX i2 ON t1(f1); ++CREATE UNIQUE INDEX i1 ON t1(f1); ++INSERT INTO t1 VALUES (REPEAT('a', 767)); ++SELECT COUNT(*) = 1 FROM t1; ++COUNT(*) = 1 ++1 ++SELECT LENGTH(f1) = 767 FROM t1; ++LENGTH(f1) = 767 ++1 ++EXPLAIN SELECT COUNT(*) = 1 FROM t1 FORCE KEY (PRIMARY) WHERE f1 = REPEAT('a', 767); ++id select_type table type possible_keys key key_len ref rows Extra ++1 SIMPLE t1 const PRIMARY PRIMARY 769 const 1 Using index ++SELECT COUNT(*) = 1 FROM t1 FORCE KEY (PRIMARY) WHERE f1 = REPEAT('a', 767); ++COUNT(*) = 1 ++1 ++EXPLAIN SELECT COUNT(*) = 1 FROM t1 FORCE KEY (i1) WHERE f1 = REPEAT('a', 767); ++id select_type table type possible_keys key key_len ref rows Extra ++1 SIMPLE t1 const i1 i1 769 const 1 Using index ++SELECT COUNT(*) = 1 FROM t1 FORCE KEY (i1) WHERE f1 = REPEAT('a', 767); ++COUNT(*) = 1 ++1 ++EXPLAIN SELECT COUNT(*) = 1 FROM t1 FORCE KEY (i63) WHERE f1 = REPEAT('a', 767); ++id select_type table type possible_keys key key_len ref rows Extra ++1 SIMPLE t1 const i63 i63 769 const 1 Using index ++SELECT COUNT(*) = 1 FROM t1 FORCE KEY (i63) WHERE f1 = REPEAT('a', 767); ++COUNT(*) = 1 ++1 ++INSERT INTO t1 VALUES (REPEAT('b', 767)); ++ANALYZE TABLE t1; ++Table Op Msg_type Msg_text ++test.t1 analyze status OK ++SELECT COUNT(*) = 2 FROM t1; ++COUNT(*) = 2 ++1 ++ANALYZE TABLE t1; ++Table Op Msg_type Msg_text ++test.t1 analyze status OK ++DELETE FROM t1 WHERE f1 = REPEAT('b', 767); ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++SELECT COUNT(*) = 1 FROM t1; ++COUNT(*) = 1 ++1 ++INSERT INTO t1 (f1) VALUES (REPEAT('c', 767)); ++ROLLBACK; ++SELECT COUNT(*) = 1 FROM t1; ++COUNT(*) = 1 ++1 ++START TRANSACTION; ++SET AUTOCOMMIT=OFF; ++SELECT COUNT(*) = 1 FROM t1; ++COUNT(*) = 1 ++1 ++START TRANSACTION; ++START TRANSACTION; ++UPDATE t1 SET f1 = REPEAT('e', 767); ++UPDATE t1 SET f1 = REPEAT('f', 767); ++COMMIT; ++COMMIT; ++ERROR 40001: Deadlock found when trying to get lock; try restarting transaction ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/r/galera_many_rows.result b/mysql-test/suite/galera/r/galera_many_rows.result +new file mode 100644 +index 0000000..6ec0add +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_many_rows.result +@@ -0,0 +1,41 @@ ++CREATE TABLE ten (f1 INTEGER); ++INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); ++CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 INTEGER) Engine=InnoDB; ++INSERT INTO t1 (f2) SELECT a1.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5; ++SELECT COUNT(*) = 100000 FROM t1; ++COUNT(*) = 100000 ++1 ++INSERT INTO t1 (f2) SELECT a1.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5; ++SELECT COUNT(*) = 200000 FROM t1; ++COUNT(*) = 200000 ++1 ++UPDATE t1 SET f2 = 1; ++SELECT COUNT(*) = 200000 FROM t1 WHERE f2 = 1; ++COUNT(*) = 200000 ++1 ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (f2) SELECT a1.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5; ++ROLLBACK; ++SELECT COUNT(*) = 200000 FROM t1; ++COUNT(*) = 200000 ++1 ++SELECT COUNT(*) = 200000 FROM t1; ++COUNT(*) = 200000 ++1 ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++UPDATE t1 SET f2 = 2; ++ROLLBACK; ++START TRANSACTION; ++SELECT COUNT(*) = 200000 FROM t1; ++COUNT(*) = 200000 ++1 ++UPDATE t1 SET f2 = 3; ++START TRANSACTION; ++UPDATE t1 SET f2 = 4; ++COMMIT; ++COMMIT; ++ERROR 40001: Deadlock found when trying to get lock; try restarting transaction ++DROP TABLE t1; ++DROP TABLE ten; +diff --git a/mysql-test/suite/galera/r/galera_many_tables_nopk.result b/mysql-test/suite/galera/r/galera_many_tables_nopk.result +new file mode 100644 +index 0000000..7a4f364 +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_many_tables_nopk.result +@@ -0,0 +1,17 @@ ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++COMMIT; ++CREATE TABLE sum_table (f1 INTEGER); ++SELECT SUM(f1) = 1000 FROM sum_table; ++SUM(f1) = 1000 ++1 ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++UPDATE t1000 SET f1 = 3; ++COMMIT; ++COMMIT; ++ERROR 40001: Deadlock found when trying to get lock; try restarting transaction ++DROP SCHEMA test; ++CREATE SCHEMA test; +diff --git a/mysql-test/suite/galera/r/galera_many_tables_pk.result b/mysql-test/suite/galera/r/galera_many_tables_pk.result +new file mode 100644 +index 0000000..6b6899d +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_many_tables_pk.result +@@ -0,0 +1,20 @@ ++SELECT COUNT(*) = 1000 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME LIKE 't%'; ++COUNT(*) = 1000 ++1 ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++COMMIT; ++CREATE TABLE sum_table (f1 INTEGER); ++SELECT SUM(f1) = 1000 FROM sum_table; ++SUM(f1) = 1000 ++1 ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++UPDATE t1000 SET f1 = 3; ++COMMIT; ++COMMIT; ++ERROR 40001: Deadlock found when trying to get lock; try restarting transaction ++DROP SCHEMA test; ++CREATE SCHEMA test; +diff --git a/mysql-test/suite/galera/r/galera_migrate.result b/mysql-test/suite/galera/r/galera_migrate.result +new file mode 100644 +index 0000000..7c92d66 +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_migrate.result +@@ -0,0 +1,79 @@ ++CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; ++INSERT INTO t1 VALUES (1); ++START SLAVE USER='root'; ++Warnings: ++Note 1759 Sending passwords in plain text without SSL/TLS is extremely insecure. ++INSERT INTO t1 VALUES (2); ++START SLAVE USER='root'; ++Warnings: ++Note 1759 Sending passwords in plain text without SSL/TLS is extremely insecure. ++INSERT INTO t1 VALUES (3); ++INSERT INTO t1 VALUES (4); ++SET GLOBAL wsrep_cluster_address='gcomm://'; ++INSERT INTO t1 VALUES (5); ++SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; ++VARIABLE_VALUE = 'Synced' ++1 ++SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; ++VARIABLE_VALUE = 'Primary' ++1 ++SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; ++VARIABLE_VALUE = 1 ++1 ++INSERT INTO t1 VALUES (6); ++GRANT ALL PRIVILEGES ON *.* TO 'sst' IDENTIFIED BY 'sst'; ++SET GLOBAL wsrep_sst_auth = 'sst:sst'; ++GRANT ALL PRIVILEGES ON *.* TO 'sst' IDENTIFIED BY 'sst'; ++SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; ++VARIABLE_VALUE = 'Synced' ++1 ++SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; ++VARIABLE_VALUE = 'Primary' ++1 ++SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; ++VARIABLE_VALUE = 2 ++1 ++STOP SLAVE; ++RESET SLAVE ALL; ++STOP SLAVE; ++RESET SLAVE ALL; ++INSERT INTO t1 VALUES (7); ++INSERT INTO t1 VALUES (8); ++SELECT COUNT(*) = 8 FROM t1; ++COUNT(*) = 8 ++1 ++SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; ++VARIABLE_VALUE = 'Synced' ++1 ++SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; ++VARIABLE_VALUE = 'Primary' ++1 ++SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; ++VARIABLE_VALUE = 2 ++1 ++SELECT COUNT(*) = 8 FROM t1; ++COUNT(*) = 8 ++1 ++SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; ++VARIABLE_VALUE = 'Synced' ++1 ++SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; ++VARIABLE_VALUE = 'Primary' ++1 ++SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; ++VARIABLE_VALUE = 2 ++1 ++DROP TABLE t1; ++DROP TABLE t1; ++SET GLOBAL wsrep_provider = 'none'; ++SET GLOBAL wsrep_sst_auth = ''; ++SET GLOBAL wsrep_provider_options = ''; ++DROP TABLE t1; ++DROP USER sst; ++SET GLOBAL wsrep_provider = 'none'; ++SET GLOBAL wsrep_sst_method = 'rsync'; ++SET GLOBAL wsrep_provider_options = ''; ++SET GLOBAL wsrep_sst_receive_address = 'AUTO'; ++DROP TABLE t1; ++DROP USER sst; ++CALL mtr.add_suppression("InnoDB: Error: Table \"mysql\"\\.\"innodb_index_stats\" not found"); +diff --git a/mysql-test/suite/galera/r/galera_multi_database.result b/mysql-test/suite/galera/r/galera_multi_database.result +new file mode 100644 +index 0000000..a04eb48 +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_multi_database.result +@@ -0,0 +1,28 @@ ++CREATE DATABASE d1; ++CREATE TABLE d1.t1(f1 INTEGER) ENGINE=InnoDB; ++CREATE DATABASE d2; ++CREATE TABLE d2.t1(f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO d1.t1 VALUES (1); ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO d2.t1 VALUES (1); ++COMMIT; ++COMMIT; ++SELECT COUNT(*) = 1 FROM d1.t1; ++COUNT(*) = 1 ++1 ++SELECT COUNT(*) = 1 FROM d2.t1; ++COUNT(*) = 1 ++1 ++SELECT COUNT(*) = 1 FROM d1.t1; ++COUNT(*) = 1 ++1 ++SELECT COUNT(*) = 1 FROM d2.t1; ++COUNT(*) = 1 ++1 ++DROP TABLE d1.t1; ++DROP TABLE d2.t1; ++DROP DATABASE d1; ++DROP DATABASE d2; +diff --git a/mysql-test/suite/galera/r/galera_myisam_autocommit.result b/mysql-test/suite/galera/r/galera_myisam_autocommit.result +new file mode 100644 +index 0000000..3f8d93b +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_myisam_autocommit.result +@@ -0,0 +1,24 @@ ++CREATE TABLE t1 (f1 INTEGER) ENGINE=MyISAM; ++INSERT INTO t1 VALUES (1); ++INSERT INTO t1 VALUES (2), (3); ++INSERT INTO t1 SELECT 4 FROM DUAL UNION ALL SELECT 5 FROM DUAL; ++CREATE TABLE t2 (f1 INTEGER PRIMARY KEY) ENGINE=MyISAM; ++INSERT INTO t2 VALUES (1); ++INSERT INTO t2 VALUES (2), (3); ++INSERT INTO t2 SELECT 4 FROM DUAL UNION ALL SELECT 5 FROM DUAL; ++INSERT INTO t2 VALUES (6), (1); ++ERROR 23000: Duplicate entry '1' for key 'PRIMARY' ++UPDATE t1 SET f1 = 9; ++UPDATE t2 SET f1 = 9 WHERE f1 = 1; ++DELETE FROM t1 WHERE f1 = 9; ++DELETE FROM t2 WHERE f1 = 9; ++TRUNCATE TABLE t1; ++TRUNCATE TABLE t1; ++SELECT COUNT(*) = 0 FROM t1; ++COUNT(*) = 0 ++1 ++SELECT COUNT(*) = 0 FROM t2; ++COUNT(*) = 0 ++1 ++DROP TABLE t1; ++DROP TABLE t2; +diff --git a/mysql-test/suite/galera/r/galera_myisam_transactions.result b/mysql-test/suite/galera/r/galera_myisam_transactions.result +new file mode 100644 +index 0000000..284f92b +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_myisam_transactions.result +@@ -0,0 +1,34 @@ ++CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; ++CREATE TABLE t2 (f1 INTEGER) ENGINE=MyISAM; ++CREATE TABLE t3 (f1 INTEGER) ENGINE=MyISAM; ++CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW INSERT INTO t3 VALUES (NEW.f1); ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES (1); ++INSERT INTO t2 VALUES (1); ++COMMIT; ++SELECT COUNT(*) = 1 FROM t1; ++COUNT(*) = 1 ++1 ++SELECT COUNT(*) = 0 FROM t2; ++COUNT(*) = 0 ++1 ++SELECT COUNT(*) = 0 FROM t2; ++COUNT(*) = 0 ++1 ++START TRANSACTION; ++INSERT INTO t1 VALUES (1); ++INSERT INTO t2 VALUES (1); ++ROLLBACK; ++Warnings: ++Warning 1196 Some non-transactional changed tables couldn't be rolled back ++SELECT COUNT(*) = 1 FROM t1; ++COUNT(*) = 1 ++1 ++SELECT COUNT(*) = 0 FROM t2; ++COUNT(*) = 0 ++1 ++SELECT COUNT(*) = 0 FROM t2; ++COUNT(*) = 0 ++1 ++DROP TABLE t1, t2, t3; +diff --git a/mysql-test/suite/galera/r/galera_nopk_bit.result b/mysql-test/suite/galera/r/galera_nopk_bit.result +new file mode 100644 +index 0000000..5723dac +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_nopk_bit.result +@@ -0,0 +1,27 @@ ++CREATE TABLE t1 (f1 BIT) ENGINE=InnoDB; ++INSERT INTO t1 VALUES (NULL),(0),(b'1'); ++SELECT f1 IS NULL, f1 = b'1' FROM t1; ++f1 IS NULL f1 = b'1' ++1 NULL ++0 0 ++0 1 ++DELETE FROM t1 WHERE f1 = b'1'; ++UPDATE t1 SET f1 = b'1' WHERE f1 IS NULL; ++UPDATE t1 SET f1 = 1 WHERE f1 = b'0'; ++SELECT f1 IS NULL, f1 = b'1' FROM t1; ++f1 IS NULL f1 = b'1' ++0 1 ++0 1 ++CREATE TABLE t2 (f1 BIT) ENGINE=InnoDB; ++INSERT INTO t2 VALUES (NULL); ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++UPDATE t2 SET f1 = 0 WHERE f1 IS NULL; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++UPDATE t2 SET f1 = 1 WHERE f1 IS NULL; ++COMMIT; ++COMMIT; ++ERROR 40001: Deadlock found when trying to get lock; try restarting transaction ++DROP TABLE t1; ++DROP TABLE t2; +diff --git a/mysql-test/suite/galera/r/galera_nopk_blob.result b/mysql-test/suite/galera/r/galera_nopk_blob.result +new file mode 100644 +index 0000000..7491b71 +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_nopk_blob.result +@@ -0,0 +1,27 @@ ++CREATE TABLE t1 (f1 BLOB) ENGINE=InnoDB; ++INSERT INTO t1 VALUES (NULL),('abc'); ++SELECT f1 FROM t1; ++f1 ++NULL ++abc ++DELETE FROM t1 WHERE f1 IS NULL; ++UPDATE t1 SET f1 = 'xyz' WHERE f1 = 'abc'; ++SELECT COUNT(*) = 1 FROM t1; ++COUNT(*) = 1 ++1 ++SELECT f1 = 'abc' FROM t1; ++f1 = 'abc' ++0 ++CREATE TABLE t2 (f1 BLOB) ENGINE=InnoDB; ++INSERT INTO t2 VALUES (NULL); ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++UPDATE t2 SET f1 = 'abc' WHERE f1 IS NULL; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++UPDATE t2 SET f1 = 'xyz' WHERE f1 IS NULL; ++COMMIT; ++COMMIT; ++ERROR 40001: Deadlock found when trying to get lock; try restarting transaction ++DROP TABLE t1; ++DROP TABLE t2; +diff --git a/mysql-test/suite/galera/r/galera_nopk_large_varchar.result b/mysql-test/suite/galera/r/galera_nopk_large_varchar.result +new file mode 100644 +index 0000000..abca81e +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_nopk_large_varchar.result +@@ -0,0 +1,30 @@ ++CREATE TABLE t1 (f1 VARCHAR(8000)) ENGINE=InnoDB; ++INSERT INTO t1 VALUES (NULL),(CONCAT(REPEAT('x', 7999), 'a')); ++SELECT LENGTH(f1) FROM t1; ++LENGTH(f1) ++NULL ++8000 ++DELETE FROM t1 WHERE f1 IS NULL; ++UPDATE t1 SET f1 = CONCAT(REPEAT('x', 7999), 'b') WHERE f1 = CONCAT(REPEAT('x', 7999), 'a'); ++SELECT COUNT(*) = 1 FROM t1; ++COUNT(*) = 1 ++1 ++SELECT LENGTH(f1) = 8000 FROM t1; ++LENGTH(f1) = 8000 ++1 ++SELECT f1 = CONCAT(REPEAT('x', 7999), 'b') FROM t1; ++f1 = CONCAT(REPEAT('x', 7999), 'b') ++1 ++CREATE TABLE t2 (f1 BLOB) ENGINE=InnoDB; ++INSERT INTO t2 VALUES (CONCAT(REPEAT('x', 7999), 'a')); ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++UPDATE t2 SET f1 = 'abc' WHERE f1 = CONCAT(REPEAT('x', 7999), 'a'); ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++UPDATE t2 SET f1 = 'xyz' WHERE f1 = CONCAT(REPEAT('x', 7999), 'a'); ++COMMIT; ++COMMIT; ++ERROR 40001: Deadlock found when trying to get lock; try restarting transaction ++DROP TABLE t1; ++DROP TABLE t2; +diff --git a/mysql-test/suite/galera/r/galera_nopk_unicode.result b/mysql-test/suite/galera/r/galera_nopk_unicode.result +new file mode 100644 +index 0000000..68d049a +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_nopk_unicode.result +@@ -0,0 +1,24 @@ ++CREATE TABLE t1 ( ++f1 VARCHAR(255), ++KEY (f1) ++) ENGINE=InnoDB DEFAULT CHARSET=utf8; ++INSERT INTO t1 VALUES ('текст'); ++SELECT f1 = 'текст' FROM t1; ++f1 = 'текст' ++1 ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++UPDATE t1 SET f1 = 'текст2'; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++UPDATE t1 SET f1 = 'текст3'; ++COMMIT; ++COMMIT; ++ERROR 40001: Deadlock found when trying to get lock; try restarting transaction ++SELECT f1 = 'текст2' FROM t1; ++f1 = 'текст2' ++1 ++SELECT f1 = 'текст2' FROM t1 WHERE f1 = 'текст2'; ++f1 = 'текст2' ++1 ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/r/galera_parallel_apply_lock_table.result b/mysql-test/suite/galera/r/galera_parallel_apply_lock_table.result +new file mode 100644 +index 0000000..85ba022 +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_parallel_apply_lock_table.result +@@ -0,0 +1,33 @@ ++CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB; ++CREATE TABLE t2 (id INT PRIMARY KEY) ENGINE=InnoDB; ++SET GLOBAL wsrep_slave_threads = 2; ++LOCK TABLE t1 READ; ++INSERT INTO t1 VALUES (1); ++INSERT INTO t2 VALUES (1); ++SET SESSION wsrep_sync_wait=0; ++SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE '%applied write set%'; ++COUNT(*) = 1 ++1 ++SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE '%Waiting for table level lock%'; ++COUNT(*) = 1 ++1 ++SELECT COUNT(*) = 0 FROM t1; ++COUNT(*) = 0 ++1 ++SELECT COUNT(*) = 0 FROM t2; ++COUNT(*) = 0 ++1 ++UNLOCK TABLES; ++SET SESSION wsrep_sync_wait = 7;; ++SELECT COUNT(*) = 1 FROM t1; ++COUNT(*) = 1 ++1 ++SELECT COUNT(*) = 1 FROM t2; ++COUNT(*) = 1 ++1 ++SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE '%committed%'; ++COUNT(*) = 2 ++1 ++SET GLOBAL wsrep_slave_threads = 1;; ++DROP TABLE t1; ++DROP TABLE t2; +diff --git a/mysql-test/suite/galera/r/galera_parallel_autoinc_largetrx.result b/mysql-test/suite/galera/r/galera_parallel_autoinc_largetrx.result +new file mode 100644 +index 0000000..1f163f4 +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_parallel_autoinc_largetrx.result +@@ -0,0 +1,18 @@ ++CREATE TABLE ten (f1 INTEGER); ++INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); ++CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 INTEGER) Engine=InnoDB; ++SET GLOBAL wsrep_slave_threads = 4; ++INSERT INTO t1 (f2) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;; ++INSERT INTO t1 (f2) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;; ++INSERT INTO t1 (f2) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;; ++SELECT COUNT(*) = 30000 FROM t1; ++COUNT(*) = 30000 ++1 ++SELECT COUNT(DISTINCT f1) = 30000 FROM t1; ++COUNT(DISTINCT f1) = 30000 ++1 ++SELECT COUNT(*) = 5 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user'; ++COUNT(*) = 5 ++1 ++DROP TABLE t1; ++DROP TABLE ten; +diff --git a/mysql-test/suite/galera/r/galera_parallel_autoinc_manytrx.result b/mysql-test/suite/galera/r/galera_parallel_autoinc_manytrx.result +new file mode 100644 +index 0000000..05ce328 +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_parallel_autoinc_manytrx.result +@@ -0,0 +1,15 @@ ++CREATE TABLE ten (f1 INTEGER); ++INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); ++CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 INTEGER) Engine=InnoDB; ++SET GLOBAL wsrep_slave_threads = 4; ++SELECT COUNT(*) = 20000 FROM t1; ++COUNT(*) = 20000 ++1 ++SELECT COUNT(DISTINCT f1) = 20000 FROM t1; ++COUNT(DISTINCT f1) = 20000 ++1 ++SELECT COUNT(*) = 4 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE 'committed%'; ++COUNT(*) = 4 ++1 ++DROP TABLE t1; ++DROP TABLE ten; +diff --git a/mysql-test/suite/galera/r/galera_parallel_simple.result b/mysql-test/suite/galera/r/galera_parallel_simple.result +new file mode 100644 +index 0000000..294a94b +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_parallel_simple.result +@@ -0,0 +1,27 @@ ++CREATE TABLE t1 (id INT) ENGINE=InnoDB; ++CREATE TABLE t2 (id INT) ENGINE=InnoDB; ++SET GLOBAL wsrep_slave_threads = 2; ++INSERT INTO t1 VALUES (1); ++INSERT INTO t2 VALUES (1); ++INSERT INTO t1 VALUES (1); ++INSERT INTO t2 VALUES (1); ++INSERT INTO t1 VALUES (1); ++INSERT INTO t2 VALUES (1); ++INSERT INTO t1 VALUES (1); ++INSERT INTO t2 VALUES (1); ++INSERT INTO t1 VALUES (1); ++INSERT INTO t2 VALUES (1); ++INSERT INTO t1 VALUES (1); ++INSERT INTO t2 VALUES (1); ++SELECT COUNT(*) = 10 FROM t1; ++COUNT(*) = 10 ++0 ++SELECT COUNT(*) = 10 FROM t2; ++COUNT(*) = 10 ++0 ++SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE 'committed%'; ++COUNT(*) = 2 ++1 ++SET GLOBAL wsrep_slave_threads = 1;; ++DROP TABLE t1; ++DROP TABLE t2; +diff --git a/mysql-test/suite/galera/r/galera_pc_ignore_sb.result b/mysql-test/suite/galera/r/galera_pc_ignore_sb.result +new file mode 100644 +index 0000000..5fcccfe +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_pc_ignore_sb.result +@@ -0,0 +1,12 @@ ++SET GLOBAL wsrep_provider_options = 'pc.ignore_sb=true'; ++Killing server ... ++CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; ++INSERT INTO t1 VALUES (1); ++DROP TABLE t1; ++SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; ++VARIABLE_VALUE = 1 ++1 ++SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready'; ++VARIABLE_VALUE = 'ON' ++1 ++SET GLOBAL wsrep_cluster_address = ''; +diff --git a/mysql-test/suite/galera/r/galera_pk_bigint_signed.result b/mysql-test/suite/galera/r/galera_pk_bigint_signed.result +new file mode 100644 +index 0000000..a307599 +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_pk_bigint_signed.result +@@ -0,0 +1,26 @@ ++CREATE TABLE t1 (f1 BIGINT SIGNED PRIMARY KEY, f2 VARCHAR(5)) ENGINE=InnoDB; ++INSERT INTO t1 VALUES ++(-9223372036854775808, 'min'), ++(9223372036854775807, 'max') ++; ++SELECT * FROM t1; ++f1 f2 ++-9223372036854775808 min ++9223372036854775807 max ++UPDATE t1 SET f2 = CONCAT(f2, '_'); ++SELECT * FROM t1; ++f1 f2 ++-9223372036854775808 min_ ++9223372036854775807 max_ ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++UPDATE t1 SET f2 = 'foo' WHERE f1 = -9223372036854775808; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++UPDATE t1 SET f2 = 'bar' WHERE f1 = -9223372036854775808; ++COMMIT; ++SET AUTOCOMMIT=ON; ++COMMIT; ++ERROR 40001: Deadlock found when trying to get lock; try restarting transaction ++SET AUTOCOMMIT=ON; ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/r/galera_pk_bigint_unsigned.result b/mysql-test/suite/galera/r/galera_pk_bigint_unsigned.result +new file mode 100644 +index 0000000..441926e +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_pk_bigint_unsigned.result +@@ -0,0 +1,23 @@ ++CREATE TABLE t1 (f1 BIGINT UNSIGNED PRIMARY KEY, f2 VARCHAR(5)) ENGINE=InnoDB; ++INSERT INTO t1 VALUES ++(18446744073709551615, 'max') ++; ++SELECT f1 = 18446744073709551615 FROM t1; ++f1 = 18446744073709551615 ++1 ++UPDATE t1 SET f2 = CONCAT(f2, '_'); ++SELECT f1 = 18446744073709551615 FROM t1; ++f1 = 18446744073709551615 ++1 ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++UPDATE t1 SET f2 = 'foo' WHERE f1 = 18446744073709551615; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++UPDATE t1 SET f2 = 'bar' WHERE f1 = 18446744073709551615; ++COMMIT; ++SET AUTOCOMMIT=ON; ++COMMIT; ++ERROR 40001: Deadlock found when trying to get lock; try restarting transaction ++SET AUTOCOMMIT=ON; ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/r/galera_query_cache.result b/mysql-test/suite/galera/r/galera_query_cache.result +new file mode 100644 +index 0000000..502d8a5 +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_query_cache.result +@@ -0,0 +1,57 @@ ++CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB; ++INSERT INTO t1 VALUES (1); ++RESET QUERY CACHE; ++FLUSH STATUS; ++SELECT COUNT(*) FROM t1; ++COUNT(*) ++1 ++SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Qcache_queries_in_cache'; ++VARIABLE_VALUE = 1 ++1 ++SELECT COUNT(*) FROM t1; ++COUNT(*) ++1 ++SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'Qcache_hits'; ++VARIABLE_VALUE = 1 ++1 ++INSERT INTO t1 VALUES (2); ++FLUSH STATUS; ++SELECT VARIABLE_VALUE = 0 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Qcache_queries_in_cache'; ++VARIABLE_VALUE = 0 ++1 ++SELECT COUNT(*) FROM t1; ++COUNT(*) ++2 ++SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Qcache_queries_in_cache'; ++VARIABLE_VALUE = 1 ++1 ++SELECT VARIABLE_VALUE = 0 FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'Qcache_hits'; ++VARIABLE_VALUE = 0 ++1 ++SELECT COUNT(*) FROM t1; ++COUNT(*) ++2 ++SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'Qcache_hits'; ++VARIABLE_VALUE = 1 ++1 ++ALTER TABLE t1 ADD COLUMN f2 INTEGER; ++FLUSH STATUS; ++SELECT VARIABLE_VALUE = 0 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Qcache_queries_in_cache'; ++VARIABLE_VALUE = 0 ++1 ++SELECT COUNT(*) FROM t1; ++COUNT(*) ++2 ++SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Qcache_queries_in_cache'; ++VARIABLE_VALUE = 1 ++1 ++SELECT VARIABLE_VALUE = 0 FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'Qcache_hits'; ++VARIABLE_VALUE = 0 ++1 ++SELECT COUNT(*) FROM t1; ++COUNT(*) ++2 ++SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'Qcache_hits'; ++VARIABLE_VALUE = 1 ++1 ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/r/galera_read_only.result b/mysql-test/suite/galera/r/galera_read_only.result +new file mode 100644 +index 0000000..d2af386 +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_read_only.result +@@ -0,0 +1,8 @@ ++CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB; ++SET GLOBAL read_only=TRUE; ++INSERT INTO t1 VALUES (1); ++SELECT COUNT(*) = 1 FROM t1; ++COUNT(*) = 1 ++1 ++SET GLOBAL read_only=FALSE; ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/r/galera_repl_key_format_flat16.result b/mysql-test/suite/galera/r/galera_repl_key_format_flat16.result +new file mode 100644 +index 0000000..4acf014 +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_repl_key_format_flat16.result +@@ -0,0 +1,18 @@ ++SET GLOBAL wsrep_provider_options = 'repl.key_format=FLAT16'; ++CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; ++INSERT INTO t1 VALUES (123); ++CREATE TABLE t2 (f1 VARCHAR(256)) ENGINE=InnoDB; ++INSERT INTO t2 VALUES (REPEAT('a', 256)); ++SELECT COUNT(*) = 1 FROM t1; ++COUNT(*) = 1 ++1 ++UPDATE t1 SET f1 = 234; ++UPDATE t2 SET f1 = REPEAT('b', 256); ++SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 234; ++COUNT(*) = 1 ++1 ++SELECT COUNT(*) = 1 FROM t2 WHERE f1 = REPEAT('b', 256); ++COUNT(*) = 1 ++1 ++DROP TABLE t1; ++DROP TABLE t2; +diff --git a/mysql-test/suite/galera/r/galera_repl_max_ws_size.result b/mysql-test/suite/galera/r/galera_repl_max_ws_size.result +new file mode 100644 +index 0000000..6e1054c +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_repl_max_ws_size.result +@@ -0,0 +1,10 @@ ++CREATE TABLE t1 (f1 VARCHAR(512)) ENGINE=InnoDB; ++SET GLOBAL wsrep_provider_options = 'repl.max_ws_size=512'; ++INSERT INTO t1 VALUES (REPEAT('a', 512)); ++ERROR HY000: Got error 5 during COMMIT ++SELECT COUNT(*) = 0 FROM t1; ++COUNT(*) = 0 ++1 ++DROP TABLE t1; ++CALL mtr.add_suppression("WSREP: Maximum writeset size exceeded by"); ++CALL mtr.add_suppression("WSREP: transaction size exceeded"); +diff --git a/mysql-test/suite/galera/r/galera_restart_nochanges.result b/mysql-test/suite/galera/r/galera_restart_nochanges.result +new file mode 100644 +index 0000000..accace9 +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_restart_nochanges.result +@@ -0,0 +1,9 @@ ++CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; ++INSERT INTO t1 VALUES (1); ++SELECT COUNT(*) = 1 FROM t1; ++COUNT(*) = 1 ++1 ++SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; ++VARIABLE_VALUE = 2 ++1 ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/r/galera_rsu_add_pk.result b/mysql-test/suite/galera/r/galera_rsu_add_pk.result +new file mode 100644 +index 0000000..3d8677d +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_rsu_add_pk.result +@@ -0,0 +1,26 @@ ++CREATE TABLE ten (f1 INTEGER); ++INSERT INTO ten VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); ++CREATE TABLE t1 (f1 INTEGER) Engine=InnoDB; ++INSERT INTO t1 (f1) SELECT 000000 + (10000 * a1.f1) + (1000 * a2.f1) + (100 * a3.f1) + (10 * a4.f1) + a5.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5; ++INSERT INTO t1 (f1) SELECT 100000 + (10000 * a1.f1) + (1000 * a2.f1) + (100 * a3.f1) + (10 * a4.f1) + a5.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5;; ++SET GLOBAL wsrep_OSU_method = "RSU"; ++ALTER TABLE t1 ADD PRIMARY KEY (f1); ++SET GLOBAL wsrep_OSU_method = "TOI"; ++INSERT INTO t1 (f1) SELECT 200000 + (10000 * a1.f1) + (1000 * a2.f1) + (100 * a3.f1) + (10 * a4.f1) + a5.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5; ++SELECT COUNT(*) = 300000 FROM t1; ++COUNT(*) = 300000 ++1 ++SELECT MAX(f1) = 299999 FROM t1; ++MAX(f1) = 299999 ++1 ++SELECT COUNT(*) = 300000 FROM t1; ++COUNT(*) = 300000 ++1 ++SELECT MAX(f1) = 299999 FROM t1; ++MAX(f1) = 299999 ++1 ++SET GLOBAL wsrep_OSU_method = "RSU"; ++ALTER TABLE t1 ADD PRIMARY KEY (f1); ++SET GLOBAL wsrep_OSU_method = "TOI"; ++DROP TABLE t1; ++DROP TABLE ten; +diff --git a/mysql-test/suite/galera/r/galera_rsu_drop_pk.result b/mysql-test/suite/galera/r/galera_rsu_drop_pk.result +new file mode 100644 +index 0000000..43b4b57 +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_rsu_drop_pk.result +@@ -0,0 +1,42 @@ ++CREATE TABLE ten (f1 INTEGER); ++INSERT INTO ten VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); ++CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) Engine=InnoDB; ++INSERT INTO t1 (f1) SELECT 000000 + (10000 * a1.f1) + (1000 * a2.f1) + (100 * a3.f1) + (10 * a4.f1) + a5.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5; ++INSERT INTO t1 (f1) SELECT 100000 + (10000 * a1.f1) + (1000 * a2.f1) + (100 * a3.f1) + (10 * a4.f1) + a5.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5;; ++SET GLOBAL wsrep_OSU_method = "RSU"; ++ALTER TABLE t1 DROP PRIMARY KEY; ++SET GLOBAL wsrep_OSU_method = "TOI"; ++INSERT INTO t1 (f1) SELECT 200000 + (10000 * a1.f1) + (1000 * a2.f1) + (100 * a3.f1) + (10 * a4.f1) + a5.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5; ++SELECT COUNT(*) = 300000 FROM t1; ++COUNT(*) = 300000 ++1 ++SELECT MAX(f1) = 299999 FROM t1; ++MAX(f1) = 299999 ++1 ++SELECT COUNT(*) = 300000 FROM t1; ++COUNT(*) = 300000 ++1 ++SELECT MAX(f1) = 299999 FROM t1; ++MAX(f1) = 299999 ++1 ++SET GLOBAL wsrep_OSU_method = "RSU"; ++ALTER TABLE t1 DROP PRIMARY KEY; ++SET GLOBAL wsrep_OSU_method = "TOI"; ++INSERT INTO t1 (f1) VALUES (1); ++INSERT INTO t1 (f1) VALUES (10); ++SELECT COUNT(*) = 2 FROM t1 WHERE f1 = 1; ++COUNT(*) = 2 ++1 ++SELECT COUNT(*) = 2 FROM t1 WHERE f1 = 10; ++COUNT(*) = 2 ++1 ++INSERT INTO t1 (f1) VALUES (100); ++INSERT INTO t1 (f1) VALUES (1000); ++SELECT COUNT(*) = 2 FROM t1 WHERE f1 = 100; ++COUNT(*) = 2 ++1 ++SELECT COUNT(*) = 2 FROM t1 WHERE f1 = 1000; ++COUNT(*) = 2 ++1 ++DROP TABLE t1; ++DROP TABLE ten; +diff --git a/mysql-test/suite/galera/r/galera_rsu_error.result b/mysql-test/suite/galera/r/galera_rsu_error.result +new file mode 100644 +index 0000000..1f9ea36 +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_rsu_error.result +@@ -0,0 +1,21 @@ ++CREATE TABLE t1 (f1 INTEGER) Engine=InnoDB; ++INSERT INTO t1 VALUES (1), (1); ++SET GLOBAL wsrep_OSU_method = "RSU"; ++ALTER TABLE t1 ADD PRIMARY KEY (f1); ++ERROR 23000: Duplicate entry '1' for key 'PRIMARY' ++SET GLOBAL wsrep_OSU_method = "TOI"; ++SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE WHERE TABLE_NAME = 't1'; ++COUNT(*) = 0 ++1 ++INSERT INTO t1 VALUES (1); ++SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE WHERE TABLE_NAME = 't1'; ++COUNT(*) = 0 ++1 ++SELECT COUNT(*) = 3 FROM t1; ++COUNT(*) = 3 ++1 ++INSERT INTO t1 VALUES (1); ++SELECT COUNT(3) = 4 FROM t1; ++COUNT(3) = 4 ++1 ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/r/galera_rsu_simple.result b/mysql-test/suite/galera/r/galera_rsu_simple.result +new file mode 100644 +index 0000000..169c4a5 +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_rsu_simple.result +@@ -0,0 +1,22 @@ ++CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) Engine=InnoDB; ++SET GLOBAL wsrep_OSU_method = "RSU"; ++ALTER TABLE t1 ADD COLUMN f2 INTEGER; ++SET GLOBAL wsrep_OSU_method = "TOI"; ++SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; ++COUNT(*) = 2 ++1 ++SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; ++COUNT(*) = 1 ++1 ++INSERT INTO t1 VALUES (1); ++SELECT COUNT(*) = 1 FROM t1; ++COUNT(*) = 1 ++1 ++INSERT INTO t1 (f1) VALUES (2); ++SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; ++COUNT(*) = 1 ++1 ++SELECT COUNT(*) = 2 FROM t1; ++COUNT(*) = 2 ++1 ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/r/galera_sbr.result b/mysql-test/suite/galera/r/galera_sbr.result +new file mode 100644 +index 0000000..66ca8cf +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_sbr.result +@@ -0,0 +1,11 @@ ++SET GLOBAL binlog_format = 'STATEMENT'; ++SET SESSION binlog_format = 'STATEMENT'; ++CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; ++INSERT INTO t1 VALUES (1); ++SET SESSION binlog_format = 'MIXED'; ++INSERT INTO t1 VALUES (2); ++SELECT COUNT(*) = 2 FROM t1; ++COUNT(*) = 2 ++1 ++DROP TABLE t1; ++SET GLOBAL binlog_format = 'ROW'; +diff --git a/mysql-test/suite/galera/r/galera_sbr_binlog.result b/mysql-test/suite/galera/r/galera_sbr_binlog.result +new file mode 100644 +index 0000000..66ca8cf +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_sbr_binlog.result +@@ -0,0 +1,11 @@ ++SET GLOBAL binlog_format = 'STATEMENT'; ++SET SESSION binlog_format = 'STATEMENT'; ++CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; ++INSERT INTO t1 VALUES (1); ++SET SESSION binlog_format = 'MIXED'; ++INSERT INTO t1 VALUES (2); ++SELECT COUNT(*) = 2 FROM t1; ++COUNT(*) = 2 ++1 ++DROP TABLE t1; ++SET GLOBAL binlog_format = 'ROW'; +diff --git a/mysql-test/suite/galera/r/galera_split_brain.result b/mysql-test/suite/galera/r/galera_split_brain.result +new file mode 100644 +index 0000000..6156150 +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_split_brain.result +@@ -0,0 +1,5 @@ ++call mtr.add_suppression("WSREP: TO isolation failed for: "); ++Killing server ... ++CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; ++ERROR 40001: Deadlock found when trying to get lock; try restarting transaction ++SET GLOBAL wsrep_cluster_address = ''; +diff --git a/mysql-test/suite/galera/r/galera_sql_log_bin_zero.result b/mysql-test/suite/galera/r/galera_sql_log_bin_zero.result +new file mode 100644 +index 0000000..89ab8d5 +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_sql_log_bin_zero.result +@@ -0,0 +1,12 @@ ++CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; ++SET SESSION sql_log_bin = 0; ++INSERT INTO t1 VALUES (1); ++SET SESSION sql_log_bin = 1; ++INSERT INTO t1 VALUES (2); ++SELECT COUNT(*) = 1 FROM t1; ++COUNT(*) = 1 ++1 ++SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 1; ++COUNT(*) = 0 ++1 ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/r/galera_ssl.result b/mysql-test/suite/galera/r/galera_ssl.result +new file mode 100644 +index 0000000..569c3c6 +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_ssl.result +@@ -0,0 +1,18 @@ ++SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; ++VARIABLE_VALUE = 'Synced' ++1 ++SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; ++VARIABLE_VALUE = 2 ++1 ++CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) Engine=InnoDB; ++INSERT INTO t1 VALUES (1); ++SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; ++VARIABLE_VALUE = 'Synced' ++1 ++SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; ++VARIABLE_VALUE = 2 ++1 ++SELECT COUNT(*) = 1 FROM t1; ++COUNT(*) = 1 ++1 ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/r/galera_sst_mysqldump.result b/mysql-test/suite/galera/r/galera_sst_mysqldump.result +new file mode 100644 +index 0000000..1be2002 +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_sst_mysqldump.result +@@ -0,0 +1,459 @@ ++Setting SST method to mysqldump ... ++GRANT ALL PRIVILEGES ON *.* TO 'sst' IDENTIFIED BY 'sst'; ++SET GLOBAL wsrep_sst_auth = 'sst:sst'; ++SET GLOBAL wsrep_sst_method = 'mysqldump'; ++Performing State Transfer on a server that has been temporarily disconnected ++CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++COMMIT; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++COMMIT; ++Unloading wsrep provider ... ++SET GLOBAL wsrep_provider = 'none'; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++COMMIT; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++Loading wsrep provider ... ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++COMMIT; ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++COMMIT; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++COMMIT; ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++ROLLBACK; ++SELECT COUNT(*) = 35 FROM t1; ++COUNT(*) = 35 ++1 ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++COUNT(*) = 0 ++1 ++COMMIT; ++SET AUTOCOMMIT=ON; ++SELECT COUNT(*) = 35 FROM t1; ++COUNT(*) = 35 ++1 ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++COUNT(*) = 0 ++1 ++DROP TABLE t1; ++COMMIT; ++SET AUTOCOMMIT=ON; ++Performing State Transfer on a server that has been shut down cleanly and restarted ++CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++COMMIT; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++COMMIT; ++Shutting down server ... ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++COMMIT; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++Starting server ... ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++COMMIT; ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++COMMIT; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++COMMIT; ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++ROLLBACK; ++SELECT COUNT(*) = 35 FROM t1; ++COUNT(*) = 35 ++1 ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++COUNT(*) = 0 ++1 ++COMMIT; ++SET AUTOCOMMIT=ON; ++SELECT COUNT(*) = 35 FROM t1; ++COUNT(*) = 35 ++1 ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++COUNT(*) = 0 ++1 ++DROP TABLE t1; ++COMMIT; ++SET AUTOCOMMIT=ON; ++Performing State Transfer on a server that starts from a clean var directory ++This is accomplished by shutting down node #2 and removing its var directory before restarting it ++CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++COMMIT; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++COMMIT; ++Shutting down server ... ++Cleaning var directory ... ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++COMMIT; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++Starting server ... ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++COMMIT; ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++COMMIT; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++COMMIT; ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++ROLLBACK; ++SELECT COUNT(*) = 35 FROM t1; ++COUNT(*) = 35 ++1 ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++COUNT(*) = 0 ++1 ++COMMIT; ++SET AUTOCOMMIT=ON; ++SELECT COUNT(*) = 35 FROM t1; ++COUNT(*) = 35 ++1 ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++COUNT(*) = 0 ++1 ++DROP TABLE t1; ++COMMIT; ++SET AUTOCOMMIT=ON; ++Performing State Transfer on a server that has been killed and restarted ++CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++COMMIT; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++COMMIT; ++Killing server ... ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++COMMIT; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++Performing --wsrep-recover ... ++Starting server ... ++Using --wsrep-start-position when starting mysqld ... ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++COMMIT; ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++COMMIT; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++COMMIT; ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++ROLLBACK; ++SELECT COUNT(*) = 35 FROM t1; ++COUNT(*) = 35 ++1 ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++COUNT(*) = 0 ++1 ++COMMIT; ++SET AUTOCOMMIT=ON; ++SELECT COUNT(*) = 35 FROM t1; ++COUNT(*) = 35 ++1 ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++COUNT(*) = 0 ++1 ++DROP TABLE t1; ++COMMIT; ++SET AUTOCOMMIT=ON; ++Performing State Transfer on a server that has been killed and restarted ++while a DDL was in progress on it ++CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++COMMIT; ++SET GLOBAL debug = 'd,sync.alter_opened_table'; ++ALTER TABLE t1 ADD COLUMN f2 INTEGER; ++SET wsrep_sync_wait = 0; ++Killing server ... ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); ++COMMIT; ++START TRANSACTION; ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++Performing --wsrep-recover ... ++Starting server ... ++Using --wsrep-start-position when starting mysqld ... ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); ++COMMIT; ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++COMMIT; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); ++COMMIT; ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++ROLLBACK; ++SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; ++COUNT(*) = 2 ++1 ++SELECT COUNT(*) = 35 FROM t1; ++COUNT(*) = 35 ++1 ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++COUNT(*) = 0 ++1 ++COMMIT; ++SET AUTOCOMMIT=ON; ++SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; ++COUNT(*) = 2 ++1 ++SELECT COUNT(*) = 35 FROM t1; ++COUNT(*) = 35 ++1 ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++COUNT(*) = 0 ++1 ++DROP TABLE t1; ++COMMIT; ++SET AUTOCOMMIT=ON; ++CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query"); ++DROP USER sst; ++CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query"); ++CALL mtr.add_suppression("InnoDB: Error: Table \"mysql\"\\.\"innodb_index_stats\" not found"); ++CALL mtr.add_suppression("InnoDB: New log files created"); ++CALL mtr.add_suppression("InnoDB: Creating foreign key constraint system tables"); ++CALL mtr.add_suppression("Can't open and lock time zone table"); ++CALL mtr.add_suppression("Can't open and lock privilege tables"); ++CALL mtr.add_suppression("Info table is not ready to be used"); ++CALL mtr.add_suppression("Native table .* has the wrong structure"); +diff --git a/mysql-test/suite/galera/r/galera_sst_rsync.result b/mysql-test/suite/galera/r/galera_sst_rsync.result +new file mode 100644 +index 0000000..750d73b +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_sst_rsync.result +@@ -0,0 +1,358 @@ ++Performing State Transfer on a server that has been shut down cleanly and restarted ++CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++COMMIT; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++COMMIT; ++Shutting down server ... ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++COMMIT; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++Starting server ... ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++COMMIT; ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++COMMIT; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++COMMIT; ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++ROLLBACK; ++SELECT COUNT(*) = 35 FROM t1; ++COUNT(*) = 35 ++1 ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++COUNT(*) = 0 ++1 ++COMMIT; ++SET AUTOCOMMIT=ON; ++SELECT COUNT(*) = 35 FROM t1; ++COUNT(*) = 35 ++1 ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++COUNT(*) = 0 ++1 ++DROP TABLE t1; ++COMMIT; ++SET AUTOCOMMIT=ON; ++Performing State Transfer on a server that starts from a clean var directory ++This is accomplished by shutting down node #2 and removing its var directory before restarting it ++CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++COMMIT; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++COMMIT; ++Shutting down server ... ++Cleaning var directory ... ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++COMMIT; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++Starting server ... ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++COMMIT; ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++COMMIT; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++COMMIT; ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++ROLLBACK; ++SELECT COUNT(*) = 35 FROM t1; ++COUNT(*) = 35 ++1 ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++COUNT(*) = 0 ++1 ++COMMIT; ++SET AUTOCOMMIT=ON; ++SELECT COUNT(*) = 35 FROM t1; ++COUNT(*) = 35 ++1 ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++COUNT(*) = 0 ++1 ++DROP TABLE t1; ++COMMIT; ++SET AUTOCOMMIT=ON; ++Performing State Transfer on a server that has been killed and restarted ++CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++COMMIT; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++COMMIT; ++Killing server ... ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++COMMIT; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++Performing --wsrep-recover ... ++Starting server ... ++Using --wsrep-start-position when starting mysqld ... ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++COMMIT; ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++COMMIT; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++COMMIT; ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++ROLLBACK; ++SELECT COUNT(*) = 35 FROM t1; ++COUNT(*) = 35 ++1 ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++COUNT(*) = 0 ++1 ++COMMIT; ++SET AUTOCOMMIT=ON; ++SELECT COUNT(*) = 35 FROM t1; ++COUNT(*) = 35 ++1 ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++COUNT(*) = 0 ++1 ++DROP TABLE t1; ++COMMIT; ++SET AUTOCOMMIT=ON; ++Performing State Transfer on a server that has been killed and restarted ++while a DDL was in progress on it ++CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++COMMIT; ++SET GLOBAL debug = 'd,sync.alter_opened_table'; ++ALTER TABLE t1 ADD COLUMN f2 INTEGER; ++SET wsrep_sync_wait = 0; ++Killing server ... ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); ++COMMIT; ++START TRANSACTION; ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++Performing --wsrep-recover ... ++Starting server ... ++Using --wsrep-start-position when starting mysqld ... ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); ++COMMIT; ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++COMMIT; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); ++COMMIT; ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++ROLLBACK; ++SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; ++COUNT(*) = 2 ++1 ++SELECT COUNT(*) = 35 FROM t1; ++COUNT(*) = 35 ++1 ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++COUNT(*) = 0 ++1 ++COMMIT; ++SET AUTOCOMMIT=ON; ++SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; ++COUNT(*) = 2 ++1 ++SELECT COUNT(*) = 35 FROM t1; ++COUNT(*) = 35 ++1 ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++COUNT(*) = 0 ++1 ++DROP TABLE t1; ++COMMIT; ++SET AUTOCOMMIT=ON; +diff --git a/mysql-test/suite/galera/r/galera_sst_xtrabackup-v2.result b/mysql-test/suite/galera/r/galera_sst_xtrabackup-v2.result +new file mode 100644 +index 0000000..750d73b +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_sst_xtrabackup-v2.result +@@ -0,0 +1,358 @@ ++Performing State Transfer on a server that has been shut down cleanly and restarted ++CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++COMMIT; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++COMMIT; ++Shutting down server ... ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++COMMIT; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++Starting server ... ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++COMMIT; ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++COMMIT; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++COMMIT; ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++ROLLBACK; ++SELECT COUNT(*) = 35 FROM t1; ++COUNT(*) = 35 ++1 ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++COUNT(*) = 0 ++1 ++COMMIT; ++SET AUTOCOMMIT=ON; ++SELECT COUNT(*) = 35 FROM t1; ++COUNT(*) = 35 ++1 ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++COUNT(*) = 0 ++1 ++DROP TABLE t1; ++COMMIT; ++SET AUTOCOMMIT=ON; ++Performing State Transfer on a server that starts from a clean var directory ++This is accomplished by shutting down node #2 and removing its var directory before restarting it ++CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++COMMIT; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++COMMIT; ++Shutting down server ... ++Cleaning var directory ... ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++COMMIT; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++Starting server ... ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++COMMIT; ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++COMMIT; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++COMMIT; ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++ROLLBACK; ++SELECT COUNT(*) = 35 FROM t1; ++COUNT(*) = 35 ++1 ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++COUNT(*) = 0 ++1 ++COMMIT; ++SET AUTOCOMMIT=ON; ++SELECT COUNT(*) = 35 FROM t1; ++COUNT(*) = 35 ++1 ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++COUNT(*) = 0 ++1 ++DROP TABLE t1; ++COMMIT; ++SET AUTOCOMMIT=ON; ++Performing State Transfer on a server that has been killed and restarted ++CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++COMMIT; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++COMMIT; ++Killing server ... ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++INSERT INTO t1 VALUES ('node1_committed_during'); ++COMMIT; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++Performing --wsrep-recover ... ++Starting server ... ++Using --wsrep-start-position when starting mysqld ... ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++INSERT INTO t1 VALUES ('node2_committed_after'); ++COMMIT; ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 VALUES ('node1_to_be_committed_after'); ++COMMIT; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++INSERT INTO t1 VALUES ('node1_committed_after'); ++COMMIT; ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ++ROLLBACK; ++SELECT COUNT(*) = 35 FROM t1; ++COUNT(*) = 35 ++1 ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++COUNT(*) = 0 ++1 ++COMMIT; ++SET AUTOCOMMIT=ON; ++SELECT COUNT(*) = 35 FROM t1; ++COUNT(*) = 35 ++1 ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++COUNT(*) = 0 ++1 ++DROP TABLE t1; ++COMMIT; ++SET AUTOCOMMIT=ON; ++Performing State Transfer on a server that has been killed and restarted ++while a DDL was in progress on it ++CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++START TRANSACTION; ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++COMMIT; ++SET GLOBAL debug = 'd,sync.alter_opened_table'; ++ALTER TABLE t1 ADD COLUMN f2 INTEGER; ++SET wsrep_sync_wait = 0; ++Killing server ... ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); ++COMMIT; ++START TRANSACTION; ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++Performing --wsrep-recover ... ++Starting server ... ++Using --wsrep-start-position when starting mysqld ... ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); ++COMMIT; ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++COMMIT; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); ++COMMIT; ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++ROLLBACK; ++SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; ++COUNT(*) = 2 ++1 ++SELECT COUNT(*) = 35 FROM t1; ++COUNT(*) = 35 ++1 ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++COUNT(*) = 0 ++1 ++COMMIT; ++SET AUTOCOMMIT=ON; ++SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; ++COUNT(*) = 2 ++1 ++SELECT COUNT(*) = 35 FROM t1; ++COUNT(*) = 35 ++1 ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++COUNT(*) = 0 ++1 ++DROP TABLE t1; ++COMMIT; ++SET AUTOCOMMIT=ON; +diff --git a/mysql-test/suite/galera/r/galera_status_cluster.result b/mysql-test/suite/galera/r/galera_status_cluster.result +new file mode 100644 +index 0000000..d7cf671 +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_status_cluster.result +@@ -0,0 +1,12 @@ ++SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; ++VARIABLE_VALUE = 2 ++1 ++SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; ++VARIABLE_VALUE = 'Primary' ++1 ++SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; ++VARIABLE_VALUE = 2 ++1 ++SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; ++VARIABLE_VALUE = 'Primary' ++1 +diff --git a/mysql-test/suite/galera/r/galera_status_local_state.result b/mysql-test/suite/galera/r/galera_status_local_state.result +new file mode 100644 +index 0000000..65713f1 +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_status_local_state.result +@@ -0,0 +1,14 @@ ++SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state'; ++VARIABLE_VALUE = 4 ++1 ++SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; ++VARIABLE_VALUE = 'Synced' ++1 ++SET GLOBAL wsrep_desync = 1; ++SELECT VARIABLE_VALUE = 'Donor/Desynced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; ++VARIABLE_VALUE = 'Donor/Desynced' ++1 ++SET GLOBAL wsrep_desync = 0; ++SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; ++VARIABLE_VALUE = 'Synced' ++1 +diff --git a/mysql-test/suite/galera/r/galera_suspend_slave.result b/mysql-test/suite/galera/r/galera_suspend_slave.result +new file mode 100644 +index 0000000..0290481 +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_suspend_slave.result +@@ -0,0 +1,10 @@ ++CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; ++Suspending node_2 ... ++INSERT INTO t1 VALUES (1); ++Got one of the listed errors ++Resuming node_2 ... ++INSERT INTO t1 VALUES (1); ++SELECT COUNT(*) = 1 FROM t1; ++COUNT(*) = 1 ++1 ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/r/galera_toi_alter_auto_increment.result b/mysql-test/suite/galera/r/galera_toi_alter_auto_increment.result +new file mode 100644 +index 0000000..f914153 +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_toi_alter_auto_increment.result +@@ -0,0 +1,42 @@ ++CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB; ++INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); ++CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 INTEGER) ENGINE=InnoDB; ++INSERT INTO t1 (f2) SELECT 1 FROM ten; ++INSERT INTO t1 (f2) SELECT 1 FROM ten; ++ALTER TABLE t1 AUTO_INCREMENT = 1000; ++INSERT INTO t1 (f2) SELECT 1 FROM ten; ++INSERT INTO t1 (f2) SELECT 1 FROM ten; ++SELECT MIN(f1) >= 1000, COUNT(*) = 20, COUNT(DISTINCT f1) = 20 FROM t1 WHERE f1 >= 1000; ++MIN(f1) >= 1000 COUNT(*) = 20 COUNT(DISTINCT f1) = 20 ++1 1 1 ++SELECT MIN(f1) >= 1000, COUNT(*) = 20, COUNT(DISTINCT f1) = 20 FROM t1 WHERE f1 >= 1000; ++MIN(f1) >= 1000 COUNT(*) = 20 COUNT(DISTINCT f1) = 20 ++1 1 1 ++ALTER TABLE t1 AUTO_INCREMENT = 5; ++INSERT INTO t1 (f2) SELECT 1 FROM ten; ++INSERT INTO t1 (f2) SELECT 1 FROM ten; ++SELECT MIN(f1) >= 1000, COUNT(*) = 40, COUNT(DISTINCT f1) = 40 FROM t1 WHERE f1 >= 1000; ++MIN(f1) >= 1000 COUNT(*) = 40 COUNT(DISTINCT f1) = 40 ++1 1 1 ++SELECT MIN(f1) >= 1000, COUNT(*) = 40, COUNT(DISTINCT f1) = 40 FROM t1 WHERE f1 >= 1000; ++MIN(f1) >= 1000 COUNT(*) = 40 COUNT(DISTINCT f1) = 40 ++1 1 1 ++DROP TABLE t1; ++SET GLOBAL wsrep_auto_increment_control = OFF; ++SET GLOBAL auto_increment_increment = 1; ++SET GLOBAL auto_increment_offset = 1; ++SET GLOBAL wsrep_auto_increment_control = OFF; ++SET GLOBAL auto_increment_increment = 1; ++SET GLOBAL auto_increment_offset = 1; ++CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 INTEGER) ENGINE=InnoDB; ++ALTER TABLE t1 AUTO_INCREMENT=100; ++INSERT INTO t1 (f2) SELECT 1 FROM ten; ++INSERT INTO t1 (f2) SELECT 1 FROM ten; ++SELECT MIN(f1) = 100, MAX(f1) = 119, COUNT(f1) = 20, COUNT(DISTINCT f1) = 20 FROM t1; ++MIN(f1) = 100 MAX(f1) = 119 COUNT(f1) = 20 COUNT(DISTINCT f1) = 20 ++1 1 1 1 ++SELECT MIN(f1) = 100, MAX(f1) = 119, COUNT(f1) = 20, COUNT(DISTINCT f1) = 20 FROM t1; ++MIN(f1) = 100 MAX(f1) = 119 COUNT(f1) = 20 COUNT(DISTINCT f1) = 20 ++1 1 1 1 ++DROP TABLE t1; ++DROP TABLE ten; +diff --git a/mysql-test/suite/galera/r/galera_toi_ddl_error.result b/mysql-test/suite/galera/r/galera_toi_ddl_error.result +new file mode 100644 +index 0000000..656e20b +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_toi_ddl_error.result +@@ -0,0 +1,19 @@ ++CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB; ++INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); ++CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; ++INSERT INTO t1 (f1) SELECT (10000 * a1.f1) + (1000 * a2.f1) + (100 * a3.f1) + (10 * a4.f1) + a5.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5; ++INSERT INTO t1 (f1) SELECT MAX(f1) FROM t1; ++ALTER TABLE t1 ADD PRIMARY KEY (f1); ++ERROR 23000: Duplicate entry '111110' for key 'PRIMARY' ++SHOW CREATE TABLE t1; ++Table Create Table ++t1 CREATE TABLE `t1` ( ++ `f1` int(11) DEFAULT NULL ++) ENGINE=InnoDB DEFAULT CHARSET=latin1 ++SHOW CREATE TABLE t1; ++Table Create Table ++t1 CREATE TABLE `t1` ( ++ `f1` int(11) DEFAULT NULL ++) ENGINE=InnoDB DEFAULT CHARSET=latin1 ++DROP TABLE t1; ++DROP TABLE ten; +diff --git a/mysql-test/suite/galera/r/galera_toi_ddl_fk_insert.result b/mysql-test/suite/galera/r/galera_toi_ddl_fk_insert.result +new file mode 100644 +index 0000000..81781fb +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_toi_ddl_fk_insert.result +@@ -0,0 +1,31 @@ ++CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB; ++INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); ++CREATE TABLE parent ( ++id INT PRIMARY KEY AUTO_INCREMENT, ++f2 INTEGER, ++KEY (id) ++) ENGINE=InnoDB; ++CREATE TABLE child ( ++id INT PRIMARY KEY AUTO_INCREMENT, ++parent_id INT ++) ENGINE=InnoDB; ++INSERT INTO parent VALUES (DEFAULT, 0); ++INSERT INTO child (parent_id) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;; ++INSERT INTO parent (f2) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;; ++INSERT INTO parent (f2) SELECT 2 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;; ++ALTER TABLE child ADD FOREIGN KEY (parent_id) REFERENCES parent(id);; ++SELECT COUNT(*) = 20001 FROM parent; ++COUNT(*) = 20001 ++1 ++SELECT COUNT(*) = 10000 FROM child; ++COUNT(*) = 10000 ++1 ++SELECT COUNT(*) = 20001 FROM parent; ++COUNT(*) = 20001 ++1 ++SELECT COUNT(*) = 10000 FROM child; ++COUNT(*) = 10000 ++1 ++DROP TABLE child; ++DROP TABLE parent; ++DROP TABLE ten; +diff --git a/mysql-test/suite/galera/r/galera_toi_ddl_locking.result b/mysql-test/suite/galera/r/galera_toi_ddl_locking.result +new file mode 100644 +index 0000000..d961f04 +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_toi_ddl_locking.result +@@ -0,0 +1,39 @@ ++CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; ++CREATE TABLE t2 (f1 INTEGER) ENGINE=InnoDB; ++SET DEBUG_SYNC = 'alter_table_before_open_tables WAIT_FOR continue'; ++ALTER TABLE t1 ADD COLUMN f2 INTEGER;; ++SET SESSION wsrep_sync_wait = 0; ++SELECT COUNT(*) = 0 FROM t1; ++COUNT(*) = 0 ++1 ++SELECT COUNT(*) = 0 FROM t2; ++COUNT(*) = 0 ++1 ++INSERT INTO t1 VALUES (1); ++ERROR 40001: Deadlock found when trying to get lock; try restarting transaction ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t2 VALUES (1); ++COMMIT;; ++SET SESSION wsrep_sync_wait = 0; ++SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO = 'Commit'; ++COUNT(*) = 1 ++1 ++SELECT COUNT(*) = 0 FROM t2; ++COUNT(*) = 0 ++1 ++SET DEBUG_SYNC= 'now SIGNAL continue'; ++SELECT COUNT(*) = 0 FROM t1; ++COUNT(*) = 0 ++1 ++SELECT COUNT(*) = 1 FROM t2; ++COUNT(*) = 1 ++1 ++SELECT COUNT(*) = 0 FROM t1; ++COUNT(*) = 0 ++1 ++SELECT COUNT(*) = 1 FROM t2; ++COUNT(*) = 1 ++1 ++DROP TABLE t1; ++DROP TABLE t2; +diff --git a/mysql-test/suite/galera/r/galera_toi_ddl_nonconflicting.result b/mysql-test/suite/galera/r/galera_toi_ddl_nonconflicting.result +new file mode 100644 +index 0000000..41e693c +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_toi_ddl_nonconflicting.result +@@ -0,0 +1,23 @@ ++CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 INTEGER); ++ALTER TABLE t1 ADD COLUMN f3 INTEGER; INSERT INTO t1 (f1, f2) VALUES (DEFAULT, 123);; ++CREATE UNIQUE INDEX i1 ON t1(f2);; ++INSERT INTO t1 (f1, f2) VALUES (DEFAULT, 234); ++SELECT COUNT(*) = 3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; ++COUNT(*) = 3 ++1 ++SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME = 't1'; ++COUNT(*) = 2 ++1 ++SELECT COUNT(*) = 2 FROM t1; ++COUNT(*) = 2 ++1 ++SELECT COUNT(*) = 3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; ++COUNT(*) = 3 ++1 ++SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME = 't1'; ++COUNT(*) = 2 ++1 ++SELECT COUNT(*) = 2 FROM t1; ++COUNT(*) = 2 ++1 ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/r/galera_toi_ddl_sequential.result b/mysql-test/suite/galera/r/galera_toi_ddl_sequential.result +new file mode 100644 +index 0000000..9dfa433 +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_toi_ddl_sequential.result +@@ -0,0 +1,35 @@ ++CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; ++INSERT INTO t1 VALUES (1); ++ALTER TABLE t1 ADD COLUMN f2 INTEGER; ++INSERT INTO t1 VALUES (2, 3); ++ALTER TABLE t1 DROP COLUMN f2; ++INSERT INTO t1 VALUES (4); ++SHOW CREATE TABLE t1; ++Table Create Table ++t1 CREATE TABLE `t1` ( ++ `f1` int(11) NOT NULL, ++ PRIMARY KEY (`f1`) ++) ENGINE=InnoDB DEFAULT CHARSET=latin1 ++SELECT COUNT(*) = 3 FROM t1; ++COUNT(*) = 3 ++1 ++SELECT * FROM t1 ORDER BY f1; ++f1 ++1 ++2 ++4 ++SHOW CREATE TABLE t1; ++Table Create Table ++t1 CREATE TABLE `t1` ( ++ `f1` int(11) NOT NULL, ++ PRIMARY KEY (`f1`) ++) ENGINE=InnoDB DEFAULT CHARSET=latin1 ++SELECT COUNT(*) = 3 FROM t1; ++COUNT(*) = 3 ++1 ++SELECT * FROM t1 ORDER BY f1; ++f1 ++1 ++2 ++4 ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/r/galera_toi_ftwrl.result b/mysql-test/suite/galera/r/galera_toi_ftwrl.result +new file mode 100644 +index 0000000..594717c +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_toi_ftwrl.result +@@ -0,0 +1,12 @@ ++CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB; ++FLUSH TABLES WITH READ LOCK; ++ALTER TABLE t1 ADD COLUMN f2 INTEGER; ++UNLOCK TABLES; ++SHOW CREATE TABLE t1; ++Table Create Table ++t1 CREATE TABLE `t1` ( ++ `id` int(11) NOT NULL, ++ `f2` int(11) DEFAULT NULL, ++ PRIMARY KEY (`id`) ++) ENGINE=InnoDB DEFAULT CHARSET=latin1 ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/r/galera_toi_lock_exclusive.result b/mysql-test/suite/galera/r/galera_toi_lock_exclusive.result +new file mode 100644 +index 0000000..eac50e8 +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_toi_lock_exclusive.result +@@ -0,0 +1,17 @@ ++CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB; ++INSERT INTO t1 VALUES (1); ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES (2); ++ALTER TABLE t1 ADD COLUMN f2 INTEGER, LOCK=EXCLUSIVE; ++COMMIT; ++ERROR 40001: Deadlock found when trying to get lock; try restarting transaction ++INSERT INTO t1 VALUES (2, 2); ++SELECT COUNT(*) = 2 FROM t1; ++COUNT(*) = 2 ++1 ++INSERT INTO t1 VALUES (3, 3); ++SELECT COUNT(*) = 3 FROM t1; ++COUNT(*) = 3 ++1 ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/r/galera_toi_lock_shared.result b/mysql-test/suite/galera/r/galera_toi_lock_shared.result +new file mode 100644 +index 0000000..36c3886 +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_toi_lock_shared.result +@@ -0,0 +1,12 @@ ++CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB; ++INSERT INTO t1 VALUES (1); ++ALTER TABLE t1 ADD COLUMN f2 INTEGER, LOCK=SHARED; ++INSERT INTO t1 VALUES (2, 2); ++SELECT COUNT(*) = 2 FROM t1; ++COUNT(*) = 2 ++1 ++INSERT INTO t1 VALUES (3, 3); ++SELECT COUNT(*) = 3 FROM t1; ++COUNT(*) = 3 ++1 ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/r/galera_transaction_read_only.result b/mysql-test/suite/galera/r/galera_transaction_read_only.result +new file mode 100644 +index 0000000..3cd1076 +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_transaction_read_only.result +@@ -0,0 +1,21 @@ ++CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++COMMIT; ++wsrep_last_committed_diff ++1 ++START TRANSACTION READ ONLY; ++SELECT COUNT(*) = 0 FROM t1; ++COUNT(*) = 0 ++1 ++COMMIT; ++wsrep_last_committed_diff ++1 ++START TRANSACTION; ++SELECT COUNT(*) = 0 FROM t1; ++COUNT(*) = 0 ++1 ++COMMIT; ++wsrep_last_committed_diff ++1 ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/r/galera_transaction_replay.result b/mysql-test/suite/galera/r/galera_transaction_replay.result +new file mode 100644 +index 0000000..23ed87f +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_transaction_replay.result +@@ -0,0 +1,30 @@ ++CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1)); ++INSERT INTO t1 VALUES (1, 'a'); ++INSERT INTO t1 VALUES (2, 'a'); ++SET AUTOCOMMIT=ON; ++START TRANSACTION; ++UPDATE t1 SET f2 = 'b' WHERE f1 = 1; ++SELECT * FROM t1 WHERE f1 = 2 FOR UPDATE; ++f1 f2 ++2 a ++SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_enter_sync'; ++COMMIT;; ++SET SESSION wsrep_sync_wait = 0; ++UPDATE t1 SET f2 = 'c' WHERE f1 = 2; ++SET GLOBAL wsrep_provider_options = 'dbug='; ++SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_enter_sync'; ++SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'b'; ++COUNT(*) = 1 ++1 ++SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'c'; ++COUNT(*) = 1 ++1 ++wsrep_local_replays ++1 ++SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'b'; ++COUNT(*) = 1 ++1 ++SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'c'; ++COUNT(*) = 1 ++1 ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/r/galera_truncate.result b/mysql-test/suite/galera/r/galera_truncate.result +new file mode 100644 +index 0000000..eeeb672 +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_truncate.result +@@ -0,0 +1,29 @@ ++CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) Engine=InnoDB; ++INSERT INTO t1 VALUES (1); ++TRUNCATE TABLE t1; ++SELECT COUNT(*) = 0 FROM t1; ++COUNT(*) = 0 ++1 ++SELECT COUNT(*) = 0 FROM t1; ++COUNT(*) = 0 ++1 ++CREATE TABLE t2 (f1 VARCHAR(255)) Engine=InnoDB; ++INSERT INTO t2 VALUES ('abc'); ++TRUNCATE TABLE t2; ++SELECT COUNT(*) = 0 FROM t2; ++COUNT(*) = 0 ++1 ++CREATE TABLE t3 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY) Engine=InnoDB; ++INSERT INTO t3 VALUES (DEFAULT),(DEFAULT),(DEFAULT),(DEFAULT),(DEFAULT); ++CREATE TABLE t4 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY) Engine=InnoDB AUTO_INCREMENT=1234; ++INSERT INTO t4 VALUES (DEFAULT),(DEFAULT),(DEFAULT),(DEFAULT),(DEFAULT); ++TRUNCATE TABLE t3; ++TRUNCATE TABLE t4; ++SELECT AUTO_INCREMENT = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME IN ('t3', 't4'); ++AUTO_INCREMENT = 1 ++1 ++1 ++DROP TABLE t1; ++DROP TABLE t2; ++DROP TABLE t3; ++DROP TABLE t4; +diff --git a/mysql-test/suite/galera/r/galera_truncate_temporary.result b/mysql-test/suite/galera/r/galera_truncate_temporary.result +new file mode 100644 +index 0000000..0bdc4e3 +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_truncate_temporary.result +@@ -0,0 +1,63 @@ ++CREATE TEMPORARY TABLE t1 (f1 INTEGER PRIMARY KEY) Engine=InnoDB; ++INSERT INTO t1 VALUES (1); ++TRUNCATE TABLE t1; ++SELECT COUNT(*) = 0 FROM t1; ++COUNT(*) = 0 ++1 ++SELECT * FROM t1; ++ERROR 42S02: Table 'test.t1' doesn't exist ++DROP TABLE t1; ++CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; ++INSERT INTO t1 VALUES (1); ++CREATE TEMPORARY TABLE t1 (f1 INTEGER) ENGINE=InnoDB; ++INSERT INTO t1 VALUES (2); ++SELECT f1 = 2 FROM t1; ++f1 = 2 ++1 ++SELECT COUNT(*) = 1 FROM t1; ++COUNT(*) = 1 ++1 ++TRUNCATE TABLE t1; ++SELECT COUNT(*) = 0 FROM t1; ++COUNT(*) = 0 ++1 ++SELECT COUNT(*) = 1 FROM t1; ++COUNT(*) = 1 ++1 ++SELECT f1 = 1 FROM t1; ++f1 = 1 ++1 ++DROP TABLE t1; ++SELECT COUNT(*) = 1 FROM t1; ++COUNT(*) = 1 ++1 ++SELECT f1 = 1 FROM t1; ++f1 = 1 ++1 ++TRUNCATE TABLE t1; ++SELECT COUNT(*) = 0 FROM t1; ++COUNT(*) = 0 ++1 ++SELECT COUNT(*) = 0 FROM t1; ++COUNT(*) = 0 ++1 ++DROP TABLE t1; ++CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; ++INSERT INTO t1 VALUES (1); ++CREATE TEMPORARY TABLE t1 (f1 INTEGER) ENGINE=InnoDB; ++INSERT INTO t1 VALUES (2); ++TRUNCATE TABLE t1; ++SELECT COUNT(*) = 0 FROM t1; ++COUNT(*) = 0 ++1 ++SELECT f1 = 2 FROM t1; ++f1 = 2 ++1 ++SELECT COUNT(*) = 1 FROM t1; ++COUNT(*) = 1 ++1 ++DROP TABLE t1; ++SELECT COUNT(*) = 0 FROM t1; ++COUNT(*) = 0 ++1 ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/r/galera_unicode_identifiers.result b/mysql-test/suite/galera/r/galera_unicode_identifiers.result +new file mode 100644 +index 0000000..212c6c6 +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_unicode_identifiers.result +@@ -0,0 +1,46 @@ ++SET GLOBAL wsrep_sync_wait = 7; ++SET GLOBAL wsrep_sync_wait = 7; ++CREATE DATABASE `database with space`; ++USE `database with space`; ++CREATE TABLE `table with space` ( ++`column with space` INTEGER AUTO_INCREMENT PRIMARY KEY, ++`second column with space` INTEGER, ++UNIQUE `index name with space` (`second column with space`) ++); ++INSERT INTO `table with space` VALUES (DEFAULT, 1); ++CREATE DATABASE `база`; ++USE `база`; ++CREATE TABLE `таблица` ( ++`първа_колона` INTEGER PRIMARY KEY, ++`втора_колона` INTEGER, ++UNIQUE `индекс` (`втора_колона`) ++); ++INSERT INTO `таблица` VALUES (1, 1); ++CREATE DATABASE `втора база`; ++USE `втора база`; ++CREATE TABLE `втора таблица` ( ++`първа колона` INTEGER, ++`втора колона` INTEGER, ++KEY `първи индекс` (`първа колона`) ++); ++INSERT INTO `втора таблица` VALUES (1, 1); ++USE `database with space`; ++SELECT `second column with space` FROM `table with space`; ++second column with space ++1 ++USE `база`; ++SELECT * FROM `таблица`; ++първа_колона втора_колона ++1 1 ++USE `втора база`; ++SELECT `втора колона` FROM `втора таблица`; ++втора колона ++1 ++SET GLOBAL wsrep_sync_wait = (SELECT @@wsrep_sync_wait); ++DROP TABLE `database with space`.`table with space`; ++DROP TABLE `база`.`таблица`; ++DROP TABLE `втора база`.`втора таблица`; ++DROP DATABASE `database with space`; ++DROP DATABASE `база`; ++DROP DATABASE `втора база`; ++SET GLOBAL wsrep_sync_wait = (SELECT @@wsrep_sync_wait); +diff --git a/mysql-test/suite/galera/r/galera_unicode_pk.result b/mysql-test/suite/galera/r/galera_unicode_pk.result +new file mode 100644 +index 0000000..d59615b +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_unicode_pk.result +@@ -0,0 +1,31 @@ ++CREATE TABLE t1 ( ++f1 VARCHAR(255) PRIMARY KEY ++) ENGINE=InnoDB DEFAULT CHARSET=utf8; ++INSERT INTO t1 VALUES ('текст'); ++SELECT f1 = 'текст' FROM t1; ++f1 = 'текст' ++1 ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++UPDATE t1 SET f1 = 'текст2'; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++UPDATE t1 SET f1 = 'текст3'; ++COMMIT; ++COMMIT; ++ERROR 40001: Deadlock found when trying to get lock; try restarting transaction ++SELECT f1 = 'текст2' FROM t1; ++f1 = 'текст2' ++1 ++SELECT f1 = 'текст2' FROM t1 WHERE f1 = 'текст2'; ++f1 = 'текст2' ++1 ++START TRANSACTION; ++INSERT INTO t1 VALUES ('текст4'); ++START TRANSACTION; ++INSERT INTO t1 VALUES ('текст4'); ++COMMIT; ++COMMIT; ++ERROR 40001: Deadlock found when trying to get lock; try restarting transaction ++COMMIT; ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/r/galera_update_limit.result b/mysql-test/suite/galera/r/galera_update_limit.result +new file mode 100644 +index 0000000..c26eb1c +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_update_limit.result +@@ -0,0 +1,17 @@ ++CREATE TABLE ten (f1 INTEGER) Engine=InnoDB; ++INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); ++CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) Engine=InnoDB; ++INSERT INTO t1 SELECT f1 FROM ten ORDER BY RAND(); ++UPDATE IGNORE t1 SET f1 = FLOOR(1 + (RAND() * 10)) ORDER BY RAND() LIMIT 5; ++sum_matches ++1 ++max_matches ++1 ++DROP TABLE t1; ++CREATE TABLE t2 (f1 INTEGER) Engine=InnoDB; ++INSERT INTO t2 SELECT f1 FROM ten ORDER BY RAND(); ++UPDATE IGNORE t2 SET f1 = FLOOR(1 + (RAND() * 10)) ORDER BY RAND() LIMIT 5; ++sum_matches ++1 ++DROP TABLE t2; ++DROP TABLE ten; +diff --git a/mysql-test/suite/galera/r/galera_v1_row_events.result b/mysql-test/suite/galera/r/galera_v1_row_events.result +new file mode 100644 +index 0000000..a6ab623 +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_v1_row_events.result +@@ -0,0 +1,10 @@ ++CREATE TABLE t1 (f1 INT PRIMARY KEY) ENGINE=InnoDB; ++INSERT INTO t1 VALUES (1); ++SELECT COUNT(*) = 1 FROM t1; ++COUNT(*) = 1 ++1 ++UPDATE t1 SET f1 = 2 WHERE f1 = 1; ++SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2; ++COUNT(*) = 1 ++1 ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/r/galera_var_auto_inc_control_off.result b/mysql-test/suite/galera/r/galera_var_auto_inc_control_off.result +new file mode 100644 +index 0000000..92b69fb +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_var_auto_inc_control_off.result +@@ -0,0 +1,61 @@ ++SET GLOBAL wsrep_auto_increment_control = OFF; ++SET GLOBAL auto_increment_increment = 1; ++SET GLOBAL auto_increment_offset = 1; ++SET GLOBAL wsrep_auto_increment_control = OFF; ++SET GLOBAL auto_increment_increment = 1; ++SET GLOBAL auto_increment_offset = 1; ++SELECT @@auto_increment_increment = 1; ++@@auto_increment_increment = 1 ++1 ++SELECT @@auto_increment_offset = 1; ++@@auto_increment_offset = 1 ++1 ++CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, node VARCHAR(10)) ENGINE=InnoDB; ++SHOW CREATE TABLE t1; ++Table Create Table ++t1 CREATE TABLE `t1` ( ++ `f1` int(11) NOT NULL AUTO_INCREMENT, ++ `node` varchar(10) DEFAULT NULL, ++ PRIMARY KEY (`f1`) ++) ENGINE=InnoDB DEFAULT CHARSET=latin1 ++SHOW CREATE TABLE t1; ++Table Create Table ++t1 CREATE TABLE `t1` ( ++ `f1` int(11) NOT NULL AUTO_INCREMENT, ++ `node` varchar(10) DEFAULT NULL, ++ PRIMARY KEY (`f1`) ++) ENGINE=InnoDB DEFAULT CHARSET=latin1 ++SELECT @@auto_increment_increment = 1; ++@@auto_increment_increment = 1 ++1 ++SELECT @@auto_increment_offset = 1; ++@@auto_increment_offset = 1 ++1 ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (node) VALUES ('node1'); ++SELECT f1 FROM t1; ++f1 ++1 ++SELECT @@auto_increment_increment = 1; ++@@auto_increment_increment = 1 ++1 ++SELECT @@auto_increment_offset = 1; ++@@auto_increment_offset = 1 ++1 ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (node) VALUES ('node2'); ++SELECT f1 FROM t1; ++f1 ++1 ++COMMIT; ++COMMIT; ++ERROR 40001: Deadlock found when trying to get lock; try restarting transaction ++SELECT * FROM t1; ++f1 node ++1 node1 ++SELECT * FROM t1; ++f1 node ++1 node1 ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/r/galera_var_auto_inc_control_on.result b/mysql-test/suite/galera/r/galera_var_auto_inc_control_on.result +new file mode 100644 +index 0000000..8859209 +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_var_auto_inc_control_on.result +@@ -0,0 +1,30 @@ ++CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, node VARCHAR(10)) ENGINE=InnoDB; ++SELECT @@auto_increment_increment = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'); ++@@auto_increment_increment = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size') ++1 ++SELECT @@auto_increment_offset = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_index') + 1; ++@@auto_increment_offset = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_index') + 1 ++1 ++INSERT INTO t1 VALUES (DEFAULT, 'node1');; ++INSERT INTO t1 VALUES (DEFAULT, 'node2');; ++SELECT @@auto_increment_increment = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'); ++@@auto_increment_increment = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size') ++1 ++SELECT @@auto_increment_offset = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_index') + 1; ++@@auto_increment_offset = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_index') + 1 ++1 ++INSERT INTO t1 VALUES (DEFAULT, 'node2'), (DEFAULT, 'node2'), (DEFAULT, 'node2'), (DEFAULT, 'node2'), (DEFAULT, 'node2'), (DEFAULT, 'node2'), (DEFAULT, 'node2'), (DEFAULT, 'node2'), (DEFAULT, 'node2'), (DEFAULT, 'node2');; ++INSERT INTO t1 VALUES (DEFAULT, 'node1'), (DEFAULT, 'node1'), (DEFAULT, 'node1'), (DEFAULT, 'node1'), (DEFAULT, 'node1'), (DEFAULT, 'node1'), (DEFAULT, 'node1'), (DEFAULT, 'node1'), (DEFAULT, 'node1'), (DEFAULT, 'node1');; ++SELECT COUNT(*) = 22 FROM t1; ++COUNT(*) = 22 ++1 ++SELECT COUNT(DISTINCT f1) = 22 FROM t1; ++COUNT(DISTINCT f1) = 22 ++1 ++SELECT COUNT(*) = 22 FROM t1; ++COUNT(*) = 22 ++1 ++SELECT COUNT(DISTINCT f1) = 22 FROM t1; ++COUNT(DISTINCT f1) = 22 ++1 ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/r/galera_var_certify_nonPK_off.result b/mysql-test/suite/galera/r/galera_var_certify_nonPK_off.result +new file mode 100644 +index 0000000..35dabb7 +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_var_certify_nonPK_off.result +@@ -0,0 +1,21 @@ ++SET GLOBAL wsrep_certify_nonPK = OFF; ++SET GLOBAL wsrep_certify_nonPK = OFF; ++CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB /* Table has no primary key */; ++CREATE TABLE t2 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; ++INSERT INTO t1 VALUES (1), (2); ++ERROR 40001: Deadlock found when trying to get lock; try restarting transaction ++INSERT INTO t2 VALUES (1), (2); ++UPDATE t2 SET f1 = 3 WHERE f1 = 1; ++SELECT COUNT(*) = 0 FROM t1; ++COUNT(*) = 0 ++1 ++SELECT COUNT(*) = 2 FROM t2; ++COUNT(*) = 2 ++1 ++SELECT COUNT(*) = 1 FROM t2 WHERE f1 = 3; ++COUNT(*) = 1 ++1 ++SET GLOBAL wsrep_certify_nonPK = 1; ++SET GLOBAL wsrep_certify_nonPK = 1; ++DROP TABLE t1; ++DROP TABLE t2; +diff --git a/mysql-test/suite/galera/r/galera_var_cluster_address.result b/mysql-test/suite/galera/r/galera_var_cluster_address.result +new file mode 100644 +index 0000000..cd52007 +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_var_cluster_address.result +@@ -0,0 +1,63 @@ ++SET GLOBAL wsrep_cluster_address = 'foo://'; ++SHOW STATUS; ++ERROR HY000: Lock wait timeout exceeded; try restarting transaction ++SET SESSION wsrep_sync_wait=0; ++SELECT * FROM INFORMATION_SCHEMA.GLOBAL_STATUS; ++ERROR 08S01: Unknown command ++SHOW STATUS LIKE 'wsrep_ready'; ++Variable_name Value ++wsrep_ready OFF ++SHOW STATUS LIKE 'wsrep_cluster_status'; ++Variable_name Value ++wsrep_cluster_status non-Primary ++SHOW STATUS LIKE 'wsrep_local_state'; ++Variable_name Value ++wsrep_local_state 0 ++SHOW STATUS LIKE 'wsrep_local_state_comment'; ++Variable_name Value ++wsrep_local_state_comment Initialized ++SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; ++VARIABLE_VALUE = 1 ++1 ++SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; ++VARIABLE_VALUE = 'Primary' ++1 ++SET GLOBAL wsrep_cluster_address = @@wsrep_cluster_address; ++SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; ++VARIABLE_VALUE = 'Primary' ++1 ++SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; ++VARIABLE_VALUE = 2 ++1 ++SET GLOBAL wsrep_cluster_address = 'gcomm://192.0.2.1'; ++SELECT * FROM INFORMATION_SCHEMA.GLOBAL_STATUS; ++ERROR 08S01: Unknown command ++SHOW STATUS LIKE 'wsrep_ready'; ++Variable_name Value ++wsrep_ready OFF ++SHOW STATUS LIKE 'wsrep_cluster_status'; ++Variable_name Value ++wsrep_cluster_status non-Primary ++SHOW STATUS LIKE 'wsrep_local_state'; ++Variable_name Value ++wsrep_local_state 0 ++SHOW STATUS LIKE 'wsrep_local_state_comment'; ++Variable_name Value ++wsrep_local_state_comment Initialized ++SET GLOBAL wsrep_cluster_address = @@wsrep_cluster_address; ++SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; ++VARIABLE_VALUE = 'Primary' ++1 ++SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; ++VARIABLE_VALUE = 2 ++1 ++CALL mtr.add_suppression("Backend not supported: foo"); ++CALL mtr.add_suppression("Failed to initialize backend using 'foo"); ++CALL mtr.add_suppression("Failed to open channel 'my_wsrep_cluster' at 'foo"); ++CALL mtr.add_suppression("gcs connect failed: Socket type not supported"); ++CALL mtr.add_suppression("wsrep::connect\\(\\) failed: 7"); ++CALL mtr.add_suppression("gcs_caused\\(\\) returned -103 \\(Software caused connection abort\\)"); ++CALL mtr.add_suppression("failed to open gcomm backend connection: 110: failed to reach primary view: 110"); ++CALL mtr.add_suppression("Failed to open backend connection: -110 \\(Connection timed out\\)"); ++CALL mtr.add_suppression("Failed to open channel 'my_wsrep_cluster' at 'gcomm://192\\.0\\.2\\.1': -110 \\(Connection timed out\\)"); ++CALL mtr.add_suppression("gcs connect failed: Connection timed out"); +diff --git a/mysql-test/suite/galera/r/galera_var_desync_on.result b/mysql-test/suite/galera/r/galera_var_desync_on.result +new file mode 100644 +index 0000000..0b5f346 +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_var_desync_on.result +@@ -0,0 +1,29 @@ ++CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; ++INSERT INTO t1 VALUES (1); ++SET GLOBAL wsrep_provider_options = 'gcs.fc_limit=1'; ++SET GLOBAL wsrep_desync = TRUE; ++FLUSH TABLES WITH READ LOCK; ++INSERT INTO t1 VALUES (2); ++INSERT INTO t1 VALUES (3); ++INSERT INTO t1 VALUES (4); ++INSERT INTO t1 VALUES (5); ++INSERT INTO t1 VALUES (6); ++INSERT INTO t1 VALUES (7); ++INSERT INTO t1 VALUES (8); ++INSERT INTO t1 VALUES (9); ++INSERT INTO t1 VALUES (10); ++SET SESSION wsrep_sync_wait = 0; ++SELECT COUNT(*) = 1 FROM t1; ++COUNT(*) = 1 ++1 ++SET GLOBAL wsrep_desync = FALSE; ++UNLOCK TABLES; ++SET SESSION wsrep_sync_wait = 1; ++SELECT COUNT(*) = 10 FROM t1; ++COUNT(*) = 10 ++1 ++INSERT INTO t1 VALUES (11); ++SELECT COUNT(*) = 11 FROM t1; ++COUNT(*) = 11 ++1 ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/r/galera_var_fkchecks.result b/mysql-test/suite/galera/r/galera_var_fkchecks.result +new file mode 100644 +index 0000000..342212a +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_var_fkchecks.result +@@ -0,0 +1,26 @@ ++CREATE TABLE parent ( ++id INT PRIMARY KEY, ++KEY (id) ++) ENGINE=InnoDB; ++CREATE TABLE child ( ++id INT PRIMARY KEY, ++parent_id INT, ++FOREIGN KEY (parent_id) ++REFERENCES parent(id) ++) ENGINE=InnoDB; ++INSERT INTO parent VALUES (1); ++INSERT INTO child VALUES (1,1); ++SET SESSION foreign_key_checks = 0; ++INSERT INTO child VALUES (2,2); ++SELECT COUNT(*) = 1 FROM child WHERE id = 2; ++COUNT(*) = 1 ++1 ++INSERT INTO child VALUES (3,3); ++ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`child`, CONSTRAINT `child_ibfk_1` FOREIGN KEY (`parent_id`) REFERENCES `parent` (`id`)) ++SET SESSION foreign_key_checks = 0; ++DELETE FROM parent; ++SELECT COUNT(*) = 0 FROM parent; ++COUNT(*) = 0 ++1 ++DROP TABLE child; ++DROP TABLE parent; +diff --git a/mysql-test/suite/galera/r/galera_var_innodb_disallow_writes.result b/mysql-test/suite/galera/r/galera_var_innodb_disallow_writes.result +new file mode 100644 +index 0000000..912e45a +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_var_innodb_disallow_writes.result +@@ -0,0 +1,12 @@ ++SET SESSION wsrep_sync_wait = 0; ++CREATE TABLE t1 (f1 INTEGER) Engine=InnoDB; ++SET GLOBAL innodb_disallow_writes=ON; ++INSERT INTO t1 VALUES (1);; ++SET GLOBAL innodb_disallow_writes=OFF; ++SELECT COUNT(*) = 1 FROM t1; ++COUNT(*) = 1 ++1 ++SELECT COUNT(*) = 1 FROM t1; ++COUNT(*) = 1 ++1 ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/r/galera_var_load_data_splitting.result b/mysql-test/suite/galera/r/galera_var_load_data_splitting.result +new file mode 100644 +index 0000000..db145fd +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_var_load_data_splitting.result +@@ -0,0 +1,9 @@ ++CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; ++SET GLOBAL wsrep_load_data_splitting = TRUE; ++SELECT COUNT(*) = 95000 FROM t1; ++COUNT(*) = 95000 ++1 ++wsrep_last_committed_diff ++1 ++SET GLOBAL wsrep_load_data_splitting = 1;; ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/r/galera_var_max_ws_size.result b/mysql-test/suite/galera/r/galera_var_max_ws_size.result +new file mode 100644 +index 0000000..6db5c24 +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_var_max_ws_size.result +@@ -0,0 +1,12 @@ ++call mtr.add_suppression('WSREP: transaction size limit.*'); ++call mtr.add_suppression('WSREP: rbr write fail.*'); ++call mtr.add_suppression('WSREP: Maximum writeset size exceeded by.*'); ++call mtr.add_suppression('WSREP: transaction size exceeded.*'); ++CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 VARCHAR(1024)) Engine=InnoDB; ++SET GLOBAL wsrep_max_ws_size = 1024; ++INSERT INTO t1 VALUES (DEFAULT, REPEAT('X', 1024)); ++ERROR HY000: Got error 5 during COMMIT ++SELECT COUNT(*) = 0 FROM t1; ++COUNT(*) = 0 ++1 ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/r/galera_var_mysql_replication_bundle.result b/mysql-test/suite/galera/r/galera_var_mysql_replication_bundle.result +new file mode 100644 +index 0000000..f2a951c +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_var_mysql_replication_bundle.result +@@ -0,0 +1,12 @@ ++CREATE TABLE t1 (f1 INT PRIMARY KEY) Engine=InnoDB; ++SET GLOBAL wsrep_mysql_replication_bundle = 2; ++INSERT INTO t1 VALUES (1); ++SELECT COUNT(*) = 0 FROM t1; ++COUNT(*) = 0 ++0 ++INSERT INTO t1 VALUES (2); ++SELECT COUNT(*) = 2 FROM t1; ++COUNT(*) = 2 ++1 ++SET GLOBAL wsrep_mysql_replication_bundle = 0; ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/r/galera_var_notify_cmd.result b/mysql-test/suite/galera/r/galera_var_notify_cmd.result +new file mode 100644 +index 0000000..e9e4605 +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_var_notify_cmd.result +@@ -0,0 +1,10 @@ ++SELECT COUNT(DISTINCT uuid) = 2 FROM mtr_wsrep_notify.membership; ++COUNT(DISTINCT uuid) = 2 ++1 ++SELECT MAX(size) = 2 FROM mtr_wsrep_notify.status; ++MAX(size) = 2 ++1 ++SELECT COUNT(DISTINCT idx) = 2 FROM mtr_wsrep_notify.status; ++COUNT(DISTINCT idx) = 2 ++1 ++DROP SCHEMA mtr_wsrep_notify; +diff --git a/mysql-test/suite/galera/r/galera_var_replicate_myisam_off.result b/mysql-test/suite/galera/r/galera_var_replicate_myisam_off.result +new file mode 100644 +index 0000000..c8b7907 +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_var_replicate_myisam_off.result +@@ -0,0 +1,8 @@ ++SET GLOBAL wsrep_replicate_myisam = FALSE; ++CREATE TABLE t1 (f1 INT PRIMARY KEY) Engine=MyISAM; ++INSERT INTO t1 VALUES (1); ++SELECT COUNT(*) = 0 FROM t1; ++COUNT(*) = 0 ++1 ++SET GLOBAL wsrep_replicate_myisam = 0; ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/r/galera_var_replicate_myisam_on.result b/mysql-test/suite/galera/r/galera_var_replicate_myisam_on.result +new file mode 100644 +index 0000000..73a0576 +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_var_replicate_myisam_on.result +@@ -0,0 +1,78 @@ ++SET GLOBAL wsrep_replicate_myisam = TRUE; ++SET GLOBAL wsrep_replicate_myisam = TRUE; ++CREATE TABLE t1 (f1 INT PRIMARY KEY) Engine=MyISAM; ++INSERT INTO t1 VALUES (1); ++INSERT INTO t1 VALUES (2), (3); ++INSERT INTO t1 SELECT 4 FROM DUAL UNION ALL SELECT 5 FROM DUAL; ++SELECT COUNT(*) = 5 FROM t1; ++COUNT(*) = 5 ++1 ++DROP TABLE t1; ++CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 VARCHAR(100)) ENGINE=MyISAM; ++INSERT INTO t1 VALUES (1, 'abc'),(2,'abc'), (3, 'xxx'); ++REPLACE INTO t1 VALUES (1, 'klm'), (2,'xyz'); ++REPLACE INTO t1 SELECT 3, 'yyy' FROM DUAL; ++SELECT COUNT(*) = 3 FROM t1; ++COUNT(*) = 3 ++1 ++SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1 AND f2 = 'klm'; ++COUNT(*) = 1 ++1 ++SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2 AND f2 = 'xyz'; ++COUNT(*) = 1 ++1 ++SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 3 AND f2 = 'yyy'; ++COUNT(*) = 1 ++1 ++UPDATE t1 SET f2 = 'zzz' WHERE f2 = 'yyy'; ++SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'zzz'; ++COUNT(*) = 1 ++1 ++DELETE FROM t1 WHERE f2 = 'zzz'; ++SELECT COUNT(*) = 0 FROM t1 WHERE f2 = 'zzz'; ++COUNT(*) = 0 ++1 ++TRUNCATE TABLE t1; ++SELECT COUNT(*) = 0 FROM t1; ++COUNT(*) = 0 ++1 ++DROP TABLE t1; ++CREATE TABLE t1 (f1 INTEGER) ENGINE=MyISAM; ++CREATE TABLE t2 (f1 INTEGER) ENGINE=InnoDB; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES (1); ++INSERT INTO t2 VALUES (1); ++COMMIT; ++SELECT COUNT(*) = 1 FROM t1; ++COUNT(*) = 1 ++1 ++SELECT COUNT(*) = 1 FROM t2; ++COUNT(*) = 1 ++1 ++START TRANSACTION; ++INSERT INTO t1 VALUES (2); ++INSERT INTO t2 VALUES (2); ++ROLLBACK; ++Warnings: ++Warning 1196 Some non-transactional changed tables couldn't be rolled back ++SELECT COUNT(*) = 2 FROM t1; ++COUNT(*) = 2 ++1 ++SELECT COUNT(*) = 1 FROM t2; ++COUNT(*) = 1 ++1 ++DROP TABLE t1; ++DROP TABLE t2; ++CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=MyISAM; ++CREATE TABLE t2 (f2 INTEGER PRIMARY KEY) ENGINE=InnoDB; ++START TRANSACTION; ++INSERT INTO t1 VALUES (1); ++INSERT INTO t2 VALUES (1); ++INSERT INTO t1 VALUES (1); ++ERROR 23000: Duplicate entry '1' for key 'PRIMARY' ++COMMIT; ++DROP TABLE t1; ++DROP TABLE t2; ++SET GLOBAL wsrep_replicate_myisam = 0; ++SET GLOBAL wsrep_replicate_myisam = 0; +diff --git a/mysql-test/suite/galera/r/galera_var_slave_threads.result b/mysql-test/suite/galera/r/galera_var_slave_threads.result +new file mode 100644 +index 0000000..6b84f03 +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_var_slave_threads.result +@@ -0,0 +1,106 @@ ++CREATE TABLE t1 (f1 INT PRIMARY KEY) Engine=InnoDB; ++CREATE TABLE t2 (f1 INT AUTO_INCREMENT PRIMARY KEY) Engine=InnoDB; ++SET GLOBAL wsrep_slave_threads = 0; ++Warnings: ++Warning 1292 Truncated incorrect wsrep_slave_threads value: '0' ++SHOW WARNINGS; ++Level Code Message ++Warning 1292 Truncated incorrect wsrep_slave_threads value: '0' ++SELECT @@wsrep_slave_threads = 1; ++@@wsrep_slave_threads = 1 ++1 ++SET GLOBAL wsrep_slave_threads = 1; ++SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user'; ++COUNT(*) = 2 ++1 ++SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE '%wsrep aborter%'; ++COUNT(*) = 1 ++1 ++SET GLOBAL wsrep_slave_threads = 64; ++INSERT INTO t1 VALUES (1); ++SELECT COUNT(*) = 1 FROM t1; ++COUNT(*) = 1 ++1 ++SELECT COUNT(*) = @@wsrep_slave_threads + 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user'; ++COUNT(*) = @@wsrep_slave_threads + 1 ++1 ++SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE '%wsrep aborter%'; ++COUNT(*) = 1 ++1 ++SET GLOBAL wsrep_slave_threads = 1; ++INSERT INTO t2 VALUES (DEFAULT); ++INSERT INTO t2 VALUES (DEFAULT); ++INSERT INTO t2 VALUES (DEFAULT); ++INSERT INTO t2 VALUES (DEFAULT); ++INSERT INTO t2 VALUES (DEFAULT); ++INSERT INTO t2 VALUES (DEFAULT); ++INSERT INTO t2 VALUES (DEFAULT); ++INSERT INTO t2 VALUES (DEFAULT); ++INSERT INTO t2 VALUES (DEFAULT); ++INSERT INTO t2 VALUES (DEFAULT); ++INSERT INTO t2 VALUES (DEFAULT); ++INSERT INTO t2 VALUES (DEFAULT); ++INSERT INTO t2 VALUES (DEFAULT); ++INSERT INTO t2 VALUES (DEFAULT); ++INSERT INTO t2 VALUES (DEFAULT); ++INSERT INTO t2 VALUES (DEFAULT); ++INSERT INTO t2 VALUES (DEFAULT); ++INSERT INTO t2 VALUES (DEFAULT); ++INSERT INTO t2 VALUES (DEFAULT); ++INSERT INTO t2 VALUES (DEFAULT); ++INSERT INTO t2 VALUES (DEFAULT); ++INSERT INTO t2 VALUES (DEFAULT); ++INSERT INTO t2 VALUES (DEFAULT); ++INSERT INTO t2 VALUES (DEFAULT); ++INSERT INTO t2 VALUES (DEFAULT); ++INSERT INTO t2 VALUES (DEFAULT); ++INSERT INTO t2 VALUES (DEFAULT); ++INSERT INTO t2 VALUES (DEFAULT); ++INSERT INTO t2 VALUES (DEFAULT); ++INSERT INTO t2 VALUES (DEFAULT); ++INSERT INTO t2 VALUES (DEFAULT); ++INSERT INTO t2 VALUES (DEFAULT); ++INSERT INTO t2 VALUES (DEFAULT); ++INSERT INTO t2 VALUES (DEFAULT); ++INSERT INTO t2 VALUES (DEFAULT); ++INSERT INTO t2 VALUES (DEFAULT); ++INSERT INTO t2 VALUES (DEFAULT); ++INSERT INTO t2 VALUES (DEFAULT); ++INSERT INTO t2 VALUES (DEFAULT); ++INSERT INTO t2 VALUES (DEFAULT); ++INSERT INTO t2 VALUES (DEFAULT); ++INSERT INTO t2 VALUES (DEFAULT); ++INSERT INTO t2 VALUES (DEFAULT); ++INSERT INTO t2 VALUES (DEFAULT); ++INSERT INTO t2 VALUES (DEFAULT); ++INSERT INTO t2 VALUES (DEFAULT); ++INSERT INTO t2 VALUES (DEFAULT); ++INSERT INTO t2 VALUES (DEFAULT); ++INSERT INTO t2 VALUES (DEFAULT); ++INSERT INTO t2 VALUES (DEFAULT); ++INSERT INTO t2 VALUES (DEFAULT); ++INSERT INTO t2 VALUES (DEFAULT); ++INSERT INTO t2 VALUES (DEFAULT); ++INSERT INTO t2 VALUES (DEFAULT); ++INSERT INTO t2 VALUES (DEFAULT); ++INSERT INTO t2 VALUES (DEFAULT); ++INSERT INTO t2 VALUES (DEFAULT); ++INSERT INTO t2 VALUES (DEFAULT); ++INSERT INTO t2 VALUES (DEFAULT); ++INSERT INTO t2 VALUES (DEFAULT); ++INSERT INTO t2 VALUES (DEFAULT); ++INSERT INTO t2 VALUES (DEFAULT); ++INSERT INTO t2 VALUES (DEFAULT); ++INSERT INTO t2 VALUES (DEFAULT); ++SELECT COUNT(*) = 64 FROM t2; ++COUNT(*) = 64 ++1 ++SELECT COUNT(*) = @@wsrep_slave_threads + 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user'; ++COUNT(*) = @@wsrep_slave_threads + 1 ++1 ++SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE '%wsrep aborter%'; ++COUNT(*) = 1 ++1 ++SET GLOBAL wsrep_slave_threads = 1; ++DROP TABLE t1; ++DROP TABLE t2; +diff --git a/mysql-test/suite/galera/r/galera_var_sync_wait.result b/mysql-test/suite/galera/r/galera_var_sync_wait.result +new file mode 100644 +index 0000000..f6136a4 +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_var_sync_wait.result +@@ -0,0 +1,21 @@ ++CREATE TABLE t1 (f1 INT PRIMARY KEY) Engine=InnoDB; ++SET GLOBAL wsrep_sync_wait = 1; ++SHOW TABLES LIKE '%t1'; ++Tables_in_test (%t1) ++t1 ++SELECT COUNT(*) = 0 FROM t1; ++COUNT(*) = 0 ++1 ++CREATE TABLE t2 (f1 INT PRIMARY KEY) Engine=InnoDB; ++SET GLOBAL wsrep_sync_wait = 4; ++INSERT INTO t2 VALUES (1); ++CREATE TABLE t3 (f1 INT PRIMARY KEY) Engine=InnoDB; ++INSERT INTO t3 VALUES (1); ++SET GLOBAL wsrep_sync_wait = 2; ++UPDATE t3 SET f1 = 2; ++affected rows: 1 ++info: Rows matched: 1 Changed: 1 Warnings: 0 ++SET GLOBAL wsrep_sync_wait = 7; ++DROP TABLE t1; ++DROP TABLE t2; ++DROP TABLE t3; +diff --git a/mysql-test/suite/galera/r/galera_var_wsrep_on_off.result b/mysql-test/suite/galera/r/galera_var_wsrep_on_off.result +new file mode 100644 +index 0000000..8b1c4eb +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_var_wsrep_on_off.result +@@ -0,0 +1,19 @@ ++CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; ++INSERT INTO t1 VALUES (1); ++SET SESSION wsrep_on = FALSE; ++INSERT INTO t1 VALUES (2); ++SELECT COUNT(*) = 1 FROM t1; ++COUNT(*) = 1 ++1 ++SET GLOBAL wsrep_on = TRUE; ++INSERT INTO t1 VALUES (3); ++SELECT COUNT(*) = 2 FROM t1; ++COUNT(*) = 2 ++1 ++SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 2; ++COUNT(*) = 0 ++1 ++SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 3; ++COUNT(*) = 1 ++1 ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/r/galera_wan.result b/mysql-test/suite/galera/r/galera_wan.result +new file mode 100644 +index 0000000..6be32b2 +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_wan.result +@@ -0,0 +1,14 @@ ++SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; ++VARIABLE_VALUE = 4 ++1 ++CREATE TABLE t1 (f1 INTEGER); ++INSERT INTO t1 VALUES (1); ++CALL mtr.add_suppression("There are no nodes in the same segment that will ever be able to become donors, yet there is a suitable donor outside"); ++SELECT VARIABLE_VALUE LIKE '%gmcast.segment = 3%' FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME = 'wsrep_provider_options'; ++VARIABLE_VALUE LIKE '%gmcast.segment = 3%' ++1 ++SELECT COUNT(*) = 1 FROM t1; ++COUNT(*) = 1 ++1 ++DROP TABLE t1; ++CALL mtr.add_suppression("There are no nodes in the same segment that will ever be able to become donors, yet there is a suitable donor outside"); +diff --git a/mysql-test/suite/galera/r/galera_wsrep_desync_wsrep_on.result b/mysql-test/suite/galera/r/galera_wsrep_desync_wsrep_on.result +new file mode 100644 +index 0000000..06fc27a +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_wsrep_desync_wsrep_on.result +@@ -0,0 +1,33 @@ ++CREATE TABLE ten (f1 INTEGER); ++INSERT INTO ten VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); ++CREATE TABLE t1 (f1 INTEGER) Engine=InnoDB; ++INSERT INTO t1 (f1) SELECT 000000 + (10000 * a1.f1) + (1000 * a2.f1) + (100 * a3.f1) + (10 * a4.f1) + a5.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5; ++SET GLOBAL wsrep_desync = TRUE; ++SET SESSION wsrep_on = FALSE; ++ALTER TABLE t1 ADD PRIMARY KEY (f1); ++SET SESSION wsrep_on = TRUE; ++SET GLOBAL wsrep_desync = FALSE; ++INSERT INTO t1 (f1) SELECT 100000 + (10000 * a1.f1) + (1000 * a2.f1) + (100 * a3.f1) + (10 * a4.f1) + a5.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5; ++SELECT COUNT(*) = 200000 FROM t1; ++COUNT(*) = 200000 ++1 ++SELECT MAX(f1) = 199999 FROM t1; ++MAX(f1) = 199999 ++1 ++SELECT COUNT(*) = 200000 FROM t1; ++COUNT(*) = 200000 ++1 ++SELECT MAX(f1) = 199999 FROM t1; ++MAX(f1) = 199999 ++1 ++SET GLOBAL wsrep_desync = TRUE; ++SET SESSION wsrep_on = FALSE; ++ALTER TABLE t1 ADD PRIMARY KEY (f1); ++SET SESSION wsrep_on = TRUE; ++SET GLOBAL wsrep_desync = FALSE; ++INSERT INTO t1 (f1) VALUES (1); ++ERROR 23000: Duplicate entry '1' for key 'PRIMARY' ++INSERT INTO t1 (f1) VALUES (100); ++ERROR 23000: Duplicate entry '100' for key 'PRIMARY' ++DROP TABLE t1; ++DROP TABLE ten; +diff --git a/mysql-test/suite/galera/r/galera_wsrep_new_cluster.result b/mysql-test/suite/galera/r/galera_wsrep_new_cluster.result +new file mode 100644 +index 0000000..e3f2fa4 +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_wsrep_new_cluster.result +@@ -0,0 +1,36 @@ ++SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; ++VARIABLE_VALUE = 'Primary' ++1 ++SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_connected'; ++VARIABLE_VALUE = 'ON' ++1 ++SELECT VARIABLE_VALUE = 0 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_index'; ++VARIABLE_VALUE = 0 ++1 ++SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready'; ++VARIABLE_VALUE = 'ON' ++1 ++SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state'; ++VARIABLE_VALUE = 4 ++1 ++SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; ++VARIABLE_VALUE = 'Synced' ++1 ++SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; ++VARIABLE_VALUE = 'Primary' ++1 ++SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_connected'; ++VARIABLE_VALUE = 'ON' ++1 ++SELECT VARIABLE_VALUE = 0 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_index'; ++VARIABLE_VALUE = 0 ++1 ++SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready'; ++VARIABLE_VALUE = 'ON' ++1 ++SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state'; ++VARIABLE_VALUE = 4 ++1 ++SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; ++VARIABLE_VALUE = 'Synced' ++1 +diff --git a/mysql-test/suite/galera/r/galera_wsrep_provider_unset_set.result b/mysql-test/suite/galera/r/galera_wsrep_provider_unset_set.result +new file mode 100644 +index 0000000..681e460 +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_wsrep_provider_unset_set.result +@@ -0,0 +1,13 @@ ++CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; ++INSERT INTO t1 VALUES (1); ++SET GLOBAL wsrep_provider='none'; ++INSERT INTO t1 VALUES (2); ++INSERT INTO t1 VALUES (3); ++INSERT INTO t1 VALUES (4); ++SELECT COUNT(*) = 4 FROM t1; ++COUNT(*) = 4 ++1 ++SELECT COUNT(*) = 3 FROM t1; ++COUNT(*) = 3 ++1 ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/r/galera_zero_length_column.result b/mysql-test/suite/galera/r/galera_zero_length_column.result +new file mode 100644 +index 0000000..2e6119b +--- /dev/null ++++ b/mysql-test/suite/galera/r/galera_zero_length_column.result +@@ -0,0 +1,38 @@ ++CREATE TABLE t1 (f1 INTEGER PRIMARY KEY , f2 VARCHAR(0)) ENGINE=InnoDB; ++CREATE TABLE t2 (f1 VARCHAR(0)) ENGINE=InnoDB; ++INSERT INTO t1 VALUES (1, NULL); ++INSERT INTO t1 VALUES (2, ''); ++INSERT INTO t2 VALUES (NULL); ++INSERT INTO t2 VALUES (''); ++SELECT COUNT(*) = 2 FROM t1; ++COUNT(*) = 2 ++1 ++SELECT f2 IS NULL FROM t1 WHERE f1 = 1; ++f2 IS NULL ++1 ++SELECT f2 = '' FROM t1 WHERE f1 = 2; ++f2 = '' ++1 ++SELECT COUNT(*) = 2 FROM t2; ++COUNT(*) = 2 ++1 ++SELECT f1 IS NULL FROM t2 WHERE f1 IS NULL; ++f1 IS NULL ++1 ++SELECT f1 = '' FROM t2 WHERE f1 IS NOT NULL; ++f1 = '' ++1 ++UPDATE t1 SET f2 = '' WHERE f1 = 1; ++UPDATE t1 SET f2 = NULL WHERE f1 = 2; ++UPDATE t2 SET f1 = '' WHERE f1 IS NULL; ++SELECT f2 = '' FROM t1 WHERE f1 = 1; ++f2 = '' ++1 ++SELECT f2 IS NULL FROM t1 WHERE f1 = 2; ++f2 IS NULL ++1 ++SELECT COUNT(*) = 2 FROM t2 WHERE f1 = ''; ++COUNT(*) = 2 ++1 ++DROP TABLE t1; ++DROP TABLE t2; +diff --git a/mysql-test/suite/galera/r/lp1276424.result b/mysql-test/suite/galera/r/lp1276424.result +new file mode 100644 +index 0000000..5f09ec9 +--- /dev/null ++++ b/mysql-test/suite/galera/r/lp1276424.result +@@ -0,0 +1,11 @@ ++CREATE TABLE t1 (f1 INT DEFAULT NULL, UNIQUE KEY i1 (f1)) ENGINE=InnoDB; ++INSERT INTO t1 VALUES (NULL); ++INSERT INTO t1 VALUES (NULL); ++SELECT COUNT(*) = 2 FROM t1; ++COUNT(*) = 2 ++1 ++SELECT f1 IS NULL FROM t1; ++f1 IS NULL ++1 ++1 ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/r/lp1347768.result b/mysql-test/suite/galera/r/lp1347768.result +new file mode 100644 +index 0000000..c085059 +--- /dev/null ++++ b/mysql-test/suite/galera/r/lp1347768.result +@@ -0,0 +1,17 @@ ++CREATE TABLE `r8kmb_redirect_links` ( ++`id` int(10) unsigned NOT NULL AUTO_INCREMENT, ++`old_url` varchar(255) DEFAULT NULL, ++`new_url` varchar(255) NOT NULL, ++`referer` varchar(150) NOT NULL, ++`comment` varchar(255) NOT NULL, ++`published` tinyint(4) NOT NULL, ++`created_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', ++`modified_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', ++PRIMARY KEY (`id`), ++UNIQUE KEY `idx_link_old` (`old_url`), ++KEY `idx_link_modifed` (`modified_date`) ++) ENGINE=InnoDB DEFAULT CHARSET=utf8; ++INSERT INTO r8kmb_redirect_links VALUES (550,'http://mysite.com/images/download/ßуñûічýøù_ôþóþòір_þфõÑ.doc','','','',0,'2013-07-15 14:29:42','0000-00-00 00:00:00'); ++Warnings: ++Warning 1265 Data truncated for column 'old_url' at row 1 ++DROP TABLE r8kmb_redirect_links; +diff --git a/mysql-test/suite/galera/r/lp959512.result b/mysql-test/suite/galera/r/lp959512.result +new file mode 100644 +index 0000000..55adfa3 +--- /dev/null ++++ b/mysql-test/suite/galera/r/lp959512.result +@@ -0,0 +1,24 @@ ++DROP TABLE IF EXISTS variable; ++Warnings: ++Note 1051 Unknown table 'test.variable' ++DROP TABLE IF EXISTS foo; ++Warnings: ++Note 1051 Unknown table 'test.foo' ++CREATE TABLE variable ( ++name varchar(128) NOT NULL DEFAULT '' COMMENT 'The name of the variable.', ++value longblob NOT NULL COMMENT 'The value of the variable.', ++PRIMARY KEY (name) ++) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Named variable/value pairs created by Drupal core or any...'; ++CREATE TABLE foo (a int); ++INSERT INTO variable (name, value) VALUES ('menu_expanded', 'a:0:{}'); ++START TRANSACTION; ++SELECT 1 AS expression FROM variable variable ++WHERE ( (name = 'menu_expanded') ) FOR UPDATE; ++expression ++1 ++UPDATE variable SET value='a:0:{}' WHERE ( (name = 'menu_expanded') ); ++COMMIT; ++INSERT INTO foo VALUES (1); ++UPDATE foo SET a = 2 WHERE a = 1; ++DROP TABLE foo; ++DROP TABLE variable; +diff --git a/mysql-test/suite/galera/t/disabled.def b/mysql-test/suite/galera/t/disabled.def +new file mode 100644 +index 0000000..a1495c6 +--- /dev/null ++++ b/mysql-test/suite/galera/t/disabled.def +@@ -0,0 +1,4 @@ ++galera_wsrep_provider_unset_set : lp1379204 'Unsupported protocol downgrade: incremental data collection disabled. Expect abort.' ++galera_kill_nochanges : mysql-wsrep#24 Galera server does not restart properly if killed ++galera_bf_abort_for_update : mysql-wsrep#26 SELECT FOR UPDATE sometimes allowed to proceed in the face of a concurrent update ++galera_toi_ddl_fk_insert : qa#39 galera_toi_ddl_fk_insert fails sporadically +diff --git a/mysql-test/suite/galera/t/galera_account_management.test b/mysql-test/suite/galera/t/galera_account_management.test +new file mode 100644 +index 0000000..357319a +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_account_management.test +@@ -0,0 +1,101 @@ ++# ++# Test the account management statements - GRANT, REVOKE, etc. ++# ++ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++# ++# CREATE USER ++# ++--connection node_1 ++CREATE USER user1, user2 IDENTIFIED BY 'password'; ++ ++--connection node_2 ++SELECT COUNT(*) = 2 FROM mysql.user WHERE user IN ('user1', 'user2'); ++ ++# ++# ALTER USER ++# ++ ++# LP bug 1376269 ++# ++#--connection node_1 ++#ALTER USER user1 PASSWORD EXPIRE; ++#SELECT password_expired = 'Y' FROM mysql.user WHERE user = 'user1'; ++# ++#--connection node_2 ++#SELECT password_expired = 'Y' FROM mysql.user WHERE user = 'user1'; ++ ++# ++# RENAME USER ++# ++ ++--connection node_1 ++RENAME USER user2 TO user3; ++ ++--connection node_2 ++SELECT COUNT(*) = 0 FROM mysql.user WHERE user = 'user2'; ++SELECT COUNT(*) = 1 FROM mysql.user WHERE user = 'user3'; ++ ++# ++# SET PASSWORD ++# ++ ++--connection node_1 ++SET PASSWORD FOR user3 = PASSWORD('foo'); ++ ++--connection node_1 ++SELECT password != '' FROM mysql.user WHERE user = 'user3'; ++ ++# ++# DROP USER ++# ++--connection node_1 ++DROP USER user1, user3; ++ ++--connection node_2 ++SELECT COUNT(*) = 0 FROM mysql.user WHERE user IN ('user1', 'user2'); ++ ++# ++# GRANT ++# ++ ++--connection node_1 ++GRANT ALL ON *.* TO user4 IDENTIFIED BY 'password'; ++ ++--connection node_2 ++SELECT COUNT(*) = 1 FROM mysql.user WHERE user = 'user4'; ++SELECT Select_priv = 'Y' FROM mysql.user WHERE user = 'user4'; ++ ++# ++# GRANT PROXY ON ++# ++--connection node_1 ++CREATE USER user5; ++GRANT PROXY ON user4 TO user5; ++ ++--connection node_2 ++SELECT COUNT(*) = 1 FROM mysql.proxies_priv WHERE user = 'user5'; ++ ++# ++# REVOKE ++# ++ ++--connection node_1 ++REVOKE ALL PRIVILEGES ON *.* FROM user4; ++ ++--connection node_2 ++SELECT Select_priv = 'N' FROM mysql.user WHERE user = 'user4'; ++ ++# ++# REVOKE PROXY ++# ++ ++--connection node_1 ++REVOKE PROXY ON user4 FROM user5; ++ ++--connection node_2 ++SELECT COUNT(*) = 0 FROM mysql.proxies_priv WHERE user = 'user5'; ++ ++DROP USER user4, user5; +diff --git a/mysql-test/suite/galera/t/galera_alter_engine_innodb.test b/mysql-test/suite/galera/t/galera_alter_engine_innodb.test +new file mode 100644 +index 0000000..bc914a3 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_alter_engine_innodb.test +@@ -0,0 +1,17 @@ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++# ++# Test ALTER ENGINE from InnoDB to InnoDB ++# ++ ++CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; ++INSERT INTO t1 VALUES (1); ++ ++ALTER TABLE t1 ENGINE=InnoDB; ++ ++--connection node_2 ++SELECT ENGINE = 'InnoDB' FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'; ++SELECT COUNT(*) = 1 FROM t1; ++ ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/t/galera_alter_engine_myisam.test b/mysql-test/suite/galera/t/galera_alter_engine_myisam.test +new file mode 100644 +index 0000000..6d41d27 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_alter_engine_myisam.test +@@ -0,0 +1,25 @@ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++# ++# Test ALTER ENGINE from MyISAM to InnoDB under wsrep_replicate_myisam ++# ++ ++--let $wsrep_replicate_myisam_orig = `SELECT @@wsrep_replicate_myisam` ++SET GLOBAL wsrep_replicate_myisam = TRUE; ++ ++CREATE TABLE t1 (f1 INTEGER) ENGINE=MyISAM; ++INSERT INTO t1 VALUES (1); ++ ++ALTER TABLE t1 ENGINE=InnoDB; ++ ++--connection node_2 ++SELECT ENGINE = 'InnoDB' FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'; ++SELECT COUNT(*) = 1 FROM t1; ++ ++--connection node_1 ++--disable_query_log ++--eval SET GLOBAL wsrep_replicate_myisam = $wsrep_replicate_myisam_orig ++--enable_query_log ++ ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/t/galera_alter_table_force.test b/mysql-test/suite/galera/t/galera_alter_table_force.test +new file mode 100644 +index 0000000..1fcc9d4 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_alter_table_force.test +@@ -0,0 +1,17 @@ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++# ++# Test ALTER TABLE FORCE, a 5.6.3 feature that simply rebuilds the table ++# ++ ++CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; ++INSERT INTO t1 VALUES (1); ++ ++ALTER TABLE t1 FORCE; ++ ++--connection node_2 ++SELECT ENGINE = 'InnoDB' FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'; ++SELECT COUNT(*) = 1 FROM t1; ++ ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/t/galera_as_master.cnf b/mysql-test/suite/galera/t/galera_as_master.cnf +new file mode 100644 +index 0000000..52fd309 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_as_master.cnf +@@ -0,0 +1 @@ ++!include ../galera_2nodes_as_master.cnf +diff --git a/mysql-test/suite/galera/t/galera_as_master.test b/mysql-test/suite/galera/t/galera_as_master.test +new file mode 100644 +index 0000000..3367a20 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_as_master.test +@@ -0,0 +1,39 @@ ++# ++# Test Galera as a master to a MySQL slave ++# ++# The galera/galera_2node_master.cnf describes the setup of the nodes ++# ++ ++--source include/have_innodb.inc ++--source include/have_log_bin.inc ++--source include/galera_cluster.inc ++ ++--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 ++--disable_query_log ++--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$NODE_MYPORT_1; ++--enable_query_log ++START SLAVE USER='root'; ++ ++--connection node_1 ++CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; ++INSERT INTO t1 VALUES(1); ++ ++--connection node_2 ++INSERT INTO t1 VALUES(2); ++ ++--connection node_3 ++--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'; ++--source include/wait_condition.inc ++ ++--let $wait_condition = SELECT COUNT(*) = 2 FROM t1; ++--source include/wait_condition.inc ++ ++--connection node_1 ++DROP TABLE t1; ++ ++--connection node_3 ++--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'; ++--source include/wait_condition.inc ++ ++STOP SLAVE; ++RESET SLAVE ALL; +diff --git a/mysql-test/suite/galera/t/galera_as_master_gtid.cnf b/mysql-test/suite/galera/t/galera_as_master_gtid.cnf +new file mode 100644 +index 0000000..1951755 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_as_master_gtid.cnf +@@ -0,0 +1,8 @@ ++!include ../galera_2nodes_as_master.cnf ++ ++[mysqld] ++gtid-mode=ON ++log-bin=mysqld-bin ++log-slave-updates ++enforce-gtid-consistency ++binlog-format=ROW +diff --git a/mysql-test/suite/galera/t/galera_as_master_gtid.test b/mysql-test/suite/galera/t/galera_as_master_gtid.test +new file mode 100644 +index 0000000..9db104b +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_as_master_gtid.test +@@ -0,0 +1,70 @@ ++# ++# Test Galera as a master to a MySQL slave with GTID ++# ++# The galera/galera_2node_master.cnf describes the setup of the nodes ++# ++# We check that all transactions originating from within Galera use a UUID that is ++# different from the server_uuid of either node ++# ++# ++ ++--source include/have_innodb.inc ++--source include/have_log_bin.inc ++--source include/galera_cluster.inc ++ ++--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 ++--disable_query_log ++--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$NODE_MYPORT_1; ++--enable_query_log ++START SLAVE USER='root'; ++ ++--connection node_1 ++CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; ++INSERT INTO t1 VALUES(1); ++ ++--let $effective_uuid = `SELECT LEFT(@@global.gtid_executed, 36)` ++--disable_query_log ++--eval SELECT '$effective_uuid' != @@global.server_uuid AS uuids_do_not_match; ++--enable_query_log ++ ++--replace_result $effective_uuid ++--replace_regex /table_id: [0-9]+/table_id: #/ /xid=[0-9]+/xid=#/ ++SHOW BINLOG EVENTS IN 'mysqld-bin.000002' FROM 120; ++ ++--connection node_2 ++INSERT INTO t1 VALUES(2); ++ ++--disable_query_log ++--eval SELECT '$effective_uuid' != @@global.server_uuid AS uuids_do_not_match; ++--eval SELECT '$effective_uuid' = LEFT(@@global.gtid_executed, 36) AS uuids_match; ++--enable_query_log ++ ++--replace_result $effective_uuid ++--replace_regex /table_id: [0-9]+/table_id: #/ /xid=[0-9]+/xid=#/ ++SHOW BINLOG EVENTS IN 'mysqld-bin.000003' FROM 120; ++ ++--connection node_3 ++--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'; ++--source include/wait_condition.inc ++ ++--let $wait_condition = SELECT COUNT(*) = 2 FROM t1; ++--source include/wait_condition.inc ++ ++--disable_query_log ++--eval SELECT '$effective_uuid' != @@global.server_uuid AS uuids_do_not_match; ++--eval SELECT '$effective_uuid' = LEFT(@@global.gtid_executed, 36) AS uuids_match; ++--enable_query_log ++ ++--replace_result $effective_uuid ++--replace_regex /table_id: [0-9]+/table_id: #/ /xid=[0-9]+/xid=#/ ++SHOW BINLOG EVENTS IN 'mysqld-bin.000001' FROM 120; ++ ++--connection node_1 ++DROP TABLE t1; ++ ++--connection node_3 ++--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'; ++--source include/wait_condition.inc ++ ++STOP SLAVE; ++RESET SLAVE ALL; +diff --git a/mysql-test/suite/galera/t/galera_as_master_gtid_change_master.cnf b/mysql-test/suite/galera/t/galera_as_master_gtid_change_master.cnf +new file mode 100644 +index 0000000..1951755 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_as_master_gtid_change_master.cnf +@@ -0,0 +1,8 @@ ++!include ../galera_2nodes_as_master.cnf ++ ++[mysqld] ++gtid-mode=ON ++log-bin=mysqld-bin ++log-slave-updates ++enforce-gtid-consistency ++binlog-format=ROW +diff --git a/mysql-test/suite/galera/t/galera_as_master_gtid_change_master.test b/mysql-test/suite/galera/t/galera_as_master_gtid_change_master.test +new file mode 100644 +index 0000000..23606d7 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_as_master_gtid_change_master.test +@@ -0,0 +1,54 @@ ++# ++# Test that a MySQL slave can use CHANGE MASTER MASTER_AUTO_POSITION to begin replicating ++# from another Galera node ++# ++# The galera/galera_2node_master.cnf describes the setup of the nodes ++# ++# ++ ++--source include/have_innodb.inc ++--source include/have_log_bin.inc ++--source include/galera_cluster.inc ++ ++--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 ++--disable_query_log ++--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$NODE_MYPORT_1; ++--enable_query_log ++START SLAVE USER='root'; ++ ++--connection node_1 ++CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; ++INSERT INTO t1 VALUES(1); ++ ++--connection node_2 ++INSERT INTO t1 VALUES(2); ++ ++--connection node_3 ++STOP SLAVE; ++--disable_query_log ++--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$NODE_MYPORT_2, MASTER_AUTO_POSITION=1; ++--enable_query_log ++START SLAVE USER='root'; ++ ++--connection node_1 ++INSERT INTO t1 VALUES(3); ++ ++--connection node_2 ++INSERT INTO t1 VALUES(4); ++ ++--connection node_3 ++--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'; ++--source include/wait_condition.inc ++ ++--let $wait_condition = SELECT COUNT(*) = 4 FROM t1; ++--source include/wait_condition.inc ++ ++--connection node_1 ++DROP TABLE t1; ++ ++--connection node_3 ++--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'; ++--source include/wait_condition.inc ++ ++STOP SLAVE; ++RESET SLAVE ALL; +diff --git a/mysql-test/suite/galera/t/galera_as_slave.cnf b/mysql-test/suite/galera/t/galera_as_slave.cnf +new file mode 100644 +index 0000000..9449ec9 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_as_slave.cnf +@@ -0,0 +1 @@ ++!include ../galera_2nodes_as_slave.cnf +diff --git a/mysql-test/suite/galera/t/galera_as_slave.test b/mysql-test/suite/galera/t/galera_as_slave.test +new file mode 100644 +index 0000000..0f899fd +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_as_slave.test +@@ -0,0 +1,48 @@ ++# ++# Test Galera as a slave to a MySQL master ++# ++# The galera/galera_2node_slave.cnf describes the setup of the nodes ++# ++ ++--source include/have_innodb.inc ++--source include/have_log_bin.inc ++ ++# As node #1 is not a Galera node, we connect to node #2 in order to run include/galera_cluster.inc ++--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2 ++--source include/galera_cluster.inc ++ ++--connection node_2 ++--disable_query_log ++--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$NODE_MYPORT_1; ++--enable_query_log ++START SLAVE USER='root'; ++ ++--connection node_1 ++CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; ++INSERT INTO t1 VALUES(1); ++ ++--connection node_2 ++--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'; ++--source include/wait_condition.inc ++ ++--let $wait_condition = SELECT COUNT(*) = 1 FROM t1; ++--source include/wait_condition.inc ++ ++INSERT INTO t1 VALUES (2); ++ ++--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 ++SELECT COUNT(*) = 2 FROM t1; ++INSERT INTO t1 VALUES (3); ++ ++--connection node_2 ++SELECT COUNT(*) = 3 FROM t1; ++ ++--connection node_1 ++DROP TABLE t1; ++ ++--connection node_2 ++--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'; ++--source include/wait_condition.inc ++ ++STOP SLAVE; ++RESET SLAVE ALL; +diff --git a/mysql-test/suite/galera/t/galera_as_slave_gtid.cnf b/mysql-test/suite/galera/t/galera_as_slave_gtid.cnf +new file mode 100644 +index 0000000..92f6a16 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_as_slave_gtid.cnf +@@ -0,0 +1,8 @@ ++!include ../galera_2nodes_as_slave.cnf ++ ++[mysqld] ++gtid-mode=ON ++log-bin=mysqld-bin ++log-slave-updates ++enforce-gtid-consistency ++binlog-format=ROW +diff --git a/mysql-test/suite/galera/t/galera_as_slave_gtid.test b/mysql-test/suite/galera/t/galera_as_slave_gtid.test +new file mode 100644 +index 0000000..02fe5f7 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_as_slave_gtid.test +@@ -0,0 +1,68 @@ ++# ++# Test Galera as a slave to a MySQL master using GTIDs ++# ++# suite/galera/galera_2nodes_as_slave.cnf describes the setup of the nodes ++# suite/galera/t/galera_as_slave_gtid.cnf has the GTID options ++# ++# In addition to performing DDL and DML, we check that the gtid of the master is preserved inside the cluster ++# ++ ++--source include/have_innodb.inc ++--source include/have_log_bin.inc ++ ++# As node #1 is not a Galera node, we connect to node #2 in order to run include/galera_cluster.inc ++--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2 ++--source include/galera_cluster.inc ++ ++--connection node_2 ++--disable_query_log ++--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$NODE_MYPORT_1; ++--enable_query_log ++START SLAVE USER='root'; ++ ++--connection node_1 ++CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; ++INSERT INTO t1 VALUES(1); ++ ++SELECT LENGTH(@@global.gtid_executed) > 1; ++--let $gtid_executed_node1 = `SELECT @@global.gtid_executed;` ++ ++--connection node_2 ++--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'; ++--source include/wait_condition.inc ++ ++--let $wait_condition = SELECT COUNT(*) = 1 FROM t1; ++--source include/wait_condition.inc ++ ++--disable_query_log ++--eval SELECT '$gtid_executed_node1' = @@global.gtid_executed AS gtid_executed_equal; ++--enable_query_log ++ ++--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 ++SELECT COUNT(*) = 1 FROM t1; ++ ++--disable_query_log ++--eval SELECT '$gtid_executed_node1' = @@global.gtid_executed AS gtid_executed_equal; ++--enable_query_log ++ ++--connection node_1 ++DROP TABLE t1; ++ ++# ++# Unfortunately without the sleep below the following statement fails with "query returned no rows", which ++# is difficult to understand given that it is an aggregate query. A "query execution was interrupted" ++# warning is also reported by MTR, which is also weird. ++# ++ ++--sleep 1 ++ ++--connection node_3 ++--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'; ++--source include/wait_condition.inc ++ ++--connection node_2 ++--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'; ++--source include/wait_condition.inc ++ ++STOP SLAVE; ++RESET SLAVE ALL; +diff --git a/mysql-test/suite/galera/t/galera_bf_abort.test b/mysql-test/suite/galera/t/galera_bf_abort.test +new file mode 100644 +index 0000000..69825ea +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_bf_abort.test +@@ -0,0 +1,29 @@ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++# ++# Test a local transaction being aborted by a slave one ++# ++ ++CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; ++ ++--connection node_2 ++--let $wsrep_local_bf_aborts_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_bf_aborts'` ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES (1); ++ ++--connection node_1 ++INSERT INTO t1 VALUES (1); ++ ++--connection node_2 ++--error ER_LOCK_DEADLOCK ++INSERT INTO t1 VALUES (2); ++ ++--let $wsrep_local_bf_aborts_after = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_bf_aborts'` ++ ++--disable_query_log ++--eval SELECT $wsrep_local_bf_aborts_after - $wsrep_local_bf_aborts_before = 1 AS wsrep_local_aborts_increment; ++--enable_query_log ++ ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/t/galera_bf_abort_for_update.test b/mysql-test/suite/galera/t/galera_bf_abort_for_update.test +new file mode 100644 +index 0000000..24c2977 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_bf_abort_for_update.test +@@ -0,0 +1,29 @@ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++# ++# Test a local transaction being aborted by a slave one while it is running a SELECT FOR UPDATE ++# ++ ++CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; ++ ++--connection node_2 ++--let $wsrep_local_bf_aborts_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_bf_aborts'` ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES (1); ++ ++--connection node_1 ++INSERT INTO t1 VALUES (1); ++ ++--connection node_2 ++--error ER_LOCK_DEADLOCK ++SELECT * FROM t1 FOR UPDATE; ++ ++--let $wsrep_local_bf_aborts_after = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_bf_aborts'` ++ ++--disable_query_log ++--eval SELECT $wsrep_local_bf_aborts_after - $wsrep_local_bf_aborts_before = 1 AS wsrep_local_aborts_increment; ++--enable_query_log ++ ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/t/galera_bf_abort_ftwrl.test b/mysql-test/suite/galera/t/galera_bf_abort_ftwrl.test +new file mode 100644 +index 0000000..44398e7 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_bf_abort_ftwrl.test +@@ -0,0 +1,30 @@ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++# ++# A local transaction running FLUSH TABLES WITH READ LOCK will not be aborted by a slave transaction ++# ++ ++CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; ++ ++--connection node_2 ++SET AUTOCOMMIT=OFF; ++--let $wsrep_local_bf_aborts_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_bf_aborts'` ++--send FLUSH TABLES WITH READ LOCK; ++ ++--connection node_1 ++INSERT INTO t1 VALUES (1); ++ ++--connection node_2 ++--reap ++ ++UNLOCK TABLES; ++ ++--let $wsrep_local_bf_aborts_after = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_bf_aborts'` ++ ++# No aborts should be registered on the counter ++--disable_query_log ++--eval SELECT $wsrep_local_bf_aborts_after - $wsrep_local_bf_aborts_before = 0 AS wsrep_local_aborts_increment; ++--enable_query_log ++ ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/t/galera_bf_abort_get_lock.test b/mysql-test/suite/galera/t/galera_bf_abort_get_lock.test +new file mode 100644 +index 0000000..72fc1c5 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_bf_abort_get_lock.test +@@ -0,0 +1,36 @@ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++# ++# Test a local transaction being aborted by a slave one while it is running a GET_LOCK() ++# ++ ++CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; ++ ++--let $galera_connection_name = node_2a ++--let $galera_server_number = 2 ++--source include/galera_connect.inc ++--connection node_2a ++SELECT GET_LOCK("foo", 1000); ++ ++--connection node_2 ++SET AUTOCOMMIT=OFF; ++--let $wsrep_local_bf_aborts_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_bf_aborts'` ++INSERT INTO t1 VALUES (1); ++--send SELECT GET_LOCK("foo", 1000); ++ ++--connection node_1 ++INSERT INTO t1 VALUES (1); ++ ++--connection node_2 ++--error ER_LOCK_DEADLOCK ++--reap ++ ++--let $wsrep_local_bf_aborts_after = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_bf_aborts'` ++ ++# Check that wsrep_local_bf_aborts has been incremented by exactly 1 ++--disable_query_log ++--eval SELECT $wsrep_local_bf_aborts_after - $wsrep_local_bf_aborts_before = 1 AS wsrep_local_aborts_increment; ++--enable_query_log ++ ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/t/galera_bf_abort_lock_table.test b/mysql-test/suite/galera/t/galera_bf_abort_lock_table.test +new file mode 100644 +index 0000000..7884271 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_bf_abort_lock_table.test +@@ -0,0 +1,33 @@ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++# ++# Test that a local LOCK TABLE will be broken by an incoming remote transaction against that table ++# ++ ++CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; ++ ++--connection node_2 ++SET AUTOCOMMIT=OFF; ++--let $wsrep_local_bf_aborts_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_bf_aborts'` ++LOCK TABLE t1 WRITE; ++ ++# Issue a concurrent INSERT against the lock table that will block ++--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2 ++--send INSERT INTO t1 VALUES (1); ++ ++--connection node_1 ++INSERT INTO t1 VALUES (2); ++ ++# The concurent insert is allowed to complete because the LOCK TABLE is now broken ++--connection node_2a ++--error 0 ++--reap ++ ++--let $wsrep_local_bf_aborts_after = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_bf_aborts'` ++ ++--disable_query_log ++--eval SELECT $wsrep_local_bf_aborts_after - $wsrep_local_bf_aborts_before = 1 AS wsrep_local_aborts_increment; ++--enable_query_log ++ ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/t/galera_bf_abort_sleep.test b/mysql-test/suite/galera/t/galera_bf_abort_sleep.test +new file mode 100644 +index 0000000..8d135dc +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_bf_abort_sleep.test +@@ -0,0 +1,30 @@ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++# ++# Test a local transaction being aborted by a slave one while it is running a SLEEP() ++# ++ ++CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; ++ ++--connection node_2 ++SET AUTOCOMMIT=OFF; ++--let $wsrep_local_bf_aborts_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_bf_aborts'` ++INSERT INTO t1 VALUES (1); ++--send SELECT SLEEP(1000); ++ ++--connection node_1 ++INSERT INTO t1 VALUES (1); ++ ++--connection node_2 ++--error ER_LOCK_DEADLOCK ++--reap ++ ++--let $wsrep_local_bf_aborts_after = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_bf_aborts'` ++ ++# Check that wsrep_local_bf_aborts has been incremented by exactly 1 ++--disable_query_log ++--eval SELECT $wsrep_local_bf_aborts_after - $wsrep_local_bf_aborts_before = 1 AS wsrep_local_aborts_increment; ++--enable_query_log ++ ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/t/galera_binlog_cache_size.test b/mysql-test/suite/galera/t/galera_binlog_cache_size.test +new file mode 100644 +index 0000000..6ce9072 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_binlog_cache_size.test +@@ -0,0 +1,35 @@ ++# ++# Test that Galera, like the stock MySQL, returns an error on transactions ++# larger than max_binlog_cache_size ++# ++ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++CREATE TABLE t1 (f1 VARCHAR(767)) ENGINE=InnoDB; ++CREATE TABLE ten (f1 INTEGER); ++INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); ++ ++--let $max_binlog_cache_size_orig = `SELECT @@max_binlog_cache_size` ++--let $binlog_cache_size_orig = `SELECT @@binlog_cache_size` ++ ++SET GLOBAL binlog_cache_size=4096; ++SET GLOBAL max_binlog_cache_size=4096; ++ ++--let $galera_connection_name = node_1a ++--let $galera_server_number = 1 ++--source include/galera_connect.inc ++--connection node_1a ++SET AUTOCOMMIT=ON; ++START TRANSACTION; ++INSERT INTO t1 SELECT REPEAT('a', 767) FROM ten; ++--error ER_TRANS_CACHE_FULL ++INSERT INTO t1 SELECT REPEAT('a', 767) FROM ten; ++ ++--disable_query_log ++--eval SET GLOBAL max_binlog_cache_size = $max_binlog_cache_size_orig ++--eval SET GLOBAL binlog_cache_size = $binlog_cache_size_orig ++--enable_query_log ++ ++DROP TABLE t1; ++DROP TABLE ten; +diff --git a/mysql-test/suite/galera/t/galera_binlog_checksum-master.opt b/mysql-test/suite/galera/t/galera_binlog_checksum-master.opt +new file mode 100644 +index 0000000..c8e53f0 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_binlog_checksum-master.opt +@@ -0,0 +1 @@ ++--binlog-checksum=CRC32 --master-verify-checksum=1 --slave-sql-verify-checksum=1 +diff --git a/mysql-test/suite/galera/t/galera_binlog_checksum.test b/mysql-test/suite/galera/t/galera_binlog_checksum.test +new file mode 100644 +index 0000000..4866930 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_binlog_checksum.test +@@ -0,0 +1,22 @@ ++# ++# Test that Galera works with binary log checksums. ++# The galera_binlog_checksum-master.opt file is used to enable checksums. ++# ++ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++CREATE TABLE t1 (f1 INT PRIMARY KEY) ENGINE=InnoDB; ++ ++INSERT INTO t1 VALUES (1); ++ ++--connection node_2 ++SELECT COUNT(*) = 1 FROM t1; ++ ++--connection node_1 ++UPDATE t1 SET f1 = 2 WHERE f1 = 1; ++ ++--connection node_2 ++SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2; ++ ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/t/galera_binlog_event_max_size_max-master.opt b/mysql-test/suite/galera/t/galera_binlog_event_max_size_max-master.opt +new file mode 100644 +index 0000000..a36d213 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_binlog_event_max_size_max-master.opt +@@ -0,0 +1 @@ ++--binlog-row-event-max-size=4294967295 +diff --git a/mysql-test/suite/galera/t/galera_binlog_event_max_size_max.test b/mysql-test/suite/galera/t/galera_binlog_event_max_size_max.test +new file mode 100644 +index 0000000..600432c +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_binlog_event_max_size_max.test +@@ -0,0 +1,20 @@ ++# ++# Test that replication works event with the maximum value of binlog-row-event-max-size - 4294967295 (on 32-bit platforms) ++# ++ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++CREATE TABLE ten (f1 INTEGER); ++INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); ++ ++CREATE TABLE t1 (f1 VARCHAR(1000)); ++ ++# Insert 10K records, 1K bytes each ++INSERT INTO t1 SELECT REPEAT('x', 1000) FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4; ++ ++--connection node_2 ++SELECT COUNT(*) = 10000 FROM t1; ++ ++DROP TABLE t1; ++DROP TABLE ten; +diff --git a/mysql-test/suite/galera/t/galera_binlog_event_max_size_min-master.opt b/mysql-test/suite/galera/t/galera_binlog_event_max_size_min-master.opt +new file mode 100644 +index 0000000..2217475 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_binlog_event_max_size_min-master.opt +@@ -0,0 +1 @@ ++--binlog-row-event-max-size=256 +diff --git a/mysql-test/suite/galera/t/galera_binlog_event_max_size_min.test b/mysql-test/suite/galera/t/galera_binlog_event_max_size_min.test +new file mode 100644 +index 0000000..00b5533 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_binlog_event_max_size_min.test +@@ -0,0 +1,15 @@ ++# ++# Test that replication works event with the minimum value of binlog-row-event-max-size - 256 ++# ++ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++CREATE TABLE t1 (f1 VARCHAR(1000)); ++INSERT INTO t1 VALUES (REPEAT('x', 1000)); ++ ++--connection node_2 ++SELECT COUNT(*) = 1 FROM t1 WHERE f1 = REPEAT('x', 1000); ++ ++DROP TABLE t1; ++ +diff --git a/mysql-test/suite/galera/t/galera_binlog_row_image.test b/mysql-test/suite/galera/t/galera_binlog_row_image.test +new file mode 100644 +index 0000000..70262ec +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_binlog_row_image.test +@@ -0,0 +1,100 @@ ++# ++# Test the operation on the different values of the binlog_row_image option ++# ++ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++# ++# binlog_row_image = minimal ++# ++ ++--connection node_1 ++SET SESSION binlog_row_image=minimal; ++ ++# Create a table with a PK, with a unique key and with no key ++CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; ++CREATE TABLE t2 (f1 INTEGER NOT NULL UNIQUE) ENGINE=InnoDB; ++CREATE TABLE t3 (f1 VARCHAR(1)) ENGINE=InnoDB; ++ ++INSERT INTO t1 VALUES (1); ++INSERT INTO t2 VALUES (1); ++INSERT INTO t3 VALUES (1); ++ ++--connection node_2 ++SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1; ++SELECT COUNT(*) = 1 FROM t2 WHERE f1 = 1; ++SELECT COUNT(*) = 1 FROM t3 WHERE f1 = 1; ++ ++--connection node_1 ++UPDATE t1 SET f1 = 2 WHERE f1 = 1; ++UPDATE t2 SET f1 = 2 WHERE f1 = 1; ++UPDATE t3 SET f1 = 2 WHERE f1 = 1; ++ ++--connection node_2 ++SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2; ++SELECT COUNT(*) = 1 FROM t2 WHERE f1 = 2; ++SELECT COUNT(*) = 1 FROM t3 WHERE f1 = 2; ++ ++--connection node_1 ++DELETE FROM t1; ++DELETE FROM t2; ++DELETE FROM t3; ++ ++--connection node_2 ++SELECT COUNT(*) = 0 FROM t1; ++SELECT COUNT(*) = 0 FROM t2; ++SELECT COUNT(*) = 0 FROM t3; ++ ++DROP TABLE t1; ++DROP TABLE t2; ++DROP TABLE t3; ++ ++# ++# binlog_row_image = noblob ++# ++ ++# A table with only a blob, and a table with a PK and a blob ++ ++--connection node_1 ++SET SESSION binlog_row_image=noblob; ++ ++CREATE TABLE t1 (f1 BLOB, f2 INTEGER PRIMARY KEY) ENGINE=InnoDB; ++CREATE TABLE t2 (f1 BLOB) ENGINE=InnoDB; ++ ++INSERT INTO t1 VALUES ('abc', 1); ++INSERT INTO t2 VALUES ('abc'); ++ ++--connection node_2 ++SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 'abc'; ++SELECT COUNT(*) = 1 FROM t2 WHERE f1 = 'abc'; ++ ++--connection node_1 ++UPDATE t1 SET f1 = 'xyz'; ++UPDATE t2 SET f1 = 'xyz'; ++ ++--connection node_2 ++SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 'xyz'; ++SELECT COUNT(*) = 1 FROM t2 WHERE f1 = 'xyz'; ++ ++--connection node_1 ++UPDATE t1 SET f2 = 2 WHERE f2 = 1; ++ ++--connection node_2 ++SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 2; ++SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 'xyz'; ++ ++--connection node_1 ++DELETE FROM t1; ++DELETE FROM t2; ++ ++--connection node_2 ++SELECT COUNT(*) = 0 FROM t1; ++SELECT COUNT(*) = 0 FROM t2; ++ ++DROP TABLE t1; ++DROP TABLE t2; ++ ++ ++ ++ +diff --git a/mysql-test/suite/galera/t/galera_binlog_rows_query_log_events.test b/mysql-test/suite/galera/t/galera_binlog_rows_query_log_events.test +new file mode 100644 +index 0000000..95bc85c +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_binlog_rows_query_log_events.test +@@ -0,0 +1,28 @@ ++# ++# Test that Galera continues to run even with binlog-rows-query-log-events=TRUE ++# ++ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++--let $binlog_rows_query_log_events_orig = `SELECT @@binlog_rows_query_log_events` ++ ++SET GLOBAL binlog_rows_query_log_events=TRUE; ++ ++CREATE TABLE t1 (f1 INT PRIMARY KEY) ENGINE=InnoDB; ++ ++INSERT INTO t1 VALUES (1); ++ ++--connection node_2 ++SELECT COUNT(*) = 1 FROM t1; ++ ++--connection node_1 ++UPDATE t1 SET f1 = 2 WHERE f1 = 1; ++ ++--connection node_2 ++SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2; ++ ++--connection node_1 ++--eval SET GLOBAL binlog_rows_query_log_events = $binlog_rows_query_log_events_orig ++ ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/t/galera_create_function.test b/mysql-test/suite/galera/t/galera_create_function.test +new file mode 100644 +index 0000000..fd4903a +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_create_function.test +@@ -0,0 +1,57 @@ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++# ++# Test CREATE FUNCTION ++# ++ ++--connection node_1 ++CREATE USER 'user1'; ++ ++CREATE ++DEFINER = 'user1' ++FUNCTION f1 (param INTEGER) ++RETURNS VARCHAR(200) ++COMMENT 'f1_comment' ++LANGUAGE SQL ++NOT DETERMINISTIC ++MODIFIES SQL DATA ++SQL SECURITY DEFINER ++RETURN 'abc'; ++GRANT EXECUTE ON FUNCTION f1 TO user1; ++ ++CREATE ++DEFINER = CURRENT_USER ++FUNCTION f2 (param VARCHAR(100)) ++RETURNS INTEGER ++DETERMINISTIC ++NO SQL ++SQL SECURITY INVOKER ++RETURN 123; ++ ++--connection node_1 ++SHOW CREATE FUNCTION f1; ++ ++--connection node_2 ++SHOW CREATE FUNCTION f1; ++ ++--connection node_1 ++SHOW CREATE FUNCTION f2; ++ ++--connection node_2 ++SHOW CREATE FUNCTION f2; ++ ++SELECT f1(1) = 'abc'; ++SELECT f2('abc') = 123; ++ ++--connection node_1 ++DROP FUNCTION f1; ++DROP FUNCTION f2; ++ ++DROP USER 'user1'; ++ ++ ++ ++ ++ ++ +diff --git a/mysql-test/suite/galera/t/galera_create_procedure.test b/mysql-test/suite/galera/t/galera_create_procedure.test +new file mode 100644 +index 0000000..30bc85f +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_create_procedure.test +@@ -0,0 +1,52 @@ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++# ++# Test CREATE PROCEDURE ++# ++ ++--connection node_1 ++CREATE USER 'user1'; ++CREATE TABLE t1 (f1 INTEGER); ++ ++CREATE ++DEFINER = 'user1' ++PROCEDURE p1 (IN param1 INTEGER, OUT param2 INTEGER, INOUT param3 INTEGER) ++COMMENT 'p1_comment' ++LANGUAGE SQL ++NOT DETERMINISTIC ++MODIFIES SQL DATA ++SQL SECURITY DEFINER ++INSERT INTO t1 VALUES (1); ++GRANT EXECUTE ON PROCEDURE p1 TO user1; ++ ++CREATE ++DEFINER = CURRENT_USER ++PROCEDURE p2 (param VARCHAR(100)) ++DETERMINISTIC ++NO SQL ++SQL SECURITY INVOKER BEGIN END ; ++ ++--connection node_1 ++SHOW CREATE PROCEDURE p1; ++ ++--connection node_2 ++# Perform causal wait ++SELECT 1 FROM DUAL; ++SHOW CREATE PROCEDURE p1; ++ ++--connection node_1 ++SHOW CREATE PROCEDURE p2; ++ ++--connection node_2 ++SHOW CREATE PROCEDURE p2; ++ ++CALL p1(@a, @b, @c); ++CALL p2('abc'); ++ ++--connection node_1 ++DROP PROCEDURE p1; ++DROP PROCEDURE p2; ++ ++DROP USER 'user1'; ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/t/galera_create_table_like.test b/mysql-test/suite/galera/t/galera_create_table_like.test +new file mode 100644 +index 0000000..0e0e8b0 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_create_table_like.test +@@ -0,0 +1,50 @@ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++# ++# Test the various forms of CREATE TABLE LIKE ... , since Galera has special handling ++# for them, especially when one of the tables is a temporary one. ++# ++ ++CREATE SCHEMA schema1; ++CREATE SCHEMA schema2; ++ ++USE schema1; ++CREATE TABLE real_table (f1 INTEGER) ENGINE=InnoDB; ++CREATE TEMPORARY TABLE temp_table (f1 INTEGER) ENGINE=InnoDB; ++CREATE TABLE myisam_table (f1 INTEGER) ENGINE=MyISAM; ++ ++USE schema2; ++CREATE TABLE real_table1 LIKE schema1.real_table; ++CREATE TABLE real_table2 LIKE schema1.temp_table; ++CREATE TABLE real_table3 LIKE schema1.myisam_table; ++ ++CREATE TEMPORARY TABLE temp_table1 LIKE schema1.real_table; ++CREATE TEMPORARY TABLE temp_table2 LIKE schema1.temp_table; ++CREATE TEMPORARY TABLE temp_table3 LIKE schema1.myisam_table; ++ ++--connection node_2 ++# Only the non-temporary tables are replicated, regardless of the type of table they are based on ++ ++SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'real_table' AND TABLE_SCHEMA = 'schema1'; ++SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'myisam_table' AND TABLE_SCHEMA = 'schema1'; ++SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'temp_table' AND TABLE_SCHEMA = 'schema1'; ++ ++SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'real_table1' AND TABLE_SCHEMA = 'schema2'; ++SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'real_table2' AND TABLE_SCHEMA = 'schema2'; ++SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'real_table3' AND TABLE_SCHEMA = 'schema2'; ++ ++SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'temp_table1' AND TABLE_SCHEMA = 'schema2'; ++SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'temp_table2' AND TABLE_SCHEMA = 'schema2'; ++SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'temp_table3' AND TABLE_SCHEMA = 'schema2'; ++ ++--connection node_1 ++DROP TABLE schema1.real_table; ++DROP TABLE schema1.myisam_table; ++ ++DROP TABLE schema2.real_table1; ++DROP TABLE schema2.real_table2; ++DROP TABLE schema2.real_table3; ++ ++DROP SCHEMA schema1; ++DROP SCHEMA schema2; +diff --git a/mysql-test/suite/galera/t/galera_create_trigger.test b/mysql-test/suite/galera/t/galera_create_trigger.test +new file mode 100644 +index 0000000..74dc616 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_create_trigger.test +@@ -0,0 +1,48 @@ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++# ++# Test CREATE TRIGGER, especially with different DEFINER ++# ++ ++CREATE TABLE definer_root (f1 INTEGER, trigger_user VARCHAR(100)) ENGINE=InnoDB; ++CREATE TABLE definer_user (f1 INTEGER, trigger_user VARCHAR(100)) ENGINE=InnoDB; ++CREATE TABLE definer_current_user (f1 INTEGER, trigger_user VARCHAR(100)) ENGINE=InnoDB; ++CREATE TABLE definer_default (f1 INTEGER, trigger_user VARCHAR(100)) ENGINE=InnoDB; ++ ++CREATE USER 'user1'; ++CREATE DEFINER=root@localhost TRIGGER definer_root BEFORE INSERT ON definer_root FOR EACH ROW SET NEW.trigger_user = CURRENT_USER(); ++CREATE DEFINER=user1 TRIGGER definer_user BEFORE INSERT ON definer_user FOR EACH ROW SET NEW.trigger_user = CURRENT_USER(); ++CREATE DEFINER=current_user TRIGGER definer_current_user BEFORE INSERT ON definer_current_user FOR EACH ROW SET NEW.trigger_user = CURRENT_USER(); ++CREATE TRIGGER definer_default BEFORE INSERT ON definer_default FOR EACH ROW SET NEW.trigger_user = CURRENT_USER(); ++ ++--connection node_2 ++INSERT INTO definer_root (f1) VALUES (1); ++SELECT DEFINER = 'root@localhost' FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME = 'definer_root'; ++SELECT trigger_user = 'root@localhost' FROM definer_root; ++ ++INSERT INTO definer_user (f1) VALUES (1); ++SELECT DEFINER = 'user1@%' FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME = 'definer_user'; ++SELECT trigger_user = 'user1@%' FROM definer_user; ++ ++INSERT INTO definer_current_user (f1) VALUES (1); ++SELECT DEFINER = 'root@localhost' FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME = 'definer_current_user'; ++SELECT trigger_user = 'root@localhost' FROM definer_current_user; ++ ++INSERT INTO definer_default (f1) VALUES (1); ++SELECT DEFINER = 'root@localhost' FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME = 'definer_default'; ++SELECT trigger_user = 'root@localhost' FROM definer_default; ++ ++--connection node_1 ++DROP TABLE definer_current_user; ++DROP TABLE definer_user; ++DROP TABLE definer_root; ++DROP TABLE definer_default; ++ ++DROP USER 'user1'; ++ ++ ++ ++ ++ ++ +diff --git a/mysql-test/suite/galera/t/galera_defaults.test b/mysql-test/suite/galera/t/galera_defaults.test +new file mode 100644 +index 0000000..25d85b7 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_defaults.test +@@ -0,0 +1,63 @@ ++# ++# The purpose of this test is to preserve the current state of the following: ++# * SHOW VARIABLES LIKE 'wsrep%' ++# * wsrep_provider_options ++# * The names of the Galera status variables ++# ++# This way, if there is any change, inadvertent or not, the test will fail and the ++# developer and QA will be alerted. ++# ++ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++# Global Variables ++ ++SELECT COUNT(*) = 40 FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME LIKE 'wsrep_%'; ++ ++SELECT VARIABLE_NAME, VARIABLE_VALUE ++FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES ++WHERE VARIABLE_NAME LIKE 'wsrep_%' ++AND VARIABLE_NAME NOT IN ( ++ 'WSREP_PROVIDER_OPTIONS', ++ 'WSREP_SST_RECEIVE_ADDRESS', ++ 'WSREP_NODE_ADDRESS', ++ 'WSREP_NODE_NAME', ++ 'WSREP_PROVIDER', ++ 'WSREP_DATA_HOME_DIR', ++ 'WSREP_NODE_INCOMING_ADDRESS', ++ 'WSREP_START_POSITION' ++) ++ORDER BY VARIABLE_NAME; ++ ++# wsrep_provider_options ++# ++# We replace the ones that vary from run to run with placeholders ++ ++--let _WSREP_PROVIDER_OPTIONS = `SELECT @@wsrep_provider_options` ++--perl ++ use strict; ++ my $wsrep_provider_options = $ENV{'_WSREP_PROVIDER_OPTIONS'}; ++ $wsrep_provider_options =~ s/base_dir = .*?;/;/sgio; ++ $wsrep_provider_options =~ s/base_host = .*?;/;/sgio; ++ $wsrep_provider_options =~ s/base_port = .*?;/;/sgio; ++ $wsrep_provider_options =~ s/gcache\.dir = .*?;/;/sgio; ++ $wsrep_provider_options =~ s/gcache\.name = .*?;/;/sgio; ++ $wsrep_provider_options =~ s/gmcast\.listen_addr = .*?;/;/sgio; ++ $wsrep_provider_options =~ s/ist\.recv_addr = .*?;/;/sgio; ++ $wsrep_provider_options =~ s/evs\.evict = .*?;/;/sgio; ++ $wsrep_provider_options =~ s/signal = .*?;\s*//sgio; ++ $wsrep_provider_options =~ s/dbug = .*?;\s*//sgio; ++ print $wsrep_provider_options."\n"; ++EOF ++ ++# Global Status ++ ++SELECT COUNT(*) FROM INFORMATION_SCHEMA.GLOBAL_STATUS ++WHERE VARIABLE_NAME LIKE 'wsrep_%' ++AND VARIABLE_NAME != 'wsrep_debug_sync_waiters'; ++ ++SELECT VARIABLE_NAME FROM INFORMATION_SCHEMA.GLOBAL_STATUS ++WHERE VARIABLE_NAME LIKE 'wsrep_%' ++AND VARIABLE_NAME != 'wsrep_debug_sync_waiters' ++ORDER BY VARIABLE_NAME; +diff --git a/mysql-test/suite/galera/t/galera_delete_limit.test b/mysql-test/suite/galera/t/galera_delete_limit.test +new file mode 100644 +index 0000000..4cbadbd +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_delete_limit.test +@@ -0,0 +1,52 @@ ++# ++# DELETE LIMIT should not cause any issues with row-based Galera replication ++# regardless of the order in which the rows were deleted ++# ++ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++# ++# With a PK ++# ++ ++--connection node_1 ++CREATE TABLE ten (f1 INTEGER) Engine=InnoDB; ++INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); ++ ++CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) Engine=InnoDB; ++INSERT INTO t1 SELECT f1 FROM ten ORDER BY RAND(); ++ ++--connection node_2 ++DELETE FROM t1 ORDER BY RAND() LIMIT 5; ++--let $sum_remaining = `SELECT SUM(f1) FROM t1` ++--let $max_remaining = `SELECT MAX(f1) FROM t1` ++ ++--connection node_1 ++--disable_query_log ++--eval SELECT (SELECT SUM(f1) FROM t1) = $sum_remaining AS sum_matches; ++--eval SELECT f1 = $max_remaining AS max_matches FROM t1 WHERE f1 = $max_remaining; ++--enable_query_log ++ ++DROP TABLE t1; ++ ++# ++# Without a PK ++# ++ ++CREATE TABLE t2 (f1 INTEGER) Engine=InnoDB; ++INSERT INTO t2 SELECT f1 FROM ten ORDER BY RAND(); ++ ++--connection node_2 ++DELETE FROM t2 ORDER BY RAND() LIMIT 5; ++--let $sum_remaining = `SELECT SUM(f1) FROM t2` ++--let $max_remaining = `SELECT MAX(f1) FROM t2` ++ ++--connection node_1 ++--disable_query_log ++--eval SELECT (SELECT SUM(f1) FROM t2) = $sum_remaining AS sum_matches; ++--eval SELECT f1 = $max_remaining AS max_matches FROM t2 WHERE f1 = $max_remaining; ++--enable_query_log ++ ++DROP TABLE t2; ++DROP TABLE ten; +diff --git a/mysql-test/suite/galera/t/galera_enum.test b/mysql-test/suite/galera/t/galera_enum.test +new file mode 100644 +index 0000000..ff53324 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_enum.test +@@ -0,0 +1,62 @@ ++# ++# Test the ENUM column type, as it is frequently an unwanted child ++# ++ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++# ++# ENUM as key ++# ++ ++--connection node_1 ++CREATE TABLE t1 (f1 ENUM('', 'one', 'two'), KEY (f1)) ENGINE=InnoDB; ++ ++INSERT INTO t1 VALUES (''); ++INSERT INTO t1 VALUES ('one'), ('two'); ++INSERT INTO t1 VALUES (0), (1), (2); ++ ++--connection node_2 ++SELECT COUNT(*) = 6 FROM t1; ++SELECT COUNT(*) = 2 FROM t1 where f1 = ''; ++SELECT COUNT(*) = 2 FROM t1 where f1 = 'one'; ++ ++DROP TABLE t1; ++ ++# ++# ENUM as PK ++# ++ ++--connection node_1 ++CREATE TABLE t1 (f1 ENUM('', 'one', 'two', 'three', 'four') PRIMARY KEY) ENGINE=InnoDB; ++ ++INSERT INTO t1 VALUES (''), ('one'), ('two'); ++ ++--connection node_2 ++SELECT COUNT(*) = 3 FROM t1; ++SELECT COUNT(*) = 1 FROM t1 WHERE f1 = ''; ++ ++# Conflict ++ ++--connection node_1 ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++UPDATE t1 SET f1 = 'three' where f1 = ''; ++ ++--connection node_2 ++SET AUTOCOMMIt=OFF; ++START TRANSACTION; ++UPDATE t1 SET f1 = 'four' where f1 = ''; ++ ++--connection node_1 ++COMMIT; ++ ++--connection node_2 ++--error ER_LOCK_DEADLOCK ++COMMIT; ++ ++--connection node_1 ++ ++SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 'three'; ++ ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/t/galera_events.test b/mysql-test/suite/galera/t/galera_events.test +new file mode 100644 +index 0000000..ae9940f +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_events.test +@@ -0,0 +1,53 @@ ++# ++# Test that the replication of MySQL events conforms to the behavior of stock MySQL replication as described here ++# http://dev.mysql.com/doc/refman/5.6/en/replication-features-invoked.html ++# ++ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++--let $event_scheduler_orig = `SELECT @@event_scheduler;` ++ ++# ++# Events arrive on slave as SLAVESIDE_DISABLED ++# ++ ++--connection node_1 ++CREATE EVENT event1 ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO SELECT 1; ++ ++--connection node_2 ++SELECT DEFINER= 'root@localhost', ORIGINATOR = 1, STATUS = 'SLAVESIDE_DISABLED', EVENT_TYPE = 'ONE TIME', ON_COMPLETION = 'NOT PRESERVE' FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME = 'event1'; ++ ++--connection node_1 ++ALTER EVENT event1 DISABLE; ++ ++--connection node_2 ++# The definition on node 2 should still say SLAVESIDE_DISABLED ++SELECT DEFINER= 'root@localhost', ORIGINATOR = 1, STATUS = 'SLAVESIDE_DISABLED', EVENT_TYPE = 'ONE TIME', ON_COMPLETION = 'NOT PRESERVE' FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME = 'event1'; ++ ++# ++# Expired event should be dropped from the slave ++# ++ ++--connection node_2 ++SET GLOBAL event_scheduler = ON; ++CREATE EVENT event2 ON SCHEDULE AT CURRENT_TIMESTAMP ON COMPLETION NOT PRESERVE DO SELECT 1; ++--sleep 1 ++ ++--connection node_1 ++SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME = 'event2'; ++ ++# ++# DROP EVENT causes event to be dropped everywhere ++# ++ ++--connection node_1 ++DROP EVENT event1; ++ ++--connection node_2 ++SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME = 'event1'; ++ ++# Cleanup ++ ++--connection node_2 ++--eval SET GLOBAL event_scheduler = $event_scheduler_orig; +diff --git a/mysql-test/suite/galera/t/galera_fk_cascade_delete.test b/mysql-test/suite/galera/t/galera_fk_cascade_delete.test +new file mode 100644 +index 0000000..9b79b4c +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_fk_cascade_delete.test +@@ -0,0 +1,41 @@ ++# ++# Test Foreign Key Cascading DELETEs ++# ++ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++CREATE TABLE grandparent ( ++ id INT NOT NULL PRIMARY KEY ++) ENGINE=InnoDB; ++ ++CREATE TABLE parent ( ++ id INT NOT NULL PRIMARY KEY, ++ grandparent_id INT, ++ FOREIGN KEY (grandparent_id) ++ REFERENCES grandparent(id) ++ ON DELETE CASCADE ++) ENGINE=InnoDB; ++ ++CREATE TABLE child ( ++ id INT NOT NULL PRIMARY KEY, ++ parent_id INT, ++ FOREIGN KEY (parent_id) ++ REFERENCES parent(id) ++ ON DELETE CASCADE ++) ENGINE=InnoDB; ++ ++INSERT INTO grandparent VALUES (1),(2); ++INSERT INTO parent VALUES (1,1), (2,2); ++INSERT INTO child VALUES (1,1), (2,2); ++ ++--connection node_2 ++DELETE FROM grandparent WHERE id = 1; ++ ++--connection node_1 ++SELECT COUNT(*) = 0 FROM parent WHERE grandparent_id = 1; ++SELECT COUNT(*) = 0 FROM child WHERE parent_id = 1; ++ ++DROP TABLE child; ++DROP TABLE parent; ++DROP TABLE grandparent; +diff --git a/mysql-test/suite/galera/t/galera_fk_cascade_update.test b/mysql-test/suite/galera/t/galera_fk_cascade_update.test +new file mode 100644 +index 0000000..e736803 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_fk_cascade_update.test +@@ -0,0 +1,41 @@ ++# ++# Test Foreign Key Cascading UPDATEs ++# ++ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++CREATE TABLE grandparent ( ++ id INT NOT NULL PRIMARY KEY ++) ENGINE=InnoDB; ++ ++CREATE TABLE parent ( ++ id INT NOT NULL PRIMARY KEY, ++ grandparent_id INT, ++ FOREIGN KEY (grandparent_id) ++ REFERENCES grandparent(id) ++ ON UPDATE CASCADE ++) ENGINE=InnoDB; ++ ++CREATE TABLE child ( ++ id INT NOT NULL PRIMARY KEY, ++ grandparent_id INT, ++ FOREIGN KEY (grandparent_id) ++ REFERENCES parent(grandparent_id) ++ ON UPDATE CASCADE ++) ENGINE=InnoDB; ++ ++INSERT INTO grandparent VALUES (1),(2); ++INSERT INTO parent VALUES (1,1), (2,2); ++INSERT INTO child VALUES (1,1), (2,2); ++ ++--connection node_2 ++UPDATE grandparent SET id = 3 WHERE id = 1; ++ ++--connection node_1 ++SELECT COUNT(*) = 1 FROM parent WHERE grandparent_id = 3; ++SELECT COUNT(*) = 1 FROM child WHERE grandparent_id = 3; ++ ++DROP TABLE child; ++DROP TABLE parent; ++DROP TABLE grandparent; +diff --git a/mysql-test/suite/galera/t/galera_fk_conflict.test b/mysql-test/suite/galera/t/galera_fk_conflict.test +new file mode 100644 +index 0000000..cb6f95e +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_fk_conflict.test +@@ -0,0 +1,41 @@ ++# ++# Test two transactions on separate nodes which conflict on a FK ++# ++ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++CREATE TABLE parent ( ++ id INT PRIMARY KEY, ++ KEY (id) ++) ENGINE=InnoDB; ++ ++CREATE TABLE child ( ++ id INT PRIMARY KEY, ++ parent_id INT, ++ FOREIGN KEY (parent_id) ++ REFERENCES parent(id) ++) ENGINE=InnoDB; ++ ++INSERT INTO parent VALUES (1), (2); ++INSERT INTO child VALUES (1,1); ++ ++--connection node_1 ++SET AUTOCOMMIT = OFF; ++START TRANSACTION; ++DELETE FROM parent WHERE id = 2; ++ ++--connection node_2 ++SET AUTOCOMMIT = OFF; ++START TRANSACTION; ++INSERT INTO child VALUES (2, 2); ++ ++--connection node_1 ++COMMIT; ++ ++--connection node_2 ++--error ER_LOCK_DEADLOCK ++COMMIT; ++ ++DROP TABLE child; ++DROP TABLE parent; +diff --git a/mysql-test/suite/galera/t/galera_fk_mismatch.test b/mysql-test/suite/galera/t/galera_fk_mismatch.test +new file mode 100644 +index 0000000..bded413 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_fk_mismatch.test +@@ -0,0 +1,38 @@ ++# ++# Test the operation where the definition of the FK is different from the one of the underlying key ++# ++ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++CREATE TABLE parent ( ++ id1 INT, ++ id2 INT, ++ PRIMARY KEY (id1, id2) /* Multipart PK */ ++) ENGINE=InnoDB; ++ ++CREATE TABLE child ( ++ id INT PRIMARY KEY, ++ parent_id1 INT, ++ FOREIGN KEY (parent_id1) ++ REFERENCES parent(id1) /* FK is subset of PK above */ ++ ON UPDATE CASCADE ++ ON DELETE CASCADE ++) ENGINE=InnoDB; ++ ++INSERT INTO parent VALUES (1, 2); ++INSERT INTO child VALUES (1, 1); ++ ++--connection node_2 ++UPDATE parent SET id1 = 3 WHERE id1 = 1; ++ ++--connection node_1 ++SELECT COUNT(*) = 1 FROM child WHERE parent_id1 = 3; ++ ++DELETE FROM parent WHERE id1 = 3; ++ ++--connection node_2 ++SELECT COUNT(*) = 0 FROM child WHERE parent_id1 = 3; ++ ++DROP TABLE child; ++DROP TABLE parent; +diff --git a/mysql-test/suite/galera/t/galera_fk_multicolumn.test b/mysql-test/suite/galera/t/galera_fk_multicolumn.test +new file mode 100644 +index 0000000..ad42f65 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_fk_multicolumn.test +@@ -0,0 +1,42 @@ ++# ++# Test UPDATE on multiple columns with multiple FKs ++# ++ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++CREATE TABLE t0 ( ++ f1 INT PRIMARY KEY, ++ f2 INT UNIQUE ++); ++ ++CREATE TABLE t1 ( ++ f1 INT PRIMARY KEY, ++ FOREIGN KEY (f1) ++ REFERENCES t0(f1) ++ ON UPDATE CASCADE ++); ++ ++CREATE TABLE t2 ( ++ f2 INT PRIMARY KEY, ++ FOREIGN KEY (f2) ++ REFERENCES t0(f2) ++ ON UPDATE CASCADE ++); ++ ++INSERT INTO t0 VALUES (0, 0); ++INSERT INTO t1 VALUES (0); ++INSERT INTO t2 VALUES (0); ++ ++--connection node_2 ++UPDATE t0 SET f1 = 1, f2 = 2; ++ ++--connection node_1 ++SELECT f1 = 1 FROM t1 WHERE f1 = 1; ++SELECT f2 = 2 FROM t2 WHERE f2 = 2; ++SELECT f1 = 1 FROM t1; ++SELECT f2 = 2 FROM t2; ++ ++DROP TABLE t2; ++DROP TABLE t1; ++DROP TABLE t0; +diff --git a/mysql-test/suite/galera/t/galera_fk_multitable.test b/mysql-test/suite/galera/t/galera_fk_multitable.test +new file mode 100644 +index 0000000..6adfb81 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_fk_multitable.test +@@ -0,0 +1,32 @@ ++# ++# Test multi-table DELETE in the presence of FKs ++# ++ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++CREATE TABLE t0 ( ++ f0 INT PRIMARY KEY ++); ++ ++CREATE TABLE t1 ( ++ f1 INT PRIMARY KEY, ++ f0 INTEGER, ++ FOREIGN KEY (f0) ++ REFERENCES t0(f0) ++ ON DELETE CASCADE ++); ++ ++INSERT INTO t0 VALUES (0), (1); ++INSERT INTO t1 VALUES (0, 0); ++INSERT INTO t1 VALUES (1, 0); ++ ++--connection node_2 ++DELETE t0.*, t1.* FROM t0, t1 WHERE t0.f0 = 0 AND t1.f1 = 0; ++ ++--connection node_1 ++SELECT COUNT(*) = 1 FROM t0; ++SELECT COUNT(*) = 0 FROM t1; ++ ++DROP TABLE t1; ++DROP TABLE t0; +diff --git a/mysql-test/suite/galera/t/galera_fk_no_pk.test b/mysql-test/suite/galera/t/galera_fk_no_pk.test +new file mode 100644 +index 0000000..d1f9c26 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_fk_no_pk.test +@@ -0,0 +1,37 @@ ++# ++# Test foreign keys if no PK is present ++# ++ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++CREATE TABLE parent ( ++ id INT, ++ KEY (id) ++) ENGINE=InnoDB; ++ ++CREATE TABLE child ( ++ id INT, ++ parent_id INT, ++ FOREIGN KEY (parent_id) ++ REFERENCES parent(id) ++ ON UPDATE CASCADE ++ ON DELETE CASCADE ++) ENGINE=InnoDB; ++ ++INSERT INTO parent VALUES (1), (1), (2), (2); ++INSERT INTO child VALUES (1,1), (2,2), (1,1), (2,2); ++ ++--connection node_2 ++DELETE FROM parent WHERE id = 1; ++SELECT COUNT(*) = 0 FROM child WHERE id = 1; ++ ++--connection node_1 ++UPDATE parent SET id = 3 WHERE id = 2; ++ ++--connection node_2 ++SELECT COUNT(*) = 0 FROM child WHERE parent_id = 1; ++SELECT parent_id = 3 FROM child WHERE id = 2; ++ ++DROP TABLE child; ++DROP TABLE parent; +diff --git a/mysql-test/suite/galera/t/galera_fk_selfreferential.test b/mysql-test/suite/galera/t/galera_fk_selfreferential.test +new file mode 100644 +index 0000000..e2c1900 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_fk_selfreferential.test +@@ -0,0 +1,24 @@ ++# ++# Test self-referential foreign keys ++# ++ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++CREATE TABLE t1 ( ++ f1 INT NOT NULL PRIMARY KEY, ++ f2 INT, ++ FOREIGN KEY (f2) ++ REFERENCES t1(f1) ++ ON DELETE CASCADE ++) ENGINE=InnoDB; ++ ++INSERT INTO t1 VALUES (1, 1), (2, 1); ++ ++--connection node_2 ++DELETE FROM t1 WHERE f1 = 1; ++ ++--connection node_1 ++SELECT COUNT(*) = 0 FROM t1; ++ ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/t/galera_fk_setnull.test b/mysql-test/suite/galera/t/galera_fk_setnull.test +new file mode 100644 +index 0000000..46ba82d +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_fk_setnull.test +@@ -0,0 +1,36 @@ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++CREATE TABLE parent ( ++ id INT NOT NULL, ++ PRIMARY KEY (id) ++) ENGINE=InnoDB; ++ ++CREATE TABLE child ( ++ id INT, ++ parent_id INT, ++ FOREIGN KEY (parent_id) ++ REFERENCES parent(id) ++ ON UPDATE SET NULL ++ ON DELETE SET NULL ++) ENGINE=InnoDB; ++ ++INSERT INTO parent VALUES (1),(2); ++INSERT INTO child VALUES (1,1),(2,2); ++ ++--connection node_2 ++DELETE FROM parent WHERE id = 1; ++SELECT parent_id IS NULL FROM child WHERE id = 1; ++ ++--connection node_1 ++SELECT parent_id IS NULL FROM child WHERE id = 1; ++ ++UPDATE parent SET id = 3 WHERE id = 2; ++SELECT parent_id IS NULL FROM child WHERE id = 2; ++ ++--connection node_2 ++SELECT parent_id IS NULL FROM child WHERE id = 2; ++ ++--connection node_1 ++DROP TABLE child; ++DROP TABLE parent; +diff --git a/mysql-test/suite/galera/t/galera_ftwrl.test b/mysql-test/suite/galera/t/galera_ftwrl.test +new file mode 100644 +index 0000000..db9bd13 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_ftwrl.test +@@ -0,0 +1,39 @@ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++# ++# At this time, issing a FLUSH TABLES WITH READ LOCK causes SELECT and SHOW to hang if ++# casuality can not be ensured because another node issued a statement in the meantime ++# which could not be applied because FTWRL blocks the applier as well ++# ++# See LP bug 1271177 ++# ++ ++CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB; ++ ++--connection node_2 ++--let $wsrep_provider_options_orig = `SELECT @@wsrep_provider_options;` ++SET GLOBAL wsrep_provider_options = "repl.causal_read_timeout=PT1S"; ++FLUSH TABLES WITH READ LOCK; ++ ++--connection node_1 ++INSERT INTO t1 VALUES (1); ++ ++--connection node_2 ++--error ER_LOCK_WAIT_TIMEOUT ++SHOW TABLES; ++ ++--error ER_LOCK_WAIT_TIMEOUT ++SELECT * FROM t1; ++ ++UNLOCK TABLES; ++ ++SHOW TABLES; ++SELECT COUNT(*) = 1 FROM t1; ++ ++--disable_query_log ++--eval SET GLOBAL wsrep_provider_options = "$wsrep_provider_options_orig"; ++--enable_query_log ++ ++DROP TABLE t1; ++ +diff --git a/mysql-test/suite/galera/t/galera_fulltext.test b/mysql-test/suite/galera/t/galera_fulltext.test +new file mode 100644 +index 0000000..aa93a33 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_fulltext.test +@@ -0,0 +1,62 @@ ++--source include/big_test.inc ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++# ++# InnoDB FULLTEXT indexes ++# ++ ++CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB; ++INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); ++ ++# ++# Fulltext index creation causes the creation of multiple system tables ++# ++ ++--connection node_1 ++CREATE TABLE t1 (f1 INT PRIMARY KEY AUTO_INCREMENT, f2 VARCHAR(100), FULLTEXT (f2)) ENGINE=InnoDB; ++ ++--connection node_2 ++SELECT COUNT(*) = 13 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE name LIKE 'test/%'; ++ ++# ++# Fulltext insertion causes a flurry of updates on those system tables ++# ++ ++--connection node_1 ++# Insert 10K rows ++INSERT INTO t1 (f2) SELECT 'foobarbaz' FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4; ++ ++--connection node_2 ++SELECT COUNT(f2) = 10000 FROM t1 WHERE MATCH(f2) AGAINST ('foobarbaz'); ++ ++UPDATE t1 SET f2 = 'abcdefjhk'; ++ ++--connection node_1 ++SELECT COUNT(f2) = 10000 FROM t1 WHERE MATCH(f2) AGAINST ('abcdefjhk'); ++ ++--connection node_2 ++ ++DROP TABLE t1; ++ ++# ++# Same on a table with no PK ++# ++ ++--connection node_1 ++CREATE TABLE t1 (f1 VARCHAR(100), FULLTEXT (f1)) ENGINE=InnoDB; ++ ++--connection node_2 ++# We insert only 1K rows here, because updates without a PK are very slow ++INSERT INTO t1 (f1) SELECT 'foobarbaz' FROM ten AS a1, ten AS a2, ten AS a3; ++ ++--connection node_1 ++SELECT COUNT(f1) = 1000 FROM t1 WHERE MATCH(f1) AGAINST ('foobarbaz'); ++ ++UPDATE t1 SET f1 = 'abcdefjhk'; ++ ++--connection node_2 ++SELECT COUNT(f1) = 1000 FROM t1 WHERE MATCH(f1) AGAINST ('abcdefjhk'); ++ ++DROP TABLE t1; ++DROP TABLE ten; +diff --git a/mysql-test/suite/galera/t/galera_gcs_fc_limit.test b/mysql-test/suite/galera/t/galera_gcs_fc_limit.test +new file mode 100644 +index 0000000..e15da0e +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_gcs_fc_limit.test +@@ -0,0 +1,52 @@ ++# ++# Test that under gcs.fc_limit=1 on the slave, transactions on the master can not commit. ++# ++ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; ++INSERT INTO t1 VALUES (1); ++ ++--connection node_2 ++--let $wsrep_provider_options_orig = `SELECT @@wsrep_provider_options` ++SET GLOBAL wsrep_provider_options = 'gcs.fc_limit=1'; ++ ++# Block the slave applier thread ++FLUSH TABLES WITH READ LOCK; ++ ++--connection node_1 ++ ++INSERT INTO t1 VALUES (2); ++INSERT INTO t1 VALUES (3); ++INSERT INTO t1 VALUES (4); ++ ++# This query will hang because flow control will kick in ++--send ++INSERT INTO t1 VALUES (5); ++--sleep 1 ++ ++--let $galera_connection_name = node_1a ++--let $galera_server_number = 1 ++--source include/galera_connect.inc ++--connection node_1a ++SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE = 'query end' AND INFO = 'INSERT INTO t1 VALUES (5)'; ++ ++--connection node_2 ++# Unblock the slave applier thread ++UNLOCK TABLES; ++ ++--connection node_1 ++--reap ++ ++INSERT INTO t1 VALUES (6); ++ ++--connection node_2 ++# Replication catches up and continues normally ++SELECT COUNT(*) = 6 FROM t1; ++ ++--disable_query_log ++--eval SET GLOBAL wsrep_provider_options = '$wsrep_provider_options_orig'; ++--enable_query_log ++ ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/t/galera_gcs_max_packet_size.cnf b/mysql-test/suite/galera/t/galera_gcs_max_packet_size.cnf +new file mode 100644 +index 0000000..aae3fee +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_gcs_max_packet_size.cnf +@@ -0,0 +1,5 @@ ++!include ../galera_2nodes.cnf ++[mysqld.1] ++wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcs.max_packet_size=64' ++[mysqld.2] ++wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcs.max_packet_size=64' +diff --git a/mysql-test/suite/galera/t/galera_gcs_max_packet_size.test b/mysql-test/suite/galera/t/galera_gcs_max_packet_size.test +new file mode 100644 +index 0000000..cafd8ac +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_gcs_max_packet_size.test +@@ -0,0 +1,25 @@ ++# ++# Test fragmentation by setting gcs.max_packet_size to a low value ++# The actual setting is performed in galera_gcs_max_packet_size.cnf ++# as gcs.max_packet_size is not a dynamic variable ++# ++ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++CREATE TABLE ten (f1 INTEGER); ++INSERT INTO ten VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10); ++ ++CREATE TABLE t1 (f1 INT PRIMARY KEY AUTO_INCREMENT, f2 INTEGER) ENGINE=InnoDB; ++CREATE TABLE t2 (f1 VARCHAR(512) UNIQUE) ENGINE=InnoDB; ++ ++INSERT INTO t1 (f2) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4; ++INSERT INTO t2 VALUES (REPEAT('x', 512)); ++ ++--connection node_2 ++SELECT COUNT(*) = 10000 FROM t1; ++SELECT LENGTH(f1) = 512 FROM t2 WHERE f1 = REPEAT('x', 512); ++ ++DROP TABLE t1; ++DROP TABLE t2; ++DROP TABLE ten; +diff --git a/mysql-test/suite/galera/t/galera_gtid-master.opt b/mysql-test/suite/galera/t/galera_gtid-master.opt +new file mode 100644 +index 0000000..48e46d7 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_gtid-master.opt +@@ -0,0 +1 @@ ++--gtid-mode=ON --log-bin --log-slave-updates --enforce-gtid-consistency +diff --git a/mysql-test/suite/galera/t/galera_gtid.test b/mysql-test/suite/galera/t/galera_gtid.test +new file mode 100644 +index 0000000..97e7d1f +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_gtid.test +@@ -0,0 +1,27 @@ ++# ++# Test basic Galera operation under --gtid-mode=ON ++# ++ ++--source include/have_log_bin.inc ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++CREATE TABLE t1 (f1 INT PRIMARY KEY); ++ ++INSERT INTO t1 VALUES (1); ++ ++--connection node_2 ++SELECT COUNT(*) = 1 FROM t1; ++ ++UPDATE t1 SET f1 = 2; ++ ++--let $gtid_executed_node2 = `SELECT @@global.gtid_executed;` ++ ++--connection node_1 ++SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2; ++ ++--disable_query_log ++--eval SELECT '$gtid_executed_node2' = @@global.gtid_executed AS gtid_executed_equal; ++--enable_query_log ++ ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/t/galera_insert_ignore.test b/mysql-test/suite/galera/t/galera_insert_ignore.test +new file mode 100644 +index 0000000..4b4b0a6 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_insert_ignore.test +@@ -0,0 +1,60 @@ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++--let $wsrep_sync_wait_orig = (SELECT @@wsrep_sync_wait) ++SET GLOBAL wsrep_sync_wait = 7; ++ ++--connection node_2 ++SET GLOBAL wsrep_sync_wait = 7; ++ ++ ++# ++# INSERT IGNORE with PRIMARY KEY ++# ++ ++--connection node_1 ++CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; ++INSERT INTO t1 VALUES (1); ++ ++INSERT IGNORE INTO t1 VALUES (1), (2); ++SELECT * FROM t1; ++ ++--connection node_2 ++SELECT * FROM t1; ++ ++# ++# INSERT IGNORE ... SELECT ++# ++ ++--connection node_2 ++CREATE TABLE t2 (f1 INTEGER) ENGINE=InnoDB; ++INSERT INTO t2 VALUES (0), (2), (3); ++INSERT IGNORE INTO t1 SELECT f1 FROM t2; ++ ++SELECT * FROM t1; ++--connection node_1 ++SELECT * FROM t1; ++ ++# ++# INSERT IGNORE with UNIQUE + NULLs ++# ++ ++--connection node_2 ++CREATE TABLE t3 (f1 INTEGER UNIQUE) Engine=InnoDB; ++INSERT INTO t3 VALUES (NULL); ++ ++--connection node_1 ++INSERT IGNORE INTO t3 VALUES (1), (NULL), (2); ++SELECT * FROM t3; ++ ++--connection node_2 ++SELECT * FROM t3; ++ ++--eval SET GLOBAL wsrep_sync_wait = $wsrep_sync_wait_orig ++ ++--connection node_1 ++DROP TABLE t1; ++DROP TABLE t2; ++DROP TABLE t3; ++--eval SET GLOBAL wsrep_sync_wait = $wsrep_sync_wait_orig ++ +diff --git a/mysql-test/suite/galera/t/galera_insert_multi.test b/mysql-test/suite/galera/t/galera_insert_multi.test +new file mode 100644 +index 0000000..d62283a +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_insert_multi.test +@@ -0,0 +1,122 @@ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++# ++# Multi-row INSERT with a PK ++# ++ ++--connection node_1 ++CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; ++INSERT INTO t1 VALUES (1),(2); ++ ++--connection node_2 ++INSERT INTO t1 VALUES (3),(4); ++ ++--connection node_1 ++SELECT COUNT(*) = 4 FROM t1; ++ ++--connection node_2 ++SELECT COUNT(*) = 4 FROM t1; ++ ++DROP TABLE t1; ++ ++# ++# Multi-row INSERT without a PK ++# ++ ++--connection node_2 ++CREATE TABLE t1 (f1 INTEGER, KEY (f1)) ENGINE=InnoDB; ++INSERT INTO t1 VALUES (1),(1); ++ ++--connection node_1 ++INSERT INTO t1 VALUES (2),(2); ++ ++--connection node_2 ++SELECT COUNT(*) = 4 FROM t1; ++ ++--connection node_1 ++SELECT COUNT(*) = 4 FROM t1; ++ ++DROP TABLE t1; ++ ++# ++# Error in the middle of a multi-row INSERT ++# ++ ++--connection node_1 ++CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; ++ ++--error ER_DUP_ENTRY ++INSERT INTO t1 VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (1); ++ ++SELECT COUNT(*) = 0 FROM t1; ++ ++--connection node_2 ++SELECT COUNT(*) = 0 FROM t1; ++ ++DROP TABLE t1; ++ ++# ++# Deadlock ++# ++ ++--connection node_1 ++CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; ++ ++SET AUTOCOMMIT = OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES (1), (2); ++ ++--connection node_2 ++SET AUTOCOMMIT = OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES (2), (1); ++ ++--connection node_1 ++COMMIT; ++ ++--connection node_2 ++--error ER_LOCK_DEADLOCK ++COMMIT; ++ ++# Workaround for mysql-wsrep#39 Transaction receives deadlock error twice in row ++--error 0,ER_LOCK_DEADLOCK ++ROLLBACK; ++ ++--error ER_DUP_ENTRY ++INSERT INTO t1 VALUES (1), (2); ++ ++DROP TABLE t1; ++ ++# ++# Rollback ++# ++ ++--connection node_1 ++CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; ++ ++START TRANSACTION; ++INSERT INTO t1 VALUES (1), (2); ++ ++--connection node_2 ++START TRANSACTION; ++INSERT INTO t1 VALUES (2), (1); ++ ++--connection node_1 ++ROLLBACK; ++ ++--connection node_2 ++COMMIT; ++SELECT COUNT(*) = 2 FROM t1; ++ ++--connection node_1 ++SELECT COUNT(*) = 2 FROM t1; ++ ++DROP TABLE t1; ++ ++ ++ ++ ++ ++ ++ +diff --git a/mysql-test/suite/galera/t/galera_ist_innodb_flush_logs.cnf b/mysql-test/suite/galera/t/galera_ist_innodb_flush_logs.cnf +new file mode 100644 +index 0000000..85245ff +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_ist_innodb_flush_logs.cnf +@@ -0,0 +1,12 @@ ++!include ../galera_2nodes.cnf ++ ++[mysqld] ++wsrep_sst_method=xtrabackup-v2 ++innodb_flush_log_at_trx_commit=0 ++ ++[mysqld.1] ++wsrep_provider_options='base_port=@mysqld.1.#galera_port;pc.ignore_sb=true' ++ ++[mysqld.2] ++wsrep_provider_options='base_port=@mysqld.2.#galera_port;pc.ignore_sb=true' ++ +diff --git a/mysql-test/suite/galera/t/galera_ist_innodb_flush_logs.test b/mysql-test/suite/galera/t/galera_ist_innodb_flush_logs.test +new file mode 100644 +index 0000000..0783870 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_ist_innodb_flush_logs.test +@@ -0,0 +1,12 @@ ++# ++# This test performs server kill and IST while innodb_flush_logs_on_trx_commit = 0 ++# This confirms that IST can properly catch up even in the face of relaxed single-node durability ++# ++# ++ ++--source include/big_test.inc ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++--source suite/galera/include/galera_st_kill_slave.inc ++--source suite/galera/include/galera_st_kill_slave_ddl.inc +diff --git a/mysql-test/suite/galera/t/galera_ist_mysqldump.cnf b/mysql-test/suite/galera/t/galera_ist_mysqldump.cnf +new file mode 100644 +index 0000000..db6b7d5 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_ist_mysqldump.cnf +@@ -0,0 +1,11 @@ ++!include ../galera_2nodes.cnf ++ ++# We do not set mysqldump-related SST options here because doing so on startup ++# causes the first MTR connection to be forefully dropped by Galera, which in turn confuses MTR ++ ++[mysqld.1] ++wsrep_provider_options='base_port=@mysqld.1.#galera_port;pc.ignore_sb=true' ++ ++[mysqld.2] ++wsrep_provider_options='base_port=@mysqld.2.#galera_port;pc.ignore_sb=true' ++ +diff --git a/mysql-test/suite/galera/t/galera_ist_mysqldump.test b/mysql-test/suite/galera/t/galera_ist_mysqldump.test +new file mode 100644 +index 0000000..a9ff8c4 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_ist_mysqldump.test +@@ -0,0 +1,17 @@ ++--source include/big_test.inc ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++--source suite/galera/include/galera_sst_set_mysqldump.inc ++ ++# mysql-wsrep#33 - nnoDB: Failing assertion: xid_seqno > trx_sys_cur_xid_seqno in trx_sys_update_wsrep_checkpoint with mysqldump IST ++# --source suite/galera/include/galera_st_disconnect_slave.inc ++ ++# We set the required mysqldump SST options here so that they are used every time the server is restarted during the test ++--let $start_mysqld_params = --wsrep_sst_auth=sst:sst --wsrep_sst_method=mysqldump --wsrep-sst-receive-address=127.0.0.1:$NODE_MYPORT_2 --skip-grant-tables ++ ++--source suite/galera/include/galera_st_shutdown_slave.inc ++--source suite/galera/include/galera_st_kill_slave.inc ++--source suite/galera/include/galera_st_kill_slave_ddl.inc ++ ++--source suite/galera/include/galera_sst_restore.inc +diff --git a/mysql-test/suite/galera/t/galera_ist_restart_joiner.cnf b/mysql-test/suite/galera/t/galera_ist_restart_joiner.cnf +new file mode 100644 +index 0000000..10958aa +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_ist_restart_joiner.cnf +@@ -0,0 +1,4 @@ ++!include ../galera_2nodes.cnf ++ ++[mysqld.1] ++wsrep_provider_options='base_port=@mysqld.1.#galera_port;pc.ignore_sb=true' +diff --git a/mysql-test/suite/galera/t/galera_ist_restart_joiner.test b/mysql-test/suite/galera/t/galera_ist_restart_joiner.test +new file mode 100644 +index 0000000..69446f0 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_ist_restart_joiner.test +@@ -0,0 +1,106 @@ ++# ++# Test that a joiner performing IST can be killed and restarted with no adverse consequences. ++# This is achieved by using the recv_IST_after_apply_trx Galera dbug sync point to block IST after ++# one transaction has been applied. When IST blocks, we kill and restart the joiner ++# ++ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++--source include/have_debug_sync.inc ++--source suite/galera/include/galera_have_debug_sync.inc ++ ++CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1)); ++INSERT INTO t1 VALUES (1, 'a'), (2, 'a'), (3, 'a'), (4, 'a'), (5, 'a'),(6, 'a'); ++ ++# Disconnect node #2 ++--connection node_2 ++--source suite/galera/include/galera_unload_provider.inc ++ ++--connection node_1 ++UPDATE t1 SET f2 = 'b' WHERE f1 > 1; ++ ++# Wait until node #1 has left ++--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' ++--source include/wait_condition.inc ++ ++UPDATE t1 SET f2 = 'c' WHERE f1 > 2; ++ ++--connection node_2 ++# Make sure IST will block ... ++SET GLOBAL wsrep_provider_options = 'dbug=d,recv_IST_after_apply_trx'; ++SET SESSION wsrep_sync_wait = 0; ++ ++ ++# Write file to make mysql-test-run.pl expect the crash, but don't start it ++--let $_server_id= `SELECT @@server_id` ++--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.$_server_id.expect ++--exec echo "wait" > $_expect_file_name ++ ++--let KILL_NODE_PIDFILE = `SELECT @@pid_file` ++ ++# ... and restart provider to force IST ++--echo Loading wsrep_provider ... ++--disable_query_log ++--eval SET GLOBAL wsrep_provider = '$wsrep_provider_orig'; ++--eval SET GLOBAL wsrep_cluster_address = '$wsrep_cluster_address_orig'; ++--enable_query_log ++ ++# We can not use a wait_condition on SELECT * FROM INFORMATION_SCHEMA.GLOBAL_STATUS as such queries are blocked during IST ++# so we perform a simple sleep and SHOW instead ++ ++--sleep 5 ++SHOW STATUS LIKE 'wsrep_debug_sync_waiters'; ++ ++--connection node_1 ++# Perform DML and DDL while IST is in progress ++--connection node_1 ++UPDATE t1 SET f2 = 'd' WHERE f1 > 3; ++CREATE TABLE t2 (f1 INTEGER); ++ ++# Kill node #2 while IST is in progress ++--connection node_2 ++ ++# Kill the connected server ++--disable_reconnect ++ ++--perl ++ my $pid_filename = $ENV{'KILL_NODE_PIDFILE'}; ++ my $mysqld_pid = `cat $pid_filename`; ++ chomp($mysqld_pid); ++ system("kill -9 $mysqld_pid"); ++ exit(0); ++EOF ++ ++--source include/wait_until_disconnected.inc ++ ++--connection node_1 ++--source include/wait_until_connected_again.inc ++--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' ++--source include/wait_condition.inc ++ ++# Perform DML and DDL while node #2 is down ++UPDATE t1 SET f2 = 'e' WHERE f1 > 4; ++CREATE TABLE t3 (f1 INTEGER); ++ ++--connection node_2 ++ ++--let $galera_wsrep_recover_server_id=2 ++--source suite/galera/include/galera_wsrep_recover.inc ++ ++--echo Starting server ... ++--source include/start_mysqld.inc ++ ++--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' ++--source include/wait_condition.inc ++ ++--connection node_1 ++UPDATE t1 SET f2 = 'f' WHERE f1 > 5; ++SELECT * FROM t1; ++ ++--connection node_2 ++SELECT * FROM t1; ++SELECT COUNT(*) = 0 FROM t2; ++SELECT COUNT(*) = 0 FROM t3; ++ ++--connection node_1 ++DROP TABLE t1, t2, t3; +diff --git a/mysql-test/suite/galera/t/galera_ist_rsync.cnf b/mysql-test/suite/galera/t/galera_ist_rsync.cnf +new file mode 100644 +index 0000000..bbe0f60 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_ist_rsync.cnf +@@ -0,0 +1,11 @@ ++!include ../galera_2nodes.cnf ++ ++[mysqld] ++wsrep_sst_method=rsync ++ ++[mysqld.1] ++wsrep_provider_options='base_port=@mysqld.1.#galera_port;pc.ignore_sb=true' ++ ++[mysqld.2] ++wsrep_provider_options='base_port=@mysqld.2.#galera_port;pc.ignore_sb=true' ++ +diff --git a/mysql-test/suite/galera/t/galera_ist_rsync.test b/mysql-test/suite/galera/t/galera_ist_rsync.test +new file mode 100644 +index 0000000..41d1a0c +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_ist_rsync.test +@@ -0,0 +1,8 @@ ++--source include/big_test.inc ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++--source suite/galera/include/galera_st_disconnect_slave.inc ++--source suite/galera/include/galera_st_shutdown_slave.inc ++--source suite/galera/include/galera_st_kill_slave.inc ++--source suite/galera/include/galera_st_kill_slave_ddl.inc +diff --git a/mysql-test/suite/galera/t/galera_ist_xtrabackup-v2.cnf b/mysql-test/suite/galera/t/galera_ist_xtrabackup-v2.cnf +new file mode 100644 +index 0000000..21e5974 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_ist_xtrabackup-v2.cnf +@@ -0,0 +1,11 @@ ++!include ../galera_2nodes.cnf ++ ++[mysqld] ++wsrep_sst_method=xtrabackup-v2 ++ ++[mysqld.1] ++wsrep_provider_options='base_port=@mysqld.1.#galera_port;pc.ignore_sb=true' ++ ++[mysqld.2] ++wsrep_provider_options='base_port=@mysqld.2.#galera_port;pc.ignore_sb=true' ++ +diff --git a/mysql-test/suite/galera/t/galera_ist_xtrabackup-v2.test b/mysql-test/suite/galera/t/galera_ist_xtrabackup-v2.test +new file mode 100644 +index 0000000..8b399e7 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_ist_xtrabackup-v2.test +@@ -0,0 +1,9 @@ ++--source include/big_test.inc ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++--source suite/galera/include/galera_st_disconnect_slave.inc ++--source suite/galera/include/galera_st_shutdown_slave.inc ++ ++--source suite/galera/include/galera_st_kill_slave.inc ++--source suite/galera/include/galera_st_kill_slave_ddl.inc +diff --git a/mysql-test/suite/galera/t/galera_kill_ddl.test b/mysql-test/suite/galera/t/galera_kill_ddl.test +new file mode 100644 +index 0000000..3c2bce5 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_kill_ddl.test +@@ -0,0 +1,39 @@ ++# ++# This test kill -9-s a slave while small updates have been performed on the master. ++# ++ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++--connection node_1 ++ ++# Enable the master to continue running during the split-brain situation that ++# occurs when the slave is killed ++--let $wsrep_provider_options_orig = `SELECT @@wsrep_provider_options` ++SET GLOBAL wsrep_provider_options = 'pc.ignore_sb=true'; ++ ++CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; ++ ++--connection node_2 ++--source include/kill_galera.inc ++ ++--connection node_1 ++ALTER TABLE t1 ADD COLUMN f2 INTEGER; ++ ++--connection node_2 ++--source include/start_mysqld.inc ++ ++--let $galera_connection_name = node_2a ++--let $galera_server_number = 2 ++--source include/galera_connect.inc ++--connection node_2a ++ ++SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='t1'; ++SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; ++ ++--connection node_1 ++--disable_query_log ++--eval SET GLOBAL wsrep_provider_options = '$wsrep_provider_options_orig'; ++--enable_query_log ++ ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/t/galera_kill_largechanges.test b/mysql-test/suite/galera/t/galera_kill_largechanges.test +new file mode 100644 +index 0000000..e9a32ce +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_kill_largechanges.test +@@ -0,0 +1,43 @@ ++# ++# This test kill -9-s a slave while a large update has been performed on the master. SST is performed. ++# ++ ++--source include/big_test.inc ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++--connection node_1 ++# Enable the master to continue running during the split-brain situation that ++# occurs when the slave is killed ++--let $wsrep_provider_options_orig = `SELECT @@wsrep_provider_options` ++SET GLOBAL wsrep_provider_options = 'pc.ignore_sb=true'; ++ ++CREATE TABLE ten (f1 INTEGER); ++INSERT INTO ten VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10); ++CREATE TABLE t1 (f1 VARCHAR(128)) ENGINE=InnoDB; ++ ++--connection node_2 ++--source include/kill_galera.inc ++ ++--connection node_1 ++# We create a 128Mb (or so) transaction that is larger than gcache. The size of the gcache is not adjustable dynamically ++INSERT INTO t1 SELECT REPEAT('a', 128) FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5, ten AS a6; ++ ++--connection node_2 ++--source include/start_mysqld.inc ++ ++--let $galera_connection_name = node_2a ++--let $galera_server_number = 2 ++--source include/galera_connect.inc ++--connection node_2a ++ ++SELECT COUNT(*) = 1000000 FROM t1; ++SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; ++ ++--connection node_1 ++--disable_query_log ++--eval SET GLOBAL wsrep_provider_options = '$wsrep_provider_options_orig'; ++--enable_query_log ++ ++DROP TABLE t1; ++DROP TABLE ten; +diff --git a/mysql-test/suite/galera/t/galera_kill_nochanges.test b/mysql-test/suite/galera/t/galera_kill_nochanges.test +new file mode 100644 +index 0000000..1903df4 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_kill_nochanges.test +@@ -0,0 +1,24 @@ ++# ++# This test kill -9-s a slave while no updates have been performed on the master. ++# ++ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++--connection node_1 ++CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; ++INSERT INTO t1 VALUES (1); ++ ++--connection node_2 ++--source include/kill_galera.inc ++--source include/start_mysqld.inc ++ ++--let $galera_connection_name = node_2a ++--let $galera_server_number = 2 ++--source include/galera_connect.inc ++--connection node_2a ++ ++SELECT COUNT(*) = 1 FROM t1; ++SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; ++ ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/t/galera_kill_smallchanges.test b/mysql-test/suite/galera/t/galera_kill_smallchanges.test +new file mode 100644 +index 0000000..d998032 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_kill_smallchanges.test +@@ -0,0 +1,39 @@ ++# ++# This test kill -9-s a slave while small updates have been performed on the master. ++# ++ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++--connection node_1 ++ ++# Enable the master to continue running during the split-brain situation that ++# occurs when the slave is killed ++--let $wsrep_provider_options_orig = `SELECT @@wsrep_provider_options` ++SET GLOBAL wsrep_provider_options = 'pc.ignore_sb=true'; ++ ++CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; ++ ++--connection node_2 ++--source include/kill_galera.inc ++ ++--connection node_1 ++INSERT INTO t1 VALUES (1); ++ ++--connection node_2 ++--source include/start_mysqld.inc ++ ++--let $galera_connection_name = node_2a ++--let $galera_server_number = 2 ++--source include/galera_connect.inc ++--connection node_2a ++ ++SELECT COUNT(*) = 1 FROM t1; ++SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; ++ ++--connection node_1 ++--disable_query_log ++--eval SET GLOBAL wsrep_provider_options = '$wsrep_provider_options_orig'; ++--enable_query_log ++ ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/t/galera_lock_table.test b/mysql-test/suite/galera/t/galera_lock_table.test +new file mode 100644 +index 0000000..bd58184 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_lock_table.test +@@ -0,0 +1,43 @@ ++# ++# Test that a LOCK TABLE on the slave will cause the applier thread to block, so no subsequent updates ++# are replicated on the slave until UNLOCK TABLE is issued. ++# ++ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++--let $wsrep_sync_wait_orig = `SELECT @@wsrep_sync_wait` ++ ++CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB; ++CREATE TABLE t2 (id INT PRIMARY KEY) ENGINE=InnoDB; ++ ++--connection node_2 ++LOCK TABLE t1 READ; ++ ++--connection node_1 ++INSERT INTO t1 VALUES (1); ++INSERT INTO t2 VALUES (1); ++ ++# We use a separate connection here so that we can SELECT from both tables ++# without running into "table t2 was not locked" error. ++ ++--let $galera_connection_name = node_2a ++--let $galera_server_number = 2 ++--source include/galera_connect.inc ++--connection node_2a ++SET SESSION wsrep_sync_wait=0; ++SELECT COUNT(*) = 0 FROM t1; ++SELECT COUNT(*) = 0 FROM t2; ++ ++--connection node_2 ++UNLOCK TABLES; ++ ++--disable_query_log ++--eval SET SESSION wsrep_sync_wait=$wsrep_sync_wait_orig; ++--enable_query_log ++ ++SELECT COUNT(*) = 1 FROM t1; ++SELECT COUNT(*) = 1 FROM t2; ++ ++DROP TABLE t1; ++DROP TABLE t2; +diff --git a/mysql-test/suite/galera/t/galera_log_bin-master.opt b/mysql-test/suite/galera/t/galera_log_bin-master.opt +new file mode 100644 +index 0000000..8a755e9 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_log_bin-master.opt +@@ -0,0 +1 @@ ++--log-bin --log-slave-updates +diff --git a/mysql-test/suite/galera/t/galera_log_bin.test b/mysql-test/suite/galera/t/galera_log_bin.test +new file mode 100644 +index 0000000..14f04e9 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_log_bin.test +@@ -0,0 +1,36 @@ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++# ++# Test Galera with --log-bin --log-slave-updates . ++# This way the actual MySQL binary log is used, ++# rather than Galera's own implementation ++# ++ ++CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB; ++INSERT INTO t1 VALUES (1); ++ ++CREATE TABLE t2 (id INT) ENGINE=InnoDB; ++INSERT INTO t2 VALUES (1); ++INSERT INTO t2 VALUES (1); ++ ++--connection node_2 ++SELECT COUNT(*) = 1 FROM t1; ++SELECT COUNT(*) = 2 FROM t2; ++ ++--connection node_1 ++ALTER TABLE t1 ADD COLUMN f2 INTEGER; ++ ++FLUSH LOGS; ++# Use pos 120 in order to skip the header that contains the MySQL version number. ++# Otherwise, version number changes will cause the test to break ++SHOW BINLOG EVENTS IN '0.000002' FROM 120; ++ ++--connection node_2 ++SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; ++ ++SHOW BINLOG EVENTS IN '0.000001' FROM 120; ++ ++DROP TABLE t1; ++DROP TABLE t2; ++ +diff --git a/mysql-test/suite/galera/t/galera_log_output_csv-master.opt b/mysql-test/suite/galera/t/galera_log_output_csv-master.opt +new file mode 100644 +index 0000000..2f71b14 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_log_output_csv-master.opt +@@ -0,0 +1 @@ ++--log-output=TABLE --log-queries-not-using-indexes --general-log --slow-query-log +diff --git a/mysql-test/suite/galera/t/galera_log_output_csv.test b/mysql-test/suite/galera/t/galera_log_output_csv.test +new file mode 100644 +index 0000000..0000939 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_log_output_csv.test +@@ -0,0 +1,27 @@ ++# ++# Test that --log-output=FILE works with Galera. ++# The relevant options are set using a -master.opt file ++# wsrep_replicate_myisam is not used as it crashes in MTR with mysql-wsrep#14 ++# ++ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; ++INSERT INTO t1 VALUES (1); ++ ++SELECT COUNT(*) > 0 FROM mysql.general_log; ++ ++SELECT 1 = 1 FROM t1; ++SELECT COUNT(*) = 1 FROM mysql.slow_log WHERE sql_text = 'SELECT 1 = 1 FROM t1'; ++ ++--connection node_2 ++ ++# CREATE TABLE from master is also present in the slave query log, but is logged twice, mysql-wsrep#44 ++SELECT COUNT(*) > 0 FROM mysql.general_log WHERE argument = 'CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB'; ++ ++SELECT 2 = 2 FROM t1; ++SELECT COUNT(*) = 1 FROM mysql.slow_log WHERE sql_text = 'SELECT 2 = 2 FROM t1'; ++ ++--connection node_1 ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/t/galera_many_columns.test b/mysql-test/suite/galera/t/galera_many_columns.test +new file mode 100644 +index 0000000..1961eae +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_many_columns.test +@@ -0,0 +1,62 @@ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++--disable_query_log ++SET @create_var1 = ""; ++--let $count = 1017 ++while ($count) ++{ ++ --eval SET @create_var1 = CONCAT(@create_var1, "f", $count, " VARCHAR(3) DEFAULT 'ABC', ") ++ --dec $count ++} ++ ++--let $create_var = `SELECT @create_var1` ++--eval CREATE TABLE t1 ($create_var PRIMARY KEY (f1, f1017)) ENGINE=InnoDB; ++--enable_query_log ++ ++INSERT INTO t1 (f1) VALUES (DEFAULT); ++ ++--connection node_2 ++SELECT f1 = 'ABC', f1017 = 'ABC' FROM t1; ++UPDATE t1 SET f1 = 'XYZ', f1017 = 'XYZ' ; ++ ++--connection node_1 ++SELECT f1 = 'XYZ', f1017 = 'XYZ' FROM t1 WHERE f1 = 'XYZ' AND f1017 = 'XYZ'; ++ ++ ++# Deadlock ++ ++--connection node_1 ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++UPDATE t1 SET f2 = 'KLM' WHERE f1 = 'XYZ' AND f1017 = 'XYZ'; ++ ++--connection node_2 ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++UPDATE t1 SET f2 = 'CDE' WHERE f1 = 'XYZ' AND f1017 = 'XYZ'; ++COMMIT; ++ ++--connection node_1 ++--error ER_LOCK_DEADLOCK ++COMMIT; ++ROLLBACK; ++ ++--connection node_2 ++ROLLBACK; ++ ++# Rollback ++ ++--connection node_1 ++START TRANSACTION; ++INSERT INTO t1 (f1, f1017) VALUES ('BCE','BCE'); ++INSERT INTO t1 (f1, f1017) VALUES ('CED','CED'); ++INSERT INTO t1 (f1, f1017) VALUES ('EDF','EDF'); ++INSERT INTO t1 (f1, f1017) VALUES ('FED','FED'); ++ROLLBACK; ++SELECT COUNT(*) = 1 FROM t1; ++ ++--connection node_2 ++SELECT COUNT(*) = 1 FROM t1; ++ ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/t/galera_many_indexes.test b/mysql-test/suite/galera/t/galera_many_indexes.test +new file mode 100644 +index 0000000..e01d0b2 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_many_indexes.test +@@ -0,0 +1,74 @@ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++CREATE TABLE t1 (f1 VARCHAR(767) PRIMARY KEY) ENGINE=InnoDB; ++ ++# MySQL complains about multiple identical indexes on the same column ++--disable_warnings ++ ++--let $count = 63 ++while ($count) ++{ ++ --disable_query_log ++ --eval SET @ddl_var1 = CONCAT("CREATE UNIQUE INDEX i", $count, " ON t1(f1)") ++ --let $ddl_var = `SELECT @ddl_var1` ++ --enable_query_log ++ --eval $ddl_var ++ --dec $count ++} ++--enable_warnings ++ ++INSERT INTO t1 VALUES (REPEAT('a', 767)); ++--connection node_2 ++SELECT COUNT(*) = 1 FROM t1; ++SELECT LENGTH(f1) = 767 FROM t1; ++ ++EXPLAIN SELECT COUNT(*) = 1 FROM t1 FORCE KEY (PRIMARY) WHERE f1 = REPEAT('a', 767); ++SELECT COUNT(*) = 1 FROM t1 FORCE KEY (PRIMARY) WHERE f1 = REPEAT('a', 767); ++ ++EXPLAIN SELECT COUNT(*) = 1 FROM t1 FORCE KEY (i1) WHERE f1 = REPEAT('a', 767); ++SELECT COUNT(*) = 1 FROM t1 FORCE KEY (i1) WHERE f1 = REPEAT('a', 767); ++ ++EXPLAIN SELECT COUNT(*) = 1 FROM t1 FORCE KEY (i63) WHERE f1 = REPEAT('a', 767); ++SELECT COUNT(*) = 1 FROM t1 FORCE KEY (i63) WHERE f1 = REPEAT('a', 767); ++ ++INSERT INTO t1 VALUES (REPEAT('b', 767)); ++ANALYZE TABLE t1; ++ ++--connection node_1 ++SELECT COUNT(*) = 2 FROM t1; ++ANALYZE TABLE t1; ++DELETE FROM t1 WHERE f1 = REPEAT('b', 767); ++ ++# Rollback ++--connection node_1 ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++SELECT COUNT(*) = 1 FROM t1; ++INSERT INTO t1 (f1) VALUES (REPEAT('c', 767)); ++ROLLBACK; ++SELECT COUNT(*) = 1 FROM t1; ++ ++--connection node_2 ++START TRANSACTION; ++SET AUTOCOMMIT=OFF; ++SELECT COUNT(*) = 1 FROM t1; ++ ++# Deadlock ++--connection node_1 ++START TRANSACTION; ++--connection node_2 ++START TRANSACTION; ++ ++--connection node_1 ++UPDATE t1 SET f1 = REPEAT('e', 767); ++--connection node_2 ++UPDATE t1 SET f1 = REPEAT('f', 767); ++ ++--connection node_1 ++COMMIT; ++--connection node_2 ++--error ER_LOCK_DEADLOCK ++COMMIT; ++ ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/t/galera_many_rows.test b/mysql-test/suite/galera/t/galera_many_rows.test +new file mode 100644 +index 0000000..0f4c4c0 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_many_rows.test +@@ -0,0 +1,55 @@ ++ ++--source include/big_test.inc ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++CREATE TABLE ten (f1 INTEGER); ++INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); ++ ++CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 INTEGER) Engine=InnoDB; ++INSERT INTO t1 (f2) SELECT a1.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5; ++ ++--connection node_2 ++SELECT COUNT(*) = 100000 FROM t1; ++INSERT INTO t1 (f2) SELECT a1.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5; ++ ++--connection node_1 ++SELECT COUNT(*) = 200000 FROM t1; ++UPDATE t1 SET f2 = 1; ++ ++--connection node_2 ++SELECT COUNT(*) = 200000 FROM t1 WHERE f2 = 1; ++ ++# Rollback ++--connection node_1 ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (f2) SELECT a1.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5; ++ROLLBACK; ++SELECT COUNT(*) = 200000 FROM t1; ++ ++--connection node_2 ++SELECT COUNT(*) = 200000 FROM t1; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++UPDATE t1 SET f2 = 2; ++ROLLBACK; ++ ++--connection node_1 ++START TRANSACTION; ++SELECT COUNT(*) = 200000 FROM t1; ++UPDATE t1 SET f2 = 3; ++ ++--connection node_2 ++START TRANSACTION; ++UPDATE t1 SET f2 = 4; ++ ++--connection node_1 ++COMMIT; ++ ++--connection node_2 ++--error ER_LOCK_DEADLOCK ++COMMIT; ++ ++DROP TABLE t1; ++DROP TABLE ten; +diff --git a/mysql-test/suite/galera/t/galera_many_tables_nopk.test b/mysql-test/suite/galera/t/galera_many_tables_nopk.test +new file mode 100644 +index 0000000..2496d14 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_many_tables_nopk.test +@@ -0,0 +1,103 @@ ++--source include/big_test.inc ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++# ++# This test forces 1K tables without a PK to participate in a single transaction ++# ++ ++# ++# First, create 1K tables ++# ++ ++--connection node_1 ++ ++--let $count = 1000 ++while ($count) ++{ ++ --disable_query_log ++ --let $ddl_var = `SELECT CONCAT("CREATE TABLE t", $count, " (f1 INTEGER) ENGINE=InnoDB")` ++ --eval $ddl_var ++ --enable_query_log ++ --dec $count ++} ++ ++--let $count = 1000 ++while ($count) ++{ ++ --disable_query_log ++ --let $ddl_var = `SELECT CONCAT("INSERT INTO t", $count, " VALUES (1234)")` ++ --eval $ddl_var ++ --enable_query_log ++ --dec $count ++} ++ ++# ++# Second, perform 1K updates ++# ++ ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++ ++--let $count = 1000 ++while ($count) ++{ ++ --disable_query_log ++ --let $ddl_var = `SELECT CONCAT("UPDATE t", $count, " SET f1 = 1")` ++ --eval $ddl_var ++ --enable_query_log ++ --dec $count ++} ++ ++COMMIT; ++ ++# Third, confirm that all the inserts have arrived on the second node ++# ++ ++--connection node_2 ++CREATE TABLE sum_table (f1 INTEGER); ++ ++--let $count = 1000 ++while ($count) ++{ ++ --disable_query_log ++ --let $ddl_var = `SELECT CONCAT("INSERT INTO sum_table SELECT COUNT(*) FROM t", $count)` ++ --eval $ddl_var ++ --enable_query_log ++ --dec $count ++} ++ ++SELECT SUM(f1) = 1000 FROM sum_table; ++ ++# ++# Fourth, create a deadlock ++# ++ ++--connection node_1 ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++ ++--let $count = 1000 ++while ($count) ++{ ++ --disable_query_log ++ --let $ddl_var = `SELECT CONCAT("UPDATE t", $count, " SET f1 = 2")` ++ --eval $ddl_var ++ --enable_query_log ++ --dec $count ++} ++ ++--connection node_2 ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++UPDATE t1000 SET f1 = 3; ++ ++--connection node_1 ++COMMIT; ++ ++--connection node_2 ++--error ER_LOCK_DEADLOCK ++COMMIT; ++ ++DROP SCHEMA test; ++CREATE SCHEMA test; +diff --git a/mysql-test/suite/galera/t/galera_many_tables_pk.test b/mysql-test/suite/galera/t/galera_many_tables_pk.test +new file mode 100644 +index 0000000..886cb7c +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_many_tables_pk.test +@@ -0,0 +1,98 @@ ++--source include/big_test.inc ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++# ++# This test forces 1K tables with a PK to participate in a single transaction ++# ++ ++# ++# First, create 1K tables and make sure the DDLs are all propagated ++# ++ ++--connection node_1 ++ ++--let $count = 1000 ++while ($count) ++{ ++ --disable_query_log ++ --let $ddl_var = `SELECT CONCAT("CREATE TABLE t", $count, " (f1 INTEGER AUTO_INCREMENT PRIMARY KEY) ENGINE=InnoDB")` ++ --eval $ddl_var ++ --enable_query_log ++ --dec $count ++} ++ ++--connection node_2 ++SELECT COUNT(*) = 1000 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME LIKE 't%'; ++ ++# ++# Second, create a transaction that uses all those tables ++# ++ ++--connection node_1 ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++ ++--let $count = 1000 ++while ($count) ++{ ++ --disable_query_log ++ --let $ddl_var = `SELECT CONCAT("INSERT INTO t", $count, " VALUES (DEFAULT)")` ++ --eval $ddl_var ++ --enable_query_log ++ --dec $count ++} ++ ++COMMIT; ++ ++# ++# Third, confirm that all the inserts have arrived on the second node ++# ++ ++--connection node_2 ++CREATE TABLE sum_table (f1 INTEGER); ++ ++--let $count = 1000 ++while ($count) ++{ ++ --disable_query_log ++ --let $ddl_var = `SELECT CONCAT("INSERT INTO sum_table SELECT COUNT(*) FROM t", $count)` ++ --eval $ddl_var ++ --enable_query_log ++ --dec $count ++} ++ ++SELECT SUM(f1) = 1000 FROM sum_table; ++ ++# ++# Fourth, create a deadlock ++# ++ ++--connection node_1 ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++ ++--let $count = 1000 ++while ($count) ++{ ++ --disable_query_log ++ --let $ddl_var = `SELECT CONCAT("UPDATE t", $count, " SET f1 = 2")` ++ --eval $ddl_var ++ --enable_query_log ++ --dec $count ++} ++ ++--connection node_2 ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++UPDATE t1000 SET f1 = 3; ++ ++--connection node_1 ++COMMIT; ++ ++--connection node_2 ++--error ER_LOCK_DEADLOCK ++COMMIT; ++ ++DROP SCHEMA test; ++CREATE SCHEMA test; +diff --git a/mysql-test/suite/galera/t/galera_migrate.cnf b/mysql-test/suite/galera/t/galera_migrate.cnf +new file mode 100644 +index 0000000..dfaf4a6 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_migrate.cnf +@@ -0,0 +1,47 @@ ++# ++# This .cnf file starts 4 servers without enabling Galera. ++# The galera_migrate.test will set wsrep_provider and the other settings as needed. ++# ++ ++!include include/default_mysqld.cnf ++ ++[mysqld] ++binlog-format=row ++innodb_autoinc_lock_mode=2 ++innodb_flush_log_at_trx_commit=2 ++log-bin=mysqld-bin ++ ++wsrep_node_address=127.0.0.1 ++wsrep_causal_reads=ON ++wsrep_sync_wait = 7 ++ ++[mysqld.1] ++ ++[mysqld.2] ++ ++[mysqld.3] ++ ++[mysqld.4] ++ ++[ENV] ++NODE_MYPORT_1= @mysqld.1.port ++NODE_MYSOCK_1= @mysqld.1.socket ++ ++NODE_MYPORT_2= @mysqld.2.port ++NODE_MYSOCK_2= @mysqld.2.socket ++ ++NODE_MYPORT_3= @mysqld.3.port ++NODE_MYSOCK_3= @mysqld.3.socket ++ ++NODE_MYPORT_4= @mysqld.4.port ++NODE_MYSOCK_4= @mysqld.4.socket ++ ++NODE_GALERAPORT_1= @mysqld.1.#galera_port ++NODE_GALERAPORT_2= @mysqld.2.#galera_port ++NODE_GALERAPORT_3= @mysqld.3.#galera_port ++NODE_GALERAPORT_4= @mysqld.4.#galera_port ++ ++NODE_SSTPORT_1= @mysqld.1.#sst_port ++NODE_SSTPORT_2= @mysqld.2.#sst_port ++NODE_SSTPORT_3= @mysqld.3.#sst_port ++NODE_SSTPORT_4= @mysqld.4.#sst_port +diff --git a/mysql-test/suite/galera/t/galera_migrate.test b/mysql-test/suite/galera/t/galera_migrate.test +new file mode 100644 +index 0000000..5c34fd6 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_migrate.test +@@ -0,0 +1,204 @@ ++# ++# Execute a migration from MySQL replication to Galera replication. ++# The test starts with 4 stand-alone servers defined by galera_migrate.cnf and then ++# performs the following steps: ++# ++# 1. Begin with a single MySQL server ++# 2. Establish traditional MySQL master-slave replication ++# 3. Attach a new sever to serve as a MySQL replication slave ++# 4. Enable Galera on the new slave and create a single-node Galera cluster ++# 5. Attach a second Galera node ++# 6. Turn off the traditional replication parts of the system ++# 7. Continue replicating within Galera only ++# ++ ++--source include/big_test.inc ++--source include/have_innodb.inc ++--source include/have_log_bin.inc ++ ++# ++# Step #1 Begin with a single server ++# ++ ++--connect node_1, 127.0.0.1, root, , test, $NODE_MYPORT_1 ++ ++CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; ++INSERT INTO t1 VALUES (1); ++ ++# ++# Step #2. Establish traditional MySQL replication ++# ++ ++--connect node_2, 127.0.0.1, root, , test, $NODE_MYPORT_2 ++--disable_query_log ++--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT = $NODE_MYPORT_1; ++--enable_query_log ++START SLAVE USER='root'; ++ ++--connection node_1 ++INSERT INTO t1 VALUES (2); ++ ++--connection node_2 ++--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'; ++--source include/wait_condition.inc ++ ++--let $wait_condition = SELECT COUNT(*) = 2 FROM t1; ++--source include/wait_condition.inc ++ ++# ++# Step #3. Attach a second slave, later to be converted to Galera ++# ++ ++--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 ++--disable_query_log ++--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT = $NODE_MYPORT_1; ++--enable_query_log ++START SLAVE USER='root'; ++ ++--connection node_1 ++INSERT INTO t1 VALUES (3); ++ ++--connection node_3 ++--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'; ++--source include/wait_condition.inc ++ ++--let $wait_condition = SELECT COUNT(*) = 3 FROM t1; ++--source include/wait_condition.inc ++ ++# ++# Step #4. Convert this MySQL slave into a Galera node ++# ++ ++--connection node_1 ++INSERT INTO t1 VALUES (4); ++ ++--connection node_3 ++--disable_query_log ++--eval SET GLOBAL wsrep_provider='$WSREP_PROVIDER' ++--eval SET GLOBAL wsrep_provider_options='base_port=$NODE_GALERAPORT_3' ++--enable_query_log ++SET GLOBAL wsrep_cluster_address='gcomm://'; ++ ++--connection node_1 ++INSERT INTO t1 VALUES (5); ++ ++--connection node_3 ++--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'; ++--source include/wait_condition.inc ++--let $wait_condition = SELECT COUNT(*) = 5 FROM t1; ++--source include/wait_condition.inc ++ ++--let $wait_condition = SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready'; ++--source include/wait_condition.inc ++ ++SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; ++SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; ++SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; ++ ++--connection node_1 ++INSERT INTO t1 VALUES (6); ++ ++# ++# Step #5. Attach a second Galera node using mysqldump SST ++# ++ ++--connection node_3 ++# We need a user with a password for mysqldump SST ++GRANT ALL PRIVILEGES ON *.* TO 'sst' IDENTIFIED BY 'sst'; ++SET GLOBAL wsrep_sst_auth = 'sst:sst'; ++ ++--connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4 ++GRANT ALL PRIVILEGES ON *.* TO 'sst' IDENTIFIED BY 'sst'; ++ ++--disable_query_log ++--eval SET GLOBAL wsrep_sst_method = 'mysqldump'; ++--eval SET GLOBAL wsrep_provider='$WSREP_PROVIDER' ++--eval SET GLOBAL wsrep_provider_options='base_port=$NODE_GALERAPORT_4' ++--eval SET GLOBAL wsrep_sst_receive_address = '127.0.0.2:$NODE_MYPORT_4'; ++--eval SET GLOBAL wsrep_cluster_address='gcomm://127.0.0.1:$NODE_GALERAPORT_3' ++--enable_query_log ++ ++--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'; ++--source include/wait_condition.inc ++ ++--let $wait_condition = SELECT COUNT(*) = 6 FROM t1; ++--source include/wait_condition.inc ++ ++--let $wait_condition = SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready'; ++--source include/wait_condition.inc ++ ++SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; ++SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; ++SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; ++ ++ ++# ++# Step #6. Turn off traditional replication ++# ++ ++--connection node_2 ++STOP SLAVE; ++RESET SLAVE ALL; ++ ++--connection node_3 ++STOP SLAVE; ++RESET SLAVE ALL; ++ ++# ++# Step #7. Continue replicating within Galera only ++# ++ ++# We need fresh connections due to galera#191 ++ ++--connect node_3a, 127.0.0.1, root, , test, $NODE_MYPORT_3 ++INSERT INTO t1 VALUES (7); ++ ++--connect node_4a, 127.0.0.1, root, , test, $NODE_MYPORT_4 ++INSERT INTO t1 VALUES (8); ++ ++--connection node_4a ++SELECT COUNT(*) = 8 FROM t1; ++ ++--let $wait_condition = SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready'; ++--source include/wait_condition.inc ++ ++SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; ++SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; ++SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; ++ ++--connection node_3a ++SELECT COUNT(*) = 8 FROM t1; ++ ++--let $wait_condition = SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready'; ++--source include/wait_condition.inc ++ ++SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; ++SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; ++SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; ++ ++# ++# Teardown ++# ++ ++--connection node_1 ++DROP TABLE t1; ++ ++--connection node_2 ++DROP TABLE t1; ++ ++--connection node_3 ++SET GLOBAL wsrep_provider = 'none'; ++SET GLOBAL wsrep_sst_auth = ''; ++SET GLOBAL wsrep_provider_options = ''; ++DROP TABLE t1; ++DROP USER sst; ++ ++--connection node_4 ++SET GLOBAL wsrep_provider = 'none'; ++SET GLOBAL wsrep_sst_method = 'rsync'; ++SET GLOBAL wsrep_provider_options = ''; ++SET GLOBAL wsrep_sst_receive_address = 'AUTO'; ++DROP TABLE t1; ++DROP USER sst; ++ ++CALL mtr.add_suppression("InnoDB: Error: Table \"mysql\"\\.\"innodb_index_stats\" not found"); +diff --git a/mysql-test/suite/galera/t/galera_multi_database.test b/mysql-test/suite/galera/t/galera_multi_database.test +new file mode 100644 +index 0000000..6e06aaa +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_multi_database.test +@@ -0,0 +1,43 @@ ++# ++# Test that identical updates can be delivered to two separate ++# databases without this causing a certification conflict ++# ++ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++CREATE DATABASE d1; ++CREATE TABLE d1.t1(f1 INTEGER) ENGINE=InnoDB; ++ ++CREATE DATABASE d2; ++CREATE TABLE d2.t1(f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; ++ ++--connection node_1 ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO d1.t1 VALUES (1); ++ ++--connection node_2 ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO d2.t1 VALUES (1); ++ ++--connection node_1 ++COMMIT; ++ ++--connection node_2 ++COMMIT; ++ ++SELECT COUNT(*) = 1 FROM d1.t1; ++SELECT COUNT(*) = 1 FROM d2.t1; ++ ++--connection node_1 ++ ++SELECT COUNT(*) = 1 FROM d1.t1; ++SELECT COUNT(*) = 1 FROM d2.t1; ++ ++DROP TABLE d1.t1; ++DROP TABLE d2.t1; ++ ++DROP DATABASE d1; ++DROP DATABASE d2; +diff --git a/mysql-test/suite/galera/t/galera_myisam_autocommit.test b/mysql-test/suite/galera/t/galera_myisam_autocommit.test +new file mode 100644 +index 0000000..b01b5dc +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_myisam_autocommit.test +@@ -0,0 +1,45 @@ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++# ++# This tests simple autocommit replication of MyISAM tables. No updates arrive on the slave. ++# ++ ++# Without a PK ++ ++CREATE TABLE t1 (f1 INTEGER) ENGINE=MyISAM; ++ ++INSERT INTO t1 VALUES (1); ++INSERT INTO t1 VALUES (2), (3); ++INSERT INTO t1 SELECT 4 FROM DUAL UNION ALL SELECT 5 FROM DUAL; ++ ++CREATE TABLE t2 (f1 INTEGER PRIMARY KEY) ENGINE=MyISAM; ++INSERT INTO t2 VALUES (1); ++INSERT INTO t2 VALUES (2), (3); ++INSERT INTO t2 SELECT 4 FROM DUAL UNION ALL SELECT 5 FROM DUAL; ++ ++# Error ++--error ER_DUP_ENTRY ++INSERT INTO t2 VALUES (6), (1); ++ ++# UPDATE ++ ++UPDATE t1 SET f1 = 9; ++UPDATE t2 SET f1 = 9 WHERE f1 = 1; ++ ++# DELETE ++ ++DELETE FROM t1 WHERE f1 = 9; ++DELETE FROM t2 WHERE f1 = 9; ++ ++# TRUNCATE ++ ++TRUNCATE TABLE t1; ++TRUNCATE TABLE t1; ++ ++--connection node_2 ++SELECT COUNT(*) = 0 FROM t1; ++SELECT COUNT(*) = 0 FROM t2; ++ ++DROP TABLE t1; ++DROP TABLE t2; +diff --git a/mysql-test/suite/galera/t/galera_myisam_transactions.test b/mysql-test/suite/galera/t/galera_myisam_transactions.test +new file mode 100644 +index 0000000..00e0bf3 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_myisam_transactions.test +@@ -0,0 +1,36 @@ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++# ++# This tests MyISAM tables in transactions. No MyISAM updates arrive on the slave, but InnoDB ones do. ++# ++ ++CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; ++CREATE TABLE t2 (f1 INTEGER) ENGINE=MyISAM; ++CREATE TABLE t3 (f1 INTEGER) ENGINE=MyISAM; ++ ++CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW INSERT INTO t3 VALUES (NEW.f1); ++ ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES (1); ++INSERT INTO t2 VALUES (1); ++COMMIT; ++ ++--connection node_2 ++SELECT COUNT(*) = 1 FROM t1; ++SELECT COUNT(*) = 0 FROM t2; ++SELECT COUNT(*) = 0 FROM t2; ++ ++--connection node_1 ++START TRANSACTION; ++INSERT INTO t1 VALUES (1); ++INSERT INTO t2 VALUES (1); ++ROLLBACK; ++ ++--connection node_2 ++SELECT COUNT(*) = 1 FROM t1; ++SELECT COUNT(*) = 0 FROM t2; ++SELECT COUNT(*) = 0 FROM t2; ++ ++DROP TABLE t1, t2, t3; +diff --git a/mysql-test/suite/galera/t/galera_nopk_bit.test b/mysql-test/suite/galera/t/galera_nopk_bit.test +new file mode 100644 +index 0000000..4292a6d +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_nopk_bit.test +@@ -0,0 +1,46 @@ ++# ++# This checks that even tables with a single BIT column are replicated properly without a PK ++# ++ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++CREATE TABLE t1 (f1 BIT) ENGINE=InnoDB; ++INSERT INTO t1 VALUES (NULL),(0),(b'1'); ++ ++--connection node_2 ++SELECT f1 IS NULL, f1 = b'1' FROM t1; ++ ++DELETE FROM t1 WHERE f1 = b'1'; ++UPDATE t1 SET f1 = b'1' WHERE f1 IS NULL; ++UPDATE t1 SET f1 = 1 WHERE f1 = b'0'; ++ ++--connection node_1 ++SELECT f1 IS NULL, f1 = b'1' FROM t1; ++ ++# ++# Provoke a conflict ++# ++ ++--connection node_1 ++CREATE TABLE t2 (f1 BIT) ENGINE=InnoDB; ++INSERT INTO t2 VALUES (NULL); ++ ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++UPDATE t2 SET f1 = 0 WHERE f1 IS NULL; ++ ++--connection node_2 ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++UPDATE t2 SET f1 = 1 WHERE f1 IS NULL; ++ ++--connection node_1 ++COMMIT; ++ ++--connection node_2 ++--error ER_LOCK_DEADLOCK ++COMMIT; ++ ++DROP TABLE t1; ++DROP TABLE t2; +diff --git a/mysql-test/suite/galera/t/galera_nopk_blob.test b/mysql-test/suite/galera/t/galera_nopk_blob.test +new file mode 100644 +index 0000000..08e3b99 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_nopk_blob.test +@@ -0,0 +1,46 @@ ++# ++# This checks that even tables with a single BLOB column and no FK are replicated properly ++# ++ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++CREATE TABLE t1 (f1 BLOB) ENGINE=InnoDB; ++INSERT INTO t1 VALUES (NULL),('abc'); ++ ++--connection node_2 ++SELECT f1 FROM t1; ++ ++DELETE FROM t1 WHERE f1 IS NULL; ++UPDATE t1 SET f1 = 'xyz' WHERE f1 = 'abc'; ++ ++--connection node_1 ++SELECT COUNT(*) = 1 FROM t1; ++SELECT f1 = 'abc' FROM t1; ++ ++# ++# Provoke a conflict ++# ++ ++--connection node_1 ++CREATE TABLE t2 (f1 BLOB) ENGINE=InnoDB; ++INSERT INTO t2 VALUES (NULL); ++ ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++UPDATE t2 SET f1 = 'abc' WHERE f1 IS NULL; ++ ++--connection node_2 ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++UPDATE t2 SET f1 = 'xyz' WHERE f1 IS NULL; ++ ++--connection node_1 ++COMMIT; ++ ++--connection node_2 ++--error ER_LOCK_DEADLOCK ++COMMIT; ++ ++DROP TABLE t1; ++DROP TABLE t2; +diff --git a/mysql-test/suite/galera/t/galera_nopk_large_varchar.test b/mysql-test/suite/galera/t/galera_nopk_large_varchar.test +new file mode 100644 +index 0000000..bb9bcd5 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_nopk_large_varchar.test +@@ -0,0 +1,50 @@ ++# ++# This checks that even tables with a single long VARCHARcolumn and no FK are replicated properly ++# ++ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++# From the Innodb manual: "The maximum row length, except for variable-length columns (VARBINARY, VARCHAR, BLOB and TEXT), ++# is slightly less than half of a database page. That is, the maximum row length is about 8000 bytes" ++ ++CREATE TABLE t1 (f1 VARCHAR(8000)) ENGINE=InnoDB; ++INSERT INTO t1 VALUES (NULL),(CONCAT(REPEAT('x', 7999), 'a')); ++ ++--connection node_2 ++SELECT LENGTH(f1) FROM t1; ++ ++DELETE FROM t1 WHERE f1 IS NULL; ++UPDATE t1 SET f1 = CONCAT(REPEAT('x', 7999), 'b') WHERE f1 = CONCAT(REPEAT('x', 7999), 'a'); ++ ++--connection node_1 ++SELECT COUNT(*) = 1 FROM t1; ++SELECT LENGTH(f1) = 8000 FROM t1; ++SELECT f1 = CONCAT(REPEAT('x', 7999), 'b') FROM t1; ++ ++# ++# Provoke a conflict ++# ++ ++--connection node_1 ++CREATE TABLE t2 (f1 BLOB) ENGINE=InnoDB; ++INSERT INTO t2 VALUES (CONCAT(REPEAT('x', 7999), 'a')); ++ ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++UPDATE t2 SET f1 = 'abc' WHERE f1 = CONCAT(REPEAT('x', 7999), 'a'); ++ ++--connection node_2 ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++UPDATE t2 SET f1 = 'xyz' WHERE f1 = CONCAT(REPEAT('x', 7999), 'a'); ++ ++--connection node_1 ++COMMIT; ++ ++--connection node_2 ++--error ER_LOCK_DEADLOCK ++COMMIT; ++ ++DROP TABLE t1; ++DROP TABLE t2; +diff --git a/mysql-test/suite/galera/t/galera_nopk_unicode.test b/mysql-test/suite/galera/t/galera_nopk_unicode.test +new file mode 100644 +index 0000000..e036e14 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_nopk_unicode.test +@@ -0,0 +1,43 @@ ++# ++# Test non-ascii data in table without a PK ++# ++ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++CREATE TABLE t1 ( ++ f1 VARCHAR(255), ++ KEY (f1) ++) ENGINE=InnoDB DEFAULT CHARSET=utf8; ++ ++INSERT INTO t1 VALUES ('текст'); ++ ++--connection node_2 ++SELECT f1 = 'текст' FROM t1; ++ ++# ++# Provoke a conflict ++# ++ ++--connection node_1 ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++UPDATE t1 SET f1 = 'текст2'; ++ ++--connection node_2 ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++UPDATE t1 SET f1 = 'текст3'; ++ ++--connection node_1 ++COMMIT; ++ ++--connection node_2 ++--error ER_LOCK_DEADLOCK ++COMMIT; ++ ++SELECT f1 = 'текст2' FROM t1; ++SELECT f1 = 'текст2' FROM t1 WHERE f1 = 'текст2'; ++ ++ ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/t/galera_parallel_apply_lock_table.test b/mysql-test/suite/galera/t/galera_parallel_apply_lock_table.test +new file mode 100644 +index 0000000..7c49a57 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_parallel_apply_lock_table.test +@@ -0,0 +1,51 @@ ++# ++# Test that a LOCK TABLE on the slave will cause all applier threads to block, ++# Even though the two INSERTS are independent transactions, the fact that t1 is locked ++# prevents the applier thread from committing the insert against t2, as commits are done ++# in order. ++# ++ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB; ++CREATE TABLE t2 (id INT PRIMARY KEY) ENGINE=InnoDB; ++ ++--connection node_2 ++ ++--let $wsrep_slave_threads_orig = `SELECT @@wsrep_slave_threads` ++--let $wsrep_sync_wait_orig = `SELECT @@wsrep_sync_wait` ++ ++SET GLOBAL wsrep_slave_threads = 2; ++LOCK TABLE t1 READ; ++ ++--connection node_1 ++INSERT INTO t1 VALUES (1); ++INSERT INTO t2 VALUES (1); ++ ++# We use a separate connection here so that we can SELECT from both tables ++# without running into "table t2 was not locked" error. ++ ++--let $galera_connection_name = node_2a ++--let $galera_server_number = 2 ++--source include/galera_connect.inc ++--connection node_2a ++--sleep 1 ++SET SESSION wsrep_sync_wait=0; ++SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE '%applied write set%'; ++SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE '%Waiting for table level lock%'; ++SELECT COUNT(*) = 0 FROM t1; ++SELECT COUNT(*) = 0 FROM t2; ++ ++--connection node_2 ++UNLOCK TABLES; ++ ++--connection node_2a ++--eval SET SESSION wsrep_sync_wait = $wsrep_sync_wait_orig; ++SELECT COUNT(*) = 1 FROM t1; ++SELECT COUNT(*) = 1 FROM t2; ++SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE '%committed%'; ++ ++--eval SET GLOBAL wsrep_slave_threads = $wsrep_slave_threads_orig; ++DROP TABLE t1; ++DROP TABLE t2; +diff --git a/mysql-test/suite/galera/t/galera_parallel_autoinc_largetrx.test b/mysql-test/suite/galera/t/galera_parallel_autoinc_largetrx.test +new file mode 100644 +index 0000000..a192044 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_parallel_autoinc_largetrx.test +@@ -0,0 +1,50 @@ ++## ++## This test tests parallel application of multiple auto-increment insert transactions ++## ++ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++# Create a second connection to node1 so that we can run transactions concurrently ++--let $galera_connection_name = node_1a ++--let $galera_server_number = 1 ++--source include/galera_connect.inc ++ ++--connection node_1 ++CREATE TABLE ten (f1 INTEGER); ++INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); ++ ++CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 INTEGER) Engine=InnoDB; ++--connection node_2 ++--let $wsrep_slave_threads_orig = `SELECT @@wsrep_slave_threads` ++SET GLOBAL wsrep_slave_threads = 4; ++ ++--connection node_1 ++--send INSERT INTO t1 (f2) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4; ++ ++--connection node_1a ++--send INSERT INTO t1 (f2) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4; ++ ++--connection node_2 ++--send INSERT INTO t1 (f2) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4; ++ ++--connection node_1 ++--reap ++ ++--connection node_1a ++--reap ++ ++--connection node_2 ++--reap ++SELECT COUNT(*) = 30000 FROM t1; ++SELECT COUNT(DISTINCT f1) = 30000 FROM t1; ++SELECT COUNT(*) = 5 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user'; ++ ++--disable_query_log ++--eval SET GLOBAL wsrep_slave_threads = $wsrep_slave_threads_orig; ++--enable_query_log ++ ++--connection default ++DROP TABLE t1; ++DROP TABLE ten; ++ +diff --git a/mysql-test/suite/galera/t/galera_parallel_autoinc_manytrx.test b/mysql-test/suite/galera/t/galera_parallel_autoinc_manytrx.test +new file mode 100644 +index 0000000..cf984f9 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_parallel_autoinc_manytrx.test +@@ -0,0 +1,53 @@ ++## ++## Tests the parallel application of many small-ish auto-increment insert transactions ++## ++ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++# Create a second connection to node1 so that we can run transactions concurrently ++--let $galera_connection_name = node_1a ++--let $galera_server_number = 1 ++--source include/galera_connect.inc ++ ++--connection node_1 ++CREATE TABLE ten (f1 INTEGER); ++INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); ++ ++CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 INTEGER) Engine=InnoDB; ++--connection node_2 ++--let $wsrep_slave_threads_orig = `SELECT @@wsrep_slave_threads` ++SET GLOBAL wsrep_slave_threads = 4; ++ ++--connection node_1 ++--let $count = 1000 ++while ($count) ++{ ++ --disable_query_log ++ INSERT INTO t1 (f2) SELECT 1 FROM ten AS a1; ++ --enable_query_log ++ --dec $count ++} ++ ++--connection node_2 ++--let $count = 1000 ++while ($count) ++{ ++ --disable_query_log ++ INSERT INTO t1 (f2) SELECT 1 FROM ten AS a1; ++ --enable_query_log ++ --dec $count ++} ++ ++SELECT COUNT(*) = 20000 FROM t1; ++SELECT COUNT(DISTINCT f1) = 20000 FROM t1; ++SELECT COUNT(*) = 4 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE 'committed%'; ++ ++--disable_query_log ++--eval SET GLOBAL wsrep_slave_threads = $wsrep_slave_threads_orig; ++--enable_query_log ++ ++--connection default ++DROP TABLE t1; ++DROP TABLE ten; ++ +diff --git a/mysql-test/suite/galera/t/galera_parallel_simple.test b/mysql-test/suite/galera/t/galera_parallel_simple.test +new file mode 100644 +index 0000000..b1dc14d +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_parallel_simple.test +@@ -0,0 +1,45 @@ ++# ++# Test that SHOW PROCESSLIST reports that two slave threads have been involved in applying ++# two independent transactions ++# ++ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++--let $wsrep_slave_threads_orig = `SELECT @@wsrep_slave_threads` ++ ++CREATE TABLE t1 (id INT) ENGINE=InnoDB; ++CREATE TABLE t2 (id INT) ENGINE=InnoDB; ++ ++--connection node_2 ++SET GLOBAL wsrep_slave_threads = 2; ++ ++--connection node_1 ++INSERT INTO t1 VALUES (1); ++INSERT INTO t2 VALUES (1); ++ ++INSERT INTO t1 VALUES (1); ++INSERT INTO t2 VALUES (1); ++ ++INSERT INTO t1 VALUES (1); ++INSERT INTO t2 VALUES (1); ++ ++INSERT INTO t1 VALUES (1); ++INSERT INTO t2 VALUES (1); ++ ++INSERT INTO t1 VALUES (1); ++INSERT INTO t2 VALUES (1); ++ ++INSERT INTO t1 VALUES (1); ++INSERT INTO t2 VALUES (1); ++ ++--connection node_2 ++ ++SELECT COUNT(*) = 10 FROM t1; ++SELECT COUNT(*) = 10 FROM t2; ++SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE 'committed%'; ++ ++--eval SET GLOBAL wsrep_slave_threads = $wsrep_slave_threads_orig; ++ ++DROP TABLE t1; ++DROP TABLE t2; +diff --git a/mysql-test/suite/galera/t/galera_pc_ignore_sb.test b/mysql-test/suite/galera/t/galera_pc_ignore_sb.test +new file mode 100644 +index 0000000..4be7331 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_pc_ignore_sb.test +@@ -0,0 +1,35 @@ ++# ++# Test pc.ignore_sb=true wsrep_provider option . Killing one node should leave the other running. ++# ++ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++--connection node_1 ++--let $wsrep_cluster_address_orig = `SELECT @@wsrep_cluster_address` ++--let $wsrep_provider_options_orig = `SELECT @@wsrep_provider_options` ++ ++SET GLOBAL wsrep_provider_options = 'pc.ignore_sb=true'; ++ ++--connection node_2 ++--source include/kill_galera.inc ++ ++--connection node_1 ++CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; ++INSERT INTO t1 VALUES (1); ++DROP TABLE t1; ++ ++SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; ++SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready'; ++ ++# Reset the master and restart the slave so that post-test checks can run ++ ++SET GLOBAL wsrep_cluster_address = ''; ++--disable_query_log ++--eval SET GLOBAL wsrep_cluster_address = '$wsrep_cluster_address_orig'; ++--eval SET GLOBAL wsrep_provider_options = '$wsrep_provider_options_orig'; ++--enable_query_log ++ ++--connection node_2 ++--source include/start_mysqld.inc ++--source include/wait_until_connected_again.inc +diff --git a/mysql-test/suite/galera/t/galera_pk_bigint_signed.test b/mysql-test/suite/galera/t/galera_pk_bigint_signed.test +new file mode 100644 +index 0000000..12a8a8f +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_pk_bigint_signed.test +@@ -0,0 +1,46 @@ ++# ++# PK that is a BIGINT SIGNED ++# ++ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++CREATE TABLE t1 (f1 BIGINT SIGNED PRIMARY KEY, f2 VARCHAR(5)) ENGINE=InnoDB; ++ ++INSERT INTO t1 VALUES ++ (-9223372036854775808, 'min'), ++ (9223372036854775807, 'max') ++; ++ ++--connection node_2 ++SELECT * FROM t1; ++ ++UPDATE t1 SET f2 = CONCAT(f2, '_'); ++ ++--connection node_1 ++SELECT * FROM t1; ++ ++# ++# Deadlock ++# ++ ++--connection node_1 ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++UPDATE t1 SET f2 = 'foo' WHERE f1 = -9223372036854775808; ++ ++--connection node_2 ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++UPDATE t1 SET f2 = 'bar' WHERE f1 = -9223372036854775808; ++ ++--connection node_1 ++COMMIT; ++SET AUTOCOMMIT=ON; ++ ++--connection node_2 ++--error ER_LOCK_DEADLOCK ++COMMIT; ++SET AUTOCOMMIT=ON; ++ ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/t/galera_pk_bigint_unsigned.test b/mysql-test/suite/galera/t/galera_pk_bigint_unsigned.test +new file mode 100644 +index 0000000..2bb02d5 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_pk_bigint_unsigned.test +@@ -0,0 +1,45 @@ ++# ++# PK that is a BIGINT UNSIGNED ++# ++ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++CREATE TABLE t1 (f1 BIGINT UNSIGNED PRIMARY KEY, f2 VARCHAR(5)) ENGINE=InnoDB; ++ ++INSERT INTO t1 VALUES ++ (18446744073709551615, 'max') ++; ++ ++--connection node_2 ++SELECT f1 = 18446744073709551615 FROM t1; ++ ++UPDATE t1 SET f2 = CONCAT(f2, '_'); ++ ++--connection node_1 ++SELECT f1 = 18446744073709551615 FROM t1; ++ ++# ++# Deadlock ++# ++ ++--connection node_1 ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++UPDATE t1 SET f2 = 'foo' WHERE f1 = 18446744073709551615; ++ ++--connection node_2 ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++UPDATE t1 SET f2 = 'bar' WHERE f1 = 18446744073709551615; ++ ++--connection node_1 ++COMMIT; ++SET AUTOCOMMIT=ON; ++ ++--connection node_2 ++--error ER_LOCK_DEADLOCK ++COMMIT; ++SET AUTOCOMMIT=ON; ++ ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/t/galera_query_cache-master.opt b/mysql-test/suite/galera/t/galera_query_cache-master.opt +new file mode 100644 +index 0000000..18f8004 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_query_cache-master.opt +@@ -0,0 +1,2 @@ ++--query_cache_type=1 ++ +diff --git a/mysql-test/suite/galera/t/galera_query_cache.test b/mysql-test/suite/galera/t/galera_query_cache.test +new file mode 100644 +index 0000000..900faba +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_query_cache.test +@@ -0,0 +1,67 @@ ++--source include/have_query_cache.inc ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++# ++# Ensure that the query cache behaves properly with respect to Galera ++# ++# * in the absence of updates, the query cache does serve cached results ++# * any cache-invalidating query on the remote node also causes the local cache to be invalidated ++# ++ ++CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB; ++ ++INSERT INTO t1 VALUES (1); ++ ++--connection node_2 ++RESET QUERY CACHE; ++FLUSH STATUS; ++ ++# ++# 1. Cache works ++# ++ ++SELECT COUNT(*) FROM t1; ++SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Qcache_queries_in_cache'; ++ ++SELECT COUNT(*) FROM t1; ++SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'Qcache_hits'; ++ ++# ++# 2. Cache is invalidated by DML on remote node ++# ++ ++--connection node_1 ++INSERT INTO t1 VALUES (2); ++ ++--connection node_2 ++FLUSH STATUS; ++ ++SELECT VARIABLE_VALUE = 0 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Qcache_queries_in_cache'; ++SELECT COUNT(*) FROM t1; ++SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Qcache_queries_in_cache'; ++ ++SELECT VARIABLE_VALUE = 0 FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'Qcache_hits'; ++SELECT COUNT(*) FROM t1; ++SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'Qcache_hits'; ++ ++# ++# 3. Cache is invalidated by DDL on remote node ++# ++ ++--connection node_1 ++ALTER TABLE t1 ADD COLUMN f2 INTEGER; ++ ++--connection node_2 ++FLUSH STATUS; ++ ++SELECT VARIABLE_VALUE = 0 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Qcache_queries_in_cache'; ++SELECT COUNT(*) FROM t1; ++SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Qcache_queries_in_cache'; ++ ++SELECT VARIABLE_VALUE = 0 FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'Qcache_hits'; ++SELECT COUNT(*) FROM t1; ++SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'Qcache_hits'; ++ ++DROP TABLE t1; ++ +diff --git a/mysql-test/suite/galera/t/galera_read_only.test b/mysql-test/suite/galera/t/galera_read_only.test +new file mode 100644 +index 0000000..828f35d +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_read_only.test +@@ -0,0 +1,23 @@ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++# ++# Ensure that the read_only option does not apply to Galera appliers and that replication ++# continues, the way MySQL replication would. ++# ++ ++CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB; ++ ++--connection node_2 ++SET GLOBAL read_only=TRUE; ++ ++--connection node_1 ++INSERT INTO t1 VALUES (1); ++ ++--connection node_2 ++SELECT COUNT(*) = 1 FROM t1; ++ ++SET GLOBAL read_only=FALSE; ++ ++DROP TABLE t1; ++ +diff --git a/mysql-test/suite/galera/t/galera_repl_key_format_flat16.test b/mysql-test/suite/galera/t/galera_repl_key_format_flat16.test +new file mode 100644 +index 0000000..8749c20 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_repl_key_format_flat16.test +@@ -0,0 +1,34 @@ ++# ++# Test repl.key_format = FLAT16 . Since it is very difficult to cause a collision on a 16-byte hash, ++# we simply verify that the option is settable and that replication works. ++# ++ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++--connection node_1 ++--let $wsrep_provider_options_orig = `SELECT @@wsrep_provider_options` ++SET GLOBAL wsrep_provider_options = 'repl.key_format=FLAT16'; ++ ++CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; ++INSERT INTO t1 VALUES (123); ++ ++CREATE TABLE t2 (f1 VARCHAR(256)) ENGINE=InnoDB; ++INSERT INTO t2 VALUES (REPEAT('a', 256)); ++ ++--connection node_2 ++SELECT COUNT(*) = 1 FROM t1; ++UPDATE t1 SET f1 = 234; ++UPDATE t2 SET f1 = REPEAT('b', 256); ++ ++--connection node_1 ++SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 234; ++SELECT COUNT(*) = 1 FROM t2 WHERE f1 = REPEAT('b', 256); ++ ++ ++--disable_query_log ++--eval SET GLOBAL wsrep_provider_options = '$wsrep_provider_options_orig'; ++--enable_query_log ++ ++DROP TABLE t1; ++DROP TABLE t2; +diff --git a/mysql-test/suite/galera/t/galera_repl_max_ws_size.test b/mysql-test/suite/galera/t/galera_repl_max_ws_size.test +new file mode 100644 +index 0000000..255e292 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_repl_max_ws_size.test +@@ -0,0 +1,27 @@ ++# ++# Test repl.max_ws_size . A transaction larger than this size can not commit. ++# ++ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++--connection node_1 ++--let $wsrep_provider_options_orig = `SELECT @@wsrep_provider_options` ++ ++CREATE TABLE t1 (f1 VARCHAR(512)) ENGINE=InnoDB; ++ ++SET GLOBAL wsrep_provider_options = 'repl.max_ws_size=512'; ++ ++--error ER_ERROR_DURING_COMMIT ++INSERT INTO t1 VALUES (REPEAT('a', 512)); ++ ++SELECT COUNT(*) = 0 FROM t1; ++ ++--disable_query_log ++--eval SET GLOBAL wsrep_provider_options = '$wsrep_provider_options_orig'; ++--enable_query_log ++ ++DROP TABLE t1; ++ ++CALL mtr.add_suppression("WSREP: Maximum writeset size exceeded by"); ++CALL mtr.add_suppression("WSREP: transaction size exceeded"); +diff --git a/mysql-test/suite/galera/t/galera_restart_nochanges.test b/mysql-test/suite/galera/t/galera_restart_nochanges.test +new file mode 100644 +index 0000000..8eb7617 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_restart_nochanges.test +@@ -0,0 +1,23 @@ ++# ++# This test restarts a slave while no updates have been performed on the master. No SST is performed. ++# ++ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++--connection node_1 ++CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; ++INSERT INTO t1 VALUES (1); ++ ++--connection node_2 ++--source include/restart_mysqld.inc ++ ++--let $galera_connection_name = node_2a ++--let $galera_server_number = 2 ++--source include/galera_connect.inc ++--connection node_2a ++ ++SELECT COUNT(*) = 1 FROM t1; ++SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; ++ ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/t/galera_rsu_add_pk.test b/mysql-test/suite/galera/t/galera_rsu_add_pk.test +new file mode 100644 +index 0000000..1a5501a +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_rsu_add_pk.test +@@ -0,0 +1,44 @@ ++# ++# ALTER TABLE ... ADD PRIMARY KEY under Rolling Schema Upgrade ++# ++ ++--source include/big_test.inc ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++--connection node_1 ++CREATE TABLE ten (f1 INTEGER); ++INSERT INTO ten VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); ++ ++CREATE TABLE t1 (f1 INTEGER) Engine=InnoDB; ++ ++# Insert some values before the ALTER ++INSERT INTO t1 (f1) SELECT 000000 + (10000 * a1.f1) + (1000 * a2.f1) + (100 * a3.f1) + (10 * a4.f1) + a5.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5; ++ ++# Insert more values while the ALTER is running ++--send INSERT INTO t1 (f1) SELECT 100000 + (10000 * a1.f1) + (1000 * a2.f1) + (100 * a3.f1) + (10 * a4.f1) + a5.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5; ++ ++--connection node_2 ++SET GLOBAL wsrep_OSU_method = "RSU"; ++ALTER TABLE t1 ADD PRIMARY KEY (f1); ++SET GLOBAL wsrep_OSU_method = "TOI"; ++ ++# Insert values after the ALTER ++INSERT INTO t1 (f1) SELECT 200000 + (10000 * a1.f1) + (1000 * a2.f1) + (100 * a3.f1) + (10 * a4.f1) + a5.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5; ++ ++ ++SELECT COUNT(*) = 300000 FROM t1; ++SELECT MAX(f1) = 299999 FROM t1; ++ ++--connection node_1 ++--reap ++SELECT COUNT(*) = 300000 FROM t1; ++SELECT MAX(f1) = 299999 FROM t1; ++ ++SET GLOBAL wsrep_OSU_method = "RSU"; ++ALTER TABLE t1 ADD PRIMARY KEY (f1); ++SET GLOBAL wsrep_OSU_method = "TOI"; ++ ++ ++DROP TABLE t1; ++DROP TABLE ten; +diff --git a/mysql-test/suite/galera/t/galera_rsu_drop_pk.test b/mysql-test/suite/galera/t/galera_rsu_drop_pk.test +new file mode 100644 +index 0000000..c3ccf89 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_rsu_drop_pk.test +@@ -0,0 +1,58 @@ ++# ++# ALTER TABLE ... DROP PRIMARY KEY under Rolling Schema Upgrade ++# ++ ++--source include/big_test.inc ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++--connection node_1 ++CREATE TABLE ten (f1 INTEGER); ++INSERT INTO ten VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); ++ ++CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) Engine=InnoDB; ++ ++# Insert some values before the ALTER ++INSERT INTO t1 (f1) SELECT 000000 + (10000 * a1.f1) + (1000 * a2.f1) + (100 * a3.f1) + (10 * a4.f1) + a5.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5; ++ ++# Insert more values while the ALTER is running ++--send INSERT INTO t1 (f1) SELECT 100000 + (10000 * a1.f1) + (1000 * a2.f1) + (100 * a3.f1) + (10 * a4.f1) + a5.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5; ++ ++--connection node_2 ++SET GLOBAL wsrep_OSU_method = "RSU"; ++ALTER TABLE t1 DROP PRIMARY KEY; ++SET GLOBAL wsrep_OSU_method = "TOI"; ++ ++# Insert even more data after the ALTER has completed ++INSERT INTO t1 (f1) SELECT 200000 + (10000 * a1.f1) + (1000 * a2.f1) + (100 * a3.f1) + (10 * a4.f1) + a5.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5; ++ ++SELECT COUNT(*) = 300000 FROM t1; ++SELECT MAX(f1) = 299999 FROM t1; ++ ++--connection node_1 ++--reap ++SELECT COUNT(*) = 300000 FROM t1; ++SELECT MAX(f1) = 299999 FROM t1; ++ ++SET GLOBAL wsrep_OSU_method = "RSU"; ++ALTER TABLE t1 DROP PRIMARY KEY; ++SET GLOBAL wsrep_OSU_method = "TOI"; ++ ++# Insert some previously-conflicting values after the ALTER has been applied on all nodes. ++--connection node_2 ++INSERT INTO t1 (f1) VALUES (1); ++INSERT INTO t1 (f1) VALUES (10); ++ ++--connection node_1 ++SELECT COUNT(*) = 2 FROM t1 WHERE f1 = 1; ++SELECT COUNT(*) = 2 FROM t1 WHERE f1 = 10; ++ ++INSERT INTO t1 (f1) VALUES (100); ++INSERT INTO t1 (f1) VALUES (1000); ++ ++--connection node_2 ++SELECT COUNT(*) = 2 FROM t1 WHERE f1 = 100; ++SELECT COUNT(*) = 2 FROM t1 WHERE f1 = 1000; ++ ++DROP TABLE t1; ++DROP TABLE ten; +diff --git a/mysql-test/suite/galera/t/galera_rsu_error.test b/mysql-test/suite/galera/t/galera_rsu_error.test +new file mode 100644 +index 0000000..b762d2b +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_rsu_error.test +@@ -0,0 +1,31 @@ ++# ++# Test DDL errors under Rolling Schema Upgrade ++# ++ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++CREATE TABLE t1 (f1 INTEGER) Engine=InnoDB; ++INSERT INTO t1 VALUES (1), (1); ++ ++--connection node_2 ++SET GLOBAL wsrep_OSU_method = "RSU"; ++--error ER_DUP_ENTRY ++ALTER TABLE t1 ADD PRIMARY KEY (f1); ++SET GLOBAL wsrep_OSU_method = "TOI"; ++ ++# The ALTER has no effect ++SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE WHERE TABLE_NAME = 't1'; ++ ++INSERT INTO t1 VALUES (1); ++ ++--connection node_1 ++SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE WHERE TABLE_NAME = 't1'; ++SELECT COUNT(*) = 3 FROM t1; ++ ++INSERT INTO t1 VALUES (1); ++ ++--connection node_2 ++SELECT COUNT(3) = 4 FROM t1; ++ ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/t/galera_rsu_simple.test b/mysql-test/suite/galera/t/galera_rsu_simple.test +new file mode 100644 +index 0000000..ea0eec1 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_rsu_simple.test +@@ -0,0 +1,35 @@ ++# ++# Test Rolling Schema Upgrade ++# ++ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) Engine=InnoDB; ++ ++--connection node_2 ++SET GLOBAL wsrep_OSU_method = "RSU"; ++ALTER TABLE t1 ADD COLUMN f2 INTEGER; ++SET GLOBAL wsrep_OSU_method = "TOI"; ++SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; ++ ++--connection node_1 ++# The ALTER above is not visible on node_1 ++SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; ++ ++INSERT INTO t1 VALUES (1); ++ ++--connection node_2 ++# The INSERT above is now visible on node_2 ++SELECT COUNT(*) = 1 FROM t1; ++ ++INSERT INTO t1 (f1) VALUES (2); ++ ++--connection node_1 ++# The ALTER has not replicated ++SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; ++ ++# However the INSERT above has ++SELECT COUNT(*) = 2 FROM t1; ++ ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/t/galera_sbr.test b/mysql-test/suite/galera/t/galera_sbr.test +new file mode 100644 +index 0000000..b598759 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_sbr.test +@@ -0,0 +1,27 @@ ++# ++# Test behavior if the user attempts to use statement-based replication ++# ++# SBR is not currently supported but we expect that no crashes or binlog-related assertions will be triggered. ++# ++ ++--source include/have_innodb.inc ++--source include/galera_cluster.inc ++ ++--connection node_1 ++SET GLOBAL binlog_format = 'STATEMENT'; ++SET SESSION binlog_format = 'STATEMENT'; ++ ++CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; ++INSERT INTO t1 VALUES (1); ++ ++SET SESSION binlog_format = 'MIXED'; ++ ++INSERT INTO t1 VALUES (2); ++ ++--connection node_2 ++SELECT COUNT(*) = 2 FROM t1; ++ ++DROP TABLE t1; ++ ++--connection node_1 ++SET GLOBAL binlog_format = 'ROW'; +diff --git a/mysql-test/suite/galera/t/galera_sbr_binlog-master.opt b/mysql-test/suite/galera/t/galera_sbr_binlog-master.opt +new file mode 100644 +index 0000000..beae84b +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_sbr_binlog-master.opt +@@ -0,0 +1 @@ ++--log-bin +diff --git a/mysql-test/suite/galera/t/galera_sbr_binlog.test b/mysql-test/suite/galera/t/galera_sbr_binlog.test +new file mode 100644 +index 0000000..23e490a +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_sbr_binlog.test +@@ -0,0 +1,28 @@ ++# ++# Test behavior if the user attempts to use statement-based replication ++# ++# SBR is not currently supported but we expect that no crashes or binlog-related assertions will be triggered. ++# ++ ++--source include/have_log_bin.inc ++--source include/have_innodb.inc ++--source include/galera_cluster.inc ++ ++--connection node_1 ++SET GLOBAL binlog_format = 'STATEMENT'; ++SET SESSION binlog_format = 'STATEMENT'; ++ ++CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; ++INSERT INTO t1 VALUES (1); ++ ++SET SESSION binlog_format = 'MIXED'; ++ ++INSERT INTO t1 VALUES (2); ++ ++--connection node_2 ++SELECT COUNT(*) = 2 FROM t1; ++ ++DROP TABLE t1; ++ ++--connection node_1 ++SET GLOBAL binlog_format = 'ROW'; +diff --git a/mysql-test/suite/galera/t/galera_split_brain.test b/mysql-test/suite/galera/t/galera_split_brain.test +new file mode 100644 +index 0000000..4e53e96 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_split_brain.test +@@ -0,0 +1,38 @@ ++# ++# Confirm that with two nodes, killing one causes the other to stop accepting connections ++# The pc.ignore_sb=true wsrep_provider option is tested in the galera_kill_* tests. ++# ++ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++call mtr.add_suppression("WSREP: TO isolation failed for: "); ++ ++--connection node_1 ++--let $wsrep_cluster_address_orig = `SELECT @@wsrep_cluster_address` ++ ++--connection node_2 ++--source include/kill_galera.inc ++ ++--connection node_1 ++--error ER_LOCK_DEADLOCK ++CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; ++ ++# Reset the master and restart the slave so that post-test checks can run ++ ++SET GLOBAL wsrep_cluster_address = ''; ++--disable_query_log ++--eval SET GLOBAL wsrep_cluster_address = '$wsrep_cluster_address_orig'; ++--enable_query_log ++ ++--source include/start_mysqld.inc ++--sleep 5 ++--source include/wait_until_connected_again.inc ++ ++--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' ++--source include/wait_condition.inc ++ ++--sleep 5 ++ ++--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2 ++--source include/wait_until_connected_again.inc +diff --git a/mysql-test/suite/galera/t/galera_sql_log_bin_zero.test b/mysql-test/suite/galera/t/galera_sql_log_bin_zero.test +new file mode 100644 +index 0000000..b6965fa +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_sql_log_bin_zero.test +@@ -0,0 +1,25 @@ ++# ++# Test SET SESSION sql_log_bin = 0 . We expect that unlogged updates will not be replicated ++# to the slave and that there will be no assertions in the process. ++# ++ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; ++ ++SET SESSION sql_log_bin = 0; ++ ++INSERT INTO t1 VALUES (1); ++ ++SET SESSION sql_log_bin = 1; ++ ++INSERT INTO t1 VALUES (2); ++ ++ ++--connection node_2 ++SELECT COUNT(*) = 1 FROM t1; ++SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 1; ++ ++--connection node_1 ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/t/galera_ssl.cnf b/mysql-test/suite/galera/t/galera_ssl.cnf +new file mode 100644 +index 0000000..59ea286 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_ssl.cnf +@@ -0,0 +1,51 @@ ++# Use default setting for mysqld processes ++!include include/default_mysqld.cnf ++ ++[mysqld.1] ++binlog-format=row ++ ++wsrep_provider=@ENV.WSREP_PROVIDER ++wsrep_cluster_address='gcomm://' ++wsrep_provider_options='base_port=@mysqld.1.#galera_port;socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/galera-cert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/galera-key.pem' ++ ++# enforce read-committed characteristics across the cluster ++wsrep_causal_reads=ON ++wsrep_sync_wait = 7 ++ ++wsrep_node_address=127.0.0.1 ++wsrep_sst_receive_address=127.0.0.2:@mysqld.1.#sst_port ++wsrep_node_incoming_address=127.0.0.1:@mysqld.1.port ++ ++# Required for Galera ++innodb_autoinc_lock_mode=2 ++ ++[mysqld.2] ++binlog-format=row ++ ++wsrep_provider=@ENV.WSREP_PROVIDER ++wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port' ++wsrep_provider_options='base_port=@mysqld.2.#galera_port;socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/galera-cert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/galera-key.pem' ++ ++# enforce read-committed characteristics across the cluster ++wsrep_causal_reads=ON ++wsrep_sync_wait = 7 ++ ++wsrep_node_address=127.0.0.1 ++wsrep_sst_receive_address=127.0.0.2:@mysqld.2.#sst_port ++wsrep_node_incoming_address=127.0.0.1:@mysqld.2.port ++ ++# Required for Galera ++innodb_autoinc_lock_mode=2 ++ ++[ENV] ++NODE_MYPORT_1= @mysqld.1.port ++NODE_MYSOCK_1= @mysqld.1.socket ++ ++NODE_MYPORT_2= @mysqld.2.port ++NODE_MYSOCK_2= @mysqld.2.socket ++ ++NODE_GALERAPORT_1= @mysqld.1.#galera_port ++NODE_GALERAPORT_2= @mysqld.2.#galera_port ++ ++NODE_SSTPORT_1= @mysqld.1.#sst_port ++NODE_SSTPORT_2= @mysqld.2.#sst_port +diff --git a/mysql-test/suite/galera/t/galera_ssl.test b/mysql-test/suite/galera/t/galera_ssl.test +new file mode 100644 +index 0000000..8dc94dc +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_ssl.test +@@ -0,0 +1,24 @@ ++# ++# Test node connections over SSL. The accompanying galera_ssl.cnf has a customized ++# wsrep_provider_options setting that enables SSL. ++# ++# At this time, the actual operation of SSL is not visible only in the error log and not in SHOW STATUS. ++# So this test can only check that the cluster has formed and is replicating. ++# ++ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; ++SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; ++ ++CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) Engine=InnoDB; ++INSERT INTO t1 VALUES (1); ++ ++--connection node_2 ++SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; ++SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; ++ ++SELECT COUNT(*) = 1 FROM t1; ++ ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/t/galera_sst_mysqldump.cnf b/mysql-test/suite/galera/t/galera_sst_mysqldump.cnf +new file mode 100644 +index 0000000..574ae28 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_sst_mysqldump.cnf +@@ -0,0 +1,11 @@ ++!include ../galera_2nodes.cnf ++ ++# We do not set mysqldump-related SST options here because doing so on startup ++# causes the first MTR connection to be forefully dropped by Galera, which in turn confuses MTR ++ ++[mysqld.1] ++wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=1;pc.ignore_sb=true' ++ ++[mysqld.2] ++wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=1;pc.ignore_sb=true' ++ +diff --git a/mysql-test/suite/galera/t/galera_sst_mysqldump.test b/mysql-test/suite/galera/t/galera_sst_mysqldump.test +new file mode 100644 +index 0000000..0b71715 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_sst_mysqldump.test +@@ -0,0 +1,18 @@ ++--source include/big_test.inc ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++--source suite/galera/include/galera_sst_set_mysqldump.inc ++ ++--source suite/galera/include/galera_st_disconnect_slave.inc ++ ++# We set the required mysqldump SST options here so that they are used every time the server is restarted during the test ++--let $start_mysqld_params = --wsrep_sst_auth=sst:sst --wsrep_sst_method=mysqldump --wsrep-sst-receive-address=127.0.0.1:$NODE_MYPORT_2 --skip-grant-tables ++ ++--source suite/galera/include/galera_st_shutdown_slave.inc ++--source suite/galera/include/galera_st_clean_slave.inc ++ ++--source suite/galera/include/galera_st_kill_slave.inc ++--source suite/galera/include/galera_st_kill_slave_ddl.inc ++ ++--source suite/galera/include/galera_sst_restore.inc +diff --git a/mysql-test/suite/galera/t/galera_sst_rsync.cnf b/mysql-test/suite/galera/t/galera_sst_rsync.cnf +new file mode 100644 +index 0000000..93981d9 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_sst_rsync.cnf +@@ -0,0 +1,11 @@ ++!include ../galera_2nodes.cnf ++ ++[mysqld] ++wsrep_sst_method=rsync ++ ++[mysqld.1] ++wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=1;pc.ignore_sb=true' ++ ++[mysqld.2] ++wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=1;pc.ignore_sb=true' ++ +diff --git a/mysql-test/suite/galera/t/galera_sst_rsync.test b/mysql-test/suite/galera/t/galera_sst_rsync.test +new file mode 100644 +index 0000000..c682379 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_sst_rsync.test +@@ -0,0 +1,9 @@ ++--source include/big_test.inc ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++--source suite/galera/include/galera_st_shutdown_slave.inc ++--source suite/galera/include/galera_st_clean_slave.inc ++ ++--source suite/galera/include/galera_st_kill_slave.inc ++--source suite/galera/include/galera_st_kill_slave_ddl.inc +diff --git a/mysql-test/suite/galera/t/galera_sst_xtrabackup-v2.cnf b/mysql-test/suite/galera/t/galera_sst_xtrabackup-v2.cnf +new file mode 100644 +index 0000000..47cb3e0 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_sst_xtrabackup-v2.cnf +@@ -0,0 +1,13 @@ ++!include ../galera_2nodes.cnf ++ ++[mysqld] ++wsrep_sst_method=xtrabackup-v2 ++wsrep_sst_auth="root:" ++wsrep_debug=ON ++ ++[mysqld.1] ++wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=1;pc.ignore_sb=true' ++ ++[mysqld.2] ++wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=1;pc.ignore_sb=true' ++ +diff --git a/mysql-test/suite/galera/t/galera_sst_xtrabackup-v2.test b/mysql-test/suite/galera/t/galera_sst_xtrabackup-v2.test +new file mode 100644 +index 0000000..c682379 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_sst_xtrabackup-v2.test +@@ -0,0 +1,9 @@ ++--source include/big_test.inc ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++--source suite/galera/include/galera_st_shutdown_slave.inc ++--source suite/galera/include/galera_st_clean_slave.inc ++ ++--source suite/galera/include/galera_st_kill_slave.inc ++--source suite/galera/include/galera_st_kill_slave_ddl.inc +diff --git a/mysql-test/suite/galera/t/galera_status_cluster.test b/mysql-test/suite/galera/t/galera_status_cluster.test +new file mode 100644 +index 0000000..3299613 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_status_cluster.test +@@ -0,0 +1,18 @@ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++# ++# A simple test for the wsrep_cluster_* status variables ++# ++ ++--connection node_1 ++ ++SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; ++SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; ++ ++--connection node_2 ++ ++SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; ++SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; ++ ++ +diff --git a/mysql-test/suite/galera/t/galera_status_local_state.test b/mysql-test/suite/galera/t/galera_status_local_state.test +new file mode 100644 +index 0000000..09cdb25 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_status_local_state.test +@@ -0,0 +1,28 @@ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++# ++# Test wsrep_local_state . We can not reliably produce all possible statuses in MTR, but ++# we can at least test for the ones we can. ++# ++ ++SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state'; ++SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; ++ ++SET GLOBAL wsrep_desync = 1; ++ ++--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state'; ++--source include/wait_condition.inc ++ ++SELECT VARIABLE_VALUE = 'Donor/Desynced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; ++ ++SET GLOBAL wsrep_desync = 0; ++ ++--let $wait_condition = SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state'; ++--source include/wait_condition.inc ++ ++SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; ++ ++ ++ ++ +diff --git a/mysql-test/suite/galera/t/galera_suspend_slave.test b/mysql-test/suite/galera/t/galera_suspend_slave.test +new file mode 100644 +index 0000000..6330711 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_suspend_slave.test +@@ -0,0 +1,51 @@ ++## ++## This test tests that transactions on the master will fail if the slave ++## is made completely unresponsive by suspending the process. Resuming the ++## process should allow replication to continue to run. ++## ++ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++--connection node_1 ++CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; ++ ++--connection node_2 ++--let NODE_2_PIDFILE = `SELECT @@pid_file` ++--disconnect node_2 ++ ++--connection node_1 ++--echo Suspending node_2 ... ++--perl ++ my $pid_filename = $ENV{'NODE_2_PIDFILE'}; ++ my $mysqld_pid = `cat $pid_filename`; ++ chomp($mysqld_pid); ++ system("kill -19 $mysqld_pid"); ++ exit(0); ++EOF ++ ++--error ER_UNKNOWN_COM_ERROR,ER_LOCK_WAIT_TIMEOUT ++INSERT INTO t1 VALUES (1); ++ ++--echo Resuming node_2 ... ++--perl ++ my $pid_filename = $ENV{'NODE_2_PIDFILE'}; ++ my $mysqld_pid = `cat $pid_filename`; ++ chomp($mysqld_pid); ++ system("kill -18 $mysqld_pid"); ++ exit(0); ++EOF ++ ++--sleep 10 ++--source include/galera_wait_ready.inc ++INSERT INTO t1 VALUES (1); ++ ++--let $galera_connection_name = node_2a ++--let $galera_server_number = 2 ++--source include/galera_connect.inc ++--connection node_2a ++ ++--source include/galera_wait_ready.inc ++SELECT COUNT(*) = 1 FROM t1; ++ ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/t/galera_toi_alter_auto_increment.test b/mysql-test/suite/galera/t/galera_toi_alter_auto_increment.test +new file mode 100644 +index 0000000..641d210 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_toi_alter_auto_increment.test +@@ -0,0 +1,120 @@ ++ ++# ++# Test the operation of ALTER TABLE ... AUTO_INCREMENT ++# ++ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++--connection node_1 ++CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB; ++INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); ++ ++CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 INTEGER) ENGINE=InnoDB; ++ ++INSERT INTO t1 (f2) SELECT 1 FROM ten; ++ ++--connection node_2 ++INSERT INTO t1 (f2) SELECT 1 FROM ten; ++ ++ALTER TABLE t1 AUTO_INCREMENT = 1000; ++INSERT INTO t1 (f2) SELECT 1 FROM ten; ++ ++--connection node_1 ++INSERT INTO t1 (f2) SELECT 1 FROM ten; ++ ++SELECT MIN(f1) >= 1000, COUNT(*) = 20, COUNT(DISTINCT f1) = 20 FROM t1 WHERE f1 >= 1000; ++ ++--connection node_2 ++SELECT MIN(f1) >= 1000, COUNT(*) = 20, COUNT(DISTINCT f1) = 20 FROM t1 WHERE f1 >= 1000; ++ ++# ++# AUTO_INCREMENT set to a value lower than the current one. ++# The ALTER does nothing, the sequence continues from the current maximum. ++# ++ ++--connection node_1 ++ALTER TABLE t1 AUTO_INCREMENT = 5; ++INSERT INTO t1 (f2) SELECT 1 FROM ten; ++ ++--connection node_2 ++INSERT INTO t1 (f2) SELECT 1 FROM ten; ++SELECT MIN(f1) >= 1000, COUNT(*) = 40, COUNT(DISTINCT f1) = 40 FROM t1 WHERE f1 >= 1000; ++ ++--connection node_1 ++SELECT MIN(f1) >= 1000, COUNT(*) = 40, COUNT(DISTINCT f1) = 40 FROM t1 WHERE f1 >= 1000; ++ ++DROP TABLE t1; ++ ++# ++# Under wsrep_auto_increment_control = OFF ++# ++ ++--connection node_1 ++--let $auto_increment_control_orig = `SELECT @@wsrep_auto_increment_control` ++--let $auto_increment_increment_node1 = `SELECT @@auto_increment_increment` ++--let $auto_increment_offset_node1 = `SELECT @@auto_increment_offset` ++ ++# Restore stock MySQL defaults ++SET GLOBAL wsrep_auto_increment_control = OFF; ++SET GLOBAL auto_increment_increment = 1; ++SET GLOBAL auto_increment_offset = 1; ++ ++#Open a fresh connection to node_1 so that the variables above take effect ++--let $galera_connection_name = node_1a ++--let $galera_server_number = 1 ++--source include/galera_connect.inc ++ ++--connection node_2 ++--let $auto_increment_increment_node2 = `SELECT @@auto_increment_increment` ++--let $auto_increment_offset_node2 = `SELECT @@auto_increment_offset` ++ ++SET GLOBAL wsrep_auto_increment_control = OFF; ++SET GLOBAL auto_increment_increment = 1; ++SET GLOBAL auto_increment_offset = 1; ++ ++#Open a fresh connection to node_2 ++--let $galera_connection_name = node_2a ++--let $galera_server_number = 2 ++--source include/galera_connect.inc ++ ++--connection node_1a ++ ++CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 INTEGER) ENGINE=InnoDB; ++ ++--connection node_2a ++ ++ALTER TABLE t1 AUTO_INCREMENT=100; ++ ++--connection node_1a ++INSERT INTO t1 (f2) SELECT 1 FROM ten; ++ ++--connection node_2a ++INSERT INTO t1 (f2) SELECT 1 FROM ten; ++ ++SELECT MIN(f1) = 100, MAX(f1) = 119, COUNT(f1) = 20, COUNT(DISTINCT f1) = 20 FROM t1; ++ ++--connection node_1a ++SELECT MIN(f1) = 100, MAX(f1) = 119, COUNT(f1) = 20, COUNT(DISTINCT f1) = 20 FROM t1; ++ ++DROP TABLE t1; ++ ++# ++# Restore all variables as they were ++# ++ ++--disable_query_log ++ ++--connection node_1 ++--eval SET GLOBAL wsrep_auto_increment_control = $auto_increment_control_orig ++--eval SET GLOBAL auto_increment_increment = $auto_increment_increment_node1 ++--eval SET GLOBAL auto_increment_offset = $auto_increment_offset_node1 ++ ++--connection node_2 ++--eval SET GLOBAL wsrep_auto_increment_control = $auto_increment_control_orig ++--eval SET GLOBAL auto_increment_increment = $auto_increment_increment_node2 ++--eval SET GLOBAL auto_increment_offset = $auto_increment_offset_node2 ++ ++--enable_query_log ++ ++DROP TABLE ten; +diff --git a/mysql-test/suite/galera/t/galera_toi_ddl_error.test b/mysql-test/suite/galera/t/galera_toi_ddl_error.test +new file mode 100644 +index 0000000..c586d97 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_toi_ddl_error.test +@@ -0,0 +1,29 @@ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++--source include/big_test.inc ++ ++# ++# Test the operation of DDLs that fail partway through ++# ++ ++CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB; ++INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); ++ ++CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; ++ ++# Insert 100K rows ++INSERT INTO t1 (f1) SELECT (10000 * a1.f1) + (1000 * a2.f1) + (100 * a3.f1) + (10 * a4.f1) + a5.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5; ++ ++# Insert one duplicate value ++INSERT INTO t1 (f1) SELECT MAX(f1) FROM t1; ++ ++--connection node_2 ++--error ER_DUP_ENTRY ++ALTER TABLE t1 ADD PRIMARY KEY (f1); ++SHOW CREATE TABLE t1; ++ ++--connection node_1 ++SHOW CREATE TABLE t1; ++ ++DROP TABLE t1; ++DROP TABLE ten; +diff --git a/mysql-test/suite/galera/t/galera_toi_ddl_fk_insert.test b/mysql-test/suite/galera/t/galera_toi_ddl_fk_insert.test +new file mode 100644 +index 0000000..1f44693 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_toi_ddl_fk_insert.test +@@ -0,0 +1,70 @@ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++--source include/big_test.inc ++ ++# ++# This test creates a new FK constraint while concurrent INSERTS are running ++# ++ ++CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB; ++INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); ++ ++CREATE TABLE parent ( ++ id INT PRIMARY KEY AUTO_INCREMENT, ++ f2 INTEGER, ++ KEY (id) ++) ENGINE=InnoDB; ++ ++CREATE TABLE child ( ++ id INT PRIMARY KEY AUTO_INCREMENT, ++ parent_id INT ++) ENGINE=InnoDB; ++ ++INSERT INTO parent VALUES (DEFAULT, 0); ++ ++--connection node_2 ++--send INSERT INTO child (parent_id) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4; ++ ++--let $galera_connection_name = node_1a ++--let $galera_server_number = 1 ++--source include/galera_connect.inc ++--connection node_1a ++--send INSERT INTO parent (f2) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4; ++ ++--let $galera_connection_name = node_2a ++--let $galera_server_number = 2 ++--source include/galera_connect.inc ++--connection node_2a ++--send INSERT INTO parent (f2) SELECT 2 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4; ++ ++--let $galera_connection_name = node_1b ++--let $galera_server_number = 1 ++--source include/galera_connect.inc ++--connection node_1b ++--sleep 2 ++--send ALTER TABLE child ADD FOREIGN KEY (parent_id) REFERENCES parent(id); ++ ++--connection node_1a ++--reap ++ ++--connection node_1b ++--reap ++ ++--connection node_2 ++--reap ++ ++--connection node_2a ++--reap ++ ++--connection node_1 ++SELECT COUNT(*) = 20001 FROM parent; ++SELECT COUNT(*) = 10000 FROM child; ++ ++--connection node_2 ++SELECT COUNT(*) = 20001 FROM parent; ++SELECT COUNT(*) = 10000 FROM child; ++ ++DROP TABLE child; ++DROP TABLE parent; ++ ++DROP TABLE ten; +diff --git a/mysql-test/suite/galera/t/galera_toi_ddl_locking.test b/mysql-test/suite/galera/t/galera_toi_ddl_locking.test +new file mode 100644 +index 0000000..24f918a +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_toi_ddl_locking.test +@@ -0,0 +1,70 @@ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++--source include/have_debug.inc ++--source include/have_debug_sync.inc ++ ++# ++# Test that DDL indeed causes all nodes to block so even unrelated updates ++# are not allowed to proceed. We block the DDL using DBUG_SYNC ++# ++ ++CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; ++CREATE TABLE t2 (f1 INTEGER) ENGINE=InnoDB; ++ ++--connection node_1 ++SET DEBUG_SYNC = 'alter_table_before_open_tables WAIT_FOR continue'; ++--send ALTER TABLE t1 ADD COLUMN f2 INTEGER; ++ ++--let $galera_connection_name = node_1a ++--let $galera_server_number = 1 ++--source include/galera_connect.inc ++ ++--let $galera_connection_name = node_1b ++--let $galera_server_number = 1 ++--source include/galera_connect.inc ++ ++--connection node_1a ++SET SESSION wsrep_sync_wait = 0; ++ ++# Allowed ++SELECT COUNT(*) = 0 FROM t1; ++ ++# Allowed ++SELECT COUNT(*) = 0 FROM t2; ++ ++# Not allowed ++--error ER_LOCK_DEADLOCK ++INSERT INTO t1 VALUES (1); ++ ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++ ++# Allowed ++INSERT INTO t2 VALUES (1); ++ ++# Hangs ++--send COMMIT; ++--sleep 1 ++ ++--connection node_1b ++SET SESSION wsrep_sync_wait = 0; ++ ++# The Commit issued above is still not done ++SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO = 'Commit'; ++SELECT COUNT(*) = 0 FROM t2; ++SET DEBUG_SYNC= 'now SIGNAL continue'; ++ ++--connection node_1a ++--reap ++ ++--connection node_1 ++--reap ++SELECT COUNT(*) = 0 FROM t1; ++SELECT COUNT(*) = 1 FROM t2; ++ ++--connection node_2 ++SELECT COUNT(*) = 0 FROM t1; ++SELECT COUNT(*) = 1 FROM t2; ++ ++DROP TABLE t1; ++DROP TABLE t2; +diff --git a/mysql-test/suite/galera/t/galera_toi_ddl_nonconflicting.test b/mysql-test/suite/galera/t/galera_toi_ddl_nonconflicting.test +new file mode 100644 +index 0000000..821f7a6 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_toi_ddl_nonconflicting.test +@@ -0,0 +1,30 @@ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++# ++# In this test, we simultaneously send two non-conflicting ALTER TABLE statements ++# ++ ++CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 INTEGER); ++ ++--connection node_2 ++--send ALTER TABLE t1 ADD COLUMN f3 INTEGER; INSERT INTO t1 (f1, f2) VALUES (DEFAULT, 123); ++ ++--connection node_1 ++--send CREATE UNIQUE INDEX i1 ON t1(f2); ++ ++--connection node_2 ++--reap ++INSERT INTO t1 (f1, f2) VALUES (DEFAULT, 234); ++ ++SELECT COUNT(*) = 3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; ++SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME = 't1'; ++SELECT COUNT(*) = 2 FROM t1; ++ ++--connection node_1 ++--reap ++SELECT COUNT(*) = 3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; ++SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME = 't1'; ++SELECT COUNT(*) = 2 FROM t1; ++ ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/t/galera_toi_ddl_sequential.test b/mysql-test/suite/galera/t/galera_toi_ddl_sequential.test +new file mode 100644 +index 0000000..51eae70 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_toi_ddl_sequential.test +@@ -0,0 +1,29 @@ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++# ++# In this test, we send two ALTER TABLE statements that would only work if executed in the right order ++# ++ ++CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; ++INSERT INTO t1 VALUES (1); ++ ++--connection node_2 ++ALTER TABLE t1 ADD COLUMN f2 INTEGER; ++INSERT INTO t1 VALUES (2, 3); ++ ++--connection node_1 ++ALTER TABLE t1 DROP COLUMN f2; ++INSERT INTO t1 VALUES (4); ++ ++--connection node_2 ++SHOW CREATE TABLE t1; ++SELECT COUNT(*) = 3 FROM t1; ++SELECT * FROM t1 ORDER BY f1; ++ ++--connection node_1 ++SHOW CREATE TABLE t1; ++SELECT COUNT(*) = 3 FROM t1; ++SELECT * FROM t1 ORDER BY f1; ++ ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/t/galera_toi_ftwrl.test b/mysql-test/suite/galera/t/galera_toi_ftwrl.test +new file mode 100644 +index 0000000..4d0edef +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_toi_ftwrl.test +@@ -0,0 +1,22 @@ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++# ++# At this time, issing a FLUSH TABLES WITH READ LOCK on one node does not prevent DDLs from other nodes ++# from proceeding. The locked node will apply the DDL after it has been unlocked ++# ++ ++CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB; ++ ++--connection node_2 ++FLUSH TABLES WITH READ LOCK; ++ ++--connection node_1 ++ALTER TABLE t1 ADD COLUMN f2 INTEGER; ++ ++--connection node_2 ++UNLOCK TABLES; ++SHOW CREATE TABLE t1; ++ ++DROP TABLE t1; ++ +diff --git a/mysql-test/suite/galera/t/galera_toi_lock_exclusive.test b/mysql-test/suite/galera/t/galera_toi_lock_exclusive.test +new file mode 100644 +index 0000000..3c66286 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_toi_lock_exclusive.test +@@ -0,0 +1,38 @@ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++# ++# Ensure that ALTER LOCK=EXCLUSIVE works under TOI. It is difficult to check that concurrent operations ++# are truly not possible, but at least we expect no hangs or deadlocks ++# ++ ++CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB; ++INSERT INTO t1 VALUES (1); ++ ++# Start a transaction that is concurrent to the DDL. This is not strictly necessary for this test ++# but does put more locks into play. ++--connection node_2 ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES (2); ++ ++--let $galera_connection_name = node_2a ++--let $galera_server_number = 2 ++--source include/galera_connect.inc ++--connection node_2a ++ALTER TABLE t1 ADD COLUMN f2 INTEGER, LOCK=EXCLUSIVE; ++ ++# In Galera, a concurrent transaction aborts in the face of ALTER ++--connection node_2 ++--error ER_LOCK_DEADLOCK ++COMMIT; ++ ++--connection node_1 ++INSERT INTO t1 VALUES (2, 2); ++SELECT COUNT(*) = 2 FROM t1; ++ ++--connection node_2 ++INSERT INTO t1 VALUES (3, 3); ++SELECT COUNT(*) = 3 FROM t1; ++ ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/t/galera_toi_lock_shared.test b/mysql-test/suite/galera/t/galera_toi_lock_shared.test +new file mode 100644 +index 0000000..6857a0e +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_toi_lock_shared.test +@@ -0,0 +1,23 @@ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++# ++# Ensure that ALTER LOCK=SHARED works under TOI. It is difficult to check that concurrent operations ++# will be possible, but at least we expect no hangs or deadlocks ++# ++ ++CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB; ++INSERT INTO t1 VALUES (1); ++ ++--connection node_2 ++ALTER TABLE t1 ADD COLUMN f2 INTEGER, LOCK=SHARED; ++ ++--connection node_1 ++INSERT INTO t1 VALUES (2, 2); ++SELECT COUNT(*) = 2 FROM t1; ++ ++--connection node_2 ++INSERT INTO t1 VALUES (3, 3); ++SELECT COUNT(*) = 3 FROM t1; ++ ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/t/galera_transaction_read_only.test b/mysql-test/suite/galera/t/galera_transaction_read_only.test +new file mode 100644 +index 0000000..386d73f +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_transaction_read_only.test +@@ -0,0 +1,58 @@ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++# ++# Ensure that transactions that do not write anything do not cause the wsrep_last_committed counter to advance ++# ++ ++# Empty transaction ++ ++--connection node_1 ++CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB; ++ ++--connection node_2 ++--let $wsrep_last_committed_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'` ++ ++--connection node_1 ++ ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++COMMIT; ++ ++--connection node_2 ++--let $wsrep_last_committed_after = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'` ++--disable_query_log ++--eval SELECT $wsrep_last_committed_after = $wsrep_last_committed_before AS wsrep_last_committed_diff; ++--enable_query_log ++ ++# START TRANSACTION READ ONLY ++ ++--connection node_2 ++--let $wsrep_last_committed_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'` ++ ++--connection node_1 ++START TRANSACTION READ ONLY; ++SELECT COUNT(*) = 0 FROM t1; ++COMMIT; ++ ++--connection node_2 ++--let $wsrep_last_committed_after = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'` ++--disable_query_log ++--eval SELECT $wsrep_last_committed_after = $wsrep_last_committed_before AS wsrep_last_committed_diff; ++--enable_query_log ++ ++# Ordinary transaction with only SELECTs ++ ++--connection node_1 ++START TRANSACTION; ++SELECT COUNT(*) = 0 FROM t1; ++COMMIT; ++ ++--connection node_2 ++--let $wsrep_last_committed_after = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'` ++--disable_query_log ++--eval SELECT $wsrep_last_committed_after = $wsrep_last_committed_before AS wsrep_last_committed_diff; ++--enable_query_log ++ ++DROP TABLE t1; ++ +diff --git a/mysql-test/suite/galera/t/galera_transaction_replay.test b/mysql-test/suite/galera/t/galera_transaction_replay.test +new file mode 100644 +index 0000000..d2c74ab +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_transaction_replay.test +@@ -0,0 +1,63 @@ ++# ++# This test tests the operation of transaction replay. If a potentially conflicting remote transaction arrives at ++# just the right time during the commit of a local transaction, the local transaction will be aborted and replayed. ++# ++ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++--source include/have_debug_sync.inc ++--source suite/galera/include/galera_have_debug_sync.inc ++ ++--let $wsrep_local_replays_old = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_replays'` ++ ++CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1)); ++INSERT INTO t1 VALUES (1, 'a'); ++INSERT INTO t1 VALUES (2, 'a'); ++ ++--connection node_1 ++SET AUTOCOMMIT=ON; ++START TRANSACTION; ++ ++UPDATE t1 SET f2 = 'b' WHERE f1 = 1; ++SELECT * FROM t1 WHERE f1 = 2 FOR UPDATE; ++ ++# Block the commit ++--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 ++SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_enter_sync'; ++ ++--connection node_1 ++--send COMMIT; ++ ++# Wait until commit is blocked ++--connection node_1a ++SET SESSION wsrep_sync_wait = 0; ++--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_debug_sync_waiters' AND VARIABLE_VALUE = 'apply_monitor_enter_sync' ++--source include/wait_condition.inc ++ ++# Issue a conflicting update on node #2 ++--connection node_2 ++UPDATE t1 SET f2 = 'c' WHERE f1 = 2; ++ ++# Unblock the commit ++--connection node_1a ++SET GLOBAL wsrep_provider_options = 'dbug='; ++SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_enter_sync'; ++ ++# Commit succeeds ++--connection node_1 ++--reap ++ ++SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'b'; ++SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'c'; ++ ++# wsrep_local_replays has increased by 1 ++--let $wsrep_local_replays_new = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_replays'` ++--disable_query_log ++--eval SELECT $wsrep_local_replays_new - $wsrep_local_replays_old = 1 AS wsrep_local_replays; ++--enable_query_log ++ ++--connection node_2 ++SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'b'; ++SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'c'; ++ ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/t/galera_truncate.test b/mysql-test/suite/galera/t/galera_truncate.test +new file mode 100644 +index 0000000..79f9bad +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_truncate.test +@@ -0,0 +1,57 @@ ++# ++# Test TRUNCATE ++# ++ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++# ++# Simple case ++# ++ ++CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) Engine=InnoDB; ++ ++INSERT INTO t1 VALUES (1); ++ ++--connection node_2 ++TRUNCATE TABLE t1; ++SELECT COUNT(*) = 0 FROM t1; ++ ++--connection node_1 ++SELECT COUNT(*) = 0 FROM t1; ++ ++# ++# Table with no PK ++# ++ ++--connection node_2 ++CREATE TABLE t2 (f1 VARCHAR(255)) Engine=InnoDB; ++INSERT INTO t2 VALUES ('abc'); ++ ++--connection node_1 ++TRUNCATE TABLE t2; ++ ++--connection node_2 ++SELECT COUNT(*) = 0 FROM t2; ++ ++# ++# Table with AUTO_INCREMENT. The AUTO_INCREMENT counter must be reset on all nodes ++# ++ ++--connection node_1 ++CREATE TABLE t3 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY) Engine=InnoDB; ++INSERT INTO t3 VALUES (DEFAULT),(DEFAULT),(DEFAULT),(DEFAULT),(DEFAULT); ++ ++CREATE TABLE t4 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY) Engine=InnoDB AUTO_INCREMENT=1234; ++INSERT INTO t4 VALUES (DEFAULT),(DEFAULT),(DEFAULT),(DEFAULT),(DEFAULT); ++ ++TRUNCATE TABLE t3; ++TRUNCATE TABLE t4; ++ ++--connection node_2 ++SELECT AUTO_INCREMENT = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME IN ('t3', 't4'); ++ ++DROP TABLE t1; ++DROP TABLE t2; ++DROP TABLE t3; ++DROP TABLE t4; +diff --git a/mysql-test/suite/galera/t/galera_truncate_temporary.test b/mysql-test/suite/galera/t/galera_truncate_temporary.test +new file mode 100644 +index 0000000..3ad94eb +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_truncate_temporary.test +@@ -0,0 +1,82 @@ ++# ++# Test TRUNCATE on TEMPORARY tables. It should not be replicated ++# ++ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++CREATE TEMPORARY TABLE t1 (f1 INTEGER PRIMARY KEY) Engine=InnoDB; ++ ++INSERT INTO t1 VALUES (1); ++ ++TRUNCATE TABLE t1; ++SELECT COUNT(*) = 0 FROM t1; ++ ++--connection node_2 ++--error ER_NO_SUCH_TABLE ++SELECT * FROM t1; ++ ++--connection node_1 ++DROP TABLE t1; ++ ++# ++# Test the case where a TEMPORARY table is masking an existing one ++# ++ ++CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; ++INSERT INTO t1 VALUES (1); ++ ++CREATE TEMPORARY TABLE t1 (f1 INTEGER) ENGINE=InnoDB; ++INSERT INTO t1 VALUES (2); ++ ++SELECT f1 = 2 FROM t1; ++SELECT COUNT(*) = 1 FROM t1; ++ ++TRUNCATE TABLE t1; ++ ++SELECT COUNT(*) = 0 FROM t1; ++ ++--connection node_2 ++SELECT COUNT(*) = 1 FROM t1; ++SELECT f1 = 1 FROM t1; ++ ++--connection node_1 ++ ++DROP TABLE t1; ++SELECT COUNT(*) = 1 FROM t1; ++SELECT f1 = 1 FROM t1; ++ ++TRUNCATE TABLE t1; ++SELECT COUNT(*) = 0 FROM t1; ++ ++--connection node_2 ++SELECT COUNT(*) = 0 FROM t1; ++ ++--connection node_1 ++DROP TABLE t1; ++ ++# ++# Test the case where one node has a TEMPORARY table but the TRUNCATE arrives from another node ++# ++ ++--connection node_1 ++CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; ++INSERT INTO t1 VALUES (1); ++ ++CREATE TEMPORARY TABLE t1 (f1 INTEGER) ENGINE=InnoDB; ++INSERT INTO t1 VALUES (2); ++ ++--connection node_2 ++TRUNCATE TABLE t1; ++ ++SELECT COUNT(*) = 0 FROM t1; ++ ++--connection node_1 ++SELECT f1 = 2 FROM t1; ++SELECT COUNT(*) = 1 FROM t1; ++ ++DROP TABLE t1; ++ ++SELECT COUNT(*) = 0 FROM t1; ++ ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/t/galera_udf-master.opt b/mysql-test/suite/galera/t/galera_udf-master.opt +new file mode 100644 +index 0000000..14dfe3e +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_udf-master.opt +@@ -0,0 +1,2 @@ ++$UDF_EXAMPLE_LIB_OPT ++--query_cache_type=1 +diff --git a/mysql-test/suite/galera/t/galera_unicode_identifiers.test b/mysql-test/suite/galera/t/galera_unicode_identifiers.test +new file mode 100644 +index 0000000..2f255e9 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_unicode_identifiers.test +@@ -0,0 +1,72 @@ ++# ++# Test non-ascii table, column and index names ++# ++ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++--let $wsrep_sync_wait_orig = (SELECT @@wsrep_sync_wait) ++SET GLOBAL wsrep_sync_wait = 7; ++ ++--connection node_2 ++SET GLOBAL wsrep_sync_wait = 7; ++ ++--connection node_1 ++ ++# Spaces in identifiers ++ ++CREATE DATABASE `database with space`; ++USE `database with space`; ++CREATE TABLE `table with space` ( ++ `column with space` INTEGER AUTO_INCREMENT PRIMARY KEY, ++ `second column with space` INTEGER, ++ UNIQUE `index name with space` (`second column with space`) ++); ++INSERT INTO `table with space` VALUES (DEFAULT, 1); ++ ++# Unicode identifiers ++ ++CREATE DATABASE `база`; ++USE `база`; ++CREATE TABLE `таблица` ( ++ `първа_колона` INTEGER PRIMARY KEY, ++ `втора_колона` INTEGER, ++ UNIQUE `индекс` (`втора_колона`) ++); ++ ++INSERT INTO `таблица` VALUES (1, 1); ++ ++# Without a PK ++ ++CREATE DATABASE `втора база`; ++USE `втора база`; ++CREATE TABLE `втора таблица` ( ++ `първа колона` INTEGER, ++ `втора колона` INTEGER, ++ KEY `първи индекс` (`първа колона`) ++); ++ ++INSERT INTO `втора таблица` VALUES (1, 1); ++ ++--connection node_2 ++USE `database with space`; ++SELECT `second column with space` FROM `table with space`; ++ ++USE `база`; ++SELECT * FROM `таблица`; ++ ++USE `втора база`; ++SELECT `втора колона` FROM `втора таблица`; ++ ++--eval SET GLOBAL wsrep_sync_wait = $wsrep_sync_wait_orig ++ ++--connection node_1 ++DROP TABLE `database with space`.`table with space`; ++DROP TABLE `база`.`таблица`; ++DROP TABLE `втора база`.`втора таблица`; ++ ++DROP DATABASE `database with space`; ++DROP DATABASE `база`; ++DROP DATABASE `втора база`; ++--eval SET GLOBAL wsrep_sync_wait = $wsrep_sync_wait_orig ++ +diff --git a/mysql-test/suite/galera/t/galera_unicode_pk.test b/mysql-test/suite/galera/t/galera_unicode_pk.test +new file mode 100644 +index 0000000..0d571f5 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_unicode_pk.test +@@ -0,0 +1,64 @@ ++# ++# Test non-ascii data in table where the PK is unicode ++# ++ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++CREATE TABLE t1 ( ++ f1 VARCHAR(255) PRIMARY KEY ++) ENGINE=InnoDB DEFAULT CHARSET=utf8; ++ ++INSERT INTO t1 VALUES ('текст'); ++ ++--connection node_2 ++SELECT f1 = 'текст' FROM t1; ++ ++# ++# Provoke a conflict ++# ++ ++--connection node_1 ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++UPDATE t1 SET f1 = 'текст2'; ++ ++--connection node_2 ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++UPDATE t1 SET f1 = 'текст3'; ++ ++--connection node_1 ++COMMIT; ++ ++--connection node_2 ++--error ER_LOCK_DEADLOCK ++COMMIT; ++ ++SELECT f1 = 'текст2' FROM t1; ++SELECT f1 = 'текст2' FROM t1 WHERE f1 = 'текст2'; ++ ++# ++# Provoke a duplicate key error ++# ++ ++--connection node_2 ++START TRANSACTION; ++INSERT INTO t1 VALUES ('текст4'); ++ ++--connection node_1 ++START TRANSACTION; ++INSERT INTO t1 VALUES ('текст4'); ++ ++--connection node_2 ++COMMIT; ++ ++--connection node_1 ++--error ER_LOCK_DEADLOCK ++COMMIT; ++ ++# Work around for mysql-wsrep#29 'Spurious deadlock error on a DROP TABLE' ++--error 0,ER_LOCK_DEADLOCK ++COMMIT; ++ ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/t/galera_update_limit.test b/mysql-test/suite/galera/t/galera_update_limit.test +new file mode 100644 +index 0000000..baacf2a +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_update_limit.test +@@ -0,0 +1,55 @@ ++# ++# UPDATE LIMIT should not cause any issues with row-based Galera replication ++# regardless of the order in which the rows were updated ++# ++ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++# ++# With a PK ++# ++ ++--connection node_1 ++CREATE TABLE ten (f1 INTEGER) Engine=InnoDB; ++INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); ++ ++CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) Engine=InnoDB; ++INSERT INTO t1 SELECT f1 FROM ten ORDER BY RAND(); ++ ++--connection node_2 ++UPDATE IGNORE t1 SET f1 = FLOOR(1 + (RAND() * 10)) ORDER BY RAND() LIMIT 5; ++ ++# Check that the sum of all elements and the max element are identical across nodes ++# as this will indicate that the same UPDATE was applied to both nodes ++ ++--let $sum_rows = `SELECT SUM(f1) FROM t1` ++--let $max_row = `SELECT MAX(f1) FROM t1` ++ ++--connection node_1 ++--disable_query_log ++--eval SELECT (SELECT SUM(f1) FROM t1) = $sum_rows AS sum_matches; ++--eval SELECT f1 = $max_row AS max_matches FROM t1 WHERE f1 = $max_row; ++--enable_query_log ++ ++DROP TABLE t1; ++ ++# ++# Without a PK ++# ++ ++CREATE TABLE t2 (f1 INTEGER) Engine=InnoDB; ++INSERT INTO t2 SELECT f1 FROM ten ORDER BY RAND(); ++ ++--connection node_2 ++UPDATE IGNORE t2 SET f1 = FLOOR(1 + (RAND() * 10)) ORDER BY RAND() LIMIT 5; ++ ++--let $sum_rows = `SELECT SUM(f1) FROM t2` ++ ++--connection node_1 ++--disable_query_log ++--eval SELECT (SELECT SUM(f1) FROM t2) = $sum_rows AS sum_matches; ++--enable_query_log ++ ++DROP TABLE t2; ++DROP TABLE ten; +diff --git a/mysql-test/suite/galera/t/galera_v1_row_events-master.opt b/mysql-test/suite/galera/t/galera_v1_row_events-master.opt +new file mode 100644 +index 0000000..dc82542 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_v1_row_events-master.opt +@@ -0,0 +1 @@ ++--log-bin-use-v1-row-events=1 +diff --git a/mysql-test/suite/galera/t/galera_v1_row_events.test b/mysql-test/suite/galera/t/galera_v1_row_events.test +new file mode 100644 +index 0000000..0c0a044 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_v1_row_events.test +@@ -0,0 +1,21 @@ ++# ++# Test that Galera continues to run even with --log-bin-use-v1-row-events=1 ++# ++ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++CREATE TABLE t1 (f1 INT PRIMARY KEY) ENGINE=InnoDB; ++ ++INSERT INTO t1 VALUES (1); ++ ++--connection node_2 ++SELECT COUNT(*) = 1 FROM t1; ++ ++--connection node_1 ++UPDATE t1 SET f1 = 2 WHERE f1 = 1; ++ ++--connection node_2 ++SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2; ++ ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/t/galera_var_auto_inc_control_off.test b/mysql-test/suite/galera/t/galera_var_auto_inc_control_off.test +new file mode 100644 +index 0000000..c0bbe5a +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_var_auto_inc_control_off.test +@@ -0,0 +1,105 @@ ++# ++# Test wsrep_auto_increment_control = OFF ++# We issue two concurrent INSERTs and one will fail with a deadlock error ++# ++ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++--let $auto_increment_control_orig = `SELECT @@wsrep_auto_increment_control` ++ ++# ++# Preserve existing variable values ++# ++ ++--connection node_1 ++--let $auto_increment_increment_node1 = `SELECT @@auto_increment_increment` ++--let $auto_increment_offset_node1 = `SELECT @@auto_increment_offset` ++ ++# Restore stock MySQL defaults ++SET GLOBAL wsrep_auto_increment_control = OFF; ++SET GLOBAL auto_increment_increment = 1; ++SET GLOBAL auto_increment_offset = 1; ++ ++#Open a fresh connection to node_1 so that the variables above take effect ++--let $galera_connection_name = node_1a ++--let $galera_server_number = 1 ++--source include/galera_connect.inc ++ ++--connection node_2 ++--let $auto_increment_increment_node2 = `SELECT @@auto_increment_increment` ++--let $auto_increment_offset_node2 = `SELECT @@auto_increment_offset` ++ ++SET GLOBAL wsrep_auto_increment_control = OFF; ++SET GLOBAL auto_increment_increment = 1; ++SET GLOBAL auto_increment_offset = 1; ++ ++#Open a fresh connection to node_2 ++--let $galera_connection_name = node_2a ++--let $galera_server_number = 2 ++--source include/galera_connect.inc ++ ++--connection node_1a ++SELECT @@auto_increment_increment = 1; ++SELECT @@auto_increment_offset = 1; ++ ++CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, node VARCHAR(10)) ENGINE=InnoDB; ++ ++# ++# We expect that SHOW CREATE TABLE on both nodes will return identical values ++# ++ ++SHOW CREATE TABLE t1; ++ ++--connection node_2a ++ ++SHOW CREATE TABLE t1; ++ ++--connection node_1a ++SELECT @@auto_increment_increment = 1; ++SELECT @@auto_increment_offset = 1; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (node) VALUES ('node1'); ++SELECT f1 FROM t1; ++ ++--connection node_2a ++SELECT @@auto_increment_increment = 1; ++SELECT @@auto_increment_offset = 1; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (node) VALUES ('node2'); ++SELECT f1 FROM t1; ++ ++--connection node_1a ++COMMIT; ++ ++--connection node_2a ++--error ER_LOCK_DEADLOCK ++COMMIT; ++ ++--connection node_1a ++SELECT * FROM t1; ++ ++--connection node_2a ++SELECT * FROM t1; ++ ++# ++# Restore all variables as they were ++# ++ ++--disable_query_log ++ ++--connection node_1 ++--eval SET GLOBAL wsrep_auto_increment_control = $auto_increment_control_orig ++--eval SET GLOBAL auto_increment_increment = $auto_increment_increment_node1 ++--eval SET GLOBAL auto_increment_offset = $auto_increment_offset_node1 ++ ++--connection node_2 ++--eval SET GLOBAL wsrep_auto_increment_control = $auto_increment_control_orig ++--eval SET GLOBAL auto_increment_increment = $auto_increment_increment_node2 ++--eval SET GLOBAL auto_increment_offset = $auto_increment_offset_node2 ++ ++--enable_query_log ++ ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/t/galera_var_auto_inc_control_on.test b/mysql-test/suite/galera/t/galera_var_auto_inc_control_on.test +new file mode 100644 +index 0000000..59f2615 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_var_auto_inc_control_on.test +@@ -0,0 +1,53 @@ ++# ++# Test the operation of wsrep_auto_increment_control = ON ++# ++ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++--connection node_1 ++ ++CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, node VARCHAR(10)) ENGINE=InnoDB; ++ ++# auto_increment_increment is equal to the number of nodes ++# auto_increment_offset is equal to the ID of the node ++ ++SELECT @@auto_increment_increment = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'); ++SELECT @@auto_increment_offset = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_index') + 1; ++ ++# Expect no conflicts ++--send INSERT INTO t1 VALUES (DEFAULT, 'node1'); ++ ++--connection node_2 ++--send INSERT INTO t1 VALUES (DEFAULT, 'node2'); ++ ++--connection node_1 ++--reap ++ ++--connection node_2 ++--reap ++ ++SELECT @@auto_increment_increment = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'); ++SELECT @@auto_increment_offset = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_index') + 1; ++ ++# Expect no conflicts ++--send INSERT INTO t1 VALUES (DEFAULT, 'node2'), (DEFAULT, 'node2'), (DEFAULT, 'node2'), (DEFAULT, 'node2'), (DEFAULT, 'node2'), (DEFAULT, 'node2'), (DEFAULT, 'node2'), (DEFAULT, 'node2'), (DEFAULT, 'node2'), (DEFAULT, 'node2'); ++ ++--connection node_1 ++--send INSERT INTO t1 VALUES (DEFAULT, 'node1'), (DEFAULT, 'node1'), (DEFAULT, 'node1'), (DEFAULT, 'node1'), (DEFAULT, 'node1'), (DEFAULT, 'node1'), (DEFAULT, 'node1'), (DEFAULT, 'node1'), (DEFAULT, 'node1'), (DEFAULT, 'node1'); ++ ++--connection node_2 ++--reap ++ ++--connection node_1 ++--reap ++ ++--connection node_2 ++SELECT COUNT(*) = 22 FROM t1; ++SELECT COUNT(DISTINCT f1) = 22 FROM t1; ++ ++--connection node_1 ++SELECT COUNT(*) = 22 FROM t1; ++SELECT COUNT(DISTINCT f1) = 22 FROM t1; ++ ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/t/galera_var_certify_nonPK_off.test b/mysql-test/suite/galera/t/galera_var_certify_nonPK_off.test +new file mode 100644 +index 0000000..f7967da +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_var_certify_nonPK_off.test +@@ -0,0 +1,39 @@ ++# ++# Test wsrep_certify_nonPK = OFF ++# ++ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++--let $wsrep_certify_nonPK_orig = `SELECT @@wsrep_certify_nonPK` ++SET GLOBAL wsrep_certify_nonPK = OFF; ++ ++--connection node_2 ++SET GLOBAL wsrep_certify_nonPK = OFF; ++ ++--connection node_1 ++CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB /* Table has no primary key */; ++CREATE TABLE t2 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; ++ ++# All DML without a PK is rejected with an error ++--error ER_LOCK_DEADLOCK ++INSERT INTO t1 VALUES (1), (2); ++ ++# DML with a PK is allowed to proceed ++INSERT INTO t2 VALUES (1), (2); ++UPDATE t2 SET f1 = 3 WHERE f1 = 1; ++ ++--connection node_2 ++SELECT COUNT(*) = 0 FROM t1; ++SELECT COUNT(*) = 2 FROM t2; ++SELECT COUNT(*) = 1 FROM t2 WHERE f1 = 3; ++ ++--connection node_1 ++--eval SET GLOBAL wsrep_certify_nonPK = $wsrep_certify_nonPK_orig ++ ++--connection node_2 ++--eval SET GLOBAL wsrep_certify_nonPK = $wsrep_certify_nonPK_orig ++ ++DROP TABLE t1; ++DROP TABLE t2; ++ +diff --git a/mysql-test/suite/galera/t/galera_var_cluster_address.test b/mysql-test/suite/galera/t/galera_var_cluster_address.test +new file mode 100644 +index 0000000..609c62c +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_var_cluster_address.test +@@ -0,0 +1,105 @@ ++# ++# Check the handling of @@wsrep_cluster_address ++# ++ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++# ++# Set to invalid value ++# ++ ++--connection node_1 ++--let $wsrep_cluster_address_node1 = `SELECT @@wsrep_cluster_address` ++SET GLOBAL wsrep_cluster_address = 'foo://'; ++ ++# With wsrep_sync_wait, this returns an error ++--error ER_LOCK_WAIT_TIMEOUT ++SHOW STATUS; ++ ++SET SESSION wsrep_sync_wait=0; ++ ++--error ER_UNKNOWN_COM_ERROR ++SELECT * FROM INFORMATION_SCHEMA.GLOBAL_STATUS; ++ ++# Must return 'OFF' ++SHOW STATUS LIKE 'wsrep_ready'; ++ ++# Must return 'Non-primary' ++SHOW STATUS LIKE 'wsrep_cluster_status'; ++ ++# Must return 0 = 'Initialized' ++SHOW STATUS LIKE 'wsrep_local_state'; ++SHOW STATUS LIKE 'wsrep_local_state_comment'; ++ ++--connection node_2 ++--sleep 1 ++# Node #2 thinks that it is now part of a single-node primary cluster ++SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; ++SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; ++ ++# ++# Reset everything as it was ++# ++ ++--connection node_1 ++--disable_query_log ++--eval SET GLOBAL wsrep_cluster_address = '$wsrep_cluster_address_node1'; ++--enable_query_log ++ ++--connection node_2 ++SET GLOBAL wsrep_cluster_address = @@wsrep_cluster_address; ++ ++--source include/wait_until_connected_again.inc ++ ++--connection node_1 ++SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; ++SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; ++ ++# ++# Set to invalid host ++# ++ ++--connection node_1 ++SET GLOBAL wsrep_cluster_address = 'gcomm://192.0.2.1'; ++ ++--error ER_UNKNOWN_COM_ERROR ++SELECT * FROM INFORMATION_SCHEMA.GLOBAL_STATUS; ++ ++# Must return 'OFF' ++SHOW STATUS LIKE 'wsrep_ready'; ++ ++# Must return 'Non-primary' ++SHOW STATUS LIKE 'wsrep_cluster_status'; ++ ++# Must return 0 = 'Initialized' ++SHOW STATUS LIKE 'wsrep_local_state'; ++SHOW STATUS LIKE 'wsrep_local_state_comment'; ++ ++# ++# Reset everything as it was ++# ++ ++--connection node_1 ++--disable_query_log ++--eval SET GLOBAL wsrep_cluster_address = '$wsrep_cluster_address_node1'; ++--enable_query_log ++ ++--connection node_2 ++SET GLOBAL wsrep_cluster_address = @@wsrep_cluster_address; ++--sleep 1 ++ ++--connection node_1 ++SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; ++SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; ++ ++CALL mtr.add_suppression("Backend not supported: foo"); ++CALL mtr.add_suppression("Failed to initialize backend using 'foo"); ++CALL mtr.add_suppression("Failed to open channel 'my_wsrep_cluster' at 'foo"); ++CALL mtr.add_suppression("gcs connect failed: Socket type not supported"); ++CALL mtr.add_suppression("wsrep::connect\\(\\) failed: 7"); ++CALL mtr.add_suppression("gcs_caused\\(\\) returned -103 \\(Software caused connection abort\\)"); ++CALL mtr.add_suppression("failed to open gcomm backend connection: 110: failed to reach primary view: 110"); ++CALL mtr.add_suppression("Failed to open backend connection: -110 \\(Connection timed out\\)"); ++CALL mtr.add_suppression("Failed to open channel 'my_wsrep_cluster' at 'gcomm://192\\.0\\.2\\.1': -110 \\(Connection timed out\\)"); ++CALL mtr.add_suppression("gcs connect failed: Connection timed out"); +diff --git a/mysql-test/suite/galera/t/galera_var_desync_on.test b/mysql-test/suite/galera/t/galera_var_desync_on.test +new file mode 100644 +index 0000000..fb0fb9f +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_var_desync_on.test +@@ -0,0 +1,58 @@ ++# ++# Test wsrep_desync = ON . Node should temporarily not participate in flow control ++# so even if fc_limit has been reached, the master should be able to continue to ++# commit transactions. ++# ++ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; ++INSERT INTO t1 VALUES (1); ++ ++--connection node_2 ++--let $wsrep_provider_options_orig = `SELECT @@wsrep_provider_options` ++SET GLOBAL wsrep_provider_options = 'gcs.fc_limit=1'; ++SET GLOBAL wsrep_desync = TRUE; ++ ++# Block the slave applier thread ++FLUSH TABLES WITH READ LOCK; ++ ++--connection node_1 ++ ++# Without wsrep_desync = TRUE it would not be possible to perform 10 inserts on the master with gcs.fc_limit=1 ++INSERT INTO t1 VALUES (2); ++INSERT INTO t1 VALUES (3); ++INSERT INTO t1 VALUES (4); ++INSERT INTO t1 VALUES (5); ++INSERT INTO t1 VALUES (6); ++INSERT INTO t1 VALUES (7); ++INSERT INTO t1 VALUES (8); ++INSERT INTO t1 VALUES (9); ++INSERT INTO t1 VALUES (10); ++--sleep 1 ++ ++--connection node_2 ++SET SESSION wsrep_sync_wait = 0; ++# No updates have arrived after the FLUSH TABLES ++SELECT COUNT(*) = 1 FROM t1; ++ ++# Resync the slave ++SET GLOBAL wsrep_desync = FALSE; ++--disable_query_log ++--eval SET GLOBAL wsrep_provider_options = '$wsrep_provider_options_orig'; ++--enable_query_log ++UNLOCK TABLES; ++ ++SET SESSION wsrep_sync_wait = 1; ++# The slave is now fully caught up ++SELECT COUNT(*) = 10 FROM t1; ++ ++--connection node_1 ++INSERT INTO t1 VALUES (11); ++ ++--connection node_2 ++# Replication continues normally ++SELECT COUNT(*) = 11 FROM t1; ++ ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/t/galera_var_fkchecks.test b/mysql-test/suite/galera/t/galera_var_fkchecks.test +new file mode 100644 +index 0000000..c771b50 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_var_fkchecks.test +@@ -0,0 +1,40 @@ ++# ++# Test the operation on the foreign_key_checks variable ++# ++ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++CREATE TABLE parent ( ++ id INT PRIMARY KEY, ++ KEY (id) ++) ENGINE=InnoDB; ++ ++CREATE TABLE child ( ++ id INT PRIMARY KEY, ++ parent_id INT, ++ FOREIGN KEY (parent_id) ++ REFERENCES parent(id) ++) ENGINE=InnoDB; ++ ++INSERT INTO parent VALUES (1); ++INSERT INTO child VALUES (1,1); ++ ++SET SESSION foreign_key_checks = 0; ++ ++INSERT INTO child VALUES (2,2); ++ ++--connection node_2 ++SELECT COUNT(*) = 1 FROM child WHERE id = 2; ++ ++--error ER_NO_REFERENCED_ROW_2 ++INSERT INTO child VALUES (3,3); ++ ++SET SESSION foreign_key_checks = 0; ++DELETE FROM parent; ++ ++--connection node_1 ++SELECT COUNT(*) = 0 FROM parent; ++ ++DROP TABLE child; ++DROP TABLE parent; +diff --git a/mysql-test/suite/galera/t/galera_var_innodb_disallow_writes.test b/mysql-test/suite/galera/t/galera_var_innodb_disallow_writes.test +new file mode 100644 +index 0000000..c08483b +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_var_innodb_disallow_writes.test +@@ -0,0 +1,33 @@ ++# ++# This test checks that innodb_disallow_writes works as expected ++# ++ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++# Open a separate connection to be used to run SHOW PROCESSLIST ++--let $galera_connection_name = node_1a ++--let $galera_server_number = 1 ++--source include/galera_connect.inc ++--connection node_1a ++SET SESSION wsrep_sync_wait = 0; ++ ++--connection node_1 ++CREATE TABLE t1 (f1 INTEGER) Engine=InnoDB; ++SET GLOBAL innodb_disallow_writes=ON; ++--send INSERT INTO t1 VALUES (1); ++ ++--connection node_1a ++let $wait_condition = SELECT 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO = 'INSERT INTO t1 VALUES (1)' AND State = 'query end'; ++--source include/wait_condition.inc ++ ++SET GLOBAL innodb_disallow_writes=OFF; ++ ++--connection node_1 ++--reap ++SELECT COUNT(*) = 1 FROM t1; ++ ++--connection node_2 ++SELECT COUNT(*) = 1 FROM t1; ++ ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/t/galera_var_load_data_splitting.test b/mysql-test/suite/galera/t/galera_var_load_data_splitting.test +new file mode 100644 +index 0000000..0783dc8 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_var_load_data_splitting.test +@@ -0,0 +1,38 @@ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++--let $wsrep_load_data_splitting_orig = `SELECT @@wsrep_load_data_splitting` ++ ++# Create a file for LOAD DATA with 95K entries ++--perl ++open(FILE, ">", "$ENV{'MYSQLTEST_VARDIR'}/tmp/galera_var_load_data_splitting.csv") or die; ++foreach my $i (1..95000) { ++ print FILE "$i\n"; ++} ++EOF ++ ++CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; ++ ++# Record wsrep_last_committed as it was before LOAD DATA ++--connection node_2 ++--let $wsrep_last_committed_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'` ++ ++SET GLOBAL wsrep_load_data_splitting = TRUE; ++--disable_query_log ++--eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/galera_var_load_data_splitting.csv' INTO TABLE t1; ++--enable_query_log ++ ++--connection node_2 ++--let $wsrep_last_committed_after = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'` ++ ++SELECT COUNT(*) = 95000 FROM t1; ++ ++# LOAD-ing 95K rows causes 10 commits to be registered ++--disable_query_log ++--eval SELECT $wsrep_last_committed_after = $wsrep_last_committed_before + 10 AS wsrep_last_committed_diff; ++--enable_query_log ++ ++--connection node_1 ++--eval SET GLOBAL wsrep_load_data_splitting = $wsrep_load_data_splitting_orig; ++ ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/t/galera_var_max_ws_size.test b/mysql-test/suite/galera/t/galera_var_max_ws_size.test +new file mode 100644 +index 0000000..bd98bab +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_var_max_ws_size.test +@@ -0,0 +1,26 @@ ++# ++# This test sets wsrep_max_ws_size to a very low value and checks that the transaction is rejected ++# ++ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++call mtr.add_suppression('WSREP: transaction size limit.*'); ++call mtr.add_suppression('WSREP: rbr write fail.*'); ++call mtr.add_suppression('WSREP: Maximum writeset size exceeded by.*'); ++call mtr.add_suppression('WSREP: transaction size exceeded.*'); ++ ++CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 VARCHAR(1024)) Engine=InnoDB; ++ ++--let $wsrep_max_ws_size_orig = `SELECT @@wsrep_max_ws_size` ++SET GLOBAL wsrep_max_ws_size = 1024; ++ ++--error ER_ERROR_DURING_COMMIT ++INSERT INTO t1 VALUES (DEFAULT, REPEAT('X', 1024)); ++SELECT COUNT(*) = 0 FROM t1; ++ ++--disable_query_log ++--eval SET GLOBAL wsrep_max_ws_size = $wsrep_max_ws_size_orig ++--enable_query_log ++ ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/t/galera_var_mysql_replication_bundle.test b/mysql-test/suite/galera/t/galera_var_mysql_replication_bundle.test +new file mode 100644 +index 0000000..642d939 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_var_mysql_replication_bundle.test +@@ -0,0 +1,30 @@ ++# ++# Simple test for the operation on the wsrep-mysql-replication-bundle ++# ++ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++--let $wsrep_mysql_replication_bundle_orig = `SELECT @@wsrep_mysql_replication_bundle` ++ ++CREATE TABLE t1 (f1 INT PRIMARY KEY) Engine=InnoDB; ++ ++SET GLOBAL wsrep_mysql_replication_bundle = 2; ++ ++--connection node_1 ++# This statement will not be replicated immediately ++INSERT INTO t1 VALUES (1); ++ ++--connection node_2 ++SELECT COUNT(*) = 0 FROM t1; ++ ++--connection node_1 ++INSERT INTO t1 VALUES (2); ++ ++--connection node_2 ++SELECT COUNT(*) = 2 FROM t1; ++ ++--connection node_1 ++--eval SET GLOBAL wsrep_mysql_replication_bundle = $wsrep_mysql_replication_bundle_orig ++ ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/t/galera_var_notify_cmd-master.opt b/mysql-test/suite/galera/t/galera_var_notify_cmd-master.opt +new file mode 100644 +index 0000000..70dfc98 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_var_notify_cmd-master.opt +@@ -0,0 +1 @@ ++--wsrep_notify_cmd=$MYSQL_TEST_DIR/std_data/wsrep_notify.sh --wsrep-sync-wait=0 +diff --git a/mysql-test/suite/galera/t/galera_var_notify_cmd.test b/mysql-test/suite/galera/t/galera_var_notify_cmd.test +new file mode 100644 +index 0000000..4fea69f +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_var_notify_cmd.test +@@ -0,0 +1,14 @@ ++# ++# Test wsrep_notify_cmd. We use a version of the support-files/wsrep_notify.sh script that writes ++# notifications into a table. ++# ++ ++--source include/have_innodb.inc ++--source include/galera_cluster.inc ++ ++--connection node_1 ++SELECT COUNT(DISTINCT uuid) = 2 FROM mtr_wsrep_notify.membership; ++SELECT MAX(size) = 2 FROM mtr_wsrep_notify.status; ++SELECT COUNT(DISTINCT idx) = 2 FROM mtr_wsrep_notify.status; ++ ++DROP SCHEMA mtr_wsrep_notify; +diff --git a/mysql-test/suite/galera/t/galera_var_replicate_myisam_off.test b/mysql-test/suite/galera/t/galera_var_replicate_myisam_off.test +new file mode 100644 +index 0000000..a981128 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_var_replicate_myisam_off.test +@@ -0,0 +1,21 @@ ++# ++# Simple test for wsrep-replicate-myisam = FALSE ++# ++ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++--let $wsrep_replicate_myisam_orig = `SELECT @@wsrep_replicate_myisam` ++ ++SET GLOBAL wsrep_replicate_myisam = FALSE; ++ ++CREATE TABLE t1 (f1 INT PRIMARY KEY) Engine=MyISAM; ++INSERT INTO t1 VALUES (1); ++ ++--connection node_2 ++SELECT COUNT(*) = 0 FROM t1; ++ ++--connection node_1 ++--eval SET GLOBAL wsrep_replicate_myisam = $wsrep_replicate_myisam_orig ++ ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/t/galera_var_replicate_myisam_on.test b/mysql-test/suite/galera/t/galera_var_replicate_myisam_on.test +new file mode 100644 +index 0000000..a09ba2e +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_var_replicate_myisam_on.test +@@ -0,0 +1,138 @@ ++# ++# Simple test for wsrep-replicate-myisam = ON ++# ++ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++--let $wsrep_replicate_myisam_orig = `SELECT @@wsrep_replicate_myisam` ++ ++--connection node_1 ++SET GLOBAL wsrep_replicate_myisam = TRUE; ++--connection node_2 ++SET GLOBAL wsrep_replicate_myisam = TRUE; ++ ++# ++# Simple INSERT ++# ++ ++--connection node_1 ++CREATE TABLE t1 (f1 INT PRIMARY KEY) Engine=MyISAM; ++INSERT INTO t1 VALUES (1); ++INSERT INTO t1 VALUES (2), (3); ++INSERT INTO t1 SELECT 4 FROM DUAL UNION ALL SELECT 5 FROM DUAL; ++ ++--connection node_2 ++SELECT COUNT(*) = 5 FROM t1; ++ ++DROP TABLE t1; ++ ++# ++# REPLACE ++# ++ ++--connection node_1 ++CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 VARCHAR(100)) ENGINE=MyISAM; ++INSERT INTO t1 VALUES (1, 'abc'),(2,'abc'), (3, 'xxx'); ++REPLACE INTO t1 VALUES (1, 'klm'), (2,'xyz'); ++REPLACE INTO t1 SELECT 3, 'yyy' FROM DUAL; ++ ++--connection node_2 ++SELECT COUNT(*) = 3 FROM t1; ++SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1 AND f2 = 'klm'; ++SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2 AND f2 = 'xyz'; ++SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 3 AND f2 = 'yyy'; ++ ++# ++# UPDATE ++# ++ ++--connection node_1 ++UPDATE t1 SET f2 = 'zzz' WHERE f2 = 'yyy'; ++ ++--connection node_2 ++SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'zzz'; ++ ++# ++# DELETE ++# ++ ++--connection node_1 ++DELETE FROM t1 WHERE f2 = 'zzz'; ++ ++--connection node_2 ++SELECT COUNT(*) = 0 FROM t1 WHERE f2 = 'zzz'; ++ ++# ++# TRUNCATE ++# ++ ++--connection node_1 ++TRUNCATE TABLE t1; ++ ++--connection node_2 ++SELECT COUNT(*) = 0 FROM t1; ++DROP TABLE t1; ++ ++# ++# Transaction ++# ++ ++--connection node_1 ++CREATE TABLE t1 (f1 INTEGER) ENGINE=MyISAM; ++CREATE TABLE t2 (f1 INTEGER) ENGINE=InnoDB; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES (1); ++INSERT INTO t2 VALUES (1); ++COMMIT; ++ ++--connection node_2 ++SELECT COUNT(*) = 1 FROM t1; ++SELECT COUNT(*) = 1 FROM t2; ++ ++# ++# Transaction rollback ++# ++ ++--connection node_1 ++START TRANSACTION; ++INSERT INTO t1 VALUES (2); ++INSERT INTO t2 VALUES (2); ++ROLLBACK; ++ ++--connection node_2 ++SELECT COUNT(*) = 2 FROM t1; ++SELECT COUNT(*) = 1 FROM t2; ++ ++DROP TABLE t1; ++DROP TABLE t2; ++ ++# ++# Transaction conflict ++# ++ ++--connection node_1 ++CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=MyISAM; ++CREATE TABLE t2 (f2 INTEGER PRIMARY KEY) ENGINE=InnoDB; ++ ++START TRANSACTION; ++INSERT INTO t1 VALUES (1); ++INSERT INTO t2 VALUES (1); ++ ++--connection node_2 ++# The MyISAM update is replicated immediately, so a duplicate key error happens even before the COMMIT ++--error ER_DUP_ENTRY ++INSERT INTO t1 VALUES (1); ++ ++--connection node_1 ++COMMIT; ++ ++DROP TABLE t1; ++DROP TABLE t2; ++ ++--connection node_1 ++--eval SET GLOBAL wsrep_replicate_myisam = $wsrep_replicate_myisam_orig ++ ++--connection node_2 ++--eval SET GLOBAL wsrep_replicate_myisam = $wsrep_replicate_myisam_orig +diff --git a/mysql-test/suite/galera/t/galera_var_slave_threads.test b/mysql-test/suite/galera/t/galera_var_slave_threads.test +new file mode 100644 +index 0000000..a83924c +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_var_slave_threads.test +@@ -0,0 +1,70 @@ ++# ++# This tests the very basic operations around wsrep-slave-threads ++# More complex scenarios will be tested separately in the context of ++# parallel replication ++# ++ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++--let $wsrep_slave_threads_orig = `SELECT @@wsrep_slave_threads` ++ ++--connection node_1 ++CREATE TABLE t1 (f1 INT PRIMARY KEY) Engine=InnoDB; ++CREATE TABLE t2 (f1 INT AUTO_INCREMENT PRIMARY KEY) Engine=InnoDB; ++ ++--connection node_2 ++ ++# Setting wsrep_slave_threads to zero triggers a warning ++SET GLOBAL wsrep_slave_threads = 0; ++SHOW WARNINGS; ++SELECT @@wsrep_slave_threads = 1; ++ ++SET GLOBAL wsrep_slave_threads = 1; ++# There is a separate wsrep_aborter thread at all times ++SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user'; ++SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE '%wsrep aborter%'; ++ ++# ++# Increase the number of slave threads. The change takes effect immediately ++# ++ ++SET GLOBAL wsrep_slave_threads = 64; ++--sleep 0.5 ++ ++--connection node_1 ++INSERT INTO t1 VALUES (1); ++ ++--connection node_2 ++SELECT COUNT(*) = 1 FROM t1; ++ ++SELECT COUNT(*) = @@wsrep_slave_threads + 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user'; ++SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE '%wsrep aborter%'; ++ ++# ++# Reduce the number of slave threads. The change is not immediate -- a thread will only exit after a replication event ++# ++ ++SET GLOBAL wsrep_slave_threads = 1; ++ ++--connection node_1 ++ ++# Generate 64 replication events ++--let $count = 64 ++while ($count) ++{ ++ INSERT INTO t2 VALUES (DEFAULT); ++ --dec $count ++} ++ ++--connection node_2 ++SELECT COUNT(*) = 64 FROM t2; ++ ++SELECT COUNT(*) = @@wsrep_slave_threads + 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user'; ++SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE '%wsrep aborter%'; ++ ++ ++--eval SET GLOBAL wsrep_slave_threads = $wsrep_slave_threads_orig ++ ++DROP TABLE t1; ++DROP TABLE t2; +diff --git a/mysql-test/suite/galera/t/galera_var_sync_wait.test b/mysql-test/suite/galera/t/galera_var_sync_wait.test +new file mode 100644 +index 0000000..935c271 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_var_sync_wait.test +@@ -0,0 +1,43 @@ ++# ++# Simple test for the various levels of wsrep-sync-wait ++# ++ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++--let $wsrep_sync_wait_orig = `SELECT @@wsrep_sync_wait` ++ ++--connection node_1 ++CREATE TABLE t1 (f1 INT PRIMARY KEY) Engine=InnoDB; ++ ++--connection node_2 ++SET GLOBAL wsrep_sync_wait = 1; ++# Those statements should see the table ++SHOW TABLES LIKE '%t1'; ++SELECT COUNT(*) = 0 FROM t1; ++ ++--connection node_1 ++CREATE TABLE t2 (f1 INT PRIMARY KEY) Engine=InnoDB; ++ ++--connection node_2 ++SET GLOBAL wsrep_sync_wait = 4; ++# This insert should see the table and succeed ++INSERT INTO t2 VALUES (1); ++ ++--connection node_1 ++CREATE TABLE t3 (f1 INT PRIMARY KEY) Engine=InnoDB; ++INSERT INTO t3 VALUES (1); ++ ++--connection node_2 ++SET GLOBAL wsrep_sync_wait = 2; ++# This statement should see and update 1 row ++--enable_info ++UPDATE t3 SET f1 = 2; ++--disable_info ++ ++--connection node_2 ++--eval SET GLOBAL wsrep_sync_wait = $wsrep_sync_wait_orig ++ ++DROP TABLE t1; ++DROP TABLE t2; ++DROP TABLE t3; +diff --git a/mysql-test/suite/galera/t/galera_var_wsrep_on_off.test b/mysql-test/suite/galera/t/galera_var_wsrep_on_off.test +new file mode 100644 +index 0000000..783b787 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_var_wsrep_on_off.test +@@ -0,0 +1,32 @@ ++# ++# Test wsrep_on = OFF. Some events will not be replicated ++# ++ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; ++INSERT INTO t1 VALUES (1); ++SET SESSION wsrep_on = FALSE; ++ ++# This statement will not be replicated ++INSERT INTO t1 VALUES (2); ++ ++--connection node_2 ++SELECT COUNT(*) = 1 FROM t1; ++ ++--connection node_1 ++SET GLOBAL wsrep_on = TRUE; ++INSERT INTO t1 VALUES (3); ++ ++--connection node_2 ++SELECT COUNT(*) = 2 FROM t1; ++ ++# Middle insert is not replicated ++SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 2; ++ ++# Final insert is replicated ++SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 3; ++ ++DROP TABLE t1; ++ +diff --git a/mysql-test/suite/galera/t/galera_wan.cnf b/mysql-test/suite/galera/t/galera_wan.cnf +new file mode 100644 +index 0000000..37ac58a +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_wan.cnf +@@ -0,0 +1,14 @@ ++!include ../galera_4nodes.cnf ++ ++[mysqld.1] ++wsrep_provider_options='base_port=@mysqld.1.#galera_port;gmcast.segment=1' ++ ++[mysqld.2] ++wsrep_provider_options='base_port=@mysqld.2.#galera_port;gmcast.segment=1' ++ ++[mysqld.3] ++wsrep_provider_options='base_port=@mysqld.3.#galera_port;gmcast.segment=2' ++ ++[mysqld.4] ++wsrep_provider_options='base_port=@mysqld.4.#galera_port;gmcast.segment=3' ++ +diff --git a/mysql-test/suite/galera/t/galera_wan.test b/mysql-test/suite/galera/t/galera_wan.test +new file mode 100644 +index 0000000..a8fd351 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_wan.test +@@ -0,0 +1,30 @@ ++# ++# Test WAN replication and the gmcast.segment functionality. ++# The galera_wan.cnf file partitions 4 Galera nodes into 3 WAN segments ++# ++# We can not test any of the actual WAN optimizations from inside MTR and no ++# status variables are provided. So we only check that simple replication works. ++# ++ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; ++ ++--connection node_1 ++CREATE TABLE t1 (f1 INTEGER); ++ ++--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 ++--connection node_3 ++INSERT INTO t1 VALUES (1); ++CALL mtr.add_suppression("There are no nodes in the same segment that will ever be able to become donors, yet there is a suitable donor outside"); ++ ++--connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4 ++--connection node_4 ++SELECT VARIABLE_VALUE LIKE '%gmcast.segment = 3%' FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME = 'wsrep_provider_options'; ++ ++SELECT COUNT(*) = 1 FROM t1; ++ ++DROP TABLE t1; ++ ++CALL mtr.add_suppression("There are no nodes in the same segment that will ever be able to become donors, yet there is a suitable donor outside"); +diff --git a/mysql-test/suite/galera/t/galera_wsrep_desync_wsrep_on.test b/mysql-test/suite/galera/t/galera_wsrep_desync_wsrep_on.test +new file mode 100644 +index 0000000..3c7988a +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_wsrep_desync_wsrep_on.test +@@ -0,0 +1,57 @@ ++# ++# Test the wsrep_desync + wsrep_on method for schema upgrades discussed at ++# http://www.slideshare.net/Severalnines/schema-upgrades-codershippresodec2013 , slide 30 ++# ++ ++--source include/big_test.inc ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++--connection node_1 ++CREATE TABLE ten (f1 INTEGER); ++INSERT INTO ten VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); ++ ++CREATE TABLE t1 (f1 INTEGER) Engine=InnoDB; ++ ++# Insert some values before the ALTER ++INSERT INTO t1 (f1) SELECT 000000 + (10000 * a1.f1) + (1000 * a2.f1) + (100 * a3.f1) + (10 * a4.f1) + a5.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5; ++ ++--connection node_2 ++SET GLOBAL wsrep_desync = TRUE; ++SET SESSION wsrep_on = FALSE; ++ ++ALTER TABLE t1 ADD PRIMARY KEY (f1); ++ ++SET SESSION wsrep_on = TRUE; ++SET GLOBAL wsrep_desync = FALSE; ++ ++# Insert even more data after the ALTER has completed ++INSERT INTO t1 (f1) SELECT 100000 + (10000 * a1.f1) + (1000 * a2.f1) + (100 * a3.f1) + (10 * a4.f1) + a5.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5; ++ ++SELECT COUNT(*) = 200000 FROM t1; ++SELECT MAX(f1) = 199999 FROM t1; ++ ++--connection node_1 ++SELECT COUNT(*) = 200000 FROM t1; ++SELECT MAX(f1) = 199999 FROM t1; ++ ++SET GLOBAL wsrep_desync = TRUE; ++SET SESSION wsrep_on = FALSE; ++ ++ALTER TABLE t1 ADD PRIMARY KEY (f1); ++ ++SET SESSION wsrep_on = TRUE; ++SET GLOBAL wsrep_desync = FALSE; ++ ++# Insert some conflicting values after the ALTER has been applied on all nodes. ++ ++--connection node_2 ++--error ER_DUP_ENTRY ++INSERT INTO t1 (f1) VALUES (1); ++ ++--connection node_1 ++--error ER_DUP_ENTRY ++INSERT INTO t1 (f1) VALUES (100); ++ ++DROP TABLE t1; ++DROP TABLE ten; +diff --git a/mysql-test/suite/galera/t/galera_wsrep_new_cluster-master.opt b/mysql-test/suite/galera/t/galera_wsrep_new_cluster-master.opt +new file mode 100644 +index 0000000..c31150c +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_wsrep_new_cluster-master.opt +@@ -0,0 +1 @@ ++--wsrep-new-cluster +diff --git a/mysql-test/suite/galera/t/galera_wsrep_new_cluster.test b/mysql-test/suite/galera/t/galera_wsrep_new_cluster.test +new file mode 100644 +index 0000000..6ba8ce7 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_wsrep_new_cluster.test +@@ -0,0 +1,24 @@ ++# ++# Test the --wsrep-new-cluster option by putting it in the galera_wsrep_new_cluster-master.opt file ++# ++# In MTR, running two nodes, the result is two separate clusters of size 1 ++# ++ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; ++SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_connected'; ++SELECT VARIABLE_VALUE = 0 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_index'; ++SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready'; ++SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state'; ++SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; ++ ++--connection node_2 ++ ++SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; ++SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_connected'; ++SELECT VARIABLE_VALUE = 0 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_index'; ++SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready'; ++SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state'; ++SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; +diff --git a/mysql-test/suite/galera/t/galera_wsrep_provider_unset_set.test b/mysql-test/suite/galera/t/galera_wsrep_provider_unset_set.test +new file mode 100644 +index 0000000..fe4c358 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_wsrep_provider_unset_set.test +@@ -0,0 +1,41 @@ ++# ++# Test that wsrep_provider can be unset and then set back to its original value ++# and replication will continue except for any updates made while the value was 'none' ++# ++ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++--connection node_1 ++CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; ++INSERT INTO t1 VALUES (1); ++ ++--connection node_2 ++--let $wsrep_provider_orig = `SELECT @@wsrep_provider` ++--let $wsrep_cluster_address_orig = `SELECT @@wsrep_cluster_address` ++ ++SET GLOBAL wsrep_provider='none'; ++INSERT INTO t1 VALUES (2); ++ ++--connection node_1 ++INSERT INTO t1 VALUES (3); ++ ++--connection node_2 ++--disable_query_log ++--eval SET GLOBAL wsrep_provider = '$wsrep_provider_orig'; ++--eval SET GLOBAL wsrep_cluster_address = '$wsrep_cluster_address_orig'; ++--enable_query_log ++ ++--source include/wait_until_connected_again.inc ++--source include/galera_wait_ready.inc ++ ++INSERT INTO t1 VALUES (4); ++ ++# Node #2 has all the inserts ++SELECT COUNT(*) = 4 FROM t1; ++ ++--connection node_1 ++# Node #1 is missing the insert made while Node #2 was not replicated ++SELECT COUNT(*) = 3 FROM t1; ++ ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/t/galera_zero_length_column.test b/mysql-test/suite/galera/t/galera_zero_length_column.test +new file mode 100644 +index 0000000..6ae81a8 +--- /dev/null ++++ b/mysql-test/suite/galera/t/galera_zero_length_column.test +@@ -0,0 +1,41 @@ ++# ++# Test columns with size zero. This is known to have tripped other storage engines. ++# Keys are not allowed on such columns ++# ++ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++--connection node_1 ++CREATE TABLE t1 (f1 INTEGER PRIMARY KEY , f2 VARCHAR(0)) ENGINE=InnoDB; ++CREATE TABLE t2 (f1 VARCHAR(0)) ENGINE=InnoDB; ++ ++ ++INSERT INTO t1 VALUES (1, NULL); ++INSERT INTO t1 VALUES (2, ''); ++ ++INSERT INTO t2 VALUES (NULL); ++INSERT INTO t2 VALUES (''); ++ ++--connection node_2 ++SELECT COUNT(*) = 2 FROM t1; ++SELECT f2 IS NULL FROM t1 WHERE f1 = 1; ++SELECT f2 = '' FROM t1 WHERE f1 = 2; ++ ++SELECT COUNT(*) = 2 FROM t2; ++SELECT f1 IS NULL FROM t2 WHERE f1 IS NULL; ++SELECT f1 = '' FROM t2 WHERE f1 IS NOT NULL; ++ ++UPDATE t1 SET f2 = '' WHERE f1 = 1; ++UPDATE t1 SET f2 = NULL WHERE f1 = 2; ++ ++UPDATE t2 SET f1 = '' WHERE f1 IS NULL; ++ ++--connection node_1 ++SELECT f2 = '' FROM t1 WHERE f1 = 1; ++SELECT f2 IS NULL FROM t1 WHERE f1 = 2; ++ ++SELECT COUNT(*) = 2 FROM t2 WHERE f1 = ''; ++ ++DROP TABLE t1; ++DROP TABLE t2; +diff --git a/mysql-test/suite/galera/t/lp1276424.test b/mysql-test/suite/galera/t/lp1276424.test +new file mode 100644 +index 0000000..a37e950 +--- /dev/null ++++ b/mysql-test/suite/galera/t/lp1276424.test +@@ -0,0 +1,17 @@ ++# ++# LP:1276424 Deadlock with insertion of NULL unique ke ++# ++ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++CREATE TABLE t1 (f1 INT DEFAULT NULL, UNIQUE KEY i1 (f1)) ENGINE=InnoDB; ++ ++INSERT INTO t1 VALUES (NULL); ++INSERT INTO t1 VALUES (NULL); ++ ++--connection node_2 ++SELECT COUNT(*) = 2 FROM t1; ++SELECT f1 IS NULL FROM t1; ++ ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera/t/lp1347768.test b/mysql-test/suite/galera/t/lp1347768.test +new file mode 100644 +index 0000000..96d4286 +--- /dev/null ++++ b/mysql-test/suite/galera/t/lp1347768.test +@@ -0,0 +1,24 @@ ++# ++# LP:1347768 Assertion failure in file ha_innodb.cc line 6759 ++# ++ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++CREATE TABLE `r8kmb_redirect_links` ( ++ `id` int(10) unsigned NOT NULL AUTO_INCREMENT, ++ `old_url` varchar(255) DEFAULT NULL, ++ `new_url` varchar(255) NOT NULL, ++ `referer` varchar(150) NOT NULL, ++ `comment` varchar(255) NOT NULL, ++ `published` tinyint(4) NOT NULL, ++ `created_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', ++ `modified_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', ++ PRIMARY KEY (`id`), ++ UNIQUE KEY `idx_link_old` (`old_url`), ++ KEY `idx_link_modifed` (`modified_date`) ++) ENGINE=InnoDB DEFAULT CHARSET=utf8; ++ ++INSERT INTO r8kmb_redirect_links VALUES (550,'http://mysite.com/images/download/ßуñûічýøù_ôþóþòір_þфõÑ.doc','','','',0,'2013-07-15 14:29:42','0000-00-00 00:00:00'); ++ ++DROP TABLE r8kmb_redirect_links; +diff --git a/mysql-test/suite/galera/t/lp959512.test b/mysql-test/suite/galera/t/lp959512.test +new file mode 100644 +index 0000000..bcc0db2 +--- /dev/null ++++ b/mysql-test/suite/galera/t/lp959512.test +@@ -0,0 +1,26 @@ ++# ++# LP#959512 IO cache not reset at trx cleanup if write set was empty Edit ++# ++ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++DROP TABLE IF EXISTS variable; ++DROP TABLE IF EXISTS foo; ++CREATE TABLE variable ( ++ name varchar(128) NOT NULL DEFAULT '' COMMENT 'The name of the variable.', ++ value longblob NOT NULL COMMENT 'The value of the variable.', ++ PRIMARY KEY (name) ++ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Named variable/value pairs created by Drupal core or any...'; ++CREATE TABLE foo (a int); ++INSERT INTO variable (name, value) VALUES ('menu_expanded', 'a:0:{}'); ++START TRANSACTION; ++SELECT 1 AS expression FROM variable variable ++ WHERE ( (name = 'menu_expanded') ) FOR UPDATE; ++UPDATE variable SET value='a:0:{}' WHERE ( (name = 'menu_expanded') ); ++COMMIT; ++INSERT INTO foo VALUES (1); ++UPDATE foo SET a = 2 WHERE a = 1; ++ ++DROP TABLE foo; ++DROP TABLE variable; +diff --git a/mysql-test/suite/galera_3nodes/galera_3nodes.cnf b/mysql-test/suite/galera_3nodes/galera_3nodes.cnf +new file mode 100644 +index 0000000..e837635 +--- /dev/null ++++ b/mysql-test/suite/galera_3nodes/galera_3nodes.cnf +@@ -0,0 +1,75 @@ ++# Use default setting for mysqld processes ++!include include/default_mysqld.cnf ++ ++[mysqld.1] ++binlog-format=row ++ ++wsrep_provider=@ENV.WSREP_PROVIDER ++wsrep_cluster_address='gcomm://' ++wsrep_provider_options='base_port=@mysqld.1.#galera_port' ++ ++# enforce read-committed characteristics across the cluster ++wsrep_causal_reads=ON ++wsrep_sync_wait = 7 ++ ++wsrep_node_address=127.0.0.1 ++wsrep_sst_receive_address=127.0.0.2:@mysqld.1.#sst_port ++wsrep_node_incoming_address=127.0.0.1:@mysqld.1.port ++ ++# Required for Galera ++innodb_autoinc_lock_mode=2 ++ ++[mysqld.2] ++binlog-format=row ++ ++wsrep_provider=@ENV.WSREP_PROVIDER ++wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port' ++wsrep_provider_options='base_port=@mysqld.2.#galera_port' ++ ++# enforce read-committed characteristics across the cluster ++wsrep_causal_reads=ON ++wsrep_sync_wait = 7 ++ ++wsrep_node_address=127.0.0.1 ++wsrep_sst_receive_address=127.0.0.2:@mysqld.2.#sst_port ++wsrep_node_incoming_address=127.0.0.1:@mysqld.2.port ++ ++# Required for Galera ++innodb_autoinc_lock_mode=2 ++ ++[mysqld.3] ++binlog-format=row ++ ++wsrep_provider=@ENV.WSREP_PROVIDER ++wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port' ++wsrep_provider_options='base_port=@mysqld.3.#galera_port' ++ ++# enforce read-committed characteristics across the cluster ++wsrep_causal_reads=ON ++wsrep_sync_wait = 7 ++ ++wsrep_node_address=127.0.0.1 ++wsrep_sst_receive_address=127.0.0.2:@mysqld.3.#sst_port ++wsrep_node_incoming_address=127.0.0.1:@mysqld.3.port ++ ++# Required for Galera ++innodb_autoinc_lock_mode=2 ++ ++[ENV] ++NODE_MYPORT_1= @mysqld.1.port ++NODE_MYSOCK_1= @mysqld.1.socket ++ ++NODE_MYPORT_2= @mysqld.2.port ++NODE_MYSOCK_2= @mysqld.2.socket ++ ++NODE_MYPORT_3= @mysqld.3.port ++NODE_MYSOCK_3= @mysqld.3.socket ++ ++NODE_GALERAPORT_1= @mysqld.1.#galera_port ++NODE_GALERAPORT_2= @mysqld.2.#galera_port ++NODE_GALERAPORT_3= @mysqld.3.#galera_port ++ ++NODE_SSTPORT_1= @mysqld.1.#sst_port ++NODE_SSTPORT_2= @mysqld.2.#sst_port ++NODE_SSTPORT_3= @mysqld.3.#sst_port ++ +diff --git a/mysql-test/suite/galera_3nodes/my.cnf b/mysql-test/suite/galera_3nodes/my.cnf +new file mode 100644 +index 0000000..bb25b95 +--- /dev/null ++++ b/mysql-test/suite/galera_3nodes/my.cnf +@@ -0,0 +1 @@ ++!include galera_3nodes.cnf +diff --git a/mysql-test/suite/galera_3nodes/r/galera_certification_ccc.result b/mysql-test/suite/galera_3nodes/r/galera_certification_ccc.result +new file mode 100644 +index 0000000..96a2bec +--- /dev/null ++++ b/mysql-test/suite/galera_3nodes/r/galera_certification_ccc.result +@@ -0,0 +1,17 @@ ++CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES (1); ++SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; ++VARIABLE_VALUE = 3 ++1 ++SET GLOBAL wsrep_cluster_address = ''; ++INSERT INTO t1 VALUES (2); ++SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; ++VARIABLE_VALUE = 2 ++1 ++COMMIT; ++SELECT COUNT(*) = 2 FROM t1; ++COUNT(*) = 2 ++1 ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera_3nodes/r/galera_certification_double_failure.result b/mysql-test/suite/galera_3nodes/r/galera_certification_double_failure.result +new file mode 100644 +index 0000000..9dc735d +--- /dev/null ++++ b/mysql-test/suite/galera_3nodes/r/galera_certification_double_failure.result +@@ -0,0 +1,12 @@ ++CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; ++CREATE TABLE t2 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES (1); ++INSERT INTO t2 VALUES (1); ++INSERT INTO t1 VALUES (1); ++INSERT INTO t2 VALUES (1); ++COMMIT; ++ERROR 40001: Deadlock found when trying to get lock; try restarting transaction ++DROP TABLE t1; ++DROP TABLE t2; +diff --git a/mysql-test/suite/galera_3nodes/r/galera_evs_suspect_timeout.result b/mysql-test/suite/galera_3nodes/r/galera_evs_suspect_timeout.result +new file mode 100644 +index 0000000..1464222 +--- /dev/null ++++ b/mysql-test/suite/galera_3nodes/r/galera_evs_suspect_timeout.result +@@ -0,0 +1,19 @@ ++SET GLOBAL wsrep_provider_options = 'evs.inactive_timeout=PT100M; evs.suspect_timeout=PT1S'; ++SET GLOBAL wsrep_provider_options = 'evs.inactive_timeout=PT100M; evs.suspect_timeout=PT1S'; ++Suspending node ... ++SET SESSION wsrep_sync_wait = 0; ++SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; ++VARIABLE_VALUE = 2 ++1 ++CREATE TABLE t1 (f1 INTEGER); ++INSERT INTO t1 VALUES (1); ++SET SESSION wsrep_sync_wait = 0; ++SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; ++VARIABLE_VALUE = 2 ++1 ++SELECT COUNT(*) = 1 FROM t1; ++COUNT(*) = 1 ++1 ++DROP TABLE t1; ++Resuming node ... ++CALL mtr.add_suppression("WSREP: gcs_caused() returned -1 \\(Operation not permitted\\)"); +diff --git a/mysql-test/suite/galera_3nodes/r/galera_garbd.result b/mysql-test/suite/galera_3nodes/r/galera_garbd.result +new file mode 100644 +index 0000000..616c9d3 +--- /dev/null ++++ b/mysql-test/suite/galera_3nodes/r/galera_garbd.result +@@ -0,0 +1,14 @@ ++Killing node #3 to free ports for garbd ... ++Starting garbd ... ++CREATE TABLE t1 (f1 INTEGER); ++INSERT INTO t1 VALUES (1); ++SELECT COUNT(*) = 1 FROM t1; ++COUNT(*) = 1 ++1 ++Killing garbd ... ++INSERT INTO t1 VALUES (2); ++SELECT COUNT(*) = 2 FROM t1; ++COUNT(*) = 2 ++1 ++DROP TABLE t1; ++Restarting node #3 to satisfy MTR's end-of-test checks +diff --git a/mysql-test/suite/galera_3nodes/r/galera_ist_gcache_rollover.result b/mysql-test/suite/galera_3nodes/r/galera_ist_gcache_rollover.result +new file mode 100644 +index 0000000..1ecea5d +--- /dev/null ++++ b/mysql-test/suite/galera_3nodes/r/galera_ist_gcache_rollover.result +@@ -0,0 +1,46 @@ ++CREATE TABLE t1 (f1 INTEGER PRIMARY KEY); ++INSERT INTO t1 VALUES (01), (02), (03), (04), (05); ++Unloading wsrep provider ... ++SET GLOBAL wsrep_provider = 'none'; ++Unloading wsrep provider ... ++SET GLOBAL wsrep_provider = 'none'; ++INSERT INTO t1 VALUES (11), (12), (13), (14), (15); ++INSERT INTO t1 VALUES (21), (22), (23), (24), (25); ++SET GLOBAL wsrep_provider_options = 'dbug=d,ist_sender_send_after_get_buffers'; ++INSERT INTO t1 VALUES (31), (32), (33), (34), (35); ++SHOW STATUS LIKE 'wsrep_debug_sync_waiters'; ++Variable_name Value ++wsrep_debug_sync_waiters ist_sender_send_after_get_buffers ist_sender_send_after_get_buffers ++INSERT INTO t1 VALUES (41), (42), (43), (44), (45); ++CREATE TABLE t2 (f1 LONGTEXT); ++INSERT INTO t2 VALUES (REPEAT('x', 512 * 1024)); ++INSERT INTO t2 VALUES (REPEAT('x', 512 * 1024)); ++INSERT INTO t2 VALUES (REPEAT('x', 512 * 1024)); ++SET GLOBAL wsrep_provider_options = 'signal=ist_sender_send_after_get_buffers'; ++SET GLOBAL wsrep_provider_options = 'dbug='; ++INSERT INTO t1 VALUES (51), (52), (53), (54), (55); ++SELECT COUNT(*) = 30 FROM t1; ++COUNT(*) = 30 ++1 ++SELECT COUNT(*) = 3 FROM t2; ++COUNT(*) = 3 ++1 ++SELECT LENGTH(f1) = 512 * 1024 FROM t2; ++LENGTH(f1) = 512 * 1024 ++1 ++1 ++1 ++CALL mtr.add_suppression("WSREP: Unsupported protocol downgrade: incremental data collection disabled"); ++SELECT COUNT(*) = 30 FROM t1; ++COUNT(*) = 30 ++1 ++SELECT COUNT(*) = 3 FROM t2; ++COUNT(*) = 3 ++1 ++SELECT LENGTH(f1) = 512 * 1024 FROM t2; ++LENGTH(f1) = 512 * 1024 ++1 ++1 ++1 ++CALL mtr.add_suppression("WSREP: Unsupported protocol downgrade: incremental data collection disabled"); ++DROP TABLE t1, t2; +diff --git a/mysql-test/suite/galera_3nodes/r/galera_parallel_apply_3nodes.result b/mysql-test/suite/galera_3nodes/r/galera_parallel_apply_3nodes.result +new file mode 100644 +index 0000000..9a6d40a +--- /dev/null ++++ b/mysql-test/suite/galera_3nodes/r/galera_parallel_apply_3nodes.result +@@ -0,0 +1,13 @@ ++CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; ++INSERT INTO t1 VALUES (1); ++SET GLOBAL wsrep_slave_threads = 2; ++UPDATE t1 SET f1 = f1 + 10;; ++UPDATE t1 SET f1 = f1 + 100;; ++SELECT f1 = 111 FROM t1; ++f1 = 111 ++1 ++SELECT COUNT(*) IN (1, 2) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE '%committed%'; ++COUNT(*) IN (1, 2) ++1 ++SET GLOBAL wsrep_slave_threads = 1;; ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera_3nodes/r/galera_pc_weight.result b/mysql-test/suite/galera_3nodes/r/galera_pc_weight.result +new file mode 100644 +index 0000000..ca05143 +--- /dev/null ++++ b/mysql-test/suite/galera_3nodes/r/galera_pc_weight.result +@@ -0,0 +1,118 @@ ++SET GLOBAL wsrep_provider_options = 'pc.weight=3'; ++Suspending node ... ++SET SESSION wsrep_sync_wait=0; ++SHOW STATUS LIKE 'wsrep_cluster_size'; ++Variable_name Value ++wsrep_cluster_size 2 ++SHOW STATUS LIKE 'wsrep_cluster_status'; ++Variable_name Value ++wsrep_cluster_status non-Primary ++SHOW STATUS LIKE 'wsrep_connected'; ++Variable_name Value ++wsrep_connected ON ++SHOW STATUS LIKE 'wsrep_ready'; ++Variable_name Value ++wsrep_ready OFF ++SHOW STATUS LIKE 'wsrep_local_state'; ++Variable_name Value ++wsrep_local_state 0 ++SHOW STATUS LIKE 'wsrep_local_state_comment'; ++Variable_name Value ++wsrep_local_state_comment Initialized ++SET SESSION wsrep_sync_wait=0; ++SHOW STATUS LIKE 'wsrep_cluster_size'; ++Variable_name Value ++wsrep_cluster_size 2 ++SHOW STATUS LIKE 'wsrep_cluster_status'; ++Variable_name Value ++wsrep_cluster_status non-Primary ++SHOW STATUS LIKE 'wsrep_connected'; ++Variable_name Value ++wsrep_connected ON ++SHOW STATUS LIKE 'wsrep_ready'; ++Variable_name Value ++wsrep_ready OFF ++SHOW STATUS LIKE 'wsrep_local_state'; ++Variable_name Value ++wsrep_local_state 0 ++SHOW STATUS LIKE 'wsrep_local_state_comment'; ++Variable_name Value ++wsrep_local_state_comment Initialized ++Resuming node ... ++SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; ++VARIABLE_VALUE = 1 ++1 ++SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; ++VARIABLE_VALUE = 'Primary' ++1 ++SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_connected'; ++VARIABLE_VALUE = 'ON' ++1 ++SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready'; ++VARIABLE_VALUE = 'ON' ++1 ++SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state'; ++VARIABLE_VALUE = 4 ++1 ++SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; ++VARIABLE_VALUE = 'Synced' ++1 ++SET SESSION wsrep_sync_wait=0; ++SET SESSION wsrep_sync_wait=0; ++SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; ++VARIABLE_VALUE = 3 ++1 ++SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; ++VARIABLE_VALUE = 'Primary' ++1 ++SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_connected'; ++VARIABLE_VALUE = 'ON' ++1 ++SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready'; ++VARIABLE_VALUE = 'ON' ++1 ++SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state'; ++VARIABLE_VALUE = 4 ++1 ++SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; ++VARIABLE_VALUE = 'Synced' ++1 ++SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; ++VARIABLE_VALUE = 3 ++1 ++SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; ++VARIABLE_VALUE = 'Primary' ++1 ++SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_connected'; ++VARIABLE_VALUE = 'ON' ++1 ++SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready'; ++VARIABLE_VALUE = 'ON' ++1 ++SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state'; ++VARIABLE_VALUE = 4 ++1 ++SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; ++VARIABLE_VALUE = 'Synced' ++1 ++SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; ++VARIABLE_VALUE = 3 ++1 ++SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; ++VARIABLE_VALUE = 'Primary' ++1 ++SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_connected'; ++VARIABLE_VALUE = 'ON' ++1 ++SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready'; ++VARIABLE_VALUE = 'ON' ++1 ++SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state'; ++VARIABLE_VALUE = 4 ++1 ++SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; ++VARIABLE_VALUE = 'Synced' ++1 ++CALL mtr.add_suppression('WSREP: gcs_caused\\(\\) returned -1'); ++CALL mtr.add_suppression('WSREP: user message in state LEAVING'); ++CALL mtr.add_suppression('sending install message failed: Transport endpoint is not connected'); +diff --git a/mysql-test/suite/galera_3nodes/t/galera_certification_ccc.test b/mysql-test/suite/galera_3nodes/t/galera_certification_ccc.test +new file mode 100644 +index 0000000..da4a609 +--- /dev/null ++++ b/mysql-test/suite/galera_3nodes/t/galera_certification_ccc.test +@@ -0,0 +1,41 @@ ++# ++# Test that a cluster configuration change during a transaction does not cause a failure ++# ++ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++--let $galera_connection_name = node_3 ++--let $galera_server_number = 3 ++--source include/galera_connect.inc ++ ++--connection node_1 ++CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; ++ ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES (1); ++SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; ++ ++--connection node_3 ++--let $wsrep_cluster_address_orig = `SELECT @@wsrep_cluster_address` ++SET GLOBAL wsrep_cluster_address = ''; ++--sleep 5 ++ ++--connection node_1 ++INSERT INTO t1 VALUES (2); ++SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; ++COMMIT; ++ ++--connection node_2 ++SELECT COUNT(*) = 2 FROM t1; ++ ++--connection node_3 ++--disable_query_log ++--eval SET GLOBAL wsrep_cluster_address = '$wsrep_cluster_address_orig'; ++--enable_query_log ++--sleep 5 ++--source include/galera_wait_ready.inc ++ ++--connection node_1 ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera_3nodes/t/galera_certification_double_failure.test b/mysql-test/suite/galera_3nodes/t/galera_certification_double_failure.test +new file mode 100644 +index 0000000..a2ad076 +--- /dev/null ++++ b/mysql-test/suite/galera_3nodes/t/galera_certification_double_failure.test +@@ -0,0 +1,33 @@ ++# ++# This test creates a transaction whose certification will fail on two separate nodes ++# for two different reasons. ++# ++ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++--let $galera_connection_name = node_3 ++--let $galera_server_number = 3 ++--source include/galera_connect.inc ++ ++--connection node_1 ++CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; ++CREATE TABLE t2 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; ++ ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES (1); ++INSERT INTO t2 VALUES (1); ++ ++--connection node_2 ++INSERT INTO t1 VALUES (1); ++ ++--connection node_3 ++INSERT INTO t2 VALUES (1); ++ ++--connection node_1 ++--error ER_LOCK_DEADLOCK ++COMMIT; ++ ++DROP TABLE t1; ++DROP TABLE t2; +diff --git a/mysql-test/suite/galera_3nodes/t/galera_evs_suspect_timeout.test b/mysql-test/suite/galera_3nodes/t/galera_evs_suspect_timeout.test +new file mode 100644 +index 0000000..a87f19a +--- /dev/null ++++ b/mysql-test/suite/galera_3nodes/t/galera_evs_suspect_timeout.test +@@ -0,0 +1,67 @@ ++# ++# Test the operation of evs.suspect_timeout. ++# ++# We set evs.inactive_timeout to a very high value so that evs.suspect_timeout can kick in instead. ++# ++ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++--connection node_1 ++--let $wsrep_provider_options_node1 = `SELECT @@wsrep_provider_options` ++SET GLOBAL wsrep_provider_options = 'evs.inactive_timeout=PT100M; evs.suspect_timeout=PT1S'; ++ ++--connection node_2 ++--source include/wait_until_connected_again.inc ++--let $wsrep_provider_options_node2 = `SELECT @@wsrep_provider_options` ++SET GLOBAL wsrep_provider_options = 'evs.inactive_timeout=PT100M; evs.suspect_timeout=PT1S'; ++ ++--let $galera_connection_name = node_3 ++--let $galera_server_number = 3 ++--source include/galera_connect.inc ++--connection node_3 ++--source include/wait_until_connected_again.inc ++--let $wsrep_cluster_address_node3 = `SELECT @@wsrep_cluster_address` ++ ++# Suspend node #3 ++ ++--source include/galera_suspend.inc ++--sleep 5 ++ ++# Confirm that the other nodes have booted it out ++ ++--connection node_1 ++--source include/wait_until_connected_again.inc ++SET SESSION wsrep_sync_wait = 0; ++SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; ++--disable_query_log ++--eval SET GLOBAL wsrep_provider_options = '$wsrep_provider_options_node1'; ++--enable_query_log ++ ++--source include/wait_until_connected_again.inc ++CREATE TABLE t1 (f1 INTEGER); ++INSERT INTO t1 VALUES (1); ++ ++--connection node_2 ++SET SESSION wsrep_sync_wait = 0; ++SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; ++--disable_query_log ++--eval SET GLOBAL wsrep_provider_options = '$wsrep_provider_options_node2'; ++--enable_query_log ++ ++--source include/wait_until_connected_again.inc ++SELECT COUNT(*) = 1 FROM t1; ++DROP TABLE t1; ++ ++# Reconnect node #3 so that MTR's end-of-test checks can run ++ ++--connection node_3 ++--source include/galera_resume.inc ++--source include/wait_until_connected_again.inc ++ ++CALL mtr.add_suppression("WSREP: gcs_caused() returned -1 \\(Operation not permitted\\)"); ++ ++--disable_query_log ++--eval SET GLOBAL wsrep_cluster_address = '$wsrep_cluster_address_node3'; ++--enable_query_log ++--source include/wait_until_connected_again.inc +diff --git a/mysql-test/suite/galera_3nodes/t/galera_garbd.test b/mysql-test/suite/galera_3nodes/t/galera_garbd.test +new file mode 100644 +index 0000000..3f58783 +--- /dev/null ++++ b/mysql-test/suite/galera_3nodes/t/galera_garbd.test +@@ -0,0 +1,50 @@ ++# ++# A very basic test for the galera arbitrator. We shut down node #3 and use its port allocation to start garbd. ++# As MTR does not allow multiple servers to be down at the same time, we are limited as to what we can test. ++# ++ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++--source include/big_test.inc ++ ++--echo Killing node #3 to free ports for garbd ... ++--let $galera_connection_name = node_3 ++--let $galera_server_number = 3 ++--source include/galera_connect.inc ++--source include/shutdown_mysqld.inc ++ ++--connection node_1 ++--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' ++--source include/wait_condition.inc ++ ++--echo Starting garbd ... ++--exec `dirname $WSREP_PROVIDER`/garb/garbd --address "gcomm://127.0.0.1:$NODE_GALERAPORT_1" --group my_wsrep_cluster --options 'base_port=$NODE_GALERAPORT_3' > $MYSQL_TMP_DIR/garbd.log 2>&1 & ++ ++--sleep 5 ++ ++--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' ++--source include/wait_condition.inc ++ ++CREATE TABLE t1 (f1 INTEGER); ++INSERT INTO t1 VALUES (1); ++ ++--connection node_2 ++SELECT COUNT(*) = 1 FROM t1; ++ ++--echo Killing garbd ... ++--exec pkill --oldest --full garbd.*$NODE_GALERAPORT_3 ++ ++--connection node_1 ++--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' ++--source include/wait_condition.inc ++ ++INSERT INTO t1 VALUES (2); ++ ++--connection node_2 ++SELECT COUNT(*) = 2 FROM t1; ++ ++DROP TABLE t1; ++ ++--echo Restarting node #3 to satisfy MTR's end-of-test checks ++--connection node_3 ++--source include/start_mysqld.inc +diff --git a/mysql-test/suite/galera_3nodes/t/galera_ist_gcache_rollover.cnf b/mysql-test/suite/galera_3nodes/t/galera_ist_gcache_rollover.cnf +new file mode 100644 +index 0000000..8211752 +--- /dev/null ++++ b/mysql-test/suite/galera_3nodes/t/galera_ist_gcache_rollover.cnf +@@ -0,0 +1,11 @@ ++!include ../galera_3nodes.cnf ++ ++[mysqld.1] ++wsrep_provider_options='base_port=@mysqld.1.#galera_port;pc.ignore_sb=true;gcache.size=1M' ++ ++[mysqld.2] ++wsrep_provider_options='base_port=@mysqld.2.#galera_port;pc.ignore_sb=true;gcache.size=1M' ++ ++[mysqld.3] ++wsrep_provider_options='base_port=@mysqld.3.#galera_port;pc.ignore_sb=true;gcache.size=1M' ++ +diff --git a/mysql-test/suite/galera_3nodes/t/galera_ist_gcache_rollover.test b/mysql-test/suite/galera_3nodes/t/galera_ist_gcache_rollover.test +new file mode 100644 +index 0000000..0668c24 +--- /dev/null ++++ b/mysql-test/suite/galera_3nodes/t/galera_ist_gcache_rollover.test +@@ -0,0 +1,98 @@ ++# ++# Test that if the gcache rolls over while IST is in progress, IST will still complete. ++# This is achieved by using the ist_sender_send_after_get_buffers Galera dbug sync point to block the donor after ++# the first gcache buffer has been locked for IST. ++# ++# After IST blocks, we roll over the gcache and resume IST to confirm that it completes successfully. ++# ++# Two nodes perform IST at the same time in order to make the test more stressfull ++# ++ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++--source include/have_debug_sync.inc ++--source suite/galera/include/galera_have_debug_sync.inc ++ ++--let $galera_connection_name = node_3 ++--let $galera_server_number = 3 ++--source include/galera_connect.inc ++ ++CREATE TABLE t1 (f1 INTEGER PRIMARY KEY); ++INSERT INTO t1 VALUES (01), (02), (03), (04), (05); ++ ++# Disconnect nodes #2 and #3 ++--connection node_2 ++--source suite/galera/include/galera_unload_provider.inc ++ ++--connection node_3 ++--source suite/galera/include/galera_unload_provider.inc ++ ++--connection node_1 ++--source include/wait_until_connected_again.inc ++INSERT INTO t1 VALUES (11), (12), (13), (14), (15); ++ ++# Wait until nodes #2 and #3 have left ++--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' ++--source include/wait_condition.inc ++ ++INSERT INTO t1 VALUES (21), (22), (23), (24), (25); ++ ++# Make sure IST will block ... ++SET GLOBAL wsrep_provider_options = 'dbug=d,ist_sender_send_after_get_buffers'; ++ ++# ... and restart providers to force IST ++--connection node_2 ++--disable_query_log ++--eval SET GLOBAL wsrep_provider = '$wsrep_provider_orig'; ++--eval SET GLOBAL wsrep_cluster_address = '$wsrep_cluster_address_orig'; ++--enable_query_log ++ ++--connection node_1 ++INSERT INTO t1 VALUES (31), (32), (33), (34), (35); ++ ++--connection node_3 ++--disable_query_log ++--eval SET GLOBAL wsrep_provider = '$wsrep_provider_orig'; ++--eval SET GLOBAL wsrep_cluster_address = '$wsrep_cluster_address_orig'; ++--enable_query_log ++ ++--connection node_1 ++--sleep 2 ++SHOW STATUS LIKE 'wsrep_debug_sync_waiters'; ++ ++INSERT INTO t1 VALUES (41), (42), (43), (44), (45); ++ ++# Roll over gcache by writing a lot of information to it ++ ++CREATE TABLE t2 (f1 LONGTEXT); ++INSERT INTO t2 VALUES (REPEAT('x', 512 * 1024)); ++INSERT INTO t2 VALUES (REPEAT('x', 512 * 1024)); ++INSERT INTO t2 VALUES (REPEAT('x', 512 * 1024)); ++ ++# Unlock IST and wait for it to complete ++SET GLOBAL wsrep_provider_options = 'signal=ist_sender_send_after_get_buffers'; ++SET GLOBAL wsrep_provider_options = 'dbug='; ++ ++INSERT INTO t1 VALUES (51), (52), (53), (54), (55); ++ ++--connection node_2 ++--source include/wait_until_connected_again.inc ++ ++--connection node_3 ++--source include/wait_until_connected_again.inc ++ ++# Final checks ++--connection node_2 ++SELECT COUNT(*) = 30 FROM t1; ++SELECT COUNT(*) = 3 FROM t2; ++SELECT LENGTH(f1) = 512 * 1024 FROM t2; ++CALL mtr.add_suppression("WSREP: Unsupported protocol downgrade: incremental data collection disabled"); ++ ++# Final checks ++--connection node_3 ++SELECT COUNT(*) = 30 FROM t1; ++SELECT COUNT(*) = 3 FROM t2; ++SELECT LENGTH(f1) = 512 * 1024 FROM t2; ++CALL mtr.add_suppression("WSREP: Unsupported protocol downgrade: incremental data collection disabled"); ++ ++DROP TABLE t1, t2; +diff --git a/mysql-test/suite/galera_3nodes/t/galera_parallel_apply_3nodes.test b/mysql-test/suite/galera_3nodes/t/galera_parallel_apply_3nodes.test +new file mode 100644 +index 0000000..659df2b +--- /dev/null ++++ b/mysql-test/suite/galera_3nodes/t/galera_parallel_apply_3nodes.test +@@ -0,0 +1,38 @@ ++# ++# This test performs two dependent updates on two nodes and checks the results on the third where ++# parallel apply is enabled. ++# ++ ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++--let $galera_connection_name = node_3 ++--let $galera_server_number = 3 ++--source include/galera_connect.inc ++ ++CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; ++INSERT INTO t1 VALUES (1); ++ ++--connection node_3 ++--let $wsrep_slave_threads_orig = `SELECT @@wsrep_slave_threads` ++SET GLOBAL wsrep_slave_threads = 2; ++ ++--connection node_1 ++--send UPDATE t1 SET f1 = f1 + 10; ++ ++--connection node_2 ++--send UPDATE t1 SET f1 = f1 + 100; ++ ++--connection node_1 ++--reap ++ ++--connection node_2 ++--reap ++ ++--connection node_3 ++SELECT f1 = 111 FROM t1; ++SELECT COUNT(*) IN (1, 2) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE '%committed%'; ++ ++--eval SET GLOBAL wsrep_slave_threads = $wsrep_slave_threads_orig; ++ ++DROP TABLE t1; +diff --git a/mysql-test/suite/galera_3nodes/t/galera_pc_weight.test b/mysql-test/suite/galera_3nodes/t/galera_pc_weight.test +new file mode 100644 +index 0000000..8956bae +--- /dev/null ++++ b/mysql-test/suite/galera_3nodes/t/galera_pc_weight.test +@@ -0,0 +1,110 @@ ++# ++# Test the pc.weight wsrep provider option. We set Node #1 to have a high weight and then ++# suspend it. This will cause Nodes #2 and #3 to transition to non-primary component. ++# ++ ++--source include/big_test.inc ++--source include/galera_cluster.inc ++--source include/have_innodb.inc ++ ++--let $wsrep_provider_options_node1 = `SELECT @@wsrep_provider_options` ++SET GLOBAL wsrep_provider_options = 'pc.weight=3'; ++ ++--source include/wait_until_connected_again.inc ++--source include/galera_suspend.inc ++--sleep 10 ++ ++--connection node_2 ++# Do not wait for causality as we are no longer in the primary component ++SET SESSION wsrep_sync_wait=0; ++--source include/wait_until_connected_again.inc ++ ++# We can not use SELECT queries here, as only SHOW is allowed to run. ++# For nodes #2 and #3, we expect a non-primary component of size 2 ++ ++SHOW STATUS LIKE 'wsrep_cluster_size'; ++SHOW STATUS LIKE 'wsrep_cluster_status'; ++SHOW STATUS LIKE 'wsrep_connected'; ++SHOW STATUS LIKE 'wsrep_ready'; ++SHOW STATUS LIKE 'wsrep_local_state'; ++SHOW STATUS LIKE 'wsrep_local_state_comment'; ++ ++--let $galera_connection_name = node_3 ++--let $galera_server_number = 3 ++--source include/galera_connect.inc ++--connection node_3 ++SET SESSION wsrep_sync_wait=0; ++--source include/wait_until_connected_again.inc ++ ++SHOW STATUS LIKE 'wsrep_cluster_size'; ++SHOW STATUS LIKE 'wsrep_cluster_status'; ++SHOW STATUS LIKE 'wsrep_connected'; ++SHOW STATUS LIKE 'wsrep_ready'; ++SHOW STATUS LIKE 'wsrep_local_state'; ++SHOW STATUS LIKE 'wsrep_local_state_comment'; ++ ++--connection node_1 ++--source include/galera_resume.inc ++--sleep 5 ++--source include/wait_until_connected_again.inc ++ ++# For Node #1, we expect a primary component of size 1 ++ ++SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; ++SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; ++SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_connected'; ++SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready'; ++SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state'; ++SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; ++ ++# Restore the cluster by resetting wsrep_cluster_address on nodes #1 and #2 ++ ++--connection node_2 ++--disable_query_log ++--eval SET GLOBAL wsrep_cluster_address = @@wsrep_cluster_address; ++--enable_query_log ++ ++SET SESSION wsrep_sync_wait=0; ++--source include/wait_until_connected_again.inc ++ ++--connection node_3 ++--disable_query_log ++--eval SET GLOBAL wsrep_cluster_address = @@wsrep_cluster_address; ++--enable_query_log ++ ++SET SESSION wsrep_sync_wait=0; ++--source include/wait_until_connected_again.inc ++ ++# On all nodes, we now expect a Primary component of size 3, Synced and ready ++ ++--connection node_1 ++--source include/wait_until_connected_again.inc ++SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; ++SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; ++SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_connected'; ++SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready'; ++SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state'; ++SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; ++ ++--connection node_2 ++SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; ++SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; ++SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_connected'; ++SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready'; ++SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state'; ++SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; ++ ++--connection node_3 ++SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; ++SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; ++SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_connected'; ++SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready'; ++SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state'; ++SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; ++ ++--connection node_1 ++CALL mtr.add_suppression('WSREP: gcs_caused\\(\\) returned -1'); ++ ++--connection node_3 ++CALL mtr.add_suppression('WSREP: user message in state LEAVING'); ++CALL mtr.add_suppression('sending install message failed: Transport endpoint is not connected'); +diff --git a/mysql-test/suite/innodb/r/innodb-autoinc.result b/mysql-test/suite/innodb/r/innodb-autoinc.result +index 0e0f49b..21acf06 100644 +--- a/mysql-test/suite/innodb/r/innodb-autoinc.result ++++ b/mysql-test/suite/innodb/r/innodb-autoinc.result +@@ -197,7 +197,7 @@ c1 c2 + 5 9 + DROP TABLE t1; + SET @@SESSION.AUTO_INCREMENT_INCREMENT=100, @@SESSION.AUTO_INCREMENT_OFFSET=10; +-SHOW VARIABLES LIKE "%auto_inc%"; ++SHOW VARIABLES LIKE "auto_inc%"; + Variable_name Value + auto_increment_increment 100 + auto_increment_offset 10 +@@ -228,9 +228,10 @@ c1 + 410 + 1000 + DROP TABLE t1; ++SET GLOBAL wsrep_auto_increment_control=OFF; + SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; + SET @@INSERT_ID=1; +-SHOW VARIABLES LIKE "%auto_inc%"; ++SHOW VARIABLES LIKE "auto_inc%"; + Variable_name Value + auto_increment_increment 1 + auto_increment_offset 1 +@@ -269,7 +270,7 @@ c1 + DROP TABLE t1; + SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; + SET @@INSERT_ID=1; +-SHOW VARIABLES LIKE "%auto_inc%"; ++SHOW VARIABLES LIKE "auto_inc%"; + Variable_name Value + auto_increment_increment 1 + auto_increment_offset 1 +@@ -282,7 +283,7 @@ SELECT * FROM t1; + c1 + -1 + SET @@SESSION.AUTO_INCREMENT_INCREMENT=100, @@SESSION.AUTO_INCREMENT_OFFSET=10; +-SHOW VARIABLES LIKE "%auto_inc%"; ++SHOW VARIABLES LIKE "auto_inc%"; + Variable_name Value + auto_increment_increment 100 + auto_increment_offset 10 +@@ -315,7 +316,7 @@ c1 + DROP TABLE t1; + SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; + SET @@INSERT_ID=1; +-SHOW VARIABLES LIKE "%auto_inc%"; ++SHOW VARIABLES LIKE "auto_inc%"; + Variable_name Value + auto_increment_increment 1 + auto_increment_offset 1 +@@ -330,7 +331,7 @@ SELECT * FROM t1; + c1 + 1 + SET @@SESSION.AUTO_INCREMENT_INCREMENT=100, @@SESSION.AUTO_INCREMENT_OFFSET=10; +-SHOW VARIABLES LIKE "%auto_inc%"; ++SHOW VARIABLES LIKE "auto_inc%"; + Variable_name Value + auto_increment_increment 100 + auto_increment_offset 10 +@@ -370,7 +371,7 @@ c1 + DROP TABLE t1; + SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; + SET @@INSERT_ID=1; +-SHOW VARIABLES LIKE "%auto_inc%"; ++SHOW VARIABLES LIKE "auto_inc%"; + Variable_name Value + auto_increment_increment 1 + auto_increment_offset 1 +@@ -385,7 +386,7 @@ SELECT * FROM t1; + c1 + 1 + SET @@SESSION.AUTO_INCREMENT_INCREMENT=100, @@SESSION.AUTO_INCREMENT_OFFSET=10; +-SHOW VARIABLES LIKE "%auto_inc%"; ++SHOW VARIABLES LIKE "auto_inc%"; + Variable_name Value + auto_increment_increment 100 + auto_increment_offset 10 +@@ -419,7 +420,7 @@ c1 + DROP TABLE t1; + SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; + SET @@INSERT_ID=1; +-SHOW VARIABLES LIKE "%auto_inc%"; ++SHOW VARIABLES LIKE "auto_inc%"; + Variable_name Value + auto_increment_increment 1 + auto_increment_offset 1 +@@ -434,7 +435,7 @@ c1 + 1 + 9223372036854775794 + SET @@SESSION.AUTO_INCREMENT_INCREMENT=2, @@SESSION.AUTO_INCREMENT_OFFSET=10; +-SHOW VARIABLES LIKE "%auto_inc%"; ++SHOW VARIABLES LIKE "auto_inc%"; + Variable_name Value + auto_increment_increment 2 + auto_increment_offset 10 +@@ -452,7 +453,7 @@ c1 + DROP TABLE t1; + SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; + SET @@INSERT_ID=1; +-SHOW VARIABLES LIKE "%auto_inc%"; ++SHOW VARIABLES LIKE "auto_inc%"; + Variable_name Value + auto_increment_increment 1 + auto_increment_offset 1 +@@ -467,7 +468,7 @@ c1 + 1 + 18446744073709551603 + SET @@SESSION.AUTO_INCREMENT_INCREMENT=2, @@SESSION.AUTO_INCREMENT_OFFSET=10; +-SHOW VARIABLES LIKE "%auto_inc%"; ++SHOW VARIABLES LIKE "auto_inc%"; + Variable_name Value + auto_increment_increment 2 + auto_increment_offset 10 +@@ -480,7 +481,7 @@ c1 + DROP TABLE t1; + SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; + SET @@INSERT_ID=1; +-SHOW VARIABLES LIKE "%auto_inc%"; ++SHOW VARIABLES LIKE "auto_inc%"; + Variable_name Value + auto_increment_increment 1 + auto_increment_offset 1 +@@ -495,7 +496,7 @@ c1 + 1 + 18446744073709551603 + SET @@SESSION.AUTO_INCREMENT_INCREMENT=5, @@SESSION.AUTO_INCREMENT_OFFSET=7; +-SHOW VARIABLES LIKE "%auto_inc%"; ++SHOW VARIABLES LIKE "auto_inc%"; + Variable_name Value + auto_increment_increment 5 + auto_increment_offset 7 +@@ -508,7 +509,7 @@ c1 + DROP TABLE t1; + SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; + SET @@INSERT_ID=1; +-SHOW VARIABLES LIKE "%auto_inc%"; ++SHOW VARIABLES LIKE "auto_inc%"; + Variable_name Value + auto_increment_increment 1 + auto_increment_offset 1 +@@ -527,7 +528,7 @@ c1 + -9223372036854775806 + 1 + SET @@SESSION.AUTO_INCREMENT_INCREMENT=3, @@SESSION.AUTO_INCREMENT_OFFSET=3; +-SHOW VARIABLES LIKE "%auto_inc%"; ++SHOW VARIABLES LIKE "auto_inc%"; + Variable_name Value + auto_increment_increment 3 + auto_increment_offset 3 +@@ -544,7 +545,7 @@ c1 + DROP TABLE t1; + SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; + SET @@INSERT_ID=1; +-SHOW VARIABLES LIKE "%auto_inc%"; ++SHOW VARIABLES LIKE "auto_inc%"; + Variable_name Value + auto_increment_increment 1 + auto_increment_offset 1 +@@ -562,7 +563,7 @@ SET @@SESSION.AUTO_INCREMENT_INCREMENT=1152921504606846976, @@SESSION.AUTO_INCRE + Warnings: + Warning 1292 Truncated incorrect auto_increment_increment value: '1152921504606846976' + Warning 1292 Truncated incorrect auto_increment_offset value: '1152921504606846976' +-SHOW VARIABLES LIKE "%auto_inc%"; ++SHOW VARIABLES LIKE "auto_inc%"; + Variable_name Value + auto_increment_increment 65535 + auto_increment_offset 65535 +@@ -575,7 +576,7 @@ c1 + DROP TABLE t1; + SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; + SET @@INSERT_ID=1; +-SHOW VARIABLES LIKE "%auto_inc%"; ++SHOW VARIABLES LIKE "auto_inc%"; + Variable_name Value + auto_increment_increment 1 + auto_increment_offset 1 +@@ -862,7 +863,7 @@ Got one of the listed errors + DROP TABLE t1; + DROP TABLE t2; + SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; +-SHOW VARIABLES LIKE "%auto_inc%"; ++SHOW VARIABLES LIKE "auto_inc%"; + Variable_name Value + auto_increment_increment 1 + auto_increment_offset 1 +@@ -1252,7 +1253,7 @@ t1 CREATE TABLE `t1` ( + ) ENGINE=InnoDB AUTO_INCREMENT=18446744073709551615 DEFAULT CHARSET=latin1 + DROP TABLE t1; + SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=256; +-SHOW VARIABLES LIKE "%auto_inc%"; ++SHOW VARIABLES LIKE "auto_inc%"; + Variable_name Value + auto_increment_increment 1 + auto_increment_offset 256 +@@ -1270,7 +1271,7 @@ c1 c2 + 1 NULL + DROP TABLE t1; + SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; +-SHOW VARIABLES LIKE "%auto_inc%"; ++SHOW VARIABLES LIKE "auto_inc%"; + Variable_name Value + auto_increment_increment 1 + auto_increment_offset 1 +diff --git a/mysql-test/suite/innodb/t/galera.skip b/mysql-test/suite/innodb/t/galera.skip +new file mode 100644 +index 0000000..54e07b4 +--- /dev/null ++++ b/mysql-test/suite/innodb/t/galera.skip +@@ -0,0 +1,43 @@ ++innodb : deadlock, failure in UPDATE IGNORE, lp1372296 ++innodb_ctype_ldml : Test contains statements unsafe to replicate in statement-based replication ++innodb-autoinc : deadlock, failure in REPLACE, lp1372296 ++innodb_mysql : deadlock due to DDL ++innodb_buffer_pool_load : Test contains statements unsafe to replicate in statement-based replication ++innodb-autoinc-56228 : deadlock, lp1372301 ++innodb_lock_wait_timeout_1 : Test contains statements unsafe to replicate in statement-based replication ++innodb-consistent : Test contains statements unsafe to replicate in statement-based replication ++innodb-semi-consistent : Test contains statements unsafe to replicate in statement-based replication ++innodb-index : DDL concurrent with transaction ++innodb-lock : deadlock on INSERT IGNORE, lp1372296 ++innodb-status-output : Test performs server restart ++innodb-wl5522 : Test contains statements unsafe to replicate in statement-based replication ++innodb-wl6445 : Test performs server restart ++innodb_bug40360 : Test contains statements unsafe to replicate in statement-based replication ++innodb_bug40565 : Galera git bug #137 - Invalid deadlock on UPDATE to NULL without a PK ++innodb_bug42419 : Test contains statements unsafe to replicate in statement-based replication ++innodb_bug49164 : Test contains statements unsafe to replicate in statement-based replication ++innodb_bug45357 : impossible to write to binary log since BINLOG_FORMAT = STATEMENT and at least one table uses a storage engine limited to row-based logging ++innodb_bug52663 : Test contains statements unsafe to replicate in statement-based replication ++innodb_bug59733 : Test contains statements unsafe to replicate in statement-based replication ++innodb_gis : Test contains statements unsafe to replicate in statement-based replication ++innodb_prefix_index_restart_server : crash, lp1372288 ++innodb_stats_external_pages : Test contains statements unsafe to replicate in statement-based replication ++innodb-2byte-collation : Unsafe statement written to the binary log ++innodb-change-buffer-recovery : Test contains statements unsafe to replicate in statement-based replication ++innodb_bug53756 : Cannot execute statement: impossible to write to binary log since BINLOG_FORMAT = STATEMENT ++innodb-alter-autoinc : AUTO_INCREMENT differences ++innodb_bug13635833 : Test contains statements unsafe to replicate in statement-based replication ++innodb_bug13867871 : mysql-wsrep#3 - innodb_bug13867871 test fails with wsrep loaded ++innodb_bug14006907 : DDL lock wait timeout ++innodb_bug38231 : Deadlock on UNLOCK TABLE ++innodb_bug-13628249 : mysql-wsrep#12 InnoDB: Failing assertion: !srv_read_only_mode with server restart ++innodb-wl6445-1 : mysql-wsrep#12 InnoDB: Failing assertion: !srv_read_only_mode with server restart ++innodb-wl6445-2 : mysql-wsrep#12 InnoDB: Failing assertion: !srv_read_only_mode with server restart ++innodb_bug12400341 : Test does not account for applier threads when performing SHOW PROCESSLIST ++innodb-blob : 'Cannot execute statement: impossible to write to binary log since BINLOG_FORMAT = STATEMENT and at least one table uses a storage engine limited to row-based logging' ++innodb_corrupt_bit : 'Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.' ++innodb-index-online : ALTER succeeds as it is given a higher priority ++innodb-table-online : ALTER succeeds as it is given a higher priority ++innodb-index-online-purge : ALTER succeeds as it is given a higher priority ++innodb-wl5522-debug : Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. ++innodb_stats_table_flag_auto_recalc : Performs multiple restarts in a row which causes '1047: Unknown command' errors +diff --git a/mysql-test/suite/innodb/t/innodb-autoinc.test b/mysql-test/suite/innodb/t/innodb-autoinc.test +index 3d9f591..7cc8065 100644 +--- a/mysql-test/suite/innodb/t/innodb-autoinc.test ++++ b/mysql-test/suite/innodb/t/innodb-autoinc.test +@@ -156,7 +156,7 @@ DROP TABLE t1; + # + # Test changes to AUTOINC next value calculation + SET @@SESSION.AUTO_INCREMENT_INCREMENT=100, @@SESSION.AUTO_INCREMENT_OFFSET=10; +-SHOW VARIABLES LIKE "%auto_inc%"; ++SHOW VARIABLES LIKE "auto_inc%"; + DROP TABLE IF EXISTS t1; + CREATE TABLE t1 (c1 INT AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; + INSERT INTO t1 VALUES (NULL),(5),(NULL); +@@ -171,9 +171,11 @@ DROP TABLE t1; + # Test with SIGNED INT column, by inserting a 0 for the first column value + # 0 is treated in the same was NULL. + # Reset the AUTOINC session variables ++SET GLOBAL wsrep_auto_increment_control=OFF; ++ + SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; + SET @@INSERT_ID=1; +-SHOW VARIABLES LIKE "%auto_inc%"; ++SHOW VARIABLES LIKE "auto_inc%"; + DROP TABLE IF EXISTS t1; + CREATE TABLE t1 (c1 INT AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; + INSERT INTO t1 VALUES(0); +@@ -193,13 +195,13 @@ DROP TABLE t1; + # Reset the AUTOINC session variables + SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; + SET @@INSERT_ID=1; +-SHOW VARIABLES LIKE "%auto_inc%"; ++SHOW VARIABLES LIKE "auto_inc%"; + DROP TABLE IF EXISTS t1; + CREATE TABLE t1 (c1 INT AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; + INSERT INTO t1 VALUES(-1); + SELECT * FROM t1; + SET @@SESSION.AUTO_INCREMENT_INCREMENT=100, @@SESSION.AUTO_INCREMENT_OFFSET=10; +-SHOW VARIABLES LIKE "%auto_inc%"; ++SHOW VARIABLES LIKE "auto_inc%"; + INSERT INTO t1 VALUES (-2), (NULL),(2),(NULL); + INSERT INTO t1 VALUES (250),(NULL); + SELECT * FROM t1; +@@ -214,13 +216,13 @@ DROP TABLE t1; + # Reset the AUTOINC session variables + SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; + SET @@INSERT_ID=1; +-SHOW VARIABLES LIKE "%auto_inc%"; ++SHOW VARIABLES LIKE "auto_inc%"; + DROP TABLE IF EXISTS t1; + CREATE TABLE t1 (c1 INT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; + INSERT INTO t1 VALUES(-1); + SELECT * FROM t1; + SET @@SESSION.AUTO_INCREMENT_INCREMENT=100, @@SESSION.AUTO_INCREMENT_OFFSET=10; +-SHOW VARIABLES LIKE "%auto_inc%"; ++SHOW VARIABLES LIKE "auto_inc%"; + INSERT INTO t1 VALUES (-2); + INSERT INTO t1 VALUES (NULL); + INSERT INTO t1 VALUES (2); +@@ -240,13 +242,13 @@ DROP TABLE t1; + # Reset the AUTOINC session variables + SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; + SET @@INSERT_ID=1; +-SHOW VARIABLES LIKE "%auto_inc%"; ++SHOW VARIABLES LIKE "auto_inc%"; + DROP TABLE IF EXISTS t1; + CREATE TABLE t1 (c1 INT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; + INSERT INTO t1 VALUES(-1); + SELECT * FROM t1; + SET @@SESSION.AUTO_INCREMENT_INCREMENT=100, @@SESSION.AUTO_INCREMENT_OFFSET=10; +-SHOW VARIABLES LIKE "%auto_inc%"; ++SHOW VARIABLES LIKE "auto_inc%"; + INSERT INTO t1 VALUES (-2),(NULL),(2),(NULL); + INSERT INTO t1 VALUES (250),(NULL); + SELECT * FROM t1; +@@ -262,7 +264,7 @@ DROP TABLE t1; + # Check for overflow handling when increment is > 1 + SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; + SET @@INSERT_ID=1; +-SHOW VARIABLES LIKE "%auto_inc%"; ++SHOW VARIABLES LIKE "auto_inc%"; + DROP TABLE IF EXISTS t1; + CREATE TABLE t1 (c1 BIGINT AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; + # TODO: Fix the autoinc init code +@@ -271,7 +273,7 @@ INSERT INTO t1 VALUES(NULL); + INSERT INTO t1 VALUES (9223372036854775794); #-- 2^63 - 14 + SELECT * FROM t1; + SET @@SESSION.AUTO_INCREMENT_INCREMENT=2, @@SESSION.AUTO_INCREMENT_OFFSET=10; +-SHOW VARIABLES LIKE "%auto_inc%"; ++SHOW VARIABLES LIKE "auto_inc%"; + # This should just fit + INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL); + SELECT * FROM t1; +@@ -281,7 +283,7 @@ DROP TABLE t1; + # Check for overflow handling when increment and offser are > 1 + SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; + SET @@INSERT_ID=1; +-SHOW VARIABLES LIKE "%auto_inc%"; ++SHOW VARIABLES LIKE "auto_inc%"; + DROP TABLE IF EXISTS t1; + CREATE TABLE t1 (c1 BIGINT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; + # TODO: Fix the autoinc init code +@@ -290,7 +292,7 @@ INSERT INTO t1 VALUES(NULL); + INSERT INTO t1 VALUES (18446744073709551603); #-- 2^64 - 13 + SELECT * FROM t1; + SET @@SESSION.AUTO_INCREMENT_INCREMENT=2, @@SESSION.AUTO_INCREMENT_OFFSET=10; +-SHOW VARIABLES LIKE "%auto_inc%"; ++SHOW VARIABLES LIKE "auto_inc%"; + --error ER_AUTOINC_READ_FAILED + INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL); + SELECT * FROM t1; +@@ -300,7 +302,7 @@ DROP TABLE t1; + # Check for overflow handling when increment and offset are odd numbers + SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; + SET @@INSERT_ID=1; +-SHOW VARIABLES LIKE "%auto_inc%"; ++SHOW VARIABLES LIKE "auto_inc%"; + DROP TABLE IF EXISTS t1; + CREATE TABLE t1 (c1 BIGINT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; + # TODO: Fix the autoinc init code +@@ -309,7 +311,7 @@ INSERT INTO t1 VALUES(NULL); + INSERT INTO t1 VALUES (18446744073709551603); #-- 2^64 - 13 + SELECT * FROM t1; + SET @@SESSION.AUTO_INCREMENT_INCREMENT=5, @@SESSION.AUTO_INCREMENT_OFFSET=7; +-SHOW VARIABLES LIKE "%auto_inc%"; ++SHOW VARIABLES LIKE "auto_inc%"; + --error ER_AUTOINC_READ_FAILED + INSERT INTO t1 VALUES (NULL),(NULL), (NULL); + SELECT * FROM t1; +@@ -319,7 +321,7 @@ DROP TABLE t1; + # and check for large -ve numbers + SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; + SET @@INSERT_ID=1; +-SHOW VARIABLES LIKE "%auto_inc%"; ++SHOW VARIABLES LIKE "auto_inc%"; + DROP TABLE IF EXISTS t1; + CREATE TABLE t1 (c1 BIGINT AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; + # TODO: Fix the autoinc init code +@@ -330,7 +332,7 @@ INSERT INTO t1 VALUES(-9223372036854775807); #-- -2^63 + 1 + INSERT INTO t1 VALUES(-9223372036854775808); #-- -2^63 + SELECT * FROM t1; + SET @@SESSION.AUTO_INCREMENT_INCREMENT=3, @@SESSION.AUTO_INCREMENT_OFFSET=3; +-SHOW VARIABLES LIKE "%auto_inc%"; ++SHOW VARIABLES LIKE "auto_inc%"; + INSERT INTO t1 VALUES (NULL),(NULL), (NULL); + SELECT * FROM t1; + DROP TABLE t1; +@@ -339,7 +341,7 @@ DROP TABLE t1; + # large numbers 2^60 + SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; + SET @@INSERT_ID=1; +-SHOW VARIABLES LIKE "%auto_inc%"; ++SHOW VARIABLES LIKE "auto_inc%"; + DROP TABLE IF EXISTS t1; + CREATE TABLE t1 (c1 BIGINT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; + # TODO: Fix the autoinc init code +@@ -348,7 +350,7 @@ INSERT INTO t1 VALUES(NULL); + INSERT INTO t1 VALUES (18446744073709551610); #-- 2^64 - 2 + SELECT * FROM t1; + SET @@SESSION.AUTO_INCREMENT_INCREMENT=1152921504606846976, @@SESSION.AUTO_INCREMENT_OFFSET=1152921504606846976; +-SHOW VARIABLES LIKE "%auto_inc%"; ++SHOW VARIABLES LIKE "auto_inc%"; + --error ER_WARN_DATA_OUT_OF_RANGE + INSERT INTO t1 VALUES (NULL),(NULL); + SELECT * FROM t1; +@@ -359,7 +361,7 @@ DROP TABLE t1; + # + SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; + SET @@INSERT_ID=1; +-SHOW VARIABLES LIKE "%auto_inc%"; ++SHOW VARIABLES LIKE "auto_inc%"; + CREATE TABLE t1 (c1 DOUBLE NOT NULL AUTO_INCREMENT, c2 INT, PRIMARY KEY (c1)) ENGINE=InnoDB; + INSERT INTO t1 VALUES(NULL, 1); + INSERT INTO t1 VALUES(NULL, 2); +@@ -445,7 +447,7 @@ DROP TABLE t2; + # If the user has specified negative values for an AUTOINC column then + # InnoDB should ignore those values when setting the table's max value. + SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; +-SHOW VARIABLES LIKE "%auto_inc%"; ++SHOW VARIABLES LIKE "auto_inc%"; + # TINYINT + CREATE TABLE t1 (c1 TINYINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; + INSERT INTO t1 VALUES (1, NULL); +@@ -641,7 +643,7 @@ DROP TABLE t1; + + # Check if we handle offset > column max value properly + SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=256; +-SHOW VARIABLES LIKE "%auto_inc%"; ++SHOW VARIABLES LIKE "auto_inc%"; + # TINYINT + CREATE TABLE t1 (c1 TINYINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; + INSERT INTO t1 VALUES (1, NULL); +@@ -653,7 +655,7 @@ DROP TABLE t1; + # of the column. IMO, this should not be allowed and the assertion that fails + # is actually an invariant. + SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; +-SHOW VARIABLES LIKE "%auto_inc%"; ++SHOW VARIABLES LIKE "auto_inc%"; + # TINYINT + CREATE TABLE t1 (c1 INT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; + INSERT INTO t1 VALUES (2147483648, 'a'); +diff --git a/mysql-test/suite/opt_trace/t/disabled.def b/mysql-test/suite/opt_trace/t/disabled.def +new file mode 100644 +index 0000000..3ed40b8 +--- /dev/null ++++ b/mysql-test/suite/opt_trace/t/disabled.def +@@ -0,0 +1,2 @@ ++general_no_prot_all : Galera mysql-wsrep#5 2014-10-28 pstoev opt_trace.general_no_prot_none and opt_trace.general_no_prot_all fail in mysql-wsrep ++general_no_prot_none : Galera mysql-wsrep#5 2014-10-28 pstoev opt_trace.general_no_prot_none and opt_trace.general_no_prot_all fail in mysql-wsrep +diff --git a/mysql-test/suite/parts/r/partition_exch_qa_10.result b/mysql-test/suite/parts/r/partition_exch_qa_10.result +index 77b91f1..7193a6c 100644 +--- a/mysql-test/suite/parts/r/partition_exch_qa_10.result ++++ b/mysql-test/suite/parts/r/partition_exch_qa_10.result +@@ -23,7 +23,7 @@ a b + DROP PROCEDURE test_p1; + SET @save_autocommit= @@autocommit; + SET @@autocommit= OFF; +-SHOW VARIABLES LIKE '%autocommit%'; ++SHOW VARIABLES LIKE 'autocommit%'; + Variable_name Value + autocommit OFF + CREATE TRIGGER test_trg_1 BEFORE UPDATE ON tp FOR EACH ROW +diff --git a/mysql-test/suite/parts/t/partition_exch_qa_10.test b/mysql-test/suite/parts/t/partition_exch_qa_10.test +index 4f56960..a87d658 100644 +--- a/mysql-test/suite/parts/t/partition_exch_qa_10.test ++++ b/mysql-test/suite/parts/t/partition_exch_qa_10.test +@@ -37,7 +37,7 @@ DROP PROCEDURE test_p1; + + SET @save_autocommit= @@autocommit; + SET @@autocommit= OFF; +-SHOW VARIABLES LIKE '%autocommit%'; ++SHOW VARIABLES LIKE 'autocommit%'; + DELIMITER |; + --error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG + CREATE TRIGGER test_trg_1 BEFORE UPDATE ON tp FOR EACH ROW +diff --git a/mysql-test/suite/perfschema/r/dml_setup_instruments.result b/mysql-test/suite/perfschema/r/dml_setup_instruments.result +index b3de51e..5152d9f 100644 +--- a/mysql-test/suite/perfschema/r/dml_setup_instruments.result ++++ b/mysql-test/suite/perfschema/r/dml_setup_instruments.result +@@ -34,6 +34,7 @@ where name like 'Wait/Synch/Cond/sql/%' + and name not in ( + 'wait/synch/cond/sql/COND_handler_count', + 'wait/synch/cond/sql/DEBUG_SYNC::cond') ++and name not like 'wait/synch/cond/sql/COND_wsrep_%' + order by name limit 10; + NAME ENABLED TIMED + wait/synch/cond/sql/COND_flush_thread_cache YES YES +diff --git a/mysql-test/suite/perfschema/r/rpl_statements.result b/mysql-test/suite/perfschema/r/rpl_statements.result +index dd8d349..96016bd 100644 +--- a/mysql-test/suite/perfschema/r/rpl_statements.result ++++ b/mysql-test/suite/perfschema/r/rpl_statements.result +@@ -14,7 +14,7 @@ Note #### Storing MySQL user name or password information in the master info rep + + *** Create test tables + +-show variables like '%binlog_format%'; ++show variables like 'binlog_format%'; + Variable_name Value + binlog_format MIXED + drop table if exists test.marker; +@@ -58,7 +58,7 @@ Expect 1 + *** MASTER *** + ************** + +-show variables like '%binlog_format%'; ++show variables like 'binlog_format%'; + Variable_name Value + binlog_format MIXED + *** Clear statement events +diff --git a/mysql-test/suite/perfschema/t/disabled.def b/mysql-test/suite/perfschema/t/disabled.def +index 888298b..1a6d6b5 100644 +--- a/mysql-test/suite/perfschema/t/disabled.def ++++ b/mysql-test/suite/perfschema/t/disabled.def +@@ -9,3 +9,6 @@ + # Do not use any TAB characters for whitespace. + # + ############################################################################## ++ ++perfschema.sizing_growth : Galera LP#1370988 2014-10-28 pstoev Performance schema heuristics need to be updated ++ortho_iter : Galera mysql-wsrep#34 2014-12-19 perfschema.ortho_iter MTR test fails sporadically +diff --git a/mysql-test/suite/perfschema/t/dml_setup_instruments.test b/mysql-test/suite/perfschema/t/dml_setup_instruments.test +index 8a4f11b..b679b7a 100644 +--- a/mysql-test/suite/perfschema/t/dml_setup_instruments.test ++++ b/mysql-test/suite/perfschema/t/dml_setup_instruments.test +@@ -36,7 +36,8 @@ select * from performance_schema.setup_instruments + and name not in ( + 'wait/synch/cond/sql/COND_handler_count', + 'wait/synch/cond/sql/DEBUG_SYNC::cond') +- order by name limit 10; ++ and name not like 'wait/synch/cond/sql/COND_wsrep_%' ++order by name limit 10; + + --disable_result_log + select * from performance_schema.setup_instruments +diff --git a/mysql-test/suite/perfschema/t/rpl_statements.test b/mysql-test/suite/perfschema/t/rpl_statements.test +index 8e71961..ac4ece5 100644 +--- a/mysql-test/suite/perfschema/t/rpl_statements.test ++++ b/mysql-test/suite/perfschema/t/rpl_statements.test +@@ -63,7 +63,7 @@ connection master; + --echo *** Create test tables + --echo + +-show variables like '%binlog_format%'; ++show variables like 'binlog_format%'; + + --disable_warnings + drop table if exists test.marker; +@@ -128,7 +128,7 @@ connection master; + --echo *** MASTER *** + --echo ************** + --echo +-show variables like '%binlog_format%'; ++show variables like 'binlog_format%'; + + --echo *** Clear statement events + --source ../include/rpl_statements_truncate.inc +diff --git a/mysql-test/suite/rpl/r/rpl_auto_increment.result b/mysql-test/suite/rpl/r/rpl_auto_increment.result +index 0d858cf..283d244 100644 +--- a/mysql-test/suite/rpl/r/rpl_auto_increment.result ++++ b/mysql-test/suite/rpl/r/rpl_auto_increment.result +@@ -42,6 +42,7 @@ show variables like "%auto_inc%"; + Variable_name Value + auto_increment_increment 100 + auto_increment_offset 10 ++wsrep_auto_increment_control ON + create table t1 (a int not null auto_increment, primary key (a)) engine=myisam; + insert into t1 values (NULL),(5),(NULL); + insert into t1 values (250),(NULL); +diff --git a/mysql-test/suite/rpl/t/disabled.def b/mysql-test/suite/rpl/t/disabled.def +index a82c31c..fd07c96 100644 +--- a/mysql-test/suite/rpl/t/disabled.def ++++ b/mysql-test/suite/rpl/t/disabled.def +@@ -13,3 +13,4 @@ + rpl_row_create_table : Bug#11759274 2010-02-27 andrei failed different way than earlier with bug#45576 + rpl_delayed_slave : Bug#11764654 2010-11-09 andrei rpl_delayed_slave fails sporadically in pb + rpl_row_binlog_max_cache_size : BUG#14126780 May 29 2012 Vasil Dimov timeout if est number of rows is 3 instead of 4 ++rpl_test_framework : Too many servers started, so fails under Galera-enabled MTR +diff --git a/mysql-test/suite/sys_vars/r/all_vars.result b/mysql-test/suite/sys_vars/r/all_vars.result +index e042384..4edc039 100644 +--- a/mysql-test/suite/sys_vars/r/all_vars.result ++++ b/mysql-test/suite/sys_vars/r/all_vars.result +@@ -1,8 +1,8 @@ + create table t1 (test_name text); + create table t2 (variable_name text); + load data infile "MYSQLTEST_VARDIR/tmp/sys_vars.all_vars.txt" into table t1; +-insert into t2 select variable_name from information_schema.global_variables; +-insert into t2 select variable_name from information_schema.session_variables; ++insert into t2 select variable_name from information_schema.global_variables where variable_name not like 'wsrep_%' and variable_name not like 'innodb_disallow_writes'; ++insert into t2 select variable_name from information_schema.session_variables where variable_name not like 'wsrep_%' and variable_name not like 'innodb_disallow_writes'; + update t2 set variable_name= replace(variable_name, "PERFORMANCE_SCHEMA_", "PFS_"); + update t2 set variable_name= replace(variable_name, "_HISTORY_LONG_", "_HL_"); + update t2 set variable_name= replace(variable_name, "_HISTORY_", "_H_"); +diff --git a/mysql-test/suite/sys_vars/t/all_vars.test b/mysql-test/suite/sys_vars/t/all_vars.test +index c272528..90f977e 100644 +--- a/mysql-test/suite/sys_vars/t/all_vars.test ++++ b/mysql-test/suite/sys_vars/t/all_vars.test +@@ -49,8 +49,8 @@ create table t2 (variable_name text); + --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR + eval load data infile "$MYSQLTEST_VARDIR/tmp/sys_vars.all_vars.txt" into table t1; + +-insert into t2 select variable_name from information_schema.global_variables; +-insert into t2 select variable_name from information_schema.session_variables; ++insert into t2 select variable_name from information_schema.global_variables where variable_name not like 'wsrep_%' and variable_name not like 'innodb_disallow_writes'; ++insert into t2 select variable_name from information_schema.session_variables where variable_name not like 'wsrep_%' and variable_name not like 'innodb_disallow_writes'; + + # Performance schema variables are too long for files named + # 'mysql-test/suite/sys_vars/t/' ... +diff --git a/mysql-test/suite/wsrep/my.cnf b/mysql-test/suite/wsrep/my.cnf +new file mode 100644 +index 0000000..81e22a5 +--- /dev/null ++++ b/mysql-test/suite/wsrep/my.cnf +@@ -0,0 +1,12 @@ ++# Use default setting for mysqld processes ++!include include/default_mysqld.cnf ++ ++[mysqld.1] ++wsrep_provider=@ENV.WSREP_PROVIDER ++wsrep_cluster_address='gcomm://' ++wsrep_node_address=127.0.0.1 ++binlog-format=row ++ ++[ENV] ++GALERA_BASE_PORT=@mysqld.1.#galera_port ++ +diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def +index dd8a6f4..ae0eb82 100644 +--- a/mysql-test/t/disabled.def ++++ b/mysql-test/t/disabled.def +@@ -18,3 +18,4 @@ ds_mrr-big @solaris : Bug#14168107 2012-04-03 Hemant disabled new test adde + mysql_embedded_client_test : Bug#13964673 2012-04-16 amitbha since most of the test cases are failing + mysql_client_test_embedded : Bug#16084066 2013-01-08 Disabled since this test is failing + file_contents : Fails without bzr revision id ++bootstrap : Galera mysql-wsrep#19 2014-11-21 pstoev Crash in LOGGER::error_log_print when printing a WSREP message +diff --git a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test +index 2b92d9e..8c0c56f 100644 +--- a/mysql-test/t/mysqltest.test ++++ b/mysql-test/t/mysqltest.test +@@ -708,7 +708,7 @@ remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql; + + # Too many errorcodes specified + --error 1 +---exec echo "--error 1,2,3,4,5,6,7,8,9,10,11" | $MYSQL_TEST 2>&1 ++--exec echo "--error 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21" | $MYSQL_TEST 2>&1 + + + # ---------------------------------------------------------------------------- +diff --git a/mysys/thr_lock.c b/mysys/thr_lock.c +index 9ef8632..9098cd8 100644 +--- a/mysys/thr_lock.c ++++ b/mysys/thr_lock.c +@@ -82,7 +82,24 @@ one TL_WRITE_DELAYED lock at the same time as multiple read locks. + my_bool thr_lock_inited=0; + ulong locks_immediate = 0L, locks_waited = 0L; + enum thr_lock_type thr_upgraded_concurrent_insert_lock = TL_WRITE; +- ++#ifdef WITH_WSREP ++static wsrep_thd_is_brute_force_fun wsrep_thd_is_brute_force= NULL; ++static wsrep_abort_thd_fun wsrep_abort_thd= NULL; ++static my_bool wsrep_debug; ++static my_bool wsrep_convert_LOCK_to_trx; ++static wsrep_on_fun wsrep_on = NULL; ++ ++void wsrep_thr_lock_init( ++ wsrep_thd_is_brute_force_fun bf_fun, wsrep_abort_thd_fun abort_fun, ++ my_bool debug, my_bool convert_LOCK_to_trx, wsrep_on_fun on_fun ++) { ++ wsrep_thd_is_brute_force = bf_fun; ++ wsrep_abort_thd = abort_fun; ++ wsrep_debug = debug; ++ wsrep_convert_LOCK_to_trx= convert_LOCK_to_trx; ++ wsrep_on = on_fun; ++} ++#endif + /* The following constants are only for debug output */ + #define MAX_THREADS 100 + #define MAX_LOCKS 100 +@@ -536,6 +553,108 @@ wait_for_lock(struct st_lock_list *wait, THR_LOCK_DATA *data, + DBUG_RETURN(result); + } + ++#ifdef WITH_WSREP ++/* ++ * If brute force applier would need to wait for a thr lock, ++ * it needs to make sure that it will get the lock without (too much) ++ * delay. ++ * We identify here the owners of blocking locks and ask them to ++ * abort. We then put our lock request in the first place in the ++ * wait queue. When lock holders abort (one by one) the lock release ++ * algorithm should grant the lock to us. We rely on this and proceed ++ * to wait_for_locks(). ++ * wsrep_break_locks() should be called in all the cases, where lock ++ * wait would happen. ++ * ++ * TODO: current implementation might not cover all possible lock wait ++ * situations. This needs an review still. ++ * TODO: lock release, might favor some other lock (instead our bf). ++ * This needs an condition to check for bf locks first. ++ * TODO: we still have a debug fprintf, this should be removed ++ */ ++static inline my_bool ++wsrep_break_lock( ++ THR_LOCK_DATA *data, struct st_lock_list *lock_queue1, ++ struct st_lock_list *lock_queue2, struct st_lock_list *wait_queue) ++{ ++ if (wsrep_on(data->owner->mysql_thd) && ++ wsrep_thd_is_brute_force && ++ wsrep_thd_is_brute_force(data->owner->mysql_thd, TRUE)) ++ { ++ THR_LOCK_DATA *holder; ++ ++ /* if locking session conversion to transaction has been enabled, ++ we know that this conflicting lock must be read lock and furthermore, ++ lock holder is read-only. It is safe to wait for him. ++ */ ++#ifdef TODO ++ if (wsrep_convert_LOCK_to_trx && ++ (THD*)(data->owner->mysql_thd)->in_lock_tables) ++ { ++ if (wsrep_debug) ++ fprintf(stderr,"WSREP wsrep_break_lock read lock untouched\n"); ++ return FALSE; ++ } ++#endif ++ if (wsrep_debug) ++ fprintf(stderr,"WSREP wsrep_break_lock aborting locks\n"); ++ ++ /* aborting lock holder(s) here */ ++ for (holder=(lock_queue1) ? lock_queue1->data : NULL; ++ holder; ++ holder=holder->next) ++ { ++ if (!wsrep_thd_is_brute_force(holder->owner->mysql_thd, TRUE)) ++ { ++ wsrep_abort_thd(data->owner->mysql_thd, ++ holder->owner->mysql_thd, FALSE); ++ } ++ else ++ { ++ if (wsrep_debug) ++ fprintf(stderr,"WSREP wsrep_break_lock skipping BF lock conflict\n"); ++ return FALSE; ++ } ++ } ++ for (holder=(lock_queue2) ? lock_queue2->data : NULL; ++ holder; ++ holder=holder->next) ++ { ++ if (!wsrep_thd_is_brute_force(holder->owner->mysql_thd, TRUE)) ++ { ++ wsrep_abort_thd(data->owner->mysql_thd, ++ holder->owner->mysql_thd, FALSE); ++ } ++ else ++ { ++ if (wsrep_debug) ++ fprintf(stderr,"WSREP wsrep_break_lock skipping BF lock conflict\n"); ++ return FALSE; ++ } ++ } ++ ++ /* Add our lock to the head of the wait queue */ ++ if (*(wait_queue->last)==wait_queue->data) ++ { ++ wait_queue->last=&data->next; ++ assert(wait_queue->data==0); ++ } ++ else ++ { ++ assert(wait_queue->data!=0); ++ wait_queue->data->prev=&data->next; ++ } ++ data->next=wait_queue->data; ++ data->prev=&wait_queue->data; ++ wait_queue->data=data; ++ data->cond=get_cond(); ++ ++ statistic_increment(locks_immediate,&THR_LOCK_lock); ++ return TRUE; ++ } ++ return FALSE; ++} ++#endif + + enum enum_thr_lock_result + thr_lock(THR_LOCK_DATA *data, THR_LOCK_INFO *owner, +@@ -544,6 +663,9 @@ thr_lock(THR_LOCK_DATA *data, THR_LOCK_INFO *owner, + THR_LOCK *lock=data->lock; + enum enum_thr_lock_result result= THR_LOCK_SUCCESS; + struct st_lock_list *wait_queue; ++#ifdef WITH_WSREP ++ my_bool wsrep_lock_inserted= FALSE; ++#endif + MYSQL_TABLE_WAIT_VARIABLES(locker, state) /* no ';' */ + DBUG_ENTER("thr_lock"); + +@@ -613,6 +735,13 @@ thr_lock(THR_LOCK_DATA *data, THR_LOCK_INFO *owner, + } + if (lock->write.data->type == TL_WRITE_ONLY) + { ++#ifdef WITH_WSREP ++ if (wsrep_break_lock(data, &lock->write, NULL, &lock->read_wait)) ++ { ++ wsrep_lock_inserted= TRUE; ++ goto wsrep_read_wait; ++ } ++#endif + /* We are not allowed to get a READ lock in this case */ + data->type=TL_UNLOCK; + result= THR_LOCK_ABORTED; /* Can't wait for this one */ +@@ -640,6 +769,13 @@ thr_lock(THR_LOCK_DATA *data, THR_LOCK_INFO *owner, + lock but a high priority write waiting in the write_wait queue. + In the latter case we should yield the lock to the writer. + */ ++#ifdef WITH_WSREP ++ if (wsrep_break_lock(data, &lock->write, NULL, &lock->read_wait)) ++ { ++ wsrep_lock_inserted= TRUE; ++ } ++ wsrep_read_wait: ++#endif + wait_queue= &lock->read_wait; + } + else /* Request for WRITE lock */ +@@ -648,12 +784,25 @@ thr_lock(THR_LOCK_DATA *data, THR_LOCK_INFO *owner, + { + if (lock->write.data && lock->write.data->type == TL_WRITE_ONLY) + { ++#ifdef WITH_WSREP ++ if (wsrep_break_lock(data, &lock->write, NULL, &lock->write_wait)) ++ { ++ wsrep_lock_inserted=TRUE; ++ goto wsrep_write_wait; ++ } ++#endif + data->type=TL_UNLOCK; + result= THR_LOCK_ABORTED; /* Can't wait for this one */ + goto end; + } + if (lock->write.data || lock->read.data) + { ++#ifdef WITH_WSREP ++ if (wsrep_break_lock(data, &lock->write, NULL, &lock->write_wait)) ++ { ++ goto end; ++ } ++#endif + /* Add delayed write lock to write_wait queue, and return at once */ + (*lock->write_wait.last)=data; + data->prev=lock->write_wait.last; +@@ -678,6 +827,13 @@ thr_lock(THR_LOCK_DATA *data, THR_LOCK_INFO *owner, + /* Allow lock owner to bypass TL_WRITE_ONLY. */ + if (!thr_lock_owner_equal(data->owner, lock->write.data->owner)) + { ++#ifdef WITH_WSREP ++ if (wsrep_break_lock(data, &lock->write, NULL, &lock->write_wait)) ++ { ++ wsrep_lock_inserted=TRUE; ++ goto wsrep_write_wait; ++ } ++#endif + /* We are not allowed to get a lock in this case */ + data->type=TL_UNLOCK; + result= THR_LOCK_ABORTED; /* Can't wait for this one */ +@@ -781,9 +937,20 @@ thr_lock(THR_LOCK_DATA *data, THR_LOCK_INFO *owner, + DBUG_PRINT("lock",("write locked 3 by thread: 0x%lx type: %d", + lock->read.data->owner->thread_id, data->type)); + } ++#ifdef WITH_WSREP ++ if (wsrep_break_lock(data, &lock->write, NULL, &lock->write_wait)) ++ { ++ wsrep_lock_inserted= TRUE; ++ } ++ wsrep_write_wait: ++#endif + wait_queue= &lock->write_wait; + } + /* Can't get lock yet; Wait for it */ ++#ifdef WITH_WSREP ++ if (wsrep_on(data->owner->mysql_thd) && wsrep_lock_inserted) ++ DBUG_RETURN(wait_for_lock(wait_queue, data, 1, lock_wait_timeout)); ++#endif + result= wait_for_lock(wait_queue, data, 0, lock_wait_timeout); + MYSQL_END_TABLE_LOCK_WAIT(locker); + DBUG_RETURN(result); +diff --git a/mysys_ssl/my_default.cc b/mysys_ssl/my_default.cc +index 6712b79..ff8f44c 100644 +--- a/mysys_ssl/my_default.cc ++++ b/mysys_ssl/my_default.cc +@@ -110,6 +110,12 @@ static char my_login_file[FN_REFLEN]; + + static my_bool defaults_already_read= FALSE; + ++#ifdef WITH_WSREP ++/* The only purpose of this global array is to hold full name of my.cnf ++ * which seems to be otherwise unavailable */ ++char wsrep_defaults_file[FN_REFLEN + 10]={0,}; ++char wsrep_defaults_group_suffix[FN_EXTLEN]={0,}; ++#endif /* WITH_WREP */ + /* Set to TRUE, if --no-defaults is found. */ + static my_bool found_no_defaults= FALSE; + +@@ -534,6 +540,13 @@ int get_defaults_options(int argc, char **argv, + if (!*group_suffix && is_prefix(*argv, "--defaults-group-suffix=")) + { + *group_suffix= *argv + sizeof("--defaults-group-suffix=")-1; ++ ++#ifdef WITH_WSREP ++ /* make sure we do this only once - for top-level file */ ++ if ('\0' == wsrep_defaults_group_suffix[0]) ++ strncpy(wsrep_defaults_group_suffix, *group_suffix, sizeof(wsrep_defaults_group_suffix) - 1); ++#endif /* WITH_WSREP */ ++ + argc--; + default_option_count ++; + continue; +@@ -893,6 +906,11 @@ static int search_default_file_with_ext(Process_option_func opt_handler, + if ( !(fp = mysql_file_fopen(key_file_cnf, name, O_RDONLY, MYF(0)))) + return 1; /* Ignore wrong files */ + } ++#ifdef WITH_WSREP ++ /* make sure we do this only once - for top-level file */ ++ if ('\0' == wsrep_defaults_file[0]) ++ strncpy(wsrep_defaults_file, name, sizeof(wsrep_defaults_file) - 1); ++#endif /* WITH_WSREP */ + + while (mysql_file_getline(buff, sizeof(buff) - 1, fp)) + { +diff --git a/mysys_ssl/my_md5.cc b/mysys_ssl/my_md5.cc +index 4c14366..1ef0b42 100644 +--- a/mysys_ssl/my_md5.cc ++++ b/mysys_ssl/my_md5.cc +@@ -66,3 +66,34 @@ void compute_md5_hash(char *digest, const char *buf, int len) + my_md5_hash((unsigned char*)digest, (unsigned const char*)buf, len); + #endif /* HAVE_YASSL */ + } ++#ifdef WITH_WSREP ++void *wsrep_md5_init() ++{ ++#if defined(HAVE_YASSL) ++ TaoCrypt::MD5 *hasher= new TaoCrypt::MD5; ++ return (void*)hasher; ++#elif defined(HAVE_OPENSSL) ++ MD5_CTX *ctx = new MD5_CTX(); ++ MD5_Init (ctx); ++ return (void *)ctx; ++#endif /* HAVE_YASSL */ ++} ++void wsrep_md5_update(void *ctx, char* buf, int len) ++{ ++#if defined(HAVE_YASSL) ++ ((TaoCrypt::MD5 *)ctx)->Update((TaoCrypt::byte *) buf, len); ++#elif defined(HAVE_OPENSSL) ++ MD5_Update((MD5_CTX*)(ctx), buf, len); ++#endif /* HAVE_YASSL */ ++} ++void wsrep_compute_md5_hash(char *digest, void *ctx) ++{ ++#if defined(HAVE_YASSL) ++ ((TaoCrypt::MD5*)ctx)->Final((TaoCrypt::byte *) digest); ++ delete (TaoCrypt::MD5*)ctx; ++#elif defined(HAVE_OPENSSL) ++ MD5_Final ((unsigned char*)digest, (MD5_CTX*)ctx); ++ delete (MD5_CTX*)ctx; ++#endif /* HAVE_YASSL */ ++} ++#endif +diff --git a/plugin/innodb_memcached/daemon_memcached/CMakeLists.txt b/plugin/innodb_memcached/daemon_memcached/CMakeLists.txt +index 11a1276..e53980b 100644 +--- a/plugin/innodb_memcached/daemon_memcached/CMakeLists.txt ++++ b/plugin/innodb_memcached/daemon_memcached/CMakeLists.txt +@@ -78,7 +78,7 @@ SET(MEMCACHED_SOURCES + MYSQL_ADD_PLUGIN(libmemcached ${MEMCACHED_SOURCES} + MODULE_ONLY MODULE_OUTPUT_NAME "libmemcached") + +-TARGET_LINK_LIBRARIES(libmemcached ${LIBEVENT_LIBRARY}) ++TARGET_LINK_LIBRARIES(libmemcached ${LIBEVENT_LIBRARY} ${LIBEVENT_LIBRARIES}) + TARGET_LINK_LIBRARIES(libmemcached memcached_utilities) + + IF(ENABLE_MEMCACHED_SASL) +diff --git a/plugin/innodb_memcached/innodb_memcache/src/innodb_api.c b/plugin/innodb_memcached/innodb_memcache/src/innodb_api.c +index 14e2fa7..e062343 100644 +--- a/plugin/innodb_memcached/innodb_memcache/src/innodb_api.c ++++ b/plugin/innodb_memcached/innodb_memcache/src/innodb_api.c +@@ -666,7 +666,6 @@ innodb_api_copy_mci( + + } else { + mci_item->value_str = malloc(data_len); +- + if (!mci_item->value_str) { + return(false); + } +diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt +index c043f07..a69d938 100644 +--- a/scripts/CMakeLists.txt ++++ b/scripts/CMakeLists.txt +@@ -320,6 +320,15 @@ IF(WIN32) + INSTALL_SCRIPT(${CMAKE_CURRENT_BINARY_DIR}/${file}.pl COMPONENT Server_Scripts) + ENDFOREACH() + ELSE() ++ IF(WITH_WSREP) ++ SET(WSREP_BINARIES ++ wsrep_sst_common ++ wsrep_sst_mysqldump ++ wsrep_sst_rsync ++ wsrep_sst_xtrabackup ++ wsrep_sst_xtrabackup-v2 ++ ) ++ ENDIF() + # Configure this one, for testing, but do not install it. + CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/mysql_config.pl.in + ${CMAKE_CURRENT_BINARY_DIR}/mysql_config.pl ESCAPE_QUOTES @ONLY) +@@ -339,6 +348,7 @@ ELSE() + mysqldumpslow + mysqld_multi + mysqld_safe ++ ${WSREP_BINARIES} + ) + FOREACH(file ${BIN_SCRIPTS}) + IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${file}.sh) +diff --git a/scripts/mysqld_safe.sh b/scripts/mysqld_safe.sh +index 3b588ef..4520503 100644 +--- a/scripts/mysqld_safe.sh ++++ b/scripts/mysqld_safe.sh +@@ -141,7 +141,7 @@ log_notice () { + } + + eval_log_error () { +- cmd="$1" ++ local cmd="$1" + case $logging in + file) cmd="$cmd >> "`shell_quote_string "$err_log"`" 2>&1" ;; + syslog) +@@ -169,6 +169,78 @@ shell_quote_string() { + echo "$1" | sed -e 's,\([^a-zA-Z0-9/_.=-]\),\\\1,g' + } + ++wsrep_pick_url() { ++ [ $# -eq 0 ] && return 0 ++ ++ log_error "WSREP: 'wsrep_urls' is DEPRECATED! Use wsrep_cluster_address to specify multiple addresses instead." ++ ++ if ! which nc >/dev/null; then ++ log_error "ERROR: nc tool not found in PATH! Make sure you have it installed." ++ return 1 ++ fi ++ ++ local url ++ # Assuming URL in the form scheme://host:port ++ # If host and port are not NULL, the liveness of URL is assumed to be tested ++ # If port part is absent, the url is returned literally and unconditionally ++ # If every URL has port but none is reachable, nothing is returned ++ for url in `echo $@ | sed s/,/\ /g` 0; do ++ local host=`echo $url | cut -d \: -f 2 | sed s/^\\\/\\\///` ++ local port=`echo $url | cut -d \: -f 3` ++ [ -z "$port" ] && break ++ nc -z "$host" $port >/dev/null && break ++ done ++ ++ if [ "$url" == "0" ]; then ++ log_error "ERROR: none of the URLs in '$@' is reachable." ++ return 1 ++ fi ++ ++ echo $url ++} ++ ++# Run mysqld with --wsrep-recover and parse recovered position from log. ++# Position will be stored in wsrep_start_position_opt global. ++wsrep_start_position_opt="" ++wsrep_recover_position() { ++ local mysqld_cmd="$@" ++ local euid=$(id -u) ++ local ret=0 ++ ++ local wr_logfile=$(mktemp $DATADIR/wsrep_recovery.XXXXXX) ++ ++ [ "$euid" = "0" ] && chown $user $wr_logfile ++ chmod 600 $wr_logfile ++ ++ local wr_pidfile="$DATADIR/"`@HOSTNAME@`"-recover.pid" ++ ++ local wr_options="--log_error='$wr_logfile' --pid-file='$wr_pidfile'" ++ ++ log_notice "WSREP: Running position recovery with $wr_options" ++ ++ eval_log_error "$mysqld_cmd --wsrep_recover $wr_options" ++ ++ local rp="$(grep 'WSREP: Recovered position:' $wr_logfile)" ++ if [ -z "$rp" ]; then ++ local skipped="$(grep WSREP $wr_logfile | grep 'skipping position recovery')" ++ if [ -z "$skipped" ]; then ++ log_error "WSREP: Failed to recover position: " `cat $wr_logfile`; ++ ret=1 ++ else ++ log_notice "WSREP: Position recovery skipped" ++ fi ++ else ++ local start_pos="$(echo $rp | sed 's/.*WSREP\:\ Recovered\ position://' \ ++ | sed 's/^[ \t]*//')" ++ log_notice "WSREP: Recovered position $start_pos" ++ wsrep_start_position_opt="--wsrep_start_position=$start_pos" ++ fi ++ ++ rm $wr_logfile ++ ++ return $ret ++} ++ + parse_arguments() { + # We only need to pass arguments through to the server if we don't + # handle them here. So, we collect unrecognized options (passed on +@@ -224,7 +296,13 @@ parse_arguments() { + --skip-syslog) want_syslog=0 ;; + --syslog-tag=*) syslog_tag="$val" ;; + --timezone=*) TZ="$val"; export TZ; ;; +- ++ --wsrep[-_]urls=*) wsrep_urls="$val"; ;; ++ --wsrep[-_]provider=*) ++ if test -n "$val" && test "$val" != "none" ++ then ++ wsrep_restart=1 ++ fi ++ ;; + --help) usage ;; + + *) +@@ -770,7 +848,8 @@ do + done + cmd="$cmd $args" + # Avoid 'nohup: ignoring input' warning +-test -n "$NOHUP_NICENESS" && cmd="$cmd < /dev/null" ++nohup_redir="" ++test -n "$NOHUP_NICENESS" && nohup_redir=" < /dev/null" + + log_notice "Starting $MYSQLD daemon with databases from $DATADIR" + +@@ -781,13 +860,28 @@ max_fast_restarts=5 + # flag whether a usable sleep command exists + have_sleep=1 + ++# maximum number of wsrep restarts ++max_wsrep_restarts=0 ++ + while true + do + rm -f $safe_mysql_unix_port "$pid_file" # Some extra safety + + start_time=`date +%M%S` + +- eval_log_error "$cmd" ++ # this sets wsrep_start_position_opt ++ wsrep_recover_position "$cmd" ++ ++ [ $? -ne 0 ] && exit 1 # ++ ++ [ -n "$wsrep_urls" ] && url=`wsrep_pick_url $wsrep_urls` # check connect address ++ ++ if [ -z "$url" ] ++ then ++ eval_log_error "$cmd $wsrep_start_position_opt $nohup_redir" ++ else ++ eval_log_error "$cmd $wsrep_start_position_opt --wsrep_cluster_address=$url $nohup_redir" ++ fi + + if [ $want_syslog -eq 0 -a ! -f "$err_log" ]; then + touch "$err_log" # hypothetical: log was renamed but not +@@ -857,6 +951,20 @@ do + I=`expr $I + 1` + done + fi ++ ++ if [ -n "$wsrep_restart" ] ++ then ++ if [ $wsrep_restart -le $max_wsrep_restarts ] ++ then ++ wsrep_restart=`expr $wsrep_restart + 1` ++ log_notice "WSREP: sleeping 15 seconds before restart" ++ sleep 15 ++ else ++ log_notice "WSREP: not restarting wsrep node automatically" ++ break ++ fi ++ fi ++ + log_notice "mysqld restarted" + done + +diff --git a/scripts/wsrep_sst_common.sh b/scripts/wsrep_sst_common.sh +new file mode 100644 +index 0000000..46f4076 +--- /dev/null ++++ b/scripts/wsrep_sst_common.sh +@@ -0,0 +1,187 @@ ++# Copyright (C) 2012-2014 Codership Oy ++# ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; version 2 of the License. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program; see the file COPYING. If not, write to the ++# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston ++# MA 02110-1301 USA. ++ ++# This is a common command line parser to be sourced by other SST scripts ++ ++set -u ++ ++WSREP_SST_OPT_BYPASS=0 ++WSREP_SST_OPT_BINLOG="" ++WSREP_SST_OPT_DATA="" ++WSREP_SST_OPT_AUTH="" ++ ++while [ $# -gt 0 ]; do ++case "$1" in ++ '--address') ++ readonly WSREP_SST_OPT_ADDR="$2" ++ shift ++ ;; ++ '--auth') ++ WSREP_SST_OPT_AUTH="$2" ++ shift ++ ;; ++ '--bypass') ++ WSREP_SST_OPT_BYPASS=1 ++ ;; ++ '--datadir') ++ readonly WSREP_SST_OPT_DATA="$2" ++ shift ++ ;; ++ '--defaults-file') ++ readonly WSREP_SST_OPT_CONF="$2" ++ shift ++ ;; ++ '--defaults-group-suffix') ++ readonly WSREP_SST_OPT_CONF_SUFFIX="$2" ++ shift ++ ;; ++ '--host') ++ readonly WSREP_SST_OPT_HOST="$2" ++ shift ++ ;; ++ '--local-port') ++ readonly WSREP_SST_OPT_LPORT="$2" ++ shift ++ ;; ++ '--parent') ++ readonly WSREP_SST_OPT_PARENT="$2" ++ shift ++ ;; ++ '--password') ++ WSREP_SST_OPT_PSWD="$2" ++ shift ++ ;; ++ '--port') ++ readonly WSREP_SST_OPT_PORT="$2" ++ shift ++ ;; ++ '--role') ++ readonly WSREP_SST_OPT_ROLE="$2" ++ shift ++ ;; ++ '--socket') ++ readonly WSREP_SST_OPT_SOCKET="$2" ++ shift ++ ;; ++ '--user') ++ WSREP_SST_OPT_USER="$2" ++ shift ++ ;; ++ '--gtid') ++ readonly WSREP_SST_OPT_GTID="$2" ++ shift ++ ;; ++ '--binlog') ++ WSREP_SST_OPT_BINLOG="$2" ++ shift ++ ;; ++ *) # must be command ++ # usage ++ # exit 1 ++ ;; ++esac ++shift ++done ++readonly WSREP_SST_OPT_BYPASS ++readonly WSREP_SST_OPT_BINLOG ++ ++# try to use my_print_defaults, mysql and mysqldump that come with the sources ++# (for MTR suite) ++SCRIPTS_DIR="$(cd $(dirname "$0"); pwd -P)" ++EXTRA_DIR="$SCRIPTS_DIR/../extra" ++CLIENT_DIR="$SCRIPTS_DIR/../client" ++ ++if [ -x "$CLIENT_DIR/mysql" ]; then ++ MYSQL_CLIENT="$CLIENT_DIR/mysql" ++else ++ MYSQL_CLIENT=$(which mysql) ++fi ++ ++if [ -x "$CLIENT_DIR/mysqldump" ]; then ++ MYSQLDUMP="$CLIENT_DIR/mysqldump" ++else ++ MYSQLDUMP=$(which mysqldump) ++fi ++ ++if [ -x "$SCRIPTS_DIR/my_print_defaults" ]; then ++ MY_PRINT_DEFAULTS="$SCRIPTS_DIR/my_print_defaults" ++elif [ -x "$EXTRA_DIR/my_print_defaults" ]; then ++ MY_PRINT_DEFAULTS="$EXTRA_DIR/my_print_defaults" ++else ++ MY_PRINT_DEFAULTS=$(which my_print_defaults) ++fi ++ ++# For Bug:1200727 ++if $MY_PRINT_DEFAULTS -c $WSREP_SST_OPT_CONF sst | grep -q "wsrep_sst_auth";then ++ if [ -z "$WSREP_SST_OPT_AUTH" -o "$WSREP_SST_OPT_AUTH" = "(null)" ];then ++ WSREP_SST_OPT_AUTH=$(my_print_defaults -c $WSREP_SST_OPT_CONF sst | grep -- "--wsrep_sst_auth" | cut -d= -f2) ++ fi ++fi ++ ++if [ -n "${WSREP_SST_OPT_DATA:-}" ] ++then ++ SST_PROGRESS_FILE="$WSREP_SST_OPT_DATA/sst_in_progress" ++else ++ SST_PROGRESS_FILE="" ++fi ++ ++ ++wsrep_log() ++{ ++ # echo everything to stderr so that it gets into common error log ++ # deliberately made to look different from the rest of the log ++ local readonly tst="$(date +%Y%m%d\ %H:%M:%S.%N | cut -b -21)" ++ echo "WSREP_SST: $* ($tst)" >&2 ++} ++ ++wsrep_log_error() ++{ ++ wsrep_log "[ERROR] $*" ++} ++ ++wsrep_log_info() ++{ ++ wsrep_log "[INFO] $*" ++} ++ ++wsrep_cleanup_progress_file() ++{ ++ [ -n "$SST_PROGRESS_FILE" ] && rm -f "$SST_PROGRESS_FILE" 2>/dev/null ++} ++ ++wsrep_check_program() ++{ ++ local prog=$1 ++ ++ if ! which $prog >/dev/null ++ then ++ echo "'$prog' not found in PATH" ++ return 2 # no such file or directory ++ fi ++} ++ ++wsrep_check_programs() ++{ ++ local ret=0 ++ ++ while [ $# -gt 0 ] ++ do ++ wsrep_check_program $1 || ret=$? ++ shift ++ done ++ ++ return $ret ++} +diff --git a/scripts/wsrep_sst_mysqldump.sh b/scripts/wsrep_sst_mysqldump.sh +new file mode 100644 +index 0000000..89eb755 +--- /dev/null ++++ b/scripts/wsrep_sst_mysqldump.sh +@@ -0,0 +1,136 @@ ++#!/bin/bash -e ++# Copyright (C) 2009 Codership Oy ++# ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; version 2 of the License. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program; see the file COPYING. If not, write to the ++# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston ++# MA 02110-1301 USA. ++ ++# This is a reference script for mysqldump-based state snapshot tansfer ++ ++. $(dirname $0)/wsrep_sst_common ++ ++EINVAL=22 ++ ++local_ip() ++{ ++ PATH=$PATH:/usr/sbin:/usr/bin:/sbin:/bin ++ ++ [ "$1" = "127.0.0.1" ] && return 0 ++ [ "$1" = "localhost" ] && return 0 ++ [ "$1" = "$(hostname -s)" ] && return 0 ++ [ "$1" = "$(hostname -f)" ] && return 0 ++ [ "$1" = "$(hostname -d)" ] && return 0 ++ ++ # Now if ip program is not found in the path, we can't return 0 since ++ # it would block any address. Thankfully grep should fail in this case ++ ip route get "$1" | grep local >/dev/null && return 0 ++ ++ return 1 ++} ++ ++if test -z "$WSREP_SST_OPT_USER"; then wsrep_log_error "USER cannot be nil"; exit $EINVAL; fi ++if test -z "$WSREP_SST_OPT_HOST"; then wsrep_log_error "HOST cannot be nil"; exit $EINVAL; fi ++if test -z "$WSREP_SST_OPT_PORT"; then wsrep_log_error "PORT cannot be nil"; exit $EINVAL; fi ++if test -z "$WSREP_SST_OPT_LPORT"; then wsrep_log_error "LPORT cannot be nil"; exit $EINVAL; fi ++if test -z "$WSREP_SST_OPT_SOCKET";then wsrep_log_error "SOCKET cannot be nil";exit $EINVAL; fi ++if test -z "$WSREP_SST_OPT_GTID"; then wsrep_log_error "GTID cannot be nil"; exit $EINVAL; fi ++ ++if local_ip $WSREP_SST_OPT_HOST && \ ++ [ "$WSREP_SST_OPT_PORT" = "$WSREP_SST_OPT_LPORT" ] ++then ++ wsrep_log_error \ ++ "destination address '$WSREP_SST_OPT_HOST:$WSREP_SST_OPT_PORT' matches source address." ++ exit $EINVAL ++fi ++ ++# Check client version ++CLIENT_MINOR=$(mysql --version | cut -d ' ' -f 6 | cut -d '.' -f 2) ++if [ $CLIENT_MINOR -lt "6" ] ++then ++ $MYSQL_CLIENT --version >&2 ++ wsrep_log_error "this operation requires MySQL client version 5.6.x" ++ exit $EINVAL ++fi ++ ++# For Bug:1293798 ++if [ -z "$WSREP_SST_OPT_PSWD" -a -n "$WSREP_SST_OPT_AUTH" ]; then ++ WSREP_SST_OPT_USER=$(echo $WSREP_SST_OPT_AUTH | cut -d: -f1) ++ WSREP_SST_OPT_PSWD=$(echo $WSREP_SST_OPT_AUTH | cut -d: -f2) ++fi ++AUTH="-u$WSREP_SST_OPT_USER" ++if test -n "$WSREP_SST_OPT_PSWD"; then AUTH="$AUTH -p$WSREP_SST_OPT_PSWD"; fi ++ ++STOP_WSREP="SET wsrep_on=OFF;" ++ ++# NOTE: we don't use --routines here because we're dumping mysql.proc table ++MYSQLDUMP="$MYSQLDUMP $AUTH -S$WSREP_SST_OPT_SOCKET \ ++--add-drop-database --add-drop-table --skip-add-locks --create-options \ ++--disable-keys --extended-insert --skip-lock-tables --quick --set-charset \ ++--skip-comments --flush-privileges --all-databases --events" ++ ++# mysqldump cannot restore CSV tables, fix this issue ++CSV_TABLES_FIX=" ++set sql_mode=''; ++ ++USE mysql; ++ ++SET @str = IF (@@have_csv = 'YES', 'CREATE TABLE IF NOT EXISTS general_log (event_time TIMESTAMP NOT NULL, user_host MEDIUMTEXT NOT NULL, thread_id INTEGER NOT NULL, server_id INTEGER UNSIGNED NOT NULL, command_type VARCHAR(64) NOT NULL,argument MEDIUMTEXT NOT NULL) engine=CSV CHARACTER SET utf8 comment=\"General log\"', 'SET @dummy = 0'); ++ ++PREPARE stmt FROM @str; ++EXECUTE stmt; ++DROP PREPARE stmt; ++ ++SET @str = IF (@@have_csv = 'YES', 'CREATE TABLE IF NOT EXISTS slow_log (start_time TIMESTAMP NOT NULL, user_host MEDIUMTEXT NOT NULL, query_time TIME NOT NULL, lock_time TIME NOT NULL, rows_sent INTEGER NOT NULL, rows_examined INTEGER NOT NULL, db VARCHAR(512) NOT NULL, last_insert_id INTEGER NOT NULL, insert_id INTEGER NOT NULL, server_id INTEGER UNSIGNED NOT NULL, sql_text MEDIUMTEXT NOT NULL) engine=CSV CHARACTER SET utf8 comment=\"Slow log\"', 'SET @dummy = 0'); ++ ++PREPARE stmt FROM @str; ++EXECUTE stmt; ++DROP PREPARE stmt;" ++ ++SET_START_POSITION="SET GLOBAL wsrep_start_position='$WSREP_SST_OPT_GTID';" ++ ++MYSQL="$MYSQL_CLIENT $AUTH -h$WSREP_SST_OPT_HOST -P$WSREP_SST_OPT_PORT "\ ++"--disable-reconnect --connect_timeout=10" ++ ++# need to disable logging when loading the dump ++# reason is that dump contains ALTER TABLE for log tables, and ++# this causes an error if logging is enabled ++GENERAL_LOG_OPT=`$MYSQL --skip-column-names -e"$STOP_WSREP SELECT @@GENERAL_LOG"` ++SLOW_LOG_OPT=`$MYSQL --skip-column-names -e"$STOP_WSREP SELECT @@SLOW_QUERY_LOG"` ++$MYSQL -e"$STOP_WSREP SET GLOBAL GENERAL_LOG=OFF" ++$MYSQL -e"$STOP_WSREP SET GLOBAL SLOW_QUERY_LOG=OFF" ++ ++# commands to restore log settings ++RESTORE_GENERAL_LOG="SET GLOBAL GENERAL_LOG=$GENERAL_LOG_OPT;" ++RESTORE_SLOW_QUERY_LOG="SET GLOBAL SLOW_QUERY_LOG=$SLOW_LOG_OPT;" ++ ++# reset master for 5.6 to clear GTID_EXECUTED ++RESET_MASTER="RESET MASTER;" ++ ++ ++if [ $WSREP_SST_OPT_BYPASS -eq 0 ] ++then ++ # commented out from dump command for 5.6: && echo $CSV_TABLES_FIX \ ++ # error is ignored because joiner binlog might be disabled. ++ # and if joiner binlog is disabled, 'RESET MASTER' returns error ++ # ERROR 1186 (HY000) at line 2: Binlog closed, cannot RESET MASTER ++ (echo $STOP_WSREP && echo $RESET_MASTER) | $MYSQL || true ++ (echo $STOP_WSREP && $MYSQLDUMP \ ++ && echo $RESTORE_GENERAL_LOG && echo $RESTORE_SLOW_QUERY_LOG \ ++ && echo $SET_START_POSITION \ ++ || echo "SST failed to complete;") | $MYSQL ++else ++ wsrep_log_info "Bypassing state dump." ++ echo $SET_START_POSITION | $MYSQL ++fi ++ ++# +diff --git a/scripts/wsrep_sst_rsync.sh b/scripts/wsrep_sst_rsync.sh +new file mode 100644 +index 0000000..8998f73 +--- /dev/null ++++ b/scripts/wsrep_sst_rsync.sh +@@ -0,0 +1,329 @@ ++#!/bin/bash -ue ++ ++# Copyright (C) 2010-2014 Codership Oy ++# ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; version 2 of the License. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program; see the file COPYING. If not, write to the ++# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston ++# MA 02110-1301 USA. ++ ++# This is a reference script for rsync-based state snapshot tansfer ++ ++RSYNC_PID= ++RSYNC_CONF= ++OS=$(uname) ++[ "$OS" == "Darwin" ] && export -n LD_LIBRARY_PATH ++ ++# Setting the path for lsof on CentOS ++export PATH="/usr/sbin:/sbin:$PATH" ++ ++. $(dirname $0)/wsrep_sst_common ++ ++wsrep_check_programs rsync ++ ++cleanup_joiner() ++{ ++ wsrep_log_info "Joiner cleanup." ++ local PID=$(cat "$RSYNC_PID" 2>/dev/null || echo 0) ++ [ "0" != "$PID" ] && kill $PID && sleep 0.5 && kill -9 $PID >/dev/null 2>&1 \ ++ || : ++ rm -rf "$RSYNC_CONF" ++ rm -rf "$MAGIC_FILE" ++ rm -rf "$RSYNC_PID" ++ wsrep_log_info "Joiner cleanup done." ++ if [ "${WSREP_SST_OPT_ROLE}" = "joiner" ];then ++ wsrep_cleanup_progress_file ++ fi ++} ++ ++check_pid() ++{ ++ local pid_file=$1 ++ [ -r "$pid_file" ] && ps -p $(cat $pid_file) >/dev/null 2>&1 ++} ++ ++check_pid_and_port() ++{ ++ local pid_file=$1 ++ local rsync_pid=$2 ++ local rsync_port=$3 ++ ++ local port_info=$(lsof -i :$rsync_port -Pn 2>/dev/null | \ ++ grep "(LISTEN)") ++ local is_rsync=$(echo $port_info | \ ++ grep -w '^rsync[[:space:]]\+'"$rsync_pid" 2>/dev/null) ++ ++ if [ -n "$port_info" -a -z "$is_rsync" ]; then ++ wsrep_log_error "rsync daemon port '$rsync_port' has been taken" ++ exit 16 # EBUSY ++ fi ++ check_pid $pid_file && \ ++ [ -n "$port_info" ] && [ -n "$is_rsync" ] && \ ++ [ $(cat $pid_file) -eq $rsync_pid ] ++} ++ ++MAGIC_FILE="$WSREP_SST_OPT_DATA/rsync_sst_complete" ++rm -rf "$MAGIC_FILE" ++ ++BINLOG_TAR_FILE="$WSREP_SST_OPT_DATA/wsrep_sst_binlog.tar" ++BINLOG_N_FILES=1 ++rm -f "$BINLOG_TAR_FILE" || : ++ ++if ! [ -z $WSREP_SST_OPT_BINLOG ] ++then ++ BINLOG_DIRNAME=$(dirname $WSREP_SST_OPT_BINLOG) ++ BINLOG_FILENAME=$(basename $WSREP_SST_OPT_BINLOG) ++fi ++ ++WSREP_LOG_DIR=${WSREP_LOG_DIR:-""} ++# if WSREP_LOG_DIR env. variable is not set, try to get it from my.cnf ++if [ -z "$WSREP_LOG_DIR" ]; then ++ WSREP_LOG_DIR=$($MY_PRINT_DEFAULTS --defaults-file \ ++ "$WSREP_SST_OPT_CONF" mysqld server mysqld-5.6 \ ++ | grep -- '--innodb[-_]log[-_]group[-_]home[-_]dir=' \ ++ | cut -b 29- ) ++fi ++ ++if [ -n "$WSREP_LOG_DIR" ]; then ++ # handle both relative and absolute paths ++ WSREP_LOG_DIR=$(cd $WSREP_SST_OPT_DATA; mkdir -p "$WSREP_LOG_DIR"; cd $WSREP_LOG_DIR; pwd -P) ++else ++ # default to datadir ++ WSREP_LOG_DIR=$(cd $WSREP_SST_OPT_DATA; pwd -P) ++fi ++ ++# Old filter - include everything except selected ++# FILTER=(--exclude '*.err' --exclude '*.pid' --exclude '*.sock' \ ++# --exclude '*.conf' --exclude core --exclude 'galera.*' \ ++# --exclude grastate.txt --exclude '*.pem' \ ++# --exclude '*.[0-9][0-9][0-9][0-9][0-9][0-9]' --exclude '*.index') ++ ++# New filter - exclude everything except dirs (schemas) and innodb files ++FILTER=(-f '- /lost+found' -f '- /.fseventsd' -f '- /.Trashes' ++ -f '+ /wsrep_sst_binlog.tar' -f '+ /ib_lru_dump' -f '+ /ibdata*' -f '+ /*/' -f '- /*') ++ ++if [ "$WSREP_SST_OPT_ROLE" = "donor" ] ++then ++ ++ if [ $WSREP_SST_OPT_BYPASS -eq 0 ] ++ then ++ ++ FLUSHED="$WSREP_SST_OPT_DATA/tables_flushed" ++ rm -rf "$FLUSHED" ++ ++ # Use deltaxfer only for WAN ++ inv=$(basename $0) ++ [ "$inv" = "wsrep_sst_rsync_wan" ] && WHOLE_FILE_OPT="" \ ++ || WHOLE_FILE_OPT="--whole-file" ++ ++ echo "flush tables" ++ ++ # wait for tables flushed and state ID written to the file ++ while [ ! -r "$FLUSHED" ] && ! grep -q ':' "$FLUSHED" >/dev/null 2>&1 ++ do ++ sleep 0.2 ++ done ++ ++ STATE="$(cat $FLUSHED)" ++ rm -rf "$FLUSHED" ++ ++ sync ++ ++ if ! [ -z $WSREP_SST_OPT_BINLOG ] ++ then ++ # Prepare binlog files ++ pushd $BINLOG_DIRNAME &> /dev/null ++ binlog_files_full=$(tail -n $BINLOG_N_FILES ${BINLOG_FILENAME}.index) ++ binlog_files="" ++ for ii in $binlog_files_full ++ do ++ binlog_files="$binlog_files $(basename $ii)" ++ done ++ if ! [ -z "$binlog_files" ] ++ then ++ wsrep_log_info "Preparing binlog files for transfer:" ++ tar -cvf $BINLOG_TAR_FILE $binlog_files >&2 ++ fi ++ popd &> /dev/null ++ fi ++ ++ # first, the normal directories, so that we can detect incompatible protocol ++ RC=0 ++ rsync --owner --group --perms --links --specials \ ++ --ignore-times --inplace --dirs --delete --quiet \ ++ $WHOLE_FILE_OPT "${FILTER[@]}" "$WSREP_SST_OPT_DATA/" \ ++ rsync://$WSREP_SST_OPT_ADDR >&2 || RC=$? ++ ++ if [ "$RC" -ne 0 ]; then ++ wsrep_log_error "rsync returned code $RC:" ++ ++ case $RC in ++ 12) RC=71 # EPROTO ++ wsrep_log_error \ ++ "rsync server on the other end has incompatible protocol. " \ ++ "Make sure you have the same version of rsync on all nodes." ++ ;; ++ 22) RC=12 # ENOMEM ++ ;; ++ *) RC=255 # unknown error ++ ;; ++ esac ++ exit $RC ++ fi ++ ++ # second, we transfer InnoDB log files ++ rsync --owner --group --perms --links --specials \ ++ --ignore-times --inplace --dirs --delete --quiet \ ++ $WHOLE_FILE_OPT -f '+ /ib_logfile[0-9]*' -f '- **' "$WSREP_LOG_DIR/" \ ++ rsync://$WSREP_SST_OPT_ADDR-log_dir >&2 || RC=$? ++ ++ if [ $RC -ne 0 ]; then ++ wsrep_log_error "rsync innodb_log_group_home_dir returned code $RC:" ++ exit 255 # unknown error ++ fi ++ ++ # then, we parallelize the transfer of database directories, use . so that pathconcatenation works ++ pushd "$WSREP_SST_OPT_DATA" >/dev/null ++ ++ count=1 ++ [ "$OS" == "Linux" ] && count=$(grep -c processor /proc/cpuinfo) ++ [ "$OS" == "Darwin" -o "$OS" == "FreeBSD" ] && count=$(sysctl -n hw.ncpu) ++ ++ find . -maxdepth 1 -mindepth 1 -type d -print0 | xargs -I{} -0 -P $count \ ++ rsync --owner --group --perms --links --specials \ ++ --ignore-times --inplace --recursive --delete --quiet \ ++ $WHOLE_FILE_OPT --exclude '*/ib_logfile*' "$WSREP_SST_OPT_DATA"/{}/ \ ++ rsync://$WSREP_SST_OPT_ADDR/{} >&2 || RC=$? ++ ++ popd >/dev/null ++ ++ if [ $RC -ne 0 ]; then ++ wsrep_log_error "find/rsync returned code $RC:" ++ exit 255 # unknown error ++ fi ++ ++ else # BYPASS ++ wsrep_log_info "Bypassing state dump." ++ STATE="$WSREP_SST_OPT_GTID" ++ fi ++ ++ echo "continue" # now server can resume updating data ++ ++ echo "$STATE" > "$MAGIC_FILE" ++ rsync --archive --quiet --checksum "$MAGIC_FILE" rsync://$WSREP_SST_OPT_ADDR ++ ++ echo "done $STATE" ++ ++elif [ "$WSREP_SST_OPT_ROLE" = "joiner" ] ++then ++ wsrep_check_programs lsof ++ ++ touch $SST_PROGRESS_FILE ++ MYSQLD_PID=$WSREP_SST_OPT_PARENT ++ ++ MODULE="rsync_sst" ++ ++ RSYNC_PID="$WSREP_SST_OPT_DATA/$MODULE.pid" ++ ++ if check_pid $RSYNC_PID ++ then ++ wsrep_log_error "rsync daemon already running." ++ exit 114 # EALREADY ++ fi ++ rm -rf "$RSYNC_PID" ++ ++ ADDR=$WSREP_SST_OPT_ADDR ++ RSYNC_PORT=$(echo $ADDR | awk -F ':' '{ print $2 }') ++ if [ -z "$RSYNC_PORT" ] ++ then ++ RSYNC_PORT=4444 ++ ADDR="$(echo $ADDR | awk -F ':' '{ print $1 }'):$RSYNC_PORT" ++ fi ++ ++ trap "exit 32" HUP PIPE ++ trap "exit 3" INT TERM ABRT ++ trap cleanup_joiner EXIT ++ ++ RSYNC_CONF="$WSREP_SST_OPT_DATA/$MODULE.conf" ++ ++cat << EOF > "$RSYNC_CONF" ++pid file = $RSYNC_PID ++use chroot = no ++read only = no ++timeout = 300 ++[$MODULE] ++ path = $WSREP_SST_OPT_DATA ++[$MODULE-log_dir] ++ path = $WSREP_LOG_DIR ++EOF ++ ++# rm -rf "$DATA"/ib_logfile* # we don't want old logs around ++ ++ # listen at all interfaces (for firewalled setups) ++ rsync --daemon --no-detach --port $RSYNC_PORT --config "$RSYNC_CONF" & ++ RSYNC_REAL_PID=$! ++ ++ until check_pid_and_port $RSYNC_PID $RSYNC_REAL_PID $RSYNC_PORT ++ do ++ sleep 0.2 ++ done ++ ++ echo "ready $ADDR/$MODULE" ++ ++ # wait for SST to complete by monitoring magic file ++ while [ ! -r "$MAGIC_FILE" ] && check_pid "$RSYNC_PID" && \ ++ ps -p $MYSQLD_PID >/dev/null ++ do ++ sleep 1 ++ done ++ ++ if ! ps -p $MYSQLD_PID >/dev/null ++ then ++ wsrep_log_error \ ++ "Parent mysqld process (PID:$MYSQLD_PID) terminated unexpectedly." ++ exit 32 ++ fi ++ ++ if ! [ -z $WSREP_SST_OPT_BINLOG ] ++ then ++ ++ pushd $BINLOG_DIRNAME &> /dev/null ++ if [ -f $BINLOG_TAR_FILE ] ++ then ++ # Clean up old binlog files first ++ rm -f ${BINLOG_FILENAME}.* ++ wsrep_log_info "Extracting binlog files:" ++ tar -xvf $BINLOG_TAR_FILE >&2 ++ for ii in $(ls -1 ${BINLOG_FILENAME}.*) ++ do ++ echo ${BINLOG_DIRNAME}/${ii} >> ${BINLOG_FILENAME}.index ++ done ++ fi ++ popd &> /dev/null ++ fi ++ if [ -r "$MAGIC_FILE" ] ++ then ++ cat "$MAGIC_FILE" # output UUID:seqno ++ else ++ # this message should cause joiner to abort ++ echo "rsync process ended without creating '$MAGIC_FILE'" ++ fi ++ wsrep_cleanup_progress_file ++# cleanup_joiner ++else ++ wsrep_log_error "Unrecognized role: '$WSREP_SST_OPT_ROLE'" ++ exit 22 # EINVAL ++fi ++ ++rm -f $BINLOG_TAR_FILE || : ++ ++exit 0 +diff --git a/scripts/wsrep_sst_xtrabackup-v2.sh b/scripts/wsrep_sst_xtrabackup-v2.sh +new file mode 100644 +index 0000000..1d1267d +--- /dev/null ++++ b/scripts/wsrep_sst_xtrabackup-v2.sh +@@ -0,0 +1,930 @@ ++#!/bin/bash -ue ++# Copyright (C) 2013 Percona Inc ++# ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; version 2 of the License. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program; see the file COPYING. If not, write to the ++# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston ++# MA 02110-1301 USA. ++ ++# Documentation: http://www.percona.com/doc/percona-xtradb-cluster/manual/xtrabackup_sst.html ++# Make sure to read that before proceeding! ++ ++ ++ ++ ++. $(dirname $0)/wsrep_sst_common ++ ++ealgo="" ++ekey="" ++ekeyfile="" ++encrypt=0 ++nproc=1 ++ecode=0 ++XTRABACKUP_PID="" ++SST_PORT="" ++REMOTEIP="" ++tcert="" ++tpem="" ++tkey="" ++sockopt="" ++progress="" ++ttime=0 ++totime=0 ++lsn="" ++incremental=0 ++ecmd="" ++rlimit="" ++# Initially ++stagemsg="${WSREP_SST_OPT_ROLE}" ++cpat="" ++speciald=0 ++ib_home_dir="" ++ib_log_dir="" ++ ++sfmt="tar" ++strmcmd="" ++tfmt="" ++tcmd="" ++rebuild=0 ++rebuildcmd="" ++payload=0 ++pvformat="-F '%N => Rate:%r Avg:%a Elapsed:%t %e Bytes: %b %p' " ++pvopts="-f -i 10 -N $WSREP_SST_OPT_ROLE " ++STATDIR="" ++uextra=0 ++disver="" ++ ++tmpopts="" ++itmpdir="" ++xtmpdir="" ++ ++scomp="" ++sdecomp="" ++ ++if which pv &>/dev/null && pv --help | grep -q FORMAT;then ++ pvopts+=$pvformat ++fi ++pcmd="pv $pvopts" ++declare -a RC ++ ++INNOBACKUPEX_BIN=innobackupex ++readonly AUTH=(${WSREP_SST_OPT_AUTH//:/ }) ++DATA="${WSREP_SST_OPT_DATA}" ++INFO_FILE="xtrabackup_galera_info" ++IST_FILE="xtrabackup_ist" ++MAGIC_FILE="${DATA}/${INFO_FILE}" ++ ++# Setting the path for ss and ip ++export PATH="/usr/sbin:/sbin:$PATH" ++ ++timeit(){ ++ local stage=$1 ++ shift ++ local cmd="$@" ++ local x1 x2 took extcode ++ ++ if [[ $ttime -eq 1 ]];then ++ x1=$(date +%s) ++ wsrep_log_info "Evaluating $cmd" ++ eval "$cmd" ++ extcode=$? ++ x2=$(date +%s) ++ took=$(( x2-x1 )) ++ wsrep_log_info "NOTE: $stage took $took seconds" ++ totime=$(( totime+took )) ++ else ++ wsrep_log_info "Evaluating $cmd" ++ eval "$cmd" ++ extcode=$? ++ fi ++ return $extcode ++} ++ ++get_keys() ++{ ++ # $encrypt -eq 1 is for internal purposes only ++ if [[ $encrypt -ge 2 || $encrypt -eq -1 ]];then ++ return ++ fi ++ ++ if [[ $encrypt -eq 0 ]];then ++ if $MY_PRINT_DEFAULTS -c $WSREP_SST_OPT_CONF xtrabackup | grep -q encrypt;then ++ wsrep_log_error "Unexpected option combination. SST may fail. Refer to http://www.percona.com/doc/percona-xtradb-cluster/manual/xtrabackup_sst.html " ++ fi ++ return ++ fi ++ ++ if [[ $sfmt == 'tar' ]];then ++ wsrep_log_info "NOTE: Xtrabackup-based encryption - encrypt=1 - cannot be enabled with tar format" ++ encrypt=-1 ++ return ++ fi ++ ++ wsrep_log_info "Xtrabackup based encryption enabled in my.cnf - Supported only from Xtrabackup 2.1.4" ++ ++ if [[ -z $ealgo ]];then ++ wsrep_log_error "FATAL: Encryption algorithm empty from my.cnf, bailing out" ++ exit 3 ++ fi ++ ++ if [[ -z $ekey && ! -r $ekeyfile ]];then ++ wsrep_log_error "FATAL: Either key or keyfile must be readable" ++ exit 3 ++ fi ++ ++ if [[ -z $ekey ]];then ++ ecmd="xbcrypt --encrypt-algo=$ealgo --encrypt-key-file=$ekeyfile" ++ else ++ ecmd="xbcrypt --encrypt-algo=$ealgo --encrypt-key=$ekey" ++ fi ++ ++ if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]];then ++ ecmd+=" -d" ++ fi ++ ++ stagemsg+="-XB-Encrypted" ++} ++ ++get_transfer() ++{ ++ if [[ -z $SST_PORT ]];then ++ TSST_PORT=4444 ++ else ++ TSST_PORT=$SST_PORT ++ fi ++ ++ if [[ $tfmt == 'nc' ]];then ++ if [[ ! -x `which nc` ]];then ++ wsrep_log_error "nc(netcat) not found in path: $PATH" ++ exit 2 ++ fi ++ wsrep_log_info "Using netcat as streamer" ++ if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]];then ++ tcmd="nc -dl ${TSST_PORT}" ++ else ++ tcmd="nc ${REMOTEIP} ${TSST_PORT}" ++ fi ++ else ++ tfmt='socat' ++ wsrep_log_info "Using socat as streamer" ++ if [[ ! -x `which socat` ]];then ++ wsrep_log_error "socat not found in path: $PATH" ++ exit 2 ++ fi ++ ++ if [[ $encrypt -eq 2 || $encrypt -eq 3 ]] && ! socat -V | grep -q WITH_OPENSSL;then ++ wsrep_log_info "NOTE: socat is not openssl enabled, falling back to plain transfer" ++ encrypt=-1 ++ fi ++ ++ if [[ $encrypt -eq 2 ]];then ++ wsrep_log_info "Using openssl based encryption with socat: with crt and pem" ++ if [[ -z $tpem || -z $tcert ]];then ++ wsrep_log_error "Both PEM and CRT files required" ++ exit 22 ++ fi ++ stagemsg+="-OpenSSL-Encrypted-2" ++ if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]];then ++ wsrep_log_info "Decrypting with PEM $tpem, CA: $tcert" ++ tcmd="socat -u openssl-listen:${TSST_PORT},reuseaddr,cert=$tpem,cafile=${tcert}${sockopt} stdio" ++ else ++ wsrep_log_info "Encrypting with PEM $tpem, CA: $tcert" ++ tcmd="socat -u stdio openssl-connect:${REMOTEIP}:${TSST_PORT},cert=$tpem,cafile=${tcert}${sockopt}" ++ fi ++ elif [[ $encrypt -eq 3 ]];then ++ wsrep_log_info "Using openssl based encryption with socat: with key and crt" ++ if [[ -z $tpem || -z $tkey ]];then ++ wsrep_log_error "Both certificate and key files required" ++ exit 22 ++ fi ++ stagemsg+="-OpenSSL-Encrypted-3" ++ if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]];then ++ wsrep_log_info "Decrypting with certificate $tpem, key $tkey" ++ tcmd="socat -u openssl-listen:${TSST_PORT},reuseaddr,cert=$tpem,key=${tkey},verify=0${sockopt} stdio" ++ else ++ wsrep_log_info "Encrypting with certificate $tpem, key $tkey" ++ tcmd="socat -u stdio openssl-connect:${REMOTEIP}:${TSST_PORT},cert=$tpem,key=${tkey},verify=0${sockopt}" ++ fi ++ ++ else ++ if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]];then ++ tcmd="socat -u TCP-LISTEN:${TSST_PORT},reuseaddr${sockopt} stdio" ++ else ++ tcmd="socat -u stdio TCP:${REMOTEIP}:${TSST_PORT}${sockopt}" ++ fi ++ fi ++ fi ++ ++} ++ ++parse_cnf() ++{ ++ local group=$1 ++ local var=$2 ++ reval=$($MY_PRINT_DEFAULTS -c $WSREP_SST_OPT_CONF $group | awk -F= '{if ($1 ~ /_/) { gsub(/_/,"-",$1); print $1"="$2 } else { print $0 }}' | grep -- "--$var=" | cut -d= -f2-) ++ if [[ -z $reval ]];then ++ [[ -n $3 ]] && reval=$3 ++ fi ++ echo $reval ++} ++ ++get_footprint() ++{ ++ pushd $WSREP_SST_OPT_DATA 1>/dev/null ++ payload=$(find . -regex '.*\.ibd$\|.*\.MYI$\|.*\.MYD$\|.*ibdata1$' -type f -print0 | xargs -0 du --block-size=1 -c | awk 'END { print $1 }') ++ if $MY_PRINT_DEFAULTS -c $WSREP_SST_OPT_CONF xtrabackup | grep -q -- "--compress";then ++ # QuickLZ has around 50% compression ratio ++ # When compression/compaction used, the progress is only an approximate. ++ payload=$(( payload*1/2 )) ++ fi ++ popd 1>/dev/null ++ pcmd+=" -s $payload" ++ adjust_progress ++} ++ ++adjust_progress() ++{ ++ if [[ -n $progress && $progress != '1' ]];then ++ if [[ -e $progress ]];then ++ pcmd+=" 2>>$progress" ++ else ++ pcmd+=" 2>$progress" ++ fi ++ elif [[ -z $progress && -n $rlimit ]];then ++ # When rlimit is non-zero ++ pcmd="pv -q" ++ fi ++ ++ if [[ -n $rlimit && "$WSREP_SST_OPT_ROLE" == "donor" ]];then ++ wsrep_log_info "Rate-limiting SST to $rlimit" ++ pcmd+=" -L \$rlimit" ++ fi ++} ++ ++read_cnf() ++{ ++ sfmt=$(parse_cnf sst streamfmt "xbstream") ++ tfmt=$(parse_cnf sst transferfmt "socat") ++ tcert=$(parse_cnf sst tca "") ++ tpem=$(parse_cnf sst tcert "") ++ tkey=$(parse_cnf sst tkey "") ++ encrypt=$(parse_cnf sst encrypt 0) ++ sockopt=$(parse_cnf sst sockopt "") ++ progress=$(parse_cnf sst progress "") ++ rebuild=$(parse_cnf sst rebuild 0) ++ ttime=$(parse_cnf sst time 0) ++ cpat=$(parse_cnf sst cpat '.*galera\.cache$\|.*sst_in_progress$\|.*grastate\.dat$\|.*gvwstate\.dat$\|.*\.err$\|.*\.log$\|.*RPM_UPGRADE_MARKER$\|.*RPM_UPGRADE_HISTORY$') ++ incremental=$(parse_cnf sst incremental 0) ++ ealgo=$(parse_cnf xtrabackup encrypt "") ++ ekey=$(parse_cnf xtrabackup encrypt-key "") ++ ekeyfile=$(parse_cnf xtrabackup encrypt-key-file "") ++ scomp=$(parse_cnf sst compressor "") ++ sdecomp=$(parse_cnf sst decompressor "") ++ ++ ++ # Refer to http://www.percona.com/doc/percona-xtradb-cluster/manual/xtrabackup_sst.html ++ if [[ -z $ealgo ]];then ++ ealgo=$(parse_cnf sst encrypt-algo "") ++ ekey=$(parse_cnf sst encrypt-key "") ++ ekeyfile=$(parse_cnf sst encrypt-key-file "") ++ fi ++ rlimit=$(parse_cnf sst rlimit "") ++ uextra=$(parse_cnf sst use-extra 0) ++ speciald=$(parse_cnf sst sst-special-dirs 1) ++ iopts=$(parse_cnf sst inno-backup-opts "") ++ iapts=$(parse_cnf sst inno-apply-opts "") ++ impts=$(parse_cnf sst inno-move-opts "") ++ stimeout=$(parse_cnf sst sst-initial-timeout 100) ++} ++ ++get_stream() ++{ ++ if [[ $sfmt == 'xbstream' ]];then ++ wsrep_log_info "Streaming with xbstream" ++ if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]];then ++ strmcmd="xbstream -x" ++ else ++ strmcmd="xbstream -c \${INFO_FILE}" ++ fi ++ else ++ sfmt="tar" ++ wsrep_log_info "Streaming with tar" ++ if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]];then ++ strmcmd="tar xfi - " ++ else ++ strmcmd="tar cf - \${INFO_FILE} " ++ fi ++ ++ fi ++} ++ ++get_proc() ++{ ++ set +e ++ nproc=$(grep -c processor /proc/cpuinfo) ++ [[ -z $nproc || $nproc -eq 0 ]] && nproc=1 ++ set -e ++} ++ ++sig_joiner_cleanup() ++{ ++ wsrep_log_error "Removing $MAGIC_FILE file due to signal" ++ rm -f "$MAGIC_FILE" ++} ++ ++cleanup_joiner() ++{ ++ # Since this is invoked just after exit NNN ++ local estatus=$? ++ if [[ $estatus -ne 0 ]];then ++ wsrep_log_error "Cleanup after exit with status:$estatus" ++ fi ++ if [ "${WSREP_SST_OPT_ROLE}" = "joiner" ];then ++ wsrep_log_info "Removing the sst_in_progress file" ++ wsrep_cleanup_progress_file ++ fi ++ if [[ -n $progress && -p $progress ]];then ++ wsrep_log_info "Cleaning up fifo file $progress" ++ rm $progress ++ fi ++ if [[ -n ${STATDIR:-} ]];then ++ [[ -d $STATDIR ]] && rm -rf $STATDIR ++ fi ++} ++ ++check_pid() ++{ ++ local pid_file="$1" ++ [ -r "$pid_file" ] && ps -p $(cat "$pid_file") >/dev/null 2>&1 ++} ++ ++cleanup_donor() ++{ ++ # Since this is invoked just after exit NNN ++ local estatus=$? ++ if [[ $estatus -ne 0 ]];then ++ wsrep_log_error "Cleanup after exit with status:$estatus" ++ fi ++ ++ if [[ -n ${XTRABACKUP_PID:-} ]];then ++ if check_pid $XTRABACKUP_PID ++ then ++ wsrep_log_error "xtrabackup process is still running. Killing... " ++ kill_xtrabackup ++ fi ++ ++ fi ++ rm -f ${DATA}/${IST_FILE} || true ++ ++ if [[ -n $progress && -p $progress ]];then ++ wsrep_log_info "Cleaning up fifo file $progress" ++ rm -f $progress || true ++ fi ++ ++ wsrep_log_info "Cleaning up temporary directories" ++ ++ if [[ -n $xtmpdir ]];then ++ [[ -d $xtmpdir ]] && rm -rf $xtmpdir || true ++ fi ++ ++ if [[ -n $itmpdir ]];then ++ [[ -d $itmpdir ]] && rm -rf $itmpdir || true ++ fi ++} ++ ++kill_xtrabackup() ++{ ++ local PID=$(cat $XTRABACKUP_PID) ++ [ -n "$PID" -a "0" != "$PID" ] && kill $PID && (kill $PID && kill -9 $PID) || : ++ wsrep_log_info "Removing xtrabackup pid file $XTRABACKUP_PID" ++ rm -f "$XTRABACKUP_PID" || true ++} ++ ++setup_ports() ++{ ++ if [[ "$WSREP_SST_OPT_ROLE" == "donor" ]];then ++ SST_PORT=$(echo $WSREP_SST_OPT_ADDR | awk -F '[:/]' '{ print $2 }') ++ REMOTEIP=$(echo $WSREP_SST_OPT_ADDR | awk -F ':' '{ print $1 }') ++ lsn=$(echo $WSREP_SST_OPT_ADDR | awk -F '[:/]' '{ print $4 }') ++ else ++ SST_PORT=$(echo ${WSREP_SST_OPT_ADDR} | awk -F ':' '{ print $2 }') ++ fi ++} ++ ++# waits ~10 seconds for nc to open the port and then reports ready ++# (regardless of timeout) ++wait_for_listen() ++{ ++ local PORT=$1 ++ local ADDR=$2 ++ local MODULE=$3 ++ for i in {1..50} ++ do ++ ss -p state listening "( sport = :$PORT )" | grep -qE 'socat|nc' && break ++ sleep 0.2 ++ done ++ if [[ $incremental -eq 1 ]];then ++ echo "ready ${ADDR}/${MODULE}/$lsn" ++ else ++ echo "ready ${ADDR}/${MODULE}" ++ fi ++} ++ ++check_extra() ++{ ++ local use_socket=1 ++ if [[ $uextra -eq 1 ]];then ++ if $MY_PRINT_DEFAULTS -c $WSREP_SST_OPT_CONF mysqld | tr '_' '-' | grep -- "--thread-handling=" | grep -q 'pool-of-threads';then ++ local eport=$($MY_PRINT_DEFAULTS -c $WSREP_SST_OPT_CONF mysqld | tr '_' '-' | grep -- "--extra-port=" | cut -d= -f2) ++ if [[ -n $eport ]];then ++ # Xtrabackup works only locally. ++ # Hence, setting host to 127.0.0.1 unconditionally. ++ wsrep_log_info "SST through extra_port $eport" ++ INNOEXTRA+=" --host=127.0.0.1 --port=$eport " ++ use_socket=0 ++ else ++ wsrep_log_error "Extra port $eport null, failing" ++ exit 1 ++ fi ++ else ++ wsrep_log_info "Thread pool not set, ignore the option use_extra" ++ fi ++ fi ++ if [[ $use_socket -eq 1 ]] && [[ -n "${WSREP_SST_OPT_SOCKET}" ]];then ++ INNOEXTRA+=" --socket=${WSREP_SST_OPT_SOCKET}" ++ fi ++} ++ ++recv_joiner() ++{ ++ local dir=$1 ++ local msg=$2 ++ local tmt=$3 ++ local ltcmd ++ ++ pushd ${dir} 1>/dev/null ++ set +e ++ ++ if [[ $tmt -gt 0 && -x `which timeout` ]];then ++ if timeout --help | grep -q -- '-k';then ++ ltcmd="timeout -k $(( tmt+10 )) $tmt $tcmd" ++ else ++ ltcmd="timeout $tmt $tcmd" ++ fi ++ timeit "$msg" "$ltcmd | $strmcmd; RC=( "\${PIPESTATUS[@]}" )" ++ else ++ timeit "$msg" "$tcmd | $strmcmd; RC=( "\${PIPESTATUS[@]}" )" ++ fi ++ ++ set -e ++ popd 1>/dev/null ++ ++ if [[ ${RC[0]} -eq 124 ]];then ++ wsrep_log_error "Possible timeout in receving first data from donor in gtid stage" ++ exit 32 ++ fi ++ ++ for ecode in "${RC[@]}";do ++ if [[ $ecode -ne 0 ]];then ++ wsrep_log_error "Error while getting data from donor node: " \ ++ "exit codes: ${RC[@]}" ++ exit 32 ++ fi ++ done ++ ++ if [ ! -r "${MAGIC_FILE}" ];then ++ # this message should cause joiner to abort ++ wsrep_log_error "xtrabackup process ended without creating '${MAGIC_FILE}'" ++ wsrep_log_info "Contents of datadir" ++ wsrep_log_info "$(ls -l ${dir}/*)" ++ exit 32 ++ fi ++} ++ ++ ++send_donor() ++{ ++ local dir=$1 ++ local msg=$2 ++ ++ pushd ${dir} 1>/dev/null ++ set +e ++ timeit "$msg" "$strmcmd | $tcmd; RC=( "\${PIPESTATUS[@]}" )" ++ set -e ++ popd 1>/dev/null ++ ++ ++ for ecode in "${RC[@]}";do ++ if [[ $ecode -ne 0 ]];then ++ wsrep_log_error "Error while getting data from donor node: " \ ++ "exit codes: ${RC[@]}" ++ exit 32 ++ fi ++ done ++ ++} ++ ++if [[ ! -x `which $INNOBACKUPEX_BIN` ]];then ++ wsrep_log_error "innobackupex not in path: $PATH" ++ exit 2 ++fi ++ ++rm -f "${MAGIC_FILE}" ++ ++if [[ ! ${WSREP_SST_OPT_ROLE} == 'joiner' && ! ${WSREP_SST_OPT_ROLE} == 'donor' ]];then ++ wsrep_log_error "Invalid role ${WSREP_SST_OPT_ROLE}" ++ exit 22 ++fi ++ ++read_cnf ++setup_ports ++get_stream ++get_transfer ++ ++if ${INNOBACKUPEX_BIN} /tmp --help | grep -q -- '--version-check'; then ++ disver="--no-version-check" ++fi ++ ++ ++INNOEXTRA="" ++INNOAPPLY="${INNOBACKUPEX_BIN} $disver $iapts --apply-log \$rebuildcmd \${DATA} &>\${DATA}/innobackup.prepare.log" ++INNOMOVE="${INNOBACKUPEX_BIN} --defaults-file=${WSREP_SST_OPT_CONF} --defaults-group=mysqld${WSREP_SST_OPT_CONF_SUFFIX} $disver $impts --move-back --force-non-empty-directories \${DATA} &>\${DATA}/innobackup.move.log" ++INNOBACKUP="${INNOBACKUPEX_BIN} --defaults-file=${WSREP_SST_OPT_CONF} --defaults-group=mysqld${WSREP_SST_OPT_CONF_SUFFIX} $disver $iopts \$tmpopts \$INNOEXTRA --galera-info --stream=\$sfmt \$itmpdir 2>\${DATA}/innobackup.backup.log" ++ ++if [ "$WSREP_SST_OPT_ROLE" = "donor" ] ++then ++ trap cleanup_donor EXIT ++ ++ if [ $WSREP_SST_OPT_BYPASS -eq 0 ] ++ then ++ ++ if [[ -z $(parse_cnf mysqld tmpdir "") && -z $(parse_cnf xtrabackup tmpdir "") ]];then ++ xtmpdir=$(mktemp -d) ++ tmpopts=" --tmpdir=$xtmpdir " ++ wsrep_log_info "Using $xtmpdir as xtrabackup temporary directory" ++ fi ++ ++ itmpdir=$(mktemp -d) ++ wsrep_log_info "Using $itmpdir as innobackupex temporary directory" ++ ++ if [ "${AUTH[0]}" != "(null)" ]; then ++ INNOEXTRA+=" --user=${AUTH[0]}" ++ fi ++ ++ if [ ${#AUTH[*]} -eq 2 ]; then ++ INNOEXTRA+=" --password=${AUTH[1]}" ++ elif [ "${AUTH[0]}" != "(null)" ]; then ++ # Empty password, used for testing, debugging etc. ++ INNOEXTRA+=" --password=" ++ fi ++ ++ get_keys ++ if [[ $encrypt -eq 1 ]];then ++ if [[ -n $ekey ]];then ++ INNOEXTRA+=" --encrypt=$ealgo --encrypt-key=$ekey " ++ else ++ INNOEXTRA+=" --encrypt=$ealgo --encrypt-key-file=$ekeyfile " ++ fi ++ fi ++ ++ if [[ -n $lsn ]];then ++ INNOEXTRA+=" --incremental --incremental-lsn=$lsn " ++ fi ++ ++ check_extra ++ ++ wsrep_log_info "Streaming GTID file before SST" ++ ++ echo "${WSREP_SST_OPT_GTID}" > "${MAGIC_FILE}" ++ ++ ttcmd="$tcmd" ++ ++ if [[ $encrypt -eq 1 ]];then ++ if [[ -n $scomp ]];then ++ tcmd=" $ecmd | $scomp | $tcmd " ++ else ++ tcmd=" $ecmd | $tcmd " ++ fi ++ elif [[ -n $scomp ]];then ++ tcmd=" $scomp | $tcmd " ++ fi ++ ++ ++ send_donor $DATA "${stagemsg}-gtid" ++ ++ tcmd="$ttcmd" ++ if [[ -n $progress ]];then ++ get_footprint ++ tcmd="$pcmd | $tcmd" ++ elif [[ -n $rlimit ]];then ++ adjust_progress ++ tcmd="$pcmd | $tcmd" ++ fi ++ ++ wsrep_log_info "Sleeping before data transfer for SST" ++ sleep 10 ++ ++ wsrep_log_info "Streaming the backup to joiner at ${REMOTEIP} ${SST_PORT:-4444}" ++ ++ if [[ -n $scomp ]];then ++ tcmd="$scomp | $tcmd" ++ fi ++ ++ set +e ++ timeit "${stagemsg}-SST" "$INNOBACKUP | $tcmd; RC=( "\${PIPESTATUS[@]}" )" ++ set -e ++ ++ if [ ${RC[0]} -ne 0 ]; then ++ wsrep_log_error "${INNOBACKUPEX_BIN} finished with error: ${RC[0]}. " \ ++ "Check ${DATA}/innobackup.backup.log" ++ exit 22 ++ elif [[ ${RC[$(( ${#RC[@]}-1 ))]} -eq 1 ]];then ++ wsrep_log_error "$tcmd finished with error: ${RC[1]}" ++ exit 22 ++ fi ++ ++ # innobackupex implicitly writes PID to fixed location in $xtmpdir ++ XTRABACKUP_PID="$xtmpdir/xtrabackup_pid" ++ ++ ++ else # BYPASS FOR IST ++ ++ wsrep_log_info "Bypassing the SST for IST" ++ echo "continue" # now server can resume updating data ++ echo "${WSREP_SST_OPT_GTID}" > "${MAGIC_FILE}" ++ echo "1" > "${DATA}/${IST_FILE}" ++ get_keys ++ if [[ $encrypt -eq 1 ]];then ++ if [[ -n $scomp ]];then ++ tcmd=" $ecmd | $scomp | $tcmd " ++ else ++ tcmd=" $ecmd | $tcmd " ++ fi ++ elif [[ -n $scomp ]];then ++ tcmd=" $scomp | $tcmd " ++ fi ++ strmcmd+=" \${IST_FILE}" ++ ++ send_donor $DATA "${stagemsg}-IST" ++ ++ fi ++ ++ echo "done ${WSREP_SST_OPT_GTID}" ++ wsrep_log_info "Total time on donor: $totime seconds" ++ ++elif [ "${WSREP_SST_OPT_ROLE}" = "joiner" ] ++then ++ [[ -e $SST_PROGRESS_FILE ]] && wsrep_log_info "Stale sst_in_progress file: $SST_PROGRESS_FILE" ++ [[ -n $SST_PROGRESS_FILE ]] && touch $SST_PROGRESS_FILE ++ ++ if [[ $speciald -eq 1 ]];then ++ ib_home_dir=$(parse_cnf mysqld innodb-data-home-dir "") ++ ib_log_dir=$(parse_cnf mysqld innodb-log-group-home-dir "") ++ if [[ -z $ib_home_dir && -z $ib_log_dir ]];then ++ speciald=0 ++ fi ++ fi ++ ++ stagemsg="Joiner-Recv" ++ ++ if [[ ! -e ${DATA}/ibdata1 ]];then ++ incremental=0 ++ fi ++ ++ if [[ $incremental -eq 1 ]];then ++ wsrep_log_info "Incremental SST enabled: NOT SUPPORTED yet" ++ lsn=$(grep to_lsn xtrabackup_checkpoints | cut -d= -f2 | tr -d ' ') ++ wsrep_log_info "Recovered LSN: $lsn" ++ fi ++ ++ sencrypted=1 ++ nthreads=1 ++ ++ MODULE="xtrabackup_sst" ++ ++ rm -f "${DATA}/${IST_FILE}" ++ ++ # May need xtrabackup_checkpoints later on ++ rm -f ${DATA}/xtrabackup_binary ${DATA}/xtrabackup_galera_info ${DATA}/xtrabackup_logfile ++ ++ ADDR=${WSREP_SST_OPT_ADDR} ++ if [ -z "${SST_PORT}" ] ++ then ++ SST_PORT=4444 ++ ADDR="$(echo ${WSREP_SST_OPT_ADDR} | awk -F ':' '{ print $1 }'):${SST_PORT}" ++ fi ++ ++ wait_for_listen ${SST_PORT} ${ADDR} ${MODULE} & ++ ++ trap sig_joiner_cleanup HUP PIPE INT TERM ++ trap cleanup_joiner EXIT ++ ++ if [[ -n $progress ]];then ++ adjust_progress ++ tcmd+=" | $pcmd" ++ fi ++ ++ if [[ $incremental -eq 1 ]];then ++ BDATA=$DATA ++ DATA=$(mktemp -d) ++ MAGIC_FILE="${DATA}/${INFO_FILE}" ++ fi ++ ++ get_keys ++ if [[ $encrypt -eq 1 && $sencrypted -eq 1 ]];then ++ if [[ -n $sdecomp ]];then ++ strmcmd=" $sdecomp | $ecmd | $strmcmd" ++ else ++ strmcmd=" $ecmd | $strmcmd" ++ fi ++ elif [[ -n $sdecomp ]];then ++ strmcmd=" $sdecomp | $strmcmd" ++ fi ++ ++ STATDIR=$(mktemp -d) ++ MAGIC_FILE="${STATDIR}/${INFO_FILE}" ++ recv_joiner $STATDIR "${stagemsg}-gtid" $stimeout ++ ++ if ! ps -p ${WSREP_SST_OPT_PARENT} &>/dev/null ++ then ++ wsrep_log_error "Parent mysqld process (PID:${WSREP_SST_OPT_PARENT}) terminated unexpectedly." ++ exit 32 ++ fi ++ ++ if [ ! -r "${STATDIR}/${IST_FILE}" ] ++ then ++ wsrep_log_info "Proceeding with SST" ++ ++ if [[ $speciald -eq 1 && -d ${DATA}/.sst ]];then ++ wsrep_log_info "WARNING: Stale temporary SST directory: ${DATA}/.sst from previous SST" ++ fi ++ ++ if [[ $incremental -ne 1 ]];then ++ if [[ $speciald -eq 1 ]];then ++ wsrep_log_info "Cleaning the existing datadir and innodb-data/log directories" ++ find $ib_home_dir $ib_log_dir $DATA -mindepth 1 -regex $cpat -prune -o -exec rm -rfv {} 1>&2 \+ ++ else ++ wsrep_log_info "Cleaning the existing datadir" ++ find $DATA -mindepth 1 -regex $cpat -prune -o -exec rm -rfv {} 1>&2 \+ ++ fi ++ tempdir=$(parse_cnf mysqld log-bin "") ++ if [[ -n ${tempdir:-} ]];then ++ binlog_dir=$(dirname $tempdir) ++ binlog_file=$(basename $tempdir) ++ if [[ -n ${binlog_dir:-} && $binlog_dir != '.' && $binlog_dir != $DATA ]];then ++ pattern="$binlog_dir/$binlog_file\.[0-9]+$" ++ wsrep_log_info "Cleaning the binlog directory $binlog_dir as well" ++ find $binlog_dir -maxdepth 1 -type f -regex $pattern -exec rm -fv {} 1>&2 \+ ++ rm $binlog_dir/*.index || true ++ fi ++ fi ++ ++ else ++ wsrep_log_info "Removing existing ib_logfile files" ++ rm -f ${BDATA}/ib_logfile* ++ fi ++ ++ ++ if [[ $speciald -eq 1 ]];then ++ mkdir -p ${DATA}/.sst ++ TDATA=${DATA} ++ DATA="${DATA}/.sst" ++ fi ++ ++ ++ MAGIC_FILE="${DATA}/${INFO_FILE}" ++ recv_joiner $DATA "${stagemsg}-SST" 0 ++ ++ get_proc ++ ++ # Rebuild indexes for compact backups ++ if grep -q 'compact = 1' ${DATA}/xtrabackup_checkpoints;then ++ wsrep_log_info "Index compaction detected" ++ rebuild=1 ++ fi ++ ++ if [[ $rebuild -eq 1 ]];then ++ nthreads=$(parse_cnf xtrabackup rebuild-threads $nproc) ++ wsrep_log_info "Rebuilding during prepare with $nthreads threads" ++ rebuildcmd="--rebuild-indexes --rebuild-threads=$nthreads" ++ fi ++ ++ if test -n "$(find ${DATA} -maxdepth 1 -type f -name '*.qp' -print -quit)";then ++ ++ wsrep_log_info "Compressed qpress files found" ++ ++ if [[ ! -x `which qpress` ]];then ++ wsrep_log_error "qpress not found in path: $PATH" ++ exit 22 ++ fi ++ ++ if [[ -n $progress ]] && pv --help | grep -q 'line-mode';then ++ count=$(find ${DATA} -type f -name '*.qp' | wc -l) ++ count=$(( count*2 )) ++ if pv --help | grep -q FORMAT;then ++ pvopts="-f -s $count -l -N Decompression -F '%N => Rate:%r Elapsed:%t %e Progress: [%b/$count]'" ++ else ++ pvopts="-f -s $count -l -N Decompression" ++ fi ++ pcmd="pv $pvopts" ++ adjust_progress ++ dcmd="$pcmd | xargs -n 2 qpress -T${nproc}d" ++ else ++ dcmd="xargs -n 2 qpress -T${nproc}d" ++ fi ++ ++ ++ # Decompress the qpress files ++ wsrep_log_info "Decompression with $nproc threads" ++ timeit "Joiner-Decompression" "find ${DATA} -type f -name '*.qp' -printf '%p\n%h\n' | $dcmd" ++ extcode=$? ++ ++ if [[ $extcode -eq 0 ]];then ++ wsrep_log_info "Removing qpress files after decompression" ++ find ${DATA} -type f -name '*.qp' -delete ++ if [[ $? -ne 0 ]];then ++ wsrep_log_error "Something went wrong with deletion of qpress files. Investigate" ++ fi ++ else ++ wsrep_log_error "Decompression failed. Exit code: $extcode" ++ exit 22 ++ fi ++ fi ++ ++ ++ if [[ ! -z $WSREP_SST_OPT_BINLOG ]];then ++ ++ BINLOG_DIRNAME=$(dirname $WSREP_SST_OPT_BINLOG) ++ BINLOG_FILENAME=$(basename $WSREP_SST_OPT_BINLOG) ++ ++ # To avoid comparing data directory and BINLOG_DIRNAME ++ mv $DATA/${BINLOG_FILENAME}.* $BINLOG_DIRNAME/ 2>/dev/null || true ++ ++ pushd $BINLOG_DIRNAME &>/dev/null ++ for bfiles in $(ls -1 ${BINLOG_FILENAME}.*);do ++ echo ${BINLOG_DIRNAME}/${bfiles} >> ${BINLOG_FILENAME}.index ++ done ++ popd &> /dev/null ++ ++ fi ++ ++ if [[ $incremental -eq 1 ]];then ++ # Added --ibbackup=xtrabackup_55 because it fails otherwise citing connection issues. ++ INNOAPPLY="${INNOBACKUPEX_BIN} $disver --defaults-file=${WSREP_SST_OPT_CONF} --defaults-group=mysqld${WSREP_SST_OPT_CONF_SUFFIX} \ ++ --ibbackup=xtrabackup_56 --apply-log $rebuildcmd --redo-only $BDATA --incremental-dir=${DATA} &>>${BDATA}/innobackup.prepare.log" ++ fi ++ ++ wsrep_log_info "Preparing the backup at ${DATA}" ++ timeit "Xtrabackup prepare stage" "$INNOAPPLY" ++ ++ if [ $? -ne 0 ]; ++ then ++ wsrep_log_error "${INNOBACKUPEX_BIN} apply finished with errors. Check ${DATA}/innobackup.prepare.log" ++ exit 22 ++ fi ++ ++ if [[ $speciald -eq 1 ]];then ++ MAGIC_FILE="${TDATA}/${INFO_FILE}" ++ set +e ++ rm $TDATA/innobackup.prepare.log $TDATA/innobackup.move.log ++ set -e ++ wsrep_log_info "Moving the backup to ${TDATA}" ++ timeit "Xtrabackup move stage" "$INNOMOVE" ++ if [[ $? -eq 0 ]];then ++ wsrep_log_info "Move successful, removing ${DATA}" ++ rm -rf $DATA ++ DATA=${TDATA} ++ else ++ wsrep_log_error "Move failed, keeping ${DATA} for further diagnosis" ++ wsrep_log_error "Check ${DATA}/innobackup.move.log for details" ++ fi ++ fi ++ ++ if [[ $incremental -eq 1 ]];then ++ wsrep_log_info "Cleaning up ${DATA} after incremental SST" ++ [[ -d ${DATA} ]] && rm -rf ${DATA} ++ DATA=$BDATA ++ fi ++ ++ else ++ wsrep_log_info "${IST_FILE} received from donor: Running IST" ++ fi ++ ++ if [[ ! -r ${MAGIC_FILE} ]];then ++ wsrep_log_error "SST magic file ${MAGIC_FILE} not found/readable" ++ exit 2 ++ fi ++ cat "${MAGIC_FILE}" # output UUID:seqno ++ wsrep_log_info "Total time on joiner: $totime seconds" ++fi ++ ++exit 0 +diff --git a/scripts/wsrep_sst_xtrabackup.sh b/scripts/wsrep_sst_xtrabackup.sh +new file mode 100644 +index 0000000..05dbcea +--- /dev/null ++++ b/scripts/wsrep_sst_xtrabackup.sh +@@ -0,0 +1,715 @@ ++#!/bin/bash -ue ++# Copyright (C) 2013 Percona Inc ++# ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; version 2 of the License. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program; see the file COPYING. If not, write to the ++# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston ++# MA 02110-1301 USA. ++ ++# Optional dependencies and options documented here: http://www.percona.com/doc/percona-xtradb-cluster/manual/xtrabackup_sst.html ++# Make sure to read that before proceeding! ++ ++ ++ ++ ++. $(dirname $0)/wsrep_sst_common ++ ++ealgo="" ++ekey="" ++ekeyfile="" ++encrypt=0 ++nproc=1 ++ecode=0 ++XTRABACKUP_PID="" ++SST_PORT="" ++REMOTEIP="" ++tcert="" ++tpem="" ++sockopt="" ++progress="" ++ttime=0 ++totime=0 ++lsn="" ++incremental=0 ++ecmd="" ++rlimit="" ++ ++sfmt="tar" ++strmcmd="" ++tfmt="" ++tcmd="" ++rebuild=0 ++rebuildcmd="" ++payload=0 ++pvformat="-F '%N => Rate:%r Avg:%a Elapsed:%t %e Bytes: %b %p' " ++pvopts="-f -i 10 -N $WSREP_SST_OPT_ROLE " ++uextra=0 ++ ++if which pv &>/dev/null && pv --help | grep -q FORMAT;then ++ pvopts+=$pvformat ++fi ++pcmd="pv $pvopts" ++declare -a RC ++ ++INNOBACKUPEX_BIN=innobackupex ++readonly AUTH=(${WSREP_SST_OPT_AUTH//:/ }) ++DATA="${WSREP_SST_OPT_DATA}" ++INFO_FILE="xtrabackup_galera_info" ++IST_FILE="xtrabackup_ist" ++MAGIC_FILE="${DATA}/${INFO_FILE}" ++ ++# Setting the path for ss and ip ++export PATH="/usr/sbin:/sbin:$PATH" ++ ++timeit(){ ++ local stage=$1 ++ shift ++ local cmd="$@" ++ local x1 x2 took extcode ++ ++ if [[ $ttime -eq 1 ]];then ++ x1=$(date +%s) ++ wsrep_log_info "Evaluating $cmd" ++ eval "$cmd" ++ extcode=$? ++ x2=$(date +%s) ++ took=$(( x2-x1 )) ++ wsrep_log_info "NOTE: $stage took $took seconds" ++ totime=$(( totime+took )) ++ else ++ wsrep_log_info "Evaluating $cmd" ++ eval "$cmd" ++ extcode=$? ++ fi ++ return $extcode ++} ++ ++get_keys() ++{ ++ if [[ $encrypt -eq 2 ]];then ++ return ++ fi ++ ++ if [[ $encrypt -eq 0 ]];then ++ if $MY_PRINT_DEFAULTS -c $WSREP_SST_OPT_CONF xtrabackup | grep -q encrypt;then ++ wsrep_log_error "Unexpected option combination. SST may fail. Refer to http://www.percona.com/doc/percona-xtradb-cluster/manual/xtrabackup_sst.html " ++ fi ++ return ++ fi ++ ++ if [[ $sfmt == 'tar' ]];then ++ wsrep_log_info "NOTE: Xtrabackup-based encryption - encrypt=1 - cannot be enabled with tar format" ++ encrypt=0 ++ return ++ fi ++ ++ wsrep_log_info "Xtrabackup based encryption enabled in my.cnf - Supported only from Xtrabackup 2.1.4" ++ ++ if [[ -z $ealgo ]];then ++ wsrep_log_error "FATAL: Encryption algorithm empty from my.cnf, bailing out" ++ exit 3 ++ fi ++ ++ if [[ -z $ekey && ! -r $ekeyfile ]];then ++ wsrep_log_error "FATAL: Either key or keyfile must be readable" ++ exit 3 ++ fi ++ ++ if [[ -z $ekey ]];then ++ ecmd="xbcrypt --encrypt-algo=$ealgo --encrypt-key-file=$ekeyfile" ++ else ++ ecmd="xbcrypt --encrypt-algo=$ealgo --encrypt-key=$ekey" ++ fi ++ ++ if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]];then ++ ecmd+=" -d" ++ fi ++} ++ ++get_transfer() ++{ ++ if [[ -z $SST_PORT ]];then ++ TSST_PORT=4444 ++ else ++ TSST_PORT=$SST_PORT ++ fi ++ ++ if [[ $tfmt == 'nc' ]];then ++ if [[ ! -x `which nc` ]];then ++ wsrep_log_error "nc(netcat) not found in path: $PATH" ++ exit 2 ++ fi ++ wsrep_log_info "Using netcat as streamer" ++ if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]];then ++ tcmd="nc -dl ${TSST_PORT}" ++ else ++ tcmd="nc ${REMOTEIP} ${TSST_PORT}" ++ fi ++ else ++ tfmt='socat' ++ wsrep_log_info "Using socat as streamer" ++ if [[ ! -x `which socat` ]];then ++ wsrep_log_error "socat not found in path: $PATH" ++ exit 2 ++ fi ++ ++ if [[ $encrypt -eq 2 ]] && ! socat -V | grep -q OPENSSL;then ++ wsrep_log_info "NOTE: socat is not openssl enabled, falling back to plain transfer" ++ encrypt=0 ++ fi ++ ++ if [[ $encrypt -eq 2 ]];then ++ wsrep_log_info "Using openssl based encryption with socat" ++ if [[ -z $tpem || -z $tcert ]];then ++ wsrep_log_error "Both PEM and CRT files required" ++ exit 22 ++ fi ++ if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]];then ++ wsrep_log_info "Decrypting with PEM $tpem, CA: $tcert" ++ tcmd="socat -u openssl-listen:${TSST_PORT},reuseaddr,cert=$tpem,cafile=${tcert}${sockopt} stdio" ++ else ++ wsrep_log_info "Encrypting with PEM $tpem, CA: $tcert" ++ tcmd="socat -u stdio openssl-connect:${REMOTEIP}:${TSST_PORT},cert=$tpem,cafile=${tcert}${sockopt}" ++ fi ++ else ++ if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]];then ++ tcmd="socat -u TCP-LISTEN:${TSST_PORT},reuseaddr${sockopt} stdio" ++ else ++ tcmd="socat -u stdio TCP:${REMOTEIP}:${TSST_PORT}${sockopt}" ++ fi ++ fi ++ fi ++ ++} ++ ++parse_cnf() ++{ ++ local group=$1 ++ local var=$2 ++ reval=$($MY_PRINT_DEFAULTS -c $WSREP_SST_OPT_CONF $group | awk -F= '{if ($1 ~ /_/) { gsub(/_/,"-",$1); print $1"="$2 } else { print $0 }}' | grep -- "--$var=" | cut -d= -f2-) ++ if [[ -z $reval ]];then ++ [[ -n $3 ]] && reval=$3 ++ fi ++ echo $reval ++} ++ ++get_footprint() ++{ ++ pushd $WSREP_SST_OPT_DATA 1>/dev/null ++ payload=$(find . -regex '.*\.ibd$\|.*\.MYI$\|.*\.MYD$\|.*ibdata1$' -type f -print0 | xargs -0 du --block-size=1 -c | awk 'END { print $1 }') ++ if $MY_PRINT_DEFAULTS -c $WSREP_SST_OPT_CONF xtrabackup | grep -q -- "--compress";then ++ # QuickLZ has around 50% compression ratio ++ # When compression/compaction used, the progress is only an approximate. ++ payload=$(( payload*1/2 )) ++ fi ++ popd 1>/dev/null ++ pcmd+=" -s $payload" ++ adjust_progress ++} ++ ++adjust_progress() ++{ ++ if [[ -n $progress && $progress != '1' ]];then ++ if [[ -e $progress ]];then ++ pcmd+=" 2>>$progress" ++ else ++ pcmd+=" 2>$progress" ++ fi ++ elif [[ -z $progress && -n $rlimit ]];then ++ # When rlimit is non-zero ++ pcmd="pv -q" ++ fi ++ ++ if [[ -n $rlimit && "$WSREP_SST_OPT_ROLE" == "donor" ]];then ++ wsrep_log_info "Rate-limiting SST to $rlimit" ++ pcmd+=" -L \$rlimit" ++ fi ++} ++ ++read_cnf() ++{ ++ sfmt=$(parse_cnf sst streamfmt "tar") ++ tfmt=$(parse_cnf sst transferfmt "socat") ++ tcert=$(parse_cnf sst tca "") ++ tpem=$(parse_cnf sst tcert "") ++ encrypt=$(parse_cnf sst encrypt 0) ++ sockopt=$(parse_cnf sst sockopt "") ++ progress=$(parse_cnf sst progress "") ++ rebuild=$(parse_cnf sst rebuild 0) ++ ttime=$(parse_cnf sst time 0) ++ incremental=$(parse_cnf sst incremental 0) ++ ealgo=$(parse_cnf xtrabackup encrypt "") ++ ekey=$(parse_cnf xtrabackup encrypt-key "") ++ ekeyfile=$(parse_cnf xtrabackup encrypt-key-file "") ++ ++ # Refer to http://www.percona.com/doc/percona-xtradb-cluster/manual/xtrabackup_sst.html ++ if [[ -z $ealgo ]];then ++ ealgo=$(parse_cnf sst encrypt-algo "") ++ ekey=$(parse_cnf sst encrypt-key "") ++ ekeyfile=$(parse_cnf sst encrypt-key-file "") ++ fi ++ rlimit=$(parse_cnf sst rlimit "") ++ uextra=$(parse_cnf sst use_extra 0) ++} ++ ++get_stream() ++{ ++ if [[ $sfmt == 'xbstream' ]];then ++ wsrep_log_info "Streaming with xbstream" ++ if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]];then ++ strmcmd="xbstream -x" ++ else ++ strmcmd="xbstream -c \${INFO_FILE} \${IST_FILE}" ++ fi ++ else ++ sfmt="tar" ++ wsrep_log_info "Streaming with tar" ++ if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]];then ++ strmcmd="tar xfi - --recursive-unlink -h" ++ else ++ strmcmd="tar cf - \${INFO_FILE} \${IST_FILE}" ++ fi ++ ++ fi ++} ++ ++get_proc() ++{ ++ set +e ++ nproc=$(grep -c processor /proc/cpuinfo) ++ [[ -z $nproc || $nproc -eq 0 ]] && nproc=1 ++ set -e ++} ++ ++sig_joiner_cleanup() ++{ ++ wsrep_log_error "Removing $MAGIC_FILE file due to signal" ++ rm -f "$MAGIC_FILE" ++} ++ ++cleanup_joiner() ++{ ++ # Since this is invoked just after exit NNN ++ local estatus=$? ++ if [[ $estatus -ne 0 ]];then ++ wsrep_log_error "Cleanup after exit with status:$estatus" ++ fi ++ if [ "${WSREP_SST_OPT_ROLE}" = "joiner" ];then ++ wsrep_log_info "Removing the sst_in_progress file" ++ wsrep_cleanup_progress_file ++ fi ++ if [[ -n $progress && -p $progress ]];then ++ wsrep_log_info "Cleaning up fifo file $progress" ++ rm $progress ++ fi ++} ++ ++check_pid() ++{ ++ local pid_file="$1" ++ [ -r "$pid_file" ] && ps -p $(cat "$pid_file") >/dev/null 2>&1 ++} ++ ++cleanup_donor() ++{ ++ # Since this is invoked just after exit NNN ++ local estatus=$? ++ if [[ $estatus -ne 0 ]];then ++ wsrep_log_error "Cleanup after exit with status:$estatus" ++ fi ++ ++ if [[ -n $XTRABACKUP_PID ]];then ++ if check_pid $XTRABACKUP_PID ++ then ++ wsrep_log_error "xtrabackup process is still running. Killing... " ++ kill_xtrabackup ++ fi ++ ++ rm -f $XTRABACKUP_PID ++ fi ++ rm -f ${DATA}/${IST_FILE} ++ ++ if [[ -n $progress && -p $progress ]];then ++ wsrep_log_info "Cleaning up fifo file $progress" ++ rm $progress ++ fi ++} ++ ++kill_xtrabackup() ++{ ++ local PID=$(cat $XTRABACKUP_PID) ++ [ -n "$PID" -a "0" != "$PID" ] && kill $PID && (kill $PID && kill -9 $PID) || : ++ rm -f "$XTRABACKUP_PID" ++} ++ ++setup_ports() ++{ ++ if [[ "$WSREP_SST_OPT_ROLE" == "donor" ]];then ++ SST_PORT=$(echo $WSREP_SST_OPT_ADDR | awk -F '[:/]' '{ print $2 }') ++ REMOTEIP=$(echo $WSREP_SST_OPT_ADDR | awk -F ':' '{ print $1 }') ++ lsn=$(echo $WSREP_SST_OPT_ADDR | awk -F '[:/]' '{ print $4 }') ++ else ++ SST_PORT=$(echo ${WSREP_SST_OPT_ADDR} | awk -F ':' '{ print $2 }') ++ fi ++} ++ ++# waits ~10 seconds for nc to open the port and then reports ready ++# (regardless of timeout) ++wait_for_listen() ++{ ++ local PORT=$1 ++ local ADDR=$2 ++ local MODULE=$3 ++ for i in {1..50} ++ do ++ ss -p state listening "( sport = :$PORT )" | grep -qE 'socat|nc' && break ++ sleep 0.2 ++ done ++ if [[ $incremental -eq 1 ]];then ++ echo "ready ${ADDR}/${MODULE}/$lsn" ++ else ++ echo "ready ${ADDR}/${MODULE}" ++ fi ++} ++ ++check_extra() ++{ ++ local use_socket=1 ++ if [[ $uextra -eq 1 ]];then ++ if $MY_PRINT_DEFAULTS -c $WSREP_SST_OPT_CONF mysqld | tr '_' '-' | grep -- "--thread-handling=" | grep -q 'pool-of-threads';then ++ local eport=$($MY_PRINT_DEFAULTS -c $WSREP_SST_OPT_CONF mysqld | tr '_' '-' | grep -- "--extra-port=" | cut -d= -f2) ++ if [[ -n $eport ]];then ++ # Xtrabackup works only locally. ++ # Hence, setting host to 127.0.0.1 unconditionally. ++ wsrep_log_info "SST through extra_port $eport" ++ INNOEXTRA+=" --host=127.0.0.1 --port=$eport " ++ use_socket=0 ++ else ++ wsrep_log_error "Extra port $eport null, failing" ++ exit 1 ++ fi ++ else ++ wsrep_log_info "Thread pool not set, ignore the option use_extra" ++ fi ++ fi ++ if [[ $use_socket -eq 1 ]] && [[ -n "${WSREP_SST_OPT_SOCKET}" ]];then ++ INNOEXTRA+=" --socket=${WSREP_SST_OPT_SOCKET}" ++ fi ++} ++ ++if [[ ! -x `which innobackupex` ]];then ++ wsrep_log_error "innobackupex not in path: $PATH" ++ exit 2 ++fi ++ ++rm -f "${MAGIC_FILE}" ++ ++if [[ ! ${WSREP_SST_OPT_ROLE} == 'joiner' && ! ${WSREP_SST_OPT_ROLE} == 'donor' ]];then ++ wsrep_log_error "Invalid role ${WSREP_SST_OPT_ROLE}" ++ exit 22 ++fi ++ ++read_cnf ++setup_ports ++get_stream ++get_transfer ++ ++INNOEXTRA="" ++INNOAPPLY="${INNOBACKUPEX_BIN} --defaults-file=${WSREP_SST_OPT_CONF} --apply-log \$rebuildcmd \${DATA} &>\${DATA}/innobackup.prepare.log" ++INNOBACKUP="${INNOBACKUPEX_BIN} --defaults-file=${WSREP_SST_OPT_CONF} \$INNOEXTRA --galera-info --stream=\$sfmt \${TMPDIR} 2>\${DATA}/innobackup.backup.log" ++ ++if [ "$WSREP_SST_OPT_ROLE" = "donor" ] ++then ++ trap cleanup_donor EXIT ++ ++ if [ $WSREP_SST_OPT_BYPASS -eq 0 ] ++ then ++ TMPDIR="${TMPDIR:-/tmp}" ++ ++ if [ "${AUTH[0]}" != "(null)" ]; then ++ INNOEXTRA+=" --user=${AUTH[0]}" ++ fi ++ ++ if [ ${#AUTH[*]} -eq 2 ]; then ++ INNOEXTRA+=" --password=${AUTH[1]}" ++ elif [ "${AUTH[0]}" != "(null)" ]; then ++ # Empty password, used for testing, debugging etc. ++ INNOEXTRA+=" --password=" ++ fi ++ ++ get_keys ++ if [[ $encrypt -eq 1 ]];then ++ if [[ -n $ekey ]];then ++ INNOEXTRA+=" --encrypt=$ealgo --encrypt-key=$ekey " ++ else ++ INNOEXTRA+=" --encrypt=$ealgo --encrypt-key-file=$ekeyfile " ++ fi ++ fi ++ ++ if [[ -n $lsn ]];then ++ INNOEXTRA+=" --incremental --incremental-lsn=$lsn " ++ fi ++ ++ check_extra ++ ++ wsrep_log_info "Streaming the backup to joiner at ${REMOTEIP} ${SST_PORT}" ++ ++ if [[ -n $progress ]];then ++ get_footprint ++ tcmd="$pcmd | $tcmd" ++ elif [[ -n $rlimit ]];then ++ adjust_progress ++ tcmd="$pcmd | $tcmd" ++ fi ++ ++ set +e ++ timeit "Donor-Transfer" "$INNOBACKUP | $tcmd; RC=( "\${PIPESTATUS[@]}" )" ++ set -e ++ ++ if [ ${RC[0]} -ne 0 ]; then ++ wsrep_log_error "${INNOBACKUPEX_BIN} finished with error: ${RC[0]}. " \ ++ "Check ${DATA}/innobackup.backup.log" ++ exit 22 ++ elif [[ ${RC[$(( ${#RC[@]}-1 ))]} -eq 1 ]];then ++ wsrep_log_error "$tcmd finished with error: ${RC[1]}" ++ exit 22 ++ fi ++ ++ # innobackupex implicitly writes PID to fixed location in ${TMPDIR} ++ XTRABACKUP_PID="${TMPDIR}/xtrabackup_pid" ++ ++ ++ else # BYPASS FOR IST ++ ++ wsrep_log_info "Bypassing the SST for IST" ++ STATE="${WSREP_SST_OPT_GTID}" ++ echo "continue" # now server can resume updating data ++ echo "${STATE}" > "${MAGIC_FILE}" ++ echo "1" > "${DATA}/${IST_FILE}" ++ get_keys ++ pushd ${DATA} 1>/dev/null ++ set +e ++ if [[ $encrypt -eq 1 ]];then ++ tcmd=" $ecmd | $tcmd" ++ fi ++ timeit "Donor-IST-Unencrypted-transfer" "$strmcmd | $tcmd; RC=( "\${PIPESTATUS[@]}" )" ++ set -e ++ popd 1>/dev/null ++ ++ for ecode in "${RC[@]}";do ++ if [[ $ecode -ne 0 ]];then ++ wsrep_log_error "Error while streaming data to joiner node: " \ ++ "exit codes: ${RC[@]}" ++ exit 1 ++ fi ++ done ++ fi ++ ++ echo "done ${WSREP_SST_OPT_GTID}" ++ wsrep_log_info "Total time on donor: $totime seconds" ++ ++elif [ "${WSREP_SST_OPT_ROLE}" = "joiner" ] ++then ++ [[ -e $SST_PROGRESS_FILE ]] && wsrep_log_info "Stale sst_in_progress file: $SST_PROGRESS_FILE" ++ touch $SST_PROGRESS_FILE ++ ++ if [[ ! -e ${DATA}/ibdata1 ]];then ++ incremental=0 ++ fi ++ ++ if [[ $incremental -eq 1 ]];then ++ wsrep_log_info "Incremental SST enabled" ++ #lsn=$(/pxc/bin/mysqld --defaults-file=$WSREP_SST_OPT_CONF --basedir=/pxc --wsrep-recover 2>&1 | grep -o 'log sequence number .*' | cut -d " " -f 4 | head -1) ++ lsn=$(grep to_lsn xtrabackup_checkpoints | cut -d= -f2 | tr -d ' ') ++ wsrep_log_info "Recovered LSN: $lsn" ++ fi ++ ++ sencrypted=1 ++ nthreads=1 ++ ++ MODULE="xtrabackup_sst" ++ ++ # May need xtrabackup_checkpoints later on ++ rm -f ${DATA}/xtrabackup_binary ${DATA}/xtrabackup_galera_info ${DATA}/xtrabackup_logfile ++ ++ ADDR=${WSREP_SST_OPT_ADDR} ++ if [ -z "${SST_PORT}" ] ++ then ++ SST_PORT=4444 ++ ADDR="$(echo ${WSREP_SST_OPT_ADDR} | awk -F ':' '{ print $1 }'):${SST_PORT}" ++ fi ++ ++ wait_for_listen ${SST_PORT} ${ADDR} ${MODULE} & ++ ++ trap sig_joiner_cleanup HUP PIPE INT TERM ++ trap cleanup_joiner EXIT ++ ++ if [[ -n $progress ]];then ++ adjust_progress ++ tcmd+=" | $pcmd" ++ fi ++ ++ if [[ $incremental -eq 1 ]];then ++ BDATA=$DATA ++ DATA=$(mktemp -d) ++ MAGIC_FILE="${DATA}/${INFO_FILE}" ++ fi ++ ++ get_keys ++ set +e ++ if [[ $encrypt -eq 1 && $sencrypted -eq 1 ]];then ++ strmcmd=" $ecmd | $strmcmd" ++ fi ++ ++ pushd ${DATA} 1>/dev/null ++ timeit "Joiner-Recv-Unencrypted" "$tcmd | $strmcmd; RC=( "\${PIPESTATUS[@]}" )" ++ popd 1>/dev/null ++ ++ set -e ++ ++ if [[ $sfmt == 'xbstream' ]];then ++ # Special handling till lp:1193240 is fixed" ++ if [[ ${RC[$(( ${#RC[@]}-1 ))]} -eq 1 ]];then ++ wsrep_log_error "Xbstream failed" ++ wsrep_log_error "Data directory ${DATA} may not be empty: lp:1193240" \ ++ "Manual intervention required in that case" ++ exit 32 ++ fi ++ fi ++ ++ wait %% # join for wait_for_listen thread ++ ++ for ecode in "${RC[@]}";do ++ if [[ $ecode -ne 0 ]];then ++ wsrep_log_error "Error while getting data from donor node: " \ ++ "exit codes: ${RC[@]}" ++ exit 32 ++ fi ++ done ++ ++ if [ ! -r "${MAGIC_FILE}" ] ++ then ++ # this message should cause joiner to abort ++ wsrep_log_error "xtrabackup process ended without creating '${MAGIC_FILE}'" ++ wsrep_log_info "Contents of datadir" ++ wsrep_log_info "$(ls -l ${DATA}/**/*)" ++ exit 32 ++ fi ++ ++ if ! ps -p ${WSREP_SST_OPT_PARENT} &>/dev/null ++ then ++ wsrep_log_error "Parent mysqld process (PID:${WSREP_SST_OPT_PARENT}) terminated unexpectedly." ++ exit 32 ++ fi ++ ++ if [ ! -r "${DATA}/${IST_FILE}" ] ++ then ++ wsrep_log_info "Proceeding with SST" ++ wsrep_log_info "Removing existing ib_logfile files" ++ if [[ $incremental -ne 1 ]];then ++ rm -f ${DATA}/ib_logfile* ++ else ++ rm -f ${BDATA}/ib_logfile* ++ fi ++ ++ get_proc ++ ++ # Rebuild indexes for compact backups ++ if grep -q 'compact = 1' ${DATA}/xtrabackup_checkpoints;then ++ wsrep_log_info "Index compaction detected" ++ rebuild=1 ++ fi ++ ++ if [[ $rebuild -eq 1 ]];then ++ nthreads=$(parse_cnf xtrabackup rebuild-threads $nproc) ++ wsrep_log_info "Rebuilding during prepare with $nthreads threads" ++ rebuildcmd="--rebuild-indexes --rebuild-threads=$nthreads" ++ fi ++ ++ if test -n "$(find ${DATA} -maxdepth 1 -type f -name '*.qp' -print -quit)";then ++ ++ wsrep_log_info "Compressed qpress files found" ++ ++ if [[ ! -x `which qpress` ]];then ++ wsrep_log_error "qpress not found in path: $PATH" ++ exit 22 ++ fi ++ ++ if [[ -n $progress ]] && pv --help | grep -q 'line-mode';then ++ count=$(find ${DATA} -type f -name '*.qp' | wc -l) ++ count=$(( count*2 )) ++ if pv --help | grep -q FORMAT;then ++ pvopts="-f -s $count -l -N Decompression -F '%N => Rate:%r Elapsed:%t %e Progress: [%b/$count]'" ++ else ++ pvopts="-f -s $count -l -N Decompression" ++ fi ++ pcmd="pv $pvopts" ++ adjust_progress ++ dcmd="$pcmd | xargs -n 2 qpress -T${nproc}d" ++ else ++ dcmd="xargs -n 2 qpress -T${nproc}d" ++ fi ++ ++ wsrep_log_info "Removing existing ibdata1 file" ++ rm -f ${DATA}/ibdata1 ++ ++ # Decompress the qpress files ++ wsrep_log_info "Decompression with $nproc threads" ++ timeit "Decompression" "find ${DATA} -type f -name '*.qp' -printf '%p\n%h\n' | $dcmd" ++ extcode=$? ++ ++ if [[ $extcode -eq 0 ]];then ++ wsrep_log_info "Removing qpress files after decompression" ++ find ${DATA} -type f -name '*.qp' -delete ++ if [[ $? -ne 0 ]];then ++ wsrep_log_error "Something went wrong with deletion of qpress files. Investigate" ++ fi ++ else ++ wsrep_log_error "Decompression failed. Exit code: $extcode" ++ exit 22 ++ fi ++ fi ++ ++ if [[ $incremental -eq 1 ]];then ++ # Added --ibbackup=xtrabackup_55 because it fails otherwise citing connection issues. ++ INNOAPPLY="${INNOBACKUPEX_BIN} --defaults-file=${WSREP_SST_OPT_CONF} \ ++ --ibbackup=xtrabackup_55 --apply-log $rebuildcmd --redo-only $BDATA --incremental-dir=${DATA} &>>${BDATA}/innobackup.prepare.log" ++ fi ++ ++ wsrep_log_info "Preparing the backup at ${DATA}" ++ timeit "Xtrabackup prepare stage" "$INNOAPPLY" ++ ++ if [[ $incremental -eq 1 ]];then ++ wsrep_log_info "Cleaning up ${DATA} after incremental SST" ++ [[ -d ${DATA} ]] && rm -rf ${DATA} ++ DATA=$BDATA ++ fi ++ ++ if [ $? -ne 0 ]; ++ then ++ wsrep_log_error "${INNOBACKUPEX_BIN} finished with errors. Check ${DATA}/innobackup.prepare.log" ++ exit 22 ++ fi ++ else ++ wsrep_log_info "${IST_FILE} received from donor: Running IST" ++ fi ++ ++ if [[ ! -r ${MAGIC_FILE} ]];then ++ wsrep_log_error "SST magic file ${MAGIC_FILE} not found/readable" ++ exit 2 ++ fi ++ ++ cat "${MAGIC_FILE}" # output UUID:seqno ++ wsrep_log_info "Total time on joiner: $totime seconds" ++fi ++ ++exit 0 +diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt +index 3eeb07d..a63d98e 100644 +--- a/sql/CMakeLists.txt ++++ b/sql/CMakeLists.txt +@@ -13,6 +13,10 @@ + # along with this program; if not, write to the Free Software + # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + ++IF(WITH_WSREP) ++ SET(WSREP_INCLUDES ${CMAKE_SOURCE_DIR}/wsrep) ++ENDIF() ++ + INCLUDE_DIRECTORIES( + ${CMAKE_SOURCE_DIR}/include + ${CMAKE_SOURCE_DIR}/sql +@@ -20,6 +24,7 @@ INCLUDE_DIRECTORIES( + ${ZLIB_INCLUDE_DIR} + ${SSL_INCLUDE_DIRS} + ${CMAKE_BINARY_DIR}/sql ++ ${WSREP_INCLUDES} + ) + + SET(GEN_SOURCES +@@ -171,7 +176,24 @@ SET(SQL_SHARED_SOURCES + + SET(SQL_EXPORTED_SOURCES ${SQL_SHARED_SOURCES} PARENT_SCOPE) + ++IF(WITH_WSREP) ++ SET(WSREP_SOURCES ++ wsrep_check_opts.cc ++ wsrep_hton.cc ++ wsrep_mysqld.cc ++ wsrep_notify.cc ++ wsrep_sst.cc ++ wsrep_utils.cc ++ wsrep_var.cc ++ wsrep_binlog.cc ++ wsrep_applier.cc ++ wsrep_thd.cc ++ ) ++ SET(WSREP_LIB wsrep) ++ENDIF() ++ + SET(SQL_SOURCE ++ ${WSREP_SOURCES} + ${GEN_SOURCES} + ${MYSYS_LIBWRAP_SOURCE} + ${SQL_SHARED_SOURCES} +@@ -208,6 +230,7 @@ DTRACE_INSTRUMENT(sql) + TARGET_LINK_LIBRARIES(sql ${MYSQLD_STATIC_PLUGIN_LIBS} + mysys mysys_ssl dbug strings vio regex + ${LIBWRAP} ${LIBCRYPT} ${LIBDL} ++ ${WSREP_LIB} + ${SSL_LIBRARIES}) + + # +@@ -246,7 +269,6 @@ ADD_LIBRARY(sqlgunitlib + ) + ADD_DEPENDENCIES(sqlgunitlib GenError) + +- + IF(WIN32) + SET(MYSQLD_SOURCE main.cc nt_servc.cc nt_servc.h message.rc) + ELSE() +diff --git a/sql/binlog.cc b/sql/binlog.cc +index d1babfe..bbf87dd 100644 +--- a/sql/binlog.cc ++++ b/sql/binlog.cc +@@ -60,7 +60,11 @@ static ulonglong limit_unsafe_suppression_start_time= 0; + static bool unsafe_warning_suppression_is_activated= false; + static int limit_unsafe_warning_count= 0; + ++#ifndef WITH_WSREP + static handlerton *binlog_hton; ++#else ++handlerton *binlog_hton; // we need it in wsrep_binlog.cc ++#endif + bool opt_binlog_order_commits= true; + + const char *log_bin_index= 0; +@@ -795,7 +799,9 @@ static binlog_cache_mngr *thd_get_cache_mngr(const THD *thd) + If opt_bin_log is not set, binlog_hton->slot == -1 and hence + thd_get_ha_data(thd, hton) segfaults. + */ ++#ifndef WITH_WSREP + DBUG_ASSERT(opt_bin_log); ++#endif + return (binlog_cache_mngr *)thd_get_ha_data(thd, binlog_hton); + } + +@@ -881,7 +887,11 @@ binlog_trans_log_savepos(THD *thd, my_off_t *pos) + DBUG_ENTER("binlog_trans_log_savepos"); + DBUG_ASSERT(pos != NULL); + binlog_cache_mngr *const cache_mngr= thd_get_cache_mngr(thd); ++#ifdef WITH_WSREP ++ DBUG_ASSERT((WSREP_EMULATE_BINLOG(thd)) || mysql_bin_log.is_open()); ++#else + DBUG_ASSERT(mysql_bin_log.is_open()); ++#endif /* WITH_WSREP */ + *pos= cache_mngr->trx_cache.get_byte_position(); + DBUG_PRINT("return", ("position: %lu", (ulong) *pos)); + DBUG_VOID_RETURN; +@@ -897,7 +907,16 @@ binlog_trans_log_savepos(THD *thd, my_off_t *pos) + static int binlog_init(void *p) + { + binlog_hton= (handlerton *)p; ++#ifdef WITH_WSREP ++ if (WSREP_ON) ++ binlog_hton->state= SHOW_OPTION_YES; ++ else ++ { ++#endif /* WITH_WSREP */ + binlog_hton->state=opt_bin_log ? SHOW_OPTION_YES : SHOW_OPTION_NO; ++#ifdef WITH_WSREP ++ } ++#endif /* WITH_WSREP */ + binlog_hton->db_type=DB_TYPE_BINLOG; + binlog_hton->savepoint_offset= sizeof(my_off_t); + binlog_hton->close_connection= binlog_close_connection; +@@ -912,10 +931,30 @@ static int binlog_init(void *p) + return 0; + } + ++#ifdef WITH_WSREP ++#include "wsrep_binlog.h" ++#endif /* WITH_WSREP */ + static int binlog_close_connection(handlerton *hton, THD *thd) + { + DBUG_ENTER("binlog_close_connection"); + binlog_cache_mngr *const cache_mngr= thd_get_cache_mngr(thd); ++#ifdef WITH_WSREP ++ if (!cache_mngr->is_binlog_empty()) { ++ IO_CACHE* cache= get_trans_log(thd); ++ uchar *buf; ++ size_t len=0; ++ wsrep_write_cache_buf(cache, &buf, &len); ++ WSREP_WARN("binlog trx cache not empty (%lu bytes) @ connection close %lu", ++ len, thd->thread_id); ++ if (len > 0) wsrep_dump_rbr_buf(thd, buf, len); ++ ++ cache = cache_mngr->get_binlog_cache_log(false); ++ wsrep_write_cache_buf(cache, &buf, &len); ++ WSREP_WARN("binlog stmt cache not empty (%lu bytes) @ connection close %lu", ++ len, thd->thread_id); ++ if (len > 0) wsrep_dump_rbr_buf(thd, buf, len); ++ } ++#endif /* WITH_WSREP */ + DBUG_ASSERT(cache_mngr->is_binlog_empty()); + DBUG_ASSERT(cache_mngr->trx_cache.is_group_cache_empty() && + cache_mngr->stmt_cache.is_group_cache_empty()); +@@ -1666,7 +1705,11 @@ int MYSQL_BIN_LOG::rollback(THD *thd, bool all) + if (error == 0 && stuff_logged) + error= ordered_commit(thd, all, /* skip_commit */ true); + ++#ifdef WITH_WSREP ++ if (!WSREP_EMULATE_BINLOG(thd) && check_write_error(thd)) ++#else + if (check_write_error(thd)) ++#endif + { + /* + "all == true" means that a "rollback statement" triggered the error and +@@ -4771,6 +4814,43 @@ int MYSQL_BIN_LOG::purge_logs_before_date(time_t purge_time, bool auto_purge) + no_of_log_files_purged, no_of_log_files_to_purge); + } + ++ if (log_is_active) ++ { ++ if(!auto_purge) ++ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, ++ ER_WARN_PURGE_LOG_IS_ACTIVE, ++ ER(ER_WARN_PURGE_LOG_IS_ACTIVE), ++ log_info.log_file_name); ++ ++ } ++ ++ if (log_is_in_use) ++ { ++ int no_of_log_files_to_purge= no_of_log_files_purged+1; ++ while (strcmp(log_file_name, log_info.log_file_name)) ++ { ++ if (mysql_file_stat(m_key_file_log, log_info.log_file_name, ++ &stat_area, MYF(0))) ++ { ++ if (stat_area.st_mtime < purge_time) ++ no_of_log_files_to_purge++; ++ else ++ break; ++ } ++ if (find_next_log(&log_info, false/*need_lock_index=false*/)) ++ { ++ no_of_log_files_to_purge++; ++ break; ++ } ++ } ++ ++ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, ++ ER_WARN_PURGE_LOG_IN_USE, ++ ER(ER_WARN_PURGE_LOG_IN_USE), ++ copy_log_in_use, no_of_threads_locking_log, ++ no_of_log_files_purged, no_of_log_files_to_purge); ++ } ++ + error= (to_log[0] ? purge_logs(to_log, true, + false/*need_lock_index=false*/, + true/*need_update_threads=true*/, +@@ -5190,7 +5270,11 @@ MYSQL_BIN_LOG::flush_and_set_pending_rows_event(THD *thd, + bool is_transactional) + { + DBUG_ENTER("MYSQL_BIN_LOG::flush_and_set_pending_rows_event(event)"); ++#ifdef WITH_WSREP ++ DBUG_ASSERT(WSREP_EMULATE_BINLOG(thd) || mysql_bin_log.is_open()); ++#else + DBUG_ASSERT(mysql_bin_log.is_open()); ++#endif /* WITH_WSREP */ + DBUG_PRINT("enter", ("event: 0x%lx", (long) event)); + + int error= 0; +@@ -5265,7 +5349,13 @@ bool MYSQL_BIN_LOG::write_event(Log_event *event_info) + mostly called if is_open() *was* true a few instructions before, but it + could have changed since. + */ ++#ifdef WITH_WSREP ++ /* applier and replayer can skip writing binlog events */ ++ if ((WSREP_EMULATE_BINLOG(thd) && (thd->wsrep_exec_mode != REPL_RECV)) || ++ is_open()) ++#else + if (likely(is_open())) ++#endif + { + #ifdef HAVE_REPLICATION + /* +@@ -5412,6 +5502,15 @@ int MYSQL_BIN_LOG::rotate(bool force_rotate, bool* check_purge) + { + int error= 0; + DBUG_ENTER("MYSQL_BIN_LOG::rotate"); ++#ifdef WITH_WSREP ++ if (WSREP_ON && wsrep_to_isolation) ++ { ++ *check_purge= false; ++ WSREP_DEBUG("avoiding binlog rotate due to TO isolation: %d", ++ wsrep_to_isolation); ++ DBUG_RETURN(0); ++ } ++#endif + + DBUG_ASSERT(!is_relay_log); + mysql_mutex_assert_owner(&LOCK_log); +@@ -5898,6 +5997,9 @@ bool MYSQL_BIN_LOG::write_incident(THD *thd, bool need_lock_log, + bool MYSQL_BIN_LOG::write_cache(THD *thd, binlog_cache_data *cache_data) + { + DBUG_ENTER("MYSQL_BIN_LOG::write_cache(THD *, binlog_cache_data *, bool)"); ++#ifdef WITH_WSREP ++ if (WSREP_EMULATE_BINLOG(thd)) DBUG_RETURN(0); ++#endif /* WITH_WSREP */ + + IO_CACHE *cache= &cache_data->cache_log; + bool incident= cache_data->has_incident(); +@@ -6353,7 +6455,13 @@ TC_LOG::enum_result MYSQL_BIN_LOG::commit(THD *thd, bool all) + DBUG_ENTER("MYSQL_BIN_LOG::commit"); + + binlog_cache_mngr *cache_mngr= thd_get_cache_mngr(thd); ++#ifdef WITH_WSREP ++ my_xid xid= (wsrep_is_wsrep_xid(&thd->transaction.xid_state.xid) ? ++ wsrep_xid_seqno(&thd->transaction.xid_state.xid) : ++ thd->transaction.xid_state.xid.get_my_xid()); ++#else + my_xid xid= thd->transaction.xid_state.xid.get_my_xid(); ++#endif /* WITH_WSREP */ + int error= RESULT_SUCCESS; + bool stuff_logged= false; + +@@ -6939,6 +7047,27 @@ int MYSQL_BIN_LOG::ordered_commit(THD *thd, bool all, bool skip_commit) + my_off_t total_bytes= 0; + bool do_rotate= false; + ++#ifdef WITH_WSREP ++ if (WSREP_EMULATE_BINLOG(thd)) ++ { ++ /* ++ Skip group commit, just do storage engine commit. ++ */ ++ int rcode = ha_commit_low(thd, all); ++ ++ /* if there is myisam statement inside innodb transaction, we may ++ have events in stmt cache ++ */ ++ binlog_cache_mngr *const cache_mngr= thd_get_cache_mngr(thd); ++ if(!cache_mngr->stmt_cache.is_binlog_empty()) ++ { ++ WSREP_DEBUG("stmt transaction inside MST, SQL: %s", thd->query()); ++ cache_mngr->stmt_cache.reset(); ++ } ++ DBUG_RETURN(rcode); ++ } ++#endif /* WITH_WSREP */ ++ + /* + These values are used while flushing a transaction, so clear + everything. +@@ -7143,6 +7272,24 @@ int MYSQL_BIN_LOG::recover(IO_CACHE *log, Format_description_log_event *fdle, + */ + bool in_transaction= FALSE; + ++#ifdef WITH_WSREP ++ /* ++ Read current wsrep position from storage engines to have consistent ++ end position for binlog scan. ++ */ ++ XID xid; ++ memset(&xid, 0, sizeof(xid)); ++ xid.formatID= -1; ++ wsrep_get_SE_checkpoint(&xid); ++ char uuid_str[40]; ++ wsrep_uuid_print(wsrep_xid_uuid(&xid), uuid_str, sizeof(uuid_str)); ++ WSREP_INFO("Binlog recovery, found wsrep position %s:%lld", uuid_str, ++ (long long)wsrep_xid_seqno(&xid)); ++ const wsrep_seqno_t last_xid_seqno= wsrep_xid_seqno(&xid); ++ wsrep_seqno_t cur_xid_seqno=WSREP_SEQNO_UNDEFINED; ++#endif /* WITH_WSREP */ ++ ++ + if (! fdle->is_valid() || + my_hash_init(&xids, &my_charset_bin, TC_LOG_PAGE_SIZE/3, 0, + sizeof(my_xid), 0, 0, MYF(0))) +@@ -7151,7 +7298,12 @@ int MYSQL_BIN_LOG::recover(IO_CACHE *log, Format_description_log_event *fdle, + init_alloc_root(&mem_root, TC_LOG_PAGE_SIZE, TC_LOG_PAGE_SIZE); + + while ((ev= Log_event::read_log_event(log, 0, fdle, TRUE)) +- && ev->is_valid()) ++ && ev->is_valid() ++#ifdef WITH_WSREP ++ && (last_xid_seqno == WSREP_SEQNO_UNDEFINED || ++ last_xid_seqno != cur_xid_seqno) ++#endif ++ ) + { + if (ev->get_type_code() == QUERY_EVENT && + !strcmp(((Query_log_event*)ev)->query, "BEGIN")) +@@ -7172,6 +7324,9 @@ int MYSQL_BIN_LOG::recover(IO_CACHE *log, Format_description_log_event *fdle, + sizeof(xev->xid)); + if (!x || my_hash_insert(&xids, x)) + goto err2; ++#ifdef WITH_WSREP ++ cur_xid_seqno= xev->xid; ++#endif /* WITH_WSREP */ + } + + /* +@@ -7216,6 +7371,11 @@ int MYSQL_BIN_LOG::recover(IO_CACHE *log, Format_description_log_event *fdle, + delete ev; + } + ++#ifdef WITH_WSREP ++ WSREP_INFO("Binlog recovery scan stopped at Xid event %lld", ++ (long long)cur_xid_seqno); ++#endif /* WITH_WSREP */ ++ + if (ha_recover(&xids)) + goto err2; + +@@ -7240,7 +7400,9 @@ Group_cache *THD::get_group_cache(bool is_transactional) + + // If opt_bin_log==0, it is not safe to call thd_get_cache_mngr + // because binlog_hton has not been completely set up. ++#ifndef WITH_WSREP + DBUG_ASSERT(opt_bin_log); ++#endif + binlog_cache_mngr *cache_mngr= thd_get_cache_mngr(this); + + // cache_mngr is NULL until we call thd->binlog_setup_trx_data, so +@@ -7433,7 +7595,12 @@ int THD::binlog_write_table_map(TABLE *table, bool is_transactional, + table->s->table_map_id.id())); + + /* Pre-conditions */ ++#ifdef WITH_WSREP ++ DBUG_ASSERT(is_current_stmt_binlog_format_row() && ++ (WSREP_EMULATE_BINLOG(this) || mysql_bin_log.is_open())); ++#else + DBUG_ASSERT(is_current_stmt_binlog_format_row() && mysql_bin_log.is_open()); ++#endif /* WITH_WSREP */ + DBUG_ASSERT(table->s->table_map_id.is_valid()); + + Table_map_log_event +@@ -7721,9 +7888,16 @@ int THD::decide_logging_format(TABLE_LIST *tables) + binlogging is off, or if the statement is filtered out from the + binlog by filtering rules. + */ ++#ifdef WITH_WSREP ++ if ((WSREP_EMULATE_BINLOG(this) || ++ (mysql_bin_log.is_open() && (variables.option_bits & OPTION_BIN_LOG))) && ++ !(WSREP_BINLOG_FORMAT(variables.binlog_format) == BINLOG_FORMAT_STMT && ++ !binlog_filter->db_ok(db))) ++#else + if (mysql_bin_log.is_open() && (variables.option_bits & OPTION_BIN_LOG) && + !(variables.binlog_format == BINLOG_FORMAT_STMT && + !binlog_filter->db_ok(db))) ++#endif /* WITH_WSREP */ + { + /* + Compute one bit field with the union of all the engine +@@ -7967,7 +8141,7 @@ int THD::decide_logging_format(TABLE_LIST *tables) + */ + my_error((error= ER_BINLOG_ROW_INJECTION_AND_STMT_ENGINE), MYF(0)); + } +- else if (variables.binlog_format == BINLOG_FORMAT_ROW && ++ else if (WSREP_BINLOG_FORMAT(variables.binlog_format) == BINLOG_FORMAT_ROW && + sqlcom_can_generate_row_events(this)) + { + /* +@@ -7996,8 +8170,8 @@ int THD::decide_logging_format(TABLE_LIST *tables) + else + { + /* binlog_format = STATEMENT */ +- if (variables.binlog_format == BINLOG_FORMAT_STMT) +- { ++ if (WSREP_BINLOG_FORMAT(variables.binlog_format) == BINLOG_FORMAT_STMT) ++ { + if (lex->is_stmt_row_injection()) + { + /* +@@ -8013,7 +8187,14 @@ int THD::decide_logging_format(TABLE_LIST *tables) + 5. Error: Cannot modify table that uses a storage engine + limited to row-logging when binlog_format = STATEMENT + */ ++#ifdef WITH_WSREP ++ if (!WSREP(this) || wsrep_exec_mode == LOCAL_STATE) ++ { ++#endif /* WITH_WSREP */ + my_error((error= ER_BINLOG_STMT_MODE_AND_ROW_ENGINE), MYF(0), ""); ++#ifdef WITH_WSREP ++ } ++#endif /* WITH_WSREP */ + } + else if (is_write && (unsafe_flags= lex->get_stmt_unsafe_flags()) != 0) + { +@@ -8159,7 +8340,7 @@ int THD::decide_logging_format(TABLE_LIST *tables) + "and binlog_filter->db_ok(db) = %d", + mysql_bin_log.is_open(), + (variables.option_bits & OPTION_BIN_LOG), +- variables.binlog_format, ++ WSREP_BINLOG_FORMAT(variables.binlog_format), + binlog_filter->db_ok(db))); + #endif + +@@ -8469,7 +8650,12 @@ int THD::binlog_write_row(TABLE* table, bool is_trans, + uchar const *record, + const uchar* extra_row_info) + { ++#ifdef WITH_WSREP ++ DBUG_ASSERT(is_current_stmt_binlog_format_row() && ++ ((WSREP_EMULATE_BINLOG(this) || mysql_bin_log.is_open()))); ++#else + DBUG_ASSERT(is_current_stmt_binlog_format_row() && mysql_bin_log.is_open()); ++#endif /* WITH_WSREP */ + + /* + Pack records into format for transfer. We are allocating more +@@ -8499,7 +8685,13 @@ int THD::binlog_update_row(TABLE* table, bool is_trans, + const uchar *after_record, + const uchar* extra_row_info) + { ++#ifdef WITH_WSREP ++ DBUG_ASSERT(is_current_stmt_binlog_format_row() && ++ ((WSREP_EMULATE_BINLOG(this) || mysql_bin_log.is_open()))); ++#else + DBUG_ASSERT(is_current_stmt_binlog_format_row() && mysql_bin_log.is_open()); ++#endif /* WITH_WSREP */ ++ + int error= 0; + + /** +@@ -8565,7 +8757,13 @@ int THD::binlog_delete_row(TABLE* table, bool is_trans, + uchar const *record, + const uchar* extra_row_info) + { ++#ifdef WITH_WSREP ++ DBUG_ASSERT(is_current_stmt_binlog_format_row() && ++ ((WSREP_EMULATE_BINLOG(this) || mysql_bin_log.is_open()))); ++#else + DBUG_ASSERT(is_current_stmt_binlog_format_row() && mysql_bin_log.is_open()); ++#endif /* WITH_WSREP */ ++ + int error= 0; + + /** +@@ -8683,7 +8881,11 @@ int THD::binlog_flush_pending_rows_event(bool stmt_end, bool is_transactional) + mode: it might be the case that we left row-based mode before + flushing anything (e.g., if we have explicitly locked tables). + */ +- if (!mysql_bin_log.is_open()) ++#ifdef WITH_WSREP ++ if (!(WSREP_EMULATE_BINLOG(this) || mysql_bin_log.is_open())) ++#else ++ if (!mysql_bin_log.is_open()) ++#endif /* WITH_WSREP */ + DBUG_RETURN(0); + + /* +@@ -8952,7 +9154,21 @@ int THD::binlog_query(THD::enum_binlog_query_type qtype, char const *query_arg, + DBUG_ENTER("THD::binlog_query"); + DBUG_PRINT("enter", ("qtype: %s query: '%s'", + show_query_type(qtype), query_arg)); ++#ifdef WITH_WSREP ++ DBUG_ASSERT(query_arg && (WSREP_EMULATE_BINLOG(this) ++ || mysql_bin_log.is_open())); ++#else + DBUG_ASSERT(query_arg && mysql_bin_log.is_open()); ++#endif /* WITH_WSREP */ ++ ++ if (get_binlog_local_stmt_filter() == BINLOG_FILTER_SET) ++ { ++ /* ++ The current statement is to be ignored, and not written to ++ the binlog. Do not call issue_unsafe_warnings(). ++ */ ++ DBUG_RETURN(0); ++ } + + if (get_binlog_local_stmt_filter() == BINLOG_FILTER_SET) + { +@@ -9056,6 +9272,72 @@ int THD::binlog_query(THD::enum_binlog_query_type qtype, char const *query_arg, + } + + #endif /* !defined(MYSQL_CLIENT) */ ++#ifdef WITH_WSREP ++IO_CACHE * get_trans_log(THD * thd) ++{ ++ binlog_cache_mngr *const cache_mngr= thd_get_cache_mngr(thd); ++ if (cache_mngr) ++ { ++ return cache_mngr->get_binlog_cache_log(true); ++ } ++ else ++ { ++ WSREP_DEBUG("binlog cache not initialized, conn :%ld", thd->thread_id); ++ return NULL; ++ } ++} ++ ++bool wsrep_trans_cache_is_empty(THD *thd) ++{ ++ binlog_cache_mngr *const cache_mngr= ++ (binlog_cache_mngr*) thd_get_ha_data(thd, binlog_hton); ++ return (!cache_mngr || cache_mngr->trx_cache.is_binlog_empty()); ++} ++ ++void thd_binlog_flush_pending_rows_event(THD *thd, bool stmt_end) ++{ ++ thd->binlog_flush_pending_rows_event(stmt_end); ++} ++void thd_binlog_trx_reset(THD * thd) ++{ ++ /* ++ todo: fix autocommit select to not call the caller ++ */ ++ if (thd_get_ha_data(thd, binlog_hton) != NULL) ++ { ++ binlog_cache_mngr *const cache_mngr= thd_get_cache_mngr(thd); ++ if (cache_mngr) ++ { ++ cache_mngr->trx_cache.reset(); ++ if (!cache_mngr->stmt_cache.is_binlog_empty()) ++ { ++ WSREP_DEBUG("pending events in stmt cache, sql: %s", thd->query()); ++ cache_mngr->stmt_cache.reset(); ++ } ++ } ++ } ++ thd->clear_binlog_table_maps(); ++} ++ ++TC_LOG::enum_result wsrep_thd_binlog_commit(THD* thd, bool all) ++{ ++ /* applier and replayer can skip binlog commit */ ++ if (WSREP_EMULATE_BINLOG(thd) && (thd->wsrep_exec_mode != REPL_RECV)) ++ return mysql_bin_log.commit(thd, all); ++ else ++ return (ha_commit_low(thd, all) ? ++ TC_LOG::RESULT_ABORTED : TC_LOG::RESULT_SUCCESS); ++} ++ ++int wsrep_thd_binlog_rollback(THD* thd, bool all) ++{ ++ /* applier and replayer can skip binlog rollback */ ++ if (WSREP_EMULATE_BINLOG(thd) && (thd->wsrep_exec_mode != REPL_RECV)) ++ return mysql_bin_log.rollback(thd, all); ++ else ++ return ha_rollback_low(thd, all); ++} ++#endif /* WITH_WSREP */ + + struct st_mysql_storage_engine binlog_storage_engine= + { MYSQL_HANDLERTON_INTERFACE_VERSION }; +diff --git a/sql/event_data_objects.cc b/sql/event_data_objects.cc +index 13a7691..139f0dc 100644 +--- a/sql/event_data_objects.cc ++++ b/sql/event_data_objects.cc +@@ -1477,8 +1477,25 @@ end: + bool save_tx_read_only= thd->tx_read_only; + thd->tx_read_only= false; + ++#ifdef WITH_WSREP ++ if (WSREP(thd)) { ++ // sql_print_information("sizeof(LEX) = %d", sizeof(struct LEX)); ++ // sizeof(LEX) = 4512, so it's relatively safe to allocate it on stack. ++ LEX lex; ++ LEX* saved = thd->lex; ++ lex.sql_command = SQLCOM_DROP_EVENT; ++ thd->lex = &lex; ++ WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL); ++ thd->lex = saved; ++ } ++#endif ++ + ret= Events::drop_event(thd, dbname, name, FALSE); + ++#ifdef WITH_WSREP ++ WSREP_TO_ISOLATION_END; ++ error: ++#endif + thd->tx_read_only= save_tx_read_only; + thd->security_ctx->master_access= saved_master_access; + } +diff --git a/sql/events.cc b/sql/events.cc +index ff87dd4..25e2e04 100644 +--- a/sql/events.cc ++++ b/sql/events.cc +@@ -1139,7 +1139,20 @@ Events::load_events_from_db(THD *thd) + delete et; + goto end; + } +- ++#ifdef WITH_WSREP ++ // when SST from master node who initials event, the event status is ENABLED ++ // this is problematic because there are two nodes with same events and both enabled. ++ if (et->originator != thd->server_id) ++ { ++ store_record(table, record[1]); ++ table->field[ET_FIELD_STATUS]-> ++ store((longlong) Event_parse_data::SLAVESIDE_DISABLED, ++ TRUE); ++ (void) table->file->ha_update_row(table->record[1], table->record[0]); ++ delete et; ++ continue; ++ } ++#endif + /** + Since the Event_queue_element object could be deleted inside + Event_queue::create_event we should save the value of dropped flag +@@ -1183,7 +1196,46 @@ end: + close_mysql_tables(thd); + DBUG_RETURN(ret); + } ++#ifdef WITH_WSREP ++int wsrep_create_event_query(THD *thd, uchar** buf, size_t* buf_len) ++{ ++ String log_query; + ++ if (create_query_string(thd, &log_query)) ++ { ++ WSREP_WARN("events create string failed: %s", thd->query()); ++ return 1; ++ } ++ return wsrep_to_buf_helper(thd, log_query.ptr(), log_query.length(), buf, buf_len); ++} ++static int ++wsrep_alter_query_string(THD *thd, String *buf) ++{ ++ /* Append the "ALTER" part of the query */ ++ if (buf->append(STRING_WITH_LEN("ALTER "))) ++ return 1; ++ /* Append definer */ ++ append_definer(thd, buf, &(thd->lex->definer->user), &(thd->lex->definer->host)); ++ /* Append the left part of thd->query after event name part */ ++ if (buf->append(thd->lex->stmt_definition_begin, ++ thd->lex->stmt_definition_end - ++ thd->lex->stmt_definition_begin)) ++ return 1; ++ ++ return 0; ++} ++int wsrep_alter_event_query(THD *thd, uchar** buf, size_t* buf_len) ++{ ++ String log_query; ++ ++ if (wsrep_alter_query_string(thd, &log_query)) ++ { ++ WSREP_WARN("events alter string failed: %s", thd->query()); ++ return 1; ++ } ++ return wsrep_to_buf_helper(thd, log_query.ptr(), log_query.length(), buf, buf_len); ++} ++#endif /* WITH_WSREP */ + /** + @} (End of group Event_Scheduler) + */ +diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc +index 26172ca..f92eb5d 100644 +--- a/sql/ha_partition.cc ++++ b/sql/ha_partition.cc +@@ -411,7 +411,13 @@ const char *ha_partition::table_type() const + // we can do this since we only support a single engine type + return m_file[0]->table_type(); + } +- ++#ifdef WITH_WSREP ++int ha_partition::wsrep_db_type() const ++{ ++ // we can do this since we only support a single engine type ++ return ha_legacy_type(m_file[0]->ht); ++} ++#endif /* WITH_WSREP */ + + /* + Destructor method +diff --git a/sql/ha_partition.h b/sql/ha_partition.h +index 6b20de0..acdfeb9 100644 +--- a/sql/ha_partition.h ++++ b/sql/ha_partition.h +@@ -1244,6 +1244,9 @@ public: + ------------------------------------------------------------------------- + virtual void append_create_info(String *packet) + */ ++#ifdef WITH_WSREP ++ virtual int wsrep_db_type() const; ++#endif /* WITH_WSREP */ + }; + + #endif /* HA_PARTITION_INCLUDED */ +diff --git a/sql/handler.cc b/sql/handler.cc +index f91c04c..e39e0d8 100644 +--- a/sql/handler.cc ++++ b/sql/handler.cc +@@ -60,7 +60,9 @@ inline double log2(double x) + return (log(x) / M_LN2); + } + #endif +- ++#ifdef WITH_WSREP ++#include "wsrep_mysqld.h" ++#endif + /* + While we have legacy_db_type, we have this array to + check for dups and to find handlerton from legacy_db_type. +@@ -1219,10 +1221,27 @@ int ha_prepare(THD *thd) + { + if ((err= ht->prepare(ht, thd, all))) + { ++#ifdef WITH_WSREP ++ if (WSREP(thd) && ht->db_type== DB_TYPE_WSREP) ++ { ++ error= 1; ++ /* avoid sending error, if we need to replay */ ++ if (thd->wsrep_conflict_state!= MUST_REPLAY) ++ { ++ my_error(ER_LOCK_DEADLOCK, MYF(0), err); ++ } ++ } ++ else ++ { ++ /* not wsrep hton, bail to native mysql behavior */ ++#endif + my_error(ER_ERROR_DURING_COMMIT, MYF(0), err); + ha_rollback_trans(thd, all); + error=1; + break; ++#ifdef WITH_WSREP ++ } ++#endif + } + } + else +@@ -1233,7 +1252,6 @@ int ha_prepare(THD *thd) + } + } + } +- + DBUG_RETURN(error); + } + +@@ -1408,7 +1426,12 @@ int ha_commit_trans(THD *thd, bool all, bool ignore_global_read_lock) + MDL_EXPLICIT); + + DBUG_PRINT("debug", ("Acquire MDL commit lock")); ++#ifdef WITH_WSREP ++ if (!WSREP(thd) && ++ thd->mdl_context.acquire_lock(&mdl_request, ++#else + if (thd->mdl_context.acquire_lock(&mdl_request, ++#endif /* WITH_WSREP */ + thd->variables.lock_wait_timeout)) + { + ha_rollback_trans(thd, all); +@@ -1482,7 +1505,19 @@ int ha_commit_low(THD *thd, bool all, bool run_after_commit) + int error=0; + THD_TRANS *trans=all ? &thd->transaction.all : &thd->transaction.stmt; + Ha_trx_info *ha_info= trans->ha_list, *ha_info_next; ++ + DBUG_ENTER("ha_commit_low"); ++#ifdef WITH_WSREP ++#ifdef WSREP_PROC_INFO ++ char info[64]= { 0, }; ++ snprintf (info, sizeof(info) - 1, "ha_commit_one_phase(%lld)", ++ (long long)wsrep_thd_trx_seqno(thd)); ++#else ++ const char info[]="ha_commit_one_phase()"; ++#endif /* WSREP_PROC_INFO */ ++ char* tmp_info= NULL; ++ if (WSREP(thd)) tmp_info= (char *)thd_proc_info(thd, info); ++#endif /* WITH_WSREP */ + + if (ha_info) + { +@@ -1513,6 +1548,9 @@ int ha_commit_low(THD *thd, bool all, bool run_after_commit) + /* Free resources and perform other cleanup even for 'empty' transactions. */ + if (all) + thd->transaction.cleanup(); ++#ifdef WITH_WSREP ++ if (WSREP(thd)) thd_proc_info(thd, tmp_info); ++#endif /* WITH_WSREP */ + /* + When the transaction has been committed, we clear the commit_low + flag. This allow other parts of the system to check if commit_low +@@ -1798,7 +1836,13 @@ static my_bool xarecover_handlerton(THD *unused, plugin_ref plugin, + got, ha_resolve_storage_engine_name(hton)); + for (int i=0; i < got; i ++) + { ++#ifdef WITH_WSREP ++ my_xid x=(wsrep_is_wsrep_xid(&info->list[i]) ? ++ wsrep_xid_seqno(&info->list[i]) : ++ info->list[i].get_my_xid()); ++#else + my_xid x=info->list[i].get_my_xid(); ++#endif /* WITH_WSREP */ + if (!x) // not "mine" - that is generated by external TM + { + #ifndef DBUG_OFF +@@ -1867,7 +1911,9 @@ int ha_recover(HASH *commit_list) + for now, only InnoDB supports 2pc. It means we can always safely + rollback all pending transactions, without risking inconsistent data + */ ++#ifndef WITH_WSREP + DBUG_ASSERT(total_ha_2pc == (ulong) opt_bin_log+1); // only InnoDB and binlog ++#endif + tc_heuristic_recover= TC_HEURISTIC_RECOVER_ROLLBACK; // forcing ROLLBACK + info.dry_run=FALSE; + #endif +@@ -2103,8 +2149,35 @@ int ha_prepare_low(THD *thd, bool all) + continue; + if ((err= ht->prepare(ht, thd, all))) + { ++#ifdef WITH_WSREP ++ if (WSREP(thd) && ht->db_type== DB_TYPE_WSREP) ++ { ++ error= 1; ++ switch (err) ++ { ++ case WSREP_TRX_SIZE_EXCEEDED: ++ /* give user size exeeded erro from wsrep_api.h */ ++ my_error(ER_ERROR_DURING_COMMIT, MYF(0), WSREP_SIZE_EXCEEDED); ++ break; ++ case WSREP_TRX_CERT_FAIL: ++ case WSREP_TRX_ERROR: ++ /* avoid sending error, if we need to replay */ ++ if (thd->wsrep_conflict_state!= MUST_REPLAY) ++ { ++ my_error(ER_LOCK_DEADLOCK, MYF(0), err); ++ } ++ } ++ } ++ ++ else ++ { ++ /* not wsrep hton, bail to native mysql behavior */ ++#endif + my_error(ER_ERROR_DURING_COMMIT, MYF(0), err); + error= 1; ++#ifdef WITH_WSREP ++ } ++#endif + } + status_var_increment(thd->status_var.ha_prepare_count); + } +@@ -3336,7 +3409,12 @@ int handler::update_auto_increment() + variables->auto_increment_increment); + auto_inc_intervals_count++; + /* Row-based replication does not need to store intervals in binlog */ ++#ifdef WITH_WSREP ++ if (((WSREP_EMULATE_BINLOG(thd)) || mysql_bin_log.is_open()) && ++ !thd->is_current_stmt_binlog_format_row()) ++#else + if (mysql_bin_log.is_open() && !thd->is_current_stmt_binlog_format_row()) ++#endif /* WITH_WSREP */ + thd->auto_inc_intervals_in_cur_stmt_for_binlog.append(auto_inc_interval_for_cur_row.minimum(), + auto_inc_interval_for_cur_row.values(), + variables->auto_increment_increment); +@@ -4621,7 +4699,9 @@ int ha_enable_transaction(THD *thd, bool on) + int error=0; + DBUG_ENTER("ha_enable_transaction"); + DBUG_PRINT("enter", ("on: %d", (int) on)); +- ++#ifdef WITH_WSREP ++ if (thd->wsrep_applier) DBUG_RETURN(0); ++#endif + if ((thd->transaction.flags.enabled= on)) + { + /* +@@ -7017,7 +7097,13 @@ static bool check_table_binlog_row_based(THD *thd, TABLE *table) + return (thd->is_current_stmt_binlog_format_row() && + table->s->cached_row_logging_check && + (thd->variables.option_bits & OPTION_BIN_LOG) && ++#ifdef WITH_WSREP ++ /* applier and replayer should not binlog */ ++ ((WSREP_EMULATE_BINLOG(thd) && (thd->wsrep_exec_mode != REPL_RECV)) || ++ mysql_bin_log.is_open())); ++#else + mysql_bin_log.is_open()); ++#endif + } + + +@@ -7118,6 +7204,17 @@ int binlog_log_row(TABLE* table, + bool error= 0; + THD *const thd= table->in_use; + ++#ifdef WITH_WSREP ++ /* only InnoDB tables will be replicated through binlog emulation */ ++ if (WSREP_EMULATE_BINLOG(thd) && ++ table->file->ht->db_type != DB_TYPE_INNODB && ++ !(table->file->ht->db_type == DB_TYPE_PARTITION_DB && ++ (((ha_partition*)(table->file))->wsrep_db_type() == DB_TYPE_INNODB))) ++ // !strcmp(table->file->table_type(), "InnoDB")) ++ { ++ return 0; ++ } ++#endif /* WITH_WSREP */ + if (check_table_binlog_row_based(thd, table)) + { + DBUG_DUMP("read_set 10", (uchar*) table->read_set->bitmap, +@@ -7438,6 +7535,64 @@ void signal_log_not_needed(struct handlerton, char *log_file) + DBUG_VOID_RETURN; + } + ++#ifdef WITH_WSREP ++/** ++ @details ++ This function makes the storage engine to force the victim transaction ++ to abort. Currently, only innodb has this functionality, but any SE ++ implementing the wsrep API should provide this service to support ++ multi-master operation. ++ ++ @param bf_thd brute force THD asking for the abort ++ @param victim_thd victim THD to be aborted ++ ++ @return ++ always 0 ++*/ ++ ++int ha_wsrep_abort_transaction(THD *bf_thd, THD *victim_thd, my_bool signal) ++{ ++ DBUG_ENTER("ha_wsrep_abort_transaction"); ++ if (!WSREP(bf_thd) && ++ !(wsrep_OSU_method_options == WSREP_OSU_RSU && ++ bf_thd->wsrep_exec_mode == TOTAL_ORDER)) { ++ DBUG_RETURN(0); ++ } ++ ++ handlerton *hton= installed_htons[DB_TYPE_INNODB]; ++ if (hton && hton->wsrep_abort_transaction) ++ { ++ hton->wsrep_abort_transaction(hton, bf_thd, victim_thd, signal); ++ } ++ else ++ { ++ WSREP_WARN("cannot abort InnoDB transaction"); ++ } ++ ++ DBUG_RETURN(0); ++} ++ ++void ha_wsrep_fake_trx_id(THD *thd) ++{ ++ DBUG_ENTER("ha_wsrep_fake_trx_id"); ++ if (!WSREP(thd)) ++ { ++ DBUG_VOID_RETURN; ++ } ++ ++ handlerton *hton= installed_htons[DB_TYPE_INNODB]; ++ if (hton && hton->wsrep_fake_trx_id) ++ { ++ hton->wsrep_fake_trx_id(hton, thd); ++ } ++ else ++ { ++ WSREP_WARN("cannot get get fake InnoDB transaction ID"); ++ } ++ ++ DBUG_VOID_RETURN; ++} ++#endif /* WITH_WSREP */ + #ifdef TRANS_LOG_MGM_EXAMPLE_CODE + /* + Example of transaction log management functions based on assumption that logs +diff --git a/sql/handler.h b/sql/handler.h +index 3d7d4fa..702b291 100644 +--- a/sql/handler.h ++++ b/sql/handler.h +@@ -392,6 +392,7 @@ enum legacy_db_type + DB_TYPE_MARIA, + /** Performance schema engine. */ + DB_TYPE_PERFORMANCE_SCHEMA, ++ DB_TYPE_WSREP, + DB_TYPE_FIRST_DYNAMIC=42, + DB_TYPE_DEFAULT=127 // Must be last + }; +@@ -924,6 +925,11 @@ struct handlerton + const char *wild, bool dir, List *files); + int (*table_exists_in_engine)(handlerton *hton, THD* thd, const char *db, + const char *name); ++ int (*wsrep_abort_transaction)(handlerton *hton, THD *bf_thd, ++ THD *victim_thd, my_bool signal); ++ int (*wsrep_set_checkpoint)(handlerton *hton, const XID* xid); ++ int (*wsrep_get_checkpoint)(handlerton *hton, XID* xid); ++ void (*wsrep_fake_trx_id)(handlerton *hton, THD *thd); + int (*make_pushed_join)(handlerton *hton, THD* thd, + const AQP::Join_plan* plan); + +@@ -3332,6 +3338,9 @@ private: + extern const char *ha_row_type[]; + extern MYSQL_PLUGIN_IMPORT const char *tx_isolation_names[]; + extern MYSQL_PLUGIN_IMPORT const char *binlog_format_names[]; ++#ifdef WITH_WSREP ++extern MYSQL_PLUGIN_IMPORT const char *wsrep_binlog_format_names[]; ++#endif /* WITH_WSREP */ + extern TYPELIB tx_isolation_typelib; + extern const char *myisam_stats_method_names[]; + extern ulong total_ha, total_ha_2pc; +@@ -3440,6 +3449,10 @@ int ha_rollback_to_savepoint(THD *thd, SAVEPOINT *sv); + bool ha_rollback_to_savepoint_can_release_mdl(THD *thd); + int ha_savepoint(THD *thd, SAVEPOINT *sv); + int ha_release_savepoint(THD *thd, SAVEPOINT *sv); ++#ifdef WITH_WSREP ++int ha_wsrep_abort_transaction(THD *bf_thd, THD *victim_thd, my_bool signal); ++void ha_wsrep_fake_trx_id(THD *thd); ++#endif /* WITH_WSREP */ + + /* Build pushed joins in handlers implementing this feature */ + int ha_make_pushed_joins(THD *thd, const AQP::Join_plan* plan); +@@ -3471,6 +3484,12 @@ void ha_binlog_wait(THD *thd); + #define ha_binlog_log_query(a,b,c,d,e,f,g) do {} while (0) + #define ha_binlog_wait(a) do {} while (0) + #endif ++#ifdef WITH_WSREP ++void wsrep_brute_force_aborts(); ++#endif ++ ++/* It is required by basic binlog features on both MySQL server and libmysqld */ ++int ha_binlog_end(THD *thd); + + /* It is required by basic binlog features on both MySQL server and libmysqld */ + int ha_binlog_end(THD *thd); +diff --git a/sql/item_func.cc b/sql/item_func.cc +index e5ff0b8..9030a02 100644 +--- a/sql/item_func.cc ++++ b/sql/item_func.cc +@@ -2618,7 +2618,19 @@ void Item_func_rand::seed_random(Item *arg) + TODO: do not do reinit 'rand' for every execute of PS/SP if + args[0] is a constant. + */ ++#ifdef WITH_WSREP ++ uint32 tmp; ++ if (WSREP(current_thd)) ++ { ++ if (current_thd->wsrep_exec_mode==REPL_RECV) ++ tmp= current_thd->wsrep_rand; ++ else ++ tmp= current_thd->wsrep_rand= (uint32) arg->val_int(); ++ } else ++ tmp= (uint32) arg->val_int(); ++#else + uint32 tmp= (uint32) arg->val_int(); ++#endif + randominit(rand, (uint32) (tmp*0x10001L+55555555L), + (uint32) (tmp*0x10000001L)); + } +diff --git a/sql/lock.cc b/sql/lock.cc +index 43f2773..e3f613d 100644 +--- a/sql/lock.cc ++++ b/sql/lock.cc +@@ -83,6 +83,10 @@ + #include + #include + ++#ifdef WITH_WSREP ++#include "wsrep_mysqld.h" ++#endif /* WITH_WSREP */ ++ + /** + @defgroup Locking Locking + @{ +@@ -314,6 +318,10 @@ MYSQL_LOCK *mysql_lock_tables(THD *thd, TABLE **tables, uint count, uint flags) + /* Copy the lock data array. thr_multi_lock() reorders its contents. */ + memcpy(sql_lock->locks + sql_lock->lock_count, sql_lock->locks, + sql_lock->lock_count * sizeof(*sql_lock->locks)); ++#ifdef WITH_WSREP ++ //thd->main_lock_id.info->in_lock_tables= thd->in_lock_tables; ++ thd->lock_info.in_lock_tables= thd->in_lock_tables; ++#endif /* Lock on the copied half of the lock data array. */ + /* Lock on the copied half of the lock data array. */ + rc= thr_lock_errno_to_mysql[(int) thr_multi_lock(sql_lock->locks + + sql_lock->lock_count, +@@ -1014,11 +1022,15 @@ void Global_read_lock::unlock_global_read_lock(THD *thd) + { + thd->mdl_context.release_lock(m_mdl_blocks_commits_lock); + m_mdl_blocks_commits_lock= NULL; ++#ifdef WITH_WSREP ++ wsrep_locked_seqno= WSREP_SEQNO_UNDEFINED; ++ wsrep->resume(wsrep); ++#endif /* WITH_WSREP */ + } + thd->mdl_context.release_lock(m_mdl_global_shared_lock); + m_mdl_global_shared_lock= NULL; + m_state= GRL_NONE; +- ++ + DBUG_VOID_RETURN; + } + +@@ -1046,6 +1058,20 @@ bool Global_read_lock::make_global_read_lock_block_commit(THD *thd) + If we didn't succeed lock_global_read_lock(), or if we already suceeded + make_global_read_lock_block_commit(), do nothing. + */ ++ ++#ifdef WITH_WSREP ++ if (m_mdl_blocks_commits_lock) ++ { ++ WSREP_DEBUG("GRL was in block commit mode when entering " ++ "make_global_read_lock_block_commit"); ++ thd->mdl_context.release_lock(m_mdl_blocks_commits_lock); ++ m_mdl_blocks_commits_lock= NULL; ++ wsrep_locked_seqno= WSREP_SEQNO_UNDEFINED; ++ wsrep->resume(wsrep); ++ m_state= GRL_ACQUIRED; ++ } ++#endif /* WITH_WSREP */ ++ + if (m_state != GRL_ACQUIRED) + DBUG_RETURN(0); + +@@ -1058,6 +1084,22 @@ bool Global_read_lock::make_global_read_lock_block_commit(THD *thd) + m_mdl_blocks_commits_lock= mdl_request.ticket; + m_state= GRL_ACQUIRED_AND_BLOCKS_COMMIT; + ++#ifdef WITH_WSREP ++ long long ret = wsrep->pause(wsrep); ++ if (ret >= 0) ++ { ++ wsrep_locked_seqno= ret; ++ } ++ else if (ret != -ENOSYS) /* -ENOSYS - no provider */ ++ { ++ WSREP_ERROR("Failed to pause provider: %lld (%s)", -ret, strerror(-ret)); ++ ++ /* m_mdl_blocks_commits_lock is always NULL here */ ++ wsrep_locked_seqno= WSREP_SEQNO_UNDEFINED; ++ my_error(ER_LOCK_DEADLOCK, MYF(0)); ++ DBUG_RETURN(TRUE); ++ } ++#endif /* WITH_WSREP */ + DBUG_RETURN(FALSE); + } + +diff --git a/sql/log.cc b/sql/log.cc +index 808c176..caa23d2 100644 +--- a/sql/log.cc ++++ b/sql/log.cc +@@ -39,6 +39,9 @@ + #include + #include + #include // For test_if_number ++#ifdef WITH_WSREP ++#include "wsrep_mysqld.h" ++#endif /* WITH_WSREP */ + + #ifdef _WIN32 + #include "message.h" +@@ -300,7 +303,6 @@ bool LOGGER::is_log_table_enabled(uint log_table_type) + } + } + +- + /* Check if a given table is opened log table */ + int check_if_log_table(size_t db_len, const char *db, size_t table_name_len, + const char *table_name, bool check_if_opened) +@@ -2435,6 +2437,7 @@ int my_plugin_log_message(MYSQL_PLUGIN *plugin_ptr, plugin_log_level level, + + /********* transaction coordinator log for 2pc - mmap() based solution *******/ + ++ + /* + the log consists of a file, mmapped to a memory. + file is divided on pages of tc_log_page_size size. +@@ -2550,8 +2553,14 @@ int TC_LOG_MMAP::open(const char *opt_name) + mysql_mutex_init(key_PAGE_lock, &pg->lock, MY_MUTEX_INIT_FAST); + mysql_cond_init(key_PAGE_cond, &pg->cond, 0); + pg->start=(my_xid *)(data + i*tc_log_page_size); ++#ifdef WITH_WSREP ++ if (!WSREP_ON) ++#endif /* WITH_WSREP */ + pg->end=(my_xid *)(pg->start + tc_log_page_size); + pg->size=pg->free=tc_log_page_size/sizeof(my_xid); ++#ifdef WITH_WSREP ++ if (WSREP_ON) pg->end=pg->start + pg->size; ++#endif /* WITH_WSREP */ + } + pages[0].size=pages[0].free= + (tc_log_page_size-TC_LOG_HEADER_SIZE)/sizeof(my_xid); +diff --git a/sql/log.h b/sql/log.h +index 6536c9e..aaefce9 100644 +--- a/sql/log.h ++++ b/sql/log.h +@@ -104,6 +104,14 @@ class TC_LOG + virtual int prepare(THD *thd, bool all) = 0; + }; + ++#ifdef WITH_WSREP ++/* ++ Wrappers to MYSQL_BIN_LOG commit()/rollback() when wsrep_emulate_bin_log ++ is on. ++ */ ++TC_LOG::enum_result wsrep_thd_binlog_commit(THD* thd, bool all); ++int wsrep_thd_binlog_rollback(THD * thd, bool all); ++#endif /* WITH_WSREP */ + + class TC_LOG_DUMMY: public TC_LOG // use it to disable the logging + { +@@ -112,10 +120,18 @@ public: + int open(const char *opt_name) { return 0; } + void close() { } + enum_result commit(THD *thd, bool all) { ++#ifdef WITH_WSREP ++ return wsrep_thd_binlog_commit(thd, all); ++#else + return ha_commit_low(thd, all) ? RESULT_ABORTED : RESULT_SUCCESS; ++#endif /* WITH_WSREP */ + } + int rollback(THD *thd, bool all) { ++#ifdef WITH_WSREP ++ return wsrep_thd_binlog_rollback(thd, all); ++#else + return ha_rollback_low(thd, all); ++#endif /* WITH_WSREP */ + } + int prepare(THD *thd, bool all) { + return ha_prepare_low(thd, all); +@@ -542,12 +558,28 @@ enum enum_binlog_row_image { + }; + + enum enum_binlog_format { ++ /* ++ statement-based except for cases where only row-based can work (UUID() ++ etc): ++ */ + BINLOG_FORMAT_MIXED= 0, ///< statement if safe, otherwise row - autodetected + BINLOG_FORMAT_STMT= 1, ///< statement-based + BINLOG_FORMAT_ROW= 2, ///< row-based + BINLOG_FORMAT_UNSPEC=3 ///< thd_binlog_format() returns it when binlog is closed + }; + ++#ifdef WITH_WSREP ++IO_CACHE* get_trans_log(THD * thd); ++bool wsrep_trans_cache_is_empty(THD *thd); ++void thd_binlog_flush_pending_rows_event(THD *thd, bool stmt_end); ++void thd_binlog_trx_reset(THD * thd); ++ ++#define WSREP_BINLOG_FORMAT(my_format) \ ++ ((wsrep_forced_binlog_format != BINLOG_FORMAT_UNSPEC) ? \ ++ wsrep_forced_binlog_format : my_format) ++#else ++#define WSREP_BINLOG_FORMAT(my_format) my_format ++#endif /* WITH_WSREP */ + int query_error_code(THD *thd, bool not_killed); + uint purge_log_get_error_code(int res); + +diff --git a/sql/log_event.cc b/sql/log_event.cc +index d4176cb..9173566 100644 +--- a/sql/log_event.cc ++++ b/sql/log_event.cc +@@ -45,6 +45,9 @@ + #include "rpl_rli_pdb.h" + #include "sql_show.h" // append_identifier + #include ++#if WITH_WSREP ++#include "wsrep_mysqld.h" ++#endif + #define window_size Log_throttle::LOG_THROTTLE_WINDOW_SIZE + Error_log_throttle + slave_ignored_err_throttle(window_size, +@@ -3583,6 +3586,14 @@ Query_log_event::Query_log_event(THD* thd_arg, const char* query_arg, + master_data_written(0), mts_accessed_dbs(0) + { + ++#ifdef WITH_WSREP ++ /* ++ If Query_log_event will contain non trans keyword (not BEGIN, COMMIT, ++ SAVEPOINT or ROLLBACK) we disable PA for this transaction. ++ */ ++ if (!is_trans_keyword()) ++ thd->wsrep_PA_safe= false; ++#endif /* WITH_WSREP */ + memset(&user, 0, sizeof(user)); + memset(&host, 0, sizeof(host)); + +@@ -11160,6 +11171,18 @@ int Rows_log_event::do_apply_event(Relay_log_info const *rli) + if (open_and_lock_tables(thd, rli->tables_to_lock, FALSE, 0)) + { + uint actual_error= thd->get_stmt_da()->sql_errno(); ++#ifdef WITH_WSREP ++ if (WSREP(thd)) ++ { ++ WSREP_WARN("BF applier failed to open_and_lock_tables: %u, fatal: %d " ++ "wsrep = (exec_mode: %d conflict_state: %d seqno: %lld)", ++ thd->get_stmt_da()->sql_errno(), ++ thd->is_fatal_error, ++ thd->wsrep_exec_mode, ++ thd->wsrep_conflict_state, ++ (long long)wsrep_thd_trx_seqno(thd)); ++ } ++#endif + if (thd->is_slave_error || thd->is_fatal_error) + { + /* +@@ -12132,7 +12155,12 @@ check_table_map(Relay_log_info const *rli, RPL_TABLE_LIST *table_list) + DBUG_ENTER("check_table_map"); + enum_tbl_map_status res= OK_TO_PROCESS; + ++#ifdef WITH_WSREP ++ if ((rli->info_thd->slave_thread /* filtering is for slave only */ || ++ (WSREP(rli->info_thd) && rli->info_thd->wsrep_applier)) && ++#else + if (rli->info_thd->slave_thread /* filtering is for slave only */ && ++#endif /* WITH_WSREP */ + (!rpl_filter->db_ok(table_list->db) || + (rpl_filter->is_on() && !rpl_filter->tables_ok("", table_list)))) + res= FILTERED_OUT; +@@ -12865,8 +12893,23 @@ int + Write_rows_log_event::do_exec_row(const Relay_log_info *const rli) + { + DBUG_ASSERT(m_table != NULL); ++#ifdef WITH_WSREP ++#ifdef WSREP_PROC_INFO ++ char info[64]; ++ info[sizeof(info) - 1] = '\0'; ++ snprintf(info, sizeof(info) - 1, "Write_rows_log_event::write_row(%lld)", ++ (long long) wsrep_thd_trx_seqno(thd)); ++ const char* tmp = (WSREP(thd)) ? thd_proc_info(thd, info) : NULL; ++#else ++ const char* tmp = (WSREP(thd)) ? ++ thd_proc_info(thd,"Write_rows_log_event::write_row()") : NULL; ++#endif /* WSREP_PROC_INFO */ ++#endif /* WITH_WSREP */ + int error= write_row(rli, slave_exec_mode == SLAVE_EXEC_MODE_IDEMPOTENT); + ++#ifdef WITH_WSREP ++ if (WSREP(thd)) thd_proc_info(thd, tmp); ++#endif /* WITH_WSREP */ + if (error && !thd->is_error()) + { + DBUG_ASSERT(0); +diff --git a/sql/mdl.cc b/sql/mdl.cc +index 70a33ab..ea79bec 100644 +--- a/sql/mdl.cc ++++ b/sql/mdl.cc +@@ -24,6 +24,17 @@ + #include + #include + ++#ifdef WITH_WSREP ++#include "wsrep_mysqld.h" ++#include "wsrep_thd.h" ++extern "C" my_thread_id wsrep_thd_thread_id(THD *thd); ++extern "C" char *wsrep_thd_query(THD *thd); ++void sql_print_information(const char *format, ...) ++ ATTRIBUTE_FORMAT(printf, 1, 2); ++extern bool ++wsrep_grant_mdl_exception(MDL_context *requestor_ctx, ++ MDL_ticket *ticket); ++#endif /* WITH_WSREP */ + #ifdef HAVE_PSI_INTERFACE + static PSI_mutex_key key_MDL_map_mutex; + static PSI_mutex_key key_MDL_wait_LOCK_wait_status; +@@ -1389,11 +1400,54 @@ void MDL_lock::Ticket_list::add_ticket(MDL_ticket *ticket) + called by other threads. + */ + DBUG_ASSERT(ticket->get_lock()); ++#ifdef WITH_WSREP ++ if ((this == &(ticket->get_lock()->m_waiting)) && ++ wsrep_thd_is_BF((void *)(ticket->get_ctx()->wsrep_get_thd()), false)) ++ { ++ Ticket_iterator itw(ticket->get_lock()->m_waiting); ++ Ticket_iterator itg(ticket->get_lock()->m_granted); ++ ++ MDL_ticket *waiting, *granted; ++ MDL_ticket *prev=NULL; ++ bool added= false; ++ ++ while ((waiting= itw++) && !added) ++ { ++ if (!wsrep_thd_is_BF((void *)(waiting->get_ctx()->wsrep_get_thd()), true)) ++ { ++ WSREP_DEBUG("MDL add_ticket inserted before: %lu %s", ++ wsrep_thd_thread_id(waiting->get_ctx()->wsrep_get_thd()), ++ wsrep_thd_query(waiting->get_ctx()->wsrep_get_thd())); ++ m_list.insert_after(prev, ticket); ++ added= true; ++ } ++ prev= waiting; ++ } ++ if (!added) m_list.push_back(ticket); ++ ++ while ((granted= itg++)) ++ { ++ if (granted->get_ctx() != ticket->get_ctx() && ++ granted->is_incompatible_when_granted(ticket->get_type())) ++ { ++ if (!wsrep_grant_mdl_exception(ticket->get_ctx(), granted)) ++ { ++ WSREP_DEBUG("MDL victim killed at add_ticket"); ++ } ++ } ++ } ++ } ++ else ++ { ++#endif /* WITH_WSREP */ + /* + Add ticket to the *back* of the queue to ensure fairness + among requests with the same priority. + */ + m_list.push_back(ticket); ++#ifdef WITH_WSREP ++ } ++#endif /* WITH_WSREP */ + m_bitmap|= MDL_BIT(ticket->get_type()); + } + +@@ -1709,7 +1763,6 @@ MDL_object_lock::m_waiting_incompatible[MDL_TYPE_END] = + 0 + }; + +- + /** + Check if request for the metadata lock can be satisfied given its + current state. +@@ -1734,6 +1787,9 @@ MDL_lock::can_grant_lock(enum_mdl_type type_arg, + bool can_grant= FALSE; + bitmap_t waiting_incompat_map= incompatible_waiting_types_bitmap()[type_arg]; + bitmap_t granted_incompat_map= incompatible_granted_types_bitmap()[type_arg]; ++#ifdef WITH_WSREP ++ bool wsrep_can_grant= TRUE; ++#endif /* WITH_WSREP */ + + /* + New lock request can be satisfied iff: +@@ -1756,12 +1812,59 @@ MDL_lock::can_grant_lock(enum_mdl_type type_arg, + { + if (ticket->get_ctx() != requestor_ctx && + ticket->is_incompatible_when_granted(type_arg)) ++#ifdef WITH_WSREP ++ { ++ if (wsrep_thd_is_BF((void *)(requestor_ctx->wsrep_get_thd()),false) && ++ key.mdl_namespace() == MDL_key::GLOBAL) ++ { ++ WSREP_DEBUG("global lock granted for BF: %lu %s", ++ wsrep_thd_thread_id(requestor_ctx->wsrep_get_thd()), ++ wsrep_thd_query(requestor_ctx->wsrep_get_thd())); ++ can_grant = true; ++ } ++ else if (!wsrep_grant_mdl_exception(requestor_ctx, ticket)) ++ { ++ wsrep_can_grant= FALSE; ++ if (wsrep_log_conflicts) ++ { ++ MDL_lock * lock = ticket->get_lock(); ++ WSREP_INFO( ++ "MDL conflict db=%s table=%s ticket=%d solved by %s", ++ lock->key.db_name(), lock->key.name(), ticket->get_type(), "abort" ++ ); ++ } ++ } ++ else ++ { ++ can_grant= TRUE; ++ } ++ } ++#else + break; ++#endif /* WITH_WSREP */ + } ++#ifdef WITH_WSREP ++ if ((ticket == NULL) && wsrep_can_grant) ++#else + if (ticket == NULL) /* Incompatible locks are our own. */ ++#endif /* WITH_WSREP */ ++ + can_grant= TRUE; + } + } ++#ifdef WITH_WSREP ++ else ++ { ++ if (wsrep_thd_is_BF((void *)(requestor_ctx->wsrep_get_thd()), false) && ++ key.mdl_namespace() == MDL_key::GLOBAL) ++ { ++ WSREP_DEBUG("global lock granted for BF (waiting queue): %lu %s", ++ wsrep_thd_thread_id(requestor_ctx->wsrep_get_thd()), ++ wsrep_thd_query(requestor_ctx->wsrep_get_thd())); ++ can_grant = true; ++ } ++ } ++#endif /* WITH_WSREP */ + return can_grant; + } + +@@ -2780,6 +2883,12 @@ void MDL_context::release_locks_stored_before(enum_mdl_duration duration, + } + + ++#ifdef WITH_WSREP ++void MDL_context::release_explicit_locks() ++{ ++ release_locks_stored_before(MDL_EXPLICIT, NULL); ++} ++#endif + /** + Release all explicit locks in the context which correspond to the + same name/object as this lock request. +@@ -3068,3 +3177,32 @@ void MDL_context::set_transaction_duration_for_all_locks() + ticket->m_duration= MDL_TRANSACTION; + #endif + } ++#ifdef WITH_WSREP ++void MDL_ticket::wsrep_report(bool debug) ++{ ++ if (debug) ++ { ++ WSREP_DEBUG("MDL ticket: type: %s space: %s db: %s name: %s", ++ (get_type() == MDL_INTENTION_EXCLUSIVE) ? "intention exclusive" : ++ ((get_type() == MDL_SHARED) ? "shared" : ++ ((get_type() == MDL_SHARED_HIGH_PRIO ? "shared high prio" : ++ ((get_type() == MDL_SHARED_READ) ? "shared read" : ++ ((get_type() == MDL_SHARED_WRITE) ? "shared write" : ++ ((get_type() == MDL_SHARED_NO_WRITE) ? "shared no write" : ++ ((get_type() == MDL_SHARED_NO_READ_WRITE) ? "shared no read write" : ++ ((get_type() == MDL_EXCLUSIVE) ? "exclusive" : ++ "UNKNOWN")))))))), ++ (m_lock->key.mdl_namespace() == MDL_key::GLOBAL) ? "GLOBAL" : ++ ((m_lock->key.mdl_namespace() == MDL_key::SCHEMA) ? "SCHEMA" : ++ ((m_lock->key.mdl_namespace() == MDL_key::TABLE) ? "TABLE" : ++ ((m_lock->key.mdl_namespace() == MDL_key::TABLE) ? "FUNCTION" : ++ ((m_lock->key.mdl_namespace() == MDL_key::TABLE) ? "PROCEDURE" : ++ ((m_lock->key.mdl_namespace() == MDL_key::TABLE) ? "TRIGGER" : ++ ((m_lock->key.mdl_namespace() == MDL_key::TABLE) ? "EVENT" : ++ ((m_lock->key.mdl_namespace() == MDL_key::COMMIT) ? "COMMIT" : ++ (char *)"UNKNOWN"))))))), ++ m_lock->key.db_name(), ++ m_lock->key.name()); ++ } ++} ++#endif /* WITH_WSREP */ +diff --git a/sql/mdl.h b/sql/mdl.h +index ddbd55a..2d2502e 100644 +--- a/sql/mdl.h ++++ b/sql/mdl.h +@@ -577,6 +577,9 @@ public: + MDL_ticket *next_in_lock; + MDL_ticket **prev_in_lock; + public: ++#ifdef WITH_WSREP ++ void wsrep_report(bool debug); ++#endif /* WITH_WSREP */ + bool has_pending_conflicting_lock() const; + + MDL_context *get_ctx() const { return m_ctx; } +@@ -763,6 +766,13 @@ public: + m_tickets[MDL_EXPLICIT].is_empty()); + } + ++#ifdef WITH_WSREP ++ inline bool has_transactional_locks() const ++ { ++ return !m_tickets[MDL_TRANSACTION].is_empty(); ++ } ++#endif /* WITH_WSREP */ ++ + MDL_savepoint mdl_savepoint() + { + return MDL_savepoint(m_tickets[MDL_STATEMENT].front(), +@@ -775,6 +785,9 @@ public: + + void release_statement_locks(); + void release_transactional_locks(); ++#ifdef WITH_WSREP ++ void release_explicit_locks(); ++#endif + void rollback_to_savepoint(const MDL_savepoint &mdl_savepoint); + + MDL_context_owner *get_owner() { return m_owner; } +@@ -908,6 +921,9 @@ private: + MDL_ticket **out_ticket); + + public: ++#ifdef WITH_WSREP ++ THD *wsrep_get_thd() const { return get_thd(); } ++#endif /* WITH_WSREP */ + void find_deadlock(); + + bool visit_subgraph(MDL_wait_for_graph_visitor *dvisitor); +diff --git a/sql/mysqld.cc b/sql/mysqld.cc +index fa68613..8ed210f 100644 +--- a/sql/mysqld.cc ++++ b/sql/mysqld.cc +@@ -72,6 +72,12 @@ + #include "probes_mysql.h" + #include "scheduler.h" + #include "debug_sync.h" ++#ifdef WITH_WSREP ++#include "wsrep_mysqld.h" ++#include "wsrep_var.h" ++#include "wsrep_thd.h" ++#include "wsrep_sst.h" ++#endif + #include "sql_callback.h" + #include "opt_trace_context.h" + +@@ -483,6 +489,10 @@ ulong binlog_checksum_options; + my_bool opt_master_verify_checksum= 0; + my_bool opt_slave_sql_verify_checksum= 1; + const char *binlog_format_names[]= {"MIXED", "STATEMENT", "ROW", NullS}; ++#ifdef WITH_WSREP ++const char *wsrep_binlog_format_names[]= ++ {"MIXED", "STATEMENT", "ROW", "NONE", NullS}; ++#endif /*WITH_WSREP */ + my_bool enforce_gtid_consistency; + my_bool binlog_gtid_simple_recovery; + ulong binlog_error_action; +@@ -747,6 +757,23 @@ pthread_attr_t connection_attrib; + mysql_mutex_t LOCK_server_started; + mysql_cond_t COND_server_started; + ++#ifdef WITH_WSREP ++mysql_mutex_t LOCK_wsrep_ready; ++mysql_cond_t COND_wsrep_ready; ++mysql_mutex_t LOCK_wsrep_sst; ++mysql_cond_t COND_wsrep_sst; ++mysql_mutex_t LOCK_wsrep_sst_init; ++mysql_cond_t COND_wsrep_sst_init; ++mysql_mutex_t LOCK_wsrep_rollback; ++mysql_cond_t COND_wsrep_rollback; ++wsrep_aborting_thd_t wsrep_aborting_thd= NULL; ++mysql_mutex_t LOCK_wsrep_replaying; ++mysql_cond_t COND_wsrep_replaying; ++mysql_mutex_t LOCK_wsrep_slave_threads; ++mysql_mutex_t LOCK_wsrep_desync; ++int wsrep_replaying= 0; ++static void wsrep_close_threads(THD* thd); ++#endif /* WITH_WSREP */ + int mysqld_server_started= 0; + + File_parser_dummy_hook file_parser_dummy_hook; +@@ -1209,7 +1236,9 @@ bool mysqld_embedded=0; + bool mysqld_embedded=1; + #endif + ++#ifndef EMBEDDED_LIBRARY + static my_bool plugins_are_initialized= FALSE; ++#endif + + #ifndef DBUG_OFF + static const char* default_dbug_option; +@@ -1421,6 +1450,11 @@ static void close_connections(void) + /* We skip slave threads & scheduler on this first loop through. */ + if (tmp->slave_thread) + continue; ++#ifdef WITH_WSREP ++ /* skip wsrep system threads as well */ ++ if (WSREP(tmp) && (tmp->wsrep_exec_mode==REPL_RECV || tmp->wsrep_applier)) ++ continue; ++#endif /* WITH_WSREP */ + if (tmp->get_command() == COM_BINLOG_DUMP || + tmp->get_command() == COM_BINLOG_DUMP_GTID) + { +@@ -1523,6 +1557,33 @@ static void close_connections(void) + tmp->main_security_ctx.user : "")); + close_connection(tmp); + } ++#ifdef WITH_WSREP ++ /* ++ * TODO: this code block may turn out redundant. wsrep->disconnect() ++ * should terminate slave threads gracefully, and we don't need ++ * to signal them here. ++ * The code here makes sure mysqld will not hang during shutdown ++ * even if wsrep provider has problems in shutting down. ++ */ ++ if (WSREP(tmp) && tmp->wsrep_exec_mode==REPL_RECV) ++ { ++ sql_print_information("closing wsrep system thread"); ++ tmp->killed= THD::KILL_CONNECTION; ++ MYSQL_CALLBACK(thread_scheduler, post_kill_notification, (tmp)); ++ if (tmp->mysys_var) ++ { ++ tmp->mysys_var->abort=1; ++ mysql_mutex_lock(&tmp->mysys_var->mutex); ++ if (tmp->mysys_var->current_cond) ++ { ++ mysql_mutex_lock(tmp->mysys_var->current_mutex); ++ mysql_cond_broadcast(tmp->mysys_var->current_cond); ++ mysql_mutex_unlock(tmp->mysys_var->current_mutex); ++ } ++ mysql_mutex_unlock(&tmp->mysys_var->mutex); ++ } ++ } ++#endif + } + DBUG_PRINT("quit",("Unlocking LOCK_thread_count")); + mysql_mutex_unlock(&LOCK_thread_count); +@@ -1672,8 +1733,14 @@ static void __cdecl kill_server(int sig_ptr) + } + } + #endif ++#ifdef WITH_WSREP ++ if (WSREP_ON) wsrep_stop_replication(NULL); ++#endif + + close_connections(); ++#ifdef WITH_WSREP ++ if (WSREP_ON) wsrep_deinit(); ++#endif + if (sig != MYSQL_KILL_SIGNAL && + sig != 0) + unireg_abort(1); /* purecov: inspected */ +@@ -1768,6 +1835,23 @@ extern "C" void unireg_abort(int exit_code) + usage(); + if (exit_code) + sql_print_error("Aborting\n"); ++ ++#ifdef WITH_WSREP ++ if (wsrep) ++ { ++ /* This is an abort situation, we cannot expect to gracefully close all ++ * wsrep threads here, we can only diconnect from service */ ++ wsrep_close_client_connections(FALSE); ++ shutdown_in_progress= 1; ++ THD* thd(0); ++ wsrep->disconnect(wsrep); ++ WSREP_INFO("Service disconnected."); ++ wsrep_close_threads(thd); /* this won't close all threads */ ++ sleep(1); /* so give some time to exit for those which can */ ++ WSREP_INFO("Some threads may fail to exit."); ++ } ++#endif // WITH_WSREP ++ + clean_up(!opt_help && (exit_code || !opt_bootstrap)); /* purecov: inspected */ + DBUG_PRINT("quit",("done with cleanup in unireg_abort")); + mysqld_exit(exit_code); +@@ -2015,6 +2099,20 @@ static void clean_up_mutexes() + mysql_cond_destroy(&COND_thread_cache); + mysql_cond_destroy(&COND_flush_thread_cache); + mysql_cond_destroy(&COND_manager); ++#ifdef WITH_WSREP ++ (void) mysql_mutex_destroy(&LOCK_wsrep_ready); ++ (void) mysql_cond_destroy(&COND_wsrep_ready); ++ (void) mysql_mutex_destroy(&LOCK_wsrep_sst); ++ (void) mysql_cond_destroy(&COND_wsrep_sst); ++ (void) mysql_mutex_destroy(&LOCK_wsrep_sst_init); ++ (void) mysql_cond_destroy(&COND_wsrep_sst_init); ++ (void) mysql_mutex_destroy(&LOCK_wsrep_rollback); ++ (void) mysql_cond_destroy(&COND_wsrep_rollback); ++ (void) mysql_mutex_destroy(&LOCK_wsrep_replaying); ++ (void) mysql_cond_destroy(&COND_wsrep_replaying); ++ (void) mysql_mutex_destroy(&LOCK_wsrep_slave_threads); ++ (void) mysql_mutex_destroy(&LOCK_wsrep_desync); ++#endif + } + #endif /*EMBEDDED_LIBRARY*/ + +@@ -2463,6 +2561,9 @@ static void network_init(void) + socket_errno); + unireg_abort(1); + } ++#if defined(WITH_WSREP) && defined(HAVE_FCNTL) && defined(FD_CLOEXEC) ++ (void) fcntl(mysql_socket_getfd(ip_sock), F_SETFD, FD_CLOEXEC); ++#endif /* WITH_WSREP */ + } + + #ifdef _WIN32 +@@ -2559,6 +2660,9 @@ static void network_init(void) + if (mysql_socket_listen(unix_sock, (int)back_log) < 0) + sql_print_warning("listen() on Unix socket failed with error %d", + socket_errno); ++#if defined(WITH_WSREP) && defined(HAVE_FCNTL) && defined(FD_CLOEXEC) ++ (void) fcntl(mysql_socket_getfd(unix_sock), F_SETFD, FD_CLOEXEC); ++#endif /* WITH_WSREP */ + } + #endif + DBUG_PRINT("info",("server started")); +@@ -2578,7 +2682,11 @@ static void network_init(void) + @note + For the connection that is doing shutdown, this is called twice + */ ++#ifdef WITH_WSREP ++void close_connection(THD *thd, uint sql_errno, bool lock) ++#else + void close_connection(THD *thd, uint sql_errno) ++#endif + { + DBUG_ENTER("close_connection"); + +@@ -2752,6 +2860,13 @@ bool one_thread_per_connection_end(THD *thd, bool block_pthread) + block_pthread= false; + } + ++#ifdef WITH_WSREP ++ if (WSREP(thd) && thd->wsrep_applier) ++ { ++ WSREP_DEBUG("avoiding thread re-use for applier, thd: %lu", thd->thread_id); ++ block_pthread= false; ++ } ++#endif /* WITH_WSREP */ + // Clean up errors now, before possibly waiting for a new connection. + #ifndef EMBEDDED_LIBRARY + ERR_remove_state(0); +@@ -3792,6 +3907,13 @@ int init_common_variables() + strmake(default_logfile_name, glob_hostname, + sizeof(default_logfile_name)-5); + ++#ifdef WITH_WSREP ++ if (0 == wsrep_node_name || 0 == wsrep_node_name[0]) ++ { ++ my_free((void *)wsrep_node_name); ++ wsrep_node_name= my_strdup(glob_hostname, MYF(MY_WME)); ++ } ++#endif /* WITH_WSREP */ + strmake(pidfile_name, default_logfile_name, sizeof(pidfile_name)-5); + strmov(fn_ext(pidfile_name),".pid"); // Add proper extension + +@@ -3851,7 +3973,11 @@ int init_common_variables() + compile_time_assert(sizeof(com_status_vars)/sizeof(com_status_vars[0]) - 1 == + SQLCOM_END + 8); + #endif +- ++#ifdef WITH_WSREP ++ /* This is a protection against mutually incompatible option values. */ ++ if (WSREP_ON && wsrep_check_opts (remaining_argc, remaining_argv)) ++ return 1; ++#endif /* WITH_WSREP */ + if (get_options(&remaining_argc, &remaining_argv)) + return 1; + set_server_version(); +@@ -4260,6 +4386,27 @@ static int init_thread_environment() + sql_print_error("Can't create thread-keys"); + return 1; + } ++#ifdef WITH_WSREP ++ mysql_mutex_init(key_LOCK_wsrep_ready, ++ &LOCK_wsrep_ready, MY_MUTEX_INIT_FAST); ++ mysql_cond_init(key_COND_wsrep_ready, &COND_wsrep_ready, NULL); ++ mysql_mutex_init(key_LOCK_wsrep_sst, ++ &LOCK_wsrep_sst, MY_MUTEX_INIT_FAST); ++ mysql_cond_init(key_COND_wsrep_sst, &COND_wsrep_sst, NULL); ++ mysql_mutex_init(key_LOCK_wsrep_sst_init, ++ &LOCK_wsrep_sst_init, MY_MUTEX_INIT_FAST); ++ mysql_cond_init(key_COND_wsrep_sst_init, &COND_wsrep_sst_init, NULL); ++ mysql_mutex_init(key_LOCK_wsrep_rollback, ++ &LOCK_wsrep_rollback, MY_MUTEX_INIT_FAST); ++ mysql_cond_init(key_COND_wsrep_rollback, &COND_wsrep_rollback, NULL); ++ mysql_mutex_init(key_LOCK_wsrep_replaying, ++ &LOCK_wsrep_replaying, MY_MUTEX_INIT_FAST); ++ mysql_cond_init(key_COND_wsrep_replaying, &COND_wsrep_replaying, NULL); ++ mysql_mutex_init(key_LOCK_wsrep_slave_threads, ++ &LOCK_wsrep_slave_threads, MY_MUTEX_INIT_FAST); ++ mysql_mutex_init(key_LOCK_wsrep_desync, ++ &LOCK_wsrep_desync, MY_MUTEX_INIT_FAST); ++#endif + return 0; + } + +@@ -4602,7 +4749,6 @@ initialize_storage_engine(char *se_name, const char *se_kind, + return false; + } + +- + static int init_server_components() + { + DBUG_ENTER("init_server_components"); +@@ -4700,7 +4846,11 @@ static int init_server_components() + sql_print_warning("You need to use --log-bin to make " + "--log-slave-updates work."); + } ++#ifdef WITH_WSREP ++ if (!WSREP_ON && binlog_format_used && !opt_bin_log) ++#else + if (binlog_format_used && !opt_bin_log) ++#endif + sql_print_warning("You need to use --log-bin to make " + "--binlog-format work."); + +@@ -4783,10 +4933,67 @@ a file name for --log-bin-index option", opt_binlog_index_name); + my_free(opt_bin_logname); + opt_bin_logname=my_strdup(buf, MYF(0)); + } ++#ifdef WITH_WSREP /* WSREP BEFORE SE */ ++ /* ++ Wsrep initialization must happen at this point, because: ++ - opt_bin_logname must be known when starting replication ++ since SST may need it ++ - SST may modify binlog index file, so it must be opened ++ after SST has happened ++ */ ++ } ++ if (!wsrep_recovery) ++ { ++ if (opt_bootstrap) // bootsrap option given - disable wsrep functionality ++ { ++ wsrep_provider_init(WSREP_NONE); ++ if (wsrep_init()) unireg_abort(1); ++ } ++ else // full wsrep initialization ++ { ++ // add basedir/bin to PATH to resolve wsrep script names ++ char* const tmp_path((char*)alloca(strlen(mysql_home) + ++ strlen("/bin") + 1)); ++ if (tmp_path) ++ { ++ strcpy(tmp_path, mysql_home); ++ strcat(tmp_path, "/bin"); ++ wsrep_prepend_PATH(tmp_path); ++ } ++ else ++ { ++ WSREP_ERROR("Could not append %s/bin to PATH", mysql_home); ++ } ++ ++ if (wsrep_before_SE()) ++ { ++ set_ports(); // this is also called in network_init() later but we need ++ // to know mysqld_port now - lp:1071882 ++ wsrep_init_startup(true); ++ } ++ } ++ } ++ if (opt_bin_log) ++ { ++ /* ++ Variable ln is not defined at this scope. We use opt_bin_logname instead. ++ It should be the same as ln since ++ - mysql_bin_log.generate_name() returns first argument if new log name ++ is not generated ++ - if new log name is generated, return value is assigned to ln and copied ++ to opt_bin_logname above ++ */ ++ if (mysql_bin_log.open_index_file(opt_binlog_index_name, opt_bin_logname, ++ TRUE)) ++ { ++ unireg_abort(1); ++ } ++#else + if (mysql_bin_log.open_index_file(opt_binlog_index_name, ln, TRUE)) + { + unireg_abort(1); + } ++#endif /* WITH_WSREP */ + } + + if (opt_bin_log) +@@ -4844,6 +5051,7 @@ a file name for --log-bin-index option", opt_binlog_index_name); + unireg_abort(1); + } + ++#ifdef WITH_WSREP + if (plugin_init(&remaining_argc, remaining_argv, + (opt_noacl ? PLUGIN_INIT_SKIP_PLUGIN_TABLE : 0) | + (opt_help ? PLUGIN_INIT_SKIP_INITIALIZATION : 0))) +@@ -4852,7 +5060,7 @@ a file name for --log-bin-index option", opt_binlog_index_name); + unireg_abort(1); + } + plugins_are_initialized= TRUE; /* Don't separate from init function */ +- ++#endif /* WITH_WSREP */ + /* we do want to exit if there are any other unknown options */ + if (remaining_argc > 1) + { +@@ -4947,16 +5155,34 @@ a file name for --log-bin-index option", opt_binlog_index_name); + &global_system_variables.temp_table_plugin)) + unireg_abort(1); + ++#ifdef WITH_WSREP ++ if (!opt_bin_log) ++ { ++ wsrep_emulate_bin_log= 1; ++ } ++#endif + if (total_ha_2pc > 1 || (1 == total_ha_2pc && opt_bin_log)) + { + if (opt_bin_log) + tc_log= &mysql_bin_log; + else ++#ifdef WITH_WSREP ++ if (WSREP_ON) ++ tc_log= &tc_log_dummy; ++ else ++#endif /* WITH_WSREP */ + tc_log= &tc_log_mmap; + } + else + tc_log= &tc_log_dummy; + ++#ifdef WITH_WSREP ++ WSREP_DEBUG("Initial TC log open: %s", ++ (tc_log == &mysql_bin_log) ? "binlog" : ++ (tc_log == &tc_log_mmap) ? "mmap" : ++ (tc_log == &tc_log_dummy) ? "dummy" : "unknown" ++ ); ++#endif + if (tc_log->open(opt_bin_log ? opt_bin_logname : opt_tc_log_file)) + { + sql_print_error("Can't init tc log"); +@@ -5047,8 +5273,6 @@ a file name for --log-bin-index option", opt_binlog_index_name); + init_update_queries(); + DBUG_RETURN(0); + } +- +- + #ifndef EMBEDDED_LIBRARY + + static void create_shutdown_thread() +@@ -5070,6 +5294,421 @@ static void create_shutdown_thread() + + #endif /* EMBEDDED_LIBRARY */ + ++#ifdef WITH_WSREP ++typedef void (*wsrep_thd_processor_fun)(THD *); ++ ++pthread_handler_t start_wsrep_THD(void *arg) ++{ ++ THD *thd; ++ wsrep_thd_processor_fun processor= (wsrep_thd_processor_fun)arg; ++ ++ if (my_thread_init()) ++ { ++ WSREP_ERROR("Could not initialize thread"); ++ return(NULL); ++ } ++ ++ if (!(thd= new THD(true, true))) ++ { ++ return(NULL); ++ } ++ mysql_mutex_lock(&LOCK_thread_count); ++ thd->thread_id=thread_id++; ++ ++ thd->real_id=pthread_self(); // Keep purify happy ++ add_global_thread(thd); ++ thread_created++; ++ ++ my_net_init(&thd->net,(st_vio*) 0); ++ ++ DBUG_PRINT("wsrep",(("creating thread %lld"), (long long)thd->thread_id)); ++ thd->prior_thr_create_utime= thd->start_utime= my_micro_time(); ++ (void) mysql_mutex_unlock(&LOCK_thread_count); ++ ++ /* from bootstrap()... */ ++ thd->bootstrap=1; ++ thd->max_client_packet_length= thd->net.max_packet; ++ thd->security_ctx->master_access= ~(ulong)0; ++ ++ /* from handle_one_connection... */ ++ pthread_detach_this_thread(); ++ ++ mysql_thread_set_psi_id(thd->thread_id); ++ thd->thr_create_utime= my_micro_time(); ++ if (MYSQL_CALLBACK_ELSE(thread_scheduler, init_new_connection_thread, (), 0)) ++ { ++ close_connection(thd, ER_OUT_OF_RESOURCES, 1); ++ statistic_increment(aborted_connects,&LOCK_status); ++ MYSQL_CALLBACK(thread_scheduler, end_thread, (thd, 0)); ++ ++ return(NULL); ++ } ++ ++ /* now that we've called my_thread_init(), it is safe to call DBUG_* */ ++ ++ thd->thread_stack= (char*) &thd; ++ if (thd->store_globals()) ++ { ++ close_connection(thd, ER_OUT_OF_RESOURCES, 1); ++ statistic_increment(aborted_connects,&LOCK_status); ++ MYSQL_CALLBACK(thread_scheduler, end_thread, (thd, 0)); ++ delete thd; ++ ++ return(NULL); ++ } ++ ++ /* from handle_bootstrap() */ ++ ++ thd->system_thread= SYSTEM_THREAD_SLAVE_SQL; ++ thd->security_ctx->skip_grants(); ++ ++ /* handle_one_connection() again... */ ++ //thd->version= refresh_version; ++ thd->proc_info= 0; ++ thd->set_command(COM_SLEEP); ++ thd->set_time(); ++ thd->init_for_queries(); ++ ++ mysql_mutex_lock(&LOCK_connection_count); ++ ++connection_count; ++ mysql_mutex_unlock(&LOCK_connection_count); ++ ++ processor(thd); ++ ++ close_connection(thd, 0, 1); ++ ++ // Note: We can't call THD destructor without crashing ++ // if plugins have not been initialized. However, in most of the ++ // cases this means that pre SE initialization SST failed and ++ // we are going to exit anyway. ++ if (plugins_are_initialized) ++ { ++ net_end(&thd->net); ++ MYSQL_CALLBACK(thread_scheduler, end_thread, (thd, 1)); ++ } ++ else ++ { ++ // TODO: lightweight cleanup to get rid of: ++ // 'Error in my_thread_global_end(): 2 threads didn't exit' ++ // at server shutdown ++ } ++ return(NULL); ++} ++ ++/**/ ++static bool abort_replicated(THD *thd) ++{ ++ bool ret_code= false; ++ if (thd->wsrep_query_state== QUERY_COMMITTING) ++ { ++ if (wsrep_debug) WSREP_INFO("aborting replicated trx: %lu", thd->real_id); ++ ++ (void)wsrep_abort_thd(thd, thd, TRUE); ++ ret_code= true; ++ } ++ return ret_code; ++} ++/**/ ++static inline bool is_client_connection(THD *thd) ++{ ++#if REMOVE ++// REMOVE THIS LATER (lp:777201). Below we had to add an explicit check for ++// wsrep_applier since wsrep_exec_mode didn't seem to always work ++if (thd->wsrep_applier && thd->wsrep_exec_mode != REPL_RECV) ++WSREP_WARN("applier has wsrep_exec_mode = %d", thd->wsrep_exec_mode); ++ ++ if ( thd->slave_thread || /* declared as mysql slave */ ++ thd->system_thread || /* declared as system thread */ ++ !thd->vio_ok() || /* server internal thread */ ++ thd->wsrep_exec_mode==REPL_RECV || /* applier or replaying thread */ ++ thd->wsrep_applier || /* wsrep slave applier */ ++ !thd->variables.wsrep_on) /* client, but fenced outside wsrep */ ++ return false; ++ ++ return true; ++#else ++ return (thd->wsrep_client_thread && thd->variables.wsrep_on); ++#endif /* REMOVE */ ++} ++ ++static inline bool is_replaying_connection(THD *thd) ++{ ++ bool ret; ++ ++ mysql_mutex_lock(&thd->LOCK_wsrep_thd); ++ ret= (thd->wsrep_conflict_state == REPLAYING) ? true : false; ++ mysql_mutex_unlock(&thd->LOCK_wsrep_thd); ++ ++ return ret; ++} ++ ++static inline bool is_committing_connection(THD *thd) ++{ ++ bool ret; ++ ++ mysql_mutex_lock(&thd->LOCK_wsrep_thd); ++ ret= (thd->wsrep_query_state == QUERY_COMMITTING) ? true : false; ++ mysql_mutex_unlock(&thd->LOCK_wsrep_thd); ++ ++ return ret; ++} ++ ++static bool have_client_connections() ++{ ++ Thread_iterator it= global_thread_list->begin(); ++ for (; it != global_thread_list->end(); ++it) ++ { ++ THD *tmp= *it; ++ DBUG_PRINT("quit",("Informing thread %ld that it's time to die", ++ tmp->thread_id)); ++ if (is_client_connection(tmp) && tmp->killed == THD::KILL_CONNECTION) ++ { ++ (void)abort_replicated(tmp); ++ return true; ++ } ++ } ++ return false; ++} ++ ++/* ++ returns the number of wsrep appliers running. ++ However, the caller (thd parameter) is not taken in account ++ */ ++static int have_wsrep_appliers(THD *thd) ++{ ++ int ret= 0; ++ ++ Thread_iterator it= global_thread_list->begin(); ++ for (; it != global_thread_list->end(); ++it) ++ { ++ THD *tmp= *it; ++ ret+= (tmp != thd && tmp->wsrep_applier); ++ } ++ return ret; ++} ++ ++static void wsrep_close_thread(THD *thd) ++{ ++ thd->killed= THD::KILL_CONNECTION; ++ MYSQL_CALLBACK(thread_scheduler, post_kill_notification, (thd)); ++ if (thd->mysys_var) ++ { ++ thd->mysys_var->abort=1; ++ mysql_mutex_lock(&thd->mysys_var->mutex); ++ if (thd->mysys_var->current_cond) ++ { ++ mysql_mutex_lock(thd->mysys_var->current_mutex); ++ mysql_cond_broadcast(thd->mysys_var->current_cond); ++ mysql_mutex_unlock(thd->mysys_var->current_mutex); ++ } ++ mysql_mutex_unlock(&thd->mysys_var->mutex); ++ } ++} ++ ++static my_bool have_committing_connections() ++{ ++ Thread_iterator it= global_thread_list->begin(); ++ for (; it != global_thread_list->end(); ++it) ++ { ++ THD *tmp= *it; ++ ++ if (!is_client_connection(tmp)) ++ continue; ++ ++ if (is_committing_connection(tmp)) ++ { ++ return TRUE; ++ } ++ } ++ return FALSE; ++} ++ ++int wsrep_wait_committing_connections_close(int wait_time) ++{ ++ int sleep_time= 100; ++ ++ while (have_committing_connections() && wait_time > 0) ++ { ++ WSREP_DEBUG("wait for committing transaction to close: %d", wait_time); ++ my_sleep(sleep_time); ++ wait_time -= sleep_time; ++ } ++ if (have_committing_connections()) ++ { ++ return 1; ++ } ++ return 0; ++} ++ ++void wsrep_close_client_connections(my_bool wait_to_end) ++{ ++ /* ++ First signal all threads that it's time to die ++ */ ++ ++ /* Kill blocked pthreads */ ++ kill_blocked_pthreads_flag++; ++ kill_blocked_pthreads(); ++ ++ mysql_mutex_lock(&LOCK_thread_count); // For unlink from list ++ ++ Thread_iterator it= global_thread_list->begin(); ++ for (; it != global_thread_list->end(); ++it) ++ { ++ THD *tmp= *it; ++ DBUG_PRINT("quit",("Informing thread %ld that it's time to die", ++ tmp->thread_id)); ++ /* We skip slave threads & scheduler on this first loop through. */ ++ if (!is_client_connection(tmp)) ++ continue; ++ ++ if (is_replaying_connection(tmp)) ++ { ++ tmp->killed= THD::KILL_CONNECTION; ++ continue; ++ } ++ ++ /* replicated transactions must be skipped */ ++ if (abort_replicated(tmp)) ++ continue; ++ ++ WSREP_DEBUG("closing connection %ld", tmp->thread_id); ++ wsrep_close_thread(tmp); ++ } ++ mysql_mutex_unlock(&LOCK_thread_count); ++ ++ if (get_thread_count() > 0) ++ sleep(2); // Give threads time to die ++ ++ mysql_mutex_lock(&LOCK_thread_count); ++ /* ++ Force remaining threads to die by closing the connection to the client ++ */ ++ ++ for (it= global_thread_list->begin(); it != global_thread_list->end(); ++it) ++ { ++ THD *tmp= *it; ++#ifndef __bsdi__ // Bug in BSDI kernel ++ if (is_client_connection(tmp) && ++ !abort_replicated(tmp) && ++ !is_replaying_connection(tmp)) ++ { ++ WSREP_INFO("killing local connection: %ld",tmp->thread_id); ++ close_connection(tmp,0,0); ++ } ++#endif ++ } ++ ++ DBUG_PRINT("quit",("Waiting for threads to die (count=%u)", get_thread_count())); ++ if (wsrep_debug) ++ WSREP_INFO("waiting for client connections to close: %u", ++ get_thread_count()); ++ ++ while (wait_to_end && have_client_connections()) ++ { ++ mysql_cond_wait(&COND_thread_count, &LOCK_thread_count); ++ DBUG_PRINT("quit",("One thread died (count=%u)", get_thread_count())); ++ } ++ ++ mysql_mutex_unlock(&LOCK_thread_count); ++ ++ /* All client connection threads have now been aborted */ ++} ++ ++void wsrep_close_applier(THD *thd) ++{ ++ WSREP_DEBUG("closing applier %ld", thd->thread_id); ++ wsrep_close_thread(thd); ++} ++ ++static void wsrep_close_threads(THD *thd) ++{ ++ mysql_mutex_lock(&LOCK_thread_count); // For unlink from list ++ ++ Thread_iterator it= global_thread_list->begin(); ++ for (; it != global_thread_list->end(); ++it) ++ { ++ THD *tmp= *it; ++ DBUG_PRINT("quit",("Informing thread %ld that it's time to die", ++ tmp->thread_id)); ++ /* We skip slave threads & scheduler on this first loop through. */ ++ if (tmp->wsrep_applier && tmp != thd) ++ { ++ WSREP_DEBUG("closing wsrep thread %ld", tmp->thread_id); ++ wsrep_close_thread (tmp); ++ } ++ } ++ ++ mysql_mutex_unlock(&LOCK_thread_count); ++} ++ ++void wsrep_close_applier_threads(int count) ++{ ++ mysql_mutex_lock(&LOCK_thread_count); // For unlink from list ++ ++ Thread_iterator it= global_thread_list->begin(); ++ for (; it != global_thread_list->end(); ++it) ++ { ++ THD *tmp= *it; ++ DBUG_PRINT("quit",("Informing thread %ld that it's time to die", ++ tmp->thread_id)); ++ /* We skip slave threads & scheduler on this first loop through. */ ++ if (tmp->wsrep_applier) ++ { ++ WSREP_DEBUG("closing wsrep applier thread %ld", tmp->thread_id); ++ tmp->wsrep_applier_closing= TRUE; ++ count--; ++ } ++ } ++ ++ mysql_mutex_unlock(&LOCK_thread_count); ++} ++ ++void wsrep_wait_appliers_close(THD *thd) ++{ ++ /* Wait for wsrep appliers to gracefully exit */ ++ mysql_mutex_lock(&LOCK_thread_count); ++ while (have_wsrep_appliers(thd) > 1) ++ // 1 is for rollbacker thread which needs to be killed explicitly. ++ // This gotta be fixed in a more elegant manner if we gonna have arbitrary ++ // number of non-applier wsrep threads. ++ { ++ mysql_cond_wait(&COND_thread_count,&LOCK_thread_count); ++ DBUG_PRINT("quit",("One applier died (count=%u)", get_thread_count())); ++ } ++ mysql_mutex_unlock(&LOCK_thread_count); ++ /* Now kill remaining wsrep threads: rollbacker */ ++ wsrep_close_threads (thd); ++ /* and wait for them to die */ ++ mysql_mutex_lock(&LOCK_thread_count); ++ while (have_wsrep_appliers(thd) > 0) ++ { ++ mysql_cond_wait(&COND_thread_count,&LOCK_thread_count); ++ DBUG_PRINT("quit",("One thread died (count=%u)", get_thread_count())); ++ } ++ mysql_mutex_unlock(&LOCK_thread_count); ++ ++ /* All wsrep applier threads have now been aborted. However, if this thread ++ is also applier, we are still running... ++ */ ++} ++ ++void wsrep_kill_mysql(THD *thd) ++{ ++ if (mysqld_server_started) ++ { ++ if (!shutdown_in_progress) ++ { ++ WSREP_INFO("starting shutdown"); ++ kill_mysql(); ++ } ++ } ++ else ++ { ++ unireg_abort(1); ++ } ++} ++#endif /* WITH_WSREP */ + + #if (defined(_WIN32) || defined(HAVE_SMEM)) && !defined(EMBEDDED_LIBRARY) + static void handle_connections_methods() +@@ -5204,6 +5843,9 @@ int mysqld_main(int argc, char **argv) + return 1; + } + #endif ++#ifdef WITH_WSREP ++ wsrep_filter_new_cluster (&argc, argv); ++#endif /* WITH_WSREP */ + + orig_argc= argc; + orig_argv= argv; +@@ -5537,6 +6179,14 @@ int mysqld_main(int argc, char **argv) + my_str_free= &my_str_free_mysqld; + my_str_realloc= &my_str_realloc_mysqld; + ++#ifdef WITH_WSREP /* WSREP AFTER SE */ ++ if (wsrep_recovery) ++ { ++ select_thread_in_use= 0; ++ wsrep_recover(); ++ unireg_abort(0); ++ } ++#endif /* WITH_WSREP */ + /* + init signals & alarm + After this we can't quit by a simple unireg_abort +@@ -5615,6 +6265,31 @@ int mysqld_main(int argc, char **argv) + if (Events::init(opt_noacl || opt_bootstrap)) + unireg_abort(1); + ++#ifdef WITH_WSREP /* WSREP AFTER SE */ ++ if (opt_bootstrap) ++ { ++ /*! bootstrap wsrep init was taken care of above */ ++ } ++ else ++ { ++ wsrep_SE_initialized(); ++ ++ if (wsrep_before_SE()) ++ { ++ /*! in case of no SST wsrep waits in view handler callback */ ++ wsrep_SE_init_grab(); ++ wsrep_SE_init_done(); ++ /*! in case of SST wsrep waits for wsrep->sst_received */ ++ wsrep_sst_continue(); ++ } ++ else ++ { ++ wsrep_init_startup (false); ++ } ++ ++ wsrep_create_appliers(wsrep_slave_threads - 1); ++ } ++#endif /* WITH_WSREP */ + if (opt_bootstrap) + { + select_thread_in_use= 0; // Allow 'kill' to work +@@ -5676,6 +6351,9 @@ int mysqld_main(int argc, char **argv) + #ifdef EXTRA_DEBUG2 + sql_print_error("Before Lock_thread_count"); + #endif ++#ifdef WITH_WSREP ++ WSREP_DEBUG("Before Lock_thread_count"); ++#endif + mysql_mutex_lock(&LOCK_thread_count); + DBUG_PRINT("quit", ("Got thread_count mutex")); + select_thread_in_use=0; // For close_connections +@@ -5941,6 +6619,9 @@ static void bootstrap(MYSQL_FILE *file) + DBUG_ENTER("bootstrap"); + + THD *thd= new THD; ++#ifdef WITH_WSREP ++ thd->variables.wsrep_on= 0; ++#endif + thd->bootstrap=1; + my_net_init(&thd->net,(st_vio*) 0); + thd->max_client_packet_length= thd->net.max_packet; +@@ -6080,7 +6761,11 @@ void create_thread_to_handle_connection(THD *thd) + my_snprintf(error_message_buff, sizeof(error_message_buff), + ER_THD(thd, ER_CANT_CREATE_THREAD), error); + net_send_error(thd, ER_CANT_CREATE_THREAD, error_message_buff, NULL); ++#ifdef WITH_WSREP ++ close_connection(thd,0,0); ++#else + close_connection(thd); ++#endif + delete thd; + return; + /* purecov: end */ +@@ -6132,7 +6817,11 @@ static void create_new_thread(THD *thd) + with no sqlstate. + A client expecting a SQLSTATE will not find any, and assume 'HY000'. + */ ++#ifdef WITH_WSREP ++ close_connection(thd, ER_CON_COUNT_ERROR, 1); ++#else + close_connection(thd, ER_CON_COUNT_ERROR); ++#endif + delete thd; + statistic_increment(connection_errors_max_connection, &LOCK_status); + DBUG_VOID_RETURN; +@@ -6352,6 +7041,9 @@ void handle_connections_sockets() + sleep(1); // Give other threads some time + continue; + } ++#if defined(WITH_WSREP) && defined(HAVE_FCNTL) && defined(FD_CLOEXEC) ++ (void) fcntl(mysql_socket_getfd(new_sock), F_SETFD, FD_CLOEXEC); ++#endif /* WITH_WSREP */ + + #ifdef HAVE_LIBWRAP + { +@@ -6531,7 +7223,11 @@ pthread_handler_t handle_connections_namedpipes(void *arg) + if (!(thd->net.vio= vio_new_win32pipe(hConnectedPipe)) || + my_net_init(&thd->net, thd->net.vio)) + { ++#ifdef WITH_WSREP ++ close_connection(thd, ER_OUT_OF_RESOURCES, 1); ++#else + close_connection(thd, ER_OUT_OF_RESOURCES); ++#endif + delete thd; + continue; + } +@@ -6726,7 +7422,11 @@ pthread_handler_t handle_connections_shared_memory(void *arg) + event_conn_closed)) || + my_net_init(&thd->net, thd->net.vio)) + { ++#ifdef WITH_WSREP ++ close_connection(thd, ER_OUT_OF_RESOURCES, 1); ++#else + close_connection(thd, ER_OUT_OF_RESOURCES); ++#endif + errmsg= 0; + goto errorconn; + } +@@ -8029,6 +8729,20 @@ SHOW_VAR status_vars[]= { + #ifdef ENABLED_PROFILING + {"Uptime_since_flush_status",(char*) &show_flushstatustime, SHOW_FUNC}, + #endif ++#ifdef WITH_WSREP ++ {"wsrep_connected", (char*) &wsrep_connected, SHOW_BOOL}, ++ {"wsrep_ready", (char*) &wsrep_ready, SHOW_BOOL}, ++ {"wsrep_cluster_state_uuid", (char*) &wsrep_cluster_state_uuid,SHOW_CHAR_PTR}, ++ {"wsrep_cluster_conf_id", (char*) &wsrep_cluster_conf_id, SHOW_LONGLONG}, ++ {"wsrep_cluster_status", (char*) &wsrep_cluster_status, SHOW_CHAR_PTR}, ++ {"wsrep_cluster_size", (char*) &wsrep_cluster_size, SHOW_LONG_NOFLUSH}, ++ {"wsrep_local_index", (char*) &wsrep_local_index, SHOW_LONG_NOFLUSH}, ++ {"wsrep_local_bf_aborts", (char*) &wsrep_show_bf_aborts, SHOW_FUNC}, ++ {"wsrep_provider_name", (char*) &wsrep_provider_name, SHOW_CHAR_PTR}, ++ {"wsrep_provider_version", (char*) &wsrep_provider_version, SHOW_CHAR_PTR}, ++ {"wsrep_provider_vendor", (char*) &wsrep_provider_vendor, SHOW_CHAR_PTR}, ++ {"wsrep", (char*) &wsrep_show_status, SHOW_FUNC}, ++#endif + {NullS, NullS, SHOW_LONG} + }; + +@@ -8356,6 +9070,10 @@ static int mysql_init_variables(void) + tmpenv = DEFAULT_MYSQL_HOME; + (void) strmake(mysql_home, tmpenv, sizeof(mysql_home)-1); + #endif ++#ifdef WITH_WSREP ++ if (WSREP_ON && wsrep_init_vars()) ++ return 1; ++#endif + return 0; + } + +@@ -8567,6 +9285,14 @@ mysqld_get_one_option(int optid, + case OPT_LOWER_CASE_TABLE_NAMES: + lower_case_table_names_used= 1; + break; ++#ifdef WITH_WSREP ++ case OPT_WSREP_START_POSITION: ++ wsrep_start_position_init (argument); ++ break; ++ case OPT_WSREP_SST_AUTH: ++ wsrep_sst_auth_init (argument); ++ break; ++#endif + #if defined(ENABLED_DEBUG_SYNC) + case OPT_DEBUG_SYNC_TIMEOUT: + /* +@@ -8926,6 +9652,31 @@ static int get_options(int *argc_ptr, char ***argv_ptr) + else + global_system_variables.option_bits&= ~OPTION_BIG_SELECTS; + ++#ifdef WITH_WSREP ++ if (global_system_variables.wsrep_causal_reads) { ++ WSREP_WARN("option --wsrep-casual-reads is deprecated"); ++ if (!(global_system_variables.wsrep_sync_wait & ++ WSREP_SYNC_WAIT_BEFORE_READ)) { ++ WSREP_WARN("--wsrep-casual-reads=ON takes precedence over --wsrep-sync-wait=%u. " ++ "WSREP_SYNC_WAIT_BEFORE_READ is on", ++ global_system_variables.wsrep_sync_wait); ++ global_system_variables.wsrep_sync_wait |= WSREP_SYNC_WAIT_BEFORE_READ; ++ } else { ++ // they are turned on both. ++ } ++ } else { ++ if (global_system_variables.wsrep_sync_wait & ++ WSREP_SYNC_WAIT_BEFORE_READ) { ++ WSREP_WARN("--wsrep-sync-wait=%u takes precedence over --wsrep-causal-reads=OFF. " ++ "WSREP_SYNC_WAIT_BEFORE_READ is on", ++ global_system_variables.wsrep_sync_wait); ++ global_system_variables.wsrep_causal_reads = 1; ++ } else { ++ // they are turned off both. ++ } ++ } ++#endif // WITH_WSREP ++ + // Synchronize @@global.autocommit on --autocommit + const ulonglong turn_bit_on= opt_autocommit ? + OPTION_AUTOCOMMIT : OPTION_NOT_AUTOCOMMIT; +@@ -9320,6 +10071,9 @@ void refresh_status(THD *thd) + + /* Reset some global variables */ + reset_status_vars(); ++#ifdef WITH_WSREP ++ wsrep->stats_reset(wsrep); ++#endif /* WITH_WSREP */ + + /* Reset the counters of all key caches (default and named). */ + process_key_caches(reset_key_cache_counters); +@@ -9383,6 +10137,12 @@ PSI_mutex_key + key_structure_guard_mutex, key_TABLE_SHARE_LOCK_ha_data, + key_LOCK_error_messages, key_LOG_INFO_lock, key_LOCK_thread_count, + key_LOCK_log_throttle_qni; ++#ifdef WITH_WSREP ++PSI_mutex_key key_LOCK_wsrep_rollback, key_LOCK_wsrep_thd, ++ key_LOCK_wsrep_replaying, key_LOCK_wsrep_ready, key_LOCK_wsrep_sst, ++ key_LOCK_wsrep_sst_thread, key_LOCK_wsrep_sst_init, ++ key_LOCK_wsrep_slave_threads, key_LOCK_wsrep_desync; ++#endif + PSI_mutex_key key_LOCK_thd_remove; + PSI_mutex_key key_RELAYLOG_LOCK_commit; + PSI_mutex_key key_RELAYLOG_LOCK_commit_queue; +@@ -9468,6 +10228,18 @@ static PSI_mutex_info all_server_mutexes[]= + { &key_LOCK_error_messages, "LOCK_error_messages", PSI_FLAG_GLOBAL}, + { &key_LOG_INFO_lock, "LOG_INFO::lock", 0}, + { &key_LOCK_thread_count, "LOCK_thread_count", PSI_FLAG_GLOBAL}, ++#ifdef WITH_WSREP ++ { &key_LOCK_wsrep_ready, "LOCK_wsrep_ready", PSI_FLAG_GLOBAL}, ++ { &key_LOCK_wsrep_sst, "LOCK_wsrep_sst", PSI_FLAG_GLOBAL}, ++ { &key_LOCK_wsrep_sst_thread, "wsrep_sst_thread", 0}, ++ { &key_LOCK_wsrep_sst_init, "LOCK_wsrep_sst_init", PSI_FLAG_GLOBAL}, ++ { &key_LOCK_wsrep_sst, "LOCK_wsrep_sst", PSI_FLAG_GLOBAL}, ++ { &key_LOCK_wsrep_rollback, "LOCK_wsrep_rollback", PSI_FLAG_GLOBAL}, ++ { &key_LOCK_wsrep_thd, "THD::LOCK_wsrep_thd", 0}, ++ { &key_LOCK_wsrep_replaying, "LOCK_wsrep_replaying", PSI_FLAG_GLOBAL}, ++ { &key_LOCK_wsrep_slave_threads, "LOCK_wsrep_slave_threads", PSI_FLAG_GLOBAL}, ++ { &key_LOCK_wsrep_desync, "LOCK_wsrep_desync", PSI_FLAG_GLOBAL}, ++#endif + { &key_LOCK_thd_remove, "LOCK_thd_remove", PSI_FLAG_GLOBAL}, + { &key_LOCK_log_throttle_qni, "LOCK_log_throttle_qni", PSI_FLAG_GLOBAL}, + { &key_gtid_ensure_index_mutex, "Gtid_state", PSI_FLAG_GLOBAL}, +@@ -9523,6 +10295,12 @@ PSI_cond_key key_BINLOG_update_cond, + key_cond_slave_parallel_worker, + key_TABLE_SHARE_cond, key_user_level_lock_cond, + key_COND_thread_count, key_COND_thread_cache, key_COND_flush_thread_cache; ++#ifdef WITH_WSREP ++PSI_cond_key key_COND_wsrep_rollback, key_COND_wsrep_thd, ++ key_COND_wsrep_replaying, key_COND_wsrep_ready, key_COND_wsrep_sst, ++ key_COND_wsrep_sst_init, key_COND_wsrep_sst_thread; ++ ++#endif /* WITH_WSREP */ + PSI_cond_key key_RELAYLOG_update_cond; + PSI_cond_key key_BINLOG_COND_done; + PSI_cond_key key_RELAYLOG_COND_done; +@@ -9567,6 +10345,15 @@ static PSI_cond_info all_server_conds[]= + { &key_user_level_lock_cond, "User_level_lock::cond", 0}, + { &key_COND_thread_count, "COND_thread_count", PSI_FLAG_GLOBAL}, + { &key_COND_thread_cache, "COND_thread_cache", PSI_FLAG_GLOBAL}, ++#ifdef WITH_WSREP ++ { &key_COND_wsrep_ready, "COND_wsrep_ready", PSI_FLAG_GLOBAL}, ++ { &key_COND_wsrep_sst, "COND_wsrep_sst", PSI_FLAG_GLOBAL}, ++ { &key_COND_wsrep_sst_init, "COND_wsrep_sst_init", PSI_FLAG_GLOBAL}, ++ { &key_COND_wsrep_sst_thread, "wsrep_sst_thread", 0}, ++ { &key_COND_wsrep_rollback, "COND_wsrep_rollback", PSI_FLAG_GLOBAL}, ++ { &key_COND_wsrep_thd, "THD::COND_wsrep_thd", 0}, ++ { &key_COND_wsrep_replaying, "COND_wsrep_replaying", PSI_FLAG_GLOBAL}, ++#endif + { &key_COND_flush_thread_cache, "COND_flush_thread_cache", PSI_FLAG_GLOBAL}, + { &key_gtid_ensure_index_cond, "Gtid_state", PSI_FLAG_GLOBAL} + }; +diff --git a/sql/mysqld.h b/sql/mysqld.h +index 2844275..17b601a 100644 +--- a/sql/mysqld.h ++++ b/sql/mysqld.h +@@ -65,7 +65,11 @@ typedef Bitmap<((MAX_INDEXES+7)/8*8)> key_map; /* Used for finding keys */ + some places */ + /* Function prototypes */ + void kill_mysql(void); ++#ifdef WITH_WSREP ++void close_connection(THD *thd, uint sql_errno= 0, bool lock=1); ++#else + void close_connection(THD *thd, uint sql_errno= 0); ++#endif + void handle_connection_in_main_thread(THD *thd); + void create_thread_to_handle_connection(THD *thd); + void destroy_thd(THD *thd); +@@ -309,6 +313,10 @@ extern pthread_key(MEM_ROOT**,THR_MALLOC); + extern PSI_mutex_key key_PAGE_lock, key_LOCK_sync, key_LOCK_active, + key_LOCK_pool; + #endif /* HAVE_MMAP */ ++#ifdef WITH_WSREP ++extern PSI_mutex_key key_LOCK_wsrep_thd; ++extern PSI_cond_key key_COND_wsrep_thd; ++#endif /* HAVE_WSREP */ + + #ifdef HAVE_OPENSSL + extern PSI_mutex_key key_LOCK_des_key_file; +@@ -658,6 +666,14 @@ enum options_mysqld + OPT_WANT_CORE, + OPT_ENGINE_CONDITION_PUSHDOWN, + OPT_LOG_ERROR, ++#ifdef WITH_WSREP ++ OPT_WSREP_PROVIDER, ++ OPT_WSREP_PROVIDER_OPTIONS, ++ OPT_WSREP_CLUSTER_ADDRESS, ++ OPT_WSREP_START_POSITION, ++ OPT_WSREP_SST_AUTH, ++ OPT_WSREP_RECOVER, ++#endif /* WITH_WSREP */ + OPT_MAX_LONG_DATA_SIZE, + OPT_PLUGIN_LOAD, + OPT_PLUGIN_LOAD_ADD, +@@ -766,4 +782,9 @@ inline THD *_current_thd(void) + + extern const char *MY_BIND_ALL_ADDRESSES; + ++#ifdef WITH_WSREP ++#include "my_pthread.h" ++pthread_handler_t start_wsrep_THD(void*); ++#endif /* WITH_WSREP */ ++ + #endif /* MYSQLD_INCLUDED */ +diff --git a/sql/protocol.cc b/sql/protocol.cc +index c03d78b..8e6ba54 100644 +--- a/sql/protocol.cc ++++ b/sql/protocol.cc +@@ -485,6 +485,14 @@ static uchar *net_store_length_fast(uchar *packet, uint length) + + void Protocol::end_statement() + { ++#ifdef WITH_WSREP ++ /*sanity check, can be removed before 1.0 release */ ++ if (WSREP(thd) && thd->wsrep_conflict_state== REPLAYING) ++ { ++ WSREP_ERROR("attempting net_end_statement while replaying"); ++ return; ++ } ++#endif + DBUG_ENTER("Protocol::end_statement"); + DBUG_ASSERT(! thd->get_stmt_da()->is_sent()); + bool error= FALSE; +diff --git a/sql/rpl_gtid_cache.cc b/sql/rpl_gtid_cache.cc +index 271a99d..7e8a368 100644 +--- a/sql/rpl_gtid_cache.cc ++++ b/sql/rpl_gtid_cache.cc +@@ -147,7 +147,22 @@ enum_return_status Group_cache::generate_automatic_gno(THD *thd) + else + { + automatic_type= GTID_GROUP; ++#ifdef WITH_WSREP ++ /* ++ Replace sidno with wsrep_sidno ++ if transaction went through wsrep commit ++ */ ++ if (WSREP(thd) && thd->wsrep_trx_meta.gtid.seqno != -1) ++ { ++ automatic_gtid.sidno= wsrep_sidno; ++ } ++ else ++ { ++#endif /* WITH_WSREP */ + automatic_gtid.sidno= gtid_state->get_server_sidno(); ++#ifdef WITH_WSREP ++ } ++#endif /* WITH_WSREP */ + gtid_state->lock_sidno(automatic_gtid.sidno); + automatic_gtid.gno= + gtid_state->get_automatic_gno(automatic_gtid.sidno); +diff --git a/sql/rpl_slave.cc b/sql/rpl_slave.cc +index 736d790..af86bec 100644 +--- a/sql/rpl_slave.cc ++++ b/sql/rpl_slave.cc +@@ -55,6 +55,9 @@ + #include "rpl_rli_pdb.h" + #include "global_threads.h" + ++#ifdef WITH_WSREP ++#include "wsrep_mysqld.h" ++#endif + #ifdef HAVE_REPLICATION + + #include "rpl_tblmap.h" +@@ -3704,6 +3707,94 @@ apply_event_and_update_pos(Log_event** ptr_ev, THD* thd, Relay_log_info* rli) + rli->mts_recovery_index)); + } + #endif ++#ifdef WITH_WSREP ++ if (wsrep_preordered_opt && WSREP_ON && ++ (ev->get_type_code() == QUERY_EVENT || ++ ev->get_type_code() == XID_EVENT || ++ ev->get_type_code() == TABLE_MAP_EVENT || ++ ev->get_type_code() == WRITE_ROWS_EVENT || ++ ev->get_type_code() == UPDATE_ROWS_EVENT || ++ ev->get_type_code() == DELETE_ROWS_EVENT || ++ ev->get_type_code() == GTID_LOG_EVENT)) ++ { ++ if (ev->get_type_code() == GTID_LOG_EVENT) ++ { ++ thd->wsrep_po_sid= *((Gtid_log_event*)ev)->get_sid(); ++ } ++ wsrep_status_t err; ++ if (thd->wsrep_po_cnt == 0) ++ { ++ /* First event in write set, write format description event ++ as a write set header so that the receiver will know how ++ to interpret following events. */ ++ Log_event* fde= rli->get_rli_description_event(); ++ ulong len= uint4korr(fde->temp_buf + EVENT_LEN_OFFSET); ++ wsrep_buf_t data= {fde->temp_buf, len}; ++ if ((err= wsrep->preordered_collect( ++ wsrep, &thd->wsrep_po_handle, &data, 1, true)) != WSREP_OK) ++ { ++ WSREP_ERROR("wsrep preordered collect failed: %d", err); ++ if (err == WSREP_TRX_FAIL && ++ wsrep->preordered_commit(wsrep, &thd->wsrep_po_handle, NULL, ++ 0, 0, false)) ++ { ++ WSREP_WARN("failed to cancel preordered write set"); ++ } ++ DBUG_RETURN(SLAVE_APPLY_EVENT_AND_UPDATE_POS_APPLY_ERROR); ++ } ++ } ++ ++thd->wsrep_po_cnt; ++ ulong len= uint4korr(ev->temp_buf + EVENT_LEN_OFFSET); ++ wsrep_buf_t data= {ev->temp_buf, len}; ++ if ((err= wsrep->preordered_collect(wsrep, &thd->wsrep_po_handle, ++ &data, 1, 1)) != WSREP_OK) ++ { ++ WSREP_ERROR("wsrep preordered collect failed: %d", err); ++ DBUG_RETURN(SLAVE_APPLY_EVENT_AND_UPDATE_POS_APPLY_ERROR); ++ } ++ ++ if (ev->get_type_code() == QUERY_EVENT && ++ ((Query_log_event*)ev)->starts_group()) ++ { ++ thd->wsrep_po_in_trans= TRUE; ++ } ++ else if (ev->get_type_code() == XID_EVENT || ++ (ev->get_type_code() == QUERY_EVENT && ++ (thd->wsrep_po_in_trans == FALSE || ++ ((Query_log_event*)ev)->ends_group()))) ++ { ++ int flags= WSREP_FLAG_COMMIT | (thd->wsrep_po_in_trans == FALSE ? ++ WSREP_FLAG_ISOLATION : 0); ++ thd->wsrep_po_in_trans= FALSE; ++ thd->wsrep_po_cnt= 0; ++ wsrep_uuid_t source; ++ memcpy(source.data, thd->wsrep_po_sid.bytes, sizeof(source.data)); ++ if ((err= wsrep->preordered_commit(wsrep, &thd->wsrep_po_handle, ++ &source, flags, 1, true)) != WSREP_OK) ++ { ++ WSREP_ERROR("failed to commit preordered event: %d", err); ++ DBUG_RETURN(SLAVE_APPLY_EVENT_AND_UPDATE_POS_APPLY_ERROR); ++ } ++ } ++ reason= Log_event::EVENT_SKIP_IGNORE; ++ skip_event= TRUE; ++ } ++ else if (WSREP_ON && (ev->get_type_code() == XID_EVENT || ++ (ev->get_type_code() == QUERY_EVENT && thd->wsrep_mysql_replicated > 0 && ++ (!strncasecmp(((Query_log_event*)ev)->query , "BEGIN", 5) || ++ !strncasecmp(((Query_log_event*)ev)->query , "COMMIT", 6) )))) ++ { ++ if (++thd->wsrep_mysql_replicated < (int)wsrep_mysql_replication_bundle) ++ { ++ WSREP_DEBUG("skipping wsrep commit %d", thd->wsrep_mysql_replicated); ++ reason = Log_event::EVENT_SKIP_IGNORE; ++ } ++ else ++ { ++ thd->wsrep_mysql_replicated = 0; ++ } ++ } ++#endif /* WITH_WSREP */ + if (reason == Log_event::EVENT_SKIP_COUNT) + { + sql_slave_skip_counter= --rli->slave_skip_counter; +@@ -5825,6 +5916,9 @@ pthread_handler_t handle_slave_sql(void *arg) + my_off_t saved_log_pos= 0; + my_off_t saved_master_log_pos= 0; + my_off_t saved_skip= 0; ++#ifdef WITH_WSREP ++ my_bool wsrep_node_dropped= FALSE; ++#endif /* WITH_WSREP */ + + Relay_log_info* rli = ((Master_info*)arg)->rli; + const char *errmsg; +@@ -5833,6 +5927,9 @@ pthread_handler_t handle_slave_sql(void *arg) + // needs to call my_thread_init(), otherwise we get a coredump in DBUG_ stuff + my_thread_init(); + DBUG_ENTER("handle_slave_sql"); ++#ifdef WITH_WSREP ++ wsrep_restart_point: ++#endif /* WITH_WSREP */ + + DBUG_ASSERT(rli->inited); + mysql_mutex_lock(&rli->run_lock); +@@ -5976,6 +6073,18 @@ pthread_handler_t handle_slave_sql(void *arg) + } + #endif + ++#ifdef WITH_WSREP ++ thd->wsrep_exec_mode= LOCAL_STATE; ++ /* synchronize with wsrep replication */ ++ if (WSREP_ON) ++ { ++ thd->wsrep_po_handle= WSREP_PO_INITIALIZER; ++ thd->wsrep_po_cnt= 0; ++ thd->wsrep_po_in_trans= FALSE; ++ memset(&thd->wsrep_po_sid, 0, sizeof(thd->wsrep_po_sid)); ++ wsrep_ready_wait(); ++ } ++#endif + DBUG_PRINT("master_info",("log_file_name: %s position: %s", + rli->get_group_master_log_name(), + llstr(rli->get_group_master_log_pos(),llbuff))); +@@ -6118,6 +6227,12 @@ Error running query, slave SQL thread aborted. Fix the problem, and restart \ + the slave SQL thread with \"SLAVE START\". We stopped at log \ + '%s' position %s", rli->get_rpl_log_name(), + llstr(rli->get_group_master_log_pos(), llbuff)); ++#ifdef WITH_WSREP ++ if (WSREP_ON && last_errno == ER_UNKNOWN_COM_ERROR) ++ { ++ wsrep_node_dropped= TRUE; ++ } ++#endif /* WITH_WSREP */ + } + goto err; + } +@@ -6139,6 +6254,16 @@ llstr(rli->get_group_master_log_pos(), llbuff)); + rli->recovery_groups_inited= false; + } + ++#ifdef WITH_WSREP ++ if (WSREP_ON) ++ { ++ if (wsrep->preordered_commit(wsrep, &thd->wsrep_po_handle, ++ NULL, 0, 0, false)) ++ { ++ WSREP_WARN("preordered cleanup failed"); ++ } ++ } ++#endif /* WITH_WSREP */ + /* + Some events set some playgrounds, which won't be cleared because thread + stops. Stopping of this thread may not be known to these events ("stop" +@@ -6191,6 +6316,27 @@ llstr(rli->get_group_master_log_pos(), llbuff)); + if (thd_added) + remove_global_thread(thd); + delete thd; ++#ifdef WITH_WSREP ++ /* if slave stopped due to node going non primary, we set global flag to ++ trigger automatic restart of slave when node joins back to cluster ++ */ ++ if (wsrep_node_dropped && wsrep_restart_slave) ++ { ++ if (wsrep_ready) ++ { ++ WSREP_INFO("Slave error due to node temporarily non-primary" ++ "SQL slave will continue"); ++ wsrep_node_dropped= FALSE; ++ mysql_mutex_unlock(&rli->run_lock); ++ goto wsrep_restart_point; ++ } else { ++ WSREP_INFO("Slave error due to node going non-primary"); ++ WSREP_INFO("wsrep_restart_slave was set and therefore slave will be " ++ "automatically restarted when node joins back to cluster"); ++ wsrep_restart_slave_activated= TRUE; ++ } ++ } ++#endif /* WITH_WSREP */ + /* + Note: the order of the broadcast and unlock calls below (first broadcast, then unlock) + is important. Otherwise a killer_thread can execute between the calls and +diff --git a/sql/set_var.h b/sql/set_var.h +index fbc7e16..6995619 100644 +--- a/sql/set_var.h ++++ b/sql/set_var.h +@@ -256,6 +256,9 @@ public: + int check(THD *thd); + int update(THD *thd); + int light_check(THD *thd); ++#ifdef WITH_WSREP ++ int wsrep_store_variable(THD *thd); ++#endif + void print(THD *thd, String *str); /* To self-print */ + #ifdef OPTIMIZER_TRACE + virtual bool is_var_optimizer_trace() const +@@ -354,6 +357,9 @@ extern sys_var *Sys_gtid_purged_ptr; + + const CHARSET_INFO *get_old_charset_by_name(const char *old_name); + ++#ifdef WITH_WSREP ++int sql_set_wsrep_variables(THD *thd, List *var_list); ++#endif + int sys_var_init(); + int sys_var_add_options(std::vector *long_options, int parse_flags); + void sys_var_end(void); +diff --git a/sql/sp.cc b/sql/sp.cc +index 915a6af..d52a5ee 100644 +--- a/sql/sp.cc ++++ b/sql/sp.cc +@@ -2734,3 +2734,37 @@ String *sp_get_item_value(THD *thd, Item *item, String *str) + return NULL; + } + } ++#ifdef WITH_WSREP ++int wsrep_create_sp(THD *thd, uchar** buf, size_t* buf_len) ++{ ++ String log_query; ++ sp_head *sp = thd->lex->sphead; ++ ulong saved_mode= thd->variables.sql_mode; ++ String retstr(64); ++ retstr.set_charset(system_charset_info); ++ ++ log_query.set_charset(system_charset_info); ++ ++ if (sp->m_type == TYPE_ENUM_FUNCTION) ++ { ++ sp_returns_type(thd, retstr, sp); ++ } ++ ++ if (!create_string(thd, &log_query, ++ sp->m_type, ++ (sp->m_explicit_name ? sp->m_db.str : NULL), ++ (sp->m_explicit_name ? sp->m_db.length : 0), ++ sp->m_name.str, sp->m_name.length, ++ sp->m_params.str, sp->m_params.length, ++ retstr.c_ptr(), retstr.length(), ++ sp->m_body.str, sp->m_body.length, ++ sp->m_chistics, &(thd->lex->definer->user), ++ &(thd->lex->definer->host), ++ saved_mode)) ++ { ++ WSREP_WARN("SP create string failed: %s", thd->query()); ++ return 1; ++ } ++ return wsrep_to_buf_helper(thd, log_query.ptr(), log_query.length(), buf, buf_len); ++} ++#endif /* WITH_WSREP */ +diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc +index dc059b0..524b764 100644 +--- a/sql/sql_acl.cc ++++ b/sql/sql_acl.cc +@@ -2304,6 +2304,9 @@ int check_change_password(THD *thd, const char *host, const char *user, + return(1); + } + if (!thd->slave_thread && ++#ifdef WITH_WSREP ++ (!WSREP(thd) || !thd->wsrep_applier) && ++#endif /* WITH_WSREP */ + (strcmp(thd->security_ctx->user, user) || + my_strcasecmp(system_charset_info, host, + thd->security_ctx->priv_host))) +@@ -2311,7 +2314,12 @@ int check_change_password(THD *thd, const char *host, const char *user, + if (check_access(thd, UPDATE_ACL, "mysql", NULL, NULL, 1, 0)) + return(1); + } ++#ifdef WITH_WSREP ++ if ((!WSREP(thd) || !thd->wsrep_applier) && ++ !thd->slave_thread && !thd->security_ctx->user[0]) ++#else + if (!thd->slave_thread && !thd->security_ctx->user[0]) ++#endif /* WITH_WSREP */ + { + my_message(ER_PASSWORD_ANONYMOUS_USER, ER(ER_PASSWORD_ANONYMOUS_USER), + MYF(0)); +@@ -2392,7 +2400,7 @@ bool change_password(THD *thd, const char *host, const char *user, + TABLE *table; + /* Buffer should be extended when password length is extended. */ + char buff[512]; +- ulong query_length; ++ ulong query_length=0; + bool save_binlog_row_based; + uchar user_key[MAX_KEY_LENGTH]; + char *plugin_temp= NULL; +@@ -2400,6 +2408,9 @@ bool change_password(THD *thd, const char *host, const char *user, + uint new_password_len= (uint) strlen(new_password); + bool result= 1; + enum mysql_user_table_field password_field= MYSQL_USER_FIELD_PASSWORD; ++#ifdef WITH_WSREP ++ const CSET_STRING query_save = thd->query_string; ++#endif /* WITH_WSREP */ + DBUG_ENTER("change_password"); + DBUG_PRINT("enter",("host: '%s' user: '%s' new_password: '%s'", + host,user,new_password)); +@@ -2407,6 +2418,18 @@ bool change_password(THD *thd, const char *host, const char *user, + + if (check_change_password(thd, host, user, new_password, new_password_len)) + DBUG_RETURN(1); ++#ifdef WITH_WSREP ++ if (WSREP(thd) && !thd->wsrep_applier) ++ { ++ query_length= sprintf(buff, "SET PASSWORD FOR '%-.120s'@'%-.120s'='%-.120s'", ++ user ? user : "", ++ host ? host : "", ++ new_password); ++ thd->set_query_inner(buff, query_length, system_charset_info); ++ ++ WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, (char*)"user", NULL); ++ } ++#endif /* WITH_WSREP */ + + tables.init_one_table("mysql", 5, "user", 4, "user", TL_WRITE); + +@@ -2677,13 +2700,26 @@ bool change_password(THD *thd, const char *host, const char *user, + table->file->has_transactions()); + end: + result|= acl_trans_commit_and_close_tables(thd); ++#ifdef WITH_WSREP ++ if (WSREP(thd) && !thd->wsrep_applier) ++ { ++ WSREP_TO_ISOLATION_END; + ++ thd->query_string = query_save; ++ thd->wsrep_exec_mode = LOCAL_STATE; ++ } ++#endif /* WITH_WSREP */ + /* Restore the state of binlog format */ + DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row()); + if (save_binlog_row_based) + thd->set_current_stmt_binlog_format_row(); + + DBUG_RETURN(result); ++#ifdef WITH_WSREP ++ error: ++ WSREP_ERROR("Replication of SET PASSWORD failed: %s", buff); ++ DBUG_RETURN(result); ++#endif /* WITH_WSREP */ + } + + +@@ -10114,6 +10150,12 @@ static bool parse_com_change_user_packet(MPVIO_EXT *mpvio, uint packet_length) + if (mpvio->charset_adapter->init_client_charset(uint2korr(ptr))) + DBUG_RETURN(1); + } ++ else ++ { ++ sql_print_warning("Client failed to provide its character set. " ++ "'%s' will be used as client character set.", ++ mpvio->charset_adapter->charset()->csname); ++ } + + /* Convert database and user names to utf8 */ + db_len= copy_and_convert(db_buff, sizeof(db_buff) - 1, system_charset_info, +diff --git a/sql/sql_admin.cc b/sql/sql_admin.cc +index 52b7ff4..7b53fa6 100644 +--- a/sql/sql_admin.cc ++++ b/sql/sql_admin.cc +@@ -1124,6 +1124,7 @@ bool Sql_cmd_optimize_table::execute(THD *thd) + if (check_table_access(thd, SELECT_ACL | INSERT_ACL, first_table, + FALSE, UINT_MAX, FALSE)) + goto error; /* purecov: inspected */ ++ WSREP_TO_ISOLATION_BEGIN(first_table->db, first_table->table_name, NULL) + thd->enable_slow_log= opt_log_slow_admin_statements; + res= (specialflag & SPECIAL_NO_NEW_FUNC) ? + mysql_recreate_table(thd, first_table, true) : +@@ -1156,6 +1157,7 @@ bool Sql_cmd_repair_table::execute(THD *thd) + FALSE, UINT_MAX, FALSE)) + goto error; /* purecov: inspected */ + thd->enable_slow_log= opt_log_slow_admin_statements; ++ WSREP_TO_ISOLATION_BEGIN(first_table->db, first_table->table_name, NULL) + res= mysql_admin_table(thd, first_table, &thd->lex->check_opt, "repair", + TL_WRITE, 1, + MY_TEST(thd->lex->check_opt.sql_flags & TT_USEFRM), +diff --git a/sql/sql_alter.cc b/sql/sql_alter.cc +index 3cf1c93..167daff 100644 +--- a/sql/sql_alter.cc ++++ b/sql/sql_alter.cc +@@ -18,6 +18,9 @@ + // mysql_exchange_partition + #include "sql_base.h" // open_temporary_tables + #include "sql_alter.h" ++#ifdef WITH_WSREP ++#include "wsrep_mysqld.h" ++#endif /* WITH_WSREP */ + + + Alter_info::Alter_info(const Alter_info &rhs, MEM_ROOT *mem_root) +@@ -304,6 +307,17 @@ bool Sql_cmd_alter_table::execute(THD *thd) + + thd->enable_slow_log= opt_log_slow_admin_statements; + ++#ifdef WITH_WSREP ++ TABLE *find_temporary_table(THD *thd, const TABLE_LIST *tl); ++ ++ if ((!thd->is_current_stmt_binlog_format_row() || ++ !find_temporary_table(thd, first_table))) ++ { ++ WSREP_TO_ISOLATION_BEGIN(((lex->name.str) ? select_lex->db : NULL), ++ ((lex->name.str) ? lex->name.str : NULL), ++ first_table); ++ } ++#endif /* WITH_WSREP */ + result= mysql_alter_table(thd, select_lex->db, lex->name.str, + &create_info, + first_table, +@@ -313,6 +327,13 @@ bool Sql_cmd_alter_table::execute(THD *thd) + lex->ignore); + + DBUG_RETURN(result); ++#ifdef WITH_WSREP ++ error: ++ { ++ WSREP_WARN("ALTER TABLE isolation failure"); ++ DBUG_RETURN(TRUE); ++ } ++#endif /* WITH_WSREP */ + } + + +diff --git a/sql/sql_base.cc b/sql/sql_base.cc +index ef5e7dc..a325273 100644 +--- a/sql/sql_base.cc ++++ b/sql/sql_base.cc +@@ -57,6 +57,9 @@ + #include + #endif + #include "table_cache.h" // Table_cache_manager, Table_cache ++#ifdef WITH_WSREP ++#include "wsrep_mysqld.h" ++#endif /* WITH_WSREP */ + + + bool +@@ -5229,6 +5232,22 @@ restart: + goto err; + } + } ++#ifdef WITH_WSREP ++ if ((thd->lex->sql_command== SQLCOM_INSERT || ++ thd->lex->sql_command== SQLCOM_INSERT_SELECT || ++ thd->lex->sql_command== SQLCOM_REPLACE || ++ thd->lex->sql_command== SQLCOM_REPLACE_SELECT || ++ thd->lex->sql_command== SQLCOM_UPDATE || ++ thd->lex->sql_command== SQLCOM_UPDATE_MULTI || ++ thd->lex->sql_command== SQLCOM_LOAD || ++ thd->lex->sql_command== SQLCOM_DELETE) && ++ wsrep_replicate_myisam && ++ (*start)->table && (*start)->table->file->ht->db_type == DB_TYPE_MYISAM) ++ { ++ WSREP_TO_ISOLATION_BEGIN(NULL, NULL, (*start)); ++ } ++ error: ++#endif + + /* Set appropriate TABLE::lock_type. */ + if (tbl && tables->lock_type != TL_UNLOCK && +diff --git a/sql/sql_builtin.cc.in b/sql/sql_builtin.cc.in +index cf7006f..a89bd06 100644 +--- a/sql/sql_builtin.cc.in ++++ b/sql/sql_builtin.cc.in +@@ -23,7 +23,11 @@ extern "C" + extern + #endif + builtin_plugin +- @mysql_mandatory_plugins@ @mysql_optional_plugins@ builtin_binlog_plugin, builtin_mysql_password_plugin; ++ @mysql_mandatory_plugins@ @mysql_optional_plugins@ builtin_binlog_plugin, ++#ifdef WITH_WSREP ++ builtin_wsrep_plugin@mysql_plugin_defs@, ++#endif /* WITH_WSREP */ ++ builtin_mysql_password_plugin; + + struct st_mysql_plugin *mysql_optional_plugins[]= + { +@@ -32,5 +36,9 @@ struct st_mysql_plugin *mysql_optional_plugins[]= + + struct st_mysql_plugin *mysql_mandatory_plugins[]= + { +- builtin_binlog_plugin, builtin_mysql_password_plugin, @mysql_mandatory_plugins@ 0 ++ builtin_binlog_plugin, ++#ifdef WITH_WSREP ++ builtin_wsrep_plugin@mysql_plugin_defs@, ++#endif /* WITH_WSREP */ ++ builtin_mysql_password_plugin, @mysql_mandatory_plugins@ 0 + }; +diff --git a/sql/sql_class.cc b/sql/sql_class.cc +index 79d56ad..cc35779 100644 +--- a/sql/sql_class.cc ++++ b/sql/sql_class.cc +@@ -57,6 +57,10 @@ + #include "debug_sync.h" + #include "sql_parse.h" // is_update_query + #include "sql_callback.h" ++#ifdef WITH_WSREP ++#include "wsrep_mysqld.h" ++#include "wsrep_thd.h" ++#endif + #include "lock.h" + #include "global_threads.h" + #include "mysqld.h" +@@ -816,6 +820,176 @@ char *thd_security_context(THD *thd, char *buffer, unsigned int length, + return buffer; + } + ++#ifdef WITH_WSREP ++extern int wsrep_on(void *thd) ++{ ++ return (int)(WSREP(((THD*)thd))); ++} ++extern "C" bool wsrep_thd_is_wsrep_on(THD *thd) ++{ ++ return thd->variables.wsrep_on; ++} ++ ++extern "C" bool wsrep_consistency_check(void *thd) ++{ ++ return ((THD*)thd)->wsrep_consistency_check == CONSISTENCY_CHECK_RUNNING; ++} ++ ++extern "C" void wsrep_thd_set_exec_mode(THD *thd, enum wsrep_exec_mode mode) ++{ ++ thd->wsrep_exec_mode= mode; ++} ++extern "C" void wsrep_thd_set_query_state( ++ THD *thd, enum wsrep_query_state state) ++{ ++ thd->wsrep_query_state= state; ++} ++extern "C" void wsrep_thd_set_conflict_state( ++ THD *thd, enum wsrep_conflict_state state) ++{ ++ thd->wsrep_conflict_state= state; ++} ++ ++ ++extern "C" enum wsrep_exec_mode wsrep_thd_exec_mode(THD *thd) ++{ ++ return thd->wsrep_exec_mode; ++} ++ ++extern "C" const char *wsrep_thd_exec_mode_str(THD *thd) ++{ ++ return ++ (!thd) ? "void" : ++ (thd->wsrep_exec_mode == LOCAL_STATE) ? "local" : ++ (thd->wsrep_exec_mode == REPL_RECV) ? "applier" : ++ (thd->wsrep_exec_mode == TOTAL_ORDER) ? "total order" : ++ (thd->wsrep_exec_mode == LOCAL_COMMIT) ? "local commit" : "void"; ++} ++ ++extern "C" enum wsrep_query_state wsrep_thd_query_state(THD *thd) ++{ ++ return thd->wsrep_query_state; ++} ++ ++extern "C" const char *wsrep_thd_query_state_str(THD *thd) ++{ ++ return ++ (!thd) ? "void" : ++ (thd->wsrep_query_state == QUERY_IDLE) ? "idle" : ++ (thd->wsrep_query_state == QUERY_EXEC) ? "executing" : ++ (thd->wsrep_query_state == QUERY_COMMITTING) ? "committing" : ++ (thd->wsrep_query_state == QUERY_EXITING) ? "exiting" : ++ (thd->wsrep_query_state == QUERY_ROLLINGBACK) ? "rolling back" : "void"; ++} ++ ++extern "C" enum wsrep_conflict_state wsrep_thd_conflict_state(THD *thd) ++{ ++ return thd->wsrep_conflict_state; ++} ++extern "C" const char *wsrep_thd_conflict_state_str(THD *thd) ++{ ++ return ++ (!thd) ? "void" : ++ (thd->wsrep_conflict_state == NO_CONFLICT) ? "no conflict" : ++ (thd->wsrep_conflict_state == MUST_ABORT) ? "must abort" : ++ (thd->wsrep_conflict_state == ABORTING) ? "aborting" : ++ (thd->wsrep_conflict_state == MUST_REPLAY) ? "must replay" : ++ (thd->wsrep_conflict_state == REPLAYING) ? "replaying" : ++ (thd->wsrep_conflict_state == RETRY_AUTOCOMMIT) ? "retrying" : ++ (thd->wsrep_conflict_state == CERT_FAILURE) ? "cert failure" : "void"; ++} ++ ++extern "C" wsrep_ws_handle_t* wsrep_thd_ws_handle(THD *thd) ++{ ++ return &thd->wsrep_ws_handle; ++} ++ ++extern "C"void wsrep_thd_LOCK(THD *thd) ++{ ++ mysql_mutex_lock(&thd->LOCK_wsrep_thd); ++} ++extern "C"void wsrep_thd_UNLOCK(THD *thd) ++{ ++ mysql_mutex_unlock(&thd->LOCK_wsrep_thd); ++} ++extern "C" time_t wsrep_thd_query_start(THD *thd) ++{ ++ return thd->query_start(); ++} ++extern "C" uint32 wsrep_thd_wsrep_rand(THD *thd) ++{ ++ return thd->wsrep_rand; ++} ++extern "C" my_thread_id wsrep_thd_thread_id(THD *thd) ++{ ++ return thd->thread_id; ++} ++extern "C" wsrep_seqno_t wsrep_thd_trx_seqno(THD *thd) ++{ ++ return (thd) ? thd->wsrep_trx_meta.gtid.seqno : WSREP_SEQNO_UNDEFINED; ++} ++extern "C" query_id_t wsrep_thd_query_id(THD *thd) ++{ ++ return thd->query_id; ++} ++extern "C" char *wsrep_thd_query(THD *thd) ++{ ++ return (thd) ? thd->query() : NULL; ++} ++extern "C" query_id_t wsrep_thd_wsrep_last_query_id(THD *thd) ++{ ++ return thd->wsrep_last_query_id; ++} ++extern "C" void wsrep_thd_set_wsrep_last_query_id(THD *thd, query_id_t id) ++{ ++ thd->wsrep_last_query_id= id; ++} ++extern "C" void wsrep_thd_awake(THD *thd, my_bool signal) ++{ ++ if (signal) ++ { ++ mysql_mutex_lock(&thd->LOCK_thd_data); ++ thd->awake(THD::KILL_QUERY); ++ mysql_mutex_unlock(&thd->LOCK_thd_data); ++ } ++ else ++ { ++ mysql_mutex_lock(&LOCK_wsrep_replaying); ++ mysql_cond_broadcast(&COND_wsrep_replaying); ++ mysql_mutex_unlock(&LOCK_wsrep_replaying); ++ } ++} ++extern "C" int wsrep_thd_retry_counter(THD *thd) ++{ ++ return(thd->wsrep_retry_counter); ++} ++ ++extern int ++wsrep_trx_order_before(void *thd1, void *thd2) ++{ ++ if (wsrep_thd_trx_seqno((THD*)thd1) < wsrep_thd_trx_seqno((THD*)thd2)) { ++ WSREP_DEBUG("BF conflict, order: %lld %lld\n", ++ (long long)wsrep_thd_trx_seqno((THD*)thd1), ++ (long long)wsrep_thd_trx_seqno((THD*)thd2)); ++ return 1; ++ } ++ WSREP_DEBUG("waiting for BF, trx order: %lld %lld\n", ++ (long long)wsrep_thd_trx_seqno((THD*)thd1), ++ (long long)wsrep_thd_trx_seqno((THD*)thd2)); ++ return 0; ++} ++extern "C" int ++wsrep_trx_is_aborting(void *thd_ptr) ++{ ++ if (thd_ptr) { ++ if ((((THD *)thd_ptr)->wsrep_conflict_state == MUST_ABORT) || ++ (((THD *)thd_ptr)->wsrep_conflict_state == ABORTING)) { ++ return 1; ++ } ++ } ++ return 0; ++} ++#endif + + /** + Implementation of Drop_table_error_handler::handle_condition(). +@@ -843,7 +1017,6 @@ bool Drop_table_error_handler::handle_condition(THD *thd, + sql_errno == ER_TRG_NO_DEFINER); + } + +- + void Open_tables_state::set_open_tables_state(Open_tables_state *state) + { + this->open_tables= state->open_tables; +@@ -878,7 +1051,11 @@ void Open_tables_state::reset_open_tables_state() + } + + ++#ifdef WITH_WSREP ++THD::THD(bool enable_plugins, bool is_applier) ++#else + THD::THD(bool enable_plugins) ++#endif + :Statement(&main_lex, &main_mem_root, STMT_CONVENTIONAL_EXECUTION, + /* statement id */ 0), + rli_fake(0), rli_slave(NULL), +@@ -911,6 +1088,16 @@ THD::THD(bool enable_plugins) + bootstrap(0), + derived_tables_processing(FALSE), + sp_runtime_ctx(NULL), ++#ifdef WITH_WSREP ++ wsrep_applier(is_applier), ++ wsrep_applier_closing(FALSE), ++ wsrep_client_thread(0), ++ wsrep_po_handle(WSREP_PO_INITIALIZER), ++ wsrep_po_cnt(0), ++ wsrep_po_in_trans(FALSE), ++ wsrep_apply_format(0), ++ wsrep_apply_toi(false), ++#endif + m_parser_state(NULL), + #if defined(ENABLED_DEBUG_SYNC) + debug_sync_control(0), +@@ -1001,6 +1188,22 @@ THD::THD(bool enable_plugins) + *scramble= '\0'; + skip_gtid_rollback= false; + ++#ifdef WITH_WSREP ++ mysql_mutex_init(key_LOCK_wsrep_thd, &LOCK_wsrep_thd, MY_MUTEX_INIT_FAST); ++ mysql_cond_init(key_COND_wsrep_thd, &COND_wsrep_thd, NULL); ++ wsrep_ws_handle.trx_id = WSREP_UNDEFINED_TRX_ID; ++ wsrep_ws_handle.opaque = NULL; ++ wsrep_retry_counter = 0; ++ wsrep_PA_safe = true; ++ wsrep_retry_query = NULL; ++ wsrep_retry_query_len = 0; ++ wsrep_retry_command = COM_CONNECT; ++ wsrep_consistency_check = NO_CONSISTENCY_CHECK; ++ wsrep_status_vars = 0; ++ wsrep_mysql_replicated = 0; ++ wsrep_TOI_pre_query = NULL; ++ wsrep_TOI_pre_query_len = 0; ++#endif + /* Call to init() below requires fully initialized Open_tables_state. */ + reset_open_tables_state(); + +@@ -1033,6 +1236,13 @@ THD::THD(bool enable_plugins) + randominit(&rand, tmp + (ulong) &rand, tmp + (ulong) ::global_query_id); + substitute_null_with_insert_id = FALSE; + thr_lock_info_init(&lock_info); /* safety: will be reset after start */ ++#ifdef WITH_WSREP ++ lock_info.mysql_thd= (void *)this; ++ lock_info.in_lock_tables= false; ++#ifdef WSREP_PROC_INFO ++ wsrep_info[sizeof(wsrep_info) - 1] = '\0'; /* make sure it is 0-terminated */ ++#endif /* WSREP_PROC_INFO */ ++#endif /* WITH_WSREP */ + + m_internal_handler= NULL; + m_binlog_invoker= FALSE; +@@ -1379,6 +1589,22 @@ void THD::init(void) + reset_current_stmt_binlog_format_row(); + reset_binlog_local_stmt_filter(); + memset(&status_var, 0, sizeof(status_var)); ++#ifdef WITH_WSREP ++ wsrep_exec_mode= wsrep_applier ? REPL_RECV : LOCAL_STATE; ++ wsrep_conflict_state= NO_CONFLICT; ++ wsrep_query_state= QUERY_IDLE; ++ wsrep_last_query_id= 0; ++ wsrep_trx_meta.gtid= WSREP_GTID_UNDEFINED; ++ wsrep_trx_meta.depends_on= WSREP_SEQNO_UNDEFINED; ++ wsrep_converted_lock_session= false; ++ wsrep_retry_counter= 0; ++ wsrep_rli= NULL; ++ wsrep_PA_safe= true; ++ wsrep_consistency_check = NO_CONSISTENCY_CHECK; ++ wsrep_mysql_replicated = 0; ++ wsrep_TOI_pre_query = NULL; ++ wsrep_TOI_pre_query_len = 0; ++#endif + binlog_row_event_extra_data= 0; + + if (variables.sql_log_bin) +@@ -1573,6 +1799,13 @@ void THD::release_resources() + plugin_thdvar_cleanup(this); + + m_release_resources_done= true; ++#ifdef WITH_WSREP ++ mysql_mutex_lock(&LOCK_wsrep_thd); ++ mysql_mutex_unlock(&LOCK_wsrep_thd); ++ mysql_mutex_destroy(&LOCK_wsrep_thd); ++ if (wsrep_rli) delete wsrep_rli; ++ if (wsrep_status_vars) wsrep->stats_free(wsrep, wsrep_status_vars); ++#endif + } + + +@@ -1873,7 +2106,19 @@ bool THD::notify_shared_lock(MDL_context_owner *ctx_in_use, + (e.g. see partitioning code). + */ + if (!thd_table->needs_reopen()) ++#ifdef WITH_WSREP ++ { ++ signalled|= mysql_lock_abort_for_thread(this, thd_table); ++ if (this && WSREP(this) && wsrep_thd_is_BF((void *)this, FALSE)) ++ { ++ WSREP_DEBUG("remove_table_from_cache: %llu", ++ (unsigned long long) this->real_id); ++ wsrep_abort_thd((void *)this, (void *)in_use, FALSE); ++ } ++ } ++#else + signalled|= mysql_lock_abort_for_thread(this, thd_table); ++#endif + } + mysql_mutex_unlock(&in_use->LOCK_thd_data); + } +@@ -2438,6 +2683,13 @@ bool sql_exchange::escaped_given(void) + bool select_send::send_result_set_metadata(List &list, uint flags) + { + bool res; ++#ifdef WITH_WSREP ++ if (WSREP(thd) && thd->wsrep_retry_query) ++ { ++ WSREP_DEBUG("skipping select metadata"); ++ return FALSE; ++ } ++#endif /* WITH_WSREP */ + if (!(res= thd->protocol->send_result_set_metadata(&list, flags))) + is_result_set_started= 1; + return res; +@@ -4206,8 +4458,13 @@ extern "C" int thd_non_transactional_update(const MYSQL_THD thd) + + extern "C" int thd_binlog_format(const MYSQL_THD thd) + { ++#ifdef WITH_WSREP ++ if (((WSREP(thd) && wsrep_emulate_bin_log) || mysql_bin_log.is_open()) && ++ (thd->variables.option_bits & OPTION_BIN_LOG)) ++#else + if (mysql_bin_log.is_open() && (thd->variables.option_bits & OPTION_BIN_LOG)) +- return (int) thd->variables.binlog_format; ++#endif ++ return (int) WSREP_BINLOG_FORMAT(thd->variables.binlog_format); + else + return BINLOG_FORMAT_UNSPEC; + } +diff --git a/sql/sql_class.h b/sql/sql_class.h +index 17f0055..ded32a5 100644 +--- a/sql/sql_class.h ++++ b/sql/sql_class.h +@@ -70,6 +70,18 @@ void set_thd_stage_info(void *thd, + #define THD_STAGE_INFO(thd, stage) \ + (thd)->enter_stage(& stage, NULL, __func__, __FILE__, __LINE__) + ++#ifdef WITH_WSREP ++#include "wsrep_mysqld.h" ++struct wsrep_thd_shadow { ++ ulonglong options; ++ uint server_status; ++ enum wsrep_exec_mode wsrep_exec_mode; ++ Vio *vio; ++ ulong tx_isolation; ++ char *db; ++ size_t db_length; ++}; ++#endif + class Reprepare_observer; + class Relay_log_info; + +@@ -547,6 +559,12 @@ typedef struct system_variables + my_bool sysdate_is_now; + my_bool binlog_rows_query_log_events; + ++#ifdef WITH_WSREP ++ my_bool wsrep_on; ++ my_bool wsrep_causal_reads; ++ uint wsrep_sync_wait; ++ ulong wsrep_retry_autocommit; ++#endif + double long_query_time_double; + + my_bool pseudo_slave_mode; +@@ -2321,7 +2339,8 @@ public: + int is_current_stmt_binlog_format_row() const { + DBUG_ASSERT(current_stmt_binlog_format == BINLOG_FORMAT_STMT || + current_stmt_binlog_format == BINLOG_FORMAT_ROW); +- return current_stmt_binlog_format == BINLOG_FORMAT_ROW; ++ return (WSREP_BINLOG_FORMAT((ulong)current_stmt_binlog_format) == ++ BINLOG_FORMAT_ROW); + } + /** Tells whether the given optimizer_switch flag is on */ + inline bool optimizer_switch_flag(ulonglong flag) const +@@ -3114,6 +3133,45 @@ public: + query_id_t first_query_id; + } binlog_evt_union; + ++#ifdef WITH_WSREP ++ const bool wsrep_applier; /* dedicated slave applier thread */ ++ bool wsrep_applier_closing; /* applier marked to close */ ++ bool wsrep_client_thread; /* to identify client threads*/ ++ enum wsrep_exec_mode wsrep_exec_mode; ++ query_id_t wsrep_last_query_id; ++ enum wsrep_query_state wsrep_query_state; ++ enum wsrep_conflict_state wsrep_conflict_state; ++ mysql_mutex_t LOCK_wsrep_thd; ++ mysql_cond_t COND_wsrep_thd; ++ // changed from wsrep_seqno_t to wsrep_trx_meta_t in wsrep API rev 75 ++ // wsrep_seqno_t wsrep_trx_seqno; ++ wsrep_trx_meta_t wsrep_trx_meta; ++ uint32 wsrep_rand; ++ Relay_log_info* wsrep_rli; ++ bool wsrep_converted_lock_session; ++ wsrep_ws_handle_t wsrep_ws_handle; ++#ifdef WSREP_PROC_INFO ++ char wsrep_info[128]; /* string for dynamic proc info */ ++#endif /* WSREP_PROC_INFO */ ++ ulong wsrep_retry_counter; // of autocommit ++ bool wsrep_PA_safe; ++ char* wsrep_retry_query; ++ size_t wsrep_retry_query_len; ++ enum enum_server_command wsrep_retry_command; ++ enum wsrep_consistency_check_mode ++ wsrep_consistency_check; ++ wsrep_stats_var* wsrep_status_vars; ++ int wsrep_mysql_replicated; ++ const char* wsrep_TOI_pre_query; /* a query to apply before ++ the actual TOI query */ ++ size_t wsrep_TOI_pre_query_len; ++ wsrep_po_handle_t wsrep_po_handle; ++ size_t wsrep_po_cnt; ++ my_bool wsrep_po_in_trans; ++ rpl_sid wsrep_po_sid; ++ void* wsrep_apply_format; ++ bool wsrep_apply_toi; /* applier processing in TOI */ ++#endif /* WITH_WSREP */ + /** + Internal parser state. + Note that since the parser is not re-entrant, we keep only one parser +@@ -3149,7 +3207,11 @@ public: + // We don't want to load/unload plugins for unit tests. + bool m_enable_plugins; + ++#ifdef WITH_WSREP ++ THD(bool enable_plugins= true, bool is_applier = false); ++#else + THD(bool enable_plugins= true); ++#endif + + /* + The THD dtor is effectively split in two: +@@ -3657,7 +3719,7 @@ public: + tests fail and so force them to propagate the + lex->binlog_row_based_if_mixed upwards to the caller. + */ +- if ((variables.binlog_format == BINLOG_FORMAT_MIXED) && ++ if ((WSREP_BINLOG_FORMAT(variables.binlog_format) == BINLOG_FORMAT_MIXED)&& + (in_sub_stmt == 0)) + set_current_stmt_binlog_format_row(); + +@@ -3699,7 +3761,7 @@ public: + show_system_thread(system_thread))); + if (in_sub_stmt == 0) + { +- if (variables.binlog_format == BINLOG_FORMAT_ROW) ++ if (WSREP_BINLOG_FORMAT(variables.binlog_format) == BINLOG_FORMAT_ROW) + set_current_stmt_binlog_format_row(); + else if (temporary_tables == NULL) + clear_current_stmt_binlog_format_row(); +diff --git a/sql/sql_connect.cc b/sql/sql_connect.cc +index 67b671b..9034a6e 100644 +--- a/sql/sql_connect.cc ++++ b/sql/sql_connect.cc +@@ -57,6 +57,9 @@ using std::max; + #else + #define MIN_HANDSHAKE_SIZE 6 + #endif /* HAVE_OPENSSL && !EMBEDDED_LIBRARY */ ++#ifdef WITH_WSREP ++#include "wsrep_mysqld.h" ++#endif + + /* + Get structure for logging connection data for the current user +@@ -706,7 +709,11 @@ bool setup_connection_thread_globals(THD *thd) + { + if (thd->store_globals()) + { ++#ifdef WITH_WSREP ++ close_connection(thd, ER_OUT_OF_RESOURCES, 1); ++#else + close_connection(thd, ER_OUT_OF_RESOURCES); ++#endif + statistic_increment(aborted_connects,&LOCK_status); + MYSQL_CALLBACK(thread_scheduler, end_thread, (thd, 0)); + return 1; // Error +@@ -772,6 +779,17 @@ bool login_connection(THD *thd) + void end_connection(THD *thd) + { + NET *net= &thd->net; ++#ifdef WITH_WSREP ++ if (WSREP(thd)) ++ { ++ wsrep_status_t rcode= wsrep->free_connection(wsrep, thd->thread_id); ++ if (rcode) { ++ WSREP_WARN("wsrep failed to free connection context: %lu, code: %d", ++ thd->thread_id, rcode); ++ } ++ } ++ thd->wsrep_client_thread= 0; ++#endif + plugin_thdvar_cleanup(thd); + + /* +@@ -912,6 +930,9 @@ bool thd_prepare_connection(THD *thd) + (char *) thd->security_ctx->host_or_ip); + + prepare_new_connection_state(thd); ++#ifdef WITH_WSREP ++ thd->wsrep_client_thread= 1; ++#endif /* WITH_WSREP */ + return FALSE; + } + +@@ -933,7 +954,11 @@ void do_handle_one_connection(THD *thd_arg) + + if (MYSQL_CALLBACK_ELSE(thread_scheduler, init_new_connection_thread, (), 0)) + { ++#ifdef WITH_WSREP ++ close_connection(thd, ER_OUT_OF_RESOURCES, 1); ++#else + close_connection(thd, ER_OUT_OF_RESOURCES); ++#endif + statistic_increment(aborted_connects,&LOCK_status); + MYSQL_CALLBACK(thread_scheduler, end_thread, (thd, 0)); + return; +@@ -983,9 +1008,21 @@ void do_handle_one_connection(THD *thd_arg) + break; + } + end_connection(thd); ++#ifdef WITH_WSREP ++ if (WSREP(thd)) ++ { ++ mysql_mutex_lock(&thd->LOCK_wsrep_thd); ++ thd->wsrep_query_state= QUERY_EXITING; ++ mysql_mutex_unlock(&thd->LOCK_wsrep_thd); ++ } ++#endif + + end_thread: ++#ifdef WITH_WSREP ++ close_connection(thd, 0, 1); ++#else + close_connection(thd); ++#endif + if (MYSQL_CALLBACK_ELSE(thread_scheduler, end_thread, (thd, 1), 0)) + return; // Probably no-threads + +diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc +index f3e8876..1b9ef9b 100644 +--- a/sql/sql_delete.cc ++++ b/sql/sql_delete.cc +@@ -451,7 +451,11 @@ cleanup: + /* See similar binlogging code in sql_update.cc, for comments */ + if ((error < 0) || thd->transaction.stmt.cannot_safely_rollback()) + { ++#ifdef WITH_WSREP ++ if ((WSREP_EMULATE_BINLOG(thd) || mysql_bin_log.is_open())) ++#else + if (mysql_bin_log.is_open()) ++#endif + { + int errcode= 0; + if (error < 0) +@@ -896,7 +900,11 @@ void multi_delete::abort_result_set() + /* + there is only side effects; to binlog with the error + */ ++#ifdef WITH_WSREP ++ if (WSREP_EMULATE_BINLOG(thd) || mysql_bin_log.is_open()) ++#else + if (mysql_bin_log.is_open()) ++#endif + { + int errcode= query_error_code(thd, thd->killed == THD::NOT_KILLED); + /* possible error of writing binary log is ignored deliberately */ +@@ -1067,7 +1075,11 @@ bool multi_delete::send_eof() + } + if ((local_error == 0) || thd->transaction.stmt.cannot_safely_rollback()) + { ++#ifdef WITH_WSREP ++ if (WSREP_EMULATE_BINLOG(thd) || mysql_bin_log.is_open()) ++#else + if (mysql_bin_log.is_open()) ++#endif + { + int errcode= 0; + if (local_error == 0) +diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc +index 114beaa..3da18a4 100644 +--- a/sql/sql_insert.cc ++++ b/sql/sql_insert.cc +@@ -1124,7 +1124,11 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list, + thd->transaction.stmt.cannot_safely_rollback() || + was_insert_delayed) + { ++#ifdef WITH_WSREP ++ if (WSREP_EMULATE_BINLOG(thd) || mysql_bin_log.is_open()) ++#else + if (mysql_bin_log.is_open()) ++#endif + { + int errcode= 0; + if (error <= 0) +@@ -3773,7 +3777,13 @@ bool select_insert::send_eof() + DBUG_PRINT("enter", ("trans_table=%d, table_type='%s'", + trans_table, table->file->table_type())); + ++#ifdef WITH_WSREP ++ error= (thd->wsrep_conflict_state == MUST_ABORT || ++ thd->wsrep_conflict_state == CERT_FAILURE) ? -1 : ++ (bulk_insert_started ? ++#else + error= (bulk_insert_started ? ++#endif /* WITH_WSREP */ + table->file->ha_end_bulk_insert() : 0); + if (!error && thd->is_error()) + error= thd->get_stmt_da()->sql_errno(); +@@ -3800,8 +3810,13 @@ bool select_insert::send_eof() + events are in the transaction cache and will be written when + ha_autocommit_or_rollback() is issued below. + */ ++#ifdef WITH_WSREP ++ if ((WSREP_EMULATE_BINLOG(thd) || mysql_bin_log.is_open()) && ++ (!error || thd->transaction.stmt.cannot_safely_rollback())) ++#else + if (mysql_bin_log.is_open() && + (!error || thd->transaction.stmt.cannot_safely_rollback())) ++#endif + { + int errcode= 0; + if (!error) +@@ -3886,7 +3901,11 @@ void select_insert::abort_result_set() { + transactional_table= table->file->has_transactions(); + if (thd->transaction.stmt.cannot_safely_rollback()) + { ++#ifdef WITH_WSREP ++ if (WSREP_EMULATE_BINLOG(thd) || mysql_bin_log.is_open()) ++#else + if (mysql_bin_log.is_open()) ++#endif + { + int errcode= query_error_code(thd, thd->killed == THD::NOT_KILLED); + /* error of writing binary log is ignored */ +@@ -4293,7 +4312,11 @@ select_create::binlog_show_create_table(TABLE **tables, uint count) + /* show_database */ TRUE); + DBUG_ASSERT(result == 0); /* store_create_info() always return 0 */ + ++#ifdef WITH_WSREP ++ if (WSREP_EMULATE_BINLOG(thd) || mysql_bin_log.is_open()) ++#else + if (mysql_bin_log.is_open()) ++#endif /* WITH_WSREP */ + { + int errcode= query_error_code(thd, thd->killed == THD::NOT_KILLED); + result= thd->binlog_query(THD::STMT_QUERY_TYPE, +@@ -4303,6 +4326,9 @@ select_create::binlog_show_create_table(TABLE **tables, uint count) + /* suppress_use */ FALSE, + errcode); + } ++#ifdef WITH_WSREP ++ ha_wsrep_fake_trx_id(thd); ++#endif + return result; + } + +@@ -4368,6 +4394,18 @@ bool select_create::send_eof() + { + trans_commit_stmt(thd); + trans_commit_implicit(thd); ++#ifdef WITH_WSREP ++ mysql_mutex_lock(&thd->LOCK_wsrep_thd); ++ if (thd->wsrep_conflict_state != NO_CONFLICT) ++ { ++ WSREP_DEBUG("select_create commit failed, thd: %lu err: %d %s", ++ thd->thread_id, thd->wsrep_conflict_state, thd->query()); ++ mysql_mutex_unlock(&thd->LOCK_wsrep_thd); ++ abort_result_set(); ++ return TRUE; ++ } ++ mysql_mutex_unlock(&thd->LOCK_wsrep_thd); ++#endif /* WITH_WSREP */ + } + + table->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY); +diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc +index 0ba8bcb..f9e1e6b 100644 +--- a/sql/sql_parse.cc ++++ b/sql/sql_parse.cc +@@ -107,6 +107,12 @@ using std::min; + + #define FLAGSTR(V,F) ((V)&(F)?#F" ":"") + ++#ifdef WITH_WSREP ++#include "wsrep_mysqld.h" ++#include "wsrep_thd.h" ++static void wsrep_mysql_parse(THD *thd, char *rawbuf, uint length, ++ Parser_state *parser_state); ++#endif /* WITH_WSREP */ + /** + @defgroup Runtime_Environment Runtime Environment + @{ +@@ -823,7 +829,11 @@ void do_handle_bootstrap(THD *thd) + if (my_thread_init() || thd->store_globals()) + { + #ifndef EMBEDDED_LIBRARY ++#ifdef WITH_WSREP ++ close_connection(thd, ER_OUT_OF_RESOURCES, 1); ++#else + close_connection(thd, ER_OUT_OF_RESOURCES); ++#endif /* WITH_WSREP */ + #endif + thd->fatal_error(); + goto end; +@@ -913,7 +923,18 @@ bool do_command(THD *thd) + enum enum_server_command command; + + DBUG_ENTER("do_command"); +- ++#ifdef WITH_WSREP ++ if (WSREP(thd)) ++ { ++ mysql_mutex_lock(&thd->LOCK_wsrep_thd); ++ thd->wsrep_query_state= QUERY_IDLE; ++ if (thd->wsrep_conflict_state==MUST_ABORT) ++ { ++ wsrep_client_rollback(thd); ++ } ++ mysql_mutex_unlock(&thd->LOCK_wsrep_thd); ++ } ++#endif /* WITH_WSREP */ + /* + indicator of uninitialized lex => normal flow of errors handling + (see my_message_sql) +@@ -952,7 +973,6 @@ bool do_command(THD *thd) + matter here, because the read/recv() below doesn't use it. + */ + DEBUG_SYNC(thd, "before_do_command_net_read"); +- + /* + Because of networking layer callbacks in place, + this call will maintain the following instrumentation: +@@ -968,12 +988,45 @@ bool do_command(THD *thd) + packet_length= my_net_read(net); + thd->m_server_idle= false; + ++#ifdef WITH_WSREP ++ if (WSREP(thd)) { ++ mysql_mutex_lock(&thd->LOCK_wsrep_thd); ++ /* these THD's are aborted or are aborting during being idle */ ++ if (thd->wsrep_conflict_state == ABORTING) ++ { ++ while (thd->wsrep_conflict_state == ABORTING) { ++ mysql_mutex_unlock(&thd->LOCK_wsrep_thd); ++ my_sleep(1000); ++ mysql_mutex_lock(&thd->LOCK_wsrep_thd); ++ } ++ thd->store_globals(); ++ } ++ else if (thd->wsrep_conflict_state == ABORTED) ++ { ++ thd->store_globals(); ++ } ++ ++ thd->wsrep_query_state= QUERY_EXEC; ++ mysql_mutex_unlock(&thd->LOCK_wsrep_thd); ++ } ++#endif /* WITH_WSREP */ + if (packet_length == packet_error) + { + DBUG_PRINT("info",("Got error %d reading command from socket %s", + net->error, + vio_description(net->vio))); + ++#ifdef WITH_WSREP ++ if (WSREP(thd)) { ++ mysql_mutex_lock(&thd->LOCK_wsrep_thd); ++ if (thd->wsrep_conflict_state == MUST_ABORT) ++ { ++ DBUG_PRINT("wsrep",("aborted for wsrep rollback: %lu", thd->real_id)); ++ wsrep_client_rollback(thd); ++ } ++ mysql_mutex_unlock(&thd->LOCK_wsrep_thd); ++ } ++#endif /* WITH_WSREP */ + /* Instrument this broken statement as "statement/com/error" */ + thd->m_statement_psi= MYSQL_REFINE_STATEMENT(thd->m_statement_psi, + com_statement_info[COM_END].m_key); +@@ -1026,6 +1079,33 @@ bool do_command(THD *thd) + vio_description(net->vio), command, + command_name[command].str)); + ++#ifdef WITH_WSREP ++ if (WSREP(thd)) { ++ /* ++ * bail out if DB snapshot has not been installed. We however, ++ * allow queries "SET" and "SHOW", they are trapped later in execute_command ++ */ ++ if (thd->variables.wsrep_on && !thd->wsrep_applier && !wsrep_ready && ++ command != COM_QUERY && ++ command != COM_PING && ++ command != COM_QUIT && ++ command != COM_PROCESS_INFO && ++ command != COM_PROCESS_KILL && ++ command != COM_SET_OPTION && ++ command != COM_SHUTDOWN && ++ command != COM_SLEEP && ++ command != COM_STATISTICS && ++ command != COM_TIME && ++ command != COM_END ++ ) { ++ my_error(ER_UNKNOWN_COM_ERROR, MYF(0), ++ "WSREP has not yet prepared node for application use"); ++ thd->protocol->end_statement(); ++ return_value= FALSE; ++ goto out; ++ } ++ } ++#endif /* WITH_WSREP */ + /* Restore read timeout value */ + my_net_set_read_timeout(net, thd->variables.net_read_timeout); + +@@ -1033,6 +1113,22 @@ bool do_command(THD *thd) + + return_value= dispatch_command(command, thd, packet+1, (uint) (packet_length-1)); + ++#ifdef WITH_WSREP ++ if (WSREP(thd)) { ++ while (thd->wsrep_conflict_state== RETRY_AUTOCOMMIT) ++ { ++ return_value= dispatch_command(command, thd, thd->wsrep_retry_query, ++ thd->wsrep_retry_query_len); ++ } ++ } ++ if (thd->wsrep_retry_query && thd->wsrep_conflict_state != REPLAYING) ++ { ++ my_free(thd->wsrep_retry_query); ++ thd->wsrep_retry_query = NULL; ++ thd->wsrep_retry_query_len = 0; ++ thd->wsrep_retry_command = COM_CONNECT; ++ } ++#endif /* WITH_WSREP */ + out: + /* The statement instrumentation must be closed in all cases. */ + DBUG_ASSERT(thd->m_statement_psi == NULL); +@@ -1108,6 +1204,36 @@ static my_bool deny_updates_if_read_only_option(THD *thd, + DBUG_RETURN(FALSE); + } + ++#ifdef WITH_WSREP ++static my_bool wsrep_read_only_option(THD *thd, TABLE_LIST *all_tables) ++{ ++ int opt_readonly_saved = opt_readonly; ++ ulong flag_saved = (ulong)(thd->security_ctx->master_access & SUPER_ACL); ++ ++ opt_readonly = 0; ++ thd->security_ctx->master_access &= ~SUPER_ACL; ++ ++ my_bool ret = !deny_updates_if_read_only_option(thd, all_tables); ++ ++ opt_readonly = opt_readonly_saved; ++ thd->security_ctx->master_access |= flag_saved; ++ ++ return ret; ++} ++ ++static void wsrep_copy_query(THD *thd) ++{ ++ thd->wsrep_retry_command = thd->get_command(); ++ thd->wsrep_retry_query_len = thd->query_length(); ++ if (thd->wsrep_retry_query) { ++ my_free(thd->wsrep_retry_query); ++ } ++ thd->wsrep_retry_query = (char *)my_malloc( ++ thd->wsrep_retry_query_len + 1, MYF(0)); ++ strncpy(thd->wsrep_retry_query, thd->query(), thd->wsrep_retry_query_len); ++ thd->wsrep_retry_query[thd->wsrep_retry_query_len] = '\0'; ++} ++#endif /* WITH_WSREP */ + /** + Perform one connection-level (COM_XXXX) command. + +@@ -1136,7 +1262,42 @@ bool dispatch_command(enum enum_server_command command, THD *thd, + bool error= 0; + DBUG_ENTER("dispatch_command"); + DBUG_PRINT("info",("packet: '%*.s'; command: %d", packet_length, packet, command)); ++#ifdef WITH_WSREP ++ if (WSREP(thd)) { ++ if (!thd->in_multi_stmt_transaction_mode()) ++ { ++ thd->wsrep_PA_safe= true; ++ } + ++ mysql_mutex_lock(&thd->LOCK_wsrep_thd); ++ thd->wsrep_query_state= QUERY_EXEC; ++ if (thd->wsrep_conflict_state== RETRY_AUTOCOMMIT) ++ { ++ thd->wsrep_conflict_state= NO_CONFLICT; ++ } ++ if (thd->wsrep_conflict_state== MUST_ABORT) ++ { ++ wsrep_client_rollback(thd); ++ } ++ if (thd->wsrep_conflict_state== ABORTED) ++ { ++ my_error(ER_LOCK_DEADLOCK, MYF(0), "wsrep aborted transaction"); ++ WSREP_DEBUG("Deadlock error for: %s", thd->query()); ++ mysql_mutex_unlock(&thd->LOCK_wsrep_thd); ++ thd->killed = THD::NOT_KILLED; ++ thd->mysys_var->abort = 0; ++ thd->wsrep_conflict_state = NO_CONFLICT; ++ thd->wsrep_retry_counter = 0; ++ /* ++ Increment threads running to compensate dec_thread_running() called ++ after dispatch_end label. ++ */ ++ inc_thread_running(); ++ goto dispatch_end; ++ } ++ mysql_mutex_unlock(&thd->LOCK_wsrep_thd); ++ } ++#endif /* WITH_WSREP */ + /* SHOW PROFILE instrumentation, begin */ + #if defined(ENABLED_PROFILING) + thd->profiling.start_new_query(); +@@ -1319,6 +1480,37 @@ bool dispatch_command(enum enum_server_command command, THD *thd, + + DBUG_PRINT("query",("%-.4096s",thd->query())); + ++#ifdef WITH_WSREP ++ ++ if (WSREP(thd)) { ++ if (!thd->in_multi_stmt_transaction_mode()) ++ { ++ thd->wsrep_PA_safe= true; ++ } ++ ++ mysql_mutex_lock(&thd->LOCK_wsrep_thd); ++ thd->wsrep_query_state= QUERY_EXEC; ++ if (thd->wsrep_conflict_state== RETRY_AUTOCOMMIT) ++ { ++ thd->wsrep_conflict_state= NO_CONFLICT; ++ } ++ ++ if (thd->wsrep_conflict_state== MUST_ABORT) ++ { ++ wsrep_client_rollback(thd); ++ } ++ if (thd->wsrep_conflict_state== ABORTED) ++ { ++ my_error(ER_LOCK_DEADLOCK, MYF(0), "wsrep aborted transaction"); ++ WSREP_DEBUG("Deadlock error for: %s", thd->query()); ++ mysql_mutex_unlock(&thd->LOCK_wsrep_thd); ++ thd->killed= THD::NOT_KILLED; ++ thd->mysys_var->abort= 0; ++ goto dispatch_end; ++ } ++ mysql_mutex_unlock(&thd->LOCK_wsrep_thd); ++ } ++#endif /* WITH_WSREP */ + #if defined(ENABLED_PROFILING) + thd->profiling.set_query_source(thd->query(), thd->query_length()); + #endif +@@ -1329,7 +1521,11 @@ bool dispatch_command(enum enum_server_command command, THD *thd, + if (parser_state.init(thd, thd->query(), thd->query_length())) + break; + ++#ifdef WITH_WSREP ++ wsrep_mysql_parse(thd, thd->query(), thd->query_length(), &parser_state); ++#else + mysql_parse(thd, thd->query(), thd->query_length(), &parser_state); ++#endif /* WITH_WSREP */ + + while (!thd->killed && (parser_state.m_lip.found_semicolon != NULL) && + ! thd->is_error()) +@@ -1401,10 +1597,19 @@ bool dispatch_command(enum enum_server_command command, THD *thd, + Count each statement from the client. + */ + statistic_increment(thd->status_var.questions, &LOCK_status); ++#ifdef WITH_WSREP ++ if (!WSREP(thd)) ++ thd->set_time(); /* Reset the query start time. */ ++#else + thd->set_time(); /* Reset the query start time. */ ++#endif /* WITH_WSREP */ + parser_state.reset(beginning_of_next_stmt, length); + /* TODO: set thd->lex->sql_command to SQLCOM_END here */ ++#ifdef WITH_WSREP ++ wsrep_mysql_parse(thd, beginning_of_next_stmt, length, &parser_state); ++#else + mysql_parse(thd, beginning_of_next_stmt, length, &parser_state); ++#endif /* WITH_WSREP */ + } + + DBUG_PRINT("info",("query ready")); +@@ -1746,6 +1951,26 @@ bool dispatch_command(enum enum_server_command command, THD *thd, + my_message(ER_UNKNOWN_COM_ERROR, ER(ER_UNKNOWN_COM_ERROR), MYF(0)); + break; + } ++#ifdef WITH_WSREP ++ dispatch_end: ++ ++ if (WSREP(thd)) { ++ /* wsrep BF abort in query exec phase */ ++ mysql_mutex_lock(&thd->LOCK_wsrep_thd); ++ if ((thd->wsrep_conflict_state != REPLAYING) && ++ (thd->wsrep_conflict_state != RETRY_AUTOCOMMIT)) { ++ mysql_mutex_unlock(&thd->LOCK_wsrep_thd); ++ ++ thd->update_server_status(); ++ thd->protocol->end_statement(); ++ query_cache_end_of_result(thd); ++ } ++ else ++ { ++ mysql_mutex_unlock(&thd->LOCK_wsrep_thd); ++ } ++ } else { /* if (WSREP(thd))... */ ++#endif /* WITH_WSREP */ + + done: + DBUG_ASSERT(thd->derived_tables == NULL && +@@ -1758,6 +1983,9 @@ done: + thd->send_kill_message(); + thd->protocol->end_statement(); + query_cache_end_of_result(thd); ++#ifdef WITH_WSREP ++ } ++#endif /* WITH_WSREP */ + + if (!thd->is_error() && !thd->killed_errno()) + mysql_audit_general(thd, MYSQL_AUDIT_GENERAL_RESULT, 0, 0); +@@ -2256,6 +2484,13 @@ err: + return TRUE; + } + ++#ifdef WITH_WSREP ++static bool wsrep_is_show_query(enum enum_sql_command command) ++{ ++ DBUG_ASSERT(command >= 0 && command <= SQLCOM_END); ++ return (sql_command_flags[command] & CF_STATUS_COMMAND) != 0; ++} ++#endif /* WITH_WSREP */ + + /** + Execute command saved in thd and lex->sql_command. +@@ -2497,7 +2732,6 @@ mysql_execute_command(THD *thd) + #ifdef HAVE_REPLICATION + } /* endif unlikely slave */ + #endif +- + status_var_increment(thd->status_var.com_stat[lex->sql_command]); + + Opt_trace_start ots(thd, all_tables, lex->sql_command, &lex->var_list, +@@ -2506,6 +2740,45 @@ mysql_execute_command(THD *thd) + + Opt_trace_object trace_command(&thd->opt_trace); + Opt_trace_array trace_command_steps(&thd->opt_trace, "steps"); ++#ifdef WITH_WSREP ++ if (WSREP(thd)) { ++ /* ++ change LOCK TABLE WRITE to transaction ++ */ ++ if (lex->sql_command== SQLCOM_LOCK_TABLES && wsrep_convert_LOCK_to_trx) ++ { ++ for (TABLE_LIST *table= all_tables; table; table= table->next_global) ++ { ++ if (table->lock_type >= TL_WRITE_ALLOW_WRITE) ++ { ++ lex->sql_command= SQLCOM_BEGIN; ++ thd->wsrep_converted_lock_session= true; ++ break; ++ } ++ } ++ } ++ if (lex->sql_command== SQLCOM_UNLOCK_TABLES && ++ thd->wsrep_converted_lock_session) ++ { ++ thd->wsrep_converted_lock_session= false; ++ lex->sql_command= SQLCOM_COMMIT; ++ lex->tx_release= TVL_NO; ++ } ++ ++ /* ++ * bail out if DB snapshot has not been installed. We however, ++ * allow SET and SHOW queries ++ */ ++ if (thd->variables.wsrep_on && !thd->wsrep_applier && !wsrep_ready && ++ lex->sql_command != SQLCOM_SET_OPTION && ++ !wsrep_is_show_query(lex->sql_command)) ++ { ++ my_error(ER_UNKNOWN_COM_ERROR, MYF(0), ++ "WSREP has not yet prepared node for application use"); ++ goto error; ++ } ++ } ++#endif /* WITH_WSREP */ + + DBUG_ASSERT(thd->transaction.stmt.cannot_safely_rollback() == FALSE); + +@@ -2546,7 +2819,13 @@ mysql_execute_command(THD *thd) + + /* Commit the normal transaction if one is active. */ + if (trans_commit_implicit(thd)) ++ { ++ thd->mdl_context.release_transactional_locks(); ++#ifdef WITH_WSREP ++ WSREP_DEBUG("implicit commit failed, MDL released: %lu", thd->thread_id); ++#endif /* WITH_WSREP */ + goto error; ++ } + /* Release metadata locks acquired in this transaction. */ + thd->mdl_context.release_transactional_locks(); + } +@@ -2600,7 +2879,9 @@ mysql_execute_command(THD *thd) + { + system_status_var old_status_var= thd->status_var; + thd->initial_status_var= &old_status_var; +- ++#ifdef WITH_WSREP ++ if (WSREP_CLIENT(thd) && wsrep_sync_wait(thd)) goto error; ++#endif /* WITH_WSREP */ + if (!(res= select_precheck(thd, lex, all_tables, first_table))) + res= execute_sqlcom_select(thd, all_tables); + +@@ -2616,6 +2897,9 @@ mysql_execute_command(THD *thd) + &old_status_var); + thd->status_var= old_status_var; + mysql_mutex_unlock(&LOCK_status); ++#ifdef WITH_WSREP ++ if (lex->sql_command == SQLCOM_SHOW_STATUS) wsrep_free_status(thd); ++#endif /* WITH_WSREP */ + break; + } + case SQLCOM_SHOW_EVENTS: +@@ -2633,12 +2917,22 @@ mysql_execute_command(THD *thd) + case SQLCOM_SHOW_PLUGINS: + case SQLCOM_SHOW_FIELDS: + case SQLCOM_SHOW_KEYS: ++#ifndef WITH_WSREP + case SQLCOM_SHOW_VARIABLES: + case SQLCOM_SHOW_CHARSETS: + case SQLCOM_SHOW_COLLATIONS: + case SQLCOM_SHOW_STORAGE_ENGINES: + case SQLCOM_SHOW_PROFILE: ++#endif /* WITH_WSREP */ + case SQLCOM_SELECT: ++#ifdef WITH_WSREP ++ if (WSREP_CLIENT(thd) && wsrep_sync_wait(thd)) goto error; ++ case SQLCOM_SHOW_VARIABLES: ++ case SQLCOM_SHOW_CHARSETS: ++ case SQLCOM_SHOW_COLLATIONS: ++ case SQLCOM_SHOW_STORAGE_ENGINES: ++ case SQLCOM_SHOW_PROFILE: ++#endif /* WITH_WSREP */ + { + thd->status_var.last_query_cost= 0.0; + thd->status_var.last_query_partial_plans= 0; +@@ -2938,7 +3232,7 @@ case SQLCOM_PREPARE: + */ + if (thd->query_name_consts && + mysql_bin_log.is_open() && +- thd->variables.binlog_format == BINLOG_FORMAT_STMT && ++ WSREP_BINLOG_FORMAT(thd->variables.binlog_format) == BINLOG_FORMAT_STMT && + !mysql_bin_log.is_query_in_union(thd, thd->query_id)) + { + List_iterator_fast it(select_lex->item_list); +@@ -3056,6 +3350,15 @@ case SQLCOM_PREPARE: + } + else + { ++#ifdef WITH_WSREP ++ /* in STATEMENT format, we probably have to replicate also temporary ++ tables, like mysql replication does ++ */ ++ if (!thd->is_current_stmt_binlog_format_row() || ++ !(create_info.options & HA_LEX_CREATE_TMP_TABLE)) ++ WSREP_TO_ISOLATION_BEGIN(create_table->db, create_table->table_name, ++ NULL) ++#endif /* WITH_WSREP */ + /* Regular CREATE TABLE */ + res= mysql_create_table(thd, create_table, + &create_info, &alter_info); +@@ -3089,6 +3392,7 @@ end_with_restore_list: + DBUG_ASSERT(first_table == all_tables && first_table != 0); + if (check_one_table_access(thd, INDEX_ACL, all_tables)) + goto error; /* purecov: inspected */ ++ WSREP_TO_ISOLATION_BEGIN(first_table->db, first_table->table_name, NULL) + /* + Currently CREATE INDEX or DROP INDEX cause a full table rebuild + and thus classify as slow administrative statements just like +@@ -3181,8 +3485,11 @@ end_with_restore_list: + goto error; + } + ++ WSREP_TO_ISOLATION_BEGIN(0, 0, first_table) + if (mysql_rename_tables(thd, first_table, 0)) ++ { + goto error; ++ } + break; + } + #ifndef EMBEDDED_LIBRARY +@@ -3208,6 +3515,10 @@ end_with_restore_list: + goto error; + #else + { ++#ifdef WITH_WSREP ++ if (WSREP_CLIENT(thd) && wsrep_sync_wait(thd)) goto error; ++#endif /* WITH_WSREP */ ++ + /* + Access check: + SHOW CREATE TABLE require any privileges on the table level (ie +@@ -3270,6 +3581,10 @@ end_with_restore_list: + case SQLCOM_CHECKSUM: + { + DBUG_ASSERT(first_table == all_tables && first_table != 0); ++#ifdef WITH_WSREP ++ if (WSREP_CLIENT(thd) && wsrep_sync_wait(thd)) goto error; ++#endif /* WITH_WSREP */ ++ + if (check_table_access(thd, SELECT_ACL, all_tables, + FALSE, UINT_MAX, FALSE)) + goto error; /* purecov: inspected */ +@@ -3278,6 +3593,10 @@ end_with_restore_list: + break; + } + case SQLCOM_UPDATE: ++#ifdef WITH_WSREP ++ if (WSREP_CLIENT(thd) && ++ wsrep_sync_wait(thd, WSREP_SYNC_WAIT_BEFORE_UPDATE_DELETE)) goto error; ++#endif /* WITH_WSREP */ + { + ha_rows found= 0, updated= 0; + DBUG_ASSERT(first_table == all_tables && first_table != 0); +@@ -3317,6 +3636,10 @@ end_with_restore_list: + /* if we switched from normal update, rights are checked */ + if (up_result != 2) + { ++#ifdef WITH_WSREP ++ if (WSREP_CLIENT(thd) && ++ wsrep_sync_wait(thd, WSREP_SYNC_WAIT_BEFORE_UPDATE_DELETE)) goto error; ++#endif /* WITH_WSREP */ + if ((res= multi_update_precheck(thd, all_tables))) + break; + } +@@ -3386,6 +3709,10 @@ end_with_restore_list: + break; + } + case SQLCOM_REPLACE: ++#ifdef WITH_WSREP ++ if (WSREP_CLIENT(thd) && ++ wsrep_sync_wait(thd, WSREP_SYNC_WAIT_BEFORE_INSERT_REPLACE)) goto error; ++#endif /* WITH_WSREP */ + #ifndef DBUG_OFF + if (mysql_bin_log.is_open()) + { +@@ -3420,6 +3747,10 @@ end_with_restore_list: + } + #endif + case SQLCOM_INSERT: ++#ifdef WITH_WSREP ++ if (WSREP_CLIENT(thd) && ++ wsrep_sync_wait(thd, WSREP_SYNC_WAIT_BEFORE_INSERT_REPLACE)) goto error; ++#endif /* WITH_WSREP */ + { + DBUG_ASSERT(first_table == all_tables && first_table != 0); + +@@ -3465,11 +3796,23 @@ end_with_restore_list: + } + case SQLCOM_REPLACE_SELECT: + case SQLCOM_INSERT_SELECT: ++#ifdef WITH_WSREP ++ if (WSREP_CLIENT(thd) && ++ wsrep_sync_wait(thd, WSREP_SYNC_WAIT_BEFORE_INSERT_REPLACE)) goto error; ++#endif /* WITH_WSREP */ + { + select_insert *sel_result; + DBUG_ASSERT(first_table == all_tables && first_table != 0); + if ((res= insert_precheck(thd, all_tables))) + break; ++#ifdef WITH_WSREP ++ if (thd->wsrep_consistency_check == CONSISTENCY_CHECK_DECLARED) ++ { ++ thd->wsrep_consistency_check = CONSISTENCY_CHECK_RUNNING; ++ WSREP_TO_ISOLATION_BEGIN(first_table->db, first_table->table_name, NULL); ++ } ++ ++#endif + /* + INSERT...SELECT...ON DUPLICATE KEY UPDATE/REPLACE SELECT/ + INSERT...IGNORE...SELECT can be unsafe, unless ORDER BY PRIMARY KEY +@@ -3555,6 +3898,10 @@ end_with_restore_list: + break; + } + case SQLCOM_DELETE: ++#ifdef WITH_WSREP ++ if (WSREP_CLIENT(thd) && ++ wsrep_sync_wait(thd, WSREP_SYNC_WAIT_BEFORE_UPDATE_DELETE)) goto error; ++#endif /* WITH_WSREP */ + { + DBUG_ASSERT(first_table == all_tables && first_table != 0); + if ((res= delete_precheck(thd, all_tables))) +@@ -3570,6 +3917,10 @@ end_with_restore_list: + break; + } + case SQLCOM_DELETE_MULTI: ++#ifdef WITH_WSREP ++ if (WSREP_CLIENT(thd) && ++ wsrep_sync_wait(thd, WSREP_SYNC_WAIT_BEFORE_UPDATE_DELETE)) goto error; ++#endif /* WITH_WSREP */ + { + DBUG_ASSERT(first_table == all_tables && first_table != 0); + TABLE_LIST *aux_tables= thd->lex->auxiliary_table_list.first; +@@ -3636,6 +3987,18 @@ end_with_restore_list: + if (check_table_access(thd, DROP_ACL, all_tables, FALSE, UINT_MAX, FALSE)) + goto error; /* purecov: inspected */ + } ++#ifdef WITH_WSREP ++ for (TABLE_LIST *table= all_tables; table; table= table->next_global) ++ { ++ if (!lex->drop_temporary && ++ (!thd->is_current_stmt_binlog_format_row() || ++ !find_temporary_table(thd, table))) ++ { ++ WSREP_TO_ISOLATION_BEGIN(NULL, NULL, all_tables); ++ break; ++ } ++ } ++#endif /* WITH_WSREP */ + /* DDL and binlog write order are protected by metadata locks. */ + res= mysql_rm_table(thd, first_table, lex->drop_if_exists, + lex->drop_temporary); +@@ -3673,7 +4036,6 @@ end_with_restore_list: + + if (!mysql_change_db(thd, &db_str, FALSE)) + my_ok(thd); +- + break; + } + +@@ -3836,6 +4198,7 @@ end_with_restore_list: + #endif + if (check_access(thd, CREATE_ACL, lex->name.str, NULL, NULL, 1, 0)) + break; ++ WSREP_TO_ISOLATION_BEGIN(lex->name.str, NULL, NULL) + res= mysql_create_db(thd,(lower_case_table_names == 2 ? alias : + lex->name.str), &create_info, 0); + break; +@@ -3860,6 +4223,7 @@ end_with_restore_list: + #endif + if (check_access(thd, DROP_ACL, lex->name.str, NULL, NULL, 1, 0)) + break; ++ WSREP_TO_ISOLATION_BEGIN(lex->name.str, NULL, NULL) + res= mysql_rm_db(thd, lex->name.str, lex->drop_if_exists, 0); + break; + } +@@ -3883,6 +4247,7 @@ end_with_restore_list: + res= 1; + break; + } ++ WSREP_TO_ISOLATION_BEGIN(db->str, NULL, NULL) + res= mysql_upgrade_db(thd, db); + if (!res) + my_ok(thd); +@@ -3910,6 +4275,7 @@ end_with_restore_list: + #endif + if (check_access(thd, ALTER_ACL, db->str, NULL, NULL, 1, 0)) + break; ++ WSREP_TO_ISOLATION_BEGIN(db->str, NULL, NULL) + res= mysql_alter_db(thd, db->str, &create_info); + break; + } +@@ -3939,6 +4305,7 @@ end_with_restore_list: + if (res) + break; + ++ WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL) + switch (lex->sql_command) { + case SQLCOM_CREATE_EVENT: + { +@@ -3973,6 +4340,7 @@ end_with_restore_list: + lex->spname->m_name); + break; + case SQLCOM_DROP_EVENT: ++ WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL) + if (!(res= Events::drop_event(thd, + lex->spname->m_db, lex->spname->m_name, + lex->drop_if_exists))) +@@ -3987,6 +4355,7 @@ end_with_restore_list: + if (check_access(thd, INSERT_ACL, "mysql", NULL, NULL, 1, 0)) + break; + #ifdef HAVE_DLOPEN ++ WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL) + if (!(res = mysql_create_function(thd, &lex->udf))) + my_ok(thd); + #else +@@ -4001,6 +4370,7 @@ end_with_restore_list: + if (check_access(thd, INSERT_ACL, "mysql", NULL, NULL, 1, 1) && + check_global_access(thd,CREATE_USER_ACL)) + break; ++ WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL) + /* Conditionally writes to binlog */ + if (!(res= mysql_create_user(thd, lex->users_list))) + my_ok(thd); +@@ -4012,6 +4382,7 @@ end_with_restore_list: + check_global_access(thd,CREATE_USER_ACL)) + break; + /* Conditionally writes to binlog */ ++ WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL) + if (!(res= mysql_drop_user(thd, lex->users_list))) + my_ok(thd); + break; +@@ -4022,6 +4393,7 @@ end_with_restore_list: + check_global_access(thd,CREATE_USER_ACL)) + break; + /* Conditionally writes to binlog */ ++ WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL) + if (!(res= mysql_rename_user(thd, lex->users_list))) + my_ok(thd); + break; +@@ -4036,6 +4408,7 @@ end_with_restore_list: + thd->binlog_invoker(); + + /* Conditionally writes to binlog */ ++ WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL) + if (!(res = mysql_revoke_all(thd, lex->users_list))) + my_ok(thd); + break; +@@ -4102,6 +4475,7 @@ end_with_restore_list: + lex->type == TYPE_ENUM_PROCEDURE, 0)) + goto error; + /* Conditionally writes to binlog */ ++ WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL) + res= mysql_routine_grant(thd, all_tables, + lex->type == TYPE_ENUM_PROCEDURE, + lex->users_list, grants, +@@ -4115,6 +4489,7 @@ end_with_restore_list: + all_tables, FALSE, UINT_MAX, FALSE)) + goto error; + /* Conditionally writes to binlog */ ++ WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL) + res= mysql_table_grant(thd, all_tables, lex->users_list, + lex->columns, lex->grant, + lex->sql_command == SQLCOM_REVOKE); +@@ -4130,6 +4505,7 @@ end_with_restore_list: + } + else + { ++ WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL) + /* Conditionally writes to binlog */ + res = mysql_grant(thd, select_lex->db, lex->users_list, lex->grant, + lex->sql_command == SQLCOM_REVOKE, +@@ -4258,7 +4634,13 @@ end_with_restore_list: + #endif + case SQLCOM_BEGIN: + if (trans_begin(thd, lex->start_transaction_opt)) ++ { ++ thd->mdl_context.release_transactional_locks(); ++#ifdef WITH_WSREP ++ WSREP_DEBUG("BEGIN failed, MDL released: %lu", thd->thread_id); ++#endif /* WITH_WSREP */ + goto error; ++ } + my_ok(thd); + break; + case SQLCOM_COMMIT: +@@ -4272,7 +4654,13 @@ end_with_restore_list: + (thd->variables.completion_type == 2 && + lex->tx_release != TVL_NO)); + if (trans_commit(thd)) ++ { ++ thd->mdl_context.release_transactional_locks(); ++#ifdef WITH_WSREP ++ WSREP_DEBUG("COMMIT failed, MDL released: %lu", thd->thread_id); ++#endif /* WITH_WSREP */ + goto error; ++ } + thd->mdl_context.release_transactional_locks(); + /* Begin transaction with the same isolation level. */ + if (tx_chain) +@@ -4289,7 +4677,20 @@ end_with_restore_list: + /* Disconnect the current client connection. */ + if (tx_release) + thd->killed= THD::KILL_CONNECTION; ++#ifdef WITH_WSREP ++ if (WSREP(thd)) { ++ ++ if (thd->wsrep_conflict_state == NO_CONFLICT || ++ thd->wsrep_conflict_state == REPLAYING) ++ { ++ my_ok(thd); ++ } ++ } else { ++#endif /* WITH_WSREP */ + my_ok(thd); ++#ifdef WITH_WSREP ++ } ++#endif /* WITH_WSREP */ + break; + } + case SQLCOM_ROLLBACK: +@@ -4303,7 +4704,13 @@ end_with_restore_list: + (thd->variables.completion_type == 2 && + lex->tx_release != TVL_NO)); + if (trans_rollback(thd)) ++ { ++ thd->mdl_context.release_transactional_locks(); ++#ifdef WITH_WSREP ++ WSREP_DEBUG("rollback failed, MDL released: %lu", thd->thread_id); ++#endif /* WITH_WSREP */ + goto error; ++ } + thd->mdl_context.release_transactional_locks(); + /* Begin transaction with the same isolation level. */ + if (tx_chain) +@@ -4320,7 +4727,17 @@ end_with_restore_list: + /* Disconnect the current client connection. */ + if (tx_release) + thd->killed= THD::KILL_CONNECTION; ++#ifdef WITH_WSREP ++ if (WSREP(thd)) { ++ if (thd->wsrep_conflict_state == NO_CONFLICT) { ++ my_ok(thd); ++ } ++ } else { ++#endif /* WITH_WSREP */ + my_ok(thd); ++#ifdef WITH_WSREP ++ } ++#endif /* WITH_WSREP */ + break; + } + case SQLCOM_RELEASE_SAVEPOINT: +@@ -4386,6 +4803,7 @@ end_with_restore_list: + if (sp_process_definer(thd)) + goto create_sp_error; + ++ WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL) + res= (sp_result= sp_create_routine(thd, lex->sphead)); + switch (sp_result) { + case SP_OK: { +@@ -4602,6 +5020,7 @@ create_sp_error: + already puts on CREATE FUNCTION. + */ + /* Conditionally writes to binlog */ ++ WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL) + int sp_result= sp_update_routine(thd, sp_type, lex->spname, + &lex->sp_chistics); + if (thd->killed) +@@ -4673,6 +5092,7 @@ create_sp_error: + lex->sql_command == SQLCOM_DROP_PROCEDURE, + false)) + goto error; ++ WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL) + + enum_sp_type sp_type= (lex->sql_command == SQLCOM_DROP_PROCEDURE) ? + SP_TYPE_PROCEDURE : SP_TYPE_FUNCTION; +@@ -4793,6 +5213,7 @@ create_sp_error: + Note: SQLCOM_CREATE_VIEW also handles 'ALTER VIEW' commands + as specified through the thd->lex->create_view_mode flag. + */ ++ WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL) + res= mysql_create_view(thd, first_table, thd->lex->create_view_mode); + break; + } +@@ -4801,12 +5222,14 @@ create_sp_error: + if (check_table_access(thd, DROP_ACL, all_tables, FALSE, UINT_MAX, FALSE)) + goto error; + /* Conditionally writes to binlog. */ ++ WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL) + res= mysql_drop_view(thd, first_table, thd->lex->drop_mode); + break; + } + case SQLCOM_CREATE_TRIGGER: + { + /* Conditionally writes to binlog. */ ++ WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL) + res= mysql_create_or_drop_trigger(thd, all_tables, 1); + + break; +@@ -4814,6 +5237,7 @@ create_sp_error: + case SQLCOM_DROP_TRIGGER: + { + /* Conditionally writes to binlog. */ ++ WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL) + res= mysql_create_or_drop_trigger(thd, all_tables, 0); + break; + } +@@ -4834,7 +5258,13 @@ create_sp_error: + break; + case SQLCOM_XA_COMMIT: + if (trans_xa_commit(thd)) ++ { ++ thd->mdl_context.release_transactional_locks(); ++#ifdef WITH_WSREP ++ WSREP_DEBUG("XA commit failed, MDL released: %lu", thd->thread_id); ++#endif /* WITH_WSREP */ + goto error; ++ } + thd->mdl_context.release_transactional_locks(); + /* + We've just done a commit, reset transaction +@@ -4846,7 +5276,13 @@ create_sp_error: + break; + case SQLCOM_XA_ROLLBACK: + if (trans_xa_rollback(thd)) ++ { ++ thd->mdl_context.release_transactional_locks(); ++#ifdef WITH_WSREP ++ WSREP_DEBUG("XA rollback failed, MDL released: %lu", thd->thread_id); ++#endif /* WITH_WSREP */ + goto error; ++ } + thd->mdl_context.release_transactional_locks(); + /* + We've just done a rollback, reset transaction +@@ -4866,11 +5302,13 @@ create_sp_error: + my_ok(thd); + break; + case SQLCOM_INSTALL_PLUGIN: ++ WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL) + if (! (res= mysql_install_plugin(thd, &thd->lex->comment, + &thd->lex->ident))) + my_ok(thd); + break; + case SQLCOM_UNINSTALL_PLUGIN: ++ WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL) + if (! (res= mysql_uninstall_plugin(thd, &thd->lex->comment))) + my_ok(thd); + break; +@@ -5012,6 +5450,9 @@ finish: + /* Free tables */ + THD_STAGE_INFO(thd, stage_closing_tables); + close_thread_tables(thd); ++#ifdef WITH_WSREP ++ thd->wsrep_consistency_check= NO_CONSISTENCY_CHECK; ++#endif /* WITH_WSREP */ + + #ifndef DBUG_OFF + if (lex->sql_command != SQLCOM_SET_OPTION && ! thd->in_sub_stmt) +@@ -5057,6 +5498,22 @@ finish: + { + thd->mdl_context.release_statement_locks(); + } ++ WSREP_TO_ISOLATION_END; ++ ++#ifdef WITH_WSREP ++ /* ++ Force release of transactional locks if not in active MST and wsrep is on. ++ */ ++ if (WSREP(thd) && ++ ! thd->in_sub_stmt && ++ ! thd->in_active_multi_stmt_transaction() && ++ thd->mdl_context.has_transactional_locks()) ++ { ++ WSREP_DEBUG("Forcing release of transactional locks for thd %lu", ++ thd->thread_id); ++ thd->mdl_context.release_transactional_locks(); ++ } ++#endif /* WITH_WSREP */ + + DBUG_RETURN(res || thd->is_error()); + } +@@ -5986,6 +6443,26 @@ void THD::reset_for_next_command() + thd->auto_inc_intervals_in_cur_stmt_for_binlog.empty(); + thd->stmt_depends_on_first_successful_insert_id_in_prev_stmt= 0; + ++#ifdef WITH_WSREP ++ /* ++ Autoinc variables should be adjusted only for locally executed ++ transactions. Appliers and replayers are either processing ROW ++ events or get autoinc variable values from Query_log_event. ++ */ ++ if (WSREP(thd) && thd->wsrep_exec_mode == LOCAL_STATE) { ++ if (wsrep_auto_increment_control) ++ { ++ if (thd->variables.auto_increment_offset != ++ global_system_variables.auto_increment_offset) ++ thd->variables.auto_increment_offset= ++ global_system_variables.auto_increment_offset; ++ if (thd->variables.auto_increment_increment != ++ global_system_variables.auto_increment_increment) ++ thd->variables.auto_increment_increment= ++ global_system_variables.auto_increment_increment; ++ } ++ } ++#endif /* WITH_WSREP */ + thd->query_start_used= thd->query_start_usec_used= 0; + thd->is_fatal_error= thd->time_zone_used= 0; + /* +@@ -6211,6 +6688,132 @@ void mysql_init_multi_delete(LEX *lex) + lex->query_tables_last= &lex->query_tables; + } + ++#ifdef WITH_WSREP ++static void wsrep_mysql_parse(THD *thd, char *rawbuf, uint length, ++ Parser_state *parser_state) ++{ ++ bool is_autocommit= ++ !thd->in_multi_stmt_transaction_mode() && ++ thd->wsrep_conflict_state == NO_CONFLICT && ++ !thd->wsrep_applier && ++ wsrep_read_only_option(thd, thd->lex->query_tables); ++ ++ do ++ { ++ if (thd->wsrep_conflict_state== RETRY_AUTOCOMMIT) ++ { ++ thd->wsrep_conflict_state= NO_CONFLICT; ++ } ++ mysql_parse(thd, rawbuf, length, parser_state); ++ ++ if (WSREP(thd)) { ++ /* wsrep BF abort in query exec phase */ ++ mysql_mutex_lock(&thd->LOCK_wsrep_thd); ++ if (thd->wsrep_conflict_state == MUST_ABORT) { ++ wsrep_client_rollback(thd); ++ ++ WSREP_DEBUG("abort in exec query state, avoiding autocommit"); ++ } ++ ++ /* checking if BF trx must be replayed */ ++ if (thd->wsrep_conflict_state== MUST_REPLAY) ++ { ++ wsrep_replay_transaction(thd); ++ } ++ ++ /* setting error code for BF aborted trxs */ ++ if (thd->wsrep_conflict_state == ABORTED || ++ thd->wsrep_conflict_state == CERT_FAILURE) ++ { ++ mysql_reset_thd_for_next_command(thd); ++ thd->killed= THD::NOT_KILLED; ++ if (is_autocommit && ++ thd->lex->sql_command != SQLCOM_SELECT && ++ (thd->wsrep_retry_counter < thd->variables.wsrep_retry_autocommit)) ++ { ++ WSREP_DEBUG("wsrep retrying AC query: %s", ++ (thd->query()) ? thd->query() : "void"); ++ ++ close_thread_tables(thd); ++ ++ thd->wsrep_conflict_state= RETRY_AUTOCOMMIT; ++ thd->wsrep_retry_counter++; // grow ++ wsrep_copy_query(thd); ++ thd->set_time(); ++ parser_state->reset(rawbuf, length); ++ ++ /* PSI end */ ++ MYSQL_END_STATEMENT(thd->m_statement_psi, thd->get_stmt_da()); ++ thd->m_statement_psi= NULL; ++ ++ /* DTRACE end */ ++ if (MYSQL_QUERY_DONE_ENABLED()) ++ { ++ MYSQL_QUERY_DONE(thd->is_error()); ++ } ++ ++ /* SHOW PROFILE end */ ++#if defined(ENABLED_PROFILING) ++ thd->profiling.finish_current_query(); ++#endif ++ ++ /* SHOW PROFILE begin */ ++#if defined(ENABLED_PROFILING) ++ thd->profiling.start_new_query("continuing"); ++ thd->profiling.set_query_source(rawbuf, length); ++#endif ++ ++ /* DTRACE begin */ ++ MYSQL_QUERY_START(rawbuf, thd->thread_id, ++ (char *) (thd->db ? thd->db : ""), ++ &thd->security_ctx->priv_user[0], ++ (char *) thd->security_ctx->host_or_ip); ++ ++ /* PSI begin */ ++ thd->m_statement_psi= MYSQL_START_STATEMENT(&thd->m_statement_state, ++ com_statement_info[thd->get_command()].m_key, ++ thd->db, thd->db_length, ++ thd->charset()); ++ } ++ else ++ { ++ WSREP_DEBUG("%s, thd: %lu is_AC: %d, retry: %lu - %lu SQL: %s", ++ (thd->wsrep_conflict_state == ABORTED) ? ++ "BF Aborted" : "cert failure", ++ thd->thread_id, is_autocommit, thd->wsrep_retry_counter, ++ thd->variables.wsrep_retry_autocommit, thd->query()); ++ my_error(ER_LOCK_DEADLOCK, MYF(0), "wsrep aborted transaction"); ++ thd->killed= THD::NOT_KILLED; ++ thd->wsrep_conflict_state= NO_CONFLICT; ++ if (thd->wsrep_conflict_state != REPLAYING) ++ thd->wsrep_retry_counter= 0; // reset ++ } ++ } ++ else ++ { ++ set_if_smaller(thd->wsrep_retry_counter, 0); // reset; eventually ok ++ } ++ mysql_mutex_unlock(&thd->LOCK_wsrep_thd); ++ } ++ } while (thd->wsrep_conflict_state== RETRY_AUTOCOMMIT); ++ ++ if (thd->wsrep_retry_query) ++ { ++ WSREP_DEBUG("releasing retry_query: " ++ "conf %d sent %d kill %d errno %d SQL %s", ++ thd->wsrep_conflict_state, ++ thd->get_stmt_da()->is_sent(), ++ thd->killed, ++ thd->get_stmt_da()->is_error() ? ++ thd->get_stmt_da()->sql_errno() : 0, ++ thd->wsrep_retry_query); ++ my_free(thd->wsrep_retry_query); ++ thd->wsrep_retry_query = NULL; ++ thd->wsrep_retry_query_len = 0; ++ thd->wsrep_retry_command = COM_CONNECT; ++ } ++} ++#endif /* WITH_WSREP */ + + /* + When you modify mysql_parse(), you may need to mofify +@@ -7265,8 +7868,14 @@ uint kill_one_thread(THD *thd, ulong id, bool only_kill_query) + slayage if both are string-equal. + */ + ++#ifdef WITH_WSREP ++ if (((thd->security_ctx->master_access & SUPER_ACL) || ++ thd->security_ctx->user_matches(tmp->security_ctx)) && ++ !wsrep_thd_is_BF((void *)tmp, true)) ++#else + if ((thd->security_ctx->master_access & SUPER_ACL) || + thd->security_ctx->user_matches(tmp->security_ctx)) ++#endif /* WITH_WSREP */ + { + /* process the kill only if thread is not already undergoing any kill + connection. +diff --git a/sql/sql_parse.h b/sql/sql_parse.h +index b1124d1..c54bc96 100644 +--- a/sql/sql_parse.h ++++ b/sql/sql_parse.h +@@ -210,6 +210,22 @@ inline bool is_supported_parser_charset(const CHARSET_INFO *cs) + { + return (cs->mbminlen == 1); + } ++#ifdef WITH_WSREP ++ ++#define WSREP_MYSQL_DB (char *)"mysql" ++#define WSREP_TO_ISOLATION_BEGIN(db_, table_, table_list_) \ ++ if (WSREP(thd) && wsrep_to_isolation_begin(thd, db_, table_, table_list_)) goto error; ++ ++#define WSREP_TO_ISOLATION_END \ ++ if (WSREP(thd) || (thd && thd->wsrep_exec_mode==TOTAL_ORDER)) \ ++ wsrep_to_isolation_end(thd); ++ ++#else ++ ++#define WSREP_TO_ISOLATION_BEGIN(db_, table_, table_list_) ++#define WSREP_TO_ISOLATION_END ++ ++#endif /* WITH_WSREP */ + + extern "C" bool sqlcom_can_generate_row_events(const THD *thd); + +diff --git a/sql/sql_partition_admin.cc b/sql/sql_partition_admin.cc +index 15ead35..dbf2be0 100644 +--- a/sql/sql_partition_admin.cc ++++ b/sql/sql_partition_admin.cc +@@ -767,6 +767,19 @@ bool Sql_cmd_alter_table_truncate_partition::execute(THD *thd) + if (check_one_table_access(thd, DROP_ACL, first_table)) + DBUG_RETURN(TRUE); + ++#ifdef WITH_WSREP ++ TABLE *find_temporary_table(THD *thd, const TABLE_LIST *tl); ++ ++ if ((!thd->is_current_stmt_binlog_format_row() || ++ !find_temporary_table(thd, first_table)) && ++ wsrep_to_isolation_begin( ++ thd, first_table->db, first_table->table_name, NULL) ++ ) ++ { ++ WSREP_WARN("ALTER TABLE isolation failure"); ++ DBUG_RETURN(TRUE); ++ } ++#endif /* WITH_WSREP */ + if (open_tables(thd, &first_table, &table_counter, 0)) + DBUG_RETURN(true); + +diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc +index bc89a8c..e43b2f2 100644 +--- a/sql/sql_plugin.cc ++++ b/sql/sql_plugin.cc +@@ -2827,7 +2827,11 @@ void plugin_thdvar_init(THD *thd, bool enable_plugins) + thd->variables.dynamic_variables_size= 0; + thd->variables.dynamic_variables_ptr= 0; + ++#ifdef WITH_WSREP ++ if ((!WSREP(thd) || !thd->wsrep_applier) && enable_plugins) ++#else + if (enable_plugins) ++#endif + { + mysql_mutex_lock(&LOCK_plugin); + thd->variables.table_plugin= +diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc +index d187418..5576e69 100644 +--- a/sql/sql_prepare.cc ++++ b/sql/sql_prepare.cc +@@ -3584,7 +3584,9 @@ Prepared_statement::set_parameters(String *expanded_query, + return res; + } + +- ++#ifdef WITH_WSREP ++void wsrep_replay_transaction(THD *thd); ++#endif /* WITH_WSREP */ + /** + Execute a prepared statement. Re-prepare it a limited number + of times if necessary. +@@ -3661,6 +3663,22 @@ reexecute: + thd->push_reprepare_observer(stmt_reprepare_observer); + + error= execute(expanded_query, open_cursor) || thd->is_error(); ++#ifdef WITH_WSREP ++ mysql_mutex_lock(&thd->LOCK_wsrep_thd); ++ switch (thd->wsrep_conflict_state) ++ { ++ case CERT_FAILURE: ++ WSREP_DEBUG("PS execute fail for CERT_FAILURE: thd: %ld err: %d", ++ thd->thread_id, thd->get_stmt_da()->sql_errno() ); ++ thd->wsrep_conflict_state = NO_CONFLICT; ++ break; ++ ++ case MUST_REPLAY: ++ (void)wsrep_replay_transaction(thd); ++ default: break; ++ } ++ mysql_mutex_unlock(&thd->LOCK_wsrep_thd); ++#endif /* WITH_WSREP */ + + thd->pop_reprepare_observer(); + +diff --git a/sql/sql_reload.cc b/sql/sql_reload.cc +index 574ed4c..60ab476 100644 +--- a/sql/sql_reload.cc ++++ b/sql/sql_reload.cc +@@ -249,7 +249,18 @@ bool reload_acl_and_cache(THD *thd, unsigned long options, + thd->global_read_lock.unlock_global_read_lock(thd); + return 1; + } +- } ++#ifdef WITH_WSREP ++ /* ++ We need to do it second time after wsrep appliers were blocked in ++ make_global_read_lock_block_commit(thd) above since they could have ++ modified the tables too. ++ */ ++ if (WSREP(thd) && ++ close_cached_tables(thd, tables, (options & REFRESH_FAST) ? ++ FALSE : TRUE, TRUE)) ++ result= 1; ++#endif /* WITH_WSREP */ ++ } + else + { + if (thd && thd->locked_tables_mode) +diff --git a/sql/sql_show.cc b/sql/sql_show.cc +index 0dc4da5..9f73f8a 100644 +--- a/sql/sql_show.cc ++++ b/sql/sql_show.cc +@@ -61,6 +61,9 @@ + using std::max; + using std::min; + ++#if !defined(MYSQL_MAX_VARIABLE_VALUE_LEN) ++#define MYSQL_MAX_VARIABLE_VALUE_LEN 1024 ++#endif // !defined(MYSQL_MAX_VARIABLE_VALUE_LEN) + #define STR_OR_NIL(S) ((S) ? (S) : "") + + #ifdef WITH_PARTITION_STORAGE_ENGINE +@@ -7938,7 +7941,8 @@ ST_FIELD_INFO variables_fields_info[]= + { + {"VARIABLE_NAME", 64, MYSQL_TYPE_STRING, 0, 0, "Variable_name", + SKIP_OPEN_TABLE}, +- {"VARIABLE_VALUE", 1024, MYSQL_TYPE_STRING, 0, 1, "Value", SKIP_OPEN_TABLE}, ++ {"VARIABLE_VALUE", MYSQL_MAX_VARIABLE_VALUE_LEN, MYSQL_TYPE_STRING, 0, 1, ++ "Value", SKIP_OPEN_TABLE}, + {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE} + }; + +diff --git a/sql/sql_table.cc b/sql/sql_table.cc +index d85585e..26b0e77 100644 +--- a/sql/sql_table.cc ++++ b/sql/sql_table.cc +@@ -5301,6 +5301,60 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table, TABLE_LIST* src_table, + uint not_used; + DBUG_ENTER("mysql_create_like_table"); + ++#ifdef WITH_WSREP ++ if (WSREP(thd) && !thd->wsrep_applier) ++ { ++ TABLE *tmp_table; ++ bool is_tmp_table= FALSE; ++ ++ for (tmp_table= thd->temporary_tables; tmp_table; tmp_table=tmp_table->next) ++ { ++ if (!strcmp(src_table->db, tmp_table->s->db.str) && ++ !strcmp(src_table->table_name, tmp_table->s->table_name.str)) ++ { ++ is_tmp_table= TRUE; ++ break; ++ } ++ } ++ if (create_info->options & HA_LEX_CREATE_TMP_TABLE) ++ { ++ /* CREATE TEMPORARY TABLE LIKE must be skipped from replication */ ++ WSREP_DEBUG("CREATE TEMPORARY TABLE LIKE... skipped replication\n %s", ++ thd->query()); ++ } ++ else if (!is_tmp_table) ++ { ++ /* this is straight CREATE TABLE LIKE... eith no tmp tables */ ++ WSREP_TO_ISOLATION_BEGIN(table->db, table->table_name, NULL); ++ } ++ else ++ { ++ /* here we have CREATE TABLE LIKE ++ the temporary table definition will be needed in slaves to ++ enable the create to succeed ++ */ ++ TABLE_LIST tbl; ++ memset(&tbl, 0, sizeof(tbl)); ++ tbl.db= src_table->db; ++ tbl.table_name= tbl.alias= src_table->table_name; ++ tbl.table= tmp_table; ++ char buf[2048]; ++ String query(buf, sizeof(buf), system_charset_info); ++ query.length(0); // Have to zero it since constructor doesn't ++ ++ (void) store_create_info(thd, &tbl, &query, NULL, TRUE); ++ WSREP_DEBUG("TMP TABLE: %s", query.ptr()); ++ ++ thd->wsrep_TOI_pre_query= query.ptr(); ++ thd->wsrep_TOI_pre_query_len= query.length(); ++ ++ WSREP_TO_ISOLATION_BEGIN(table->db, table->table_name, NULL); ++ ++ thd->wsrep_TOI_pre_query= NULL; ++ thd->wsrep_TOI_pre_query_len= 0; ++ } ++ } ++#endif + + /* + We the open source table to get its description in HA_CREATE_INFO +@@ -5474,6 +5528,11 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table, TABLE_LIST* src_table, + + err: + DBUG_RETURN(res); ++#ifdef WITH_WSREP ++ error: ++ thd->wsrep_TOI_pre_query= NULL; ++ DBUG_RETURN(TRUE); ++#endif /* WITH_WSREP */ + } + + +@@ -7883,6 +7942,17 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name, + + DEBUG_SYNC(thd, "alter_opened_table"); + ++#ifdef WITH_WSREP ++ DBUG_EXECUTE_IF("sync.alter_opened_table", ++ { ++ const char act[]= ++ "now " ++ "wait_for signal.alter_opened_table"; ++ DBUG_ASSERT(!debug_sync_set_action(thd, ++ STRING_WITH_LEN(act))); ++ };); ++#endif // WITH_WSREP ++ + if (error) + DBUG_RETURN(true); + +diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc +index e98b327..c9e92ad 100644 +--- a/sql/sql_trigger.cc ++++ b/sql/sql_trigger.cc +@@ -434,8 +434,14 @@ bool mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create) + binlogged, so they share the same danger, so trust_function_creators + applies to them too. + */ ++#ifdef WITH_WSREP ++ if (!trust_function_creators && ++ (WSREP_EMULATE_BINLOG(thd) || mysql_bin_log.is_open()) && ++ !(thd->security_ctx->master_access & SUPER_ACL)) ++#else + if (!trust_function_creators && mysql_bin_log.is_open() && + !(thd->security_ctx->master_access & SUPER_ACL)) ++#endif /* WITH_WSREP */ + { + my_error(ER_BINLOG_CREATE_ROUTINE_NEED_SUPER, MYF(0)); + DBUG_RETURN(TRUE); +@@ -2528,3 +2534,55 @@ bool load_table_name_for_trigger(THD *thd, + + DBUG_RETURN(FALSE); + } ++#ifdef WITH_WSREP ++int wsrep_create_trigger_query(THD *thd, uchar** buf, size_t* buf_len) ++{ ++ LEX *lex= thd->lex; ++ String stmt_query; ++ ++ LEX_STRING definer_user; ++ LEX_STRING definer_host; ++ ++ if (!lex->definer) ++ { ++ if (!thd->slave_thread) ++ { ++ if (!(lex->definer= create_default_definer(thd))) ++ return 1; ++ } ++ } ++ ++ if (lex->definer) ++ { ++ /* SUID trigger. */ ++ ++ definer_user= lex->definer->user; ++ definer_host= lex->definer->host; ++ } ++ else ++ { ++ /* non-SUID trigger. */ ++ ++ definer_user.str= 0; ++ definer_user.length= 0; ++ ++ definer_host.str= 0; ++ definer_host.length= 0; ++ } ++ ++ stmt_query.append(STRING_WITH_LEN("CREATE ")); ++ ++ append_definer(thd, &stmt_query, &definer_user, &definer_host); ++ ++ LEX_STRING stmt_definition; ++ stmt_definition.str= (char*) thd->lex->stmt_definition_begin; ++ stmt_definition.length= thd->lex->stmt_definition_end ++ - thd->lex->stmt_definition_begin; ++ trim_whitespace(thd->charset(), & stmt_definition); ++ ++ stmt_query.append(stmt_definition.str, stmt_definition.length); ++ ++ return wsrep_to_buf_helper(thd, stmt_query.c_ptr(), stmt_query.length(), ++ buf, buf_len); ++} ++#endif /* WITH_WSREP */ +diff --git a/sql/sql_truncate.cc b/sql/sql_truncate.cc +index 4d3d4e9..3b6173b 100644 +--- a/sql/sql_truncate.cc ++++ b/sql/sql_truncate.cc +@@ -24,6 +24,9 @@ + #include "sql_parse.h" // check_one_table_access() + #include "sql_truncate.h" + #include "sql_show.h" //append_identifier() ++#ifdef WITH_WSREP ++#include "wsrep_mysqld.h" ++#endif /* WITH_WSREP */ + + + /** +@@ -461,6 +464,12 @@ bool Sql_cmd_truncate_table::truncate_table(THD *thd, TABLE_LIST *table_ref) + { + bool hton_can_recreate; + ++#ifdef WITH_WSREP ++ if (WSREP(thd) && wsrep_to_isolation_begin(thd, ++ table_ref->db, ++ table_ref->table_name, NULL)) ++ DBUG_RETURN(TRUE); ++#endif /* WITH_WSREP */ + if (lock_table(thd, table_ref, &hton_can_recreate)) + DBUG_RETURN(TRUE); + +@@ -542,7 +551,6 @@ bool Sql_cmd_truncate_table::execute(THD *thd) + + if (! (res= truncate_table(thd, first_table))) + my_ok(thd); +- + DBUG_RETURN(res); + } + +diff --git a/sql/sql_update.cc b/sql/sql_update.cc +index 4c4714e..cb34af5 100644 +--- a/sql/sql_update.cc ++++ b/sql/sql_update.cc +@@ -988,7 +988,11 @@ int mysql_update(THD *thd, + */ + if ((error < 0) || thd->transaction.stmt.cannot_safely_rollback()) + { ++#ifdef WITH_WSREP ++ if (WSREP_EMULATE_BINLOG(thd) || mysql_bin_log.is_open()) ++#else + if (mysql_bin_log.is_open()) ++#endif + { + int errcode= 0; + if (error < 0) +@@ -2203,7 +2207,11 @@ void multi_update::abort_result_set() + The query has to binlog because there's a modified non-transactional table + either from the query's list or via a stored routine: bug#13270,23333 + */ ++#ifdef WITH_WSREP ++ if (WSREP_EMULATE_BINLOG(thd) || mysql_bin_log.is_open()) ++#else + if (mysql_bin_log.is_open()) ++#endif + { + /* + THD::killed status might not have been set ON at time of an error +@@ -2435,7 +2443,11 @@ bool multi_update::send_eof() + + if (local_error == 0 || thd->transaction.stmt.cannot_safely_rollback()) + { ++#ifdef WITH_WSREP ++ if (WSREP_EMULATE_BINLOG(thd) || mysql_bin_log.is_open()) ++#else + if (mysql_bin_log.is_open()) ++#endif + { + int errcode= 0; + if (local_error == 0) +diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy +index 180b7cd..4b6ef7a 100644 +--- a/sql/sql_yacc.yy ++++ b/sql/sql_yacc.yy +@@ -7433,7 +7433,7 @@ alter: + } + view_tail + {} +- | ALTER definer_opt EVENT_SYM sp_name ++ | ALTER definer_opt remember_name EVENT_SYM sp_name + { + /* + It is safe to use Lex->spname because +@@ -7445,9 +7445,12 @@ alter: + + if (!(Lex->event_parse_data= Event_parse_data::new_instance(YYTHD))) + MYSQL_YYABORT; +- Lex->event_parse_data->identifier= $4; ++ Lex->event_parse_data->identifier= $5; + + Lex->sql_command= SQLCOM_ALTER_EVENT; ++#ifdef WITH_WSREP ++ Lex->stmt_definition_begin= $3; ++#endif + } + ev_alter_on_schedule_completion + opt_ev_rename_to +@@ -7455,7 +7458,7 @@ alter: + opt_ev_comment + opt_ev_sql_stmt + { +- if (!($6 || $7 || $8 || $9 || $10)) ++ if (!($7 || $8 || $9 || $10 || $11)) + { + my_parse_error(ER(ER_SYNTAX_ERROR)); + MYSQL_YYABORT; +@@ -7465,6 +7468,9 @@ alter: + can overwrite it + */ + Lex->sql_command= SQLCOM_ALTER_EVENT; ++#ifdef WITH_WSREP ++ Lex->stmt_definition_end= (char*)YYLIP->get_cpp_ptr(); ++#endif + } + | ALTER TABLESPACE alter_tablespace_info + { +diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc +index f44196e..f26605a 100644 +--- a/sql/sys_vars.cc ++++ b/sql/sys_vars.cc +@@ -3222,6 +3222,10 @@ static bool fix_autocommit(sys_var *self, THD *thd, enum_var_type type) + if (trans_commit_stmt(thd) || trans_commit(thd)) + { + thd->variables.option_bits&= ~OPTION_AUTOCOMMIT; ++ thd->mdl_context.release_transactional_locks(); ++#ifdef WITH_WSREP ++ WSREP_DEBUG("autocommit, MDL TRX lock released: %lu", thd->thread_id); ++#endif /* WITH_WSREP */ + return true; + } + /* +@@ -4216,6 +4220,274 @@ static Sys_var_tz Sys_time_zone( + "time_zone", "time_zone", + SESSION_VAR(time_zone), NO_CMD_LINE, + DEFAULT(&default_tz), NO_MUTEX_GUARD, IN_BINLOG); ++#ifdef WITH_WSREP ++#include "wsrep_var.h" ++#include "wsrep_sst.h" ++#include "wsrep_binlog.h" ++ ++static Sys_var_charptr Sys_wsrep_provider( ++ "wsrep_provider", "Path to replication provider library", ++ PREALLOCATED GLOBAL_VAR(wsrep_provider), CMD_LINE(REQUIRED_ARG, OPT_WSREP_PROVIDER), ++ IN_FS_CHARSET, DEFAULT(wsrep_provider), ++ // IN_FS_CHARSET, DEFAULT(wsrep_provider_default), ++ NO_MUTEX_GUARD, NOT_IN_BINLOG, ++ ON_CHECK(wsrep_provider_check), ON_UPDATE(wsrep_provider_update)); ++ ++static Sys_var_charptr Sys_wsrep_provider_options( ++ "wsrep_provider_options", "provider specific options", ++ PREALLOCATED GLOBAL_VAR(wsrep_provider_options), ++ CMD_LINE(REQUIRED_ARG, OPT_WSREP_PROVIDER_OPTIONS), ++ IN_FS_CHARSET, DEFAULT(wsrep_provider_options), ++ NO_MUTEX_GUARD, NOT_IN_BINLOG, ++ ON_CHECK(wsrep_provider_options_check), ++ ON_UPDATE(wsrep_provider_options_update)); ++ ++static Sys_var_charptr Sys_wsrep_data_home_dir( ++ "wsrep_data_home_dir", "home directory for wsrep provider", ++ READ_ONLY GLOBAL_VAR(wsrep_data_home_dir), CMD_LINE(REQUIRED_ARG), ++ IN_FS_CHARSET, DEFAULT(""), ++ NO_MUTEX_GUARD, NOT_IN_BINLOG); ++ ++static Sys_var_charptr Sys_wsrep_cluster_name( ++ "wsrep_cluster_name", "Name for the cluster", ++ PREALLOCATED GLOBAL_VAR(wsrep_cluster_name), CMD_LINE(REQUIRED_ARG), ++ IN_FS_CHARSET, DEFAULT(wsrep_cluster_name), ++ NO_MUTEX_GUARD, NOT_IN_BINLOG, ++ ON_CHECK(wsrep_cluster_name_check), ++ ON_UPDATE(wsrep_cluster_name_update)); ++ ++static PolyLock_mutex PLock_wsrep_slave_threads(&LOCK_wsrep_slave_threads); ++static Sys_var_charptr Sys_wsrep_cluster_address ( ++ "wsrep_cluster_address", "Address to initially connect to cluster", ++ PREALLOCATED GLOBAL_VAR(wsrep_cluster_address), ++ CMD_LINE(REQUIRED_ARG, OPT_WSREP_CLUSTER_ADDRESS), ++ IN_FS_CHARSET, DEFAULT(wsrep_cluster_address), ++ &PLock_wsrep_slave_threads, NOT_IN_BINLOG, ++ ON_CHECK(wsrep_cluster_address_check), ++ ON_UPDATE(wsrep_cluster_address_update)); ++ ++static Sys_var_charptr Sys_wsrep_node_name ( ++ "wsrep_node_name", "Node name", ++ PREALLOCATED GLOBAL_VAR(wsrep_node_name), CMD_LINE(REQUIRED_ARG), ++ IN_FS_CHARSET, DEFAULT(wsrep_node_name), ++ NO_MUTEX_GUARD, NOT_IN_BINLOG); ++ ++static Sys_var_charptr Sys_wsrep_node_address ( ++ "wsrep_node_address", "Node address", ++ PREALLOCATED GLOBAL_VAR(wsrep_node_address), CMD_LINE(REQUIRED_ARG), ++ IN_FS_CHARSET, DEFAULT(wsrep_node_address), ++ NO_MUTEX_GUARD, NOT_IN_BINLOG, ++ ON_CHECK(wsrep_node_address_check), ++ ON_UPDATE(wsrep_node_address_update)); ++ ++static Sys_var_charptr Sys_wsrep_node_incoming_address( ++ "wsrep_node_incoming_address", "Client connection address", ++ PREALLOCATED GLOBAL_VAR(wsrep_node_incoming_address),CMD_LINE(REQUIRED_ARG), ++ IN_FS_CHARSET, DEFAULT(wsrep_node_incoming_address), ++ NO_MUTEX_GUARD, NOT_IN_BINLOG); ++ ++static Sys_var_ulong Sys_wsrep_slave_threads( ++ "wsrep_slave_threads", "Number of slave appliers to launch", ++ GLOBAL_VAR(wsrep_slave_threads), CMD_LINE(REQUIRED_ARG), ++ VALID_RANGE(1, 512), DEFAULT(1), BLOCK_SIZE(1), ++ &PLock_wsrep_slave_threads, NOT_IN_BINLOG, ++ ON_CHECK(wsrep_slave_threads_check), ++ ON_UPDATE(wsrep_slave_threads_update)); ++ ++static Sys_var_charptr Sys_wsrep_dbug_option( ++ "wsrep_dbug_option", "DBUG options to provider library", ++ GLOBAL_VAR(wsrep_dbug_option),CMD_LINE(REQUIRED_ARG), ++ IN_FS_CHARSET, DEFAULT(""), ++ NO_MUTEX_GUARD, NOT_IN_BINLOG); ++ ++static Sys_var_mybool Sys_wsrep_debug( ++ "wsrep_debug", "To enable debug level logging", ++ GLOBAL_VAR(wsrep_debug), CMD_LINE(OPT_ARG), DEFAULT(FALSE)); ++ ++static Sys_var_mybool Sys_wsrep_convert_LOCK_to_trx( ++ "wsrep_convert_LOCK_to_trx", "To convert locking sessions " ++ "into transactions", ++ GLOBAL_VAR(wsrep_convert_LOCK_to_trx), ++ CMD_LINE(OPT_ARG), DEFAULT(FALSE)); ++ ++static Sys_var_ulong Sys_wsrep_retry_autocommit( ++ "wsrep_retry_autocommit", "Max number of times to retry " ++ "a failed autocommit statement", ++ SESSION_VAR(wsrep_retry_autocommit), CMD_LINE(REQUIRED_ARG), ++ VALID_RANGE(0, 10000), DEFAULT(1), BLOCK_SIZE(1)); ++ ++static Sys_var_mybool Sys_wsrep_auto_increment_control( ++ "wsrep_auto_increment_control", "To automatically control the " ++ "assignment of autoincrement variables", ++ GLOBAL_VAR(wsrep_auto_increment_control), ++ CMD_LINE(OPT_ARG), DEFAULT(TRUE)); ++ ++static Sys_var_mybool Sys_wsrep_drupal_282555_workaround( ++ "wsrep_drupal_282555_workaround", "To use a workaround for" ++ "bad autoincrement value", ++ GLOBAL_VAR(wsrep_drupal_282555_workaround), ++ CMD_LINE(OPT_ARG), DEFAULT(FALSE)); ++ ++static Sys_var_charptr sys_wsrep_sst_method( ++ "wsrep_sst_method", "State snapshot transfer method", ++ GLOBAL_VAR(wsrep_sst_method),CMD_LINE(REQUIRED_ARG), ++ IN_FS_CHARSET, DEFAULT(wsrep_sst_method), NO_MUTEX_GUARD, NOT_IN_BINLOG, ++ ON_CHECK(wsrep_sst_method_check), ++ ON_UPDATE(wsrep_sst_method_update)); ++ ++static Sys_var_charptr Sys_wsrep_sst_receive_address( ++ "wsrep_sst_receive_address", "Address where node is waiting for " ++ "SST contact", ++ GLOBAL_VAR(wsrep_sst_receive_address),CMD_LINE(REQUIRED_ARG), ++ IN_FS_CHARSET, DEFAULT(wsrep_sst_receive_address), NO_MUTEX_GUARD, ++ NOT_IN_BINLOG, ++ ON_CHECK(wsrep_sst_receive_address_check), ++ ON_UPDATE(wsrep_sst_receive_address_update)); ++ ++static Sys_var_charptr Sys_wsrep_sst_auth( ++ "wsrep_sst_auth", "Authentication for SST connection", ++ PREALLOCATED GLOBAL_VAR(wsrep_sst_auth), CMD_LINE(REQUIRED_ARG, OPT_WSREP_SST_AUTH), ++ IN_FS_CHARSET, DEFAULT(wsrep_sst_auth), NO_MUTEX_GUARD, ++ NOT_IN_BINLOG, ++ ON_CHECK(wsrep_sst_auth_check), ++ ON_UPDATE(wsrep_sst_auth_update)); ++ ++static Sys_var_charptr Sys_wsrep_sst_donor( ++ "wsrep_sst_donor", "preferred donor node for the SST", ++ GLOBAL_VAR(wsrep_sst_donor),CMD_LINE(REQUIRED_ARG), ++ IN_FS_CHARSET, DEFAULT(""), NO_MUTEX_GUARD, NOT_IN_BINLOG, ++ ON_CHECK(wsrep_sst_donor_check), ++ ON_UPDATE(wsrep_sst_donor_update)); ++ ++static Sys_var_mybool Sys_wsrep_sst_donor_rejects_queries( ++ "wsrep_sst_donor_rejects_queries", "Reject client queries " ++ "when donating state snapshot transfer", ++ GLOBAL_VAR(wsrep_sst_donor_rejects_queries), ++ CMD_LINE(OPT_ARG), DEFAULT(FALSE)); ++ ++static Sys_var_mybool Sys_wsrep_on ( ++ "wsrep_on", "To enable wsrep replication ", ++ SESSION_VAR(wsrep_on), ++ CMD_LINE(OPT_ARG), DEFAULT(TRUE), ++ NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0), ++ ON_UPDATE(wsrep_on_update)); ++ ++static Sys_var_charptr Sys_wsrep_start_position ( ++ "wsrep_start_position", "global transaction position to start from ", ++ PREALLOCATED GLOBAL_VAR(wsrep_start_position), ++ CMD_LINE(REQUIRED_ARG, OPT_WSREP_START_POSITION), ++ IN_FS_CHARSET, DEFAULT(wsrep_start_position), ++ NO_MUTEX_GUARD, NOT_IN_BINLOG, ++ ON_CHECK(wsrep_start_position_check), ++ ON_UPDATE(wsrep_start_position_update)); ++ ++static Sys_var_ulong Sys_wsrep_max_ws_size ( ++ "wsrep_max_ws_size", "Max write set size (bytes)", ++ GLOBAL_VAR(wsrep_max_ws_size), CMD_LINE(REQUIRED_ARG), ++ /* Upper limit is 65K short of 4G to avoid overlows on 32-bit systems */ ++ VALID_RANGE(1024, WSREP_MAX_WS_SIZE), DEFAULT(1073741824UL), BLOCK_SIZE(1)); ++ ++static Sys_var_ulong Sys_wsrep_max_ws_rows ( ++ "wsrep_max_ws_rows", "Max number of rows in write set", ++ GLOBAL_VAR(wsrep_max_ws_rows), CMD_LINE(REQUIRED_ARG), ++ VALID_RANGE(1, 1048576), DEFAULT(131072), BLOCK_SIZE(1)); ++ ++static Sys_var_charptr Sys_wsrep_notify_cmd( ++ "wsrep_notify_cmd", "", ++ GLOBAL_VAR(wsrep_notify_cmd),CMD_LINE(REQUIRED_ARG), ++ IN_FS_CHARSET, DEFAULT(""), NO_MUTEX_GUARD, NOT_IN_BINLOG); ++ ++static Sys_var_mybool Sys_wsrep_certify_nonPK( ++ "wsrep_certify_nonPK", "Certify tables with no primary key", ++ GLOBAL_VAR(wsrep_certify_nonPK), ++ CMD_LINE(OPT_ARG), DEFAULT(TRUE)); ++ ++static Sys_var_mybool Sys_wsrep_causal_reads( ++ "wsrep_causal_reads", "(DEPRECATED) setting this variable is equivalent to setting wsrep_sync_wait READ flag", ++ SESSION_VAR(wsrep_causal_reads), ++ CMD_LINE(OPT_ARG), DEFAULT(FALSE), ++ NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0), ++ ON_UPDATE(wsrep_causal_reads_update)); ++ ++static Sys_var_uint Sys_wsrep_sync_wait( ++ "wsrep_sync_wait", "Ensure \"synchronous\" read view before executing an operation of the type specified by bitmask: 1 - READ(includes SELECT, SHOW and BEGIN/START TRANSACTION); 2 - UPDATE and DELETE; 4 - INSERT and REPLACE", ++ SESSION_VAR(wsrep_sync_wait), ++ CMD_LINE(OPT_ARG), ++ VALID_RANGE(WSREP_SYNC_WAIT_NONE, WSREP_SYNC_WAIT_MAX), ++ DEFAULT(WSREP_SYNC_WAIT_NONE), ++ BLOCK_SIZE(1), ++ NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0), ++ ON_UPDATE(wsrep_sync_wait_update)); ++ ++static const char *wsrep_OSU_method_names[]= { "TOI", "RSU", NullS }; ++static Sys_var_enum Sys_wsrep_OSU_method( ++ "wsrep_OSU_method", "Method for Online Schema Upgrade", ++ GLOBAL_VAR(wsrep_OSU_method_options), CMD_LINE(OPT_ARG), ++ wsrep_OSU_method_names, DEFAULT(WSREP_OSU_TOI), ++ NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0), ++ ON_UPDATE(0)); ++ ++static PolyLock_mutex PLock_wsrep_desync(&LOCK_wsrep_desync); ++static Sys_var_mybool Sys_wsrep_desync ( ++ "wsrep_desync", "To desynchronize the node from the cluster", ++ GLOBAL_VAR(wsrep_desync), ++ CMD_LINE(OPT_ARG), DEFAULT(FALSE), ++ &PLock_wsrep_desync, NOT_IN_BINLOG, ++ ON_CHECK(wsrep_desync_check), ++ ON_UPDATE(wsrep_desync_update)); ++ ++static Sys_var_enum Sys_wsrep_forced_binlog_format( ++ "wsrep_forced_binlog_format", "binlog format to take effect over user's choice", ++ GLOBAL_VAR(wsrep_forced_binlog_format), ++ CMD_LINE(REQUIRED_ARG, OPT_BINLOG_FORMAT), ++ wsrep_binlog_format_names, DEFAULT(BINLOG_FORMAT_UNSPEC), ++ NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0), ++ ON_UPDATE(0)); ++ ++static Sys_var_mybool Sys_wsrep_recover_datadir( ++ "wsrep_recover", "Recover database state after crash and exit", ++ READ_ONLY GLOBAL_VAR(wsrep_recovery), ++ CMD_LINE(OPT_ARG, OPT_WSREP_RECOVER), DEFAULT(FALSE)); ++ ++static Sys_var_mybool Sys_wsrep_replicate_myisam( ++ "wsrep_replicate_myisam", "To enable myisam replication", ++ GLOBAL_VAR(wsrep_replicate_myisam), CMD_LINE(OPT_ARG), DEFAULT(FALSE)); ++ ++static Sys_var_mybool Sys_wsrep_log_conflicts( ++ "wsrep_log_conflicts", "To log multi-master conflicts", ++ GLOBAL_VAR(wsrep_log_conflicts), CMD_LINE(OPT_ARG), DEFAULT(FALSE)); ++ ++static Sys_var_ulong Sys_wsrep_mysql_replication_bundle( ++ "wsrep_mysql_replication_bundle", "mysql replication group commit ", ++ GLOBAL_VAR(wsrep_mysql_replication_bundle), CMD_LINE(REQUIRED_ARG), ++ VALID_RANGE(0, 1000), DEFAULT(0), BLOCK_SIZE(1)); ++ ++static Sys_var_mybool Sys_wsrep_preordered( ++ "wsrep_preordered", "To enable preordered write set processing", ++ GLOBAL_VAR(wsrep_preordered_opt), CMD_LINE(OPT_ARG), DEFAULT(FALSE)); ++ ++static Sys_var_mybool Sys_wsrep_load_data_splitting( ++ "wsrep_load_data_splitting", "To commit LOAD DATA " ++ "transaction after every 10K rows inserted", ++ GLOBAL_VAR(wsrep_load_data_splitting), ++ CMD_LINE(OPT_ARG), DEFAULT(TRUE)); ++ ++static Sys_var_mybool Sys_wsrep_slave_FK_checks( ++ "wsrep_slave_FK_checks", "Should slave thread do " ++ "foreign key constraint checks", ++ GLOBAL_VAR(wsrep_slave_FK_checks), ++ CMD_LINE(OPT_ARG), DEFAULT(TRUE)); ++ ++static Sys_var_mybool Sys_wsrep_slave_UK_checks( ++ "wsrep_slave_UK_checks", "Should slave thread do " ++ "secondary index uniqueness chesks", ++ GLOBAL_VAR(wsrep_slave_UK_checks), ++ CMD_LINE(OPT_ARG), DEFAULT(FALSE)); ++ ++static Sys_var_mybool Sys_wsrep_restart_slave( ++ "wsrep_restart_slave", "Should MySQL slave be restarted automatically, when node joins back to cluster", ++ GLOBAL_VAR(wsrep_restart_slave), CMD_LINE(OPT_ARG), DEFAULT(FALSE)); ++#endif /* WITH_WSREP */ + + static bool fix_host_cache_size(sys_var *, THD *, enum_var_type) + { +diff --git a/sql/table.cc b/sql/table.cc +index afd3947..95eb03d 100644 +--- a/sql/table.cc ++++ b/sql/table.cc +@@ -5321,8 +5321,17 @@ void TABLE::mark_columns_needed_for_delete() + in mark_columns_per_binlog_row_image, if not, then use + the hidden primary key + */ ++#ifdef WITH_WSREP ++ /* this does not affect wsrep patch as long as we use RBR only, ++ but this condition is just preparing for possible future STATEMENT ++ format support ++ */ ++ if (!((WSREP_EMULATE_BINLOG(current_thd) || mysql_bin_log.is_open()) && ++ in_use && in_use->is_current_stmt_binlog_format_row())) ++#else + if (!(mysql_bin_log.is_open() && in_use && + in_use->is_current_stmt_binlog_format_row())) ++#endif /* WITH_WSREP */ + file->use_hidden_primary_key(); + } + else +@@ -5388,8 +5397,17 @@ void TABLE::mark_columns_needed_for_update() + in mark_columns_per_binlog_row_image, if not, then use + the hidden primary key + */ ++#ifdef WITH_WSREP ++ /* this does not affect wsrep patch as long as we use RBR only, ++ but this condition is just preparing for possible future STATEMENT ++ format support ++ */ ++ if (!((WSREP_EMULATE_BINLOG(current_thd) || mysql_bin_log.is_open()) && ++ in_use && in_use->is_current_stmt_binlog_format_row())) ++#else + if (!(mysql_bin_log.is_open() && in_use && + in_use->is_current_stmt_binlog_format_row())) ++#endif /* WITH_WSREP */ + file->use_hidden_primary_key(); + } + else +@@ -5441,9 +5459,15 @@ void TABLE::mark_columns_per_binlog_row_image() + If in RBR we may need to mark some extra columns, + depending on the binlog-row-image command line argument. + */ ++#ifdef WITH_WSREP ++ if (((WSREP_EMULATE_BINLOG(current_thd) || mysql_bin_log.is_open()) && ++ in_use && in_use->is_current_stmt_binlog_format_row() && ++ !ha_check_storage_engine_flag(s->db_type(), HTON_NO_BINLOG_ROW_OPT))) ++#else + if ((mysql_bin_log.is_open() && in_use && + in_use->is_current_stmt_binlog_format_row() && + !ha_check_storage_engine_flag(s->db_type(), HTON_NO_BINLOG_ROW_OPT))) ++#endif /* WITH_WSREP */ + { + + THD *thd= current_thd; +diff --git a/sql/transaction.cc b/sql/transaction.cc +index a307e8a..1247917 100644 +--- a/sql/transaction.cc ++++ b/sql/transaction.cc +@@ -102,6 +102,9 @@ static bool xa_trans_force_rollback(THD *thd) + by ha_rollback()/THD::transaction::cleanup(). + */ + thd->transaction.xid_state.rm_error= 0; ++#ifdef WITH_WSREP ++ wsrep_register_hton(thd, TRUE); ++#endif /* WITH_WSREP */ + if (ha_rollback_trans(thd, true)) + { + my_error(ER_XAER_RMERR, MYF(0)); +@@ -140,10 +143,16 @@ bool trans_begin(THD *thd, uint flags) + (thd->variables.option_bits & OPTION_TABLE_LOCK)) + { + thd->variables.option_bits&= ~OPTION_TABLE_LOCK; ++#ifdef WITH_WSREP ++ wsrep_register_hton(thd, TRUE); ++#endif /* WITH_WSREP */ + thd->server_status&= + ~(SERVER_STATUS_IN_TRANS | SERVER_STATUS_IN_TRANS_READONLY); + DBUG_PRINT("info", ("clearing SERVER_STATUS_IN_TRANS")); + res= MY_TEST(ha_commit_trans(thd, TRUE)); ++#ifdef WITH_WSREP ++ wsrep_post_commit(thd, TRUE); ++#endif /* WITH_WSREP */ + } + + thd->variables.option_bits&= ~OPTION_BEGIN; +@@ -181,6 +190,12 @@ bool trans_begin(THD *thd, uint flags) + thd->tx_read_only= false; + } + ++#ifdef WITH_WSREP ++ thd->wsrep_PA_safe= true; ++ if (WSREP_CLIENT(thd) && wsrep_sync_wait(thd)) ++ DBUG_RETURN(TRUE); ++#endif /* WITH_WSREP */ ++ + thd->variables.option_bits|= OPTION_BEGIN; + thd->server_status|= SERVER_STATUS_IN_TRANS; + if (thd->tx_read_only) +@@ -222,12 +237,18 @@ bool trans_commit(THD *thd) + if (trans_check_state(thd)) + DBUG_RETURN(TRUE); + ++#ifdef WITH_WSREP ++ wsrep_register_hton(thd, TRUE); ++#endif /* WITH_WSREP */ + thd->server_status&= + ~(SERVER_STATUS_IN_TRANS | SERVER_STATUS_IN_TRANS_READONLY); + DBUG_PRINT("info", ("clearing SERVER_STATUS_IN_TRANS")); + res= ha_commit_trans(thd, TRUE); + thd->variables.option_bits&= ~OPTION_BEGIN; + thd->transaction.all.reset_unsafe_rollback_flags(); ++#ifdef WITH_WSREP ++ wsrep_post_commit(thd, TRUE); ++#endif /* WITH_WSREP */ + thd->lex->start_transaction_opt= 0; + + DBUG_RETURN(MY_TEST(res)); +@@ -275,10 +296,16 @@ bool trans_commit_implicit(THD *thd) + /* Safety if one did "drop table" on locked tables */ + if (!thd->locked_tables_mode) + thd->variables.option_bits&= ~OPTION_TABLE_LOCK; +- thd->server_status&= ++#ifdef WITH_WSREP ++ wsrep_register_hton(thd, TRUE); ++#endif /* WITH_WSREP */ ++ thd->server_status&= + ~(SERVER_STATUS_IN_TRANS | SERVER_STATUS_IN_TRANS_READONLY); + DBUG_PRINT("info", ("clearing SERVER_STATUS_IN_TRANS")); + res= MY_TEST(ha_commit_trans(thd, TRUE)); ++#ifdef WITH_WSREP ++ wsrep_post_commit(thd, TRUE); ++#endif /* WITH_WSREP */ + } + else if (tc_log) + tc_log->commit(thd, true); +@@ -312,6 +339,9 @@ bool trans_rollback(THD *thd) + { + int res; + DBUG_ENTER("trans_rollback"); ++#ifdef WITH_WSREP ++ thd->wsrep_PA_safe= true; ++#endif /* WITH_WSREP */ + + #ifndef DBUG_OFF + char buf1[256], buf2[256]; +@@ -326,6 +356,9 @@ bool trans_rollback(THD *thd) + if (trans_check_state(thd)) + DBUG_RETURN(TRUE); + ++#ifdef WITH_WSREP ++ wsrep_register_hton(thd, TRUE); ++#endif /* WITH_WSREP */ + thd->server_status&= + ~(SERVER_STATUS_IN_TRANS | SERVER_STATUS_IN_TRANS_READONLY); + DBUG_PRINT("info", ("clearing SERVER_STATUS_IN_TRANS")); +@@ -366,6 +399,9 @@ bool trans_rollback_implicit(THD *thd) + */ + DBUG_ASSERT(thd->transaction.stmt.is_empty() && !thd->in_sub_stmt); + ++#ifdef WITH_WSREP ++ wsrep_register_hton(thd, true); ++#endif /* WITH_WSREP */ + thd->server_status&= + ~(SERVER_STATUS_IN_TRANS | SERVER_STATUS_IN_TRANS_READONLY); + DBUG_PRINT("info", ("clearing SERVER_STATUS_IN_TRANS")); +@@ -431,12 +467,20 @@ bool trans_commit_stmt(THD *thd) + + if (thd->transaction.stmt.ha_list) + { ++#ifdef WITH_WSREP ++ wsrep_register_hton(thd, FALSE); ++#endif /* WITH_WSREP */ + res= ha_commit_trans(thd, FALSE); + if (! thd->in_active_multi_stmt_transaction()) ++#ifdef WITH_WSREP + { ++#endif /* WITH_WSREP */ + thd->tx_isolation= (enum_tx_isolation) thd->variables.tx_isolation; + thd->tx_read_only= thd->variables.tx_read_only; ++#ifdef WITH_WSREP ++ wsrep_post_commit(thd, FALSE); + } ++#endif /* WITH_WSREP */ + } + else if (tc_log) + tc_log->commit(thd, false); +@@ -481,6 +525,9 @@ bool trans_rollback_stmt(THD *thd) + + if (thd->transaction.stmt.ha_list) + { ++#ifdef WITH_WSREP ++ wsrep_register_hton(thd, FALSE); ++#endif /* WITH_WSREP */ + ha_rollback_trans(thd, FALSE); + if (! thd->in_active_multi_stmt_transaction()) + { +@@ -652,9 +699,16 @@ bool trans_rollback_to_savepoint(THD *thd, LEX_STRING name) + For backward-compatibility reasons we always release MDL if binary + logging is off. + */ ++#ifdef WITH_WSREP ++ bool mdl_can_safely_rollback_to_savepoint= ++ (!((WSREP_EMULATE_BINLOG(thd) || mysql_bin_log.is_open()) ++ && thd->variables.sql_log_bin) || ++ ha_rollback_to_savepoint_can_release_mdl(thd)); ++#else + bool mdl_can_safely_rollback_to_savepoint= + (!(mysql_bin_log.is_open() && thd->variables.sql_log_bin) || + ha_rollback_to_savepoint_can_release_mdl(thd)); ++#endif /* WITH_WSREP */ + + if (ha_rollback_to_savepoint(thd, sv)) + res= TRUE; +@@ -871,9 +925,15 @@ bool trans_xa_commit(THD *thd) + } + else if (xa_state == XA_IDLE && thd->lex->xa_opt == XA_ONE_PHASE) + { ++#ifdef WITH_WSREP ++ wsrep_register_hton(thd, TRUE); ++#endif /* WITH_WSREP */ + int r= ha_commit_trans(thd, TRUE); + if ((res= MY_TEST(r))) + my_error(r == 1 ? ER_XA_RBROLLBACK : ER_XAER_RMERR, MYF(0)); ++#ifdef WITH_WSREP ++ wsrep_post_commit(thd, TRUE); ++#endif /* WITH_WSREP */ + } + else if (xa_state == XA_PREPARED && thd->lex->xa_opt == XA_NONE) + { +@@ -892,6 +952,9 @@ bool trans_xa_commit(THD *thd) + if (thd->mdl_context.acquire_lock(&mdl_request, + thd->variables.lock_wait_timeout)) + { ++#ifdef WITH_WSREP ++ wsrep_register_hton(thd, TRUE); ++#endif /* WITH_WSREP */ + ha_rollback_trans(thd, TRUE); + my_error(ER_XAER_RMERR, MYF(0)); + } +diff --git a/sql/wsrep_applier.cc b/sql/wsrep_applier.cc +new file mode 100644 +index 0000000..bb95a66 +--- /dev/null ++++ b/sql/wsrep_applier.cc +@@ -0,0 +1,386 @@ ++/* Copyright (C) 2013 Codership Oy ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; version 2 of the License. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License along ++ with this program; if not, write to the Free Software Foundation, Inc., ++ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ ++ ++#include "wsrep_priv.h" ++#include "wsrep_binlog.h" // wsrep_dump_rbr_buf() ++ ++#include "log_event.h" // class THD, EVENT_LEN_OFFSET, etc. ++#include "wsrep_applier.h" ++#include "debug_sync.h" ++ ++/* ++ read the first event from (*buf). The size of the (*buf) is (*buf_len). ++ At the end (*buf) is shitfed to point to the following event or NULL and ++ (*buf_len) will be changed to account just being read bytes of the 1st event. ++*/ ++ ++static Log_event* wsrep_read_log_event( ++ char **arg_buf, size_t *arg_buf_len, ++ const Format_description_log_event *description_event) ++{ ++ DBUG_ENTER("wsrep_read_log_event"); ++ char *head= (*arg_buf); ++ ++ uint data_len = uint4korr(head + EVENT_LEN_OFFSET); ++ char *buf= (*arg_buf); ++ const char *error= 0; ++ Log_event *res= 0; ++ ++ if (data_len > wsrep_max_ws_size) ++ { ++ error = "Event too big"; ++ goto err; ++ } ++ ++ res= Log_event::read_log_event(buf, data_len, &error, description_event, 0); ++ ++err: ++ if (!res) ++ { ++ DBUG_ASSERT(error != 0); ++ sql_print_error("Error in Log_event::read_log_event(): " ++ "'%s', data_len: %d, event_type: %d", ++ error,data_len,head[EVENT_TYPE_OFFSET]); ++ } ++ (*arg_buf)+= data_len; ++ (*arg_buf_len)-= data_len; ++ DBUG_RETURN(res); ++} ++ ++#include "transaction.h" // trans_commit(), trans_rollback() ++#include "rpl_rli.h" // class Relay_log_info; ++#include "sql_base.h" // close_temporary_table() ++ ++static inline void ++wsrep_set_apply_format(THD* thd, Format_description_log_event* ev) ++{ ++ if (thd->wsrep_apply_format) ++ { ++ delete (Format_description_log_event*)thd->wsrep_apply_format; ++ } ++ thd->wsrep_apply_format= ev; ++} ++ ++static inline Format_description_log_event* ++wsrep_get_apply_format(THD* thd) ++{ ++ if (thd->wsrep_apply_format) ++ return (Format_description_log_event*) thd->wsrep_apply_format; ++ return thd->wsrep_rli->get_rli_description_event(); ++} ++ ++static wsrep_cb_status_t wsrep_apply_events(THD* thd, ++ const void* events_buf, ++ size_t buf_len) ++{ ++ char *buf= (char *)events_buf; ++ int rcode= 0; ++ int event= 1; ++ ++ DBUG_ENTER("wsrep_apply_events"); ++ ++ if (thd->killed == THD::KILL_CONNECTION && ++ thd->wsrep_conflict_state != REPLAYING) ++ { ++ WSREP_INFO("applier has been aborted, skipping apply_rbr: %lld", ++ (long long) wsrep_thd_trx_seqno(thd)); ++ DBUG_RETURN(WSREP_CB_FAILURE); ++ } ++ ++ mysql_mutex_lock(&thd->LOCK_wsrep_thd); ++ thd->wsrep_query_state= QUERY_EXEC; ++ if (thd->wsrep_conflict_state!= REPLAYING) ++ thd->wsrep_conflict_state= NO_CONFLICT; ++ mysql_mutex_unlock(&thd->LOCK_wsrep_thd); ++ ++ if (!buf_len) WSREP_DEBUG("empty rbr buffer to apply: %lld", ++ (long long) wsrep_thd_trx_seqno(thd)); ++ ++ while(buf_len) ++ { ++ int exec_res; ++ Log_event* ev= wsrep_read_log_event(&buf, &buf_len, ++ wsrep_get_apply_format(thd)); ++ ++ if (!ev) ++ { ++ WSREP_ERROR("applier could not read binlog event, seqno: %lld, len: %zu", ++ (long long)wsrep_thd_trx_seqno(thd), buf_len); ++ rcode= 1; ++ goto error; ++ } ++ ++ switch (ev->get_type_code()) { ++ case FORMAT_DESCRIPTION_EVENT: ++ wsrep_set_apply_format(thd, (Format_description_log_event*)ev); ++ continue; ++ case GTID_LOG_EVENT: ++ { ++ Gtid_log_event* gev= (Gtid_log_event*)ev; ++ if (gev->get_gno() == 0) ++ { ++ /* Skip GTID log event to make binlog to generate LTID on commit */ ++ delete ev; ++ continue; ++ } ++ } ++ default: ++ break; ++ } ++ ++ thd->server_id = ev->server_id; // use the original server id for logging ++ thd->set_time(); // time the query ++ wsrep_xid_init(&thd->transaction.xid_state.xid, ++ &thd->wsrep_trx_meta.gtid.uuid, ++ thd->wsrep_trx_meta.gtid.seqno); ++ thd->lex->current_select= 0; ++ if (!ev->when.tv_sec) ++ my_micro_time_to_timeval(my_micro_time(), &ev->when); ++ ev->thd = thd; ++ exec_res = ev->apply_event(thd->wsrep_rli); ++ DBUG_PRINT("info", ("exec_event result: %d", exec_res)); ++ ++ if (exec_res) ++ { ++ WSREP_WARN("RBR event %d %s apply warning: %d, %lld", ++ event, ev->get_type_str(), exec_res, ++ (long long) wsrep_thd_trx_seqno(thd)); ++ rcode= exec_res; ++ /* stop processing for the first error */ ++ delete ev; ++ goto error; ++ } ++ event++; ++ ++ if (thd->wsrep_conflict_state!= NO_CONFLICT && ++ thd->wsrep_conflict_state!= REPLAYING) ++ WSREP_WARN("conflict state after RBR event applying: %d, %lld", ++ thd->wsrep_query_state, (long long)wsrep_thd_trx_seqno(thd)); ++ ++ if (thd->wsrep_conflict_state == MUST_ABORT) { ++ WSREP_WARN("RBR event apply failed, rolling back: %lld", ++ (long long) wsrep_thd_trx_seqno(thd)); ++ trans_rollback(thd); ++ thd->locked_tables_list.unlock_locked_tables(thd); ++ /* Release transactional metadata locks. */ ++ thd->mdl_context.release_transactional_locks(); ++ thd->wsrep_conflict_state= NO_CONFLICT; ++ DBUG_RETURN(WSREP_CB_FAILURE); ++ } ++ ++ delete ev; ++ } ++ ++ error: ++ mysql_mutex_lock(&thd->LOCK_wsrep_thd); ++ thd->wsrep_query_state= QUERY_IDLE; ++ mysql_mutex_unlock(&thd->LOCK_wsrep_thd); ++ ++ assert(thd->wsrep_exec_mode== REPL_RECV); ++ ++ if (thd->killed == THD::KILL_CONNECTION) ++ WSREP_INFO("applier aborted: %lld", (long long)wsrep_thd_trx_seqno(thd)); ++ ++ if (rcode) DBUG_RETURN(WSREP_CB_FAILURE); ++ DBUG_RETURN(WSREP_CB_SUCCESS); ++} ++ ++wsrep_cb_status_t wsrep_apply_cb(void* const ctx, ++ const void* const buf, ++ size_t const buf_len, ++ uint32_t const flags, ++ const wsrep_trx_meta_t* meta) ++{ ++ THD* const thd((THD*)ctx); ++ ++// Allow tests to block the applier thread using the DBUG facilities ++ DBUG_EXECUTE_IF("sync.wsrep_apply_cb", ++ { ++ const char act[]= ++ "now " ++ "wait_for signal.wsrep_apply_cb"; ++ DBUG_ASSERT(!debug_sync_set_action(thd, ++ STRING_WITH_LEN(act))); ++ };); ++ ++ thd->wsrep_trx_meta = *meta; ++ ++#ifdef WSREP_PROC_INFO ++ snprintf(thd->wsrep_info, sizeof(thd->wsrep_info) - 1, ++ "applying write set %lld: %p, %zu", ++ (long long)wsrep_thd_trx_seqno(thd), buf, buf_len); ++ thd_proc_info(thd, thd->wsrep_info); ++#else ++ thd_proc_info(thd, "applying write set"); ++#endif /* WSREP_PROC_INFO */ ++ ++ /* tune FK and UK checking policy */ ++ if (wsrep_slave_UK_checks == FALSE) ++ thd->variables.option_bits|= OPTION_RELAXED_UNIQUE_CHECKS; ++ else ++ thd->variables.option_bits&= ~OPTION_RELAXED_UNIQUE_CHECKS; ++ ++ if (wsrep_slave_FK_checks == FALSE) ++ thd->variables.option_bits|= OPTION_NO_FOREIGN_KEY_CHECKS; ++ else ++ thd->variables.option_bits&= ~OPTION_NO_FOREIGN_KEY_CHECKS; ++ ++ if (flags & WSREP_FLAG_ISOLATION) ++ { ++ thd->wsrep_apply_toi= true; ++ /* ++ Don't run in transaction mode with TOI actions. ++ */ ++ thd->variables.option_bits&= ~OPTION_BEGIN; ++ thd->server_status&= ~SERVER_STATUS_IN_TRANS; ++ } ++ wsrep_cb_status_t rcode(wsrep_apply_events(thd, buf, buf_len)); ++ ++#ifdef WSREP_PROC_INFO ++ snprintf(thd->wsrep_info, sizeof(thd->wsrep_info) - 1, ++ "applied write set %lld", (long long)wsrep_thd_trx_seqno(thd)); ++ thd_proc_info(thd, thd->wsrep_info); ++#else ++ thd_proc_info(thd, "applied write set"); ++#endif /* WSREP_PROC_INFO */ ++ ++ if (WSREP_CB_SUCCESS != rcode) ++ { ++ wsrep_dump_rbr_buf(thd, buf, buf_len); ++ } ++ ++ TABLE *tmp; ++ while ((tmp = thd->temporary_tables)) ++ { ++ WSREP_DEBUG("Applier %lu, has temporary tables: %s.%s", ++ thd->thread_id, ++ (tmp->s) ? tmp->s->db.str : "void", ++ (tmp->s) ? tmp->s->table_name.str : "void"); ++ close_temporary_table(thd, tmp, 1, 1); ++ } ++ ++ return rcode; ++} ++ ++static wsrep_cb_status_t wsrep_commit(THD* const thd, ++ wsrep_seqno_t const global_seqno) ++{ ++#ifdef WSREP_PROC_INFO ++ snprintf(thd->wsrep_info, sizeof(thd->wsrep_info) - 1, ++ "committing %lld", (long long)wsrep_thd_trx_seqno(thd)); ++ thd_proc_info(thd, thd->wsrep_info); ++#else ++ thd_proc_info(thd, "committing"); ++#endif /* WSREP_PROC_INFO */ ++ ++ wsrep_cb_status_t const rcode(trans_commit(thd) ? ++ WSREP_CB_FAILURE : WSREP_CB_SUCCESS); ++ ++#ifdef WSREP_PROC_INFO ++ snprintf(thd->wsrep_info, sizeof(thd->wsrep_info) - 1, ++ "committed %lld", (long long)wsrep_thd_trx_seqno(thd)); ++ thd_proc_info(thd, thd->wsrep_info); ++#else ++ thd_proc_info(thd, "committed"); ++#endif /* WSREP_PROC_INFO */ ++ ++ if (WSREP_CB_SUCCESS == rcode) ++ { ++ thd->wsrep_rli->cleanup_context(thd, 0); ++ thd->variables.gtid_next.set_automatic(); ++ // TODO: mark snapshot with global_seqno. ++ } ++ ++ return rcode; ++} ++ ++static wsrep_cb_status_t wsrep_rollback(THD* const thd, ++ wsrep_seqno_t const global_seqno) ++{ ++#ifdef WSREP_PROC_INFO ++ snprintf(thd->wsrep_info, sizeof(thd->wsrep_info) - 1, ++ "rolling back %lld", (long long)wsrep_thd_trx_seqno(thd)); ++ thd_proc_info(thd, thd->wsrep_info); ++#else ++ thd_proc_info(thd, "rolling back"); ++#endif /* WSREP_PROC_INFO */ ++ ++ wsrep_cb_status_t const rcode(trans_rollback(thd) ? ++ WSREP_CB_FAILURE : WSREP_CB_SUCCESS); ++ ++#ifdef WSREP_PROC_INFO ++ snprintf(thd->wsrep_info, sizeof(thd->wsrep_info) - 1, ++ "rolled back %lld", (long long)wsrep_thd_trx_seqno(thd)); ++ thd_proc_info(thd, thd->wsrep_info); ++#else ++ thd_proc_info(thd, "rolled back"); ++#endif /* WSREP_PROC_INFO */ ++ thd->wsrep_rli->cleanup_context(thd, 0); ++ thd->variables.gtid_next.set_automatic(); ++ ++ return rcode; ++} ++ ++wsrep_cb_status_t wsrep_commit_cb(void* const ctx, ++ uint32_t const flags, ++ const wsrep_trx_meta_t* meta, ++ wsrep_bool_t* const exit, ++ bool const commit) ++{ ++ THD* const thd((THD*)ctx); ++ ++ assert(meta->gtid.seqno == wsrep_thd_trx_seqno(thd)); ++ ++ wsrep_cb_status_t rcode; ++ ++ if (commit) ++ rcode = wsrep_commit(thd, meta->gtid.seqno); ++ else ++ rcode = wsrep_rollback(thd, meta->gtid.seqno); ++ ++ wsrep_set_apply_format(thd, NULL); ++ thd->mdl_context.release_transactional_locks(); ++ free_root(thd->mem_root,MYF(MY_KEEP_PREALLOC)); ++ thd->tx_isolation= (enum_tx_isolation) thd->variables.tx_isolation; ++ ++ if (wsrep_slave_count_change < 0 && commit && WSREP_CB_SUCCESS == rcode) ++ { ++ mysql_mutex_lock(&LOCK_wsrep_slave_threads); ++ if (wsrep_slave_count_change < 0) ++ { ++ wsrep_slave_count_change++; ++ *exit = true; ++ } ++ mysql_mutex_unlock(&LOCK_wsrep_slave_threads); ++ } ++ ++ if (*exit == false && thd->wsrep_applier) ++ { ++ /* From trans_begin() */ ++ thd->variables.option_bits|= OPTION_BEGIN; ++ thd->server_status|= SERVER_STATUS_IN_TRANS; ++ thd->wsrep_apply_toi= false; ++ } ++ ++ return rcode; ++} ++ ++ ++wsrep_cb_status_t wsrep_unordered_cb(void* const ctx, ++ const void* const data, ++ size_t const size) ++{ ++ return WSREP_CB_SUCCESS; ++} +diff --git a/sql/wsrep_applier.h b/sql/wsrep_applier.h +new file mode 100644 +index 0000000..816970d +--- /dev/null ++++ b/sql/wsrep_applier.h +@@ -0,0 +1,38 @@ ++/* Copyright 2013 Codership Oy ++ ++ 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ ++ ++#ifndef WSREP_APPLIER_H ++#define WSREP_APPLIER_H ++ ++#include ++ ++/* wsrep callback prototypes */ ++ ++wsrep_cb_status_t wsrep_apply_cb(void *ctx, ++ const void* buf, size_t buf_len, ++ uint32_t flags, ++ const wsrep_trx_meta_t* meta); ++ ++wsrep_cb_status_t wsrep_commit_cb(void *ctx, ++ uint32_t flags, ++ const wsrep_trx_meta_t* meta, ++ wsrep_bool_t* exit, ++ bool commit); ++ ++wsrep_cb_status_t wsrep_unordered_cb(void* ctx, ++ const void* data, ++ size_t size); ++ ++#endif /* WSREP_APPLIER_H */ +diff --git a/sql/wsrep_binlog.cc b/sql/wsrep_binlog.cc +new file mode 100644 +index 0000000..e33422f +--- /dev/null ++++ b/sql/wsrep_binlog.cc +@@ -0,0 +1,414 @@ ++/* Copyright (C) 2013 Codership Oy ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; version 2 of the License. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License along ++ with this program; if not, write to the Free Software Foundation, Inc., ++ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ ++ ++#include "wsrep_binlog.h" ++#include "wsrep_priv.h" ++ ++/* ++ Write the contents of a cache to a memory buffer. ++ ++ This function quite the same as MYSQL_BIN_LOG::write_cache(), ++ with the exception that here we write in buffer instead of log file. ++ */ ++int wsrep_write_cache_buf(IO_CACHE *cache, uchar **buf, size_t *buf_len) ++{ ++ *buf= NULL; ++ *buf_len= 0; ++ ++ my_off_t const saved_pos(my_b_tell(cache)); ++ ++ if (reinit_io_cache(cache, READ_CACHE, 0, 0, 0)) ++ { ++ WSREP_ERROR("failed to initialize io-cache"); ++ return ER_ERROR_ON_WRITE; ++ } ++ ++ uint length = my_b_bytes_in_cache(cache); ++ if (unlikely(0 == length)) length = my_b_fill(cache); ++ ++ size_t total_length = 0; ++ ++ if (likely(length > 0)) do ++ { ++ total_length += length; ++ /* ++ Bail out if buffer grows too large. ++ A temporary fix to avoid allocating indefinitely large buffer, ++ not a real limit on a writeset size which includes other things ++ like header and keys. ++ */ ++ if (total_length > wsrep_max_ws_size) ++ { ++ WSREP_WARN("transaction size limit (%lu) exceeded: %zu", ++ wsrep_max_ws_size, total_length); ++ goto error; ++ } ++ ++ uchar* tmp = (uchar *)my_realloc(*buf, total_length, MYF(0)); ++ if (!tmp) ++ { ++ WSREP_ERROR("could not (re)allocate buffer: %zu + %u", ++ *buf_len, length); ++ goto error; ++ } ++ *buf = tmp; ++ ++ memcpy(*buf + *buf_len, cache->read_pos, length); ++ *buf_len = total_length; ++ cache->read_pos = cache->read_end; ++ } while ((cache->file >= 0) && (length = my_b_fill(cache))); ++ ++ if (reinit_io_cache(cache, WRITE_CACHE, saved_pos, 0, 0)) ++ { ++ WSREP_WARN("failed to initialize io-cache"); ++ goto cleanup; ++ } ++ ++ if (reinit_io_cache(cache, WRITE_CACHE, saved_pos, 0, 0)) ++ { ++ WSREP_ERROR("failed to initialize io-cache"); ++ goto cleanup; ++ } ++ ++ return 0; ++ ++error: ++ if (reinit_io_cache(cache, WRITE_CACHE, saved_pos, 0, 0)) ++ { ++ WSREP_WARN("failed to initialize io-cache"); ++ } ++cleanup: ++ my_free(*buf); ++ *buf= NULL; ++ *buf_len= 0; ++ return ER_ERROR_ON_WRITE; ++} ++ ++#define STACK_SIZE 4096 /* 4K - for buffer preallocated on the stack: ++ * many transactions would fit in there ++ * so there is no need to reach for the heap */ ++ ++/* Returns minimum multiple of HEAP_PAGE_SIZE that is >= length */ ++static inline size_t ++heap_size(size_t length) ++{ ++ return (length + HEAP_PAGE_SIZE - 1)/HEAP_PAGE_SIZE*HEAP_PAGE_SIZE; ++} ++ ++/* append data to writeset */ ++static inline wsrep_status_t ++wsrep_append_data(wsrep_t* const wsrep, ++ wsrep_ws_handle_t* const ws, ++ const void* const data, ++ size_t const len) ++{ ++ struct wsrep_buf const buff = { data, len }; ++ wsrep_status_t const rc(wsrep->append_data(wsrep, ws, &buff, 1, ++ WSREP_DATA_ORDERED, true)); ++ if (rc != WSREP_OK) ++ { ++ WSREP_WARN("append_data() returned %d", rc); ++ } ++ ++ return rc; ++} ++ ++/* ++ Write the contents of a cache to wsrep provider. ++ ++ This function quite the same as MYSQL_BIN_LOG::write_cache(), ++ with the exception that here we write in buffer instead of log file. ++ ++ This version reads all of cache into single buffer and then appends to a ++ writeset at once. ++ */ ++static int wsrep_write_cache_once(wsrep_t* const wsrep, ++ THD* const thd, ++ IO_CACHE* const cache, ++ size_t* const len) ++{ ++ my_off_t const saved_pos(my_b_tell(cache)); ++ ++ if (reinit_io_cache(cache, READ_CACHE, 0, 0, 0)) ++ { ++ WSREP_ERROR("failed to initialize io-cache"); ++ return ER_ERROR_ON_WRITE; ++ } ++ ++ int err(WSREP_OK); ++ ++ size_t total_length(0); ++ uchar stack_buf[STACK_SIZE]; /* to avoid dynamic allocations for few data*/ ++ uchar* heap_buf(NULL); ++ uchar* buf(stack_buf); ++ size_t allocated(sizeof(stack_buf)); ++ size_t used(0); ++ ++ uint length(my_b_bytes_in_cache(cache)); ++ if (unlikely(0 == length)) length = my_b_fill(cache); ++ ++ if (likely(length > 0)) do ++ { ++ total_length += length; ++ /* ++ Bail out if buffer grows too large. ++ A temporary fix to avoid allocating indefinitely large buffer, ++ not a real limit on a writeset size which includes other things ++ like header and keys. ++ */ ++ if (unlikely(total_length > wsrep_max_ws_size)) ++ { ++ WSREP_WARN("transaction size limit (%lu) exceeded: %zu", ++ wsrep_max_ws_size, total_length); ++ err = WSREP_TRX_SIZE_EXCEEDED; ++ goto cleanup; ++ } ++ ++ if (total_length > allocated) ++ { ++ size_t const new_size(heap_size(total_length)); ++ uchar* tmp = (uchar *)my_realloc(heap_buf, new_size, MYF(0)); ++ if (!tmp) ++ { ++ WSREP_ERROR("could not (re)allocate buffer: %zu + %u", ++ allocated, length); ++ err = WSREP_TRX_SIZE_EXCEEDED; ++ goto cleanup; ++ } ++ ++ heap_buf = tmp; ++ buf = heap_buf; ++ allocated = new_size; ++ ++ if (used <= STACK_SIZE && used > 0) // there's data in stack_buf ++ { ++ DBUG_ASSERT(buf == stack_buf); ++ memcpy(heap_buf, stack_buf, used); ++ } ++ } ++ ++ memcpy(buf + used, cache->read_pos, length); ++ used = total_length; ++ cache->read_pos = cache->read_end; ++ } while ((cache->file >= 0) && (length = my_b_fill(cache))); ++ ++ if (used > 0) ++ err = wsrep_append_data(wsrep, &thd->wsrep_ws_handle, buf, used); ++ ++ if (WSREP_OK == err) *len = total_length; ++ ++cleanup: ++ if (reinit_io_cache(cache, WRITE_CACHE, saved_pos, 0, 0)) ++ { ++ WSREP_ERROR("failed to reinitialize io-cache"); ++ } ++ ++ if (unlikely(WSREP_OK != err)) wsrep_dump_rbr_buf(thd, buf, used); ++ ++ my_free(heap_buf); ++ return err; ++} ++ ++/* ++ Write the contents of a cache to wsrep provider. ++ ++ This function quite the same as MYSQL_BIN_LOG::write_cache(), ++ with the exception that here we write in buffer instead of log file. ++ ++ This version uses incremental data appending as it reads it from cache. ++ */ ++static int wsrep_write_cache_inc(wsrep_t* const wsrep, ++ THD* const thd, ++ IO_CACHE* const cache, ++ size_t* const len) ++{ ++ my_off_t const saved_pos(my_b_tell(cache)); ++ ++ if (reinit_io_cache(cache, READ_CACHE, 0, 0, 0)) ++ { ++ WSREP_ERROR("failed to initialize io-cache"); ++ return WSREP_TRX_ERROR; ++ } ++ ++ int err(WSREP_OK); ++ ++ size_t total_length(0); ++ ++ uint length(my_b_bytes_in_cache(cache)); ++ if (unlikely(0 == length)) length = my_b_fill(cache); ++ ++ if (likely(length > 0)) do ++ { ++ total_length += length; ++ /* bail out if buffer grows too large ++ not a real limit on a writeset size which includes other things ++ like header and keys. ++ */ ++ if (unlikely(total_length > wsrep_max_ws_size)) ++ { ++ WSREP_WARN("transaction size limit (%lu) exceeded: %zu", ++ wsrep_max_ws_size, total_length); ++ err = WSREP_TRX_SIZE_EXCEEDED; ++ goto cleanup; ++ } ++ ++ if(WSREP_OK != (err=wsrep_append_data(wsrep, &thd->wsrep_ws_handle, ++ cache->read_pos, length))) ++ goto cleanup; ++ ++ cache->read_pos = cache->read_end; ++ } while ((cache->file >= 0) && (length = my_b_fill(cache))); ++ ++ if (WSREP_OK == err) *len = total_length; ++ ++cleanup: ++ if (reinit_io_cache(cache, WRITE_CACHE, saved_pos, 0, 0)) ++ { ++ WSREP_ERROR("failed to reinitialize io-cache"); ++ } ++ ++ return err; ++} ++ ++/* ++ Write the contents of a cache to wsrep provider. ++ ++ This function quite the same as MYSQL_BIN_LOG::write_cache(), ++ with the exception that here we write in buffer instead of log file. ++ */ ++int wsrep_write_cache(wsrep_t* const wsrep, ++ THD* const thd, ++ IO_CACHE* const cache, ++ size_t* const len) ++{ ++ if (wsrep_incremental_data_collection) { ++ return wsrep_write_cache_inc(wsrep, thd, cache, len); ++ } ++ else { ++ return wsrep_write_cache_once(wsrep, thd, cache, len); ++ } ++} ++ ++void wsrep_dump_rbr_buf(THD *thd, const void* rbr_buf, size_t buf_len) ++{ ++ char filename[PATH_MAX]= {0}; ++ int len= snprintf(filename, PATH_MAX, "%s/GRA_%ld_%lld.log", ++ wsrep_data_home_dir, thd->thread_id, ++ (long long)wsrep_thd_trx_seqno(thd)); ++ if (len >= PATH_MAX) ++ { ++ WSREP_ERROR("RBR dump path too long: %d, skipping dump.", len); ++ return; ++ } ++ ++ FILE *of= fopen(filename, "wb"); ++ if (of) ++ { ++ fwrite (rbr_buf, buf_len, 1, of); ++ fclose(of); ++ } ++ else ++ { ++ WSREP_ERROR("Failed to open file '%s': %d (%s)", ++ filename, errno, strerror(errno)); ++ } ++} ++ ++void wsrep_dump_rbr_direct(THD* thd, IO_CACHE* cache) ++{ ++ char filename[PATH_MAX]= {0}; ++ int len= snprintf(filename, PATH_MAX, "%s/GRA_%ld_%lld.log", ++ wsrep_data_home_dir, thd->thread_id, ++ (long long)wsrep_thd_trx_seqno(thd)); ++ size_t bytes_in_cache = 0; ++ // check path ++ if (len >= PATH_MAX) ++ { ++ WSREP_ERROR("RBR dump path too long: %d, skipping dump.", len); ++ return ; ++ } ++ // init cache ++ my_off_t const saved_pos(my_b_tell(cache)); ++ if (reinit_io_cache(cache, READ_CACHE, 0, 0, 0)) ++ { ++ WSREP_ERROR("failed to initialize io-cache"); ++ return ; ++ } ++ // open file ++ FILE* of = fopen(filename, "wb"); ++ if (!of) ++ { ++ WSREP_ERROR("Failed to open file '%s': %d (%s)", ++ filename, errno, strerror(errno)); ++ goto cleanup; ++ } ++ // ready to write ++ bytes_in_cache= my_b_bytes_in_cache(cache); ++ if (unlikely(bytes_in_cache == 0)) bytes_in_cache = my_b_fill(cache); ++ if (likely(bytes_in_cache > 0)) do ++ { ++ if (my_fwrite(of, cache->read_pos, bytes_in_cache, ++ MYF(MY_WME | MY_NABP)) == (size_t) -1) ++ { ++ WSREP_ERROR("Failed to write file '%s'", filename); ++ goto cleanup; ++ } ++ cache->read_pos= cache->read_end; ++ } while ((cache->file >= 0) && (bytes_in_cache= my_b_fill(cache))); ++ if(cache->error == -1) ++ { ++ WSREP_ERROR("RBR inconsistent"); ++ goto cleanup; ++ } ++cleanup: ++ // init back ++ if (reinit_io_cache(cache, WRITE_CACHE, saved_pos, 0, 0)) ++ { ++ WSREP_ERROR("failed to reinitialize io-cache"); ++ } ++ // close file ++ if (of) fclose(of); ++} ++ ++extern handlerton *binlog_hton; ++ ++/* ++ wsrep exploits binlog's caches even if binlogging itself is not ++ activated. In such case connection close needs calling ++ actual binlog's method. ++ Todo: split binlog hton from its caches to use ones by wsrep ++ without referring to binlog's stuff. ++*/ ++int wsrep_binlog_close_connection(THD* thd) ++{ ++ DBUG_ENTER("wsrep_binlog_close_connection"); ++ if (thd_get_ha_data(thd, binlog_hton) != NULL) ++ binlog_hton->close_connection (binlog_hton, thd); ++ DBUG_RETURN(0); ++} ++ ++int wsrep_binlog_savepoint_set(THD *thd, void *sv) ++{ ++ if (!wsrep_emulate_bin_log) return 0; ++ int rcode = binlog_hton->savepoint_set(binlog_hton, thd, sv); ++ return rcode; ++} ++ ++int wsrep_binlog_savepoint_rollback(THD *thd, void *sv) ++{ ++ if (!wsrep_emulate_bin_log) return 0; ++ int rcode = binlog_hton->savepoint_rollback(binlog_hton, thd, sv); ++ return rcode; ++} +diff --git a/sql/wsrep_binlog.h b/sql/wsrep_binlog.h +new file mode 100644 +index 0000000..a7b680f +--- /dev/null ++++ b/sql/wsrep_binlog.h +@@ -0,0 +1,56 @@ ++/* Copyright (C) 2013 Codership Oy ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; version 2 of the License. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License along ++ with this program; if not, write to the Free Software Foundation, Inc., ++ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ ++ ++#ifndef WSREP_BINLOG_H ++#define WSREP_BINLOG_H ++ ++#include "sql_class.h" // THD, IO_CACHE ++ ++#define HEAP_PAGE_SIZE 65536 /* 64K */ ++#define WSREP_MAX_WS_SIZE (0xFFFFFFFFUL - HEAP_PAGE_SIZE) ++ ++/* ++ Write the contents of a cache to a memory buffer. ++ ++ This function quite the same as MYSQL_BIN_LOG::write_cache(), ++ with the exception that here we write in buffer instead of log file. ++ */ ++int wsrep_write_cache_buf(IO_CACHE *cache, uchar **buf, size_t *buf_len); ++ ++/* ++ Write the contents of a cache to wsrep provider. ++ ++ This function quite the same as MYSQL_BIN_LOG::write_cache(), ++ with the exception that here we write in buffer instead of log file. ++ ++ @param len total amount of data written ++ @return wsrep error status ++ */ ++int wsrep_write_cache (wsrep_t* wsrep, ++ THD* thd, ++ IO_CACHE* cache, ++ size_t* len); ++ ++/* Dump replication buffer to disk */ ++void wsrep_dump_rbr_buf(THD *thd, const void* rbr_buf, size_t buf_len); ++ ++/* Dump replication buffer to disk without intermediate buffer */ ++void wsrep_dump_rbr_direct(THD* thd, IO_CACHE* cache); ++ ++int wsrep_binlog_close_connection(THD* thd); ++int wsrep_binlog_savepoint_set(THD *thd, void *sv); ++int wsrep_binlog_savepoint_rollback(THD *thd, void *sv); ++ ++#endif /* WSREP_BINLOG_H */ +diff --git a/sql/wsrep_check_opts.cc b/sql/wsrep_check_opts.cc +new file mode 100644 +index 0000000..5ec18c7 +--- /dev/null ++++ b/sql/wsrep_check_opts.cc +@@ -0,0 +1,379 @@ ++/* Copyright 2011 Codership Oy ++ ++ 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ ++ ++//#include ++#include ++//#include ++//#include ++ ++#include "wsrep_mysqld.h" ++ ++#include ++#include ++#include ++#include ++ ++/* This file is about checking for correctness of mysql configuration options */ ++ ++struct opt ++{ ++ const char* const name; ++ const char* value; ++}; ++ ++/* A list of options to check. ++ * At first we assume default values and then see if they are changed on CLI or ++ * in my.cnf */ ++static struct opt opts[] = ++{ ++ { "wsrep_slave_threads", "1" }, // mysqld.cc ++ { "bind_address", "0.0.0.0" }, // mysqld.cc ++ { "wsrep_sst_method", "rsync" }, // mysqld.cc ++ { "wsrep_sst_receive_address","AUTO"}, // mysqld.cc ++ { "binlog_format", "ROW" }, // mysqld.cc ++ { "wsrep_provider", "none" }, // mysqld.cc ++ { "query_cache_type", "0" }, // mysqld.cc ++ { "query_cache_size", "0" }, // mysqld.cc ++ { "locked_in_memory", "0" }, // mysqld.cc ++ { "wsrep_cluster_address", "0" }, // mysqld.cc ++ { "locks_unsafe_for_binlog", "0" }, // ha_innodb.cc ++ { "autoinc_lock_mode", "1" }, // ha_innodb.cc ++ { 0, 0 } ++}; ++ ++enum ++{ ++ WSREP_SLAVE_THREADS, ++ BIND_ADDRESS, ++ WSREP_SST_METHOD, ++ WSREP_SST_RECEIVE_ADDRESS, ++ BINLOG_FORMAT, ++ WSREP_PROVIDER, ++ QUERY_CACHE_TYPE, ++ QUERY_CACHE_SIZE, ++ LOCKED_IN_MEMORY, ++ WSREP_CLUSTER_ADDRESS, ++ LOCKS_UNSAFE_FOR_BINLOG, ++ AUTOINC_LOCK_MODE ++}; ++ ++ ++/* A class to make a copy of argv[] vector */ ++struct argv_copy ++{ ++ int const argc_; ++ char** argv_; ++ ++ argv_copy (int const argc, const char* const argv[]) : ++ argc_ (argc), ++ argv_ (reinterpret_cast(calloc(argc_, sizeof(char*)))) ++ { ++ if (argv_) ++ { ++ for (int i = 0; i < argc_; ++i) ++ { ++ argv_[i] = strdup(argv[i]); ++ ++ if (!argv_[i]) ++ { ++ argv_free (); // free whatever bee allocated ++ return; ++ } ++ } ++ } ++ } ++ ++ ~argv_copy () { argv_free (); } ++ ++private: ++ argv_copy (const argv_copy&); ++ argv_copy& operator= (const argv_copy&); ++ ++ void argv_free() ++ { ++ if (argv_) ++ { ++ for (int i = 0; (i < argc_) && argv_[i] ; ++i) free (argv_[i]); ++ free (argv_); ++ argv_ = 0; ++ } ++ } ++}; ++ ++/* a short corresponding to '--' byte sequence */ ++static short const long_opt_prefix ('-' + ('-' << 8)); ++ ++/* Normalizes long options to have '_' instead of '-' */ ++static int ++normalize_opts (argv_copy& a) ++{ ++ if (a.argv_) ++ { ++ for (int i = 0; i < a.argc_; ++i) ++ { ++ char* ptr = a.argv_[i]; ++ if (long_opt_prefix == *(short*)ptr) // long option ++ { ++ ptr += 2; ++ const char* end = strchr(ptr, '='); ++ ++ if (!end) end = ptr + strlen(ptr); ++ ++ for (; ptr != end; ++ptr) if ('-' == *ptr) *ptr = '_'; ++ } ++ } ++ ++ return 0; ++ } ++ ++ return EINVAL; ++} ++ ++/* Find required options in the argument list and change their values */ ++static int ++find_opts (argv_copy& a, struct opt* const opts) ++{ ++ for (int i = 0; i < a.argc_; ++i) ++ { ++ char* ptr = a.argv_[i] + 2; // we're interested only in long options ++ ++ struct opt* opt = opts; ++ for (; 0 != opt->name; ++opt) ++ { ++ if (!strstr(ptr, opt->name)) continue; // try next option ++ ++ /* 1. try to find value after the '=' */ ++ opt->value = strchr(ptr, '=') + 1; ++ ++ /* 2. if no '=', try next element in the argument vector */ ++ if (reinterpret_cast(1) == opt->value) ++ { ++ /* also check that the next element is not an option itself */ ++ if (i + 1 < a.argc_ && *(a.argv_[i + 1]) != '-') ++ { ++ ++i; ++ opt->value = a.argv_[i]; ++ } ++ else opt->value = ""; // no value supplied (like boolean opt) ++ } ++ ++ break; // option found, break inner loop ++ } ++ } ++ ++ return 0; ++} ++ ++/* Parses string for an integer. Returns 0 on success. */ ++int get_long_long (const struct opt& opt, long long* const val, int const base) ++{ ++ const char* const str = opt.value; ++ ++ if ('\0' != *str) ++ { ++ char* endptr; ++ ++ *val = strtoll (str, &endptr, base); ++ ++ if ('k' == *endptr || 'K' == *endptr) ++ { ++ *val *= 1024L; ++ endptr++; ++ } ++ else if ('m' == *endptr || 'M' == *endptr) ++ { ++ *val *= 1024L * 1024L; ++ endptr++; ++ } ++ else if ('g' == *endptr || 'G' == *endptr) ++ { ++ *val *= 1024L * 1024L * 1024L; ++ endptr++; ++ } ++ ++ if ('\0' == *endptr) return 0; // the whole string was a valid integer ++ } ++ ++ WSREP_ERROR ("Bad value for *%s: '%s'. Should be integer.", ++ opt.name, opt.value); ++ ++ return EINVAL; ++} ++ ++/* This is flimzy coz hell knows how mysql interprets boolean strings... ++ * and, no, I'm not going to become versed in how mysql handles options - ++ * I'd rather sing. ++ ++ Aha, http://dev.mysql.com/doc/refman/5.1/en/dynamic-system-variables.html: ++ Variables that have a type of “boolean” can be set to 0, 1, ON or OFF. (If you ++ set them on the command line or in an option file, use the numeric values.) ++ ++ So it is '0' for FALSE, '1' or empty string for TRUE ++ ++ */ ++int get_bool (const struct opt& opt, bool* const val) ++{ ++ const char* str = opt.value; ++ ++ while (isspace(*str)) ++str; // skip initial whitespaces ++ ++ ssize_t str_len = strlen(str); ++ switch (str_len) ++ { ++ case 0: ++ *val = true; ++ return 0; ++ case 1: ++ if ('0' == *str || '1' == *str) ++ { ++ *val = ('1' == *str); ++ return 0; ++ } ++ } ++ ++ WSREP_ERROR ("Bad value for *%s: '%s'. Should be '0', '1' or empty string.", ++ opt.name, opt.value); ++ ++ return EINVAL; ++} ++ ++static int ++check_opts (int const argc, const char* const argv[], struct opt opts[]) ++{ ++ /* First, make a copy of argv to be able to manipulate it */ ++ argv_copy a(argc, argv); ++ ++ if (!a.argv_) ++ { ++ WSREP_ERROR ("Could not copy argv vector: not enough memory."); ++ return ENOMEM; ++ } ++ ++ int err = normalize_opts (a); ++ if (err) ++ { ++ WSREP_ERROR ("Failed to normalize options."); ++ return err; ++ } ++ ++ err = find_opts (a, opts); ++ if (err) ++ { ++ WSREP_ERROR ("Failed to parse options."); ++ return err; ++ } ++ ++ /* At this point we have updated default values in our option list to ++ what has been specified on the command line / my.cnf */ ++ ++ long long slave_threads; ++ err = get_long_long (opts[WSREP_SLAVE_THREADS], &slave_threads, 10); ++ if (err) return err; ++ ++ int rcode = 0; ++ ++ if (slave_threads > 1) ++ /* Need to check AUTOINC_LOCK_MODE and LOCKS_UNSAFE_FOR_BINLOG */ ++ { ++ long long autoinc_lock_mode; ++ err = get_long_long (opts[AUTOINC_LOCK_MODE], &autoinc_lock_mode, 10); ++ if (err) return err; ++ ++ bool locks_unsafe_for_binlog; ++ err = get_bool (opts[LOCKS_UNSAFE_FOR_BINLOG],&locks_unsafe_for_binlog); ++ if (err) return err; ++ ++ if (autoinc_lock_mode != 2) ++ { ++ WSREP_ERROR ("Parallel applying (wsrep_slave_threads > 1) requires" ++ " innodb_autoinc_lock_mode = 2."); ++ rcode = EINVAL; ++ } ++ } ++ ++ bool locked_in_memory; ++ err = get_bool (opts[LOCKED_IN_MEMORY], &locked_in_memory); ++ if (err) { WSREP_ERROR("get_bool error: %s", strerror(err)); return err; } ++ if (locked_in_memory) ++ { ++ WSREP_ERROR ("Memory locking is not supported (locked_in_memory=%s)", ++ locked_in_memory ? "ON" : "OFF"); ++ rcode = EINVAL; ++ } ++ ++ if (!strcasecmp(opts[WSREP_SST_METHOD].value,"mysqldump")) ++ { ++ if (!strcasecmp(opts[BIND_ADDRESS].value, "127.0.0.1") || ++ !strcasecmp(opts[BIND_ADDRESS].value, "localhost")) ++ { ++ WSREP_ERROR ("wsrep_sst_method is set to 'mysqldump' yet " ++ "mysqld bind_address is set to '%s', which makes it " ++ "impossible to receive state transfer from another " ++ "node, since mysqld won't accept such connections. " ++ "If you wish to use mysqldump state transfer method, " ++ "set bind_address to allow mysql client connections " ++ "from other cluster members (e.g. 0.0.0.0).", ++ opts[BIND_ADDRESS].value); ++ rcode = EINVAL; ++ } ++ } ++ else ++ { ++ // non-mysqldump SST requires wsrep_cluster_address on startup ++ if (strlen(opts[WSREP_CLUSTER_ADDRESS].value) == 0) ++ { ++ WSREP_ERROR ("%s SST method requires wsrep_cluster_address to be " ++ "configured on startup.",opts[WSREP_SST_METHOD].value); ++ rcode = EINVAL; ++ } ++ } ++ ++ if (strcasecmp(opts[WSREP_SST_RECEIVE_ADDRESS].value, "AUTO")) ++ { ++ if (!strncasecmp(opts[WSREP_SST_RECEIVE_ADDRESS].value, ++ "127.0.0.1", strlen("127.0.0.1")) || ++ !strncasecmp(opts[WSREP_SST_RECEIVE_ADDRESS].value, ++ "localhost", strlen("localhost"))) ++ { ++ WSREP_WARN ("wsrep_sst_receive_address is set to '%s' which " ++ "makes it impossible for another host to reach this " ++ "one. Please set it to the address which this node " ++ "can be connected at by other cluster members.", ++ opts[WSREP_SST_RECEIVE_ADDRESS].value); ++// rcode = EINVAL; ++ } ++ } ++ ++ if (strcasecmp(opts[WSREP_PROVIDER].value, "none")) ++ { ++ if (strcasecmp(opts[BINLOG_FORMAT].value, "ROW")) ++ { ++ WSREP_ERROR ("Only binlog_format = 'ROW' is currently supported. " ++ "Configured value: '%s'. Please adjust your " ++ "configuration.", opts[BINLOG_FORMAT].value); ++ ++ rcode = EINVAL; ++ } ++ } ++ ++ return rcode; ++} ++ ++int ++wsrep_check_opts (int const argc, char* const* const argv) ++{ ++ return check_opts (argc, argv, opts); ++} ++ +diff --git a/sql/wsrep_hton.cc b/sql/wsrep_hton.cc +new file mode 100644 +index 0000000..e89858c +--- /dev/null ++++ b/sql/wsrep_hton.cc +@@ -0,0 +1,590 @@ ++/* Copyright 2008 Codership Oy ++ ++ 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ ++ ++#include ++#include "sql_base.h" ++#include "binlog.h" ++#include "rpl_filter.h" ++#include ++#include "wsrep_mysqld.h" ++#include "wsrep_binlog.h" ++#include ++#include ++ ++extern ulonglong thd_to_trx_id(THD *thd); ++ ++extern "C" int thd_binlog_format(const MYSQL_THD thd); ++// todo: share interface with ha_innodb.c ++ ++enum wsrep_trx_status wsrep_run_wsrep_commit(THD *thd, handlerton *hton, ++ bool all); ++ ++/* ++ Cleanup after local transaction commit/rollback, replay or TOI. ++*/ ++void wsrep_cleanup_transaction(THD *thd) ++{ ++ if (wsrep_emulate_bin_log) thd_binlog_trx_reset(thd); ++ thd->wsrep_ws_handle.trx_id= WSREP_UNDEFINED_TRX_ID; ++ thd->wsrep_trx_meta.gtid= WSREP_GTID_UNDEFINED; ++ thd->wsrep_trx_meta.depends_on= WSREP_SEQNO_UNDEFINED; ++ thd->wsrep_exec_mode= LOCAL_STATE; ++ return; ++} ++ ++/* ++ wsrep hton ++*/ ++handlerton *wsrep_hton; ++ ++ ++/* ++ Registers wsrep hton at commit time if transaction has registered htons ++ for supported engine types. ++ ++ Hton should not be registered for TOTAL_ORDER operations. ++ ++ Registration is needed for both LOCAL_MODE and REPL_RECV transactions to run ++ commit in 2pc so that wsrep position gets properly recorded in storage ++ engines. ++ ++ Note that all hton calls should immediately return for threads that are ++ in REPL_RECV mode as their states are controlled by wsrep appliers or ++ replaying code. Only threads in LOCAL_MODE should run wsrep callbacks ++ from hton methods. ++*/ ++void wsrep_register_hton(THD* thd, bool all) ++{ ++ if (thd->wsrep_exec_mode != TOTAL_ORDER && !thd->wsrep_apply_toi) ++ { ++ THD_TRANS *trans=all ? &thd->transaction.all : &thd->transaction.stmt; ++ for (Ha_trx_info *i= trans->ha_list; WSREP(thd) && i; i = i->next()) ++ { ++ if (i->ht()->db_type == DB_TYPE_INNODB) ++ { ++ trans_register_ha(thd, all, wsrep_hton); ++ ++ /* follow innodb read/write settting ++ * but, as an exception: CTAS with empty result set will not be ++ * replicated unless we declare wsrep hton as read/write here ++ */ ++ if (i->is_trx_read_write() || ++ (thd->lex->sql_command == SQLCOM_CREATE_TABLE && ++ thd->wsrep_exec_mode == LOCAL_STATE)) ++ { ++ thd->ha_data[wsrep_hton->slot].ha_info[all].set_trx_read_write(); ++ } ++ break; ++ } ++ } ++ } ++} ++ ++/* ++ Calls wsrep->post_commit() for locally executed transactions that have ++ got seqno from provider (must commit) and don't require replaying. ++ */ ++void wsrep_post_commit(THD* thd, bool all) ++{ ++ switch (thd->wsrep_exec_mode) ++ { ++ case LOCAL_COMMIT: ++ { ++ DBUG_ASSERT(thd->wsrep_trx_meta.gtid.seqno != WSREP_SEQNO_UNDEFINED); ++ if (wsrep->post_commit(wsrep, &thd->wsrep_ws_handle)) ++ { ++ DBUG_PRINT("wsrep", ("set committed fail")); ++ WSREP_WARN("set committed fail: %llu %d", ++ (long long)thd->real_id, thd->get_stmt_da()->status()); ++ } ++ wsrep_cleanup_transaction(thd); ++ break; ++ } ++ case LOCAL_STATE: ++ { ++ /* non-InnoDB statements may have populated events in stmt cache ++ => cleanup ++ */ ++ WSREP_DEBUG("cleanup transaction for LOCAL_STATE: %s", thd->query()); ++ wsrep_cleanup_transaction(thd); ++ break; ++ } ++ default: break; ++ } ++ ++} ++ ++/* ++ wsrep exploits binlog's caches even if binlogging itself is not ++ activated. In such case connection close needs calling ++ actual binlog's method. ++ Todo: split binlog hton from its caches to use ones by wsrep ++ without referring to binlog's stuff. ++*/ ++static int ++wsrep_close_connection(handlerton* hton, THD* thd) ++{ ++ DBUG_ENTER("wsrep_close_connection"); ++ ++ if (thd->wsrep_exec_mode == REPL_RECV) ++ { ++ DBUG_RETURN(0); ++ } ++ DBUG_RETURN(wsrep_binlog_close_connection (thd)); ++} ++ ++/* ++ prepare/wsrep_run_wsrep_commit can fail in two ways ++ - certification test or an equivalent. As a result, ++ the current transaction just rolls back ++ Error codes: ++ WSREP_TRX_CERT_FAIL, WSREP_TRX_SIZE_EXCEEDED, WSREP_TRX_ERROR ++ - a post-certification failure makes this server unable to ++ commit its own WS and therefore the server must abort ++*/ ++static int wsrep_prepare(handlerton *hton, THD *thd, bool all) ++{ ++ DBUG_ENTER("wsrep_prepare"); ++ ++ if (thd->wsrep_exec_mode == REPL_RECV) ++ { ++ DBUG_RETURN(0); ++ } ++ ++ DBUG_ASSERT(thd->ha_data[wsrep_hton->slot].ha_info[all].is_trx_read_write()); ++ DBUG_ASSERT(thd->wsrep_exec_mode == LOCAL_STATE); ++ DBUG_ASSERT(thd->wsrep_trx_meta.gtid.seqno == WSREP_SEQNO_UNDEFINED); ++ ++ if ((all || ++ !thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) && ++ (thd->variables.wsrep_on && !wsrep_trans_cache_is_empty(thd))) ++ { ++ DBUG_RETURN (wsrep_run_wsrep_commit(thd, hton, all)); ++ } ++ DBUG_RETURN(0); ++} ++ ++static int wsrep_savepoint_set(handlerton *hton, THD *thd, void *sv) ++{ ++ DBUG_ENTER("wsrep_savepoint_set"); ++ ++ if (thd->wsrep_exec_mode == REPL_RECV) ++ { ++ DBUG_RETURN(0); ++ } ++ ++ if (!wsrep_emulate_bin_log) DBUG_RETURN(0); ++ int rcode = wsrep_binlog_savepoint_set(thd, sv); ++ DBUG_RETURN(rcode); ++} ++ ++static int wsrep_savepoint_rollback(handlerton *hton, THD *thd, void *sv) ++{ ++ DBUG_ENTER("wsrep_savepoint_rollback"); ++ ++ if (thd->wsrep_exec_mode == REPL_RECV) ++ { ++ DBUG_RETURN(0); ++ } ++ ++ if (!wsrep_emulate_bin_log) DBUG_RETURN(0); ++ int rcode = wsrep_binlog_savepoint_rollback(thd, sv); ++ DBUG_RETURN(rcode); ++} ++ ++static int wsrep_rollback(handlerton *hton, THD *thd, bool all) ++{ ++ DBUG_ENTER("wsrep_rollback"); ++ ++ if (thd->wsrep_exec_mode == REPL_RECV) ++ { ++ DBUG_RETURN(0); ++ } ++ ++ mysql_mutex_lock(&thd->LOCK_wsrep_thd); ++ switch (thd->wsrep_exec_mode) ++ { ++ case TOTAL_ORDER: ++ case REPL_RECV: ++ mysql_mutex_unlock(&thd->LOCK_wsrep_thd); ++ WSREP_DEBUG("Avoiding wsrep rollback for failed DDL: %s", thd->query()); ++ DBUG_RETURN(0); ++ default: break; ++ } ++ ++ if ((all || !thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) && ++ (thd->variables.wsrep_on && thd->wsrep_conflict_state != MUST_REPLAY)) ++ { ++ if (wsrep->post_rollback(wsrep, &thd->wsrep_ws_handle)) ++ { ++ DBUG_PRINT("wsrep", ("setting rollback fail")); ++ WSREP_ERROR("settting rollback fail: thd: %llu SQL: %s", ++ (long long)thd->real_id, thd->query()); ++ } ++ wsrep_cleanup_transaction(thd); ++ } ++ mysql_mutex_unlock(&thd->LOCK_wsrep_thd); ++ DBUG_RETURN(0); ++} ++ ++int wsrep_commit(handlerton *hton, THD *thd, bool all) ++{ ++ DBUG_ENTER("wsrep_commit"); ++ ++ if (thd->wsrep_exec_mode == REPL_RECV) ++ { ++ DBUG_RETURN(0); ++ } ++ ++ mysql_mutex_lock(&thd->LOCK_wsrep_thd); ++ if ((all || !thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) && ++ (thd->variables.wsrep_on && thd->wsrep_conflict_state != MUST_REPLAY)) ++ { ++ if (thd->wsrep_exec_mode == LOCAL_COMMIT) ++ { ++ DBUG_ASSERT(thd->ha_data[wsrep_hton->slot].ha_info[all].is_trx_read_write()); ++ /* ++ Call to wsrep->post_commit() (moved to wsrep_post_commit()) must ++ be done only after commit has done for all involved htons. ++ */ ++ DBUG_PRINT("wsrep", ("commit")); ++ } ++ else ++ { ++ /* ++ Transaction didn't go through wsrep->pre_commit() so just roll back ++ possible changes to clean state. ++ */ ++ if (wsrep->post_rollback(wsrep, &thd->wsrep_ws_handle)) ++ { ++ DBUG_PRINT("wsrep", ("setting rollback fail")); ++ WSREP_ERROR("settting rollback fail: thd: %llu SQL: %s", ++ (long long)thd->real_id, thd->query()); ++ } ++ wsrep_cleanup_transaction(thd); ++ } ++ } ++ mysql_mutex_unlock(&thd->LOCK_wsrep_thd); ++ DBUG_RETURN(0); ++} ++ ++ ++extern Rpl_filter* binlog_filter; ++extern my_bool opt_log_slave_updates; ++ ++enum wsrep_trx_status ++wsrep_run_wsrep_commit(THD *thd, handlerton *hton, bool all) ++{ ++ int rcode= -1; ++ size_t data_len= 0; ++ IO_CACHE *cache; ++ int replay_round= 0; ++ ++ if (thd->get_stmt_da()->is_error()) { ++ WSREP_ERROR("commit issue, error: %d %s", ++ thd->get_stmt_da()->sql_errno(), thd->get_stmt_da()->message()); ++ } ++ ++ DBUG_ENTER("wsrep_run_wsrep_commit"); ++ ++ if (thd->slave_thread && !opt_log_slave_updates) DBUG_RETURN(WSREP_TRX_OK); ++ ++ if (thd->wsrep_exec_mode == REPL_RECV) { ++ ++ mysql_mutex_lock(&thd->LOCK_wsrep_thd); ++ if (thd->wsrep_conflict_state == MUST_ABORT) { ++ if (wsrep_debug) ++ WSREP_INFO("WSREP: must abort for BF"); ++ DBUG_PRINT("wsrep", ("BF apply commit fail")); ++ thd->wsrep_conflict_state = NO_CONFLICT; ++ mysql_mutex_unlock(&thd->LOCK_wsrep_thd); ++ // ++ // TODO: test all calls of the rollback. ++ // rollback must happen automagically innobase_rollback(hton, thd, 1); ++ // ++ DBUG_RETURN(WSREP_TRX_ERROR); ++ } ++ mysql_mutex_unlock(&thd->LOCK_wsrep_thd); ++ } ++ ++ if (thd->wsrep_exec_mode != LOCAL_STATE) DBUG_RETURN(WSREP_TRX_OK); ++ ++ if (thd->wsrep_consistency_check == CONSISTENCY_CHECK_RUNNING) { ++ WSREP_DEBUG("commit for consistency check: %s", thd->query()); ++ DBUG_RETURN(WSREP_TRX_OK); ++ } ++ ++ DBUG_PRINT("wsrep", ("replicating commit")); ++ ++ mysql_mutex_lock(&thd->LOCK_wsrep_thd); ++ if (thd->wsrep_conflict_state == MUST_ABORT) { ++ DBUG_PRINT("wsrep", ("replicate commit fail")); ++ thd->wsrep_conflict_state = ABORTED; ++ mysql_mutex_unlock(&thd->LOCK_wsrep_thd); ++ if (wsrep_debug) { ++ WSREP_INFO("innobase_commit, abort %s", ++ (thd->query()) ? thd->query() : "void"); ++ } ++ DBUG_RETURN(WSREP_TRX_CERT_FAIL); ++ } ++ ++ mysql_mutex_lock(&LOCK_wsrep_replaying); ++ ++ while (wsrep_replaying > 0 && ++ thd->wsrep_conflict_state == NO_CONFLICT && ++ thd->killed == THD::NOT_KILLED && ++ !shutdown_in_progress) ++ { ++ ++ mysql_mutex_unlock(&LOCK_wsrep_replaying); ++ mysql_mutex_unlock(&thd->LOCK_wsrep_thd); ++ ++ mysql_mutex_lock(&thd->mysys_var->mutex); ++ thd_proc_info(thd, "wsrep waiting on replaying"); ++ thd->mysys_var->current_mutex= &LOCK_wsrep_replaying; ++ thd->mysys_var->current_cond= &COND_wsrep_replaying; ++ mysql_mutex_unlock(&thd->mysys_var->mutex); ++ ++ mysql_mutex_lock(&LOCK_wsrep_replaying); ++ // Using timedwait is a hack to avoid deadlock in case if BF victim ++ // misses the signal. ++ struct timespec wtime = {0, 1000000}; ++ mysql_cond_timedwait(&COND_wsrep_replaying, &LOCK_wsrep_replaying, ++ &wtime); ++ ++ if (replay_round++ % 100000 == 0) ++ WSREP_DEBUG("commit waiting for replaying: replayers %d, thd: (%lu) " ++ "conflict: %d (round: %d)", ++ wsrep_replaying, thd->thread_id, ++ thd->wsrep_conflict_state, replay_round); ++ ++ mysql_mutex_unlock(&LOCK_wsrep_replaying); ++ ++ mysql_mutex_lock(&thd->mysys_var->mutex); ++ thd->mysys_var->current_mutex= 0; ++ thd->mysys_var->current_cond= 0; ++ mysql_mutex_unlock(&thd->mysys_var->mutex); ++ ++ mysql_mutex_lock(&thd->LOCK_wsrep_thd); ++ mysql_mutex_lock(&LOCK_wsrep_replaying); ++ } ++ mysql_mutex_unlock(&LOCK_wsrep_replaying); ++ ++ if (thd->wsrep_conflict_state == MUST_ABORT) { ++ DBUG_PRINT("wsrep", ("replicate commit fail")); ++ thd->wsrep_conflict_state = ABORTED; ++ mysql_mutex_unlock(&thd->LOCK_wsrep_thd); ++ WSREP_DEBUG("innobase_commit abort after replaying wait %s", ++ (thd->query()) ? thd->query() : "void"); ++ DBUG_RETURN(WSREP_TRX_CERT_FAIL); ++ } ++ ++ thd->wsrep_query_state = QUERY_COMMITTING; ++ mysql_mutex_unlock(&thd->LOCK_wsrep_thd); ++ ++ cache = get_trans_log(thd); ++ rcode = 0; ++ if (cache) { ++ thd->binlog_flush_pending_rows_event(true); ++ rcode = wsrep_write_cache(wsrep, thd, cache, &data_len); ++ if (WSREP_OK != rcode) { ++ WSREP_ERROR("rbr write fail, data_len: %zu, %d", data_len, rcode); ++ DBUG_RETURN(WSREP_TRX_SIZE_EXCEEDED); ++ } ++ } ++ ++ if (data_len == 0) ++ { ++ if (thd->get_stmt_da()->is_ok() && ++ thd->get_stmt_da()->affected_rows() > 0 && ++ !binlog_filter->is_on()) ++ { ++ WSREP_DEBUG("empty rbr buffer, query: %s, " ++ "affected rows: %llu, " ++ "changed tables: %d, " ++ "sql_log_bin: %d, " ++ "wsrep status (%d %d %d)", ++ thd->query(), thd->get_stmt_da()->affected_rows(), ++ stmt_has_updated_trans_table(thd), thd->variables.sql_log_bin, ++ thd->wsrep_exec_mode, thd->wsrep_query_state, ++ thd->wsrep_conflict_state); ++ } ++ else ++ { ++ WSREP_DEBUG("empty rbr buffer, query: %s", thd->query()); ++ } ++ thd->wsrep_query_state= QUERY_EXEC; ++ DBUG_RETURN(WSREP_TRX_OK); ++ } ++ ++ if (WSREP_UNDEFINED_TRX_ID == thd->wsrep_ws_handle.trx_id) ++ { ++ WSREP_WARN("SQL statement was ineffective, THD: %lu, buf: %zu\n" ++ "QUERY: %s\n" ++ " => Skipping replication", ++ thd->thread_id, data_len, thd->query()); ++ rcode = WSREP_TRX_FAIL; ++ } ++ else if (!rcode) ++ { ++ if (WSREP_OK == rcode) ++ rcode = wsrep->pre_commit(wsrep, ++ (wsrep_conn_id_t)thd->thread_id, ++ &thd->wsrep_ws_handle, ++ WSREP_FLAG_COMMIT | ++ ((thd->wsrep_PA_safe) ? ++ 0ULL : WSREP_FLAG_PA_UNSAFE), ++ &thd->wsrep_trx_meta); ++ ++ if (rcode == WSREP_TRX_MISSING) { ++ WSREP_WARN("Transaction missing in provider, thd: %ld, SQL: %s", ++ thd->thread_id, thd->query()); ++ rcode = WSREP_TRX_FAIL; ++ } else if (rcode == WSREP_BF_ABORT) { ++ WSREP_DEBUG("thd %lu seqno %lld BF aborted by provider, will replay", ++ thd->thread_id, (long long)thd->wsrep_trx_meta.gtid.seqno); ++ mysql_mutex_lock(&thd->LOCK_wsrep_thd); ++ thd->wsrep_conflict_state = MUST_REPLAY; ++ DBUG_ASSERT(wsrep_thd_trx_seqno(thd) > 0); ++ mysql_mutex_unlock(&thd->LOCK_wsrep_thd); ++ mysql_mutex_lock(&LOCK_wsrep_replaying); ++ wsrep_replaying++; ++ WSREP_DEBUG("replaying increased: %d, thd: %lu", ++ wsrep_replaying, thd->thread_id); ++ mysql_mutex_unlock(&LOCK_wsrep_replaying); ++ } ++ } else { ++ WSREP_ERROR("I/O error reading from thd's binlog iocache: " ++ "errno=%d, io cache code=%d", my_errno, cache->error); ++ DBUG_ASSERT(0); // failure like this can not normally happen ++ DBUG_RETURN(WSREP_TRX_ERROR); ++ } ++ ++ mysql_mutex_lock(&thd->LOCK_wsrep_thd); ++ switch(rcode) { ++ case 0: ++ /* ++ About MUST_ABORT: We assume that even if thd conflict state was set ++ to MUST_ABORT, underlying transaction was not rolled back or marked ++ as deadlock victim in QUERY_COMMITTING state. Conflict state is ++ set to NO_CONFLICT and commit proceeds as usual. ++ */ ++ if (thd->wsrep_conflict_state == MUST_ABORT) ++ thd->wsrep_conflict_state= NO_CONFLICT; ++ ++ if (thd->wsrep_conflict_state != NO_CONFLICT) ++ { ++ WSREP_WARN("thd %lu seqno %lld: conflict state %d after post commit", ++ thd->thread_id, ++ (long long)thd->wsrep_trx_meta.gtid.seqno, ++ thd->wsrep_conflict_state); ++ } ++ thd->wsrep_exec_mode= LOCAL_COMMIT; ++ DBUG_ASSERT(thd->wsrep_trx_meta.gtid.seqno != WSREP_SEQNO_UNDEFINED); ++ /* Override XID iff it was generated by mysql */ ++ if (thd->transaction.xid_state.xid.get_my_xid()) ++ { ++ wsrep_xid_init(&thd->transaction.xid_state.xid, ++ &thd->wsrep_trx_meta.gtid.uuid, ++ thd->wsrep_trx_meta.gtid.seqno); ++ } ++ DBUG_PRINT("wsrep", ("replicating commit success")); ++ break; ++ case WSREP_BF_ABORT: ++ DBUG_ASSERT(thd->wsrep_trx_meta.gtid.seqno != WSREP_SEQNO_UNDEFINED); ++ case WSREP_TRX_FAIL: ++ WSREP_DEBUG("commit failed for reason: %d %lu %s", rcode, thd->thread_id, thd->query()); ++ DBUG_PRINT("wsrep", ("replicating commit fail")); ++ ++ thd->wsrep_query_state= QUERY_EXEC; ++ ++ if (thd->wsrep_conflict_state == MUST_ABORT) { ++ thd->wsrep_conflict_state= ABORTED; ++ } ++ else ++ { ++ WSREP_DEBUG("conflict state: %d", thd->wsrep_conflict_state); ++ if (thd->wsrep_conflict_state == NO_CONFLICT) ++ { ++ thd->wsrep_conflict_state = CERT_FAILURE; ++ WSREP_LOG_CONFLICT(NULL, thd, FALSE); ++ } ++ } ++ mysql_mutex_unlock(&thd->LOCK_wsrep_thd); ++ ++ DBUG_RETURN(WSREP_TRX_CERT_FAIL); ++ ++ case WSREP_SIZE_EXCEEDED: ++ WSREP_ERROR("transaction size exceeded"); ++ mysql_mutex_unlock(&thd->LOCK_wsrep_thd); ++ DBUG_RETURN(WSREP_TRX_SIZE_EXCEEDED); ++ case WSREP_CONN_FAIL: ++ WSREP_ERROR("connection failure"); ++ mysql_mutex_unlock(&thd->LOCK_wsrep_thd); ++ DBUG_RETURN(WSREP_TRX_ERROR); ++ default: ++ WSREP_ERROR("unknown connection failure"); ++ mysql_mutex_unlock(&thd->LOCK_wsrep_thd); ++ DBUG_RETURN(WSREP_TRX_ERROR); ++ } ++ ++ thd->wsrep_query_state= QUERY_EXEC; ++ mysql_mutex_unlock(&thd->LOCK_wsrep_thd); ++ ++ DBUG_RETURN(WSREP_TRX_OK); ++} ++ ++ ++static int wsrep_hton_init(void *p) ++{ ++ wsrep_hton= (handlerton *)p; ++ //wsrep_hton->state=opt_bin_log ? SHOW_OPTION_YES : SHOW_OPTION_NO; ++ wsrep_hton->state= SHOW_OPTION_YES; ++ wsrep_hton->db_type=DB_TYPE_WSREP; ++ wsrep_hton->savepoint_offset= sizeof(my_off_t); ++ wsrep_hton->close_connection= wsrep_close_connection; ++ wsrep_hton->savepoint_set= wsrep_savepoint_set; ++ wsrep_hton->savepoint_rollback= wsrep_savepoint_rollback; ++ wsrep_hton->commit= wsrep_commit; ++ wsrep_hton->rollback= wsrep_rollback; ++ wsrep_hton->prepare= wsrep_prepare; ++ wsrep_hton->flags= HTON_NOT_USER_SELECTABLE | HTON_HIDDEN; // todo: fix flags ++ wsrep_hton->slot= 0; ++ return 0; ++} ++ ++ ++struct st_mysql_storage_engine wsrep_storage_engine= ++{ MYSQL_HANDLERTON_INTERFACE_VERSION }; ++ ++ ++mysql_declare_plugin(wsrep) ++{ ++ MYSQL_STORAGE_ENGINE_PLUGIN, ++ &wsrep_storage_engine, ++ "wsrep", ++ "Codership Oy", ++ "A pseudo storage engine to represent transactions in multi-master " ++ "synchornous replication", ++ PLUGIN_LICENSE_GPL, ++ wsrep_hton_init, /* Plugin Init */ ++ NULL, /* Plugin Deinit */ ++ 0x0100 /* 1.0 */, ++ NULL, /* status variables */ ++ NULL, /* system variables */ ++ NULL, /* config options */ ++ 0, /* flags */ ++} ++mysql_declare_plugin_end; +diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc +new file mode 100644 +index 0000000..e2816c4 +--- /dev/null ++++ b/sql/wsrep_mysqld.cc +@@ -0,0 +1,1564 @@ ++/* Copyright 2008-2013 Codership Oy ++ ++ 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ ++ ++#include ++#include ++#include ++#include "wsrep_priv.h" ++#include "wsrep_thd.h" ++#include "wsrep_sst.h" ++#include "wsrep_utils.h" ++#include "wsrep_var.h" ++#include "wsrep_binlog.h" ++#include "wsrep_applier.h" ++#include ++#include ++#include "log_event.h" ++#include ++ ++wsrep_t *wsrep = NULL; ++my_bool wsrep_emulate_bin_log = FALSE; // activating parts of binlog interface ++/* Sidno in global_sid_map corresponding to group uuid */ ++rpl_sidno wsrep_sidno= -1; ++my_bool wsrep_preordered_opt= FALSE; ++ ++/* ++ * Begin configuration options and their default values ++ */ ++ ++const char* wsrep_data_home_dir = NULL; ++const char* wsrep_dbug_option = ""; ++ ++long wsrep_slave_threads = 1; // # of slave action appliers wanted ++int wsrep_slave_count_change = 0; // # of appliers to stop or start ++my_bool wsrep_debug = 0; // enable debug level logging ++my_bool wsrep_convert_LOCK_to_trx = 1; // convert locking sessions to trx ++ulong wsrep_retry_autocommit = 5; // retry aborted autocommit trx ++my_bool wsrep_auto_increment_control = 1; // control auto increment variables ++my_bool wsrep_drupal_282555_workaround = 1; // retry autoinc insert after dupkey ++my_bool wsrep_incremental_data_collection = 0; // incremental data collection ++ulong wsrep_max_ws_size = 1073741824UL;//max ws (RBR buffer) size ++ulong wsrep_max_ws_rows = 65536; // max number of rows in ws ++int wsrep_to_isolation = 0; // # of active TO isolation threads ++my_bool wsrep_certify_nonPK = 1; // certify, even when no primary key ++long wsrep_max_protocol_version = 3; // maximum protocol version to use ++ulong wsrep_forced_binlog_format = BINLOG_FORMAT_UNSPEC; ++my_bool wsrep_recovery = 0; // recovery ++my_bool wsrep_replicate_myisam = 0; // enable myisam replication ++my_bool wsrep_log_conflicts = 0; ++ulong wsrep_mysql_replication_bundle = 0; ++my_bool wsrep_desync = 0; // desynchronize the node from the ++ // cluster ++my_bool wsrep_load_data_splitting = 1; // commit load data every 10K intervals ++my_bool wsrep_restart_slave = 0; // should mysql slave thread be ++ // restarted, if node joins back ++my_bool wsrep_restart_slave_activated = 0; // node has dropped, and slave ++ // restart will be needed ++my_bool wsrep_slave_UK_checks = 0; // slave thread does UK checks ++my_bool wsrep_slave_FK_checks = 0; // slave thread does FK checks ++/* ++ * End configuration options ++ */ ++ ++static const wsrep_uuid_t cluster_uuid = WSREP_UUID_UNDEFINED; ++static char cluster_uuid_str[40]= { 0, }; ++static const char* cluster_status_str[WSREP_VIEW_MAX] = ++{ ++ "Primary", ++ "non-Primary", ++ "Disconnected" ++}; ++ ++static char provider_name[256]= { 0, }; ++static char provider_version[256]= { 0, }; ++static char provider_vendor[256]= { 0, }; ++ ++/* ++ * wsrep status variables ++ */ ++my_bool wsrep_connected = FALSE; ++my_bool wsrep_ready = FALSE; // node can accept queries ++const char* wsrep_cluster_state_uuid = cluster_uuid_str; ++long long wsrep_cluster_conf_id = WSREP_SEQNO_UNDEFINED; ++const char* wsrep_cluster_status = cluster_status_str[WSREP_VIEW_DISCONNECTED]; ++long wsrep_cluster_size = 0; ++long wsrep_local_index = -1; ++long long wsrep_local_bf_aborts = 0; ++const char* wsrep_provider_name = provider_name; ++const char* wsrep_provider_version = provider_version; ++const char* wsrep_provider_vendor = provider_vendor; ++/* End wsrep status variables */ ++ ++wsrep_uuid_t local_uuid = WSREP_UUID_UNDEFINED; ++wsrep_seqno_t local_seqno = WSREP_SEQNO_UNDEFINED; ++wsp::node_status local_status; ++long wsrep_protocol_version = 3; ++ ++// Boolean denoting if server is in initial startup phase. This is needed ++// to make sure that main thread waiting in wsrep_sst_wait() is signaled ++// if there was no state gap on receiving first view event. ++static my_bool wsrep_startup = TRUE; ++ ++ ++static void wsrep_log_cb(wsrep_log_level_t level, const char *msg) { ++ switch (level) { ++ case WSREP_LOG_INFO: ++ sql_print_information("WSREP: %s", msg); ++ break; ++ case WSREP_LOG_WARN: ++ sql_print_warning("WSREP: %s", msg); ++ break; ++ case WSREP_LOG_ERROR: ++ case WSREP_LOG_FATAL: ++ sql_print_error("WSREP: %s", msg); ++ break; ++ case WSREP_LOG_DEBUG: ++ if (wsrep_debug) sql_print_information ("[Debug] WSREP: %s", msg); ++ default: ++ break; ++ } ++} ++ ++static void wsrep_log_states (wsrep_log_level_t const level, ++ const wsrep_uuid_t* const group_uuid, ++ wsrep_seqno_t const group_seqno, ++ const wsrep_uuid_t* const node_uuid, ++ wsrep_seqno_t const node_seqno) ++{ ++ char uuid_str[37]; ++ char msg[256]; ++ ++ wsrep_uuid_print (group_uuid, uuid_str, sizeof(uuid_str)); ++ snprintf (msg, 255, "WSREP: Group state: %s:%lld", ++ uuid_str, (long long)group_seqno); ++ wsrep_log_cb (level, msg); ++ ++ wsrep_uuid_print (node_uuid, uuid_str, sizeof(uuid_str)); ++ snprintf (msg, 255, "WSREP: Local state: %s:%lld", ++ uuid_str, (long long)node_seqno); ++ wsrep_log_cb (level, msg); ++} ++ ++static my_bool set_SE_checkpoint(THD* unused, plugin_ref plugin, void* arg) ++{ ++ XID* xid= reinterpret_cast(arg); ++ handlerton* hton= plugin_data(plugin, handlerton *); ++ if (hton->db_type == DB_TYPE_INNODB) ++ { ++ const wsrep_uuid_t* uuid(wsrep_xid_uuid(xid)); ++ char uuid_str[40] = {0, }; ++ wsrep_uuid_print(uuid, uuid_str, sizeof(uuid_str)); ++ WSREP_DEBUG("Set WSREPXid for InnoDB: %s:%lld", ++ uuid_str, (long long)wsrep_xid_seqno(xid)); ++ hton->wsrep_set_checkpoint(hton, xid); ++ } ++ return FALSE; ++} ++ ++void wsrep_set_SE_checkpoint(XID* xid) ++{ ++ plugin_foreach(NULL, set_SE_checkpoint, MYSQL_STORAGE_ENGINE_PLUGIN, xid); ++} ++ ++static my_bool get_SE_checkpoint(THD* unused, plugin_ref plugin, void* arg) ++{ ++ XID* xid= reinterpret_cast(arg); ++ handlerton* hton= plugin_data(plugin, handlerton *); ++ if (hton->db_type == DB_TYPE_INNODB) ++ { ++ hton->wsrep_get_checkpoint(hton, xid); ++ const wsrep_uuid_t* uuid(wsrep_xid_uuid(xid)); ++ char uuid_str[40] = {0, }; ++ wsrep_uuid_print(uuid, uuid_str, sizeof(uuid_str)); ++ WSREP_DEBUG("Read WSREPXid from InnoDB: %s:%lld", ++ uuid_str, (long long)wsrep_xid_seqno(xid)); ++ ++ } ++ return FALSE; ++} ++ ++void wsrep_get_SE_checkpoint(XID* xid) ++{ ++ plugin_foreach(NULL, get_SE_checkpoint, MYSQL_STORAGE_ENGINE_PLUGIN, xid); ++} ++ ++void wsrep_init_sidno(const wsrep_uuid_t& uuid) ++{ ++ /* generate new Sid map entry from inverted uuid */ ++ rpl_sid sid; ++ wsrep_uuid_t ltid_uuid; ++ for (size_t i= 0; i < sizeof(ltid_uuid.data); ++i) ++ { ++ ltid_uuid.data[i] = ~local_uuid.data[i]; ++ } ++ sid.copy_from(ltid_uuid.data); ++ global_sid_lock->wrlock(); ++ wsrep_sidno= global_sid_map->add_sid(sid); ++ WSREP_INFO("inited wsrep sidno %d", wsrep_sidno); ++ global_sid_lock->unlock(); ++} ++ ++ ++static wsrep_cb_status_t ++wsrep_view_handler_cb (void* app_ctx, ++ void* recv_ctx, ++ const wsrep_view_info_t* view, ++ const char* state, ++ size_t state_len, ++ void** sst_req, ++ size_t* sst_req_len) ++{ ++ *sst_req = NULL; ++ *sst_req_len = 0; ++ ++ wsrep_member_status_t new_status= local_status.get(); ++ ++ if (memcmp(&cluster_uuid, &view->state_id.uuid, sizeof(wsrep_uuid_t))) ++ { ++ memcpy((wsrep_uuid_t*)&cluster_uuid, &view->state_id.uuid, ++ sizeof(cluster_uuid)); ++ ++ wsrep_uuid_print (&cluster_uuid, cluster_uuid_str, ++ sizeof(cluster_uuid_str)); ++ } ++ ++ wsrep_cluster_conf_id= view->view; ++ wsrep_cluster_status= cluster_status_str[view->status]; ++ wsrep_cluster_size= view->memb_num; ++ wsrep_local_index= view->my_idx; ++ ++ WSREP_INFO("New cluster view: global state: %s:%lld, view# %lld: %s, " ++ "number of nodes: %ld, my index: %ld, protocol version %d", ++ wsrep_cluster_state_uuid, (long long)view->state_id.seqno, ++ (long long)wsrep_cluster_conf_id, wsrep_cluster_status, ++ wsrep_cluster_size, wsrep_local_index, view->proto_ver); ++ ++ /* Proceed further only if view is PRIMARY */ ++ if (WSREP_VIEW_PRIMARY != view->status) { ++ wsrep_ready_set(FALSE); ++ new_status= WSREP_MEMBER_UNDEFINED; ++ /* Always record local_uuid and local_seqno in non-prim since this ++ * may lead to re-initializing provider and start position is ++ * determined according to these variables */ ++ // WRONG! local_uuid should be the last primary configuration uuid we were ++ // a member of. local_seqno should be updated in commit calls. ++ // local_uuid= cluster_uuid; ++ // local_seqno= view->first - 1; ++ goto out; ++ } ++ ++ switch (view->proto_ver) ++ { ++ case 0: ++ case 1: ++ case 2: ++ case 3: ++ // version change ++ if (view->proto_ver != wsrep_protocol_version) ++ { ++ my_bool wsrep_ready_saved= wsrep_ready; ++ wsrep_ready_set(FALSE); ++ WSREP_INFO("closing client connections for " ++ "protocol change %ld -> %d", ++ wsrep_protocol_version, view->proto_ver); ++ wsrep_close_client_connections(TRUE); ++ wsrep_protocol_version= view->proto_ver; ++ wsrep_ready_set(wsrep_ready_saved); ++ } ++ break; ++ default: ++ WSREP_ERROR("Unsupported application protocol version: %d", ++ view->proto_ver); ++ unireg_abort(1); ++ } ++ ++ if (view->state_gap) ++ { ++ WSREP_WARN("Gap in state sequence. Need state transfer."); ++ ++ /* After that wsrep will call wsrep_sst_prepare. */ ++ /* keep ready flag 0 until we receive the snapshot */ ++ wsrep_ready_set(FALSE); ++ ++ /* Close client connections to ensure that they don't interfere ++ * with SST. Necessary only if storage engines are initialized ++ * before SST. ++ * TODO: Just killing all ongoing transactions should be enough ++ * since wsrep_ready is OFF and no new transactions can start. ++ */ ++ if (!wsrep_before_SE()) ++ { ++ WSREP_DEBUG("[debug]: closing client connections for PRIM"); ++ wsrep_close_client_connections(TRUE); ++ } ++ ++ ssize_t const req_len= wsrep_sst_prepare (sst_req); ++ ++ if (req_len < 0) ++ { ++ WSREP_ERROR("SST preparation failed: %zd (%s)", -req_len, ++ strerror(-req_len)); ++ new_status= WSREP_MEMBER_UNDEFINED; ++ } ++ else ++ { ++ assert(sst_req != NULL); ++ *sst_req_len= req_len; ++ new_status= WSREP_MEMBER_JOINER; ++ } ++ } ++ else ++ { ++ /* ++ * NOTE: Initialize wsrep_group_uuid here only if it wasn't initialized ++ * before - OR - it was reinitilized on startup (lp:992840) ++ */ ++ if (wsrep_startup) ++ { ++ if (wsrep_before_SE()) ++ { ++ wsrep_SE_init_grab(); ++ // Signal mysqld init thread to continue ++ wsrep_sst_complete (&cluster_uuid, view->state_id.seqno, false); ++ // and wait for SE initialization ++ wsrep_SE_init_wait(); ++ } ++ else ++ { ++ local_uuid= cluster_uuid; ++ local_seqno= view->state_id.seqno; ++ } ++ /* Init storage engine XIDs from first view */ ++ XID xid; ++ wsrep_xid_init(&xid, &local_uuid, local_seqno); ++ wsrep_set_SE_checkpoint(&xid); ++ new_status= WSREP_MEMBER_JOINED; ++ wsrep_init_sidno(local_uuid); ++ } ++ ++ // just some sanity check ++ if (memcmp (&local_uuid, &cluster_uuid, sizeof (wsrep_uuid_t))) ++ { ++ WSREP_ERROR("Undetected state gap. Can't continue."); ++ wsrep_log_states(WSREP_LOG_FATAL, &cluster_uuid, view->state_id.seqno, ++ &local_uuid, -1); ++ unireg_abort(1); ++ } ++ } ++ ++ if (wsrep_auto_increment_control) ++ { ++ global_system_variables.auto_increment_offset= view->my_idx + 1; ++ global_system_variables.auto_increment_increment= view->memb_num; ++ } ++ ++ { /* capabilities may be updated on new configuration */ ++ uint64_t const caps(wsrep->capabilities (wsrep)); ++ ++ my_bool const idc((caps & WSREP_CAP_INCREMENTAL_WRITESET) != 0); ++ if (TRUE == wsrep_incremental_data_collection && FALSE == idc) ++ { ++ WSREP_WARN("Unsupported protocol downgrade: " ++ "incremental data collection disabled. Expect abort."); ++ } ++ wsrep_incremental_data_collection = idc; ++ } ++ ++out: ++ if (view->status == WSREP_VIEW_PRIMARY) wsrep_startup= FALSE; ++ local_status.set(new_status, view); ++ ++ return WSREP_CB_SUCCESS; ++} ++ ++void wsrep_ready_set (my_bool x) ++{ ++ WSREP_DEBUG("Setting wsrep_ready to %d", x); ++ if (mysql_mutex_lock (&LOCK_wsrep_ready)) abort(); ++ if (wsrep_ready != x) ++ { ++ wsrep_ready= x; ++ mysql_cond_signal (&COND_wsrep_ready); ++ } ++ mysql_mutex_unlock (&LOCK_wsrep_ready); ++} ++ ++// Wait until wsrep has reached ready state ++void wsrep_ready_wait () ++{ ++ if (mysql_mutex_lock (&LOCK_wsrep_ready)) abort(); ++ while (!wsrep_ready) ++ { ++ WSREP_INFO("Waiting to reach ready state"); ++ mysql_cond_wait (&COND_wsrep_ready, &LOCK_wsrep_ready); ++ } ++ WSREP_INFO("ready state reached"); ++ mysql_mutex_unlock (&LOCK_wsrep_ready); ++} ++ ++static void wsrep_synced_cb(void* app_ctx) ++{ ++ WSREP_INFO("Synchronized with group, ready for connections"); ++ bool signal_main= false; ++ if (mysql_mutex_lock (&LOCK_wsrep_ready)) abort(); ++ if (!wsrep_ready) ++ { ++ wsrep_ready= TRUE; ++ mysql_cond_signal (&COND_wsrep_ready); ++ signal_main= true; ++ ++ } ++ local_status.set(WSREP_MEMBER_SYNCED); ++ mysql_mutex_unlock (&LOCK_wsrep_ready); ++ ++ if (signal_main) ++ { ++ wsrep_SE_init_grab(); ++ // Signal mysqld init thread to continue ++ wsrep_sst_complete (&local_uuid, local_seqno, false); ++ // and wait for SE initialization ++ wsrep_SE_init_wait(); ++ } ++ if (wsrep_restart_slave_activated) ++ { ++ int rcode; ++ WSREP_INFO("MySQL slave restart"); ++ wsrep_restart_slave_activated= FALSE; ++ ++ mysql_mutex_lock(&LOCK_active_mi); ++ if ((rcode = start_slave_threads(1 /* need mutex */, ++ 0 /* no wait for start*/, ++ active_mi, ++ SLAVE_SQL))) ++ { ++ WSREP_WARN("Failed to create slave threads: %d", rcode); ++ } ++ mysql_mutex_unlock(&LOCK_active_mi); ++ ++ } ++} ++ ++static void wsrep_init_position() ++{ ++ /* read XIDs from storage engines */ ++ XID xid; ++ memset(&xid, 0, sizeof(xid)); ++ xid.formatID= -1; ++ wsrep_get_SE_checkpoint(&xid); ++ ++ if (xid.formatID == -1) ++ { ++ WSREP_INFO("Read nil XID from storage engines, skipping position init"); ++ return; ++ } ++ else if (!wsrep_is_wsrep_xid(&xid)) ++ { ++ WSREP_WARN("Read non-wsrep XID from storage engines, skipping position init"); ++ return; ++ } ++ ++ const wsrep_uuid_t* uuid= wsrep_xid_uuid(&xid); ++ const wsrep_seqno_t seqno= wsrep_xid_seqno(&xid); ++ ++ char uuid_str[40] = {0, }; ++ wsrep_uuid_print(uuid, uuid_str, sizeof(uuid_str)); ++ WSREP_INFO("Initial position: %s:%lld", uuid_str, (long long)seqno); ++ ++ ++ if (!memcmp(&local_uuid, &WSREP_UUID_UNDEFINED, sizeof(local_uuid)) && ++ local_seqno == WSREP_SEQNO_UNDEFINED) ++ { ++ // Initial state ++ local_uuid= *uuid; ++ local_seqno= seqno; ++ } ++ else if (memcmp(&local_uuid, uuid, sizeof(local_uuid)) || ++ local_seqno != seqno) ++ { ++ WSREP_WARN("Initial position was provided by configuration or SST, " ++ "avoiding override"); ++ } ++} ++ ++int wsrep_init() ++{ ++ int rcode= -1; ++ ++ wsrep_ready_set(FALSE); ++ assert(wsrep_provider); ++ ++ wsrep_init_position(); ++ ++ if ((rcode= wsrep_load(wsrep_provider, &wsrep, wsrep_log_cb)) != WSREP_OK) ++ { ++ if (strcasecmp(wsrep_provider, WSREP_NONE)) ++ { ++ WSREP_ERROR("wsrep_load(%s) failed: %s (%d). Reverting to no provider.", ++ wsrep_provider, strerror(rcode), rcode); ++ strcpy((char*)wsrep_provider, WSREP_NONE); // damn it's a dirty hack ++ (void) wsrep_init(); ++ return rcode; ++ } ++ else /* this is for recursive call above */ ++ { ++ WSREP_ERROR("Could not revert to no provider: %s (%d). Need to abort.", ++ strerror(rcode), rcode); ++ unireg_abort(1); ++ } ++ } ++ ++ if (strlen(wsrep_provider)== 0 || ++ !strcmp(wsrep_provider, WSREP_NONE)) ++ { ++ // enable normal operation in case no provider is specified ++ wsrep_ready_set(TRUE); ++ global_system_variables.wsrep_on = 0; ++ wsrep_init_args args; ++ args.logger_cb = wsrep_log_cb; ++ args.options = (wsrep_provider_options) ? ++ wsrep_provider_options : ""; ++ rcode = wsrep->init(wsrep, &args); ++ if (rcode) ++ { ++ DBUG_PRINT("wsrep",("wsrep::init() failed: %d", rcode)); ++ WSREP_ERROR("wsrep::init() failed: %d, must shutdown", rcode); ++ wsrep->free(wsrep); ++ free(wsrep); ++ wsrep = NULL; ++ } ++ return rcode; ++ } ++ else ++ { ++ global_system_variables.wsrep_on = 1; ++ strncpy(provider_name, ++ wsrep->provider_name, sizeof(provider_name) - 1); ++ strncpy(provider_version, ++ wsrep->provider_version, sizeof(provider_version) - 1); ++ strncpy(provider_vendor, ++ wsrep->provider_vendor, sizeof(provider_vendor) - 1); ++ } ++ ++ if (!wsrep_data_home_dir || strlen(wsrep_data_home_dir) == 0) ++ wsrep_data_home_dir = mysql_real_data_home; ++ ++ char node_addr[512]= { 0, }; ++ size_t const node_addr_max= sizeof(node_addr) - 1; ++ if (!wsrep_node_address || !strcmp(wsrep_node_address, "")) ++ { ++ size_t const ret= wsrep_guess_ip(node_addr, node_addr_max); ++ if (!(ret > 0 && ret < node_addr_max)) ++ { ++ WSREP_WARN("Failed to guess base node address. Set it explicitly via " ++ "wsrep_node_address."); ++ node_addr[0]= '\0'; ++ } ++ } ++ else ++ { ++ strncpy(node_addr, wsrep_node_address, node_addr_max); ++ } ++ ++ char inc_addr[512]= { 0, }; ++ size_t const inc_addr_max= sizeof (inc_addr); ++ if ((!wsrep_node_incoming_address || ++ !strcmp (wsrep_node_incoming_address, WSREP_NODE_INCOMING_AUTO))) ++ { ++ unsigned int my_bind_ip= INADDR_ANY; // default if not set ++ if (my_bind_addr_str && strlen(my_bind_addr_str)) ++ { ++ my_bind_ip= wsrep_check_ip(my_bind_addr_str); ++ } ++ ++ if (INADDR_ANY != my_bind_ip) ++ { ++ if (INADDR_NONE != my_bind_ip && INADDR_LOOPBACK != my_bind_ip) ++ { ++ snprintf(inc_addr, inc_addr_max, "%s:%u", ++ my_bind_addr_str, (int)mysqld_port); ++ } // else leave inc_addr an empty string - mysqld is not listening for ++ // client connections on network interfaces. ++ } ++ else // mysqld binds to 0.0.0.0, take IP from wsrep_node_address if possible ++ { ++ size_t const node_addr_len= strlen(node_addr); ++ if (node_addr_len > 0) ++ { ++ const char* const colon= strrchr(node_addr, ':'); ++ if (strchr(node_addr, ':') == colon) // 1 or 0 ':' ++ { ++ size_t const ip_len= colon ? colon - node_addr : node_addr_len; ++ if (ip_len + 7 /* :55555\0 */ < inc_addr_max) ++ { ++ memcpy (inc_addr, node_addr, ip_len); ++ snprintf(inc_addr + ip_len, inc_addr_max - ip_len, ":%u", ++ (int)mysqld_port); ++ } ++ else ++ { ++ WSREP_WARN("Guessing address for incoming client connections: " ++ "address too long."); ++ inc_addr[0]= '\0'; ++ } ++ } ++ else ++ { ++ WSREP_WARN("Guessing address for incoming client connections: " ++ "too many colons :) ."); ++ inc_addr[0]= '\0'; ++ } ++ } ++ ++ if (!strlen(inc_addr)) ++ { ++ WSREP_WARN("Guessing address for incoming client connections failed. " ++ "Try setting wsrep_node_incoming_address explicitly."); ++ } ++ } ++ } ++ else if (!strchr(wsrep_node_incoming_address, ':')) // no port included ++ { ++ if ((int)inc_addr_max <= ++ snprintf(inc_addr, inc_addr_max, "%s:%u", ++ wsrep_node_incoming_address,(int)mysqld_port)) ++ { ++ WSREP_WARN("Guessing address for incoming client connections: " ++ "address too long."); ++ inc_addr[0]= '\0'; ++ } ++ } ++ else ++ { ++ size_t const need = strlen (wsrep_node_incoming_address); ++ if (need >= inc_addr_max) { ++ WSREP_WARN("wsrep_node_incoming_address too long: %zu", need); ++ inc_addr[0]= '\0'; ++ } ++ else { ++ memcpy (inc_addr, wsrep_node_incoming_address, need); ++ } ++ } ++ ++ struct wsrep_init_args wsrep_args; ++ ++ struct wsrep_gtid const state_id = { local_uuid, local_seqno }; ++ ++ wsrep_args.data_dir = wsrep_data_home_dir; ++ wsrep_args.node_name = (wsrep_node_name) ? wsrep_node_name : ""; ++ wsrep_args.node_address = node_addr; ++ wsrep_args.node_incoming = inc_addr; ++ wsrep_args.options = (wsrep_provider_options) ? ++ wsrep_provider_options : ""; ++ wsrep_args.proto_ver = wsrep_max_protocol_version; ++ ++ wsrep_args.state_id = &state_id; ++ ++ wsrep_args.logger_cb = wsrep_log_cb; ++ wsrep_args.view_handler_cb = wsrep_view_handler_cb; ++ wsrep_args.apply_cb = wsrep_apply_cb; ++ wsrep_args.commit_cb = wsrep_commit_cb; ++ wsrep_args.unordered_cb = wsrep_unordered_cb; ++ wsrep_args.sst_donate_cb = wsrep_sst_donate_cb; ++ wsrep_args.synced_cb = wsrep_synced_cb; ++ ++ rcode = wsrep->init(wsrep, &wsrep_args); ++ ++ if (rcode) ++ { ++ DBUG_PRINT("wsrep",("wsrep::init() failed: %d", rcode)); ++ WSREP_ERROR("wsrep::init() failed: %d, must shutdown", rcode); ++ wsrep->free(wsrep); ++ free(wsrep); ++ wsrep = NULL; ++ } ++ ++ return rcode; ++} ++ ++extern int wsrep_on(void *); ++ ++void wsrep_init_startup (bool first) ++{ ++ if (wsrep_init()) unireg_abort(1); ++ ++ wsrep_thr_lock_init(wsrep_thd_is_BF, wsrep_abort_thd, ++ wsrep_debug, wsrep_convert_LOCK_to_trx, wsrep_on); ++ ++ /* Skip replication start if no cluster address */ ++ if (!wsrep_cluster_address || strlen(wsrep_cluster_address) == 0) return; ++ ++ if (first) wsrep_sst_grab(); // do it so we can wait for SST below ++ ++ if (!wsrep_start_replication()) unireg_abort(1); ++ ++ wsrep_create_rollbacker(); ++ wsrep_create_appliers(1); ++ ++ if (first && !wsrep_sst_wait()) unireg_abort(1);// wait until SST is completed ++} ++ ++ ++void wsrep_deinit() ++{ ++ wsrep_unload(wsrep); ++ wsrep= 0; ++ provider_name[0]= '\0'; ++ provider_version[0]= '\0'; ++ provider_vendor[0]= '\0'; ++} ++ ++void wsrep_recover() ++{ ++ if (!memcmp(&local_uuid, &WSREP_UUID_UNDEFINED, sizeof(wsrep_uuid_t)) && ++ local_seqno == -2) ++ { ++ char uuid_str[40]; ++ wsrep_uuid_print(&local_uuid, uuid_str, sizeof(uuid_str)); ++ WSREP_INFO("Position %s:%lld given at startup, skipping position recovery", ++ uuid_str, (long long)local_seqno); ++ return; ++ } ++ XID xid; ++ memset(&xid, 0, sizeof(xid)); ++ xid.formatID= -1; ++ wsrep_get_SE_checkpoint(&xid); ++ char uuid_str[40]; ++ wsrep_uuid_print(wsrep_xid_uuid(&xid), uuid_str, sizeof(uuid_str)); ++ WSREP_INFO("Recovered position: %s:%lld", uuid_str, ++ (long long)wsrep_xid_seqno(&xid)); ++} ++ ++ ++void wsrep_stop_replication(THD *thd) ++{ ++ WSREP_INFO("Stop replication"); ++ if (!wsrep) ++ { ++ WSREP_INFO("Provider was not loaded, in stop replication"); ++ return; ++ } ++ ++ /* disconnect from group first to get wsrep_ready == FALSE */ ++ WSREP_DEBUG("Provider disconnect"); ++ wsrep->disconnect(wsrep); ++ ++ wsrep_connected= FALSE; ++ ++ wsrep_close_client_connections(TRUE); ++ ++ /* wait until appliers have stopped */ ++ wsrep_wait_appliers_close(thd); ++ ++ return; ++} ++ ++/* This one is set to true when --wsrep-new-cluster is found in the command ++ * line arguments */ ++static my_bool wsrep_new_cluster= FALSE; ++#define WSREP_NEW_CLUSTER "--wsrep-new-cluster" ++/* Finds and hides --wsrep-new-cluster from the arguments list ++ * by moving it to the end of the list and decrementing argument count */ ++void wsrep_filter_new_cluster (int* argc, char* argv[]) ++{ ++ int i; ++ for (i= *argc - 1; i > 0; i--) ++ { ++ /* make a copy of the argument to convert possible underscores to hyphens. ++ * the copy need not to be longer than WSREP_NEW_CLUSTER option */ ++ char arg[sizeof(WSREP_NEW_CLUSTER) + 1]= { 0, }; ++ strncpy(arg, argv[i], sizeof(arg) - 1); ++ char* underscore(arg); ++ while (NULL != (underscore= strchr(underscore, '_'))) *underscore= '-'; ++ ++ if (!strcmp(arg, WSREP_NEW_CLUSTER)) ++ { ++ wsrep_new_cluster= TRUE; ++ *argc -= 1; ++ /* preserve the order of remaining arguments AND ++ * preserve the original argument pointers - just in case */ ++ char* wnc= argv[i]; ++ memmove(&argv[i], &argv[i + 1], (*argc - i)*sizeof(argv[i])); ++ argv[*argc]= wnc; /* this will be invisible to the rest of the program */ ++ } ++ } ++} ++ ++bool wsrep_start_replication() ++{ ++ wsrep_status_t rcode; ++ ++ /* ++ if provider is trivial, don't even try to connect, ++ but resume local node operation ++ */ ++ if (strlen(wsrep_provider)== 0 || ++ !strcmp(wsrep_provider, WSREP_NONE)) ++ { ++ // enable normal operation in case no provider is specified ++ wsrep_ready_set(TRUE); ++ return true; ++ } ++ ++ if (!wsrep_cluster_address || strlen(wsrep_cluster_address)== 0) ++ { ++ // if provider is non-trivial, but no address is specified, wait for address ++ wsrep_ready_set(FALSE); ++ return true; ++ } ++ ++ bool const bootstrap(TRUE == wsrep_new_cluster); ++ wsrep_new_cluster= FALSE; ++ ++ WSREP_INFO("Start replication"); ++ ++ if ((rcode = wsrep->connect(wsrep, ++ wsrep_cluster_name, ++ wsrep_cluster_address, ++ wsrep_sst_donor, ++ bootstrap))) ++ { ++ if (-ESOCKTNOSUPPORT == rcode) ++ { ++ DBUG_PRINT("wsrep",("unrecognized cluster address: '%s', rcode: %d", ++ wsrep_cluster_address, rcode)); ++ WSREP_ERROR("unrecognized cluster address: '%s', rcode: %d", ++ wsrep_cluster_address, rcode); ++ } ++ else ++ { ++ DBUG_PRINT("wsrep",("wsrep->connect() failed: %d", rcode)); ++ WSREP_ERROR("wsrep::connect() failed: %d", rcode); ++ } ++ ++ return false; ++ } ++ else ++ { ++ wsrep_connected= TRUE; ++ ++ char* opts= wsrep->options_get(wsrep); ++ if (opts) ++ { ++ wsrep_provider_options_init(opts); ++ free(opts); ++ } ++ else ++ { ++ WSREP_WARN("Failed to get wsrep options"); ++ } ++ } ++ ++ return true; ++} ++ ++bool wsrep_sync_wait (THD* thd, uint mask) ++{ ++ if ((thd->variables.wsrep_sync_wait & mask) && ++ thd->variables.wsrep_on && ++ !thd->in_active_multi_stmt_transaction() && ++ thd->wsrep_conflict_state != REPLAYING) ++ { ++ WSREP_DEBUG("wsrep_sync_wait: thd->variables.wsrep_sync_wait = %u, mask = %u", ++ thd->variables.wsrep_sync_wait, mask); ++ // This allows autocommit SELECTs and a first SELECT after SET AUTOCOMMIT=0 ++ // TODO: modify to check if thd has locked any rows. ++ wsrep_gtid_t gtid; ++ wsrep_status_t ret= wsrep->causal_read (wsrep, >id); ++ ++ if (unlikely(WSREP_OK != ret)) ++ { ++ const char* msg; ++ int err; ++ ++ // Possibly relevant error codes: ++ // ER_CHECKREAD, ER_ERROR_ON_READ, ER_INVALID_DEFAULT, ER_EMPTY_QUERY, ++ // ER_FUNCTION_NOT_DEFINED, ER_NOT_ALLOWED_COMMAND, ER_NOT_SUPPORTED_YET, ++ // ER_FEATURE_DISABLED, ER_QUERY_INTERRUPTED ++ ++ switch (ret) ++ { ++ case WSREP_NOT_IMPLEMENTED: ++ msg= "synchronous reads by wsrep backend. " ++ "Please unset wsrep_causal_reads variable."; ++ err= ER_NOT_SUPPORTED_YET; ++ break; ++ default: ++ msg= "Synchronous wait failed."; ++ err= ER_LOCK_WAIT_TIMEOUT; // NOTE: the above msg won't be displayed ++ // with ER_LOCK_WAIT_TIMEOUT ++ } ++ ++ my_error(err, MYF(0), msg); ++ ++ return true; ++ } ++ } ++ ++ return false; ++} ++ ++/* ++ * Helpers to deal with TOI key arrays ++ */ ++typedef struct wsrep_key_arr ++{ ++ wsrep_key_t* keys; ++ size_t keys_len; ++} wsrep_key_arr_t; ++ ++ ++static void wsrep_keys_free(wsrep_key_arr_t* key_arr) ++{ ++ for (size_t i= 0; i < key_arr->keys_len; ++i) ++ { ++ my_free((void*)key_arr->keys[i].key_parts); ++ } ++ my_free(key_arr->keys); ++ key_arr->keys= 0; ++ key_arr->keys_len= 0; ++} ++ ++ ++/*! ++ * @param db Database string ++ * @param table Table string ++ * @param key Array of wsrep_key_t ++ * @param key_len In: number of elements in key array, Out: number of ++ * elements populated ++ * ++ * @return true if preparation was successful, otherwise false. ++ */ ++ ++static bool wsrep_prepare_key_for_isolation(const char* db, ++ const char* table, ++ wsrep_buf_t* key, ++ size_t* key_len) ++{ ++ if (*key_len < 2) return false; ++ ++ switch (wsrep_protocol_version) ++ { ++ case 0: ++ *key_len= 0; ++ break; ++ case 1: ++ case 2: ++ case 3: ++ { ++ *key_len= 0; ++ if (db) ++ { ++ // sql_print_information("%s.%s", db, table); ++ if (db) ++ { ++ key[*key_len].ptr= db; ++ key[*key_len].len= strlen(db); ++ ++(*key_len); ++ if (table) ++ { ++ key[*key_len].ptr= table; ++ key[*key_len].len= strlen(table); ++ ++(*key_len); ++ } ++ } ++ } ++ break; ++ } ++ default: ++ return false; ++ } ++ ++ return true; ++} ++ ++/* Prepare key list from db/table and table_list */ ++static bool wsrep_prepare_keys_for_isolation(THD* thd, ++ const char* db, ++ const char* table, ++ const TABLE_LIST* table_list, ++ wsrep_key_arr_t* ka) ++{ ++ ka->keys= 0; ++ ka->keys_len= 0; ++ ++ extern TABLE* find_temporary_table(THD*, const TABLE_LIST*); ++ ++ if (db || table) ++ { ++ TABLE_LIST tmp_table; ++ MDL_request mdl_request; ++ ++ memset(&tmp_table, 0, sizeof(tmp_table)); ++ tmp_table.table_name= (char*)table; ++ tmp_table.db= (char*)db; ++ tmp_table.mdl_request.init(MDL_key::GLOBAL, (db) ? db : "", ++ (table) ? table : "", ++ MDL_INTENTION_EXCLUSIVE, MDL_STATEMENT); ++ ++ if (!table || !find_temporary_table(thd, &tmp_table)) ++ { ++ if (!(ka->keys= (wsrep_key_t*)my_malloc(sizeof(wsrep_key_t), MYF(0)))) ++ { ++ WSREP_ERROR("Can't allocate memory for key_array"); ++ goto err; ++ } ++ ka->keys_len= 1; ++ if (!(ka->keys[0].key_parts= (wsrep_buf_t*) ++ my_malloc(sizeof(wsrep_buf_t)*2, MYF(0)))) ++ { ++ WSREP_ERROR("Can't allocate memory for key_parts"); ++ goto err; ++ } ++ ka->keys[0].key_parts_num= 2; ++ if (!wsrep_prepare_key_for_isolation( ++ db, table, ++ (wsrep_buf_t*)ka->keys[0].key_parts, ++ &ka->keys[0].key_parts_num)) ++ { ++ WSREP_ERROR("Preparing keys for isolation failed"); ++ goto err; ++ } ++ } ++ } ++ ++ for (const TABLE_LIST* table= table_list; table; table= table->next_global) ++ { ++ if (!find_temporary_table(thd, table)) ++ { ++ wsrep_key_t* tmp; ++ tmp= (wsrep_key_t*)my_realloc( ++ ka->keys, (ka->keys_len + 1) * sizeof(wsrep_key_t), MYF(0)); ++ if (!tmp) ++ { ++ WSREP_ERROR("Can't allocate memory for key_array"); ++ goto err; ++ } ++ ka->keys= tmp; ++ if (!(ka->keys[ka->keys_len].key_parts= (wsrep_buf_t*) ++ my_malloc(sizeof(wsrep_buf_t)*2, MYF(0)))) ++ { ++ WSREP_ERROR("Can't allocate memory for key_parts"); ++ goto err; ++ } ++ ka->keys[ka->keys_len].key_parts_num= 2; ++ ++ka->keys_len; ++ if (!wsrep_prepare_key_for_isolation( ++ table->db, table->table_name, ++ (wsrep_buf_t*)ka->keys[ka->keys_len - 1].key_parts, ++ &ka->keys[ka->keys_len - 1].key_parts_num)) ++ { ++ WSREP_ERROR("Preparing keys for isolation failed"); ++ goto err; ++ } ++ } ++ } ++ return true; ++err: ++ wsrep_keys_free(ka); ++ return false; ++} ++ ++ ++bool wsrep_prepare_key_for_innodb(const uchar* cache_key, ++ size_t cache_key_len, ++ const uchar* row_id, ++ size_t row_id_len, ++ wsrep_buf_t* key, ++ size_t* key_len) ++{ ++ if (*key_len < 3) return false; ++ ++ *key_len= 0; ++ switch (wsrep_protocol_version) ++ { ++ case 0: ++ { ++ key[0].ptr = cache_key; ++ key[0].len = cache_key_len; ++ ++ *key_len = 1; ++ break; ++ } ++ case 1: ++ case 2: ++ case 3: ++ { ++ key[0].ptr = cache_key; ++ key[0].len = strlen( (char*)cache_key ); ++ ++ key[1].ptr = cache_key + strlen( (char*)cache_key ) + 1; ++ key[1].len = strlen( (char*)(key[1].ptr) ); ++ ++ *key_len = 2; ++ break; ++ } ++ default: ++ return false; ++ } ++ ++ key[*key_len].ptr = row_id; ++ key[*key_len].len = row_id_len; ++ ++(*key_len); ++ ++ return true; ++} ++ ++ ++/* ++ * Construct Query_log_Event from thd query and serialize it ++ * into buffer. ++ * ++ * Return 0 in case of success, 1 in case of error. ++ */ ++int wsrep_to_buf_helper( ++ THD* thd, const char *query, uint query_len, uchar** buf, size_t* buf_len) ++{ ++ IO_CACHE tmp_io_cache; ++ if (open_cached_file(&tmp_io_cache, mysql_tmpdir, TEMP_PREFIX, ++ 65536, MYF(MY_WME))) ++ return 1; ++ int ret(0); ++ ++ if (thd->variables.gtid_next.type == GTID_GROUP) ++ { ++ Gtid_log_event gtid_ev(thd, FALSE, &thd->variables.gtid_next); ++ if (!gtid_ev.is_valid()) ret= 0; ++ if (!ret && gtid_ev.write(&tmp_io_cache)) ret= 1; ++ } ++ ++ /* if there is prepare query, add event for it */ ++ if (!ret && thd->wsrep_TOI_pre_query) ++ { ++ Query_log_event ev(thd, thd->wsrep_TOI_pre_query, ++ thd->wsrep_TOI_pre_query_len, ++ FALSE, FALSE, FALSE, 0); ++ if (ev.write(&tmp_io_cache)) ret= 1; ++ } ++ ++ /* continue to append the actual query */ ++ Query_log_event ev(thd, query, query_len, FALSE, FALSE, FALSE, 0); ++ if (!ret && ev.write(&tmp_io_cache)) ret= 1; ++ if (!ret && wsrep_write_cache_buf(&tmp_io_cache, buf, buf_len)) ret= 1; ++ close_cached_file(&tmp_io_cache); ++ return ret; ++} ++ ++#include "sql_show.h" ++static int ++create_view_query(THD *thd, uchar** buf, size_t* buf_len) ++{ ++ LEX *lex= thd->lex; ++ SELECT_LEX *select_lex= &lex->select_lex; ++ TABLE_LIST *first_table= select_lex->table_list.first; ++ TABLE_LIST *views = first_table; ++ ++ String buff; ++ const LEX_STRING command[3]= ++ {{ C_STRING_WITH_LEN("CREATE ") }, ++ { C_STRING_WITH_LEN("ALTER ") }, ++ { C_STRING_WITH_LEN("CREATE OR REPLACE ") }}; ++ ++ buff.append(command[thd->lex->create_view_mode].str, ++ command[thd->lex->create_view_mode].length); ++ ++ if (!lex->definer) ++ { ++ /* ++ DEFINER-clause is missing; we have to create default definer in ++ persistent arena to be PS/SP friendly. ++ If this is an ALTER VIEW then the current user should be set as ++ the definer. ++ */ ++ ++ if (!(lex->definer= create_default_definer(thd))) ++ { ++ WSREP_WARN("view default definer issue"); ++ } ++ } ++ ++ views->algorithm = lex->create_view_algorithm; ++ views->definer.user = lex->definer->user; ++ views->definer.host = lex->definer->host; ++ views->view_suid = lex->create_view_suid; ++ views->with_check = lex->create_view_check; ++ ++ view_store_options(thd, views, &buff); ++ buff.append(STRING_WITH_LEN("VIEW ")); ++ /* Test if user supplied a db (ie: we did not use thd->db) */ ++ if (views->db && views->db[0] && ++ (thd->db == NULL || strcmp(views->db, thd->db))) ++ { ++ append_identifier(thd, &buff, views->db, ++ views->db_length); ++ buff.append('.'); ++ } ++ append_identifier(thd, &buff, views->table_name, ++ views->table_name_length); ++ if (lex->view_list.elements) ++ { ++ List_iterator_fast names(lex->view_list); ++ LEX_STRING *name; ++ int i; ++ ++ for (i= 0; (name= names++); i++) ++ { ++ buff.append(i ? ", " : "("); ++ append_identifier(thd, &buff, name->str, name->length); ++ } ++ buff.append(')'); ++ } ++ buff.append(STRING_WITH_LEN(" AS ")); ++ //buff.append(views->source.str, views->source.length); ++ buff.append(thd->lex->create_view_select.str, ++ thd->lex->create_view_select.length); ++ //int errcode= query_error_code(thd, TRUE); ++ //if (thd->binlog_query(THD::STMT_QUERY_TYPE, ++ // buff.ptr(), buff.length(), FALSE, FALSE, FALSE, errcod ++ return wsrep_to_buf_helper(thd, buff.ptr(), buff.length(), buf, buf_len); ++} ++ ++/* ++ returns: ++ 0: statement was replicated as TOI ++ 1: TOI replication was skipped ++ -1: TOI replication failed ++ */ ++static int wsrep_TOI_begin(THD *thd, char *db_, char *table_, ++ const TABLE_LIST* table_list) ++{ ++ wsrep_status_t ret(WSREP_WARNING); ++ uchar* buf(0); ++ size_t buf_len(0); ++ int buf_err; ++ ++ WSREP_DEBUG("TO BEGIN: %lld, %d : %s", (long long)wsrep_thd_trx_seqno(thd), ++ thd->wsrep_exec_mode, thd->query() ); ++ switch (thd->lex->sql_command) ++ { ++ case SQLCOM_CREATE_VIEW: ++ buf_err= create_view_query(thd, &buf, &buf_len); ++ break; ++ case SQLCOM_CREATE_PROCEDURE: ++ case SQLCOM_CREATE_SPFUNCTION: ++ buf_err= wsrep_create_sp(thd, &buf, &buf_len); ++ break; ++ case SQLCOM_CREATE_TRIGGER: ++ buf_err= wsrep_create_trigger_query(thd, &buf, &buf_len); ++ break; ++ case SQLCOM_CREATE_EVENT: ++ buf_err= wsrep_create_event_query(thd, &buf, &buf_len); ++ break; ++ case SQLCOM_ALTER_EVENT: ++ buf_err= wsrep_alter_event_query(thd, &buf, &buf_len); ++ break; ++ default: ++ buf_err= wsrep_to_buf_helper(thd, thd->query(), thd->query_length(), &buf, ++ &buf_len); ++ break; ++ } ++ ++ wsrep_key_arr_t key_arr= {0, 0}; ++ struct wsrep_buf buff = { buf, buf_len }; ++ if (!buf_err && ++ wsrep_prepare_keys_for_isolation(thd, db_, table_, table_list, &key_arr)&& ++ key_arr.keys_len > 0 && ++ WSREP_OK == (ret = wsrep->to_execute_start(wsrep, thd->thread_id, ++ key_arr.keys, key_arr.keys_len, ++ &buff, 1, ++ &thd->wsrep_trx_meta))) ++ { ++ thd->wsrep_exec_mode= TOTAL_ORDER; ++ wsrep_to_isolation++; ++ if (buf) my_free(buf); ++ wsrep_keys_free(&key_arr); ++ WSREP_DEBUG("TO BEGIN: %lld, %d",(long long)wsrep_thd_trx_seqno(thd), ++ thd->wsrep_exec_mode); ++ } ++ else if (key_arr.keys_len > 0) { ++ /* jump to error handler in mysql_execute_command() */ ++ WSREP_WARN("TO isolation failed for: %d, sql: %s. Check wsrep " ++ "connection state and retry the query.", ++ ret, (thd->query()) ? thd->query() : "void"); ++ my_error(ER_LOCK_DEADLOCK, MYF(0), "WSREP replication failed. Check " ++ "your wsrep connection state and retry the query."); ++ if (buf) my_free(buf); ++ wsrep_keys_free(&key_arr); ++ return -1; ++ } ++ else { ++ /* non replicated DDL, affecting temporary tables only */ ++ WSREP_DEBUG("TO isolation skipped for: %d, sql: %s." ++ "Only temporary tables affected.", ++ ret, (thd->query()) ? thd->query() : "void"); ++ return 1; ++ } ++ return 0; ++} ++ ++static void wsrep_TOI_end(THD *thd) { ++ wsrep_status_t ret; ++ wsrep_to_isolation--; ++ ++ WSREP_DEBUG("TO END: %lld, %d : %s", (long long)wsrep_thd_trx_seqno(thd), ++ thd->wsrep_exec_mode, (thd->query()) ? thd->query() : "void"); ++ ++ XID xid; ++ wsrep_xid_init(&xid, &thd->wsrep_trx_meta.gtid.uuid, ++ thd->wsrep_trx_meta.gtid.seqno); ++ wsrep_set_SE_checkpoint(&xid); ++ WSREP_DEBUG("TO END: %lld, update seqno", ++ (long long)wsrep_thd_trx_seqno(thd)); ++ ++ if (WSREP_OK == (ret = wsrep->to_execute_end(wsrep, thd->thread_id))) { ++ WSREP_DEBUG("TO END: %lld", (long long)wsrep_thd_trx_seqno(thd)); ++ } ++ else { ++ WSREP_WARN("TO isolation end failed for: %d, sql: %s", ++ ret, (thd->query()) ? thd->query() : "void"); ++ } ++} ++ ++static int wsrep_RSU_begin(THD *thd, char *db_, char *table_) ++{ ++ wsrep_status_t ret(WSREP_WARNING); ++ WSREP_DEBUG("RSU BEGIN: %lld, %d : %s", (long long)wsrep_thd_trx_seqno(thd), ++ thd->wsrep_exec_mode, thd->query() ); ++ ++ ret = wsrep->desync(wsrep); ++ if (ret != WSREP_OK) ++ { ++ WSREP_WARN("RSU desync failed %d for %s", ret, thd->query()); ++ my_error(ER_LOCK_DEADLOCK, MYF(0)); ++ return(ret); ++ } ++ mysql_mutex_lock(&LOCK_wsrep_replaying); ++ wsrep_replaying++; ++ mysql_mutex_unlock(&LOCK_wsrep_replaying); ++ ++ if (wsrep_wait_committing_connections_close(5000)) ++ { ++ /* no can do, bail out from DDL */ ++ WSREP_WARN("RSU failed due to pending transactions, %s", thd->query()); ++ mysql_mutex_lock(&LOCK_wsrep_replaying); ++ wsrep_replaying--; ++ mysql_mutex_unlock(&LOCK_wsrep_replaying); ++ ++ ret = wsrep->resync(wsrep); ++ if (ret != WSREP_OK) ++ { ++ WSREP_WARN("resync failed %d for %s", ret, thd->query()); ++ } ++ my_error(ER_LOCK_DEADLOCK, MYF(0)); ++ return(1); ++ } ++ ++ wsrep_seqno_t seqno = wsrep->pause(wsrep); ++ if (seqno == WSREP_SEQNO_UNDEFINED) ++ { ++ WSREP_WARN("pause failed %lld for %s", (long long)seqno, thd->query()); ++ return(1); ++ } ++ WSREP_DEBUG("paused at %lld", (long long)seqno); ++ thd->variables.wsrep_on = 0; ++ return 0; ++} ++ ++static void wsrep_RSU_end(THD *thd) ++{ ++ wsrep_status_t ret(WSREP_WARNING); ++ WSREP_DEBUG("RSU END: %lld, %d : %s", (long long)wsrep_thd_trx_seqno(thd), ++ thd->wsrep_exec_mode, thd->query() ); ++ ++ ++ mysql_mutex_lock(&LOCK_wsrep_replaying); ++ wsrep_replaying--; ++ mysql_mutex_unlock(&LOCK_wsrep_replaying); ++ ++ ret = wsrep->resume(wsrep); ++ if (ret != WSREP_OK) ++ { ++ WSREP_WARN("resume failed %d for %s", ret, thd->query()); ++ } ++ ret = wsrep->resync(wsrep); ++ if (ret != WSREP_OK) ++ { ++ WSREP_WARN("resync failed %d for %s", ret, thd->query()); ++ return; ++ } ++ thd->variables.wsrep_on = 1; ++} ++ ++int wsrep_to_isolation_begin(THD *thd, char *db_, char *table_, ++ const TABLE_LIST* table_list) ++{ ++ ++ /* ++ No isolation for applier or replaying threads. ++ */ ++ if (thd->wsrep_exec_mode == REPL_RECV) return 0; ++ ++ int ret= 0; ++ mysql_mutex_lock(&thd->LOCK_wsrep_thd); ++ ++ if (thd->wsrep_conflict_state == MUST_ABORT) ++ { ++ WSREP_INFO("thread: %lu, %s has been aborted due to multi-master conflict", ++ thd->thread_id, thd->query()); ++ mysql_mutex_unlock(&thd->LOCK_wsrep_thd); ++ return WSREP_TRX_FAIL; ++ } ++ mysql_mutex_unlock(&thd->LOCK_wsrep_thd); ++ ++ DBUG_ASSERT(thd->wsrep_exec_mode == LOCAL_STATE); ++ DBUG_ASSERT(thd->wsrep_trx_meta.gtid.seqno == WSREP_SEQNO_UNDEFINED); ++ ++ if (thd->global_read_lock.can_acquire_protection()) ++ { ++ WSREP_DEBUG("Aborting TOI: Global Read-Lock (FTWRL) in place: %s %lu", ++ thd->query(), thd->thread_id); ++ return -1; ++ } ++ ++ if (wsrep_debug && thd->mdl_context.has_locks()) ++ { ++ WSREP_DEBUG("thread holds MDL locks at TI begin: %s %lu", ++ thd->query(), thd->thread_id); ++ } ++ ++ /* ++ It makes sense to set auto_increment_* to defaults in TOI operations. ++ Must be done before wsrep_TOI_begin() since Query_log_event encapsulating ++ TOI statement and auto inc variables for wsrep replication is constructed ++ there. Variables are reset back in THD::reset_for_next_command() before ++ processing of next command. ++ */ ++ if (wsrep_auto_increment_control) ++ { ++ thd->variables.auto_increment_offset = 1; ++ thd->variables.auto_increment_increment = 1; ++ } ++ ++ if (thd->variables.wsrep_on && thd->wsrep_exec_mode==LOCAL_STATE) ++ { ++ switch (wsrep_OSU_method_options) { ++ case WSREP_OSU_TOI: ret = wsrep_TOI_begin(thd, db_, table_, ++ table_list); break; ++ case WSREP_OSU_RSU: ret = wsrep_RSU_begin(thd, db_, table_); break; ++ } ++ switch (ret) { ++ case 0: thd->wsrep_exec_mode= TOTAL_ORDER; break; ++ case 1: ++ /* TOI replication skipped, treat as success */ ++ ret = 0; ++ break; ++ case -1: ++ /* TOI replication failed, treat as error */ ++ break; ++ } ++ } ++ return ret; ++} ++ ++void wsrep_to_isolation_end(THD *thd) ++{ ++ if (thd->wsrep_exec_mode == TOTAL_ORDER) ++ { ++ switch(wsrep_OSU_method_options) ++ { ++ case WSREP_OSU_TOI: wsrep_TOI_end(thd); break; ++ case WSREP_OSU_RSU: wsrep_RSU_end(thd); break; ++ } ++ wsrep_cleanup_transaction(thd); ++ } ++} ++ ++#define WSREP_MDL_LOG(severity, msg, req, gra) \ ++ WSREP_##severity( \ ++ "%s\n" \ ++ "request: (%lu \tseqno %lld \twsrep (%d, %d, %d) cmd %d %d \t%s)\n" \ ++ "granted: (%lu \tseqno %lld \twsrep (%d, %d, %d) cmd %d %d \t%s)", \ ++ msg, \ ++ req->thread_id, (long long)wsrep_thd_trx_seqno(req), \ ++ req->wsrep_exec_mode, req->wsrep_query_state, req->wsrep_conflict_state, \ ++ req->get_command(), req->lex->sql_command, req->query(), \ ++ gra->thread_id, (long long)wsrep_thd_trx_seqno(gra), \ ++ gra->wsrep_exec_mode, gra->wsrep_query_state, gra->wsrep_conflict_state, \ ++ gra->get_command(), gra->lex->sql_command, gra->query()); ++ ++bool ++wsrep_grant_mdl_exception(MDL_context *requestor_ctx, ++ MDL_ticket *ticket ++) { ++ if (!WSREP_ON) return FALSE; ++ ++ THD *request_thd = requestor_ctx->wsrep_get_thd(); ++ THD *granted_thd = ticket->get_ctx()->wsrep_get_thd(); ++ bool ret = FALSE; ++ ++ mysql_mutex_lock(&request_thd->LOCK_wsrep_thd); ++ if (request_thd->wsrep_exec_mode == TOTAL_ORDER || ++ request_thd->wsrep_exec_mode == REPL_RECV) ++ { ++ mysql_mutex_unlock(&request_thd->LOCK_wsrep_thd); ++ WSREP_MDL_LOG(DEBUG, "MDL conflict ", request_thd, granted_thd); ++ ticket->wsrep_report(wsrep_debug); ++ ++ mysql_mutex_lock(&granted_thd->LOCK_wsrep_thd); ++ if (granted_thd->wsrep_exec_mode == TOTAL_ORDER || ++ granted_thd->wsrep_exec_mode == REPL_RECV) ++ { ++ WSREP_MDL_LOG(INFO, "MDL BF-BF conflict", request_thd, granted_thd); ++ ticket->wsrep_report(true); ++ mysql_mutex_unlock(&granted_thd->LOCK_wsrep_thd); ++ ret = TRUE; ++ } ++ else if (granted_thd->lex->sql_command == SQLCOM_FLUSH) ++ { ++ WSREP_DEBUG("mdl granted over FLUSH BF"); ++ ticket->wsrep_report(wsrep_debug); ++ mysql_mutex_unlock(&granted_thd->LOCK_wsrep_thd); ++ ret = TRUE; ++ } ++ else if (request_thd->lex->sql_command == SQLCOM_DROP_TABLE) ++ { ++ WSREP_DEBUG("DROP caused BF abort"); ++ ticket->wsrep_report(wsrep_debug); ++ mysql_mutex_unlock(&granted_thd->LOCK_wsrep_thd); ++ wsrep_abort_thd((void*)request_thd, (void*)granted_thd, 1); ++ ret = FALSE; ++ } ++ else if (granted_thd->wsrep_query_state == QUERY_COMMITTING) ++ { ++ WSREP_DEBUG("mdl granted, but commiting thd abort scheduled"); ++ ticket->wsrep_report(wsrep_debug); ++ mysql_mutex_unlock(&granted_thd->LOCK_wsrep_thd); ++ wsrep_abort_thd((void*)request_thd, (void*)granted_thd, 1); ++ ret = FALSE; ++ } ++ else ++ { ++ WSREP_MDL_LOG(DEBUG, "MDL conflict-> BF abort", request_thd, granted_thd); ++ ticket->wsrep_report(wsrep_debug); ++ mysql_mutex_unlock(&granted_thd->LOCK_wsrep_thd); ++ wsrep_abort_thd((void*)request_thd, (void*)granted_thd, 1); ++ ret = FALSE; ++ } ++ } ++ else ++ { ++ mysql_mutex_unlock(&request_thd->LOCK_wsrep_thd); ++ } ++ return ret; ++} +diff --git a/sql/wsrep_mysqld.h b/sql/wsrep_mysqld.h +new file mode 100644 +index 0000000..3df3911 +--- /dev/null ++++ b/sql/wsrep_mysqld.h +@@ -0,0 +1,321 @@ ++/* Copyright 2008-2013 Codership Oy ++ ++ 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ ++ ++#ifndef WSREP_MYSQLD_H ++#define WSREP_MYSQLD_H ++ ++#include "mysqld.h" ++typedef struct st_mysql_show_var SHOW_VAR; ++#include ++#include "rpl_gtid.h" ++#include "../wsrep/wsrep_api.h" ++ ++#define WSREP_UNDEFINED_TRX_ID ULONGLONG_MAX ++ ++class set_var; ++class THD; ++ ++enum wsrep_exec_mode { ++ LOCAL_STATE, ++ REPL_RECV, ++ TOTAL_ORDER, ++ LOCAL_COMMIT ++}; ++ ++enum wsrep_query_state { ++ QUERY_IDLE, ++ QUERY_EXEC, ++ QUERY_COMMITTING, ++ QUERY_EXITING, ++ QUERY_ROLLINGBACK, ++}; ++ ++enum wsrep_conflict_state { ++ NO_CONFLICT, ++ MUST_ABORT, ++ ABORTING, ++ ABORTED, ++ MUST_REPLAY, ++ REPLAYING, ++ RETRY_AUTOCOMMIT, ++ CERT_FAILURE, ++}; ++ ++enum wsrep_consistency_check_mode { ++ NO_CONSISTENCY_CHECK, ++ CONSISTENCY_CHECK_DECLARED, ++ CONSISTENCY_CHECK_RUNNING, ++}; ++ ++ ++// Global wsrep parameters ++extern wsrep_t* wsrep; ++ ++// MySQL wsrep options ++extern const char* wsrep_provider; ++extern const char* wsrep_provider_options; ++extern const char* wsrep_cluster_name; ++extern const char* wsrep_cluster_address; ++extern const char* wsrep_node_name; ++extern const char* wsrep_node_address; ++extern const char* wsrep_node_incoming_address; ++extern const char* wsrep_data_home_dir; ++extern const char* wsrep_dbug_option; ++extern long wsrep_slave_threads; ++extern int wsrep_slave_count_change; ++extern MYSQL_PLUGIN_IMPORT my_bool wsrep_debug; ++extern my_bool wsrep_convert_LOCK_to_trx; ++extern ulong wsrep_retry_autocommit; ++extern my_bool wsrep_auto_increment_control; ++extern my_bool wsrep_drupal_282555_workaround; ++extern my_bool wsrep_incremental_data_collection; ++extern const char* wsrep_start_position; ++extern ulong wsrep_max_ws_size; ++extern ulong wsrep_max_ws_rows; ++extern const char* wsrep_notify_cmd; ++extern my_bool wsrep_certify_nonPK; ++extern long wsrep_max_protocol_version; ++extern long wsrep_protocol_version; ++extern ulong wsrep_forced_binlog_format; ++extern ulong wsrep_OSU_method_options; ++extern my_bool wsrep_desync; ++extern my_bool wsrep_recovery; ++extern my_bool wsrep_replicate_myisam; ++extern my_bool wsrep_log_conflicts; ++extern ulong wsrep_mysql_replication_bundle; ++extern my_bool wsrep_load_data_splitting; ++extern my_bool wsrep_restart_slave; ++extern my_bool wsrep_restart_slave_activated; ++extern my_bool wsrep_slave_FK_checks; ++extern my_bool wsrep_slave_UK_checks; ++ ++enum enum_wsrep_OSU_method { WSREP_OSU_TOI, WSREP_OSU_RSU }; ++enum enum_wsrep_sync_wait { ++ WSREP_SYNC_WAIT_NONE = 0x0, ++ // show, select, begin ++ WSREP_SYNC_WAIT_BEFORE_READ = 0x1, ++ WSREP_SYNC_WAIT_BEFORE_UPDATE_DELETE = 0x2, ++ WSREP_SYNC_WAIT_BEFORE_INSERT_REPLACE = 0x4, ++ WSREP_SYNC_WAIT_MAX = 0x7 ++}; ++ ++// MySQL status variables ++extern my_bool wsrep_connected; ++extern my_bool wsrep_ready; ++extern const char* wsrep_cluster_state_uuid; ++extern long long wsrep_cluster_conf_id; ++extern const char* wsrep_cluster_status; ++extern long wsrep_cluster_size; ++extern long wsrep_local_index; ++extern long long wsrep_local_bf_aborts; ++extern const char* wsrep_provider_name; ++extern const char* wsrep_provider_version; ++extern const char* wsrep_provider_vendor; ++ ++int wsrep_show_status(THD *thd, SHOW_VAR *var, char *buff); ++void wsrep_free_status(THD *thd); ++ ++/* Filters out --wsrep-new-cluster oprtion from argv[] ++ * should be called in the very beginning of main() */ ++void wsrep_filter_new_cluster (int* argc, char* argv[]); ++ ++int wsrep_init(); ++void wsrep_deinit(); ++void wsrep_recover(); ++bool wsrep_before_SE(); // initialize wsrep before storage ++ // engines (true) or after (false) ++/* wsrep initialization sequence at startup ++ * @param before wsrep_before_SE() value */ ++void wsrep_init_startup(bool before); ++ ++ ++extern "C" enum wsrep_exec_mode wsrep_thd_exec_mode(THD *thd); ++extern "C" enum wsrep_conflict_state wsrep_thd_conflict_state(THD *thd); ++extern "C" enum wsrep_query_state wsrep_thd_query_state(THD *thd); ++extern "C" const char * wsrep_thd_exec_mode_str(THD *thd); ++extern "C" const char * wsrep_thd_conflict_state_str(THD *thd); ++extern "C" const char * wsrep_thd_query_state_str(THD *thd); ++extern "C" wsrep_ws_handle_t* wsrep_thd_ws_handle(THD *thd); ++ ++extern "C" void wsrep_thd_set_exec_mode(THD *thd, enum wsrep_exec_mode mode); ++extern "C" void wsrep_thd_set_query_state( ++ THD *thd, enum wsrep_query_state state); ++extern "C" void wsrep_thd_set_conflict_state( ++ THD *thd, enum wsrep_conflict_state state); ++ ++extern "C" void wsrep_thd_set_trx_to_replay(THD *thd, uint64 trx_id); ++ ++extern "C" void wsrep_thd_LOCK(THD *thd); ++extern "C" void wsrep_thd_UNLOCK(THD *thd); ++extern "C" uint32 wsrep_thd_wsrep_rand(THD *thd); ++extern "C" time_t wsrep_thd_query_start(THD *thd); ++extern "C" my_thread_id wsrep_thd_thread_id(THD *thd); ++extern "C" int64_t wsrep_thd_trx_seqno(THD *thd); ++extern "C" query_id_t wsrep_thd_query_id(THD *thd); ++extern "C" char * wsrep_thd_query(THD *thd); ++extern "C" query_id_t wsrep_thd_wsrep_last_query_id(THD *thd); ++extern "C" void wsrep_thd_set_wsrep_last_query_id(THD *thd, query_id_t id); ++extern "C" void wsrep_thd_awake(THD *thd, my_bool signal); ++extern "C" int wsrep_thd_retry_counter(THD *thd); ++ ++ ++extern void wsrep_close_client_connections(my_bool wait_to_end); ++extern int wsrep_wait_committing_connections_close(int wait_time); ++extern void wsrep_close_applier(THD *thd); ++extern void wsrep_wait_appliers_close(THD *thd); ++extern void wsrep_close_applier_threads(int count); ++extern void wsrep_kill_mysql(THD *thd); ++ ++/* new defines */ ++extern void wsrep_stop_replication(THD *thd); ++extern bool wsrep_start_replication(); ++extern bool wsrep_sync_wait (THD* thd, uint mask = WSREP_SYNC_WAIT_BEFORE_READ); ++extern int wsrep_check_opts (int argc, char* const* argv); ++extern void wsrep_prepend_PATH (const char* path); ++/* some inline functions are defined in wsrep_mysqld_inl.h */ ++ ++/* Other global variables */ ++extern wsrep_seqno_t wsrep_locked_seqno; ++ ++#define WSREP_ON \ ++ (global_system_variables.wsrep_on) ++ ++#define WSREP(thd) \ ++ (WSREP_ON && wsrep && (thd && thd->variables.wsrep_on)) ++ ++#define WSREP_CLIENT(thd) \ ++ (WSREP(thd) && thd->wsrep_client_thread) ++ ++#define WSREP_EMULATE_BINLOG(thd) \ ++ (WSREP(thd) && wsrep_emulate_bin_log) ++ ++// MySQL logging functions don't seem to understand long long length modifer. ++// This is a workaround. It also prefixes all messages with "WSREP" ++#define WSREP_LOG(fun, ...) \ ++ { \ ++ char msg[1024] = {'\0'}; \ ++ snprintf(msg, sizeof(msg) - 1, ## __VA_ARGS__); \ ++ fun("WSREP: %s", msg); \ ++ } ++ ++#define WSREP_DEBUG(...) \ ++ if (wsrep_debug) WSREP_LOG(sql_print_information, ##__VA_ARGS__) ++#define WSREP_INFO(...) WSREP_LOG(sql_print_information, ##__VA_ARGS__) ++#define WSREP_WARN(...) WSREP_LOG(sql_print_warning, ##__VA_ARGS__) ++#define WSREP_ERROR(...) WSREP_LOG(sql_print_error, ##__VA_ARGS__) ++ ++#define WSREP_LOG_CONFLICT_THD(thd, role) \ ++ WSREP_LOG(sql_print_information, \ ++ "%s: \n " \ ++ " THD: %lu, mode: %s, state: %s, conflict: %s, seqno: %lld\n " \ ++ " SQL: %s", \ ++ role, wsrep_thd_thread_id(thd), wsrep_thd_exec_mode_str(thd), \ ++ wsrep_thd_query_state_str(thd), \ ++ wsrep_thd_conflict_state_str(thd), (long long)wsrep_thd_trx_seqno(thd), \ ++ wsrep_thd_query(thd) \ ++ ); ++ ++#define WSREP_LOG_CONFLICT(bf_thd, victim_thd, bf_abort) \ ++ if (wsrep_debug || wsrep_log_conflicts) \ ++ { \ ++ WSREP_LOG(sql_print_information, "cluster conflict due to %s for threads:",\ ++ (bf_abort) ? "high priority abort" : "certification failure" \ ++ ); \ ++ if (bf_thd) WSREP_LOG_CONFLICT_THD(bf_thd, "Winning thread"); \ ++ if (victim_thd) WSREP_LOG_CONFLICT_THD(victim_thd, "Victim thread"); \ ++ } ++ ++extern void wsrep_ready_wait(); ++ ++enum wsrep_trx_status { ++ WSREP_TRX_OK, ++ WSREP_TRX_CERT_FAIL, /* certification failure, must abort */ ++ WSREP_TRX_SIZE_EXCEEDED, /* trx size exceeded */ ++ WSREP_TRX_ERROR, /* native mysql error */ ++}; ++ ++extern enum wsrep_trx_status ++wsrep_run_wsrep_commit(THD *thd, handlerton *hton, bool all); ++class Ha_trx_info; ++struct THD_TRANS; ++void wsrep_register_hton(THD* thd, bool all); ++void wsrep_post_commit(THD* thd, bool all); ++void wsrep_brute_force_killer(THD *thd); ++int wsrep_hire_brute_force_killer(THD *thd, uint64_t trx_id); ++ ++extern "C" bool wsrep_consistency_check(void *thd_ptr); ++ ++/* this is visible for client build so that innodb plugin gets this */ ++typedef struct wsrep_aborting_thd { ++ struct wsrep_aborting_thd *next; ++ THD *aborting_thd; ++} *wsrep_aborting_thd_t; ++ ++extern mysql_mutex_t LOCK_wsrep_ready; ++extern mysql_cond_t COND_wsrep_ready; ++extern mysql_mutex_t LOCK_wsrep_sst; ++extern mysql_cond_t COND_wsrep_sst; ++extern mysql_mutex_t LOCK_wsrep_sst_init; ++extern mysql_cond_t COND_wsrep_sst_init; ++extern mysql_mutex_t LOCK_wsrep_rollback; ++extern mysql_cond_t COND_wsrep_rollback; ++extern int wsrep_replaying; ++extern mysql_mutex_t LOCK_wsrep_replaying; ++extern mysql_cond_t COND_wsrep_replaying; ++extern mysql_mutex_t LOCK_wsrep_slave_threads; ++extern mysql_mutex_t LOCK_wsrep_desync; ++extern wsrep_aborting_thd_t wsrep_aborting_thd; ++extern my_bool wsrep_emulate_bin_log; ++extern int wsrep_to_isolation; ++extern rpl_sidno wsrep_sidno; ++extern my_bool wsrep_preordered_opt; ++#ifdef HAVE_PSI_INTERFACE ++extern PSI_mutex_key key_LOCK_wsrep_ready; ++extern PSI_mutex_key key_COND_wsrep_ready; ++extern PSI_mutex_key key_LOCK_wsrep_sst; ++extern PSI_cond_key key_COND_wsrep_sst; ++extern PSI_mutex_key key_LOCK_wsrep_sst_init; ++extern PSI_cond_key key_COND_wsrep_sst_init; ++extern PSI_mutex_key key_LOCK_wsrep_sst_thread; ++extern PSI_cond_key key_COND_wsrep_sst_thread; ++extern PSI_mutex_key key_LOCK_wsrep_rollback; ++extern PSI_cond_key key_COND_wsrep_rollback; ++extern PSI_mutex_key key_LOCK_wsrep_replaying; ++extern PSI_cond_key key_COND_wsrep_replaying; ++extern PSI_mutex_key key_LOCK_wsrep_slave_threads; ++extern PSI_mutex_key key_LOCK_wsrep_desync; ++#endif /* HAVE_PSI_INTERFACE */ ++struct TABLE_LIST; ++int wsrep_to_isolation_begin(THD *thd, char *db_, char *table_, ++ const TABLE_LIST* table_list); ++void wsrep_to_isolation_end(THD *thd); ++void wsrep_cleanup_transaction(THD *thd); ++int wsrep_to_buf_helper( ++ THD* thd, const char *query, uint query_len, uchar** buf, size_t* buf_len); ++int wsrep_create_sp(THD *thd, uchar** buf, size_t* buf_len); ++int wsrep_create_trigger_query(THD *thd, uchar** buf, size_t* buf_len); ++int wsrep_create_event_query(THD *thd, uchar** buf, size_t* buf_len); ++int wsrep_alter_event_query(THD *thd, uchar** buf, size_t* buf_len); ++ ++struct xid_t; ++void wsrep_get_SE_checkpoint(xid_t*); ++void wsrep_set_SE_checkpoint(xid_t*); ++void wsrep_init_sidno(const wsrep_uuid_t&); ++void wsrep_xid_init(xid_t*, const wsrep_uuid_t*, wsrep_seqno_t); ++const wsrep_uuid_t* wsrep_xid_uuid(const xid_t*); ++wsrep_seqno_t wsrep_xid_seqno(const xid_t*); ++int wsrep_is_wsrep_xid(const void* xid); ++ ++#endif /* WSREP_MYSQLD_H */ +diff --git a/sql/wsrep_notify.cc b/sql/wsrep_notify.cc +new file mode 100644 +index 0000000..0fc76f5 +--- /dev/null ++++ b/sql/wsrep_notify.cc +@@ -0,0 +1,111 @@ ++/* Copyright 2010 Codership Oy ++ ++ 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ ++ ++#include ++#include "wsrep_priv.h" ++#include "wsrep_utils.h" ++ ++const char* wsrep_notify_cmd=""; ++ ++static const char* _status_str(wsrep_member_status_t status) ++{ ++ switch (status) ++ { ++ case WSREP_MEMBER_UNDEFINED: return "Undefined"; ++ case WSREP_MEMBER_JOINER: return "Joiner"; ++ case WSREP_MEMBER_DONOR: return "Donor"; ++ case WSREP_MEMBER_JOINED: return "Joined"; ++ case WSREP_MEMBER_SYNCED: return "Synced"; ++ default: return "Error(?)"; ++ } ++} ++ ++void wsrep_notify_status (wsrep_member_status_t status, ++ const wsrep_view_info_t* view) ++{ ++ if (!wsrep_notify_cmd || 0 == strlen(wsrep_notify_cmd)) ++ { ++ WSREP_INFO("wsrep_notify_cmd is not defined, skipping notification."); ++ return; ++ } ++ ++ char cmd_buf[1 << 16]; // this can be long ++ long cmd_len = sizeof(cmd_buf) - 1; ++ char* cmd_ptr = cmd_buf; ++ long cmd_off = 0; ++ ++ cmd_off += snprintf (cmd_ptr + cmd_off, cmd_len - cmd_off, "%s", ++ wsrep_notify_cmd); ++ ++ if (status >= WSREP_MEMBER_UNDEFINED && status < WSREP_MEMBER_ERROR) ++ { ++ cmd_off += snprintf (cmd_ptr + cmd_off, cmd_len - cmd_off, " --status %s", ++ _status_str(status)); ++ } ++ else ++ { ++ /* here we preserve provider error codes */ ++ cmd_off += snprintf (cmd_ptr + cmd_off, cmd_len - cmd_off, ++ " --status 'Error(%d)'", status); ++ } ++ ++ if (0 != view) ++ { ++ char uuid_str[40]; ++ ++ wsrep_uuid_print (&view->state_id.uuid, uuid_str, sizeof(uuid_str)); ++ cmd_off += snprintf (cmd_ptr + cmd_off, cmd_len - cmd_off, ++ " --uuid %s", uuid_str); ++ ++ cmd_off += snprintf (cmd_ptr + cmd_off, cmd_len - cmd_off, ++ " --primary %s", view->view >= 0 ? "yes" : "no"); ++ ++ cmd_off += snprintf (cmd_ptr + cmd_off, cmd_len - cmd_off, ++ " --index %d", view->my_idx); ++ ++ if (view->memb_num) ++ { ++ cmd_off += snprintf (cmd_ptr + cmd_off, cmd_len - cmd_off, " --members"); ++ ++ for (int i = 0; i < view->memb_num; i++) ++ { ++ wsrep_uuid_print (&view->members[i].id, uuid_str, sizeof(uuid_str)); ++ cmd_off += snprintf (cmd_ptr + cmd_off, cmd_len - cmd_off, ++ "%c%s/%s/%s", i > 0 ? ',' : ' ', ++ uuid_str, view->members[i].name, ++ view->members[i].incoming); ++ } ++ } ++ } ++ ++ if (cmd_off == cmd_len) ++ { ++ WSREP_ERROR("Notification buffer too short (%ld). Aborting notification.", ++ cmd_len); ++ return; ++ } ++ ++ wsp::process p(cmd_ptr, "r"); ++ ++ p.wait(); ++ int err = p.error(); ++ ++ if (err) ++ { ++ WSREP_ERROR("Notification command failed: %d (%s): \"%s\"", ++ err, strerror(err), cmd_ptr); ++ } ++} ++ +diff --git a/sql/wsrep_priv.h b/sql/wsrep_priv.h +new file mode 100644 +index 0000000..93640fb +--- /dev/null ++++ b/sql/wsrep_priv.h +@@ -0,0 +1,51 @@ ++/* Copyright 2010 Codership Oy ++ ++ 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ */ ++ ++//! @file declares symbols private to wsrep integration layer ++ ++#ifndef WSREP_PRIV_H ++#define WSREP_PRIV_H ++ ++#include "wsrep_mysqld.h" ++#include "../wsrep/wsrep_api.h" ++ ++#include ++#include ++#include ++ ++void wsrep_ready_set (my_bool x); ++ ++ssize_t wsrep_sst_prepare (void** msg); ++wsrep_cb_status wsrep_sst_donate_cb (void* app_ctx, ++ void* recv_ctx, ++ const void* msg, size_t msg_len, ++ const wsrep_gtid_t* state_id, ++ const char* state, size_t state_len, ++ bool bypass); ++ ++extern wsrep_uuid_t local_uuid; ++extern wsrep_seqno_t local_seqno; ++ ++// a helper function ++void wsrep_sst_received(wsrep_t*, const wsrep_uuid_t*, wsrep_seqno_t, ++ const void*, size_t); ++/*! SST thread signals init thread about sst completion */ ++void wsrep_sst_complete(const wsrep_uuid_t*, wsrep_seqno_t, bool); ++ ++void wsrep_notify_status (wsrep_member_status_t new_status, ++ const wsrep_view_info_t* view = 0); ++ ++#endif /* WSREP_PRIV_H */ +diff --git a/sql/wsrep_sst.cc b/sql/wsrep_sst.cc +new file mode 100644 +index 0000000..ed45674 +--- /dev/null ++++ b/sql/wsrep_sst.cc +@@ -0,0 +1,1102 @@ ++/* Copyright 2008-2012 Codership Oy ++ ++ 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ ++ ++#include "wsrep_sst.h" ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include "wsrep_priv.h" ++#include "wsrep_utils.h" ++#include ++#include ++ ++extern const char wsrep_defaults_file[]; ++extern const char wsrep_defaults_group_suffix[]; ++ ++#define WSREP_SST_OPT_ROLE "--role" ++#define WSREP_SST_OPT_ADDR "--address" ++#define WSREP_SST_OPT_AUTH "--auth" ++#define WSREP_SST_OPT_DATA "--datadir" ++#define WSREP_SST_OPT_CONF "--defaults-file" ++#define WSREP_SST_OPT_CONF_SUFFIX "--defaults-group-suffix" ++#define WSREP_SST_OPT_PARENT "--parent" ++#define WSREP_SST_OPT_BINLOG "--binlog" ++ ++// mysqldump-specific options ++#define WSREP_SST_OPT_USER "--user" ++#define WSREP_SST_OPT_PSWD "--password" ++#define WSREP_SST_OPT_HOST "--host" ++#define WSREP_SST_OPT_PORT "--port" ++#define WSREP_SST_OPT_LPORT "--local-port" ++ ++// donor-specific ++#define WSREP_SST_OPT_SOCKET "--socket" ++#define WSREP_SST_OPT_GTID "--gtid" ++#define WSREP_SST_OPT_BYPASS "--bypass" ++ ++#define WSREP_SST_MYSQLDUMP "mysqldump" ++#define WSREP_SST_RSYNC "rsync" ++#define WSREP_SST_SKIP "skip" ++#define WSREP_SST_XTRABACKUP "xtrabackup" ++#define WSREP_SST_XTRABACKUP_V2 "xtrabackup-v2" ++#define WSREP_SST_DEFAULT WSREP_SST_RSYNC ++#define WSREP_SST_ADDRESS_AUTO "AUTO" ++#define WSREP_SST_AUTH_MASK "********" ++ ++const char* wsrep_sst_method = WSREP_SST_DEFAULT; ++const char* wsrep_sst_receive_address = WSREP_SST_ADDRESS_AUTO; ++const char* wsrep_sst_donor = ""; ++ char* wsrep_sst_auth = NULL; ++ ++// container for real auth string ++static const char* sst_auth_real = NULL; ++my_bool wsrep_sst_donor_rejects_queries = FALSE; ++ ++bool wsrep_sst_method_check (sys_var *self, THD* thd, set_var* var) ++{ ++ char buff[FN_REFLEN]; ++ String str(buff, sizeof(buff), system_charset_info), *res; ++ const char* c_str = NULL; ++ ++ if ((res = var->value->val_str(&str)) && ++ (c_str = res->c_ptr()) && ++ strlen(c_str) > 0) ++ return 0; ++ ++ my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), "wsrep_sst_method", c_str ? c_str : "NULL"); ++ return 1; ++} ++ ++bool wsrep_sst_method_update (sys_var *self, THD* thd, enum_var_type type) ++{ ++ return 0; ++} ++ ++static bool sst_receive_address_check (const char* str) ++{ ++ if (!strncasecmp(str, "127.0.0.1", strlen("127.0.0.1")) || ++ !strncasecmp(str, "localhost", strlen("localhost"))) ++ { ++ return 1; ++ } ++ ++ return 0; ++} ++ ++bool wsrep_sst_receive_address_check (sys_var *self, THD* thd, set_var* var) ++{ ++ const char* c_str = var->value->str_value.c_ptr(); ++ ++ if (sst_receive_address_check (c_str)) ++ { ++ my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), "wsrep_sst_receive_address", c_str ? c_str : "NULL"); ++ return 1; ++ } ++ ++ return 0; ++} ++ ++bool wsrep_sst_receive_address_update (sys_var *self, THD* thd, ++ enum_var_type type) ++{ ++ return 0; ++} ++ ++bool wsrep_sst_auth_check (sys_var *self, THD* thd, set_var* var) ++{ ++ return 0; ++} ++static bool sst_auth_real_set (const char* value) ++{ ++ const char* v = strdup (value); ++ ++ if (v) ++ { ++ if (sst_auth_real) free (const_cast(sst_auth_real)); ++ sst_auth_real = v; ++ ++ if (strlen(sst_auth_real)) ++ { ++ if (wsrep_sst_auth) ++ { ++ my_free ((void*)wsrep_sst_auth); ++ wsrep_sst_auth = my_strdup(WSREP_SST_AUTH_MASK, MYF(0)); ++ //strncpy (wsrep_sst_auth, WSREP_SST_AUTH_MASK, ++ // sizeof(wsrep_sst_auth) - 1); ++ } ++ else ++ wsrep_sst_auth = my_strdup (WSREP_SST_AUTH_MASK, MYF(0)); ++ } ++ return 0; ++ } ++ ++ return 1; ++} ++ ++bool wsrep_sst_auth_update (sys_var *self, THD* thd, enum_var_type type) ++{ ++ return sst_auth_real_set (wsrep_sst_auth); ++} ++ ++void wsrep_sst_auth_init (const char* value) ++{ ++ if (wsrep_sst_auth == value) wsrep_sst_auth = NULL; ++ if (value) sst_auth_real_set (value); ++} ++ ++bool wsrep_sst_donor_check (sys_var *self, THD* thd, set_var* var) ++{ ++ return 0; ++} ++ ++bool wsrep_sst_donor_update (sys_var *self, THD* thd, enum_var_type type) ++{ ++ return 0; ++} ++ ++static wsrep_uuid_t cluster_uuid = WSREP_UUID_UNDEFINED; ++ ++bool wsrep_before_SE() ++{ ++ return (wsrep_provider != NULL ++ && strcmp (wsrep_provider, WSREP_NONE) ++ && strcmp (wsrep_sst_method, WSREP_SST_SKIP) ++ && strcmp (wsrep_sst_method, WSREP_SST_MYSQLDUMP)); ++} ++ ++static bool sst_complete = false; ++static bool sst_needed = false; ++ ++void wsrep_sst_grab () ++{ ++ WSREP_INFO("wsrep_sst_grab()"); ++ if (mysql_mutex_lock (&LOCK_wsrep_sst)) abort(); ++ sst_complete = false; ++ mysql_mutex_unlock (&LOCK_wsrep_sst); ++} ++ ++// Wait for end of SST ++bool wsrep_sst_wait () ++{ ++ if (mysql_mutex_lock (&LOCK_wsrep_sst)) abort(); ++ while (!sst_complete) ++ { ++ WSREP_INFO("Waiting for SST to complete."); ++ mysql_cond_wait (&COND_wsrep_sst, &LOCK_wsrep_sst); ++ } ++ ++ if (local_seqno >= 0) ++ { ++ WSREP_INFO("SST complete, seqno: %lld", (long long) local_seqno); ++ } ++ else ++ { ++ WSREP_ERROR("SST failed: %d (%s)", ++ int(-local_seqno), strerror(-local_seqno)); ++ } ++ ++ mysql_mutex_unlock (&LOCK_wsrep_sst); ++ ++ return (local_seqno >= 0); ++} ++ ++// Signal end of SST ++void wsrep_sst_complete (const wsrep_uuid_t* sst_uuid, ++ wsrep_seqno_t sst_seqno, ++ bool needed) ++{ ++ if (mysql_mutex_lock (&LOCK_wsrep_sst)) abort(); ++ if (!sst_complete) ++ { ++ sst_complete = true; ++ sst_needed = needed; ++ local_uuid = *sst_uuid; ++ local_seqno = sst_seqno; ++ mysql_cond_signal (&COND_wsrep_sst); ++ } ++ else ++ { ++ /* This can happen when called from wsrep_synced_cb(). ++ At the moment there is no way to check there ++ if main thread is still waiting for signal, ++ so wsrep_sst_complete() is called from there ++ each time wsrep_ready changes from FALSE -> TRUE. ++ */ ++ WSREP_DEBUG("Nobody is waiting for SST."); ++ } ++ mysql_mutex_unlock (&LOCK_wsrep_sst); ++} ++ ++void wsrep_sst_received (wsrep_t* const wsrep, ++ const wsrep_uuid_t* const uuid, ++ wsrep_seqno_t const seqno, ++ const void* const state, ++ size_t const state_len) ++{ ++ int const rcode(seqno < 0 ? seqno : 0); ++ wsrep_gtid_t const state_id = { ++ *uuid, (rcode ? WSREP_SEQNO_UNDEFINED : seqno) ++ }; ++ wsrep_init_sidno(state_id.uuid); ++ wsrep->sst_received(wsrep, &state_id, state, state_len, rcode); ++} ++ ++// Let applier threads to continue ++void wsrep_sst_continue () ++{ ++ if (sst_needed) ++ { ++ WSREP_INFO("Signalling provider to continue."); ++ wsrep_sst_received (wsrep, &local_uuid, local_seqno, NULL, 0); ++ } ++} ++ ++struct sst_thread_arg ++{ ++ const char* cmd; ++ int err; ++ char* ret_str; ++ mysql_mutex_t lock; ++ mysql_cond_t cond; ++ ++ sst_thread_arg (const char* c) : cmd(c), err(-1), ret_str(0) ++ { ++ mysql_mutex_init(key_LOCK_wsrep_sst_thread, &lock, MY_MUTEX_INIT_FAST); ++ mysql_cond_init(key_COND_wsrep_sst_thread, &cond, NULL); ++ } ++ ++ ~sst_thread_arg() ++ { ++ mysql_cond_destroy (&cond); ++ mysql_mutex_unlock (&lock); ++ mysql_mutex_destroy (&lock); ++ } ++}; ++ ++static int sst_scan_uuid_seqno (const char* str, ++ wsrep_uuid_t* uuid, wsrep_seqno_t* seqno) ++{ ++ int offt = wsrep_uuid_scan (str, strlen(str), uuid); ++ if (offt > 0 && strlen(str) > (unsigned int)offt && ':' == str[offt]) ++ { ++ *seqno = strtoll (str + offt + 1, NULL, 10); ++ if (*seqno != LLONG_MAX || errno != ERANGE) ++ { ++ return 0; ++ } ++ } ++ ++ WSREP_ERROR("Failed to parse uuid:seqno pair: '%s'", str); ++ return EINVAL; ++} ++ ++// get rid of trailing \n ++static char* my_fgets (char* buf, size_t buf_len, FILE* stream) ++{ ++ char* ret= fgets (buf, buf_len, stream); ++ ++ if (ret) ++ { ++ size_t len = strlen(ret); ++ if (len > 0 && ret[len - 1] == '\n') ret[len - 1] = '\0'; ++ } ++ ++ return ret; ++} ++ ++/* ++ Generate opt_binlog_opt_val for sst_donate_other(), sst_prepare_other(). ++ ++ Returns zero on success, negative error code otherwise. ++ ++ String containing binlog name is stored in param ret if binlog is enabled ++ and GTID mode is on, otherwise empty string. Returned string should be ++ freed with my_free(). ++ */ ++static int generate_binlog_opt_val(char** ret) ++{ ++ DBUG_ASSERT(ret); ++ *ret= NULL; ++ if (opt_bin_log && gtid_mode > 0) ++ { ++ assert(opt_bin_logname); ++ *ret= strcmp(opt_bin_logname, "0") ? ++ my_strdup(opt_bin_logname, MYF(0)) : my_strdup("", MYF(0)); ++ } ++ else ++ { ++ *ret= my_strdup("", MYF(0)); ++ } ++ if (!*ret) return -ENOMEM; ++ return 0; ++} ++ ++static void* sst_joiner_thread (void* a) ++{ ++ sst_thread_arg* arg= (sst_thread_arg*) a; ++ int err= 1; ++ ++ { ++ const char magic[] = "ready"; ++ const size_t magic_len = sizeof(magic) - 1; ++ const size_t out_len = 512; ++ char out[out_len]; ++ ++ WSREP_INFO("Running: '%s'", arg->cmd); ++ ++ wsp::process proc (arg->cmd, "r"); ++ ++ if (proc.pipe() && !proc.error()) ++ { ++ const char* tmp= my_fgets (out, out_len, proc.pipe()); ++ ++ if (!tmp || strlen(tmp) < (magic_len + 2) || ++ strncasecmp (tmp, magic, magic_len)) ++ { ++ WSREP_ERROR("Failed to read '%s ' from: %s\n\tRead: '%s'", ++ magic, arg->cmd, tmp); ++ proc.wait(); ++ if (proc.error()) err = proc.error(); ++ } ++ else ++ { ++ err = 0; ++ } ++ } ++ else ++ { ++ err = proc.error(); ++ WSREP_ERROR("Failed to execute: %s : %d (%s)", ++ arg->cmd, err, strerror(err)); ++ } ++ ++ // signal sst_prepare thread with ret code, ++ // it will go on sending SST request ++ mysql_mutex_lock (&arg->lock); ++ if (!err) ++ { ++ arg->ret_str = strdup (out + magic_len + 1); ++ if (!arg->ret_str) err = ENOMEM; ++ } ++ arg->err = -err; ++ mysql_cond_signal (&arg->cond); ++ mysql_mutex_unlock (&arg->lock); //! @note arg is unusable after that. ++ ++ if (err) return NULL; /* lp:808417 - return immediately, don't signal ++ * initializer thread to ensure single thread of ++ * shutdown. */ ++ ++ wsrep_uuid_t ret_uuid = WSREP_UUID_UNDEFINED; ++ wsrep_seqno_t ret_seqno = WSREP_SEQNO_UNDEFINED; ++ ++ // in case of successfull receiver start, wait for SST completion/end ++ char* tmp = my_fgets (out, out_len, proc.pipe()); ++ ++ proc.wait(); ++ err= EINVAL; ++ ++ if (!tmp) ++ { ++ WSREP_ERROR("Failed to read uuid:seqno from joiner script."); ++ if (proc.error()) err = proc.error(); ++ } ++ else ++ { ++ err= sst_scan_uuid_seqno (out, &ret_uuid, &ret_seqno); ++ } ++ ++ if (err) ++ { ++ ret_uuid= WSREP_UUID_UNDEFINED; ++ ret_seqno= -err; ++ } ++ ++ // Tell initializer thread that SST is complete ++ wsrep_sst_complete (&ret_uuid, ret_seqno, true); ++ } ++ ++ return NULL; ++} ++ ++static ssize_t sst_prepare_other (const char* method, ++ const char* addr_in, ++ const char** addr_out) ++{ ++ ssize_t cmd_len= 1024; ++ char cmd_str[1024]; ++ const char* sst_dir= mysql_real_data_home; ++ const char* binlog_opt= ""; ++ char* binlog_opt_val= NULL; ++ ++ int ret; ++ if ((ret= generate_binlog_opt_val(&binlog_opt_val))) ++ { ++ WSREP_ERROR("sst_prepare_other(): generate_binlog_opt_val() failed: %d", ++ ret); ++ return ret; ++ } ++ if (strlen(binlog_opt_val)) binlog_opt= WSREP_SST_OPT_BINLOG; ++ ++ ++ ret= snprintf (cmd_str, cmd_len, ++ "wsrep_sst_%s " ++ WSREP_SST_OPT_ROLE" 'joiner' " ++ WSREP_SST_OPT_ADDR" '%s' " ++ WSREP_SST_OPT_AUTH" '%s' " ++ WSREP_SST_OPT_DATA" '%s' " ++ WSREP_SST_OPT_CONF" '%s' " ++ WSREP_SST_OPT_CONF_SUFFIX" '%s' " ++ WSREP_SST_OPT_PARENT" '%d'" ++ " %s '%s' ", ++ method, addr_in, (sst_auth_real) ? sst_auth_real : "", ++ sst_dir, wsrep_defaults_file, wsrep_defaults_group_suffix, (int)getpid(), ++ binlog_opt, binlog_opt_val); ++ my_free(binlog_opt_val); ++ ++ if (ret < 0 || ret >= cmd_len) ++ { ++ WSREP_ERROR("sst_prepare_other(): snprintf() failed: %d", ret); ++ return (ret < 0 ? ret : -EMSGSIZE); ++ } ++ ++ pthread_t tmp; ++ sst_thread_arg arg(cmd_str); ++ mysql_mutex_lock (&arg.lock); ++ ret = pthread_create (&tmp, NULL, sst_joiner_thread, &arg); ++ if (ret) ++ { ++ WSREP_ERROR("sst_prepare_other(): pthread_create() failed: %d (%s)", ++ ret, strerror(ret)); ++ return ret; ++ } ++ mysql_cond_wait (&arg.cond, &arg.lock); ++ ++ *addr_out= arg.ret_str; ++ ++ if (!arg.err) ++ ret = strlen(*addr_out); ++ else ++ { ++ assert (arg.err < 0); ++ ret = arg.err; ++ } ++ ++ pthread_detach (tmp); ++ ++ return ret; ++} ++ ++extern uint mysqld_port; ++ ++/*! Just tells donor where to send mysqldump */ ++static ssize_t sst_prepare_mysqldump (const char* addr_in, ++ const char** addr_out) ++{ ++ ssize_t ret = strlen (addr_in); ++ ++ if (!strrchr(addr_in, ':')) ++ { ++ ssize_t s = ret + 7; ++ char* tmp = (char*) malloc (s); ++ ++ if (tmp) ++ { ++ ret= snprintf (tmp, s, "%s:%u", addr_in, mysqld_port); ++ ++ if (ret > 0 && ret < s) ++ { ++ *addr_out= tmp; ++ return ret; ++ } ++ if (ret > 0) /* buffer too short */ ret = -EMSGSIZE; ++ free (tmp); ++ } ++ else { ++ ret= -ENOMEM; ++ } ++ ++ WSREP_ERROR ("Could not prepare state transfer request: " ++ "adding default port failed: %zd.", ret); ++ } ++ else { ++ *addr_out= addr_in; ++ } ++ ++ return ret; ++} ++ ++static bool SE_initialized = false; ++ ++ssize_t wsrep_sst_prepare (void** msg) ++{ ++ const ssize_t ip_max= 256; ++ char ip_buf[ip_max]; ++ const char* addr_in= NULL; ++ const char* addr_out= NULL; ++ ++ if (!strcmp(wsrep_sst_method, WSREP_SST_SKIP)) ++ { ++ ssize_t ret = strlen(WSREP_STATE_TRANSFER_TRIVIAL) + 1; ++ *msg = strdup(WSREP_STATE_TRANSFER_TRIVIAL); ++ if (!msg) ++ { ++ WSREP_ERROR("Could not allocate %zd bytes for state request", ret); ++ unireg_abort(1); ++ } ++ return ret; ++ } ++ ++ // Figure out SST address. Common for all SST methods ++ if (wsrep_sst_receive_address && ++ strcmp (wsrep_sst_receive_address, WSREP_SST_ADDRESS_AUTO)) ++ { ++ addr_in= wsrep_sst_receive_address; ++ } ++ else if (wsrep_node_address && strlen(wsrep_node_address)) ++ { ++ const char* const colon= strchr (wsrep_node_address, ':'); ++ if (colon) ++ { ++ ptrdiff_t const len= colon - wsrep_node_address; ++ strncpy (ip_buf, wsrep_node_address, len); ++ ip_buf[len]= '\0'; ++ addr_in= ip_buf; ++ } ++ else ++ { ++ addr_in= wsrep_node_address; ++ } ++ } ++ else ++ { ++ ssize_t ret= wsrep_guess_ip (ip_buf, ip_max); ++ ++ if (ret && ret < ip_max) ++ { ++ addr_in= ip_buf; ++ } ++ else ++ { ++ WSREP_ERROR("Could not prepare state transfer request: " ++ "failed to guess address to accept state transfer at. " ++ "wsrep_sst_receive_address must be set manually."); ++ unireg_abort(1); ++ } ++ } ++ ++ ssize_t addr_len= -ENOSYS; ++ if (!strcmp(wsrep_sst_method, WSREP_SST_MYSQLDUMP)) ++ { ++ addr_len= sst_prepare_mysqldump (addr_in, &addr_out); ++ if (addr_len < 0) unireg_abort(1); ++ } ++ else ++ { ++ /*! A heuristic workaround until we learn how to stop and start engines */ ++ if (SE_initialized) ++ { ++ // we already did SST at initializaiton, now engines are running ++ // sql_print_information() is here because the message is too long ++ // for WSREP_INFO. ++ sql_print_information ("WSREP: " ++ "You have configured '%s' state snapshot transfer method " ++ "which cannot be performed on a running server. " ++ "Wsrep provider won't be able to fall back to it " ++ "if other means of state transfer are unavailable. " ++ "In that case you will need to restart the server.", ++ wsrep_sst_method); ++ *msg = 0; ++ return 0; ++ } ++ ++ addr_len = sst_prepare_other (wsrep_sst_method, addr_in, &addr_out); ++ if (addr_len < 0) ++ { ++ WSREP_ERROR("Failed to prepare for '%s' SST. Unrecoverable.", ++ wsrep_sst_method); ++ unireg_abort(1); ++ } ++ } ++ ++ size_t const method_len(strlen(wsrep_sst_method)); ++ size_t const msg_len (method_len + addr_len + 2 /* + auth_len + 1*/); ++ ++ *msg = malloc (msg_len); ++ if (NULL != *msg) { ++ char* const method_ptr(reinterpret_cast(*msg)); ++ strcpy (method_ptr, wsrep_sst_method); ++ char* const addr_ptr(method_ptr + method_len + 1); ++ strcpy (addr_ptr, addr_out); ++ ++ WSREP_INFO ("Prepared SST request: %s|%s", method_ptr, addr_ptr); ++ } ++ else { ++ WSREP_ERROR("Failed to allocate SST request of size %zu. Can't continue.", ++ msg_len); ++ unireg_abort(1); ++ } ++ ++ if (addr_out != addr_in) /* malloc'ed */ free ((char*)addr_out); ++ ++ return msg_len; ++} ++ ++// helper method for donors ++static int sst_run_shell (const char* cmd_str, int max_tries) ++{ ++ int ret = 0; ++ ++ for (int tries=1; tries <= max_tries; tries++) ++ { ++ wsp::process proc (cmd_str, "r"); ++ ++ if (NULL != proc.pipe()) ++ { ++ proc.wait(); ++ } ++ ++ if ((ret = proc.error())) ++ { ++ WSREP_ERROR("Try %d/%d: '%s' failed: %d (%s)", ++ tries, max_tries, proc.cmd(), ret, strerror(ret)); ++ sleep (1); ++ } ++ else ++ { ++ WSREP_DEBUG("SST script successfully completed."); ++ break; ++ } ++ } ++ ++ return -ret; ++} ++ ++static void sst_reject_queries(my_bool close_conn) ++{ ++ wsrep_ready_set (FALSE); // this will be resotred when donor becomes synced ++ WSREP_INFO("Rejecting client queries for the duration of SST."); ++ if (TRUE == close_conn) wsrep_close_client_connections(FALSE); ++} ++ ++static int sst_mysqldump_check_addr (const char* user, const char* pswd, ++ const char* host, const char* port) ++{ ++ return 0; ++} ++ ++static int sst_donate_mysqldump (const char* addr, ++ const wsrep_uuid_t* uuid, ++ const char* uuid_str, ++ wsrep_seqno_t seqno, ++ bool bypass) ++{ ++ size_t host_len; ++ const char* port = strchr (addr, ':'); ++ ++ if (port) ++ { ++ port += 1; ++ host_len = port - addr; ++ } ++ else ++ { ++ port = ""; ++ host_len = strlen (addr) + 1; ++ } ++ ++ char *host= (char*) malloc(host_len); ++ ++ strncpy (host, addr, host_len - 1); ++ host[host_len - 1] = '\0'; ++ ++ const char* auth = sst_auth_real; ++ const char* pswd = (auth) ? strchr (auth, ':') : NULL; ++ size_t user_len; ++ ++ if (pswd) ++ { ++ pswd += 1; ++ user_len = pswd - auth; ++ } ++ else ++ { ++ pswd = ""; ++ user_len = (auth) ? strlen (auth) + 1 : 1; ++ } ++ ++ char* user= (char*) malloc(user_len); ++ ++ strncpy (user, (auth) ? auth : "", user_len - 1); ++ user[user_len - 1] = '\0'; ++ ++ int ret = sst_mysqldump_check_addr (user, pswd, host, port); ++ if (!ret) ++ { ++ size_t cmd_len= 1024; ++ char cmd_str[1024]; ++ ++ if (!bypass && wsrep_sst_donor_rejects_queries) sst_reject_queries(TRUE); ++ ++ snprintf (cmd_str, cmd_len, ++ "wsrep_sst_mysqldump " ++ WSREP_SST_OPT_USER" '%s' " ++ WSREP_SST_OPT_PSWD" '%s' " ++ WSREP_SST_OPT_HOST" '%s' " ++ WSREP_SST_OPT_PORT" '%s' " ++ WSREP_SST_OPT_LPORT" '%u' " ++ WSREP_SST_OPT_SOCKET" '%s' " ++ WSREP_SST_OPT_CONF" '%s' " ++ WSREP_SST_OPT_GTID" '%s:%lld'" ++ "%s", ++ user, pswd, host, port, mysqld_port, mysqld_unix_port, ++ wsrep_defaults_file, uuid_str, ++ (long long)seqno, bypass ? " "WSREP_SST_OPT_BYPASS : ""); ++ ++ WSREP_DEBUG("Running: '%s'", cmd_str); ++ ++ ret= sst_run_shell (cmd_str, 3); ++ } ++ ++ wsrep_gtid_t const state_id = { *uuid, (ret ? WSREP_SEQNO_UNDEFINED : seqno)}; ++ ++ wsrep->sst_sent (wsrep, &state_id, ret); ++ ++ free(user); ++ free(host); ++ ++ return ret; ++} ++ ++wsrep_seqno_t wsrep_locked_seqno= WSREP_SEQNO_UNDEFINED; ++ ++static int run_sql_command(THD *thd, const char *query) ++{ ++ thd->set_query((char *)query, strlen(query)); ++ ++ Parser_state ps; ++ if (ps.init(thd, thd->query(), thd->query_length())) ++ { ++ WSREP_ERROR("SST query: %s failed", query); ++ return -1; ++ } ++ ++ mysql_parse(thd, thd->query(), thd->query_length(), &ps); ++ if (thd->is_error()) ++ { ++ int const err= thd->get_stmt_da()->sql_errno(); ++ WSREP_WARN ("error executing '%s': %d (%s)%s", ++ query, err, thd->get_stmt_da()->message(), ++ err == ER_UNKNOWN_SYSTEM_VARIABLE ? ++ ". Was mysqld built with --with-innodb-disallow-writes ?" : ""); ++ thd->clear_error(); ++ return -1; ++ } ++ return 0; ++} ++ ++static int sst_flush_tables(THD* thd) ++{ ++ WSREP_INFO("Flushing tables for SST..."); ++ ++ int err; ++ int not_used; ++ if (run_sql_command(thd, "FLUSH TABLES WITH READ LOCK")) ++ { ++ WSREP_ERROR("Failed to flush and lock tables"); ++ err = -1; ++ } ++ else ++ { ++ /* make sure logs are flushed after global read lock acquired */ ++ err= reload_acl_and_cache(thd, REFRESH_ENGINE_LOG | REFRESH_BINARY_LOG, ++ (TABLE_LIST*) 0, ¬_used); ++ } ++ ++ if (err) ++ { ++ WSREP_ERROR("Failed to flush tables: %d (%s)", err, strerror(err)); ++ } ++ else ++ { ++ WSREP_INFO("Tables flushed."); ++ const char base_name[]= "tables_flushed"; ++ ssize_t const full_len= strlen(mysql_real_data_home) + strlen(base_name)+2; ++ char *real_name = (char*) malloc(full_len); ++ sprintf(real_name, "%s/%s", mysql_real_data_home, base_name); ++ char *tmp_name = (char*) malloc(full_len + 4); ++ sprintf(tmp_name, "%s.tmp", real_name); ++ ++ FILE* file= fopen(tmp_name, "w+"); ++ if (0 == file) ++ { ++ err= errno; ++ WSREP_ERROR("Failed to open '%s': %d (%s)", tmp_name, err,strerror(err)); ++ } ++ else ++ { ++ fprintf(file, "%s:%lld\n", ++ wsrep_cluster_state_uuid, (long long)wsrep_locked_seqno); ++ fsync(fileno(file)); ++ fclose(file); ++ if (rename(tmp_name, real_name) == -1) ++ { ++ err= errno; ++ WSREP_ERROR("Failed to rename '%s' to '%s': %d (%s)", ++ tmp_name, real_name, err,strerror(err)); ++ } ++ } ++ free(real_name); ++ free(tmp_name); ++ } ++ ++ return err; ++} ++ ++static void sst_disallow_writes (THD* thd, bool yes) ++{ ++ char query_str[64] = { 0, }; ++ ssize_t const query_max = sizeof(query_str) - 1; ++ snprintf (query_str, query_max, "SET GLOBAL innodb_disallow_writes=%d", ++ yes ? 1 : 0); ++ ++ if (run_sql_command(thd, query_str)) ++ { ++ WSREP_ERROR("Failed to disallow InnoDB writes"); ++ } ++} ++ ++static void* sst_donor_thread (void* a) ++{ ++ sst_thread_arg* arg= (sst_thread_arg*)a; ++ ++ WSREP_INFO("Running: '%s'", arg->cmd); ++ ++ int err= 1; ++ bool locked= false; ++ ++ const char* out= NULL; ++ const size_t out_len= 128; ++ char out_buf[out_len]; ++ ++ wsrep_uuid_t ret_uuid= WSREP_UUID_UNDEFINED; ++ wsrep_seqno_t ret_seqno= WSREP_SEQNO_UNDEFINED; // seqno of complete SST ++ ++ wsp::thd thd(FALSE); // we turn off wsrep_on for this THD so that it can ++ // operate with wsrep_ready == OFF ++ wsp::process proc(arg->cmd, "r"); ++ ++ err= proc.error(); ++ ++/* Inform server about SST script startup and release TO isolation */ ++ mysql_mutex_lock (&arg->lock); ++ arg->err = -err; ++ mysql_cond_signal (&arg->cond); ++ mysql_mutex_unlock (&arg->lock); //! @note arg is unusable after that. ++ ++ if (proc.pipe() && !err) ++ { ++wait_signal: ++ out= my_fgets (out_buf, out_len, proc.pipe()); ++ ++ if (out) ++ { ++ const char magic_flush[]= "flush tables"; ++ const char magic_cont[]= "continue"; ++ const char magic_done[]= "done"; ++ ++ if (!strcasecmp (out, magic_flush)) ++ { ++ err= sst_flush_tables (thd.ptr); ++ if (!err) ++ { ++ sst_disallow_writes (thd.ptr, true); ++ locked= true; ++ goto wait_signal; ++ } ++ } ++ else if (!strcasecmp (out, magic_cont)) ++ { ++ if (locked) ++ { ++ sst_disallow_writes (thd.ptr, false); ++ thd.ptr->global_read_lock.unlock_global_read_lock (thd.ptr); ++ locked= false; ++ } ++ err= 0; ++ goto wait_signal; ++ } ++ else if (!strncasecmp (out, magic_done, strlen(magic_done))) ++ { ++ err= sst_scan_uuid_seqno (out + strlen(magic_done) + 1, ++ &ret_uuid, &ret_seqno); ++ } ++ else ++ { ++ WSREP_WARN("Received unknown signal: '%s'", out); ++ } ++ } ++ else ++ { ++ WSREP_ERROR("Failed to read from: %s", proc.cmd()); ++ proc.wait(); ++ } ++ if (!err && proc.error()) err= proc.error(); ++ } ++ else ++ { ++ WSREP_ERROR("Failed to execute: %s : %d (%s)", ++ proc.cmd(), err, strerror(err)); ++ } ++ ++ if (locked) // don't forget to unlock server before return ++ { ++ sst_disallow_writes (thd.ptr, false); ++ thd.ptr->global_read_lock.unlock_global_read_lock (thd.ptr); ++ } ++ ++ // signal to donor that SST is over ++ struct wsrep_gtid const state_id = { ++ ret_uuid, err ? WSREP_SEQNO_UNDEFINED : ret_seqno ++ }; ++ wsrep->sst_sent (wsrep, &state_id, -err); ++ proc.wait(); ++ ++ return NULL; ++} ++ ++ ++ ++static int sst_donate_other (const char* method, ++ const char* addr, ++ const char* uuid, ++ wsrep_seqno_t seqno, ++ bool bypass) ++{ ++ ssize_t cmd_len = 4096; ++ char cmd_str[4096]; ++ const char* binlog_opt= ""; ++ char* binlog_opt_val= NULL; ++ ++ int ret; ++ if ((ret= generate_binlog_opt_val(&binlog_opt_val))) ++ { ++ WSREP_ERROR("sst_donate_other(): generate_binlog_opt_val() failed: %d",ret); ++ return ret; ++ } ++ if (strlen(binlog_opt_val)) binlog_opt= WSREP_SST_OPT_BINLOG; ++ ++ ret= snprintf (cmd_str, cmd_len, ++ "wsrep_sst_%s " ++ WSREP_SST_OPT_ROLE" 'donor' " ++ WSREP_SST_OPT_ADDR" '%s' " ++ WSREP_SST_OPT_AUTH" '%s' " ++ WSREP_SST_OPT_SOCKET" '%s' " ++ WSREP_SST_OPT_DATA" '%s' " ++ WSREP_SST_OPT_CONF" '%s' " ++ WSREP_SST_OPT_CONF_SUFFIX" '%s' " ++ " %s '%s' " ++ WSREP_SST_OPT_GTID" '%s:%lld'" ++ "%s", ++ method, addr, sst_auth_real, mysqld_unix_port, ++ mysql_real_data_home, wsrep_defaults_file, wsrep_defaults_group_suffix, ++ binlog_opt, binlog_opt_val, ++ uuid, (long long) seqno, ++ bypass ? " "WSREP_SST_OPT_BYPASS : ""); ++ my_free(binlog_opt_val); ++ ++ if (ret < 0 || ret >= cmd_len) ++ { ++ WSREP_ERROR("sst_donate_other(): snprintf() failed: %d", ret); ++ return (ret < 0 ? ret : -EMSGSIZE); ++ } ++ ++ if (!bypass && wsrep_sst_donor_rejects_queries) sst_reject_queries(FALSE); ++ ++ pthread_t tmp; ++ sst_thread_arg arg(cmd_str); ++ mysql_mutex_lock (&arg.lock); ++ ret = pthread_create (&tmp, NULL, sst_donor_thread, &arg); ++ if (ret) ++ { ++ WSREP_ERROR("sst_donate_other(): pthread_create() failed: %d (%s)", ++ ret, strerror(ret)); ++ return ret; ++ } ++ mysql_cond_wait (&arg.cond, &arg.lock); ++ ++ WSREP_INFO("sst_donor_thread signaled with %d", arg.err); ++ return arg.err; ++} ++ ++wsrep_cb_status_t wsrep_sst_donate_cb (void* app_ctx, void* recv_ctx, ++ const void* msg, size_t msg_len, ++ const wsrep_gtid_t* current_gtid, ++ const char* state, size_t state_len, ++ bool bypass) ++{ ++ /* This will be reset when sync callback is called. ++ * Should we set wsrep_ready to FALSE here too? */ ++// wsrep_notify_status(WSREP_MEMBER_DONOR); ++ local_status.set(WSREP_MEMBER_DONOR); ++ ++ const char* method = (char*)msg; ++ size_t method_len = strlen (method); ++ const char* data = method + method_len + 1; ++ ++ char uuid_str[37]; ++ wsrep_uuid_print (¤t_gtid->uuid, uuid_str, sizeof(uuid_str)); ++ ++ int ret; ++ if (!strcmp (WSREP_SST_MYSQLDUMP, method)) ++ { ++ ret = sst_donate_mysqldump(data, ¤t_gtid->uuid, uuid_str, ++ current_gtid->seqno, bypass); ++ } ++ else ++ { ++ ret = sst_donate_other(method, data, uuid_str, current_gtid->seqno,bypass); ++ } ++ ++ return (ret > 0 ? WSREP_CB_SUCCESS : WSREP_CB_FAILURE); ++} ++ ++void wsrep_SE_init_grab() ++{ ++ if (mysql_mutex_lock (&LOCK_wsrep_sst_init)) abort(); ++} ++ ++void wsrep_SE_init_wait() ++{ ++ while (SE_initialized == false) ++ { ++ mysql_cond_wait (&COND_wsrep_sst_init, &LOCK_wsrep_sst_init); ++ } ++ mysql_mutex_unlock (&LOCK_wsrep_sst_init); ++} ++ ++void wsrep_SE_init_done() ++{ ++ mysql_cond_signal (&COND_wsrep_sst_init); ++ mysql_mutex_unlock (&LOCK_wsrep_sst_init); ++} ++ ++void wsrep_SE_initialized() ++{ ++ SE_initialized = true; ++} +diff --git a/sql/wsrep_sst.h b/sql/wsrep_sst.h +new file mode 100644 +index 0000000..b7f0e26 +--- /dev/null ++++ b/sql/wsrep_sst.h +@@ -0,0 +1,40 @@ ++/* Copyright (C) 2013 Codership Oy ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; version 2 of the License. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License along ++ with this program; if not, write to the Free Software Foundation, Inc., ++ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ ++ ++#ifndef WSREP_SST_H ++#define WSREP_SST_H ++ ++#include // my_bool ++ ++/* system variables */ ++extern const char* wsrep_sst_method; ++extern const char* wsrep_sst_receive_address; ++extern const char* wsrep_sst_donor; ++extern char* wsrep_sst_auth; ++extern my_bool wsrep_sst_donor_rejects_queries; ++ ++/*! Synchronizes applier thread start with init thread */ ++extern void wsrep_sst_grab(); ++/*! Init thread waits for SST completion */ ++extern bool wsrep_sst_wait(); ++/*! Signals wsrep that initialization is complete, writesets can be applied */ ++extern void wsrep_sst_continue(); ++ ++extern void wsrep_SE_init_grab(); /*! grab init critical section */ ++extern void wsrep_SE_init_wait(); /*! wait for SE init to complete */ ++extern void wsrep_SE_init_done(); /*! signal that SE init is complte */ ++extern void wsrep_SE_initialized(); /*! mark SE initialization complete */ ++ ++#endif /* WSREP_SST_H */ +diff --git a/sql/wsrep_thd.cc b/sql/wsrep_thd.cc +new file mode 100644 +index 0000000..707a8fe +--- /dev/null ++++ b/sql/wsrep_thd.cc +@@ -0,0 +1,576 @@ ++/* Copyright (C) 2013 Codership Oy ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; version 2 of the License. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License along ++ with this program; if not, write to the Free Software Foundation, Inc., ++ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ ++ ++#include "wsrep_thd.h" ++ ++#include "transaction.h" ++#include "rpl_rli.h" ++#include "log_event.h" ++#include "sql_parse.h" ++#include "global_threads.h" // LOCK_thread_count, etc. ++#include "sql_base.h" // close_thread_tables() ++#include "mysqld.h" // start_wsrep_THD(); ++ ++static long long wsrep_bf_aborts_counter = 0; ++ ++int wsrep_show_bf_aborts (THD *thd, SHOW_VAR *var, char *buff) ++{ ++ wsrep_local_bf_aborts = my_atomic_load64(&wsrep_bf_aborts_counter); ++ var->type = SHOW_LONGLONG; ++ var->value = (char*)&wsrep_local_bf_aborts; ++ return 0; ++} ++ ++/* must have (&thd->LOCK_wsrep_thd) */ ++void wsrep_client_rollback(THD *thd) ++{ ++ WSREP_DEBUG("client rollback due to BF abort for (%ld), query: %s", ++ thd->thread_id, thd->query()); ++ ++ my_atomic_add64(&wsrep_bf_aborts_counter, 1); ++ ++ thd->wsrep_conflict_state= ABORTING; ++ mysql_mutex_unlock(&thd->LOCK_wsrep_thd); ++ trans_rollback(thd); ++ ++ if (thd->locked_tables_mode && thd->lock) ++ { ++ WSREP_DEBUG("unlocking tables for BF abort (%ld)", thd->thread_id); ++ thd->locked_tables_list.unlock_locked_tables(thd); ++ thd->variables.option_bits&= ~(OPTION_TABLE_LOCK); ++ } ++ ++ if (thd->global_read_lock.is_acquired()) ++ { ++ WSREP_DEBUG("unlocking GRL for BF abort (%ld)", thd->thread_id); ++ thd->global_read_lock.unlock_global_read_lock(thd); ++ } ++ ++ /* Release transactional metadata locks. */ ++ thd->mdl_context.release_transactional_locks(); ++ ++ /* release explicit MDL locks */ ++ thd->mdl_context.release_explicit_locks(); ++ ++ if (thd->get_binlog_table_maps()) ++ { ++ WSREP_DEBUG("clearing binlog table map for BF abort (%ld)", thd->thread_id); ++ thd->clear_binlog_table_maps(); ++ } ++ mysql_mutex_lock(&thd->LOCK_wsrep_thd); ++ thd->wsrep_conflict_state= ABORTED; ++} ++ ++#define NUMBER_OF_FIELDS_TO_IDENTIFY_COORDINATOR 1 ++#define NUMBER_OF_FIELDS_TO_IDENTIFY_WORKER 2 ++#include "rpl_info_factory.h" ++ ++static Relay_log_info* wsrep_relay_log_init(const char* log_fname) ++{ ++ uint rli_option = INFO_REPOSITORY_DUMMY; ++ Relay_log_info *rli= NULL; ++ rli = Rpl_info_factory::create_rli(rli_option, false); ++ rli->set_rli_description_event( ++ new Format_description_log_event(BINLOG_VERSION)); ++ ++ return (rli); ++ ++#ifdef REMOVED ++ Rpl_info_handler* handler_src= NULL; ++ Rpl_info_handler* handler_dest= NULL; ++ ulong *key_info_idx= NULL; ++ const char *msg= "Failed to allocate memory for the relay log info " ++ "structure"; ++ ++ DBUG_ENTER("Rpl_info_factory::create_rli"); ++ ++ if (!(rli= new Relay_log_info(false ++#ifdef HAVE_PSI_INTERFACE ++ ,&key_relay_log_info_run_lock, ++ &key_relay_log_info_data_lock, ++ &key_relay_log_info_sleep_lock, ++ &key_relay_log_info_data_cond, ++ &key_relay_log_info_start_cond, ++ &key_relay_log_info_stop_cond, ++ &key_relay_log_info_sleep_cond ++#endif /* HAVE_PSI_INTERFACE */ ++ ))) ++ goto err; ++ ++ if (!(key_info_idx= new ulong[NUMBER_OF_FIELDS_TO_IDENTIFY_COORDINATOR])) ++ goto err; ++ key_info_idx[0]= server_id; ++ rli->set_idx_info(key_info_idx, NUMBER_OF_FIELDS_TO_IDENTIFY_COORDINATOR); ++ ++ if(Rpl_info_factory::init_rli_repositories(rli, rli_option, &handler_src, ++ &handler_dest, &msg)) ++ goto err; ++ ++ if (Rpl_info_factory::decide_repository(rli, rli_option, &handler_src, ++ &handler_dest, &msg)) ++ goto err; ++ ++ DBUG_RETURN(rli); ++err: ++ delete handler_src; ++ delete handler_dest; ++ delete []key_info_idx; ++ if (rli) ++ { ++ /* ++ The handler was previously deleted so we need to remove ++ any reference to it. ++ */ ++ rli->set_idx_info(NULL, 0); ++ rli->set_rpl_info_handler(NULL); ++ rli->set_rpl_info_type(INVALID_INFO_REPOSITORY); ++ delete rli; ++ } ++ WSREP_ERROR("Error creating relay log info: %s.", msg); ++ DBUG_RETURN(NULL); ++#endif /* REMOVED */ ++} ++ ++static void wsrep_prepare_bf_thd(THD *thd, struct wsrep_thd_shadow* shadow) ++{ ++ shadow->options = thd->variables.option_bits; ++ shadow->server_status = thd->server_status; ++ shadow->wsrep_exec_mode = thd->wsrep_exec_mode; ++ shadow->vio = thd->net.vio; ++ ++ if (opt_log_slave_updates) ++ thd->variables.option_bits|= OPTION_BIN_LOG; ++ else ++ thd->variables.option_bits&= ~(OPTION_BIN_LOG); ++ ++ if (!thd->wsrep_rli) thd->wsrep_rli= wsrep_relay_log_init("wsrep_relay"); ++ thd->wsrep_rli->info_thd = thd; ++ ++ thd->wsrep_exec_mode= REPL_RECV; ++ thd->net.vio= 0; ++ thd->clear_error(); ++ ++ shadow->tx_isolation = thd->variables.tx_isolation; ++ thd->variables.tx_isolation = ISO_READ_COMMITTED; ++ thd->tx_isolation = ISO_READ_COMMITTED; ++ ++ shadow->db = thd->db; ++ shadow->db_length = thd->db_length; ++ thd->reset_db(NULL, 0); ++} ++ ++static void wsrep_return_from_bf_mode(THD *thd, struct wsrep_thd_shadow* shadow) ++{ ++ thd->variables.option_bits = shadow->options; ++ thd->server_status = shadow->server_status; ++ thd->wsrep_exec_mode = shadow->wsrep_exec_mode; ++ thd->net.vio = shadow->vio; ++ thd->variables.tx_isolation = shadow->tx_isolation; ++ thd->reset_db(shadow->db, shadow->db_length); ++} ++ ++void wsrep_replay_transaction(THD *thd) ++{ ++ /* checking if BF trx must be replayed */ ++ if (thd->wsrep_conflict_state== MUST_REPLAY) { ++ DBUG_ASSERT(wsrep_thd_trx_seqno(thd)); ++ if (thd->wsrep_exec_mode!= REPL_RECV) { ++ if (thd->get_stmt_da()->is_sent()) ++ { ++ WSREP_ERROR("replay issue, thd has reported status already"); ++ } ++ thd->get_stmt_da()->reset_diagnostics_area(); ++ ++ thd->wsrep_conflict_state= REPLAYING; ++ mysql_mutex_unlock(&thd->LOCK_wsrep_thd); ++ ++ mysql_reset_thd_for_next_command(thd); ++ thd->killed= THD::NOT_KILLED; ++ close_thread_tables(thd); ++ if (thd->locked_tables_mode && thd->lock) ++ { ++ WSREP_DEBUG("releasing table lock for replaying (%ld)", ++ thd->thread_id); ++ thd->locked_tables_list.unlock_locked_tables(thd); ++ thd->variables.option_bits&= ~(OPTION_TABLE_LOCK); ++ } ++ thd->mdl_context.release_transactional_locks(); ++ /* ++ Replaying will call MYSQL_START_STATEMENT when handling ++ BEGIN Query_log_event so end statement must be called before ++ replaying. ++ */ ++ MYSQL_END_STATEMENT(thd->m_statement_psi, thd->get_stmt_da()); ++ thd->m_statement_psi= NULL; ++ thd_proc_info(thd, "wsrep replaying trx"); ++ WSREP_DEBUG("replay trx: %s %lld", ++ thd->query() ? thd->query() : "void", ++ (long long)wsrep_thd_trx_seqno(thd)); ++ struct wsrep_thd_shadow shadow; ++ wsrep_prepare_bf_thd(thd, &shadow); ++ ++ /* From trans_begin() */ ++ thd->variables.option_bits|= OPTION_BEGIN; ++ thd->server_status|= SERVER_STATUS_IN_TRANS; ++ ++ int rcode = wsrep->replay_trx(wsrep, ++ &thd->wsrep_ws_handle, ++ (void *)thd); ++ ++ wsrep_return_from_bf_mode(thd, &shadow); ++ if (thd->wsrep_conflict_state!= REPLAYING) ++ WSREP_WARN("lost replaying mode: %d", thd->wsrep_conflict_state ); ++ ++ mysql_mutex_lock(&thd->LOCK_wsrep_thd); ++ ++ switch (rcode) ++ { ++ case WSREP_OK: ++ thd->wsrep_conflict_state= NO_CONFLICT; ++ wsrep->post_commit(wsrep, &thd->wsrep_ws_handle); ++ WSREP_DEBUG("trx_replay successful for: %ld %llu", ++ thd->thread_id, (long long)thd->real_id); ++ if (thd->get_stmt_da()->is_sent()) ++ { ++ WSREP_WARN("replay ok, thd has reported status"); ++ } ++ else if (thd->get_stmt_da()->is_set()) ++ { ++ if (thd->get_stmt_da()->status() != Diagnostics_area::DA_OK) ++ { ++ WSREP_WARN("replay ok, thd has error status %d", ++ thd->get_stmt_da()->status()); ++ } ++ } ++ else ++ { ++ my_ok(thd); ++ } ++ break; ++ case WSREP_TRX_FAIL: ++ if (thd->get_stmt_da()->is_sent()) ++ { ++ WSREP_ERROR("replay failed, thd has reported status"); ++ } ++ else ++ { ++ WSREP_DEBUG("replay failed, rolling back"); ++ //my_error(ER_LOCK_DEADLOCK, MYF(0), "wsrep aborted transaction"); ++ } ++ thd->wsrep_conflict_state= ABORTED; ++ wsrep->post_rollback(wsrep, &thd->wsrep_ws_handle); ++ break; ++ default: ++ WSREP_ERROR("trx_replay failed for: %d, query: %s", ++ rcode, thd->query() ? thd->query() : "void"); ++ /* we're now in inconsistent state, must abort */ ++ mysql_mutex_unlock(&thd->LOCK_wsrep_thd); ++ unireg_abort(1); ++ break; ++ } ++ ++ wsrep_cleanup_transaction(thd); ++ ++ mysql_mutex_lock(&LOCK_wsrep_replaying); ++ wsrep_replaying--; ++ WSREP_DEBUG("replaying decreased: %d, thd: %lu", ++ wsrep_replaying, thd->thread_id); ++ mysql_cond_broadcast(&COND_wsrep_replaying); ++ mysql_mutex_unlock(&LOCK_wsrep_replaying); ++ } ++ } ++} ++ ++static void wsrep_replication_process(THD *thd) ++{ ++ int rcode; ++ DBUG_ENTER("wsrep_replication_process"); ++ ++ struct wsrep_thd_shadow shadow; ++ ++ wsrep_prepare_bf_thd(thd, &shadow); ++ ++ /* From trans_begin() */ ++ thd->variables.option_bits|= OPTION_BEGIN; ++ thd->server_status|= SERVER_STATUS_IN_TRANS; ++ ++ rcode = wsrep->recv(wsrep, (void *)thd); ++ DBUG_PRINT("wsrep",("wsrep_repl returned: %d", rcode)); ++ ++ WSREP_INFO("applier thread exiting (code:%d)", rcode); ++ ++ switch (rcode) { ++ case WSREP_OK: ++ case WSREP_NOT_IMPLEMENTED: ++ case WSREP_CONN_FAIL: ++ /* provider does not support slave operations / disconnected from group, ++ * just close applier thread */ ++ break; ++ case WSREP_NODE_FAIL: ++ /* data inconsistency => SST is needed */ ++ /* Note: we cannot just blindly restart replication here, ++ * SST might require server restart if storage engines must be ++ * initialized after SST */ ++ WSREP_ERROR("node consistency compromised, aborting"); ++ wsrep_kill_mysql(thd); ++ break; ++ case WSREP_WARNING: ++ case WSREP_TRX_FAIL: ++ case WSREP_TRX_MISSING: ++ /* these suggests a bug in provider code */ ++ WSREP_WARN("bad return from recv() call: %d", rcode); ++ /* fall through to node shutdown */ ++ case WSREP_FATAL: ++ /* Cluster connectivity is lost. ++ * ++ * If applier was killed on purpose (KILL_CONNECTION), we ++ * avoid mysql shutdown. This is because the killer will then handle ++ * shutdown processing (or replication restarting) ++ */ ++ if (thd->killed != THD::KILL_CONNECTION) ++ { ++ wsrep_kill_mysql(thd); ++ } ++ break; ++ } ++ ++ mysql_mutex_lock(&LOCK_thread_count); ++ wsrep_close_applier(thd); ++ mysql_cond_broadcast(&COND_thread_count); ++ mysql_mutex_unlock(&LOCK_thread_count); ++ ++ TABLE *tmp; ++ while ((tmp = thd->temporary_tables)) ++ { ++ WSREP_WARN("Applier %lu, has temporary tables at exit: %s.%s", ++ thd->thread_id, ++ (tmp->s) ? tmp->s->db.str : "void", ++ (tmp->s) ? tmp->s->table_name.str : "void"); ++ } ++ wsrep_return_from_bf_mode(thd, &shadow); ++ DBUG_VOID_RETURN; ++} ++ ++void wsrep_create_appliers(long threads) ++{ ++ if (!wsrep_connected) ++ { ++ /* see wsrep_replication_start() for the logic */ ++ if (wsrep_cluster_address && strlen(wsrep_cluster_address) && ++ wsrep_provider && strcasecmp(wsrep_provider, "none")) ++ { ++ WSREP_ERROR("Trying to launch slave threads before creating " ++ "connection at '%s'", wsrep_cluster_address); ++ assert(0); ++ } ++ return; ++ } ++ ++ long wsrep_threads=0; ++ pthread_t hThread; ++ while (wsrep_threads++ < threads) { ++ if (pthread_create( ++ &hThread, &connection_attrib, ++ start_wsrep_THD, (void*)wsrep_replication_process)) ++ WSREP_WARN("Can't create thread to manage wsrep replication"); ++ } ++} ++ ++static void wsrep_rollback_process(THD *thd) ++{ ++ DBUG_ENTER("wsrep_rollback_process"); ++ ++ mysql_mutex_lock(&LOCK_wsrep_rollback); ++ wsrep_aborting_thd= NULL; ++ ++ while (thd->killed == THD::NOT_KILLED) { ++ thd_proc_info(thd, "wsrep aborter idle"); ++ thd->mysys_var->current_mutex= &LOCK_wsrep_rollback; ++ thd->mysys_var->current_cond= &COND_wsrep_rollback; ++ ++ mysql_cond_wait(&COND_wsrep_rollback,&LOCK_wsrep_rollback); ++ ++ WSREP_DEBUG("WSREP rollback thread wakes for signal"); ++ ++ mysql_mutex_lock(&thd->mysys_var->mutex); ++ thd_proc_info(thd, "wsrep aborter active"); ++ thd->mysys_var->current_mutex= 0; ++ thd->mysys_var->current_cond= 0; ++ mysql_mutex_unlock(&thd->mysys_var->mutex); ++ ++ /* check for false alarms */ ++ if (!wsrep_aborting_thd) ++ { ++ WSREP_DEBUG("WSREP rollback thread has empty abort queue"); ++ } ++ /* process all entries in the queue */ ++ while (wsrep_aborting_thd) { ++ THD *aborting; ++ wsrep_aborting_thd_t next = wsrep_aborting_thd->next; ++ aborting = wsrep_aborting_thd->aborting_thd; ++ my_free(wsrep_aborting_thd); ++ wsrep_aborting_thd= next; ++ /* ++ * must release mutex, appliers my want to add more ++ * aborting thds in our work queue, while we rollback ++ */ ++ mysql_mutex_unlock(&LOCK_wsrep_rollback); ++ ++ mysql_mutex_lock(&aborting->LOCK_wsrep_thd); ++ if (aborting->wsrep_conflict_state== ABORTED) ++ { ++ WSREP_DEBUG("WSREP, thd already aborted: %llu state: %d", ++ (long long)aborting->real_id, ++ aborting->wsrep_conflict_state); ++ ++ mysql_mutex_unlock(&aborting->LOCK_wsrep_thd); ++ mysql_mutex_lock(&LOCK_wsrep_rollback); ++ continue; ++ } ++ aborting->wsrep_conflict_state= ABORTING; ++ ++ mysql_mutex_unlock(&aborting->LOCK_wsrep_thd); ++ ++ aborting->store_globals(); ++ ++ mysql_mutex_lock(&aborting->LOCK_wsrep_thd); ++ wsrep_client_rollback(aborting); ++ WSREP_DEBUG("WSREP rollbacker aborted thd: (%lu %llu)", ++ aborting->thread_id, (long long)aborting->real_id); ++ mysql_mutex_unlock(&aborting->LOCK_wsrep_thd); ++ ++ mysql_mutex_lock(&LOCK_wsrep_rollback); ++ } ++ } ++ ++ mysql_mutex_unlock(&LOCK_wsrep_rollback); ++ sql_print_information("WSREP: rollbacker thread exiting"); ++ ++ DBUG_PRINT("wsrep",("wsrep rollbacker thread exiting")); ++ DBUG_VOID_RETURN; ++} ++ ++void wsrep_create_rollbacker() ++{ ++ if (wsrep_provider && strcasecmp(wsrep_provider, "none")) ++ { ++ pthread_t hThread; ++ /* create rollbacker */ ++ if (pthread_create( &hThread, &connection_attrib, ++ start_wsrep_THD, (void*)wsrep_rollback_process)) ++ WSREP_WARN("Can't create thread to manage wsrep rollback"); ++ } ++} ++ ++void wsrep_thd_set_PA_safe(void *thd_ptr, my_bool safe) ++{ ++ if (thd_ptr) ++ { ++ THD* thd = (THD*)thd_ptr; ++ thd->wsrep_PA_safe = safe; ++ } ++} ++ ++int wsrep_thd_conflict_state(void *thd_ptr, my_bool sync) ++{ ++ int state = -1; ++ if (thd_ptr) ++ { ++ THD* thd = (THD*)thd_ptr; ++ if (sync) mysql_mutex_lock(&thd->LOCK_wsrep_thd); ++ ++ state = thd->wsrep_conflict_state; ++ if (sync) mysql_mutex_unlock(&thd->LOCK_wsrep_thd); ++ } ++ return state; ++} ++ ++my_bool wsrep_thd_is_BF(void *thd_ptr, my_bool sync) ++{ ++ my_bool status = FALSE; ++ if (thd_ptr) ++ { ++ THD* thd = (THD*)thd_ptr; ++ if (sync) mysql_mutex_lock(&thd->LOCK_wsrep_thd); ++ ++ status = ((thd->wsrep_exec_mode == REPL_RECV) || ++ (thd->wsrep_exec_mode == TOTAL_ORDER)); ++ if (sync) mysql_mutex_unlock(&thd->LOCK_wsrep_thd); ++ } ++ return status; ++} ++ ++extern "C" ++my_bool wsrep_thd_is_BF_or_commit(void *thd_ptr, my_bool sync) ++{ ++ bool status = FALSE; ++ if (thd_ptr) ++ { ++ THD* thd = (THD*)thd_ptr; ++ if (sync) mysql_mutex_lock(&thd->LOCK_wsrep_thd); ++ ++ status = ((thd->wsrep_exec_mode == REPL_RECV) || ++ (thd->wsrep_exec_mode == TOTAL_ORDER) || ++ (thd->wsrep_exec_mode == LOCAL_COMMIT)); ++ if (sync) mysql_mutex_unlock(&thd->LOCK_wsrep_thd); ++ } ++ return status; ++} ++ ++extern "C" ++my_bool wsrep_thd_is_local(void *thd_ptr, my_bool sync) ++{ ++ bool status = FALSE; ++ if (thd_ptr) ++ { ++ THD* thd = (THD*)thd_ptr; ++ if (sync) mysql_mutex_lock(&thd->LOCK_wsrep_thd); ++ ++ status = (thd->wsrep_exec_mode == LOCAL_STATE); ++ if (sync) mysql_mutex_unlock(&thd->LOCK_wsrep_thd); ++ } ++ return status; ++} ++ ++int wsrep_abort_thd(void *bf_thd_ptr, void *victim_thd_ptr, my_bool signal) ++{ ++ THD *victim_thd = (THD *) victim_thd_ptr; ++ THD *bf_thd = (THD *) bf_thd_ptr; ++ DBUG_ENTER("wsrep_abort_thd"); ++ ++ if ( (WSREP(bf_thd) || ++ ( (WSREP_ON || wsrep_OSU_method_options == WSREP_OSU_RSU) && ++ bf_thd->wsrep_exec_mode == TOTAL_ORDER) ) && ++ victim_thd) ++ { ++ WSREP_DEBUG("wsrep_abort_thd, by: %llu, victim: %llu", (bf_thd) ? ++ (long long)bf_thd->real_id : 0, (long long)victim_thd->real_id); ++ ha_wsrep_abort_transaction(bf_thd, victim_thd, signal); ++ } ++ else ++ { ++ WSREP_DEBUG("wsrep_abort_thd not effective: %p %p", bf_thd, victim_thd); ++ } ++ ++ DBUG_RETURN(1); ++} ++ ++int wsrep_thd_in_locking_session(void *thd_ptr) ++{ ++ if (thd_ptr && ((THD *)thd_ptr)->in_lock_tables) { ++ return 1; ++ } ++ return 0; ++} +diff --git a/sql/wsrep_thd.h b/sql/wsrep_thd.h +new file mode 100644 +index 0000000..cbf03e6 +--- /dev/null ++++ b/sql/wsrep_thd.h +@@ -0,0 +1,38 @@ ++/* Copyright (C) 2013 Codership Oy ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; version 2 of the License. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License along ++ with this program; if not, write to the Free Software Foundation, Inc., ++ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ ++ ++#ifndef WSREP_THD_H ++#define WSREP_THD_H ++ ++#include "sql_class.h" ++ ++int wsrep_show_bf_aborts (THD *thd, SHOW_VAR *var, char *buff); ++void wsrep_client_rollback(THD *thd); ++void wsrep_replay_transaction(THD *thd); ++void wsrep_create_appliers(long threads); ++void wsrep_create_rollbacker(); ++ ++int wsrep_abort_thd(void *bf_thd_ptr, void *victim_thd_ptr, ++ my_bool signal); ++ ++extern void wsrep_thd_set_PA_safe(void *thd_ptr, my_bool safe); ++extern my_bool wsrep_thd_is_BF(void *thd_ptr, my_bool sync); ++extern int wsrep_thd_conflict_state(void *thd_ptr, my_bool sync); ++//extern "C" my_bool wsrep_thd_is_BF(void *thd_ptr, my_bool sync); ++extern "C" my_bool wsrep_thd_is_BF_or_commit(void *thd_ptr, my_bool sync); ++extern "C" my_bool wsrep_thd_is_local(void *thd_ptr, my_bool sync); ++int wsrep_thd_in_locking_session(void *thd_ptr); ++ ++#endif /* WSREP_THD_H */ +diff --git a/sql/wsrep_utils.cc b/sql/wsrep_utils.cc +new file mode 100644 +index 0000000..2a073ac +--- /dev/null ++++ b/sql/wsrep_utils.cc +@@ -0,0 +1,524 @@ ++/* Copyright 2010 Codership Oy ++ ++ 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ */ ++ ++//! @file some utility functions and classes not directly related to replication ++ ++#ifndef _GNU_SOURCE ++#define _GNU_SOURCE // POSIX_SPAWN_USEVFORK flag ++#endif ++ ++#include "wsrep_utils.h" ++#include "wsrep_mysqld.h" ++ ++#include ++ ++#include // posix_spawn() ++#include // pipe() ++#include // errno ++#include // strerror() ++#include // waitpid() ++#include ++#include ++#include // getaddrinfo() ++ ++#ifdef HAVE_GETIFADDRS ++#include ++#include ++#endif // HAVE_GETIFADDRS ++ ++extern char** environ; // environment variables ++ ++static wsp::string wsrep_PATH; ++ ++void ++wsrep_prepend_PATH (const char* path) ++{ ++ int count = 0; ++ ++ while (environ[count]) ++ { ++ if (strncmp (environ[count], "PATH=", 5)) ++ { ++ count++; ++ continue; ++ } ++ ++ char* const old_path (environ[count]); ++ ++ if (strstr (old_path, path)) return; // path already there ++ ++ size_t const new_path_len(strlen(old_path) + strlen(":") + ++ strlen(path) + 1); ++ ++ char* const new_path (reinterpret_cast(malloc(new_path_len))); ++ ++ if (new_path) ++ { ++ snprintf (new_path, new_path_len, "PATH=%s:%s", path, ++ old_path + strlen("PATH=")); ++ ++ wsrep_PATH.set (new_path); ++ environ[count] = new_path; ++ } ++ else ++ { ++ WSREP_ERROR ("Failed to allocate 'PATH' environment variable " ++ "buffer of size %zu.", new_path_len); ++ } ++ ++ return; ++ } ++ ++ WSREP_ERROR ("Failed to find 'PATH' environment variable. " ++ "State snapshot transfer may not be working."); ++} ++ ++namespace wsp ++{ ++ ++#define PIPE_READ 0 ++#define PIPE_WRITE 1 ++#define STDIN_FD 0 ++#define STDOUT_FD 1 ++ ++#ifndef POSIX_SPAWN_USEVFORK ++# define POSIX_SPAWN_USEVFORK 0 ++#endif ++ ++process::process (const char* cmd, const char* type) ++ : str_(cmd ? strdup(cmd) : strdup("")), io_(NULL), err_(EINVAL), pid_(0) ++{ ++ if (0 == str_) ++ { ++ WSREP_ERROR ("Can't allocate command line of size: %zu", strlen(cmd)); ++ err_ = ENOMEM; ++ return; ++ } ++ ++ if (0 == strlen(str_)) ++ { ++ WSREP_ERROR ("Can't start a process: null or empty command line."); ++ return; ++ } ++ ++ if (NULL == type || (strcmp (type, "w") && strcmp(type, "r"))) ++ { ++ WSREP_ERROR ("type argument should be either \"r\" or \"w\"."); ++ return; ++ } ++ ++ int pipe_fds[2] = { -1, }; ++ if (::pipe(pipe_fds)) ++ { ++ err_ = errno; ++ WSREP_ERROR ("pipe() failed: %d (%s)", err_, strerror(err_)); ++ return; ++ } ++ ++ // which end of pipe will be returned to parent ++ int const parent_end (strcmp(type,"w") ? PIPE_READ : PIPE_WRITE); ++ int const child_end (parent_end == PIPE_READ ? PIPE_WRITE : PIPE_READ); ++ int const close_fd (parent_end == PIPE_READ ? STDOUT_FD : STDIN_FD); ++ ++ char* const pargv[4] = { strdup("sh"), strdup("-c"), strdup(str_), NULL }; ++ if (!(pargv[0] && pargv[1] && pargv[2])) ++ { ++ err_ = ENOMEM; ++ WSREP_ERROR ("Failed to allocate pargv[] array."); ++ goto cleanup_pipe; ++ } ++ ++ posix_spawnattr_t attr; ++ err_ = posix_spawnattr_init (&attr); ++ if (err_) ++ { ++ WSREP_ERROR ("posix_spawnattr_init() failed: %d (%s)", ++ err_, strerror(err_)); ++ goto cleanup_pipe; ++ } ++ ++ /* make sure that no signlas are masked in child process */ ++ sigset_t sigmask_empty; sigemptyset(&sigmask_empty); ++ err_ = posix_spawnattr_setsigmask(&attr, &sigmask_empty); ++ if (err_) ++ { ++ WSREP_ERROR ("posix_spawnattr_setsigmask() failed: %d (%s)", ++ err_, strerror(err_)); ++ goto cleanup_attr; ++ } ++ ++ /* make sure the following signals are not ignored in child process */ ++ sigset_t default_signals; sigemptyset(&default_signals); ++ sigaddset(&default_signals, SIGHUP); ++ sigaddset(&default_signals, SIGINT); ++ sigaddset(&default_signals, SIGQUIT); ++ sigaddset(&default_signals, SIGPIPE); ++ sigaddset(&default_signals, SIGTERM); ++ sigaddset(&default_signals, SIGCHLD); ++ err_ = posix_spawnattr_setsigdefault(&attr, &default_signals); ++ if (err_) ++ { ++ WSREP_ERROR ("posix_spawnattr_setsigdefault() failed: %d (%s)", ++ err_, strerror(err_)); ++ goto cleanup_attr; ++ } ++ ++ err_ = posix_spawnattr_setflags (&attr, POSIX_SPAWN_SETSIGDEF | ++ POSIX_SPAWN_SETSIGMASK | ++ /* start a new process group */ POSIX_SPAWN_SETPGROUP | ++ POSIX_SPAWN_USEVFORK); ++ if (err_) ++ { ++ WSREP_ERROR ("posix_spawnattr_setflags() failed: %d (%s)", ++ err_, strerror(err_)); ++ goto cleanup_attr; ++ } ++ ++ posix_spawn_file_actions_t fact; ++ err_ = posix_spawn_file_actions_init (&fact); ++ if (err_) ++ { ++ WSREP_ERROR ("posix_spawn_file_actions_init() failed: %d (%s)", ++ err_, strerror(err_)); ++ goto cleanup_attr; ++ } ++ ++ // close child's stdout|stdin depending on what we returning ++ err_ = posix_spawn_file_actions_addclose (&fact, close_fd); ++ if (err_) ++ { ++ WSREP_ERROR ("posix_spawn_file_actions_addclose() failed: %d (%s)", ++ err_, strerror(err_)); ++ goto cleanup_fact; ++ } ++ ++ // substitute our pipe descriptor in place of the closed one ++ err_ = posix_spawn_file_actions_adddup2 (&fact, ++ pipe_fds[child_end], close_fd); ++ if (err_) ++ { ++ WSREP_ERROR ("posix_spawn_file_actions_addup2() failed: %d (%s)", ++ err_, strerror(err_)); ++ goto cleanup_fact; ++ } ++ ++ err_ = posix_spawnp (&pid_, pargv[0], &fact, &attr, pargv, environ); ++ if (err_) ++ { ++ WSREP_ERROR ("posix_spawnp(%s) failed: %d (%s)", ++ pargv[2], err_, strerror(err_)); ++ pid_ = 0; // just to make sure it was not messed up in the call ++ goto cleanup_fact; ++ } ++ ++ io_ = fdopen (pipe_fds[parent_end], type); ++ ++ if (io_) ++ { ++ pipe_fds[parent_end] = -1; // skip close on cleanup ++ } ++ else ++ { ++ err_ = errno; ++ WSREP_ERROR ("fdopen() failed: %d (%s)", err_, strerror(err_)); ++ } ++ ++cleanup_fact: ++ int err; // to preserve err_ code ++ err = posix_spawn_file_actions_destroy (&fact); ++ if (err) ++ { ++ WSREP_ERROR ("posix_spawn_file_actions_destroy() failed: %d (%s)\n", ++ err, strerror(err)); ++ } ++ ++cleanup_attr: ++ err = posix_spawnattr_destroy (&attr); ++ if (err) ++ { ++ WSREP_ERROR ("posix_spawnattr_destroy() failed: %d (%s)", ++ err, strerror(err)); ++ } ++ ++cleanup_pipe: ++ if (pipe_fds[0] >= 0) close (pipe_fds[0]); ++ if (pipe_fds[1] >= 0) close (pipe_fds[1]); ++ ++ free (pargv[0]); ++ free (pargv[1]); ++ free (pargv[2]); ++} ++ ++process::~process () ++{ ++ if (io_) ++ { ++ assert (pid_); ++ assert (str_); ++ ++ WSREP_WARN("Closing pipe to child process: %s, PID(%ld) " ++ "which might still be running.", str_, (long)pid_); ++ ++ if (fclose (io_) == -1) ++ { ++ err_ = errno; ++ WSREP_ERROR("fclose() failed: %d (%s)", err_, strerror(err_)); ++ } ++ } ++ ++ if (str_) free (const_cast(str_)); ++} ++ ++int ++process::wait () ++{ ++ if (pid_) ++ { ++ int status; ++ if (-1 == waitpid(pid_, &status, 0)) ++ { ++ err_ = errno; assert (err_); ++ WSREP_ERROR("Waiting for process failed: %s, PID(%ld): %d (%s)", ++ str_, (long)pid_, err_, strerror (err_)); ++ } ++ else ++ { // command completed, check exit status ++ if (WIFEXITED (status)) { ++ err_ = WEXITSTATUS (status); ++ } ++ else { // command didn't complete with exit() ++ WSREP_ERROR("Process was aborted."); ++ err_ = errno ? errno : ECHILD; ++ } ++ ++ if (err_) { ++ switch (err_) /* Translate error codes to more meaningful */ ++ { ++ case 126: err_ = EACCES; break; /* Permission denied */ ++ case 127: err_ = ENOENT; break; /* No such file or directory */ ++ } ++ WSREP_ERROR("Process completed with error: %s: %d (%s)", ++ str_, err_, strerror(err_)); ++ } ++ ++ pid_ = 0; ++ if (io_) fclose (io_); ++ io_ = NULL; ++ } ++ } ++ else { ++ assert (NULL == io_); ++ WSREP_ERROR("Command did not run: %s", str_); ++ } ++ ++ return err_; ++} ++ ++thd::thd (my_bool won) : init(), ptr(new THD) ++{ ++ if (ptr) ++ { ++ ptr->thread_stack= (char*) &ptr; ++ ptr->store_globals(); ++ ptr->variables.option_bits&= ~OPTION_BIN_LOG; // disable binlog ++ ptr->variables.wsrep_on = won; ++ ptr->security_ctx->master_access= ~(ulong)0; ++ lex_start(ptr); ++ } ++} ++ ++thd::~thd () ++{ ++ if (ptr) ++ { ++ delete ptr; ++ my_pthread_setspecific_ptr (THR_THD, 0); ++ } ++} ++ ++} // namespace wsp ++ ++/* Returns INADDR_NONE, INADDR_ANY, INADDR_LOOPBACK or something else */ ++unsigned int wsrep_check_ip (const char* const addr) ++{ ++ if (addr && 0 == strcasecmp(addr, MY_BIND_ALL_ADDRESSES)) return INADDR_ANY; ++ ++ unsigned int ret = INADDR_NONE; ++ struct addrinfo *res, hints; ++ ++ memset (&hints, 0, sizeof(hints)); ++ hints.ai_flags= AI_PASSIVE/*|AI_ADDRCONFIG*/; ++ hints.ai_socktype= SOCK_STREAM; ++ hints.ai_family= AF_UNSPEC; ++ ++ int gai_ret = getaddrinfo(addr, NULL, &hints, &res); ++ if (0 == gai_ret) ++ { ++ if (AF_INET == res->ai_family) /* IPv4 */ ++ { ++ struct sockaddr_in* a= (struct sockaddr_in*)res->ai_addr; ++ ret= htonl(a->sin_addr.s_addr); ++ } ++ else /* IPv6 */ ++ { ++ struct sockaddr_in6* a= (struct sockaddr_in6*)res->ai_addr; ++ if (IN6_IS_ADDR_UNSPECIFIED(&a->sin6_addr)) ++ ret= INADDR_ANY; ++ else if (IN6_IS_ADDR_LOOPBACK(&a->sin6_addr)) ++ ret= INADDR_LOOPBACK; ++ else ++ ret= 0xdeadbeef; ++ } ++ freeaddrinfo (res); ++ } ++ else { ++ WSREP_ERROR ("getaddrinfo() failed on '%s': %d (%s)", ++ addr, gai_ret, gai_strerror(gai_ret)); ++ } ++ ++ // uint8_t* b= (uint8_t*)&ret; ++ // fprintf (stderr, "########## wsrep_check_ip returning: %hhu.%hhu.%hhu.%hhu\n", ++ // b[0], b[1], b[2], b[3]); ++ ++ return ret; ++} ++ ++size_t wsrep_guess_ip (char* buf, size_t buf_len) ++{ ++ size_t ip_len = 0; ++ ++ if (my_bind_addr_str && my_bind_addr_str[0] != '\0') ++ { ++ unsigned int const ip_type= wsrep_check_ip(my_bind_addr_str); ++ ++ if (INADDR_NONE == ip_type) { ++ WSREP_ERROR("Networking not configured, cannot receive state transfer."); ++ return 0; ++ } ++ ++ if (INADDR_ANY != ip_type) { ++ strncpy (buf, my_bind_addr_str, buf_len); ++ return strlen(buf); ++ } ++ } ++ ++ // mysqld binds to all interfaces - try IP from wsrep_node_address ++ if (wsrep_node_address && wsrep_node_address[0] != '\0') { ++ const char* const colon_ptr = strchr(wsrep_node_address, ':'); ++ ++ if (colon_ptr) ++ ip_len = colon_ptr - wsrep_node_address; ++ else ++ ip_len = strlen(wsrep_node_address); ++ ++ if (ip_len >= buf_len) { ++ WSREP_WARN("default_ip(): buffer too short: %zu <= %zd", buf_len, ip_len); ++ return 0; ++ } ++ ++ memcpy (buf, wsrep_node_address, ip_len); ++ buf[ip_len] = '\0'; ++ return ip_len; ++ } ++ ++ ++// ++// getifaddrs() is avaiable at least on Linux since glib 2.3, FreeBSD ++// MAC OS X, opensolaris, Solaris. ++// ++// On platforms which do not support getifaddrs() this function returns ++// a failure and user is prompted to do manual configuration. ++// ++#if HAVE_GETIFADDRS ++ struct ifaddrs *ifaddr, *ifa; ++ if (getifaddrs(&ifaddr) == 0) ++ { ++ for (ifa= ifaddr; ifa != NULL; ifa = ifa->ifa_next) ++ { ++ if (!ifa->ifa_addr || ifa->ifa_addr->sa_family != AF_INET) // TODO AF_INET6 ++ continue; ++ ++ // Skip loopback interfaces (like lo:127.0.0.1) ++ if (ifa->ifa_flags & IFF_LOOPBACK) ++ continue; ++ ++ if (vio_getnameinfo(ifa->ifa_addr, buf, buf_len, NULL, 0, NI_NUMERICHOST)) ++ continue; ++ ++ freeifaddrs(ifaddr); ++ return strlen(buf); ++ } ++ freeifaddrs(ifaddr); ++ } ++#endif // HAVE_GETIFADDRS ++ ++ return 0; ++} ++ ++/* ++ * WSREPXid ++ */ ++ ++#define WSREP_XID_PREFIX "WSREPXid" ++#define WSREP_XID_PREFIX_LEN MYSQL_XID_PREFIX_LEN ++#define WSREP_XID_UUID_OFFSET 8 ++#define WSREP_XID_SEQNO_OFFSET (WSREP_XID_UUID_OFFSET + sizeof(wsrep_uuid_t)) ++#define WSREP_XID_GTRID_LEN (WSREP_XID_SEQNO_OFFSET + sizeof(wsrep_seqno_t)) ++ ++void wsrep_xid_init(XID* xid, const wsrep_uuid_t* uuid, wsrep_seqno_t seqno) ++{ ++ xid->formatID= 1; ++ xid->gtrid_length= WSREP_XID_GTRID_LEN; ++ xid->bqual_length= 0; ++ memset(xid->data, 0, sizeof(xid->data)); ++ memcpy(xid->data, WSREP_XID_PREFIX, WSREP_XID_PREFIX_LEN); ++ memcpy(xid->data + WSREP_XID_UUID_OFFSET, uuid, sizeof(wsrep_uuid_t)); ++ memcpy(xid->data + WSREP_XID_SEQNO_OFFSET, &seqno, sizeof(wsrep_seqno_t)); ++} ++ ++const wsrep_uuid_t* wsrep_xid_uuid(const XID* xid) ++{ ++ if (wsrep_is_wsrep_xid(xid)) ++ return reinterpret_cast(xid->data ++ + WSREP_XID_UUID_OFFSET); ++ else ++ return &WSREP_UUID_UNDEFINED; ++} ++ ++wsrep_seqno_t wsrep_xid_seqno(const XID* xid) ++{ ++ ++ if (wsrep_is_wsrep_xid(xid)) ++ { ++ wsrep_seqno_t seqno; ++ memcpy(&seqno, xid->data + WSREP_XID_SEQNO_OFFSET, sizeof(wsrep_seqno_t)); ++ return seqno; ++ } ++ else ++ { ++ return WSREP_SEQNO_UNDEFINED; ++ } ++} ++ ++extern ++int wsrep_is_wsrep_xid(const void* xid_ptr) ++{ ++ const XID* xid= reinterpret_cast(xid_ptr); ++ return (xid->formatID == 1 && ++ xid->gtrid_length == WSREP_XID_GTRID_LEN && ++ xid->bqual_length == 0 && ++ !memcmp(xid->data, WSREP_XID_PREFIX, WSREP_XID_PREFIX_LEN)); ++} +diff --git a/sql/wsrep_utils.h b/sql/wsrep_utils.h +new file mode 100644 +index 0000000..dfb68bc +--- /dev/null ++++ b/sql/wsrep_utils.h +@@ -0,0 +1,207 @@ ++/* Copyright (C) 2013 Codership Oy ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; version 2 of the License. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License along ++ with this program; if not, write to the Free Software Foundation, Inc., ++ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ ++ ++#ifndef WSREP_UTILS_H ++#define WSREP_UTILS_H ++ ++#include "wsrep_priv.h" ++ ++unsigned int wsrep_check_ip (const char* addr); ++size_t wsrep_guess_ip (char* buf, size_t buf_len); ++ ++namespace wsp { ++class node_status ++{ ++public: ++ node_status() : status(WSREP_MEMBER_UNDEFINED) {} ++ void set(wsrep_member_status_t new_status, ++ const wsrep_view_info_t* view = 0) ++ { ++ if (status != new_status || 0 != view) ++ { ++ wsrep_notify_status(new_status, view); ++ status = new_status; ++ } ++ } ++ wsrep_member_status_t get() const { return status; } ++private: ++ wsrep_member_status_t status; ++}; ++} /* namespace wsp */ ++ ++extern wsp::node_status local_status; ++ ++namespace wsp { ++/* A small class to run external programs. */ ++class process ++{ ++private: ++ const char* const str_; ++ FILE* io_; ++ int err_; ++ pid_t pid_; ++ ++public: ++/*! @arg type is a pointer to a null-terminated string which must contain ++ either the letter 'r' for reading or the letter 'w' for writing. ++ */ ++ process (const char* cmd, const char* type); ++ ~process (); ++ ++ FILE* pipe () { return io_; } ++ int error() { return err_; } ++ int wait (); ++ const char* cmd() { return str_; } ++}; ++ ++class thd ++{ ++ class thd_init ++ { ++ public: ++ thd_init() { my_thread_init(); } ++ ~thd_init() { my_thread_end(); } ++ } ++ init; ++ ++ thd (const thd&); ++ thd& operator= (const thd&); ++ ++public: ++ ++ thd(my_bool wsrep_on); ++ ~thd(); ++ THD* const ptr; ++}; ++ ++class string ++{ ++public: ++ string() : string_(0) {} ++ void set(char* str) { if (string_) free (string_); string_ = str; } ++ ~string() { set (0); } ++private: ++ char* string_; ++}; ++ ++#ifdef REMOVED ++class lock ++{ ++ pthread_mutex_t* const mtx_; ++ ++public: ++ ++ lock (pthread_mutex_t* mtx) : mtx_(mtx) ++ { ++ int err = pthread_mutex_lock (mtx_); ++ ++ if (err) ++ { ++ WSREP_ERROR("Mutex lock failed: %s", strerror(err)); ++ abort(); ++ } ++ } ++ ++ virtual ~lock () ++ { ++ int err = pthread_mutex_unlock (mtx_); ++ ++ if (err) ++ { ++ WSREP_ERROR("Mutex unlock failed: %s", strerror(err)); ++ abort(); ++ } ++ } ++ ++ inline void wait (pthread_cond_t* cond) ++ { ++ pthread_cond_wait (cond, mtx_); ++ } ++ ++private: ++ ++ lock (const lock&); ++ lock& operator=(const lock&); ++ ++}; ++ ++class monitor ++{ ++ int mutable refcnt; ++ pthread_mutex_t mutable mtx; ++ pthread_cond_t mutable cond; ++ ++public: ++ ++ monitor() : refcnt(0) ++ { ++ pthread_mutex_init (&mtx, NULL); ++ pthread_cond_init (&cond, NULL); ++ } ++ ++ ~monitor() ++ { ++ pthread_mutex_destroy (&mtx); ++ pthread_cond_destroy (&cond); ++ } ++ ++ void enter() const ++ { ++ lock l(&mtx); ++ ++ while (refcnt) ++ { ++ l.wait(&cond); ++ } ++ refcnt++; ++ } ++ ++ void leave() const ++ { ++ lock l(&mtx); ++ ++ refcnt--; ++ if (refcnt == 0) ++ { ++ pthread_cond_signal (&cond); ++ } ++ } ++ ++private: ++ ++ monitor (const monitor&); ++ monitor& operator= (const monitor&); ++}; ++ ++class critical ++{ ++ const monitor& mon; ++ ++public: ++ ++ critical(const monitor& m) : mon(m) { mon.enter(); } ++ ++ ~critical() { mon.leave(); } ++ ++private: ++ ++ critical (const critical&); ++ critical& operator= (const critical&); ++}; ++#endif ++ ++} // namespace wsrep ++ ++#endif /* WSREP_UTILS_H */ +diff --git a/sql/wsrep_var.cc b/sql/wsrep_var.cc +new file mode 100644 +index 0000000..0eea405 +--- /dev/null ++++ b/sql/wsrep_var.cc +@@ -0,0 +1,628 @@ ++/* Copyright 2008 Codership Oy ++ ++ 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ ++ ++#include "wsrep_var.h" ++ ++#include ++#include ++#include ++#include ++#include ++#include "wsrep_priv.h" ++#include "wsrep_thd.h" ++#include ++#include ++#include ++ ++#define WSREP_START_POSITION_ZERO "00000000-0000-0000-0000-000000000000:-1" ++#define WSREP_CLUSTER_NAME "my_wsrep_cluster" ++ ++const char* wsrep_provider = 0; ++const char* wsrep_provider_options = 0; ++const char* wsrep_cluster_address = 0; ++const char* wsrep_cluster_name = 0; ++const char* wsrep_node_name = 0; ++const char* wsrep_node_address = 0; ++const char* wsrep_node_incoming_address = 0; ++const char* wsrep_start_position = 0; ++ulong wsrep_OSU_method_options; ++ ++int wsrep_init_vars() ++{ ++ wsrep_provider = my_strdup(WSREP_NONE, MYF(MY_WME)); ++ wsrep_provider_options= my_strdup("", MYF(MY_WME)); ++ wsrep_cluster_address = my_strdup("", MYF(MY_WME)); ++ wsrep_cluster_name = my_strdup(WSREP_CLUSTER_NAME, MYF(MY_WME)); ++ wsrep_node_name = my_strdup("", MYF(MY_WME)); ++ wsrep_node_address = my_strdup("", MYF(MY_WME)); ++ wsrep_node_incoming_address= my_strdup(WSREP_NODE_INCOMING_AUTO, MYF(MY_WME)); ++ wsrep_start_position = my_strdup(WSREP_START_POSITION_ZERO, MYF(MY_WME)); ++ ++ global_system_variables.binlog_format=BINLOG_FORMAT_ROW; ++ return 0; ++} ++ ++bool wsrep_on_update (sys_var *self, THD* thd, enum_var_type var_type) ++{ ++ if (var_type == OPT_GLOBAL) { ++ // FIXME: this variable probably should be changed only per session ++ thd->variables.wsrep_on = global_system_variables.wsrep_on; ++ } ++ return false; ++} ++ ++bool wsrep_causal_reads_update (sys_var *self, THD* thd, enum_var_type var_type) ++{ ++ // global setting should not affect session setting. ++ // if (var_type == OPT_GLOBAL) { ++ // thd->variables.wsrep_causal_reads = global_system_variables.wsrep_causal_reads; ++ // } ++ if (thd->variables.wsrep_causal_reads) { ++ thd->variables.wsrep_sync_wait |= WSREP_SYNC_WAIT_BEFORE_READ; ++ } else { ++ thd->variables.wsrep_sync_wait &= ~WSREP_SYNC_WAIT_BEFORE_READ; ++ } ++ ++ // update global settings too. ++ if (global_system_variables.wsrep_causal_reads) { ++ global_system_variables.wsrep_sync_wait |= WSREP_SYNC_WAIT_BEFORE_READ; ++ } else { ++ global_system_variables.wsrep_sync_wait &= ~WSREP_SYNC_WAIT_BEFORE_READ; ++ } ++ return false; ++} ++ ++bool wsrep_sync_wait_update (sys_var* self, THD* thd, enum_var_type var_type) ++{ ++ // global setting should not affect session setting. ++ // if (var_type == OPT_GLOBAL) { ++ // thd->variables.wsrep_sync_wait = global_system_variables.wsrep_sync_wait; ++ // } ++ thd->variables.wsrep_causal_reads = thd->variables.wsrep_sync_wait & ++ WSREP_SYNC_WAIT_BEFORE_READ; ++ ++ // update global settings too ++ global_system_variables.wsrep_causal_reads = global_system_variables.wsrep_sync_wait & ++ WSREP_SYNC_WAIT_BEFORE_READ; ++ return false; ++} ++ ++static int wsrep_start_position_verify (const char* start_str) ++{ ++ size_t start_len; ++ wsrep_uuid_t uuid; ++ ssize_t uuid_len; ++ ++ start_len = strlen (start_str); ++ if (start_len < 34) ++ return 1; ++ ++ uuid_len = wsrep_uuid_scan (start_str, start_len, &uuid); ++ if (uuid_len < 0 || (start_len - uuid_len) < 2) ++ return 1; ++ ++ if (start_str[uuid_len] != ':') // separator should follow UUID ++ return 1; ++ ++ char* endptr; ++ wsrep_seqno_t const seqno __attribute__((unused)) // to avoid GCC warnings ++ (strtoll(&start_str[uuid_len + 1], &endptr, 10)); ++ ++ if (*endptr == '\0') return 0; // remaining string was seqno ++ ++ return 1; ++} ++ ++bool wsrep_start_position_check (sys_var *self, THD* thd, set_var* var) ++{ ++ char buff[FN_REFLEN]; ++ String str(buff, sizeof(buff), system_charset_info), *res; ++ const char* start_str = NULL; ++ ++ if (!(res = var->value->val_str(&str))) goto err; ++ ++ start_str = res->c_ptr(); ++ ++ if (!start_str) goto err; ++ ++ if (!wsrep_start_position_verify(start_str)) return 0; ++ ++err: ++ ++ my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), var->var->name.str, ++ start_str ? start_str : "NULL"); ++ return 1; ++} ++ ++void wsrep_set_local_position (const char* value) ++{ ++ size_t value_len = strlen (value); ++ size_t uuid_len = wsrep_uuid_scan (value, value_len, &local_uuid); ++ ++ local_seqno = strtoll (value + uuid_len + 1, NULL, 10); ++ ++ XID xid; ++ wsrep_xid_init(&xid, &local_uuid, local_seqno); ++ wsrep_set_SE_checkpoint(&xid); ++ WSREP_INFO ("wsrep_start_position var submitted: '%s'", wsrep_start_position); ++} ++ ++bool wsrep_start_position_update (sys_var *self, THD* thd, enum_var_type type) ++{ ++ // since this value passed wsrep_start_position_check, don't check anything ++ // here ++ wsrep_set_local_position (wsrep_start_position); ++ ++ if (wsrep) { ++ wsrep_sst_received (wsrep, &local_uuid, local_seqno, NULL, 0); ++ } ++ ++ return 0; ++} ++ ++void wsrep_start_position_init (const char* val) ++{ ++ if (NULL == val || wsrep_start_position_verify (val)) ++ { ++ WSREP_ERROR("Bad initial value for wsrep_start_position: %s", ++ (val ? val : "")); ++ return; ++ } ++ ++ wsrep_set_local_position (val); ++} ++ ++static bool refresh_provider_options() ++{ ++ WSREP_DEBUG("refresh_provider_options: %s", ++ (wsrep_provider_options) ? wsrep_provider_options : "null"); ++ char* opts= wsrep->options_get(wsrep); ++ if (opts) ++ { ++ if (wsrep_provider_options) my_free((void *)wsrep_provider_options); ++ wsrep_provider_options = (char*)my_memdup(opts, strlen(opts) + 1, ++ MYF(MY_WME)); ++ } ++ else ++ { ++ WSREP_ERROR("Failed to get provider options"); ++ return true; ++ } ++ return false; ++} ++ ++static int wsrep_provider_verify (const char* provider_str) ++{ ++ MY_STAT f_stat; ++ char path[FN_REFLEN]; ++ ++ if (!provider_str || strlen(provider_str)== 0) ++ return 1; ++ ++ if (!strcmp(provider_str, WSREP_NONE)) ++ return 0; ++ ++ if (!unpack_filename(path, provider_str)) ++ return 1; ++ ++ /* check that provider file exists */ ++ memset(&f_stat, 0, sizeof(MY_STAT)); ++ if (!my_stat(path, &f_stat, MYF(0))) ++ { ++ return 1; ++ } ++ return 0; ++} ++ ++bool wsrep_provider_check (sys_var *self, THD* thd, set_var* var) ++{ ++ char buff[FN_REFLEN]; ++ String str(buff, sizeof(buff), system_charset_info), *res; ++ const char* provider_str = NULL; ++ ++ if (!(res = var->value->val_str(&str))) goto err; ++ ++ provider_str = res->c_ptr(); ++ ++ if (!provider_str) goto err; ++ ++ if (!wsrep_provider_verify(provider_str)) return 0; ++ ++err: ++ ++ my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), var->var->name.str, ++ provider_str ? provider_str : "NULL"); ++ return 1; ++} ++ ++bool wsrep_provider_update (sys_var *self, THD* thd, enum_var_type type) ++{ ++ bool rcode= false; ++ ++ bool wsrep_on_saved= thd->variables.wsrep_on; ++ thd->variables.wsrep_on= false; ++ ++ WSREP_DEBUG("wsrep_provider_update: %s", wsrep_provider); ++ ++ /* stop replication is heavy operation, and includes closing all client ++ connections. Closing clients may need to get LOCK_global_system_variables ++ at least in MariaDB. ++ ++ Note: releasing LOCK_global_system_variables may cause race condition, if ++ there can be several concurrent clients changing wsrep_provider ++ */ ++ mysql_mutex_unlock(&LOCK_global_system_variables); ++ wsrep_stop_replication(thd); ++ mysql_mutex_lock(&LOCK_global_system_variables); ++ ++ wsrep_deinit(); ++ ++ char* tmp= strdup(wsrep_provider); // wsrep_init() rewrites provider ++ //when fails ++ if (wsrep_init()) ++ { ++ my_error(ER_CANT_OPEN_LIBRARY, MYF(0), tmp); ++ rcode = true; ++ } ++ free(tmp); ++ ++ // we sure don't want to use old address with new provider ++ wsrep_cluster_address_init(NULL); ++ wsrep_provider_options_init(NULL); ++ ++ thd->variables.wsrep_on= wsrep_on_saved; ++ ++ refresh_provider_options(); ++ ++ return rcode; ++} ++ ++void wsrep_provider_init (const char* value) ++{ ++ WSREP_DEBUG("wsrep_provider_init: %s -> %s", ++ (wsrep_provider) ? wsrep_provider : "null", ++ (value) ? value : "null"); ++ if (NULL == value || wsrep_provider_verify (value)) ++ { ++ WSREP_ERROR("Bad initial value for wsrep_provider: %s", ++ (value ? value : "")); ++ return; ++ } ++ ++ if (wsrep_provider) my_free((void *)wsrep_provider); ++ wsrep_provider = my_strdup(value, MYF(0)); ++} ++ ++bool wsrep_provider_options_check(sys_var *self, THD* thd, set_var* var) ++{ ++ return 0; ++} ++ ++bool wsrep_provider_options_update(sys_var *self, THD* thd, enum_var_type type) ++{ ++ wsrep_status_t ret= wsrep->options_set(wsrep, wsrep_provider_options); ++ if (ret != WSREP_OK) ++ { ++ WSREP_ERROR("Set options returned %d", ret); ++ refresh_provider_options(); ++ return true; ++ } ++ return refresh_provider_options(); ++} ++ ++void wsrep_provider_options_init(const char* value) ++{ ++ if (wsrep_provider_options && wsrep_provider_options != value) ++ my_free((void *)wsrep_provider_options); ++ wsrep_provider_options = (value) ? my_strdup(value, MYF(0)) : NULL; ++} ++ ++static int wsrep_cluster_address_verify (const char* cluster_address_str) ++{ ++ /* There is no predefined address format, it depends on provider. */ ++ return 0; ++} ++ ++bool wsrep_cluster_address_check (sys_var *self, THD* thd, set_var* var) ++{ ++ char buff[FN_REFLEN]; ++ String str(buff, sizeof(buff), system_charset_info), *res; ++ const char* cluster_address_str = NULL; ++ ++ if (!(res = var->value->val_str(&str))) goto err; ++ ++ cluster_address_str = res->c_ptr(); ++ ++ if (!wsrep_cluster_address_verify(cluster_address_str)) return 0; ++ ++ err: ++ ++ my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), var->var->name.str, ++ cluster_address_str ? cluster_address_str : "NULL"); ++ return 1 ; ++} ++ ++bool wsrep_cluster_address_update (sys_var *self, THD* thd, enum_var_type type) ++{ ++ bool wsrep_on_saved= thd->variables.wsrep_on; ++ thd->variables.wsrep_on= false; ++ ++ /* stop replication is heavy operation, and includes closing all client ++ connections. Closing clients may need to get LOCK_global_system_variables ++ at least in MariaDB. ++ ++ Note: releasing LOCK_global_system_variables may cause race condition, if ++ there can be several concurrent clients changing wsrep_provider ++ */ ++ mysql_mutex_unlock(&LOCK_global_system_variables); ++ wsrep_stop_replication(thd); ++ mysql_mutex_lock(&LOCK_global_system_variables); ++ ++ if (wsrep_start_replication()) ++ { ++ wsrep_create_rollbacker(); ++ wsrep_create_appliers(wsrep_slave_threads); ++ } ++ ++ thd->variables.wsrep_on= wsrep_on_saved; ++ ++ return false; ++} ++ ++void wsrep_cluster_address_init (const char* value) ++{ ++ WSREP_DEBUG("wsrep_cluster_address_init: %s -> %s", ++ (wsrep_cluster_address) ? wsrep_cluster_address : "null", ++ (value) ? value : "null"); ++ ++ if (wsrep_cluster_address) my_free ((void*)wsrep_cluster_address); ++ wsrep_cluster_address = (value) ? my_strdup(value, MYF(0)) : NULL; ++} ++ ++bool wsrep_cluster_name_check (sys_var *self, THD* thd, set_var* var) ++{ ++ char buff[FN_REFLEN]; ++ String str(buff, sizeof(buff), system_charset_info), *res; ++ const char* cluster_name_str = NULL; ++ ++ if (!(res = var->value->val_str(&str))) goto err; ++ ++ cluster_name_str = res->c_ptr(); ++ ++ if (!cluster_name_str || strlen(cluster_name_str) == 0) goto err; ++ ++ return 0; ++ ++ err: ++ ++ my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), var->var->name.str, ++ cluster_name_str ? cluster_name_str : "NULL"); ++ return 1; ++} ++ ++bool wsrep_cluster_name_update (sys_var *self, THD* thd, enum_var_type type) ++{ ++ return 0; ++} ++ ++bool wsrep_node_name_check (sys_var *self, THD* thd, set_var* var) ++{ ++ char buff[FN_REFLEN]; ++ String str(buff, sizeof(buff), system_charset_info), *res; ++ const char* node_name_str = NULL; ++ ++ if (!(res = var->value->val_str(&str))) goto err; ++ ++ node_name_str = res->c_ptr(); ++ ++ if (!node_name_str || strlen(node_name_str) == 0) goto err; ++ ++ return 0; ++ ++ err: ++ ++ my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), var->var->name.str, ++ node_name_str ? node_name_str : "NULL"); ++ return 1; ++} ++ ++bool wsrep_node_name_update (sys_var *self, THD* thd, enum_var_type type) ++{ ++ return 0; ++} ++ ++// TODO: do something more elaborate, like checking connectivity ++bool wsrep_node_address_check (sys_var *self, THD* thd, set_var* var) ++{ ++ char buff[FN_REFLEN]; ++ String str(buff, sizeof(buff), system_charset_info), *res; ++ const char* node_address_str = NULL; ++ ++ if (!(res = var->value->val_str(&str))) goto err; ++ ++ node_address_str = res->c_ptr(); ++ ++ if (!node_address_str || strlen(node_address_str) == 0) goto err; ++ ++ return 0; ++ ++ err: ++ ++ my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), var->var->name.str, ++ node_address_str ? node_address_str : "NULL"); ++ return 1; ++} ++ ++bool wsrep_node_address_update (sys_var *self, THD* thd, enum_var_type type) ++{ ++ return 0; ++} ++ ++void wsrep_node_address_init (const char* value) ++{ ++ if (wsrep_node_address && strcmp(wsrep_node_address, value)) ++ my_free ((void*)wsrep_node_address); ++ ++ wsrep_node_address = (value) ? my_strdup(value, MYF(0)) : NULL; ++} ++ ++bool wsrep_slave_threads_check (sys_var *self, THD* thd, set_var* var) ++{ ++ mysql_mutex_lock(&LOCK_wsrep_slave_threads); ++ wsrep_slave_count_change = var->value->val_int() - wsrep_slave_threads; ++ mysql_mutex_unlock(&LOCK_wsrep_slave_threads); ++ ++ return 0; ++} ++ ++bool wsrep_slave_threads_update (sys_var *self, THD* thd, enum_var_type type) ++{ ++ if (wsrep_slave_count_change > 0) ++ { ++ wsrep_create_appliers(wsrep_slave_count_change); ++ wsrep_slave_count_change = 0; ++ } ++ return false; ++} ++ ++bool wsrep_desync_check (sys_var *self, THD* thd, set_var* var) ++{ ++ bool new_wsrep_desync = var->value->val_bool(); ++ if (wsrep_desync == new_wsrep_desync) { ++ if (new_wsrep_desync) { ++ push_warning (thd, Sql_condition::WARN_LEVEL_WARN, ++ ER_WRONG_VALUE_FOR_VAR, ++ "'wsrep_desync' is already ON."); ++ } else { ++ push_warning (thd, Sql_condition::WARN_LEVEL_WARN, ++ ER_WRONG_VALUE_FOR_VAR, ++ "'wsrep_desync' is already OFF."); ++ } ++ } ++ return 0; ++} ++ ++bool wsrep_desync_update (sys_var *self, THD* thd, enum_var_type type) ++{ ++ wsrep_status_t ret(WSREP_WARNING); ++ if (wsrep_desync) { ++ ret = wsrep->desync (wsrep); ++ if (ret != WSREP_OK) { ++ WSREP_WARN ("SET desync failed %d for %s", ret, thd->query()); ++ my_error (ER_CANNOT_USER, MYF(0), "'desync'", thd->query()); ++ return true; ++ } ++ } else { ++ ret = wsrep->resync (wsrep); ++ if (ret != WSREP_OK) { ++ WSREP_WARN ("SET resync failed %d for %s", ret, thd->query()); ++ my_error (ER_CANNOT_USER, MYF(0), "'resync'", thd->query()); ++ return true; ++ } ++ } ++ return false; ++} ++ ++/* ++ * Status variables stuff below ++ */ ++static inline void ++wsrep_assign_to_mysql (SHOW_VAR* mysql, wsrep_stats_var* wsrep) ++{ ++ mysql->name = wsrep->name; ++ switch (wsrep->type) { ++ case WSREP_VAR_INT64: ++ mysql->value = (char*) &wsrep->value._int64; ++ mysql->type = SHOW_LONGLONG; ++ break; ++ case WSREP_VAR_STRING: ++ mysql->value = (char*) &wsrep->value._string; ++ mysql->type = SHOW_CHAR_PTR; ++ break; ++ case WSREP_VAR_DOUBLE: ++ mysql->value = (char*) &wsrep->value._double; ++ mysql->type = SHOW_DOUBLE; ++ break; ++ } ++} ++ ++#if DYNAMIC ++// somehow this mysql status thing works only with statically allocated arrays. ++static SHOW_VAR* mysql_status_vars = NULL; ++static int mysql_status_len = -1; ++#else ++static SHOW_VAR mysql_status_vars[512 + 1]; ++static const int mysql_status_len = 512; ++#endif ++ ++static void export_wsrep_status_to_mysql(THD* thd) ++{ ++ int wsrep_status_len, i; ++ ++ thd->wsrep_status_vars = wsrep->stats_get(wsrep); ++ ++ if (!thd->wsrep_status_vars) { ++ return; ++ } ++ ++ for (wsrep_status_len = 0; ++ thd->wsrep_status_vars[wsrep_status_len].name != NULL; ++ wsrep_status_len++) { ++ /* */ ++ } ++ ++#if DYNAMIC ++ if (wsrep_status_len != mysql_status_len) { ++ void* tmp = realloc (mysql_status_vars, ++ (wsrep_status_len + 1) * sizeof(SHOW_VAR)); ++ if (!tmp) { ++ ++ sql_print_error ("Out of memory for wsrep status variables." ++ "Number of variables: %d", wsrep_status_len); ++ return; ++ } ++ ++ mysql_status_len = wsrep_status_len; ++ mysql_status_vars = (SHOW_VAR*)tmp; ++ } ++ /* @TODO: fix this: */ ++#else ++ if (mysql_status_len < wsrep_status_len) wsrep_status_len= mysql_status_len; ++#endif ++ ++ for (i = 0; i < wsrep_status_len; i++) ++ wsrep_assign_to_mysql (mysql_status_vars + i, thd->wsrep_status_vars + i); ++ ++ mysql_status_vars[wsrep_status_len].name = NullS; ++ mysql_status_vars[wsrep_status_len].value = NullS; ++ mysql_status_vars[wsrep_status_len].type = SHOW_LONG; ++} ++ ++int wsrep_show_status (THD *thd, SHOW_VAR *var, char *buff) ++{ ++ export_wsrep_status_to_mysql(thd); ++ var->type= SHOW_ARRAY; ++ var->value= (char *) &mysql_status_vars; ++ return 0; ++} ++ ++void wsrep_free_status (THD* thd) ++{ ++ if (thd->wsrep_status_vars) ++ { ++ wsrep->stats_free (wsrep, thd->wsrep_status_vars); ++ thd->wsrep_status_vars = 0; ++ } ++} +diff --git a/sql/wsrep_var.h b/sql/wsrep_var.h +new file mode 100644 +index 0000000..d845987 +--- /dev/null ++++ b/sql/wsrep_var.h +@@ -0,0 +1,84 @@ ++/* Copyright (C) 2013 Codership Oy ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; version 2 of the License. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License along ++ with this program; if not, write to the Free Software Foundation, Inc., ++ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ ++ ++#ifndef WSREP_VAR_H ++#define WSREP_VAR_H ++ ++#define WSREP_NODE_INCOMING_AUTO "AUTO" ++ ++// MySQL variables funcs ++ ++#include "sql_priv.h" ++class sys_var; ++class set_var; ++class THD; ++ ++int wsrep_init_vars(); ++ ++#define CHECK_ARGS (sys_var *self, THD* thd, set_var *var) ++#define UPDATE_ARGS (sys_var *self, THD* thd, enum_var_type type) ++#define DEFAULT_ARGS (THD* thd, enum_var_type var_type) ++#define INIT_ARGS (const char* opt) ++ ++extern bool wsrep_on_update UPDATE_ARGS; ++extern bool wsrep_causal_reads_update UPDATE_ARGS; ++extern bool wsrep_sync_wait_update UPDATE_ARGS; ++extern bool wsrep_start_position_check CHECK_ARGS; ++extern bool wsrep_start_position_update UPDATE_ARGS; ++extern void wsrep_start_position_init INIT_ARGS; ++ ++extern bool wsrep_provider_check CHECK_ARGS; ++extern bool wsrep_provider_update UPDATE_ARGS; ++extern void wsrep_provider_init INIT_ARGS; ++ ++extern bool wsrep_provider_options_check CHECK_ARGS; ++extern bool wsrep_provider_options_update UPDATE_ARGS; ++extern void wsrep_provider_options_init INIT_ARGS; ++ ++extern bool wsrep_cluster_address_check CHECK_ARGS; ++extern bool wsrep_cluster_address_update UPDATE_ARGS; ++extern void wsrep_cluster_address_init INIT_ARGS; ++ ++extern bool wsrep_cluster_name_check CHECK_ARGS; ++extern bool wsrep_cluster_name_update UPDATE_ARGS; ++ ++extern bool wsrep_node_name_check CHECK_ARGS; ++extern bool wsrep_node_name_update UPDATE_ARGS; ++ ++extern bool wsrep_node_address_check CHECK_ARGS; ++extern bool wsrep_node_address_update UPDATE_ARGS; ++extern void wsrep_node_address_init INIT_ARGS; ++ ++extern bool wsrep_sst_method_check CHECK_ARGS; ++extern bool wsrep_sst_method_update UPDATE_ARGS; ++extern void wsrep_sst_method_init INIT_ARGS; ++ ++extern bool wsrep_sst_receive_address_check CHECK_ARGS; ++extern bool wsrep_sst_receive_address_update UPDATE_ARGS; ++ ++extern bool wsrep_sst_auth_check CHECK_ARGS; ++extern bool wsrep_sst_auth_update UPDATE_ARGS; ++extern void wsrep_sst_auth_init INIT_ARGS; ++ ++extern bool wsrep_sst_donor_check CHECK_ARGS; ++extern bool wsrep_sst_donor_update UPDATE_ARGS; ++ ++extern bool wsrep_slave_threads_check CHECK_ARGS; ++extern bool wsrep_slave_threads_update UPDATE_ARGS; ++ ++extern bool wsrep_desync_check CHECK_ARGS; ++extern bool wsrep_desync_update UPDATE_ARGS; ++ ++#endif /* WSREP_VAR_H */ +diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc +index 1611fb6..392c9e3 100644 +--- a/storage/innobase/btr/btr0cur.cc ++++ b/storage/innobase/btr/btr0cur.cc +@@ -2946,7 +2946,9 @@ btr_cur_del_mark_set_clust_rec( + #endif /* UNIV_DEBUG */ + + ut_ad(dict_index_is_clust(index)); ++#ifndef WITH_WSREP + ut_ad(!rec_get_deleted_flag(rec, rec_offs_comp(offsets))); ++#endif + + err = lock_clust_rec_modify_check_and_lock(BTR_NO_LOCKING_FLAG, block, + rec, index, offsets, thr); +diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc +index 8045389..fb5dcae 100644 +--- a/storage/innobase/dict/dict0dict.cc ++++ b/storage/innobase/dict/dict0dict.cc +@@ -3347,7 +3347,29 @@ dict_foreign_find_index( + + return(NULL); + } +- ++#ifdef WITH_WSREP ++dict_index_t* ++wsrep_dict_foreign_find_index( ++/*====================*/ ++ dict_table_t* table, /*!< in: table */ ++ const char** col_names, /*!< in: column names, or NULL ++ to use table->col_names */ ++ const char** columns,/*!< in: array of column names */ ++ ulint n_cols, /*!< in: number of columns */ ++ dict_index_t* types_idx, /*!< in: NULL or an index to whose types the ++ column types must match */ ++ ibool check_charsets, ++ /*!< in: whether to check charsets. ++ only has an effect if types_idx != NULL */ ++ ulint check_null) ++ /*!< in: nonzero if none of the columns must ++ be declared NOT NULL */ ++{ ++ return dict_foreign_find_index( ++ table, col_names, columns, n_cols, types_idx, check_charsets, ++ check_null); ++} ++#endif /* WITH_WSREP */ + /**********************************************************************//** + Report an error in a foreign key definition. */ + static +diff --git a/storage/innobase/fts/fts0opt.cc b/storage/innobase/fts/fts0opt.cc +index 5891b53..2e2bd06 100644 +--- a/storage/innobase/fts/fts0opt.cc ++++ b/storage/innobase/fts/fts0opt.cc +@@ -2577,6 +2577,8 @@ fts_optimize_add_table( + return; + } + ++ ut_ad(table->cached && table->fts != NULL); ++ + /* Make sure table with FTS index cannot be evicted */ + if (table->can_be_evicted) { + dict_table_move_from_lru_to_non_lru(table); +diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc +index b8f6351..b54ab75 100644 +--- a/storage/innobase/handler/ha_innodb.cc ++++ b/storage/innobase/handler/ha_innodb.cc +@@ -95,6 +95,9 @@ this program; if not, write to the Free Software Foundation, Inc., + #include "fts0priv.h" + #include "page0zip.h" + ++#ifdef WITH_WSREP ++#include "dict0priv.h" ++#endif /* WITH_WSREP */ + enum_tx_isolation thd_get_trx_isolation(const THD* thd); + + #include "ha_innodb.h" +@@ -103,6 +106,35 @@ enum_tx_isolation thd_get_trx_isolation(const THD* thd); + # ifndef MYSQL_PLUGIN_IMPORT + # define MYSQL_PLUGIN_IMPORT /* nothing */ + # endif /* MYSQL_PLUGIN_IMPORT */ ++#ifdef WITH_WSREP ++#include "../storage/innobase/include/ut0byte.h" ++#include ++#include ++extern my_bool wsrep_certify_nonPK; ++class binlog_trx_data; ++extern handlerton *binlog_hton; ++ ++extern MYSQL_PLUGIN_IMPORT mysql_mutex_t LOCK_wsrep_rollback; ++extern MYSQL_PLUGIN_IMPORT mysql_cond_t COND_wsrep_rollback; ++extern MYSQL_PLUGIN_IMPORT wsrep_aborting_thd_t wsrep_aborting_thd; ++ ++static inline wsrep_ws_handle_t* ++wsrep_ws_handle(THD* thd, const trx_t* trx) { ++ return wsrep_ws_handle_for_trx(wsrep_thd_ws_handle(thd), ++ (wsrep_trx_id_t)trx->id); ++} ++ ++extern bool wsrep_prepare_key_for_innodb(const uchar *cache_key, ++ size_t cache_key_len, ++ const uchar* row_id, ++ size_t row_id_len, ++ wsrep_buf_t* key, ++ size_t* key_len); ++ ++extern handlerton * wsrep_hton; ++extern TC_LOG* tc_log; ++extern void wsrep_cleanup_transaction(THD *thd); ++#endif /* WITH_WSREP */ + + /** to protect innobase_open_files */ + static mysql_mutex_t innobase_share_mutex; +@@ -1152,6 +1184,10 @@ innobase_srv_conc_enter_innodb( + /*===========================*/ + trx_t* trx) /*!< in: transaction handle */ + { ++#ifdef WITH_WSREP ++ if (wsrep_on(trx->mysql_thd) && ++ wsrep_thd_is_BF(trx->mysql_thd, FALSE)) return; ++#endif /* WITH_WSREP */ + if (srv_thread_concurrency) { + if (trx->n_tickets_to_enter_innodb > 0) { + +@@ -1186,6 +1222,10 @@ innobase_srv_conc_exit_innodb( + #ifdef UNIV_SYNC_DEBUG + ut_ad(!sync_thread_levels_nonempty_trx(trx->has_search_latch)); + #endif /* UNIV_SYNC_DEBUG */ ++#ifdef WITH_WSREP ++ if (wsrep_on(trx->mysql_thd) && ++ wsrep_thd_is_BF(trx->mysql_thd, FALSE)) return; ++#endif /* WITH_WSREP */ + + /* This is to avoid making an unnecessary function call. */ + if (trx->declared_to_be_inside_innodb +@@ -1306,6 +1346,15 @@ thd_to_trx( + { + return(*(trx_t**) thd_ha_data(thd, innodb_hton_ptr)); + } ++#ifdef WITH_WSREP ++ulonglong ++thd_to_trx_id( ++/*=======*/ ++ THD* thd) /*!< in: MySQL thread */ ++{ ++ return(thd_to_trx(thd)->id); ++} ++#endif + + /********************************************************************//** + Call this function when mysqld passes control to the client. That is to +@@ -1335,6 +1384,15 @@ innobase_release_temporary_latches( + return(0); + } + ++#ifdef WITH_WSREP ++static int ++wsrep_abort_transaction(handlerton* hton, THD *bf_thd, THD *victim_thd, ++ my_bool signal); ++static void ++wsrep_fake_trx_id(handlerton* hton, THD *thd); ++static int innobase_wsrep_set_checkpoint(handlerton* hton, const XID* xid); ++static int innobase_wsrep_get_checkpoint(handlerton* hton, XID* xid); ++#endif + /********************************************************************//** + Increments innobase_active_counter and every INNOBASE_WAKE_INTERVALth + time calls srv_active_wake_master_thread. This function should be used +@@ -1800,6 +1858,9 @@ int + innobase_mysql_tmpfile(void) + /*========================*/ + { ++#ifdef WITH_INNODB_DISALLOW_WRITES ++ os_event_wait(srv_allow_writes_event); ++#endif /* WITH_INNODB_DISALLOW_WRITES */ + int fd2 = -1; + File fd; + +@@ -2844,6 +2905,12 @@ innobase_init( + innobase_release_temporary_latches; + + innobase_hton->data = &innodb_api_cb; ++#ifdef WITH_WSREP ++ innobase_hton->wsrep_abort_transaction=wsrep_abort_transaction; ++ innobase_hton->wsrep_set_checkpoint=innobase_wsrep_set_checkpoint; ++ innobase_hton->wsrep_get_checkpoint=innobase_wsrep_get_checkpoint; ++ innobase_hton->wsrep_fake_trx_id=wsrep_fake_trx_id; ++#endif /* WITH_WSREP */ + + ut_a(DATA_MYSQL_TRUE_VARCHAR == (ulint)MYSQL_TYPE_VARCHAR); + +@@ -3407,10 +3474,30 @@ innobase_commit_low( + /*================*/ + trx_t* trx) /*!< in: transaction handle */ + { ++#ifdef WITH_WSREP ++ THD* thd = (THD*)trx->mysql_thd; ++ const char* tmp = 0; ++ if (wsrep_on((void*)thd)) { ++#ifdef WSREP_PROC_INFO ++ char info[64]; ++ info[sizeof(info) - 1] = '\0'; ++ snprintf(info, sizeof(info) - 1, ++ "innobase_commit_low():trx_commit_for_mysql(%lld)", ++ (long long) wsrep_thd_trx_seqno(thd)); ++ tmp = thd_proc_info(thd, info); ++ ++#else ++ tmp = thd_proc_info(thd, "innobase_commit_low()"); ++#endif /* WSREP_PROC_INFO */ ++ } ++#endif /* WITH_WSREP */ + if (trx_is_started(trx)) { + + trx_commit_for_mysql(trx); + } ++#ifdef WITH_WSREP ++ if (wsrep_on((void*)thd)) { thd_proc_info(thd, tmp); } ++#endif /* WITH_WSREP */ + } + + /*****************************************************************//** +@@ -4063,7 +4150,11 @@ ha_innobase::max_supported_key_length() const + case 8192: + return(1536); + default: ++#ifdef WITH_WSREP ++ return(3500); ++#else + return(3500); ++#endif + } + } + +@@ -5163,6 +5254,112 @@ get_field_offset( + { + return((uint) (field->ptr - table->record[0])); + } ++#ifdef WITH_WSREP ++UNIV_INTERN ++int ++wsrep_innobase_mysql_sort( ++/*===============*/ ++ /* out: str contains sort string */ ++ int mysql_type, /* in: MySQL type */ ++ uint charset_number, /* in: number of the charset */ ++ unsigned char* str, /* in: data field */ ++ unsigned int str_length, /* in: data field length, ++ not UNIV_SQL_NULL */ ++ unsigned int buf_length) /* in: total str buffer length */ ++ ++{ ++ CHARSET_INFO* charset; ++ enum_field_types mysql_tp; ++ int ret_length = str_length; ++ ++ DBUG_ASSERT(str_length != UNIV_SQL_NULL); ++ ++ mysql_tp = (enum_field_types) mysql_type; ++ ++ switch (mysql_tp) { ++ ++ case MYSQL_TYPE_BIT: ++ case MYSQL_TYPE_STRING: ++ case MYSQL_TYPE_VAR_STRING: ++ case MYSQL_TYPE_TINY_BLOB: ++ case MYSQL_TYPE_MEDIUM_BLOB: ++ case MYSQL_TYPE_BLOB: ++ case MYSQL_TYPE_LONG_BLOB: ++ case MYSQL_TYPE_VARCHAR: ++ { ++ uchar tmp_str[REC_VERSION_56_MAX_INDEX_COL_LEN] = {'\0'}; ++ uint tmp_length = REC_VERSION_56_MAX_INDEX_COL_LEN; ++ ++ /* Use the charset number to pick the right charset struct for ++ the comparison. Since the MySQL function get_charset may be ++ slow before Bar removes the mutex operation there, we first ++ look at 2 common charsets directly. */ ++ ++ if (charset_number == default_charset_info->number) { ++ charset = default_charset_info; ++ } else if (charset_number == my_charset_latin1.number) { ++ charset = &my_charset_latin1; ++ } else { ++ charset = get_charset(charset_number, MYF(MY_WME)); ++ ++ if (charset == NULL) { ++ sql_print_error("InnoDB needs charset %lu for doing " ++ "a comparison, but MySQL cannot " ++ "find that charset.", ++ (ulong) charset_number); ++ ut_a(0); ++ } ++ } ++ ++ ut_a(str_length <= tmp_length); ++ memcpy(tmp_str, str, str_length); ++ ++ if (wsrep_protocol_version < 3) { ++ tmp_length = charset->coll->strnxfrm( ++ charset, str, str_length, ++ str_length, tmp_str, tmp_length, 0); ++ DBUG_ASSERT(tmp_length <= str_length); ++ } else { ++ /* strnxfrm will expand the destination string, ++ protocols < 3 truncated the sorted sring ++ protocols >= 3 gets full sorted sring ++ */ ++ tmp_length = charset->coll->strnxfrm( ++ charset, str, buf_length, ++ str_length, tmp_str, str_length, 0); ++ DBUG_ASSERT(tmp_length <= buf_length); ++ ret_length = tmp_length; ++ } ++ ++ break; ++ } ++ case MYSQL_TYPE_DECIMAL : ++ case MYSQL_TYPE_TINY : ++ case MYSQL_TYPE_SHORT : ++ case MYSQL_TYPE_LONG : ++ case MYSQL_TYPE_FLOAT : ++ case MYSQL_TYPE_DOUBLE : ++ case MYSQL_TYPE_NULL : ++ case MYSQL_TYPE_TIMESTAMP : ++ case MYSQL_TYPE_LONGLONG : ++ case MYSQL_TYPE_INT24 : ++ case MYSQL_TYPE_DATE : ++ case MYSQL_TYPE_TIME : ++ case MYSQL_TYPE_DATETIME : ++ case MYSQL_TYPE_YEAR : ++ case MYSQL_TYPE_NEWDATE : ++ case MYSQL_TYPE_NEWDECIMAL : ++ case MYSQL_TYPE_ENUM : ++ case MYSQL_TYPE_SET : ++ case MYSQL_TYPE_GEOMETRY : ++ break; ++ default: ++ break; ++ } ++ ++ return ret_length; ++} ++#endif // WITH_WSREP + + /*************************************************************//** + InnoDB uses this function to compare two data fields for which the data type +@@ -5675,6 +5872,307 @@ innobase_read_from_2_little_endian( + /*******************************************************************//** + Stores a key value for a row to a buffer. + @return key value length as stored in buff */ ++#ifdef WITH_WSREP ++UNIV_INTERN ++uint ++wsrep_store_key_val_for_row( ++/*===============================*/ ++ THD* thd, ++ TABLE* table, ++ uint keynr, /*!< in: key number */ ++ char* buff, /*!< in/out: buffer for the key value (in MySQL ++ format) */ ++ uint buff_len,/*!< in: buffer length */ ++ const uchar* record, ++ ibool* key_is_null)/*!< out: full key was null */ ++{ ++ KEY* key_info = table->key_info + keynr; ++ KEY_PART_INFO* key_part = key_info->key_part; ++ KEY_PART_INFO* end = ++ key_part + key_info->user_defined_key_parts; ++ char* buff_start = buff; ++ enum_field_types mysql_type; ++ Field* field; ++ uint buff_space = buff_len; ++ ++ DBUG_ENTER("wsrep_store_key_val_for_row"); ++ ++ memset(buff, 0, buff_len); ++ *key_is_null = TRUE; ++ ++ for (; key_part != end; key_part++) { ++ ++ uchar sorted[REC_VERSION_56_MAX_INDEX_COL_LEN] = {'\0'}; ++ ibool part_is_null = FALSE; ++ ++ if (key_part->null_bit) { ++ if (buff_space > 0) { ++ if (record[key_part->null_offset] ++ & key_part->null_bit) { ++ *buff = 1; ++ part_is_null = TRUE; ++ } else { ++ *buff = 0; ++ } ++ buff++; ++ buff_space--; ++ } else { ++ fprintf (stderr, "WSREP: key truncated: %s\n", ++ wsrep_thd_query(thd)); ++ } ++ } ++ if (!part_is_null) *key_is_null = FALSE; ++ ++ field = key_part->field; ++ mysql_type = field->type(); ++ ++ if (mysql_type == MYSQL_TYPE_VARCHAR) { ++ /* >= 5.0.3 true VARCHAR */ ++ ulint lenlen; ++ ulint len; ++ const byte* data; ++ ulint key_len; ++ ulint true_len; ++ const CHARSET_INFO* cs; ++ int error=0; ++ ++ key_len = key_part->length; ++ ++ if (part_is_null) { ++ true_len = key_len + 2; ++ if (true_len > buff_space) { ++ fprintf (stderr, ++ "WSREP: key truncated: %s\n", ++ wsrep_thd_query(thd)); ++ true_len = buff_space; ++ } ++ buff += true_len; ++ buff_space -= true_len; ++ continue; ++ } ++ cs = field->charset(); ++ ++ lenlen = (ulint) ++ (((Field_varstring*)field)->length_bytes); ++ ++ data = row_mysql_read_true_varchar(&len, ++ (byte*) (record ++ + (ulint)get_field_offset(table, field)), ++ lenlen); ++ ++ true_len = len; ++ ++ /* For multi byte character sets we need to calculate ++ the true length of the key */ ++ ++ if (len > 0 && cs->mbmaxlen > 1) { ++ true_len = (ulint) cs->cset->well_formed_len(cs, ++ (const char *) data, ++ (const char *) data + len, ++ (uint) (key_len / cs->mbmaxlen), ++ &error); ++ } ++ ++ /* In a column prefix index, we may need to truncate ++ the stored value: */ ++ ++ if (true_len > key_len) { ++ true_len = key_len; ++ } ++ ++ memcpy(sorted, data, true_len); ++ true_len = wsrep_innobase_mysql_sort( ++ mysql_type, cs->number, sorted, true_len, ++ REC_VERSION_56_MAX_INDEX_COL_LEN); ++ ++ if (wsrep_protocol_version > 1) { ++ /* Note that we always reserve the maximum possible ++ length of the true VARCHAR in the key value, though ++ only len first bytes after the 2 length bytes contain ++ actual data. The rest of the space was reset to zero ++ in the bzero() call above. */ ++ if (true_len > buff_space) { ++ fprintf (stderr, ++ "WSREP: key truncated: %s\n", ++ wsrep_thd_query(thd)); ++ true_len = buff_space; ++ } ++ memcpy(buff, sorted, true_len); ++ buff += true_len; ++ buff_space -= true_len; ++ } else { ++ buff += key_len; ++ } ++ } else if (mysql_type == MYSQL_TYPE_TINY_BLOB ++ || mysql_type == MYSQL_TYPE_MEDIUM_BLOB ++ || mysql_type == MYSQL_TYPE_BLOB ++ || mysql_type == MYSQL_TYPE_LONG_BLOB ++ /* MYSQL_TYPE_GEOMETRY data is treated ++ as BLOB data in innodb. */ ++ || mysql_type == MYSQL_TYPE_GEOMETRY) { ++ ++ const CHARSET_INFO* cs; ++ ulint key_len; ++ ulint true_len; ++ int error=0; ++ ulint blob_len; ++ const byte* blob_data; ++ ++ ut_a(key_part->key_part_flag & HA_PART_KEY_SEG); ++ ++ key_len = key_part->length; ++ ++ if (part_is_null) { ++ true_len = key_len + 2; ++ if (true_len > buff_space) { ++ fprintf (stderr, ++ "WSREP: key truncated: %s\n", ++ wsrep_thd_query(thd)); ++ true_len = buff_space; ++ } ++ buff += true_len; ++ buff_space -= true_len; ++ ++ continue; ++ } ++ ++ cs = field->charset(); ++ ++ blob_data = row_mysql_read_blob_ref(&blob_len, ++ (byte*) (record ++ + (ulint)get_field_offset(table, field)), ++ (ulint) field->pack_length()); ++ ++ true_len = blob_len; ++ ++ ut_a(get_field_offset(table, field) ++ == key_part->offset); ++ ++ /* For multi byte character sets we need to calculate ++ the true length of the key */ ++ ++ if (blob_len > 0 && cs->mbmaxlen > 1) { ++ true_len = (ulint) cs->cset->well_formed_len(cs, ++ (const char *) blob_data, ++ (const char *) blob_data ++ + blob_len, ++ (uint) (key_len / cs->mbmaxlen), ++ &error); ++ } ++ ++ /* All indexes on BLOB and TEXT are column prefix ++ indexes, and we may need to truncate the data to be ++ stored in the key value: */ ++ ++ if (true_len > key_len) { ++ true_len = key_len; ++ } ++ ++ memcpy(sorted, blob_data, true_len); ++ true_len = wsrep_innobase_mysql_sort( ++ mysql_type, cs->number, sorted, true_len, ++ REC_VERSION_56_MAX_INDEX_COL_LEN); ++ ++ ++ /* Note that we always reserve the maximum possible ++ length of the BLOB prefix in the key value. */ ++ if (wsrep_protocol_version > 1) { ++ if (true_len > buff_space) { ++ fprintf (stderr, ++ "WSREP: key truncated: %s\n", ++ wsrep_thd_query(thd)); ++ true_len = buff_space; ++ } ++ buff += true_len; ++ buff_space -= true_len; ++ } else { ++ buff += key_len; ++ } ++ memcpy(buff, sorted, true_len); ++ } else { ++ /* Here we handle all other data types except the ++ true VARCHAR, BLOB and TEXT. Note that the column ++ value we store may be also in a column prefix ++ index. */ ++ ++ const CHARSET_INFO* cs = NULL; ++ ulint true_len; ++ ulint key_len; ++ const uchar* src_start; ++ int error=0; ++ enum_field_types real_type; ++ ++ key_len = key_part->length; ++ ++ if (part_is_null) { ++ true_len = key_len; ++ if (true_len > buff_space) { ++ fprintf (stderr, ++ "WSREP: key truncated: %s\n", ++ wsrep_thd_query(thd)); ++ true_len = buff_space; ++ } ++ buff += true_len; ++ buff_space -= true_len; ++ ++ continue; ++ } ++ ++ src_start = record + key_part->offset; ++ real_type = field->real_type(); ++ true_len = key_len; ++ ++ /* Character set for the field is defined only ++ to fields whose type is string and real field ++ type is not enum or set. For these fields check ++ if character set is multi byte. */ ++ ++ if (real_type != MYSQL_TYPE_ENUM ++ && real_type != MYSQL_TYPE_SET ++ && ( mysql_type == MYSQL_TYPE_VAR_STRING ++ || mysql_type == MYSQL_TYPE_STRING)) { ++ ++ cs = field->charset(); ++ ++ /* For multi byte character sets we need to ++ calculate the true length of the key */ ++ ++ if (key_len > 0 && cs->mbmaxlen > 1) { ++ ++ true_len = (ulint) ++ cs->cset->well_formed_len(cs, ++ (const char *)src_start, ++ (const char *)src_start ++ + key_len, ++ (uint) (key_len / ++ cs->mbmaxlen), ++ &error); ++ } ++ memcpy(sorted, src_start, true_len); ++ true_len = wsrep_innobase_mysql_sort( ++ mysql_type, cs->number, sorted, true_len, ++ REC_VERSION_56_MAX_INDEX_COL_LEN); ++ ++ if (true_len > buff_space) { ++ fprintf (stderr, ++ "WSREP: key truncated: %s\n", ++ wsrep_thd_query(thd)); ++ true_len = buff_space; ++ } ++ memcpy(buff, sorted, true_len); ++ } else { ++ memcpy(buff, src_start, true_len); ++ } ++ buff += true_len; ++ buff_space -= true_len; ++ } ++ } ++ ++ ut_a(buff <= buff_start + buff_len); ++ ++ DBUG_RETURN((uint)(buff - buff_start)); ++} ++#endif /* WITH_WSREP */ + UNIV_INTERN + uint + ha_innobase::store_key_val_for_row( +@@ -6502,6 +7000,9 @@ ha_innobase::write_row( + dberr_t error; + int error_result= 0; + ibool auto_inc_used= FALSE; ++#ifdef WITH_WSREP ++ ibool auto_inc_inserted= FALSE; /* if NULL was inserted */ ++#endif + ulint sql_command; + trx_t* trx = thd_to_trx(user_thd); + +@@ -6535,8 +7036,20 @@ ha_innobase::write_row( + if ((sql_command == SQLCOM_ALTER_TABLE + || sql_command == SQLCOM_OPTIMIZE + || sql_command == SQLCOM_CREATE_INDEX ++#ifdef WITH_WSREP ++ || (wsrep_on(user_thd) && wsrep_load_data_splitting && ++ sql_command == SQLCOM_LOAD && ++ !thd_test_options( ++ user_thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) ++#endif /* WITH_WSREP */ + || sql_command == SQLCOM_DROP_INDEX) + && num_write_row >= 10000) { ++#ifdef WITH_WSREP ++ if (wsrep_on(user_thd) && sql_command == SQLCOM_LOAD) { ++ WSREP_DEBUG("forced trx split for LOAD: %s", ++ wsrep_thd_query(user_thd)); ++ } ++#endif /* WITH_WSREP */ + /* ALTER TABLE is COMMITted at every 10000 copied rows. + The IX table lock for the original table has to be re-issued. + As this method will be called on a temporary table where the +@@ -6570,6 +7083,26 @@ no_commit: + */ + ; + } else if (src_table == prebuilt->table) { ++#ifdef WITH_WSREP ++ if (wsrep_on(user_thd) && wsrep_load_data_splitting && ++ sql_command == SQLCOM_LOAD && ++ !thd_test_options( ++ user_thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) ++ { ++ switch (wsrep_run_wsrep_commit(user_thd, wsrep_hton, 1)) ++ { ++ case WSREP_TRX_OK: ++ break; ++ case WSREP_TRX_SIZE_EXCEEDED: ++ case WSREP_TRX_CERT_FAIL: ++ case WSREP_TRX_ERROR: ++ DBUG_RETURN(1); ++ } ++ ++ if (tc_log->commit(user_thd, 1)) DBUG_RETURN(1); ++ wsrep_post_commit(user_thd, TRUE); ++ } ++#endif /* WITH_WSREP */ + /* Source table is not in InnoDB format: + no need to re-acquire locks on it. */ + +@@ -6580,6 +7113,25 @@ no_commit: + /* We will need an IX lock on the destination table. */ + prebuilt->sql_stat_start = TRUE; + } else { ++#ifdef WITH_WSREP ++ if (wsrep_on(user_thd) && wsrep_load_data_splitting && ++ sql_command == SQLCOM_LOAD && ++ !thd_test_options( ++ user_thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) ++ { ++ switch (wsrep_run_wsrep_commit(user_thd, wsrep_hton, 1)) ++ { ++ case WSREP_TRX_OK: ++ break; ++ case WSREP_TRX_SIZE_EXCEEDED: ++ case WSREP_TRX_CERT_FAIL: ++ case WSREP_TRX_ERROR: ++ DBUG_RETURN(1); ++ } ++ if (tc_log->commit(user_thd, 1)) DBUG_RETURN(1); ++ wsrep_post_commit(user_thd, TRUE); ++ } ++#endif /* WITH_WSREP */ + /* Ensure that there are no other table locks than + LOCK_IX and LOCK_AUTO_INC on the destination table. */ + +@@ -6609,6 +7161,9 @@ no_commit: + innobase_get_auto_increment(). */ + prebuilt->autoinc_error = DB_SUCCESS; + ++#ifdef WITH_WSREP ++ auto_inc_inserted= (table->next_number_field->val_int() == 0); ++#endif + if ((error_result = update_auto_increment())) { + /* We don't want to mask autoinc overflow errors. */ + +@@ -6687,6 +7242,40 @@ no_commit: + case SQLCOM_REPLACE_SELECT: + goto set_max_autoinc; + ++#ifdef WITH_WSREP ++ /* workaround for LP bug #355000, retrying the insert */ ++ case SQLCOM_INSERT: ++ ++ WSREP_DEBUG("DUPKEY error for autoinc\n" ++ "THD %ld, value %llu, off %llu inc %llu", ++ wsrep_thd_thread_id(current_thd), ++ auto_inc, ++ prebuilt->autoinc_offset, ++ prebuilt->autoinc_increment); ++ ++ if (wsrep_on(current_thd) && ++ auto_inc_inserted && ++ wsrep_drupal_282555_workaround && ++ wsrep_thd_retry_counter(current_thd) == 0 && ++ !thd_test_options(current_thd, ++ OPTION_NOT_AUTOCOMMIT | ++ OPTION_BEGIN)) { ++ WSREP_DEBUG( ++ "retrying insert: %s", ++ (*wsrep_thd_query(current_thd)) ? ++ wsrep_thd_query(current_thd) : ++ (char *)"void"); ++ error= DB_SUCCESS; ++ wsrep_thd_set_conflict_state( ++ current_thd, MUST_ABORT); ++ innobase_srv_conc_exit_innodb( ++ prebuilt->trx); ++ /* jump straight to func exit over ++ * later wsrep hooks */ ++ goto func_exit; ++ } ++ break; ++#endif + default: + break; + } +@@ -6745,6 +7334,20 @@ report_error: + error_result = convert_error_code_to_mysql(error, + prebuilt->table->flags, + user_thd); ++#ifdef WITH_WSREP ++ if (!error_result && wsrep_thd_exec_mode(user_thd) == LOCAL_STATE && ++ wsrep_on(user_thd) && !wsrep_consistency_check(user_thd) && ++ (sql_command != SQLCOM_LOAD || ++ thd_binlog_format(user_thd) == BINLOG_FORMAT_ROW)) { ++ ++ if (wsrep_append_keys(user_thd, false, record, NULL)) { ++ DBUG_PRINT("wsrep", ("row key failed")); ++ error_result = HA_ERR_INTERNAL_ERROR; ++ goto wsrep_error; ++ } ++ } ++wsrep_error: ++#endif + + if (error_result == HA_FTS_INVALID_DOCID) { + my_error(HA_FTS_INVALID_DOCID, MYF(0)); +@@ -6755,7 +7358,88 @@ func_exit: + + DBUG_RETURN(error_result); + } ++#ifdef WITH_WSREP ++#if defined(HAVE_YASSL) ++#include "my_config.h" ++#include "md5.hpp" ++#elif defined(HAVE_OPENSSL) ++#include ++#endif ++static ++int ++wsrep_calc_row_hash( ++/*================*/ ++ byte* digest, /*!< in/out: md5 sum */ ++ const uchar* row, /*!< in: row in MySQL format */ ++ TABLE* table, /*!< in: table in MySQL data ++ dictionary */ ++ row_prebuilt_t* prebuilt, /*!< in: InnoDB prebuilt struct */ ++ THD* thd) /*!< in: user thread */ ++{ ++ Field* field; ++ enum_field_types field_mysql_type; ++ uint n_fields; ++ ulint len; ++ const byte* ptr; ++ ulint col_type; ++ uint i; + ++ ++ void *ctx = wsrep_md5_init(); ++ ++ n_fields = table->s->fields; ++ ++ for (i = 0; i < n_fields; i++) { ++ byte null_byte=0; ++ byte true_byte=1; ++ ++ field = table->field[i]; ++ ++ ptr = (const byte*) row + get_field_offset(table, field); ++ len = field->pack_length(); ++ ++ field_mysql_type = field->type(); ++ ++ col_type = prebuilt->table->cols[i].mtype; ++ ++ switch (col_type) { ++ ++ case DATA_BLOB: ++ ptr = row_mysql_read_blob_ref(&len, ptr, len); ++ ++ break; ++ ++ case DATA_VARCHAR: ++ case DATA_BINARY: ++ case DATA_VARMYSQL: ++ if (field_mysql_type == MYSQL_TYPE_VARCHAR) { ++ /* This is a >= 5.0.3 type true VARCHAR where ++ the real payload data length is stored in ++ 1 or 2 bytes */ ++ ++ ptr = row_mysql_read_true_varchar( ++ &len, ptr, ++ (ulint) ++ (((Field_varstring*)field)->length_bytes)); ++ ++ } ++ ++ break; ++ default: ++ ; ++ } ++ ++ if (field->is_null_in_record(row)) { ++ wsrep_md5_update(ctx, (char*)&null_byte, 1); ++ } else { ++ wsrep_md5_update(ctx, (char*)&true_byte, 1); ++ wsrep_md5_update(ctx, (char*)ptr, len); ++ } ++ } ++ wsrep_compute_md5_hash((char*)digest, ctx); ++ return(0); ++} ++#endif /* WITH_WSREP */ + /**********************************************************************//** + Checks which fields have changed in a row and stores information + of them to an update vector. +@@ -7164,6 +7848,20 @@ func_exit: + + innobase_active_small(); + ++#ifdef WITH_WSREP ++ if (!err && wsrep_thd_exec_mode(user_thd) == LOCAL_STATE && ++ wsrep_on(user_thd)) { ++ ++ DBUG_PRINT("wsrep", ("update row key")); ++ ++ if (wsrep_append_keys(user_thd, false, old_row, new_row)) { ++ DBUG_PRINT("wsrep", ("row key failed")); ++ err = HA_ERR_INTERNAL_ERROR; ++ goto wsrep_error; ++ } ++ } ++wsrep_error: ++#endif + DBUG_RETURN(err); + } + +@@ -7211,6 +7909,18 @@ ha_innobase::delete_row( + + innobase_active_small(); + ++#ifdef WITH_WSREP ++ if (error == DB_SUCCESS && wsrep_thd_exec_mode(user_thd) == LOCAL_STATE && ++ wsrep_on(user_thd)) { ++ ++ if (wsrep_append_keys(user_thd, false, record, NULL)) { ++ DBUG_PRINT("wsrep", ("delete fail")); ++ error = DB_ERROR; ++ goto wsrep_error; ++ } ++ } ++wsrep_error: ++#endif + DBUG_RETURN(convert_error_code_to_mysql( + error, prebuilt->table->flags, user_thd)); + } +@@ -8198,7 +8908,6 @@ innobase_fts_create_doc_id_key( + dfield_t* dfield = dtuple_get_nth_field(tuple, 0); + + ut_a(dict_index_get_n_unique(index) == 1); +- + dtuple_set_n_fields(tuple, index->n_fields); + dict_index_copy_types(tuple, index, index->n_fields); + +@@ -8371,7 +9080,395 @@ ha_innobase::ft_end() + + rnd_end(); + } ++#ifdef WITH_WSREP ++dict_index_t* ++wsrep_dict_foreign_find_index( ++ dict_table_t* table, ++ const char** col_names, ++ const char** columns, ++ ulint n_cols, ++ dict_index_t* types_idx, ++ ibool check_charsets, ++ ulint check_null); ++ ++extern ++dberr_t ++wsrep_append_foreign_key( ++/*===========================*/ ++ trx_t* trx, /*!< in: trx */ ++ dict_foreign_t* foreign, /*!< in: foreign key constraint */ ++ const rec_t* rec, /*!mysql_thd; ++ int rcode = 0; ++ char cache_key[513] = {'\0'}; ++ int cache_key_len; ++ bool const copy = true; ++ ut_a(trx); + ++ if (!wsrep_on(trx->mysql_thd) || ++ wsrep_thd_exec_mode(thd) != LOCAL_STATE) ++ return DB_SUCCESS; ++ ++ if (!thd || !foreign || ++ (!foreign->referenced_table && !foreign->foreign_table)) ++ { ++ WSREP_INFO("FK: %s missing in: %s", ++ (!thd) ? "thread" : ++ ((!foreign) ? "constraint" : ++ ((!foreign->referenced_table) ? ++ "referenced table" : "foreign table")), ++ (thd && wsrep_thd_query(thd)) ? ++ wsrep_thd_query(thd) : "void"); ++ return DB_ERROR; ++ } ++ ++ if ( !((referenced) ? ++ foreign->referenced_table : foreign->foreign_table)) ++ { ++ WSREP_DEBUG("pulling %s table into cache", ++ (referenced) ? "referenced" : "foreign"); ++ mutex_enter(&(dict_sys->mutex)); ++ if (referenced) ++ { ++ foreign->referenced_table = ++ dict_table_get_low( ++ foreign->referenced_table_name_lookup); ++ if (foreign->referenced_table) ++ { ++ foreign->referenced_index = ++ wsrep_dict_foreign_find_index( ++ foreign->referenced_table, NULL, ++ foreign->referenced_col_names, ++ foreign->n_fields, ++ foreign->foreign_index, ++ TRUE, FALSE); ++ } ++ } ++ else ++ { ++ foreign->foreign_table = ++ dict_table_get_low( ++ foreign->foreign_table_name_lookup); ++ if (foreign->foreign_table) ++ { ++ foreign->foreign_index = ++ wsrep_dict_foreign_find_index( ++ foreign->foreign_table, NULL, ++ foreign->foreign_col_names, ++ foreign->n_fields, ++ foreign->referenced_index, ++ TRUE, FALSE); ++ } ++ } ++ mutex_exit(&(dict_sys->mutex)); ++ } ++ ++ if ( !((referenced) ? ++ foreign->referenced_table : foreign->foreign_table)) ++ { ++ WSREP_WARN("FK: %s missing in query: %s", ++ (!foreign->referenced_table) ? ++ "referenced table" : "foreign table", ++ (wsrep_thd_query(thd)) ? ++ wsrep_thd_query(thd) : "void"); ++ return DB_ERROR; ++ } ++ byte key[WSREP_MAX_SUPPORTED_KEY_LENGTH+1] = {'\0'}; ++ ulint len = WSREP_MAX_SUPPORTED_KEY_LENGTH; ++ ++ dict_index_t *idx_target = (referenced) ? ++ foreign->referenced_index : index; ++ dict_index_t *idx = (referenced) ? ++ UT_LIST_GET_FIRST(foreign->referenced_table->indexes) : ++ UT_LIST_GET_FIRST(foreign->foreign_table->indexes); ++ int i = 0; ++ while (idx != NULL && idx != idx_target) { ++ if (innobase_strcasecmp (idx->name, innobase_index_reserve_name) != 0) { ++ i++; ++ } ++ idx = UT_LIST_GET_NEXT(indexes, idx); ++ } ++ ut_a(idx); ++ key[0] = (char)i; ++ ++ rcode = wsrep_rec_get_foreign_key( ++ &key[1], &len, rec, index, idx, ++ wsrep_protocol_version > 1); ++ if (rcode != DB_SUCCESS) { ++ WSREP_ERROR( ++ "FK key set failed: %d (%lu %lu), index: %s %s, %s", ++ rcode, referenced, shared, ++ (index && index->name) ? index->name : ++ "void index", ++ (index && index->table_name) ? index->table_name : ++ "void table", ++ wsrep_thd_query(thd)); ++ return DB_ERROR; ++ } ++ strncpy(cache_key, ++ (wsrep_protocol_version > 1) ? ++ ((referenced) ? ++ foreign->referenced_table->name : ++ foreign->foreign_table->name) : ++ foreign->foreign_table->name, sizeof(cache_key) - 1); ++ cache_key_len = strlen(cache_key); ++// #define WSREP_DEBUG_PRINT ++#ifdef WSREP_DEBUG_PRINT ++ ulint j; ++ fprintf(stderr, "FK parent key, table: %s %s len: %lu ", ++ cache_key, (shared) ? "shared" : "exclusive", len+1); ++ for (j=0; jreferenced_table->name, ++ foreign->foreign_table->name); ++ } ++ ++ wsrep_buf_t wkey_part[3]; ++ wsrep_key_t wkey = {wkey_part, 3}; ++ if (!wsrep_prepare_key_for_innodb( ++ (const uchar*)cache_key, ++ cache_key_len + 1, ++ (const uchar*)key, len+1, ++ wkey_part, ++ &wkey.key_parts_num)) { ++ WSREP_WARN("key prepare failed for cascaded FK: %s", ++ (wsrep_thd_query(thd)) ? ++ wsrep_thd_query(thd) : "void"); ++ return DB_ERROR; ++ } ++ rcode = wsrep->append_key( ++ wsrep, ++ wsrep_ws_handle(thd, trx), ++ &wkey, ++ 1, ++ shared ? WSREP_KEY_SHARED : WSREP_KEY_EXCLUSIVE, ++ copy); ++ if (rcode) { ++ DBUG_PRINT("wsrep", ("row key failed: %d", rcode)); ++ WSREP_ERROR("Appending cascaded fk row key failed: %s, %d", ++ (wsrep_thd_query(thd)) ? ++ wsrep_thd_query(thd) : "void", rcode); ++ return DB_ERROR; ++ } ++ ++ return DB_SUCCESS; ++} ++ ++static int ++wsrep_append_key( ++/*==================*/ ++ THD *thd, ++ trx_t *trx, ++ TABLE_SHARE *table_share, ++ TABLE *table, ++ const char* key, ++ uint16_t key_len, ++ bool shared ++) ++{ ++ DBUG_ENTER("wsrep_append_key"); ++ bool const copy = true; ++#ifdef WSREP_DEBUG_PRINT ++ fprintf(stderr, "%s conn %ld, trx %llu, keylen %d, table %s\n SQL: %s ", ++ (shared) ? "Shared" : "Exclusive", ++ wsrep_thd_thread_id(thd), (long long)trx->id, key_len, ++ table_share->table_name.str, wsrep_thd_query(thd)); ++ for (int i=0; itable_cache_key.str, ++ table_share->table_cache_key.length, ++ (const uchar*)key, key_len, ++ wkey_part, ++ &wkey.key_parts_num)) { ++ WSREP_WARN("key prepare failed for: %s", ++ (wsrep_thd_query(thd)) ? ++ wsrep_thd_query(thd) : "void"); ++ DBUG_RETURN(-1); ++ } ++ ++ int rcode = wsrep->append_key( ++ wsrep, ++ wsrep_ws_handle(thd, trx), ++ &wkey, ++ 1, ++ shared ? WSREP_KEY_SHARED : WSREP_KEY_EXCLUSIVE, ++ copy); ++ if (rcode) { ++ DBUG_PRINT("wsrep", ("row key failed: %d", rcode)); ++ WSREP_WARN("Appending row key failed: %s, %d", ++ (wsrep_thd_query(thd)) ? ++ wsrep_thd_query(thd) : "void", rcode); ++ DBUG_RETURN(-1); ++ } ++ DBUG_RETURN(0); ++} ++ ++extern void compute_md5_hash(char *digest, const char *buf, int len); ++#define MD5_HASH compute_md5_hash ++ ++int ++ha_innobase::wsrep_append_keys( ++/*==================*/ ++ THD *thd, ++ bool shared, ++ const uchar* record0, /* in: row in MySQL format */ ++ const uchar* record1) /* in: row in MySQL format */ ++{ ++ int rcode; ++ DBUG_ENTER("wsrep_append_keys"); ++ ++ bool key_appended = false; ++ trx_t *trx = thd_to_trx(thd); ++ ++ if (table_share && table_share->tmp_table != NO_TMP_TABLE) { ++ WSREP_DEBUG("skipping tmp table DML: THD: %lu tmp: %d SQL: %s", ++ wsrep_thd_thread_id(thd), ++ table_share->tmp_table, ++ (wsrep_thd_query(thd)) ? ++ wsrep_thd_query(thd) : "void"); ++ DBUG_RETURN(0); ++ } ++ ++ if (wsrep_protocol_version == 0) { ++ uint len; ++ char keyval[WSREP_MAX_SUPPORTED_KEY_LENGTH+1] = {'\0'}; ++ char *key = &keyval[0]; ++ ibool is_null; ++ ++ len = wsrep_store_key_val_for_row( ++ thd, table, 0, key, WSREP_MAX_SUPPORTED_KEY_LENGTH, ++ record0, &is_null); ++ ++ if (!is_null) { ++ rcode = wsrep_append_key( ++ thd, trx, table_share, table, keyval, ++ len, shared); ++ if (rcode) DBUG_RETURN(rcode); ++ } ++ else ++ { ++ WSREP_DEBUG("NULL key skipped (proto 0): %s", ++ wsrep_thd_query(thd)); ++ } ++ } else { ++ ut_a(table->s->keys <= 256); ++ uint i; ++ bool hasPK= false; ++ ++ for (i=0; is->keys; ++i) { ++ KEY* key_info = table->key_info + i; ++ if (key_info->flags & HA_NOSAME) { ++ hasPK = true; ++ } ++ } ++ ++ for (i=0; is->keys; ++i) { ++ uint len; ++ char keyval0[WSREP_MAX_SUPPORTED_KEY_LENGTH+1] = {'\0'}; ++ char keyval1[WSREP_MAX_SUPPORTED_KEY_LENGTH+1] = {'\0'}; ++ char* key0 = &keyval0[1]; ++ char* key1 = &keyval1[1]; ++ KEY* key_info = table->key_info + i; ++ ibool is_null; ++ ++ dict_index_t* idx = innobase_get_index(i); ++ dict_table_t* tab = (idx) ? idx->table : NULL; ++ ++ keyval0[0] = (char)i; ++ keyval1[0] = (char)i; ++ ++ if (!tab) { ++ WSREP_WARN("MySQL-InnoDB key mismatch %s %s", ++ table->s->table_name.str, ++ key_info->name); ++ } ++ /* !hasPK == table with no PK, must append all non-unique keys */ ++ if (!hasPK || key_info->flags & HA_NOSAME || ++ ((tab && ++ dict_table_get_referenced_constraint(tab, idx)) || ++ (!tab && referenced_by_foreign_key()))) { ++ ++ len = wsrep_store_key_val_for_row( ++ thd, table, i, key0, ++ WSREP_MAX_SUPPORTED_KEY_LENGTH, ++ record0, &is_null); ++ if (!is_null) { ++ rcode = wsrep_append_key( ++ thd, trx, table_share, table, ++ keyval0, len+1, shared); ++ if (rcode) DBUG_RETURN(rcode); ++ ++ if (key_info->flags & HA_NOSAME || shared) ++ key_appended = true; ++ } ++ else ++ { ++ WSREP_DEBUG("NULL key skipped: %s", ++ wsrep_thd_query(thd)); ++ } ++ if (record1) { ++ len = wsrep_store_key_val_for_row( ++ thd, table, i, key1, ++ WSREP_MAX_SUPPORTED_KEY_LENGTH, ++ record1, &is_null); ++ if (!is_null && memcmp(key0, key1, len)) { ++ rcode = wsrep_append_key( ++ thd, trx, table_share, ++ table, ++ keyval1, len+1, shared); ++ if (rcode) DBUG_RETURN(rcode); ++ } ++ } ++ } ++ } ++ } ++ ++ /* if no PK, calculate hash of full row, to be the key value */ ++ if (!key_appended && wsrep_certify_nonPK) { ++ uchar digest[16]; ++ int rcode; ++ ++ wsrep_calc_row_hash(digest, record0, table, prebuilt, thd); ++ if ((rcode = wsrep_append_key(thd, trx, table_share, table, ++ (const char*) digest, 16, ++ shared))) { ++ DBUG_RETURN(rcode); ++ } ++ ++ if (record1) { ++ wsrep_calc_row_hash( ++ digest, record1, table, prebuilt, thd); ++ if ((rcode = wsrep_append_key(thd, trx, table_share, ++ table, ++ (const char*) digest, ++ 16, shared))) { ++ DBUG_RETURN(rcode); ++ } ++ } ++ DBUG_RETURN(0); ++ } ++ ++ DBUG_RETURN(0); ++} ++#endif + /*********************************************************************//** + Stores a reference to the current row to 'ref' field of the handle. Note + that in the case where we have generated the clustered index for the +@@ -12128,11 +13225,18 @@ ha_innobase::external_lock( + /* used by test case */ + DBUG_EXECUTE_IF("no_innodb_binlog_errors", skip = true;); + if (!skip) { ++#ifdef WITH_WSREP ++ if (!wsrep_on(thd) || wsrep_thd_exec_mode(thd) == LOCAL_STATE) ++ { ++#endif /* WITH_WSREP */ + my_error(ER_BINLOG_STMT_MODE_AND_ROW_ENGINE, MYF(0), + " InnoDB is limited to row-logging when " + "transaction isolation level is " + "READ COMMITTED or READ UNCOMMITTED."); + DBUG_RETURN(HA_ERR_LOGGING_IMPOSSIBLE); ++#ifdef WITH_WSREP ++ } ++#endif /* WITH_WSREP */ + } + } + +@@ -12163,6 +13267,33 @@ ha_innobase::external_lock( + + } + ++ /* Check for UPDATEs in read-only mode. */ ++ if (srv_read_only_mode ++ && (thd_sql_command(thd) == SQLCOM_UPDATE ++ || thd_sql_command(thd) == SQLCOM_INSERT ++ || thd_sql_command(thd) == SQLCOM_REPLACE ++ || thd_sql_command(thd) == SQLCOM_DROP_TABLE ++ || thd_sql_command(thd) == SQLCOM_ALTER_TABLE ++ || thd_sql_command(thd) == SQLCOM_OPTIMIZE ++ || (thd_sql_command(thd) == SQLCOM_CREATE_TABLE ++ && lock_type == F_WRLCK) ++ || thd_sql_command(thd) == SQLCOM_CREATE_INDEX ++ || thd_sql_command(thd) == SQLCOM_DROP_INDEX ++ || thd_sql_command(thd) == SQLCOM_DELETE)) { ++ ++ if (thd_sql_command(thd) == SQLCOM_CREATE_TABLE) ++ { ++ ib_senderrf(thd, IB_LOG_LEVEL_WARN, ++ ER_INNODB_READ_ONLY); ++ DBUG_RETURN(HA_ERR_INNODB_READ_ONLY); ++ } else { ++ ib_senderrf(thd, IB_LOG_LEVEL_WARN, ++ ER_READ_ONLY_MODE); ++ DBUG_RETURN(HA_ERR_TABLE_READONLY); ++ } ++ ++ } ++ + trx = prebuilt->trx; + + prebuilt->sql_stat_start = TRUE; +@@ -13218,8 +14349,20 @@ ha_innobase::get_auto_increment( + next value in the series. */ + if (prebuilt->autoinc_increment > increment) { + ++#ifdef WITH_WSREP ++ WSREP_DEBUG("autoinc decrease: %llu -> %llu\n" ++ "THD: %ld, current: %llu, autoinc: %llu", ++ prebuilt->autoinc_increment, ++ increment, ++ wsrep_thd_thread_id(ha_thd()), ++ current, autoinc); ++ if (!wsrep_on(ha_thd())) ++ { ++#endif /* WITH_WSREP */ + current = autoinc - prebuilt->autoinc_increment; +- ++#ifdef WITH_WSREP ++ } ++#endif /* WITH_WSREP */ + current = innobase_next_autoinc( + current, 1, increment, 1, col_max_value); + +@@ -13580,6 +14723,9 @@ innobase_xa_prepare( + to the session variable take effect only in the next transaction */ + if (!trx->support_xa) { + ++#ifdef WITH_WSREP ++ thd_get_xid(thd, (MYSQL_XID*) &trx->xid); ++#endif // WITH_WSREP + return(0); + } + +@@ -15648,6 +16794,292 @@ static SHOW_VAR innodb_status_variables_export[]= { + static struct st_mysql_storage_engine innobase_storage_engine= + { MYSQL_HANDLERTON_INTERFACE_VERSION }; + ++#ifdef WITH_WSREP ++void ++wsrep_abort_slave_trx(wsrep_seqno_t bf_seqno, wsrep_seqno_t victim_seqno) ++{ ++ WSREP_ERROR("Trx %lld tries to abort slave trx %lld. This could be " ++ "caused by:\n\t" ++ "1) unsupported configuration options combination, please check documentation.\n\t" ++ "2) a bug in the code.\n\t" ++ "3) a database corruption.\n Node consistency compromized, " ++ "need to abort. Restart the node to resync with cluster.", ++ (long long)bf_seqno, (long long)victim_seqno); ++ abort(); ++} ++ ++int ++wsrep_innobase_kill_one_trx(void * const bf_thd_ptr, ++ const trx_t * const bf_trx, ++ trx_t *victim_trx, ibool signal) ++{ ++ ut_ad(lock_mutex_own()); ++ ut_ad(trx_mutex_own(victim_trx)); ++ ut_ad(bf_thd_ptr); ++ ut_ad(victim_trx); ++ ++ DBUG_ENTER("wsrep_innobase_kill_one_trx"); ++ THD *bf_thd = bf_thd_ptr ? (THD*) bf_thd_ptr : NULL; ++ THD *thd = (THD *) victim_trx->mysql_thd; ++ int64_t bf_seqno = (bf_thd) ? wsrep_thd_trx_seqno(bf_thd) : 0; ++ ++ if (!thd) { ++ DBUG_PRINT("wsrep", ("no thd for conflicting lock")); ++ WSREP_WARN("no THD for trx: %llu", (long long)victim_trx->id); ++ DBUG_RETURN(1); ++ } ++ if (!bf_thd) { ++ DBUG_PRINT("wsrep", ("no BF thd for conflicting lock")); ++ WSREP_WARN("no BF THD for trx: %llu", ++ (bf_trx) ? (long long)bf_trx->id : 0); ++ DBUG_RETURN(1); ++ } ++ ++ WSREP_LOG_CONFLICT(bf_thd, thd, TRUE); ++ ++ WSREP_DEBUG("BF kill (%lu, seqno: %lld), victim: (%llu) trx: %llu", ++ signal, (long long)bf_seqno, ++ (long long)wsrep_thd_thread_id(thd), ++ (long long)victim_trx->id); ++ ++ WSREP_DEBUG("Aborting query: %s", ++ (thd && wsrep_thd_query(thd)) ? wsrep_thd_query(thd) : "void"); ++ ++ wsrep_thd_LOCK(thd); ++ ++ if (wsrep_thd_query_state(thd) == QUERY_EXITING) { ++ WSREP_DEBUG("kill trx EXITING for %llu", ++ (long long)victim_trx->id); ++ wsrep_thd_UNLOCK(thd); ++ DBUG_RETURN(0); ++ } ++ if(wsrep_thd_exec_mode(thd) != LOCAL_STATE) { ++ WSREP_DEBUG("withdraw for BF trx: %llu, state: %d", ++ (long long)victim_trx->id, ++ wsrep_thd_conflict_state(thd)); ++ } ++ ++ switch (wsrep_thd_conflict_state(thd)) { ++ case NO_CONFLICT: ++ wsrep_thd_set_conflict_state(thd, MUST_ABORT); ++ break; ++ case MUST_ABORT: ++ WSREP_DEBUG("victim %llu in MUST ABORT state", ++ (long long)victim_trx->id); ++ wsrep_thd_UNLOCK(thd); ++ wsrep_thd_awake(thd, signal); ++ DBUG_RETURN(0); ++ break; ++ case ABORTED: ++ case ABORTING: // fall through ++ default: ++ WSREP_DEBUG("victim %llu in state %d", ++ (long long)victim_trx->id, ++ wsrep_thd_conflict_state(thd)); ++ wsrep_thd_UNLOCK(thd); ++ DBUG_RETURN(0); ++ break; ++ } ++ ++ switch (wsrep_thd_query_state(thd)) { ++ case QUERY_COMMITTING: ++ enum wsrep_status rcode; ++ ++ WSREP_DEBUG("kill trx QUERY_COMMITTING for %llu", ++ (long long)victim_trx->id); ++ wsrep_thd_awake(thd, signal); ++ ++ if (wsrep_thd_exec_mode(thd) == REPL_RECV) { ++ wsrep_abort_slave_trx(bf_seqno, ++ wsrep_thd_trx_seqno(thd)); ++ } else { ++ rcode = wsrep->abort_pre_commit( ++ wsrep, bf_seqno, ++ (wsrep_trx_id_t)victim_trx->id ++ ); ++ ++ switch (rcode) { ++ case WSREP_WARNING: ++ WSREP_DEBUG("cancel commit warning: %llu", ++ (long long)victim_trx->id); ++ wsrep_thd_UNLOCK(thd); ++ DBUG_RETURN(1); ++ break; ++ case WSREP_OK: ++ break; ++ default: ++ WSREP_ERROR( ++ "cancel commit bad exit: %d %llu", ++ rcode, ++ (long long)victim_trx->id); ++ /* unable to interrupt, must abort */ ++ /* note: kill_mysql() will block, if we cannot. ++ * kill the lock holder first. ++ */ ++ abort(); ++ break; ++ } ++ } ++ break; ++ case QUERY_EXEC: ++ /* it is possible that victim trx is itself waiting for some ++ * other lock. We need to cancel this waiting ++ */ ++ WSREP_DEBUG("kill trx QUERY_EXEC for %llu", (long long)victim_trx->id); ++ ++ victim_trx->lock.was_chosen_as_deadlock_victim= TRUE; ++ if (victim_trx->lock.wait_lock) { ++ WSREP_DEBUG("victim has wait flag: %ld", ++ wsrep_thd_thread_id(thd)); ++ lock_t* wait_lock = victim_trx->lock.wait_lock; ++ if (wait_lock) { ++ WSREP_DEBUG("canceling wait lock"); ++ victim_trx->lock.was_chosen_as_deadlock_victim= TRUE; ++ lock_cancel_waiting_and_release(wait_lock); ++ } ++ ++ wsrep_thd_awake(thd, signal); ++ } else { ++ /* abort currently executing query */ ++ DBUG_PRINT("wsrep",("sending KILL_QUERY to: %ld", ++ wsrep_thd_thread_id(thd))); ++ WSREP_DEBUG("kill query for: %ld", ++ wsrep_thd_thread_id(thd)); ++ wsrep_thd_awake(thd, signal); ++ ++ /* for BF thd, we need to prevent him from committing */ ++ if (wsrep_thd_exec_mode(thd) == REPL_RECV) { ++ wsrep_abort_slave_trx(bf_seqno, ++ wsrep_thd_trx_seqno(thd)); ++ } ++ } ++ break; ++ case QUERY_IDLE: ++ { ++ bool skip_abort= false; ++ wsrep_aborting_thd_t abortees; ++ ++ WSREP_DEBUG("kill IDLE for %llu", (long long)victim_trx->id); ++ ++ if (wsrep_thd_exec_mode(thd) == REPL_RECV) { ++ WSREP_DEBUG("kill BF IDLE, seqno: %lld", ++ (long long)wsrep_thd_trx_seqno(thd)); ++ wsrep_thd_UNLOCK(thd); ++ wsrep_abort_slave_trx(bf_seqno, ++ wsrep_thd_trx_seqno(thd)); ++ DBUG_RETURN(0); ++ } ++ /* This will lock thd from proceeding after net_read() */ ++ wsrep_thd_set_conflict_state(thd, ABORTING); ++ ++ mysql_mutex_lock(&LOCK_wsrep_rollback); ++ ++ abortees = wsrep_aborting_thd; ++ while (abortees && !skip_abort) { ++ /* check if we have a kill message for this already */ ++ if (abortees->aborting_thd == thd) { ++ skip_abort = true; ++ WSREP_WARN("duplicate thd aborter %lu", ++ wsrep_thd_thread_id(thd)); ++ } ++ abortees = abortees->next; ++ } ++ if (!skip_abort) { ++ wsrep_aborting_thd_t aborting = (wsrep_aborting_thd_t) ++ my_malloc(sizeof(struct wsrep_aborting_thd), ++ MYF(0)); ++ aborting->aborting_thd = thd; ++ aborting->next = wsrep_aborting_thd; ++ wsrep_aborting_thd = aborting; ++ DBUG_PRINT("wsrep",("enqueuing trx abort for %lu", ++ wsrep_thd_thread_id(thd))); ++ WSREP_DEBUG("enqueuing trx abort for (%lu)", ++ wsrep_thd_thread_id(thd)); ++ } ++ ++ DBUG_PRINT("wsrep",("signalling wsrep rollbacker")); ++ WSREP_DEBUG("signaling aborter"); ++ mysql_cond_signal(&COND_wsrep_rollback); ++ mysql_mutex_unlock(&LOCK_wsrep_rollback); ++ ++ break; ++ } ++ default: ++ WSREP_WARN("bad wsrep query state: %d", ++ wsrep_thd_query_state(thd)); ++ break; ++ } ++ wsrep_thd_UNLOCK(thd); ++ ++ DBUG_RETURN(0); ++} ++static int ++wsrep_abort_transaction(handlerton* hton, THD *bf_thd, THD *victim_thd, ++ my_bool signal) ++{ ++ DBUG_ENTER("wsrep_innobase_abort_thd"); ++ trx_t* victim_trx = thd_to_trx(victim_thd); ++ trx_t* bf_trx = (bf_thd) ? thd_to_trx(bf_thd) : NULL; ++ WSREP_DEBUG("abort transaction: BF: %s victim: %s", ++ wsrep_thd_query(bf_thd), ++ wsrep_thd_query(victim_thd)); ++ ++ if (victim_trx) ++ { ++ lock_mutex_enter(); ++ trx_mutex_enter(victim_trx); ++ int rcode = wsrep_innobase_kill_one_trx(bf_thd, bf_trx, ++ victim_trx, signal); ++ trx_mutex_exit(victim_trx); ++ lock_mutex_exit(); ++ wsrep_srv_conc_cancel_wait(victim_trx); ++ ++ DBUG_RETURN(rcode); ++ } else { ++ WSREP_DEBUG("victim does not have transaction"); ++ wsrep_thd_LOCK(victim_thd); ++ wsrep_thd_set_conflict_state(victim_thd, MUST_ABORT); ++ wsrep_thd_UNLOCK(victim_thd); ++ wsrep_thd_awake(victim_thd, signal); ++ } ++ DBUG_RETURN(-1); ++} ++ ++static int innobase_wsrep_set_checkpoint(handlerton* hton, const XID* xid) ++{ ++ DBUG_ASSERT(hton == innodb_hton_ptr); ++ if (wsrep_is_wsrep_xid(xid)) { ++ mtr_t mtr; ++ mtr_start(&mtr); ++ trx_sysf_t* sys_header = trx_sysf_get(&mtr); ++ trx_sys_update_wsrep_checkpoint(xid, sys_header, &mtr); ++ mtr_commit(&mtr); ++ innobase_flush_logs(hton); ++ return 0; ++ } else { ++ return 1; ++ } ++} ++ ++static int innobase_wsrep_get_checkpoint(handlerton* hton, XID* xid) ++{ ++ DBUG_ASSERT(hton == innodb_hton_ptr); ++ trx_sys_read_wsrep_checkpoint(xid); ++ return 0; ++} ++ ++static void ++wsrep_fake_trx_id( ++/*==================*/ ++ handlerton *hton, ++ THD *thd) /*!< in: user thread handle */ ++{ ++ trx_id_t trx_id = trx_sys_get_new_trx_id(); ++ ++ (void *)wsrep_ws_handle_for_trx(wsrep_thd_ws_handle(thd), trx_id); ++} ++ ++#endif /* WITH_WSREP */ + /* plugin options */ + + static MYSQL_SYSVAR_ENUM(checksum_algorithm, srv_checksum_algorithm, +@@ -16359,6 +17791,40 @@ static MYSQL_SYSVAR_BOOL(disable_background_merge, + NULL, NULL, FALSE); + #endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */ + ++#ifdef WITH_INNODB_DISALLOW_WRITES ++/******************************************************* ++ * innobase_disallow_writes variable definition * ++ *******************************************************/ ++ ++/* Must always init to FALSE. */ ++static my_bool innobase_disallow_writes = FALSE; ++ ++/************************************************************************** ++An "update" method for innobase_disallow_writes variable. */ ++static ++void ++innobase_disallow_writes_update( ++/*============================*/ ++ THD* thd, /* in: thread handle */ ++ st_mysql_sys_var* var, /* in: pointer to system ++ variable */ ++ void* var_ptr, /* out: pointer to dynamic ++ variable */ ++ const void* save) /* in: temporary storage */ ++{ ++ *(my_bool*)var_ptr = *(my_bool*)save; ++ ut_a(srv_allow_writes_event); ++ if (*(my_bool*)var_ptr) ++ os_event_reset(srv_allow_writes_event); ++ else ++ os_event_set(srv_allow_writes_event); ++} ++ ++static MYSQL_SYSVAR_BOOL(disallow_writes, innobase_disallow_writes, ++ PLUGIN_VAR_NOCMDOPT, ++ "Tell InnoDB to stop any writes to disk", ++ NULL, innobase_disallow_writes_update, FALSE); ++#endif /* WITH_INNODB_DISALLOW_WRITES */ + static MYSQL_SYSVAR_BOOL(random_read_ahead, srv_random_read_ahead, + PLUGIN_VAR_NOCMDARG, + "Whether to use read ahead for random access within an extent.", +@@ -16577,6 +18043,9 @@ static struct st_mysql_sys_var* innobase_system_variables[]= { + MYSQL_SYSVAR(change_buffering_debug), + MYSQL_SYSVAR(disable_background_merge), + #endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */ ++#ifdef WITH_INNODB_DISALLOW_WRITES ++ MYSQL_SYSVAR(disallow_writes), ++#endif /* WITH_INNODB_DISALLOW_WRITES */ + MYSQL_SYSVAR(random_read_ahead), + MYSQL_SYSVAR(read_ahead_threshold), + MYSQL_SYSVAR(read_only), +diff --git a/storage/innobase/handler/ha_innodb.h b/storage/innobase/handler/ha_innodb.h +index f735b6f..45b8fd3 100644 +--- a/storage/innobase/handler/ha_innodb.h ++++ b/storage/innobase/handler/ha_innodb.h +@@ -95,6 +95,10 @@ class ha_innobase: public handler + void innobase_initialize_autoinc(); + dict_index_t* innobase_get_index(uint keynr); + ++#ifdef WITH_WSREP ++ int wsrep_append_keys(THD *thd, bool shared, ++ const uchar* record0, const uchar* record1); ++#endif + /* Init values for the class: */ + public: + ha_innobase(handlerton *hton, TABLE_SHARE *table_arg); +@@ -440,6 +444,38 @@ bool thd_is_strict_mode(const MYSQL_THD thd) + __attribute__((nonnull)); + } /* extern "C" */ + ++#ifdef WITH_WSREP ++#include ++extern "C" bool wsrep_thd_is_wsrep_on(THD *thd); ++ ++extern "C" enum wsrep_exec_mode wsrep_thd_exec_mode(THD *thd); ++extern "C" enum wsrep_conflict_state wsrep_thd_conflict_state(THD *thd); ++extern "C" enum wsrep_query_state wsrep_thd_query_state(THD *thd); ++extern "C" const char * wsrep_thd_exec_mode_str(THD *thd); ++extern "C" const char * wsrep_thd_conflict_state_str(THD *thd); ++extern "C" const char * wsrep_thd_query_state_str(THD *thd); ++extern "C" wsrep_ws_handle_t* wsrep_thd_ws_handle(THD *thd); ++ ++extern "C" void wsrep_thd_set_exec_mode(THD *thd, enum wsrep_exec_mode mode); ++extern "C" void wsrep_thd_set_query_state( ++ THD *thd, enum wsrep_query_state state); ++extern "C" void wsrep_thd_set_conflict_state( ++ THD *thd, enum wsrep_conflict_state state); ++ ++extern "C" void wsrep_thd_set_trx_to_replay(THD *thd, uint64 trx_id); ++ ++extern "C"void wsrep_thd_LOCK(THD *thd); ++extern "C"void wsrep_thd_UNLOCK(THD *thd); ++extern "C" uint32 wsrep_thd_wsrep_rand(THD *thd); ++extern "C" time_t wsrep_thd_query_start(THD *thd); ++extern "C" my_thread_id wsrep_thd_thread_id(THD *thd); ++extern "C" int64_t wsrep_thd_trx_seqno(THD *thd); ++extern "C" query_id_t wsrep_thd_query_id(THD *thd); ++extern "C" char * wsrep_thd_query(THD *thd); ++extern "C" query_id_t wsrep_thd_wsrep_last_query_id(THD *thd); ++extern "C" void wsrep_thd_set_wsrep_last_query_id(THD *thd, query_id_t id); ++extern "C" void wsrep_thd_awake(THD *thd, my_bool signal); ++#endif + struct trx_t; + + extern const struct _ft_vft ft_vft_result; +diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc +index 19812ce..4f2c8d4 100644 +--- a/storage/innobase/handler/handler0alter.cc ++++ b/storage/innobase/handler/handler0alter.cc +@@ -46,6 +46,10 @@ Smart ALTER TABLE + #include "srv0mon.h" + #include "fts0priv.h" + #include "pars0pars.h" ++#ifdef WITH_WSREP ++//#include "wsrep_api.h" ++#include // PROCESS_ACL ++#endif + #include "row0sel.h" + #include "ha_innodb.h" + +diff --git a/storage/innobase/include/dict0mem.h b/storage/innobase/include/dict0mem.h +index 460a7e1..5b9f052 100644 +--- a/storage/innobase/include/dict0mem.h ++++ b/storage/innobase/include/dict0mem.h +@@ -484,6 +484,9 @@ be REC_VERSION_56_MAX_INDEX_COL_LEN (3072) bytes */ + + /** Defines the maximum fixed length column size */ + #define DICT_MAX_FIXED_COL_LEN DICT_ANTELOPE_MAX_INDEX_COL_LEN ++#ifdef WITH_WSREP ++#define WSREP_MAX_SUPPORTED_KEY_LENGTH 3500 ++#endif /* WITH_WSREP */ + + /** Data structure for a field in an index */ + struct dict_field_t{ +@@ -767,6 +770,23 @@ struct dict_foreign_with_index { + const dict_index_t* m_index; + }; + ++#ifdef WITH_WSREP ++/** A function object to find a foreign key with the given index as the ++foreign index. Return the foreign key with matching criteria or NULL */ ++struct dict_foreign_with_foreign_index { ++ ++ dict_foreign_with_foreign_index(const dict_index_t* index) ++ : m_index(index) ++ {} ++ ++ bool operator()(const dict_foreign_t* foreign) const ++ { ++ return(foreign->foreign_index == m_index); ++ } ++ ++ const dict_index_t* m_index; ++}; ++#endif + /* A function object to check if the foreign constraint is between different + tables. Returns true if foreign key constraint is between different tables, + false otherwise. */ +diff --git a/storage/innobase/include/ha_prototypes.h b/storage/innobase/include/ha_prototypes.h +index fa202aa..330bd3b 100644 +--- a/storage/innobase/include/ha_prototypes.h ++++ b/storage/innobase/include/ha_prototypes.h +@@ -273,6 +273,23 @@ innobase_casedn_str( + /*================*/ + char* a); /*!< in/out: string to put in lower case */ + ++#ifdef WITH_WSREP ++UNIV_INTERN ++int ++wsrep_innobase_kill_one_trx(void *thd_ptr, ++ const trx_t *bf_trx, trx_t *victim_trx, ibool signal); ++my_bool wsrep_thd_set_PA_safe(void *thd_ptr, my_bool safe); ++int wsrep_thd_conflict_state(void *thd_ptr, my_bool sync); ++my_bool wsrep_thd_is_BF(void *thd_ptr, my_bool sync); ++int wsrep_trx_order_before(void *thd1, void *thd2); ++int wsrep_innobase_mysql_sort(int mysql_type, uint charset_number, ++ unsigned char* str, unsigned int str_length, ++ unsigned int buf_length); ++UNIV_INTERN ++int ++wsrep_on(void *thd_ptr); ++int wsrep_is_wsrep_xid(const void*); ++#endif /* WITH_WSREP */ + /**********************************************************************//** + Determines the connection character set. + @return connection character set */ +diff --git a/storage/innobase/include/hash0hash.h b/storage/innobase/include/hash0hash.h +index 6f9a628..9a4077b 100644 +--- a/storage/innobase/include/hash0hash.h ++++ b/storage/innobase/include/hash0hash.h +@@ -144,6 +144,33 @@ do {\ + }\ + } while (0) + ++#ifdef WITH_WSREP ++/*******************************************************************//** ++Inserts a struct to the head of hash table. */ ++ ++#define HASH_PREPEND(TYPE, NAME, TABLE, FOLD, DATA) \ ++do { \ ++ hash_cell_t* cell3333; \ ++ TYPE* struct3333; \ ++ \ ++ HASH_ASSERT_OWN(TABLE, FOLD) \ ++ \ ++ (DATA)->NAME = NULL; \ ++ \ ++ cell3333 = hash_get_nth_cell(TABLE, hash_calc_hash(FOLD, TABLE));\ ++ \ ++ if (cell3333->node == NULL) { \ ++ cell3333->node = DATA; \ ++ DATA->NAME = NULL; \ ++ } else { \ ++ struct3333 = (TYPE*) cell3333->node; \ ++ \ ++ DATA->NAME = struct3333; \ ++ \ ++ cell3333->node = DATA; \ ++ } \ ++} while (0) ++#endif /*WITH_WSREP */ + #ifdef UNIV_HASH_DEBUG + # define HASH_ASSERT_VALID(DATA) ut_a((void*) (DATA) != (void*) -1) + # define HASH_INVALIDATE(DATA, NAME) *(void**) (&DATA->NAME) = (void*) -1 +diff --git a/storage/innobase/include/lock0lock.h b/storage/innobase/include/lock0lock.h +index 6d5ed35..385853b 100644 +--- a/storage/innobase/include/lock0lock.h ++++ b/storage/innobase/include/lock0lock.h +@@ -972,6 +972,16 @@ extern lock_sys_t* lock_sys; + mutex_exit(&lock_sys->wait_mutex); \ + } while (0) + ++#ifdef WITH_WSREP ++/*********************************************************************//** ++Cancels a waiting lock request and releases possible other transactions ++waiting behind it. */ ++UNIV_INTERN ++void ++lock_cancel_waiting_and_release( ++/*============================*/ ++ lock_t* lock); /*!< in/out: waiting lock request */ ++#endif /* WITH_WSREP */ + #ifndef UNIV_NONINL + #include "lock0lock.ic" + #endif +diff --git a/storage/innobase/include/rem0rec.h b/storage/innobase/include/rem0rec.h +index 8e7d5ff..5dc4971 100644 +--- a/storage/innobase/include/rem0rec.h ++++ b/storage/innobase/include/rem0rec.h +@@ -981,6 +981,15 @@ are given in one byte (resp. two byte) format. */ + two upmost bits in a two byte offset for special purposes */ + #define REC_MAX_DATA_SIZE (16 * 1024) + ++#ifdef WITH_WSREP ++dberr_t wsrep_rec_get_foreign_key( ++ byte *buf, /* out: extracted key */ ++ ulint *buf_len, /* in/out: length of buf */ ++ const rec_t* rec, /* in: physical record */ ++ dict_index_t* index_for, /* in: index for foreign table */ ++ dict_index_t* index_ref, /* in: index for referenced table */ ++ ibool new_protocol); /* in: protocol > 1 */ ++#endif /* WITH_WSREP */ + #ifndef UNIV_NONINL + #include "rem0rec.ic" + #endif +diff --git a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h +index 7a6c9f9..4b40c36 100644 +--- a/storage/innobase/include/srv0srv.h ++++ b/storage/innobase/include/srv0srv.h +@@ -257,6 +257,10 @@ extern ulong srv_flush_log_at_trx_commit; + extern uint srv_flush_log_at_timeout; + extern char srv_adaptive_flushing; + ++#ifdef WITH_INNODB_DISALLOW_WRITES ++/* When this event is reset we do not allow any file writes to take place. */ ++extern os_event_t srv_allow_writes_event; ++#endif /* WITH_INNODB_DISALLOW_WRITES */ + /* If this flag is TRUE, then we will load the indexes' (and tables') metadata + even if they are marked as "corrupted". Mostly it is for DBA to process + corrupted index and table */ +@@ -884,5 +888,13 @@ struct srv_slot_t{ + # define srv_start_raw_disk_in_use 0 + # define srv_file_per_table 1 + #endif /* !UNIV_HOTBACKUP */ ++#ifdef WITH_WSREP ++UNIV_INTERN ++void ++wsrep_srv_conc_cancel_wait( ++/*==================*/ ++ trx_t* trx); /*!< in: transaction object associated with the ++ thread */ ++#endif /* WITH_WSREP */ + + #endif +diff --git a/storage/innobase/include/sync0sync.ic b/storage/innobase/include/sync0sync.ic +index 616e53d..2a85d2b 100644 +--- a/storage/innobase/include/sync0sync.ic ++++ b/storage/innobase/include/sync0sync.ic +@@ -213,8 +213,10 @@ mutex_enter_func( + ulint line) /*!< in: line where locked */ + { + ut_ad(mutex_validate(mutex)); ++#ifndef WITH_WSREP ++ /* this cannot be be granted when BF trx kills a trx in lock wait state */ + ut_ad(!mutex_own(mutex)); +- ++#endif /* WITH_WSREP */ + /* Note that we do not peek at the value of lock_word before trying + the atomic test_and_set; we could peek, and possibly save time. */ + +diff --git a/storage/innobase/include/trx0sys.h b/storage/innobase/include/trx0sys.h +index 70f214d..28ed5bf 100644 +--- a/storage/innobase/include/trx0sys.h ++++ b/storage/innobase/include/trx0sys.h +@@ -41,6 +41,9 @@ Created 3/26/1996 Heikki Tuuri + #include "ut0bh.h" + #include "read0types.h" + #include "page0types.h" ++#ifdef WITH_WSREP ++#include "trx0xa.h" ++#endif /* WITH_WSREP */ + #include "ut0bh.h" + + typedef UT_LIST_BASE_NODE_T(trx_t) trx_list_t; +@@ -293,6 +296,9 @@ trx_sys_update_mysql_binlog_offset( + ib_int64_t offset, /*!< in: position in that log file */ + ulint field, /*!< in: offset of the MySQL log info field in + the trx sys header */ ++#ifdef WITH_WSREP ++ trx_sysf_t* sys_header, /*!< in: trx sys header */ ++#endif /* WITH_WSREP */ + mtr_t* mtr); /*!< in: mtr */ + /*****************************************************************//** + Prints to stderr the MySQL binlog offset info in the trx system header if +@@ -301,6 +307,19 @@ UNIV_INTERN + void + trx_sys_print_mysql_binlog_offset(void); + /*===================================*/ ++#ifdef WITH_WSREP ++/** Update WSREP checkpoint XID in sys header. */ ++void ++trx_sys_update_wsrep_checkpoint( ++ const XID* xid, /*!< in: WSREP XID */ ++ trx_sysf_t* sys_header, /*!< in: sys_header */ ++ mtr_t* mtr); /*!< in: mtr */ ++ ++void ++/** Read WSREP checkpoint XID from sys header. */ ++trx_sys_read_wsrep_checkpoint( ++ XID* xid); /*!< out: WSREP XID */ ++#endif /* WITH_WSREP */ + /*****************************************************************//** + Prints to stderr the MySQL master log offset info in the trx system header if + the magic number shows it valid. */ +@@ -529,6 +548,20 @@ this contains the same fields as TRX_SYS_MYSQL_LOG_INFO below */ + within that file */ + #define TRX_SYS_MYSQL_LOG_NAME 12 /*!< MySQL log file name */ + ++#ifdef WITH_WSREP ++/* The offset to WSREP XID headers */ ++#define TRX_SYS_WSREP_XID_INFO (UNIV_PAGE_SIZE - 3500) ++#define TRX_SYS_WSREP_XID_MAGIC_N_FLD 0 ++#define TRX_SYS_WSREP_XID_MAGIC_N 0x77737265 ++ ++/* XID field: formatID, gtrid_len, bqual_len, xid_data */ ++#define TRX_SYS_WSREP_XID_LEN (4 + 4 + 4 + XIDDATASIZE) ++#define TRX_SYS_WSREP_XID_FORMAT 4 ++#define TRX_SYS_WSREP_XID_GTRID_LEN 8 ++#define TRX_SYS_WSREP_XID_BQUAL_LEN 12 ++#define TRX_SYS_WSREP_XID_DATA 16 ++#endif /* WITH_WSREP*/ ++ + /** Doublewrite buffer */ + /* @{ */ + /** The offset of the doublewrite buffer header on the trx system header page */ +diff --git a/storage/innobase/include/trx0sys.ic b/storage/innobase/include/trx0sys.ic +index e097e29..7265a97 100644 +--- a/storage/innobase/include/trx0sys.ic ++++ b/storage/innobase/include/trx0sys.ic +@@ -445,7 +445,10 @@ trx_id_t + trx_sys_get_new_trx_id(void) + /*========================*/ + { ++#ifndef WITH_WSREP ++ /* wsrep_fake_trx_id violates this assert */ + ut_ad(mutex_own(&trx_sys->mutex)); ++#endif /* WITH_WSREP */ + + /* VERY important: after the database is started, max_trx_id value is + divisible by TRX_SYS_TRX_ID_WRITE_MARGIN, and the following if +diff --git a/storage/innobase/include/trx0trx.h b/storage/innobase/include/trx0trx.h +index 144e180..6adbe2c 100644 +--- a/storage/innobase/include/trx0trx.h ++++ b/storage/innobase/include/trx0trx.h +@@ -1004,6 +1004,9 @@ struct trx_t{ + /*------------------------------*/ + char detailed_error[256]; /*!< detailed error message for last + error, or empty. */ ++#ifdef WITH_WSREP ++ os_event_t wsrep_event; /* event waited for in srv_conc_slot */ ++#endif /* WITH_WSREP */ + }; + + /* Transaction isolation levels (trx->isolation_level) */ +diff --git a/storage/innobase/lock/lock0lock.cc b/storage/innobase/lock/lock0lock.cc +index bf7ca16..881507a 100644 +--- a/storage/innobase/lock/lock0lock.cc ++++ b/storage/innobase/lock/lock0lock.cc +@@ -50,6 +50,10 @@ Created 5/7/1996 Heikki Tuuri + #include "dict0boot.h" + #include + ++#ifdef WITH_WSREP ++extern my_bool wsrep_debug; ++extern my_bool wsrep_log_conflicts; ++#endif + /* Restricts the length of search we will do in the waits-for + graph of transactions */ + #define LOCK_MAX_N_STEPS_IN_DEADLOCK_CHECK 1000000 +@@ -945,6 +949,9 @@ UNIV_INLINE + ibool + lock_rec_has_to_wait( + /*=================*/ ++#ifdef WITH_WSREP ++ ibool for_locking, /*!< is caller locking or releasing */ ++#endif /* WITH_WSREP */ + const trx_t* trx, /*!< in: trx of new lock */ + ulint type_mode,/*!< in: precise mode of the new lock + to set: LOCK_S or LOCK_X, possibly +@@ -1015,9 +1022,59 @@ lock_rec_has_to_wait( + return(FALSE); + } + ++#ifdef WITH_WSREP ++ /* if BF thread is locking and has conflict with another BF ++ thread, we need to look at trx ordering and lock types */ ++ if (wsrep_thd_is_BF(trx->mysql_thd, FALSE) && ++ wsrep_thd_is_BF(lock2->trx->mysql_thd, TRUE)) { ++ ++ if (wsrep_debug) { ++ fprintf(stderr, ++ "BF-BF lock conflict, locking: %lu\n", ++ for_locking); ++ lock_rec_print(stderr, lock2); ++ } ++ ++ if (wsrep_trx_order_before(trx->mysql_thd, ++ lock2->trx->mysql_thd) && ++ (type_mode & LOCK_MODE_MASK) == LOCK_X && ++ (lock2->type_mode & LOCK_MODE_MASK) == LOCK_X) ++ { ++ if (for_locking || wsrep_debug) { ++ /* exclusive lock conflicts are not ++ accepted */ ++ fprintf(stderr, ++ "BF-BF X lock conflict," ++ "mode: %lu supremum: %lu\n", ++ type_mode, lock_is_on_supremum); ++ fprintf(stderr, ++ "conflicts states: my %d locked %d\n", ++ wsrep_thd_conflict_state(trx->mysql_thd, FALSE), ++ wsrep_thd_conflict_state(lock2->trx->mysql_thd, FALSE) ); ++ lock_rec_print(stderr, lock2); ++ if (for_locking) return FALSE; ++ //abort(); ++ } ++ } else { ++ /* if lock2->index->n_uniq <= ++ lock2->index->n_user_defined_cols ++ operation is on uniq index ++ */ ++ if (wsrep_debug) fprintf(stderr, ++ "BF conflict, modes: %lu %lu, " ++ "idx: %s-%s n_uniq %u n_user %u\n", ++ type_mode, lock2->type_mode, ++ lock2->index->name, ++ lock2->index->table_name, ++ lock2->index->n_uniq, ++ lock2->index->n_user_defined_cols); ++ return FALSE; ++ } ++ } ++#endif /* WITH_WSREP */ + return(TRUE); + } +- ++ + return(FALSE); + } + +@@ -1045,7 +1102,11 @@ lock_has_to_wait( + /* If this lock request is for a supremum record + then the second bit on the lock bitmap is set */ + ++#ifdef WITH_WSREP ++ return(lock_rec_has_to_wait(FALSE, lock1->trx, ++#else + return(lock_rec_has_to_wait(lock1->trx, ++#endif /* WITH_WSREP */ + lock1->type_mode, lock2, + lock_rec_get_nth_bit( + lock1, 1))); +@@ -1514,6 +1575,11 @@ lock_rec_has_expl( + return(NULL); + } + ++#ifdef WITH_WSREP ++static ++void ++lock_rec_discard(lock_t* in_lock); ++#endif + #ifdef UNIV_DEBUG + /*********************************************************************//** + Checks if some other transaction has a lock request in the queue. +@@ -1562,6 +1628,58 @@ lock_rec_other_has_expl_req( + } + #endif /* UNIV_DEBUG */ + ++#ifdef WITH_WSREP ++static void ++wsrep_kill_victim(const trx_t * const trx, const lock_t *lock) { ++ ut_ad(lock_mutex_own()); ++ ut_ad(trx_mutex_own(lock->trx)); ++ my_bool bf_this = wsrep_thd_is_BF(trx->mysql_thd, FALSE); ++ my_bool bf_other = wsrep_thd_is_BF(lock->trx->mysql_thd, TRUE); ++ ++ if ((bf_this && !bf_other) || ++ (bf_this && bf_other && wsrep_trx_order_before( ++ trx->mysql_thd, lock->trx->mysql_thd))) { ++ ++ if (lock->trx->lock.que_state == TRX_QUE_LOCK_WAIT) { ++ if (wsrep_debug) ++ fprintf(stderr, "WSREP: BF victim waiting\n"); ++ /* cannot release lock, until our lock ++ is in the queue*/ ++ } else if (lock->trx != trx) { ++ if (wsrep_log_conflicts) { ++ mutex_enter(&trx_sys->mutex); ++ if (bf_this) ++ fputs("\n*** Priority TRANSACTION:\n", ++ stderr); ++ else ++ fputs("\n*** Victim TRANSACTION:\n", ++ stderr); ++ trx_print_latched(stderr, trx, 3000); ++ ++ if (bf_other) ++ fputs("\n*** Priority TRANSACTION:\n", ++ stderr); ++ else ++ fputs("\n*** Victim TRANSACTION:\n", ++ stderr); ++ trx_print_latched(stderr, lock->trx, 3000); ++ ++ mutex_exit(&trx_sys->mutex); ++ fputs("*** WAITING FOR THIS LOCK TO BE GRANTED:\n", ++ stderr); ++ ++ if (lock_get_type(lock) == LOCK_REC) { ++ lock_rec_print(stderr, lock); ++ } else { ++ lock_table_print(stderr, lock); ++ } ++ } ++ wsrep_innobase_kill_one_trx(trx->mysql_thd, ++ (const trx_t*) trx, lock->trx, TRUE); ++ } ++ } ++} ++#endif + /*********************************************************************//** + Checks if some other transaction has a conflicting explicit lock request + in the queue, so that we have to wait. +@@ -1590,7 +1708,14 @@ lock_rec_other_has_conflicting( + lock != NULL; + lock = lock_rec_get_next_const(heap_no, lock)) { + ++#ifdef WITH_WSREP ++ if (lock_rec_has_to_wait(TRUE, trx, mode, lock, is_supremum)) { ++ trx_mutex_enter(lock->trx); ++ wsrep_kill_victim(trx, lock); ++ trx_mutex_exit(lock->trx); ++#else + if (lock_rec_has_to_wait(trx, mode, lock, is_supremum)) { ++#endif /* WITH_WSREP */ + return(lock); + } + } +@@ -1683,6 +1808,7 @@ lock_sec_rec_some_has_impl( + return(trx_id); + } + ++#ifndef WITH_WSREP + #ifdef UNIV_DEBUG + /*********************************************************************//** + Checks if some transaction, other than given trx_id, has an explicit +@@ -1733,6 +1859,7 @@ lock_rec_other_trx_holds_expl( + return(holds); + } + #endif /* UNIV_DEBUG */ ++#endif /* !WITH_WSREP */ + + /*********************************************************************//** + Return approximate number or record locks (bits set in the bitmap) for +@@ -1770,6 +1897,27 @@ lock_number_of_rows_locked( + } + + /*============== RECORD LOCK CREATION AND QUEUE MANAGEMENT =============*/ ++#ifdef WITH_WSREP ++static ++void ++wsrep_print_wait_locks( ++/*============*/ ++ lock_t* c_lock) /* conflicting lock to print */ ++{ ++ if (wsrep_debug && c_lock->trx->lock.wait_lock != c_lock) { ++ fprintf(stderr, "WSREP: c_lock != wait lock\n"); ++ if (lock_get_type_low(c_lock) & LOCK_TABLE) ++ lock_table_print(stderr, c_lock); ++ else ++ lock_rec_print(stderr, c_lock); ++ ++ if (lock_get_type_low(c_lock->trx->lock.wait_lock) & LOCK_TABLE) ++ lock_table_print(stderr, c_lock->trx->lock.wait_lock); ++ else ++ lock_rec_print(stderr, c_lock->trx->lock.wait_lock); ++ } ++} ++#endif /* WITH_WSREP */ + + /*********************************************************************//** + Creates a new record lock and inserts it to the lock queue. Does NOT check +@@ -1779,6 +1927,10 @@ static + lock_t* + lock_rec_create( + /*============*/ ++#ifdef WITH_WSREP ++ lock_t* const c_lock, /* conflicting lock */ ++ que_thr_t* thr, ++#endif + ulint type_mode,/*!< in: lock mode and wait + flag, type is ignored and + replaced by LOCK_REC */ +@@ -1850,9 +2002,79 @@ lock_rec_create( + + ut_ad(index->table->n_ref_count > 0 || !index->table->can_be_evicted); + ++#ifdef WITH_WSREP ++ ++ if (c_lock && wsrep_thd_is_BF(trx->mysql_thd, FALSE)) { ++ lock_t *hash = (lock_t *)c_lock->hash; ++ lock_t *prev = NULL; ++ ++ while (hash && ++ wsrep_thd_is_BF(((lock_t *)hash)->trx->mysql_thd, TRUE) && ++ wsrep_trx_order_before( ++ ((lock_t *)hash)->trx->mysql_thd, ++ trx->mysql_thd)) { ++ prev = hash; ++ hash = (lock_t *)hash->hash; ++ } ++ lock->hash = hash; ++ if (prev) { ++ prev->hash = lock; ++ } else { ++ c_lock->hash = lock; ++ } ++ /* ++ * delayed conflict resolution '...kill_one_trx' was not called, ++ * if victim was waiting for some other lock ++ */ ++ trx_mutex_enter(c_lock->trx); ++ if (c_lock->trx->lock.que_state == TRX_QUE_LOCK_WAIT) { ++ ++ c_lock->trx->lock.was_chosen_as_deadlock_victim = TRUE; ++ ++ if (wsrep_debug) wsrep_print_wait_locks(c_lock); ++ ++ trx->lock.que_state = TRX_QUE_LOCK_WAIT; ++ lock_set_lock_and_trx_wait(lock, trx); ++ UT_LIST_ADD_LAST(trx_locks, trx->lock.trx_locks, lock); ++ ++ ut_ad(thr != NULL); ++ trx->lock.wait_thr = thr; ++ thr->state = QUE_THR_LOCK_WAIT; ++ ++ /* have to release trx mutex for the duration of ++ victim lock release. This will eventually call ++ lock_grant, which wants to grant trx mutex again ++ */ ++ if (caller_owns_trx_mutex) trx_mutex_exit(trx); ++ lock_cancel_waiting_and_release( ++ c_lock->trx->lock.wait_lock); ++ if (caller_owns_trx_mutex) trx_mutex_enter(trx); ++ ++ /* trx might not wait for c_lock, but some other lock ++ does not matter if wait_lock was released above ++ */ ++ if (c_lock->trx->lock.wait_lock == c_lock) { ++ lock_reset_lock_and_trx_wait(lock); ++ } ++ trx_mutex_exit(c_lock->trx); ++ ++ if (wsrep_debug) fprintf( ++ stderr, ++ "WSREP: c_lock canceled %llu\n", ++ (ulonglong) c_lock->trx->id); ++ ++ /* have to bail out here to avoid lock_set_lock... */ ++ return(lock); ++ } ++ trx_mutex_exit(c_lock->trx); ++ } else { ++ HASH_INSERT(lock_t, hash, lock_sys->rec_hash, ++ lock_rec_fold(space, page_no), lock); ++ } ++#else + HASH_INSERT(lock_t, hash, lock_sys->rec_hash, + lock_rec_fold(space, page_no), lock); +- ++#endif /* WITH_WSREP */ + if (!caller_owns_trx_mutex) { + trx_mutex_enter(trx); + } +@@ -1871,7 +2093,6 @@ lock_rec_create( + + MONITOR_INC(MONITOR_RECLOCK_CREATED); + MONITOR_INC(MONITOR_NUM_RECLOCK); +- + return(lock); + } + +@@ -1886,6 +2107,9 @@ static + dberr_t + lock_rec_enqueue_waiting( + /*=====================*/ ++#ifdef WITH_WSREP ++ lock_t* c_lock, /* conflicting lock */ ++#endif + ulint type_mode,/*!< in: lock mode this + transaction is requesting: + LOCK_S or LOCK_X, possibly +@@ -1942,8 +2166,17 @@ lock_rec_enqueue_waiting( + + /* Enqueue the lock request that will wait to be granted, note that + we already own the trx mutex. */ ++#ifdef WITH_WSREP ++ if (wsrep_on(trx->mysql_thd) && ++ trx->lock.was_chosen_as_deadlock_victim) { ++ return(DB_DEADLOCK); ++ } ++ lock = lock_rec_create(c_lock, thr, ++ type_mode | LOCK_WAIT, block, heap_no, index, trx, TRUE); ++#else + lock = lock_rec_create( + type_mode | LOCK_WAIT, block, heap_no, index, trx, TRUE); ++#endif /* WITH_WSREP */ + + /* Release the mutex to obey the latching order. + This is safe, because lock_deadlock_check_and_resolve() +@@ -2044,7 +2277,19 @@ lock_rec_add_to_queue( + const lock_t* other_lock + = lock_rec_other_has_expl_req(mode, 0, LOCK_WAIT, + block, heap_no, trx); ++#ifdef WITH_WSREP ++ /* this can potentionally assert with wsrep */ ++ if (wsrep_on(trx->mysql_thd)) { ++ if (wsrep_debug && other_lock) { ++ fprintf(stderr, ++ "WSREP: InnoDB assert ignored\n"); ++ } ++ } else { ++ ut_a(!other_lock); ++ } ++#else + ut_a(!other_lock); ++#endif /* WITH_WSREP */ + } + #endif /* UNIV_DEBUG */ + +@@ -2072,7 +2317,16 @@ lock_rec_add_to_queue( + + if (lock_get_wait(lock) + && lock_rec_get_nth_bit(lock, heap_no)) { +- ++#ifdef WITH_WSREP ++ if (wsrep_thd_is_BF(trx->mysql_thd, FALSE)) { ++ if (wsrep_debug) { ++ fprintf(stderr, ++ "BF skipping wait: %lu\n", ++ trx->id); ++ lock_rec_print(stderr, lock); ++ } ++ } else ++#endif + goto somebody_waits; + } + } +@@ -2095,9 +2349,15 @@ lock_rec_add_to_queue( + } + + somebody_waits: ++#ifdef WITH_WSREP ++ return(lock_rec_create(NULL, NULL, ++ type_mode, block, heap_no, index, trx, ++ caller_owns_trx_mutex)); ++#else + return(lock_rec_create( + type_mode, block, heap_no, index, trx, + caller_owns_trx_mutex)); ++#endif + } + + /** Record locking request status */ +@@ -2160,9 +2420,13 @@ lock_rec_lock_fast( + if (lock == NULL) { + if (!impl) { + /* Note that we don't own the trx mutex. */ ++#ifdef WITH_WSREP ++ lock = lock_rec_create(NULL, thr, ++ mode, block, heap_no, index, trx, FALSE); ++#else + lock = lock_rec_create( + mode, block, heap_no, index, trx, FALSE); +- ++#endif + } + status = LOCK_REC_SUCCESS_CREATED; + } else { +@@ -2215,6 +2479,9 @@ lock_rec_lock_slow( + que_thr_t* thr) /*!< in: query thread */ + { + trx_t* trx; ++#ifdef WITH_WSREP ++ lock_t* c_lock(NULL); ++#endif + dberr_t err = DB_SUCCESS; + + ut_ad(lock_mutex_own()); +@@ -2239,18 +2506,30 @@ lock_rec_lock_slow( + /* The trx already has a strong enough lock on rec: do + nothing */ + ++#ifdef WITH_WSREP ++ } else if ((c_lock = (lock_t *)lock_rec_other_has_conflicting( ++ static_cast(mode), ++ block, heap_no, trx))) { ++#else + } else if (lock_rec_other_has_conflicting( + static_cast(mode), + block, heap_no, trx)) { +- ++#endif /* WITH_WSREP */ + /* If another transaction has a non-gap conflicting + request in the queue, as this transaction does not + have a lock strong enough already granted on the + record, we have to wait. */ + ++#ifdef WITH_WSREP ++ /* c_lock is NULL here if jump to enqueue_waiting happened ++ but it's ok because lock is not NULL in that case and c_lock ++ is not used. */ ++ err = lock_rec_enqueue_waiting(c_lock, ++ mode, block, heap_no, index, thr); ++#else + err = lock_rec_enqueue_waiting( + mode, block, heap_no, index, thr); +- ++#endif /* WITH_WSREP */ + } else if (!impl) { + /* Set the requested lock on the record, note that + we already own the transaction mutex. */ +@@ -2355,7 +2634,13 @@ lock_rec_has_to_wait_in_queue( + if (heap_no < lock_rec_get_n_bits(lock) + && (p[bit_offset] & bit_mask) + && lock_has_to_wait(wait_lock, lock)) { +- ++#ifdef WITH_WSREP ++ if (wsrep_thd_is_BF(wait_lock->trx->mysql_thd, FALSE) && ++ wsrep_thd_is_BF(lock->trx->mysql_thd, TRUE)) { ++ /* don't wait for another BF lock */ ++ continue; ++ } ++#endif + return(lock); + } + } +@@ -3739,9 +4024,19 @@ lock_deadlock_select_victim( + /* The joining transaction is 'smaller', + choose it as the victim and roll it back. */ + ++#ifdef WITH_WSREP ++ if (wsrep_thd_is_BF(ctx->start->mysql_thd, TRUE)) ++ return(ctx->wait_lock->trx); ++ else ++#endif /* WITH_WSREP */ + return(ctx->start); + } + ++#ifdef WITH_WSREP ++ if (wsrep_thd_is_BF(ctx->wait_lock->trx->mysql_thd, TRUE)) ++ return(ctx->start); ++ else ++#endif /* WITH_WSREP */ + return(ctx->wait_lock->trx); + } + +@@ -3872,6 +4167,11 @@ lock_deadlock_search( + ctx->too_deep = TRUE; + + /* Select the joining transaction as the victim. */ ++#ifdef WITH_WSREP ++ if (wsrep_thd_is_BF(ctx->start->mysql_thd, TRUE)) ++ return(ctx->wait_lock->trx->id); ++ else ++#endif /* WITH_WSREP */ + return(ctx->start->id); + + } else if (lock->trx->lock.que_state == TRX_QUE_LOCK_WAIT) { +@@ -3889,6 +4189,11 @@ lock_deadlock_search( + + ctx->too_deep = TRUE; + ++#ifdef WITH_WSREP ++ if (wsrep_thd_is_BF(ctx->start->mysql_thd, TRUE)) ++ return(lock->trx->id); ++ else ++#endif /* WITH_WSREP */ + return(ctx->start->id); + } + +@@ -4005,11 +4310,21 @@ lock_deadlock_check_and_resolve( + if (ctx.too_deep) { + + ut_a(trx == ctx.start); ++ ++#ifdef WITH_WSREP ++ if (!wsrep_thd_is_BF(ctx.start->mysql_thd, TRUE)) ++ { ++#endif /* WITH_WSREP */ + ut_a(victim_trx_id == trx->id); + + if (!srv_read_only_mode) { + lock_deadlock_joining_trx_print(trx, lock); + } ++#ifdef WITH_WSREP ++ } else { ++ /* BF processor */; ++ } ++#endif /* WITH_WSREP */ + + MONITOR_INC(MONITOR_DEADLOCK); + +@@ -4047,6 +4362,9 @@ UNIV_INLINE + lock_t* + lock_table_create( + /*==============*/ ++#ifdef WITH_WSREP ++ lock_t* c_lock, /* conflicting lock */ ++#endif + dict_table_t* table, /*!< in/out: database table + in dictionary cache */ + ulint type_mode,/*!< in: lock mode possibly ORed with +@@ -4090,7 +4408,46 @@ lock_table_create( + ut_ad(table->n_ref_count > 0 || !table->can_be_evicted); + + UT_LIST_ADD_LAST(trx_locks, trx->lock.trx_locks, lock); ++#ifdef WITH_WSREP ++ if (c_lock && wsrep_thd_is_BF(trx->mysql_thd, FALSE)) { ++ UT_LIST_INSERT_AFTER( ++ un_member.tab_lock.locks, table->locks, c_lock, lock); ++ } else { ++ UT_LIST_ADD_LAST(un_member.tab_lock.locks, table->locks, lock); ++ } ++ ++ if (c_lock) trx_mutex_enter(c_lock->trx); ++ if (c_lock && c_lock->trx->lock.que_state == TRX_QUE_LOCK_WAIT) { ++ ++ c_lock->trx->lock.was_chosen_as_deadlock_victim = TRUE; ++ ++ if (wsrep_debug) wsrep_print_wait_locks(c_lock); ++ ++ /* have to release trx mutex for the duration of ++ victim lock release. This will eventually call ++ lock_grant, which wants to grant trx mutex again ++ */ ++ /* caller has trx_mutex, have to release for lock cancel */ ++ trx_mutex_exit(trx); ++ lock_cancel_waiting_and_release(c_lock->trx->lock.wait_lock); ++ trx_mutex_enter(trx); ++ ++ /* trx might not wait for c_lock, but some other lock ++ does not matter if wait_lock was released above ++ */ ++ if (c_lock->trx->lock.wait_lock == c_lock) { ++ lock_reset_lock_and_trx_wait(lock); ++ } ++ ++ if (wsrep_debug) { ++ fprintf(stderr, "WSREP: c_lock canceled %llu\n", ++ (ulonglong) c_lock->trx->id); ++ } ++ } ++ if (c_lock) trx_mutex_exit(c_lock->trx); ++#else + UT_LIST_ADD_LAST(un_member.tab_lock.locks, table->locks, lock); ++#endif /* WITH_WSREP */ + + if (UNIV_UNLIKELY(type_mode & LOCK_WAIT)) { + +@@ -4247,12 +4604,15 @@ static + dberr_t + lock_table_enqueue_waiting( + /*=======================*/ ++#ifdef WITH_WSREP ++ lock_t* c_lock, /* conflicting lock */ ++#endif + ulint mode, /*!< in: lock mode this transaction is + requesting */ + dict_table_t* table, /*!< in/out: table */ + que_thr_t* thr) /*!< in: query thread */ + { +- trx_t* trx; ++ trx_t* trx; + lock_t* lock; + trx_id_t victim_trx_id; + +@@ -4291,7 +4651,14 @@ lock_table_enqueue_waiting( + + /* Enqueue the lock request that will wait to be granted */ + ++#ifdef WITH_WSREP ++ if (trx->lock.was_chosen_as_deadlock_victim) { ++ return(DB_DEADLOCK); ++ } ++ lock = lock_table_create(c_lock, table, mode | LOCK_WAIT, trx); ++#else + lock = lock_table_create(table, mode | LOCK_WAIT, trx); ++#endif + + /* Release the mutex to obey the latching order. + This is safe, because lock_deadlock_check_and_resolve() +@@ -4363,6 +4730,13 @@ lock_table_other_has_incompatible( + && !lock_mode_compatible(lock_get_mode(lock), mode) + && (wait || !lock_get_wait(lock))) { + ++#ifdef WITH_WSREP ++ if (wsrep_debug) ++ fprintf(stderr, "WSREP: table lock abort"); ++ trx_mutex_enter(lock->trx); ++ wsrep_kill_victim((trx_t *)trx, (lock_t *)lock); ++ trx_mutex_exit(lock->trx); ++#endif + return(lock); + } + } +@@ -4424,9 +4798,18 @@ lock_table( + mode: this trx may have to wait */ + + if (wait_for != NULL) { ++#ifdef WITH_WSREP ++ err = lock_table_enqueue_waiting((lock_t *)wait_for, ++ mode | flags, table, thr); ++#else + err = lock_table_enqueue_waiting(mode | flags, table, thr); ++#endif /* WITH_WSREP */ + } else { ++#ifdef WITH_WSREP ++ lock_table_create((lock_t *)wait_for, table, mode | flags, trx); ++#else + lock_table_create(table, mode | flags, trx); ++#endif /* WITH_WSREP */ + + ut_a(!flags || mode == LOCK_S || mode == LOCK_X); + +@@ -4464,7 +4847,11 @@ lock_table_ix_resurrect( + trx, LOCK_WAIT, table, LOCK_IX)); + + trx_mutex_enter(trx); ++#ifdef WITH_WSREP ++ lock_table_create(NULL, table, LOCK_IX, trx); ++#else + lock_table_create(table, LOCK_IX, trx); ++#endif /* WITH_WSREP */ + lock_mutex_exit(); + trx_mutex_exit(trx); + } +@@ -5612,6 +5999,7 @@ lock_rec_queue_validate( + + if (!lock_rec_get_gap(lock) && !lock_get_wait(lock)) { + ++#ifndef WITH_WSREP + enum lock_mode mode; + + if (lock_get_mode(lock) == LOCK_S) { +@@ -5621,6 +6009,7 @@ lock_rec_queue_validate( + } + ut_a(!lock_rec_other_has_expl_req( + mode, 0, 0, block, heap_no, lock->trx)); ++#endif /* WITH_WSREP */ + + } else if (lock_get_wait(lock) && !lock_rec_get_gap(lock)) { + +@@ -5924,6 +6313,9 @@ lock_rec_insert_check_and_lock( + lock_t* lock; + dberr_t err; + ulint next_rec_heap_no; ++#ifdef WITH_WSREP ++ lock_t *c_lock; ++#endif + ibool inherit_in = *inherit; + + ut_ad(block->frame == page_align(rec)); +@@ -5981,17 +6373,29 @@ lock_rec_insert_check_and_lock( + had to wait for their insert. Both had waiting gap type lock requests + on the successor, which produced an unnecessary deadlock. */ + ++#ifdef WITH_WSREP ++ if ((c_lock = (lock_t *)lock_rec_other_has_conflicting( ++ static_cast( ++ LOCK_X | LOCK_GAP | LOCK_INSERT_INTENTION), ++ block, next_rec_heap_no, trx))) { ++#else + if (lock_rec_other_has_conflicting( + static_cast( + LOCK_X | LOCK_GAP | LOCK_INSERT_INTENTION), + block, next_rec_heap_no, trx)) { +- ++#endif /* WITH_WSREP */ + /* Note that we may get DB_SUCCESS also here! */ + trx_mutex_enter(trx); + ++#ifdef WITH_WSREP ++ err = lock_rec_enqueue_waiting(c_lock, ++ LOCK_X | LOCK_GAP | LOCK_INSERT_INTENTION, ++ block, next_rec_heap_no, index, thr); ++#else + err = lock_rec_enqueue_waiting( + LOCK_X | LOCK_GAP | LOCK_INSERT_INTENTION, + block, next_rec_heap_no, index, thr); ++#endif /* WITH_WSREP */ + + trx_mutex_exit(trx); + } else { +@@ -6070,8 +6474,10 @@ lock_rec_convert_impl_to_expl( + trx_is_active(trx_id, NULL) check below, because we are not + holding lock_mutex. */ + ++#ifndef WITH_WSREP + ut_ad(!lock_rec_other_trx_holds_expl(LOCK_S | LOCK_REC_NOT_GAP, + trx_id, rec, block)); ++#endif /* WITH_WSREP */ + } + + if (trx_id != 0) { +diff --git a/storage/innobase/lock/lock0wait.cc b/storage/innobase/lock/lock0wait.cc +index a1c35e2..9d1a4da 100644 +--- a/storage/innobase/lock/lock0wait.cc ++++ b/storage/innobase/lock/lock0wait.cc +@@ -184,6 +184,28 @@ lock_wait_table_reserve_slot( + return(NULL); + } + ++#ifdef WITH_WSREP ++/*********************************************************************//** ++check if lock timeout was for priority thread, ++as a side effect trigger lock monitor ++@return false for regular lock timeout */ ++static ibool ++wsrep_is_BF_lock_timeout( ++/*====================*/ ++ trx_t* trx) /* in: trx to check for lock priority */ ++{ ++ if (wsrep_on(trx->mysql_thd) && ++ wsrep_thd_is_BF(trx->mysql_thd, FALSE)) { ++ fprintf(stderr, "WSREP: BF lock wait long\n"); ++ srv_print_innodb_monitor = TRUE; ++ srv_print_innodb_lock_monitor = TRUE; ++ os_event_set(srv_monitor_event); ++ return TRUE; ++ } ++ return FALSE; ++ } ++#endif /* WITH_WSREP */ ++ + /***************************************************************//** + Puts a user OS thread to wait for a lock to be released. If an error + occurs during the wait trx->error_state associated with thr is +@@ -375,9 +397,15 @@ lock_wait_suspend_thread( + + if (lock_wait_timeout < 100000000 + && wait_time > (double) lock_wait_timeout) { ++#ifdef WITH_WSREP ++ if (!wsrep_is_BF_lock_timeout(trx)) { ++#endif /* WITH_WSREP */ + + trx->error_state = DB_LOCK_WAIT_TIMEOUT; + ++#ifdef WITH_WSREP ++ } ++#endif /* WITH_WSREP */ + MONITOR_INC(MONITOR_TIMEOUT); + } + +@@ -461,8 +489,14 @@ lock_wait_check_and_cancel( + if (trx->lock.wait_lock) { + + ut_a(trx->lock.que_state == TRX_QUE_LOCK_WAIT); ++#ifdef WITH_WSREP ++ if (!wsrep_is_BF_lock_timeout(trx)) { ++#endif /* WITH_WSREP */ + + lock_cancel_waiting_and_release(trx->lock.wait_lock); ++#ifdef WITH_WSREP ++ } ++#endif /* WITH_WSREP */ + } + + lock_mutex_exit(); +diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc +index fb7e8ca..41372a8 100644 +--- a/storage/innobase/os/os0file.cc ++++ b/storage/innobase/os/os0file.cc +@@ -87,6 +87,12 @@ UNIV_INTERN os_ib_mutex_t os_file_seek_mutexes[OS_FILE_N_SEEK_MUTEXES]; + /* In simulated aio, merge at most this many consecutive i/os */ + #define OS_AIO_MERGE_N_CONSECUTIVE 64 + ++#ifdef WITH_INNODB_DISALLOW_WRITES ++#define WAIT_ALLOW_WRITES() os_event_wait(srv_allow_writes_event) ++#else ++#define WAIT_ALLOW_WRITES() do { } while (0) ++#endif /* WITH_INNODB_DISALLOW_WRITES */ ++ + /********************************************************************** + + InnoDB AIO Implementation: +@@ -763,7 +769,11 @@ os_file_create_tmpfile(void) + /*========================*/ + { + FILE* file = NULL; +- int fd = innobase_mysql_tmpfile(); ++ int fd; ++ WAIT_ALLOW_WRITES(); ++ fd = innobase_mysql_tmpfile(); ++ ++ ut_ad(!srv_read_only_mode); + + ut_ad(!srv_read_only_mode); + +@@ -1089,6 +1099,7 @@ os_file_create_directory( + return(TRUE); + #else + int rcode; ++ WAIT_ALLOW_WRITES(); + + rcode = mkdir(pathname, 0770); + +@@ -1215,6 +1226,8 @@ os_file_create_simple_func( + + #else /* __WIN__ */ + int create_flag; ++ if (create_mode != OS_FILE_OPEN && create_mode != OS_FILE_OPEN_RAW) ++ WAIT_ALLOW_WRITES(); + + ut_a(!(create_mode & OS_FILE_ON_ERROR_SILENT)); + ut_a(!(create_mode & OS_FILE_ON_ERROR_NO_EXIT)); +@@ -1382,6 +1395,8 @@ os_file_create_simple_no_error_handling_func( + int create_flag; + + ut_a(name); ++ if (create_mode != OS_FILE_OPEN && create_mode != OS_FILE_OPEN_RAW) ++ WAIT_ALLOW_WRITES(); + + ut_a(!(create_mode & OS_FILE_ON_ERROR_SILENT)); + ut_a(!(create_mode & OS_FILE_ON_ERROR_NO_EXIT)); +@@ -1673,6 +1688,8 @@ os_file_create_func( + #else /* __WIN__ */ + int create_flag; + const char* mode_str = NULL; ++ if (create_mode != OS_FILE_OPEN && create_mode != OS_FILE_OPEN_RAW) ++ WAIT_ALLOW_WRITES(); + + on_error_no_exit = create_mode & OS_FILE_ON_ERROR_NO_EXIT + ? TRUE : FALSE; +@@ -1852,6 +1869,7 @@ loop: + goto loop; + #else + int ret; ++ WAIT_ALLOW_WRITES(); + + ret = unlink(name); + +@@ -1916,6 +1934,7 @@ loop: + goto loop; + #else + int ret; ++ WAIT_ALLOW_WRITES(); + + ret = unlink(name); + +@@ -1969,6 +1988,7 @@ os_file_rename_func( + return(FALSE); + #else + int ret; ++ WAIT_ALLOW_WRITES(); + + ret = rename(oldpath, newpath); + +@@ -2180,6 +2200,7 @@ os_file_set_eof( + HANDLE h = (HANDLE) _get_osfhandle(fileno(file)); + return(SetEndOfFile(h)); + #else /* __WIN__ */ ++ WAIT_ALLOW_WRITES(); + return(!ftruncate(fileno(file), ftell(file))); + #endif /* __WIN__ */ + } +@@ -2274,6 +2295,7 @@ os_file_flush_func( + return(FALSE); + #else + int ret; ++ WAIT_ALLOW_WRITES(); + + #if defined(HAVE_DARWIN_THREADS) + # ifndef F_FULLFSYNC +@@ -2969,6 +2991,7 @@ retry: + return(FALSE); + #else + ssize_t ret; ++ WAIT_ALLOW_WRITES(); + + ret = os_file_pwrite(file, buf, n, offset); + +diff --git a/storage/innobase/rem/rem0rec.cc b/storage/innobase/rem/rem0rec.cc +index 0d7b7c1..9540211 100644 +--- a/storage/innobase/rem/rem0rec.cc ++++ b/storage/innobase/rem/rem0rec.cc +@@ -33,6 +33,9 @@ Created 5/30/1994 Heikki Tuuri + #include "mtr0mtr.h" + #include "mtr0log.h" + #include "fts0fts.h" ++#ifdef WITH_WSREP ++#include ++#endif /* WITH_WSREP */ + + /* PHYSICAL RECORD (OLD STYLE) + =========================== +@@ -1961,3 +1964,133 @@ rec_get_trx_id( + } + # endif /* UNIV_DEBUG */ + #endif /* !UNIV_HOTBACKUP */ ++#ifdef WITH_WSREP ++dberr_t ++wsrep_rec_get_foreign_key( ++ byte *buf, /* out: extracted key */ ++ ulint *buf_len, /* in/out: length of buf */ ++ const rec_t* rec, /* in: physical record */ ++ dict_index_t* index_for, /* in: index in foreign table */ ++ dict_index_t* index_ref, /* in: index in referenced table */ ++ ibool new_protocol) /* in: protocol > 1 */ ++{ ++ const byte* data; ++ ulint len; ++ ulint key_len = 0; ++ ulint i; ++ uint key_parts; ++ mem_heap_t* heap = NULL; ++ ulint offsets_[REC_OFFS_NORMAL_SIZE]; ++ const ulint* offsets; ++ ++ ut_ad(index_for); ++ ut_ad(index_ref); ++ ++ rec_offs_init(offsets_); ++ offsets = rec_get_offsets(rec, index_for, offsets_, ++ ULINT_UNDEFINED, &heap); ++ ++ ut_ad(rec_offs_validate(rec, NULL, offsets)); ++ ++ ut_ad(rec); ++ ++ key_parts = dict_index_get_n_unique_in_tree(index_for); ++ for (i = 0; ++ i < key_parts && ++ (index_for->type & DICT_CLUSTERED || i < key_parts - 1); ++ i++) { ++ dict_field_t* field_f = ++ dict_index_get_nth_field(index_for, i); ++ const dict_col_t* col_f = dict_field_get_col(field_f); ++ dict_field_t* field_r = ++ dict_index_get_nth_field(index_ref, i); ++ const dict_col_t* col_r = dict_field_get_col(field_r); ++ ++ data = rec_get_nth_field(rec, offsets, i, &len); ++ if (key_len + ((len != UNIV_SQL_NULL) ? len + 1 : 1) > ++ *buf_len) { ++ fprintf (stderr, ++ "WSREP: FK key len exceeded %lu %lu %lu\n", ++ key_len, len, *buf_len); ++ goto err_out; ++ } ++ ++ if (len == UNIV_SQL_NULL) { ++ ut_a(!(col_f->prtype & DATA_NOT_NULL)); ++ *buf++ = 1; ++ key_len++; ++ } else if (!new_protocol) { ++ if (!(col_r->prtype & DATA_NOT_NULL)) { ++ *buf++ = 0; ++ key_len++; ++ } ++ memcpy(buf, data, len); ++ *buf_len = wsrep_innobase_mysql_sort( ++ (int)(col_f->prtype & DATA_MYSQL_TYPE_MASK), ++ (uint)dtype_get_charset_coll(col_f->prtype), ++ buf, len, *buf_len); ++ } else { /* new protocol */ ++ if (!(col_r->prtype & DATA_NOT_NULL)) { ++ *buf++ = 0; ++ key_len++; ++ } ++ switch (col_f->mtype) { ++ case DATA_INT: { ++ byte* ptr = buf+len; ++ for (;;) { ++ ptr--; ++ *ptr = *data; ++ if (ptr == buf) { ++ break; ++ } ++ data++; ++ } ++ ++ if (!(col_f->prtype & DATA_UNSIGNED)) { ++ buf[len-1] = (byte) (buf[len-1] ^ 128); ++ } ++ ++ break; ++ } ++ case DATA_VARCHAR: ++ case DATA_VARMYSQL: ++ case DATA_CHAR: ++ case DATA_MYSQL: ++ /* Copy the actual data */ ++ ut_memcpy(buf, data, len); ++ len = wsrep_innobase_mysql_sort( ++ (int) ++ (col_f->prtype & DATA_MYSQL_TYPE_MASK), ++ (uint) ++ dtype_get_charset_coll(col_f->prtype), ++ buf, len, *buf_len); ++ break; ++ case DATA_BLOB: ++ case DATA_BINARY: ++ memcpy(buf, data, len); ++ break; ++ default: ++ break; ++ } ++ ++ key_len += len; ++ buf += len; ++ } ++ } ++ ++ rec_validate(rec, offsets); ++ ++ if (UNIV_LIKELY_NULL(heap)) { ++ mem_heap_free(heap); ++ } ++ ++ *buf_len = key_len; ++ return DB_SUCCESS; ++ ++ err_out: ++ if (UNIV_LIKELY_NULL(heap)) { ++ mem_heap_free(heap); ++ } ++ return DB_ERROR; ++} ++#endif // WITH_WSREP +diff --git a/storage/innobase/row/row0ins.cc b/storage/innobase/row/row0ins.cc +index e31b447..3c3ccf4 100644 +--- a/storage/innobase/row/row0ins.cc ++++ b/storage/innobase/row/row0ins.cc +@@ -920,6 +920,14 @@ row_ins_invalidate_query_cache( + innobase_invalidate_query_cache(thr_get_trx(thr), buf, len); + mem_free(buf); + } ++#ifdef WITH_WSREP ++dberr_t wsrep_append_foreign_key(trx_t *trx, ++ dict_foreign_t* foreign, ++ const rec_t* clust_rec, ++ dict_index_t* clust_index, ++ ibool referenced, ++ ibool shared); ++#endif /* WITH_WSREP */ + + /*********************************************************************//** + Perform referential actions or checks when a parent row is deleted or updated +@@ -1271,6 +1279,18 @@ row_ins_foreign_check_on_constraint( + + cascade->state = UPD_NODE_UPDATE_CLUSTERED; + ++#ifdef WITH_WSREP ++ err = wsrep_append_foreign_key( ++ thr_get_trx(thr), ++ foreign, ++ clust_rec, ++ clust_index, ++ FALSE, FALSE); ++ if (err != DB_SUCCESS) { ++ fprintf(stderr, ++ "WSREP: foreign key append failed: %d\n", err); ++ } else ++#endif + err = row_update_cascade_for_mysql(thr, cascade, + foreign->foreign_table); + +@@ -1603,7 +1623,14 @@ run_again: + + if (check_ref) { + err = DB_SUCCESS; +- ++#ifdef WITH_WSREP ++ err = wsrep_append_foreign_key( ++ thr_get_trx(thr), ++ foreign, ++ rec, ++ check_index, ++ check_ref, TRUE); ++#endif /* WITH_WSREP */ + goto end_scan; + } else if (foreign->type != 0) { + /* There is an ON UPDATE or ON DELETE +diff --git a/storage/innobase/row/row0upd.cc b/storage/innobase/row/row0upd.cc +index fcd5433..5a8987a 100644 +--- a/storage/innobase/row/row0upd.cc ++++ b/storage/innobase/row/row0upd.cc +@@ -51,6 +51,9 @@ Created 12/27/1996 Heikki Tuuri + #include "pars0sym.h" + #include "eval0eval.h" + #include "buf0lru.h" ++#ifdef WITH_WSREP ++extern my_bool wsrep_debug; ++#endif + #include + + /* What kind of latch and lock can we assume when the control comes to +@@ -162,6 +165,42 @@ row_upd_index_is_referenced( + return(is_referenced); + } + ++#ifdef WITH_WSREP ++static ++ibool ++wsrep_row_upd_index_is_foreign( ++/*========================*/ ++ dict_index_t* index, /*!< in: index */ ++ trx_t* trx) /*!< in: transaction */ ++{ ++ dict_table_t* table = index->table; ++ ibool froze_data_dict = FALSE; ++ ibool is_referenced = FALSE; ++ ++ if (table->foreign_set.empty()) { ++ return(FALSE); ++ } ++ ++ if (trx->dict_operation_lock_mode == 0) { ++ row_mysql_freeze_data_dictionary(trx); ++ froze_data_dict = TRUE; ++ } ++ ++ dict_foreign_set::iterator it ++ = std::find_if(table->foreign_set.begin(), ++ table->foreign_set.end(), ++ dict_foreign_with_foreign_index(index)); ++ ++ is_referenced = (it != table->foreign_set.end()); ++ ++ if (froze_data_dict) { ++ row_mysql_unfreeze_data_dictionary(trx); ++ } ++ ++ return(is_referenced); ++} ++#endif /* WITH_WSREP */ ++ + /*********************************************************************//** + Checks if possible foreign key constraints hold after a delete of the record + under pcur. +@@ -281,7 +320,6 @@ run_again: + } + + err = DB_SUCCESS; +- + func_exit: + if (got_s_lock) { + row_mysql_unfreeze_data_dictionary(trx); +@@ -293,6 +331,127 @@ func_exit: + + return(err); + } ++#ifdef WITH_WSREP ++static ++dberr_t ++wsrep_row_upd_check_foreign_constraints( ++/*=================================*/ ++ upd_node_t* node, /*!< in: row update node */ ++ btr_pcur_t* pcur, /*!< in: cursor positioned on a record; NOTE: the ++ cursor position is lost in this function! */ ++ dict_table_t* table, /*!< in: table in question */ ++ dict_index_t* index, /*!< in: index of the cursor */ ++ ulint* offsets,/*!< in/out: rec_get_offsets(pcur.rec, index) */ ++ que_thr_t* thr, /*!< in: query thread */ ++ mtr_t* mtr) /*!< in: mtr */ ++{ ++ dict_foreign_t* foreign; ++ mem_heap_t* heap; ++ dtuple_t* entry; ++ trx_t* trx; ++ const rec_t* rec; ++ ulint n_ext; ++ dberr_t err; ++ ibool got_s_lock = FALSE; ++ ibool opened = FALSE; ++ ++ if (table->foreign_set.empty()) { ++ return(DB_SUCCESS); ++ } ++ ++ trx = thr_get_trx(thr); ++ ++ /* TODO: make native slave thread bail out here */ ++ ++ rec = btr_pcur_get_rec(pcur); ++ ut_ad(rec_offs_validate(rec, index, offsets)); ++ ++ heap = mem_heap_create(500); ++ ++ entry = row_rec_to_index_entry(rec, index, offsets, ++ &n_ext, heap); ++ ++ mtr_commit(mtr); ++ ++ mtr_start(mtr); ++ ++ if (trx->dict_operation_lock_mode == 0) { ++ got_s_lock = TRUE; ++ ++ row_mysql_freeze_data_dictionary(trx); ++ } ++ ++run_again: ++ ++ for (dict_foreign_set::iterator it = table->foreign_set.begin(); ++ it != table->foreign_set.end(); ++ ++it) { ++ ++ foreign = *it; ++ /* Note that we may have an update which updates the index ++ record, but does NOT update the first fields which are ++ referenced in a foreign key constraint. Then the update does ++ NOT break the constraint. */ ++ ++ if (foreign->foreign_index == index ++ && (node->is_delete ++ || row_upd_changes_first_fields_binary( ++ entry, index, node->update, ++ foreign->n_fields))) { ++ ++ if (foreign->referenced_table == NULL) { ++ foreign->referenced_table = ++ dict_table_open_on_name( ++ foreign->referenced_table_name_lookup, ++ FALSE, FALSE, DICT_ERR_IGNORE_NONE); ++ opened = TRUE; ++ } ++ ++ if (foreign->referenced_table) { ++ os_inc_counter(dict_sys->mutex, ++ foreign->referenced_table ++ ->n_foreign_key_checks_running); ++ } ++ ++ /* NOTE that if the thread ends up waiting for a lock ++ we will release dict_operation_lock temporarily! ++ But the counter on the table protects 'foreign' from ++ being dropped while the check is running. */ ++ ++ err = row_ins_check_foreign_constraint( ++ TRUE, foreign, table, entry, thr); ++ ++ if (foreign->referenced_table) { ++ os_dec_counter(dict_sys->mutex, ++ foreign->referenced_table ++ ->n_foreign_key_checks_running); ++ ++ if (opened == TRUE) { ++ dict_table_close(foreign->referenced_table, TRUE, FALSE); ++ opened = FALSE; ++ } ++ } ++ ++ /* Some table foreign key dropped, try again */ ++ if (err == DB_DICT_CHANGED) { ++ goto run_again; ++ } else if (err != DB_SUCCESS) { ++ goto func_exit; ++ } ++ } ++ } ++ ++ err = DB_SUCCESS; ++func_exit: ++ if (got_s_lock) { ++ row_mysql_unfreeze_data_dictionary(trx); ++ } ++ ++ mem_heap_free(heap); ++ ++ return(err); ++} ++#endif /* WITH_WSREP */ + + /*********************************************************************//** + Creates an update node for a query graph. +@@ -1667,6 +1826,9 @@ row_upd_sec_index_entry( + index = node->index; + + referenced = row_upd_index_is_referenced(index, trx); ++#ifdef WITH_WSREP ++ ibool foreign = wsrep_row_upd_index_is_foreign(index, trx); ++#endif /* WITH_WSREP */ + + heap = mem_heap_create(1024); + +@@ -1794,6 +1956,9 @@ row_upd_sec_index_entry( + row_ins_sec_index_entry() below */ + if (!rec_get_deleted_flag( + rec, dict_table_is_comp(index->table))) { ++#ifdef WITH_WSREP ++ que_node_t *parent = que_node_get_parent(node); ++#endif /* WITH_WSREP */ + err = btr_cur_del_mark_set_sec_rec( + 0, btr_cur, TRUE, thr, &mtr); + +@@ -1811,6 +1976,37 @@ row_upd_sec_index_entry( + node, &pcur, index->table, + index, offsets, thr, &mtr); + } ++#ifdef WITH_WSREP ++ if (err == DB_SUCCESS && !referenced && ++ !(parent && que_node_get_type(parent) == ++ QUE_NODE_UPDATE && ++ ((upd_node_t*)parent)->cascade_node == node) && ++ foreign ++ ) { ++ ulint* offsets = ++ rec_get_offsets( ++ rec, index, NULL, ULINT_UNDEFINED, ++ &heap); ++ err = wsrep_row_upd_check_foreign_constraints( ++ node, &pcur, index->table, ++ index, offsets, thr, &mtr); ++ switch (err) { ++ case DB_SUCCESS: ++ case DB_NO_REFERENCED_ROW: ++ err = DB_SUCCESS; ++ break; ++ case DB_DEADLOCK: ++ if (wsrep_debug) fprintf (stderr, ++ "WSREP: sec index FK check fail for deadlock"); ++ break; ++ default: ++ fprintf (stderr, ++ "WSREP: referenced FK check fail: %d", ++ (int)err); ++ break; ++ } ++ } ++#endif /* WITH_WSREP */ + } + break; + } +@@ -1965,6 +2161,9 @@ row_upd_clust_rec_by_insert( + que_thr_t* thr, /*!< in: query thread */ + ibool referenced,/*!< in: TRUE if index may be referenced in + a foreign key constraint */ ++#ifdef WITH_WSREP ++ ibool foreign, /*!< in: TRUE if index is foreign key index */ ++#endif /* WITH_WSREP */ + mtr_t* mtr) /*!< in/out: mtr; gets committed here */ + { + mem_heap_t* heap; +@@ -1978,6 +2177,9 @@ row_upd_clust_rec_by_insert( + rec_t* rec; + ulint* offsets = NULL; + ++#ifdef WITH_WSREP ++ que_node_t *parent = que_node_get_parent(node); ++#endif /* WITH_WSREP */ + ut_ad(node); + ut_ad(dict_index_is_clust(index)); + +@@ -2060,6 +2262,34 @@ err_exit: + goto err_exit; + } + } ++#ifdef WITH_WSREP ++ if (!referenced && ++ !(parent && que_node_get_type(parent) == QUE_NODE_UPDATE && ++ ((upd_node_t*)parent)->cascade_node == node) && ++ foreign ++ ) { ++ err = wsrep_row_upd_check_foreign_constraints( ++ node, pcur, table, index, offsets, thr, mtr); ++ switch (err) { ++ case DB_SUCCESS: ++ case DB_NO_REFERENCED_ROW: ++ err = DB_SUCCESS; ++ break; ++ case DB_DEADLOCK: ++ if (wsrep_debug) fprintf (stderr, ++ "WSREP: insert FK check fail for deadlock"); ++ break; ++ default: ++ fprintf (stderr, ++ "WSREP: referenced FK check fail: %d", ++ (int)err); ++ break; ++ } ++ if (err != DB_SUCCESS) { ++ goto err_exit; ++ } ++ } ++#endif /* WITH_WSREP */ + } + + mtr_commit(mtr); +@@ -2252,11 +2482,18 @@ row_upd_del_mark_clust_rec( + ibool referenced, + /*!< in: TRUE if index may be referenced in + a foreign key constraint */ ++#ifdef WITH_WSREP ++ ibool foreign,/*!< in: TRUE if index is foreign key index */ ++#endif /* WITH_WSREP */ + mtr_t* mtr) /*!< in: mtr; gets committed here */ + { + btr_pcur_t* pcur; + btr_cur_t* btr_cur; + dberr_t err; ++#ifdef WITH_WSREP ++ rec_t* rec; ++ que_node_t *parent = que_node_get_parent(node); ++#endif /* WITH_WSREP */ + + ut_ad(node); + ut_ad(dict_index_is_clust(index)); +@@ -2273,8 +2510,16 @@ row_upd_del_mark_clust_rec( + /* Mark the clustered index record deleted; we do not have to check + locks, because we assume that we have an x-lock on the record */ + ++#ifdef WITH_WSREP ++ rec = btr_cur_get_rec(btr_cur); ++#endif /* WITH_WSREP */ ++ + err = btr_cur_del_mark_set_clust_rec( ++#ifdef WITH_WSREP ++ btr_cur_get_block(btr_cur), rec, ++#else + btr_cur_get_block(btr_cur), btr_cur_get_rec(btr_cur), ++#endif /* WITH_WSREP */ + index, offsets, thr, mtr); + if (err == DB_SUCCESS && referenced) { + /* NOTE that the following call loses the position of pcur ! */ +@@ -2282,6 +2527,32 @@ row_upd_del_mark_clust_rec( + err = row_upd_check_references_constraints( + node, pcur, index->table, index, offsets, thr, mtr); + } ++#ifdef WITH_WSREP ++ if (err == DB_SUCCESS && !referenced && ++ !(parent && que_node_get_type(parent) == QUE_NODE_UPDATE && ++ ((upd_node_t*)parent)->cascade_node == node) && ++ thr_get_trx(thr) && ++ foreign ++ ) { ++ err = wsrep_row_upd_check_foreign_constraints( ++ node, pcur, index->table, index, offsets, thr, mtr); ++ switch (err) { ++ case DB_SUCCESS: ++ case DB_NO_REFERENCED_ROW: ++ err = DB_SUCCESS; ++ break; ++ case DB_DEADLOCK: ++ if (wsrep_debug) fprintf (stderr, ++ "WSREP: clust rec FK check fail for deadlock"); ++ break; ++ default: ++ fprintf (stderr, ++ "WSREP: clust rec referenced FK check fail: %d", ++ (int)err); ++ break; ++ } ++ } ++#endif /* WITH_WSREP */ + + mtr_commit(mtr); + +@@ -2314,6 +2585,10 @@ row_upd_clust_step( + index = dict_table_get_first_index(node->table); + + referenced = row_upd_index_is_referenced(index, thr_get_trx(thr)); ++#ifdef WITH_WSREP ++ ibool foreign = wsrep_row_upd_index_is_foreign( ++ index, thr_get_trx(thr)); ++#endif /* WITH_WSREP */ + + pcur = node->pcur; + +@@ -2408,7 +2683,11 @@ row_upd_clust_step( + + if (node->is_delete) { + err = row_upd_del_mark_clust_rec( ++#ifdef WITH_WSREP ++ node, index, offsets, thr, referenced, foreign, &mtr); ++#else + node, index, offsets, thr, referenced, &mtr); ++#endif /* WITH_WSREP */ + + if (err == DB_SUCCESS) { + node->state = UPD_NODE_UPDATE_ALL_SEC; +@@ -2453,7 +2732,11 @@ row_upd_clust_step( + externally! */ + + err = row_upd_clust_rec_by_insert( ++#ifdef WITH_WSREP ++ node, index, thr, referenced, foreign, &mtr); ++#else + node, index, thr, referenced, &mtr); ++#endif /* WITH_WSREP */ + + if (err != DB_SUCCESS) { + +diff --git a/storage/innobase/srv/srv0conc.cc b/storage/innobase/srv/srv0conc.cc +index dc3c0b1..fb7fad3 100644 +--- a/storage/innobase/srv/srv0conc.cc ++++ b/storage/innobase/srv/srv0conc.cc +@@ -42,6 +42,10 @@ Created 2011/04/18 Sunny Bains + #include "trx0trx.h" + + #include "mysql/plugin.h" ++#ifdef WITH_WSREP ++extern "C" int wsrep_trx_is_aborting(void *thd_ptr); ++extern my_bool wsrep_debug; ++#endif + + /** Number of times a thread is allowed to enter InnoDB within the same + SQL query after it has once got the ticket. */ +@@ -86,6 +90,9 @@ struct srv_conc_slot_t{ + reserved may still be TRUE at that + point */ + srv_conc_node_t srv_conc_queue; /*!< queue node */ ++#ifdef WITH_WSREP ++ void *thd; /*!< to see priority */ ++#endif + }; + + /** Queue of threads waiting to get in */ +@@ -145,6 +152,9 @@ srv_conc_init(void) + + conc_slot->event = os_event_create(); + ut_a(conc_slot->event); ++#ifdef WITH_WSREP ++ conc_slot->thd = NULL; ++#endif /* WITH_WSREP */ + } + #endif /* !HAVE_ATOMIC_BUILTINS */ + } +@@ -202,6 +212,16 @@ srv_conc_enter_innodb_with_atomics( + + for (;;) { + ulint sleep_in_us; ++#ifdef WITH_WSREP ++ if (wsrep_on(trx->mysql_thd) && ++ wsrep_trx_is_aborting(trx->mysql_thd)) { ++ if (wsrep_debug) ++ fprintf(stderr, ++ "srv_conc_enter due to MUST_ABORT"); ++ srv_conc_force_enter_innodb(trx); ++ return; ++ } ++#endif /* WITH_WSREP */ + + if (srv_conc.n_active < (lint) srv_thread_concurrency) { + ulint n_active; +@@ -319,6 +339,9 @@ srv_conc_exit_innodb_without_atomics( + slot = NULL; + + if (srv_conc.n_active < (lint) srv_thread_concurrency) { ++#ifdef WITH_WSREP ++ srv_conc_slot_t* wsrep_slot; ++#endif + /* Look for a slot where a thread is waiting and no other + thread has yet released the thread */ + +@@ -329,6 +352,19 @@ srv_conc_exit_innodb_without_atomics( + /* No op */ + } + ++#ifdef WITH_WSREP ++ /* look for aborting trx, they must be released asap */ ++ wsrep_slot= slot; ++ while (wsrep_slot && (wsrep_slot->wait_ended == TRUE || ++ !wsrep_trx_is_aborting(wsrep_slot->thd))) { ++ wsrep_slot = UT_LIST_GET_NEXT(srv_conc_queue, wsrep_slot); ++ } ++ if (wsrep_slot) { ++ slot = wsrep_slot; ++ if (wsrep_debug) ++ fprintf(stderr, "WSREP: releasing aborting thd\n"); ++ } ++#endif + if (slot != NULL) { + slot->wait_ended = TRUE; + +@@ -384,6 +420,13 @@ retry: + + return; + } ++#ifdef WITH_WSREP ++ if (wsrep_on(trx->mysql_thd) && ++ wsrep_trx_is_aborting(trx->mysql_thd)) { ++ srv_conc_force_enter_innodb(trx); ++ return; ++ } ++#endif + + /* If the transaction is not holding resources, let it sleep + for srv_thread_sleep_delay microseconds, and try again then */ +@@ -450,6 +493,9 @@ retry: + /* Add to the queue */ + slot->reserved = TRUE; + slot->wait_ended = FALSE; ++#ifdef WITH_WSREP ++ slot->thd = trx->mysql_thd; ++#endif + + UT_LIST_ADD_LAST(srv_conc_queue, srv_conc_queue, slot); + +@@ -457,6 +503,18 @@ retry: + + srv_conc.n_waiting++; + ++#ifdef WITH_WSREP ++ if (wsrep_on(trx->mysql_thd) && ++ wsrep_trx_is_aborting(trx->mysql_thd)) { ++ os_fast_mutex_unlock(&srv_conc_mutex); ++ if (wsrep_debug) ++ fprintf(stderr, "srv_conc_enter due to MUST_ABORT"); ++ trx->declared_to_be_inside_innodb = TRUE; ++ trx->n_tickets_to_enter_innodb = srv_n_free_tickets_to_enter; ++ return; ++ } ++ trx->wsrep_event = slot->event; ++#endif /* WITH_WSREP */ + os_fast_mutex_unlock(&srv_conc_mutex); + + /* Go to wait for the event; when a thread leaves InnoDB it will +@@ -471,6 +529,9 @@ retry: + thd_wait_begin(trx->mysql_thd, THD_WAIT_USER_LOCK); + + os_event_wait(slot->event); ++#ifdef WITH_WSREP ++ trx->wsrep_event = NULL; ++#endif /* WITH_WSREP */ + thd_wait_end(trx->mysql_thd); + + trx->op_info = ""; +@@ -483,6 +544,9 @@ retry: + incremented the thread counter on behalf of this thread */ + + slot->reserved = FALSE; ++#ifdef WITH_WSREP ++ slot->thd = NULL; ++#endif + + UT_LIST_REMOVE(srv_conc_queue, srv_conc_queue, slot); + +@@ -593,5 +657,32 @@ srv_conc_get_active_threads(void) + /*==============================*/ + { + return(srv_conc.n_active); +- } ++} ++ ++#ifdef WITH_WSREP ++UNIV_INTERN ++void ++wsrep_srv_conc_cancel_wait( ++/*==================*/ ++ trx_t* trx) /*!< in: transaction object associated with the ++ thread */ ++{ ++#ifdef HAVE_ATOMIC_BUILTINS ++ /* aborting transactions will enter innodb by force in ++ srv_conc_enter_innodb_with_atomics(). No need to cancel here, ++ thr will wake up after os_sleep and let to enter innodb ++ */ ++ if (wsrep_debug) ++ fprintf(stderr, "WSREP: conc slot cancel, no atomics\n"); ++#else ++ os_fast_mutex_lock(&srv_conc_mutex); ++ if (trx->wsrep_event) { ++ if (wsrep_debug) ++ fprintf(stderr, "WSREP: conc slot cancel\n"); ++ os_event_set(trx->wsrep_event); ++ } ++ os_fast_mutex_unlock(&srv_conc_mutex); ++#endif ++} ++#endif /* WITH_WSREP */ + +diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc +index f4ea889..4404023 100644 +--- a/storage/innobase/srv/srv0srv.cc ++++ b/storage/innobase/srv/srv0srv.cc +@@ -71,6 +71,10 @@ Created 10/8/1995 Heikki Tuuri + #include "mysql/plugin.h" + #include "mysql/service_thd_wait.h" + ++#ifdef WITH_WSREP ++extern int wsrep_debug; ++extern int wsrep_trx_is_aborting(void *thd_ptr); ++#endif + /* The following is the maximum allowed duration of a lock wait. */ + UNIV_INTERN ulint srv_fatal_semaphore_wait_threshold = 600; + +@@ -207,6 +211,10 @@ srv_printf_innodb_monitor() will request mutex acquisition + with mutex_enter(), which will wait until it gets the mutex. */ + #define MUTEX_NOWAIT(mutex_skipped) ((mutex_skipped) < MAX_MUTEX_NOWAIT) + ++#ifdef WITH_INNODB_DISALLOW_WRITES ++UNIV_INTERN os_event_t srv_allow_writes_event; ++#endif /* WITH_INNODB_DISALLOW_WRITES */ ++ + /** The sort order table of the MySQL latin1_swedish_ci character set + collation */ + UNIV_INTERN const byte* srv_latin1_ordering; +@@ -975,6 +983,14 @@ srv_init(void) + + srv_conc_init(); + ++#ifdef WITH_INNODB_DISALLOW_WRITES ++ /* Writes have to be enabled on init or else we hang. Thus, we ++ always set the event here regardless of innobase_disallow_writes. ++ That flag will always be 0 at this point because it isn't settable ++ via my.cnf or command line arg. */ ++ srv_allow_writes_event = os_event_create(); ++ os_event_set(srv_allow_writes_event); ++#endif /* WITH_INNODB_DISALLOW_WRITES */ + /* Initialize some INFORMATION SCHEMA internal structures */ + trx_i_s_cache_init(trx_i_s_cache); + +@@ -1737,7 +1753,20 @@ loop: + + if (sync_array_print_long_waits(&waiter, &sema) + && sema == old_sema && os_thread_eq(waiter, old_waiter)) { ++#if defined(WITH_WSREP) && defined(WITH_INNODB_DISALLOW_WRITES) ++ if (srv_allow_writes_event->is_set) { ++#endif /* WITH_WSREP */ + fatal_cnt++; ++#if defined(WITH_WSREP) && defined(WITH_INNODB_DISALLOW_WRITES) ++ } else { ++ fprintf(stderr, ++ "WSREP: avoiding InnoDB self crash due to long " ++ "semaphore wait of > %lu seconds\n" ++ "Server is processing SST donor operation, " ++ "fatal_cnt now: %lu", ++ (ulong) srv_fatal_semaphore_wait_threshold, fatal_cnt); ++ } ++#endif /* WITH_WSREP */ + if (fatal_cnt > 10) { + + fprintf(stderr, +diff --git a/storage/innobase/trx/trx0roll.cc b/storage/innobase/trx/trx0roll.cc +index bc11f1d..ae9095d 100644 +--- a/storage/innobase/trx/trx0roll.cc ++++ b/storage/innobase/trx/trx0roll.cc +@@ -43,6 +43,9 @@ Created 3/26/1996 Heikki Tuuri + #include "row0mysql.h" + #include "lock0lock.h" + #include "pars0pars.h" ++#ifdef WITH_WSREP ++#include "ha_prototypes.h" ++#endif /* WITH_WSREP */ + #include "srv0mon.h" + #include "trx0sys.h" + +@@ -374,6 +377,11 @@ trx_rollback_to_savepoint_for_mysql_low( + + trx->op_info = ""; + ++#ifdef WITH_WSREP_OUT ++ if (wsrep_on(trx->mysql_thd)) { ++ trx->lock.was_chosen_as_deadlock_victim = FALSE; ++ } ++#endif /* WITH_WSREP */ + return(err); + } + +@@ -1014,6 +1022,11 @@ trx_roll_try_truncate( + if (trx->update_undo) { + trx_undo_truncate_end(trx, trx->update_undo, limit); + } ++#ifdef WITH_WSREP_OUT ++ if (wsrep_on(trx->mysql_thd)) { ++ trx->lock.was_chosen_as_deadlock_victim = FALSE; ++ } ++#endif /* WITH_WSREP */ + } + + /***********************************************************************//** +diff --git a/storage/innobase/trx/trx0sys.cc b/storage/innobase/trx/trx0sys.cc +index 52830a7..816de1c 100644 +--- a/storage/innobase/trx/trx0sys.cc ++++ b/storage/innobase/trx/trx0sys.cc +@@ -44,6 +44,10 @@ Created 3/26/1996 Heikki Tuuri + #include "os0file.h" + #include "read0read.h" + ++#ifdef WITH_WSREP ++#include "ha_prototypes.h" /* wsrep_is_wsrep_xid() */ ++#endif /* */ ++ + /** The file format tag structure with id and name. */ + struct file_format_t { + ulint id; /*!< id of the file format */ +@@ -174,7 +178,12 @@ trx_sys_flush_max_trx_id(void) + mtr_t mtr; + trx_sysf_t* sys_header; + ++#ifndef WITH_WSREP ++ /* wsrep_fake_trx_id violates this assert ++ * Copied from trx_sys_get_new_trx_id ++ */ + ut_ad(mutex_own(&trx_sys->mutex)); ++#endif /* WITH_WSREP */ + + if (!srv_read_only_mode) { + mtr_start(&mtr); +@@ -202,10 +211,14 @@ trx_sys_update_mysql_binlog_offset( + ib_int64_t offset, /*!< in: position in that log file */ + ulint field, /*!< in: offset of the MySQL log info field in + the trx sys header */ ++#ifdef WITH_WSREP ++ trx_sysf_t* sys_header, /*!< in: trx sys header */ ++#endif /* WITH_WSREP */ + mtr_t* mtr) /*!< in: mtr */ + { ++#ifndef WITH_WSREP + trx_sysf_t* sys_header; +- ++#endif /* !WITH_WSREP */ + if (ut_strlen(file_name) >= TRX_SYS_MYSQL_LOG_NAME_LEN) { + + /* We cannot fit the name to the 512 bytes we have reserved */ +@@ -213,7 +226,9 @@ trx_sys_update_mysql_binlog_offset( + return; + } + ++#ifndef WITH_WSREP + sys_header = trx_sysf_get(mtr); ++#endif /* !WITH_WSREP */ + + if (mach_read_from_4(sys_header + field + + TRX_SYS_MYSQL_LOG_MAGIC_N_FLD) +@@ -300,6 +315,125 @@ trx_sys_print_mysql_binlog_offset(void) + mtr_commit(&mtr); + } + ++#ifdef WITH_WSREP ++ ++#ifdef UNIV_DEBUG ++static long long trx_sys_cur_xid_seqno = -1; ++static unsigned char trx_sys_cur_xid_uuid[16]; ++ ++long long read_wsrep_xid_seqno(const XID* xid) ++{ ++ long long seqno; ++ memcpy(&seqno, xid->data + 24, sizeof(long long)); ++ return seqno; ++} ++ ++void read_wsrep_xid_uuid(const XID* xid, unsigned char* buf) ++{ ++ memcpy(buf, xid->data + 8, 16); ++} ++ ++#endif /* UNIV_DEBUG */ ++ ++void ++trx_sys_update_wsrep_checkpoint( ++ const XID* xid, /*!< in: transaction XID */ ++ trx_sysf_t* sys_header, /*!< in: sys_header */ ++ mtr_t* mtr) /*!< in: mtr */ ++{ ++ ++#ifdef UNIV_DEBUG ++ { ++ /* Check that seqno is monotonically increasing */ ++ unsigned char xid_uuid[16]; ++ long long xid_seqno = read_wsrep_xid_seqno(xid); ++ read_wsrep_xid_uuid(xid, xid_uuid); ++ if (!memcmp(xid_uuid, trx_sys_cur_xid_uuid, 8)) ++ { ++ ut_ad(xid_seqno > trx_sys_cur_xid_seqno); ++ trx_sys_cur_xid_seqno = xid_seqno; ++ } ++ else ++ { ++ memcpy(trx_sys_cur_xid_uuid, xid_uuid, 16); ++ } ++ trx_sys_cur_xid_seqno = xid_seqno; ++ } ++#endif /* UNIV_DEBUG */ ++ ++ ut_ad(xid && mtr && sys_header); ++ ut_a(xid->formatID == -1 || wsrep_is_wsrep_xid(xid)); ++ ++ if (mach_read_from_4(sys_header + TRX_SYS_WSREP_XID_INFO ++ + TRX_SYS_WSREP_XID_MAGIC_N_FLD) ++ != TRX_SYS_WSREP_XID_MAGIC_N) { ++ mlog_write_ulint(sys_header + TRX_SYS_WSREP_XID_INFO ++ + TRX_SYS_WSREP_XID_MAGIC_N_FLD, ++ TRX_SYS_WSREP_XID_MAGIC_N, ++ MLOG_4BYTES, mtr); ++ } ++ ++ mlog_write_ulint(sys_header + TRX_SYS_WSREP_XID_INFO ++ + TRX_SYS_WSREP_XID_FORMAT, ++ (int)xid->formatID, ++ MLOG_4BYTES, mtr); ++ mlog_write_ulint(sys_header + TRX_SYS_WSREP_XID_INFO ++ + TRX_SYS_WSREP_XID_GTRID_LEN, ++ (int)xid->gtrid_length, ++ MLOG_4BYTES, mtr); ++ mlog_write_ulint(sys_header + TRX_SYS_WSREP_XID_INFO ++ + TRX_SYS_WSREP_XID_BQUAL_LEN, ++ (int)xid->bqual_length, ++ MLOG_4BYTES, mtr); ++ mlog_write_string(sys_header + TRX_SYS_WSREP_XID_INFO ++ + TRX_SYS_WSREP_XID_DATA, ++ (const unsigned char*) xid->data, ++ XIDDATASIZE, mtr); ++ ++} ++ ++void ++trx_sys_read_wsrep_checkpoint(XID* xid) ++/*===================================*/ ++{ ++ trx_sysf_t* sys_header; ++ mtr_t mtr; ++ ulint magic; ++ ++ ut_ad(xid); ++ ++ mtr_start(&mtr); ++ ++ sys_header = trx_sysf_get(&mtr); ++ ++ if ((magic = mach_read_from_4(sys_header + TRX_SYS_WSREP_XID_INFO ++ + TRX_SYS_WSREP_XID_MAGIC_N_FLD)) ++ != TRX_SYS_WSREP_XID_MAGIC_N) { ++ memset(xid, 0, sizeof(*xid)); ++ xid->formatID = -1; ++ trx_sys_update_wsrep_checkpoint(xid, sys_header, &mtr); ++ mtr_commit(&mtr); ++ return; ++ } ++ ++ xid->formatID = (int)mach_read_from_4( ++ sys_header ++ + TRX_SYS_WSREP_XID_INFO + TRX_SYS_WSREP_XID_FORMAT); ++ xid->gtrid_length = (int)mach_read_from_4( ++ sys_header ++ + TRX_SYS_WSREP_XID_INFO + TRX_SYS_WSREP_XID_GTRID_LEN); ++ xid->bqual_length = (int)mach_read_from_4( ++ sys_header ++ + TRX_SYS_WSREP_XID_INFO + TRX_SYS_WSREP_XID_BQUAL_LEN); ++ ut_memcpy(xid->data, ++ sys_header + TRX_SYS_WSREP_XID_INFO + TRX_SYS_WSREP_XID_DATA, ++ XIDDATASIZE); ++ ++ mtr_commit(&mtr); ++} ++ ++#endif /* WITH_WSREP */ ++ + /*****************************************************************//** + Prints to stderr the MySQL master log offset info in the trx system header if + the magic number shows it valid. */ +diff --git a/storage/innobase/trx/trx0trx.cc b/storage/innobase/trx/trx0trx.cc +index c2d5c1f..4c530dd 100644 +--- a/storage/innobase/trx/trx0trx.cc ++++ b/storage/innobase/trx/trx0trx.cc +@@ -158,7 +158,10 @@ trx_create(void) + trx->lock.table_locks = ib_vector_create( + heap_alloc, sizeof(void**), 32); + +- return(trx); ++#ifdef WITH_WSREP ++ trx->wsrep_event = NULL; ++#endif /* WITH_WSREP */ ++ return(trx); + } + + /********************************************************************//** +@@ -853,6 +856,11 @@ trx_start_low( + srv_undo_logs, srv_undo_tablespaces); + } + ++#ifdef WITH_WSREP ++ memset(&trx->xid, 0, sizeof(trx->xid)); ++ trx->xid.formatID = -1; ++#endif /* WITH_WSREP */ ++ + /* The initial value for trx->no: TRX_ID_MAX is used in + read_view_open_now: */ + +@@ -967,6 +975,9 @@ trx_write_serialisation_history( + trx_t* trx, /*!< in/out: transaction */ + mtr_t* mtr) /*!< in/out: mini-transaction */ + { ++#ifdef WITH_WSREP ++ trx_sysf_t* sys_header; ++#endif /* WITH_WSREP */ + trx_rseg_t* rseg; + + rseg = trx->rseg; +@@ -1013,6 +1024,15 @@ trx_write_serialisation_history( + + MONITOR_INC(MONITOR_TRX_COMMIT_UNDO); + ++#ifdef WITH_WSREP ++ sys_header = trx_sysf_get(mtr); ++ /* Update latest MySQL wsrep XID in trx sys header. */ ++ if (wsrep_is_wsrep_xid(&trx->xid)) ++ { ++ trx_sys_update_wsrep_checkpoint(&trx->xid, sys_header, mtr); ++ } ++#endif /* WITH_WSREP */ ++ + /* Update the latest MySQL binlog name and offset info + in trx sys header if MySQL binlogging is on or the database + server is a MySQL replication slave */ +@@ -1023,7 +1043,11 @@ trx_write_serialisation_history( + trx_sys_update_mysql_binlog_offset( + trx->mysql_log_file_name, + trx->mysql_log_offset, ++#ifdef WITH_WSREP ++ TRX_SYS_MYSQL_LOG_INFO, sys_header, mtr); ++#else + TRX_SYS_MYSQL_LOG_INFO, mtr); ++#endif /* WITH_WSREP */ + + trx->mysql_log_file_name = NULL; + } +@@ -1318,6 +1342,11 @@ trx_commit_in_memory( + ut_ad(!trx->in_ro_trx_list); + ut_ad(!trx->in_rw_trx_list); + ++#ifdef WITH_WSREP ++ if (wsrep_on(trx->mysql_thd)) { ++ trx->lock.was_chosen_as_deadlock_victim = FALSE; ++ } ++#endif + trx->dict_operation = TRX_DICT_OP_NONE; + + trx->error_state = DB_SUCCESS; +@@ -1502,6 +1531,10 @@ trx_commit_or_rollback_prepare( + + switch (trx->state) { + case TRX_STATE_NOT_STARTED: ++#ifdef WITH_WSREP ++ ut_d(trx->start_file = __FILE__); ++ ut_d(trx->start_line = __LINE__); ++#endif /* WITH_WSREP */ + trx_start_low(trx); + /* fall through */ + case TRX_STATE_ACTIVE: +@@ -2229,6 +2262,10 @@ trx_start_if_not_started_xa_low( + transaction, doesn't. */ + trx->support_xa = thd_supports_xa(trx->mysql_thd); + ++#ifdef WITH_WSREP ++ ut_d(trx->start_file = __FILE__); ++ ut_d(trx->start_line = __LINE__); ++#endif /* WITH_WSREP */ + trx_start_low(trx); + /* fall through */ + case TRX_STATE_ACTIVE: +@@ -2251,6 +2288,10 @@ trx_start_if_not_started_low( + { + switch (trx->state) { + case TRX_STATE_NOT_STARTED: ++#ifdef WITH_WSREP ++ ut_d(trx->start_file = __FILE__); ++ ut_d(trx->start_line = __LINE__); ++#endif /* WITH_WSREP */ + trx_start_low(trx); + /* fall through */ + case TRX_STATE_ACTIVE: +@@ -2284,6 +2325,10 @@ trx_start_for_ddl_low( + trx->will_lock = 1; + + trx->ddl = true; ++#ifdef WITH_WSREP ++ ut_d(trx->start_file = __FILE__); ++ ut_d(trx->start_line = __LINE__); ++#endif /* WITH_WSREP */ + + trx_start_low(trx); + return; +diff --git a/support-files/CMakeLists.txt b/support-files/CMakeLists.txt +index 5afe261..74b1075 100644 +--- a/support-files/CMakeLists.txt ++++ b/support-files/CMakeLists.txt +@@ -93,4 +93,12 @@ IF(UNIX) + DESTINATION ${inst_location} COMPONENT SupportFiles + PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ + GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) ++ CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/wsrep_notify.sh ++ ${CMAKE_CURRENT_BINARY_DIR}/wsrep_notify @ONLY) ++ INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/wsrep_notify ++ DESTINATION ${inst_location} COMPONENT SupportFiles ++ PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ ++ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) ++ CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/wsrep.cnf.sh ++ ${CMAKE_CURRENT_BINARY_DIR}/wsrep.cnf @ONLY) + ENDIF() +diff --git a/support-files/build-tags b/support-files/build-tags +index c37485e..635940a 100755 +--- a/support-files/build-tags ++++ b/support-files/build-tags +@@ -10,3 +10,7 @@ $list |grep $filter |while read f; + do + etags -o TAGS --append $f + done ++(cd storage/galera && svn ls -R) | grep $filter | while read f; ++do ++ etags -o TAGS --append storage/galera/$f ++done +diff --git a/support-files/cmake-no-wix.patch b/support-files/cmake-no-wix.patch +new file mode 100644 +index 0000000..325d97e +--- /dev/null ++++ b/support-files/cmake-no-wix.patch +@@ -0,0 +1,14 @@ ++diff --git a/CMakeLists.txt b/CMakeLists.txt ++index 9e235ba..15c3414 100644 ++--- a/CMakeLists.txt +++++ b/CMakeLists.txt ++@@ -569,7 +569,8 @@ IF(WIN32) ++ ELSE() ++ SET(CPACK_GENERATOR "TGZ") ++ ENDIF() ++-ADD_SUBDIRECTORY(packaging/WiX) +++# Trouble on SLES 11 due to old cmake ... +++# ADD_SUBDIRECTORY(packaging/WiX) ++ ADD_SUBDIRECTORY(packaging/solaris) ++ ++ # Create a single package with "make package" +diff --git a/support-files/mysql-rpmlintrc b/support-files/mysql-rpmlintrc +new file mode 100644 +index 0000000..72dd6e3 +--- /dev/null ++++ b/support-files/mysql-rpmlintrc +@@ -0,0 +1,64 @@ ++# allow the traditional name "mysql-shared" even with a so-versioned lib ++setBadness('shlib-policy-name-error', 0) ++ ++# Suppress several "false positive" messages which we cannot prevent: ++# Oracle text we must not change: ++addFilter("MySQL.* invalid-license") ++addFilter("mysql.* invalid-license") ++addFilter("MySQL.* name-repeated-in-summary") ++addFilter("mysql.* name-repeated-in-summary") ++addFilter("MySQL.* no-version-in-last-changelog") ++addFilter("mysql.* no-version-in-last-changelog") ++addFilter("MySQL.*src.* invalid-spec-name") ++addFilter("mysql.*src.* invalid-spec-name") ++# Oracle code we must not change: ++addFilter("MySQL.*shared.* shared-lib-calls-exit /usr/lib64/libmysqlclient") ++addFilter("mysql.*shared.* shared-lib-calls-exit /usr/lib64/libmysqlclient") ++addFilter("MySQL.*server.* binary-or-shlib-calls-gethostbyname /usr/bin/resolveip") ++addFilter("mysql.*server.* binary-or-shlib-calls-gethostbyname /usr/bin/resolveip") ++# "obsolete" the Oracle commercial RPMs: ++addFilter("MySQL.* obsolete-not-provided mysql[^ ]*advanced") ++addFilter("mysql.* obsolete-not-provided mysql[^ ]*advanced") ++addFilter("MySQL.* obsolete-not-provided MySQL[^ ]*advanced") ++addFilter("mysql.* obsolete-not-provided MySQL[^ ]*advanced") ++addFilter("MySQL.* obsolete-not-provided MySQL[^ ]*classic") ++addFilter("mysql.* obsolete-not-provided MySQL[^ ]*classic") ++addFilter("MySQL.* obsolete-not-provided MySQL[^ ]*community") ++addFilter("mysql.* obsolete-not-provided MySQL[^ ]*community") ++addFilter("MySQL.* obsolete-not-provided MySQL[^ ]*enterprise") ++addFilter("mysql.* obsolete-not-provided MySQL[^ ]*enterprise") ++addFilter("MySQL.* obsolete-not-provided MySQL[^ ]*pro") ++addFilter("mysql.* obsolete-not-provided MySQL[^ ]*pro") ++addFilter("MySQL.* obsolete-not-provided MySQL[^ ]*standard") ++addFilter("mysql.* obsolete-not-provided MySQL[^ ]*standard") ++# ... and the packages we dropped on intention: ++addFilter("MySQL.*devel.* obsolete-not-provided MySQL-embedded-devel") ++addFilter("mysql.*devel.* obsolete-not-provided MySQL-embedded-devel") ++addFilter("MySQL.*devel.* obsolete-not-provided mysql-embedded-devel") ++addFilter("mysql.*devel.* obsolete-not-provided mysql-embedded-devel") ++addFilter("MySQL.*test.* obsolete-not-provided MySQL-bench") ++addFilter("mysql.*test.* obsolete-not-provided MySQL-bench") ++addFilter("MySQL.*test.* obsolete-not-provided mysql-bench") ++addFilter("mysql.*test.* obsolete-not-provided mysql-bench") ++# Oracle does not strip binaries, and neither will we: ++addFilter("MySQL.* unstripped-binary-or-object /usr/s?bin/.*") ++addFilter("mysql.* unstripped-binary-or-object /usr/s?bin/.*") ++addFilter("MySQL.* unstripped-binary-or-object /usr/lib64/.*") ++addFilter("mysql.* unstripped-binary-or-object /usr/lib64/.*") ++addFilter("MySQL.*test.* unstripped-binary-or-object /usr/share/mysql-test/lib/.*") ++addFilter("mysql.*test.* unstripped-binary-or-object /usr/share/mysql-test/lib/.*") ++# Pre-defined certificates are needed for SSL tests, also a binary: ++addFilter("MySQL.*test.* pem-certificate") ++addFilter("mysql.*test.* pem-certificate") ++addFilter("MySQL.*test.* arch-dependent-file-in-usr-share /usr/share/mysql-test/lib/My/SafeProcess/my_safe_process") ++addFilter("mysql.*test.* arch-dependent-file-in-usr-share /usr/share/mysql-test/lib/My/SafeProcess/my_safe_process") ++# Oracle doesn't have a "check" section (yet): ++addFilter("MySQL.* make-check-outside-check-section") ++addFilter("mysql.* make-check-outside-check-section") ++# Documentation issues: ++addFilter("MySQL.*server.* no-manual-page-for-binary mysqld-debug") ++addFilter("mysql.*server.* no-manual-page-for-binary mysqld-debug") ++# File naming: ++addFilter("MySQL.*server.* incoherent-init-script-name mysql") ++addFilter("mysql.*server.* incoherent-init-script-name mysql") ++# End of the "false positive" messages which we cannot prevent. +diff --git a/support-files/mysql.server.sh b/support-files/mysql.server.sh +index 7487d5a..5c3f2f9 100644 +--- a/support-files/mysql.server.sh ++++ b/support-files/mysql.server.sh +@@ -24,6 +24,11 @@ + # Short-Description: start and stop MySQL + # Description: MySQL is a very fast and reliable SQL database engine. + ### END INIT INFO ++ ++# Prevent OpenSUSE's init scripts from calling systemd, so that ++# both 'bootstrap' and 'start' are handled entirely within this script ++ ++SYSTEMD_NO_WRAP=1 + + # If you install MySQL on some other places than @prefix@, then you + # have to do one of the following things for this script to work: +@@ -329,7 +334,10 @@ case "$mode" in + # Stop the service and regardless of whether it was + # running or not, start it again. + if $0 stop $other_args; then +- $0 start $other_args ++ if ! $0 start $other_args; then ++ log_failure_msg "Failed to restart server." ++ exit 1 ++ fi + else + log_failure_msg "Failed to stop running server, so refusing to try to start." + exit 1 +@@ -379,6 +387,12 @@ case "$mode" in + fi + fi + ;; ++ 'bootstrap') ++ # Bootstrap the cluster, start the first node ++ # that initiate the cluster ++ echo $echo_n "Bootstrapping the cluster" ++ $0 start $other_args --wsrep-new-cluster ++ ;; + *) + # usage + basename=`basename "$0"` +diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh +index c72ca39..9e8ce67 100644 +--- a/support-files/mysql.spec.sh ++++ b/support-files/mysql.spec.sh +@@ -25,13 +25,15 @@ + %global mysql_vendor Oracle and/or its affiliates + + %global mysql_version @VERSION@ ++%global wsrep_version @WSREP_VERSION@ ++%global wsrep_revision @WSREP_REVISION@ + + %global mysqld_user mysql + %global mysqld_group mysql + %global mysqldatadir /var/lib/mysql + +-%global release 1 +- ++%global release %{wsrep_version} ++%global short_product_tag 5.6 + + # + # Macros we use which are not available in all supported versions of RPM +@@ -79,9 +81,9 @@ + # Source name + # ---------------------------------------------------------------------------- + %if %{undefined src_base} +-%define src_base mysql ++%define src_base mysql-wsrep + %endif +-%define src_dir %{src_base}-%{mysql_version} ++%define src_dir %{src_base}-%{mysql_version}-%{wsrep_version} + + # ---------------------------------------------------------------------------- + # Feature set (storage engines, options). Default to community (everything) +@@ -118,95 +120,48 @@ + # ---------------------------------------------------------------------------- + # Distribution support + # ---------------------------------------------------------------------------- +-%if %{undefined distro_specific} +-%define distro_specific 0 ++ ++# Disable post build checks for time being. ++BuildConflicts: post-build-checks ++ ++BuildRequires: gcc-c++ ncurses-devel perl zlib-devel cmake libaio-devel bison flex ++ ++%if 0%{?rhel} == 6 || 0%{?rhel} == 7 || 0%{?fedora} == 20 || 0%{?fedora} == 21 ++BuildRequires: time + %endif +-%if %{distro_specific} +- %if %(test -f /etc/enterprise-release && echo 1 || echo 0) +- %define oelver %(rpm -qf --qf '%%{version}\\n' /etc/enterprise-release | sed -e 's/^\\([0-9]*\\).*/\\1/g') +- %if "%oelver" == "4" +- %define distro_description Oracle Enterprise Linux 4 +- %define distro_releasetag oel4 +- %define distro_buildreq gcc-c++ gperf ncurses-devel perl time zlib-devel cmake libaio-devel +- %define distro_requires chkconfig coreutils grep procps shadow-utils net-tools +- %else +- %if "%oelver" == "5" +- %define distro_description Oracle Enterprise Linux 5 +- %define distro_releasetag oel5 +- %define distro_buildreq gcc-c++ gperf ncurses-devel perl time zlib-devel cmake libaio-devel +- %define distro_requires chkconfig coreutils grep procps shadow-utils net-tools +- %else +- %{error:Oracle Enterprise Linux %{oelver} is unsupported} +- %endif +- %endif +- %else +- %if %(test -f /etc/oracle-release && echo 1 || echo 0) +- %define elver %(rpm -qf --qf '%%{version}\\n' /etc/oracle-release | sed -e 's/^\\([0-9]*\\).*/\\1/g') +- %if "%elver" == "6" || "%elver" == "7" +- %define distro_description Oracle Linux %elver +- %define distro_releasetag el%elver +- %define distro_buildreq gcc-c++ ncurses-devel perl time zlib-devel cmake libaio-devel +- %define distro_requires chkconfig coreutils grep procps shadow-utils net-tools +- %else +- %{error:Oracle Linux %{elver} is unsupported} +- %endif +- %else +- %if %(test -f /etc/redhat-release && echo 1 || echo 0) +- %define rhelver %(rpm -qf --qf '%%{version}\\n' /etc/redhat-release | sed -e 's/^\\([0-9]*\\).*/\\1/g') +- %if "%rhelver" == "4" +- %define distro_description Red Hat Enterprise Linux 4 +- %define distro_releasetag rhel4 +- %define distro_buildreq gcc-c++ gperf ncurses-devel perl time zlib-devel cmake libaio-devel +- %define distro_requires chkconfig coreutils grep procps shadow-utils net-tools +- %else +- %if "%rhelver" == "5" +- %define distro_description Red Hat Enterprise Linux 5 +- %define distro_releasetag rhel5 +- %define distro_buildreq gcc-c++ gperf ncurses-devel perl time zlib-devel cmake libaio-devel +- %define distro_requires chkconfig coreutils grep procps shadow-utils net-tools +- %else +- %if "%rhelver" == "6" +- %define distro_description Red Hat Enterprise Linux 6 +- %define distro_releasetag rhel6 +- %define distro_buildreq gcc-c++ ncurses-devel perl time zlib-devel cmake libaio-devel +- %define distro_requires chkconfig coreutils grep procps shadow-utils net-tools +- %else +- %{error:Red Hat Enterprise Linux %{rhelver} is unsupported} +- %endif +- %endif +- %endif +- %else +- %if %(test -f /etc/SuSE-release && echo 1 || echo 0) +- %define susever %(rpm -qf --qf '%%{version}\\n' /etc/SuSE-release | cut -d. -f1) +- %if "%susever" == "10" +- %define distro_description SUSE Linux Enterprise Server 10 +- %define distro_releasetag sles10 +- %define distro_buildreq gcc-c++ gdbm-devel gperf ncurses-devel openldap2-client zlib-devel cmake libaio-devel +- %define distro_requires aaa_base coreutils grep procps pwdutils +- %else +- %if "%susever" == "11" +- %define distro_description SUSE Linux Enterprise Server 11 +- %define distro_releasetag sles11 +- %define distro_buildreq gcc-c++ gdbm-devel gperf ncurses-devel openldap2-client procps pwdutils zlib-devel cmake libaio-devel +- %define distro_requires aaa_base coreutils grep procps pwdutils +- %else +- %{error:SuSE %{susever} is unsupported} +- %endif +- %endif +- %else +- %{error:Unsupported distribution} +- %endif +- %endif +- %endif ++ ++%if 0%{?suse_version} ++%if 0%{?suse_version} == 1110 ++BuildRequires: gdbm-devel gperf openldap2-client procps pwdutils ++%endif ++%if 0%{?suse_version} == 1310 || 0%{?suse_version} == 1315 || 0%{?suse_version} == 1320 ++BuildRequires: gperf procps time ++%endif ++%endif ++ ++# Define dist tag if not given by platform ++%if %{undefined dist} ++ # For suse versions see: ++ # https://en.opensuse.org/openSUSE:Build_Service_cross_distribution_howto ++ %if 0%{?suse_version} == 1110 ++ %define dist .sle11 ++ %endif ++ %if 0%{?suse_version} == 1310 ++ %define dist .suse13.1 ++ %endif ++ %if 0%{?suse_version} == 1315 ++ %define dist .sle12 ++ %endif ++ %if 0%{?suse_version} == 1320 ++ %define dist .suse13.2 ++ %endif ++ # Still missing? ++ %if %{undefined dist} ++ %define dist .DIST + %endif +-%else +- %define glibc_version %(/lib/libc.so.6 | grep stable | cut -d, -f1 | cut -c38-) +- %define distro_description Generic Linux (glibc %{glibc_version}) +- %define distro_releasetag linux_glibc%{glibc_version} +- %define distro_buildreq gcc-c++ gperf ncurses-devel perl time zlib-devel +- %define distro_requires coreutils grep procps /sbin/chkconfig /usr/sbin/useradd /usr/sbin/groupadd + %endif + ++ + # Avoid debuginfo RPMs, leaves binaries unstripped + %define debug_package %{nil} + +@@ -231,7 +186,7 @@ + %define license_files_server %{src_dir}/LICENSE.mysql + %define license_type Commercial + %else +-%define license_files_server %{src_dir}/COPYING %{src_dir}/README ++%define license_files_server COPYING README + %define license_type GPL + %endif + +@@ -243,17 +198,20 @@ Name: MySQL%{product_suffix} + Summary: MySQL: a very fast and reliable SQL database server + Group: Applications/Databases + Version: @MYSQL_RPM_VERSION@ +-Release: %{release}%{?distro_releasetag:.%{distro_releasetag}} +-Distribution: %{distro_description} ++Release: %{release}%{dist} ++# Distribution: %{distro_description} + License: Copyright (c) 2000, @MYSQL_COPYRIGHT_YEAR@, %{mysql_vendor}. All rights reserved. Under %{license_type} license as shown in the Description field. +-Source: http://www.mysql.com/Downloads/MySQL-@MYSQL_BASE_VERSION@/%{src_dir}.tar.gz ++Source: %{src_dir}.tar.gz ++Source99: mysql-rpmlintrc ++Patch0: cmake-no-wix.patch + URL: http://www.mysql.com/ +-Packager: MySQL Release Engineering ++Packager: Codership Oy + Vendor: %{mysql_vendor} +-BuildRequires: %{distro_buildreq} ++# BuildRequires: %{distro_buildreq} ++#wsrep_patch_tag + + # Regression tests may take a long time, override the default to skip them +-%{!?runselftest:%global runselftest 1} ++%{!?runselftest:%global runselftest 0} + + # Think about what you use here since the first step is to + # run a rm -rf +@@ -282,10 +240,41 @@ documentation and the manual for more information. + # Sub package definition + ############################################################################## + +-%package -n MySQL-server%{product_suffix} ++%package -n mysql-wsrep%{product_suffix} ++Summary: MySQL: meta package for a server+client setup ++Group: Applications/Databases ++Requires: mysql-wsrep-server%{product_suffix} ++Requires: mysql-wsrep-client%{product_suffix} ++ ++%description -n mysql-wsrep%{product_suffix} ++This meta package ensures the installation of a MySQL server and the necessary ++client programs for operation and administration. It does not itself ++contain those files but rather causes the installation of the subpackages ++"mysql-wsrep-server%{product_suffix}" and "mysql-wsrep-client%{product_suffix}". ++As indicated in the name, the server is built with the "wsrep" plugin so that ++it can be a node in a MySQL Galera Cluster. ++ ++# ---------------------------------------------------------------------------- ++ ++%package -n mysql-wsrep-server%{product_suffix} + Summary: MySQL: a very fast and reliable SQL database server + Group: Applications/Databases +-Requires: %{distro_requires} ++# Distro requirements ++# RedHat ++%if 0%{?fedora} || 0%{?rhel} ++Requires: chkconfig coreutils grep procps shadow-utils net-tools rsync lsof ++%if 0%{?rhel} == 7 || 0%{?fedora} >= 20 ++Requires: perl-Data-Dumper ++%endif ++%endif ++# SUSE ++%if 0%{?suse_version} ++Requires: aaa_base coreutils grep procps rsync lsof ++%if 0%{suse_version} == 1110 ++Requires: pwdutils ++%endif ++%endif ++ + %if 0%{?commercial} + Obsoletes: MySQL-server + %else +@@ -298,7 +287,7 @@ Obsoletes: MySQL-server-advanced-gpl MySQL-server-enterprise-gpl + Provides: mysql-server = %{version}-%{release} + Provides: mysql-server%{?_isa} = %{version}-%{release} + +-%description -n MySQL-server%{product_suffix} ++%description -n mysql-wsrep-server%{product_suffix} + The MySQL(TM) software delivers a very fast, multi-threaded, multi-user, + and robust SQL (Structured Query Language) database server. MySQL Server + is intended for mission-critical, heavy-load production systems as well +@@ -319,11 +308,13 @@ and the manual for more information. + This package includes the MySQL server binary as well as related utilities + to run and administer a MySQL server. + ++Built with wsrep patch %{wsrep_version}. ++ + If you want to access and work with the database, you have to install +-package "MySQL-client%{product_suffix}" as well! ++package "mysql-wsrep-client%{product_suffix}" as well! + + # ---------------------------------------------------------------------------- +-%package -n MySQL-client%{product_suffix} ++%package -n mysql-wsrep-client%{product_suffix} + Summary: MySQL - Client + Group: Applications/Databases + %if 0%{?commercial} +@@ -338,13 +329,13 @@ Obsoletes: MySQL-client-advanced-gpl MySQL-client-enterprise-gpl + Provides: mysql = %{version}-%{release} + Provides: mysql%{?_isa} = %{version}-%{release} + +-%description -n MySQL-client%{product_suffix} ++%description -n mysql-wsrep-client%{product_suffix} + This package contains the standard MySQL clients and administration tools. + + For a description of MySQL see the base MySQL RPM or http://www.mysql.com/ + + # ---------------------------------------------------------------------------- +-%package -n MySQL-test%{product_suffix} ++%package -n mysql-wsrep-test%{product_suffix} + Summary: MySQL - Test suite + Group: Applications/Databases + %if 0%{?commercial} +@@ -362,13 +353,13 @@ Provides: mysql-test = %{version}-%{release} + Provides: mysql-test%{?_isa} = %{version}-%{release} + AutoReqProv: no + +-%description -n MySQL-test%{product_suffix} ++%description -n mysql-wsrep-test%{product_suffix} + This package contains the MySQL regression test suite. + + For a description of MySQL see the base MySQL RPM or http://www.mysql.com/ + + # ---------------------------------------------------------------------------- +-%package -n MySQL-devel%{product_suffix} ++%package -n mysql-wsrep-devel%{product_suffix} + Summary: MySQL - Development header files and libraries + Group: Applications/Databases + %if 0%{?commercial} +@@ -383,14 +374,14 @@ Obsoletes: MySQL-devel-advanced-gpl MySQL-devel-enterprise-gpl + Provides: mysql-devel = %{version}-%{release} + Provides: mysql-devel%{?_isa} = %{version}-%{release} + +-%description -n MySQL-devel%{product_suffix} ++%description -n mysql-wsrep-devel%{product_suffix} + This package contains the development header files and libraries necessary + to develop MySQL client applications. + + For a description of MySQL see the base MySQL RPM or http://www.mysql.com/ + + # ---------------------------------------------------------------------------- +-%package -n MySQL-shared%{product_suffix} ++%package -n mysql-wsrep-shared%{product_suffix} + Summary: MySQL - Shared libraries + Group: Applications/Databases + %if 0%{?commercial} +@@ -404,44 +395,17 @@ Obsoletes: MySQL-shared-pro-gpl-cert + Obsoletes: MySQL-shared-classic MySQL-shared-community MySQL-shared-enterprise + Obsoletes: MySQL-shared-advanced-gpl MySQL-shared-enterprise-gpl + +-%description -n MySQL-shared%{product_suffix} ++%description -n mysql-wsrep-shared%{product_suffix} + This package contains the shared libraries (*.so*) which certain languages + and applications need to dynamically load and use MySQL. + +-# ---------------------------------------------------------------------------- +-%package -n MySQL-embedded%{product_suffix} +-Summary: MySQL - Embedded library +-Group: Applications/Databases +-%if 0%{?commercial} +-Requires: MySQL-devel-advanced +-Obsoletes: MySQL-embedded +-%else +-Requires: MySQL-devel +-Obsoletes: MySQL-embedded-advanced +-%endif +-Obsoletes: mysql-embedded < %{version}-%{release} +-Obsoletes: mysql-embedded-advanced +-Obsoletes: MySQL-embedded-pro +-Obsoletes: MySQL-embedded-classic MySQL-embedded-community MySQL-embedded-enterprise +-Obsoletes: MySQL-embedded-advanced-gpl MySQL-embedded-enterprise-gpl +-Provides: mysql-embedded = %{version}-%{release} +-Provides: mysql-emdedded%{?_isa} = %{version}-%{release} +- +-%description -n MySQL-embedded%{product_suffix} +-This package contains the MySQL server as an embedded library. +- +-The embedded MySQL server library makes it possible to run a full-featured +-MySQL server inside the client application. The main benefits are increased +-speed and more simple management for embedded applications. +- +-The API is identical for the embedded MySQL version and the +-client/server version. +- +-For a description of MySQL see the base MySQL RPM or http://www.mysql.com/ +- + ############################################################################## + %prep +-%setup -T -a 0 -c -n %{src_dir} ++%setup -n %{src_dir} ++# That patch is needed with old cmake only, on SLES 11, but it won't do any harm ++# outside Windows, so it may be used in all RPM builds. ++%patch0 -p1 ++#wsrep_apply_patch_tag + ############################################################################## + %build + +@@ -481,7 +445,7 @@ export CFLAGS=${MYSQL_BUILD_CFLAGS:-${CFLAGS:-$RPM_OPT_FLAGS}} + export CXXFLAGS=${MYSQL_BUILD_CXXFLAGS:-${CXXFLAGS:-$RPM_OPT_FLAGS -felide-constructors}} + export LDFLAGS=${MYSQL_BUILD_LDFLAGS:-${LDFLAGS:-}} + export CMAKE=${MYSQL_BUILD_CMAKE:-${CMAKE:-cmake}} +-export MAKE_JFLAG=${MYSQL_BUILD_MAKE_JFLAG:-} ++export MAKE_JFLAG=${MYSQL_BUILD_MAKE_JFLAG:--j$(ncpu=$(cat /proc/cpuinfo | grep processor | wc -l) && echo $(($ncpu > 4 ? 4 : $ncpu)))} + + # By default, a build will include the bundeled "yaSSL" library for SSL. + # However, there may be a need to override. +@@ -500,6 +464,7 @@ mkdir debug + CFLAGS=`echo " ${CFLAGS} " | \ + sed -e 's/ -O[0-9]* / /' \ + -e 's/-Wp,-D_FORTIFY_SOURCE=2/ /' \ ++ -e 's/-D_FORTIFY_SOURCE=2/ /' \ + -e 's/ -unroll2 / /' \ + -e 's/ -ip / /' \ + -e 's/^ //' \ +@@ -507,19 +472,23 @@ mkdir debug + CXXFLAGS=`echo " ${CXXFLAGS} " | \ + sed -e 's/ -O[0-9]* / /' \ + -e 's/-Wp,-D_FORTIFY_SOURCE=2/ /' \ ++ -e 's/-D_FORTIFY_SOURCE=2/ /' \ + -e 's/ -unroll2 / /' \ + -e 's/ -ip / /' \ + -e 's/^ //' \ + -e 's/ $//'` + # XXX: MYSQL_UNIX_ADDR should be in cmake/* but mysql_version is included before + # XXX: install_layout so we can't just set it based on INSTALL_LAYOUT=RPM +- ${CMAKE} ../%{src_dir} -DBUILD_CONFIG=mysql_release -DINSTALL_LAYOUT=RPM \ ++ ${CMAKE} ../ -DBUILD_CONFIG=mysql_release -DINSTALL_LAYOUT=RPM \ + -DCMAKE_BUILD_TYPE=Debug \ + -DMYSQL_UNIX_ADDR="%{mysqldatadir}/mysql.sock" \ + -DFEATURE_SET="%{feature_set}" \ + %{ssl_option} \ + -DCOMPILATION_COMMENT="%{compilation_comment_debug}" \ +- -DMYSQL_SERVER_SUFFIX="%{server_suffix}" ++ -DMYSQL_SERVER_SUFFIX="%{server_suffix}" \ ++ -DWITH_WSREP=1 \ ++ -DWSREP_VERSION="%{wsrep_version}" \ ++ -DWSREP_REVISION="%{wsrep_revision}" + echo BEGIN_DEBUG_CONFIG ; egrep '^#define' include/config.h ; echo END_DEBUG_CONFIG + make ${MAKE_JFLAG} VERBOSE=1 + ) +@@ -529,13 +498,16 @@ mkdir release + cd release + # XXX: MYSQL_UNIX_ADDR should be in cmake/* but mysql_version is included before + # XXX: install_layout so we can't just set it based on INSTALL_LAYOUT=RPM +- ${CMAKE} ../%{src_dir} -DBUILD_CONFIG=mysql_release -DINSTALL_LAYOUT=RPM \ ++ ${CMAKE} ../ -DBUILD_CONFIG=mysql_release -DINSTALL_LAYOUT=RPM \ + -DCMAKE_BUILD_TYPE=RelWithDebInfo \ + -DMYSQL_UNIX_ADDR="%{mysqldatadir}/mysql.sock" \ + -DFEATURE_SET="%{feature_set}" \ + %{ssl_option} \ + -DCOMPILATION_COMMENT="%{compilation_comment_release}" \ +- -DMYSQL_SERVER_SUFFIX="%{server_suffix}" ++ -DMYSQL_SERVER_SUFFIX="%{server_suffix}" \ ++ -DWITH_WSREP=1 \ ++ -DWSREP_VERSION="%{wsrep_version}" \ ++ -DWSREP_REVISION="%{wsrep_revision}" + echo BEGIN_NORMAL_CONFIG ; egrep '^#define' include/config.h ; echo END_NORMAL_CONFIG + make ${MAKE_JFLAG} VERBOSE=1 + ) +@@ -582,14 +554,20 @@ install -m 755 $MBD/release/support-files/mysql.server $RBR%{_sysconfdir}/init.d + + # Create a symlink "rcmysql", pointing to the init.script. SuSE users + # will appreciate that, as all services usually offer this. +-ln -s %{_sysconfdir}/init.d/mysql $RBR%{_sbindir}/rcmysql ++ln -sf %{_sysconfdir}/init.d/mysql $RBR%{_sbindir}/rcmysql ++ ++# Create a wsrep_sst_rsync_wan symlink. ++install -d $RBR%{_bindir} ++ln -sf wsrep_sst_rsync $RBR%{_bindir}/wsrep_sst_rsync_wan + + # Touch the place where the my.cnf config file might be located + # Just to make sure it's in the file list and marked as a config file + touch $RBR%{_sysconfdir}/my.cnf ++touch $RBR%{_sysconfdir}/wsrep.cnf ++ + + # Install SELinux files in datadir +-install -m 600 $MBD/%{src_dir}/support-files/RHEL4-SElinux/mysql.{fc,te} \ ++install -m 600 $MBD/support-files/RHEL4-SElinux/mysql.{fc,te} \ + $RBR%{_datadir}/mysql/SELinux/RHEL4 + + %if %{WITH_TCMALLOC} +@@ -608,7 +586,7 @@ install -m 644 "%{malloc_lib_source}" \ + # Post processing actions, i.e. when installed + ############################################################################## + +-%pre -n MySQL-server%{product_suffix} ++%pre -n mysql-wsrep-server%{product_suffix} + # This is the code running at the beginning of a RPM upgrade action, + # before replacing the old files with the new ones. + +@@ -786,7 +764,7 @@ if [ -x %{_sysconfdir}/init.d/mysql ] ; then + sleep 5 + fi + +-%post -n MySQL-server%{product_suffix} ++%post -n mysql-wsrep-server%{product_suffix} + # This is the code running at the end of a RPM install or upgrade action, + # after the (new) files have been written. + +@@ -946,7 +924,7 @@ mv -f $STATUS_FILE ${STATUS_FILE}-LAST # for "triggerpostun" + #scheduled service packs and more. Visit www.mysql.com/enterprise for more + #information." + +-%preun -n MySQL-server%{product_suffix} ++%preun -n mysql-wsrep-server%{product_suffix} + + # Which '$1' does this refer to? Fedora docs have info: + # " ... a count of the number of versions of the package that are installed. +@@ -975,7 +953,7 @@ fi + # We do not remove the mysql user since it may still own a lot of + # database files. + +-%triggerpostun -n MySQL-server%{product_suffix} --MySQL-server-community ++%triggerpostun -n mysql-wsrep-server%{product_suffix} --MySQL-server-community + + # Setup: We renamed this package, so any existing "server-community" + # package will be removed when this "server" is installed. +@@ -1046,15 +1024,22 @@ echo "=====" >> $STATUS_HISTORY + # Files section + ############################################################################## + +-%files -n MySQL-server%{product_suffix} -f release/support-files/plugins.files ++%files -n mysql-wsrep%{product_suffix} ++# Intentionally empty - this is a pure meta package. ++ ++# ---------------------------------------------------------------------------- ++%files -n mysql-wsrep-server%{product_suffix} -f release/support-files/plugins.files + %defattr(-,root,root,0755) + %if %{defined license_files_server} + %doc %{license_files_server} + %endif +-%doc %{src_dir}/Docs/ChangeLog +-%doc %{src_dir}/Docs/INFO_SRC* ++%doc Docs/ChangeLog ++%doc release/Docs/INFO_SRC* + %doc release/Docs/INFO_BIN* + %doc release/support-files/my-default.cnf ++%doc Docs/README-wsrep ++%doc release/support-files/wsrep.cnf ++%doc release/support-files/wsrep_notify + + %if 0%{?commercial} + %doc %attr(644, root, root) %{_infodir}/mysql.info* +@@ -1090,6 +1075,7 @@ echo "=====" >> $STATUS_HISTORY + %doc %attr(644, root, man) %{_mandir}/man1/resolveip.1* + + %ghost %config(noreplace,missingok) %{_sysconfdir}/my.cnf ++%ghost %config(noreplace,missingok) %{_sysconfdir}/wsrep.cnf + %dir %{_sysconfdir}/my.cnf.d + + %attr(755, root, root) %{_bindir}/innochecksum +@@ -1117,10 +1103,18 @@ echo "=====" >> $STATUS_HISTORY + %attr(755, root, root) %{_bindir}/replace + %attr(755, root, root) %{_bindir}/resolve_stack_dump + %attr(755, root, root) %{_bindir}/resolveip ++%attr(755, root, root) %{_bindir}/wsrep_sst_common ++%attr(755, root, root) %{_bindir}/wsrep_sst_mysqldump ++%attr(755, root, root) %{_bindir}/wsrep_sst_rsync ++%attr(755, root, root) %{_bindir}/wsrep_sst_rsync_wan ++%attr(755, root, root) %{_bindir}/wsrep_sst_xtrabackup ++%attr(755, root, root) %{_bindir}/wsrep_sst_xtrabackup-v2 + + %attr(755, root, root) %{_sbindir}/mysqld + %attr(755, root, root) %{_sbindir}/mysqld-debug + %attr(755, root, root) %{_sbindir}/rcmysql ++%dir %{_libdir}/mysql/plugin ++%dir %{_libdir}/mysql/plugin/debug + %attr(755, root, root) %{_libdir}/mysql/plugin/daemon_example.ini + + %if %{WITH_TCMALLOC} +@@ -1133,7 +1127,8 @@ echo "=====" >> $STATUS_HISTORY + %dir %attr(755, mysql, mysql) /var/lib/mysql + + # ---------------------------------------------------------------------------- +-%files -n MySQL-client%{product_suffix} ++%files -n mysql-wsrep-client%{product_suffix} ++ + %defattr(-, root, root, 0755) + %if %{defined license_files_server} + %doc %{license_files_server} +@@ -1169,7 +1164,7 @@ echo "=====" >> $STATUS_HISTORY + %doc %attr(644, root, man) %{_mandir}/man1/mysql_config_editor.1* + + # ---------------------------------------------------------------------------- +-%files -n MySQL-devel%{product_suffix} -f optional-files-devel ++%files -n mysql-wsrep-devel%{product_suffix} -f optional-files-devel + %defattr(-, root, root, 0755) + %if %{defined license_files_server} + %doc %{license_files_server} +@@ -1186,7 +1181,7 @@ echo "=====" >> $STATUS_HISTORY + %{_libdir}/mysql/libmysqlservices.a + + # ---------------------------------------------------------------------------- +-%files -n MySQL-shared%{product_suffix} ++%files -n mysql-wsrep-shared%{product_suffix} + %defattr(-, root, root, 0755) + %if %{defined license_files_server} + %doc %{license_files_server} +@@ -1194,44 +1189,47 @@ echo "=====" >> $STATUS_HISTORY + # Shared libraries (omit for architectures that don't support them) + %{_libdir}/libmysql*.so* + +-%post -n MySQL-shared%{product_suffix} ++%post -n mysql-wsrep-shared%{product_suffix} + /sbin/ldconfig + +-%postun -n MySQL-shared%{product_suffix} ++%postun -n mysql-wsrep-shared%{product_suffix} + /sbin/ldconfig + + # ---------------------------------------------------------------------------- +-%files -n MySQL-test%{product_suffix} ++%files -n mysql-wsrep-test%{product_suffix} + %defattr(-, root, root, 0755) + %if %{defined license_files_server} + %doc %{license_files_server} + %endif + %attr(-, root, root) %{_datadir}/mysql-test + %attr(755, root, root) %{_bindir}/mysql_client_test +-%attr(755, root, root) %{_bindir}/mysql_client_test_embedded +-%attr(755, root, root) %{_bindir}/mysqltest_embedded + %doc %attr(644, root, man) %{_mandir}/man1/mysql_client_test.1* + %doc %attr(644, root, man) %{_mandir}/man1/mysql-stress-test.pl.1* + %doc %attr(644, root, man) %{_mandir}/man1/mysql-test-run.pl.1* + %doc %attr(644, root, man) %{_mandir}/man1/mysql_client_test_embedded.1* + %doc %attr(644, root, man) %{_mandir}/man1/mysqltest_embedded.1* + +-# ---------------------------------------------------------------------------- +-%files -n MySQL-embedded%{product_suffix} +-%defattr(-, root, root, 0755) +-%if %{defined license_files_server} +-%doc %{license_files_server} +-%endif +-%attr(755, root, root) %{_bindir}/mysql_embedded +-%attr(644, root, root) %{_libdir}/mysql/libmysqld.a +-%attr(644, root, root) %{_libdir}/mysql/libmysqld-debug.a +- + ############################################################################## + # The spec file changelog only includes changes made to the spec file + # itself - note that they must be ordered by date (important when + # merging BK trees) + ############################################################################## + %changelog ++* Thu Jan 29 2015 Joerg Bruehe ++- Add a meta-package "mysql-wsrep" that requires both "server" and "client". ++- Fix the fall-back definition of "dist", it must start with a period. ++ ++* Mon Jan 26 2015 Joerg Bruehe ++- Allow "rpmlint", but suppress "post-build-checks" (fail on SuSE 12 + 13). ++- Improve handling of undefined "%%{dist}". ++- Fix wrong changelog dates, to get rid of warnings about "bogus date". ++- Escape percent signs in changelog, to get rid of "rpmlint" warnings. ++ ++* Tue Jan 20 2015 Teemu Ollakka ++ ++- Reworked to build wsrep patched packages exclusively ++- OBS compatible ++ + * Mon Oct 06 2014 Balasubramanian Kandasamy + - Add license info in each subpackage + +@@ -1350,7 +1348,7 @@ echo "=====" >> $STATUS_HISTORY + not in an RPM upgrade. + This affects both the "mkdir" and the call of "mysql_install_db". + +-* Wed Feb 09 2011 Joerg Bruehe ++* Thu Feb 10 2011 Joerg Bruehe + + - Fix bug#56581: If an installation deviates from the default file locations + ("datadir" and "pid-file"), the mechanism to detect a running server (on upgrade) +@@ -1471,7 +1469,7 @@ echo "=====" >> $STATUS_HISTORY + - Fix some problems with the directives around "tcmalloc" (experimental), + remove erroneous traces of the InnoDB plugin (that is 5.1 only). + +-* Tue Oct 06 2009 Magnus Blaudd ++* Fri Oct 09 2009 Magnus Blaudd + + - Removed mysql_fix_privilege_tables + +@@ -1668,7 +1666,7 @@ echo "=====" >> $STATUS_HISTORY + + - Set $LDFLAGS from $MYSQL_BUILD_LDFLAGS + +-* Tue Mar 07 2006 Kent Boortz ++* Wed Mar 08 2006 Kent Boortz + + - Changed product name from "Community Edition" to "Community Server" + +@@ -1763,7 +1761,7 @@ echo "=====" >> $STATUS_HISTORY + + * Thu Sep 29 2005 Lenz Grimmer + +-- fixed the removing of the RPM_BUILD_ROOT in the %clean section (the ++- fixed the removing of the RPM_BUILD_ROOT in the %%clean section (the + $RBR variable did not get expanded, thus leaving old build roots behind) + + * Thu Aug 04 2005 Lenz Grimmer +@@ -1916,7 +1914,7 @@ echo "=====" >> $STATUS_HISTORY + + - marked /etc/logrotate.d/mysql as a config file (BUG 2156) + +-* Sat Dec 13 2003 Lenz Grimmer ++* Fri Dec 12 2003 Lenz Grimmer + + - fixed file permissions (BUG 1672) + +@@ -2058,7 +2056,7 @@ echo "=====" >> $STATUS_HISTORY + - Added separate libmysql_r directory; now both a threaded + and non-threaded library is shipped. + +-* Tue Sep 28 1999 David Axmark ++* Wed Sep 29 1999 David Axmark + + - Added the support-files/my-example.cnf to the docs directory. + +diff --git a/support-files/wsrep.cnf b/support-files/wsrep.cnf +new file mode 100644 +index 0000000..756d4f6 +--- /dev/null ++++ b/support-files/wsrep.cnf +@@ -0,0 +1,129 @@ ++# This file contains wsrep-related mysqld options. It should be included ++# in the main MySQL configuration file. ++# ++# Options that need to be customized: ++# - wsrep_provider ++# - wsrep_cluster_address ++# - wsrep_sst_auth ++# The rest of defaults should work out of the box. ++ ++## ++## mysqld options _MANDATORY_ for correct opration of the cluster ++## ++[mysqld] ++ ++# (This must be substituted by wsrep_format) ++binlog_format=ROW ++ ++# Currently only InnoDB storage engine is supported ++default-storage-engine=innodb ++ ++# to avoid issues with 'bulk mode inserts' using autoinc ++innodb_autoinc_lock_mode=2 ++ ++# This is a must for paralell applying ++innodb_locks_unsafe_for_binlog=1 ++ ++# Query Cache is not supported with wsrep ++query_cache_size=0 ++query_cache_type=0 ++ ++# Override bind-address ++# In some systems bind-address defaults to 127.0.0.1, and with mysqldump SST ++# it will have (most likely) disastrous consequences on donor node ++bind-address=0.0.0.0 ++ ++## ++## WSREP options ++## ++ ++# Full path to wsrep provider library or 'none' ++wsrep_provider=none ++ ++# Provider specific configuration options ++#wsrep_provider_options= ++ ++# Logical cluster name. Should be the same for all nodes. ++wsrep_cluster_name="my_wsrep_cluster" ++ ++# Group communication system handle ++#wsrep_cluster_address="dummy://" ++ ++# Human-readable node name (non-unique). Hostname by default. ++#wsrep_node_name= ++ ++# Base replication [:port] of the node. ++# The values supplied will be used as defaults for state transfer receiving, ++# listening ports and so on. Default: address of the first network interface. ++#wsrep_node_address= ++ ++# Address for incoming client connections. Autodetect by default. ++#wsrep_node_incoming_address= ++ ++# How many threads will process writesets from other nodes ++wsrep_slave_threads=1 ++ ++# DBUG options for wsrep provider ++#wsrep_dbug_option ++ ++# Generate fake primary keys for non-PK tables (required for multi-master ++# and parallel applying operation) ++wsrep_certify_nonPK=1 ++ ++# Maximum number of rows in write set ++wsrep_max_ws_rows=131072 ++ ++# Maximum size of write set ++wsrep_max_ws_size=1073741824 ++ ++# to enable debug level logging, set this to 1 ++wsrep_debug=0 ++ ++# convert locking sessions into transactions ++wsrep_convert_LOCK_to_trx=0 ++ ++# how many times to retry deadlocked autocommits ++wsrep_retry_autocommit=1 ++ ++# change auto_increment_increment and auto_increment_offset automatically ++wsrep_auto_increment_control=1 ++ ++# retry autoinc insert, which failed for duplicate key error ++wsrep_drupal_282555_workaround=0 ++ ++# enable "strictly synchronous" semantics for read operations ++wsrep_causal_reads=0 ++ ++# Command to call when node status or cluster membership changes. ++# Will be passed all or some of the following options: ++# --status - new status of this node ++# --uuid - UUID of the cluster ++# --primary - whether the component is primary or not ("yes"/"no") ++# --members - comma-separated list of members ++# --index - index of this node in the list ++wsrep_notify_cmd= ++ ++## ++## WSREP State Transfer options ++## ++ ++# State Snapshot Transfer method ++wsrep_sst_method=rsync ++ ++# Address which donor should send State Snapshot to. ++# Should be the address of THIS node. DON'T SET IT TO DONOR ADDRESS!!! ++# (SST method dependent. Defaults to the first IP of the first interface) ++#wsrep_sst_receive_address= ++ ++# SST authentication string. This will be used to send SST to joining nodes. ++# Depends on SST method. For mysqldump method it is root: ++wsrep_sst_auth=root: ++ ++# Desired SST donor name. ++#wsrep_sst_donor= ++ ++# Reject client queries when donating SST (false) ++#wsrep_sst_donor_rejects_queries=0 ++ ++# Protocol version to use ++# wsrep_protocol_version= +diff --git a/support-files/wsrep.cnf.sh b/support-files/wsrep.cnf.sh +new file mode 100644 +index 0000000..756d4f6 +--- /dev/null ++++ b/support-files/wsrep.cnf.sh +@@ -0,0 +1,129 @@ ++# This file contains wsrep-related mysqld options. It should be included ++# in the main MySQL configuration file. ++# ++# Options that need to be customized: ++# - wsrep_provider ++# - wsrep_cluster_address ++# - wsrep_sst_auth ++# The rest of defaults should work out of the box. ++ ++## ++## mysqld options _MANDATORY_ for correct opration of the cluster ++## ++[mysqld] ++ ++# (This must be substituted by wsrep_format) ++binlog_format=ROW ++ ++# Currently only InnoDB storage engine is supported ++default-storage-engine=innodb ++ ++# to avoid issues with 'bulk mode inserts' using autoinc ++innodb_autoinc_lock_mode=2 ++ ++# This is a must for paralell applying ++innodb_locks_unsafe_for_binlog=1 ++ ++# Query Cache is not supported with wsrep ++query_cache_size=0 ++query_cache_type=0 ++ ++# Override bind-address ++# In some systems bind-address defaults to 127.0.0.1, and with mysqldump SST ++# it will have (most likely) disastrous consequences on donor node ++bind-address=0.0.0.0 ++ ++## ++## WSREP options ++## ++ ++# Full path to wsrep provider library or 'none' ++wsrep_provider=none ++ ++# Provider specific configuration options ++#wsrep_provider_options= ++ ++# Logical cluster name. Should be the same for all nodes. ++wsrep_cluster_name="my_wsrep_cluster" ++ ++# Group communication system handle ++#wsrep_cluster_address="dummy://" ++ ++# Human-readable node name (non-unique). Hostname by default. ++#wsrep_node_name= ++ ++# Base replication [:port] of the node. ++# The values supplied will be used as defaults for state transfer receiving, ++# listening ports and so on. Default: address of the first network interface. ++#wsrep_node_address= ++ ++# Address for incoming client connections. Autodetect by default. ++#wsrep_node_incoming_address= ++ ++# How many threads will process writesets from other nodes ++wsrep_slave_threads=1 ++ ++# DBUG options for wsrep provider ++#wsrep_dbug_option ++ ++# Generate fake primary keys for non-PK tables (required for multi-master ++# and parallel applying operation) ++wsrep_certify_nonPK=1 ++ ++# Maximum number of rows in write set ++wsrep_max_ws_rows=131072 ++ ++# Maximum size of write set ++wsrep_max_ws_size=1073741824 ++ ++# to enable debug level logging, set this to 1 ++wsrep_debug=0 ++ ++# convert locking sessions into transactions ++wsrep_convert_LOCK_to_trx=0 ++ ++# how many times to retry deadlocked autocommits ++wsrep_retry_autocommit=1 ++ ++# change auto_increment_increment and auto_increment_offset automatically ++wsrep_auto_increment_control=1 ++ ++# retry autoinc insert, which failed for duplicate key error ++wsrep_drupal_282555_workaround=0 ++ ++# enable "strictly synchronous" semantics for read operations ++wsrep_causal_reads=0 ++ ++# Command to call when node status or cluster membership changes. ++# Will be passed all or some of the following options: ++# --status - new status of this node ++# --uuid - UUID of the cluster ++# --primary - whether the component is primary or not ("yes"/"no") ++# --members - comma-separated list of members ++# --index - index of this node in the list ++wsrep_notify_cmd= ++ ++## ++## WSREP State Transfer options ++## ++ ++# State Snapshot Transfer method ++wsrep_sst_method=rsync ++ ++# Address which donor should send State Snapshot to. ++# Should be the address of THIS node. DON'T SET IT TO DONOR ADDRESS!!! ++# (SST method dependent. Defaults to the first IP of the first interface) ++#wsrep_sst_receive_address= ++ ++# SST authentication string. This will be used to send SST to joining nodes. ++# Depends on SST method. For mysqldump method it is root: ++wsrep_sst_auth=root: ++ ++# Desired SST donor name. ++#wsrep_sst_donor= ++ ++# Reject client queries when donating SST (false) ++#wsrep_sst_donor_rejects_queries=0 ++ ++# Protocol version to use ++# wsrep_protocol_version= +diff --git a/support-files/wsrep_notify.sh b/support-files/wsrep_notify.sh +new file mode 100644 +index 0000000..bdbe3d1 +--- /dev/null ++++ b/support-files/wsrep_notify.sh +@@ -0,0 +1,102 @@ ++#!/bin/sh -eu ++ ++# This is a simple example of wsrep notification script (wsrep_notify_cmd). ++# It will create 'wsrep' schema and two tables in it: 'membeship' and 'status' ++# and fill them on every membership or node status change. ++# ++# Edit parameters below to specify the address and login to server. ++ ++USER=root ++PSWD=rootpass ++HOST=127.0.0.1 ++PORT=3306 ++ ++SCHEMA="wsrep" ++MEMB_TABLE="$SCHEMA.membership" ++STATUS_TABLE="$SCHEMA.status" ++ ++BEGIN=" ++SET wsrep_on=0; ++DROP SCHEMA IF EXISTS $SCHEMA; CREATE SCHEMA $SCHEMA; ++CREATE TABLE $MEMB_TABLE ( ++ idx INT UNIQUE PRIMARY KEY, ++ uuid CHAR(40) UNIQUE, /* node UUID */ ++ name VARCHAR(32), /* node name */ ++ addr VARCHAR(256) /* node address */ ++) ENGINE=MEMORY; ++CREATE TABLE $STATUS_TABLE ( ++ size INT, /* component size */ ++ idx INT, /* this node index */ ++ status CHAR(16), /* this node status */ ++ uuid CHAR(40), /* cluster UUID */ ++ prim BOOLEAN /* if component is primary */ ++) ENGINE=MEMORY; ++BEGIN; ++DELETE FROM $MEMB_TABLE; ++DELETE FROM $STATUS_TABLE; ++" ++END="COMMIT;" ++ ++configuration_change() ++{ ++ echo "$BEGIN;" ++ ++ local idx=0 ++ ++ for NODE in $(echo $MEMBERS | sed s/,/\ /g) ++ do ++ echo "INSERT INTO $MEMB_TABLE VALUES ( $idx, " ++ # Don't forget to properly quote string values ++ echo "'$NODE'" | sed s/\\//\',\'/g ++ echo ");" ++ idx=$(( $idx + 1 )) ++ done ++ ++ echo "INSERT INTO $STATUS_TABLE VALUES($idx, $INDEX, '$STATUS', '$CLUSTER_UUID', $PRIMARY);" ++ ++ echo "$END" ++} ++ ++status_update() ++{ ++ echo "SET wsrep_on=0; BEGIN; UPDATE $STATUS_TABLE SET status='$STATUS'; COMMIT;" ++} ++ ++COM=status_update # not a configuration change by default ++ ++while [ $# -gt 0 ] ++do ++ case $1 in ++ --status) ++ STATUS=$2 ++ shift ++ ;; ++ --uuid) ++ CLUSTER_UUID=$2 ++ shift ++ ;; ++ --primary) ++ [ "$2" = "yes" ] && PRIMARY="1" || PRIMARY="0" ++ COM=configuration_change ++ shift ++ ;; ++ --index) ++ INDEX=$2 ++ shift ++ ;; ++ --members) ++ MEMBERS=$2 ++ shift ++ ;; ++ esac ++ shift ++done ++ ++# Undefined means node is shutting down ++if [ "$STATUS" != "Undefined" ] ++then ++ $COM | mysql -B -u$USER -p$PSWD -h$HOST -P$PORT ++fi ++ ++exit 0 ++# +diff --git a/vio/viosslfactories.c b/vio/viosslfactories.c +index 4d5ff71..07e05e4 100644 +--- a/vio/viosslfactories.c ++++ b/vio/viosslfactories.c +@@ -1,4 +1,4 @@ +-/* Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. ++/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by +diff --git a/wsrep/CMakeLists.txt b/wsrep/CMakeLists.txt +new file mode 100644 +index 0000000..182e458 +--- /dev/null ++++ b/wsrep/CMakeLists.txt +@@ -0,0 +1,24 @@ ++# Copyright (c) 2012, Codership Oy. 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 ++ ++INCLUDE_DIRECTORIES( "." ) ++ ++SET(WSREP_SOURCES wsrep_gtid.c wsrep_uuid.c wsrep_loader.c wsrep_dummy.c) ++ ++ADD_CONVENIENCE_LIBRARY(wsrep ${WSREP_SOURCES}) ++DTRACE_INSTRUMENT(wsrep) ++ ++#ADD_EXECUTABLE(listener wsrep_listener.c ${WSREP_SOURCES}) ++#TARGET_LINK_LIBRARIES(listener ${LIBDL}) +diff --git a/wsrep/Makefile.am b/wsrep/Makefile.am +new file mode 100644 +index 0000000..a748ece +--- /dev/null ++++ b/wsrep/Makefile.am +@@ -0,0 +1,7 @@ ++noinst_LIBRARIES = libwsrep.a ++libwsrep_a_SOURCES = wsrep_api.h wsrep_loader.c wsrep_dummy.c wsrep_uuid.c wsrep_gtid.c ++noinst_PROGRAMS = wsrep_listener ++wsrep_listener_SOURCES = wsrep_listener.c ++wsrep_listener_LDADD = $(noinst_LIBRARIES) ++wsrep_listener_LDFLAGS = -static -ldl ++ +diff --git a/wsrep/wsrep_api.h b/wsrep/wsrep_api.h +new file mode 100644 +index 0000000..c3304d7 +--- /dev/null ++++ b/wsrep/wsrep_api.h +@@ -0,0 +1,1118 @@ ++/* Copyright (C) 2009-2013 Codership Oy ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; version 2 of the License. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License along ++ with this program; if not, write to the Free Software Foundation, Inc., ++ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. ++ */ ++ ++/*! ++ @file wsrep API declaration. ++ ++ HOW TO READ THIS FILE. ++ ++ Due to C language rules this header layout doesn't lend itself to intuitive ++ reading. So here's the scoop: in the end this header declares two main types: ++ ++ * struct wsrep_init_args ++ ++ and ++ ++ * struct wsrep ++ ++ wsrep_init_args contains initialization parameters for wsrep provider like ++ names, addresses, etc. and pointers to callbacks. The callbacks will be called ++ by provider when it needs to do something application-specific, like log a ++ message or apply a writeset. It should be passed to init() call from ++ wsrep API. It is an application part of wsrep API contract. ++ ++ struct wsrep is the interface to wsrep provider. It contains all wsrep API ++ calls. It is a provider part of wsrep API contract. ++ ++ Finally, wsrep_load() method loads (dlopens) wsrep provider library. It is ++ defined in wsrep_loader.c unit and is part of libwsrep.a (which is not a ++ wsrep provider, but a convenience library). ++ ++ wsrep_unload() does the reverse. ++ ++*/ ++#ifndef WSREP_H ++#define WSREP_H ++ ++#include ++#include ++#include ++#include ++#include ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++/************************************************************************** ++ * * ++ * wsrep replication API * ++ * * ++ **************************************************************************/ ++ ++#define WSREP_INTERFACE_VERSION "25" ++ ++/*! Empty backend spec */ ++#define WSREP_NONE "none" ++ ++ ++/*! ++ * @brief log severity levels, passed as first argument to log handler ++ */ ++typedef enum wsrep_log_level ++{ ++ WSREP_LOG_FATAL, //!< Unrecoverable error, application must quit. ++ WSREP_LOG_ERROR, //!< Operation failed, must be repeated. ++ WSREP_LOG_WARN, //!< Unexpected condition, but no operational failure. ++ WSREP_LOG_INFO, //!< Informational message. ++ WSREP_LOG_DEBUG //!< Debug message. Shows only of compiled with debug. ++} wsrep_log_level_t; ++ ++/*! ++ * @brief error log handler ++ * ++ * All messages from wsrep provider are directed to this ++ * handler, if present. ++ * ++ * @param level log level ++ * @param message log message ++ */ ++typedef void (*wsrep_log_cb_t)(wsrep_log_level_t, const char *); ++ ++ ++/*! ++ * Certain provider capabilities application may want to know about ++ */ ++#define WSREP_CAP_MULTI_MASTER ( 1ULL << 0 ) ++#define WSREP_CAP_CERTIFICATION ( 1ULL << 1 ) ++#define WSREP_CAP_PARALLEL_APPLYING ( 1ULL << 2 ) ++#define WSREP_CAP_TRX_REPLAY ( 1ULL << 3 ) ++#define WSREP_CAP_ISOLATION ( 1ULL << 4 ) ++#define WSREP_CAP_PAUSE ( 1ULL << 5 ) ++#define WSREP_CAP_CAUSAL_READS ( 1ULL << 6 ) ++#define WSREP_CAP_CAUSAL_TRX ( 1ULL << 7 ) ++#define WSREP_CAP_INCREMENTAL_WRITESET ( 1ULL << 8 ) ++#define WSREP_CAP_SESSION_LOCKS ( 1ULL << 9 ) ++#define WSREP_CAP_DISTRIBUTED_LOCKS ( 1ULL << 10 ) ++#define WSREP_CAP_CONSISTENCY_CHECK ( 1ULL << 11 ) ++#define WSREP_CAP_UNORDERED ( 1ULL << 12 ) ++#define WSREP_CAP_ANNOTATION ( 1ULL << 13 ) ++#define WSREP_CAP_PREORDERED ( 1ULL << 14 ) ++ ++ ++/*! ++ * Writeset flags ++ * ++ * COMMIT the writeset and all preceding writesets must be committed ++ * ROLLBACK all preceding writesets in a transaction must be rolled back ++ * ISOLATION the writeset must be applied AND committed in isolation ++ * PA_UNSAFE the writeset cannot be applied in parallel ++ * COMMUTATIVE the order in which the writeset is applied does not matter ++ * NATIVE the writeset contains another writeset in this provider format ++ * ++ * Note that some of the flags are mutually exclusive (e.g. COMMIT and ++ * ROLLBACK). ++ */ ++#define WSREP_FLAG_COMMIT ( 1ULL << 0 ) ++#define WSREP_FLAG_ROLLBACK ( 1ULL << 1 ) ++#define WSREP_FLAG_ISOLATION ( 1ULL << 2 ) ++#define WSREP_FLAG_PA_UNSAFE ( 1ULL << 3 ) ++#define WSREP_FLAG_COMMUTATIVE ( 1ULL << 4 ) ++#define WSREP_FLAG_NATIVE ( 1ULL << 5 ) ++ ++ ++typedef uint64_t wsrep_trx_id_t; //!< application transaction ID ++typedef uint64_t wsrep_conn_id_t; //!< application connection ID ++typedef int64_t wsrep_seqno_t; //!< sequence number of a writeset, etc. ++#ifdef __cplusplus ++typedef bool wsrep_bool_t; ++#else ++typedef _Bool wsrep_bool_t; //!< should be the same as standard (C99) bool ++#endif /* __cplusplus */ ++ ++/*! undefined seqno */ ++#define WSREP_SEQNO_UNDEFINED (-1) ++ ++ ++/*! wsrep provider status codes */ ++typedef enum wsrep_status ++{ ++ WSREP_OK = 0, //!< success ++ WSREP_WARNING, //!< minor warning, error logged ++ WSREP_TRX_MISSING, //!< transaction is not known by wsrep ++ WSREP_TRX_FAIL, //!< transaction aborted, server can continue ++ WSREP_BF_ABORT, //!< trx was victim of brute force abort ++ WSREP_SIZE_EXCEEDED, //!< data exceeded maximum supported size ++ WSREP_CONN_FAIL, //!< error in client connection, must abort ++ WSREP_NODE_FAIL, //!< error in node state, wsrep must reinit ++ WSREP_FATAL, //!< fatal error, server must abort ++ WSREP_NOT_IMPLEMENTED //!< feature not implemented ++} wsrep_status_t; ++ ++ ++/*! wsrep callbacks status codes */ ++typedef enum wsrep_cb_status ++{ ++ WSREP_CB_SUCCESS = 0, //!< success (as in "not critical failure") ++ WSREP_CB_FAILURE //!< critical failure (consistency violation) ++ /* Technically, wsrep provider has no use for specific failure codes since ++ * there is nothing it can do about it but abort execution. Therefore any ++ * positive number shall indicate a critical failure. Optionally that value ++ * may be used by provider to come to a consensus about state consistency ++ * in a group of nodes. */ ++} wsrep_cb_status_t; ++ ++ ++/*! ++ * UUID type - for all unique IDs ++ */ ++typedef struct wsrep_uuid { ++ uint8_t data[16]; ++} wsrep_uuid_t; ++ ++/*! Undefined UUID */ ++static const wsrep_uuid_t WSREP_UUID_UNDEFINED = {{0,}}; ++ ++/*! UUID string representation length, terminating '\0' not included */ ++#define WSREP_UUID_STR_LEN 36 ++ ++/*! ++ * Scan UUID from string ++ * @return length of UUID string representation or negative error code ++ */ ++extern int ++wsrep_uuid_scan (const char* str, size_t str_len, wsrep_uuid_t* uuid); ++ ++/*! ++ * Print UUID to string ++ * @return length of UUID string representation or negative error code ++ */ ++extern int ++wsrep_uuid_print (const wsrep_uuid_t* uuid, char* str, size_t str_len); ++ ++#define WSREP_MEMBER_NAME_LEN 32 //!< maximum logical member name length ++#define WSREP_INCOMING_LEN 256 //!< max Domain Name length + 0x00 ++ ++ ++/*! ++ * Global transaction identifier ++ */ ++typedef struct wsrep_gtid ++{ ++ wsrep_uuid_t uuid; /*!< History UUID */ ++ wsrep_seqno_t seqno; /*!< Sequence number */ ++} wsrep_gtid_t; ++ ++/*! Undefined GTID */ ++static const wsrep_gtid_t WSREP_GTID_UNDEFINED = {{{0, }}, -1}; ++ ++/*! Minimum number of bytes guaranteed to store GTID string representation, ++ * terminating '\0' not included (36 + 1 + 20) */ ++#define WSREP_GTID_STR_LEN 57 ++ ++ ++/*! ++ * Scan GTID from string ++ * @return length of GTID string representation or negative error code ++ */ ++extern int ++wsrep_gtid_scan(const char* str, size_t str_len, wsrep_gtid_t* gtid); ++ ++/*! ++ * Print GTID to string ++ * @return length of GTID string representation or negative error code ++ */ ++extern int ++wsrep_gtid_print(const wsrep_gtid_t* gtid, char* str, size_t str_len); ++ ++ ++/*! ++ * Transaction meta data ++ */ ++typedef struct wsrep_trx_meta ++{ ++ wsrep_gtid_t gtid; /*!< Global transaction identifier */ ++ wsrep_seqno_t depends_on; /*!< Sequence number part of the last transaction ++ this transaction depends on */ ++} wsrep_trx_meta_t; ++ ++ ++/*! ++ * member status ++ */ ++typedef enum wsrep_member_status { ++ WSREP_MEMBER_UNDEFINED, //!< undefined state ++ WSREP_MEMBER_JOINER, //!< incomplete state, requested state transfer ++ WSREP_MEMBER_DONOR, //!< complete state, donates state transfer ++ WSREP_MEMBER_JOINED, //!< complete state ++ WSREP_MEMBER_SYNCED, //!< complete state, synchronized with group ++ WSREP_MEMBER_ERROR, //!< this and above is provider-specific error code ++ WSREP_MEMBER_MAX ++} wsrep_member_status_t; ++ ++/*! ++ * static information about a group member (some fields are tentative yet) ++ */ ++typedef struct wsrep_member_info { ++ wsrep_uuid_t id; //!< group-wide unique member ID ++ char name[WSREP_MEMBER_NAME_LEN]; //!< human-readable name ++ char incoming[WSREP_INCOMING_LEN]; //!< address for client requests ++} wsrep_member_info_t; ++ ++/*! ++ * group status ++ */ ++typedef enum wsrep_view_status { ++ WSREP_VIEW_PRIMARY, //!< primary group configuration (quorum present) ++ WSREP_VIEW_NON_PRIMARY, //!< non-primary group configuration (quorum lost) ++ WSREP_VIEW_DISCONNECTED, //!< not connected to group, retrying. ++ WSREP_VIEW_MAX ++} wsrep_view_status_t; ++ ++/*! ++ * view of the group ++ */ ++typedef struct wsrep_view_info { ++ wsrep_gtid_t state_id; //!< global state ID ++ wsrep_seqno_t view; //!< global view number ++ wsrep_view_status_t status; //!< view status ++ wsrep_bool_t state_gap; //!< gap between global and local states ++ int my_idx; //!< index of this member in the view ++ int memb_num; //!< number of members in the view ++ int proto_ver; //!< application protocol agreed on the view ++ wsrep_member_info_t members[1];//!< array of member information ++} wsrep_view_info_t; ++ ++/*! ++ * Magic string to tell provider to engage into trivial (empty) state transfer. ++ * No data will be passed, but the node shall be considered JOINED. ++ * Should be passed in sst_req parameter of wsrep_view_cb_t. ++ */ ++#define WSREP_STATE_TRANSFER_TRIVIAL "trivial" ++ ++/*! ++ * Magic string to tell provider not to engage in state transfer at all. ++ * The member will stay in WSREP_MEMBER_UNDEFINED state but will keep on ++ * receiving all writesets. ++ * Should be passed in sst_req parameter of wsrep_view_cb_t. ++ */ ++#define WSREP_STATE_TRANSFER_NONE "none" ++ ++/*! ++ * @brief group view handler ++ * ++ * This handler is called in total order corresponding to the group ++ * configuration change. It is to provide a vital information about ++ * new group view. If view info indicates existence of discontinuity ++ * between group and member states, state transfer request message ++ * should be filled in by the callback implementation. ++ * ++ * @note Currently it is assumed that sst_req is allocated using ++ * malloc()/calloc()/realloc() and it will be freed by ++ * wsrep implementation. ++ * ++ * @param app_ctx application context ++ * @param recv_ctx receiver context ++ * @param view new view on the group ++ * @param state current state ++ * @param state_len lenght of current state ++ * @param sst_req location to store SST request ++ * @param sst_req_len location to store SST request length or error code, ++ * value of 0 means no SST. ++ */ ++typedef enum wsrep_cb_status (*wsrep_view_cb_t) ( ++ void* app_ctx, ++ void* recv_ctx, ++ const wsrep_view_info_t* view, ++ const char* state, ++ size_t state_len, ++ void** sst_req, ++ size_t* sst_req_len ++); ++ ++ ++/*! ++ * @brief apply callback ++ * ++ * This handler is called from wsrep library to apply replicated writeset ++ * Must support brute force applying for multi-master operation ++ * ++ * @param recv_ctx receiver context pointer provided by the application ++ * @param data data buffer containing the writeset ++ * @param size data buffer size ++ * @param flags WSREP_FLAG_... flags ++ * @param meta transaction meta data of the writeset to be applied ++ * ++ * @return success code: ++ * @retval WSREP_OK ++ * @retval WSREP_NOT_IMPLEMENTED appl. does not support the writeset format ++ * @retval WSREP_ERROR failed to apply the writeset ++ */ ++typedef enum wsrep_cb_status (*wsrep_apply_cb_t) ( ++ void* recv_ctx, ++ const void* data, ++ size_t size, ++ uint32_t flags, ++ const wsrep_trx_meta_t* meta ++); ++ ++ ++/*! ++ * @brief commit callback ++ * ++ * This handler is called to commit the changes made by apply callback. ++ * ++ * @param recv_ctx receiver context pointer provided by the application ++ * @param flags WSREP_FLAG_... flags ++ * @param meta transaction meta data of the writeset to be committed ++ * @param exit set to true to exit recv loop ++ * @param commit true - commit writeset, false - rollback writeset ++ * ++ * @return success code: ++ * @retval WSREP_OK ++ * @retval WSREP_ERROR call failed ++ */ ++typedef enum wsrep_cb_status (*wsrep_commit_cb_t) ( ++ void* recv_ctx, ++ uint32_t flags, ++ const wsrep_trx_meta_t* meta, ++ wsrep_bool_t* exit, ++ wsrep_bool_t commit ++); ++ ++ ++/*! ++ * @brief unordered callback ++ * ++ * This handler is called to execute unordered actions (actions that need not ++ * to be executed in any particular order) attached to writeset. ++ * ++ * @param recv_ctx receiver context pointer provided by the application ++ * @param data data buffer containing the writeset ++ * @param size data buffer size ++ */ ++typedef enum wsrep_cb_status (*wsrep_unordered_cb_t) ( ++ void* recv_ctx, ++ const void* data, ++ size_t size ++); ++ ++ ++/*! ++ * @brief a callback to donate state snapshot ++ * ++ * This handler is called from wsrep library when it needs this node ++ * to deliver state to a new cluster member. ++ * No state changes will be committed for the duration of this call. ++ * Wsrep implementation may provide internal state to be transmitted ++ * to new cluster member for initial state. ++ * ++ * @param app_ctx application context ++ * @param recv_ctx receiver context ++ * @param msg state transfer request message ++ * @param msg_len state transfer request message length ++ * @param gtid current state ID on this node ++ * @param state current wsrep internal state buffer ++ * @param state_len current wsrep internal state buffer len ++ * @param bypass bypass snapshot transfer, only transfer uuid:seqno pair ++ */ ++typedef enum wsrep_cb_status (*wsrep_sst_donate_cb_t) ( ++ void* app_ctx, ++ void* recv_ctx, ++ const void* msg, ++ size_t msg_len, ++ const wsrep_gtid_t* state_id, ++ const char* state, ++ size_t state_len, ++ wsrep_bool_t bypass ++); ++ ++ ++/*! ++ * @brief a callback to signal application that wsrep state is synced ++ * with cluster ++ * ++ * This callback is called after wsrep library has got in sync with ++ * rest of the cluster. ++ * ++ * @param app_ctx application context ++ */ ++typedef void (*wsrep_synced_cb_t) (void* app_ctx); ++ ++ ++/*! ++ * Initialization parameters for wsrep provider. ++ */ ++struct wsrep_init_args ++{ ++ void* app_ctx; //!< Application context for callbacks ++ ++ /* Configuration parameters */ ++ const char* node_name; //!< Symbolic name of this node (e.g. hostname) ++ const char* node_address; //!< Address to be used by wsrep provider ++ const char* node_incoming; //!< Address for incoming client connections ++ const char* data_dir; //!< Directory where wsrep files are kept if any ++ const char* options; //!< Provider-specific configuration string ++ int proto_ver; //!< Max supported application protocol version ++ ++ /* Application initial state information. */ ++ const wsrep_gtid_t* state_id; //!< Application state GTID ++ const char* state; //!< Initial state for wsrep provider ++ size_t state_len; //!< Length of state buffer ++ ++ /* Application callbacks */ ++ wsrep_log_cb_t logger_cb; //!< logging handler ++ wsrep_view_cb_t view_handler_cb; //!< group view change handler ++ ++ /* Applier callbacks */ ++ wsrep_apply_cb_t apply_cb; //!< apply callback ++ wsrep_commit_cb_t commit_cb; //!< commit callback ++ wsrep_unordered_cb_t unordered_cb; //!< callback for unordered actions ++ ++ /* State Snapshot Transfer callbacks */ ++ wsrep_sst_donate_cb_t sst_donate_cb; //!< starting to donate ++ wsrep_synced_cb_t synced_cb; //!< synced with group ++}; ++ ++ ++/*! Type of the stats variable value in struct wsrep_status_var */ ++typedef enum wsrep_var_type ++{ ++ WSREP_VAR_STRING, //!< pointer to null-terminated string ++ WSREP_VAR_INT64, //!< int64_t ++ WSREP_VAR_DOUBLE //!< double ++} ++wsrep_var_type_t; ++ ++/*! Generalized stats variable representation */ ++struct wsrep_stats_var ++{ ++ const char* name; //!< variable name ++ wsrep_var_type_t type; //!< variable value type ++ union { ++ int64_t _int64; ++ double _double; ++ const char* _string; ++ } value; //!< variable value ++}; ++ ++ ++/*! Abstract data buffer structure */ ++typedef struct wsrep_buf ++{ ++ const void* ptr; /*!< Pointer to data buffer */ ++ size_t len; /*!< Length of buffer */ ++} wsrep_buf_t; ++ ++/*! Key struct used to pass certification keys for transaction handling calls. ++ * A key consists of zero or more key parts. */ ++typedef struct wsrep_key ++{ ++ const wsrep_buf_t* key_parts; /*!< Array of key parts */ ++ size_t key_parts_num; /*!< Number of key parts */ ++} wsrep_key_t; ++ ++/*! Key type: ++ * EXCLUSIVE conflicts with any key type ++ * SEMI reserved. If not supported, should be interpeted as EXCLUSIVE ++ * SHARED conflicts only with EXCLUSIVE keys */ ++typedef enum wsrep_key_type ++{ ++ WSREP_KEY_SHARED = 0, ++ WSREP_KEY_SEMI, ++ WSREP_KEY_EXCLUSIVE ++} wsrep_key_type_t; ++ ++/*! Data type: ++ * ORDERED state modification event that should be applied and committed ++ * in order. ++ * UNORDERED some action that does not modify state and execution of which is ++ * optional and does not need to happen in order. ++ * ANNOTATION (human readable) writeset annotation. */ ++typedef enum wsrep_data_type ++{ ++ WSREP_DATA_ORDERED = 0, ++ WSREP_DATA_UNORDERED, ++ WSREP_DATA_ANNOTATION ++} wsrep_data_type_t; ++ ++ ++/*! Transaction handle struct passed for wsrep transaction handling calls */ ++typedef struct wsrep_ws_handle ++{ ++ wsrep_trx_id_t trx_id; //!< transaction ID ++ void* opaque; //!< opaque provider transaction context data ++} wsrep_ws_handle_t; ++ ++/*! ++ * @brief Helper method to reset trx writeset handle state when trx id changes ++ * ++ * Instead of passing wsrep_ws_handle_t directly to wsrep calls, ++ * wrapping handle with this call offloads bookkeeping from ++ * application. ++ */ ++static inline wsrep_ws_handle_t* wsrep_ws_handle_for_trx( ++ wsrep_ws_handle_t* ws_handle, ++ wsrep_trx_id_t trx_id) ++{ ++ if (ws_handle->trx_id != trx_id) ++ { ++ ws_handle->trx_id = trx_id; ++ ws_handle->opaque = NULL; ++ } ++ return ws_handle; ++} ++ ++ ++/*! ++ * A handle for processing preordered actions. ++ * Must be initialized to WSREP_PO_INITIALIZER before use. ++ */ ++typedef struct wsrep_po_handle { void* opaque; } wsrep_po_handle_t; ++ ++static const wsrep_po_handle_t WSREP_PO_INITIALIZER = { NULL }; ++ ++ ++typedef struct wsrep wsrep_t; ++/*! ++ * wsrep interface for dynamically loadable libraries ++ */ ++struct wsrep { ++ ++ const char *version; //!< interface version string ++ ++ /*! ++ * @brief Initializes wsrep provider ++ * ++ * @param wsrep provider handle ++ * @param args wsrep initialization parameters ++ */ ++ wsrep_status_t (*init) (wsrep_t* wsrep, ++ const struct wsrep_init_args* args); ++ ++ /*! ++ * @brief Returns provider capabilities flag bitmap ++ * ++ * @param wsrep provider handle ++ */ ++ uint64_t (*capabilities) (wsrep_t* wsrep); ++ ++ /*! ++ * @brief Passes provider-specific configuration string to provider. ++ * ++ * @param wsrep provider handle ++ * @param conf configuration string ++ * ++ * @retval WSREP_OK configuration string was parsed successfully ++ * @retval WSREP_WARNING could't not parse conf string, no action taken ++ */ ++ wsrep_status_t (*options_set) (wsrep_t* wsrep, const char* conf); ++ ++ /*! ++ * @brief Returns provider-specific string with current configuration values. ++ * ++ * @param wsrep provider handle ++ * ++ * @return a dynamically allocated string with current configuration ++ * parameter values ++ */ ++ char* (*options_get) (wsrep_t* wsrep); ++ ++ /*! ++ * @brief Opens connection to cluster ++ * ++ * Returns when either node is ready to operate as a part of the clsuter ++ * or fails to reach operating status. ++ * ++ * @param wsrep provider handle ++ * @param cluster_name unique symbolic cluster name ++ * @param cluster_url URL-like cluster address (backend://address) ++ * @param state_donor name of the node to be asked for state transfer. ++ * @param bootstrap a flag to request initialization of a new wsrep ++ * service rather then a connection to the existing one. ++ * clister_url may still carry important initialization ++ * parameters, like backend spec and/or listen address. ++ */ ++ wsrep_status_t (*connect) (wsrep_t* wsrep, ++ const char* cluster_name, ++ const char* cluster_url, ++ const char* state_donor, ++ wsrep_bool_t bootstrap); ++ ++ /*! ++ * @brief Closes connection to cluster. ++ * ++ * If state_uuid and/or state_seqno is not NULL, will store final state ++ * in there. ++ * ++ * @param wsrep this wsrep handler ++ */ ++ wsrep_status_t (*disconnect)(wsrep_t* wsrep); ++ ++ /*! ++ * @brief start receiving replication events ++ * ++ * This function never returns ++ * ++ * @param wsrep provider handle ++ * @param recv_ctx receiver context ++ */ ++ wsrep_status_t (*recv)(wsrep_t* wsrep, void* recv_ctx); ++ ++ /*! ++ * @brief Replicates/logs result of transaction to other nodes and allocates ++ * required resources. ++ * ++ * Must be called before transaction commit. Returns success code, which ++ * caller must check. ++ * In case of WSREP_OK, starts commit critical section, transaction can ++ * commit. Otherwise transaction must rollback. ++ * ++ * @param wsrep provider handle ++ * @param ws_handle writeset of committing transaction ++ * @param conn_id connection ID ++ * @param flags fine tuning the replication WSREP_FLAG_* ++ * @param meta transaction meta data ++ * ++ * @retval WSREP_OK cluster-wide commit succeeded ++ * @retval WSREP_TRX_FAIL must rollback transaction ++ * @retval WSREP_CONN_FAIL must close client connection ++ * @retval WSREP_NODE_FAIL must close all connections and reinit ++ */ ++ wsrep_status_t (*pre_commit)(wsrep_t* wsrep, ++ wsrep_conn_id_t conn_id, ++ wsrep_ws_handle_t* ws_handle, ++ uint32_t flags, ++ wsrep_trx_meta_t* meta); ++ ++ /*! ++ * @brief Releases resources after transaction commit. ++ * ++ * Ends commit critical section. ++ * ++ * @param wsrep provider handle ++ * @param ws_handle writeset of committing transaction ++ * @retval WSREP_OK post_commit succeeded ++ */ ++ wsrep_status_t (*post_commit) (wsrep_t* wsrep, ++ wsrep_ws_handle_t* ws_handle); ++ ++ /*! ++ * @brief Releases resources after transaction rollback. ++ * ++ * @param wsrep provider handle ++ * @param ws_handle writeset of committing transaction ++ * @retval WSREP_OK post_rollback succeeded ++ */ ++ wsrep_status_t (*post_rollback)(wsrep_t* wsrep, ++ wsrep_ws_handle_t* ws_handle); ++ ++ /*! ++ * @brief Replay trx as a slave writeset ++ * ++ * If local trx has been aborted by brute force, and it has already ++ * replicated before this abort, we must try if we can apply it as ++ * slave trx. Note that slave nodes see only trx writesets and certification ++ * test based on write set content can be different to DBMS lock conflicts. ++ * ++ * @param wsrep provider handle ++ * @param ws_handle writeset of committing transaction ++ * @param trx_ctx transaction context ++ * ++ * @retval WSREP_OK cluster commit succeeded ++ * @retval WSREP_TRX_FAIL must rollback transaction ++ * @retval WSREP_BF_ABORT brute force abort happened after trx replicated ++ * must rollback transaction and try to replay ++ * @retval WSREP_CONN_FAIL must close client connection ++ * @retval WSREP_NODE_FAIL must close all connections and reinit ++ */ ++ wsrep_status_t (*replay_trx)(wsrep_t* wsrep, ++ wsrep_ws_handle_t* ws_handle, ++ void* trx_ctx); ++ ++ /*! ++ * @brief Abort pre_commit() call of another thread. ++ * ++ * It is possible, that some high-priority transaction needs to abort ++ * another transaction which is in pre_commit() call waiting for resources. ++ * ++ * The kill routine checks that abort is not attmpted against a transaction ++ * which is front of the caller (in total order). ++ * ++ * @param wsrep provider handle ++ * @param bf_seqno seqno of brute force trx, running this cancel ++ * @param victim_trx transaction to be aborted, and which is committing ++ * ++ * @retval WSREP_OK abort secceded ++ * @retval WSREP_WARNING abort failed ++ */ ++ wsrep_status_t (*abort_pre_commit)(wsrep_t* wsrep, ++ wsrep_seqno_t bf_seqno, ++ wsrep_trx_id_t victim_trx); ++ ++ /*! ++ * @brief Appends a row reference to transaction writeset ++ * ++ * Both copy flag and key_type can be ignored by provider (key type ++ * interpreted as WSREP_KEY_EXCLUSIVE). ++ * ++ * @param wsrep provider handle ++ * @param ws_handle writeset handle ++ * @param keys array of keys ++ * @param count length of the array of keys ++ * @param type type ot the key ++ * @param copy can be set to FALSE if keys persist through commit. ++ */ ++ wsrep_status_t (*append_key)(wsrep_t* wsrep, ++ wsrep_ws_handle_t* ws_handle, ++ const wsrep_key_t* keys, ++ size_t count, ++ enum wsrep_key_type type, ++ wsrep_bool_t copy); ++ ++ /*! ++ * @brief Appends data to transaction writeset ++ * ++ * This method can be called any time before commit and it ++ * appends a number of data buffers to transaction writeset. ++ * ++ * Both copy and unordered flags can be ignored by provider. ++ * ++ * @param wsrep provider handle ++ * @param ws_handle writeset handle ++ * @param data array of data buffers ++ * @param count buffer count ++ * @param type type of data ++ * @param copy can be set to FALSE if data persists through commit. ++ */ ++ wsrep_status_t (*append_data)(wsrep_t* wsrep, ++ wsrep_ws_handle_t* ws_handle, ++ const struct wsrep_buf* data, ++ size_t count, ++ enum wsrep_data_type type, ++ wsrep_bool_t copy); ++ ++ /*! ++ * @brief Get causal ordering for read operation ++ * ++ * This call will block until causal ordering with all possible ++ * preceding writes in the cluster is guaranteed. If pointer to ++ * gtid is non-null, the call stores the global transaction ID ++ * of the last transaction which is guaranteed to be ordered ++ * causally before this call. ++ * ++ * @param wsrep provider handle ++ * @param gtid location to store GTID ++ */ ++ wsrep_status_t (*causal_read)(wsrep_t* wsrep, wsrep_gtid_t* gtid); ++ ++ /*! ++ * @brief Clears allocated connection context. ++ * ++ * Whenever a new connection ID is passed to wsrep provider through ++ * any of the API calls, a connection context is allocated for this ++ * connection. This call is to explicitly notify provider fo connection ++ * closing. ++ * ++ * @param wsrep provider handle ++ * @param conn_id connection ID ++ * @param query the 'set database' query ++ * @param query_len length of query (does not end with 0) ++ */ ++ wsrep_status_t (*free_connection)(wsrep_t* wsrep, ++ wsrep_conn_id_t conn_id); ++ ++ /*! ++ * @brief Replicates a query and starts "total order isolation" section. ++ * ++ * Replicates the action spec and returns success code, which caller must ++ * check. Total order isolation continues until to_execute_end() is called. ++ * ++ * @param wsrep provider handle ++ * @param conn_id connection ID ++ * @param keys array of keys ++ * @param keys_num lenght of the array of keys ++ * @param action action buffer array to be executed ++ * @param count action buffer count ++ * @param meta transaction meta data ++ * ++ * @retval WSREP_OK cluster commit succeeded ++ * @retval WSREP_CONN_FAIL must close client connection ++ * @retval WSREP_NODE_FAIL must close all connections and reinit ++ */ ++ wsrep_status_t (*to_execute_start)(wsrep_t* wsrep, ++ wsrep_conn_id_t conn_id, ++ const wsrep_key_t* keys, ++ size_t keys_num, ++ const struct wsrep_buf* action, ++ size_t count, ++ wsrep_trx_meta_t* meta); ++ ++ /*! ++ * @brief Ends the total order isolation section. ++ * ++ * Marks the end of total order isolation. TO locks are freed ++ * and other transactions are free to commit from this point on. ++ * ++ * @param wsrep provider handle ++ * @param conn_id connection ID ++ * ++ * @retval WSREP_OK cluster commit succeeded ++ * @retval WSREP_CONN_FAIL must close client connection ++ * @retval WSREP_NODE_FAIL must close all connections and reinit ++ */ ++ wsrep_status_t (*to_execute_end)(wsrep_t* wsrep, wsrep_conn_id_t conn_id); ++ ++ /*! ++ * @brief Collects preordered replication events into a writeset. ++ * ++ * @param wsrep wsrep provider handle ++ * @param handle a handle associated with a given writeset ++ * @param data an array of data buffers. ++ * @param count length of data buffer array. ++ * @param copy whether provider needs to make a copy of events. ++ * ++ * @retval WSREP_OK cluster-wide commit succeeded ++ * @retval WSREP_TRX_FAIL operation failed (e.g. trx size exceeded limit) ++ * @retval WSREP_NODE_FAIL must close all connections and reinit ++ */ ++ wsrep_status_t (*preordered_collect) (wsrep_t* wsrep, ++ wsrep_po_handle_t* handle, ++ const struct wsrep_buf* data, ++ size_t count, ++ wsrep_bool_t copy); ++ ++ /*! ++ * @brief "Commits" preordered writeset to cluster. ++ * ++ * The contract is that the writeset will be committed in the same (partial) ++ * order this method was called. Frees resources associated with the writeset ++ * handle and reinitializes the handle. ++ * ++ * @param wsrep wsrep provider handle ++ * @param po_handle a handle associated with a given writeset ++ * @param source_id ID of the event producer, also serves as the partial order ++ * or stream ID - events with different source_ids won't be ++ * ordered with respect to each other. ++ * @param flags WSREP_FLAG_... flags ++ * @param pa_range the number of preceding events this event can be processed ++ * in parallel with. A value of 0 means strict serial ++ * processing. Note: commits always happen in wsrep order. ++ * @param commit 'true' to commit writeset to cluster (replicate) or ++ * 'false' to rollback (cancel) the writeset. ++ * ++ * @retval WSREP_OK cluster-wide commit succeeded ++ * @retval WSREP_TRX_FAIL operation failed (e.g. NON-PRIMARY component) ++ * @retval WSREP_NODE_FAIL must close all connections and reinit ++ */ ++ wsrep_status_t (*preordered_commit) (wsrep_t* wsrep, ++ wsrep_po_handle_t* handle, ++ const wsrep_uuid_t* source_id, ++ uint32_t flags, ++ int pa_range, ++ wsrep_bool_t commit); ++ ++ /*! ++ * @brief Signals to wsrep provider that state snapshot has been sent to ++ * joiner. ++ * ++ * @param wsrep provider handle ++ * @param state_id state ID ++ * @param rcode 0 or negative error code of the operation. ++ */ ++ wsrep_status_t (*sst_sent)(wsrep_t* wsrep, ++ const wsrep_gtid_t* state_id, ++ int rcode); ++ ++ /*! ++ * @brief Signals to wsrep provider that new state snapshot has been received. ++ * May deadlock if called from sst_prepare_cb. ++ * ++ * @param wsrep provider handle ++ * @param state_id state ID ++ * @param state initial state provided by SST donor ++ * @param state_len length of state buffer ++ * @param rcode 0 or negative error code of the operation. ++ */ ++ wsrep_status_t (*sst_received)(wsrep_t* wsrep, ++ const wsrep_gtid_t* state_id, ++ const void* state, ++ size_t state_len, ++ int rcode); ++ ++ ++ /*! ++ * @brief Generate request for consistent snapshot. ++ * ++ * If successfull, this call will generate internally SST request ++ * which in turn triggers calling SST donate callback on the nodes ++ * specified in donor_spec. If donor_spec is null, callback is ++ * called only locally. This call will block until sst_sent is called ++ * from callback. ++ * ++ * @param wsrep provider handle ++ * @param msg context message for SST donate callback ++ * @param msg_len length of context message ++ * @param donor_spec list of snapshot donors ++ */ ++ wsrep_status_t (*snapshot)(wsrep_t* wsrep, ++ const void* msg, ++ size_t msg_len, ++ const char* donor_spec); ++ ++ /*! ++ * @brief Returns an array fo status variables. ++ * Array is terminated by Null variable name. ++ * ++ * @param wsrep provider handle ++ * @return array of struct wsrep_status_var. ++ */ ++ struct wsrep_stats_var* (*stats_get) (wsrep_t* wsrep); ++ ++ /*! ++ * @brief Release resources that might be associated with the array. ++ * ++ * @param wsrep provider handle. ++ * @param var_array array returned by stats_get(). ++ */ ++ void (*stats_free) (wsrep_t* wsrep, struct wsrep_stats_var* var_array); ++ ++ /*! ++ * @brief Reset some stats variables to inital value, provider-dependent. ++ * ++ * @param wsrep provider handle. ++ */ ++ void (*stats_reset) (wsrep_t* wsrep); ++ ++ /*! ++ * @brief Pauses writeset applying/committing. ++ * ++ * @return global sequence number of the paused state or negative error code. ++ */ ++ wsrep_seqno_t (*pause) (wsrep_t* wsrep); ++ ++ /*! ++ * @brief Resumes writeset applying/committing. ++ */ ++ wsrep_status_t (*resume) (wsrep_t* wsrep); ++ ++ /*! ++ * @brief Desynchronize from cluster ++ * ++ * Effectively turns off flow control for this node, allowing it ++ * to fall behind the cluster. ++ */ ++ wsrep_status_t (*desync) (wsrep_t* wsrep); ++ ++ /*! ++ * @brief Request to resynchronize with cluster. ++ * ++ * Effectively turns on flow control. Asynchronous - actual synchronization ++ * event to be deliverred via sync_cb. ++ */ ++ wsrep_status_t (*resync) (wsrep_t* wsrep); ++ ++ /*! ++ * @brief Acquire global named lock ++ * ++ * @param wsrep wsrep provider handle ++ * @param name lock name ++ * @param shared shared or exclusive lock ++ * @param owner 64-bit owner ID ++ * @param tout timeout in nanoseconds. ++ * 0 - return immediately, -1 wait forever. ++ * @return wsrep status or negative error code ++ * @retval -EDEADLK lock was already acquired by this thread ++ * @retval -EBUSY lock was busy ++ */ ++ wsrep_status_t (*lock) (wsrep_t* wsrep, ++ const char* name, wsrep_bool_t shared, ++ uint64_t owner, int64_t tout); ++ ++ /*! ++ * @brief Release global named lock ++ * ++ * @param wsrep wsrep provider handle ++ * @param name lock name ++ * @param owner 64-bit owner ID ++ * @return wsrep status or negative error code ++ * @retval -EPERM lock does not belong to this owner ++ */ ++ wsrep_status_t (*unlock) (wsrep_t* wsrep, const char* name, uint64_t owner); ++ ++ /*! ++ * @brief Check if global named lock is locked ++ * ++ * @param wsrep wsrep provider handle ++ * @param name lock name ++ * @param owner if not NULL will contain 64-bit owner ID ++ * @param node if not NULL will contain owner's node UUID ++ * @return true if lock is locked ++ */ ++ wsrep_bool_t (*is_locked) (wsrep_t* wsrep, const char* name, uint64_t* conn, ++ wsrep_uuid_t* node); ++ ++ /*! ++ * wsrep provider name ++ */ ++ const char* provider_name; ++ ++ /*! ++ * wsrep provider version ++ */ ++ const char* provider_version; ++ ++ /*! ++ * wsrep provider vendor name ++ */ ++ const char* provider_vendor; ++ ++ /*! ++ * @brief Frees allocated resources before unloading the library. ++ * @param wsrep provider handle ++ */ ++ void (*free)(wsrep_t* wsrep); ++ ++ void *dlh; //!< reserved for future use ++ void *ctx; //!< reserved for implemetation private context ++}; ++ ++ ++/*! ++ * ++ * @brief Loads wsrep library ++ * ++ * @param spec path to wsrep library. If NULL or WSREP_NONE initialises dummy ++ * pass-through implementation. ++ * @param hptr wsrep handle ++ * @param log_cb callback to handle loader messages. Otherwise writes to stderr. ++ * ++ * @return zero on success, errno on failure ++ */ ++int wsrep_load(const char* spec, wsrep_t** hptr, wsrep_log_cb_t log_cb); ++ ++/*! ++ * @brief Unloads wsrep library and frees associated resources ++ * ++ * @param hptr wsrep handler pointer ++ */ ++void wsrep_unload(wsrep_t* hptr); ++ ++#ifdef __cplusplus ++} ++#endif ++ ++#endif /* WSREP_H */ +diff --git a/wsrep/wsrep_dummy.c b/wsrep/wsrep_dummy.c +new file mode 100644 +index 0000000..bab5329 +--- /dev/null ++++ b/wsrep/wsrep_dummy.c +@@ -0,0 +1,407 @@ ++/* Copyright (C) 2009-2010 Codership Oy ++ ++ 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ */ ++ ++/*! @file Dummy wsrep API implementation. */ ++ ++#include "wsrep_api.h" ++ ++#include ++#include ++#include ++ ++/*! Dummy backend context. */ ++typedef struct wsrep_dummy ++{ ++ wsrep_log_cb_t log_fn; ++ char* options; ++} wsrep_dummy_t; ++ ++/* Get pointer to wsrep_dummy context from wsrep_t pointer */ ++#define WSREP_DUMMY(_p) ((wsrep_dummy_t *) (_p)->ctx) ++ ++/* Trace function usage a-la DBUG */ ++#define WSREP_DBUG_ENTER(_w) do { \ ++ if (WSREP_DUMMY(_w)) { \ ++ if (WSREP_DUMMY(_w)->log_fn) \ ++ WSREP_DUMMY(_w)->log_fn(WSREP_LOG_DEBUG, __FUNCTION__); \ ++ } \ ++ } while (0) ++ ++ ++static void dummy_free(wsrep_t *w) ++{ ++ WSREP_DBUG_ENTER(w); ++ if (WSREP_DUMMY(w)->options) { ++ free(WSREP_DUMMY(w)->options); ++ WSREP_DUMMY(w)->options = NULL; ++ } ++ free(w->ctx); ++ w->ctx = NULL; ++} ++ ++static wsrep_status_t dummy_init (wsrep_t* w, ++ const struct wsrep_init_args* args) ++{ ++ WSREP_DUMMY(w)->log_fn = args->logger_cb; ++ WSREP_DBUG_ENTER(w); ++ if (args->options) { ++ WSREP_DUMMY(w)->options = strdup(args->options); ++ } ++ return WSREP_OK; ++} ++ ++static uint64_t dummy_capabilities (wsrep_t* w __attribute__((unused))) ++{ ++ return 0; ++} ++ ++static wsrep_status_t dummy_options_set( ++ wsrep_t* w, ++ const char* conf) ++{ ++ WSREP_DBUG_ENTER(w); ++ if (WSREP_DUMMY(w)->options) { ++ free(WSREP_DUMMY(w)->options); ++ WSREP_DUMMY(w)->options = NULL; ++ } ++ if (conf) { ++ WSREP_DUMMY(w)->options = strdup(conf); ++ } ++ return WSREP_OK; ++} ++ ++static char* dummy_options_get (wsrep_t* w) ++{ ++ WSREP_DBUG_ENTER(w); ++ return WSREP_DUMMY(w)->options; ++} ++ ++static wsrep_status_t dummy_connect( ++ wsrep_t* w, ++ const char* name __attribute__((unused)), ++ const char* url __attribute__((unused)), ++ const char* donor __attribute__((unused)), ++ wsrep_bool_t bootstrap __attribute__((unused))) ++{ ++ WSREP_DBUG_ENTER(w); ++ return WSREP_OK; ++} ++ ++static wsrep_status_t dummy_disconnect(wsrep_t* w) ++{ ++ WSREP_DBUG_ENTER(w); ++ return WSREP_OK; ++} ++ ++static wsrep_status_t dummy_recv(wsrep_t* w, ++ void* recv_ctx __attribute__((unused))) ++{ ++ WSREP_DBUG_ENTER(w); ++ return WSREP_OK; ++} ++ ++static wsrep_status_t dummy_pre_commit( ++ wsrep_t* w, ++ const wsrep_conn_id_t conn_id __attribute__((unused)), ++ wsrep_ws_handle_t* ws_handle __attribute__((unused)), ++ uint32_t flags __attribute__((unused)), ++ wsrep_trx_meta_t* meta __attribute__((unused))) ++{ ++ WSREP_DBUG_ENTER(w); ++ return WSREP_OK; ++} ++ ++static wsrep_status_t dummy_post_commit( ++ wsrep_t* w, ++ wsrep_ws_handle_t* ws_handle __attribute__((unused))) ++{ ++ WSREP_DBUG_ENTER(w); ++ return WSREP_OK; ++} ++ ++static wsrep_status_t dummy_post_rollback( ++ wsrep_t* w, ++ wsrep_ws_handle_t* ws_handle __attribute__((unused))) ++{ ++ WSREP_DBUG_ENTER(w); ++ return WSREP_OK; ++} ++ ++static wsrep_status_t dummy_replay_trx( ++ wsrep_t* w, ++ wsrep_ws_handle_t* ws_handle __attribute__((unused)), ++ void* trx_ctx __attribute__((unused))) ++{ ++ WSREP_DBUG_ENTER(w); ++ return WSREP_OK; ++} ++ ++static wsrep_status_t dummy_abort_pre_commit( ++ wsrep_t* w, ++ const wsrep_seqno_t bf_seqno __attribute__((unused)), ++ const wsrep_trx_id_t trx_id __attribute__((unused))) ++{ ++ WSREP_DBUG_ENTER(w); ++ return WSREP_OK; ++} ++ ++static wsrep_status_t dummy_append_key( ++ wsrep_t* w, ++ wsrep_ws_handle_t* ws_handle __attribute__((unused)), ++ const wsrep_key_t* key __attribute__((unused)), ++ const size_t key_num __attribute__((unused)), ++ const wsrep_key_type_t key_type __attribute__((unused)), ++ const bool copy __attribute__((unused))) ++{ ++ WSREP_DBUG_ENTER(w); ++ return WSREP_OK; ++} ++ ++static wsrep_status_t dummy_append_data( ++ wsrep_t* w, ++ wsrep_ws_handle_t* ws_handle __attribute__((unused)), ++ const struct wsrep_buf* data __attribute__((unused)), ++ const size_t count __attribute__((unused)), ++ const wsrep_data_type_t type __attribute__((unused)), ++ const bool copy __attribute__((unused))) ++{ ++ WSREP_DBUG_ENTER(w); ++ return WSREP_OK; ++} ++ ++static wsrep_status_t dummy_causal_read( ++ wsrep_t* w, ++ wsrep_gtid_t* gtid __attribute__((unused))) ++{ ++ WSREP_DBUG_ENTER(w); ++ return WSREP_OK; ++} ++ ++static wsrep_status_t dummy_free_connection( ++ wsrep_t* w, ++ const wsrep_conn_id_t conn_id __attribute__((unused))) ++{ ++ WSREP_DBUG_ENTER(w); ++ return WSREP_OK; ++} ++ ++static wsrep_status_t dummy_to_execute_start( ++ wsrep_t* w, ++ const wsrep_conn_id_t conn_id __attribute__((unused)), ++ const wsrep_key_t* key __attribute__((unused)), ++ const size_t key_num __attribute__((unused)), ++ const struct wsrep_buf* data __attribute__((unused)), ++ const size_t count __attribute__((unused)), ++ wsrep_trx_meta_t* meta __attribute__((unused))) ++{ ++ WSREP_DBUG_ENTER(w); ++ return WSREP_OK; ++} ++ ++static wsrep_status_t dummy_to_execute_end( ++ wsrep_t* w, ++ const wsrep_conn_id_t conn_id __attribute__((unused))) ++{ ++ WSREP_DBUG_ENTER(w); ++ return WSREP_OK; ++} ++ ++static wsrep_status_t dummy_preordered_collect( ++ wsrep_t* w, ++ wsrep_po_handle_t* handle __attribute__((unused)), ++ const struct wsrep_buf* data __attribute__((unused)), ++ size_t count __attribute__((unused)), ++ wsrep_bool_t copy __attribute__((unused))) ++{ ++ WSREP_DBUG_ENTER(w); ++ return WSREP_OK; ++} ++ ++static wsrep_status_t dummy_preordered_commit( ++ wsrep_t* w, ++ wsrep_po_handle_t* handle __attribute__((unused)), ++ const wsrep_uuid_t* source_id __attribute__((unused)), ++ uint32_t flags __attribute__((unused)), ++ int pa_range __attribute__((unused)), ++ wsrep_bool_t commit __attribute__((unused))) ++{ ++ WSREP_DBUG_ENTER(w); ++ return WSREP_OK; ++} ++ ++static wsrep_status_t dummy_sst_sent( ++ wsrep_t* w, ++ const wsrep_gtid_t* state_id __attribute__((unused)), ++ const int rcode __attribute__((unused))) ++{ ++ WSREP_DBUG_ENTER(w); ++ return WSREP_OK; ++} ++ ++static wsrep_status_t dummy_sst_received( ++ wsrep_t* w, ++ const wsrep_gtid_t* state_id __attribute__((unused)), ++ const void* state __attribute__((unused)), ++ const size_t state_len __attribute__((unused)), ++ const int rcode __attribute__((unused))) ++{ ++ WSREP_DBUG_ENTER(w); ++ return WSREP_OK; ++} ++ ++static wsrep_status_t dummy_snapshot( ++ wsrep_t* w, ++ const void* msg __attribute__((unused)), ++ const size_t msg_len __attribute__((unused)), ++ const char* donor_spec __attribute__((unused))) ++{ ++ WSREP_DBUG_ENTER(w); ++ return WSREP_OK; ++} ++ ++static struct wsrep_stats_var dummy_stats[] = { ++ { NULL, WSREP_VAR_STRING, { 0 } } ++}; ++ ++static struct wsrep_stats_var* dummy_stats_get (wsrep_t* w) ++{ ++ WSREP_DBUG_ENTER(w); ++ return dummy_stats; ++} ++ ++static void dummy_stats_free ( ++ wsrep_t* w, ++ struct wsrep_stats_var* stats __attribute__((unused))) ++{ ++ WSREP_DBUG_ENTER(w); ++} ++ ++static void dummy_stats_reset (wsrep_t* w) ++{ ++ WSREP_DBUG_ENTER(w); ++} ++ ++static wsrep_seqno_t dummy_pause (wsrep_t* w) ++{ ++ WSREP_DBUG_ENTER(w); ++ return -ENOSYS; ++} ++ ++static wsrep_status_t dummy_resume (wsrep_t* w) ++{ ++ WSREP_DBUG_ENTER(w); ++ return WSREP_OK; ++} ++ ++static wsrep_status_t dummy_desync (wsrep_t* w) ++{ ++ WSREP_DBUG_ENTER(w); ++ return WSREP_NOT_IMPLEMENTED; ++} ++ ++static wsrep_status_t dummy_resync (wsrep_t* w) ++{ ++ WSREP_DBUG_ENTER(w); ++ return WSREP_OK; ++} ++ ++static wsrep_status_t dummy_lock (wsrep_t* w, ++ const char* s __attribute__((unused)), ++ bool r __attribute__((unused)), ++ uint64_t o __attribute__((unused)), ++ int64_t t __attribute__((unused))) ++{ ++ WSREP_DBUG_ENTER(w); ++ return WSREP_NOT_IMPLEMENTED; ++} ++ ++static wsrep_status_t dummy_unlock (wsrep_t* w, ++ const char* s __attribute__((unused)), ++ uint64_t o __attribute__((unused))) ++{ ++ WSREP_DBUG_ENTER(w); ++ return WSREP_OK; ++} ++ ++static bool dummy_is_locked (wsrep_t* w, ++ const char* s __attribute__((unused)), ++ uint64_t* o __attribute__((unused)), ++ wsrep_uuid_t* t __attribute__((unused))) ++{ ++ WSREP_DBUG_ENTER(w); ++ return false; ++} ++ ++static wsrep_t dummy_iface = { ++ WSREP_INTERFACE_VERSION, ++ &dummy_init, ++ &dummy_capabilities, ++ &dummy_options_set, ++ &dummy_options_get, ++ &dummy_connect, ++ &dummy_disconnect, ++ &dummy_recv, ++ &dummy_pre_commit, ++ &dummy_post_commit, ++ &dummy_post_rollback, ++ &dummy_replay_trx, ++ &dummy_abort_pre_commit, ++ &dummy_append_key, ++ &dummy_append_data, ++ &dummy_causal_read, ++ &dummy_free_connection, ++ &dummy_to_execute_start, ++ &dummy_to_execute_end, ++ &dummy_preordered_collect, ++ &dummy_preordered_commit, ++ &dummy_sst_sent, ++ &dummy_sst_received, ++ &dummy_snapshot, ++ &dummy_stats_get, ++ &dummy_stats_free, ++ &dummy_stats_reset, ++ &dummy_pause, ++ &dummy_resume, ++ &dummy_desync, ++ &dummy_resync, ++ &dummy_lock, ++ &dummy_unlock, ++ &dummy_is_locked, ++ WSREP_NONE, ++ WSREP_INTERFACE_VERSION, ++ "Codership Oy ", ++ &dummy_free, ++ NULL, ++ NULL ++}; ++ ++int wsrep_dummy_loader(wsrep_t* w) ++{ ++ if (!w) ++ return EINVAL; ++ ++ *w = dummy_iface; ++ ++ // allocate private context ++ if (!(w->ctx = malloc(sizeof(wsrep_dummy_t)))) ++ return ENOMEM; ++ ++ // initialize private context ++ WSREP_DUMMY(w)->log_fn = NULL; ++ WSREP_DUMMY(w)->options = NULL; ++ ++ return 0; ++} +diff --git a/wsrep/wsrep_gtid.c b/wsrep/wsrep_gtid.c +new file mode 100644 +index 0000000..e618c5a +--- /dev/null ++++ b/wsrep/wsrep_gtid.c +@@ -0,0 +1,74 @@ ++/* Copyright (C) 2013 Codership Oy ++ ++ 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ */ ++ ++/*! @file Helper functions to deal with GTID string representations */ ++ ++#include ++#include ++#include ++#include ++ ++#include "wsrep_api.h" ++ ++/*! ++ * Read GTID from string ++ * @return length of GTID string representation or -EINVAL in case of error ++ */ ++int ++wsrep_gtid_scan(const char* str, size_t str_len, wsrep_gtid_t* gtid) ++{ ++ unsigned int offset; ++ char* endptr; ++ ++ if ((offset = wsrep_uuid_scan(str, str_len, >id->uuid)) > 0 && ++ offset < str_len && str[offset] == ':') { ++ ++offset; ++ if (offset < str_len) ++ { ++ errno = 0; ++ gtid->seqno = strtoll(str + offset, &endptr, 0); ++ ++ if (errno == 0) { ++ offset = endptr - str; ++ return offset; ++ } ++ } ++ } ++ *gtid = WSREP_GTID_UNDEFINED; ++ return -EINVAL; ++} ++ ++/*! ++ * Write GTID to string ++ * @return length of GTID stirng representation of -EMSGSIZE if string is too ++ * short ++ */ ++int ++wsrep_gtid_print(const wsrep_gtid_t* gtid, char* str, size_t str_len) ++{ ++ unsigned int offset, ret; ++ if ((offset = wsrep_uuid_print(>id->uuid, str, str_len)) > 0) ++ { ++ ret = snprintf(str + offset, str_len - offset, ++ ":%" PRId64, gtid->seqno); ++ if (ret <= str_len - offset) { ++ return (offset + ret); ++ } ++ ++ } ++ ++ return -EMSGSIZE; ++} +diff --git a/wsrep/wsrep_loader.c b/wsrep/wsrep_loader.c +new file mode 100644 +index 0000000..c330c77 +--- /dev/null ++++ b/wsrep/wsrep_loader.c +@@ -0,0 +1,203 @@ ++/* Copyright (C) 2009-2011 Codership Oy ++ ++ 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ */ ++ ++/*! @file wsrep implementation loader */ ++ ++#include ++#include ++#include ++#include ++ ++#include "wsrep_api.h" ++ ++// Logging stuff for the loader ++static const char* log_levels[] = {"FATAL", "ERROR", "WARN", "INFO", "DEBUG"}; ++ ++static void default_logger (wsrep_log_level_t lvl, const char* msg) ++{ ++ fprintf (stderr, "wsrep loader: [%s] %s\n", log_levels[lvl], msg); ++} ++ ++static wsrep_log_cb_t logger = default_logger; ++ ++/************************************************************************** ++ * Library loader ++ **************************************************************************/ ++ ++static int verify(const wsrep_t *wh, const char *iface_ver) ++{ ++ const size_t msg_len = 128; ++ char msg[128]; ++ ++#define VERIFY(_p) if (!(_p)) { \ ++ snprintf(msg, msg_len, "wsrep_load(): verify(): %s\n", # _p); \ ++ logger (WSREP_LOG_ERROR, msg); \ ++ return EINVAL; \ ++ } ++ ++ VERIFY(wh); ++ VERIFY(wh->version); ++ ++ if (strcmp(wh->version, iface_ver)) { ++ snprintf (msg, msg_len, ++ "provider interface version mismatch: need '%s', found '%s'", ++ iface_ver, wh->version); ++ logger (WSREP_LOG_ERROR, msg); ++ return EINVAL; ++ } ++ ++ VERIFY(wh->init); ++ VERIFY(wh->options_set); ++ VERIFY(wh->options_get); ++ VERIFY(wh->connect); ++ VERIFY(wh->disconnect); ++ VERIFY(wh->recv); ++ VERIFY(wh->pre_commit); ++ VERIFY(wh->post_commit); ++ VERIFY(wh->post_rollback); ++ VERIFY(wh->replay_trx); ++ VERIFY(wh->abort_pre_commit); ++ VERIFY(wh->append_key); ++ VERIFY(wh->append_data); ++ VERIFY(wh->free_connection); ++ VERIFY(wh->to_execute_start); ++ VERIFY(wh->to_execute_end); ++ VERIFY(wh->preordered_collect); ++ VERIFY(wh->preordered_commit); ++ VERIFY(wh->sst_sent); ++ VERIFY(wh->sst_received); ++ VERIFY(wh->stats_get); ++ VERIFY(wh->stats_free); ++ VERIFY(wh->stats_reset); ++ VERIFY(wh->pause); ++ VERIFY(wh->resume); ++ VERIFY(wh->desync); ++ VERIFY(wh->resync); ++ VERIFY(wh->lock); ++ VERIFY(wh->unlock); ++ VERIFY(wh->is_locked); ++ VERIFY(wh->provider_name); ++ VERIFY(wh->provider_version); ++ VERIFY(wh->provider_vendor); ++ VERIFY(wh->free); ++ return 0; ++} ++ ++typedef int (*wsrep_loader_fun)(wsrep_t*); ++ ++static wsrep_loader_fun wsrep_dlf(void *dlh, const char *sym) ++{ ++ union { ++ wsrep_loader_fun dlfun; ++ void *obj; ++ } alias; ++ alias.obj = dlsym(dlh, sym); ++ return alias.dlfun; ++} ++ ++extern int wsrep_dummy_loader(wsrep_t *w); ++ ++int wsrep_load(const char *spec, wsrep_t **hptr, wsrep_log_cb_t log_cb) ++{ ++ int ret = 0; ++ void *dlh = NULL; ++ wsrep_loader_fun dlfun; ++ const size_t msg_len = 1024; ++ char msg[1024 + 1]; ++ msg[msg_len] = 0; ++ ++ if (NULL != log_cb) ++ logger = log_cb; ++ ++ if (!(spec && hptr)) ++ return EINVAL; ++ ++ snprintf (msg, msg_len, ++ "wsrep_load(): loading provider library '%s'", spec); ++ logger (WSREP_LOG_INFO, msg); ++ ++ if (!(*hptr = malloc(sizeof(wsrep_t)))) { ++ logger (WSREP_LOG_FATAL, "wsrep_load(): out of memory"); ++ return ENOMEM; ++ } ++ ++ if (!spec || strcmp(spec, WSREP_NONE) == 0) { ++ if ((ret = wsrep_dummy_loader(*hptr)) != 0) { ++ free (*hptr); ++ *hptr = NULL; ++ } ++ return ret; ++ } ++ ++ if (!(dlh = dlopen(spec, RTLD_NOW | RTLD_LOCAL))) { ++ snprintf(msg, msg_len, "wsrep_load(): dlopen(): %s", dlerror()); ++ logger (WSREP_LOG_ERROR, msg); ++ ret = EINVAL; ++ goto out; ++ } ++ ++ if (!(dlfun = wsrep_dlf(dlh, "wsrep_loader"))) { ++ ret = EINVAL; ++ goto out; ++ } ++ ++ if ((ret = (*dlfun)(*hptr)) != 0) { ++ snprintf(msg, msg_len, "wsrep_load(): loader failed: %s", ++ strerror(ret)); ++ logger (WSREP_LOG_ERROR, msg); ++ goto out; ++ } ++ ++ if ((ret = verify(*hptr, WSREP_INTERFACE_VERSION)) != 0) { ++ snprintf (msg, msg_len, ++ "wsrep_load(): interface version mismatch: my version %s, " ++ "provider version %s", WSREP_INTERFACE_VERSION, ++ (*hptr)->version); ++ logger (WSREP_LOG_ERROR, msg); ++ goto out; ++ } ++ ++ (*hptr)->dlh = dlh; ++ ++out: ++ if (ret != 0) { ++ if (dlh) dlclose(dlh); ++ free(*hptr); ++ *hptr = NULL; ++ } else { ++ snprintf (msg, msg_len, ++ "wsrep_load(): %s %s by %s loaded successfully.", ++ (*hptr)->provider_name, (*hptr)->provider_version, ++ (*hptr)->provider_vendor); ++ logger (WSREP_LOG_INFO, msg); ++ } ++ ++ return ret; ++} ++ ++void wsrep_unload(wsrep_t *hptr) ++{ ++ if (!hptr) { ++ logger (WSREP_LOG_WARN, "wsrep_unload(): null pointer."); ++ } else { ++ if (hptr->free) ++ hptr->free(hptr); ++ if (hptr->dlh) ++ dlclose(hptr->dlh); ++ free(hptr); ++ } ++} ++ +diff --git a/wsrep/wsrep_uuid.c b/wsrep/wsrep_uuid.c +new file mode 100644 +index 0000000..baa95b2 +--- /dev/null ++++ b/wsrep/wsrep_uuid.c +@@ -0,0 +1,83 @@ ++/* Copyright (C) 2009 Codership Oy ++ ++ 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ */ ++ ++/*! @file Helper functions to deal with history UUID string representations */ ++ ++#include ++#include ++#include ++ ++#include "wsrep_api.h" ++ ++/*! ++ * Read UUID from string ++ * @return length of UUID string representation or -EINVAL in case of error ++ */ ++int ++wsrep_uuid_scan (const char* str, size_t str_len, wsrep_uuid_t* uuid) ++{ ++ unsigned int uuid_len = 0; ++ unsigned int uuid_offt = 0; ++ ++ while (uuid_len + 1 < str_len) { ++ /* We are skipping potential '-' after uuid_offt == 4, 6, 8, 10 ++ * which means ++ * (uuid_offt >> 1) == 2, 3, 4, 5, ++ * which in turn means ++ * (uuid_offt >> 1) - 2 <= 3 ++ * since it is always >= 0, because uuid_offt is unsigned */ ++ if (((uuid_offt >> 1) - 2) <= 3 && str[uuid_len] == '-') { ++ // skip dashes after 4th, 6th, 8th and 10th positions ++ uuid_len += 1; ++ continue; ++ } ++ ++ if (isxdigit(str[uuid_len]) && isxdigit(str[uuid_len + 1])) { ++ // got hex digit, scan another byte to uuid, increment uuid_offt ++ sscanf (str + uuid_len, "%2hhx", uuid->data + uuid_offt); ++ uuid_len += 2; ++ uuid_offt += 1; ++ if (sizeof (uuid->data) == uuid_offt) ++ return uuid_len; ++ } ++ else { ++ break; ++ } ++ } ++ ++ *uuid = WSREP_UUID_UNDEFINED; ++ return -EINVAL; ++} ++ ++/*! ++ * Write UUID to string ++ * @return length of UUID string representation or -EMSGSIZE if string is too ++ * short ++ */ ++int ++wsrep_uuid_print (const wsrep_uuid_t* uuid, char* str, size_t str_len) ++{ ++ if (str_len > 36) { ++ const unsigned char* u = uuid->data; ++ return snprintf(str, str_len, "%02x%02x%02x%02x-%02x%02x-%02x%02x-" ++ "%02x%02x-%02x%02x%02x%02x%02x%02x", ++ u[ 0], u[ 1], u[ 2], u[ 3], u[ 4], u[ 5], u[ 6], u[ 7], ++ u[ 8], u[ 9], u[10], u[11], u[12], u[13], u[14], u[15]); ++ } ++ else { ++ return -EMSGSIZE; ++ } ++} diff --git a/debian/patches/series b/debian/patches/series index c6ee1f47..eae7eb5e 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -5,6 +5,5 @@ disable_tests.patch fix_standalone_tests.patch kfreebsd_tests.patch spelling.patch -CVE-2014-0001.patch -mysql-5.6.16_wsrep_25.5.patch +mysql-5.6.23_wsrep_25.10.patch wsrep_sst_mysqldump.patch diff --git a/debian/patches/wsrep_sst_mysqldump.patch b/debian/patches/wsrep_sst_mysqldump.patch index 63bcd512..6b970767 100644 --- a/debian/patches/wsrep_sst_mysqldump.patch +++ b/debian/patches/wsrep_sst_mysqldump.patch @@ -1,20 +1,31 @@ ---- old/scripts/wsrep_sst_mysqldump.sh 2014-07-31 16:52:30.553138975 +0000 -+++ new/scripts/wsrep_sst_mysqldump.sh 2014-07-31 16:55:55.539138944 +0000 -@@ -67,7 +67,7 @@ if test -n "$WSREP_SST_OPT_PSWD"; then A +diff --git a/scripts/wsrep_sst_mysqldump.sh b/scripts/wsrep_sst_mysqldump.sh +index 89eb755..c20d9fa 100644 +--- a/scripts/wsrep_sst_mysqldump.sh ++++ b/scripts/wsrep_sst_mysqldump.sh +@@ -53,6 +53,8 @@ then + exit $EINVAL + fi + ++MYSQL_APPS_PREFIX="nice -n 15 ionice -c2 -n7" ++ + # Check client version + CLIENT_MINOR=$(mysql --version | cut -d ' ' -f 6 | cut -d '.' -f 2) + if [ $CLIENT_MINOR -lt "6" ] +@@ -73,7 +75,7 @@ if test -n "$WSREP_SST_OPT_PSWD"; then AUTH="$AUTH -p$WSREP_SST_OPT_PSWD"; fi STOP_WSREP="SET wsrep_on=OFF;" # NOTE: we don't use --routines here because we're dumping mysql.proc table --MYSQLDUMP="mysqldump $AUTH -S$WSREP_SST_OPT_SOCKET \ -+MYSQLDUMP="nice -n 15 ionice -c2 -n7 mysqldump $AUTH -S$WSREP_SST_OPT_SOCKET \ +-MYSQLDUMP="$MYSQLDUMP $AUTH -S$WSREP_SST_OPT_SOCKET \ ++MYSQLDUMP="$MYSQL_APPS_PREFIX $MYSQLDUMP $AUTH -S$WSREP_SST_OPT_SOCKET \ --add-drop-database --add-drop-table --skip-add-locks --create-options \ --disable-keys --extended-insert --skip-lock-tables --quick --set-charset \ - --skip-comments --flush-privileges --all-databases" -@@ -92,7 +92,7 @@ DROP PREPARE stmt;" + --skip-comments --flush-privileges --all-databases --events" +@@ -98,7 +100,7 @@ DROP PREPARE stmt;" SET_START_POSITION="SET GLOBAL wsrep_start_position='$WSREP_SST_OPT_GTID';" --MYSQL="mysql $AUTH -h$WSREP_SST_OPT_HOST -P$WSREP_SST_OPT_PORT "\ -+MYSQL="nice -n 15 ionice -c2 -n7 mysql $AUTH -h$WSREP_SST_OPT_HOST -P$WSREP_SST_OPT_PORT "\ +-MYSQL="$MYSQL_CLIENT $AUTH -h$WSREP_SST_OPT_HOST -P$WSREP_SST_OPT_PORT "\ ++MYSQL="$MYSQL_APPS_PREFIX $MYSQL_CLIENT $AUTH -h$WSREP_SST_OPT_HOST -P$WSREP_SST_OPT_PORT "\ "--disable-reconnect --connect_timeout=10" # need to disable logging when loading the dump diff --git a/mysql-wsrep-5.6/.gitignore b/mysql-wsrep-5.6/.gitignore new file mode 100644 index 00000000..8bbfde40 --- /dev/null +++ b/mysql-wsrep-5.6/.gitignore @@ -0,0 +1,3139 @@ +*-t +*_test +*.Plo +*.Po +*.a +*.bb +*.bbg +*.bin +*.cdf +*.core +*.d +*.da +*.dir +*.dll +*.dylib +*.exe +*.exp +*.gcda +*.gcno +*.gcov +*.idb +*.ilk +*.la +*.lai +*.lib +*.lo +*.manifest +*.map +*.o +*.obj +*.old +*.pch +*.pdb +*.reject +*.res +*.rule +*.sbr +*.so +*.so.* +*.spec +*.user +*.vcproj +*.vcproj.cmake +*.vcxproj +*.vcxproj.filters +*/*.dir/* +Debug +MySql.sdf +Win32 +*/*_pure_*warnings +*/.deps +*/.libs/* +*/.pure +*/debug/* +*/minsizerel/* +*/release/* +RelWithDebInfo +*~ +.*.swp +./CMakeCache.txt +./MySql.ncb +./MySql.sln +./MySql.suo +./README.build-files +./cmakecache.txt +./config.h +./copy_mysql_files.bat +./fix-project-files +./mysql*.ds? +./mysql.ncb +./mysql.sln +./mysql.suo +./prepare +.DS_Store +.defs.mk +.depend +.depend.mk +.deps +.gdb_history +.gdbinit +.libs +.o +.out +.snprj/* +.vimrc +50 +=6 +BUILD/compile-pentium-maintainer +BitKeeper/etc/RESYNC_TREE +BitKeeper/etc/config +BitKeeper/etc/csets +BitKeeper/etc/csets-in +BitKeeper/etc/csets-out +BitKeeper/etc/gone +BitKeeper/etc/level +BitKeeper/etc/pushed +BitKeeper/post-commit +BitKeeper/post-commit-manual +BitKeeper/tmp/* +BitKeeper/tmp/bkr3sAHD +BitKeeper/tmp/gone +CMakeFiles +CMakeFiles/* +CTestTestfile.cmake +COPYING +COPYING.LIB +Docs/#manual.texi# +Docs/INSTALL-BINARY +Docs/Images/myaccess-odbc.txt +Docs/Images/myaccess.txt +Docs/Images/myarchitecture.txt +Docs/Images/mydll-properties.txt +Docs/Images/mydsn-example.txt +Docs/Images/mydsn-icon.txt +Docs/Images/mydsn-options.txt +Docs/Images/mydsn-setup.txt +Docs/Images/mydsn-test-fail.txt +Docs/Images/mydsn-test-success.txt +Docs/Images/mydsn-trace.txt +Docs/Images/mydsn.txt +Docs/Images/myflowchart.txt +Docs/include.texi +Docs/internals.html +Docs/internals.info +Docs/internals.pdf +Docs/internals.txt +Docs/internals_toc.html +Docs/manual.aux +Docs/manual.cp +Docs/manual.cps +Docs/manual.de.log +Docs/manual.dvi +Docs/manual.fn +Docs/manual.fns +Docs/manual.html +Docs/manual.ky +Docs/manual.log +Docs/manual.pdf +Docs/manual.pg +Docs/manual.texi.orig +Docs/manual.texi.rej +Docs/manual.toc +Docs/manual.tp +Docs/manual.txt +Docs/manual.vr +Docs/manual_a4.ps +Docs/manual_letter.ps +Docs/manual_toc.html +Docs/my_sys.doc +Docs/mysql.info +Docs/mysql.xml +Docs/safe-mysql.xml +Docs/tex.fmt +Docs/texi2dvi.out +EXCEPTIONS-CLIENT +INSTALL-SOURCE +INSTALL-WIN-SOURCE +Logs/* +MIRRORS +Makefile +Makefile.in +Makefile.in' +PENDING/* +scripts/scripts +TAGS +VC++Files/client/mysql_amd64.dsp +ac_available_languages_fragment +acinclude.m4 +aclocal.m4 +analyse.test +autom4te-2.53.cache/* +autom4te-2.53.cache/output.0 +autom4te-2.53.cache/requests +autom4te-2.53.cache/traces.0 +autom4te.cache/* +autom4te.cache/output.0 +autom4te.cache/requests +autom4te.cache/traces.0 +bdb/*.ds? +bdb/*.vcproj +bdb/README +bdb/btree/btree_auto.c +bdb/build_unix/* +bdb/build_vxworks/db.h +bdb/build_vxworks/db_int.h +bdb/build_win32/db.h +bdb/build_win32/db_archive.dsp +bdb/build_win32/db_checkpoint.dsp +bdb/build_win32/db_config.h +bdb/build_win32/db_cxx.h +bdb/build_win32/db_deadlock.dsp +bdb/build_win32/db_dll.dsp +bdb/build_win32/db_dump.dsp +bdb/build_win32/db_int.h +bdb/build_win32/db_java.dsp +bdb/build_win32/db_load.dsp +bdb/build_win32/db_perf.dsp +bdb/build_win32/db_printlog.dsp +bdb/build_win32/db_recover.dsp +bdb/build_win32/db_stat.dsp +bdb/build_win32/db_static.dsp +bdb/build_win32/db_tcl.dsp +bdb/build_win32/db_test.dsp +bdb/build_win32/db_upgrade.dsp +bdb/build_win32/db_verify.dsp +bdb/build_win32/ex_access.dsp +bdb/build_win32/ex_btrec.dsp +bdb/build_win32/ex_env.dsp +bdb/build_win32/ex_lock.dsp +bdb/build_win32/ex_mpool.dsp +bdb/build_win32/ex_tpcb.dsp +bdb/build_win32/excxx_access.dsp +bdb/build_win32/excxx_btrec.dsp +bdb/build_win32/excxx_env.dsp +bdb/build_win32/excxx_lock.dsp +bdb/build_win32/excxx_mpool.dsp +bdb/build_win32/excxx_tpcb.dsp +bdb/build_win32/include.tcl +bdb/build_win32/libdb.def +bdb/build_win32/libdb.rc +bdb/db/crdel_auto.c +bdb/db/db_auto.c +bdb/dbinc_auto/*.* +bdb/dbreg/dbreg_auto.c +bdb/dist/autom4te-2.53.cache/* +bdb/dist/autom4te-2.53.cache/output.0 +bdb/dist/autom4te-2.53.cache/requests +bdb/dist/autom4te-2.53.cache/traces.0 +bdb/dist/autom4te.cache/* +bdb/dist/autom4te.cache/output.0 +bdb/dist/autom4te.cache/requests +bdb/dist/autom4te.cache/traces.0 +bdb/dist/config.hin +bdb/dist/configure +bdb/dist/db.h +bdb/dist/db_config.h +bdb/dist/db_cxx.h +bdb/dist/db_int.h +bdb/dist/include.tcl +bdb/dist/tags +bdb/dist/template/db_server_proc +bdb/dist/template/gen_client_ret +bdb/dist/template/rec_btree +bdb/dist/template/rec_crdel +bdb/dist/template/rec_db +bdb/dist/template/rec_dbreg +bdb/dist/template/rec_fileops +bdb/dist/template/rec_hash +bdb/dist/template/rec_log +bdb/dist/template/rec_qam +bdb/dist/template/rec_txn +bdb/examples_c/ex_apprec/ex_apprec_auto.c +bdb/examples_c/ex_apprec/ex_apprec_auto.h +bdb/examples_c/ex_apprec/ex_apprec_template +bdb/examples_java +bdb/fileops/fileops_auto.c +bdb/hash/hash_auto.c +bdb/include/btree_auto.h +bdb/include/btree_ext.h +bdb/include/clib_ext.h +bdb/include/common_ext.h +bdb/include/crdel_auto.h +bdb/include/db_auto.h +bdb/include/db_ext.h +bdb/include/db_server.h +bdb/include/env_ext.h +bdb/include/gen_client_ext.h +bdb/include/gen_server_ext.h +bdb/include/hash_auto.h +bdb/include/hash_ext.h +bdb/include/lock_ext.h +bdb/include/log_auto.h +bdb/include/log_ext.h +bdb/include/mp_ext.h +bdb/include/mutex_ext.h +bdb/include/os_ext.h +bdb/include/qam_auto.h +bdb/include/qam_ext.h +bdb/include/rpc_client_ext.h +bdb/include/rpc_server_ext.h +bdb/include/tcl_ext.h +bdb/include/txn_auto.h +bdb/include/txn_ext.h +bdb/include/xa_ext.h +bdb/java/src/com/sleepycat/db/Db.java +bdb/java/src/com/sleepycat/db/DbBtreeStat.java +bdb/java/src/com/sleepycat/db/DbConstants.java +bdb/java/src/com/sleepycat/db/DbHashStat.java +bdb/java/src/com/sleepycat/db/DbLockStat.java +bdb/java/src/com/sleepycat/db/DbLogStat.java +bdb/java/src/com/sleepycat/db/DbMpoolFStat.java +bdb/java/src/com/sleepycat/db/DbQueueStat.java +bdb/java/src/com/sleepycat/db/DbRepStat.java +bdb/java/src/com/sleepycat/db/DbTxnStat.java +bdb/libdb_java/java_stat_auto.c +bdb/libdb_java/java_stat_auto.h +bdb/log/log_auto.c +bdb/qam/qam_auto.c +bdb/rpc_client/db_server_clnt.c +bdb/rpc_client/gen_client.c +bdb/rpc_server/c/db_server_proc.c +bdb/rpc_server/c/db_server_proc.sed +bdb/rpc_server/c/db_server_svc.c +bdb/rpc_server/c/db_server_xdr.c +bdb/rpc_server/c/gen_db_server.c +bdb/rpc_server/db_server.x +bdb/rpc_server/db_server_proc.sed +bdb/rpc_server/db_server_svc.c +bdb/rpc_server/db_server_xdr.c +bdb/rpc_server/gen_db_server.c +bdb/test/TESTS +bdb/test/include.tcl +bdb/test/logtrack.list +bdb/txn/txn_auto.c +binary/* +bkpull.log +bkpull.log* +bkpull.log.2 +bkpull.log.3 +bkpull.log.4 +bkpull.log.5 +bkpull.log.6 +bkpush.log +bkpush.log* +build.log +build_tags.sh +client/#mysql.cc# +client/*.ds? +client/*.vcproj +client/.deps/base64.Po +client/.deps/completion_hash.Po +client/.deps/dummy.Po +client/.deps/mf_tempdir.Po +client/.deps/my_bit.Po +client/.deps/my_bitmap.Po +client/.deps/my_getsystime.Po +client/.deps/my_new.Po +client/.deps/my_user.Po +client/.deps/my_vle.Po +client/.deps/mysql.Po +client/.deps/mysql_upgrade.Po +client/.deps/mysqladmin.Po +client/.deps/mysqlbinlog.Po +client/.deps/mysqlcheck.Po +client/.deps/mysqldump.Po +client/.deps/mysqlimport.Po +client/.deps/mysqlshow.Po +client/.deps/mysqlslap.Po +client/.deps/mysqltest.Po +client/.deps/readline.Po +client/.deps/sql_string.Po +client/.libs -prune +client/.libs/lt-mysql +client/.libs/lt-mysqladmin +client/.libs/lt-mysqlbinlog +client/.libs/lt-mysqlcheck +client/.libs/lt-mysqldump +client/.libs/lt-mysqlimport +client/.libs/lt-mysqlshow +client/.libs/lt-mysqlslap +client/.libs/lt-mysqltest +client/.libs/mysql +client/.libs/mysql_upgrade +client/.libs/mysqladmin +client/.libs/mysqlbinlog +client/.libs/mysqlcheck +client/.libs/mysqldump +client/.libs/mysqlimport +client/.libs/mysqlshow +client/.libs/mysqlslap +client/.libs/mysqltest +client/completion_hash.cpp +client/decimal.c +client/insert_test +client/link_sources +client/log_event.cc +client/log_event.h +client/log_event_old.cc +client/log_event_old.h +client/mf_iocache.c +client/mf_iocache.cc +client/my_decimal.cc +client/my_decimal.h +client/my_user.c +client/mysql +client/mysql.cpp +client/mysql_config_editor +client/mysql_upgrade +client/mysqladmin +client/mysqladmin.c +client/mysqladmin.cpp +client/mysqlbinlog +client/mysqlbinlog.cpp +client/mysqlcheck +client/mysqldump +client/mysqlimport +client/mysqlmanager-pwgen +client/mysqlmanagerc +client/mysqlshow +client/mysqlslap +client/mysqltest +client/mysqltestmanager-pwgen +client/mysqltestmanagerc +client/mysys_priv.h +client/readline.cpp +client/rpl_constants.h +client/rpl_record_old.cc +client/rpl_record_old.h +client/rpl_tblmap.h +client/rpl_tblmap.cc +client/rpl_utility.h +client/rpl_utility.cc +client/select_test +client/sql_const.h +client/sql_string.cpp +client/ssl_test +client/thimble +client/thread_test +client/tmp.diff +client_debug/* +client_release/* +client_test +cmake_install.cmake +cmd-line-utils/libedit/.deps/chared.Po +cmd-line-utils/libedit/.deps/common.Po +cmd-line-utils/libedit/.deps/el.Po +cmd-line-utils/libedit/.deps/emacs.Po +cmd-line-utils/libedit/.deps/fcns.Po +cmd-line-utils/libedit/.deps/fgetln.Po +cmd-line-utils/libedit/.deps/help.Po +cmd-line-utils/libedit/.deps/hist.Po +cmd-line-utils/libedit/.deps/history.Po +cmd-line-utils/libedit/.deps/key.Po +cmd-line-utils/libedit/.deps/map.Po +cmd-line-utils/libedit/.deps/parse.Po +cmd-line-utils/libedit/.deps/prompt.Po +cmd-line-utils/libedit/.deps/read.Po +cmd-line-utils/libedit/.deps/readline.Po +cmd-line-utils/libedit/.deps/refresh.Po +cmd-line-utils/libedit/.deps/search.Po +cmd-line-utils/libedit/.deps/sig.Po +cmd-line-utils/libedit/.deps/strlcat.Po +cmd-line-utils/libedit/.deps/strlcpy.Po +cmd-line-utils/libedit/.deps/term.Po +cmd-line-utils/libedit/.deps/tokenizer.Po +cmd-line-utils/libedit/.deps/tty.Po +cmd-line-utils/libedit/.deps/unvis.Po +cmd-line-utils/libedit/.deps/vi.Po +cmd-line-utils/libedit/.deps/vis.Po +cmd-line-utils/libedit/common.h +cmd-line-utils/libedit/makelist +cmd-line-utils/readline/.deps/bind.Po +cmd-line-utils/readline/.deps/callback.Po +cmd-line-utils/readline/.deps/compat.Po +cmd-line-utils/readline/.deps/complete.Po +cmd-line-utils/readline/.deps/display.Po +cmd-line-utils/readline/.deps/funmap.Po +cmd-line-utils/readline/.deps/histexpand.Po +cmd-line-utils/readline/.deps/histfile.Po +cmd-line-utils/readline/.deps/history.Po +cmd-line-utils/readline/.deps/histsearch.Po +cmd-line-utils/readline/.deps/input.Po +cmd-line-utils/readline/.deps/isearch.Po +cmd-line-utils/readline/.deps/keymaps.Po +cmd-line-utils/readline/.deps/kill.Po +cmd-line-utils/readline/.deps/macro.Po +cmd-line-utils/readline/.deps/mbutil.Po +cmd-line-utils/readline/.deps/misc.Po +cmd-line-utils/readline/.deps/nls.Po +cmd-line-utils/readline/.deps/parens.Po +cmd-line-utils/readline/.deps/readline.Po +cmd-line-utils/readline/.deps/rltty.Po +cmd-line-utils/readline/.deps/savestring.Po +cmd-line-utils/readline/.deps/search.Po +cmd-line-utils/readline/.deps/shell.Po +cmd-line-utils/readline/.deps/signals.Po +cmd-line-utils/readline/.deps/terminal.Po +cmd-line-utils/readline/.deps/text.Po +cmd-line-utils/readline/.deps/tilde.Po +cmd-line-utils/readline/.deps/undo.Po +cmd-line-utils/readline/.deps/util.Po +cmd-line-utils/readline/.deps/vi_mode.Po +cmd-line-utils/readline/.deps/xmalloc.Po +comon.h +comp_err/*.ds? +comp_err/*.vcproj +compile +config.cache +config.guess +config.h +config.h.in +config.log +config.status +config.sub +configure +configure.lineno +contrib/*.ds? +contrib/*.vcproj +core +core.* +cscope.in.out +cscope.out +cscope.po.out +db-*.*.* +dbug/*.ds? +dbug/*.vcproj +dbug/.deps/dbug.Po +dbug/.deps/dbug_analyze.Po +dbug/.deps/factorial.Po +dbug/.deps/my_main.Po +dbug/.deps/sanity.Po +dbug/dbug_analyze +dbug/example*.r +dbug/factorial +dbug/factorial.r +dbug/main.r +dbug/output*.r +dbug/user.ps +dbug/user.t +debian/control +debian/defs.mk +depcomp +emacs.h +examples/*.ds? +examples/*.vcproj +examples/udf_example/udf_example.def +extra/.deps/comp_err.Po +extra/.deps/innochecksum.Po +extra/.deps/my_print_defaults.Po +extra/.deps/mysql_waitpid.Po +extra/.deps/perror.Po +extra/.deps/replace.Po +extra/.deps/resolve_stack_dump.Po +extra/.deps/resolveip.Po +extra/comp_err +extra/created_include_files +extra/innochecksum +extra/my_print_defaults +extra/mysql_install +extra/mysql_tzinfo_to_sql +extra/mysql_waitpid +extra/mysqld_ername.h +extra/mysqld_error.h +extra/perror +extra/replace +extra/resolve_stack_dump +extra/resolveip +extra/sql_state.h +extra/tztime.cc +extra/yassl/src/.deps/buffer.Plo +extra/yassl/src/.deps/cert_wrapper.Plo +extra/yassl/src/.deps/crypto_wrapper.Plo +extra/yassl/src/.deps/handshake.Plo +extra/yassl/src/.deps/lock.Plo +extra/yassl/src/.deps/log.Plo +extra/yassl/src/.deps/socket_wrapper.Plo +extra/yassl/src/.deps/ssl.Plo +extra/yassl/src/.deps/template_instnt.Plo +extra/yassl/src/.deps/timer.Plo +extra/yassl/src/.deps/yassl_error.Plo +extra/yassl/src/.deps/yassl_imp.Plo +extra/yassl/src/.deps/yassl_int.Plo +extra/yassl/taocrypt/benchmark/.deps/benchmark-benchmark.Po +extra/yassl/taocrypt/benchmark/benchmark +extra/yassl/taocrypt/src/.deps/libtaocrypt_la-aes.Plo +extra/yassl/taocrypt/src/.deps/libtaocrypt_la-aestables.Plo +extra/yassl/taocrypt/src/.deps/libtaocrypt_la-algebra.Plo +extra/yassl/taocrypt/src/.deps/libtaocrypt_la-arc4.Plo +extra/yassl/taocrypt/src/.deps/libtaocrypt_la-asn.Plo +extra/yassl/taocrypt/src/.deps/libtaocrypt_la-bftables.Plo +extra/yassl/taocrypt/src/.deps/libtaocrypt_la-blowfish.Plo +extra/yassl/taocrypt/src/.deps/libtaocrypt_la-coding.Plo +extra/yassl/taocrypt/src/.deps/libtaocrypt_la-des.Plo +extra/yassl/taocrypt/src/.deps/libtaocrypt_la-dh.Plo +extra/yassl/taocrypt/src/.deps/libtaocrypt_la-dsa.Plo +extra/yassl/taocrypt/src/.deps/libtaocrypt_la-file.Plo +extra/yassl/taocrypt/src/.deps/libtaocrypt_la-hash.Plo +extra/yassl/taocrypt/src/.deps/libtaocrypt_la-integer.Plo +extra/yassl/taocrypt/src/.deps/libtaocrypt_la-md2.Plo +extra/yassl/taocrypt/src/.deps/libtaocrypt_la-md4.Plo +extra/yassl/taocrypt/src/.deps/libtaocrypt_la-md5.Plo +extra/yassl/taocrypt/src/.deps/libtaocrypt_la-misc.Plo +extra/yassl/taocrypt/src/.deps/libtaocrypt_la-random.Plo +extra/yassl/taocrypt/src/.deps/libtaocrypt_la-ripemd.Plo +extra/yassl/taocrypt/src/.deps/libtaocrypt_la-rsa.Plo +extra/yassl/taocrypt/src/.deps/libtaocrypt_la-sha.Plo +extra/yassl/taocrypt/src/.deps/libtaocrypt_la-template_instnt.Plo +extra/yassl/taocrypt/src/.deps/libtaocrypt_la-tftables.Plo +extra/yassl/taocrypt/src/.deps/libtaocrypt_la-twofish.Plo +extra/yassl/taocrypt/test/.deps/test-test.Po +extra/yassl/taocrypt/test/test +extra/yassl/testsuite/.deps/testsuite-client.Po +extra/yassl/testsuite/.deps/testsuite-echoclient.Po +extra/yassl/testsuite/.deps/testsuite-echoserver.Po +extra/yassl/testsuite/.deps/testsuite-server.Po +extra/yassl/testsuite/.deps/testsuite-test.Po +extra/yassl/testsuite/.deps/testsuite-testsuite.Po +extra/yassl/testsuite/testsuite +fcns.c +fcns.h +gdbinit +gmon.out +hardcopy.0 +heap/*.ds? +heap/*.vcproj +heap/hp_test1 +heap/hp_test2 +help +help.c +help.h +include/abi_check +include/check_abi +include/link_sources +include/my_config.h +include/my_global.h +include/mysql_h.ic +include/mysql_version.h +include/mysqld_ername.h +include/mysqld_error.h +include/mysqld_error.h.rule +include/openssl +include/probes_mysql_dtrace.h +include/readline +include/readline/*.h +include/readline/readline.h +include/sql_state.h +include/widec.h +innobase/*.ds? +innobase/*.vcproj +innobase/autom4te-2.53.cache/* +innobase/autom4te-2.53.cache/output.0 +innobase/autom4te-2.53.cache/requests +innobase/autom4te-2.53.cache/traces.0 +innobase/autom4te.cache/* +innobase/autom4te.cache/output.0 +innobase/autom4te.cache/requests +innobase/autom4te.cache/traces.0 +innobase/configure.lineno +innobase/conftest.s1 +innobase/conftest.subs +innobase/ib_config.h +innobase/ib_config.h.in +innobase/mkinstalldirs +innobase/stamp-h1 +insert_test +install +install-sh +isam/*.ds? +isam/*.vcproj +isam/isamchk +isam/isamlog +isam/pack_isam +isam/test1 +isam/test2 +isam/test3 +isamchk/*.ds? +isamchk/*.vcproj +item_xmlfunc.cc +lib_debug/* +lib_release/* +libmysql/*.c +libmysql/*.ds? +libmysql/*.vcproj +libmysql/.deps/array.Plo +libmysql/.deps/bchange.Plo +libmysql/.deps/bcmp.Plo +libmysql/.deps/bmove.Plo +libmysql/.deps/bmove_upp.Plo +libmysql/.deps/charset-def.Plo +libmysql/.deps/charset.Plo +libmysql/.deps/client.Plo +libmysql/.deps/conf_to_src.Po +libmysql/.deps/ctype-big5.Plo +libmysql/.deps/ctype-bin.Plo +libmysql/.deps/ctype-cp932.Plo +libmysql/.deps/ctype-czech.Plo +libmysql/.deps/ctype-euc_kr.Plo +libmysql/.deps/ctype-eucjpms.Plo +libmysql/.deps/ctype-extra.Plo +libmysql/.deps/ctype-gb2312.Plo +libmysql/.deps/ctype-gbk.Plo +libmysql/.deps/ctype-latin1.Plo +libmysql/.deps/ctype-mb.Plo +libmysql/.deps/ctype-simple.Plo +libmysql/.deps/ctype-sjis.Plo +libmysql/.deps/ctype-tis620.Plo +libmysql/.deps/ctype-uca.Plo +libmysql/.deps/ctype-ucs2.Plo +libmysql/.deps/ctype-ujis.Plo +libmysql/.deps/ctype-utf8.Plo +libmysql/.deps/ctype-win1250ch.Plo +libmysql/.deps/ctype.Plo +libmysql/.deps/dbug.Plo +libmysql/.deps/default.Plo +libmysql/.deps/default_modify.Plo +libmysql/.deps/errmsg.Plo +libmysql/.deps/errors.Plo +libmysql/.deps/get_password.Plo +libmysql/.deps/hash.Plo +libmysql/.deps/int2str.Plo +libmysql/.deps/is_prefix.Plo +libmysql/.deps/libmysql.Plo +libmysql/.deps/list.Plo +libmysql/.deps/llstr.Plo +libmysql/.deps/longlong2str.Plo +libmysql/.deps/manager.Plo +libmysql/.deps/md5.Plo +libmysql/.deps/mf_cache.Plo +libmysql/.deps/mf_dirname.Plo +libmysql/.deps/mf_fn_ext.Plo +libmysql/.deps/mf_format.Plo +libmysql/.deps/mf_iocache.Plo +libmysql/.deps/mf_iocache2.Plo +libmysql/.deps/mf_loadpath.Plo +libmysql/.deps/mf_pack.Plo +libmysql/.deps/mf_path.Plo +libmysql/.deps/mf_tempfile.Plo +libmysql/.deps/mf_unixpath.Plo +libmysql/.deps/mf_wcomp.Plo +libmysql/.deps/mulalloc.Plo +libmysql/.deps/my_alloc.Plo +libmysql/.deps/my_chsize.Plo +libmysql/.deps/my_compress.Plo +libmysql/.deps/my_create.Plo +libmysql/.deps/my_delete.Plo +libmysql/.deps/my_div.Plo +libmysql/.deps/my_error.Plo +libmysql/.deps/my_file.Plo +libmysql/.deps/my_fopen.Plo +libmysql/.deps/my_fstream.Plo +libmysql/.deps/my_gethostbyname.Plo +libmysql/.deps/my_getopt.Plo +libmysql/.deps/my_getwd.Plo +libmysql/.deps/my_init.Plo +libmysql/.deps/my_lib.Plo +libmysql/.deps/my_malloc.Plo +libmysql/.deps/my_messnc.Plo +libmysql/.deps/my_net.Plo +libmysql/.deps/my_once.Plo +libmysql/.deps/my_open.Plo +libmysql/.deps/my_port.Plo +libmysql/.deps/my_pread.Plo +libmysql/.deps/my_pthread.Plo +libmysql/.deps/my_read.Plo +libmysql/.deps/my_realloc.Plo +libmysql/.deps/my_rename.Plo +libmysql/.deps/my_seek.Plo +libmysql/.deps/my_sleep.Plo +libmysql/.deps/my_static.Plo +libmysql/.deps/my_strtoll10.Plo +libmysql/.deps/my_symlink.Plo +libmysql/.deps/my_thr_init.Plo +libmysql/.deps/my_time.Plo +libmysql/.deps/my_vsnprintf.Plo +libmysql/.deps/my_write.Plo +libmysql/.deps/net.Plo +libmysql/.deps/pack.Plo +libmysql/.deps/password.Plo +libmysql/.deps/safemalloc.Plo +libmysql/.deps/sha1.Plo +libmysql/.deps/str2int.Plo +libmysql/.deps/str_alloc.Plo +libmysql/.deps/strcend.Plo +libmysql/.deps/strcont.Plo +libmysql/.deps/strend.Plo +libmysql/.deps/strfill.Plo +libmysql/.deps/string.Plo +libmysql/.deps/strinstr.Plo +libmysql/.deps/strmake.Plo +libmysql/.deps/strmov.Plo +libmysql/.deps/strnlen.Plo +libmysql/.deps/strnmov.Plo +libmysql/.deps/strtod.Plo +libmysql/.deps/strtoll.Plo +libmysql/.deps/strtoull.Plo +libmysql/.deps/strxmov.Plo +libmysql/.deps/strxnmov.Plo +libmysql/.deps/thr_mutex.Plo +libmysql/.deps/typelib.Plo +libmysql/.deps/vio.Plo +libmysql/.deps/viosocket.Plo +libmysql/.deps/viossl.Plo +libmysql/.deps/viosslfactories.Plo +libmysql/.deps/xml.Plo +libmysql/.libs/libmysqlclient.lai +libmysql/.libs/libmysqlclient.so.15 +libmysql/.libs/libmysqlclient.so.15.0.0 +libmysql/conf_to_src +libmysql/debug/libmysql.exp +libmysql/libmysql.ver +libmysql/link_sources +libmysql/my_static.h +libmysql/my_time.c +libmysql/mysys_priv.h +libmysql/net.c +libmysql/release/libmysql.exp +libmysql/vio_priv.h +libmysql/viosocket.o.6WmSJk +libmysql_r/*.c +libmysql_r/.deps/array.Plo +libmysql_r/.deps/bchange.Plo +libmysql_r/.deps/bcmp.Plo +libmysql_r/.deps/bmove.Plo +libmysql_r/.deps/bmove_upp.Plo +libmysql_r/.deps/charset-def.Plo +libmysql_r/.deps/charset.Plo +libmysql_r/.deps/client.Plo +libmysql_r/.deps/conf_to_src.Po +libmysql_r/.deps/ctype-big5.Plo +libmysql_r/.deps/ctype-bin.Plo +libmysql_r/.deps/ctype-cp932.Plo +libmysql_r/.deps/ctype-czech.Plo +libmysql_r/.deps/ctype-euc_kr.Plo +libmysql_r/.deps/ctype-eucjpms.Plo +libmysql_r/.deps/ctype-extra.Plo +libmysql_r/.deps/ctype-gb2312.Plo +libmysql_r/.deps/ctype-gbk.Plo +libmysql_r/.deps/ctype-latin1.Plo +libmysql_r/.deps/ctype-mb.Plo +libmysql_r/.deps/ctype-simple.Plo +libmysql_r/.deps/ctype-sjis.Plo +libmysql_r/.deps/ctype-tis620.Plo +libmysql_r/.deps/ctype-uca.Plo +libmysql_r/.deps/ctype-ucs2.Plo +libmysql_r/.deps/ctype-ujis.Plo +libmysql_r/.deps/ctype-utf8.Plo +libmysql_r/.deps/ctype-win1250ch.Plo +libmysql_r/.deps/ctype.Plo +libmysql_r/.deps/dbug.Plo +libmysql_r/.deps/default.Plo +libmysql_r/.deps/default_modify.Plo +libmysql_r/.deps/errmsg.Plo +libmysql_r/.deps/errors.Plo +libmysql_r/.deps/get_password.Plo +libmysql_r/.deps/hash.Plo +libmysql_r/.deps/int2str.Plo +libmysql_r/.deps/is_prefix.Plo +libmysql_r/.deps/libmysql.Plo +libmysql_r/.deps/list.Plo +libmysql_r/.deps/llstr.Plo +libmysql_r/.deps/longlong2str.Plo +libmysql_r/.deps/manager.Plo +libmysql_r/.deps/md5.Plo +libmysql_r/.deps/mf_cache.Plo +libmysql_r/.deps/mf_dirname.Plo +libmysql_r/.deps/mf_fn_ext.Plo +libmysql_r/.deps/mf_format.Plo +libmysql_r/.deps/mf_iocache.Plo +libmysql_r/.deps/mf_iocache2.Plo +libmysql_r/.deps/mf_loadpath.Plo +libmysql_r/.deps/mf_pack.Plo +libmysql_r/.deps/mf_path.Plo +libmysql_r/.deps/mf_tempfile.Plo +libmysql_r/.deps/mf_unixpath.Plo +libmysql_r/.deps/mf_wcomp.Plo +libmysql_r/.deps/mulalloc.Plo +libmysql_r/.deps/my_alloc.Plo +libmysql_r/.deps/my_chsize.Plo +libmysql_r/.deps/my_compress.Plo +libmysql_r/.deps/my_create.Plo +libmysql_r/.deps/my_delete.Plo +libmysql_r/.deps/my_div.Plo +libmysql_r/.deps/my_error.Plo +libmysql_r/.deps/my_file.Plo +libmysql_r/.deps/my_fopen.Plo +libmysql_r/.deps/my_fstream.Plo +libmysql_r/.deps/my_gethostbyname.Plo +libmysql_r/.deps/my_getopt.Plo +libmysql_r/.deps/my_getwd.Plo +libmysql_r/.deps/my_init.Plo +libmysql_r/.deps/my_lib.Plo +libmysql_r/.deps/my_malloc.Plo +libmysql_r/.deps/my_messnc.Plo +libmysql_r/.deps/my_net.Plo +libmysql_r/.deps/my_once.Plo +libmysql_r/.deps/my_open.Plo +libmysql_r/.deps/my_port.Plo +libmysql_r/.deps/my_pread.Plo +libmysql_r/.deps/my_pthread.Plo +libmysql_r/.deps/my_read.Plo +libmysql_r/.deps/my_realloc.Plo +libmysql_r/.deps/my_rename.Plo +libmysql_r/.deps/my_seek.Plo +libmysql_r/.deps/my_sleep.Plo +libmysql_r/.deps/my_static.Plo +libmysql_r/.deps/my_strtoll10.Plo +libmysql_r/.deps/my_symlink.Plo +libmysql_r/.deps/my_thr_init.Plo +libmysql_r/.deps/my_time.Plo +libmysql_r/.deps/my_vsnprintf.Plo +libmysql_r/.deps/my_write.Plo +libmysql_r/.deps/net.Plo +libmysql_r/.deps/pack.Plo +libmysql_r/.deps/password.Plo +libmysql_r/.deps/safemalloc.Plo +libmysql_r/.deps/sha1.Plo +libmysql_r/.deps/str2int.Plo +libmysql_r/.deps/str_alloc.Plo +libmysql_r/.deps/strcend.Plo +libmysql_r/.deps/strcont.Plo +libmysql_r/.deps/strend.Plo +libmysql_r/.deps/strfill.Plo +libmysql_r/.deps/string.Plo +libmysql_r/.deps/strinstr.Plo +libmysql_r/.deps/strmake.Plo +libmysql_r/.deps/strmov.Plo +libmysql_r/.deps/strnlen.Plo +libmysql_r/.deps/strnmov.Plo +libmysql_r/.deps/strtod.Plo +libmysql_r/.deps/strtoll.Plo +libmysql_r/.deps/strtoull.Plo +libmysql_r/.deps/strxmov.Plo +libmysql_r/.deps/strxnmov.Plo +libmysql_r/.deps/thr_mutex.Plo +libmysql_r/.deps/typelib.Plo +libmysql_r/.deps/vio.Plo +libmysql_r/.deps/viosocket.Plo +libmysql_r/.deps/viossl.Plo +libmysql_r/.deps/viosslfactories.Plo +libmysql_r/.deps/xml.Plo +libmysql_r/.libs/libmysqlclient_r.lai +libmysql_r/.libs/libmysqlclient_r.so.15 +libmysql_r/.libs/libmysqlclient_r.so.15.0.0 +libmysql_r/acconfig.h +libmysql_r/client_settings.h +libmysql_r/conf_to_src +libmysql_r/link_sources +libmysql_r/my_static.h +libmysql_r/mysys_priv.h +libmysql_r/vio_priv.h +libmysqld/*.ds? +libmysqld/*.vcproj +libmysqld/.deps/client.Po +libmysqld/.deps/derror.Po +libmysqld/.deps/discover.Po +libmysqld/.deps/emb_qcache.Po +libmysqld/.deps/errmsg.Po +libmysqld/.deps/event_data_objects.Po +libmysqld/.deps/event_db_repository.Po +libmysqld/.deps/event_queue.Po +libmysqld/.deps/event_scheduler.Po +libmysqld/.deps/events.Po +libmysqld/.deps/field.Po +libmysqld/.deps/field_conv.Po +libmysqld/.deps/filesort.Po +libmysqld/.deps/get_password.Po +libmysqld/.deps/gstream.Po +libmysqld/.deps/ha_berkeley.Po +libmysqld/.deps/ha_federated.Po +libmysqld/.deps/ha_heap.Po +libmysqld/.deps/ha_innodb.Po +libmysqld/.deps/ha_myisam.Po +libmysqld/.deps/ha_myisammrg.Po +libmysqld/.deps/ha_ndbcluster.Po +libmysqld/.deps/ha_ndbcluster_binlog.Po +libmysqld/.deps/ha_partition.Po +libmysqld/.deps/handler.Po +libmysqld/.deps/hash_filo.Po +libmysqld/.deps/hostname.Po +libmysqld/.deps/init.Po +libmysqld/.deps/item.Po +libmysqld/.deps/item_buff.Po +libmysqld/.deps/item_cmpfunc.Po +libmysqld/.deps/item_create.Po +libmysqld/.deps/item_func.Po +libmysqld/.deps/item_geofunc.Po +libmysqld/.deps/item_row.Po +libmysqld/.deps/item_strfunc.Po +libmysqld/.deps/item_subselect.Po +libmysqld/.deps/item_sum.Po +libmysqld/.deps/item_timefunc.Po +libmysqld/.deps/item_uniq.Po +libmysqld/.deps/item_xmlfunc.Po +libmysqld/.deps/key.Po +libmysqld/.deps/lib_sql.Po +libmysqld/.deps/libmysql.Po +libmysqld/.deps/libmysqld.Po +libmysqld/.deps/lock.Po +libmysqld/.deps/log.Po +libmysqld/.deps/log_event.Po +libmysqld/.deps/my_decimal.Po +libmysqld/.deps/my_time.Po +libmysqld/.deps/my_user.Po +libmysqld/.deps/net_serv.Po +libmysqld/.deps/opt_range.Po +libmysqld/.deps/opt_sum.Po +libmysqld/.deps/pack.Po +libmysqld/.deps/parse_file.Po +libmysqld/.deps/partition_info.Po +libmysqld/.deps/password.Po +libmysqld/.deps/procedure.Po +libmysqld/.deps/protocol.Po +libmysqld/.deps/records.Po +libmysqld/.deps/rpl_filter.Po +libmysqld/.deps/rpl_injector.Po +libmysqld/.deps/set_var.Po +libmysqld/.deps/sp.Po +libmysqld/.deps/sp_cache.Po +libmysqld/.deps/sp_head.Po +libmysqld/.deps/sp_pcontext.Po +libmysqld/.deps/sp_rcontext.Po +libmysqld/.deps/spatial.Po +libmysqld/.deps/sql_acl.Po +libmysqld/.deps/sql_analyse.Po +libmysqld/.deps/sql_base.Po +libmysqld/.deps/sql_builtin.Po +libmysqld/.deps/sql_cache.Po +libmysqld/.deps/sql_class.Po +libmysqld/.deps/sql_crypt.Po +libmysqld/.deps/sql_cursor.Po +libmysqld/.deps/sql_db.Po +libmysqld/.deps/sql_delete.Po +libmysqld/.deps/sql_truncate.Po +libmysqld/.deps/sql_reload.Po +libmysqld/.deps/datadict.Po +libmysqld/.deps/sql_derived.Po +libmysqld/.deps/sql_do.Po +libmysqld/.deps/sql_error.Po +libmysqld/.deps/sql_handler.Po +libmysqld/.deps/sql_help.Po +libmysqld/.deps/sql_insert.Po +libmysqld/.deps/sql_lex.Po +libmysqld/.deps/sql_list.Po +libmysqld/.deps/sql_load.Po +libmysqld/.deps/sql_manager.Po +libmysqld/.deps/sql_map.Po +libmysqld/.deps/sql_parse.Po +libmysqld/.deps/sql_partition.Po +libmysqld/.deps/sql_plugin.Po +libmysqld/.deps/sql_prepare.Po +libmysqld/.deps/sql_rename.Po +libmysqld/.deps/sql_select.Po +libmysqld/.deps/sql_show.Po +libmysqld/.deps/sql_state.Po +libmysqld/.deps/sql_string.Po +libmysqld/.deps/sql_table.Po +libmysqld/.deps/sql_tablespace.Po +libmysqld/.deps/sql_test.Po +libmysqld/.deps/sql_trigger.Po +libmysqld/.deps/sql_udf.Po +libmysqld/.deps/sql_union.Po +libmysqld/.deps/sql_update.Po +libmysqld/.deps/sql_view.Po +libmysqld/.deps/sql_yacc.Po +libmysqld/.deps/stacktrace.Po +libmysqld/.deps/strfunc.Po +libmysqld/.deps/table.Po +libmysqld/.deps/thr_malloc.Po +libmysqld/.deps/time.Po +libmysqld/.deps/tztime.Po +libmysqld/.deps/uniques.Po +libmysqld/.deps/unireg.Po +libmysqld/backup_dir +libmysqld/client.c +libmysqld/client_settings.h +libmysqld/cmake_dummy.c +libmysqld/convert.cc +libmysqld/derror.cc +libmysqld/discover.cc +libmysqld/emb_qcache.cpp +libmysqld/errmsg.c +libmysqld/event.cc +libmysqld/event_data_objects.cc +libmysqld/event_db_repository.cc +libmysqld/event_executor.cc +libmysqld/event_queue.cc +libmysqld/event_scheduler.cc +libmysqld/event_timed.cc +libmysqld/events.cc +libmysqld/examples/.deps/completion_hash.Po +libmysqld/examples/.deps/mysql.Po +libmysqld/examples/.deps/mysql_client_test.Po +libmysqld/examples/.deps/mysqltest.Po +libmysqld/examples/.deps/readline.Po +libmysqld/examples/client_test.c +libmysqld/examples/client_test.cc +libmysqld/examples/completion_hash.cc +libmysqld/examples/completion_hash.h +libmysqld/examples/link_sources +libmysqld/examples/my_readline.h +libmysqld/examples/mysql +libmysqld/examples/mysql.cc +libmysqld/examples/mysql_client_test.c +libmysqld/examples/mysql_client_test_embedded +libmysqld/examples/mysqltest +libmysqld/examples/mysqltest.c +libmysqld/examples/mysqltest_embedded +libmysqld/examples/readline.cc +libmysqld/examples/sql_string.cc +libmysqld/examples/sql_string.h +libmysqld/examples/test-gdbinit +libmysqld/field.cc +libmysqld/field_conv.cc +libmysqld/filesort.cc +libmysqld/get_password.c +libmysqld/gstream.cc +libmysqld/ha_archive.cc +libmysqld/ha_berkeley.cc +libmysqld/ha_blackhole.cc +libmysqld/ha_example.cc +libmysqld/ha_federated.cc +libmysqld/ha_heap.cc +libmysqld/ha_innobase.cc +libmysqld/ha_innodb.cc +libmysqld/ha_isam.cc +libmysqld/ha_isammrg.cc +libmysqld/ha_myisam.cc +libmysqld/ha_myisammrg.cc +libmysqld/ha_ndbcluster.cc +libmysqld/ha_ndbcluster_binlog.cc +libmysqld/ha_ndbcluster_cond.cc +libmysqld/ha_partition.cc +libmysqld/ha_tina.cc +libmysqld/handler.cc +libmysqld/handlerton.cc +libmysqld/hash_filo.cc +libmysqld/hostname.cc +libmysqld/init.cc +libmysqld/item.cc +libmysqld/item_buff.cc +libmysqld/item_cmpfunc.cc +libmysqld/item_create.cc +libmysqld/item_func.cc +libmysqld/item_geofunc.cc +libmysqld/item_row.cc +libmysqld/item_strfunc.cc +libmysqld/item_subselect.cc +libmysqld/item_sum.cc +libmysqld/item_timefunc.cc +libmysqld/item_uniq.cc +libmysqld/key.cc +libmysqld/lex_hash.h +libmysqld/lib_sql.cpp +libmysqld/libmysql.c +libmysqld/link_sources +libmysqld/lock.cc +libmysqld/log.cc +libmysqld/log_event.cc +libmysqld/log_event_old.cc +libmysqld/md5.c +libmysqld/message.h +libmysqld/message.rc +libmysqld/mf_iocache.cc +libmysqld/mini_client.cc +libmysqld/my_decimal.cc +libmysqld/my_time.c +libmysqld/my_user.c +libmysqld/net_pkg.cc +libmysqld/net_serv.cc +libmysqld/opt_ft.cc +libmysqld/opt_range.cc +libmysqld/opt_sum.cc +libmysqld/pack.c +libmysqld/parse_file.cc +libmysqld/partition_info.cc +libmysqld/password.c +libmysqld/procedure.cc +libmysqld/protocol.cc +libmysqld/protocol_cursor.cc +libmysqld/records.cc +libmysqld/repl_failsafe.cc +libmysqld/rpl_filter.cc +libmysqld/rpl_handler.cc +libmysqld/rpl_injector.cc +libmysqld/rpl_record.cc +libmysqld/rpl_record_old.cc +libmysqld/rpl_utility.cc +libmysqld/scheduler.cc +libmysqld/set_var.cc +libmysqld/sha2.cc +libmysqld/simple-test +libmysqld/slave.cc +libmysqld/sp.cc +libmysqld/sp_cache.cc +libmysqld/sp_head.cc +libmysqld/sp_pcontext.cc +libmysqld/sp_rcontext.cc +libmysqld/spatial.cc +libmysqld/sql_acl.cc +libmysqld/sql_alloc_error_handler.cc +libmysqld/sql_analyse.cc +libmysqld/sql_base.cc +libmysqld/sql_builtin.cc +libmysqld/sql_cache.cc +libmysqld/sql_class.cc +libmysqld/sql_command +libmysqld/sql_connect.cc +libmysqld/sql_crypt.cc +libmysqld/sql_cursor.cc +libmysqld/sql_cursor.h +libmysqld/sql_db.cc +libmysqld/sql_delete.cc +libmysqld/sql_truncate.cc +libmysqld/sql_reload.cc +libmysqld/datadict.cc +libmysqld/sql_derived.cc +libmysqld/sql_do.cc +libmysqld/sql_error.cc +libmysqld/sql_handler.cc +libmysqld/sql_help.cc +libmysqld/sql_insert.cc +libmysqld/sql_lex.cc +libmysqld/sql_list.cc +libmysqld/sql_load.cc +libmysqld/sql_locale.cc +libmysqld/sql_manager.cc +libmysqld/sql_map.cc +libmysqld/sql_olap.cc +libmysqld/sql_parse.cc +libmysqld/sql_partition.cc +libmysqld/sql_plugin.cc +libmysqld/sql_prepare.cc +libmysqld/sql_profile.cc +libmysqld/sql_rename.cc +libmysqld/sql_repl.cc +libmysqld/sql_select.cc +libmysqld/sql_servers.cc +libmysqld/sql_show.cc +libmysqld/sql_state.c +libmysqld/sql_string.cc +libmysqld/sql_table.cc +libmysqld/sql_tablespace.cc +libmysqld/sql_test.cc +libmysqld/sql_trigger.cc +libmysqld/sql_udf.cc +libmysqld/sql_union.cc +libmysqld/sql_unions.cc +libmysqld/sql_update.cc +libmysqld/sql_view.cc +libmysqld/sql_yacc.cc +libmysqld/sql_yacc.cpp +libmysqld/sql_yacc.h +libmysqld/stacktrace.c +libmysqld/strfunc.cc +libmysqld/table.cc +libmysqld/thr_malloc.cc +libmysqld/sql_time.cc +libmysqld/tztime.cc +libmysqld/uniques.cc +libmysqld/unireg.cc +libmysqltest/*.ds? +libmysqltest/*.vcproj +libmysqltest/mytest.c +libtool +linked_client_sources +linked_include_sources +linked_libmysql_r_sources +linked_libmysql_sources +linked_libmysqld_sources +linked_libmysqldex_sources +linked_server_sources +linked_tools_sources +locked +ltmain.sh +man/*.1 +merge/*.ds? +merge/*.vcproj +missing +mit-pthreads/config.flags +mit-pthreads/include/bits +mit-pthreads/include/pthread/machdep.h +mit-pthreads/include/pthread/posix.h +mit-pthreads/include/sys +mit-pthreads/machdep.c +mit-pthreads/pg++ +mit-pthreads/pgcc +mit-pthreads/syscall.S +mkinstalldirs +my_print_defaults/*.ds? +my_print_defaults/*.vcproj +myisam/*.ds? +myisam/*.vcproj +myisam/FT1.MYD +myisam/FT1.MYI +myisam/ft_dump +myisam/ft_eval +myisam/ft_test1 +myisam/ftbench/data +myisam/ftbench/t +myisam/ftbench/var/* +myisam/mi_test1 +myisam/mi_test2 +myisam/mi_test3 +myisam/mi_test_all +myisam/myisam.log +myisam/myisam_ftdump +myisam/myisamchk +myisam/myisamlog +myisam/myisampack +myisam/rt_test +myisam/rt_test.MYD +myisam/rt_test.MYI +myisam/sp_test +myisam/test1.MYD +myisam/test1.MYI +myisam/test2.MYD +myisam/test2.MYI +myisam_ftdump/*.ds? +myisam_ftdump/*.vcproj +myisamchk/*.ds? +myisamchk/*.vcproj +myisamlog/*.ds? +myisamlog/*.vcproj +myisammrg/*.ds? +myisammrg/*.vcproj +myisampack/*.ds? +myisampack/*.vcproj +mysql-4.0.2-alpha-pc-linux-gnu-i686.tar.gz +mysql-4.0.2-alpha.tar.gz +mysql-4.1.8-win-src.zip +mysql-5.0.2-alpha.tar.gz +mysql-max-4.0.2-alpha-pc-linux-gnu-i686.tar.gz +mysql-test/*.ds? +mysql-test/*.vcproj +mysql-test/.DS_Store +mysql-test/collections/default.release +mysql-test/collections/default.release.done +mysql-test/funcs_1.log +mysql-test/funcs_1.tar +mysql-test/gmon.out +mysql-test/install_test_db +mysql-test/lib/My/SafeProcess/my_safe_process +mysql-test/lib/init_db.sql +mysql-test/linux_sys_vars.inc +mysql-test/load_sysvars.inc +mysql-test/mtr +mysql-test/mysql-test-run +mysql-test/mysql-test-gcov.err +mysql-test/mysql-test-gcov.msg +mysql-test/mysql-test-run-shell +mysql-test/mysql-test-run.log +mysql-test/mysql_test_run_new +mysql-test/ndb/ndbcluster +mysql-test/partitions.log +mysql-test/r/*.err +mysql-test/r/*.log +mysql-test/r/*.out +mysql-test/r/*.reject +mysql-test/r/index_merge_load.result +mysql-test/r/max_allowed_packet_func.result +mysql-test/r/rpl000001.eval +mysql-test/r/rpl000002.eval +mysql-test/r/rpl000014.eval +mysql-test/r/rpl000015.eval +mysql-test/r/rpl000016.eval +mysql-test/r/rpl_log.eval +mysql-test/r/slave-running.eval +mysql-test/r/slave-stopped.eval +mysql-test/r/tmp.result +mysql-test/reg.log +mysql-test/rpl.log +mysql-test/share/mysql +mysql-test/std_data/*.pem +mysql-test/suite/funcs_1.tar.gz +mysql-test/suite/funcs_1.tar.zip +mysql-test/suite/funcs_1/r/innodb_trig_03e.warnings +mysql-test/suite/funcs_1/r/innodb_views.warnings +mysql-test/suite/funcs_1/r/memory_trig_03e.warnings +mysql-test/suite/funcs_1/r/memory_views.warnings +mysql-test/suite/funcs_1/r/myisam_trig_03e.warnings +mysql-test/suite/funcs_1/r/myisam_views.warnings +mysql-test/suite/funcs_1/r/ndb_trig_03e.warnings +mysql-test/suite/funcs_1/r/ndb_views.warnings +mysql-test/suite/partitions/r/dif +mysql-test/suite/partitions/r/diff +mysql-test/suite/partitions/r/partition.result +mysql-test/suite/partitions/r/partition_bit_ndb.warnings +mysql-test/suite/partitions/r/partition_special_innodb.warnings +mysql-test/suite/partitions/r/partition_special_myisam.warnings +mysql-test/suite/partitions/r/partition_t55.out +mysql-test/suite/partitions/r/partition_t55.refout +mysql-test/suite/partitions/t/partition.test +mysql-test/t/index_merge.load +mysql-test/t/tmp.test +mysql-test/var +mysql-test/var/* +mysql-test/windows_sys_vars.inc +mysql.kdevprj +mysql.proj +sql_priv.h +mysqlbinlog/*.ds? +mysqlbinlog/*.vcproj +mysqlcheck/*.ds? +mysqlcheck/*.vcproj +mysqld.S +mysqld.sym +mysqldemb/*.ds? +mysqldemb/*.vcproj +mysqlserver/*.ds? +mysqlserver/*.vcproj +mysys/#mf_iocache.c# +mysys/*.ds? +mysys/*.vcproj +mysys/.deps/array.Po +mysys/.deps/base64.Po +mysys/.deps/charset-def.Po +mysys/.deps/charset.Po +mysys/.deps/checksum.Po +mysys/.deps/default.Po +mysys/.deps/default_modify.Po +mysys/.deps/errors.Po +mysys/.deps/hash.Po +mysys/.deps/list.Po +mysys/.deps/md5.Po +mysys/.deps/mf_brkhant.Po +mysys/.deps/mf_cache.Po +mysys/.deps/mf_dirname.Po +mysys/.deps/mf_fn_ext.Po +mysys/.deps/mf_format.Po +mysys/.deps/mf_getdate.Po +mysys/.deps/mf_iocache.Po +mysys/.deps/mf_iocache2.Po +mysys/.deps/mf_keycache.Po +mysys/.deps/mf_keycaches.Po +mysys/.deps/mf_loadpath.Po +mysys/.deps/mf_pack.Po +mysys/.deps/mf_path.Po +mysys/.deps/mf_qsort.Po +mysys/.deps/mf_qsort2.Po +mysys/.deps/mf_radix.Po +mysys/.deps/mf_same.Po +mysys/.deps/mf_sort.Po +mysys/.deps/mf_strip.Po +mysys/.deps/mf_tempdir.Po +mysys/.deps/mf_tempfile.Po +mysys/.deps/mf_unixpath.Po +mysys/.deps/mf_wcomp.Po +mysys/.deps/mf_wfile.Po +mysys/.deps/mulalloc.Po +mysys/.deps/my_access.Po +mysys/.deps/my_aes.Po +mysys/.deps/my_alarm.Po +mysys/.deps/my_alloc.Po +mysys/.deps/my_append.Po +mysys/.deps/my_atomic.Po +mysys/.deps/my_bit.Po +mysys/.deps/my_bitmap.Po +mysys/.deps/my_chsize.Po +mysys/.deps/my_clock.Po +mysys/.deps/my_compress.Po +mysys/.deps/my_copy.Po +mysys/.deps/my_crc32.Po +mysys/.deps/my_create.Po +mysys/.deps/my_delete.Po +mysys/.deps/my_div.Po +mysys/.deps/my_dup.Po +mysys/.deps/my_error.Po +mysys/.deps/my_file.Po +mysys/.deps/my_fopen.Po +mysys/.deps/my_fstream.Po +mysys/.deps/my_gethostbyname.Po +mysys/.deps/my_gethwaddr.Po +mysys/.deps/my_getncpus.Po +mysys/.deps/my_getopt.Po +mysys/.deps/my_getsystime.Po +mysys/.deps/my_getwd.Po +mysys/.deps/my_handler.Po +mysys/.deps/my_init.Po +mysys/.deps/my_largepage.Po +mysys/.deps/my_lib.Po +mysys/.deps/my_libwrap.Po +mysys/.deps/my_lock.Po +mysys/.deps/my_lockmem.Po +mysys/.deps/my_lread.Po +mysys/.deps/my_lwrite.Po +mysys/.deps/my_malloc.Po +mysys/.deps/my_memmem.Po +mysys/.deps/my_messnc.Po +mysys/.deps/my_mkdir.Po +mysys/.deps/my_mmap.Po +mysys/.deps/my_net.Po +mysys/.deps/my_netware.Po +mysys/.deps/my_new.Po +mysys/.deps/my_once.Po +mysys/.deps/my_open.Po +mysys/.deps/my_port.Po +mysys/.deps/my_pread.Po +mysys/.deps/my_pthread.Po +mysys/.deps/my_quick.Po +mysys/.deps/my_read.Po +mysys/.deps/my_realloc.Po +mysys/.deps/my_redel.Po +mysys/.deps/my_rename.Po +mysys/.deps/my_seek.Po +mysys/.deps/my_semaphore.Po +mysys/.deps/my_sleep.Po +mysys/.deps/my_static.Po +mysys/.deps/my_symlink.Po +mysys/.deps/my_symlink2.Po +mysys/.deps/my_sync.Po +mysys/.deps/my_thr_init.Po +mysys/.deps/my_vle.Po +mysys/.deps/my_windac.Po +mysys/.deps/my_write.Po +mysys/.deps/ptr_cmp.Po +mysys/.deps/queues.Po +mysys/.deps/rijndael.Po +mysys/.deps/safemalloc.Po +mysys/.deps/sha1.Po +mysys/.deps/string.Po +mysys/.deps/thr_alarm.Po +mysys/.deps/thr_lock.Po +mysys/.deps/thr_mutex.Po +mysys/.deps/thr_rwlock.Po +mysys/.deps/tree.Po +mysys/.deps/trie.Po +mysys/.deps/typelib.Po +mysys/getopt.c +mysys/getopt1.c +mysys/main.cc +mysys/my_new.cpp +mysys/raid.cpp +mysys/ste5KbMa +mysys/test_atomic +mysys/test_bitmap +mysys/test_charset +mysys/test_dir +mysys/test_gethwaddr +mysys/test_io_cache +mysys/test_thr_alarm +mysys/test_thr_lock +mysys/test_vsnprintf +mysys/testhash +ndb/bin/DbAsyncGenerator +ndb/bin/DbCreate +ndb/bin/acid +ndb/bin/async-lmc-bench-l-p10.sh +ndb/bin/async-lmc-bench-l.sh +ndb/bin/async-lmc-bench-p10.sh +ndb/bin/async-lmc-bench.sh +ndb/bin/atrt +ndb/bin/atrt-analyze-result.sh +ndb/bin/atrt-clear-result.sh +ndb/bin/atrt-gather-result.sh +ndb/bin/atrt-setup.sh +ndb/bin/bankCreator +ndb/bin/bankMakeGL +ndb/bin/bankSumAccounts +ndb/bin/bankTimer +ndb/bin/bankTransactionMaker +ndb/bin/bankValidateAllGLs +ndb/bin/basicTransporterTest +ndb/bin/benchronja +ndb/bin/bulk_copy +ndb/bin/copy_tab +ndb/bin/create_all_tabs +ndb/bin/create_index +ndb/bin/create_tab +ndb/bin/delete_all +ndb/bin/desc +ndb/bin/drop_all_tabs +ndb/bin/drop_index +ndb/bin/drop_tab +ndb/bin/flexAsynch +ndb/bin/flexBench +ndb/bin/flexHammer +ndb/bin/flexScan +ndb/bin/flexTT +ndb/bin/hugoCalculator +ndb/bin/hugoFill +ndb/bin/hugoLoad +ndb/bin/hugoLockRecords +ndb/bin/hugoPkDelete +ndb/bin/hugoPkRead +ndb/bin/hugoPkReadRecord +ndb/bin/hugoPkUpdate +ndb/bin/hugoScanRead +ndb/bin/hugoScanUpdate +ndb/bin/index +ndb/bin/index2 +ndb/bin/initronja +ndb/bin/interpreterInTup +ndb/bin/list_tables +ndb/bin/make-config.sh +ndb/bin/mgmtclient +ndb/bin/mgmtsrvr +ndb/bin/mkconfig +ndb/bin/ndb +ndb/bin/ndb_cpcc +ndb/bin/ndb_cpcd +ndb/bin/ndb_rep +ndb/bin/ndbsql +ndb/bin/newton_basic +ndb/bin/newton_br +ndb/bin/newton_pb +ndb/bin/newton_perf +ndb/bin/perfTransporterTest +ndb/bin/printConfig +ndb/bin/printSchemafile +ndb/bin/printSysfile +ndb/bin/redoLogFileReader +ndb/bin/restart +ndb/bin/restarter +ndb/bin/restarter2 +ndb/bin/restarts +ndb/bin/restore +ndb/bin/select_all +ndb/bin/select_count +ndb/bin/telco +ndb/bin/testBackup +ndb/bin/testBank +ndb/bin/testBasic +ndb/bin/testBasicAsynch +ndb/bin/testCopy +ndb/bin/testDataBuffers +ndb/bin/testDict +ndb/bin/testGrep +ndb/bin/testGrepVerify +ndb/bin/testIndex +ndb/bin/testInterpreter +ndb/bin/testKernelDataBuffer +ndb/bin/testLongSig +ndb/bin/testMgm +ndb/bin/testMgmapi +ndb/bin/testNdbApi +ndb/bin/testNodeRestart +ndb/bin/testOIBasic +ndb/bin/testOdbcDriver +ndb/bin/testOperations +ndb/bin/testRestartGci +ndb/bin/testScan +ndb/bin/testScanInterpreter +ndb/bin/testSimplePropertiesSection +ndb/bin/testSystemRestart +ndb/bin/testTimeout +ndb/bin/testTransactions +ndb/bin/test_cpcd +ndb/bin/test_event +ndb/bin/verify_index +ndb/bin/waiter +ndb/config/autom4te.cache/* +ndb/config/config.mk +ndb/examples/ndbapi_example1/ndbapi_example1 +ndb/examples/ndbapi_example2/ndbapi_example2 +ndb/examples/ndbapi_example3/ndbapi_example3 +ndb/examples/ndbapi_example5/ndbapi_example5 +ndb/examples/select_all/select_all +ndb/include/ndb_global.h +ndb/include/ndb_types.h +ndb/include/ndb_version.h +ndb/lib/libMGM_API.so +ndb/lib/libNDB_API.so +ndb/lib/libNDB_ODBC.so +ndb/lib/libNEWTON_API.so +ndb/lib/libNEWTON_BASICTEST_COMMON.so +ndb/lib/libREP_API.so +ndb/lib/libndbclient.so +ndb/lib/libndbclient_extra.so +ndb/src/common/debugger/libtrace.dsp +ndb/src/common/debugger/signaldata/libsignaldataprint.dsp +ndb/src/common/logger/liblogger.dsp +ndb/src/common/mgmcommon/libmgmsrvcommon.dsp +ndb/src/common/mgmcommon/printConfig/*.d +ndb/src/common/portlib/libportlib.dsp +ndb/src/common/transporter/libtransporter.dsp +ndb/src/common/util/libgeneral.dsp +ndb/src/common/util/testBitmask.cpp +ndb/src/cw/cpcd/ndb_cpcd +ndb/src/dummy.cpp +ndb/src/kernel/blocks/backup/libbackup.dsp +ndb/src/kernel/blocks/backup/restore/ndb_restore +ndb/src/kernel/blocks/cmvmi/libcmvmi.dsp +ndb/src/kernel/blocks/dbacc/libdbacc.dsp +ndb/src/kernel/blocks/dbdict/libdbdict.dsp +ndb/src/kernel/blocks/dbdih/libdbdih.dsp +ndb/src/kernel/blocks/dblqh/libdblqh.dsp +ndb/src/kernel/blocks/dbtc/libdbtc.dsp +ndb/src/kernel/blocks/dbtup/libdbtup.dsp +ndb/src/kernel/blocks/dbtux/libdbtux.dsp +ndb/src/kernel/blocks/dbutil/libdbutil.dsp +ndb/src/kernel/blocks/grep/libgrep.dsp +ndb/src/kernel/blocks/ndbcntr/libndbcntr.dsp +ndb/src/kernel/blocks/ndbfs/libndbfs.dsp +ndb/src/kernel/blocks/qmgr/libqmgr.dsp +ndb/src/kernel/blocks/suma/libsuma.dsp +ndb/src/kernel/blocks/trix/libtrix.dsp +ndb/src/kernel/error/liberror.dsp +ndb/src/kernel/ndbd +ndb/src/kernel/ndbd.dsp +ndb/src/kernel/vm/libkernel.dsp +ndb/src/libndb.ver +ndb/src/libndbclient.dsp +ndb/src/mgmapi/libmgmapi.dsp +ndb/src/mgmclient/libndbmgmclient.dsp +ndb/src/mgmclient/ndb_mgm +ndb/src/mgmclient/ndb_mgm.dsp +ndb/src/mgmclient/test_cpcd/*.d +ndb/src/mgmsrv/ndb_mgmd +ndb/src/mgmsrv/ndb_mgmd.dsp +ndb/src/ndbapi/libndbapi.dsp +ndb/test/ndbapi/bank/bankCreator +ndb/test/ndbapi/bank/bankMakeGL +ndb/test/ndbapi/bank/bankSumAccounts +ndb/test/ndbapi/bank/bankTimer +ndb/test/ndbapi/bank/bankTransactionMaker +ndb/test/ndbapi/bank/bankValidateAllGLs +ndb/test/ndbapi/bank/testBank +ndb/test/ndbapi/create_all_tabs +ndb/test/ndbapi/create_tab +ndb/test/ndbapi/drop_all_tabs +ndb/test/ndbapi/flexAsynch +ndb/test/ndbapi/flexBench +ndb/test/ndbapi/flexBench.dsp +ndb/test/ndbapi/flexHammer +ndb/test/ndbapi/flexTT +ndb/test/ndbapi/testBackup +ndb/test/ndbapi/testBasic +ndb/test/ndbapi/testBasic.dsp +ndb/test/ndbapi/testBasicAsynch +ndb/test/ndbapi/testBlobs +ndb/test/ndbapi/testBlobs.dsp +ndb/test/ndbapi/testDataBuffers +ndb/test/ndbapi/testDeadlock +ndb/test/ndbapi/testDict +ndb/test/ndbapi/testIndex +ndb/test/ndbapi/testMgm +ndb/test/ndbapi/testNdbApi +ndb/test/ndbapi/testNodeRestart +ndb/test/ndbapi/testOIBasic +ndb/test/ndbapi/testOperations +ndb/test/ndbapi/testRestartGci +ndb/test/ndbapi/testSRBank +ndb/test/ndbapi/testScan +ndb/test/ndbapi/testScan.dsp +ndb/test/ndbapi/testScanInterpreter +ndb/test/ndbapi/testScanPerf +ndb/test/ndbapi/testSystemRestart +ndb/test/ndbapi/testTimeout +ndb/test/ndbapi/testTransactions +ndb/test/ndbapi/test_event +ndb/test/run-test/atrt +ndb/test/src/libNDBT.dsp +ndb/test/tools/copy_tab +ndb/test/tools/create_index +ndb/test/tools/hugoCalculator +ndb/test/tools/hugoFill +ndb/test/tools/hugoLoad +ndb/test/tools/hugoLockRecords +ndb/test/tools/hugoPkDelete +ndb/test/tools/hugoPkRead +ndb/test/tools/hugoPkReadRecord +ndb/test/tools/hugoPkUpdate +ndb/test/tools/hugoScanRead +ndb/test/tools/hugoScanUpdate +ndb/test/tools/ndb_cpcc +ndb/test/tools/restart +ndb/test/tools/verify_index +ndb/tools/ndb_config +ndb/tools/ndb_delete_all +ndb/tools/ndb_delete_all.dsp +ndb/tools/ndb_desc +ndb/tools/ndb_desc.dsp +ndb/tools/ndb_drop_index +ndb/tools/ndb_drop_index.dsp +ndb/tools/ndb_drop_table +ndb/tools/ndb_drop_table.dsp +ndb/tools/ndb_restore +ndb/tools/ndb_select_all +ndb/tools/ndb_select_all.dsp +ndb/tools/ndb_select_count +ndb/tools/ndb_select_count.dsp +ndb/tools/ndb_show_tables +ndb/tools/ndb_show_tables.dsp +ndb/tools/ndb_test_platform +ndb/tools/ndb_waiter +ndb/tools/ndb_waiter.dsp +ndbcluster-1186 +ndbcluster-1186/SCCS +ndbcluster-1186/config.ini +ndbcluster-1186/ndb_1.pid +ndbcluster-1186/ndb_1_out.log +ndbcluster-1186/ndb_1_signal.log +ndbcluster-1186/ndb_2.pid +ndbcluster-1186/ndb_2_out.log +ndbcluster-1186/ndb_2_signal.log +ndbcluster-1186/ndb_3.pid +ndbcluster-1186/ndb_3_cluster.log +ndbcluster-1186/ndb_3_out.log +ndbcluster-1186/ndbcluster.pid +netware/.deps/libmysqlmain.Po +netware/.deps/my_manage.Po +netware/.deps/mysql_install_db.Po +netware/.deps/mysql_test_run.Po +netware/.deps/mysqld_safe.Po +netware/init_db.sql +netware/libmysql.imp +netware/test_db.sql +pack_isam/*.ds? +perror/*.ds? +perror/*.vcproj +plugin/fulltext/.deps/mypluglib_la-plugin_example.Plo +plugin/fulltext/.libs/mypluglib.lai +plugin/fulltext/.libs/mypluglib.so.0 +plugin/fulltext/.libs/mypluglib.so.0.0.0 +pstack/.deps/bucomm.Po +pstack/.deps/debug.Po +pstack/.deps/filemode.Po +pstack/.deps/ieee.Po +pstack/.deps/linuxthreads.Po +pstack/.deps/pstack.Po +pstack/.deps/rddbg.Po +pstack/.deps/stabs.Po +pull.log +regex/*.ds? +regex/*.vcproj +regex/.deps/debug.Po +regex/.deps/main.Po +regex/.deps/regcomp.Po +regex/.deps/regerror.Po +regex/.deps/regexec.Po +regex/.deps/regfree.Po +regex/.deps/reginit.Po +regex/.deps/split.Po +regex/re +repl-tests/test-repl-ts/repl-timestamp.master.reject +repl-tests/test-repl/foo-dump-slave.master. +repl-tests/test-repl/sum-wlen-slave.master. +repl-tests/test-repl/sum-wlen-slave.master.re +repl-tests/test-repl/sum-wlen-slave.master.reje +replace/*.ds? +replace/*.vcproj +scripts/comp_sql +scripts/fill_func_tables +scripts/fill_func_tables.sql +scripts/fill_help_tables +scripts/fill_help_tables.sql +scripts/make_binary_distribution +scripts/make_sharedlib_distribution +scripts/make_win_binary_distribution +scripts/make_win_src_distribution +scripts/make_win_src_distribution_old +scripts/msql2mysql +scripts/mysql_config +scripts/mysql_convert_table_format +scripts/mysql_create_system_tables +scripts/mysql_explain_log +scripts/mysql_find_rows +scripts/mysql_fix_extensions +scripts/mysql_fix_privilege_tables +scripts/mysql_fix_privilege_tables.sql +scripts/mysql_fix_privilege_tables.sql.rule +scripts/mysql_fix_privilege_tables_sql.c +scripts/mysql_fix_privilege_tables_sql.c.rule +scripts/mysql_install_db +scripts/mysql_secure_installation +scripts/mysql_setpermission +scripts/mysql_tableinfo +scripts/mysql_upgrade +scripts/mysql_upgrade_shell +scripts/mysql_zap +scripts/mysqlaccess +scripts/mysqlbug +scripts/mysqld_multi +scripts/mysqld_safe +scripts/mysqldumpslow +scripts/mysqlhotcopy +scripts/mysqlhotcopy.sh.rej +scripts/safe_mysqld +select_test +server-tools/instance-manager/.deps/buffer.Po +server-tools/instance-manager/.deps/command.Po +server-tools/instance-manager/.deps/commands.Po +server-tools/instance-manager/.deps/guardian.Po +server-tools/instance-manager/.deps/instance.Po +server-tools/instance-manager/.deps/instance_map.Po +server-tools/instance-manager/.deps/instance_options.Po +server-tools/instance-manager/.deps/liboptions_la-options.Plo +server-tools/instance-manager/.deps/liboptions_la-priv.Plo +server-tools/instance-manager/.deps/listener.Po +server-tools/instance-manager/.deps/log.Po +server-tools/instance-manager/.deps/manager.Po +server-tools/instance-manager/.deps/messages.Po +server-tools/instance-manager/.deps/mysql_connection.Po +server-tools/instance-manager/.deps/mysqlmanager.Po +server-tools/instance-manager/.deps/net_serv.Po +server-tools/instance-manager/.deps/parse.Po +server-tools/instance-manager/.deps/parse_output.Po +server-tools/instance-manager/.deps/protocol.Po +server-tools/instance-manager/.deps/thread_registry.Po +server-tools/instance-manager/.deps/user_management_commands.Po +server-tools/instance-manager/.deps/user_map.Po +server-tools/instance-manager/buffer.cpp +server-tools/instance-manager/client.c +server-tools/instance-manager/client_settings.h +server-tools/instance-manager/command.cpp +server-tools/instance-manager/commands.cpp +server-tools/instance-manager/errmsg.c +server-tools/instance-manager/guardian.cpp +server-tools/instance-manager/instance.cpp +server-tools/instance-manager/instance_map.cpp +server-tools/instance-manager/instance_options.cpp +server-tools/instance-manager/listener.cpp +server-tools/instance-manager/log.cpp +server-tools/instance-manager/manager.cpp +server-tools/instance-manager/messages.cpp +server-tools/instance-manager/mysql_connection.cpp +server-tools/instance-manager/mysqlmanager +server-tools/instance-manager/mysqlmanager.cpp +server-tools/instance-manager/net_serv.cc +server-tools/instance-manager/options.cpp +server-tools/instance-manager/parse.cpp +server-tools/instance-manager/parse_output.cpp +server-tools/instance-manager/priv.cpp +server-tools/instance-manager/protocol.cpp +server-tools/instance-manager/thr_alarm.c +server-tools/instance-manager/thread_registry.cpp +server-tools/instance-manager/user_map.cpp +sql-bench/Results-linux/ATIS-mysql_bdb-Linux_2.2.14_my_SMP_i686 +sql-bench/bench-count-distinct +sql-bench/bench-init.pl +sql-bench/compare-results +sql-bench/compare-results-all +sql-bench/copy-db +sql-bench/crash-me +sql-bench/gif/* +sql-bench/graph-compare-results +sql-bench/innotest1 +sql-bench/innotest1a +sql-bench/innotest1b +sql-bench/innotest2 +sql-bench/innotest2a +sql-bench/innotest2b +sql-bench/output/* +sql-bench/run-all-tests +sql-bench/server-cfg +sql-bench/template.html +sql-bench/test-ATIS +sql-bench/test-alter-table +sql-bench/test-big-tables +sql-bench/test-connect +sql-bench/test-create +sql-bench/test-insert +sql-bench/test-select +sql-bench/test-transactions +sql-bench/test-wisconsin +sql/*.cpp +sql/*.ds? +sql/*.def +sql/*.vcproj +sql/.deps/client.Po +sql/.deps/derror.Po +sql/.deps/des_key_file.Po +sql/.deps/discover.Po +sql/.deps/event_data_objects.Po +sql/.deps/event_db_repository.Po +sql/.deps/event_queue.Po +sql/.deps/event_scheduler.Po +sql/.deps/events.Po +sql/.deps/field.Po +sql/.deps/field_conv.Po +sql/.deps/filesort.Po +sql/.deps/gen_lex_hash.Po +sql/.deps/gstream.Po +sql/.deps/ha_berkeley.Po +sql/.deps/ha_federated.Po +sql/.deps/ha_heap.Po +sql/.deps/ha_innodb.Po +sql/.deps/ha_myisam.Po +sql/.deps/ha_myisammrg.Po +sql/.deps/ha_ndbcluster.Po +sql/.deps/ha_ndbcluster_binlog.Po +sql/.deps/ha_partition.Po +sql/.deps/handler.Po +sql/.deps/hash_filo.Po +sql/.deps/hostname.Po +sql/.deps/init.Po +sql/.deps/item.Po +sql/.deps/item_buff.Po +sql/.deps/item_cmpfunc.Po +sql/.deps/item_create.Po +sql/.deps/item_func.Po +sql/.deps/item_geofunc.Po +sql/.deps/item_row.Po +sql/.deps/item_strfunc.Po +sql/.deps/item_subselect.Po +sql/.deps/item_sum.Po +sql/.deps/item_timefunc.Po +sql/.deps/item_uniq.Po +sql/.deps/item_xmlfunc.Po +sql/.deps/key.Po +sql/.deps/lock.Po +sql/.deps/log.Po +sql/.deps/log_event.Po +sql/.deps/mf_iocache.Po +sql/.deps/mini_client_errors.Po +sql/.deps/my_decimal.Po +sql/.deps/my_lock.Po +sql/.deps/my_time.Po +sql/.deps/my_user.Po +sql/.deps/mysql_tzinfo_to_sql.Po +sql/.deps/mysqld.Po +sql/.deps/net_serv.Po +sql/.deps/opt_range.Po +sql/.deps/opt_sum.Po +sql/.deps/pack.Po +sql/.deps/parse_file.Po +sql/.deps/partition_info.Po +sql/.deps/password.Po +sql/.deps/procedure.Po +sql/.deps/protocol.Po +sql/.deps/records.Po +sql/.deps/repl_failsafe.Po +sql/.deps/rpl_filter.Po +sql/.deps/rpl_injector.Po +sql/.deps/rpl_tblmap.Po +sql/.deps/set_var.Po +sql/.deps/slave.Po +sql/.deps/sp.Po +sql/.deps/sp_cache.Po +sql/.deps/sp_head.Po +sql/.deps/sp_pcontext.Po +sql/.deps/sp_rcontext.Po +sql/.deps/spatial.Po +sql/.deps/sql_acl.Po +sql/.deps/sql_analyse.Po +sql/.deps/sql_base.Po +sql/.deps/sql_binlog.Po +sql/.deps/sql_builtin.Po +sql/.deps/sql_cache.Po +sql/.deps/sql_class.Po +sql/.deps/sql_client.Po +sql/.deps/sql_crypt.Po +sql/.deps/sql_cursor.Po +sql/.deps/sql_db.Po +sql/.deps/sql_delete.Po +sql/.deps/sql_truncate.Po +sql/.deps/sql_reload.Po +sql/.deps/datadict.Po +sql/.deps/sql_derived.Po +sql/.deps/sql_do.Po +sql/.deps/sql_error.Po +sql/.deps/sql_handler.Po +sql/.deps/sql_help.Po +sql/.deps/sql_insert.Po +sql/.deps/sql_lex.Po +sql/.deps/sql_list.Po +sql/.deps/sql_load.Po +sql/.deps/sql_manager.Po +sql/.deps/sql_map.Po +sql/.deps/sql_olap.Po +sql/.deps/sql_parse.Po +sql/.deps/sql_partition.Po +sql/.deps/sql_plugin.Po +sql/.deps/sql_prepare.Po +sql/.deps/sql_rename.Po +sql/.deps/sql_repl.Po +sql/.deps/sql_select.Po +sql/.deps/sql_show.Po +sql/.deps/sql_state.Po +sql/.deps/sql_string.Po +sql/.deps/sql_table.Po +sql/.deps/sql_tablespace.Po +sql/.deps/sql_test.Po +sql/.deps/sql_trigger.Po +sql/.deps/sql_udf.Po +sql/.deps/sql_union.Po +sql/.deps/sql_update.Po +sql/.deps/sql_view.Po +sql/.deps/sql_yacc.Po +sql/.deps/stacktrace.Po +sql/.deps/strfunc.Po +sql/.deps/table.Po +sql/.deps/thr_malloc.Po +sql/.deps/time.Po +sql/.deps/tztime.Po +sql/.deps/udf_example.Plo +sql/.deps/uniques.Po +sql/.deps/unireg.Po +sql/.gdbinit +sql/.libs/udf_example.lai +sql/.libs/udf_example.so.0 +sql/.libs/udf_example.so.0.0.0 +sql/client.c +sql/cmake_dummy.cc +sql/Doxyfile +sql/cscope.out +sql/f.c +sql/gen_lex_hash +sql/gmon.out +sql/handlerton.cc +sql/html +sql/latex +sql/lex_hash.h +sql/lex_hash.h.rule +sql/link_sources +sql/max/* +sql/message.h +sql/message.mc +sql/message.rc +sql/mini_client_errors.c +sql/my_time.c +sql/my_user.c +sql/mysql_tzinfo_to_sql +sql/mysql_tzinfo_to_sql.cc +sql/mysql_tzinfo_to_sql_tztime.cc +sql/mysqlbinlog +sql/mysqld +sql/mysqld-purecov +sql/mysqld-purify +sql/mysqld-quantify +sql/new.cc +sql/pack.c +sql/safe_to_cache_query.txt +sql/share/*.sys +sql/share/charsets/gmon.out +sql/share/fixerrmsg.pl +sql/share/gmon.out +sql/share/iso639-2.txt +sql/share/mysql +sql/share/norwegian-ny/errmsg.sys +sql/share/norwegian/errmsg.sys +sql/sql_builtin.cc +sql/sql_select.cc.orig +sql/sql_yacc.cc +sql/sql_yacc.h +sql/sql_yacc.h.rule +sql/sql_yacc.output +sql/sql_yacc.yy.orig +sql/test_time +sql/udf_example.so +sql_error.cc +sql_prepare.cc +stamp-h +stamp-h.in +stamp-h1 +stamp-h1.in +stamp-h2 +stamp-h2.in +stamp-h3 +stamp-h4 +start_mysqld.sh +storage/archive/.deps/archive_test-archive_test.Po +storage/archive/.deps/archive_test-azio.Po +storage/archive/.deps/ha_archive_la-azio.Plo +storage/archive/.deps/ha_archive_la-ha_archive.Plo +storage/archive/.deps/libarchive_a-azio.Po +storage/archive/.deps/libarchive_a-ha_archive.Po +storage/archive/archive_reader +storage/archive/archive_test +storage/bdb/*.ds? +storage/bdb/*.vcproj +storage/bdb/README +storage/bdb/btree/btree_auto.c +storage/bdb/btree/btree_autop.c +storage/bdb/build_unix/* +storage/bdb/build_vxworks/BerkeleyDB20.wpj +storage/bdb/build_vxworks/BerkeleyDB20small.wpj +storage/bdb/build_vxworks/BerkeleyDB22.wpj +storage/bdb/build_vxworks/BerkeleyDB22small.wpj +storage/bdb/build_vxworks/db.h +storage/bdb/build_vxworks/db_config.h +storage/bdb/build_vxworks/db_config_small.h +storage/bdb/build_vxworks/db_deadlock/db_deadlock20.wpj +storage/bdb/build_vxworks/db_deadlock/db_deadlock22.wpj +storage/bdb/build_vxworks/db_int.h +storage/bdb/build_vxworks/dbdemo/dbdemo.c +storage/bdb/build_vxworks/dbdemo/dbdemo20.wpj +storage/bdb/build_vxworks/dbdemo/dbdemo22.wpj +storage/bdb/build_win32/*.dsp +storage/bdb/build_win32/*.h +storage/bdb/build_win32/db.h +storage/bdb/build_win32/db_archive.dsp +storage/bdb/build_win32/db_checkpoint.dsp +storage/bdb/build_win32/db_config.h +storage/bdb/build_win32/db_cxx.h +storage/bdb/build_win32/db_deadlock.dsp +storage/bdb/build_win32/db_dll.dsp +storage/bdb/build_win32/db_dump.dsp +storage/bdb/build_win32/db_int.h +storage/bdb/build_win32/db_java.dsp +storage/bdb/build_win32/db_load.dsp +storage/bdb/build_win32/db_perf.dsp +storage/bdb/build_win32/db_printlog.dsp +storage/bdb/build_win32/db_recover.dsp +storage/bdb/build_win32/db_stat.dsp +storage/bdb/build_win32/db_static.dsp +storage/bdb/build_win32/db_tcl.dsp +storage/bdb/build_win32/db_test.dsp +storage/bdb/build_win32/db_upgrade.dsp +storage/bdb/build_win32/db_verify.dsp +storage/bdb/build_win32/ex_access.dsp +storage/bdb/build_win32/ex_btrec.dsp +storage/bdb/build_win32/ex_env.dsp +storage/bdb/build_win32/ex_lock.dsp +storage/bdb/build_win32/ex_mpool.dsp +storage/bdb/build_win32/ex_tpcb.dsp +storage/bdb/build_win32/excxx_access.dsp +storage/bdb/build_win32/excxx_btrec.dsp +storage/bdb/build_win32/excxx_env.dsp +storage/bdb/build_win32/excxx_lock.dsp +storage/bdb/build_win32/excxx_mpool.dsp +storage/bdb/build_win32/excxx_tpcb.dsp +storage/bdb/build_win32/include.tcl +storage/bdb/build_win32/libdb.def +storage/bdb/build_win32/libdb.rc +storage/bdb/build_win64/*.dsp +storage/bdb/build_win64/*.dsw +storage/bdb/build_win64/*.h +storage/bdb/db/crdel_auto.c +storage/bdb/db/crdel_autop.c +storage/bdb/db/db_auto.c +storage/bdb/db/db_autop.c +storage/bdb/dbinc_auto/*.* +storage/bdb/dbreg/dbreg_auto.c +storage/bdb/dbreg/dbreg_autop.c +storage/bdb/dist/autom4te-2.53.cache/* +storage/bdb/dist/autom4te-2.53.cache/output.0 +storage/bdb/dist/autom4te-2.53.cache/requests +storage/bdb/dist/autom4te-2.53.cache/traces.0 +storage/bdb/dist/autom4te.cache/* +storage/bdb/dist/autom4te.cache/output.0 +storage/bdb/dist/autom4te.cache/requests +storage/bdb/dist/autom4te.cache/traces.0 +storage/bdb/dist/config.hin +storage/bdb/dist/configure +storage/bdb/dist/tags +storage/bdb/dist/template/db_server_proc +storage/bdb/dist/template/gen_client_ret +storage/bdb/dist/template/rec_btree +storage/bdb/dist/template/rec_crdel +storage/bdb/dist/template/rec_db +storage/bdb/dist/template/rec_dbreg +storage/bdb/dist/template/rec_fileops +storage/bdb/dist/template/rec_hash +storage/bdb/dist/template/rec_log +storage/bdb/dist/template/rec_qam +storage/bdb/dist/template/rec_txn +storage/bdb/examples_c/ex_apprec/ex_apprec_auto.c +storage/bdb/examples_c/ex_apprec/ex_apprec_auto.h +storage/bdb/examples_c/ex_apprec/ex_apprec_template +storage/bdb/examples_java +storage/bdb/fileops/fileops_auto.c +storage/bdb/fileops/fileops_autop.c +storage/bdb/hash/hash_auto.c +storage/bdb/hash/hash_autop.c +storage/bdb/include/btree_auto.h +storage/bdb/include/btree_ext.h +storage/bdb/include/clib_ext.h +storage/bdb/include/common_ext.h +storage/bdb/include/crdel_auto.h +storage/bdb/include/db_auto.h +storage/bdb/include/db_ext.h +storage/bdb/include/db_server.h +storage/bdb/include/env_ext.h +storage/bdb/include/gen_client_ext.h +storage/bdb/include/gen_server_ext.h +storage/bdb/include/hash_auto.h +storage/bdb/include/hash_ext.h +storage/bdb/include/lock_ext.h +storage/bdb/include/log_auto.h +storage/bdb/include/log_ext.h +storage/bdb/include/mp_ext.h +storage/bdb/include/mutex_ext.h +storage/bdb/include/os_ext.h +storage/bdb/include/qam_auto.h +storage/bdb/include/qam_ext.h +storage/bdb/include/rpc_client_ext.h +storage/bdb/include/rpc_server_ext.h +storage/bdb/include/tcl_ext.h +storage/bdb/include/txn_auto.h +storage/bdb/include/txn_ext.h +storage/bdb/include/xa_ext.h +storage/bdb/java/src/com/sleepycat/db/Db.java +storage/bdb/java/src/com/sleepycat/db/DbBtreeStat.java +storage/bdb/java/src/com/sleepycat/db/DbConstants.java +storage/bdb/java/src/com/sleepycat/db/DbHashStat.java +storage/bdb/java/src/com/sleepycat/db/DbLockStat.java +storage/bdb/java/src/com/sleepycat/db/DbLogStat.java +storage/bdb/java/src/com/sleepycat/db/DbMpoolFStat.java +storage/bdb/java/src/com/sleepycat/db/DbQueueStat.java +storage/bdb/java/src/com/sleepycat/db/DbRepStat.java +storage/bdb/java/src/com/sleepycat/db/DbTxnStat.java +storage/bdb/libdb_java/java_stat_auto.c +storage/bdb/libdb_java/java_stat_auto.h +storage/bdb/libdb_java/java_util.i +storage/bdb/log/log_auto.c +storage/bdb/qam/qam_auto.c +storage/bdb/qam/qam_autop.c +storage/bdb/rep/rep_auto.c +storage/bdb/rep/rep_autop.c +storage/bdb/rpc_client/db_server_clnt.c +storage/bdb/rpc_client/gen_client.c +storage/bdb/rpc_server/c/db_server_proc.c +storage/bdb/rpc_server/c/db_server_proc.sed +storage/bdb/rpc_server/c/db_server_svc.c +storage/bdb/rpc_server/c/db_server_xdr.c +storage/bdb/rpc_server/c/gen_db_server.c +storage/bdb/rpc_server/db_server.x +storage/bdb/rpc_server/db_server_proc.sed +storage/bdb/rpc_server/db_server_svc.c +storage/bdb/rpc_server/db_server_xdr.c +storage/bdb/rpc_server/gen_db_server.c +storage/bdb/test/TESTS +storage/bdb/test/include.tcl +storage/bdb/test/logtrack.list +storage/bdb/txn/txn_auto.c +storage/bdb/txn/txn_autop.c +storage/blackhole/.deps/ha_blackhole_la-ha_blackhole.Plo +storage/blackhole/.deps/libblackhole_a-ha_blackhole.Po +storage/csv/.deps/ha_csv_la-ha_tina.Plo +storage/csv/.deps/libcsv_a-ha_tina.Po +storage/example/.deps/ha_example_la-ha_example.Plo +storage/example/.deps/libexample_a-ha_example.Po +storage/heap/.deps/_check.Po +storage/heap/.deps/_rectest.Po +storage/heap/.deps/hp_block.Po +storage/heap/.deps/hp_clear.Po +storage/heap/.deps/hp_close.Po +storage/heap/.deps/hp_create.Po +storage/heap/.deps/hp_delete.Po +storage/heap/.deps/hp_extra.Po +storage/heap/.deps/hp_hash.Po +storage/heap/.deps/hp_info.Po +storage/heap/.deps/hp_open.Po +storage/heap/.deps/hp_panic.Po +storage/heap/.deps/hp_rename.Po +storage/heap/.deps/hp_rfirst.Po +storage/heap/.deps/hp_rkey.Po +storage/heap/.deps/hp_rlast.Po +storage/heap/.deps/hp_rnext.Po +storage/heap/.deps/hp_rprev.Po +storage/heap/.deps/hp_rrnd.Po +storage/heap/.deps/hp_rsame.Po +storage/heap/.deps/hp_scan.Po +storage/heap/.deps/hp_static.Po +storage/heap/.deps/hp_test1.Po +storage/heap/.deps/hp_test2.Po +storage/heap/.deps/hp_update.Po +storage/heap/.deps/hp_write.Po +storage/heap/hp_test1 +storage/heap/hp_test2 +storage/innobase/autom4te-2.53.cache/* +storage/innobase/autom4te-2.53.cache/output.0 +storage/innobase/autom4te-2.53.cache/requests +storage/innobase/autom4te-2.53.cache/traces.0 +storage/innobase/autom4te.cache/* +storage/innobase/autom4te.cache/output.0 +storage/innobase/autom4te.cache/requests +storage/innobase/autom4te.cache/traces.0 +storage/innobase/btr/.deps/btr0btr.Po +storage/innobase/btr/.deps/btr0cur.Po +storage/innobase/btr/.deps/btr0pcur.Po +storage/innobase/btr/.deps/btr0sea.Po +storage/innobase/buf/.deps/buf0buf.Po +storage/innobase/buf/.deps/buf0flu.Po +storage/innobase/buf/.deps/buf0lru.Po +storage/innobase/buf/.deps/buf0rea.Po +storage/innobase/configure.lineno +storage/innobase/conftest.s1 +storage/innobase/conftest.subs +storage/innobase/data/.deps/data0data.Po +storage/innobase/data/.deps/data0type.Po +storage/innobase/dict/.deps/dict0boot.Po +storage/innobase/dict/.deps/dict0crea.Po +storage/innobase/dict/.deps/dict0dict.Po +storage/innobase/dict/.deps/dict0load.Po +storage/innobase/dict/.deps/dict0mem.Po +storage/innobase/dyn/.deps/dyn0dyn.Po +storage/innobase/eval/.deps/eval0eval.Po +storage/innobase/eval/.deps/eval0proc.Po +storage/innobase/fil/.deps/fil0fil.Po +storage/innobase/fsp/.deps/fsp0fsp.Po +storage/innobase/fut/.deps/fut0fut.Po +storage/innobase/fut/.deps/fut0lst.Po +storage/innobase/ha/.deps/ha0ha.Po +storage/innobase/ha/.deps/hash0hash.Po +storage/innobase/ib_config.h +storage/innobase/ib_config.h.in +storage/innobase/ibuf/.deps/ibuf0ibuf.Po +storage/innobase/lock/.deps/lock0lock.Po +storage/innobase/log/.deps/log0log.Po +storage/innobase/log/.deps/log0recv.Po +storage/innobase/mach/.deps/mach0data.Po +storage/innobase/mem/.deps/mem0mem.Po +storage/innobase/mem/.deps/mem0pool.Po +storage/innobase/mkinstalldirs +storage/innobase/mtr/.deps/mtr0log.Po +storage/innobase/mtr/.deps/mtr0mtr.Po +storage/innobase/os/.deps/os0file.Po +storage/innobase/os/.deps/os0proc.Po +storage/innobase/os/.deps/os0sync.Po +storage/innobase/os/.deps/os0thread.Po +storage/innobase/page/.deps/page0cur.Po +storage/innobase/page/.deps/page0page.Po +storage/innobase/pars/.deps/lexyy.Po +storage/innobase/pars/.deps/pars0grm.Po +storage/innobase/pars/.deps/pars0opt.Po +storage/innobase/pars/.deps/pars0pars.Po +storage/innobase/pars/.deps/pars0sym.Po +storage/innobase/que/.deps/que0que.Po +storage/innobase/read/.deps/read0read.Po +storage/innobase/rem/.deps/rem0cmp.Po +storage/innobase/rem/.deps/rem0rec.Po +storage/innobase/row/.deps/row0ins.Po +storage/innobase/row/.deps/row0mysql.Po +storage/innobase/row/.deps/row0purge.Po +storage/innobase/row/.deps/row0row.Po +storage/innobase/row/.deps/row0sel.Po +storage/innobase/row/.deps/row0uins.Po +storage/innobase/row/.deps/row0umod.Po +storage/innobase/row/.deps/row0undo.Po +storage/innobase/row/.deps/row0upd.Po +storage/innobase/row/.deps/row0vers.Po +storage/innobase/srv/.deps/srv0que.Po +storage/innobase/srv/.deps/srv0srv.Po +storage/innobase/srv/.deps/srv0start.Po +storage/innobase/stamp-h1 +storage/innobase/sync/.deps/sync0arr.Po +storage/innobase/sync/.deps/sync0rw.Po +storage/innobase/sync/.deps/sync0sync.Po +storage/innobase/thr/.deps/thr0loc.Po +storage/innobase/trx/.deps/trx0purge.Po +storage/innobase/trx/.deps/trx0rec.Po +storage/innobase/trx/.deps/trx0roll.Po +storage/innobase/trx/.deps/trx0rseg.Po +storage/innobase/trx/.deps/trx0sys.Po +storage/innobase/trx/.deps/trx0trx.Po +storage/innobase/trx/.deps/trx0undo.Po +storage/innobase/usr/.deps/usr0sess.Po +storage/innobase/ut/.deps/ut0byte.Po +storage/innobase/ut/.deps/ut0dbg.Po +storage/innobase/ut/.deps/ut0list.Po +storage/innobase/ut/.deps/ut0mem.Po +storage/innobase/ut/.deps/ut0rnd.Po +storage/innobase/ut/.deps/ut0ut.Po +storage/innobase/ut/.deps/ut0vec.Po +storage/innobase/ut/.deps/ut0wqueue.Po +storage/myisam/.deps/ft_boolean_search.Po +storage/myisam/.deps/ft_nlq_search.Po +storage/myisam/.deps/ft_parser.Po +storage/myisam/.deps/ft_static.Po +storage/myisam/.deps/ft_stopwords.Po +storage/myisam/.deps/ft_update.Po +storage/myisam/.deps/mi_cache.Po +storage/myisam/.deps/mi_changed.Po +storage/myisam/.deps/mi_check.Po +storage/myisam/.deps/mi_checksum.Po +storage/myisam/.deps/mi_close.Po +storage/myisam/.deps/mi_create.Po +storage/myisam/.deps/mi_dbug.Po +storage/myisam/.deps/mi_delete.Po +storage/myisam/.deps/mi_delete_all.Po +storage/myisam/.deps/mi_delete_table.Po +storage/myisam/.deps/mi_dynrec.Po +storage/myisam/.deps/mi_extra.Po +storage/myisam/.deps/mi_info.Po +storage/myisam/.deps/mi_key.Po +storage/myisam/.deps/mi_keycache.Po +storage/myisam/.deps/mi_locking.Po +storage/myisam/.deps/mi_log.Po +storage/myisam/.deps/mi_open.Po +storage/myisam/.deps/mi_packrec.Po +storage/myisam/.deps/mi_page.Po +storage/myisam/.deps/mi_panic.Po +storage/myisam/.deps/mi_preload.Po +storage/myisam/.deps/mi_range.Po +storage/myisam/.deps/mi_rename.Po +storage/myisam/.deps/mi_rfirst.Po +storage/myisam/.deps/mi_rkey.Po +storage/myisam/.deps/mi_rlast.Po +storage/myisam/.deps/mi_rnext.Po +storage/myisam/.deps/mi_rnext_same.Po +storage/myisam/.deps/mi_rprev.Po +storage/myisam/.deps/mi_rrnd.Po +storage/myisam/.deps/mi_rsame.Po +storage/myisam/.deps/mi_rsamepos.Po +storage/myisam/.deps/mi_scan.Po +storage/myisam/.deps/mi_search.Po +storage/myisam/.deps/mi_static.Po +storage/myisam/.deps/mi_statrec.Po +storage/myisam/.deps/mi_test1.Po +storage/myisam/.deps/mi_test2.Po +storage/myisam/.deps/mi_test3.Po +storage/myisam/.deps/mi_unique.Po +storage/myisam/.deps/mi_update.Po +storage/myisam/.deps/mi_write.Po +storage/myisam/.deps/myisam_ftdump.Po +storage/myisam/.deps/myisamchk.Po +storage/myisam/.deps/myisamlog.Po +storage/myisam/.deps/myisampack.Po +storage/myisam/.deps/rt_index.Po +storage/myisam/.deps/rt_key.Po +storage/myisam/.deps/rt_mbr.Po +storage/myisam/.deps/rt_split.Po +storage/myisam/.deps/rt_test.Po +storage/myisam/.deps/sort.Po +storage/myisam/.deps/sp_key.Po +storage/myisam/.deps/sp_test.Po +storage/myisam/FT1.MYD +storage/myisam/FT1.MYI +storage/myisam/ft_dump +storage/myisam/ft_eval +storage/myisam/ft_test1 +storage/myisam/ftbench/data +storage/myisam/ftbench/t +storage/myisam/ftbench/var/* +storage/myisam/mi_test1 +storage/myisam/mi_test2 +storage/myisam/mi_test3 +storage/myisam/mi_test_all +storage/myisam/myisam.log +storage/myisam/myisam_ftdump +storage/myisam/myisamchk +storage/myisam/myisamlog +storage/myisam/myisampack +storage/myisam/rt_test +storage/myisam/rt_test.MYD +storage/myisam/rt_test.MYI +storage/myisam/sp_test +storage/myisam/test1.MYD +storage/myisam/test1.MYI +storage/myisam/test2.MYD +storage/myisam/test2.MYI +storage/myisammrg/.deps/myrg_close.Po +storage/myisammrg/.deps/myrg_create.Po +storage/myisammrg/.deps/myrg_delete.Po +storage/myisammrg/.deps/myrg_extra.Po +storage/myisammrg/.deps/myrg_info.Po +storage/myisammrg/.deps/myrg_locking.Po +storage/myisammrg/.deps/myrg_open.Po +storage/myisammrg/.deps/myrg_panic.Po +storage/myisammrg/.deps/myrg_queue.Po +storage/myisammrg/.deps/myrg_range.Po +storage/myisammrg/.deps/myrg_rfirst.Po +storage/myisammrg/.deps/myrg_rkey.Po +storage/myisammrg/.deps/myrg_rlast.Po +storage/myisammrg/.deps/myrg_rnext.Po +storage/myisammrg/.deps/myrg_rnext_same.Po +storage/myisammrg/.deps/myrg_rprev.Po +storage/myisammrg/.deps/myrg_rrnd.Po +storage/myisammrg/.deps/myrg_rsame.Po +storage/myisammrg/.deps/myrg_static.Po +storage/myisammrg/.deps/myrg_update.Po +storage/myisammrg/.deps/myrg_write.Po +storage/ndb/bin/DbAsyncGenerator +storage/ndb/bin/DbCreate +storage/ndb/bin/acid +storage/ndb/bin/async-lmc-bench-l-p10.sh +storage/ndb/bin/async-lmc-bench-l.sh +storage/ndb/bin/async-lmc-bench-p10.sh +storage/ndb/bin/async-lmc-bench.sh +storage/ndb/bin/atrt +storage/ndb/bin/atrt-analyze-result.sh +storage/ndb/bin/atrt-clear-result.sh +storage/ndb/bin/atrt-gather-result.sh +storage/ndb/bin/atrt-setup.sh +storage/ndb/bin/bankCreator +storage/ndb/bin/bankMakeGL +storage/ndb/bin/bankSumAccounts +storage/ndb/bin/bankTimer +storage/ndb/bin/bankTransactionMaker +storage/ndb/bin/bankValidateAllGLs +storage/ndb/bin/basicTransporterTest +storage/ndb/bin/benchronja +storage/ndb/bin/bulk_copy +storage/ndb/bin/copy_tab +storage/ndb/bin/create_all_tabs +storage/ndb/bin/create_index +storage/ndb/bin/create_tab +storage/ndb/bin/delete_all +storage/ndb/bin/desc +storage/ndb/bin/drop_all_tabs +storage/ndb/bin/drop_index +storage/ndb/bin/drop_tab +storage/ndb/bin/flexAsynch +storage/ndb/bin/flexBench +storage/ndb/bin/flexHammer +storage/ndb/bin/flexScan +storage/ndb/bin/flexTT +storage/ndb/bin/hugoCalculator +storage/ndb/bin/hugoFill +storage/ndb/bin/hugoLoad +storage/ndb/bin/hugoLockRecords +storage/ndb/bin/hugoPkDelete +storage/ndb/bin/hugoPkRead +storage/ndb/bin/hugoPkReadRecord +storage/ndb/bin/hugoPkUpdate +storage/ndb/bin/hugoScanRead +storage/ndb/bin/hugoScanUpdate +storage/ndb/bin/index +storage/ndb/bin/index2 +storage/ndb/bin/initronja +storage/ndb/bin/interpreterInTup +storage/ndb/bin/list_tables +storage/ndb/bin/make-config.sh +storage/ndb/bin/mgmtclient +storage/ndb/bin/mgmtsrvr +storage/ndb/bin/mkconfig +storage/ndb/bin/ndb +storage/ndb/bin/ndb_cpcc +storage/ndb/bin/ndb_cpcd +storage/ndb/bin/ndb_rep +storage/ndb/bin/ndbsql +storage/ndb/bin/newton_basic +storage/ndb/bin/newton_br +storage/ndb/bin/newton_pb +storage/ndb/bin/newton_perf +storage/ndb/bin/perfTransporterTest +storage/ndb/bin/printConfig +storage/ndb/bin/printSchemafile +storage/ndb/bin/printSysfile +storage/ndb/bin/redoLogFileReader +storage/ndb/bin/restart +storage/ndb/bin/restarter +storage/ndb/bin/restarter2 +storage/ndb/bin/restarts +storage/ndb/bin/restore +storage/ndb/bin/select_all +storage/ndb/bin/select_count +storage/ndb/bin/telco +storage/ndb/bin/testBackup +storage/ndb/bin/testBank +storage/ndb/bin/testBasic +storage/ndb/bin/testBasicAsynch +storage/ndb/bin/testCopy +storage/ndb/bin/testDataBuffers +storage/ndb/bin/testDict +storage/ndb/bin/testGrep +storage/ndb/bin/testGrepVerify +storage/ndb/bin/testIndex +storage/ndb/bin/testInterpreter +storage/ndb/bin/testKernelDataBuffer +storage/ndb/bin/testLongSig +storage/ndb/bin/testMgm +storage/ndb/bin/testMgmapi +storage/ndb/bin/testNdbApi +storage/ndb/bin/testNodeRestart +storage/ndb/bin/testOIBasic +storage/ndb/bin/testOdbcDriver +storage/ndb/bin/testOperations +storage/ndb/bin/testRestartGci +storage/ndb/bin/testScan +storage/ndb/bin/testScanInterpreter +storage/ndb/bin/testSimplePropertiesSection +storage/ndb/bin/testSystemRestart +storage/ndb/bin/testTimeout +storage/ndb/bin/testTransactions +storage/ndb/bin/test_cpcd +storage/ndb/bin/test_event +storage/ndb/bin/verify_index +storage/ndb/bin/waiter +storage/ndb/config/autom4te.cache/* +storage/ndb/config/config.mk +storage/ndb/examples/ndbapi_example1/ndbapi_example1 +storage/ndb/examples/ndbapi_example2/ndbapi_example2 +storage/ndb/examples/ndbapi_example3/ndbapi_example3 +storage/ndb/examples/ndbapi_example5/ndbapi_example5 +storage/ndb/examples/select_all/select_all +storage/ndb/include/ndb_global.h +storage/ndb/include/ndb_types.h +storage/ndb/include/ndb_version.h +storage/ndb/lib/libMGM_API.so +storage/ndb/lib/libNDB_API.so +storage/ndb/lib/libNDB_ODBC.so +storage/ndb/lib/libNEWTON_API.so +storage/ndb/lib/libNEWTON_BASICTEST_COMMON.so +storage/ndb/lib/libREP_API.so +storage/ndb/lib/libndbclient.so +storage/ndb/lib/libndbclient_extra.so +storage/ndb/ndbapi-examples/mgmapi_logevent/mgmapi_logevent +storage/ndb/ndbapi-examples/mgmapi_logevent2/mgmapi_logevent2 +storage/ndb/ndbapi-examples/ndbapi_async/ndbapi_async +storage/ndb/ndbapi-examples/ndbapi_async1/ndbapi_async1 +storage/ndb/ndbapi-examples/ndbapi_event/ndbapi_event +storage/ndb/ndbapi-examples/ndbapi_retries/ndbapi_retries +storage/ndb/ndbapi-examples/ndbapi_scan/ndbapi_scan +storage/ndb/ndbapi-examples/ndbapi_simple/ndbapi_simple +storage/ndb/ndbapi-examples/ndbapi_simple_dual/ndbapi_simple_dual +storage/ndb/ndbapi-examples/ndbapi_simple_index/ndbapi_simple_index +storage/ndb/src/common/debugger/libtrace.dsp +storage/ndb/src/common/debugger/signaldata/libsignaldataprint.dsp +storage/ndb/src/common/logger/liblogger.dsp +storage/ndb/src/common/mgmcommon/libmgmsrvcommon.dsp +storage/ndb/src/common/mgmcommon/printConfig/*.d +storage/ndb/src/common/portlib/libportlib.dsp +storage/ndb/src/common/transporter/libtransporter.dsp +storage/ndb/src/common/util/libgeneral.dsp +storage/ndb/src/common/util/testBitmask.cpp +storage/ndb/src/cw/cpcd/ndb_cpcd +storage/ndb/src/dummy.cpp +storage/ndb/src/kernel/blocks/backup/libbackup.dsp +storage/ndb/src/kernel/blocks/backup/ndb_print_backup_file +storage/ndb/src/kernel/blocks/backup/restore/ndb_restore +storage/ndb/src/kernel/blocks/cmvmi/libcmvmi.dsp +storage/ndb/src/kernel/blocks/dbacc/libdbacc.dsp +storage/ndb/src/kernel/blocks/dbdict/libdbdict.dsp +storage/ndb/src/kernel/blocks/dbdict/ndb_print_schema_file +storage/ndb/src/kernel/blocks/dbdih/libdbdih.dsp +storage/ndb/src/kernel/blocks/dbdih/ndb_print_sys_file +storage/ndb/src/kernel/blocks/dblqh/libdblqh.dsp +storage/ndb/src/kernel/blocks/dbtc/libdbtc.dsp +storage/ndb/src/kernel/blocks/dbtup/libdbtup.dsp +storage/ndb/src/kernel/blocks/dbtup/test_varpage +storage/ndb/src/kernel/blocks/dbtux/libdbtux.dsp +storage/ndb/src/kernel/blocks/dbutil/libdbutil.dsp +storage/ndb/src/kernel/blocks/grep/libgrep.dsp +storage/ndb/src/kernel/blocks/ndb_print_file +storage/ndb/src/kernel/blocks/ndbcntr/libndbcntr.dsp +storage/ndb/src/kernel/blocks/ndbfs/libndbfs.dsp +storage/ndb/src/kernel/blocks/qmgr/libqmgr.dsp +storage/ndb/src/kernel/blocks/suma/libsuma.dsp +storage/ndb/src/kernel/blocks/trix/libtrix.dsp +storage/ndb/src/kernel/error/liberror.dsp +storage/ndb/src/kernel/ndbd +storage/ndb/src/kernel/ndbd.dsp +storage/ndb/src/kernel/vm/libkernel.dsp +storage/ndb/src/libndb.ver +storage/ndb/src/libndbclient.dsp +storage/ndb/src/mgmapi/libmgmapi.dsp +storage/ndb/src/mgmclient/libndbmgmclient.dsp +storage/ndb/src/mgmclient/ndb_mgm +storage/ndb/src/mgmclient/ndb_mgm.dsp +storage/ndb/src/mgmclient/test_cpcd/*.d +storage/ndb/src/mgmsrv/ndb_mgmd +storage/ndb/src/mgmsrv/ndb_mgmd.dsp +storage/ndb/src/ndbapi/libndbapi.dsp +storage/ndb/src/ndbapi/ndberror_check +storage/ndb/test/ndbapi/DbAsyncGenerator +storage/ndb/test/ndbapi/DbCreate +storage/ndb/test/ndbapi/bank/bankCreator +storage/ndb/test/ndbapi/bank/bankMakeGL +storage/ndb/test/ndbapi/bank/bankSumAccounts +storage/ndb/test/ndbapi/bank/bankTimer +storage/ndb/test/ndbapi/bank/bankTransactionMaker +storage/ndb/test/ndbapi/bank/bankValidateAllGLs +storage/ndb/test/ndbapi/bank/testBank +storage/ndb/test/ndbapi/create_all_tabs +storage/ndb/test/ndbapi/create_tab +storage/ndb/test/ndbapi/drop_all_tabs +storage/ndb/test/ndbapi/flexAsynch +storage/ndb/test/ndbapi/flexBench +storage/ndb/test/ndbapi/flexBench.dsp +storage/ndb/test/ndbapi/flexHammer +storage/ndb/test/ndbapi/flexTT +storage/ndb/test/ndbapi/ndbapi_slow_select +storage/ndb/test/ndbapi/testBackup +storage/ndb/test/ndbapi/testBasic +storage/ndb/test/ndbapi/testBasic.dsp +storage/ndb/test/ndbapi/testBasicAsynch +storage/ndb/test/ndbapi/testBitfield +storage/ndb/test/ndbapi/testBlobs +storage/ndb/test/ndbapi/testBlobs.dsp +storage/ndb/test/ndbapi/testDataBuffers +storage/ndb/test/ndbapi/testDeadlock +storage/ndb/test/ndbapi/testDict +storage/ndb/test/ndbapi/testIndex +storage/ndb/test/ndbapi/testIndexStat +storage/ndb/test/ndbapi/testInterpreter +storage/ndb/test/ndbapi/testLcp +storage/ndb/test/ndbapi/testMgm +storage/ndb/test/ndbapi/testNdbApi +storage/ndb/test/ndbapi/testNodeRestart +storage/ndb/test/ndbapi/testOIBasic +storage/ndb/test/ndbapi/testOperations +storage/ndb/test/ndbapi/testPartitioning +storage/ndb/test/ndbapi/testReadPerf +storage/ndb/test/ndbapi/testRestartGci +storage/ndb/test/ndbapi/testSRBank +storage/ndb/test/ndbapi/testScan +storage/ndb/test/ndbapi/testScan.dsp +storage/ndb/test/ndbapi/testScanInterpreter +storage/ndb/test/ndbapi/testScanPerf +storage/ndb/test/ndbapi/testSystemRestart +storage/ndb/test/ndbapi/testTimeout +storage/ndb/test/ndbapi/testTransactions +storage/ndb/test/ndbapi/test_event +storage/ndb/test/ndbapi/test_event_merge +storage/ndb/test/run-test/atrt +storage/ndb/test/src/libNDBT.dsp +storage/ndb/test/tools/copy_tab +storage/ndb/test/tools/create_index +storage/ndb/test/tools/hugoCalculator +storage/ndb/test/tools/hugoFill +storage/ndb/test/tools/hugoLoad +storage/ndb/test/tools/hugoLockRecords +storage/ndb/test/tools/hugoPkDelete +storage/ndb/test/tools/hugoPkRead +storage/ndb/test/tools/hugoPkReadRecord +storage/ndb/test/tools/hugoPkUpdate +storage/ndb/test/tools/hugoScanRead +storage/ndb/test/tools/hugoScanUpdate +storage/ndb/test/tools/listen_event +storage/ndb/test/tools/ndb_cpcc +storage/ndb/test/tools/rep_latency +storage/ndb/test/tools/restart +storage/ndb/test/tools/verify_index +storage/ndb/tools/ndb_config +storage/ndb/tools/ndb_delete_all +storage/ndb/tools/ndb_delete_all.dsp +storage/ndb/tools/ndb_desc +storage/ndb/tools/ndb_desc.dsp +storage/ndb/tools/ndb_drop_index +storage/ndb/tools/ndb_drop_index.dsp +storage/ndb/tools/ndb_drop_table +storage/ndb/tools/ndb_drop_table.dsp +storage/ndb/tools/ndb_restore +storage/ndb/tools/ndb_select_all +storage/ndb/tools/ndb_select_all.dsp +storage/ndb/tools/ndb_select_count +storage/ndb/tools/ndb_select_count.dsp +storage/ndb/tools/ndb_show_tables +storage/ndb/tools/ndb_show_tables.dsp +storage/ndb/tools/ndb_test_platform +storage/ndb/tools/ndb_waiter +storage/ndb/tools/ndb_waiter.dsp +strings/*.ds? +strings/*.vcproj +strings/.deps/bchange.Po +strings/.deps/bcmp.Po +strings/.deps/bfill.Po +strings/.deps/bmove.Po +strings/.deps/bmove512.Po +strings/.deps/bmove_upp.Po +strings/.deps/conf_to_src.Po +strings/.deps/ctype-big5.Po +strings/.deps/ctype-bin.Po +strings/.deps/ctype-cp932.Po +strings/.deps/ctype-czech.Po +strings/.deps/ctype-euc_kr.Po +strings/.deps/ctype-eucjpms.Po +strings/.deps/ctype-extra.Po +strings/.deps/ctype-gb2312.Po +strings/.deps/ctype-gbk.Po +strings/.deps/ctype-latin1.Po +strings/.deps/ctype-mb.Po +strings/.deps/ctype-simple.Po +strings/.deps/ctype-sjis.Po +strings/.deps/ctype-tis620.Po +strings/.deps/ctype-uca.Po +strings/.deps/ctype-ucs2.Po +strings/.deps/ctype-ujis.Po +strings/.deps/ctype-utf8.Po +strings/.deps/ctype-win1250ch.Po +strings/.deps/ctype.Po +strings/.deps/decimal.Po +strings/.deps/int2str.Po +strings/.deps/is_prefix.Po +strings/.deps/llstr.Po +strings/.deps/longlong2str.Po +strings/.deps/longlong2str_asm.Po +strings/.deps/my_strchr.Po +strings/.deps/my_strtoll10.Po +strings/.deps/my_vsnprintf.Po +strings/.deps/r_strinstr.Po +strings/.deps/str2int.Po +strings/.deps/str_alloc.Po +strings/.deps/strappend.Po +strings/.deps/strcend.Po +strings/.deps/strcont.Po +strings/.deps/strend.Po +strings/.deps/strfill.Po +strings/.deps/strinstr.Po +strings/.deps/strmake.Po +strings/.deps/strmov.Po +strings/.deps/strnlen.Po +strings/.deps/strnmov.Po +strings/.deps/strstr.Po +strings/.deps/strtod.Po +strings/.deps/strtol.Po +strings/.deps/strtoll.Po +strings/.deps/strtoul.Po +strings/.deps/strtoull.Po +strings/.deps/strxmov.Po +strings/.deps/strxnmov.Po +strings/.deps/xml.Po +strings/conf_to_src +strings/ctype_autoconf.c +strings/ctype_extra_sources.c +strings/str_test +strings/test_decimal +support-files/*.ini +support-files/MacOSX/Description.plist +support-files/MacOSX/Info.plist +support-files/MacOSX/ReadMe.txt +support-files/MacOSX/StartupParameters.plist +support-files/MacOSX/postflight +support-files/MacOSX/postinstall +support-files/MacOSX/preflight +support-files/MacOSX/preinstall +support-files/binary-configure +support-files/my-huge.cnf +support-files/my-innodb-heavy-4G.cnf +support-files/my-large.cnf +support-files/my-medium.cnf +support-files/my-small.cnf +support-files/mysql-3.23.25-beta.spec +support-files/mysql-3.23.26-beta.spec +support-files/mysql-3.23.27-beta.spec +support-files/mysql-3.23.28-gamma.spec +support-files/mysql-3.23.29-gamma.spec +support-files/mysql-log-rotate +support-files/mysql.server +support-files/mysql.spec +support-files/mysqld_multi.server +support-files/ndb-config-2-node.ini +tags +test/ndbapi/bank/bankCreator +test/ndbapi/bank/bankMakeGL +test/ndbapi/bank/bankSumAccounts +test/ndbapi/bank/bankTimer +test/ndbapi/bank/bankTransactionMaker +test/ndbapi/bank/bankValidateAllGLs +test/ndbapi/bank/testBank +test/ndbapi/create_all_tabs +test/ndbapi/create_tab +test/ndbapi/drop_all_tabs +test/ndbapi/flexAsynch +test/ndbapi/flexBench +test/ndbapi/flexHammer +test/ndbapi/flexTT +test/ndbapi/testBackup +test/ndbapi/testBasic +test/ndbapi/testBasicAsynch +test/ndbapi/testBlobs +test/ndbapi/testDataBuffers +test/ndbapi/testDeadlock +test/ndbapi/testDict +test/ndbapi/testIndex +test/ndbapi/testMgm +test/ndbapi/testNdbApi +test/ndbapi/testNodeRestart +test/ndbapi/testOIBasic +test/ndbapi/testOperations +test/ndbapi/testRestartGci +test/ndbapi/testScan +test/ndbapi/testScanInterpreter +test/ndbapi/testScanPerf +test/ndbapi/testSystemRestart +test/ndbapi/testTimeout +test/ndbapi/testTransactions +test/ndbapi/test_event +test/run-test/atrt +test/tools/copy_tab +test/tools/create_index +test/tools/hugoCalculator +test/tools/hugoFill +test/tools/hugoLoad +test/tools/hugoLockRecords +test/tools/hugoPkDelete +test/tools/hugoPkRead +test/tools/hugoPkReadRecord +test/tools/hugoPkUpdate +test/tools/hugoScanRead +test/tools/hugoScanUpdate +test/tools/ndb_cpcc +test/tools/restart +test/tools/verify_index +test1/* +test_xml +tests/*.ds? +tests/*.vcproj +tests/.deps/dummy.Po +tests/.deps/insert_test.Po +tests/.deps/mysql_client_test.Po +tests/.deps/select_test.Po +tests/.deps/thread_test.Po +tests/.libs -prune +tests/.libs/lt-mysql_client_test +tests/.libs/mysql_client_test +tests/bug25714 +tests/client_test +tests/connect_test +tests/mysql_client_test +thr_insert_test/* +thr_test/* +thread_test +tmp/* +tools/.libs -prune +tools/my_vsnprintf.c +tools/mysqlmanager +tools/mysqlmngd +tools/mysqltestmanager +tools/mysys_priv.h +unittest/examples/*.t +unittest/examples/.deps/no_plan-t.Po +unittest/examples/.deps/simple-t.Po +unittest/examples/.deps/skip-t.Po +unittest/examples/.deps/skip_all-t.Po +unittest/examples/.deps/todo-t.Po +unittest/gunit/merge_large_tests.cc +unittest/gunit/merge_small_tests.cc +unittest/mysys/*.t +unittest/mysys/.deps/base64-t.Po +unittest/mysys/.deps/my_atomic-t.Po +unittest/mytap/.deps/tap.Po +unittest/mytap/t/*.t +unittest/mytap/t/.deps/basic-t.Po +unittest/unit +vi.h +vio/*.ds? +vio/*.vcproj +vio/.deps/dummy.Po +vio/.deps/test-ssl.Po +vio/.deps/test-sslclient.Po +vio/.deps/test-sslserver.Po +vio/.deps/vio.Po +vio/.deps/viosocket.Po +vio/.deps/viossl.Po +vio/.deps/viosslfactories.Po +vio/test-ssl +vio/test-sslclient +vio/test-sslserver +vio/viotest-ssl +vio/viotest-sslconnect.cpp +vio/viotest.cpp +win/configure.data +win/vs71cache.txt +win/vs8cache.txt +win/nmake_cache.txt +ylwrap +zlib/*.ds? +zlib/*.vcproj +mysql-test/bug36522-64.tar +mysql-test/bug36522.tar +mysql-test/t.log +mysql-test/tps.log +libmysqld/event_parse_data.cc +autom4te.cache +sql/share/czech +sql/share/danish +sql/share/dutch +sql/share/english +sql/share/estonian +sql/share/french +sql/share/german +sql/share/greek +sql/share/hungarian +sql/share/italian +sql/share/japanese +sql/share/japanese-sjis +sql/share/korean +sql/share/norwegian +sql/share/norwegian-ny +sql/share/polish +sql/share/portuguese +sql/share/romanian +sql/share/russian +sql/share/serbian +sql/share/slovak +sql/share/spanish +sql/share/swedish +sql/share/ukrainian +*.jar +*.dylib +*.stamp +storage/ndb/**/*.dir +storage/ndb/**/CMakeFiles +storage/ndb/**/target +storage/ndb/**/*.class +storage/ndb/src/ndbjtie/**/*.sh +storage/ndb/src/ndbjtie/**/*.log +storage/ndb/src/ndbjtie/jtie/test/myapi/myapi_test +storage/ndb/clusterj/**/*MANIFEST.MF +storage/ndb/clusterj/**/*manifest.mf +storage/ndb/test/crund/*.cnf +storage/ndb/test/crund/*.ini* +storage/ndb/test/crund/*.properties +storage/ndb/test/crund/build/ +storage/ndb/test/crund/javadoc/ +storage/ndb/test/crund/lib/ +storage/ndb/test/crund/**/log* +storage/ndb/test/crund/martins_little_helpers/src/utils/Properties_test +storage/ndb/test/crund/martins_little_helpers/src/utils/hrt_stopwatch_test +storage/ndb/test/crund/martins_little_helpers/src/utils/hrt_utils_test +storage/ndb/test/crund/martins_little_helpers/src/utils/utils_HrtStopwatch.h +storage/ndb/test/crund/martins_little_helpers/src/utils/utils_JniInstrumentationTest.h +storage/ndb/test/crund/scripts/ndblog +storage/ndb/test/crund/scripts/results +storage/ndb/test/crund/src/crundndb/NdbApiDriver +storage/ndb/test/crund/src/crundndb/com_mysql_cluster_crund_NdbApiLoad.h +storage/ndb/test/crund/tws/tws_java/build/ +storage/ndb/test/crund/tws/tws_java/nbproject/configs/ +storage/ndb/test/crund/tws/tws_java/nbproject/private/ +storage/ndb/test/crund/tws/tws_java/run.properties +storage/ndb/test/crund/tws/*.properties +storage/ndb/test/crund/tws/tws_cpp/TwsDriver + +libmysqld/examples/mysqltest.cc +libmysqld/sql_signal.cc +libmysqld/debug_sync.cc +dbug/tests +libmysqld/mdl.cc +client/transaction.h +libmysqld/transaction.cc +libmysqld/sys_vars.cc +libmysqld/keycaches.cc +client/dtoa.c +libmysqld/opt_trace.cc +libmysqld/sql_audit.cc +storage/archive/archive_performance +storage/archive/concurrency_test +libmysql_r/client_settings.h +libmysqld/scheduler.cc +libmysqld/sql_connect.cc +libmysqld/sql_tablespace.cc +mysql-test/dump.txt +configure.am +run_collection*.cmake +configure.am +run_collection*.cmake +cmake_install.cmake +CMakeFiles.cmake +CPackConfig.cmake +CPackSourceConfig.cmake +CTestTestfile.cmake +make_dist.cmake +_CPack_Packages +merge_archives*.cmake +libmysqld/des_key_file.cc +CPackConfig.cmake +CPackSourceConfig.cmake +make_dist.cmake +client/echo +libmysql/libmysql_exports_file.cc +libmysql/merge_archives_mysqlclient.cmake +libmysqld/merge_archives_mysqlserver.cmake +libmysqld/mysqlserver_depends.c +libmysqld/examples/mysql_embedded +libmysqld/sql_bootstrap.cc +sql/dummy.bak +mysys/thr_lock +mysys/queues +libmysqld/binlog.cc +libmysqld/sql_alter.cc +libmysqld/sql_partition_admin.cc +generated +doxyerror.log +VERSION.dep +info_macros.cmake +Docs/INFO_BIN +Docs/INFO_SRC +Testing +FilesCopied +source_downloads +client/mysql_plugin +support-files/plugins.files +storage/perfschema/pfs_lex_token.h +storage/perfschema/gen_pfs_lex_token +sql/share/bulgarian diff --git a/mysql-wsrep-5.6/CMakeLists.txt b/mysql-wsrep-5.6/CMakeLists.txt index 5941954e..5be5e924 100644 --- a/mysql-wsrep-5.6/CMakeLists.txt +++ b/mysql-wsrep-5.6/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2006, 2014, 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 @@ -19,8 +19,27 @@ if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 2.6) CMAKE_POLICY(VERSION 2.8) endif() +# We use PROPERTIES LINK_INTERFACE_LIBRARIES. See cmake --help-policy CMP0022 +IF(CMAKE_VERSION VERSION_EQUAL "2.8.12" OR + CMAKE_VERSION VERSION_GREATER "2.8.12") + CMAKE_POLICY(SET CMP0022 OLD) +ENDIF() + +# We use the LOCATION target property (CMP0026) +# and get_target_property() for non-existent targets (CMP0045) +# and INSTALL_NAME_DIR (CMP0042) +IF(CMAKE_VERSION VERSION_EQUAL "3.0.0" OR + CMAKE_VERSION VERSION_GREATER "3.0.0") + CMAKE_POLICY(SET CMP0026 OLD) + CMAKE_POLICY(SET CMP0045 OLD) + CMAKE_POLICY(SET CMP0042 OLD) +ENDIF() + MESSAGE(STATUS "Running cmake version ${CMAKE_VERSION}") +# Will set GIT_EXECUTABLE and GIT_FOUND +FIND_PACKAGE(Git) + SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake) # First, decide about build type (debug or release) @@ -60,15 +79,8 @@ SET(BUILDTYPE_DOCSTRING "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel") -# Possibly temporary fix: Clang on 32 bit causes non-debug server to crash -IF(CMAKE_OSX_ARCHITECTURES MATCHES "i386") - SET(CMAKE_CXX_COMPILER g++) -ENDIF() - IF(WITH_DEBUG) SET(CMAKE_BUILD_TYPE "Debug" CACHE STRING ${BUILDTYPE_DOCSTRING} FORCE) - SET(MYSQL_MAINTAINER_MODE ON CACHE BOOL - "MySQL maintainer-specific development environment") IF(UNIX AND NOT APPLE) # Compiling with PIC speeds up embedded build, on PIC sensitive systems # Predefine it to ON, in case user chooses to build embedded. @@ -98,6 +110,15 @@ ELSE() ENDIF() PROJECT(${MYSQL_PROJECT_NAME}) +# Maintainer mode is default on only for Linux debug builds using GCC/G++ +IF(CMAKE_BUILD_TYPE MATCHES "Debug" OR WITH_DEBUG) + IF(CMAKE_SYSTEM_NAME MATCHES "Linux" AND + CMAKE_COMPILER_IS_GNUCC AND CMAKE_COMPILER_IS_GNUCXX) + SET(MYSQL_MAINTAINER_MODE ON CACHE BOOL + "MySQL maintainer-specific development environment") + ENDIF() +ENDIF() + OPTION(WITH_DEFAULT_COMPILER_OPTIONS "Use flags from cmake/build_configurations/compiler_options.cmake" ON) @@ -154,31 +175,6 @@ IF(WITH_DEFAULT_FEATURE_SET) INCLUDE(${CMAKE_SOURCE_DIR}/cmake/build_configurations/feature_set.cmake) ENDIF() -# -# Control aspects of the development environment which are -# specific to MySQL maintainers and developers. -# -INCLUDE(maintainer) - -OPTION(MYSQL_MAINTAINER_MODE - "MySQL maintainer-specific development environment" OFF) - -# Whether the maintainer mode compiler options should be enabled. -IF(MYSQL_MAINTAINER_MODE) - IF(CMAKE_C_COMPILER_ID MATCHES "GNU") - SET_MYSQL_MAINTAINER_GNU_C_OPTIONS() - ENDIF() - IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU") - SET_MYSQL_MAINTAINER_GNU_CXX_OPTIONS() - ENDIF() - IF(CMAKE_C_COMPILER_ID MATCHES "Intel") - SET_MYSQL_MAINTAINER_INTEL_C_OPTIONS() - ENDIF() - IF(CMAKE_CXX_COMPILER_ID MATCHES "Intel") - SET_MYSQL_MAINTAINER_INTEL_CXX_OPTIONS() - ENDIF() -ENDIF() - # Add macros INCLUDE(character_sets) INCLUDE(cpu_info) @@ -207,7 +203,9 @@ OPTION(WITHOUT_SERVER OFF) IF(UNIX) OPTION(WITH_VALGRIND "Valgrind instrumentation" OFF) ENDIF() -OPTION (WITH_UNIT_TESTS "Compile MySQL with unit tests" ON) +IF(NOT WITHOUT_SERVER) + OPTION (WITH_UNIT_TESTS "Compile MySQL with unit tests" ON) +ENDIF() MARK_AS_ADVANCED(CYBOZU BACKUP_TEST WITHOUT_SERVER DISABLE_SHARED) @@ -385,14 +383,15 @@ IF(SYSCONFDIR) SET(DEFAULT_SYSCONFDIR "${SYSCONFDIR}") ENDIF() -OPTION(TMPDIR -"PATH to MySQL TMP dir. If unspecified, defaults to P_tmpdir in " OFF) -IF(TMPDIR) +SET(TMPDIR "P_tmpdir" + CACHE PATH + "PATH to MySQL TMP dir. Defaults to the P_tmpdir macro in ") +IF(TMPDIR STREQUAL "P_tmpdir") + # Do not quote it, to refer to the P_tmpdir macro. + SET(DEFAULT_TMPDIR "P_tmpdir") +ELSE() # Quote it, to make it a const char string. SET(DEFAULT_TMPDIR "\"${TMPDIR}\"") -ELSE() - # Do not quote it, to refer to the P_tmpdir macro in . - SET(DEFAULT_TMPDIR "P_tmpdir") ENDIF() # Run platform tests @@ -419,30 +418,22 @@ MYSQL_CHECK_LIBEVENT() # Why doesn't these flags affect the entire build? # Because things may already have been included with ADD_SUBDIRECTORY # -IF(MYSQL_MAINTAINER_MODE) - # Set compiler flags required under maintainer mode. - MESSAGE(STATUS "C warning options: ${MY_MAINTAINER_C_WARNINGS}") - SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${MY_MAINTAINER_C_WARNINGS}") - MESSAGE(STATUS "C++ warning options: ${MY_MAINTAINER_CXX_WARNINGS}") - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${MY_MAINTAINER_CXX_WARNINGS}") -ENDIF() - -IF(CMAKE_COMPILER_IS_GNUCXX) - STRING(REGEX MATCH "-Werror" - BUILD_WITH_WERROR ${CMAKE_CXX_FLAGS}) - IF(BUILD_WITH_WERROR) - SET("COMPILE_FLAG_WERROR" 1) - ENDIF() -ENDIF() +OPTION(MYSQL_MAINTAINER_MODE + "MySQL maintainer-specific development environment" OFF) + +INCLUDE(maintainer) IF(WITH_UNIT_TESTS) ENABLE_TESTING() ENDIF() IF(NOT WITHOUT_SERVER) -SET (MYSQLD_STATIC_PLUGIN_LIBS "" CACHE INTERNAL "") - # Add storage engines and plugins. - CONFIGURE_PLUGINS() + SET (MYSQLD_STATIC_PLUGIN_LIBS "" CACHE INTERNAL "") + # Add storage engines and plugins. + CONFIGURE_PLUGINS() +ELSE() + # We may still want Cluster client libraries, use -DWITH_NDBCLUSTER=1 + ADD_SUBDIRECTORY(storage/ndb) ENDIF() ADD_SUBDIRECTORY(include) @@ -463,36 +454,47 @@ IF(WITH_UNIT_TESTS) IF(WIN32) ADD_DEFINITIONS( /D _VARIADIC_MAX=10 ) ENDIF() + # libc++ doesn't have tuple in tr1 + IF(HAVE_LLVM_LIBCPP) + ADD_DEFINITIONS(-DGTEST_USE_OWN_TR1_TUPLE=1) + ENDIF() ADD_SUBDIRECTORY(unittest/gunit) ENDIF() ADD_SUBDIRECTORY(extra) +ADD_SUBDIRECTORY(client) +ADD_SUBDIRECTORY(sql/share) +ADD_SUBDIRECTORY(libservices) + +IF(UNIX) + ADD_SUBDIRECTORY(man) +ENDIF() + IF(NOT WITHOUT_SERVER) ADD_SUBDIRECTORY(tests) - ADD_SUBDIRECTORY(client) ADD_SUBDIRECTORY(sql) - ADD_SUBDIRECTORY(sql/share) - ADD_SUBDIRECTORY(libservices) OPTION (WITH_EMBEDDED_SERVER "Compile MySQL with embedded server" OFF) IF(WITH_EMBEDDED_SERVER) ADD_SUBDIRECTORY(libmysqld) ADD_SUBDIRECTORY(libmysqld/examples) ENDIF(WITH_EMBEDDED_SERVER) +ENDIF() + +# scripts/mysql_config depends on client and server targets loaded above. +# It is referenced by some of the directories below, so we insert it here. +ADD_SUBDIRECTORY(scripts) +IF(NOT WITHOUT_SERVER) ADD_SUBDIRECTORY(mysql-test) ADD_SUBDIRECTORY(mysql-test/lib/My/SafeProcess) ADD_SUBDIRECTORY(support-files) - ADD_SUBDIRECTORY(scripts) ADD_SUBDIRECTORY(sql-bench) - IF(UNIX) - ADD_SUBDIRECTORY(man) - ENDIF() IF(EXISTS ${CMAKE_SOURCE_DIR}/internal/CMakeLists.txt) ADD_SUBDIRECTORY(internal) ENDIF() - ADD_SUBDIRECTORY(packaging/rpm-uln) ADD_SUBDIRECTORY(packaging/rpm-oel) ADD_SUBDIRECTORY(packaging/rpm-fedora) + ADD_SUBDIRECTORY(packaging/rpm-sles) ENDIF() INCLUDE(cmake/abi_check.cmake) @@ -505,13 +507,14 @@ CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/include/mysql_version.h.in CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/sql/sql_builtin.cc.in ${CMAKE_BINARY_DIR}/sql/sql_builtin.cc) CONFIGURE_FILE( - ${CMAKE_SOURCE_DIR}/cmake/info_macros.cmake.in ${CMAKE_BINARY_DIR}/info_macros.cmake @ONLY) + ${CMAKE_SOURCE_DIR}/cmake/info_macros.cmake.in + ${CMAKE_BINARY_DIR}/info_macros.cmake @ONLY) # Handle the "INFO_*" files. INCLUDE(${CMAKE_BINARY_DIR}/info_macros.cmake) # Source: This can be done during the cmake phase, all information is # available, but should be repeated on each "make" just in case someone -# does "cmake ; make ; bzr pull ; make". +# does "cmake ; make ; git pull ; make". CREATE_INFO_SRC(${CMAKE_BINARY_DIR}/Docs) ADD_CUSTOM_TARGET(INFO_SRC ALL COMMAND ${CMAKE_COMMAND} -P ${CMAKE_SOURCE_DIR}/cmake/info_src.cmake @@ -569,3 +572,37 @@ IF(NOT INSTALL_LAYOUT MATCHES "RPM") ENDIF() INCLUDE(CPack) + +# C compiler flags consist of: +# CPPFLAGS Taken from environment, see above. +# ADD_DEFINITIONS In each individual CMakeLists.txt +# CMAKE_C_FLAGS From command line. +# We extend these in maintainer.cmake +# ENV{CFLAGS} From environment, but environment is ignored if +# CMAKE_C_FLAGS is also given on command line +# CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE} +# We extend these in compiler_options.cmake +# +# Note that CMakeCache.txt contains cmake builtins for these variables, +# *not* the values that will actually be used: + +IF(CMAKE_GENERATOR MATCHES "Makefiles") + MESSAGE(STATUS "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}") +ENDIF() +GET_PROPERTY(cwd_definitions DIRECTORY PROPERTY COMPILE_DEFINITIONS) +MESSAGE(STATUS "COMPILE_DEFINITIONS: ${cwd_definitions}") +MESSAGE(STATUS "CMAKE_C_FLAGS: ${CMAKE_C_FLAGS}") +MESSAGE(STATUS "CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}") +IF(CMAKE_BUILD_TYPE AND CMAKE_GENERATOR MATCHES "Makefiles") + STRING(TOUPPER "${CMAKE_BUILD_TYPE}" CMAKEBT) + MESSAGE(STATUS "CMAKE_C_FLAGS_${CMAKEBT}: ${CMAKE_C_FLAGS_${CMAKEBT}}") + MESSAGE(STATUS "CMAKE_CXX_FLAGS_${CMAKEBT}: ${CMAKE_CXX_FLAGS_${CMAKEBT}}") +ENDIF() +IF(NOT CMAKE_GENERATOR MATCHES "Makefiles") + MESSAGE(STATUS "CMAKE_C_FLAGS_DEBUG: ${CMAKE_C_FLAGS_DEBUG}") + MESSAGE(STATUS "CMAKE_CXX_FLAGS_DEBUG: ${CMAKE_CXX_FLAGS_DEBUG}") + MESSAGE(STATUS + "CMAKE_C_FLAGS_RELWITHDEBINFO: ${CMAKE_C_FLAGS_RELWITHDEBINFO}") + MESSAGE(STATUS + "CMAKE_CXX_FLAGS_RELWITHDEBINFO: ${CMAKE_CXX_FLAGS_RELWITHDEBINFO}") +ENDIF() diff --git a/mysql-wsrep-5.6/Docs/ChangeLog b/mysql-wsrep-5.6/Docs/ChangeLog index d4f05948..9988db36 100644 --- a/mysql-wsrep-5.6/Docs/ChangeLog +++ b/mysql-wsrep-5.6/Docs/ChangeLog @@ -1,1373 +1 @@ ------------------------------------------------------------- -revno: 5732 -committer: Anirudh Mangipudi -branch nick: mysql-5.6.16-release -timestamp: Thu 2014-01-09 20:13:58 +0530 -message: - Bug#18047812: RESULT FILE MISMATCH DUE TO COPYRIGHT YEAR IN OUTPUT - Problem: - Copyright mismatch is causing test failure. - - Solution: - Replacing the present year (2014) as the copyright year. ------------------------------------------------------------- -revno: 5731 -committer: Balasubramanian Kandasamy -branch nick: mysql-5.6.16-release -timestamp: Thu 2014-01-09 13:40:11 +0100 -message: - Updated release version ------------------------------------------------------------- -revno: 5730 -committer: Tor Didriksen -branch nick: 5.6.16-release -timestamp: Wed 2014-01-08 14:55:14 +0100 -message: - Bug#18046811 COMPILATION ERRORS WHILE BUILDING MYSQL-5.6.16 ON SOLARIS 10 - - Include my_config.h before any system headers, to avoid - Warning (Anachronism): Attempt to redefine _FILE_OFFSET_BITS without using #undef. - - Include before to avoid - "/usr/include/floatingpoint.h", line 164: Error: FILE is not defined." - "/usr/include/stdio.h", line 82: Error: Multiple declaration for std::FILE." - (this must be a bug in the solaris header files) ------------------------------------------------------------- -revno: 5729 -committer: Murthy Narkedimilli -branch nick: mysql-5.6.16-release -timestamp: Wed 2014-01-08 11:16:17 +0100 -message: - Correcting the version, and updating the current copyright year which reflects in the MySQL welcome message. ------------------------------------------------------------- -revno: 5728 -committer: Balasubramanian Kandasamy -branch nick: mysql-5.6.16-release -timestamp: Tue 2014-01-07 19:09:54 +0100 -message: - Fix for fedora and rpm uln package build ------------------------------------------------------------- -revno: 5727 [merge] -committer: Vishal Chaudhary -branch nick: mysql-5.6 -timestamp: Mon 2014-01-06 12:04:40 +0100 -message: - Empty version change upmerge - ------------------------------------------------------------ - revno: 2875.437.321 - author: laasya.moduludu@oracle.com - committer: Laasya Moduludu - branch nick: mysql-5.5 - timestamp: Mon 2014-01-06 11:43:05 +0100 - message: - Raise version number after cloning 5.5.36 ------------------------------------------------------------- -revno: 5726 -author: vishal.chaudhary@oracle.com -committer: Vishal Chaudhary -branch nick: mysql-5.6 -timestamp: Mon 2014-01-06 11:43:05 +0100 -message: - Raise version number after cloning 5.6.16 ------------------------------------------------------------- -revno: 5725 -tags: clone-5.6.16-build -committer: Jimmy Yang -branch nick: mysql-5.6 -timestamp: Mon 2014-01-06 16:24:28 +0800 -message: - Fix #Bug 17800829 - MEMCACHED.MEMC247_CACHE_POLICY CRASHES IN PB2 WITH - ASSERTION `IT->SLABS_CLSID - - rb://3890 approved by Sunny Bains ------------------------------------------------------------- -revno: 5724 [merge] -committer: Murthy Narkedimilli -branch nick: mysql-5.6 -timestamp: Mon 2014-01-06 11:33:08 +0530 -message: - Update/added copyright headers - ------------------------------------------------------------ - revno: 2875.437.320 - tags: clone-5.5.36-build - committer: Murthy Narkedimilli - branch nick: mysql-5.5 - timestamp: Mon 2014-01-06 10:52:35 +0530 - message: - Updated/added copyright headers ------------------------------------------------------------- -revno: 5723 -committer: Murthy Narkedimilli -branch nick: mysql-5.6 -timestamp: Mon 2014-01-06 10:53:19 +0530 -message: - Updated/added copyright headers ------------------------------------------------------------- -revno: 5722 -committer: Venkata Sidagam -branch nick: 5.6 -timestamp: Fri 2014-01-03 15:38:15 +0530 -message: - Bug #17209750 OLD FILES NOT BEING REMOVED FROM - PERFORMANCE_SCHEMA.FILE_INSTANCES - - The test case is having issues(basically some timining issues). - Need to refactor the test case. Hence removed for time being. ------------------------------------------------------------- -revno: 5721 -committer: Sujatha Sivakumar -branch nick: Bug17842137_mysql-5.6 -timestamp: Thu 2014-01-02 11:01:12 +0530 -message: - Bug#17842137:ASSERT IN ROW BASED REPLICATION WHEN - TRANSACTION CACHE SIZE IS EXACTLY 32768 - - Problem: - ======== - When the binlog's IO_CACHE grows up to exact 32768 bytes it - causes binlog events to get corrupt, if this transaction - precedes with a transaction whose IO_CACHE size is >32768. - - Analysis: - ======== - On the master during the execution of a transaction all the - events that are related to that transaction will be written - to the IO_CACHE. The size of the IO_CACHE is 32768. - - The transaction whose events can fit within the IO_CACHE - are never flushed to disk. During flush operation they do - nothing but simply set the cache->read_end and end_of_file - to current size. At the time of writing to the binlog the - cache is read back and if CRC is enabled checksum is - calculated if not then the content is written to binlog file. - - If the transaction size exceeds 32768 then it will be - written to a temporary file and the cache is reinited so - that remaining events can be written to cache. During - writing to binary log file this temp file is read back. - - In the bug scenario the transaction size grows exactly to - 32768, and during flush operation it expects current size of - cache to be < 32768. Which is incorrect ideally it should - have been <= 32768. As the size is still equal to IO_CACHE - size. - - Because of the incorrect check cache is marked for flush but - the writing function "my_b_write" doesn't flush the buffer - to disk as it expects cache size to be > 32768 and the cache - is reinited without writing to temp file. When the cache is - read back it finds the buffer to be empty and tries to fill - it from temp file which wrong. Hence the buffer is filled - with some other transaction related data causing corruption. - - - Fix: - === - During flush the check for size has been changed from "<" to - "<=". ------------------------------------------------------------- -revno: 5720 -committer: Yasufumi Kinoshita -branch nick: mysql-5.6 -timestamp: Tue 2013-12-31 12:29:00 +0900 -message: - Follow up for Bug#16249481 fix. - If flush_rbt is active (in recovery phase), buf_page_t::space and buf_page_t::offset cannot be invalidated until the bpage is removed from flush_list. - - * revno: 5677 - * committer: Sunny Bains - * branch nick: 5.6 - * timestamp: Tue 2013-12-10 14:30:34 +0530 - * message: - * Bug#16249481 - INNODB DOES NOT SCALE WELL ON 12 CORE SYSTEM FOR SPECIFIC ALL IN MEMORY SELECT - * - * Add a new build option: INNODB_PAGE_ATOMIC_REF_COUNT, default is ON. - * - * If this option is enabled then use atomic reference counting to track - * block use. If it is off then use the old way. - * * Approved by Yasufumi Kinoshita rb#3958. ------------------------------------------------------------- -revno: 5719 -committer: Ashish Agarwal -branch nick: bug_17065383 -timestamp: Mon 2013-12-30 13:40:45 +0530 -message: - Bug#17065383: PASSWORD VALIDATE PLUGIN STORES HASH OF - LOWERCASE PASSWORD BY MISTAKE - - PROBLEM: Dictionary check was done on the original - password string (converting it to lowercase), - which leads to storing a wrong password hash - for the user. - - SOLUTION: A copy of the string is created and all the - string comparisons is done on it. ------------------------------------------------------------- -revno: 5718 [merge] -committer: Arun Kuruvila -branch nick: mysql-5.6 -timestamp: Mon 2013-12-30 12:00:48 +0530 -message: - Merging from mysql-5.5 to mysql-trunk. - ------------------------------------------------------------ - revno: 2875.437.319 - committer: Arun Kuruvila - branch nick: mysql-5.5 - timestamp: Mon 2013-12-30 11:39:55 +0530 - message: - Bug #16324629 : SERVER CRASHES ON UPDATE/JOIN FEDERATED + - LOCAL TABLE WHEN ONLY 1 LOCAL ROW - - Description: When updating a federated table with UPDATE... - JOIN, the server consistently crashes with Signal 11 when - only 1 row exists in the local table involved in the join - and that 1 row can be joined with a row in the federated - table. - - Analysis: Interaction between the federated engine and the - optimizer results in the crash. In our scenario, ie, local - table having only one row, the program is following a - different path because the table is treated as a constant - table by the join optimizer. So in this scenario - "index_read()" is happening in the prepare phase, - since optimizer plan is different for constant table joins. - In this case, "index_read_idx_map()" (inside handler.cc) is - calling "index_read()" and inside "index_read()", matching - rows are fetched and "stored_result" gets populated by - calling "store_result()". And just after "index_read()", - "index_end()" function is called. And in the "index_end()", - its freeing the "stored_result" by calling "free_result()". - So when it reaches the execution phase, in "position()" - function, we are getting assertion at - "DBUG_ASSERT(stored_result);". In all other scenarios (ie, - table with more than 1 row), optimizer plan is different - and "index_read()" is happening in the execution phase. - - Fix: So my fix is to have a separate ha_federated member - function for "index_read_idx_map()" which will handle - federated engine separately. So that position() will be - called before index_end() call in constant table scenario. ------------------------------------------------------------- -revno: 5717 [merge] -committer: Aditya A -branch nick: mysql-5.6 -timestamp: Sun 2013-12-29 17:10:21 +0530 -message: - Bug#12762390 SHOW INNODB STATUS REPORTS NON-FK - ERRORS IN THE FK SECTION - - [Merge from 5.5] - ------------------------------------------------------------ - revno: 2875.437.318 - committer: Aditya A - branch nick: mysql-5.5 - timestamp: Sun 2013-12-29 16:55:24 +0530 - message: - Bug#12762390 SHOW INNODB STATUS REPORTS NON-FK - ERRORS IN THE FK SECTION - - ANALYSIS - -------- - - Any error during the renaming of the table was - incorrectly logged in the dict_foreign_err_file - and it showed up in foreign key section when - we give the query "show engine innodb status". - - FIX - --- - Prevent renaming error from being logged in - dict_foreign_err_file section. - - [Aprooved by marko #rb 2501 ] ------------------------------------------------------------- -revno: 5716 -committer: Praveenkumar Hulakund -branch nick: mysql_5_6 -timestamp: Sat 2013-12-28 22:08:40 +0530 -message: - Bug#17862905: MYSQLDUMP CREATES USELESS METADATA LOCKS - - Problem Description: - -------------------- - While taking the backup using tool "mysqldump" with option - "--single-transaction", MDL lock is acquired on each table dumped. - But these locks are not released until the backup operation is - completed. Any concurrent DDL operation on those tables will be - blocked until backup operation is completed. Moreover such blocked - DDL operations will also block other concurrent DML operations - (Since DDL has priority over DML) creating pile-up. - - Note that officially mysqldump --single-transaction is documented as - not working/not supported in presence of concurrent DDL statements. - But it might work for some people in some scenarios and before 5.5, - due to absence of MDL, combination of "mysqldump --single-transaction" - and concurrent DDL didn't create pile-up of DML statements. - - Analysis: - -------------------- - "mysqldump" start transaction with consistent snapshot and sets - isolation level to "repeatable read" when it is used with option - "--single-transaction". Data of all the tables is dumped using - SELECT statement as part of this transaction. MDL lock SR is - taken on all these tables and held till the transaction is - committed or rolled back. Any other incompatible MDL lock request - on these tables will wait until timeout or "mysqldump" operation - is completed. - - As result concurrent DDL operations on the tables which were dumped - will be blocked till the end of dump or timeout. - - Note that once table is dumped it won't be used again by "mysqldump". - This fact and the fact that "mysqldump --single-transactions" produces - backup with validity point at the start of transaction (and also - retrieves binlog position for backup at the start of transaction) means - that "mysqldump --single-transaction" can release MDL on tables which - it has already dumped without introducing more problems with - consistency. - - Fix: - -------------------- - To make "mysqldump --single-transaction" to release locks once - dumping of the table is done, modified mysqldump client code - to dump table data after setting a savepoint. Once dumping of - table data is over, added code to rollback to the savepoint set. - Rolling back to savepoint will release MDL lock acquired for the - table. - - But as of now, on rollback to savepoint, MDL locks are - not released if binlog is on. This logic is added to avoid - dropping of tables before rollback to savepoint event is - written to binlog. But when binlog handlerton can clear cache - and can safely rollback to savepoint without writing an event for - rollback to savepoint then also we are not releasing the MDL - locks. - - This is fixed by introducing a new handlerton function call - savepoint_rollback_can_release_mdl. We call this function to - check with each storage engine participating in transaction - whether it is safe to release MDL after rollback to savepoint. - Metadata locks are released only if all the storage engines - agreed that it is a safe thing to do. - - 1) For InnoDB storage engine this handlerton function can allow - release of MDL locks if transaction has not acquired any InnoDB - locks. - - 2) For Binlog this handlerton function can allow release of MDL - locks if rollback to savepoint will completely remove any - traces of transaction from cache. - - 3) Absence of this method for any storage engine means it is not - safe to release MDL locks. - - Note that this patch doesn't make "mysqldump --single-transaction" - safe in general case in presence of concurrent DDL. Nor makes it - officially supported in this case. It just allows to avoid problem - with unnecessary concurrent DDL blocking and associated DML query - pile-up in some specific cases when it might work. ------------------------------------------------------------- -revno: 5715 -committer: Venkata Sidagam -branch nick: 5.6 -timestamp: Fri 2013-12-27 14:11:20 +0530 -message: - Bug #17209750 OLD FILES NOT BEING REMOVED FROM - PERFORMANCE_SCHEMA.FILE_INSTANCES - - Description: "When a file is deleted from the disk, it is - also removed from the file_instances table." This is not - true on either 5.5.23 or 5.6.11. When there are three - relay log files on disk, but the file_instances table - lists more number of relay logs. Even this case is - happening for master bin and slave bin logs. - - Analysis: When we are deleting the - slave-relay-bin/master-bin/slave-bin log files we were - using the my_delete() function which is not P_S - instrumented function. Hence, the files are not removed - from the file_instances table. - - Fix: As part of the fix we replaced my_delete() - function with P_S instrumented mysql_file_delete() function. ------------------------------------------------------------- -revno: 5714 -committer: Shaohua Wang -branch nick: mysql-5.6-bugfix1 -timestamp: Thu 2013-12-26 17:47:04 +0800 -message: - BUG#17978763 - SEGV IN FTSPARSE() BOOLEAN MODE QUERY AGAINST '\"\"@117' - - We check whether node is null in fts_ast_term_set_distance, and do nothing - if the node is null. - - rb://4230 approved by Jimmy.Yang ------------------------------------------------------------- -revno: 5713 [merge] -committer: Satya Bodapati -branch nick: mysql-5.6 -timestamp: Thu 2013-12-26 14:39:11 +0530 -message: - Merge testcase for BUG#16752251 from mysql-5.5 to mysql-5.6 - ------------------------------------------------------------ - revno: 2875.437.317 - committer: Satya Bodapati - branch nick: mysql-5.5 - timestamp: Thu 2013-12-26 14:33:52 +0530 - message: - BUG#16752251 - INNODB DOESN'T REDO-LOG INSERT BUFFER MERGE OPERATION IF - IT IS DONE IN-PLACE - - Add testcase as innodb-change-buffer-recovery.test ------------------------------------------------------------- -revno: 5712 -committer: Annamalai Gurusami -branch nick: mysql-5.6 -timestamp: Tue 2013-12-24 10:59:45 +0530 -message: - Fixing a pb2 issue. This test case times out under valgrind. - Not running it under valgrind until further notice. ------------------------------------------------------------- -revno: 5711 -committer: Annamalai Gurusami -branch nick: mysql-5.6 -timestamp: Mon 2013-12-23 12:11:26 +0530 -message: - Bug #17991524 THE DEBUG SYNC POINT IB_CORRUPT_PAGE0 IS NOT WORKING AS EXPECTED - - Problem: - - The debug point ib_corrupt_page0 is not working reliably. This is because of - the background i/o threads. If the page 0 of a tablespace is flushed by a user - session (the SET command for variable innodb_buf_flush_list_now), then the - debug point ib_corrupt_page0 will be enabled and will work as expected. But if - the page 0 of the tablespace is flushed by a background i/o thread, then - ib_corrupt_page0 will not work as expected. - - Solution: - - Removing the ib_corrupt_page0 debug point and re-writing the test case using - some other means. - - rb#4216 approved by Jimmy. ------------------------------------------------------------- -revno: 5710 -committer: Aditya A -branch nick: mysql-5.6 -timestamp: Sun 2013-12-22 22:07:51 +0530 -message: - Bug#17287443 ERROR(1030): GOT ERROR -1 FROM STORAGE ENGINE - - Post push test failure fix in test script. ------------------------------------------------------------- -revno: 5709 -committer: Annamalai Gurusami -branch nick: mysql-5.6 -timestamp: Fri 2013-12-20 19:14:13 +0530 -message: - Fixing a pb2 issue. The combination gcov + embedded + crash test does not work. ------------------------------------------------------------- -revno: 5708 -committer: Neeraj Bisht -branch nick: 5.6 -timestamp: Fri 2013-12-20 15:15:00 +0530 -message: - Bug#16539903 - SERVER CRASHES IN IN HA_MYISAM::FT_INIT_EXT WITH - A FROM SUBQUERY - - Problem:- - Full-text search combined with derived tables causes a segment fault. - - Analysis:- - In query like - EXPLAIN SELECT MATCH(ft) AGAINST( "test" IN BOOLEAN MODE) FROM - ( SELECT ft FROM t1 ) AS t; - - We are creating a temporary table for the subquery result table. - But after wl-5274(where we are postponed materialization), we will create - tmp table, but skip instantiation of temporary table. - - When we have full-text function in our main select query, we are - going to call Item_func_match::init_search() for all the full-text item. - There we are going to take care about - condition like - --> match ... against (null) - and we are going to call handler::ft_init_ext(), which is used to - Initialize full-text index scan(which need table to be initialized). - but as we havnt initialized the table. This cause a segmentation fault. - - Solution:- - When we have derived tables, instead of intializing full-text function at - optimization, we will initiate it at the time of execution . ------------------------------------------------------------- -revno: 5707 -committer: Annamalai Gurusami -branch nick: mysql-5.6 -timestamp: Fri 2013-12-20 12:05:46 +0530 -message: - BUG 17335427 - INNODB CAN NOT USE THE DOUBLEWRITE BUFFER PROPERLY - - Problem: - - Fixing a memory issue in my original fix. This was identified from PB2 - failures. If the page is uncompressed, then its size must be equal to - UNIV_PAGE_SIZE. The buf_page_is_corrupted() assumes the size of the - uncompressed pages as equal to UNIV_PAGE_SIZE. - - Solution: - - Call buf_page_is_corrupted() for uncompressed pages only if page size is - equal to UNIV_PAGE_SIZE. - - approved by Yasufumi over IM. ------------------------------------------------------------- -revno: 5706 -committer: Aditya A -branch nick: mysql-5.6 -timestamp: Fri 2013-12-20 11:22:30 +0530 -message: - Bug#17287443 ERROR(1030): GOT ERROR -1 FROM STORAGE ENGINE - - PROBLEM - ------- - When we try to do DML operations in innodb - force recovery mode.we get a cryptic error - message. - ERROR(1030): GOT ERROR -1 FROM STORAGE ENGINE - - FIX - --- - Introduced a new error ER_INNODB_FORCE_RECOVERY - which will print proper error message. - - [Approved by Kevin and Krunal #rb4095 and rb#4137] ------------------------------------------------------------- -revno: 5705 [merge] -committer: Venkata Sidagam -branch nick: 5.6 -timestamp: Thu 2013-12-19 16:29:20 +0530 -message: - Bug #17780290 PUBLISH THE GIS TEST FOR BUG#16451878 - - Merging from 5.5 to 5.6 - ------------------------------------------------------------ - revno: 2875.437.316 - committer: Venkata Sidagam - branch nick: 5.5 - timestamp: Thu 2013-12-19 16:08:38 +0530 - message: - Bug #17780290 PUBLISH THE GIS TEST FOR BUG#16451878 - - Adding the test cases for the BUG#16451878. ------------------------------------------------------------- -revno: 5704 -committer: Aditya A -branch nick: mysql-5.6 -timestamp: Thu 2013-12-19 16:06:45 +0530 -message: - Bug#17448389 SYS_DATAFILES TABLE IS NOT UPDATED AFTER - RECOVERY FOR TABLES WITH .ISL PATH - - PROBLEM - ------- - - If user changes updates the path of .ibd files in - *.isl files and does a crash recovery then tables - are loaded from the updated path,but SYS_DATAFILES - are not updated. Now if the user stops and restarts - the server in normal mode ,it will detect that the - there are two different copies of data directory - (one in isl file and one in SYS_DATAFILES table) - and both are valid ( we have not deleted the ibd - file from the original path) and refuse to load the - table and ask user to resolve the conflict. - - FIX - --- - Update the SYS_DATFILES to reflect the updated path - after crash recovery. - - [Aprroved by Kevin rb#4177] ------------------------------------------------------------- -revno: 5703 -committer: Annamalai Gurusami -branch nick: mysql-5.6 -timestamp: Thu 2013-12-19 13:20:50 +0530 -message: - Bug #17335427 INNODB CAN NOT USE THE DOUBLEWRITE BUFFER PROPERLY - - Problem: - - If the first page (page 0) of the single table tablespace is corrupted in the - data file then our recovery doesn't progress even if there is a clean copy of - the same available in the double write buffer. - - Analysis: - - During recovery, our first step is to process the double write buffer. We look - at the pages in the double write buffer and determine its (space_id, page_no) - details. Each of the page in the double write buffer corresponds to a page in - the .ibd data file. Using the space_id information we need to map the page in - the double write buffer to the corresponding ibd file. This is done by reading - the space_id information from the first page of the single table tablespace. - If the first page of the single table tablespace is corrupted, then we are - unable to determine the data file to which a particular page in the double - write buffer belongs to. So we need to explore and see if we can determine the - space_id in other means. - - Solution: - - Assume a particular page size. Read N number of pages from the ibd file. - Ignore the corrupted pages and determine the (space_id, page_size and zip_size) - information. Repeat this for all supported page sizes. Using this approach - determine the correct (space_id, page_size and zip_size) of the ibd file. - - rb#4025 approved by Yasufumi. ------------------------------------------------------------- -revno: 5702 -committer: Thirunarayanan B -branch nick: r-5.6 -timestamp: Thu 2013-12-19 11:44:13 +0530 -message: - Bug #16868967 MYSQL USES SIGNIFICANTLY MORE MEMORY - FOR ALTER TABLE THAN EXPECTED - - Problem: - During online alter table, an online log buffer would be created for - index that is being rebuilt or created. This online log contains two - buffers - head and tail. Alter table takes lot of memory than - expected even there is no concurrent write for index. But Both head - and tail buffer will be useful when there is a concurrent - write on the index. If there are many partitions involved, it is - unlikely that all the partitions would be modified concurrently. - - Solution: - Allocate the tail buffer only when first DML statement happens on the - index. Allocate the head buffer only in apply phase and freed at the - end of the apply phase. - - Approved by Marko rb#3850 ------------------------------------------------------------- -revno: 5701 -committer: horst.hunger@oracle.com -branch nick: mysql-5.6 -timestamp: Wed 2013-12-18 15:39:57 +0100 -message: - Request by development to run memcached in 5.6 ------------------------------------------------------------- -revno: 5700 [merge] -committer: Bjorn Munch -branch nick: main-56 -timestamp: Wed 2013-12-18 14:03:30 +0100 -message: - Followup fix for Bug 17827378 MTR DOES NOT REPORT IF A TEST - FAILS TO DROP CREATED EVENTS: - - - Check for triggers should exclude mtr's own - - Move the code to before checksum table as it might affects result - of some autdit_log tests - - Remove duplicated show status like 'slave_open_temp_tables'; - ------------------------------------------------------------ - revno: 2875.437.315 - committer: Bjorn Munch - branch nick: main-55 - timestamp: Wed 2013-12-18 14:01:15 +0100 - message: - Followup fix for Bug 17827378 MTR DOES NOT REPORT IF A TEST - FAILS TO DROP CREATED EVENTS: - - - Check for triggers should exclude mtr's own - - Move the code to before checksum table as it might affect result - of some autdit_log tests (does in 5.6) - - Replace SHOW STATUS LIKE 'slave_open_temp_tables' to be like in 5.6 ------------------------------------------------------------- -revno: 5699 [merge] -committer: Tor Didriksen -branch nick: 5.6-merge -timestamp: Wed 2013-12-18 11:17:16 +0100 -message: - merge 5.5 => 5.6 - ------------------------------------------------------------ - revno: 2875.437.314 - committer: Tor Didriksen - branch nick: 5.5 - timestamp: Wed 2013-12-18 11:08:21 +0100 - message: - MTR's internal check of the test case 'main.events_trans' failed. - fix: DROP EVENT e1; - ------------------------------------------------------------ - revno: 2875.437.313 - committer: Tor Didriksen - branch nick: 5.5 - timestamp: Wed 2013-12-18 11:05:18 +0100 - message: - Bug#16316074 RFE: MAKE TMPDIR A BUILD-TIME CONFIGURABLE OPTION - Bug#68338 RFE: make tmpdir a build-time configurable option - - Background: Some distributions use tmpfs for mounting /tmp by - default, which has some advantages, but brings also new - issues. Fedora started using tmpfs on /tmp in version 18 for - example. If not configured otherwise in my.cnf, MySQL uses - system's constant P_tmpdir expanded to /tmp on Linux. This can - introduce some problems with limited space in /tmp and also some - data loss in case of replication slave [1]. - - In case distributions would like to use /var/tmp, which should be - better for MySQL purposes, then we have to patch the source or - change tmpdir option in my.cnf, which is however not updated in - case it has already existed. - - Thus, it would be useful to be able to specify default tmpdir - path using a configure option, while using P_tmpdir in case it is - not defined explicitly. - - Based on a contribution from Honza Horak ------------------------------------------------------------- -revno: 5698 [merge] -committer: Venkatesh Duggirala -branch nick: mysql-5.6 -timestamp: Wed 2013-12-18 13:55:27 +0530 -message: - Bug17632978 SLAVE CRASHES IF ROW EVENT IS CORRUPTED - (MYSQLBINLOG -V CRASHES WITH THAT BINLOG) - - Merging fix from mysql-5.5 - Post-Push: Fix Werror-build problem - ------------------------------------------------------------ - revno: 2875.437.312 - committer: Venkatesh Duggirala - branch nick: mysql-5.5 - timestamp: Wed 2013-12-18 13:52:49 +0530 - message: - Bug17632978 SLAVE CRASHES IF ROW EVENT IS CORRUPTED - (MYSQLBINLOG -V CRASHES WITH THAT BINLOG) - - Post Push: Fixing Werror compiler issue ------------------------------------------------------------- -revno: 5697 [merge] -committer: Venkatesh Duggirala -branch nick: mysql-5.6 -timestamp: Tue 2013-12-17 22:26:45 +0530 -message: - Bug17632978 SLAVE CRASHES IF ROW EVENT IS CORRUPTED - (MYSQLBINLOG -V CRASHES WITH THAT BINLOG) - - Merging fix from mysql-5.5 - ------------------------------------------------------------ - revno: 2875.437.311 - committer: Venkatesh Duggirala - branch nick: mysql-5.5 - timestamp: Tue 2013-12-17 22:11:22 +0530 - message: - Bug#17632978 SLAVE CRASHES IF ROW EVENT IS CORRUPTED - (MYSQLBINLOG -V CRASHES WITH THAT BINLOG) - - Problem: If slave receives a corrupted row event, - slave server is crashing. - - Analysis: When slave is unpacking the row event, it is - not validating the data before applying the event. If the - data is corrupted for eg: the length of a field is wrong, - it could end up reading wrong data leading to a crash. - A similar problem happens when mysqlbinlog tool is used - against a corrupted binlog using '-v' option. Due to -v - option, the tool tries to print the values of all the - fields. Corrupted field length could lead to a crash. - - Fix: Before unpacking the field, a verification - will be made on the length. If it falls into the event - range, only then it will be unpacked. Otherwise, - "ER_SLAVE_CORRUPT_EVENT" error will be thrown. - Incase mysqlbinlog -v case, the field value will not be - printed and the processing of the file will be stopped. ------------------------------------------------------------- -revno: 5696 -committer: Venkatesh Duggirala -branch nick: mysql-5.6 -timestamp: Tue 2013-12-17 17:13:02 +0530 -message: - BUG#17544169 MYSQLBINLOG -V DOES NOT PROPERLY DECODE - DECIMAL VALUES IN AN RBR LOG - - Analysis: If verbose (-v) option is used in - mysqlbinlog tool it decodes a RBR event into - the query (the same query which was used at - source to generate) and displays immediately - after displaying the row event in the output. - The algorithm used to display the decimal was - wrongly written which were causing problems - similar to the ones mentioned below. - Eg: -0.938582 is decoded as: -938582000.000000000 - 4294967296.001 as: 000000004.294967296.001000000.000000000 - - Fix: 'decimal2string' is an existing function - which converts a decimal value into a string - format. Hence the algorithm used was replaced with - this existing 'decimal2string' function to - avoid problems mentioned above. - After this fix, decimal will be printed exactly - the same way how they get printed in 'select' command - output. - Eg: -0.938582 for decimal(10,10) will be displayed as - -0.938582000. 4294967296.001 for decimal(20,10) will - be displayed as 4294967296.0010000000 ------------------------------------------------------------- -revno: 5695 -committer: Yasufumi Kinoshita -branch nick: mysql-5.6 -timestamp: Tue 2013-12-17 20:30:16 +0900 -message: - Follow up for Bug#16249481 fix. - backport from mysql-trunk - - revno: 7152 - committer: Vasil Dimov - branch nick: mysql-trunk - timestamp: Tue 2013-12-17 11:29:47 +0200 - message: - Followup to sunny.bains@oracle.com-20131210092144-0xfzdmj5vgqlqpq2 - - Fix a compilation failure on Win32: - - buf0buf.ic(1016): error C2664: '_InterlockedExchangeAdd' : cannot - convert parameter 1 from 'ib_uint32_t *' to 'volatile long *' - Types pointed to are unrelated; conversion requires reinterpret_cast, - C-style cast or function-style cast ------------------------------------------------------------- -revno: 5694 -committer: Yasufumi Kinoshita -branch nick: mysql-5.6 -timestamp: Tue 2013-12-17 20:03:26 +0900 -message: - Follow up for Bug#16249481 fix. - Atomic operation macro for Soralis and Windows added by Bug#16249481 fix were wrong. - Aligned same for mysql-trunk. - - * revno: 5677 - * committer: Sunny Bains - * branch nick: 5.6 - * timestamp: Tue 2013-12-10 14:30:34 +0530 - * message: - * Bug#16249481 - INNODB DOES NOT SCALE WELL ON 12 CORE SYSTEM FOR SPECIFIC ALL IN MEMORY SELECT - * - * Add a new build option: INNODB_PAGE_ATOMIC_REF_COUNT, default is ON. - * - * If this option is enabled then use atomic reference counting to track - * block use. If it is off then use the old way. - * - * Approved by Yasufumi Kinoshita rb#3958. ------------------------------------------------------------- -revno: 5693 -committer: Jorgen Loland -branch nick: mysql-5.6 -timestamp: Tue 2013-12-17 10:45:12 +0100 -message: - BUG#17889511 - - fix test errors ------------------------------------------------------------- -revno: 5692 -committer: Yasufumi Kinoshita -branch nick: mysql-5.6 -timestamp: Mon 2013-12-16 21:03:59 +0900 -message: - The fix for Bug#16249481 was not enabled for builds. - - "#cmakedefine INNODB_PAGE_ATOMIC_REF_COUNT" is added to config.h.cmake - - Patch made by Sunny Bains (by mail) - Approved by Yasufumi Kinoshita - - * revno: 5677 - * committer: Sunny Bains - * branch nick: 5.6 - * timestamp: Tue 2013-12-10 14:30:34 +0530 - * message: - * Bug#16249481 - INNODB DOES NOT SCALE WELL ON 12 CORE SYSTEM FOR SPECIFIC ALL IN MEMORY SELECT - * - * Add a new build option: INNODB_PAGE_ATOMIC_REF_COUNT, default is ON. - * - * If this option is enabled then use atomic reference counting to track - * block use. If it is off then use the old way. - * - * Approved by Yasufumi Kinoshita rb#3958. ------------------------------------------------------------- -revno: 5691 -committer: Jorgen Loland -branch nick: mysql-5.6 -timestamp: Mon 2013-12-16 08:40:11 +0100 -message: - Bug#17889511: FORCE INDEX UNABLE TO FORCE AN ORDER BY WITH JOIN - - "FORCE INDEX [FOR ORDER BY] (indexName)" did not work for joins - because test_if_skip_sort_order() contains a heuristic that - table scan + join cache tends to be cheaper than an index scan. - - While the heuristic may be correct, it should not override the - users explicit request to use the index. - - This patch also changes the warning created for EXPLAIN. Instead - of printing only "IGNORE/USE/FORCE INDEX" it now also prints - "FOR [GROUP BY|ORDER BY|JOIN]" if this was specified in the - query. ------------------------------------------------------------- -revno: 5690 -committer: Thirunarayanan B -branch nick: r-5.6 -timestamp: Mon 2013-12-16 12:29:20 +0530 -message: - Bug #16924719 SMALL PERFORMANCE IMPACT WITH HEAP BLOCK - DEBUGGING INFO IN RELEASE BUILDS - Problem: - Memory block debugging details (file_name, lineno) is present on - release builds.It impacts by a tiny amount on every heap creation. - - Solution: - Removed the file_name, line no parameters from mem_heap_create_func() - and mem_alloc_func() in release builds. - - [Approved by Marko #rb 4022] ------------------------------------------------------------- -revno: 5689 [merge] -committer: Kent Boortz -branch nick: mysql-5.6 -timestamp: Sat 2013-12-14 13:11:48 +0100 -message: - Merge mysql-5.5 --> mysql-5.6 - ------------------------------------------------------------ - revno: 2875.437.310 - committer: Kent Boortz - branch nick: mysql-5.5 - timestamp: Sat 2013-12-14 13:05:36 +0100 - message: - Bug#29716 : Bug#11746921 : MYSQL_INSTALL_DB REFERS TO THE (OBSOLETE) MYSQLBUG SCRIPT DURING INSTALLATION - Bug#68742 : Bug#16530527 : OBSOLETE BUGREPORT ADDRESSES ------------------------------------------------------------- -revno: 5688 -committer: Shaohua Wang -branch nick: mysql-5.6-bugfix1 -timestamp: Fri 2013-12-13 17:56:54 +0800 -message: - Bug#17033591 5.6.12 REMOVED UNIV_SYNC_DEBUG FROM UNIV_DEBUG - - Enable UNIV_SYNC_DEBUG and fix fts test failures. - - rb://4139 approved by Marko and Jimmy. ------------------------------------------------------------- -revno: 5687 [merge] -committer: Marc Alff -branch nick: mysql-5.6-push -timestamp: Fri 2013-12-13 10:42:34 +0100 -message: - Merge mysql-5.5 --> mysql-5.6 - ------------------------------------------------------------ - revno: 2875.437.309 [merge] - committer: Marc Alff - branch nick: mysql-5.5-push - timestamp: Fri 2013-12-13 10:26:05 +0100 - message: - Push to mysql-5.5 - ------------------------------------------------------------ - revno: 2875.465.1 - committer: Marc Alff - branch nick: mysql-5.5-bug17928281 - timestamp: Wed 2013-12-11 11:15:23 +0100 - message: - Bug#17928281 'CHECK_PERFORMANCE_SCHEMA()' LEAVES 'CURRENT_THD' REFERRING - DESTRUCTED THD OBJ - - Prior to fix, function check_performance_schema() could leave - behind stale pointers in thread local storage, for the following keys: - - THR_THD (used by _current_thd) - - THR_MALLOC (used for memory allocation) - This is an unsafe practice, which can potentially cause crashes, - and that can cause other bugs when code is modified during maintenance. - - With this fix, thread local storage keys used temporarily within - function check_performance_schema() are cleaned up after use. ------------------------------------------------------------- -revno: 5686 -committer: mithun -branch nick: mysql-5.6 -timestamp: Fri 2013-12-13 11:09:40 +0530 -message: - Bug #17513341 : >=4G JOIN_BUFFER_SIZE CRASH WHEN - JOINING TABLES, VIEWS - ISSUE : 1. Offset address from a join buffer of size - >=4gb can be >4 bytes long. But we - have only considered offsets upto 4bytes long. - This will lead to invalid buffer read and - memory corruption henceforth. - 2. If we fail to allocate join buffer then - we are not freeing the JOIN_CACHE_X instance. - Now next join buffer will wrongly take this - unfreed JOIN_CACHE_X instance as its previous - cache. Hence in incremental join buffer - implementation there will be a chance for - unallocated memory access. - Solution : 1. Now for join buffer >=4gb we have made offest - address size = 8 bytes. - 2. If we fail to allocate the join buffer we free - the JOIN_CACHE_X instance also. ------------------------------------------------------------- -revno: 5685 -committer: Yasufumi Kinoshita -branch nick: mysql-5.6 -timestamp: Fri 2013-12-13 13:23:34 +0900 -message: - Fix the possibile rare race condition at Bug#16249481 fix. - - Approved by Sunny Bains (IM) - - * revno: 5677 - * committer: Sunny Bains - * branch nick: 5.6 - * timestamp: Tue 2013-12-10 14:30:34 +0530 - * message: - * Bug#16249481 - INNODB DOES NOT SCALE WELL ON 12 CORE SYSTEM FOR SPECIFIC ALL IN MEMORY SELECT - * - * Add a new build option: INNODB_PAGE_ATOMIC_REF_COUNT, default is ON. - * - * If this option is enabled then use atomic reference counting to track - * block use. If it is off then use the old way. - * - * Approved by Yasufumi Kinoshita rb#3958. ------------------------------------------------------------- -revno: 5684 -committer: Yasufumi Kinoshita -branch nick: mysql-5.6 -timestamp: Fri 2013-12-13 12:52:47 +0900 -message: - The adjustment about UNIV_SUNC_DEBUG is needed for Bug#16249481 fix - - Approved by Sunny Bains (IM) - - * revno: 5677 - * committer: Sunny Bains - * branch nick: 5.6 - * timestamp: Tue 2013-12-10 14:30:34 +0530 - * message: - * Bug#16249481 - INNODB DOES NOT SCALE WELL ON 12 CORE SYSTEM FOR SPECIFIC ALL IN MEMORY SELECT - * - * Add a new build option: INNODB_PAGE_ATOMIC_REF_COUNT, default is ON. - * - * If this option is enabled then use atomic reference counting to track - * block use. If it is off then use the old way. - * - * Approved by Yasufumi Kinoshita rb#3958. ------------------------------------------------------------- -revno: 5683 [merge] -committer: sayantan dutta -branch nick: mysql-5.6 -timestamp: Thu 2013-12-12 12:23:02 +0530 -message: - Bug 17827378 5.5=>5.6 - ------------------------------------------------------------ - revno: 2875.437.308 - committer: sayantan dutta - branch nick: mysql-5.5 - timestamp: Thu 2013-12-12 12:20:57 +0530 - message: - Bug #17827378 - MTR DOES NOT REPORT IF A TEST FAILS TO DROP CREATED EVENTS ------------------------------------------------------------- -revno: 5682 -committer: Vasil Dimov -branch nick: mysql-5.6 -timestamp: Wed 2013-12-11 16:13:33 +0200 -message: - Backport from mysql-trunk to mysql-5.6: - - ** revision-id: vasil.dimov@oracle.com-20131203163459-tlkyqdq93jysk9z0 - ** committer: Vasil Dimov - ** branch nick: mysql-trunk - ** timestamp: Tue 2013-12-03 18:34:59 +0200 - ** message: - ** Fix Bug#70768 Persistent optimizer statistics often causes LOCK_open stalls - ** - ** Protect each table's dict_table_t::stat* members with a latch dedicated - ** for this table instead of using a global pool of 64 shared latches. - ** With 6 tables, the chances of at least two ending up with the same latch - ** is 23.9%. With a lots of tables, there are tons of collisions. - ** - ** Reviewed by: Kevin (rb:3805) ------------------------------------------------------------- -revno: 5681 -committer: Roy Lyseng -branch nick: mysql-5.6 -timestamp: Wed 2013-12-11 09:59:30 +0100 -message: - Bug#17600176: This query returns a row in 5.5 but not 5.6 or current 5.7 - - The problem query contains an IN subquery that is transformed to - a semi-join. The subquery contains an outer join operation. - When run standalone, the outer join in the subquery is preserved as an - outer join and returns one row. However, when the full query is run, - the outer join is converted into an inner join, and the subquery no - longer returns any row. This causes the outer query to return no rows. - - The problem is with the IF clause in the WHERE clause of the subquery, - When transforming into semi-join, we rely on Item::fix_after_pullout() - to adjust used_tables and not_null_tables information within the - condition objects, in order to determine e.g. the outer join to inner - join transform. However, there is no specific implementation of - ::fix_after_pullout() for the IF clause, so it returns generic - information generated by Item_func::fix_after_pullout(). The fix is to - add this function. - - By analysis, this appears to be a problem for BETWEEN predicates and - IN predicates too. A specific implementation of :;fix_after_pullout() - is added for both classes. - - In addition, it was detected that not_null_tables information was not - updated correctly for class Item_row. However, I was not able to think - out any failing test for this problem, so no test case was added. ------------------------------------------------------------- -revno: 5680 -committer: Thirunarayanan B -branch nick: mysql-5.6 -timestamp: Wed 2013-12-11 14:06:16 +0530 -message: - Bug #17848838 BACKPORT 16511145 TO 5.6 - Backporting the fix of Bug #16511145 - from trunk to mysql-5.6 - - [Approved by Kevin rb# 3983] ------------------------------------------------------------- -revno: 5679 -committer: Anil Toshniwal -branch nick: mysql-5.6 -timestamp: Wed 2013-12-11 13:35:55 +0530 -message: - Bug#16936961 INCORRECT TRANSACTION ACTIVE TIME FOR RECOVING TRANSACTION - AFTER CRASH - Problem: The start_time member of trx_t structure is uninitialized in - trx_create(), that is, at the time of transaction object creation. - The start_time was initialized only at the start of transaction. - So after crash, start_time was taking the garbage value and while - rollback is running in background for uncommited trx. - - Fixed: Initialized the start_time member in trx_resurrect_*(), when trx - is in either ACTIVE or PREPARED STATE. - - Approved by Jimmy (rb#4046). ------------------------------------------------------------- -revno: 5678 -committer: Anil Toshniwal -branch nick: mysql-5.6 -timestamp: Wed 2013-12-11 12:30:53 +0530 -message: - Bug#17810862 INNOCHECKSUM.EXE CANNOT HANDLE >=4G FILES - (AND PRINTS WRONG ERROR MESSAGE) - Problem: - 1) mysql-5.6 innochecksum tool don't support file larger than 2GB. - 2) Wasn't used the Windows specific API, _stat64() to get file size, so - was printing wrong error message. - Solution: - 1) Fixed innochecksum to provide utility to support large file also. - 2) Use Windows Specific API, _stat64() to get file size. - - Approved by Kevin (rb#4012). ------------------------------------------------------------- -revno: 5677 -committer: Sunny Bains -branch nick: 5.6 -timestamp: Tue 2013-12-10 14:30:34 +0530 -message: - Bug#16249481 - INNODB DOES NOT SCALE WELL ON 12 CORE SYSTEM FOR SPECIFIC ALL IN MEMORY SELECT - - Add a new build option: INNODB_PAGE_ATOMIC_REF_COUNT, default is ON. - - If this option is enabled then use atomic reference counting to track - block use. If it is off then use the old way. - - Approved by Yasufumi Kinoshita rb#3958. ------------------------------------------------------------- -revno: 5676 -committer: Roy Lyseng -branch nick: mysql-5.6 -timestamp: Tue 2013-12-10 09:24:24 +0100 -message: - Bug#71010: Bug#17876794: sql/sql_resolver.cc refers to partition engine fields - - An #ifdef was missed in this file. ------------------------------------------------------------- -revno: 5675 -committer: Tor Didriksen -branch nick: 5.6-merge -timestamp: Mon 2013-12-09 09:27:28 +0100 -message: - Bug#17400967 MYSQL_CONFIG FAILS TO FILTER OUT SOME WARNING FLAG - - For clang and gcc we set some warning flags when compiling the server. - Remove them when generating the script mysqld_config. ------------------------------------------------------------- -revno: 5674 -committer: Thirunarayanan B -branch nick: r-5.6 -timestamp: Mon 2013-12-09 11:56:43 +0530 -message: - Bug #16924719 SMALL PERFORMANCE IMPACT WITH HEAP BLOCK - DEBUGGING INFO IN RELEASE BUILDS - Fixed build problem in debug mode. ------------------------------------------------------------- -revno: 5673 -committer: Pavan Naik -branch nick: mysql-5.6 -timestamp: Mon 2013-12-09 11:45:35 +0530 -message: - BUG#16321920 : CREATE A SEPARATE INNODB_ZIP TEST SUITE - - innodb.innodb-wl5980-alter.test and innodb.innodb-wl6445-1.test were affecting innodb_zip.innodb-restart.test - - Added "rmdir" statement in the end of both the tests to remove the directory "$MYSQL_TMP_DIR/alt_dir". ------------------------------------------------------------- -revno: 5672 -committer: Thirunarayanan B -branch nick: r-5.6 -timestamp: Mon 2013-12-09 10:32:10 +0530 -message: - Bug #16924719 SMALL PERFORMANCE IMPACT WITH HEAP BLOCK - DEBUGGING INFO IN RELEASE BUILDS - Problem: - Memory block debugging details (file_name, lineno) is present on - release builds.It impacts by a tiny amount on every heap creation. - - Solution: - Removed file_no, lineno of block details in release builds. - - [Approved by Marko #rb 4022] ------------------------------------------------------------- -revno: 5671 -committer: Vasil Dimov -branch nick: mysql-5.6 -timestamp: Fri 2013-12-06 13:49:49 +0200 -message: - Backport from mysql-trunk to mysql-5.6: - - ** revision-id: vasil.dimov@oracle.com-20131203155950-qm0okr731tms81sy - ** committer: Vasil Dimov - ** branch nick: mysql-trunk - ** timestamp: Tue 2013-12-03 17:59:50 +0200 - ** message: - ** Fix Bug#17193801 DICT_TABLE_SCHEMA_CHECK CALLS DTYPE_SQL_NAME - ** NEEDLESSLY - WASTING A LOT OF CPU - ** - ** Avoid the calls to dtype_sql_name() if the results are not going to - ** be used (they are used only in an event of an error). - ** - ** Reviewed by: Kevin (rb:3625) ------------------------------------------------------------- -revno: 5670 [merge] -committer: Guilhem Bichot -branch nick: 5.6 -timestamp: Wed 2013-12-04 18:08:05 +0100 -message: - Merge of local 5.6 with latest changes of local 5.5 - ------------------------------------------------------------ - revno: 2875.437.307 - committer: Guilhem Bichot - branch nick: 5.5 - timestamp: Wed 2013-12-04 12:32:42 +0100 - message: - Bug#16539979 - BASIC SELECT COUNT(DISTINCT ID) IS BROKEN - Bug#17867117 - ERROR RESULT WHEN "COUNT + DISTINCT + CASE WHEN" NEED MERGE_WALK - - Problem: - COUNT DISTINCT gives incorrect result when it uses a Unique - Tree and its last inserted record has null value. - - Here is how COUNT DISTINCT is processed, given that this query is not - using loose index scan. - - When a row is produced as a result of joining tables (there is only - one table here), we store the SELECTed value in a Unique tree. This - allows elimination of any duplicates, and thus implements DISTINCT. - - When we have processed all rows like this, we walk the Unique tree, - counting its elements, in Aggregator_distinct::endup() (tree->walk()); - for each element we call Item_sum_count::add(). Such function wants to - ignore any NULL value, for that it checks item_sum -> args[0] -> - null_value. It is a mistake: when walking the Unique tree, the value - to be aggregated is not item_sum ->args[0] but rather table -> - field[0]. - - Solution: - instead of item_sum -> args[0] -> null_value, use arg_is_null(), which - knows where to look (like in fix for bug 57932). - - As a consequence of this solution, we have to make arg_is_null() a - little more general: - 1) Because it was so far only used for AVG() (which always has a - single argument), this function was looking at a single argument; now - that it has to work with COUNT(DISTINCT expression1,expression2), it - must look at all arguments. - 2) Because we start using arg_is_null () for COUNT(DISTINCT), i.e. in - Item_sum_count::add (), it implies that we are also using it for - COUNT(no DISTINCT) (same add ()). For COUNT(no DISTINCT), the - nullness to check is that of item_sum -> args[0]. But the null_value - of such item is reliable only if val_*() has been called on it. So far - arg_is_null() was always used after a call to arg_val*(), so could - rely on null_value; but for COUNT, there is no call to arg_val*(), so - arg_is_null() has to call is_null() instead. - - Testcase for 16539979 by Neeraj. Testcase for 17867117 contributed by - Xiaobin Lin from Taobao. ------------------------------------------------------------- -revno: 5669 -committer: Krunal Bauskar krunal.bauskar@oracle.com -branch nick: mysql-5.6 -timestamp: Wed 2013-12-04 15:58:27 +0530 -message: - - bug#70867: WRONG OS ERROR NUMBER REPORTED IN ERROR LOG DURING FAILURE AT - STARTUP - - InnoDB has handler to handle some of the common known errors. - One of such error is ACCESS VIOLATION error which is detected and - proper notifying error message is printed but it left unmapped to internal - InnoDB error code that causes caller function to think that error is - is not from know list and caller try to invoke default error handle - leading to error-code and message mis-match. - - Fixed by ensuring that known ACCESS VIOLATION error is mapped to proper - InnoDB error code. - - Approved by: Kevin (rb#3986) - (BPS approval by Sveta) ------------------------------------------------------------- -revno: 5668 [merge] -committer: Hery Ramilison -branch nick: mysql-5.6 -timestamp: Wed 2013-12-04 04:12:50 +0100 -message: - Upmerge of the mysql-5.1.73 build - ------------------------------------------------------------ - revno: 2875.437.306 [merge] - committer: Hery Ramilison - branch nick: mysql-5.5 - timestamp: Wed 2013-12-04 04:04:44 +0100 - message: - Upmerge of the mysql-5.1.73 build - ------------------------------------------------------------ - revno: 2661.885.1 - author: - committer: Hery Ramilison - branch nick: mysql-5.1 - timestamp: Tue 2013-12-03 20:47:36 +0100 - message: - Merge from mysql-5.1.73-release ------------------------------------------------------------- -revno: 5667 [merge] -author: vishal.chaudhary@oracle.com -committer: Vishal Chaudhary -branch nick: mysql-5.6 -timestamp: Tue 2013-12-03 10:53:16 +0100 -message: - Merge from mysql-5.6.15-release - ------------------------------------------------------------ - revno: 5583.2.2 - tags: mysql-5.6.15 - committer: Balasubramanian Kandasamy - branch nick: mysql-5.6.15-release - timestamp: Sun 2013-11-17 18:51:36 +0100 - message: - Merged Bug #17675622 cset 5632 from mysql-5.6 +This is a first release, this file is supposed to be empty diff --git a/mysql-wsrep-5.6/Docs/INFO_SRC b/mysql-wsrep-5.6/Docs/INFO_SRC index 422ae193..fbc1a6c3 100644 --- a/mysql-wsrep-5.6/Docs/INFO_SRC +++ b/mysql-wsrep-5.6/Docs/INFO_SRC @@ -1,7 +1,7 @@ -revision-id: anirudh.mangipudi@oracle.com-20140109144358-97kc3jwcfpa3a43n -date: 2014-01-09 20:13:58 +0530 -build-date: 2014-01-09 15:46:48 +0100 -revno: 5732 -branch-nick: mysql-5.6.16-release +commit: 19ff9770da1307a8b44be40beaa456c4d1149c2a +date: 2015-01-19 14:26:20 +0100 +build-date: 2015-01-19 14:38:00 +0100 +short: 19ff977 +branch: mysql-5.6.23-release -MySQL source 5.6.16 +MySQL source 5.6.23 diff --git a/mysql-wsrep-5.6/Docs/INSTALL-BINARY b/mysql-wsrep-5.6/Docs/INSTALL-BINARY index 234c255d..864415f7 100644 --- a/mysql-wsrep-5.6/Docs/INSTALL-BINARY +++ b/mysql-wsrep-5.6/Docs/INSTALL-BINARY @@ -1,60 +1,76 @@ - -2.2. Installing MySQL on Unix/Linux Using Generic Binaries +2.2 Installing MySQL on Unix/Linux Using Generic Binaries Oracle provides a set of binary distributions of MySQL. These - include binary distributions in the form of compressed tar files - (files with a .tar.gz extension) for a number of platforms, as - well as binaries in platform-specific package formats for selected - platforms. - - This section covers the installation of MySQL from a compressed - tar file binary distribution. For other platform-specific package - formats, see the other platform-specific sections. For example, - for Windows distributions, see Section 2.3, "Installing MySQL on + include binary distributions in the form of compressed tar + files (files with a .tar.gz extension) for a number of + platforms, as well as binaries in platform-specific package + formats for selected platforms. + + This section covers the installation of MySQL from a + compressed tar file binary distribution. For other + platform-specific package formats, see the other + platform-specific sections. For example, for Windows + distributions, see Section 2.3, "Installing MySQL on Microsoft Windows." To obtain MySQL, see Section 2.1.3, "How to Get MySQL." - MySQL compressed tar file binary distributions have names of the - form mysql-VERSION-OS.tar.gz, where VERSION is a number (for - example, 5.6.17), and OS indicates the type of operating system - for which the distribution is intended (for example, pc-linux-i686 - or winx64). + MySQL compressed tar file binary distributions have names of + the form mysql-VERSION-OS.tar.gz, where VERSION is a number + (for example, 5.6.23), and OS indicates the type of operating + system for which the distribution is intended (for example, + pc-linux-i686 or winx64). - To install MySQL from a compressed tar file binary distribution, - your system must have GNU gunzip to uncompress the distribution - and a reasonable tar to unpack it. If your tar program supports - the z option, it can both uncompress and unpack the file. + To install MySQL from a compressed tar file binary + distribution, your system must have GNU gunzip to uncompress + the distribution and a reasonable tar to unpack it. If your + tar program supports the z option, it can both uncompress and + unpack the file. GNU tar is known to work. The standard tar provided with some - operating systems is not able to unpack the long file names in the - MySQL distribution. You should download and install GNU tar, or if - available, use a preinstalled version of GNU tar. Usually this is - available as gnutar, gtar, or as tar within a GNU or Free Software - directory, such as /usr/sfw/bin or /usr/local/bin. GNU tar is - available from http://www.gnu.org/software/tar/. + operating systems is not able to unpack the long file names + in the MySQL distribution. You should download and install + GNU tar, or if available, use a preinstalled version of GNU + tar. Usually this is available as gnutar, gtar, or as tar + within a GNU or Free Software directory, such as /usr/sfw/bin + or /usr/local/bin. GNU tar is available from + http://www.gnu.org/software/tar/. + Warning + + If you have previously installed MySQL using your operating + system native package management system, such as yum or + apt-get, you may experience problems installing using a + native binary. Make sure your previous MySQL previous + installation has been removed entirely (using your package + management system), and that any additional files, such as + old versions of your data files, have also been removed. You + should also check the existence of configuration files such + as /etc/my.cnf or the /etc/mysql directory have been deleted. Warning - If you have previously installed MySQL using your operating system - native package management system, such as yum or apt-get, you may - experience problems installing using a native binary. Make sure - your previous MySQL previous installation has been removed - entirely (using your package management system), and that any - additional files, such as old versions of your data files, have - also been removed. You should also check the existence of - configuration files such as /etc/my.cnf or the /etc/mysql - directory have been deleted. - - If you run into problems and need to file a bug report, please use - the instructions in Section 1.7, "How to Report Bugs or Problems." - - On Unix, to install a compressed tar file binary distribution, - unpack it at the installation location you choose (typically - /usr/local/mysql). This creates the directories shown in the - following table. - - Table 2.3. MySQL Installation Layout for Generic Unix/Linux Binary - Package + MySQL has a dependency on the libaio library. The + mysql_install_db and subsequent mysqld_safe steps will fail + if this library is not installed locally. If necessary, + install it using the appropriate package manager. For + example, on Yum-based systems: +shell> yum search libaio # search for info +shell> yum install libaio # install library + + Or, on APT-based systems: +shell> apt-cache search libaio # search for info +shell> apt-get install libaio1 # install library + + If you run into problems and need to file a bug report, + please use the instructions in Section 1.7, "How to Report + Bugs or Problems." + + On Unix, to install a compressed tar file binary + distribution, unpack it at the installation location you + choose (typically /usr/local/mysql). This creates the + directories shown in the following table. + + Table 2.3 MySQL Installation Layout for Generic Unix/Linux + Binary Package Directory Contents of Directory bin Client programs and the mysqld server data Log files, databases @@ -67,14 +83,15 @@ sample configuration files, SQL for database installation sql-bench Benchmarks - Debug versions of the mysqld binary are available as mysqld-debug. - To compile your own debug version of MySQL from a source - distribution, use the appropriate configuration options to enable - debugging support. For more information on compiling from source, - see Section 2.9, "Installing MySQL from Source." + Debug versions of the mysqld binary are available as + mysqld-debug. To compile your own debug version of MySQL from + a source distribution, use the appropriate configuration + options to enable debugging support. For more information on + compiling from source, see Section 2.9, "Installing MySQL + from Source." - To install and use a MySQL binary distribution, the basic command - sequence looks like this: + To install and use a MySQL binary distribution, the basic + command sequence looks like this: shell> groupadd mysql shell> useradd -r -g mysql mysql shell> cd /usr/local @@ -90,53 +107,54 @@ shell> bin/mysqld_safe --user=mysql & # Next command is optional shell> cp support-files/mysql.server /etc/init.d/mysql.server - mysql_install_db creates a default option file named my.cnf in the - base installation directory. This file is created from a template - included in the distribution package named my-default.cnf. For - more information, see Section 5.1.2.2, "Using a Sample Default - Server Configuration File." + mysql_install_db creates a default option file named my.cnf + in the base installation directory. This file is created from + a template included in the distribution package named + my-default.cnf. For more information, see Section 5.1.2.2, + "Using a Sample Default Server Configuration File." A more detailed version of the preceding description for installing a binary distribution follows. Note - This procedure assumes that you have root (administrator) access - to your system. Alternatively, you can prefix each command using - the sudo (Linux) or pfexec (OpenSolaris) command. + This procedure assumes that you have root (administrator) + access to your system. Alternatively, you can prefix each + command using the sudo (Linux) or pfexec (OpenSolaris) + command. - The procedure does not set up any passwords for MySQL accounts. - After following the procedure, proceed to Section 2.10.2, - "Securing the Initial MySQL Accounts." + The procedure does not set up any passwords for MySQL + accounts. After following the procedure, proceed to Section + 2.10.2, "Securing the Initial MySQL Accounts." Create a mysql User and Group - If your system does not already have a user and group for mysqld - to run as, you may need to create one. The following commands add - the mysql group and the mysql user. You might want to call the - user and group something else instead of mysql. If so, substitute - the appropriate name in the following instructions. The syntax for - useradd and groupadd may differ slightly on different versions of - Unix, or they may have different names such as adduser and - addgroup. + If your system does not already have a user and group for + mysqld to run as, you may need to create one. The following + commands add the mysql group and the mysql user. You might + want to call the user and group something else instead of + mysql. If so, substitute the appropriate name in the + following instructions. The syntax for useradd and groupadd + may differ slightly on different versions of Unix, or they + may have different names such as adduser and addgroup. shell> groupadd mysql shell> useradd -r -g mysql mysql Note Because the user is required only for ownership purposes, not - login purposes, the useradd command uses the -r option to create a - user that does not have login permissions to your server host. - Omit this option to permit logins for the user (or if your useradd - does not support the option). + login purposes, the useradd command uses the -r option to + create a user that does not have login permissions to your + server host. Omit this option to permit logins for the user + (or if your useradd does not support the option). Obtain and Unpack the Distribution - Pick the directory under which you want to unpack the distribution - and change location into it. The example here unpacks the - distribution under /usr/local. The instructions, therefore, assume - that you have permission to create files and directories in - /usr/local. If that directory is protected, you must perform the - installation as root. + Pick the directory under which you want to unpack the + distribution and change location into it. The example here + unpacks the distribution under /usr/local. The instructions, + therefore, assume that you have permission to create files + and directories in /usr/local. If that directory is + protected, you must perform the installation as root. shell> cd /usr/local Obtain a distribution file using the instructions in Section @@ -144,614 +162,1020 @@ shell> cd /usr/local distributions for all platforms are built from the same MySQL source distribution. - Unpack the distribution, which creates the installation directory. - Then create a symbolic link to that directory. tar can uncompress - and unpack the distribution if it has z option support: + Unpack the distribution, which creates the installation + directory. Then create a symbolic link to that directory. tar + can uncompress and unpack the distribution if it has z option + support: shell> tar zxvf /path/to/mysql-VERSION-OS.tar.gz shell> ln -s full-path-to-mysql-VERSION-OS mysql - The tar command creates a directory named mysql-VERSION-OS. The ln - command makes a symbolic link to that directory. This enables you - to refer more easily to the installation directory as - /usr/local/mysql. + The tar command creates a directory named mysql-VERSION-OS. + The ln command makes a symbolic link to that directory. This + enables you to refer more easily to the installation + directory as /usr/local/mysql. - If your tar does not have z option support, use gunzip to unpack - the distribution and tar to unpack it. Replace the preceding tar - command with the following alternative command to uncompress and - extract the distribution: + If your tar does not have z option support, use gunzip to + unpack the distribution and tar to unpack it. Replace the + preceding tar command with the following alternative command + to uncompress and extract the distribution: shell> gunzip < /path/to/mysql-VERSION-OS.tar.gz | tar xvf - Perform Postinstallation Setup - The remainder of the installation process involves setting up the - configuration file, creating the core databases, and starting the - MySQL server. For next steps, see Section 2.10, "Postinstallation - Setup and Testing." + The remainder of the installation process involves setting up + the configuration file, creating the core databases, and + starting the MySQL server. For next steps, see Section 2.10, + "Postinstallation Setup and Testing." Note - The accounts that are listed in the MySQL grant tables initially - have no passwords. After starting the server, you should set up - passwords for them using the instructions in Section 2.10.2, - "Securing the Initial MySQL Accounts." + The accounts that are listed in the MySQL grant tables + initially have no passwords. After starting the server, you + should set up passwords for them using the instructions in + Section 2.10.2, "Securing the Initial MySQL Accounts." +2.3 Installing MySQL on Microsoft Windows + + There are several different methods to install MySQL on + Microsoft Windows. + +Simple Installation Method - Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights - reserved. Legal Notices + The simplest and recommended method is to download MySQL + Installer (for Windows) and let it install and configure all + of the MySQL products on your system. Here is how: -2.3. Installing MySQL on Microsoft Windows + * Download MySQL Installer from + http://dev.mysql.com/downloads/installer/ and execute it. + Note + Unlike the standard MySQL Installer, the smaller + "web-community" version does not bundle any MySQL + applications but it will download the MySQL products you + choose to install. + + * Choose the appropriate Setup Type for your system. + Typically you will choose Developer Default to install + MySQL server and other MySQL tools related to MySQL + development, helpful tools like MySQL Workbench. Or, + choose the Custom setup type to manually select your + desired MySQL products. + Note + Multiple versions of MySQL server can exist on a single + system. You can choose one or multiple versions. + + * Complete the installation process by following the MySQL + Installation wizard's instructions. This will install + several MySQL products and start the MySQL server. + + * MySQL is now installed. You probably configured MySQL as + a service that will automatically start MySQL server + every time you restart your system. + + Note + + You probably also installed other helpful MySQL products like + MySQL Workbench and MySQL Notifier on your system. Consider + loading Chapter 26, "MySQL Workbench" to check your new MySQL + server connection, and Section 2.3.4, "MySQL Notifier" to + view the connection's status. By default, these two programs + automatically start after installing MySQL. + + This process also installs the MySQL Installer application on + your system, and later you can use MySQL Installer to upgrade + or reconfigure your MySQL products. + +Additional Installation Information MySQL is available for Microsoft Windows, for both 32-bit and - 64-bit versions. For supported Windows platform information, see - http://www.mysql.com/support/supportedplatforms/database.html. + 64-bit versions. For supported Windows platform information, + see + http://www.mysql.com/support/supportedplatforms/database.html + . It is possible to run MySQL as a standard application or as a - Windows service. By using a service, you can monitor and control - the operation of the server through the standard Windows service - management tools. For more information, see Section 2.3.5.7, - "Starting MySQL as a Windows Service." - - Generally, you should install MySQL on Windows using an account - that has administrator rights. Otherwise, you may encounter - problems with certain operations such as editing the PATH - environment variable or accessing the Service Control Manager. - Once installed, MySQL does not need to be executed using a user - with Administrator privileges. + Windows service. By using a service, you can monitor and + control the operation of the server through the standard + Windows service management tools. For more information, see + Section 2.3.5.7, "Starting MySQL as a Windows Service." + + Generally, you should install MySQL on Windows using an + account that has administrator rights. Otherwise, you may + encounter problems with certain operations such as editing + the PATH environment variable or accessing the Service + Control Manager. Once installed, MySQL does not need to be + executed using a user with Administrator privileges. For a list of limitations on the use of MySQL on the Windows - platform, see Section E.10.6, "Windows Platform Limitations." + platform, see Section D.10.6, "Windows Platform Limitations." In addition to the MySQL Server package, you may need or want additional components to use MySQL with your application or - development environment. These include, but are not limited to: - - * To connect to the MySQL server using ODBC, you must have a - Connector/ODBC driver. For more information, including - installation and configuration instructions, see Section 22.1, - "MySQL Connector/ODBC." But note that MySQL Installer will - install and configure Connector/ODBC for you. - - * To use MySQL server with .NET applications, you must have the - Connector/Net driver. For more information, including - installation and configuration instructions, see Section 22.2, - "MySQL Connector/Net." But note that MySQL Installer will - install and configure Connector/NET for you. + development environment. These include, but are not limited + to: + + * To connect to the MySQL server using ODBC, you must have + a Connector/ODBC driver. For more information, including + installation and configuration instructions, see MySQL + Connector/ODBC Developer Guide + (http://dev.mysql.com/doc/connector-odbc/en/index.html). + Note + MySQL Installer will install and configure Connector/ODBC + for you. + + * To use MySQL server with .NET applications, you must have + the Connector/Net driver. For more information, including + installation and configuration instructions, see MySQL + Connector/Net Developer Guide + (http://dev.mysql.com/doc/connector-net/en/index.html). + Note + MySQL Installer will install and configure Connector/NET + for you. MySQL distributions for Windows can be downloaded from - http://dev.mysql.com/downloads/. See Section 2.1.3, "How to Get - MySQL." - - MySQL for Windows is available in several distribution formats, - detailed following. Generally speaking, you should use MySQL - Installer. It is simpler to use than the Zip file, and you need no - additional tools to get MySQL up and running. MySQL Installer - automatically installs MySQL Server and additional MySQL products, - creates an options file, starts the server, and enables you to - create default user accounts. For more information on choosing a - package, see Section 2.3.2, "Choosing An Installation Package." + http://dev.mysql.com/downloads/. See Section 2.1.3, "How to + Get MySQL." + + MySQL for Windows is available in several distribution + formats, detailed below. Generally speaking, you should use + MySQL Installer. It contains more features and MySQL products + than the older MSI, is simpler to use than the ZIP file, and + you need no additional tools to get MySQL up and running. + MySQL Installer automatically installs MySQL Server and + additional MySQL products, creates an options file, starts + the server, and enables you to create default user accounts. + For more information on choosing a package, see Section + 2.3.2, "Choosing An Installation Package." * A MySQL Installer distribution includes MySQL Server and - additional MySQL products including MySQL Workbench, MySQL - Notifier, and MySQL for Excel. MySQL Installer can also be - used to upgrade these products in the future. - For instructions on installing MySQL using MySQL Installer, - see Section 2.3.3, "Installing MySQL on Microsoft Windows - Using MySQL Installer." + additional MySQL products including MySQL Workbench, + MySQL Notifier, and MySQL for Excel. MySQL Installer can + also be used to upgrade these products in the future. + For instructions on installing MySQL using MySQL + Installer, see Section 2.3.3, "Installing MySQL on + Microsoft Windows Using MySQL Installer." * The standard binary distribution (packaged as a Zip file) - contains all of the necessary files that you unpack into your - chosen location. This package contains all of the files in the - full Windows MSI Installer package, but does not include an - installation program. - For instructions on installing MySQL using the Zip file, see - Section 2.3.5, "Installing MySQL on Microsoft Windows Using a - noinstall Zip Archive." + contains all of the necessary files that you unpack into + your chosen location. This package contains all of the + files in the full Windows MSI Installer package, but does + not include an installation program. + For instructions on installing MySQL using the Zip file, + see Section 2.3.5, "Installing MySQL on Microsoft Windows + Using a noinstall Zip Archive." * The source distribution format contains all the code and - support files for building the executables using the Visual - Studio compiler system. - For instructions on building MySQL from source on Windows, see - Section 2.9, "Installing MySQL from Source." + support files for building the executables using the + Visual Studio compiler system. + For instructions on building MySQL from source on + Windows, see Section 2.9, "Installing MySQL from Source." MySQL on Windows considerations: * Large Table Support - If you need tables with a size larger than 4GB, install MySQL - on an NTFS or newer file system. Do not forget to use MAX_ROWS - and AVG_ROW_LENGTH when you create tables. See Section - 13.1.17, "CREATE TABLE Syntax." + If you need tables with a size larger than 4GB, install + MySQL on an NTFS or newer file system. Do not forget to + use MAX_ROWS and AVG_ROW_LENGTH when you create tables. + See Section 13.1.17, "CREATE TABLE Syntax." * MySQL and Virus Checking Software - Virus-scanning software such as Norton/Symantec Anti-Virus on - directories containing MySQL data and temporary tables can - cause issues, both in terms of the performance of MySQL and - the virus-scanning software misidentifying the contents of the - files as containing spam. This is due to the fingerprinting - mechanism used by the virus-scanning software, and the way in - which MySQL rapidly updates different files, which may be - identified as a potential security risk. + Virus-scanning software such as Norton/Symantec + Anti-Virus on directories containing MySQL data and + temporary tables can cause issues, both in terms of the + performance of MySQL and the virus-scanning software + misidentifying the contents of the files as containing + spam. This is due to the fingerprinting mechanism used by + the virus-scanning software, and the way in which MySQL + rapidly updates different files, which may be identified + as a potential security risk. After installing MySQL Server, it is recommended that you - disable virus scanning on the main directory (datadir) used to - store your MySQL table data. There is usually a system built - into the virus scanning software to enable specific - directories to be ignored. - In addition, by default, MySQL creates temporary files in the - standard Windows temporary directory. To prevent the temporary - files also being scanned, configure a separate temporary - directory for MySQL temporary files and add this directory to - the virus scanning exclusion list. To do this, add a - configuration option for the tmpdir parameter to your my.ini - configuration file. For more information, see Section 2.3.5.2, - "Creating an Option File." - -2.3.1. MySQL Installation Layout on Microsoft Windows - - For MySQL 5.6 on Windows, the default installation directory is - C:\Program Files\MySQL\MySQL Server 5.6. Some Windows users prefer - to install in C:\mysql, the directory that formerly was used as - the default. However, the layout of the subdirectories remains the - same. - - All of the files are located within this parent directory, using - the structure shown in the following table. - - Table 2.4. Default MySQL Installation Layout for Microsoft Windows + disable virus scanning on the main directory (datadir) + used to store your MySQL table data. There is usually a + system built into the virus-scanning software to enable + specific directories to be ignored. + In addition, by default, MySQL creates temporary files in + the standard Windows temporary directory. To prevent the + temporary files also being scanned, configure a separate + temporary directory for MySQL temporary files and add + this directory to the virus scanning exclusion list. To + do this, add a configuration option for the tmpdir + parameter to your my.ini configuration file. For more + information, see Section 2.3.5.2, "Creating an Option + File." + +2.3.1 MySQL Installation Layout on Microsoft Windows + + For MySQL 5.6 on Windows, the default installation directory + is C:\Program Files\MySQL\MySQL Server 5.6. Some Windows + users prefer to install in C:\mysql, the directory that + formerly was used as the default. However, the layout of the + subdirectories remains the same. + + All of the files are located within this parent directory, + using the structure shown in the following table. + + Table 2.4 Default MySQL Installation Layout for Microsoft + Windows Directory Contents of Directory Notes bin Client programs and the mysqld server - %ALLUSERSPROFILE%\MySQL\MySQL Server 5.6\ Log files, databases - (Windows XP, Windows Server 2003) The Windows system variable - %ALLUSERSPROFILE% defaults to C:\Documents and Settings\All - Users\Application Data - %PROGRAMDATA%\MySQL\MySQL Server 5.6\ Log files, databases (Vista, - Windows 7, Windows Server 2008, and newer) The Windows system - variable %PROGRAMDATA% defaults to C:\ProgramData + %ALLUSERSPROFILE%\MySQL\MySQL Server 5.6\ Log files, + databases (Windows XP, Windows Server 2003) The Windows + system variable %ALLUSERSPROFILE% defaults to C:\Documents + and Settings\All Users\Application Data + %PROGRAMDATA%\MySQL\MySQL Server 5.6\ Log files, databases + (Vista, Windows 7, Windows Server 2008, and newer) The + Windows system variable %PROGRAMDATA% defaults to + C:\ProgramData examples Example programs and scripts include Include (header) files lib Libraries scripts Utility scripts share Miscellaneous support files, including error messages, - character set files, sample configuration files, SQL for database - installation + character set files, sample configuration files, SQL for + database installation If you install MySQL using the MySQL Installer, this package - creates and sets up the data directory that the installed server - will use, and also creates a pristine "template" data directory - named data under the installation directory. After an installation - has been performed using this package, the template data directory - can be copied to set up additional MySQL instances. See Section - 5.3, "Running Multiple MySQL Instances on One Machine." + creates and sets up the data directory that the installed + server will use, and also creates a pristine "template" data + directory named data under the installation directory. After + an installation has been performed using this package, the + template data directory can be copied to set up additional + MySQL instances. See Section 5.3, "Running Multiple MySQL + Instances on One Machine." -2.3.2. Choosing An Installation Package +2.3.2 Choosing An Installation Package - For MySQL 5.6, there are installation package formats to choose - from when installing MySQL on Windows: + For MySQL 5.6, there are installation package formats to + choose from when installing MySQL on Windows: * MySQL Installer: This package has a file name similar to - mysql-installer-community-5.6.17.0.msi or - mysql-installer-commercial-5.6.17.0.msi, and utilizes MSI's to - automatically install MySQL server and other products. It will - download and apply updates to itself, and for each of the - installed products. It also configures the additional - non-server products. - The installed products are configurable, and this includes: - documentation with samples and examples, connectors (such as - C, C++, J, NET, and ODBC), MySQL Workbench, MySQL Notifier for - Microsoft Windows, MySQL for Excel, and the MySQL Server with - its components. - MySQL Installer will run on all Windows platforms that are - supported by MySQL (see - http://www.mysql.com/support/supportedplatforms/database.html) - . + mysql-installer-community-5.6.23.0.msi or + mysql-installer-commercial-5.6.23.0.msi, and utilizes + MSIs to automatically install MySQL server and other + products. It will download and apply updates to itself, + and for each of the installed products. It also + configures the additional non-server products. + The installed products are configurable, and this + includes: documentation with samples and examples, + connectors (such as C, C++, J, NET, and ODBC), MySQL + Workbench, MySQL Notifier, MySQL for Excel, and the MySQL + Server with its components. + MySQL Installer will run on all Windows platforms that + are supported by MySQL (see + http://www.mysql.com/support/supportedplatforms/database. + html). Note - Because MySQL Installer is not a native component of Microsoft - Windows and depends on .NET, it will not work on minimal - installation options like the "Server Core" version of Windows - Server 2008. - For instructions on installing MySQL using MySQL Installer, - see Section 2.3.3, "Installing MySQL on Microsoft Windows - Using MySQL Installer." - - * The Noinstall Archive: This package has a file name similar to - mysql-5.6.17-win32.zip or mysql-5.6.17-winx64.zip, and - contains all the files found in the Complete install package, - with the exception of the GUI. This package does not include - an automated installer, and must be manually installed and - configured. - - Your choice of install package affects the installation process - you must follow. If you choose to use MySQL Installer, see Section - 2.3.3, "Installing MySQL on Microsoft Windows Using MySQL - Installer." If you choose to install a Noinstall archive, see - Section 2.3.5, "Installing MySQL on Microsoft Windows Using a - noinstall Zip Archive." - -2.3.3. Installing MySQL on Microsoft Windows Using MySQL Installer - - MySQL Installer is an application that simplifies the installation - and updating process for a wide range of MySQL products, including - MySQL Notifier for Microsoft Windows, MySQL Workbench, and MySQL - for Excel. From this central application, you can see which MySQL - products are already installed, configure them, and update or - remove them if necessary. The installer can also install plugins, - documentation, tutorials, and example databases. The MySQL - Installer is only available for Microsoft Windows, and includes - both a GUI and command-line interface. + Because MySQL Installer is not a native component of + Microsoft Windows and depends on .NET, it will not work + on minimal installation options like the "Server Core" + version of Windows Server 2008. + For instructions on installing MySQL using MySQL + Installer, see Section 2.3.3, "Installing MySQL on + Microsoft Windows Using MySQL Installer." + + * The Noinstall Archive: This package has a file name + similar to mysql-5.6.23-win32.zip or + mysql-5.6.23-winx64.zip, and contains all the files found + in the Complete install package, with the exception of + the GUI. This package does not include an automated + installer, and must be manually installed and configured. + + MySQL Installer is recommended for most users. + + Your choice of install package affects the installation + process you must follow. If you choose to use MySQL + Installer, see Section 2.3.3, "Installing MySQL on Microsoft + Windows Using MySQL Installer." If you choose to install a + Noinstall archive, see Section 2.3.5, "Installing MySQL on + Microsoft Windows Using a noinstall Zip Archive." + +2.3.3 Installing MySQL on Microsoft Windows Using MySQL Installer + + MySQL Installer simplifies the installation and updating + process for your MySQL products on Microsoft Windows. From + this central application, you can view, remove, update, and + reconfigure the existing MySQL products on your system. MySQL + Installer can also install plugins, documentation, tutorials, + and example databases. The MySQL Installer is only available + for Microsoft Windows, and includes both GUI and command-line + interfaces. + + The supported products include: + + * MySQL server (http://dev.mysql.com/doc/) (one or multiple + versions) + + * MySQL Workbench + + * MySQL Connectors + (http://dev.mysql.com/doc/index-connectors.html) (.Net / + Python / ODBC / Java / C / C++) + + * MySQL Notifier + + * MySQL for Excel + (http://dev.mysql.com/doc/mysql-for-excel/en/index.html) + + * MySQL for Visual Studio + (http://dev.mysql.com/doc/connector-net/en/connector-net- + visual-studio.html) + + * MySQL Utilities and MySQL Fabric + (http://dev.mysql.com/doc/index-utils-fabric.html) + + * MySQL Samples and Examples + + * MySQL Documentation + + * MySQL Installer is also installed and remains on the + system as its own application Installer package types - * Full: Bundles all of the MySQL products (including MySQL - Server). The file is over 160MB, and have names of the form - mysql-installer-community-VERSION.N.msi where VERSION is the - MySQL Server version number such as 5.6 and N is the package - number, which begins at 0. + * Full: Bundles all of the MySQL products (including the + MySQL server). The file' size is over 200MB, and its name + has the form mysql-installer-community-VERSION.N.msi + where VERSION is the MySQL Server version number such as + 5.6 and N is the package number, which begins at 0. - * Web: Only contains the Installer and configuration files, and - it only downloads the MySQL products you choose to install. - The file is about 2MB, and have names of the form - mysql-installer-community-web-VERSION.N.msi where VERSION is - the MySQL Server version number such as 5.6 and N is the - package number, which begins at 0. + * Web: Only contains the Installer and configuration files, + and it only downloads the MySQL products you choose to + install. The size of this file is about 2MB; the name of + the file has the form + mysql-installer-community-web-VERSION.N.msi where VERSION + is the MySQL Server version number such as 5.6 and N is + the package number, which begins at 0. Installer editions * Community edition: Downloadable at - http://dev.mysql.com/downloads/installer/. It installs the - community edition of all MySQL products. + http://dev.mysql.com/downloads/installer/. It installs + the community edition of all MySQL products. - * Commercial edition: Downloadable at either My Oracle Support - (https://support.oracle.com/) (MOS) or + * Commercial edition: Downloadable at either My Oracle + Support (https://support.oracle.com/) (MOS) or https://edelivery.oracle.com/. It installs the commercial - version of all MySQL products, including Workbench SE. It also - integrates with your MOS account, so enter in your MOS - credentials to automatically receive updates for your - commercial MySQL products. + version of all MySQL products, including Workbench SE/EE. + It also integrates with your MOS account. + Note + Entering your MOS credentials is optional when installing + bundled MySQL products, but your credentials are required + when choosing non-bundled MySQL products that MySQL + Installer must download. - For release notes detailing the changes in each release of MySQL + For notes detailing the changes in each release of MySQL Installer, see MySQL Installer Release Notes (http://dev.mysql.com/doc/relnotes/mysql-installer/en/). - MySQL Installer is compatible with pre-existing installations, and - adds them to its list of installed components. And while the MySQL - Installer is bundled with a specific version of MySQL Server, a - single MySQL Installer instance can install and manage multiple - MySQL Server versions. For example, a single MySQL Installer - instance can install versions 5.1, 5.5, and 5.6. It can also - manage either commercial or community editions of the MySQL - Server. + MySQL Installer is compatible with pre-existing + installations, and adds them to its list of installed + components. While the standard MySQL Installer is bundled + with a specific version of MySQL Server, a single MySQL + Installer instance can install and manage multiple MySQL + Server versions. For example, a single MySQL Installer + instance can install (and update) versions 5.5, 5.6, and 5.7 + on the host. Note - A single host can not have both community and commercial editions - of MySQL Server installed. For example, if you want both MySQL - Server 5.5 and 5.6 installed on a single host, then both must be - the same commercial or community edition. + A single host can not have both community and commercial + editions of MySQL Server installed. For example, if you want + both MySQL Server 5.5 and 5.6 installed on a single host, + then both must be the same edition. - MySQL Installer handles the initial configuration and setup of the - applications. For example: + MySQL Installer handles the initial configuration and set up + of the applications. For example: - 1. It will create MySQL Server connections in MySQL Workbench. + 1. It creates initial MySQL Server connections in MySQL + Workbench. - 2. It creates the configuration file (my.ini) that is used to - configure the MySQL Server. The values written to this file - are influenced by choices you make during the installation - process. + 2. It creates the configuration file (my.ini) that is used + to configure the MySQL Server. The values written to this + file are influenced by choices you make during the + installation process. - 3. It imports example databases. + 3. It can optionally import example databases. - 4. It creates MySQL Server user accounts with configurable - permissions based on general roles, such as DB Administrator, - DB Designer, and Backup Admin. It optionally creates a Windows - user named MysqlSys with limited privileges, which would then - run the MySQL Server. - This feature is only available during the initial installation - of the MySQL Server, and not during future updates. User - accounts may also be added with MySQL Workbench. + 4. It can optionally create MySQL Server user accounts with + configurable permissions based on general roles, such as + DB Administrator, DB Designer, and Backup Admin. It + optionally creates a Windows user named MysqlSys with + limited privileges, which would then run the MySQL + Server. + User accounts may also be added and configured in MySQL + Workbench. - 5. If the "Advanced Configuration" option is checked, then the - Logging Options are also configured. This includes defining - file paths for the error log, general log, slow query log - (including the configuration of seconds it requires to execute - a query), and the binary log. + 5. If the "Advanced Configuration" option is checked, then + the Logging Options are also configured. This includes + defining file paths for the error log, general log, slow + query log (including the configuration of seconds it + requires to execute a query), and the binary log. - MySQL Installer can optionally check for updated components and - download them for you automatically. + MySQL Installer can optionally check for updated components + and download them for you. -2.3.3.1. MySQL Installer GUI +2.3.3.1 MySQL Installer GUI - After installation of the GUI version, the installer will have add - its own Start Menu item under MySQL. + Installing MySQL Installer adds a link to the Start menu + under the MySQL group. Click Start, All Programs MySQL, MySQL + Installer to reload the MySQL Installer GUI. Note - Files that are generated by MySQL Installer grant full permissions - to the user that executes MySQL Installer, including my.ini. This - does not apply to files and directories for specific products such - as the MySQL Server data directory in ProgramData, that is owned - by SYSTEM. + Files that are generated by MySQL Installer grant full + permissions to the user that executes MySQL Installer, + including my.ini. This does not apply to files and + directories for specific products such as the MySQL Server + data directory in %ProgramData% that is owned by SYSTEM. - After the installer itself has been installed and started, the - following screen is displayed: + The initial execution of MySQL Installer requires you to + accept the license agreement before installing MySQL + products. - Figure 2.7. MySQL Installer - Welcome Screen - MySQL Installer - Welcome Screen + Figure 2.7 MySQL Installer - License Agreement + MySQL Installer - License Agreement - There are three main options: +Installing New Packages - 1. Install MySQL Products - The Installation Wizard. + Choose the appropriate Setup Type for your system. The + selected type determines which MySQL products are installed + on your system, or select Custom to manually choose + individual products. - 2. About MySQL - Learn about MySQL products and features. + * Developer: Install all products needed to develop + applications with MySQL. This is the default option. - 3. Resources - Information to help install and configure MySQL. + * Server only: Only install the MySQL server. - To Install MySQL Products after executing MySQL Installer for the - first time, you must accept the license agreement before - proceeding with the installation process. + * Client only: Only install the MySQL client products, + which does not include the MySQL server. - Figure 2.8. MySQL Installer - License Agreement - MySQL Installer - License Agreement + * Full: Install all MySQL products. - If you are connected to the Internet, then the Installer will - search for the latest MySQL components and add them to the - installation bundle. Click Connect to the Internet to complete - this step, or otherwise check the Skip checkbox and then Continue. + * Custom: Manually select the MySQL products to install. + Note + After the initial installation, you may use MySQL + Installer to manually select MySQL products to install or + remove. In other words, MySQL Installer becomes a MySQL + product management system. - Figure 2.9. MySQL Installer - Find latest products - MySQL Installer - Find latest products + Figure 2.8 MySQL Installer - Choosing a Setup Type + MySQL Installer - Choosing a Setup Type - If you chose "Connect to the Internet," the next page will show - the progress of MySQL Installer's search for available updates. - When the search is complete (or if you opted to skip the search), - you will be taken to the Choose Setup Type page: + After you select a setup type, the MySQL Installer will check + your system for the necessary external requirements for each + of the selected MySQL products. MySQL Installer will either + download and install the missing components onto your system, + or point you to the download location and set Status to + "Manual". - Figure 2.10. MySQL Installer - Choosing a Setup Type - MySQL Installer - Choosing a Setup Type + The next window lists the MySQL products that are scheduled + to be installed: - Determine the option most compatible with your preferences by - reading the Setup Type Description descriptions. + Figure 2.9 MySQL Installer - Installation Progress + MySQL Installer - Installation Progress - The Installation and Data paths are also defined here, and a - caution flag will notify you if the data path you define already - exists. + As components are installed, their Status changes from a + progress percentage to "Complete". - After you select a setup type, the MySQL Installer will check your - system for the necessary external requirements and download then - install missing components onto your system. + After all components are installed, the next step configures + some of the recently installed MySQL products. The + Configuration Overview window displays the progress and then + loads a configuration window, if required. Our example + configures MySQL Server 5.6.x. - Figure 2.11. MySQL Installer - Check Requirements - MySQL Installer - Check Requirements +Configuring MySQL Server - The next window lists the MySQL products that are scheduled to be - installed: + Configuring the MySQL server begins with defining several + Type and Networking options. - Figure 2.12. MySQL Installer - Installation Progress - MySQL Installer - Installation Progress + Figure 2.10 MySQL Installer - Configuration Overview + MySQL Installer - Configuration Overview - As components are installed, you'll see their status change from - "to be installed" to "install success." + Server Configuration Type - Figure 2.13. MySQL Installer - Installation Progress status - MySQL Installer - Installation Progress status + Choose the MySQL server configuration type that describes + your setup. This setting defines the amount of system + resources that will be assigned to your MySQL server + instance. - After all components are installed, the next step involves - configuring the products. The Configuration Overview window - displays the progress and then loads a configuration window if it - is required. + * Developer: A machine that will host many other + applications, and typically this is your personal + workstation. This option configures MySQL to use the + least amount of memory. - Figure 2.14. MySQL Installer - Configuration Overview - MySQL Installer - Configuration Overview + * Server: Several other applications will be running on + this machine, such as a web server. This option + configures MySQL to use a medium amount of memory. + + * Dedicated: A machine that is dedicated to running the + MySQL server. Because no other major applications are + running on the server, such as web servers, this option + configures MySQL to use all available memory. + + Connectivity + + Connectivity options control how you will connect to MySQL. + Options include: + + * TCP/IP: You may enable TCP/IP Networking here as + otherwise only localhost connections are allowed. Also + define the Port Number and whether to open the firewall + port for network access. + + * Named Pipe: Enable and define the pipe name, similar to + using the --enable-named-pipe option. + + * Shared Memory: Enable and then define the memory name, + similar to using the --shared-memory option. + + Advanced Configuration + + Checking the "Advanced Configuration" option provides + additional Logging Options to configure. This includes + defining file paths for the error log, general log, slow + query log (including the configuration of seconds it requires + to execute a query), and the binary log. + + Figure 2.11 MySQL Installer - MySQL Server Configuration: + Type and Networking + MySQL Installer- MySQL Server Configuration: Type and + Networking - The ideal MySQL Server configuration depends on your intended use, - as explained in the next window. Choose the description that most - closely applies to your machine. - - You may enable TCP/IP Networking here as otherwise only localhost - connections are allowed. - - Checking the "Advanced Configuration" option provides additional - Logging Options to configure. This includes defining file paths - for the error log, general log, slow query log (including the - configuration of seconds it requires to execute a query), and the - binary log. - - Figure 2.15. MySQL Installer - MySQL Server Configuration: Define - platform, networking, and logging options - MySQL Installer- MySQL Server Configuration: Define platform, - networking, and logging options - - Next, choose your account information. Defining a root password is - required, whereas it's optional to create additional users. There - are several different predefined user roles that each have - different permission levels. For example, a "DB Admin" will have - more privileges than a "DB Designer.". - - Figure 2.16. MySQL Installer - MySQL Server Configuration: User - accounts - MySQL Installer - MySQL Server Configuration: User accounts +Accounts and Roles + + Next, define your MySQL account information. Assigning a root + password is required. + + Optionally, you can add additional MySQL user accounts with + predefined user roles. Each predefined role, such as "DB + Admin", are configured with their own set of privileges. For + example, the "DB Admin" role has more privileges than the "DB + Designer" role. Click the Role dropdown for a list of role + descriptions. Note - If the MySQL Server is already installed, then the Current Root - Password will also be needed. + If the MySQL Server is already installed, then you must also + enter the Current Root Password. + + Figure 2.12 MySQL Installer - MySQL Server Configuration: + User Accounts and Roles + MySQL Installer - MySQL Server Configuration: User Accounts + and Roles + + Figure 2.13 MySQL Installer - MySQL Server Configuration: + User Accounts and Roles: Adding a User + MySQL Installer - MySQL Server Configuration: User Accounts + and Roles: Adding a User + +Windows Service - Next, configure the Windows Service Details. This includes the - service name, how the MySQL Server should be loaded at startup, - and how the Windows Service for MySQL Server will be run. + Next, configure the Windows Service details. This includes + the service name, whether the MySQL Server should be loaded + at startup, and how the Windows Service for MySQL Server is + executed. - Figure 2.17. MySQL Installer - MySQL Server Configuration: Windows - service details - MySQL Installer - MySQL Server Configuration: Windows service - details + Figure 2.14 MySQL Installer - MySQL Server Configuration: + Windows Service + MySQL Installer - MySQL Server Configuration: Windows Service Note - When configuring Run Windows Services as ... using a Custom User, - the custom user must have privileges to log on to Windows as a - service. And the Next button will be disabled until this user is - given these user rights. + When configuring Run Windows Services as ... using a Custom + User, the custom user must have privileges to log on to + Microsoft Windows as a service. And the Next button will be + disabled until this user is configured with these user + rights. + + On Microsoft Windows 7, this is configured by loading the + Start Menu, Control Panel, Administrative Tools, Local + Security Policy, Local Policies, User Rights Assignment, then + Log On As A Service. Choose Add User or Group here to add the + custom user, and then OK, OK to save. + +Advanced Options + + The next configuration step is available if the Advanced + Configuration option was checked. This section includes + options that are related to the MySQL log files: + + Figure 2.15 MySQL Installer - MySQL Server Configuration: + Logging Options + MySQL Installer - MySQL Server Configuration: Logging Options - On Microsoft Windows 7, this is configured by loading the Start - Menu, Control Panel, Administrative Tools, Local Security Policy, - Local Policies, User Rights Assignment, then Log On As A Service. - Choose Add User or Group here to add the custom user, and then OK, - OK to save. + Click Next to continue on to the final page before all of the + requested changes are applied. This Apply Server + Configuration page details the configuration steps that will + be performed. - The final configuration step is available if the Advanced - Configuration option was checked, and it includes configuration - options related to log file names: + Figure 2.16 MySQL Installer - MySQL Server Configuration: + Apply Server Configuration + MySQL Installer - MySQL Server Configuration: Apply Server + Configuration - Figure 2.18. MySQL Installer - MySQL Server Configuration: Logging - options - MySQL Installer - MySQL Server Configuration: Logging options + Click Execute to execute the configuration steps. The icon + for each step toggles from white to green on success, or the + process stops on failure. Click the Log tab to view the log. - After the MySQL Installer configuration process is completed, you - may save the installation log, and then load MySQL Workbench if - the Start MySQL Workbench after Setup option is checked: + After the MySQL Installer configuration process is finished, + MySQL Installer reloads the opening page where you can + execute other installation and configuration related actions. - Figure 2.19. MySQL Installer - Installation Complete - MySQL Installer - Installation Complete + MySQL Installer is added to the Microsoft Windows Start menu + under the MySQL group. Opening MySQL Installer loads its + dashboard where installed MySQL products are listed, and + other MySQL Installer actions are available: - You can now open MySQL Installer from the Microsoft Windows Start - menu under the MySQL group, which will load the MySQL Installer - Maintenance Screen. This is used to add, update, and remove - features. + Figure 2.17 MySQL Installer - Main Dashboard + MySQL Installer - Main Dashboard - Figure 2.20. MySQL Installer - Maintenance Screen - MySQL Installer - Maintenance Screen +Adding MySQL Products + + Click Add to add new products. This loads the Select Products + and Features page: + + Figure 2.18 MySQL Installer - Select Products and Features + MySQL Installer - Select Products and Features + + From here, choose the MySQL products you want to install from + the left Available Products pane, and then click the green + right arrow to queue products for installation. + + Optionally, click Edit to open the product and features + search filter: + + Figure 2.19 MySQL Installer - Select Products and Features + Filter + MySQL Installer - Select Products and Features Filter + + For example, you might choose to include Pre-Release products + in your selections, such as a Beta product that has not yet + reached GA status. Note - An Update Screen screen is shown if MySQL Installer is used on a - machine with older products installed, as opposed to the - Maintenance Screen shown above. However, the functionality remains - the same. + The ability to install Pre-Release versions of MySQL products + was added in MySQL Installer 1.4.0. + + Select all of the MySQL products you want to install, then + click Next to continue, and then Execute to execute the + installation process to install all of the selected products. - Add/Modify Products and Features will list all installed and - available MySQL products. +2.3.3.1.1 MySQL Product Catalog - Figure 2.21. MySQL Installer - Add/Modify Products and Features - MySQL Installer - Add/Modify Products and Features + MySQL Installer stores a MySQL product catalog. The catalog + can be updated either manually or automatically, and the + catalog change history is also available. + Note - The installation is now complete. MySQL Server should be running, - and most MySQL products installed and available for use. + The MySQL product catalog was added in MySQL Installer 1.4.0. - See also the MySQL Workbench documentation - (http://dev.mysql.com/doc/workbench/en/). + Manual updates -2.3.3.2. MySQL Installer Console + You can update the MySQL product catalog at any time by + clicking Catalog on the Installer dashboard. - MySQLInstallerConsole provides functionality similar to the GUI - version of MySQL Installer, but from the command-line. It is - installed when MySQL Installer is initially executed, and then - available within the MySQL Installer directory. Typically that is - in C:\Program Files (x86)\MySQL\MySQL Installer\, and the console - must be executed with administrative privileges. + Figure 2.20 MySQL Installer - Open the MySQL Product Catalog + MySQL Installer - Open the MySQL Product Catalog - To use, invoke the Command Prompt with administrative privileges - by choosing Start, Accessories, then right-click on Command Prompt - and choose Run as administrator. And from the command-line, - optionally change the directory to where MySQLInstallerConsole is - located: -C:\> cd "C:\Program Files (x86)\MySQL\MySQL Installer" + From there, click Execute to update the product catalog. - MySQLInstallerConsole supports the following options, which are - specified on the command line: + Automatic updates - * --help, -h, or -? - Displays a help message with usage examples, and then exits. -C:\> MySQLInstallerConsole --help + You can configure MySQL Installer to automatically update the + MySQL product catalog once per day. To enable this feature + and set the update time, click the wrench icon on the + Installer dashboard. - * --updates (or -u) - Checks for new products before any further action is taken. - Disabled by default. + The next window configures the Automatic Catalog Update. + Enable or disable this feature, and also set the hour. - * --nowait - Skips the final pause when the program finishes. Otherwise, a - "Press Enter to continue." dialogue is generated. It is used - in conjunction with other options. + Figure 2.21 MySQL Installer - Configure the Catalog Scheduler + MySQL Installer - Configure the Catalog Scheduler - * --catalog=catalog_name (or -c) - Sets the default catalog. Use --list to view a list of - available catalogs. + This option uses the Windows Task Scheduler to schedule a + task named "ManifestUpdate". - * --type=installation_type (or -t) - Sets the installation type. - The possible values for installation_type are: developer, - server, client, full, and custom. + Change History - * --action=action_name - The action being performed. - The possible values are: install, remove, upgrade, list, and - status. + MySQL Installer tracks the change history for all of the + MySQL products. Click Catalog from the dashboard, optionally + update the catalog (or, toggle the Do not update at this time + checkbox), click Next/Execute, and then view the change + history. - + install: Installs a product or products, as defined by - --products + Figure 2.22 MySQL Installer - Catalog Change History + MySQL Installer - Catalog Change History - + upgrade: Upgrades a product or products, as defined by - --products. +2.3.3.1.2 Remove MySQL Products - + remove: Removes a product or products, as defined by - --products. + MySQL Installer can also remove MySQL products from your + system. To remove a MySQL product, click Remove from the + Installer dashboard. This opens a window with a list of + installed MySQL products. Select the MySQL products you want + to remove (uninstall), and then click Execute to begin the + removal process. + Note - + list: Lists the product manifest, both installed and - available products. + To select all MySQL products, click the [ ] checkbox to the + left of the Product label. - + status: Shows the status after another action is - performed. + Figure 2.23 MySQL Installer - Removing Products: Select + MySQL Installer - Removing Products: Select - * --product=product_name[:feature1],[feature2], [...] (or -p) - Set the feature list of a product. Use --list to view - available products, or pass in --product=* (an asterisk) to - install all available products. + Figure 2.24 MySQL Installer - Removing Products: Executed + MySQL Installer - Removing Products: Executed - * --config=product_name:passwd=root_password[;parameter1=value], - [;parameter2=value], ... - The configuration parameters for the most recently listed - products. +2.3.3.1.3 Alter MySQL Products + + MySQL Installer offers several options to alter your MySQL + product installations. + +Upgrade + + MySQL products with an available upgrade are highlighted on + the main dashboard. Products with available upgrades will + have an upgrade icon next to their version number. - * --user=product_name:name=username,host:hostname,role=rolename, - password=password or - --user=product_name:name=username,host:hostname,role=rolename, - tokens=tokens - Creates a new user. - Requires: name, host, role, and the password or tokens. Tokens - are separated by pipe ("|") characters. - -2.3.4. MySQL Notifier for Microsoft Windows - - The MySQL Notifier for Microsoft Windows is a tool that enables - you to monitor and adjust the status of your local and remote - MySQL Server instances through an indicator that resides in the - system tray. The MySQL Notifier for Microsoft Windows also gives - quick access to several MySQL GUI tools (such as MySQL Workbench) - through its context menu. - - The MySQL Notifier for Microsoft Windows is installed by MySQL - Installer, and (by default) will start-up when Microsoft Windows - is started. + Figure 2.25 MySQL Installer - Upgrade a MySQL Product + MySQL Installer - Upgrade a MySQL Product + Note + + Available upgrades are determined by having a current + catalog. For information about keeping your MySQL product + catalog current, see Section 2.3.3.1.1, "MySQL Product + Catalog." + + Click Upgrade to view a list upgradable products. Our example + indicates that MySQL server 5.6.19 can be upgraded to version + 5.6.20. + + Figure 2.26 MySQL Installer - Select Products To Upgrade + MySQL Installer - Select Products To Upgrade + + Select (check) the products to upgrade, and optionally click + the changes link to view the product's release notes in your + browser. Click Next to begin the upgrade process. + + Figure 2.27 MySQL Installer - Apply Updates + MySQL Installer - Apply Updates + + A MySQL server upgrade will also check and upgrade the + server's database. Although optional, this step is + recommended. + + Figure 2.28 MySQL Installer - Check and Upgrade Database + MySQL Installer - Check and Upgrade Database + + Upon completion, your upgraded products will be upgraded and + available to use. A MySQL server upgrade also restarts the + MySQL server. + +Reconfigure + + Some MySQL products, such as the MySQL server, include a + Reconfigure option. It opens the same configuration options + that were set when the MySQL product was installed, and is + pre-populated with the current values. + + To execute, click the Reconfigure link under the Quick Action + column on the main dashboard for the MySQL product that you + want to reconfigure. + + Figure 2.29 MySQL Installer - Reconfigure a MySQL Product + MySQL Installer - Reconfigure a MySQL Product + + In the case of the MySQL server, this opens the familiar + configuration wizard. + + Figure 2.30 MySQL Installer - Reconfiguration Wizard + MySQL Installer - Reconfiguration Wizard + +Modify + + Many MySQL products contain feature components that can be + added or removed. For example, Debug binaries and Client + Programs are subcomponents of the MySQL server. + + The modify the features of a product, click Modify on the + main dashboard. + + Figure 2.31 MySQL Installer - Modify Product Features + MySQL Installer - Modify Product Features + + Click Execute to execute the modification request. + +2.3.3.2 MySQL Installer Console + + MySQLInstallerConsole provides functionality similar to the + GUI version of MySQL Installer, but from the command-line. It + is installed when MySQL Installer is initially executed, and + then available within the MySQL Installer directory. + Typically that is in C:\Program Files (x86)\MySQL\MySQL + Installer\, and the console must be executed with + administrative privileges. + + To use, invoke the Command Prompt with administrative + privileges by choosing Start, Accessories, then right-click + on Command Prompt and choose Run as administrator. And from + the command-line, optionally change the directory to where + MySQLInstallerConsole is located: +C:\> cd "C:\Program Files (x86)\MySQL\MySQL Installer" +C:\> MySQLInstallerConsole.exe help + +C:\Program Files (x86)\MySQL\MySQL Installer for Windows>MySQLInstalle +rConsole.exe help + +The following commands are available: + +Configure - Configures one or more of your installed programs. +Help - Provides list of available commands. +Install - Install and configure one or more available MySQL programs +. +List - Provides an interactive way to list all products available +. +Modify - Modifies the features of installed products. +Remove - Removes one or more products from your system. +Status - Shows the status of all installed products. +Update - Update the current product catalog. +Upgrade - Upgrades one or more of your installed programs. + + MySQLInstallerConsole supports the following options, which + are specified on the command line: + + * configure [product1]:[setting]=[value]; + [product2]:[setting]=[value]; [...] + Configure one or more MySQL products on your system. + Switches include: + + + -showsettings : Displays the available options for + the selected product, by passing in the product name + after -showsettings. + + + -silent : Disable confirmation prompts. +C:\> MySQLInstallerConsole configure -showsettings server +C:\> MySQLInstallerConsole configure server:port=3307 + + + * help [command] + Displays a help message with usage examples, and then + exits. Pass in an additional command to receive help + specific to that command. +C:\> MySQLInstallerConsole help +C:\> MySQLInstallerConsole help install + + + * install [product]:[features]:[config block]:[config + block]:[config block]; [...] + Install one or more MySQL products on your system. + Switches and syntax options include: + + + -type=[SetupType] : Installs a predefined set of + software. The "SetupType" can be one of the + following: + Note + Non-custom setup types can only be chosen if no + other MySQL products are installed. + o Developer: Installs a complete development + environment. + o Server: Installs a single MySQL server + o Client: Installs client programs and libraries + o Full: Installs everything + o Custom: Installs user selected products. This + is the default option. + + + -showsettings : Displays the available options for + the selected product, by passing in the product name + after -showsettings. + + + -silent : Disable confirmation prompts. + + + [config block]: One or more configuration blocks can + be specified. Each configuration block is a + semicolon separated list of key value pairs. A block + can include either a "config" or "user" type key, + where "config" is the default type if one is not + defined. + Only one "config" type block can be defined per + product. A "user" block should be defined for each + user that should be created during the product's + installation. + Note + Adding users is not supported when a product is + being reconfigured. + + + [feature]: The feature block is a semicolon + separated list of features, or '*' to select all + features. +C:\> MySQLInstallerConsole install server;5.6.22:*:port=3307;serverid= +2:type=user;username=foo;password=bar;role=DBManager +C:\> MySQLInstallerConsole install server;5.6.22;x64 -silent + + + * list + Lists an interactive console where all of the available + MySQL products can be searched. Execute + MySQLInstallerConsole list to launch the console, and + enter in a substring to search. +C:\> MySQLInstallerConsole list + + + * modify [product1:-removelist|+addlist] + [product2:-removelist|+addlist] [...] + Modifies or displays features of a previously installed + MySQL product. + + + -silent : Disable confirmation prompts. +C:\> MySQLInstallerConsole modify server +C:\> MySQLInstallerConsole modify server:+documentation +C:\> MySQLInstallerConsole modify server:-debug + + + * remove [product1] [product2] [...] + Removes one ore more products from your system. + + + * : Pass in * to remove all of the MySQL products. + + + -continue : Continue the operation even if an error + occurs. + + + -silent : Disable confirmation prompts. +C:\> MySQLInstallerConsole remove * +C:\> MySQLInstallerConsole remove server + + + * status + Provides a quick overview of the MySQL products that are + installed on the system. Information includes product + name and version, architecture, date installed, and + install location. +C:\> MySQLInstallerConsole status + + + * upgrade [product1:version] [product2:version], [...] + Upgrades one or more products on your system. Syntax + options include: + + + * : Pass in * to upgrade all products to the latest + version, or pass in specific products. + + + ! : Pass in ! as a version number to upgrade the + MySQL product to its latest version. + + + -silent : Disable confirmation prompts. +C:\> MySQLInstallerConsole upgrade * +C:\> MySQLInstallerConsole upgrade workbench:6.2.2 +C:\> MySQLInstallerConsole upgrade workbench:! +C:\> MySQLInstallerConsole upgrade workbench:6.2.2 excel:1.3.2 + + + * update + Downloads the latest MySQL product catalog to your + system. On success, the download catalog will be applied + the next time either MySQLInstaller or + MySQLInstallerConsole is executed. +C:\> MySQLInstallerConsole update + + Note + The Automatic Catalog Update GUI option executes this + command from the Windows Task Scheduler. + +2.3.4 MySQL Notifier + + The MySQL Notifier is a tool that enables you to monitor and + adjust the status of your local and remote MySQL Server + instances through an indicator that resides in the system + tray. The MySQL Notifier also gives quick access to several + MySQL GUI tools (such as MySQL Workbench) through its context + menu. + + The MySQL Notifier is installed by MySQL Installer, and (by + default) will start-up when Microsoft Windows is started. Note To install, download and execute the MySQL Installer - (http://dev.mysql.com/downloads/installer/), be sure the MySQL - Notifier for Microsoft Windows product is selected, then proceed - with the installation. See the MySQL Installer manual for - additional details. + (http://dev.mysql.com/downloads/installer/), be sure the + MySQL Notifier product is selected, then proceed with the + installation. See the MySQL Installer manual for additional + details. - For release notes detailing the changes in each release of MySQL - Notifier for Microsoft Windows, see the MySQL Notifier Release - Notes (http://dev.mysql.com/doc/relnotes/mysql-notifier/en/). + For notes detailing the changes in each release of MySQL + Notifier, see the MySQL Notifier Release Notes + (http://dev.mysql.com/doc/relnotes/mysql-notifier/en/). Visit the MySQL Notifier forum (http://forums.mysql.com/list.php?173) for additional MySQL - Notifier for Microsoft Windows help and support. + Notifier help and support. Features include: * Start, Stop, and Restart instances of the MySQL Server. - * Automatically detects (and adds) new MySQL Server services. - These are listed under Manage Monitored Items, and may also be - configured. + * Automatically detects (and adds) new MySQL Server + services. These are listed under Manage Monitored Items, + and may also be configured. - * The Tray icon changes, depending on the status. It's green if - all monitored MySQL Server instances are running, or red if at - least one service is stopped. The Update MySQL Notifier tray - icon based on service status option, which dictates this - behavior, is enabled by default for each service. + * The Tray icon changes, depending on the status. It's + green if all monitored MySQL Server instances are + running, or red if at least one service is stopped. The + Update MySQL Notifier tray icon based on service status + option, which dictates this behavior, is enabled by + default for each service. * Links to other applications like MySQL Workbench, MySQL Installer, and the MySQL Utilities. For example, choosing @@ -759,403 +1183,418 @@ C:\> MySQLInstallerConsole --help Administration window for that particular instance. * If MySQL Workbench is also installed, then the Configure - Instance and SQL Editor options are available for local (but - not remote) MySQL instances. + Instance and SQL Editor options are available for local + (but not remote) MySQL instances. * Monitoring of both local and remote MySQL instances. Note - Remote monitoring is available since MySQL Notifier for Microsoft - Windows 1.1.0. + Remote monitoring is available since MySQL Notifier 1.1.0. - The MySQL Notifier for Microsoft Windows resides in the system - tray and provides visual status information for your MySQL Server - instances. A green icon is displayed at the top left corner of the - tray icon if the current MySQL Server is running, or a red icon if + The MySQL Notifier resides in the system tray and provides + visual status information for your MySQL Server instances. A + green icon is displayed at the top left corner of the tray + icon if the current MySQL Server is running, or a red icon if the service is stopped. - The MySQL Notifier for Microsoft Windows automatically adds - discovered MySQL Services on the local machine, and each service - is saved and configurable. By default, the Automatically add new - services whose name contains option is enabled and set to mysql. + The MySQL Notifier automatically adds discovered MySQL + Services on the local machine, and each service is saved and + configurable. By default, the Automatically add new services + whose name contains option is enabled and set to mysql. Related Notifications Options include being notified when new - services are either discovered or experience status changes, and - are also enabled by default. And uninstalling a service will also - remove the service from the MySQL Notifier for Microsoft Windows. + services are either discovered or experience status changes, + and are also enabled by default. And uninstalling a service + will also remove the service from the MySQL Notifier. Note The Automatically add new services whose name contains option - default changed from ".*mysqld.*" to "mysql" in Notifier 1.1.0. + default changed from ".*mysqld.*" to "mysql" in Notifier + 1.1.0. - Clicking the system tray icon will reveal several options, as seen - in the screenshots below: + Clicking the system tray icon will reveal several options, as + seen in the screenshots below: - The Service Instance menu is the main MySQL Notifier for Microsoft - Windows window, and enables you to Stop, Start, and Restart the - MySQL Server. + The Service Instance menu is the main MySQL Notifier window, + and enables you to Stop, Start, and Restart the MySQL Server. - Figure 2.22. MySQL Notifier for Microsoft Windows Service Instance - menu - MySQL Notifier for Microsoft Windows Service Instance menu + Figure 2.32 MySQL Notifier Service Instance menu + MySQL Notifier Service Instance menu - The Actions menu includes several links to external applications - (if they are installed), and a a Refresh Status option to manually - refresh the status of all monitored services (in both local and - remote computers) and MySQL instances. + The Actions menu includes several links to external + applications (if they are installed), and a Refresh Status + option to manually refresh the status of all monitored + services (in both local and remote computers) and MySQL + instances. Note - The main menu will not show the Actions menu when there are no - services being monitored by MySQL Notifier for Microsoft Windows. + The main menu will not show the Actions menu when there are + no services being monitored by MySQL Notifier. Note - The Refresh Status feature is available since MySQL Notifier for - Microsoft Windows 1.1.0. + The Refresh Status feature is available since MySQL Notifier + 1.1.0. - Figure 2.23. MySQL Notifier for Microsoft Windows Actions menu - MySQL Notifier for Microsoft Windows Actions menu + Figure 2.33 MySQL Notifier Actions menu + MySQL Notifier Actions menu - The Actions, Options menu configures MySQL Notifier for Microsoft - Windows and includes options to: + The Actions, Options menu configures MySQL Notifier and + includes options to: - * Use colorful status icons: Enables a colorful style of icons - for the tray of the MySQL Notifier for Microsoft Windows. + * Use colorful status icons: Enables a colorful style of + icons for the tray of the MySQL Notifier. - * Run at Windows Startup: Allows the application to be loaded - when Microsoft Windows starts. + * Run at Windows Startup: Allows the application to be + loaded when Microsoft Windows starts. - * Automatically Check For Updates Every # Weeks: Checks for a - new version of MySQL Notifier for Microsoft Windows, and runs - this check every # weeks. + * Automatically Check For Updates Every # Weeks: Checks for + a new version of MySQL Notifier, and runs this check + every # weeks. - * Automatically add new services whose name contains: The text - used to filter services and add them automatically to the - monitored list of the local computer running MySQL Notifier, - and on remote computers already monitoring Windows services. - monitored services, and also filters the list of the Microsoft - Windows services for the Add New Service dialog. - Prior to version 1.1.0, this option was named "Automatically - add new services that match this pattern." + * Automatically add new services whose name contains: The + text used to filter services and add them automatically + to the monitored list of the local computer running MySQL + Notifier, and on remote computers already monitoring + Windows services. monitored services, and also filters + the list of the Microsoft Windows services for the Add + New Service dialog. + Prior to version 1.1.0, this option was named + "Automatically add new services that match this pattern." - * Notify me when a service is automatically added: Will display - a balloon notification from the taskbar when a newly - discovered service is added to the monitored services list. + * Notify me when a service is automatically added: Will + display a balloon notification from the taskbar when a + newly discovered service is added to the monitored + services list. * Notify me when a service changes status: Will display a - balloon notification from the taskbar when a monitored service - changes its status. + balloon notification from the taskbar when a monitored + service changes its status. - Figure 2.24. MySQL Notifier for Microsoft Windows Options menu - MySQL Notifier for Microsoft Windows Options menu + Figure 2.34 MySQL Notifier Options menu + MySQL Notifier Options menu - The Actions, Manage Monitored Items menu enables you to configure - the monitored services and MySQL instances. First, with the - Services tab open: + The Actions, Manage Monitored Items menu enables you to + configure the monitored services and MySQL instances. First, + with the Services tab open: - Figure 2.25. MySQL Notifier for Microsoft Windows Manage Services - menu - MySQL Notifier for Microsoft Windows Manage Services menu + Figure 2.35 MySQL Notifier Manage Services menu + MySQL Notifier Manage Services menu The Instances tab is similar: - Figure 2.26. MySQL Notifier for Microsoft Windows Manage Instances - menu - MySQL Notifier for Microsoft Windows Manage Instances menu + Figure 2.36 MySQL Notifier Manage Instances menu + MySQL Notifier Manage Instances menu - Adding a service or instance (after clicking Add in the Manage - Monitored Items window) enables you to select a running Microsoft - Windows service or instance connection, and configure MySQL - Notifier for Microsoft Windows to monitor it. Add a new service or + Adding a service or instance (after clicking Add in the + Manage Monitored Items window) enables you to select a + running Microsoft Windows service or instance connection, and + configure MySQL Notifier to monitor it. Add a new service or instance by clicking service name from the list, then OK to accept. Multiple services and instances may be selected. - Figure 2.27. MySQL Notifier for Microsoft Windows Adding new - services - MySQL Notifier for Microsoft Windows Adding new services + Figure 2.37 MySQL Notifier Adding new services + MySQL Notifier Adding new services And instances: - Figure 2.28. MySQL Notifier for Microsoft Windows Adding new - instances - MySQL Notifier for Microsoft Windows Adding new instances + Figure 2.38 MySQL Notifier Adding new instances + MySQL Notifier Adding new instances Note - The Instances tab available since MySQL Notifier for Microsoft - Windows 1.1.0. + The Instances tab available since MySQL Notifier 1.1.0. -2.3.4.1. Remote monitoring set up and installation instructions +2.3.4.1 Remote monitoring set up and installation instructions - The MySQL Notifier for Microsoft Windows uses Windows Management - Instrumentation (WMI) to manage and monitor services in remote - computers running Windows XP or later. This guide explains how it + The MySQL Notifier uses Windows Management Instrumentation + (WMI) to manage and monitor services in remote computers + running Windows XP or later. This guide explains how it works, and how to set up your system to monitor remote MySQL instances. Note - Remote monitoring is available since MySQL Notifier for Microsoft - Windows 1.1.0. + Remote monitoring is available since MySQL Notifier 1.1.0. - In order to configure WMI, it is important to understand that the - underlying Distributed Component Object Model (DCOM) architecture - is doing the WMI work. Specifically, MySQL Notifier for Microsoft - Windows is using asynchronous notification queries on remote + In order to configure WMI, it is important to understand that + the underlying Distributed Component Object Model (DCOM) + architecture is doing the WMI work. Specifically, MySQL + Notifier is using asynchronous notification queries on remote Microsoft Windows hosts as .NET events. These events send an - asynchronous callback to the computer running the MySQL Notifier - for Microsoft Windows so it knows when a service status has - changed on the remote computer. Asynchronous notifications offer - the best performance compared to semi-synchronous notifications or + asynchronous callback to the computer running the MySQL + Notifier so it knows when a service status has changed on the + remote computer. Asynchronous notifications offer the best + performance compared to semisynchronous notifications or synchronous notifications that use timers. - Asynchronous notifications requires the remote computer to send a - callback to the client computer (thus opening a reverse - connection), so the Windows Firewall and DCOM settings must be - properly configured for the communication to function properly. - - Figure 2.29. MySQL Notifier for Microsoft Windows Distributed - Component Object Model (DCOM) - MySQL Notifier for Microsoft Windows Distributed Component Object - Model (DCOM) - - Most of the common errors thrown by asynchronous WMI notifications - are related to Windows Firewall blocking the communication, or to - DCOM / WMI settings not being set up properly. For a list of - common errors with solutions, see Section 2.3.4.1, "." - - The following steps are required to make WMI function. These steps - are divided between two machines. A single host computer that runs - MySQL Notifier for Microsoft Windows (Computer A), and multiple + Asynchronous notifications requires the remote computer to + send a callback to the client computer (thus opening a + reverse connection), so the Windows Firewall and DCOM + settings must be properly configured for the communication to + function properly. + + Figure 2.39 MySQL Notifier Distributed Component Object Model + (DCOM) + MySQL Notifier Distributed Component Object Model (DCOM) + + Most of the common errors thrown by asynchronous WMI + notifications are related to Windows Firewall blocking the + communication, or to DCOM / WMI settings not being set up + properly. For a list of common errors with solutions, see + Section 2.3.4.1, "." + + The following steps are required to make WMI function. These + steps are divided between two machines. A single host + computer that runs MySQL Notifier (Computer A), and multiple remote machines that are being monitored (Computer B). -Computer running MySQL Notifier for Microsoft Windows (Computer A) +Computer running MySQL Notifier (Computer A) - 1. Allow for remote administration by either editing the Group - Policy Editor, or using NETSH: + 1. Allow for remote administration by either editing the + Group Policy Editor, or using NETSH: Using the Group Policy Editor: - a. Click Start, click Run, type GPEDIT.MSC, and then click - OK. - b. Under the Local Computer Policy heading, double-click - Computer Configuration. + a. Click Start, click Run, type GPEDIT.MSC, and then + click OK. + b. Under the Local Computer Policy heading, + double-click Computer Configuration. c. Double-click Administrative Templates, then Network, Network Connections, and then Windows Firewall. d. If the computer is in the domain, then double-click - Domain Profile; otherwise, double-click Standard Profile. + Domain Profile; otherwise, double-click Standard + Profile. e. Click Windows Firewall: Allow inbound remote administration exception. - f. On the Action menu either select Edit, or double-click - the selection from the previous step. + f. On the Action menu either select Edit, or + double-click the selection from the previous step. g. Check the Enabled radio button, and then click OK. Using the NETSH command: - a. Open a command prompt window with Administrative rights - (you can right-click the Command Prompt icon and click - Run as Administrator). + a. Open a command prompt window with Administrative + rights (you can right-click the Command Prompt icon + and click Run as Administrator). b. Execute the following command: NETSH firewall set service RemoteAdmin enable + 2. Open the DCOM port TCP 135: - a. Open a command prompt window with Administrative rights - (you can right-click the Command Prompt icon and click - Run as Administrator) . + a. Open a command prompt window with Administrative + rights (you can right-click the Command Prompt icon + and click Run as Administrator) . b. Execute the following command: NETSH firewall add portopening protocol=tcp port=135 name=DCOM_TCP135 - 3. Add the client application which contains the sink for the - callback (MySqlNotifier.exe) to the Windows Firewall - Exceptions List (use either the Windows Firewall configuration - or NETSH): + + 3. Add the client application which contains the sink for + the callback (MySqlNotifier.exe) to the Windows Firewall + Exceptions List (use either the Windows Firewall + configuration or NETSH): Using the Windows Firewall configuration: a. In the Control Panel, double-click Windows Firewall. - b. In the Windows Firewall window's left panel, click Allow - a program or feature through Windows Firewall. - c. In the Allowed Programs window, click Change Settings. + b. In the Windows Firewall window's left panel, click + Allow a program or feature through Windows Firewall. + c. In the Allowed Programs window, click Change + Settings. d. If MySqlNotifier.exe is in the Allowed programs and - features list, make sure it is checked for the type of - networks the computer connects to (Private, Public or - both). + features list, make sure it is checked for the type + of networks the computer connects to (Private, + Public or both). e. If MySqlNotifier.exe is not in the list, click Allow another program.... - f. In the Add a Program window, select the MySqlNotifier.exe - if it exists in the Programs list, otherwise click - Browse... and go to the directory where MySqlNotifier.exe - was installed to select it, then click Add. - g. Make sure MySqlNotifier.exe is checked for the type of - networks the computer connects to (Private, Public or - both). + f. In the Add a Program window, select the + MySqlNotifier.exe if it exists in the Programs list, + otherwise click Browse... and go to the directory + where MySqlNotifier.exe was installed to select it, + then click Add. + g. Make sure MySqlNotifier.exe is checked for the type + of networks the computer connects to (Private, + Public or both). Using the NETSH command: - a. Open a command prompt window with Administrative rights - (you can right-click the Command Prompt icon and click - Run as Administrator). + a. Open a command prompt window with Administrative + rights (you can right-click the Command Prompt icon + and click Run as Administrator). b. Execute the following command, where you change "[YOUR_INSTALL_DIRECTORY]": -NETSH firewall add allowedprogram program=[YOUR_INSTALL_DIRECTORY]\My -SqlNotifier.exe name=MySqlNotifier +NETSH firewall add allowedprogram program=[YOUR_INSTALL_DIRECTORY]\MyS +qlNotifier.exe name=MySqlNotifier + 4. If Computer B is either a member of WORKGROUP or is in a - different domain that is untrusted by Computer A, then the - callback connection (Connection 2) is created as an Anonymous - connection. To grant Anonymous connections DCOM Remote Access - permissions: - a. Click Start, click Run, type DCOMCNFG, and then click OK. - b. In the Component Services dialog box, expand Component - Services, expand Computers, and then right-click My - Computer and click Properties. - c. In the My Computer Properties dialog box, click the COM - Security tab. + different domain that is untrusted by Computer A, then + the callback connection (Connection 2) is created as an + Anonymous connection. To grant Anonymous connections DCOM + Remote Access permissions: + a. Click Start, click Run, type DCOMCNFG, and then + click OK. + b. In the Component Services dialog box, expand + Component Services, expand Computers, and then + right-click My Computer and click Properties. + c. In the My Computer Properties dialog box, click the + COM Security tab. d. Under Access Permissions, click Edit Limits. - e. In the Access Permission dialog box, select ANONYMOUS - LOGON name in the Group or user names box. In the Allow - column under Permissions for User, select Remote Access, - and then click OK. + e. In the Access Permission dialog box, select + ANONYMOUS LOGON name in the Group or user names box. + In the Allow column under Permissions for User, + select Remote Access, and then click OK. Monitored Remote Computer (Computer B) - If the user account that is logged into the computer running the - MySQL Notifier for Microsoft Windows (Computer A) is a local - administrator on the remote computer (Computer B), such that the - same account is an administrator on Computer B, you can skip to - the "Allow for remote administration" step. - - Setting DCOM security to allow a non-administrator user to access - a computer remotely: - - 1. Grant "DCOM remote launch" and activation permissions for a - user or group: - a. Click Start, click Run, type DCOMCNFG, and then click OK. - b. In the Component Services dialog box, expand Component - Services, expand Computers, and then right-click My - Computer and click Properties. - c. In the My Computer Properties dialog box, click the COM - Security tab. + If the user account that is logged into the computer running + the MySQL Notifier (Computer A) is a local administrator on + the remote computer (Computer B), such that the same account + is an administrator on Computer B, you can skip to the "Allow + for remote administration" step. + + Setting DCOM security to allow a non-administrator user to + access a computer remotely: + + 1. Grant "DCOM remote launch" and activation permissions for + a user or group: + a. Click Start, click Run, type DCOMCNFG, and then + click OK. + b. In the Component Services dialog box, expand + Component Services, expand Computers, and then + right-click My Computer and click Properties. + c. In the My Computer Properties dialog box, click the + COM Security tab. d. Under Access Permissions, click Edit Limits. - e. In the Launch Permission dialog box, follow these steps - if your name or your group does not appear in the Groups - or user names list: + e. In the Launch Permission dialog box, follow these + steps if your name or your group does not appear in + the Groups or user names list: i. In the Launch Permission dialog box, click Add. - ii. In the Select Users, Computers, or Groups dialog - box, add your name and the group in the "Enter the - object names to select" box, and then click OK. - f. In the Launch Permission dialog box, select your user and - group in the Group or user names box. In the Allow column - under Permissions for User, select Remote Launch, select - Remote Activation, and then click OK. + ii. In the Select Users, Computers, or Groups + dialog box, add your name and the group in the + "Enter the object names to select" box, and + then click OK. + f. In the Launch Permission dialog box, select your + user and group in the Group or user names box. In + the Allow column under Permissions for User, select + Remote Launch, select Remote Activation, and then + click OK. Grant DCOM remote access permissions: - a. Click Start, click Run, type DCOMCNFG, and then click OK. - b. In the Component Services dialog box, expand Component - Services, expand Computers, and then right-click My - Computer and click Properties. - c. In the My Computer Properties dialog box, click the COM - Security tab. + a. Click Start, click Run, type DCOMCNFG, and then + click OK. + b. In the Component Services dialog box, expand + Component Services, expand Computers, and then + right-click My Computer and click Properties. + c. In the My Computer Properties dialog box, click the + COM Security tab. d. Under Access Permissions, click Edit Limits. - e. In the Access Permission dialog box, select ANONYMOUS - LOGON name in the Group or user names box. In the Allow - column under Permissions for User, select Remote Access, - and then click OK. + e. In the Access Permission dialog box, select + ANONYMOUS LOGON name in the Group or user names box. + In the Allow column under Permissions for User, + select Remote Access, and then click OK. 2. Allowing non-administrator users access to a specific WMI namespace: - a. In the Control Panel, double-click Administrative Tools. - b. In the Administrative Tools window, double-click Computer - Management. - c. In the Computer Management window, expand the Services - and Applications tree and double-click the WMI Control. - d. Right-click the WMI Control icon and select Properties. - e. In the WMI Control Properties window, click the Security - tab. + a. In the Control Panel, double-click Administrative + Tools. + b. In the Administrative Tools window, double-click + Computer Management. + c. In the Computer Management window, expand the + Services and Applications tree and double-click the + WMI Control. + d. Right-click the WMI Control icon and select + Properties. + e. In the WMI Control Properties window, click the + Security tab. f. In the Security tab, select the namespace and click Security. - g. Locate the appropriate account and check Remote Enable in - the Permissions list. + g. Locate the appropriate account and check Remote + Enable in the Permissions list. - 3. Allow for remote administration by either editing the Group - Policy Editor or using NETSH: + 3. Allow for remote administration by either editing the + Group Policy Editor or using NETSH: Using the Group Policy Editor: - a. Click Start, click Run, type GPEDIT.MSC, and then click - OK. - b. Under the Local Computer Policy heading, double-click - Computer Configuration. + a. Click Start, click Run, type GPEDIT.MSC, and then + click OK. + b. Under the Local Computer Policy heading, + double-click Computer Configuration. c. Double-click Administrative Templates, then Network, Network Connections, and then Windows Firewall. d. If the computer is in the domain, then double-click - Domain Profile; otherwise, double-click Standard Profile. + Domain Profile; otherwise, double-click Standard + Profile. e. Click Windows Firewall: Allow inbound remote administration exception. - f. On the Action menu either select Edit, or double-click - the selection from the previous step. + f. On the Action menu either select Edit, or + double-click the selection from the previous step. g. Check the Enabled radio button, and then click OK. Using the NETSH command: - a. Open a command prompt window with Administrative rights - (you can right-click the Command Prompt icon and click - Run as Administrator). + a. Open a command prompt window with Administrative + rights (you can right-click the Command Prompt icon + and click Run as Administrator). b. Execute the following command: NETSH firewall set service RemoteAdmin enable - 4. Now, be sure the user you are logging in with uses the Name - value and not the Full Name value: - a. In the Control Panel, double-click Administrative Tools. - b. In the Administrative Tools window, double-click Computer - Management. + + 4. Now, be sure the user you are logging in with uses the + Name value and not the Full Name value: + a. In the Control Panel, double-click Administrative + Tools. + b. In the Administrative Tools window, double-click + Computer Management. c. In the Computer Management window, expand the System Tools then Local Users and Groups. - d. Click the Users node, and on the right side panel locate - your user and make sure it uses the Name value to - connect, and not the Full Name value. - - 5. If the remote computer is running on Windows XP Professional, - make sure that remote logins are not being forcefully changed - to the guest account user (also known as ForceGuest), which is - enabled by default on computers that are not attached to a - domain. - a. Click Start, click Run, type SECPOL.MSC, and then click - OK. + d. Click the Users node, and on the right side panel + locate your user and make sure it uses the Name + value to connect, and not the Full Name value. + + 5. If the remote computer is running on Windows XP + Professional, make sure that remote logins are not being + forcefully changed to the guest account user (also known + as ForceGuest), which is enabled by default on computers + that are not attached to a domain. + a. Click Start, click Run, type SECPOL.MSC, and then + click OK. b. Under the Local Policies node, double-click Security Options. - c. Select Network Access: Sharing and security model for - local accounts and save. + c. Select Network Access: Sharing and security model + for local accounts and save. Common Errors * 0x80070005 - + DCOM Security was not configured properly (see Computer - B, the Setting DCOM security... step). + + DCOM Security was not configured properly (see + Computer B, the Setting DCOM security... step). - + The remote computer (Computer B) is a member of WORKGROUP - or is in a domain that is untrusted by the client - computer (Computer A) (see Computer A, the Grant - Anonymous connections DCOM Remote Access permissions - step). + + The remote computer (Computer B) is a member of + WORKGROUP or is in a domain that is untrusted by the + client computer (Computer A) (see Computer A, the + Grant Anonymous connections DCOM Remote Access + permissions step). * 0x8007000E - + The remote computer (Computer B) is a member of WORKGROUP - or is in a domain that is untrusted by the client - computer (Computer A) (see Computer A, the Grant - Anonymous connections DCOM Remote Access permissions - step). + + The remote computer (Computer B) is a member of + WORKGROUP or is in a domain that is untrusted by the + client computer (Computer A) (see Computer A, the + Grant Anonymous connections DCOM Remote Access + permissions step). * 0x80041003 - + Access to the remote WMI namespace was not configured - properly (see Computer B, the Allowing non-administrator - users access to a specific WMI namespace step). + + Access to the remote WMI namespace was not + configured properly (see Computer B, the Allowing + non-administrator users access to a specific WMI + namespace step). * 0x800706BA + The DCOM port is not open on the client computers - (Computer A) firewall. See the Open the DCOM port TCP 135 - step for Computer A. + (Computer A) firewall. See the Open the DCOM port + TCP 135 step for Computer A. - + The remote computer (Computer B) is inaccessible because - its network location is set to Public. Make sure you can - access it through the Windows Explorer. + + The remote computer (Computer B) is inaccessible + because its network location is set to Public. Make + sure you can access it through the Windows Explorer. -2.3.5. Installing MySQL on Microsoft Windows Using a noinstall Zip +2.3.5 Installing MySQL on Microsoft Windows Using a noinstall Zip Archive - Users who are installing from the noinstall package can use the - instructions in this section to manually install MySQL. The - process for installing MySQL from a Zip archive is as follows: + Users who are installing from the noinstall package can use + the instructions in this section to manually install MySQL. + The process for installing MySQL from a Zip archive is as + follows: 1. Extract the archive to the desired install directory @@ -1169,197 +1608,208 @@ Archive This process is described in the sections that follow. -2.3.5.1. Extracting the Install Archive +2.3.5.1 Extracting the Install Archive To install MySQL manually, do the following: - 1. If you are upgrading from a previous version please refer to - Section 2.3.7, "Upgrading MySQL on Windows," before beginning - the upgrade process. + 1. If you are upgrading from a previous version please refer + to Section 2.3.7, "Upgrading MySQL on Windows," before + beginning the upgrade process. - 2. Make sure that you are logged in as a user with administrator - privileges. + 2. Make sure that you are logged in as a user with + administrator privileges. 3. Choose an installation location. Traditionally, the MySQL - server is installed in C:\mysql. The MySQL Installer installs - MySQL under C:\Program Files\MySQL. If you do not install - MySQL at C:\mysql, you must specify the path to the install - directory during startup or in an option file. See Section - 2.3.5.2, "Creating an Option File." + server is installed in C:\mysql. The MySQL Installation + Wizard installs MySQL under C:\Program Files\MySQL. If + you do not install MySQL at C:\mysql, you must specify + the path to the install directory during startup or in an + option file. See Section 2.3.5.2, "Creating an Option + File." + Note + The MySQL Installer installs MySQL under C:\Program + Files\MySQL. 4. Extract the install archive to the chosen installation - location using your preferred Zip archive tool. Some tools may - extract the archive to a folder within your chosen - installation location. If this occurs, you can move the - contents of the subfolder into the chosen installation - location. - -2.3.5.2. Creating an Option File - - If you need to specify startup options when you run the server, - you can indicate them on the command line or place them in an - option file. For options that are used every time the server - starts, you may find it most convenient to use an option file to - specify your MySQL configuration. This is particularly true under - the following circumstances: - - * The installation or data directory locations are different - from the default locations (C:\Program Files\MySQL\MySQL - Server 5.6 and C:\Program Files\MySQL\MySQL Server 5.6\data). - - * You need to tune the server settings, such as memory, cache, - or InnoDB configuration information. - - When the MySQL server starts on Windows, it looks for option files - in several locations, such as the Windows directory, C:\, and the - MySQL installation directory (for the full list of locations, see - Section 4.2.3.3, "Using Option Files"). The Windows directory - typically is named something like C:\WINDOWS. You can determine - its exact location from the value of the WINDIR environment - variable using the following command: + location using your preferred Zip archive tool. Some + tools may extract the archive to a folder within your + chosen installation location. If this occurs, you can + move the contents of the subfolder into the chosen + installation location. + +2.3.5.2 Creating an Option File + + If you need to specify startup options when you run the + server, you can indicate them on the command line or place + them in an option file. For options that are used every time + the server starts, you may find it most convenient to use an + option file to specify your MySQL configuration. This is + particularly true under the following circumstances: + + * The installation or data directory locations are + different from the default locations (C:\Program + Files\MySQL\MySQL Server 5.6 and C:\Program + Files\MySQL\MySQL Server 5.6\data). + + * You need to tune the server settings, such as memory, + cache, or InnoDB configuration information. + + When the MySQL server starts on Windows, it looks for option + files in several locations, such as the Windows directory, + C:\, and the MySQL installation directory (for the full list + of locations, see Section 4.2.6, "Using Option Files"). The + Windows directory typically is named something like + C:\WINDOWS. You can determine its exact location from the + value of the WINDIR environment variable using the following + command: C:\> echo %WINDIR% - MySQL looks for options in each location first in the my.ini file, - and then in the my.cnf file. However, to avoid confusion, it is - best if you use only one file. If your PC uses a boot loader where - C: is not the boot drive, your only option is to use the my.ini - file. Whichever option file you use, it must be a plain text file. + MySQL looks for options in each location first in the my.ini + file, and then in the my.cnf file. However, to avoid + confusion, it is best if you use only one file. If your PC + uses a boot loader where C: is not the boot drive, your only + option is to use the my.ini file. Whichever option file you + use, it must be a plain text file. Note - When using the MySQL Installer to install MySQL Server, it will - create the my.ini at the default location. And as of MySQL Server - 5.5.27, the user running MySQL Installer is granted full - permissions to this new my.ini. + When using the MySQL Installer to install MySQL Server, it + will create the my.ini at the default location. And as of + MySQL Server 5.5.27, the user running MySQL Installer is + granted full permissions to this new my.ini. - In other words, be sure that the MySQL Server user has permission - to read the my.ini file. + In other words, be sure that the MySQL Server user has + permission to read the my.ini file. - You can also make use of the example option files included with - your MySQL distribution; see Section 5.1.2, "Server Configuration - Defaults." + You can also make use of the example option files included + with your MySQL distribution; see Section 5.1.2, "Server + Configuration Defaults." - An option file can be created and modified with any text editor, - such as Notepad. For example, if MySQL is installed in E:\mysql - and the data directory is in E:\mydata\data, you can create an - option file containing a [mysqld] section to specify values for - the basedir and datadir options: + An option file can be created and modified with any text + editor, such as Notepad. For example, if MySQL is installed + in E:\mysql and the data directory is in E:\mydata\data, you + can create an option file containing a [mysqld] section to + specify values for the basedir and datadir options: [mysqld] # set basedir to your installation path basedir=E:/mysql # set datadir to the location of your data directory datadir=E:/mydata/data - Note that Windows path names are specified in option files using - (forward) slashes rather than backslashes. If you do use - backslashes, double them: + Microsoft Windows path names are specified in option files + using (forward) slashes rather than backslashes. If you do + use backslashes, double them: [mysqld] # set basedir to your installation path basedir=E:\\mysql # set datadir to the location of your data directory datadir=E:\\mydata\\data - The rules for use of backslash in option file values are given in - Section 4.2.3.3, "Using Option Files." + The rules for use of backslash in option file values are + given in Section 4.2.6, "Using Option Files." - The data directory is located within the AppData directory for the - user running MySQL. + The data directory is located within the AppData directory + for the user running MySQL. - If you would like to use a data directory in a different location, - you should copy the entire contents of the data directory to the - new location. For example, if you want to use E:\mydata as the - data directory instead, you must do two things: + If you would like to use a data directory in a different + location, you should copy the entire contents of the data + directory to the new location. For example, if you want to + use E:\mydata as the data directory instead, you must do two + things: - 1. Move the entire data directory and all of its contents from - the default location (for example C:\Program Files\MySQL\MySQL - Server 5.6\data) to E:\mydata. + 1. Move the entire data directory and all of its contents + from the default location (for example C:\Program + Files\MySQL\MySQL Server 5.6\data) to E:\mydata. 2. Use a --datadir option to specify the new data directory location each time you start the server. -2.3.5.3. Selecting a MySQL Server Type +2.3.5.3 Selecting a MySQL Server Type - The following table shows the available servers for Windows in - MySQL 5.6. + The following table shows the available servers for Windows + in MySQL 5.6. Binary Description mysqld Optimized binary with named-pipe support - mysqld-debug Like mysqld, but compiled with full debugging and - automatic memory allocation checking + mysqld-debug Like mysqld, but compiled with full debugging + and automatic memory allocation checking All of the preceding binaries are optimized for modern Intel processors, but should work on any Intel i386-class or higher processor. Each of the servers in a distribution support the same set of - storage engines. The SHOW ENGINES statement displays which engines - a given server supports. + storage engines. The SHOW ENGINES statement displays which + engines a given server supports. - All Windows MySQL 5.6 servers have support for symbolic linking of - database directories. + All Windows MySQL 5.6 servers have support for symbolic + linking of database directories. - MySQL supports TCP/IP on all Windows platforms. MySQL servers on - Windows also support named pipes, if you start the server with the - --enable-named-pipe option. It is necessary to use this option - explicitly because some users have experienced problems with - shutting down the MySQL server when named pipes were used. The - default is to use TCP/IP regardless of platform because named - pipes are slower than TCP/IP in many Windows configurations. + MySQL supports TCP/IP on all Windows platforms. MySQL servers + on Windows also support named pipes, if you start the server + with the --enable-named-pipe option. It is necessary to use + this option explicitly because some users have experienced + problems with shutting down the MySQL server when named pipes + were used. The default is to use TCP/IP regardless of + platform because named pipes are slower than TCP/IP in many + Windows configurations. -2.3.5.4. Starting the Server for the First Time +2.3.5.4 Starting the Server for the First Time This section gives a general overview of starting the MySQL - server. The following sections provide more specific information - for starting the MySQL server from the command line or as a - Windows service. + server. The following sections provide more specific + information for starting the MySQL server from the command + line or as a Windows service. The information here applies primarily if you installed MySQL - using the Noinstall version, or if you wish to configure and test - MySQL manually rather than with the GUI tools. + using the Noinstall version, or if you wish to configure and + test MySQL manually rather than with the GUI tools. Note - The MySQL server will automatically start after using the MySQL - Installer, and the MySQL Notifier for Microsoft Windows GUI can be - used to start/stop/restart at any time. + The MySQL server will automatically start after using the + MySQL Installer, and the MySQL Notifier GUI can be used to + start/stop/restart at any time. The examples in these sections assume that MySQL is installed - under the default location of C:\Program Files\MySQL\MySQL Server - 5.6. Adjust the path names shown in the examples if you have MySQL - installed in a different location. + under the default location of C:\Program Files\MySQL\MySQL + Server 5.6. Adjust the path names shown in the examples if + you have MySQL installed in a different location. - Clients have two options. They can use TCP/IP, or they can use a - named pipe if the server supports named-pipe connections. + Clients have two options. They can use TCP/IP, or they can + use a named pipe if the server supports named-pipe + connections. - MySQL for Windows also supports shared-memory connections if the - server is started with the --shared-memory option. Clients can - connect through shared memory by using the --protocol=MEMORY - option. + MySQL for Windows also supports shared-memory connections if + the server is started with the --shared-memory option. + Clients can connect through shared memory by using the + --protocol=MEMORY option. For information about which server binary to run, see Section 2.3.5.3, "Selecting a MySQL Server Type." - Testing is best done from a command prompt in a console window (or - "DOS window"). In this way you can have the server display status - messages in the window where they are easy to see. If something is - wrong with your configuration, these messages make it easier for - you to identify and fix any problems. + Testing is best done from a command prompt in a console + window (or "DOS window"). In this way you can have the server + display status messages in the window where they are easy to + see. If something is wrong with your configuration, these + messages make it easier for you to identify and fix any + problems. To start the server, enter this command: C:\> "C:\Program Files\MySQL\MySQL Server 5.6\bin\mysqld" --console For a server that includes InnoDB support, you should see the - messages similar to those following as it starts (the path names - and sizes may differ): + messages similar to those following as it starts (the path + names and sizes may differ): InnoDB: The first specified datafile c:\ibdata\ibdata1 did not exist: InnoDB: a new database to be created! InnoDB: Setting file c:\ibdata\ibdata1 size to 209715200 InnoDB: Database physically writes the file full: wait... -InnoDB: Log file c:\iblogs\ib_logfile0 did not exist: new to be creat -ed +InnoDB: Log file c:\iblogs\ib_logfile0 did not exist: new to be create +d InnoDB: Setting log file c:\iblogs\ib_logfile0 size to 31457280 -InnoDB: Log file c:\iblogs\ib_logfile1 did not exist: new to be creat -ed +InnoDB: Log file c:\iblogs\ib_logfile1 did not exist: new to be create +d InnoDB: Setting log file c:\iblogs\ib_logfile1 size to 31457280 -InnoDB: Log file c:\iblogs\ib_logfile2 did not exist: new to be creat -ed +InnoDB: Log file c:\iblogs\ib_logfile2 did not exist: new to be create +d InnoDB: Setting log file c:\iblogs\ib_logfile2 size to 31457280 InnoDB: Doublewrite buffer not found: creating new InnoDB: Doublewrite buffer created @@ -1368,159 +1818,170 @@ InnoDB: foreign key constraint system tables created 011024 10:58:25 InnoDB: Started When the server finishes its startup sequence, you should see - something like this, which indicates that the server is ready to - service client connections: + something like this, which indicates that the server is ready + to service client connections: mysqld: ready for connections -Version: '5.6.17' socket: '' port: 3306 +Version: '5.6.23' socket: '' port: 3306 The server continues to write to the console any further - diagnostic output it produces. You can open a new console window - in which to run client programs. - - If you omit the --console option, the server writes diagnostic - output to the error log in the data directory (C:\Program - Files\MySQL\MySQL Server 5.6\data by default). The error log is - the file with the .err extension, and may be set using the - --log-error option. + diagnostic output it produces. You can open a new console + window in which to run client programs. + + If you omit the --console option, the server writes + diagnostic output to the error log in the data directory + (C:\Program Files\MySQL\MySQL Server 5.6\data by default). + The error log is the file with the .err extension, and may be + set using the --log-error option. Note - The accounts that are listed in the MySQL grant tables initially - have no passwords. After starting the server, you should set up - passwords for them using the instructions in Section 2.10.2, - "Securing the Initial MySQL Accounts." + The accounts that are listed in the MySQL grant tables + initially have no passwords. After starting the server, you + should set up passwords for them using the instructions in + Section 2.10.2, "Securing the Initial MySQL Accounts." -2.3.5.5. Starting MySQL from the Windows Command Line +2.3.5.5 Starting MySQL from the Windows Command Line - The MySQL server can be started manually from the command line. - This can be done on any version of Windows. + The MySQL server can be started manually from the command + line. This can be done on any version of Windows. Note - The MySQL Notifier for Microsoft Windows GUI can also be used to - start/stop/restart the MySQL server. + The MySQL Notifier GUI can also be used to start/stop/restart + the MySQL server. - To start the mysqld server from the command line, you should start - a console window (or "DOS window") and enter this command: + To start the mysqld server from the command line, you should + start a console window (or "DOS window") and enter this + command: C:\> "C:\Program Files\MySQL\MySQL Server 5.6\bin\mysqld" - The path to mysqld may vary depending on the install location of - MySQL on your system. + The path to mysqld may vary depending on the install location + of MySQL on your system. You can stop the MySQL server by executing this command: C:\> "C:\Program Files\MySQL\MySQL Server 5.6\bin\mysqladmin" -u root - shutdown +shutdown + + Note + + If the MySQL root user account has a password, you need to + invoke mysqladmin with the -p option and supply the password + when prompted. + This command invokes the MySQL administrative utility + mysqladmin to connect to the server and tell it to shut down. + The command connects as the MySQL root user, which is the + default administrative account in the MySQL grant system. Note - If the MySQL root user account has a password, you need to invoke - mysqladmin with the -p option and supply the password when - prompted. - - This command invokes the MySQL administrative utility mysqladmin - to connect to the server and tell it to shut down. The command - connects as the MySQL root user, which is the default - administrative account in the MySQL grant system. Note that users - in the MySQL grant system are wholly independent from any login - users under Windows. - - If mysqld doesn't start, check the error log to see whether the - server wrote any messages there to indicate the cause of the - problem. By default, the error log is located in the C:\Program - Files\MySQL\MySQL Server 5.6\data directory. It is the file with a - suffix of .err, or may be specified by passing in the --log-error - option. Alternatively, you can try to start the server as mysqld - --console; in this case, you may get some useful information on - the screen that may help solve the problem. + Users in the MySQL grant system are wholly independent from + any login users under Microsoft Windows. + + If mysqld doesn't start, check the error log to see whether + the server wrote any messages there to indicate the cause of + the problem. By default, the error log is located in the + C:\Program Files\MySQL\MySQL Server 5.6\data directory. It is + the file with a suffix of .err, or may be specified by + passing in the --log-error option. Alternatively, you can try + to start the server with the --console option; in this case, + the server may display some useful information on the screen + that will help solve the problem. The last option is to start mysqld with the --standalone and --debug options. In this case, mysqld writes a log file - C:\mysqld.trace that should contain the reason why mysqld doesn't - start. See Section 23.4.3, "The DBUG Package." + C:\mysqld.trace that should contain the reason why mysqld + doesn't start. See Section 24.4.3, "The DBUG Package." - Use mysqld --verbose --help to display all the options that mysqld - supports. + Use mysqld --verbose --help to display all the options that + mysqld supports. -2.3.5.6. Customizing the PATH for MySQL Tools +2.3.5.6 Customizing the PATH for MySQL Tools - To make it easier to invoke MySQL programs, you can add the path - name of the MySQL bin directory to your Windows system PATH - environment variable: + To make it easier to invoke MySQL programs, you can add the + path name of the MySQL bin directory to your Windows system + PATH environment variable: - * On the Windows desktop, right-click the My Computer icon, and - select Properties. + * On the Windows desktop, right-click the My Computer icon, + and select Properties. - * Next select the Advanced tab from the System Properties menu - that appears, and click the Environment Variables button. + * Next select the Advanced tab from the System Properties + menu that appears, and click the Environment Variables + button. - * Under System Variables, select Path, and then click the Edit - button. The Edit System Variable dialogue should appear. + * Under System Variables, select Path, and then click the + Edit button. The Edit System Variable dialogue should + appear. * Place your cursor at the end of the text appearing in the - space marked Variable Value. (Use the End key to ensure that - your cursor is positioned at the very end of the text in this - space.) Then enter the complete path name of your MySQL bin - directory (for example, C:\Program Files\MySQL\MySQL Server - 5.6\bin) + space marked Variable Value. (Use the End key to ensure + that your cursor is positioned at the very end of the + text in this space.) Then enter the complete path name of + your MySQL bin directory (for example, C:\Program + Files\MySQL\MySQL Server 5.6\bin) Note - There must be a semicolon separating this path from any values - present in this field. - Dismiss this dialogue, and each dialogue in turn, by clicking - OK until all of the dialogues that were opened have been - dismissed. You should now be able to invoke any MySQL - executable program by typing its name at the DOS prompt from - any directory on the system, without having to supply the - path. This includes the servers, the mysql client, and all - MySQL command-line utilities such as mysqladmin and mysqldump. - You should not add the MySQL bin directory to your Windows - PATH if you are running multiple MySQL servers on the same - machine. + There must be a semicolon separating this path from any + values present in this field. + Dismiss this dialogue, and each dialogue in turn, by + clicking OK until all of the dialogues that were opened + have been dismissed. You should now be able to invoke any + MySQL executable program by typing its name at the DOS + prompt from any directory on the system, without having + to supply the path. This includes the servers, the mysql + client, and all MySQL command-line utilities such as + mysqladmin and mysqldump. + You should not add the MySQL bin directory to your + Windows PATH if you are running multiple MySQL servers on + the same machine. Warning You must exercise great care when editing your system PATH by - hand; accidental deletion or modification of any portion of the - existing PATH value can leave you with a malfunctioning or even - unusable system. - -2.3.5.7. Starting MySQL as a Windows Service - - On Windows, the recommended way to run MySQL is to install it as a - Windows service, so that MySQL starts and stops automatically when - Windows starts and stops. A MySQL server installed as a service - can also be controlled from the command line using NET commands, - or with the graphical Services utility. Generally, to install - MySQL as a Windows service you should be logged in using an - account that has administrator rights. + hand; accidental deletion or modification of any portion of + the existing PATH value can leave you with a malfunctioning + or even unusable system. + +2.3.5.7 Starting MySQL as a Windows Service + + On Windows, the recommended way to run MySQL is to install it + as a Windows service, so that MySQL starts and stops + automatically when Windows starts and stops. A MySQL server + installed as a service can also be controlled from the + command line using NET commands, or with the graphical + Services utility. Generally, to install MySQL as a Windows + service you should be logged in using an account that has + administrator rights. Note - The MySQL Notifier for Microsoft Windows GUI can also be used to - monitor the status of the MySQL service. + The MySQL Notifier GUI can also be used to monitor the status + of the MySQL service. - The Services utility (the Windows Service Control Manager) can be - found in the Windows Control Panel (under Administrative Tools on - Windows 2000, XP, Vista, and Server 2003). To avoid conflicts, it - is advisable to close the Services utility while performing server - installation or removal operations from the command line. + The Services utility (the Windows Service Control Manager) + can be found in the Windows Control Panel (under + Administrative Tools on Windows 2000, XP, Vista, and Server + 2003). To avoid conflicts, it is advisable to close the + Services utility while performing server installation or + removal operations from the command line. Installing the service - Before installing MySQL as a Windows service, you should first - stop the current server if it is running by using the following - command: + Before installing MySQL as a Windows service, you should + first stop the current server if it is running by using the + following command: C:\> "C:\Program Files\MySQL\MySQL Server 5.6\bin\mysqladmin" -u root shutdown Note - If the MySQL root user account has a password, you need to invoke - mysqladmin with the -p option and supply the password when - prompted. + If the MySQL root user account has a password, you need to + invoke mysqladmin with the -p option and supply the password + when prompted. + + This command invokes the MySQL administrative utility + mysqladmin to connect to the server and tell it to shut down. + The command connects as the MySQL root user, which is the + default administrative account in the MySQL grant system. + Note - This command invokes the MySQL administrative utility mysqladmin - to connect to the server and tell it to shut down. The command - connects as the MySQL root user, which is the default - administrative account in the MySQL grant system. Note that users - in the MySQL grant system are wholly independent from any login - users under Windows. + Users in the MySQL grant system are wholly independent from + any login users under Windows. Install the server as a service using this command: C:\> "C:\Program Files\MySQL\MySQL Server 5.6\bin\mysqld" --install @@ -1528,187 +1989,196 @@ C:\> "C:\Program Files\MySQL\MySQL Server 5.6\bin\mysqld" --install The service-installation command does not start the server. Instructions for that are given later in this section. - To make it easier to invoke MySQL programs, you can add the path - name of the MySQL bin directory to your Windows system PATH - environment variable: + To make it easier to invoke MySQL programs, you can add the + path name of the MySQL bin directory to your Windows system + PATH environment variable: - * On the Windows desktop, right-click the My Computer icon, and - select Properties. + * On the Windows desktop, right-click the My Computer icon, + and select Properties. - * Next select the Advanced tab from the System Properties menu - that appears, and click the Environment Variables button. + * Next select the Advanced tab from the System Properties + menu that appears, and click the Environment Variables + button. - * Under System Variables, select Path, and then click the Edit - button. The Edit System Variable dialogue should appear. + * Under System Variables, select Path, and then click the + Edit button. The Edit System Variable dialogue should + appear. * Place your cursor at the end of the text appearing in the - space marked Variable Value. (Use the End key to ensure that - your cursor is positioned at the very end of the text in this - space.) Then enter the complete path name of your MySQL bin - directory (for example, C:\Program Files\MySQL\MySQL Server - 5.6\bin), Note that there should be a semicolon separating - this path from any values present in this field. Dismiss this - dialogue, and each dialogue in turn, by clicking OK until all - of the dialogues that were opened have been dismissed. You - should now be able to invoke any MySQL executable program by - typing its name at the DOS prompt from any directory on the - system, without having to supply the path. This includes the - servers, the mysql client, and all MySQL command-line - utilities such as mysqladmin and mysqldump. - You should not add the MySQL bin directory to your Windows - PATH if you are running multiple MySQL servers on the same - machine. + space marked Variable Value. (Use the End key to ensure + that your cursor is positioned at the very end of the + text in this space.) Then enter the complete path name of + your MySQL bin directory (for example, C:\Program + Files\MySQL\MySQL Server 5.6\bin), and there should be a + semicolon separating this path from any values present in + this field. Dismiss this dialogue, and each dialogue in + turn, by clicking OK until all of the dialogues that were + opened have been dismissed. You should now be able to + invoke any MySQL executable program by typing its name at + the DOS prompt from any directory on the system, without + having to supply the path. This includes the servers, the + mysql client, and all MySQL command-line utilities such + as mysqladmin and mysqldump. + You should not add the MySQL bin directory to your + Windows PATH if you are running multiple MySQL servers on + the same machine. Warning You must exercise great care when editing your system PATH by - hand; accidental deletion or modification of any portion of the - existing PATH value can leave you with a malfunctioning or even - unusable system. + hand; accidental deletion or modification of any portion of + the existing PATH value can leave you with a malfunctioning + or even unusable system. - The following additional arguments can be used when installing the - service: + The following additional arguments can be used when + installing the service: * You can specify a service name immediately following the --install option. The default service name is MySQL. - * If a service name is given, it can be followed by a single - option. By convention, this should be - --defaults-file=file_name to specify the name of an option - file from which the server should read options when it starts. + * If a service name is given, it can be followed by a + single option. By convention, this should be + --defaults-file=file_name to specify the name of an + option file from which the server should read options + when it starts. The use of a single option other than --defaults-file is - possible but discouraged. --defaults-file is more flexible - because it enables you to specify multiple startup options for - the server by placing them in the named option file. + possible but discouraged. --defaults-file is more + flexible because it enables you to specify multiple + startup options for the server by placing them in the + named option file. - * You can also specify a --local-service option following the - service name. This causes the server to run using the + * You can also specify a --local-service option following + the service name. This causes the server to run using the LocalService Windows account that has limited system - privileges. This account is available only for Windows XP or - newer. If both --defaults-file and --local-service are given - following the service name, they can be in any order. - - For a MySQL server that is installed as a Windows service, the - following rules determine the service name and option files that - the server uses: - - * If the service-installation command specifies no service name - or the default service name (MySQL) following the --install - option, the server uses the a service name of MySQL and reads - options from the [mysqld] group in the standard option files. - - * If the service-installation command specifies a service name - other than MySQL following the --install option, the server - uses that service name. It reads options from the [mysqld] - group and the group that has the same name as the service in - the standard option files. This enables you to use the - [mysqld] group for options that should be used by all MySQL - services, and an option group with the service name for use by - the server installed with that service name. + privileges. This account is available only for Windows XP + or newer. If both --defaults-file and --local-service are + given following the service name, they can be in any + order. + + For a MySQL server that is installed as a Windows service, + the following rules determine the service name and option + files that the server uses: + + * If the service-installation command specifies no service + name or the default service name (MySQL) following the + --install option, the server uses the a service name of + MySQL and reads options from the [mysqld] group in the + standard option files. + + * If the service-installation command specifies a service + name other than MySQL following the --install option, the + server uses that service name. It reads options from the + [mysqld] group and the group that has the same name as + the service in the standard option files. This enables + you to use the [mysqld] group for options that should be + used by all MySQL services, and an option group with the + service name for use by the server installed with that + service name. * If the service-installation command specifies a --defaults-file option after the service name, the server - reads options the same way as described in the previous item, - except that it reads options only from the the named file and - ignores the standard option files. + reads options the same way as described in the previous + item, except that it reads options only from the named + file and ignores the standard option files. As a more complex example, consider the following command: C:\> "C:\Program Files\MySQL\MySQL Server 5.6\bin\mysqld" --install MySQL --defaults-file=C:\my-opts.cnf Here, the default service name (MySQL) is given after the - --install option. If no --defaults-file option had been given, - this command would have the effect of causing the server to read - the [mysqld] group from the standard option files. However, - because the --defaults-file option is present, the server reads - options from the [mysqld] option group, and only from the named - file. + --install option. If no --defaults-file option had been + given, this command would have the effect of causing the + server to read the [mysqld] group from the standard option + files. However, because the --defaults-file option is + present, the server reads options from the [mysqld] option + group, and only from the named file. Note - On Windows, if the server is started with the --defaults-file and - --install options, --install must be first. Otherwise, mysqld.exe - will attempt to start the MySQL server. + On Windows, if the server is started with the --defaults-file + and --install options, --install must be first. Otherwise, + mysqld.exe will attempt to start the MySQL server. - You can also specify options as Start parameters in the Windows - Services utility before you start the MySQL service. + You can also specify options as Start parameters in the + Windows Services utility before you start the MySQL service. Starting the service Once a MySQL server has been installed as a service, Windows starts the service automatically whenever Windows starts. The - service also can be started immediately from the Services utility, - or by using a NET START MySQL command. The NET command is not case - sensitive. - - When run as a service, mysqld has no access to a console window, - so no messages can be seen there. If mysqld does not start, check - the error log to see whether the server wrote any messages there - to indicate the cause of the problem. The error log is located in - the MySQL data directory (for example, C:\Program - Files\MySQL\MySQL Server 5.6\data). It is the file with a suffix - of .err. + service also can be started immediately from the Services + utility, or by using a NET START MySQL command. The NET + command is not case sensitive. + + When run as a service, mysqld has no access to a console + window, so no messages can be seen there. If mysqld does not + start, check the error log to see whether the server wrote + any messages there to indicate the cause of the problem. The + error log is located in the MySQL data directory (for + example, C:\Program Files\MySQL\MySQL Server 5.6\data). It is + the file with a suffix of .err. When a MySQL server has been installed as a service, and the - service is running, Windows stops the service automatically when - Windows shuts down. The server also can be stopped manually by - using the Services utility, the NET STOP MySQL command, or the - mysqladmin shutdown command. + service is running, Windows stops the service automatically + when Windows shuts down. The server also can be stopped + manually by using the Services utility, the NET STOP MySQL + command, or the mysqladmin shutdown command. You also have the choice of installing the server as a manual service if you do not wish for the service to be started automatically during the boot process. To do this, use the --install-manual option rather than the --install option: -C:\> "C:\Program Files\MySQL\MySQL Server 5.6\bin\mysqld" --install-m -anual +C:\> "C:\Program Files\MySQL\MySQL Server 5.6\bin\mysqld" --install-ma +nual Removing the service - To remove a server that is installed as a service, first stop it - if it is running by executing NET STOP MySQL. Then use the + To remove a server that is installed as a service, first stop + it if it is running by executing NET STOP MySQL. Then use the --remove option to remove it: C:\> "C:\Program Files\MySQL\MySQL Server 5.6\bin\mysqld" --remove - If mysqld is not running as a service, you can start it from the - command line. For instructions, see Section 2.3.5.5, "Starting - MySQL from the Windows Command Line." + If mysqld is not running as a service, you can start it from + the command line. For instructions, see Section 2.3.5.5, + "Starting MySQL from the Windows Command Line." - If you encounter difficulties during installation. see Section - 2.3.6, "Troubleshooting a Microsoft Windows MySQL Server - Installation." + If you encounter difficulties during installation. see + Section 2.3.6, "Troubleshooting a Microsoft Windows MySQL + Server Installation." -2.3.5.8. Testing The MySQL Installation +2.3.5.8 Testing The MySQL Installation - You can test whether the MySQL server is working by executing any - of the following commands: + You can test whether the MySQL server is working by executing + any of the following commands: C:\> "C:\Program Files\MySQL\MySQL Server 5.6\bin\mysqlshow" -C:\> "C:\Program Files\MySQL\MySQL Server 5.6\bin\mysqlshow" -u root -mysql +C:\> "C:\Program Files\MySQL\MySQL Server 5.6\bin\mysqlshow" -u root m +ysql C:\> "C:\Program Files\MySQL\MySQL Server 5.6\bin\mysqladmin" version - status proc +status proc C:\> "C:\Program Files\MySQL\MySQL Server 5.6\bin\mysql" test - If mysqld is slow to respond to TCP/IP connections from client - programs, there is probably a problem with your DNS. In this case, - start mysqld with the --skip-name-resolve option and use only - localhost and IP addresses in the Host column of the MySQL grant - tables. + If mysqld is slow to respond to TCP/IP connections from + client programs, there is probably a problem with your DNS. + In this case, start mysqld with the --skip-name-resolve + option and use only localhost and IP addresses in the Host + column of the MySQL grant tables. - You can force a MySQL client to use a named-pipe connection rather - than TCP/IP by specifying the --pipe or --protocol=PIPE option, or - by specifying . (period) as the host name. Use the --socket option - to specify the name of the pipe if you do not want to use the - default pipe name. + You can force a MySQL client to use a named-pipe connection + rather than TCP/IP by specifying the --pipe or + --protocol=PIPE option, or by specifying . (period) as the + host name. Use the --socket option to specify the name of the + pipe if you do not want to use the default pipe name. - Note that if you have set a password for the root account, deleted - the anonymous account, or created a new user account, then to - connect to the MySQL server you must use the appropriate -u and -p - options with the commands shown previously. See Section 4.2.2, - "Connecting to the MySQL Server." + If you have set a password for the root account, deleted the + anonymous account, or created a new user account, then to + connect to the MySQL server you must use the appropriate -u + and -p options with the commands shown previously. See + Section 4.2.2, "Connecting to the MySQL Server." For more information about mysqlshow, see Section 4.5.6, - "mysqlshow --- Display Database, Table, and Column Information." + "mysqlshow --- Display Database, Table, and Column + Information." -2.3.6. Troubleshooting a Microsoft Windows MySQL Server Installation +2.3.6 Troubleshooting a Microsoft Windows MySQL Server Installation When installing and running MySQL for the first time, you may encounter certain errors that prevent the MySQL server from @@ -1717,99 +2187,114 @@ C:\> "C:\Program Files\MySQL\MySQL Server 5.6\bin\mysql" test Your first resource when troubleshooting server issues is the error log. The MySQL server uses the error log to record - information relevant to the error that prevents the server from - starting. The error log is located in the data directory specified - in your my.ini file. The default data directory location is - C:\Program Files\MySQL\MySQL Server 5.6\data, or - C:\ProgramData\Mysql on Windows 7 and Windows Server 2008. The - C:\ProgramData directory is hidden by default. You need to change - your folder options to see the directory and contents. For more - information on the error log and understanding the content, see - Section 5.2.2, "The Error Log." + information relevant to the error that prevents the server + from starting. The error log is located in the data directory + specified in your my.ini file. The default data directory + location is C:\Program Files\MySQL\MySQL Server 5.6\data, or + C:\ProgramData\Mysql on Windows 7 and Windows Server 2008. + The C:\ProgramData directory is hidden by default. You need + to change your folder options to see the directory and + contents. For more information on the error log and + understanding the content, see Section 5.2.2, "The Error + Log." For information regarding possible errors, also consult the - console messages displayed when the MySQL service is starting. Use - the NET START MySQL command from the command line after installing - mysqld as a service to see any error messages regarding the - starting of the MySQL server as a service. See Section 2.3.5.7, - "Starting MySQL as a Windows Service." + console messages displayed when the MySQL service is + starting. Use the NET START MySQL command from the command + line after installing mysqld as a service to see any error + messages regarding the starting of the MySQL server as a + service. See Section 2.3.5.7, "Starting MySQL as a Windows + Service." - The following examples show other common error messages you might - encounter when installing MySQL and starting the server for the - first time: + The following examples show other common error messages you + might encounter when installing MySQL and starting the server + for the first time: - * If the MySQL server cannot find the mysql privileges database - or other critical files, it displays these messages: + * If the MySQL server cannot find the mysql privileges + database or other critical files, it displays these + messages: System error 1067 has occurred. Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist + These messages often occur when the MySQL base or data directories are installed in different locations than the - default locations (C:\Program Files\MySQL\MySQL Server 5.6 and - C:\Program Files\MySQL\MySQL Server 5.6\data, respectively). - This situation can occur when MySQL is upgraded and installed - to a new location, but the configuration file is not updated - to reflect the new location. In addition, old and new - configuration files might conflict. Be sure to delete or - rename any old configuration files when upgrading MySQL. + default locations (C:\Program Files\MySQL\MySQL Server + 5.6 and C:\Program Files\MySQL\MySQL Server 5.6\data, + respectively). + This situation can occur when MySQL is upgraded and + installed to a new location, but the configuration file + is not updated to reflect the new location. In addition, + old and new configuration files might conflict. Be sure + to delete or rename any old configuration files when + upgrading MySQL. If you have installed MySQL to a directory other than - C:\Program Files\MySQL\MySQL Server 5.6, ensure that the MySQL - server is aware of this through the use of a configuration - (my.ini) file. Put the my.ini file in your Windows directory, - typically C:\WINDOWS. To determine its exact location from the - value of the WINDIR environment variable, issue the following - command from the command prompt: + C:\Program Files\MySQL\MySQL Server 5.6, ensure that the + MySQL server is aware of this through the use of a + configuration (my.ini) file. Put the my.ini file in your + Windows directory, typically C:\WINDOWS. To determine its + exact location from the value of the WINDIR environment + variable, issue the following command from the command + prompt: C:\> echo %WINDIR% - You can create or modify an option file with any text editor, - such as Notepad. For example, if MySQL is installed in - E:\mysql and the data directory is D:\MySQLdata, you can - create the option file and set up a [mysqld] section to - specify values for the basedir and datadir options: + + You can create or modify an option file with any text + editor, such as Notepad. For example, if MySQL is + installed in E:\mysql and the data directory is + D:\MySQLdata, you can create the option file and set up a + [mysqld] section to specify values for the basedir and + datadir options: [mysqld] # set basedir to your installation path basedir=E:/mysql # set datadir to the location of your data directory datadir=D:/MySQLdata - Note that Windows path names are specified in option files - using (forward) slashes rather than backslashes. If you do use - backslashes, double them: + + Microsoft Windows path names are specified in option + files using (forward) slashes rather than backslashes. If + you do use backslashes, double them: [mysqld] # set basedir to your installation path basedir=C:\\Program Files\\MySQL\\MySQL Server 5.6 # set datadir to the location of your data directory datadir=D:\\MySQLdata - The rules for use of backslash in option file values are given - in Section 4.2.3.3, "Using Option Files." - If you change the datadir value in your MySQL configuration - file, you must move the contents of the existing MySQL data - directory before restarting the MySQL server. + + The rules for use of backslash in option file values are + given in Section 4.2.6, "Using Option Files." + If you change the datadir value in your MySQL + configuration file, you must move the contents of the + existing MySQL data directory before restarting the MySQL + server. See Section 2.3.5.2, "Creating an Option File." - * If you reinstall or upgrade MySQL without first stopping and - removing the existing MySQL service and install MySQL using - the MySQL Installer, you might see this error: + * If you reinstall or upgrade MySQL without first stopping + and removing the existing MySQL service and install MySQL + using the MySQL Installer, you might see this error: Error: Cannot create Windows service for MySql. Error: 0 - This occurs when the Configuration Wizard tries to install the - service and finds an existing service with the same name. - One solution to this problem is to choose a service name other - than mysql when using the configuration wizard. This enables - the new service to be installed correctly, but leaves the - outdated service in place. Although this is harmless, it is - best to remove old services that are no longer in use. + + This occurs when the Configuration Wizard tries to + install the service and finds an existing service with + the same name. + One solution to this problem is to choose a service name + other than mysql when using the configuration wizard. + This enables the new service to be installed correctly, + but leaves the outdated service in place. Although this + is harmless, it is best to remove old services that are + no longer in use. To permanently remove the old mysql service, execute the - following command as a user with administrative privileges, on - the command line: + following command as a user with administrative + privileges, on the command line: C:\> sc delete mysql [SC] DeleteService SUCCESS + If the sc utility is not available for your version of Windows, download the delsrv utility from - http://www.microsoft.com/windows2000/techinfo/reskit/tools/exi - sting/delsrv-o.asp and use the delsrv mysql syntax. + http://www.microsoft.com/windows2000/techinfo/reskit/tool + s/existing/delsrv-o.asp and use the delsrv mysql syntax. -2.3.7. Upgrading MySQL on Windows +2.3.7 Upgrading MySQL on Windows - This section lists some of the steps to take when upgrading MySQL - on Windows. + To upgrade MySQL on Windows, follow these steps: 1. Review Section 2.11.1, "Upgrading MySQL," for additional information on upgrading MySQL that is not specific to @@ -1823,93 +2308,124 @@ C:\> sc delete mysql http://dev.mysql.com/downloads/. 4. Before upgrading MySQL, stop the server. If the server is - installed as a service, stop the service with the following - command from the command prompt: + installed as a service, stop the service with the + following command from the command prompt: C:\> NET STOP MySQL + If you are not running the MySQL server as a service, use mysqladmin to stop it. For example, before upgrading from - MySQL 5.5 to 5.6, use mysqladmin from MySQL 5.5 as follows: + MySQL 5.5 to 5.6, use mysqladmin from MySQL 5.5 as + follows: C:\> "C:\Program Files\MySQL\MySQL Server 5.5\bin\mysqladmin" -u root - shutdown +shutdown + Note If the MySQL root user account has a password, invoke - mysqladmin with the -p option and supply the password when + mysqladmin with the -p option and enter the password when prompted. 5. Before upgrading to MySQL 5.6 from a version previous to - 4.1.5, or from a version of MySQL installed from a Zip archive - to a version of MySQL installed with the MySQL Installation - Wizard, you must first manually remove the previous - installation and MySQL service (if the server is installed as - a service). + 4.1.5, or from a version of MySQL installed from a Zip + archive to a version of MySQL installed with the MySQL + Installation Wizard, you must first manually remove the + previous installation and MySQL service (if the server is + installed as a service). To remove the MySQL service, use the following command: C:\> C:\mysql\bin\mysqld --remove + If you do not remove the existing service, the MySQL - Installation Wizard may fail to properly install the new MySQL - service. - - 6. If you are using the MySQL Installer, start it as described in - Section 2.3.3, "Installing MySQL on Microsoft Windows Using - MySQL Installer." - - 7. If you are installing MySQL from a Zip archive, extract the - archive. You may either overwrite your existing MySQL - installation (usually located at C:\mysql), or install it into - a different directory, such as C:\mysql5. Overwriting the - existing installation is recommended. - - 8. If you were running MySQL as a Windows service and you had to - remove the service earlier in this procedure, reinstall the - service. (See Section 2.3.5.7, "Starting MySQL as a Windows - Service.") - - 9. Restart the server. For example, use NET START MySQL if you - run MySQL as a service, or invoke mysqld directly otherwise. + Installation Wizard may fail to properly install the new + MySQL service. + + 6. If you are using the MySQL Installer, start it as + described in Section 2.3.3, "Installing MySQL on + Microsoft Windows Using MySQL Installer." + + 7. If you are upgrading MySQL from a Zip archive, extract + the archive. You may either overwrite your existing MySQL + installation (usually located at C:\mysql), or install it + into a different directory, such as C:\mysql5. + Overwriting the existing installation is recommended. + However, for upgrades (as opposed to installing for the + first time), you must remove the data directory from your + existing MySQL installation to avoid replacing your + current data files. To do so, follow these steps: + a. Unzip the Zip archive in some location other than + your current MySQL installation + b. Remove the data directory + c. Rezip the Zip archive + d. Unzip the modified Zip archive on top of your + existing installation + Alternatively: + a. Unzip the Zip archive in some location other than + your current MySQL installation + b. Remove the data directory + c. Move the data directory from the current MySQL + installation to the location of the just-removed + data directory + d. Remove the current MySQL installation + e. Move the unzipped installation to the location of + the just-removed installation + + 8. If you were running MySQL as a Windows service and you + had to remove the service earlier in this procedure, + reinstall the service. (See Section 2.3.5.7, "Starting + MySQL as a Windows Service.") + + 9. Restart the server. For example, use NET START MySQL if + you run MySQL as a service, or invoke mysqld directly + otherwise. 10. As Administrator, run mysql_upgrade to check your tables, - attempt to repair them if necessary, and update your grant - tables if they have changed so that you can take advantage of - any new capabilities. See Section 4.4.7, "mysql_upgrade --- - Check and Upgrade MySQL Tables." - 11. If you encounter errors, see Section 2.3.6, "Troubleshooting a - Microsoft Windows MySQL Server Installation." + attempt to repair them if necessary, and update your + grant tables if they have changed so that you can take + advantage of any new capabilities. See Section 4.4.7, + "mysql_upgrade --- Check and Upgrade MySQL Tables." + 11. If you encounter errors, see Section 2.3.6, + "Troubleshooting a Microsoft Windows MySQL Server + Installation." -2.3.8. Windows Postinstallation Procedures +2.3.8 Windows Postinstallation Procedures - GUI tools exist that perform most of the tasks described below, - including: + GUI tools exist that perform most of the tasks described + below, including: - * MySQL Installer: Used to install and upgrade MySQL products. + * MySQL Installer: Used to install and upgrade MySQL + products. * MySQL Workbench: Manages the MySQL server and edits SQL queries. - * MySQL Notifier: Starts, stops, or restarts the MySQL server, - and monitors its status. - - * MySQL for Excel: Edits MySQL data with Microsoft Excel. - - On Windows, you need not create the data directory and the grant - tables. MySQL Windows distributions include the grant tables with - a set of preinitialized accounts in the mysql database under the - data directory. Regarding passwords, if you installed MySQL using - the MySQL Installer, you may have already assigned passwords to - the accounts. (See Section 2.3.3, "Installing MySQL on Microsoft - Windows Using MySQL Installer.") Otherwise, use the - password-assignment procedure given in Section 2.10.2, "Securing - the Initial MySQL Accounts." - - Before setting up passwords, you might want to try running some - client programs to make sure that you can connect to the server - and that it is operating properly. Make sure that the server is - running (see Section 2.3.5.4, "Starting the Server for the First - Time"), and then issue the following commands to verify that you - can retrieve information from the server. You may need to specify - directory different from C:\mysql\bin on the command line. If you - used the MySQL Installer, the default directory is C:\Program - Files\MySQL\MySQL Server 5.6, and the mysql and mysqlshow client - programs are in C:\Program Files\MySQL\MySQL Server 5.6\bin. See - Section 2.3.3, "Installing MySQL on Microsoft Windows Using MySQL - Installer," for more information. + * MySQL Notifier: Starts, stops, or restarts the MySQL + server, and monitors its status. + + * MySQL for Excel + (http://dev.mysql.com/doc/mysql-for-excel/en/index.html): + Edits MySQL data with Microsoft Excel. + + On Windows, you need not create the data directory and the + grant tables. MySQL Windows distributions include the grant + tables with a set of preinitialized accounts in the mysql + database under the data directory. Regarding passwords, if + you installed MySQL using the MySQL Installer, you may have + already assigned passwords to the accounts. (See Section + 2.3.3, "Installing MySQL on Microsoft Windows Using MySQL + Installer.") Otherwise, use the password-assignment procedure + given in Section 2.10.2, "Securing the Initial MySQL + Accounts." + + Before setting up passwords, you might want to try running + some client programs to make sure that you can connect to the + server and that it is operating properly. Make sure that the + server is running (see Section 2.3.5.4, "Starting the Server + for the First Time"), and then issue the following commands + to verify that you can retrieve information from the server. + You may need to specify directory different from C:\mysql\bin + on the command line. If you installed MySQL using MySQL + Installer, the default directory is C:\Program + Files\MySQL\MySQL Server 5.6, and the mysql and mysqlshow + client programs are in C:\Program Files\MySQL\MySQL Server + 5.6\bin. See Section 2.3.3, "Installing MySQL on Microsoft + Windows Using MySQL Installer," for more information. Use mysqlshow to see what databases exist: C:\> C:\mysql\bin\mysqlshow @@ -1921,20 +2437,22 @@ C:\> C:\mysql\bin\mysqlshow | test | +--------------------+ - The list of installed databases may vary, but will always include - the minimum of mysql and information_schema. In most cases, the - test database will also be installed automatically. - - The preceding command (and commands for other MySQL programs such - as mysql) may not work if the correct MySQL account does not - exist. For example, the program may fail with an error, or you may - not be able to view all databases. If you installed using MySQL - Installer, then the root user will have been created automatically - with the password you supplied. In this case, you should use the - -u root and -p options. (You will also need to use the -u root and - -p options if you have already secured the initial MySQL - accounts.) With -p, you will be prompted for the root password. - For example: + The list of installed databases may vary, but will always + include the minimum of mysql and information_schema. In most + cases, the test database will also be installed + automatically. + + The preceding command (and commands for other MySQL programs + such as mysql) may not work if the correct MySQL account does + not exist. For example, the program may fail with an error, + or you may not be able to view all databases. If you + installed MySQL using MySQL Installer, then the root user + will have been created automatically with the password you + supplied. In this case, you should use the -u root and -p + options. (You will also need to use the -u root and -p + options if you have already secured the initial MySQL + accounts.) With -p, you will be prompted for the root + password. For example: C:\> C:\mysql\bin\mysqlshow -u root -p Enter password: (enter root password here) +--------------------+ @@ -1945,8 +2463,8 @@ Enter password: (enter root password here) | test | +--------------------+ - If you specify a database name, mysqlshow displays a list of the - tables within the database: + If you specify a database name, mysqlshow displays a list of + the tables within the database: C:\> C:\mysql\bin\mysqlshow mysql Database: mysql +---------------------------+ @@ -1974,8 +2492,8 @@ Database: mysql | user | +---------------------------+ - Use the mysql program to select information from a table in the - mysql database: + Use the mysql program to select information from a table in + the mysql database: C:\> C:\mysql\bin\mysql -e "SELECT Host,Db,User FROM mysql.db" +------+--------+------+ | host | db | user | @@ -1984,14 +2502,12 @@ C:\> C:\mysql\bin\mysql -e "SELECT Host,Db,User FROM mysql.db" | % | test_% | | +------+--------+------+ - For more information about mysqlshow and mysql, see Section 4.5.6, - "mysqlshow --- Display Database, Table, and Column Information," - and Section 4.5.1, "mysql --- The MySQL Command-Line Tool." - - If you are running a version of Windows that supports services, - you can set up the MySQL server to run automatically when Windows - starts. See Section 2.3.5.7, "Starting MySQL as a Windows - Service." + For more information about mysqlshow and mysql, see Section + 4.5.6, "mysqlshow --- Display Database, Table, and Column + Information," and Section 4.5.1, "mysql --- The MySQL + Command-Line Tool." - Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights - reserved. Legal Notices + If you are running a version of Windows that supports + services, you can set up the MySQL server to run + automatically when Windows starts. See Section 2.3.5.7, + "Starting MySQL as a Windows Service." diff --git a/mysql-wsrep-5.6/Docs/README-wsrep b/mysql-wsrep-5.6/Docs/README-wsrep new file mode 100644 index 00000000..7b1435f4 --- /dev/null +++ b/mysql-wsrep-5.6/Docs/README-wsrep @@ -0,0 +1,487 @@ +Codership Oy +http://www.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 + +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 + + 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 /24 --destination /32 --dport 3306 -j ACCEPT +# iptables --insert RH-Firewall-1-INPUT 1 --proto tcp --source /24 --destination /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=''; +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 +
[: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
part + will be used to listen for SST (see below). And the whole
[: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 most tested. + - rsync: much faster on large datasets. + - 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: + datadir= + [client] + 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 + : + 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. + diff --git a/mysql-wsrep-5.6/INSTALL-SOURCE b/mysql-wsrep-5.6/INSTALL-SOURCE index f21ca02f..ac578609 100644 --- a/mysql-wsrep-5.6/INSTALL-SOURCE +++ b/mysql-wsrep-5.6/INSTALL-SOURCE @@ -1,377 +1,217 @@ +Chapter 2 Installing and Upgrading MySQL -Chapter 2. Installing and Upgrading MySQL + This chapter describes how to obtain and install MySQL. A + summary of the procedure follows and later sections provide + the details. If you plan to upgrade an existing version of + MySQL to a newer version rather than install MySQL for the + first time, see Section 2.11.1, "Upgrading MySQL," for + information about upgrade procedures and about issues that + you should consider before upgrading. - This chapter describes how to obtain and install MySQL. A summary - of the procedure follows and later sections provide the details. - If you plan to upgrade an existing version of MySQL to a newer - version rather than install MySQL for the first time, see Section - 2.11.1, "Upgrading MySQL," for information about upgrade - procedures and about issues that you should consider before - upgrading. + If you are interested in migrating to MySQL from another + database system, you may wish to read Section A.8, "MySQL 5.6 + FAQ: Migration," which contains answers to some common + questions concerning migration issues. - If you are interested in migrating to MySQL from another database - system, you may wish to read Section B.8, "MySQL 5.6 FAQ: - Migration," which contains answers to some common questions - concerning migration issues. - - Installation of MySQL generally follows the steps outlined here: + Installation of MySQL generally follows the steps outlined + here: 1. Determine whether MySQL runs and is supported on your platform. - Please note that not all platforms are equally suitable for - running MySQL, and that not all platforms on which MySQL is - known to run are officially supported by Oracle Corporation: + Please note that not all platforms are equally suitable + for running MySQL, and that not all platforms on which + MySQL is known to run are officially supported by Oracle + Corporation: 2. Choose which distribution to install. Several versions of MySQL are available, and most are - available in several distribution formats. You can choose from - pre-packaged distributions containing binary (precompiled) - programs or source code. When in doubt, use a binary - distribution. We also provide public access to our current - source tree for those who want to see our most recent - developments and help us test new code. To determine which - version and type of distribution you should use, see Section - 2.1.2, "Choosing Which MySQL Distribution to Install." + available in several distribution formats. You can choose + from pre-packaged distributions containing binary + (precompiled) programs or source code. When in doubt, use + a binary distribution. We also provide public access to + our current source tree for those who want to see our + most recent developments and help us test new code. To + determine which version and type of distribution you + should use, see Section 2.1.2, "Which MySQL Version and + Distribution to Install." 3. Download the distribution that you want to install. - For instructions, see Section 2.1.3, "How to Get MySQL." To - verify the integrity of the distribution, use the instructions - in Section 2.1.4, "Verifying Package Integrity Using MD5 - Checksums or GnuPG." + For instructions, see Section 2.1.3, "How to Get MySQL." + To verify the integrity of the distribution, use the + instructions in Section 2.1.4, "Verifying Package + Integrity Using MD5 Checksums or GnuPG." 4. Install the distribution. To install MySQL from a binary distribution, use the - instructions in Section 2.2, "Installing MySQL on Unix/Linux - Using Generic Binaries." + instructions in Section 2.2, "Installing MySQL on + Unix/Linux Using Generic Binaries." To install MySQL from a source distribution or from the current development source tree, use the instructions in Section 2.9, "Installing MySQL from Source." 5. Perform any necessary postinstallation setup. - After installing MySQL, see Section 2.10, "Postinstallation - Setup and Testing" for information about making sure the MySQL - server is working properly. Also refer to the information - provided in Section 2.10.2, "Securing the Initial MySQL - Accounts." This section describes how to secure the initial - MySQL user accounts, which have no passwords until you assign - passwords. The section applies whether you install MySQL using - a binary or source distribution. - - 6. If you want to run the MySQL benchmark scripts, Perl support - for MySQL must be available. See Section 2.13, "Perl - Installation Notes." + After installing MySQL, see Section 2.10, + "Postinstallation Setup and Testing" for information + about making sure the MySQL server is working properly. + Also refer to the information provided in Section 2.10.2, + "Securing the Initial MySQL Accounts." This section + describes how to secure the initial MySQL user accounts, + which have no passwords until you assign passwords. The + section applies whether you install MySQL using a binary + or source distribution. + + 6. If you want to run the MySQL benchmark scripts, Perl + support for MySQL must be available. See Section 2.13, + "Perl Installation Notes." Instructions for installing MySQL on different platforms and environments is available on a platform by platform basis: * Unix, Linux, FreeBSD - For instructions on installing MySQL on most Linux and Unix - platforms using a generic binary (for example, a .tar.gz - package), see Section 2.2, "Installing MySQL on Unix/Linux - Using Generic Binaries." - For information on building MySQL entirely from the source - code distributions or the source code repositories, see - Section 2.9, "Installing MySQL from Source" - For specific platform help on installation, configuration, and - building from source see the corresponding platform section: - - + Linux, including notes on distribution specific methods, - see Section 2.5, "Installing MySQL on Linux." + For instructions on installing MySQL on most Linux and + Unix platforms using a generic binary (for example, a + .tar.gz package), see Section 2.2, "Installing MySQL on + Unix/Linux Using Generic Binaries." + For information on building MySQL entirely from the + source code distributions or the source code + repositories, see Section 2.9, "Installing MySQL from + Source" + For specific platform help on installation, + configuration, and building from source see the + corresponding platform section: - + Solaris and OpenSolaris, including PKG and IPS formats, - see Section 2.6, "Installing MySQL on Solaris and - OpenSolaris." + + Linux, including notes on distribution specific + methods, see Section 2.5, "Installing MySQL on + Linux." - + IBM AIX, see Section 2.6, "Installing MySQL on Solaris - and OpenSolaris." + + Solaris and OpenSolaris, including PKG and IPS + formats, see Section 2.7, "Installing MySQL on + Solaris and OpenSolaris." - + Hewlett-Packard HP-UX, including the DEPOT package - format, see Section 2.7, "Installing MySQL on HP-UX." + + IBM AIX, see Section 2.7, "Installing MySQL on + Solaris and OpenSolaris." - + FreeBSD, see Section 2.8, "Installing MySQL on FreeBSD." + + FreeBSD, see Section 2.8, "Installing MySQL on + FreeBSD." * Microsoft Windows - For instructions on installing MySQL on Microsoft Windows, - using either a Zipped binary or an MSI package, see Section - 2.3, "Installing MySQL on Microsoft Windows." - For details and instructions on building MySQL from source - code using Microsoft Visual Studio, see Section 2.9, - "Installing MySQL from Source." - - * Mac OS X - For installation on Mac OS X, including using both the binary - package and native PKG formats, see Section 2.4, "Installing - MySQL on Mac OS X." - For information on making use of the MySQL Startup Item to - automatically start and stop MySQL, see Section 2.4.3, + For instructions on installing MySQL on Microsoft + Windows, using either a Zipped binary or an MSI package, + see Section 2.3, "Installing MySQL on Microsoft Windows." + For details and instructions on building MySQL from + source code using Microsoft Visual Studio, see Section + 2.9, "Installing MySQL from Source." + + * OS X + For installation on OS X, including using both the binary + package and native PKG formats, see Section 2.4, + "Installing MySQL on OS X." + For information on making use of the MySQL Startup Item + to automatically start and stop MySQL, see Section 2.4.4, "Installing the MySQL Startup Item." For information on the MySQL Preference Pane, see Section - 2.4.4, "Installing and Using the MySQL Preference Pane." + 2.4.5, "Installing and Using the MySQL Preference Pane." -2.1. General Installation Guidance +2.1 General Installation Guidance The immediately following sections contain the information - necessary to choose, download, and verify your distribution. The - instructions in later sections of the chapter describe how to - install the distribution that you choose. For binary - distributions, see the instructions at Section 2.2, "Installing - MySQL on Unix/Linux Using Generic Binaries" or the corresponding - section for your platform if available. To build MySQL from - source, use the instructions in Section 2.9, "Installing MySQL - from Source." - -2.1.1. Operating Systems Supported by MySQL Community Server - - This section lists the operating systems on which MySQL Community - Server is known to run. - Important - - Oracle Corporation does not necessarily provide official support - for all the platforms listed in this section. For information - about those platforms that are officially supported, see - http://www.mysql.com/support/supportedplatforms/database.html on - the MySQL Web site. - - We use CMake, so it is possible to port MySQL to all modern - systems that have a C++ compiler and a working implementation of - POSIX threads. (Thread support is needed for the server. To - compile only the client code, the only requirement is a C++ - compiler.) - - MySQL has been reported to compile successfully on the following - systems: - - * FreeBSD 5.x and up. See Section 2.8, "Installing MySQL on - FreeBSD." - - * HP-UX 11.x. See Section 2.7, "Installing MySQL on HP-UX." - - * Linux. Builds on all recent Linux distributions based on the - 2.6 kernel. See Section 2.5, "Installing MySQL on Linux." - - * Mac OS X. See Section 2.4, "Installing MySQL on Mac OS X." - - * Solaris 2.8 on SPARC and x86. See Section 2.6, "Installing - MySQL on Solaris and OpenSolaris." - - * Microsoft Windows. See Section 2.3, "Installing MySQL on - Microsoft Windows." - - MySQL has also been known to run on other systems in the past. See - Section 2.1, "General Installation Guidance." Some porting effort - might be required for current versions of MySQL on these systems. - - Not all platforms are equally well-suited for running MySQL. How - well a certain platform is suited for a high-load mission-critical - MySQL server is determined by the following factors: - - * General stability of the thread library. A platform may have - an excellent reputation otherwise, but MySQL is only as stable - as the thread library it calls, even if everything else is - perfect. - - * The capability of the kernel and the thread library to take - advantage of symmetric multi-processor (SMP) systems. In other - words, when a process creates a thread, it should be possible - for that thread to run on a CPU different from the original - process. - - * The capability of the kernel and the thread library to run - many threads that acquire and release a mutex over a short - critical region frequently without excessive context switches. - If the implementation of pthread_mutex_lock() is too anxious - to yield CPU time, this hurts MySQL tremendously. If this - issue is not taken care of, adding extra CPUs actually makes - MySQL slower. + necessary to choose, download, and verify your distribution. + The instructions in later sections of the chapter describe + how to install the distribution that you choose. For binary + distributions, see the instructions at Section 2.2, + "Installing MySQL on Unix/Linux Using Generic Binaries" or + the corresponding section for your platform if available. To + build MySQL from source, use the instructions in Section 2.9, + "Installing MySQL from Source." + +2.1.1 Operating Systems Supported by MySQL Community Server + + MySQL is available on a number of operating systems and + platforms. For information about those platforms that are + officially supported, see + http://www.mysql.com/support/supportedplatforms/database.html + on the MySQL Web site. + +2.1.2 Which MySQL Version and Distribution to Install + + When preparing to install MySQL, you should decide which + version to use, and which distribution format (binary or + source) to use for the installation. + + First, decide if you want to install a development release or + a GA release. Development releases have the newest features, + but are not recommended for production use. GA (General + Availability) releases, also called production or stable + releases, are meant for production use. We recommend to use + the most recent GA release. + + The naming scheme in MySQL 5.6 uses release names that + consist of three numbers and a suffix; for example, + mysql-5.6.1-m1. The numbers within the release name are + interpreted as follows: + + * The first number (5) is the major version and describes + the file format. All MySQL 5 releases have the same file + format. + + * The second number (6) is the release level. Taken + together, the major version and release level constitute + the release series number. + + * The third number (1) is the version number within the + release series. This is incremented for each new release. + Usually you want the latest version for the series you + have chosen. + + For each minor update, the last number in the version string + is incremented. When there are major new features or minor + incompatibilities with previous versions, the second number + in the version string is incremented. When the file format + changes, the first number is increased. + + Release names can also include a suffix that indicates the + stability level of the release. Releases within a series + progress through a set of suffixes to indicate how the + stability level improves. The possible suffixes are: - * General file system stability and performance. - - * Table size. If your tables are large, performance is affected - by the ability of the file system to deal with large files and - dealing with them efficiently. - - * Our level of expertise here at Oracle Corporation with the - platform. If we know a platform well, we enable - platform-specific optimizations and fixes at compile time. We - can also provide advice on configuring your system optimally - for MySQL. - - * The amount of testing we have done internally for similar - configurations. - - * The number of users that have run MySQL successfully on the - platform in similar configurations. If this number is high, - the likelihood of encountering platform-specific surprises is - much smaller. - -2.1.2. Choosing Which MySQL Distribution to Install - - When preparing to install MySQL, you should decide which version - to use. MySQL development occurs in several release series, and - you can pick the one that best fits your needs. After deciding - which version to install, you can choose a distribution format. - Releases are available in binary or source format. - -2.1.2.1. Choosing Which Version of MySQL to Install - - The first decision to make is whether you want to use a production - (stable) release or a development release. In the MySQL - development process, multiple release series co-exist, each at a - different stage of maturity. - -Production Releases - - - * MySQL 5.6: Latest General Availability (Production) release - - * MySQL 5.5: Previous General Availability (Production) release - - * MySQL 5.1: Older General Availability (Production) release - - * MySQL 5.0: Older Production release nearing the end of the - product lifecycle - - MySQL 4.1, 4.0, and 3.23 are old releases that are no longer - supported. - - See http://www.mysql.com/about/legal/lifecycle/ for information - about support policies and schedules. - - Normally, if you are beginning to use MySQL for the first time or - trying to port it to some system for which there is no binary - distribution, use the most recent General Availability series - listed in the preceding descriptions. All MySQL releases, even - those from development series, are checked with the MySQL - benchmarks and an extensive test suite before being issued. - - If you are running an older system and want to upgrade, but do not - want to take the chance of having a nonseamless upgrade, you - should upgrade to the latest version in the same release series - you are using (where only the last part of the version number is - newer than yours). We have tried to fix only fatal bugs and make - only small, relatively "safe" changes to that version. - - If you want to use new features not present in the production - release series, you can use a version from a development series. - Be aware that development releases are not as stable as production - releases. - - We do not use a complete code freeze because this prevents us from - making bugfixes and other fixes that must be done. We may add - small things that should not affect anything that currently works - in a production release. Naturally, relevant bugfixes from an - earlier series propagate to later series. - - If you want to use the very latest sources containing all current - patches and bugfixes, you can use one of our source code - repositories (see Section 2.9.3, "Installing MySQL Using a - Development Source Tree"). These are not "releases" as such, but - are available as previews of the code on which future releases are - to be based. - - The naming scheme in MySQL 5.6 uses release names that consist of - three numbers and a suffix; for example, mysql-5.6.1-m1. The - numbers within the release name are interpreted as follows: - - * The first number (5) is the major version and describes the - file format. All MySQL 5 releases have the same file format. - - * The second number (6) is the release level. Taken together, - the major version and release level constitute the release - series number. - - * The third number (1) is the version number within the release - series. This is incremented for each new release. Usually you - want the latest version for the series you have chosen. - - For each minor update, the last number in the version string is - incremented. When there are major new features or minor - incompatibilities with previous versions, the second number in the - version string is incremented. When the file format changes, the - first number is increased. - - Release names also include a suffix to indicates the stability - level of the release. Releases within a series progress through a - set of suffixes to indicate how the stability level improves. The - possible suffixes are: - - * mN (for example, m1, m2, m3, ...) indicate a milestone number. - MySQL development uses a milestone model, in which each - milestone proceeds through a small number of versions with a - tight focus on a small subset of thoroughly tested features. - Following the releases for one milestone, development proceeds - with another small number of releases that focuses on the next - small set of features, also thoroughly tested. Features within - milestone releases may be considered to be of pre-production - quality. + * If there is no suffix, it indicates that the release is a + General Availability (GA) or Production release. GA + releases are stable, having successfully passed through + all earlier release stages and are believed to be + reliable, free of serious bugs, and suitable for use in + production systems. Only critical bugfixes are applied to + the release. + + * mN (for example, m1, m2, m3, ...) indicate a milestone + number. MySQL development uses a milestone model, in + which each milestone proceeds through a small number of + versions with a tight focus on a small subset of + thoroughly tested features. Following the releases for + one milestone, development proceeds with another small + number of releases that focuses on the next small set of + features, also thoroughly tested. Features within + milestone releases may be considered to be of + pre-production quality. * rc indicates a Release Candidate. Release candidates are - believed to be stable, having passed all of MySQL's internal - testing, and with all known fatal runtime bugs fixed. However, - the release has not been in widespread use long enough to know - for sure that all bugs have been identified. Only minor fixes - are added. - - * If there is no suffix, it indicates that the release is a - General Availability (GA) or Production release. GA releases - are stable, having successfully passed through all earlier - release stages and are believed to be reliable, free of - serious bugs, and suitable for use in production systems. Only - critical bugfixes are applied to the release. - - All releases of MySQL are run through our standard tests and - benchmarks to ensure that they are relatively safe to use. Because - the standard tests are extended over time to check for all - previously found bugs, the test suite keeps getting better. - - All releases have been tested at least with these tools: - - * An internal test suite. The mysql-test directory contains an - extensive set of test cases. We run these tests for every - server binary. See Section 23.1.2, "The MySQL Test Suite," for - more information about this test suite. - - * The MySQL benchmark suite. This suite runs a range of common - queries. It is also a test to determine whether the latest - batch of optimizations actually made the code faster. See - Section 8.12.2, "The MySQL Benchmark Suite." - - We also perform additional integration and nonfunctional testing - of the latest MySQL version in our internal production - environment. Integration testing is done with different - connectors, storage engines, replication modes, backup, - partitioning, stored programs, and so forth in various - combinations. Additional nonfunctional testing is done in areas of - performance, concurrency, stress, high volume, upgrade and - downgrade. - -2.1.2.2. Choosing a Distribution Format - - After choosing which version of MySQL to install, you should - decide whether to use a binary distribution or a source - distribution. In most cases, you should probably use a binary - distribution, if one exists for your platform. Binary - distributions are available in native format for many platforms, - such as RPM packages for Linux, DMG packages for Mac OS X, and PKG - packages for Solaris. Distributions are also available in more - generic formats such as Zip archives or compressed tar files. - - Reasons to choose a binary distribution include the following: - - * Binary distributions generally are easier to install than - source distributions. - - * To satisfy different user requirements, we provide several - servers in binary distributions. mysqld is an optimized server - that is a smaller, faster binary. mysqld-debug is compiled - with debugging support. - Each of these servers is compiled from the same source - distribution, though with different configuration options. All - native MySQL clients can connect to servers from either MySQL - version. - - Under some circumstances, you may be better off installing MySQL - from a source distribution: + believed to be stable, having passed all of MySQL's + internal testing, and with all known fatal runtime bugs + fixed. However, the release has not been in widespread + use long enough to know for sure that all bugs have been + identified. Only minor fixes are added. + + Once you've chosen which MySQL version to install, you need + to decide which distribution to install for your operating + system. For most use cases, a binary distribution is the + right choice. Binary distributions are available in native + format for many platforms, such as RPM packages for Linux, or + DMG packages for OS X. Distributions are also available in + more generic formats such as Zip archives or compressed tar + files. On Windows, you can use the MySQL Installer to install + a binary distribution. + + Under some circumstances, you may be better off installing + MySQL from a source distribution: * You want to install MySQL at some explicit location. The standard binary distributions are ready to run at any @@ -379,109 +219,84 @@ Production Releases flexibility to place MySQL components where you want. * You want to configure mysqld to ensure that features are - available that might not be included in the standard binary - distributions. Here is a list of the most common extra options - that you may want to use to ensure feature availability: + available that might not be included in the standard + binary distributions. Here is a list of the most common + extra options that you may want to use to ensure feature + availability: + -DWITH_LIBWRAP=1 for TCP wrappers support. - + -DWITH_ZLIB={system|bundled} for features that depend on - compression + + -DWITH_ZLIB={system|bundled} for features that + depend on compression + -DWITH_DEBUG=1 for debugging support For additional information, see Section 2.9.4, "MySQL Source-Configuration Options." - * You want to configure mysqld without some features that are - included in the standard binary distributions. For example, - distributions normally are compiled with support for all - character sets. If you want a smaller MySQL server, you can - recompile it with support for only the character sets you - need. + * You want to configure mysqld without some features that + are included in the standard binary distributions. For + example, distributions normally are compiled with support + for all character sets. If you want a smaller MySQL + server, you can recompile it with support for only the + character sets you need. - * You want to use the latest sources from one of the Bazaar + * You want to use the latest sources from one of the Git repositories to have access to all current bugfixes. For - example, if you have found a bug and reported it to the MySQL - development team, the bugfix is committed to the source - repository and you can access it there. The bugfix does not - appear in a release until a release actually is issued. - - * You want to read (or modify) the C and C++ code that makes up - MySQL. For this purpose, you should get a source distribution, - because the source code is always the ultimate manual. + example, if you have found a bug and reported it to the + MySQL development team, the bugfix is committed to the + source repository and you can access it there. The bugfix + does not appear in a release until a release actually is + issued. + + * You want to read (or modify) the C and C++ code that + makes up MySQL. For this purpose, you should get a source + distribution. * Source distributions contain more tests and examples than binary distributions. -2.1.2.3. How and When Updates Are Released - - MySQL is evolving quite rapidly and we want to share new - developments with other MySQL users. We try to produce a new - release whenever we have new and useful features that others also - seem to have a need for. - - We also try to help users who request features that are easy to - implement. We take note of what our licensed users want, and we - especially take note of what our support customers want and try to - help them in this regard. - - No one is required to download a new release. The Release Notes - (http://dev.mysql.com/doc/relnotes/mysql/5.6/en/) help you - determine whether the new release has something you really want. - - We use the following policy when updating MySQL: - - * Enterprise Server releases are meant to appear every 18 - months, supplemented by quarterly service packs and monthly - rapid updates. Community Server releases are meant to appear 2 - to 3 times per year. - - * Releases are issued within each series. For each release, the - last number in the version is one more than the previous - release within the same series. - - * Binary distributions for some platforms are made by us for - major releases. Other people may make binary distributions for - other systems, but probably less frequently. - - * We make fixes available as soon as we have identified and - corrected small or noncritical but annoying bugs. The fixes - are available in source form immediately from our public - Bazaar repositories, and are included in the next release. - - * If by any chance a security vulnerability or critical bug is - found in a release, our policy is to fix it in a new release - as soon as possible. (We would like other companies to do - this, too!) - -2.1.3. How to Get MySQL +2.1.3 How to Get MySQL - Check our downloads page at http://dev.mysql.com/downloads/ for - information about the current version of MySQL and for downloading - instructions. For a complete up-to-date list of MySQL download - mirror sites, see http://dev.mysql.com/downloads/mirrors.html. You - can also find information there about becoming a MySQL mirror site - and how to report a bad or out-of-date mirror. + Check our downloads page at http://dev.mysql.com/downloads/ + for information about the current version of MySQL and for + downloading instructions. For a complete up-to-date list of + MySQL download mirror sites, see + http://dev.mysql.com/downloads/mirrors.html. You can also + find information there about becoming a MySQL mirror site and + how to report a bad or out-of-date mirror. For RPM-based Linux platforms that use Yum as their package management system, MySQL can be installed using the MySQL Yum - repository (http://dev.mysql.com/downloads/repo/). See Section - 2.5.1, "Installing MySQL on Linux Using the MySQL Yum Repository" - for details. + Repository (http://dev.mysql.com/downloads/repo/yum/). See + Section 2.5.1, "Installing MySQL on Linux Using the MySQL Yum + Repository" for details. + + For a number of Debian-based Linux platforms, MySQL can be + installed using the MySQL APT Repository + (http://dev.mysql.com/downloads/repo/apt/). See Section + 2.5.3, "Installing MySQL on Linux Using the MySQL APT + Repository" for details. + + For SUSE Linux Enterprise Server (SLES) platforms, MySQL can + be installed using the MySQL SLES Repository + (http://dev.mysql.com/downloads/repo/suse/). See Section + 2.5.4, "Installing MySQL on Linux Using the MySQL SLES + Repository" for details. To obtain the latest development source, see Section 2.9.3, "Installing MySQL Using a Development Source Tree." -2.1.4. Verifying Package Integrity Using MD5 Checksums or GnuPG +2.1.4 Verifying Package Integrity Using MD5 Checksums or GnuPG - After you have downloaded the MySQL package that suits your needs - and before you attempt to install it, you should make sure that it - is intact and has not been tampered with. There are three means of - integrity checking: + After you have downloaded the MySQL package that suits your + needs and before you attempt to install it, you should make + sure that it is intact and has not been tampered with. There + are three means of integrity checking: * MD5 checksums - * Cryptographic signatures using GnuPG, the GNU Privacy Guard + * Cryptographic signatures using GnuPG, the GNU Privacy + Guard * For RPM packages, the built-in RPM integrity verification mechanism @@ -489,72 +304,74 @@ Production Releases The following sections describe how to use these methods. If you notice that the MD5 checksum or GPG signatures do not - match, first try to download the respective package one more time, - perhaps from another mirror site. - -2.1.4.1. Verifying the MD5 Checksum - - After you have downloaded a MySQL package, you should make sure - that its MD5 checksum matches the one provided on the MySQL - download pages. Each package has an individual checksum that you - can verify against the package that you downloaded. The correct - MD5 checksum is listed on the downloads page for each MySQL - product, and you will compare it against the MD5 checksum of the - file (product) that you download. - - Each operating system and setup offers its own version of tools - for checking the MD5 checksum. Typically the command is named - md5sum, or it may be named md5, and some operating systems do not - ship it at all. On Linux, it is part of the GNU Text Utilities - package, which is available for a wide range of platforms. You can - also download the source code from - http://www.gnu.org/software/textutils/. If you have OpenSSL - installed, you can use the command openssl md5 package_name - instead. A Windows implementation of the md5 command line utility - is available from http://www.fourmilab.ch/md5/. winMd5Sum is a - graphical MD5 checking tool that can be obtained from - http://www.nullriver.com/index/products/winmd5sum. Our Microsoft - Windows examples will assume the name md5.exe. + match, first try to download the respective package one more + time, perhaps from another mirror site. + +2.1.4.1 Verifying the MD5 Checksum + + After you have downloaded a MySQL package, you should make + sure that its MD5 checksum matches the one provided on the + MySQL download pages. Each package has an individual checksum + that you can verify against the package that you downloaded. + The correct MD5 checksum is listed on the downloads page for + each MySQL product, and you will compare it against the MD5 + checksum of the file (product) that you download. + + Each operating system and setup offers its own version of + tools for checking the MD5 checksum. Typically the command is + named md5sum, or it may be named md5, and some operating + systems do not ship it at all. On Linux, it is part of the + GNU Text Utilities package, which is available for a wide + range of platforms. You can also download the source code + from http://www.gnu.org/software/textutils/. If you have + OpenSSL installed, you can use the command openssl md5 + package_name instead. A Windows implementation of the md5 + command line utility is available from + http://www.fourmilab.ch/md5/. winMd5Sum is a graphical MD5 + checking tool that can be obtained from + http://www.nullriver.com/index/products/winmd5sum. Our + Microsoft Windows examples will assume the name md5.exe. Linux and Microsoft Windows examples: -shell> md5sum mysql-standard-5.6.17-linux-i686.tar.gz -aaab65abbec64d5e907dcd41b8699945 mysql-standard-5.6.17-linux-i686.ta -r.gz -shell> md5.exe mysql-installer-community-5.6.17.msi -aaab65abbec64d5e907dcd41b8699945 mysql-installer-community-5.6.17.ms -i +shell> md5sum mysql-standard-5.6.23-linux-i686.tar.gz +aaab65abbec64d5e907dcd41b8699945 mysql-standard-5.6.23-linux-i686.tar +.gz + +shell> md5.exe mysql-installer-community-5.6.23.msi +aaab65abbec64d5e907dcd41b8699945 mysql-installer-community-5.6.23.msi You should verify that the resulting checksum (the string of - hexadecimal digits) matches the one displayed on the download page - immediately below the respective package. + hexadecimal digits) matches the one displayed on the download + page immediately below the respective package. Note - Make sure to verify the checksum of the archive file (for example, - the .zip, .tar.gz, or .msi file) and not of the files that are - contained inside of the archive. In other words, verify the file - before extracting its contents. + Make sure to verify the checksum of the archive file (for + example, the .zip, .tar.gz, or .msi file) and not of the + files that are contained inside of the archive. In other + words, verify the file before extracting its contents. -2.1.4.2. Signature Checking Using GnuPG +2.1.4.2 Signature Checking Using GnuPG - Another method of verifying the integrity and authenticity of a - package is to use cryptographic signatures. This is more reliable - than using MD5 checksums, but requires more work. + Another method of verifying the integrity and authenticity of + a package is to use cryptographic signatures. This is more + reliable than using MD5 checksums, but requires more work. We sign MySQL downloadable packages with GnuPG (GNU Privacy Guard). GnuPG is an Open Source alternative to the well-known Pretty Good Privacy (PGP) by Phil Zimmermann. See - http://www.gnupg.org/ for more information about GnuPG and how to - obtain and install it on your system. Most Linux distributions - ship with GnuPG installed by default. For more information about - GnuPG, see http://www.openpgp.org/. - - To verify the signature for a specific package, you first need to - obtain a copy of our public GPG build key, which you can download - from http://pgp.mit.edu/. The key that you want to obtain is named - mysql-build@oss.oracle.com. Alternatively, you can cut and paste - the key directly from the following text: + http://www.gnupg.org/ for more information about GnuPG and + how to obtain and install it on your system. Most Linux + distributions ship with GnuPG installed by default. For more + information about GnuPG, see http://www.openpgp.org/. + + To verify the signature for a specific package, you first + need to obtain a copy of our public GPG build key, which you + can download from http://pgp.mit.edu/. The key that you want + to obtain is named mysql-build@oss.oracle.com. Alternatively, + you can cut and paste the key directly from the following + text: -----BEGIN PGP PUBLIC KEY BLOCK----- -Version: PGP Universal 2.9.1 (Build 347) +Version: GnuPG v1.4.9 (SunOS) mQGiBD4+owwRBAC14GIfUfCyEDSIePvEW3SAFUdJBtoQHH/nJKZyQT7h9bPlUWC3 RODjQReyCITRrdwyrKUGku2FmeVGwn2u2WmDMNABLnpprWPkBdCk96+OmSLN9brZ @@ -565,34 +382,95 @@ K2HtkrPbP72vwsEKMYhhr0eKCbtLGfls9krjJ6sBgACyP/Vb7hiPwxh6rDZ7ITnE kYpXBACmWpP8NJTkamEnPCia2ZoOHODANwpUkP43I7jsDmgtobZX9qnrAXw+uNDI QJEXM6FSbi0LLtZciNlYsafwAPEOMDKpMqAK6IyisNtPvaLd8lH0bPAnWqcyefep rv0sxxqUEMcM3o7wwgfN83POkDasDbs3pjwPhxvhz6//62zQJ7Q2TXlTUUwgUmVs -ZWFzZSBFbmdpbmVlcmluZyA8bXlzcWwtYnVpbGRAb3NzLm9yYWNsZS5jb20+iGYE -ExECACYCGyMGCwkIBwMCBBUCCAMEFgIDAQIeAQIXgAUCTnc+KgUJE/sCFQAKCRCM -cY07UHLh9SbMAJ4l1+qBz2BZNSGCZwwA6YbhGPC7FwCgp8z5TzIw4YQuL5NGJ/sy -0oSazqmJASIEEAECAAwFAk53QS4FAwASdQAACgkQlxC4m8pXrXwJ8Qf/be/UO9mq -foc2sMyhwMpN4/fdBWwfLkA12FXQDOQMvwH9HsmEjnfUgYKXschZRi+DuHXe1P7l -8G2aQLubhBsQf9ejKvRFTzuWMQkdIq+6Koulxv6ofkCcv3d1xtO2W7nb5yxcpVBP -rRfGFGebJvZa58DymCNgyGtAU6AOz4veavNmI2+GIDQsY66+tYDvZ+CxwzdYu+HD -V9HmrJfc6deM0mnBn7SRjqzxJPgoTQhihTav6q/R5/2p5NvQ/H84OgS6GjosfGc2 -duUDzCP/kheMRKfzuyKCOHQPtJuIj8++gfpHtEU7IDUX1So3c9n0PdpeBvclsDbp -RnCNxQWU4mBot7kCDQQ+PqMdEAgA7+GJfxbMdY4wslPnjH9rF4N2qfWsEN/lxaZo -JYc3a6M02WCnHl6ahT2/tBK2w1QI4YFteR47gCvtgb6O1JHffOo2HfLmRDRiRjd1 -DTCHqeyX7CHhcghj/dNRlW2Z0l5QFEcmV9U0Vhp3aFfWC4Ujfs3LU+hkAWzE7zaD -5cH9J7yv/6xuZVw411x0h4UqsTcWMu0iM1BzELqX1DY7LwoPEb/O9Rkbf4fmLe11 -EzIaCa4PqARXQZc4dhSinMt6K3X4BrRsKTfozBu74F47D8Ilbf5vSYHbuE5p/1oI -Dznkg/p8kW+3FxuWrycciqFTcNz215yyX39LXFnlLzKUb/F5GwADBQf+Lwqqa8CG -rRfsOAJxim63CHfty5mUc5rUSnTslGYEIOCR1BeQauyPZbPDsDD9MZ1ZaSafanFv -wFG6Llx9xkU7tzq+vKLoWkm4u5xf3vn55VjnSd1aQ9eQnUcXiL4cnBGoTbOWI39E -cyzgslzBdC++MPjcQTcA7p6JUVsP6oAB3FQWg54tuUo0Ec8bsM8b3Ev42LmuQT5N -dKHGwHsXTPtl0klk4bQk4OajHsiy1BMahpT27jWjJlMiJc+IWJ0mghkKHt926s/y -mfdf5HkdQ1cyvsz5tryVI3Fx78XeSYfQvuuwqp2H139pXGEkg0n6KdUOetdZWhe7 -0YGNPw1yjWJT1IhUBBgRAgAMBQJOdz3tBQkT+wG4ABIHZUdQRwABAQkQjHGNO1By -4fUUmwCbBYr2+bBEn/L2BOcnw9Z/QFWuhRMAoKVgCFm5fadQ3Afi+UQlAcOphrnJ -=Eto8 +ZWFzZSBFbmdpbmVlcmluZyA8bXlzcWwtYnVpbGRAb3NzLm9yYWNsZS5jb20+iGkE +ExECACkCGyMGCwkIBwMCBBUCCAMEFgIDAQIeAQIXgAIZAQUCUwHUZgUJGmbLywAK +CRCMcY07UHLh9V+DAKCjS1gGwgVI/eut+5L+l2v3ybl+ZgCcD7ZoA341HtoroV3U +6xRD09fUgeq0O015U1FMIFBhY2thZ2Ugc2lnbmluZyBrZXkgKHd3dy5teXNxbC5j +b20pIDxidWlsZEBteXNxbC5jb20+iG8EMBECAC8FAk53Pa0oHSBidWlsZEBteXNx +bC5jb20gd2lsbCBzdG9wIHdvcmtpbmcgc29vbgAKCRCMcY07UHLh9bU9AJ9xDK0o +xJFL9vTl9OSZC4lX0K9AzwCcCrS9cnJyz79eaRjL0s2r/CcljdyIZQQTEQIAHQUC +R6yUtAUJDTBYqAULBwoDBAMVAwIDFgIBAheAABIJEIxxjTtQcuH1B2VHUEcAAQGu +kgCffz4GUEjzXkOi71VcwgCxASTgbe0An34LPr1j9fCbrXWXO14msIADfb5piEwE +ExECAAwFAj4+o9EFgwlmALsACgkQSVDhKrJykfIk4QCfWbEeKN+3TRspe+5xKj+k +QJSammIAnjUz0xFWPlVx0f8o38qNG1bq0cU9iEwEExECAAwFAj5CggMFgwliIokA +CgkQtvXNTca6JD+WkQCgiGmnoGjMojynp5ppvMXkyUkfnykAoK79E6h8rwkSDZou +iz7nMRisH8uyiEYEEBECAAYFAj+s468ACgkQr8UjSHiDdA/2lgCg21IhIMMABTYd +p/IBiUsP/JQLiEoAnRzMywEtujQz/E9ono7H1DkebDa4iEYEEBECAAYFAj+0Q3cA +CgkQhZavqzBzTmbGwwCdFqD1frViC7WRt8GKoOS7hzNN32kAnirlbwpnT7a6NOsQ +83nk11a2dePhiEYEEBECAAYFAkNbs+oACgkQi9gubzC5S1x/dACdELKoXQKkwJN0 +gZztsM7kjsIgyFMAnRRMbHQ7V39XC90OIpaPjk3a01tgiEYEExECAAYFAkTxMyYA +CgkQ9knE9GCTUwwKcQCgibak/SwhxWH1ijRhgYCo5GtM4vcAnAhtzL57wcw1Kg1X +m7nVGetUqJ7fiEwEEBECAAwFAkGBywEFgwYi2YsACgkQGFnQH2d7oexCjQCcD8sJ +NDc/mS8m8OGDUOx9VMWcnGkAnj1YWOD+Qhxo3mI/Ul9oEAhNkjcfiEwEEBECAAwF +AkGByzQFgwYi2VgACgkQgcL36+ITtpIiIwCdFVNVUB8xe8mFXoPm4d9Z54PTjpMA +niSPA/ZsfJ3oOMLKar4F0QPPrdrGiEwEEBECAAwFAkGBy2IFgwYi2SoACgkQa3Ds +2V3D9HMJqgCbBYzr5GPXOXgP88jKzmdbjweqXeEAnRss4G2G/3qD7uhTL1SPT1SH +jWUXiEwEEBECAAwFAkHQkyQFgwXUEWgACgkQfSXKCsEpp8JiVQCghvWvkPqowsw8 +w7WSseTcw1tflvkAni+vLHl/DqIly0LkZYn5jzK1dpvfiEwEEBECAAwFAkIrW7oF +gwV5SNIACgkQ5hukiRXruavzEwCgkzL5QkLSypcw9LGHcFSx1ya0VL4An35nXkum +g6cCJ1NP8r2I4NcZWIrqiEwEEhECAAwFAkAqWToFgwd6S1IACgkQPKEfNJT6+GEm +XACcD+A53A5OGM7w750W11ukq4iZ9ckAnRMvndAqn3YTOxxlLPj2UPZiSgSqiEwE +EhECAAwFAkA9+roFgwdmqdIACgkQ8tdcY+OcZZyy3wCgtDcwlaq20w0cNuXFLLNe +EUaFFTwAni6RHN80moSVAdDTRkzZacJU3M5QiEwEEhECAAwFAkEOCoQFgwaWmggA +CgkQOcor9D1qil/83QCeITZ9wIo7XAMjC6y4ZWUL4m+edZsAoMOhRIRi42fmrNFu +vNZbnMGej81viEwEEhECAAwFAkKApTQFgwUj/1gACgkQBA3AhXyDn6jjJACcD1A4 +UtXk84J13JQyoH9+dy24714Aniwlsso/9ndICJOkqs2j5dlHFq6oiEwEExECAAwF +Aj5NTYQFgwlXVwgACgkQLbt2v63UyTMFDACglT5G5NVKf5Mj65bFSlPzb92zk2QA +n1uc2h19/IwwrsbIyK/9POJ+JMP7iEwEExECAAwFAkHXgHYFgwXNJBYACgkQZu/b +yM2C/T4/vACfXe67xiSHB80wkmFZ2krb+oz/gBAAnjR2ucpbaonkQQgnC3GnBqmC +vNaJiEwEExECAAwFAkIYgQ4FgwWMI34ACgkQdsEDHKIxbqGg7gCfQi2HcrHn+yLF +uNlH1oSOh48ZM0oAn3hKV0uIRJphonHaUYiUP1ttWgdBiGUEExECAB0FCwcKAwQD +FQMCAxYCAQIXgAUCS3AvygUJEPPzpwASB2VHUEcAAQEJEIxxjTtQcuH1sNsAniYp +YBGqy/HhMnw3WE8kXahOOR5KAJ4xUmWPGYP4l3hKxyNK9OAUbpDVYIh7BDARAgA7 +BQJCdzX1NB0AT29wcy4uLiBzaG91bGQgaGF2ZSBiZWVuIGxvY2FsISBJJ20gKnNv +KiBzdHVwaWQuLi4ACgkQOcor9D1qil/vRwCdFo08f66oKLiuEAqzlf9iDlPozEEA +n2EgvCYLCCHjfGosrkrU3WK5NFVgiI8EMBECAE8FAkVvAL9IHQBTaG91bGQgaGF2 +ZSBiZWVuIGEgbG9jYWwgc2lnbmF0dXJlLCBvciBzb21ldGhpbmcgLSBXVEYgd2Fz +IEkgdGhpbmtpbmc/AAoJEDnKK/Q9aopfoPsAn3BVqKOalJeF0xPSvLR90PsRlnmG +AJ44oisY7Tl3NJbPgZal8W32fbqgbIkCIgQQAQIADAUCQYHLhQWDBiLZBwAKCRCq +4+bOZqFEaKgvEACCErnaHGyUYa0wETjj6DLEXsqeOiXad4i9aBQxnD35GUgcFofC +/nCY4XcnCMMEnmdQ9ofUuU3OBJ6BNJIbEusAabgLooebP/3KEaiCIiyhHYU5jarp +ZAh+Zopgs3Oc11mQ1tIaS69iJxrGTLodkAsAJAeEUwTPq9fHFFzC1eGBysoyFWg4 +bIjz/zClI+qyTbFA5g6tRoiXTo8ko7QhY2AA5UGEg+83Hdb6akC04Z2QRErxKAqr +phHzj8XpjVOsQAdAi/qVKQeNKROlJ+iq6+YesmcWGfzeb87dGNweVFDJIGA0qY27 +pTb2lExYjsRFN4Cb13NfodAbMTOxcAWZ7jAPCxAPlHUG++mHMrhQXEToZnBFE4nb +nC7vOBNgWdjUgXcpkUCkop4b17BFpR+k8ZtYLSS8p2LLz4uAeCcSm2/msJxT7rC/ +FvoH8428oHincqs2ICo9zO/Ud4HmmO0O+SsZdVKIIjinGyOVWb4OOzkAlnnhEZ3o +6hAHcREIsBgPwEYVTj/9ZdC0AO44Nj9cU7awaqgtrnwwfr/o4V2gl8bLSkltZU27 +/29HeuOeFGjlFe0YrDd/aRNsxbyb2O28H4sG1CVZmC5uK1iQBDiSyA7Q0bbdofCW +oQzm5twlpKWnY8Oe0ub9XP5p/sVfck4FceWFHwv+/PC9RzSl33lQ6vM2wIkCIgQT +AQIADAUCQp8KHAWDBQWacAAKCRDYwgoJWiRXzyE+D/9uc7z6fIsalfOYoLN60ajA +bQbI/uRKBFugyZ5RoaItusn9Z2rAtn61WrFhu4uCSJtFN1ny2RERg40f56pTghKr +D+YEt+Nze6+FKQ5AbGIdFsR/2bUk+ZZRSt83e14Lcb6ii/fJfzkoIox9ltkifQxq +Y7Tvk4noKu4oLSc8O1Wsfc/y0B9sYUUCmUfcnq58DEmGie9ovUslmyt5NPnveXxp +5UeaRc5Rqt9tK2B4A+7/cqENrdZJbAMSunt2+2fkYiRunAFPKPBdJBsY1sxeL/A9 +aKe0viKEXQdAWqdNZKNCi8rd/oOP99/9lMbFudAbX6nL2DSb1OG2Z7NWEqgIAzjm +pwYYPCKeVz5Q8R+if9/fe5+STY/55OaI33fJ2H3v+U435VjYqbrerWe36xJItcJe +qUzW71fQtXi1CTEl3w2ch7VF5oj/QyjabLnAlHgSlkSi6p7By5C2MnbCHlCfPnIi +nPhFoRcRGPjJe9nFwGs+QblvS/Chzc2WX3s/2SWm4gEUKRX4zsAJ5ocyfa/vkxCk +SxK/erWlCPf/J1T70+i5waXDN/E3enSet/WL7h94pQKpjz8OdGL4JSBHuAVGA+a+ +dknqnPF0KMKLhjrgV+L7O84FhbmAP7PXm3xmiMPriXf+el5fZZequQoIagf8rdRH +HhRJxQgI0HNknkaOqs8dtrkCDQQ+PqMdEAgA7+GJfxbMdY4wslPnjH9rF4N2qfWs +EN/lxaZoJYc3a6M02WCnHl6ahT2/tBK2w1QI4YFteR47gCvtgb6O1JHffOo2HfLm +RDRiRjd1DTCHqeyX7CHhcghj/dNRlW2Z0l5QFEcmV9U0Vhp3aFfWC4Ujfs3LU+hk +AWzE7zaD5cH9J7yv/6xuZVw411x0h4UqsTcWMu0iM1BzELqX1DY7LwoPEb/O9Rkb +f4fmLe11EzIaCa4PqARXQZc4dhSinMt6K3X4BrRsKTfozBu74F47D8Ilbf5vSYHb +uE5p/1oIDznkg/p8kW+3FxuWrycciqFTcNz215yyX39LXFnlLzKUb/F5GwADBQf+ +Lwqqa8CGrRfsOAJxim63CHfty5mUc5rUSnTslGYEIOCR1BeQauyPZbPDsDD9MZ1Z +aSafanFvwFG6Llx9xkU7tzq+vKLoWkm4u5xf3vn55VjnSd1aQ9eQnUcXiL4cnBGo +TbOWI39EcyzgslzBdC++MPjcQTcA7p6JUVsP6oAB3FQWg54tuUo0Ec8bsM8b3Ev4 +2LmuQT5NdKHGwHsXTPtl0klk4bQk4OajHsiy1BMahpT27jWjJlMiJc+IWJ0mghkK +Ht926s/ymfdf5HkdQ1cyvsz5tryVI3Fx78XeSYfQvuuwqp2H139pXGEkg0n6KdUO +etdZWhe70YGNPw1yjWJT1IhUBBgRAgAMBQJOdz3tBQkT+wG4ABIHZUdQRwABAQkQ +jHGNO1By4fUUmwCbBYr2+bBEn/L2BOcnw9Z/QFWuhRMAoKVgCFm5fadQ3Afi+UQl +AcOphrnJ +=443I -----END PGP PUBLIC KEY BLOCK----- - To import the build key into your personal public GPG keyring, use - gpg --import. For example, if you have saved the key in a file - named mysql_pubkey.asc, the import command looks like this: + To import the build key into your personal public GPG + keyring, use gpg --import. For example, if you have saved the + key in a file named mysql_pubkey.asc, the import command + looks like this: shell> gpg --import mysql_pubkey.asc gpg: key 5072E1F5: public key "MySQL Release Engineering " imported @@ -600,15 +478,15 @@ gpg: Total number processed: 1 gpg: imported: 1 gpg: no ultimately trusted keys found - You can also download the key from the public keyserver using the - public key id, 5072E1F5: + You can also download the key from the public keyserver using + the public key id, 5072E1F5: shell> gpg --recv-keys 5072E1F5 gpg: requesting key 5072E1F5 from hkp server keys.gnupg.net -gpg: key 5072E1F5: "MySQL Release Engineering " +gpg: key 5072E1F5: "MySQL Release Engineering " 1 new user ID -gpg: key 5072E1F5: "MySQL Release Engineering " +gpg: key 5072E1F5: "MySQL Release Engineering " 53 new signatures gpg: no ultimately trusted keys found gpg: Total number processed: 1 @@ -616,214 +494,220 @@ gpg: new user IDs: 1 gpg: new signatures: 53 If you want to import the key into your RPM configuration to - validate RPM install packages, you should be able to import the - key directly: + validate RPM install packages, you should be able to import + the key directly: shell> rpm --import mysql_pubkey.asc - If you experience problems or require RPM specific information, - see Section 2.1.4.4, "Signature Checking Using RPM." + If you experience problems or require RPM specific + information, see Section 2.1.4.4, "Signature Checking Using + RPM." After you have downloaded and imported the public build key, download your desired MySQL package and the corresponding - signature, which also is available from the download page. The - signature file has the same name as the distribution file with an - .asc extension, as shown by the examples in the following table. + signature, which also is available from the download page. + The signature file has the same name as the distribution file + with an .asc extension, as shown by the examples in the + following table. - Table 2.1. MySQL Package and Signature Files for Source files + Table 2.1 MySQL Package and Signature Files for Source files File Type File Name - Distribution file mysql-standard-5.6.17-linux-i686.tar.gz - Signature file mysql-standard-5.6.17-linux-i686.tar.gz.asc + Distribution file mysql-standard-5.6.23-linux-i686.tar.gz + Signature file mysql-standard-5.6.23-linux-i686.tar.gz.asc - Make sure that both files are stored in the same directory and - then run the following command to verify the signature for the - distribution file: + Make sure that both files are stored in the same directory + and then run the following command to verify the signature + for the distribution file: shell> gpg --verify package_name.asc If the downloaded package is valid, you will see a "Good signature" similar to: -shell> gpg --verify mysql-standard-5.6.17-linux-i686.tar.gz.asc -gpg: Signature made Tue 01 Feb 2011 02:38:30 AM CST using DSA key ID -5072E1F5 -gpg: Good signature from "MySQL Release Engineering " - - The Good signature message indicates that the file signature is - valid, when compared to the signature listed on our site. But you - might also see warnings, like so: -shell> gpg --verify mysql-standard-5.6.17-linux-i686.tar.gz.asc -gpg: Signature made Wed 23 Jan 2013 02:25:45 AM PST using DSA key ID -5072E1F5 +shell> gpg --verify mysql-standard-5.6.23-linux-i686.tar.gz.asc +gpg: Signature made Tue 01 Feb 2011 02:38:30 AM CST using DSA key ID 5 +072E1F5 +gpg: Good signature from "MySQL Release Engineering " + + The Good signature message indicates that the file signature + is valid, when compared to the signature listed on our site. + But you might also see warnings, like so: +shell> gpg --verify mysql-standard-5.6.23-linux-i686.tar.gz.asc +gpg: Signature made Wed 23 Jan 2013 02:25:45 AM PST using DSA key ID 5 +072E1F5 gpg: checking the trustdb gpg: no ultimately trusted keys found -gpg: Good signature from "MySQL Release Engineering " +gpg: Good signature from "MySQL Release Engineering " gpg: WARNING: This key is not certified with a trusted signature! -gpg: There is no indication that the signature belongs to th -e owner. -Primary key fingerprint: A4A9 4068 76FC BD3C 4567 70C8 8C71 8D3B 507 -2 E1F5 - - That is normal, as they depend on your setup and configuration. - Here are explanations for these warnings: - - * gpg: no ultimately trusted keys found: This means that the - specific key is not "ultimately trusted" by you or your web of - trust, which is okay for the purposes of verifying file - signatures. - - * WARNING: This key is not certified with a trusted signature! - There is no indication that the signature belongs to the - owner.: This refers to your level of trust in your belief that - you possess our real public key. This is a personal decision. - Ideally, a MySQL developer would hand you the key in person, - but more commonly, you downloaded it. Was the download - tampered with? Probably not, but this decision is up to you. - Setting up a web of trust is one method for trusting them. - - See the GPG documentation for more information on how to work with - public keys. - -2.1.4.3. Signature Checking Using Gpg4win for Windows +gpg: There is no indication that the signature belongs to the + owner. +Primary key fingerprint: A4A9 4068 76FC BD3C 4567 70C8 8C71 8D3B 5072 + E1F5 + + That is normal, as they depend on your setup and + configuration. Here are explanations for these warnings: + + * gpg: no ultimately trusted keys found: This means that + the specific key is not "ultimately trusted" by you or + your web of trust, which is okay for the purposes of + verifying file signatures. + + * WARNING: This key is not certified with a trusted + signature! There is no indication that the signature + belongs to the owner.: This refers to your level of trust + in your belief that you possess our real public key. This + is a personal decision. Ideally, a MySQL developer would + hand you the key in person, but more commonly, you + downloaded it. Was the download tampered with? Probably + not, but this decision is up to you. Setting up a web of + trust is one method for trusting them. + + See the GPG documentation for more information on how to work + with public keys. + +2.1.4.3 Signature Checking Using Gpg4win for Windows The Section 2.1.4.2, "Signature Checking Using GnuPG" section - describes how to verify MySQL downloads using GPG. That guide also - applies to Microsoft Windows, but another option is to use a GUI - tool like Gpg4win (http://www.gpg4win.org/). You may use a - different tool but our examples are based on Gpg4win, and utilize - its bundled Kleopatra GUI. + describes how to verify MySQL downloads using GPG. That guide + also applies to Microsoft Windows, but another option is to + use a GUI tool like Gpg4win (http://www.gpg4win.org/). You + may use a different tool but our examples are based on + Gpg4win, and utilize its bundled Kleopatra GUI. - Download and install Gpg4win, and then load Kleopatra. The dialog - should look similar to: + Download and install Gpg4win, and then load Kleopatra. The + dialog should look similar to: - Figure 2.1. Initial screen after loading Kleopatra + Figure 2.1 Initial screen after loading Kleopatra Initial screen after loading Kleopatra - Next, add the MySQL Release Engineering certificate. Do this by - clicking File, Lookup Certificates on Server. Type "Mysql Release - Engineering" into the search box and press Search. + Next, add the MySQL Release Engineering certificate. Do this + by clicking File, Lookup Certificates on Server. Type "Mysql + Release Engineering" into the search box and press Search. - Figure 2.2. Finding the MySQL Release Engineering certificate + Figure 2.2 Finding the MySQL Release Engineering certificate Finding the MySQL Release Engineering certificate Select the "MySQL Release Engineering" certificate. The - Fingerprint and Key-ID must be "5072E1F5", or choose Details... to - confirm the certificate is valid. Now, import it by clicking - Import. An import dialog will be displayed, choose Okay, and this - certificate will now be listed under the Imported Certificates - tab. - - Next, configure the trust level for our certificate. Select our - certificate, then from the main menu select Certificates, Change - Owner Trust.... We suggest choosing I believe checks are very - accurate for our certificate, as otherwise you might not be able - to verify our signature. Select I believe checks are very accurate - and then press OK. - - Figure 2.3. Changing the Trust level + Fingerprint and Key-ID must be "5072E1F5", or choose + Details... to confirm the certificate is valid. Now, import + it by clicking Import. An import dialog will be displayed, + choose Okay, and this certificate will now be listed under + the Imported Certificates tab. + + Next, configure the trust level for our certificate. Select + our certificate, then from the main menu select Certificates, + Change Owner Trust.... We suggest choosing I believe checks + are very accurate for our certificate, as otherwise you might + not be able to verify our signature. Select I believe checks + are very accurate and then press OK. + + Figure 2.3 Changing the Trust level Changing the Trust level Next, verify the downloaded MySQL package file. This requires - files for both the packaged file, and the signature. The signature - file must have the same name as the packaged file but with an - appended .asc extension, as shown by the example in the following - table. The signature is linked to on the downloads page for each - MySQL product. You must create the .asc file with this signature. - - Table 2.2. MySQL Package and Signature Files for MySQL Installer - for Microsoft Windows + files for both the packaged file, and the signature. The + signature file must have the same name as the packaged file + but with an appended .asc extension, as shown by the example + in the following table. The signature is linked to on the + downloads page for each MySQL product. You must create the + .asc file with this signature. + + Table 2.2 MySQL Package and Signature Files for MySQL + Installer for Microsoft Windows File Type File Name - Distribution file mysql-installer-community-5.6.17.msi - Signature file mysql-installer-community-5.6.17.msi.asc + Distribution file mysql-installer-community-5.6.23.msi + Signature file mysql-installer-community-5.6.23.msi.asc - Make sure that both files are stored in the same directory and - then run the following command to verify the signature for the - distribution file. Either drag and drop the signature (.asc) file - into Kleopatra, or load the dialog from File, Decrypt/Verify - Files..., and then choose either the .msi or .asc file. + Make sure that both files are stored in the same directory + and then run the following command to verify the signature + for the distribution file. Either drag and drop the signature + (.asc) file into Kleopatra, or load the dialog from File, + Decrypt/Verify Files..., and then choose either the .msi or + .asc file. - Figure 2.4. The Decrypt/Verify Files dialog + Figure 2.4 The Decrypt/Verify Files dialog The Decrypt/Verify Files dialog Click Decrypt/Verify to check the file. The two most common results will look like the following, and although the yellow - warning looks problematic, the following means that the file check - passed with success. You may now run this installer. + warning looks problematic, the following means that the file + check passed with success. You may now run this installer. - Figure 2.5. The Decrypt/Verify Results: Good + Figure 2.5 The Decrypt/Verify Results: Good The Decrypt/Verify Results: Good Seeing a red "The signature is bad" error means the file is invalid. Do not execute the MSI file if you see this error. - Figure 2.6. The Decrypt/Verify Results: Bad + Figure 2.6 The Decrypt/Verify Results: Bad The Decrypt/Verify Results: Bad The Section 2.1.4.2, "Signature Checking Using GnuPG" section - explains why you probably don't see a green Good signature result. + explains why you probably don't see a green Good signature + result. -2.1.4.4. Signature Checking Using RPM +2.1.4.4 Signature Checking Using RPM - For RPM packages, there is no separate signature. RPM packages - have a built-in GPG signature and MD5 checksum. You can verify a - package by running the following command: + For RPM packages, there is no separate signature. RPM + packages have a built-in GPG signature and MD5 checksum. You + can verify a package by running the following command: shell> rpm --checksig package_name.rpm Example: -shell> rpm --checksig MySQL-server-5.6.17-0.glibc23.i386.rpm -MySQL-server-5.6.17-0.glibc23.i386.rpm: md5 gpg OK +shell> rpm --checksig MySQL-server-5.6.23-0.linux_glibc2.5.i386.rpm +MySQL-server-5.6.23-0.linux_glibc2.5.i386.rpm: md5 gpg OK Note If you are using RPM 4.1 and it complains about (GPG) NOT OK - (MISSING KEYS: GPG#5072e1f5), even though you have imported the - MySQL public build key into your own GPG keyring, you need to - import the key into the RPM keyring first. RPM 4.1 no longer uses - your personal GPG keyring (or GPG itself). Rather, RPM maintains a - separate keyring because it is a system-wide application and a - user's GPG public keyring is a user-specific file. To import the - MySQL public key into the RPM keyring, first obtain the key, then - use rpm --import to import the key. For example: + (MISSING KEYS: GPG#5072e1f5), even though you have imported + the MySQL public build key into your own GPG keyring, you + need to import the key into the RPM keyring first. RPM 4.1 no + longer uses your personal GPG keyring (or GPG itself). + Rather, RPM maintains a separate keyring because it is a + system-wide application and a user's GPG public keyring is a + user-specific file. To import the MySQL public key into the + RPM keyring, first obtain the key, then use rpm --import to + import the key. For example: shell> gpg --export -a 5072e1f5 > 5072e1f5.asc shell> rpm --import 5072e1f5.asc - Alternatively, rpm also supports loading the key directly from a - URL, and you can use this manual page: -shell> rpm --import http://dev.mysql.com/doc/refman/5.6/en/checking-g -pg-signature.html + Alternatively, rpm also supports loading the key directly + from a URL, and you can use this manual page: +shell> rpm --import doc/refman/5.6/en/checking-gpg-signature.html - If you need to obtain the MySQL public key, see Section 2.1.4.2, - "Signature Checking Using GnuPG." + If you need to obtain the MySQL public key, see Section + 2.1.4.2, "Signature Checking Using GnuPG." -2.1.5. Installation Layouts +2.1.5 Installation Layouts - The installation layout differs for different installation types - (for example, native packages, binary tarballs, and source - tarballs), which can lead to confusion when managing different - systems or using different installation sources. The individual - layouts are given in the corresponding installation type or - platform chapter, as described following. Note that the layout of - installations from vendors other than Oracle may differ from these - layouts. + The installation layout differs for different installation + types (for example, native packages, binary tarballs, and + source tarballs), which can lead to confusion when managing + different systems or using different installation sources. + The individual layouts are given in the corresponding + installation type or platform chapter, as described + following. Note that the layout of installations from vendors + other than Oracle may differ from these layouts. * Section 2.3.1, "MySQL Installation Layout on Microsoft Windows" * Section 2.9.1, "MySQL Layout for Source Installation" - * Section 2.2, "MySQL Installation Layout for Generic Unix/Linux - Binary Package" + * Section 2.2, "MySQL Installation Layout for Generic + Unix/Linux Binary Package" - * Section 2.5.3, "MySQL Installation Layout for Linux RPM - Packages" + * Section 2.5.5, "MySQL Installation Layout for Linux RPM + Packages from the MySQL Developer Zone" - * Section 2.4.2, "MySQL Installation Layout on Mac OS X" + * Section 2.4.2, "MySQL Installation Layout on OS X" -2.1.6. Compiler-Specific Build Characteristics +2.1.6 Compiler-Specific Build Characteristics In some cases, the compiler used to build MySQL affects the - features available for use. The notes in this section apply for - binary distributions provided by Oracle Corporation or that you - compile yourself from source. + features available for use. The notes in this section apply + for binary distributions provided by Oracle Corporation or + that you compile yourself from source. icc (Intel C++ Compiler) Builds @@ -831,62 +715,79 @@ pg-signature.html * SSL support is not included. -2.2. Installing MySQL on Unix/Linux Using Generic Binaries +2.2 Installing MySQL on Unix/Linux Using Generic Binaries Oracle provides a set of binary distributions of MySQL. These - include binary distributions in the form of compressed tar files - (files with a .tar.gz extension) for a number of platforms, as - well as binaries in platform-specific package formats for selected - platforms. - - This section covers the installation of MySQL from a compressed - tar file binary distribution. For other platform-specific package - formats, see the other platform-specific sections. For example, - for Windows distributions, see Section 2.3, "Installing MySQL on + include binary distributions in the form of compressed tar + files (files with a .tar.gz extension) for a number of + platforms, as well as binaries in platform-specific package + formats for selected platforms. + + This section covers the installation of MySQL from a + compressed tar file binary distribution. For other + platform-specific package formats, see the other + platform-specific sections. For example, for Windows + distributions, see Section 2.3, "Installing MySQL on Microsoft Windows." To obtain MySQL, see Section 2.1.3, "How to Get MySQL." - MySQL compressed tar file binary distributions have names of the - form mysql-VERSION-OS.tar.gz, where VERSION is a number (for - example, 5.6.17), and OS indicates the type of operating system - for which the distribution is intended (for example, pc-linux-i686 - or winx64). + MySQL compressed tar file binary distributions have names of + the form mysql-VERSION-OS.tar.gz, where VERSION is a number + (for example, 5.6.23), and OS indicates the type of operating + system for which the distribution is intended (for example, + pc-linux-i686 or winx64). - To install MySQL from a compressed tar file binary distribution, - your system must have GNU gunzip to uncompress the distribution - and a reasonable tar to unpack it. If your tar program supports - the z option, it can both uncompress and unpack the file. + To install MySQL from a compressed tar file binary + distribution, your system must have GNU gunzip to uncompress + the distribution and a reasonable tar to unpack it. If your + tar program supports the z option, it can both uncompress and + unpack the file. GNU tar is known to work. The standard tar provided with some - operating systems is not able to unpack the long file names in the - MySQL distribution. You should download and install GNU tar, or if - available, use a preinstalled version of GNU tar. Usually this is - available as gnutar, gtar, or as tar within a GNU or Free Software - directory, such as /usr/sfw/bin or /usr/local/bin. GNU tar is - available from http://www.gnu.org/software/tar/. + operating systems is not able to unpack the long file names + in the MySQL distribution. You should download and install + GNU tar, or if available, use a preinstalled version of GNU + tar. Usually this is available as gnutar, gtar, or as tar + within a GNU or Free Software directory, such as /usr/sfw/bin + or /usr/local/bin. GNU tar is available from + http://www.gnu.org/software/tar/. Warning - If you have previously installed MySQL using your operating system - native package management system, such as yum or apt-get, you may - experience problems installing using a native binary. Make sure - your previous MySQL previous installation has been removed - entirely (using your package management system), and that any - additional files, such as old versions of your data files, have - also been removed. You should also check the existence of - configuration files such as /etc/my.cnf or the /etc/mysql - directory have been deleted. - - If you run into problems and need to file a bug report, please use - the instructions in Section 1.7, "How to Report Bugs or Problems." - - On Unix, to install a compressed tar file binary distribution, - unpack it at the installation location you choose (typically - /usr/local/mysql). This creates the directories shown in the - following table. + If you have previously installed MySQL using your operating + system native package management system, such as yum or + apt-get, you may experience problems installing using a + native binary. Make sure your previous MySQL previous + installation has been removed entirely (using your package + management system), and that any additional files, such as + old versions of your data files, have also been removed. You + should also check the existence of configuration files such + as /etc/my.cnf or the /etc/mysql directory have been deleted. + Warning + + MySQL has a dependency on the libaio library. The + mysql_install_db and subsequent mysqld_safe steps will fail + if this library is not installed locally. If necessary, + install it using the appropriate package manager. For + example, on Yum-based systems: +shell> yum search libaio # search for info +shell> yum install libaio # install library + + Or, on APT-based systems: +shell> apt-cache search libaio # search for info +shell> apt-get install libaio1 # install library + + If you run into problems and need to file a bug report, + please use the instructions in Section 1.7, "How to Report + Bugs or Problems." + + On Unix, to install a compressed tar file binary + distribution, unpack it at the installation location you + choose (typically /usr/local/mysql). This creates the + directories shown in the following table. - Table 2.3. MySQL Installation Layout for Generic Unix/Linux Binary - Package + Table 2.3 MySQL Installation Layout for Generic Unix/Linux + Binary Package Directory Contents of Directory bin Client programs and the mysqld server data Log files, databases @@ -899,14 +800,15 @@ pg-signature.html sample configuration files, SQL for database installation sql-bench Benchmarks - Debug versions of the mysqld binary are available as mysqld-debug. - To compile your own debug version of MySQL from a source - distribution, use the appropriate configuration options to enable - debugging support. For more information on compiling from source, - see Section 2.9, "Installing MySQL from Source." + Debug versions of the mysqld binary are available as + mysqld-debug. To compile your own debug version of MySQL from + a source distribution, use the appropriate configuration + options to enable debugging support. For more information on + compiling from source, see Section 2.9, "Installing MySQL + from Source." - To install and use a MySQL binary distribution, the basic command - sequence looks like this: + To install and use a MySQL binary distribution, the basic + command sequence looks like this: shell> groupadd mysql shell> useradd -r -g mysql mysql shell> cd /usr/local @@ -922,53 +824,54 @@ shell> bin/mysqld_safe --user=mysql & # Next command is optional shell> cp support-files/mysql.server /etc/init.d/mysql.server - mysql_install_db creates a default option file named my.cnf in the - base installation directory. This file is created from a template - included in the distribution package named my-default.cnf. For - more information, see Section 5.1.2.2, "Using a Sample Default - Server Configuration File." + mysql_install_db creates a default option file named my.cnf + in the base installation directory. This file is created from + a template included in the distribution package named + my-default.cnf. For more information, see Section 5.1.2.2, + "Using a Sample Default Server Configuration File." A more detailed version of the preceding description for installing a binary distribution follows. Note - This procedure assumes that you have root (administrator) access - to your system. Alternatively, you can prefix each command using - the sudo (Linux) or pfexec (OpenSolaris) command. + This procedure assumes that you have root (administrator) + access to your system. Alternatively, you can prefix each + command using the sudo (Linux) or pfexec (OpenSolaris) + command. - The procedure does not set up any passwords for MySQL accounts. - After following the procedure, proceed to Section 2.10.2, - "Securing the Initial MySQL Accounts." + The procedure does not set up any passwords for MySQL + accounts. After following the procedure, proceed to Section + 2.10.2, "Securing the Initial MySQL Accounts." Create a mysql User and Group - If your system does not already have a user and group for mysqld - to run as, you may need to create one. The following commands add - the mysql group and the mysql user. You might want to call the - user and group something else instead of mysql. If so, substitute - the appropriate name in the following instructions. The syntax for - useradd and groupadd may differ slightly on different versions of - Unix, or they may have different names such as adduser and - addgroup. + If your system does not already have a user and group for + mysqld to run as, you may need to create one. The following + commands add the mysql group and the mysql user. You might + want to call the user and group something else instead of + mysql. If so, substitute the appropriate name in the + following instructions. The syntax for useradd and groupadd + may differ slightly on different versions of Unix, or they + may have different names such as adduser and addgroup. shell> groupadd mysql shell> useradd -r -g mysql mysql Note Because the user is required only for ownership purposes, not - login purposes, the useradd command uses the -r option to create a - user that does not have login permissions to your server host. - Omit this option to permit logins for the user (or if your useradd - does not support the option). + login purposes, the useradd command uses the -r option to + create a user that does not have login permissions to your + server host. Omit this option to permit logins for the user + (or if your useradd does not support the option). Obtain and Unpack the Distribution - Pick the directory under which you want to unpack the distribution - and change location into it. The example here unpacks the - distribution under /usr/local. The instructions, therefore, assume - that you have permission to create files and directories in - /usr/local. If that directory is protected, you must perform the - installation as root. + Pick the directory under which you want to unpack the + distribution and change location into it. The example here + unpacks the distribution under /usr/local. The instructions, + therefore, assume that you have permission to create files + and directories in /usr/local. If that directory is + protected, you must perform the installation as root. shell> cd /usr/local Obtain a distribution file using the instructions in Section @@ -976,611 +879,1021 @@ shell> cd /usr/local distributions for all platforms are built from the same MySQL source distribution. - Unpack the distribution, which creates the installation directory. - Then create a symbolic link to that directory. tar can uncompress - and unpack the distribution if it has z option support: + Unpack the distribution, which creates the installation + directory. Then create a symbolic link to that directory. tar + can uncompress and unpack the distribution if it has z option + support: shell> tar zxvf /path/to/mysql-VERSION-OS.tar.gz shell> ln -s full-path-to-mysql-VERSION-OS mysql - The tar command creates a directory named mysql-VERSION-OS. The ln - command makes a symbolic link to that directory. This enables you - to refer more easily to the installation directory as - /usr/local/mysql. + The tar command creates a directory named mysql-VERSION-OS. + The ln command makes a symbolic link to that directory. This + enables you to refer more easily to the installation + directory as /usr/local/mysql. - If your tar does not have z option support, use gunzip to unpack - the distribution and tar to unpack it. Replace the preceding tar - command with the following alternative command to uncompress and - extract the distribution: + If your tar does not have z option support, use gunzip to + unpack the distribution and tar to unpack it. Replace the + preceding tar command with the following alternative command + to uncompress and extract the distribution: shell> gunzip < /path/to/mysql-VERSION-OS.tar.gz | tar xvf - Perform Postinstallation Setup - The remainder of the installation process involves setting up the - configuration file, creating the core databases, and starting the - MySQL server. For next steps, see Section 2.10, "Postinstallation - Setup and Testing." + The remainder of the installation process involves setting up + the configuration file, creating the core databases, and + starting the MySQL server. For next steps, see Section 2.10, + "Postinstallation Setup and Testing." Note - The accounts that are listed in the MySQL grant tables initially - have no passwords. After starting the server, you should set up - passwords for them using the instructions in Section 2.10.2, - "Securing the Initial MySQL Accounts." + The accounts that are listed in the MySQL grant tables + initially have no passwords. After starting the server, you + should set up passwords for them using the instructions in + Section 2.10.2, "Securing the Initial MySQL Accounts." + +2.3 Installing MySQL on Microsoft Windows + + There are several different methods to install MySQL on + Microsoft Windows. + +Simple Installation Method + + The simplest and recommended method is to download MySQL + Installer (for Windows) and let it install and configure all + of the MySQL products on your system. Here is how: + + * Download MySQL Installer from + http://dev.mysql.com/downloads/installer/ and execute it. + Note + Unlike the standard MySQL Installer, the smaller + "web-community" version does not bundle any MySQL + applications but it will download the MySQL products you + choose to install. + + * Choose the appropriate Setup Type for your system. + Typically you will choose Developer Default to install + MySQL server and other MySQL tools related to MySQL + development, helpful tools like MySQL Workbench. Or, + choose the Custom setup type to manually select your + desired MySQL products. + Note + Multiple versions of MySQL server can exist on a single + system. You can choose one or multiple versions. + + * Complete the installation process by following the MySQL + Installation wizard's instructions. This will install + several MySQL products and start the MySQL server. -2.3. Installing MySQL on Microsoft Windows + * MySQL is now installed. You probably configured MySQL as + a service that will automatically start MySQL server + every time you restart your system. + + Note + + You probably also installed other helpful MySQL products like + MySQL Workbench and MySQL Notifier on your system. Consider + loading Chapter 26, "MySQL Workbench" to check your new MySQL + server connection, and Section 2.3.4, "MySQL Notifier" to + view the connection's status. By default, these two programs + automatically start after installing MySQL. + + This process also installs the MySQL Installer application on + your system, and later you can use MySQL Installer to upgrade + or reconfigure your MySQL products. + +Additional Installation Information MySQL is available for Microsoft Windows, for both 32-bit and - 64-bit versions. For supported Windows platform information, see - http://www.mysql.com/support/supportedplatforms/database.html. + 64-bit versions. For supported Windows platform information, + see + http://www.mysql.com/support/supportedplatforms/database.html + . It is possible to run MySQL as a standard application or as a - Windows service. By using a service, you can monitor and control - the operation of the server through the standard Windows service - management tools. For more information, see Section 2.3.5.7, - "Starting MySQL as a Windows Service." - - Generally, you should install MySQL on Windows using an account - that has administrator rights. Otherwise, you may encounter - problems with certain operations such as editing the PATH - environment variable or accessing the Service Control Manager. - Once installed, MySQL does not need to be executed using a user - with Administrator privileges. + Windows service. By using a service, you can monitor and + control the operation of the server through the standard + Windows service management tools. For more information, see + Section 2.3.5.7, "Starting MySQL as a Windows Service." + + Generally, you should install MySQL on Windows using an + account that has administrator rights. Otherwise, you may + encounter problems with certain operations such as editing + the PATH environment variable or accessing the Service + Control Manager. Once installed, MySQL does not need to be + executed using a user with Administrator privileges. For a list of limitations on the use of MySQL on the Windows - platform, see Section E.10.6, "Windows Platform Limitations." + platform, see Section D.10.6, "Windows Platform Limitations." In addition to the MySQL Server package, you may need or want additional components to use MySQL with your application or - development environment. These include, but are not limited to: - - * To connect to the MySQL server using ODBC, you must have a - Connector/ODBC driver. For more information, including - installation and configuration instructions, see Section 22.1, - "MySQL Connector/ODBC." But note that MySQL Installer will - install and configure Connector/ODBC for you. - - * To use MySQL server with .NET applications, you must have the - Connector/Net driver. For more information, including - installation and configuration instructions, see Section 22.2, - "MySQL Connector/Net." But note that MySQL Installer will - install and configure Connector/NET for you. + development environment. These include, but are not limited + to: + + * To connect to the MySQL server using ODBC, you must have + a Connector/ODBC driver. For more information, including + installation and configuration instructions, see MySQL + Connector/ODBC Developer Guide + (http://dev.mysql.com/doc/connector-odbc/en/index.html). + Note + MySQL Installer will install and configure Connector/ODBC + for you. + + * To use MySQL server with .NET applications, you must have + the Connector/Net driver. For more information, including + installation and configuration instructions, see MySQL + Connector/Net Developer Guide + (http://dev.mysql.com/doc/connector-net/en/index.html). + Note + MySQL Installer will install and configure Connector/NET + for you. MySQL distributions for Windows can be downloaded from - http://dev.mysql.com/downloads/. See Section 2.1.3, "How to Get - MySQL." - - MySQL for Windows is available in several distribution formats, - detailed following. Generally speaking, you should use MySQL - Installer. It is simpler to use than the Zip file, and you need no - additional tools to get MySQL up and running. MySQL Installer - automatically installs MySQL Server and additional MySQL products, - creates an options file, starts the server, and enables you to - create default user accounts. For more information on choosing a - package, see Section 2.3.2, "Choosing An Installation Package." + http://dev.mysql.com/downloads/. See Section 2.1.3, "How to + Get MySQL." + + MySQL for Windows is available in several distribution + formats, detailed below. Generally speaking, you should use + MySQL Installer. It contains more features and MySQL products + than the older MSI, is simpler to use than the ZIP file, and + you need no additional tools to get MySQL up and running. + MySQL Installer automatically installs MySQL Server and + additional MySQL products, creates an options file, starts + the server, and enables you to create default user accounts. + For more information on choosing a package, see Section + 2.3.2, "Choosing An Installation Package." * A MySQL Installer distribution includes MySQL Server and - additional MySQL products including MySQL Workbench, MySQL - Notifier, and MySQL for Excel. MySQL Installer can also be - used to upgrade these products in the future. - For instructions on installing MySQL using MySQL Installer, - see Section 2.3.3, "Installing MySQL on Microsoft Windows - Using MySQL Installer." + additional MySQL products including MySQL Workbench, + MySQL Notifier, and MySQL for Excel. MySQL Installer can + also be used to upgrade these products in the future. + For instructions on installing MySQL using MySQL + Installer, see Section 2.3.3, "Installing MySQL on + Microsoft Windows Using MySQL Installer." * The standard binary distribution (packaged as a Zip file) - contains all of the necessary files that you unpack into your - chosen location. This package contains all of the files in the - full Windows MSI Installer package, but does not include an - installation program. - For instructions on installing MySQL using the Zip file, see - Section 2.3.5, "Installing MySQL on Microsoft Windows Using a - noinstall Zip Archive." + contains all of the necessary files that you unpack into + your chosen location. This package contains all of the + files in the full Windows MSI Installer package, but does + not include an installation program. + For instructions on installing MySQL using the Zip file, + see Section 2.3.5, "Installing MySQL on Microsoft Windows + Using a noinstall Zip Archive." * The source distribution format contains all the code and - support files for building the executables using the Visual - Studio compiler system. - For instructions on building MySQL from source on Windows, see - Section 2.9, "Installing MySQL from Source." + support files for building the executables using the + Visual Studio compiler system. + For instructions on building MySQL from source on + Windows, see Section 2.9, "Installing MySQL from Source." MySQL on Windows considerations: * Large Table Support - If you need tables with a size larger than 4GB, install MySQL - on an NTFS or newer file system. Do not forget to use MAX_ROWS - and AVG_ROW_LENGTH when you create tables. See Section - 13.1.17, "CREATE TABLE Syntax." + If you need tables with a size larger than 4GB, install + MySQL on an NTFS or newer file system. Do not forget to + use MAX_ROWS and AVG_ROW_LENGTH when you create tables. + See Section 13.1.17, "CREATE TABLE Syntax." * MySQL and Virus Checking Software - Virus-scanning software such as Norton/Symantec Anti-Virus on - directories containing MySQL data and temporary tables can - cause issues, both in terms of the performance of MySQL and - the virus-scanning software misidentifying the contents of the - files as containing spam. This is due to the fingerprinting - mechanism used by the virus-scanning software, and the way in - which MySQL rapidly updates different files, which may be - identified as a potential security risk. + Virus-scanning software such as Norton/Symantec + Anti-Virus on directories containing MySQL data and + temporary tables can cause issues, both in terms of the + performance of MySQL and the virus-scanning software + misidentifying the contents of the files as containing + spam. This is due to the fingerprinting mechanism used by + the virus-scanning software, and the way in which MySQL + rapidly updates different files, which may be identified + as a potential security risk. After installing MySQL Server, it is recommended that you - disable virus scanning on the main directory (datadir) used to - store your MySQL table data. There is usually a system built - into the virus scanning software to enable specific - directories to be ignored. - In addition, by default, MySQL creates temporary files in the - standard Windows temporary directory. To prevent the temporary - files also being scanned, configure a separate temporary - directory for MySQL temporary files and add this directory to - the virus scanning exclusion list. To do this, add a - configuration option for the tmpdir parameter to your my.ini - configuration file. For more information, see Section 2.3.5.2, - "Creating an Option File." - -2.3.1. MySQL Installation Layout on Microsoft Windows - - For MySQL 5.6 on Windows, the default installation directory is - C:\Program Files\MySQL\MySQL Server 5.6. Some Windows users prefer - to install in C:\mysql, the directory that formerly was used as - the default. However, the layout of the subdirectories remains the - same. - - All of the files are located within this parent directory, using - the structure shown in the following table. - - Table 2.4. Default MySQL Installation Layout for Microsoft Windows + disable virus scanning on the main directory (datadir) + used to store your MySQL table data. There is usually a + system built into the virus-scanning software to enable + specific directories to be ignored. + In addition, by default, MySQL creates temporary files in + the standard Windows temporary directory. To prevent the + temporary files also being scanned, configure a separate + temporary directory for MySQL temporary files and add + this directory to the virus scanning exclusion list. To + do this, add a configuration option for the tmpdir + parameter to your my.ini configuration file. For more + information, see Section 2.3.5.2, "Creating an Option + File." + +2.3.1 MySQL Installation Layout on Microsoft Windows + + For MySQL 5.6 on Windows, the default installation directory + is C:\Program Files\MySQL\MySQL Server 5.6. Some Windows + users prefer to install in C:\mysql, the directory that + formerly was used as the default. However, the layout of the + subdirectories remains the same. + + All of the files are located within this parent directory, + using the structure shown in the following table. + + Table 2.4 Default MySQL Installation Layout for Microsoft + Windows Directory Contents of Directory Notes bin Client programs and the mysqld server - %ALLUSERSPROFILE%\MySQL\MySQL Server 5.6\ Log files, databases - (Windows XP, Windows Server 2003) The Windows system variable - %ALLUSERSPROFILE% defaults to C:\Documents and Settings\All - Users\Application Data - %PROGRAMDATA%\MySQL\MySQL Server 5.6\ Log files, databases (Vista, - Windows 7, Windows Server 2008, and newer) The Windows system - variable %PROGRAMDATA% defaults to C:\ProgramData + %ALLUSERSPROFILE%\MySQL\MySQL Server 5.6\ Log files, + databases (Windows XP, Windows Server 2003) The Windows + system variable %ALLUSERSPROFILE% defaults to C:\Documents + and Settings\All Users\Application Data + %PROGRAMDATA%\MySQL\MySQL Server 5.6\ Log files, databases + (Vista, Windows 7, Windows Server 2008, and newer) The + Windows system variable %PROGRAMDATA% defaults to + C:\ProgramData examples Example programs and scripts include Include (header) files lib Libraries scripts Utility scripts share Miscellaneous support files, including error messages, - character set files, sample configuration files, SQL for database - installation + character set files, sample configuration files, SQL for + database installation If you install MySQL using the MySQL Installer, this package - creates and sets up the data directory that the installed server - will use, and also creates a pristine "template" data directory - named data under the installation directory. After an installation - has been performed using this package, the template data directory - can be copied to set up additional MySQL instances. See Section - 5.3, "Running Multiple MySQL Instances on One Machine." + creates and sets up the data directory that the installed + server will use, and also creates a pristine "template" data + directory named data under the installation directory. After + an installation has been performed using this package, the + template data directory can be copied to set up additional + MySQL instances. See Section 5.3, "Running Multiple MySQL + Instances on One Machine." -2.3.2. Choosing An Installation Package +2.3.2 Choosing An Installation Package - For MySQL 5.6, there are installation package formats to choose - from when installing MySQL on Windows: + For MySQL 5.6, there are installation package formats to + choose from when installing MySQL on Windows: * MySQL Installer: This package has a file name similar to - mysql-installer-community-5.6.17.0.msi or - mysql-installer-commercial-5.6.17.0.msi, and utilizes MSI's to - automatically install MySQL server and other products. It will - download and apply updates to itself, and for each of the - installed products. It also configures the additional - non-server products. - The installed products are configurable, and this includes: - documentation with samples and examples, connectors (such as - C, C++, J, NET, and ODBC), MySQL Workbench, MySQL Notifier for - Microsoft Windows, MySQL for Excel, and the MySQL Server with - its components. - MySQL Installer will run on all Windows platforms that are - supported by MySQL (see - http://www.mysql.com/support/supportedplatforms/database.html) - . + mysql-installer-community-5.6.23.0.msi or + mysql-installer-commercial-5.6.23.0.msi, and utilizes + MSIs to automatically install MySQL server and other + products. It will download and apply updates to itself, + and for each of the installed products. It also + configures the additional non-server products. + The installed products are configurable, and this + includes: documentation with samples and examples, + connectors (such as C, C++, J, NET, and ODBC), MySQL + Workbench, MySQL Notifier, MySQL for Excel, and the MySQL + Server with its components. + MySQL Installer will run on all Windows platforms that + are supported by MySQL (see + http://www.mysql.com/support/supportedplatforms/database. + html). Note - Because MySQL Installer is not a native component of Microsoft - Windows and depends on .NET, it will not work on minimal - installation options like the "Server Core" version of Windows - Server 2008. - For instructions on installing MySQL using MySQL Installer, - see Section 2.3.3, "Installing MySQL on Microsoft Windows - Using MySQL Installer." - - * The Noinstall Archive: This package has a file name similar to - mysql-5.6.17-win32.zip or mysql-5.6.17-winx64.zip, and - contains all the files found in the Complete install package, - with the exception of the GUI. This package does not include - an automated installer, and must be manually installed and - configured. - - Your choice of install package affects the installation process - you must follow. If you choose to use MySQL Installer, see Section - 2.3.3, "Installing MySQL on Microsoft Windows Using MySQL - Installer." If you choose to install a Noinstall archive, see - Section 2.3.5, "Installing MySQL on Microsoft Windows Using a - noinstall Zip Archive." - -2.3.3. Installing MySQL on Microsoft Windows Using MySQL Installer - - MySQL Installer is an application that simplifies the installation - and updating process for a wide range of MySQL products, including - MySQL Notifier for Microsoft Windows, MySQL Workbench, and MySQL - for Excel. From this central application, you can see which MySQL - products are already installed, configure them, and update or - remove them if necessary. The installer can also install plugins, - documentation, tutorials, and example databases. The MySQL - Installer is only available for Microsoft Windows, and includes - both a GUI and command-line interface. + Because MySQL Installer is not a native component of + Microsoft Windows and depends on .NET, it will not work + on minimal installation options like the "Server Core" + version of Windows Server 2008. + For instructions on installing MySQL using MySQL + Installer, see Section 2.3.3, "Installing MySQL on + Microsoft Windows Using MySQL Installer." + + * The Noinstall Archive: This package has a file name + similar to mysql-5.6.23-win32.zip or + mysql-5.6.23-winx64.zip, and contains all the files found + in the Complete install package, with the exception of + the GUI. This package does not include an automated + installer, and must be manually installed and configured. + + MySQL Installer is recommended for most users. + + Your choice of install package affects the installation + process you must follow. If you choose to use MySQL + Installer, see Section 2.3.3, "Installing MySQL on Microsoft + Windows Using MySQL Installer." If you choose to install a + Noinstall archive, see Section 2.3.5, "Installing MySQL on + Microsoft Windows Using a noinstall Zip Archive." + +2.3.3 Installing MySQL on Microsoft Windows Using MySQL Installer + + MySQL Installer simplifies the installation and updating + process for your MySQL products on Microsoft Windows. From + this central application, you can view, remove, update, and + reconfigure the existing MySQL products on your system. MySQL + Installer can also install plugins, documentation, tutorials, + and example databases. The MySQL Installer is only available + for Microsoft Windows, and includes both GUI and command-line + interfaces. + + The supported products include: + + * MySQL server (http://dev.mysql.com/doc/) (one or multiple + versions) + + * MySQL Workbench + + * MySQL Connectors + (http://dev.mysql.com/doc/index-connectors.html) (.Net / + Python / ODBC / Java / C / C++) + + * MySQL Notifier + + * MySQL for Excel + (http://dev.mysql.com/doc/mysql-for-excel/en/index.html) + + * MySQL for Visual Studio + (http://dev.mysql.com/doc/connector-net/en/connector-net- + visual-studio.html) + + * MySQL Utilities and MySQL Fabric + (http://dev.mysql.com/doc/index-utils-fabric.html) + + * MySQL Samples and Examples + + * MySQL Documentation + + * MySQL Installer is also installed and remains on the + system as its own application Installer package types - * Full: Bundles all of the MySQL products (including MySQL - Server). The file is over 160MB, and have names of the form - mysql-installer-community-VERSION.N.msi where VERSION is the - MySQL Server version number such as 5.6 and N is the package - number, which begins at 0. + * Full: Bundles all of the MySQL products (including the + MySQL server). The file' size is over 200MB, and its name + has the form mysql-installer-community-VERSION.N.msi + where VERSION is the MySQL Server version number such as + 5.6 and N is the package number, which begins at 0. - * Web: Only contains the Installer and configuration files, and - it only downloads the MySQL products you choose to install. - The file is about 2MB, and have names of the form - mysql-installer-community-web-VERSION.N.msi where VERSION is - the MySQL Server version number such as 5.6 and N is the - package number, which begins at 0. + * Web: Only contains the Installer and configuration files, + and it only downloads the MySQL products you choose to + install. The size of this file is about 2MB; the name of + the file has the form + mysql-installer-community-web-VERSION.N.msi where VERSION + is the MySQL Server version number such as 5.6 and N is + the package number, which begins at 0. Installer editions * Community edition: Downloadable at - http://dev.mysql.com/downloads/installer/. It installs the - community edition of all MySQL products. + http://dev.mysql.com/downloads/installer/. It installs + the community edition of all MySQL products. - * Commercial edition: Downloadable at either My Oracle Support - (https://support.oracle.com/) (MOS) or + * Commercial edition: Downloadable at either My Oracle + Support (https://support.oracle.com/) (MOS) or https://edelivery.oracle.com/. It installs the commercial - version of all MySQL products, including Workbench SE. It also - integrates with your MOS account, so enter in your MOS - credentials to automatically receive updates for your - commercial MySQL products. + version of all MySQL products, including Workbench SE/EE. + It also integrates with your MOS account. + Note + Entering your MOS credentials is optional when installing + bundled MySQL products, but your credentials are required + when choosing non-bundled MySQL products that MySQL + Installer must download. - For release notes detailing the changes in each release of MySQL + For notes detailing the changes in each release of MySQL Installer, see MySQL Installer Release Notes (http://dev.mysql.com/doc/relnotes/mysql-installer/en/). - MySQL Installer is compatible with pre-existing installations, and - adds them to its list of installed components. And while the MySQL - Installer is bundled with a specific version of MySQL Server, a - single MySQL Installer instance can install and manage multiple - MySQL Server versions. For example, a single MySQL Installer - instance can install versions 5.1, 5.5, and 5.6. It can also - manage either commercial or community editions of the MySQL - Server. + MySQL Installer is compatible with pre-existing + installations, and adds them to its list of installed + components. While the standard MySQL Installer is bundled + with a specific version of MySQL Server, a single MySQL + Installer instance can install and manage multiple MySQL + Server versions. For example, a single MySQL Installer + instance can install (and update) versions 5.5, 5.6, and 5.7 + on the host. Note - A single host can not have both community and commercial editions - of MySQL Server installed. For example, if you want both MySQL - Server 5.5 and 5.6 installed on a single host, then both must be - the same commercial or community edition. + A single host can not have both community and commercial + editions of MySQL Server installed. For example, if you want + both MySQL Server 5.5 and 5.6 installed on a single host, + then both must be the same edition. - MySQL Installer handles the initial configuration and setup of the - applications. For example: + MySQL Installer handles the initial configuration and set up + of the applications. For example: - 1. It will create MySQL Server connections in MySQL Workbench. + 1. It creates initial MySQL Server connections in MySQL + Workbench. - 2. It creates the configuration file (my.ini) that is used to - configure the MySQL Server. The values written to this file - are influenced by choices you make during the installation - process. + 2. It creates the configuration file (my.ini) that is used + to configure the MySQL Server. The values written to this + file are influenced by choices you make during the + installation process. - 3. It imports example databases. + 3. It can optionally import example databases. - 4. It creates MySQL Server user accounts with configurable - permissions based on general roles, such as DB Administrator, - DB Designer, and Backup Admin. It optionally creates a Windows - user named MysqlSys with limited privileges, which would then - run the MySQL Server. - This feature is only available during the initial installation - of the MySQL Server, and not during future updates. User - accounts may also be added with MySQL Workbench. + 4. It can optionally create MySQL Server user accounts with + configurable permissions based on general roles, such as + DB Administrator, DB Designer, and Backup Admin. It + optionally creates a Windows user named MysqlSys with + limited privileges, which would then run the MySQL + Server. + User accounts may also be added and configured in MySQL + Workbench. - 5. If the "Advanced Configuration" option is checked, then the - Logging Options are also configured. This includes defining - file paths for the error log, general log, slow query log - (including the configuration of seconds it requires to execute - a query), and the binary log. + 5. If the "Advanced Configuration" option is checked, then + the Logging Options are also configured. This includes + defining file paths for the error log, general log, slow + query log (including the configuration of seconds it + requires to execute a query), and the binary log. - MySQL Installer can optionally check for updated components and - download them for you automatically. + MySQL Installer can optionally check for updated components + and download them for you. -2.3.3.1. MySQL Installer GUI +2.3.3.1 MySQL Installer GUI - After installation of the GUI version, the installer will have add - its own Start Menu item under MySQL. + Installing MySQL Installer adds a link to the Start menu + under the MySQL group. Click Start, All Programs MySQL, MySQL + Installer to reload the MySQL Installer GUI. Note - Files that are generated by MySQL Installer grant full permissions - to the user that executes MySQL Installer, including my.ini. This - does not apply to files and directories for specific products such - as the MySQL Server data directory in ProgramData, that is owned - by SYSTEM. + Files that are generated by MySQL Installer grant full + permissions to the user that executes MySQL Installer, + including my.ini. This does not apply to files and + directories for specific products such as the MySQL Server + data directory in %ProgramData% that is owned by SYSTEM. - After the installer itself has been installed and started, the - following screen is displayed: + The initial execution of MySQL Installer requires you to + accept the license agreement before installing MySQL + products. - Figure 2.7. MySQL Installer - Welcome Screen - MySQL Installer - Welcome Screen + Figure 2.7 MySQL Installer - License Agreement + MySQL Installer - License Agreement - There are three main options: +Installing New Packages - 1. Install MySQL Products - The Installation Wizard. + Choose the appropriate Setup Type for your system. The + selected type determines which MySQL products are installed + on your system, or select Custom to manually choose + individual products. - 2. About MySQL - Learn about MySQL products and features. + * Developer: Install all products needed to develop + applications with MySQL. This is the default option. - 3. Resources - Information to help install and configure MySQL. + * Server only: Only install the MySQL server. - To Install MySQL Products after executing MySQL Installer for the - first time, you must accept the license agreement before - proceeding with the installation process. + * Client only: Only install the MySQL client products, + which does not include the MySQL server. - Figure 2.8. MySQL Installer - License Agreement - MySQL Installer - License Agreement + * Full: Install all MySQL products. + + * Custom: Manually select the MySQL products to install. + Note + After the initial installation, you may use MySQL + Installer to manually select MySQL products to install or + remove. In other words, MySQL Installer becomes a MySQL + product management system. - If you are connected to the Internet, then the Installer will - search for the latest MySQL components and add them to the - installation bundle. Click Connect to the Internet to complete - this step, or otherwise check the Skip checkbox and then Continue. + Figure 2.8 MySQL Installer - Choosing a Setup Type + MySQL Installer - Choosing a Setup Type - Figure 2.9. MySQL Installer - Find latest products - MySQL Installer - Find latest products + After you select a setup type, the MySQL Installer will check + your system for the necessary external requirements for each + of the selected MySQL products. MySQL Installer will either + download and install the missing components onto your system, + or point you to the download location and set Status to + "Manual". - If you chose "Connect to the Internet," the next page will show - the progress of MySQL Installer's search for available updates. - When the search is complete (or if you opted to skip the search), - you will be taken to the Choose Setup Type page: + The next window lists the MySQL products that are scheduled + to be installed: - Figure 2.10. MySQL Installer - Choosing a Setup Type - MySQL Installer - Choosing a Setup Type + Figure 2.9 MySQL Installer - Installation Progress + MySQL Installer - Installation Progress - Determine the option most compatible with your preferences by - reading the Setup Type Description descriptions. + As components are installed, their Status changes from a + progress percentage to "Complete". - The Installation and Data paths are also defined here, and a - caution flag will notify you if the data path you define already - exists. + After all components are installed, the next step configures + some of the recently installed MySQL products. The + Configuration Overview window displays the progress and then + loads a configuration window, if required. Our example + configures MySQL Server 5.6.x. - After you select a setup type, the MySQL Installer will check your - system for the necessary external requirements and download then - install missing components onto your system. +Configuring MySQL Server - Figure 2.11. MySQL Installer - Check Requirements - MySQL Installer - Check Requirements + Configuring the MySQL server begins with defining several + Type and Networking options. - The next window lists the MySQL products that are scheduled to be - installed: + Figure 2.10 MySQL Installer - Configuration Overview + MySQL Installer - Configuration Overview - Figure 2.12. MySQL Installer - Installation Progress - MySQL Installer - Installation Progress + Server Configuration Type - As components are installed, you'll see their status change from - "to be installed" to "install success." + Choose the MySQL server configuration type that describes + your setup. This setting defines the amount of system + resources that will be assigned to your MySQL server + instance. - Figure 2.13. MySQL Installer - Installation Progress status - MySQL Installer - Installation Progress status + * Developer: A machine that will host many other + applications, and typically this is your personal + workstation. This option configures MySQL to use the + least amount of memory. - After all components are installed, the next step involves - configuring the products. The Configuration Overview window - displays the progress and then loads a configuration window if it - is required. + * Server: Several other applications will be running on + this machine, such as a web server. This option + configures MySQL to use a medium amount of memory. - Figure 2.14. MySQL Installer - Configuration Overview - MySQL Installer - Configuration Overview + * Dedicated: A machine that is dedicated to running the + MySQL server. Because no other major applications are + running on the server, such as web servers, this option + configures MySQL to use all available memory. + + Connectivity + + Connectivity options control how you will connect to MySQL. + Options include: + + * TCP/IP: You may enable TCP/IP Networking here as + otherwise only localhost connections are allowed. Also + define the Port Number and whether to open the firewall + port for network access. + + * Named Pipe: Enable and define the pipe name, similar to + using the --enable-named-pipe option. + + * Shared Memory: Enable and then define the memory name, + similar to using the --shared-memory option. - The ideal MySQL Server configuration depends on your intended use, - as explained in the next window. Choose the description that most - closely applies to your machine. - - You may enable TCP/IP Networking here as otherwise only localhost - connections are allowed. - - Checking the "Advanced Configuration" option provides additional - Logging Options to configure. This includes defining file paths - for the error log, general log, slow query log (including the - configuration of seconds it requires to execute a query), and the - binary log. - - Figure 2.15. MySQL Installer - MySQL Server Configuration: Define - platform, networking, and logging options - MySQL Installer- MySQL Server Configuration: Define platform, - networking, and logging options - - Next, choose your account information. Defining a root password is - required, whereas it's optional to create additional users. There - are several different predefined user roles that each have - different permission levels. For example, a "DB Admin" will have - more privileges than a "DB Designer.". - - Figure 2.16. MySQL Installer - MySQL Server Configuration: User - accounts - MySQL Installer - MySQL Server Configuration: User accounts + Advanced Configuration + + Checking the "Advanced Configuration" option provides + additional Logging Options to configure. This includes + defining file paths for the error log, general log, slow + query log (including the configuration of seconds it requires + to execute a query), and the binary log. + + Figure 2.11 MySQL Installer - MySQL Server Configuration: + Type and Networking + MySQL Installer- MySQL Server Configuration: Type and + Networking + +Accounts and Roles + + Next, define your MySQL account information. Assigning a root + password is required. + + Optionally, you can add additional MySQL user accounts with + predefined user roles. Each predefined role, such as "DB + Admin", are configured with their own set of privileges. For + example, the "DB Admin" role has more privileges than the "DB + Designer" role. Click the Role dropdown for a list of role + descriptions. Note - If the MySQL Server is already installed, then the Current Root - Password will also be needed. + If the MySQL Server is already installed, then you must also + enter the Current Root Password. + + Figure 2.12 MySQL Installer - MySQL Server Configuration: + User Accounts and Roles + MySQL Installer - MySQL Server Configuration: User Accounts + and Roles - Next, configure the Windows Service Details. This includes the - service name, how the MySQL Server should be loaded at startup, - and how the Windows Service for MySQL Server will be run. + Figure 2.13 MySQL Installer - MySQL Server Configuration: + User Accounts and Roles: Adding a User + MySQL Installer - MySQL Server Configuration: User Accounts + and Roles: Adding a User - Figure 2.17. MySQL Installer - MySQL Server Configuration: Windows - service details - MySQL Installer - MySQL Server Configuration: Windows service - details +Windows Service + + Next, configure the Windows Service details. This includes + the service name, whether the MySQL Server should be loaded + at startup, and how the Windows Service for MySQL Server is + executed. + + Figure 2.14 MySQL Installer - MySQL Server Configuration: + Windows Service + MySQL Installer - MySQL Server Configuration: Windows Service Note - When configuring Run Windows Services as ... using a Custom User, - the custom user must have privileges to log on to Windows as a - service. And the Next button will be disabled until this user is - given these user rights. + When configuring Run Windows Services as ... using a Custom + User, the custom user must have privileges to log on to + Microsoft Windows as a service. And the Next button will be + disabled until this user is configured with these user + rights. + + On Microsoft Windows 7, this is configured by loading the + Start Menu, Control Panel, Administrative Tools, Local + Security Policy, Local Policies, User Rights Assignment, then + Log On As A Service. Choose Add User or Group here to add the + custom user, and then OK, OK to save. + +Advanced Options + + The next configuration step is available if the Advanced + Configuration option was checked. This section includes + options that are related to the MySQL log files: + + Figure 2.15 MySQL Installer - MySQL Server Configuration: + Logging Options + MySQL Installer - MySQL Server Configuration: Logging Options - On Microsoft Windows 7, this is configured by loading the Start - Menu, Control Panel, Administrative Tools, Local Security Policy, - Local Policies, User Rights Assignment, then Log On As A Service. - Choose Add User or Group here to add the custom user, and then OK, - OK to save. + Click Next to continue on to the final page before all of the + requested changes are applied. This Apply Server + Configuration page details the configuration steps that will + be performed. - The final configuration step is available if the Advanced - Configuration option was checked, and it includes configuration - options related to log file names: + Figure 2.16 MySQL Installer - MySQL Server Configuration: + Apply Server Configuration + MySQL Installer - MySQL Server Configuration: Apply Server + Configuration - Figure 2.18. MySQL Installer - MySQL Server Configuration: Logging - options - MySQL Installer - MySQL Server Configuration: Logging options + Click Execute to execute the configuration steps. The icon + for each step toggles from white to green on success, or the + process stops on failure. Click the Log tab to view the log. - After the MySQL Installer configuration process is completed, you - may save the installation log, and then load MySQL Workbench if - the Start MySQL Workbench after Setup option is checked: + After the MySQL Installer configuration process is finished, + MySQL Installer reloads the opening page where you can + execute other installation and configuration related actions. - Figure 2.19. MySQL Installer - Installation Complete - MySQL Installer - Installation Complete + MySQL Installer is added to the Microsoft Windows Start menu + under the MySQL group. Opening MySQL Installer loads its + dashboard where installed MySQL products are listed, and + other MySQL Installer actions are available: - You can now open MySQL Installer from the Microsoft Windows Start - menu under the MySQL group, which will load the MySQL Installer - Maintenance Screen. This is used to add, update, and remove - features. + Figure 2.17 MySQL Installer - Main Dashboard + MySQL Installer - Main Dashboard - Figure 2.20. MySQL Installer - Maintenance Screen - MySQL Installer - Maintenance Screen +Adding MySQL Products + + Click Add to add new products. This loads the Select Products + and Features page: + + Figure 2.18 MySQL Installer - Select Products and Features + MySQL Installer - Select Products and Features + + From here, choose the MySQL products you want to install from + the left Available Products pane, and then click the green + right arrow to queue products for installation. + + Optionally, click Edit to open the product and features + search filter: + + Figure 2.19 MySQL Installer - Select Products and Features + Filter + MySQL Installer - Select Products and Features Filter + + For example, you might choose to include Pre-Release products + in your selections, such as a Beta product that has not yet + reached GA status. Note - An Update Screen screen is shown if MySQL Installer is used on a - machine with older products installed, as opposed to the - Maintenance Screen shown above. However, the functionality remains - the same. + The ability to install Pre-Release versions of MySQL products + was added in MySQL Installer 1.4.0. - Add/Modify Products and Features will list all installed and - available MySQL products. + Select all of the MySQL products you want to install, then + click Next to continue, and then Execute to execute the + installation process to install all of the selected products. - Figure 2.21. MySQL Installer - Add/Modify Products and Features - MySQL Installer - Add/Modify Products and Features +2.3.3.1.1 MySQL Product Catalog - The installation is now complete. MySQL Server should be running, - and most MySQL products installed and available for use. + MySQL Installer stores a MySQL product catalog. The catalog + can be updated either manually or automatically, and the + catalog change history is also available. + Note - See also the MySQL Workbench documentation - (http://dev.mysql.com/doc/workbench/en/). + The MySQL product catalog was added in MySQL Installer 1.4.0. -2.3.3.2. MySQL Installer Console + Manual updates - MySQLInstallerConsole provides functionality similar to the GUI - version of MySQL Installer, but from the command-line. It is - installed when MySQL Installer is initially executed, and then - available within the MySQL Installer directory. Typically that is - in C:\Program Files (x86)\MySQL\MySQL Installer\, and the console - must be executed with administrative privileges. + You can update the MySQL product catalog at any time by + clicking Catalog on the Installer dashboard. - To use, invoke the Command Prompt with administrative privileges - by choosing Start, Accessories, then right-click on Command Prompt - and choose Run as administrator. And from the command-line, - optionally change the directory to where MySQLInstallerConsole is - located: -C:\> cd "C:\Program Files (x86)\MySQL\MySQL Installer" + Figure 2.20 MySQL Installer - Open the MySQL Product Catalog + MySQL Installer - Open the MySQL Product Catalog + + From there, click Execute to update the product catalog. - MySQLInstallerConsole supports the following options, which are - specified on the command line: + Automatic updates - * --help, -h, or -? - Displays a help message with usage examples, and then exits. -C:\> MySQLInstallerConsole --help + You can configure MySQL Installer to automatically update the + MySQL product catalog once per day. To enable this feature + and set the update time, click the wrench icon on the + Installer dashboard. - * --updates (or -u) - Checks for new products before any further action is taken. - Disabled by default. + The next window configures the Automatic Catalog Update. + Enable or disable this feature, and also set the hour. - * --nowait - Skips the final pause when the program finishes. Otherwise, a - "Press Enter to continue." dialogue is generated. It is used - in conjunction with other options. + Figure 2.21 MySQL Installer - Configure the Catalog Scheduler + MySQL Installer - Configure the Catalog Scheduler - * --catalog=catalog_name (or -c) - Sets the default catalog. Use --list to view a list of - available catalogs. + This option uses the Windows Task Scheduler to schedule a + task named "ManifestUpdate". - * --type=installation_type (or -t) - Sets the installation type. - The possible values for installation_type are: developer, - server, client, full, and custom. + Change History - * --action=action_name - The action being performed. - The possible values are: install, remove, upgrade, list, and - status. + MySQL Installer tracks the change history for all of the + MySQL products. Click Catalog from the dashboard, optionally + update the catalog (or, toggle the Do not update at this time + checkbox), click Next/Execute, and then view the change + history. - + install: Installs a product or products, as defined by - --products + Figure 2.22 MySQL Installer - Catalog Change History + MySQL Installer - Catalog Change History - + upgrade: Upgrades a product or products, as defined by - --products. +2.3.3.1.2 Remove MySQL Products - + remove: Removes a product or products, as defined by - --products. + MySQL Installer can also remove MySQL products from your + system. To remove a MySQL product, click Remove from the + Installer dashboard. This opens a window with a list of + installed MySQL products. Select the MySQL products you want + to remove (uninstall), and then click Execute to begin the + removal process. + Note - + list: Lists the product manifest, both installed and - available products. + To select all MySQL products, click the [ ] checkbox to the + left of the Product label. - + status: Shows the status after another action is - performed. + Figure 2.23 MySQL Installer - Removing Products: Select + MySQL Installer - Removing Products: Select - * --product=product_name[:feature1],[feature2], [...] (or -p) - Set the feature list of a product. Use --list to view - available products, or pass in --product=* (an asterisk) to - install all available products. + Figure 2.24 MySQL Installer - Removing Products: Executed + MySQL Installer - Removing Products: Executed - * --config=product_name:passwd=root_password[;parameter1=value], - [;parameter2=value], ... - The configuration parameters for the most recently listed - products. +2.3.3.1.3 Alter MySQL Products + + MySQL Installer offers several options to alter your MySQL + product installations. - * --user=product_name:name=username,host:hostname,role=rolename, - password=password or - --user=product_name:name=username,host:hostname,role=rolename, - tokens=tokens - Creates a new user. - Requires: name, host, role, and the password or tokens. Tokens - are separated by pipe ("|") characters. - -2.3.4. MySQL Notifier for Microsoft Windows - - The MySQL Notifier for Microsoft Windows is a tool that enables - you to monitor and adjust the status of your local and remote - MySQL Server instances through an indicator that resides in the - system tray. The MySQL Notifier for Microsoft Windows also gives - quick access to several MySQL GUI tools (such as MySQL Workbench) - through its context menu. - - The MySQL Notifier for Microsoft Windows is installed by MySQL - Installer, and (by default) will start-up when Microsoft Windows - is started. +Upgrade + + MySQL products with an available upgrade are highlighted on + the main dashboard. Products with available upgrades will + have an upgrade icon next to their version number. + + Figure 2.25 MySQL Installer - Upgrade a MySQL Product + MySQL Installer - Upgrade a MySQL Product + Note + + Available upgrades are determined by having a current + catalog. For information about keeping your MySQL product + catalog current, see Section 2.3.3.1.1, "MySQL Product + Catalog." + + Click Upgrade to view a list upgradable products. Our example + indicates that MySQL server 5.6.19 can be upgraded to version + 5.6.20. + + Figure 2.26 MySQL Installer - Select Products To Upgrade + MySQL Installer - Select Products To Upgrade + + Select (check) the products to upgrade, and optionally click + the changes link to view the product's release notes in your + browser. Click Next to begin the upgrade process. + + Figure 2.27 MySQL Installer - Apply Updates + MySQL Installer - Apply Updates + + A MySQL server upgrade will also check and upgrade the + server's database. Although optional, this step is + recommended. + + Figure 2.28 MySQL Installer - Check and Upgrade Database + MySQL Installer - Check and Upgrade Database + + Upon completion, your upgraded products will be upgraded and + available to use. A MySQL server upgrade also restarts the + MySQL server. + +Reconfigure + + Some MySQL products, such as the MySQL server, include a + Reconfigure option. It opens the same configuration options + that were set when the MySQL product was installed, and is + pre-populated with the current values. + + To execute, click the Reconfigure link under the Quick Action + column on the main dashboard for the MySQL product that you + want to reconfigure. + + Figure 2.29 MySQL Installer - Reconfigure a MySQL Product + MySQL Installer - Reconfigure a MySQL Product + + In the case of the MySQL server, this opens the familiar + configuration wizard. + + Figure 2.30 MySQL Installer - Reconfiguration Wizard + MySQL Installer - Reconfiguration Wizard + +Modify + + Many MySQL products contain feature components that can be + added or removed. For example, Debug binaries and Client + Programs are subcomponents of the MySQL server. + + The modify the features of a product, click Modify on the + main dashboard. + + Figure 2.31 MySQL Installer - Modify Product Features + MySQL Installer - Modify Product Features + + Click Execute to execute the modification request. + +2.3.3.2 MySQL Installer Console + + MySQLInstallerConsole provides functionality similar to the + GUI version of MySQL Installer, but from the command-line. It + is installed when MySQL Installer is initially executed, and + then available within the MySQL Installer directory. + Typically that is in C:\Program Files (x86)\MySQL\MySQL + Installer\, and the console must be executed with + administrative privileges. + + To use, invoke the Command Prompt with administrative + privileges by choosing Start, Accessories, then right-click + on Command Prompt and choose Run as administrator. And from + the command-line, optionally change the directory to where + MySQLInstallerConsole is located: +C:\> cd "C:\Program Files (x86)\MySQL\MySQL Installer" +C:\> MySQLInstallerConsole.exe help + +C:\Program Files (x86)\MySQL\MySQL Installer for Windows>MySQLInstalle +rConsole.exe help + +The following commands are available: + +Configure - Configures one or more of your installed programs. +Help - Provides list of available commands. +Install - Install and configure one or more available MySQL programs +. +List - Provides an interactive way to list all products available +. +Modify - Modifies the features of installed products. +Remove - Removes one or more products from your system. +Status - Shows the status of all installed products. +Update - Update the current product catalog. +Upgrade - Upgrades one or more of your installed programs. + + MySQLInstallerConsole supports the following options, which + are specified on the command line: + + * configure [product1]:[setting]=[value]; + [product2]:[setting]=[value]; [...] + Configure one or more MySQL products on your system. + Switches include: + + + -showsettings : Displays the available options for + the selected product, by passing in the product name + after -showsettings. + + + -silent : Disable confirmation prompts. +C:\> MySQLInstallerConsole configure -showsettings server +C:\> MySQLInstallerConsole configure server:port=3307 + + + * help [command] + Displays a help message with usage examples, and then + exits. Pass in an additional command to receive help + specific to that command. +C:\> MySQLInstallerConsole help +C:\> MySQLInstallerConsole help install + + + * install [product]:[features]:[config block]:[config + block]:[config block]; [...] + Install one or more MySQL products on your system. + Switches and syntax options include: + + + -type=[SetupType] : Installs a predefined set of + software. The "SetupType" can be one of the + following: + Note + Non-custom setup types can only be chosen if no + other MySQL products are installed. + o Developer: Installs a complete development + environment. + o Server: Installs a single MySQL server + o Client: Installs client programs and libraries + o Full: Installs everything + o Custom: Installs user selected products. This + is the default option. + + + -showsettings : Displays the available options for + the selected product, by passing in the product name + after -showsettings. + + + -silent : Disable confirmation prompts. + + + [config block]: One or more configuration blocks can + be specified. Each configuration block is a + semicolon separated list of key value pairs. A block + can include either a "config" or "user" type key, + where "config" is the default type if one is not + defined. + Only one "config" type block can be defined per + product. A "user" block should be defined for each + user that should be created during the product's + installation. + Note + Adding users is not supported when a product is + being reconfigured. + + + [feature]: The feature block is a semicolon + separated list of features, or '*' to select all + features. +C:\> MySQLInstallerConsole install server;5.6.22:*:port=3307;serverid= +2:type=user;username=foo;password=bar;role=DBManager +C:\> MySQLInstallerConsole install server;5.6.22;x64 -silent + + + * list + Lists an interactive console where all of the available + MySQL products can be searched. Execute + MySQLInstallerConsole list to launch the console, and + enter in a substring to search. +C:\> MySQLInstallerConsole list + + + * modify [product1:-removelist|+addlist] + [product2:-removelist|+addlist] [...] + Modifies or displays features of a previously installed + MySQL product. + + + -silent : Disable confirmation prompts. +C:\> MySQLInstallerConsole modify server +C:\> MySQLInstallerConsole modify server:+documentation +C:\> MySQLInstallerConsole modify server:-debug + + + * remove [product1] [product2] [...] + Removes one ore more products from your system. + + + * : Pass in * to remove all of the MySQL products. + + + -continue : Continue the operation even if an error + occurs. + + + -silent : Disable confirmation prompts. +C:\> MySQLInstallerConsole remove * +C:\> MySQLInstallerConsole remove server + + + * status + Provides a quick overview of the MySQL products that are + installed on the system. Information includes product + name and version, architecture, date installed, and + install location. +C:\> MySQLInstallerConsole status + + + * upgrade [product1:version] [product2:version], [...] + Upgrades one or more products on your system. Syntax + options include: + + + * : Pass in * to upgrade all products to the latest + version, or pass in specific products. + + + ! : Pass in ! as a version number to upgrade the + MySQL product to its latest version. + + + -silent : Disable confirmation prompts. +C:\> MySQLInstallerConsole upgrade * +C:\> MySQLInstallerConsole upgrade workbench:6.2.2 +C:\> MySQLInstallerConsole upgrade workbench:! +C:\> MySQLInstallerConsole upgrade workbench:6.2.2 excel:1.3.2 + + + * update + Downloads the latest MySQL product catalog to your + system. On success, the download catalog will be applied + the next time either MySQLInstaller or + MySQLInstallerConsole is executed. +C:\> MySQLInstallerConsole update + + Note + The Automatic Catalog Update GUI option executes this + command from the Windows Task Scheduler. + +2.3.4 MySQL Notifier + + The MySQL Notifier is a tool that enables you to monitor and + adjust the status of your local and remote MySQL Server + instances through an indicator that resides in the system + tray. The MySQL Notifier also gives quick access to several + MySQL GUI tools (such as MySQL Workbench) through its context + menu. + + The MySQL Notifier is installed by MySQL Installer, and (by + default) will start-up when Microsoft Windows is started. Note To install, download and execute the MySQL Installer - (http://dev.mysql.com/downloads/installer/), be sure the MySQL - Notifier for Microsoft Windows product is selected, then proceed - with the installation. See the MySQL Installer manual for - additional details. + (http://dev.mysql.com/downloads/installer/), be sure the + MySQL Notifier product is selected, then proceed with the + installation. See the MySQL Installer manual for additional + details. - For release notes detailing the changes in each release of MySQL - Notifier for Microsoft Windows, see the MySQL Notifier Release - Notes (http://dev.mysql.com/doc/relnotes/mysql-notifier/en/). + For notes detailing the changes in each release of MySQL + Notifier, see the MySQL Notifier Release Notes + (http://dev.mysql.com/doc/relnotes/mysql-notifier/en/). Visit the MySQL Notifier forum (http://forums.mysql.com/list.php?173) for additional MySQL - Notifier for Microsoft Windows help and support. + Notifier help and support. Features include: * Start, Stop, and Restart instances of the MySQL Server. - * Automatically detects (and adds) new MySQL Server services. - These are listed under Manage Monitored Items, and may also be - configured. + * Automatically detects (and adds) new MySQL Server + services. These are listed under Manage Monitored Items, + and may also be configured. - * The Tray icon changes, depending on the status. It's green if - all monitored MySQL Server instances are running, or red if at - least one service is stopped. The Update MySQL Notifier tray - icon based on service status option, which dictates this - behavior, is enabled by default for each service. + * The Tray icon changes, depending on the status. It's + green if all monitored MySQL Server instances are + running, or red if at least one service is stopped. The + Update MySQL Notifier tray icon based on service status + option, which dictates this behavior, is enabled by + default for each service. * Links to other applications like MySQL Workbench, MySQL Installer, and the MySQL Utilities. For example, choosing @@ -1588,403 +1901,418 @@ C:\> MySQLInstallerConsole --help Administration window for that particular instance. * If MySQL Workbench is also installed, then the Configure - Instance and SQL Editor options are available for local (but - not remote) MySQL instances. + Instance and SQL Editor options are available for local + (but not remote) MySQL instances. * Monitoring of both local and remote MySQL instances. Note - Remote monitoring is available since MySQL Notifier for Microsoft - Windows 1.1.0. + Remote monitoring is available since MySQL Notifier 1.1.0. - The MySQL Notifier for Microsoft Windows resides in the system - tray and provides visual status information for your MySQL Server - instances. A green icon is displayed at the top left corner of the - tray icon if the current MySQL Server is running, or a red icon if + The MySQL Notifier resides in the system tray and provides + visual status information for your MySQL Server instances. A + green icon is displayed at the top left corner of the tray + icon if the current MySQL Server is running, or a red icon if the service is stopped. - The MySQL Notifier for Microsoft Windows automatically adds - discovered MySQL Services on the local machine, and each service - is saved and configurable. By default, the Automatically add new - services whose name contains option is enabled and set to mysql. + The MySQL Notifier automatically adds discovered MySQL + Services on the local machine, and each service is saved and + configurable. By default, the Automatically add new services + whose name contains option is enabled and set to mysql. Related Notifications Options include being notified when new - services are either discovered or experience status changes, and - are also enabled by default. And uninstalling a service will also - remove the service from the MySQL Notifier for Microsoft Windows. + services are either discovered or experience status changes, + and are also enabled by default. And uninstalling a service + will also remove the service from the MySQL Notifier. Note The Automatically add new services whose name contains option - default changed from ".*mysqld.*" to "mysql" in Notifier 1.1.0. + default changed from ".*mysqld.*" to "mysql" in Notifier + 1.1.0. - Clicking the system tray icon will reveal several options, as seen - in the screenshots below: + Clicking the system tray icon will reveal several options, as + seen in the screenshots below: - The Service Instance menu is the main MySQL Notifier for Microsoft - Windows window, and enables you to Stop, Start, and Restart the - MySQL Server. + The Service Instance menu is the main MySQL Notifier window, + and enables you to Stop, Start, and Restart the MySQL Server. - Figure 2.22. MySQL Notifier for Microsoft Windows Service Instance - menu - MySQL Notifier for Microsoft Windows Service Instance menu + Figure 2.32 MySQL Notifier Service Instance menu + MySQL Notifier Service Instance menu - The Actions menu includes several links to external applications - (if they are installed), and a a Refresh Status option to manually - refresh the status of all monitored services (in both local and - remote computers) and MySQL instances. + The Actions menu includes several links to external + applications (if they are installed), and a Refresh Status + option to manually refresh the status of all monitored + services (in both local and remote computers) and MySQL + instances. Note - The main menu will not show the Actions menu when there are no - services being monitored by MySQL Notifier for Microsoft Windows. + The main menu will not show the Actions menu when there are + no services being monitored by MySQL Notifier. Note - The Refresh Status feature is available since MySQL Notifier for - Microsoft Windows 1.1.0. + The Refresh Status feature is available since MySQL Notifier + 1.1.0. - Figure 2.23. MySQL Notifier for Microsoft Windows Actions menu - MySQL Notifier for Microsoft Windows Actions menu + Figure 2.33 MySQL Notifier Actions menu + MySQL Notifier Actions menu - The Actions, Options menu configures MySQL Notifier for Microsoft - Windows and includes options to: + The Actions, Options menu configures MySQL Notifier and + includes options to: - * Use colorful status icons: Enables a colorful style of icons - for the tray of the MySQL Notifier for Microsoft Windows. + * Use colorful status icons: Enables a colorful style of + icons for the tray of the MySQL Notifier. - * Run at Windows Startup: Allows the application to be loaded - when Microsoft Windows starts. + * Run at Windows Startup: Allows the application to be + loaded when Microsoft Windows starts. - * Automatically Check For Updates Every # Weeks: Checks for a - new version of MySQL Notifier for Microsoft Windows, and runs - this check every # weeks. + * Automatically Check For Updates Every # Weeks: Checks for + a new version of MySQL Notifier, and runs this check + every # weeks. - * Automatically add new services whose name contains: The text - used to filter services and add them automatically to the - monitored list of the local computer running MySQL Notifier, - and on remote computers already monitoring Windows services. - monitored services, and also filters the list of the Microsoft - Windows services for the Add New Service dialog. - Prior to version 1.1.0, this option was named "Automatically - add new services that match this pattern." + * Automatically add new services whose name contains: The + text used to filter services and add them automatically + to the monitored list of the local computer running MySQL + Notifier, and on remote computers already monitoring + Windows services. monitored services, and also filters + the list of the Microsoft Windows services for the Add + New Service dialog. + Prior to version 1.1.0, this option was named + "Automatically add new services that match this pattern." - * Notify me when a service is automatically added: Will display - a balloon notification from the taskbar when a newly - discovered service is added to the monitored services list. + * Notify me when a service is automatically added: Will + display a balloon notification from the taskbar when a + newly discovered service is added to the monitored + services list. * Notify me when a service changes status: Will display a - balloon notification from the taskbar when a monitored service - changes its status. + balloon notification from the taskbar when a monitored + service changes its status. - Figure 2.24. MySQL Notifier for Microsoft Windows Options menu - MySQL Notifier for Microsoft Windows Options menu + Figure 2.34 MySQL Notifier Options menu + MySQL Notifier Options menu - The Actions, Manage Monitored Items menu enables you to configure - the monitored services and MySQL instances. First, with the - Services tab open: + The Actions, Manage Monitored Items menu enables you to + configure the monitored services and MySQL instances. First, + with the Services tab open: - Figure 2.25. MySQL Notifier for Microsoft Windows Manage Services - menu - MySQL Notifier for Microsoft Windows Manage Services menu + Figure 2.35 MySQL Notifier Manage Services menu + MySQL Notifier Manage Services menu The Instances tab is similar: - Figure 2.26. MySQL Notifier for Microsoft Windows Manage Instances - menu - MySQL Notifier for Microsoft Windows Manage Instances menu + Figure 2.36 MySQL Notifier Manage Instances menu + MySQL Notifier Manage Instances menu - Adding a service or instance (after clicking Add in the Manage - Monitored Items window) enables you to select a running Microsoft - Windows service or instance connection, and configure MySQL - Notifier for Microsoft Windows to monitor it. Add a new service or + Adding a service or instance (after clicking Add in the + Manage Monitored Items window) enables you to select a + running Microsoft Windows service or instance connection, and + configure MySQL Notifier to monitor it. Add a new service or instance by clicking service name from the list, then OK to accept. Multiple services and instances may be selected. - Figure 2.27. MySQL Notifier for Microsoft Windows Adding new - services - MySQL Notifier for Microsoft Windows Adding new services + Figure 2.37 MySQL Notifier Adding new services + MySQL Notifier Adding new services And instances: - Figure 2.28. MySQL Notifier for Microsoft Windows Adding new - instances - MySQL Notifier for Microsoft Windows Adding new instances + Figure 2.38 MySQL Notifier Adding new instances + MySQL Notifier Adding new instances Note - The Instances tab available since MySQL Notifier for Microsoft - Windows 1.1.0. + The Instances tab available since MySQL Notifier 1.1.0. -2.3.4.1. Remote monitoring set up and installation instructions +2.3.4.1 Remote monitoring set up and installation instructions - The MySQL Notifier for Microsoft Windows uses Windows Management - Instrumentation (WMI) to manage and monitor services in remote - computers running Windows XP or later. This guide explains how it + The MySQL Notifier uses Windows Management Instrumentation + (WMI) to manage and monitor services in remote computers + running Windows XP or later. This guide explains how it works, and how to set up your system to monitor remote MySQL instances. Note - Remote monitoring is available since MySQL Notifier for Microsoft - Windows 1.1.0. + Remote monitoring is available since MySQL Notifier 1.1.0. - In order to configure WMI, it is important to understand that the - underlying Distributed Component Object Model (DCOM) architecture - is doing the WMI work. Specifically, MySQL Notifier for Microsoft - Windows is using asynchronous notification queries on remote + In order to configure WMI, it is important to understand that + the underlying Distributed Component Object Model (DCOM) + architecture is doing the WMI work. Specifically, MySQL + Notifier is using asynchronous notification queries on remote Microsoft Windows hosts as .NET events. These events send an - asynchronous callback to the computer running the MySQL Notifier - for Microsoft Windows so it knows when a service status has - changed on the remote computer. Asynchronous notifications offer - the best performance compared to semi-synchronous notifications or + asynchronous callback to the computer running the MySQL + Notifier so it knows when a service status has changed on the + remote computer. Asynchronous notifications offer the best + performance compared to semisynchronous notifications or synchronous notifications that use timers. - Asynchronous notifications requires the remote computer to send a - callback to the client computer (thus opening a reverse - connection), so the Windows Firewall and DCOM settings must be - properly configured for the communication to function properly. - - Figure 2.29. MySQL Notifier for Microsoft Windows Distributed - Component Object Model (DCOM) - MySQL Notifier for Microsoft Windows Distributed Component Object - Model (DCOM) - - Most of the common errors thrown by asynchronous WMI notifications - are related to Windows Firewall blocking the communication, or to - DCOM / WMI settings not being set up properly. For a list of - common errors with solutions, see Section 2.3.4.1, "." - - The following steps are required to make WMI function. These steps - are divided between two machines. A single host computer that runs - MySQL Notifier for Microsoft Windows (Computer A), and multiple + Asynchronous notifications requires the remote computer to + send a callback to the client computer (thus opening a + reverse connection), so the Windows Firewall and DCOM + settings must be properly configured for the communication to + function properly. + + Figure 2.39 MySQL Notifier Distributed Component Object Model + (DCOM) + MySQL Notifier Distributed Component Object Model (DCOM) + + Most of the common errors thrown by asynchronous WMI + notifications are related to Windows Firewall blocking the + communication, or to DCOM / WMI settings not being set up + properly. For a list of common errors with solutions, see + Section 2.3.4.1, "." + + The following steps are required to make WMI function. These + steps are divided between two machines. A single host + computer that runs MySQL Notifier (Computer A), and multiple remote machines that are being monitored (Computer B). -Computer running MySQL Notifier for Microsoft Windows (Computer A) +Computer running MySQL Notifier (Computer A) - 1. Allow for remote administration by either editing the Group - Policy Editor, or using NETSH: + 1. Allow for remote administration by either editing the + Group Policy Editor, or using NETSH: Using the Group Policy Editor: - a. Click Start, click Run, type GPEDIT.MSC, and then click - OK. - b. Under the Local Computer Policy heading, double-click - Computer Configuration. + a. Click Start, click Run, type GPEDIT.MSC, and then + click OK. + b. Under the Local Computer Policy heading, + double-click Computer Configuration. c. Double-click Administrative Templates, then Network, Network Connections, and then Windows Firewall. d. If the computer is in the domain, then double-click - Domain Profile; otherwise, double-click Standard Profile. + Domain Profile; otherwise, double-click Standard + Profile. e. Click Windows Firewall: Allow inbound remote administration exception. - f. On the Action menu either select Edit, or double-click - the selection from the previous step. + f. On the Action menu either select Edit, or + double-click the selection from the previous step. g. Check the Enabled radio button, and then click OK. Using the NETSH command: - a. Open a command prompt window with Administrative rights - (you can right-click the Command Prompt icon and click - Run as Administrator). + a. Open a command prompt window with Administrative + rights (you can right-click the Command Prompt icon + and click Run as Administrator). b. Execute the following command: NETSH firewall set service RemoteAdmin enable + 2. Open the DCOM port TCP 135: - a. Open a command prompt window with Administrative rights - (you can right-click the Command Prompt icon and click - Run as Administrator) . + a. Open a command prompt window with Administrative + rights (you can right-click the Command Prompt icon + and click Run as Administrator) . b. Execute the following command: NETSH firewall add portopening protocol=tcp port=135 name=DCOM_TCP135 - 3. Add the client application which contains the sink for the - callback (MySqlNotifier.exe) to the Windows Firewall - Exceptions List (use either the Windows Firewall configuration - or NETSH): + + 3. Add the client application which contains the sink for + the callback (MySqlNotifier.exe) to the Windows Firewall + Exceptions List (use either the Windows Firewall + configuration or NETSH): Using the Windows Firewall configuration: a. In the Control Panel, double-click Windows Firewall. - b. In the Windows Firewall window's left panel, click Allow - a program or feature through Windows Firewall. - c. In the Allowed Programs window, click Change Settings. + b. In the Windows Firewall window's left panel, click + Allow a program or feature through Windows Firewall. + c. In the Allowed Programs window, click Change + Settings. d. If MySqlNotifier.exe is in the Allowed programs and - features list, make sure it is checked for the type of - networks the computer connects to (Private, Public or - both). + features list, make sure it is checked for the type + of networks the computer connects to (Private, + Public or both). e. If MySqlNotifier.exe is not in the list, click Allow another program.... - f. In the Add a Program window, select the MySqlNotifier.exe - if it exists in the Programs list, otherwise click - Browse... and go to the directory where MySqlNotifier.exe - was installed to select it, then click Add. - g. Make sure MySqlNotifier.exe is checked for the type of - networks the computer connects to (Private, Public or - both). + f. In the Add a Program window, select the + MySqlNotifier.exe if it exists in the Programs list, + otherwise click Browse... and go to the directory + where MySqlNotifier.exe was installed to select it, + then click Add. + g. Make sure MySqlNotifier.exe is checked for the type + of networks the computer connects to (Private, + Public or both). Using the NETSH command: - a. Open a command prompt window with Administrative rights - (you can right-click the Command Prompt icon and click - Run as Administrator). + a. Open a command prompt window with Administrative + rights (you can right-click the Command Prompt icon + and click Run as Administrator). b. Execute the following command, where you change "[YOUR_INSTALL_DIRECTORY]": -NETSH firewall add allowedprogram program=[YOUR_INSTALL_DIRECTORY]\My -SqlNotifier.exe name=MySqlNotifier +NETSH firewall add allowedprogram program=[YOUR_INSTALL_DIRECTORY]\MyS +qlNotifier.exe name=MySqlNotifier + 4. If Computer B is either a member of WORKGROUP or is in a - different domain that is untrusted by Computer A, then the - callback connection (Connection 2) is created as an Anonymous - connection. To grant Anonymous connections DCOM Remote Access - permissions: - a. Click Start, click Run, type DCOMCNFG, and then click OK. - b. In the Component Services dialog box, expand Component - Services, expand Computers, and then right-click My - Computer and click Properties. - c. In the My Computer Properties dialog box, click the COM - Security tab. + different domain that is untrusted by Computer A, then + the callback connection (Connection 2) is created as an + Anonymous connection. To grant Anonymous connections DCOM + Remote Access permissions: + a. Click Start, click Run, type DCOMCNFG, and then + click OK. + b. In the Component Services dialog box, expand + Component Services, expand Computers, and then + right-click My Computer and click Properties. + c. In the My Computer Properties dialog box, click the + COM Security tab. d. Under Access Permissions, click Edit Limits. - e. In the Access Permission dialog box, select ANONYMOUS - LOGON name in the Group or user names box. In the Allow - column under Permissions for User, select Remote Access, - and then click OK. + e. In the Access Permission dialog box, select + ANONYMOUS LOGON name in the Group or user names box. + In the Allow column under Permissions for User, + select Remote Access, and then click OK. Monitored Remote Computer (Computer B) - If the user account that is logged into the computer running the - MySQL Notifier for Microsoft Windows (Computer A) is a local - administrator on the remote computer (Computer B), such that the - same account is an administrator on Computer B, you can skip to - the "Allow for remote administration" step. - - Setting DCOM security to allow a non-administrator user to access - a computer remotely: - - 1. Grant "DCOM remote launch" and activation permissions for a - user or group: - a. Click Start, click Run, type DCOMCNFG, and then click OK. - b. In the Component Services dialog box, expand Component - Services, expand Computers, and then right-click My - Computer and click Properties. - c. In the My Computer Properties dialog box, click the COM - Security tab. + If the user account that is logged into the computer running + the MySQL Notifier (Computer A) is a local administrator on + the remote computer (Computer B), such that the same account + is an administrator on Computer B, you can skip to the "Allow + for remote administration" step. + + Setting DCOM security to allow a non-administrator user to + access a computer remotely: + + 1. Grant "DCOM remote launch" and activation permissions for + a user or group: + a. Click Start, click Run, type DCOMCNFG, and then + click OK. + b. In the Component Services dialog box, expand + Component Services, expand Computers, and then + right-click My Computer and click Properties. + c. In the My Computer Properties dialog box, click the + COM Security tab. d. Under Access Permissions, click Edit Limits. - e. In the Launch Permission dialog box, follow these steps - if your name or your group does not appear in the Groups - or user names list: + e. In the Launch Permission dialog box, follow these + steps if your name or your group does not appear in + the Groups or user names list: i. In the Launch Permission dialog box, click Add. - ii. In the Select Users, Computers, or Groups dialog - box, add your name and the group in the "Enter the - object names to select" box, and then click OK. - f. In the Launch Permission dialog box, select your user and - group in the Group or user names box. In the Allow column - under Permissions for User, select Remote Launch, select - Remote Activation, and then click OK. + ii. In the Select Users, Computers, or Groups + dialog box, add your name and the group in the + "Enter the object names to select" box, and + then click OK. + f. In the Launch Permission dialog box, select your + user and group in the Group or user names box. In + the Allow column under Permissions for User, select + Remote Launch, select Remote Activation, and then + click OK. Grant DCOM remote access permissions: - a. Click Start, click Run, type DCOMCNFG, and then click OK. - b. In the Component Services dialog box, expand Component - Services, expand Computers, and then right-click My - Computer and click Properties. - c. In the My Computer Properties dialog box, click the COM - Security tab. + a. Click Start, click Run, type DCOMCNFG, and then + click OK. + b. In the Component Services dialog box, expand + Component Services, expand Computers, and then + right-click My Computer and click Properties. + c. In the My Computer Properties dialog box, click the + COM Security tab. d. Under Access Permissions, click Edit Limits. - e. In the Access Permission dialog box, select ANONYMOUS - LOGON name in the Group or user names box. In the Allow - column under Permissions for User, select Remote Access, - and then click OK. + e. In the Access Permission dialog box, select + ANONYMOUS LOGON name in the Group or user names box. + In the Allow column under Permissions for User, + select Remote Access, and then click OK. 2. Allowing non-administrator users access to a specific WMI namespace: - a. In the Control Panel, double-click Administrative Tools. - b. In the Administrative Tools window, double-click Computer - Management. - c. In the Computer Management window, expand the Services - and Applications tree and double-click the WMI Control. - d. Right-click the WMI Control icon and select Properties. - e. In the WMI Control Properties window, click the Security - tab. + a. In the Control Panel, double-click Administrative + Tools. + b. In the Administrative Tools window, double-click + Computer Management. + c. In the Computer Management window, expand the + Services and Applications tree and double-click the + WMI Control. + d. Right-click the WMI Control icon and select + Properties. + e. In the WMI Control Properties window, click the + Security tab. f. In the Security tab, select the namespace and click Security. - g. Locate the appropriate account and check Remote Enable in - the Permissions list. + g. Locate the appropriate account and check Remote + Enable in the Permissions list. - 3. Allow for remote administration by either editing the Group - Policy Editor or using NETSH: + 3. Allow for remote administration by either editing the + Group Policy Editor or using NETSH: Using the Group Policy Editor: - a. Click Start, click Run, type GPEDIT.MSC, and then click - OK. - b. Under the Local Computer Policy heading, double-click - Computer Configuration. + a. Click Start, click Run, type GPEDIT.MSC, and then + click OK. + b. Under the Local Computer Policy heading, + double-click Computer Configuration. c. Double-click Administrative Templates, then Network, Network Connections, and then Windows Firewall. d. If the computer is in the domain, then double-click - Domain Profile; otherwise, double-click Standard Profile. + Domain Profile; otherwise, double-click Standard + Profile. e. Click Windows Firewall: Allow inbound remote administration exception. - f. On the Action menu either select Edit, or double-click - the selection from the previous step. + f. On the Action menu either select Edit, or + double-click the selection from the previous step. g. Check the Enabled radio button, and then click OK. Using the NETSH command: - a. Open a command prompt window with Administrative rights - (you can right-click the Command Prompt icon and click - Run as Administrator). + a. Open a command prompt window with Administrative + rights (you can right-click the Command Prompt icon + and click Run as Administrator). b. Execute the following command: NETSH firewall set service RemoteAdmin enable - 4. Now, be sure the user you are logging in with uses the Name - value and not the Full Name value: - a. In the Control Panel, double-click Administrative Tools. - b. In the Administrative Tools window, double-click Computer - Management. + + 4. Now, be sure the user you are logging in with uses the + Name value and not the Full Name value: + a. In the Control Panel, double-click Administrative + Tools. + b. In the Administrative Tools window, double-click + Computer Management. c. In the Computer Management window, expand the System Tools then Local Users and Groups. - d. Click the Users node, and on the right side panel locate - your user and make sure it uses the Name value to - connect, and not the Full Name value. - - 5. If the remote computer is running on Windows XP Professional, - make sure that remote logins are not being forcefully changed - to the guest account user (also known as ForceGuest), which is - enabled by default on computers that are not attached to a - domain. - a. Click Start, click Run, type SECPOL.MSC, and then click - OK. + d. Click the Users node, and on the right side panel + locate your user and make sure it uses the Name + value to connect, and not the Full Name value. + + 5. If the remote computer is running on Windows XP + Professional, make sure that remote logins are not being + forcefully changed to the guest account user (also known + as ForceGuest), which is enabled by default on computers + that are not attached to a domain. + a. Click Start, click Run, type SECPOL.MSC, and then + click OK. b. Under the Local Policies node, double-click Security Options. - c. Select Network Access: Sharing and security model for - local accounts and save. + c. Select Network Access: Sharing and security model + for local accounts and save. Common Errors * 0x80070005 - + DCOM Security was not configured properly (see Computer - B, the Setting DCOM security... step). + + DCOM Security was not configured properly (see + Computer B, the Setting DCOM security... step). - + The remote computer (Computer B) is a member of WORKGROUP - or is in a domain that is untrusted by the client - computer (Computer A) (see Computer A, the Grant - Anonymous connections DCOM Remote Access permissions - step). + + The remote computer (Computer B) is a member of + WORKGROUP or is in a domain that is untrusted by the + client computer (Computer A) (see Computer A, the + Grant Anonymous connections DCOM Remote Access + permissions step). * 0x8007000E - + The remote computer (Computer B) is a member of WORKGROUP - or is in a domain that is untrusted by the client - computer (Computer A) (see Computer A, the Grant - Anonymous connections DCOM Remote Access permissions - step). + + The remote computer (Computer B) is a member of + WORKGROUP or is in a domain that is untrusted by the + client computer (Computer A) (see Computer A, the + Grant Anonymous connections DCOM Remote Access + permissions step). * 0x80041003 - + Access to the remote WMI namespace was not configured - properly (see Computer B, the Allowing non-administrator - users access to a specific WMI namespace step). + + Access to the remote WMI namespace was not + configured properly (see Computer B, the Allowing + non-administrator users access to a specific WMI + namespace step). * 0x800706BA + The DCOM port is not open on the client computers - (Computer A) firewall. See the Open the DCOM port TCP 135 - step for Computer A. + (Computer A) firewall. See the Open the DCOM port + TCP 135 step for Computer A. - + The remote computer (Computer B) is inaccessible because - its network location is set to Public. Make sure you can - access it through the Windows Explorer. + + The remote computer (Computer B) is inaccessible + because its network location is set to Public. Make + sure you can access it through the Windows Explorer. -2.3.5. Installing MySQL on Microsoft Windows Using a noinstall Zip +2.3.5 Installing MySQL on Microsoft Windows Using a noinstall Zip Archive - Users who are installing from the noinstall package can use the - instructions in this section to manually install MySQL. The - process for installing MySQL from a Zip archive is as follows: + Users who are installing from the noinstall package can use + the instructions in this section to manually install MySQL. + The process for installing MySQL from a Zip archive is as + follows: 1. Extract the archive to the desired install directory @@ -1998,197 +2326,208 @@ Archive This process is described in the sections that follow. -2.3.5.1. Extracting the Install Archive +2.3.5.1 Extracting the Install Archive To install MySQL manually, do the following: - 1. If you are upgrading from a previous version please refer to - Section 2.3.7, "Upgrading MySQL on Windows," before beginning - the upgrade process. + 1. If you are upgrading from a previous version please refer + to Section 2.3.7, "Upgrading MySQL on Windows," before + beginning the upgrade process. - 2. Make sure that you are logged in as a user with administrator - privileges. + 2. Make sure that you are logged in as a user with + administrator privileges. 3. Choose an installation location. Traditionally, the MySQL - server is installed in C:\mysql. The MySQL Installer installs - MySQL under C:\Program Files\MySQL. If you do not install - MySQL at C:\mysql, you must specify the path to the install - directory during startup or in an option file. See Section - 2.3.5.2, "Creating an Option File." + server is installed in C:\mysql. The MySQL Installation + Wizard installs MySQL under C:\Program Files\MySQL. If + you do not install MySQL at C:\mysql, you must specify + the path to the install directory during startup or in an + option file. See Section 2.3.5.2, "Creating an Option + File." + Note + The MySQL Installer installs MySQL under C:\Program + Files\MySQL. 4. Extract the install archive to the chosen installation - location using your preferred Zip archive tool. Some tools may - extract the archive to a folder within your chosen - installation location. If this occurs, you can move the - contents of the subfolder into the chosen installation - location. - -2.3.5.2. Creating an Option File - - If you need to specify startup options when you run the server, - you can indicate them on the command line or place them in an - option file. For options that are used every time the server - starts, you may find it most convenient to use an option file to - specify your MySQL configuration. This is particularly true under - the following circumstances: - - * The installation or data directory locations are different - from the default locations (C:\Program Files\MySQL\MySQL - Server 5.6 and C:\Program Files\MySQL\MySQL Server 5.6\data). - - * You need to tune the server settings, such as memory, cache, - or InnoDB configuration information. - - When the MySQL server starts on Windows, it looks for option files - in several locations, such as the Windows directory, C:\, and the - MySQL installation directory (for the full list of locations, see - Section 4.2.3.3, "Using Option Files"). The Windows directory - typically is named something like C:\WINDOWS. You can determine - its exact location from the value of the WINDIR environment - variable using the following command: + location using your preferred Zip archive tool. Some + tools may extract the archive to a folder within your + chosen installation location. If this occurs, you can + move the contents of the subfolder into the chosen + installation location. + +2.3.5.2 Creating an Option File + + If you need to specify startup options when you run the + server, you can indicate them on the command line or place + them in an option file. For options that are used every time + the server starts, you may find it most convenient to use an + option file to specify your MySQL configuration. This is + particularly true under the following circumstances: + + * The installation or data directory locations are + different from the default locations (C:\Program + Files\MySQL\MySQL Server 5.6 and C:\Program + Files\MySQL\MySQL Server 5.6\data). + + * You need to tune the server settings, such as memory, + cache, or InnoDB configuration information. + + When the MySQL server starts on Windows, it looks for option + files in several locations, such as the Windows directory, + C:\, and the MySQL installation directory (for the full list + of locations, see Section 4.2.6, "Using Option Files"). The + Windows directory typically is named something like + C:\WINDOWS. You can determine its exact location from the + value of the WINDIR environment variable using the following + command: C:\> echo %WINDIR% - MySQL looks for options in each location first in the my.ini file, - and then in the my.cnf file. However, to avoid confusion, it is - best if you use only one file. If your PC uses a boot loader where - C: is not the boot drive, your only option is to use the my.ini - file. Whichever option file you use, it must be a plain text file. + MySQL looks for options in each location first in the my.ini + file, and then in the my.cnf file. However, to avoid + confusion, it is best if you use only one file. If your PC + uses a boot loader where C: is not the boot drive, your only + option is to use the my.ini file. Whichever option file you + use, it must be a plain text file. Note - When using the MySQL Installer to install MySQL Server, it will - create the my.ini at the default location. And as of MySQL Server - 5.5.27, the user running MySQL Installer is granted full - permissions to this new my.ini. + When using the MySQL Installer to install MySQL Server, it + will create the my.ini at the default location. And as of + MySQL Server 5.5.27, the user running MySQL Installer is + granted full permissions to this new my.ini. - In other words, be sure that the MySQL Server user has permission - to read the my.ini file. + In other words, be sure that the MySQL Server user has + permission to read the my.ini file. - You can also make use of the example option files included with - your MySQL distribution; see Section 5.1.2, "Server Configuration - Defaults." + You can also make use of the example option files included + with your MySQL distribution; see Section 5.1.2, "Server + Configuration Defaults." - An option file can be created and modified with any text editor, - such as Notepad. For example, if MySQL is installed in E:\mysql - and the data directory is in E:\mydata\data, you can create an - option file containing a [mysqld] section to specify values for - the basedir and datadir options: + An option file can be created and modified with any text + editor, such as Notepad. For example, if MySQL is installed + in E:\mysql and the data directory is in E:\mydata\data, you + can create an option file containing a [mysqld] section to + specify values for the basedir and datadir options: [mysqld] # set basedir to your installation path basedir=E:/mysql # set datadir to the location of your data directory datadir=E:/mydata/data - Note that Windows path names are specified in option files using - (forward) slashes rather than backslashes. If you do use - backslashes, double them: + Microsoft Windows path names are specified in option files + using (forward) slashes rather than backslashes. If you do + use backslashes, double them: [mysqld] # set basedir to your installation path basedir=E:\\mysql # set datadir to the location of your data directory datadir=E:\\mydata\\data - The rules for use of backslash in option file values are given in - Section 4.2.3.3, "Using Option Files." + The rules for use of backslash in option file values are + given in Section 4.2.6, "Using Option Files." - The data directory is located within the AppData directory for the - user running MySQL. + The data directory is located within the AppData directory + for the user running MySQL. - If you would like to use a data directory in a different location, - you should copy the entire contents of the data directory to the - new location. For example, if you want to use E:\mydata as the - data directory instead, you must do two things: + If you would like to use a data directory in a different + location, you should copy the entire contents of the data + directory to the new location. For example, if you want to + use E:\mydata as the data directory instead, you must do two + things: - 1. Move the entire data directory and all of its contents from - the default location (for example C:\Program Files\MySQL\MySQL - Server 5.6\data) to E:\mydata. + 1. Move the entire data directory and all of its contents + from the default location (for example C:\Program + Files\MySQL\MySQL Server 5.6\data) to E:\mydata. 2. Use a --datadir option to specify the new data directory location each time you start the server. -2.3.5.3. Selecting a MySQL Server Type +2.3.5.3 Selecting a MySQL Server Type - The following table shows the available servers for Windows in - MySQL 5.6. + The following table shows the available servers for Windows + in MySQL 5.6. Binary Description mysqld Optimized binary with named-pipe support - mysqld-debug Like mysqld, but compiled with full debugging and - automatic memory allocation checking + mysqld-debug Like mysqld, but compiled with full debugging + and automatic memory allocation checking All of the preceding binaries are optimized for modern Intel processors, but should work on any Intel i386-class or higher processor. Each of the servers in a distribution support the same set of - storage engines. The SHOW ENGINES statement displays which engines - a given server supports. + storage engines. The SHOW ENGINES statement displays which + engines a given server supports. - All Windows MySQL 5.6 servers have support for symbolic linking of - database directories. + All Windows MySQL 5.6 servers have support for symbolic + linking of database directories. - MySQL supports TCP/IP on all Windows platforms. MySQL servers on - Windows also support named pipes, if you start the server with the - --enable-named-pipe option. It is necessary to use this option - explicitly because some users have experienced problems with - shutting down the MySQL server when named pipes were used. The - default is to use TCP/IP regardless of platform because named - pipes are slower than TCP/IP in many Windows configurations. + MySQL supports TCP/IP on all Windows platforms. MySQL servers + on Windows also support named pipes, if you start the server + with the --enable-named-pipe option. It is necessary to use + this option explicitly because some users have experienced + problems with shutting down the MySQL server when named pipes + were used. The default is to use TCP/IP regardless of + platform because named pipes are slower than TCP/IP in many + Windows configurations. -2.3.5.4. Starting the Server for the First Time +2.3.5.4 Starting the Server for the First Time This section gives a general overview of starting the MySQL - server. The following sections provide more specific information - for starting the MySQL server from the command line or as a - Windows service. + server. The following sections provide more specific + information for starting the MySQL server from the command + line or as a Windows service. The information here applies primarily if you installed MySQL - using the Noinstall version, or if you wish to configure and test - MySQL manually rather than with the GUI tools. + using the Noinstall version, or if you wish to configure and + test MySQL manually rather than with the GUI tools. Note - The MySQL server will automatically start after using the MySQL - Installer, and the MySQL Notifier for Microsoft Windows GUI can be - used to start/stop/restart at any time. + The MySQL server will automatically start after using the + MySQL Installer, and the MySQL Notifier GUI can be used to + start/stop/restart at any time. The examples in these sections assume that MySQL is installed - under the default location of C:\Program Files\MySQL\MySQL Server - 5.6. Adjust the path names shown in the examples if you have MySQL - installed in a different location. + under the default location of C:\Program Files\MySQL\MySQL + Server 5.6. Adjust the path names shown in the examples if + you have MySQL installed in a different location. - Clients have two options. They can use TCP/IP, or they can use a - named pipe if the server supports named-pipe connections. + Clients have two options. They can use TCP/IP, or they can + use a named pipe if the server supports named-pipe + connections. - MySQL for Windows also supports shared-memory connections if the - server is started with the --shared-memory option. Clients can - connect through shared memory by using the --protocol=MEMORY - option. + MySQL for Windows also supports shared-memory connections if + the server is started with the --shared-memory option. + Clients can connect through shared memory by using the + --protocol=MEMORY option. For information about which server binary to run, see Section 2.3.5.3, "Selecting a MySQL Server Type." - Testing is best done from a command prompt in a console window (or - "DOS window"). In this way you can have the server display status - messages in the window where they are easy to see. If something is - wrong with your configuration, these messages make it easier for - you to identify and fix any problems. + Testing is best done from a command prompt in a console + window (or "DOS window"). In this way you can have the server + display status messages in the window where they are easy to + see. If something is wrong with your configuration, these + messages make it easier for you to identify and fix any + problems. To start the server, enter this command: C:\> "C:\Program Files\MySQL\MySQL Server 5.6\bin\mysqld" --console For a server that includes InnoDB support, you should see the - messages similar to those following as it starts (the path names - and sizes may differ): + messages similar to those following as it starts (the path + names and sizes may differ): InnoDB: The first specified datafile c:\ibdata\ibdata1 did not exist: InnoDB: a new database to be created! InnoDB: Setting file c:\ibdata\ibdata1 size to 209715200 InnoDB: Database physically writes the file full: wait... -InnoDB: Log file c:\iblogs\ib_logfile0 did not exist: new to be creat -ed +InnoDB: Log file c:\iblogs\ib_logfile0 did not exist: new to be create +d InnoDB: Setting log file c:\iblogs\ib_logfile0 size to 31457280 -InnoDB: Log file c:\iblogs\ib_logfile1 did not exist: new to be creat -ed +InnoDB: Log file c:\iblogs\ib_logfile1 did not exist: new to be create +d InnoDB: Setting log file c:\iblogs\ib_logfile1 size to 31457280 -InnoDB: Log file c:\iblogs\ib_logfile2 did not exist: new to be creat -ed +InnoDB: Log file c:\iblogs\ib_logfile2 did not exist: new to be create +d InnoDB: Setting log file c:\iblogs\ib_logfile2 size to 31457280 InnoDB: Doublewrite buffer not found: creating new InnoDB: Doublewrite buffer created @@ -2197,159 +2536,170 @@ InnoDB: foreign key constraint system tables created 011024 10:58:25 InnoDB: Started When the server finishes its startup sequence, you should see - something like this, which indicates that the server is ready to - service client connections: + something like this, which indicates that the server is ready + to service client connections: mysqld: ready for connections -Version: '5.6.17' socket: '' port: 3306 +Version: '5.6.23' socket: '' port: 3306 The server continues to write to the console any further - diagnostic output it produces. You can open a new console window - in which to run client programs. - - If you omit the --console option, the server writes diagnostic - output to the error log in the data directory (C:\Program - Files\MySQL\MySQL Server 5.6\data by default). The error log is - the file with the .err extension, and may be set using the - --log-error option. + diagnostic output it produces. You can open a new console + window in which to run client programs. + + If you omit the --console option, the server writes + diagnostic output to the error log in the data directory + (C:\Program Files\MySQL\MySQL Server 5.6\data by default). + The error log is the file with the .err extension, and may be + set using the --log-error option. Note - The accounts that are listed in the MySQL grant tables initially - have no passwords. After starting the server, you should set up - passwords for them using the instructions in Section 2.10.2, - "Securing the Initial MySQL Accounts." + The accounts that are listed in the MySQL grant tables + initially have no passwords. After starting the server, you + should set up passwords for them using the instructions in + Section 2.10.2, "Securing the Initial MySQL Accounts." -2.3.5.5. Starting MySQL from the Windows Command Line +2.3.5.5 Starting MySQL from the Windows Command Line - The MySQL server can be started manually from the command line. - This can be done on any version of Windows. + The MySQL server can be started manually from the command + line. This can be done on any version of Windows. Note - The MySQL Notifier for Microsoft Windows GUI can also be used to - start/stop/restart the MySQL server. + The MySQL Notifier GUI can also be used to start/stop/restart + the MySQL server. - To start the mysqld server from the command line, you should start - a console window (or "DOS window") and enter this command: + To start the mysqld server from the command line, you should + start a console window (or "DOS window") and enter this + command: C:\> "C:\Program Files\MySQL\MySQL Server 5.6\bin\mysqld" - The path to mysqld may vary depending on the install location of - MySQL on your system. + The path to mysqld may vary depending on the install location + of MySQL on your system. You can stop the MySQL server by executing this command: C:\> "C:\Program Files\MySQL\MySQL Server 5.6\bin\mysqladmin" -u root - shutdown +shutdown + + Note + + If the MySQL root user account has a password, you need to + invoke mysqladmin with the -p option and supply the password + when prompted. + This command invokes the MySQL administrative utility + mysqladmin to connect to the server and tell it to shut down. + The command connects as the MySQL root user, which is the + default administrative account in the MySQL grant system. Note - If the MySQL root user account has a password, you need to invoke - mysqladmin with the -p option and supply the password when - prompted. - - This command invokes the MySQL administrative utility mysqladmin - to connect to the server and tell it to shut down. The command - connects as the MySQL root user, which is the default - administrative account in the MySQL grant system. Note that users - in the MySQL grant system are wholly independent from any login - users under Windows. - - If mysqld doesn't start, check the error log to see whether the - server wrote any messages there to indicate the cause of the - problem. By default, the error log is located in the C:\Program - Files\MySQL\MySQL Server 5.6\data directory. It is the file with a - suffix of .err, or may be specified by passing in the --log-error - option. Alternatively, you can try to start the server as mysqld - --console; in this case, you may get some useful information on - the screen that may help solve the problem. + Users in the MySQL grant system are wholly independent from + any login users under Microsoft Windows. + + If mysqld doesn't start, check the error log to see whether + the server wrote any messages there to indicate the cause of + the problem. By default, the error log is located in the + C:\Program Files\MySQL\MySQL Server 5.6\data directory. It is + the file with a suffix of .err, or may be specified by + passing in the --log-error option. Alternatively, you can try + to start the server with the --console option; in this case, + the server may display some useful information on the screen + that will help solve the problem. The last option is to start mysqld with the --standalone and --debug options. In this case, mysqld writes a log file - C:\mysqld.trace that should contain the reason why mysqld doesn't - start. See Section 23.4.3, "The DBUG Package." + C:\mysqld.trace that should contain the reason why mysqld + doesn't start. See Section 24.4.3, "The DBUG Package." - Use mysqld --verbose --help to display all the options that mysqld - supports. + Use mysqld --verbose --help to display all the options that + mysqld supports. -2.3.5.6. Customizing the PATH for MySQL Tools +2.3.5.6 Customizing the PATH for MySQL Tools - To make it easier to invoke MySQL programs, you can add the path - name of the MySQL bin directory to your Windows system PATH - environment variable: + To make it easier to invoke MySQL programs, you can add the + path name of the MySQL bin directory to your Windows system + PATH environment variable: - * On the Windows desktop, right-click the My Computer icon, and - select Properties. + * On the Windows desktop, right-click the My Computer icon, + and select Properties. - * Next select the Advanced tab from the System Properties menu - that appears, and click the Environment Variables button. + * Next select the Advanced tab from the System Properties + menu that appears, and click the Environment Variables + button. - * Under System Variables, select Path, and then click the Edit - button. The Edit System Variable dialogue should appear. + * Under System Variables, select Path, and then click the + Edit button. The Edit System Variable dialogue should + appear. * Place your cursor at the end of the text appearing in the - space marked Variable Value. (Use the End key to ensure that - your cursor is positioned at the very end of the text in this - space.) Then enter the complete path name of your MySQL bin - directory (for example, C:\Program Files\MySQL\MySQL Server - 5.6\bin) + space marked Variable Value. (Use the End key to ensure + that your cursor is positioned at the very end of the + text in this space.) Then enter the complete path name of + your MySQL bin directory (for example, C:\Program + Files\MySQL\MySQL Server 5.6\bin) Note - There must be a semicolon separating this path from any values - present in this field. - Dismiss this dialogue, and each dialogue in turn, by clicking - OK until all of the dialogues that were opened have been - dismissed. You should now be able to invoke any MySQL - executable program by typing its name at the DOS prompt from - any directory on the system, without having to supply the - path. This includes the servers, the mysql client, and all - MySQL command-line utilities such as mysqladmin and mysqldump. - You should not add the MySQL bin directory to your Windows - PATH if you are running multiple MySQL servers on the same - machine. + There must be a semicolon separating this path from any + values present in this field. + Dismiss this dialogue, and each dialogue in turn, by + clicking OK until all of the dialogues that were opened + have been dismissed. You should now be able to invoke any + MySQL executable program by typing its name at the DOS + prompt from any directory on the system, without having + to supply the path. This includes the servers, the mysql + client, and all MySQL command-line utilities such as + mysqladmin and mysqldump. + You should not add the MySQL bin directory to your + Windows PATH if you are running multiple MySQL servers on + the same machine. Warning You must exercise great care when editing your system PATH by - hand; accidental deletion or modification of any portion of the - existing PATH value can leave you with a malfunctioning or even - unusable system. - -2.3.5.7. Starting MySQL as a Windows Service - - On Windows, the recommended way to run MySQL is to install it as a - Windows service, so that MySQL starts and stops automatically when - Windows starts and stops. A MySQL server installed as a service - can also be controlled from the command line using NET commands, - or with the graphical Services utility. Generally, to install - MySQL as a Windows service you should be logged in using an - account that has administrator rights. + hand; accidental deletion or modification of any portion of + the existing PATH value can leave you with a malfunctioning + or even unusable system. + +2.3.5.7 Starting MySQL as a Windows Service + + On Windows, the recommended way to run MySQL is to install it + as a Windows service, so that MySQL starts and stops + automatically when Windows starts and stops. A MySQL server + installed as a service can also be controlled from the + command line using NET commands, or with the graphical + Services utility. Generally, to install MySQL as a Windows + service you should be logged in using an account that has + administrator rights. Note - The MySQL Notifier for Microsoft Windows GUI can also be used to - monitor the status of the MySQL service. + The MySQL Notifier GUI can also be used to monitor the status + of the MySQL service. - The Services utility (the Windows Service Control Manager) can be - found in the Windows Control Panel (under Administrative Tools on - Windows 2000, XP, Vista, and Server 2003). To avoid conflicts, it - is advisable to close the Services utility while performing server - installation or removal operations from the command line. + The Services utility (the Windows Service Control Manager) + can be found in the Windows Control Panel (under + Administrative Tools on Windows 2000, XP, Vista, and Server + 2003). To avoid conflicts, it is advisable to close the + Services utility while performing server installation or + removal operations from the command line. Installing the service - Before installing MySQL as a Windows service, you should first - stop the current server if it is running by using the following - command: + Before installing MySQL as a Windows service, you should + first stop the current server if it is running by using the + following command: C:\> "C:\Program Files\MySQL\MySQL Server 5.6\bin\mysqladmin" -u root shutdown Note - If the MySQL root user account has a password, you need to invoke - mysqladmin with the -p option and supply the password when - prompted. + If the MySQL root user account has a password, you need to + invoke mysqladmin with the -p option and supply the password + when prompted. + + This command invokes the MySQL administrative utility + mysqladmin to connect to the server and tell it to shut down. + The command connects as the MySQL root user, which is the + default administrative account in the MySQL grant system. + Note - This command invokes the MySQL administrative utility mysqladmin - to connect to the server and tell it to shut down. The command - connects as the MySQL root user, which is the default - administrative account in the MySQL grant system. Note that users - in the MySQL grant system are wholly independent from any login - users under Windows. + Users in the MySQL grant system are wholly independent from + any login users under Windows. Install the server as a service using this command: C:\> "C:\Program Files\MySQL\MySQL Server 5.6\bin\mysqld" --install @@ -2357,187 +2707,196 @@ C:\> "C:\Program Files\MySQL\MySQL Server 5.6\bin\mysqld" --install The service-installation command does not start the server. Instructions for that are given later in this section. - To make it easier to invoke MySQL programs, you can add the path - name of the MySQL bin directory to your Windows system PATH - environment variable: + To make it easier to invoke MySQL programs, you can add the + path name of the MySQL bin directory to your Windows system + PATH environment variable: - * On the Windows desktop, right-click the My Computer icon, and - select Properties. + * On the Windows desktop, right-click the My Computer icon, + and select Properties. - * Next select the Advanced tab from the System Properties menu - that appears, and click the Environment Variables button. + * Next select the Advanced tab from the System Properties + menu that appears, and click the Environment Variables + button. - * Under System Variables, select Path, and then click the Edit - button. The Edit System Variable dialogue should appear. + * Under System Variables, select Path, and then click the + Edit button. The Edit System Variable dialogue should + appear. * Place your cursor at the end of the text appearing in the - space marked Variable Value. (Use the End key to ensure that - your cursor is positioned at the very end of the text in this - space.) Then enter the complete path name of your MySQL bin - directory (for example, C:\Program Files\MySQL\MySQL Server - 5.6\bin), Note that there should be a semicolon separating - this path from any values present in this field. Dismiss this - dialogue, and each dialogue in turn, by clicking OK until all - of the dialogues that were opened have been dismissed. You - should now be able to invoke any MySQL executable program by - typing its name at the DOS prompt from any directory on the - system, without having to supply the path. This includes the - servers, the mysql client, and all MySQL command-line - utilities such as mysqladmin and mysqldump. - You should not add the MySQL bin directory to your Windows - PATH if you are running multiple MySQL servers on the same - machine. + space marked Variable Value. (Use the End key to ensure + that your cursor is positioned at the very end of the + text in this space.) Then enter the complete path name of + your MySQL bin directory (for example, C:\Program + Files\MySQL\MySQL Server 5.6\bin), and there should be a + semicolon separating this path from any values present in + this field. Dismiss this dialogue, and each dialogue in + turn, by clicking OK until all of the dialogues that were + opened have been dismissed. You should now be able to + invoke any MySQL executable program by typing its name at + the DOS prompt from any directory on the system, without + having to supply the path. This includes the servers, the + mysql client, and all MySQL command-line utilities such + as mysqladmin and mysqldump. + You should not add the MySQL bin directory to your + Windows PATH if you are running multiple MySQL servers on + the same machine. Warning You must exercise great care when editing your system PATH by - hand; accidental deletion or modification of any portion of the - existing PATH value can leave you with a malfunctioning or even - unusable system. + hand; accidental deletion or modification of any portion of + the existing PATH value can leave you with a malfunctioning + or even unusable system. - The following additional arguments can be used when installing the - service: + The following additional arguments can be used when + installing the service: * You can specify a service name immediately following the --install option. The default service name is MySQL. - * If a service name is given, it can be followed by a single - option. By convention, this should be - --defaults-file=file_name to specify the name of an option - file from which the server should read options when it starts. + * If a service name is given, it can be followed by a + single option. By convention, this should be + --defaults-file=file_name to specify the name of an + option file from which the server should read options + when it starts. The use of a single option other than --defaults-file is - possible but discouraged. --defaults-file is more flexible - because it enables you to specify multiple startup options for - the server by placing them in the named option file. + possible but discouraged. --defaults-file is more + flexible because it enables you to specify multiple + startup options for the server by placing them in the + named option file. - * You can also specify a --local-service option following the - service name. This causes the server to run using the + * You can also specify a --local-service option following + the service name. This causes the server to run using the LocalService Windows account that has limited system - privileges. This account is available only for Windows XP or - newer. If both --defaults-file and --local-service are given - following the service name, they can be in any order. - - For a MySQL server that is installed as a Windows service, the - following rules determine the service name and option files that - the server uses: - - * If the service-installation command specifies no service name - or the default service name (MySQL) following the --install - option, the server uses the a service name of MySQL and reads - options from the [mysqld] group in the standard option files. - - * If the service-installation command specifies a service name - other than MySQL following the --install option, the server - uses that service name. It reads options from the [mysqld] - group and the group that has the same name as the service in - the standard option files. This enables you to use the - [mysqld] group for options that should be used by all MySQL - services, and an option group with the service name for use by - the server installed with that service name. + privileges. This account is available only for Windows XP + or newer. If both --defaults-file and --local-service are + given following the service name, they can be in any + order. + + For a MySQL server that is installed as a Windows service, + the following rules determine the service name and option + files that the server uses: + + * If the service-installation command specifies no service + name or the default service name (MySQL) following the + --install option, the server uses the a service name of + MySQL and reads options from the [mysqld] group in the + standard option files. + + * If the service-installation command specifies a service + name other than MySQL following the --install option, the + server uses that service name. It reads options from the + [mysqld] group and the group that has the same name as + the service in the standard option files. This enables + you to use the [mysqld] group for options that should be + used by all MySQL services, and an option group with the + service name for use by the server installed with that + service name. * If the service-installation command specifies a --defaults-file option after the service name, the server - reads options the same way as described in the previous item, - except that it reads options only from the the named file and - ignores the standard option files. + reads options the same way as described in the previous + item, except that it reads options only from the named + file and ignores the standard option files. As a more complex example, consider the following command: C:\> "C:\Program Files\MySQL\MySQL Server 5.6\bin\mysqld" --install MySQL --defaults-file=C:\my-opts.cnf Here, the default service name (MySQL) is given after the - --install option. If no --defaults-file option had been given, - this command would have the effect of causing the server to read - the [mysqld] group from the standard option files. However, - because the --defaults-file option is present, the server reads - options from the [mysqld] option group, and only from the named - file. + --install option. If no --defaults-file option had been + given, this command would have the effect of causing the + server to read the [mysqld] group from the standard option + files. However, because the --defaults-file option is + present, the server reads options from the [mysqld] option + group, and only from the named file. Note - On Windows, if the server is started with the --defaults-file and - --install options, --install must be first. Otherwise, mysqld.exe - will attempt to start the MySQL server. + On Windows, if the server is started with the --defaults-file + and --install options, --install must be first. Otherwise, + mysqld.exe will attempt to start the MySQL server. - You can also specify options as Start parameters in the Windows - Services utility before you start the MySQL service. + You can also specify options as Start parameters in the + Windows Services utility before you start the MySQL service. Starting the service Once a MySQL server has been installed as a service, Windows starts the service automatically whenever Windows starts. The - service also can be started immediately from the Services utility, - or by using a NET START MySQL command. The NET command is not case - sensitive. - - When run as a service, mysqld has no access to a console window, - so no messages can be seen there. If mysqld does not start, check - the error log to see whether the server wrote any messages there - to indicate the cause of the problem. The error log is located in - the MySQL data directory (for example, C:\Program - Files\MySQL\MySQL Server 5.6\data). It is the file with a suffix - of .err. + service also can be started immediately from the Services + utility, or by using a NET START MySQL command. The NET + command is not case sensitive. + + When run as a service, mysqld has no access to a console + window, so no messages can be seen there. If mysqld does not + start, check the error log to see whether the server wrote + any messages there to indicate the cause of the problem. The + error log is located in the MySQL data directory (for + example, C:\Program Files\MySQL\MySQL Server 5.6\data). It is + the file with a suffix of .err. When a MySQL server has been installed as a service, and the - service is running, Windows stops the service automatically when - Windows shuts down. The server also can be stopped manually by - using the Services utility, the NET STOP MySQL command, or the - mysqladmin shutdown command. + service is running, Windows stops the service automatically + when Windows shuts down. The server also can be stopped + manually by using the Services utility, the NET STOP MySQL + command, or the mysqladmin shutdown command. You also have the choice of installing the server as a manual service if you do not wish for the service to be started automatically during the boot process. To do this, use the --install-manual option rather than the --install option: -C:\> "C:\Program Files\MySQL\MySQL Server 5.6\bin\mysqld" --install-m -anual +C:\> "C:\Program Files\MySQL\MySQL Server 5.6\bin\mysqld" --install-ma +nual Removing the service - To remove a server that is installed as a service, first stop it - if it is running by executing NET STOP MySQL. Then use the + To remove a server that is installed as a service, first stop + it if it is running by executing NET STOP MySQL. Then use the --remove option to remove it: C:\> "C:\Program Files\MySQL\MySQL Server 5.6\bin\mysqld" --remove - If mysqld is not running as a service, you can start it from the - command line. For instructions, see Section 2.3.5.5, "Starting - MySQL from the Windows Command Line." + If mysqld is not running as a service, you can start it from + the command line. For instructions, see Section 2.3.5.5, + "Starting MySQL from the Windows Command Line." - If you encounter difficulties during installation. see Section - 2.3.6, "Troubleshooting a Microsoft Windows MySQL Server - Installation." + If you encounter difficulties during installation. see + Section 2.3.6, "Troubleshooting a Microsoft Windows MySQL + Server Installation." -2.3.5.8. Testing The MySQL Installation +2.3.5.8 Testing The MySQL Installation - You can test whether the MySQL server is working by executing any - of the following commands: + You can test whether the MySQL server is working by executing + any of the following commands: C:\> "C:\Program Files\MySQL\MySQL Server 5.6\bin\mysqlshow" -C:\> "C:\Program Files\MySQL\MySQL Server 5.6\bin\mysqlshow" -u root -mysql +C:\> "C:\Program Files\MySQL\MySQL Server 5.6\bin\mysqlshow" -u root m +ysql C:\> "C:\Program Files\MySQL\MySQL Server 5.6\bin\mysqladmin" version - status proc +status proc C:\> "C:\Program Files\MySQL\MySQL Server 5.6\bin\mysql" test - If mysqld is slow to respond to TCP/IP connections from client - programs, there is probably a problem with your DNS. In this case, - start mysqld with the --skip-name-resolve option and use only - localhost and IP addresses in the Host column of the MySQL grant - tables. + If mysqld is slow to respond to TCP/IP connections from + client programs, there is probably a problem with your DNS. + In this case, start mysqld with the --skip-name-resolve + option and use only localhost and IP addresses in the Host + column of the MySQL grant tables. - You can force a MySQL client to use a named-pipe connection rather - than TCP/IP by specifying the --pipe or --protocol=PIPE option, or - by specifying . (period) as the host name. Use the --socket option - to specify the name of the pipe if you do not want to use the - default pipe name. + You can force a MySQL client to use a named-pipe connection + rather than TCP/IP by specifying the --pipe or + --protocol=PIPE option, or by specifying . (period) as the + host name. Use the --socket option to specify the name of the + pipe if you do not want to use the default pipe name. - Note that if you have set a password for the root account, deleted - the anonymous account, or created a new user account, then to - connect to the MySQL server you must use the appropriate -u and -p - options with the commands shown previously. See Section 4.2.2, - "Connecting to the MySQL Server." + If you have set a password for the root account, deleted the + anonymous account, or created a new user account, then to + connect to the MySQL server you must use the appropriate -u + and -p options with the commands shown previously. See + Section 4.2.2, "Connecting to the MySQL Server." For more information about mysqlshow, see Section 4.5.6, - "mysqlshow --- Display Database, Table, and Column Information." + "mysqlshow --- Display Database, Table, and Column + Information." -2.3.6. Troubleshooting a Microsoft Windows MySQL Server Installation +2.3.6 Troubleshooting a Microsoft Windows MySQL Server Installation When installing and running MySQL for the first time, you may encounter certain errors that prevent the MySQL server from @@ -2546,99 +2905,114 @@ C:\> "C:\Program Files\MySQL\MySQL Server 5.6\bin\mysql" test Your first resource when troubleshooting server issues is the error log. The MySQL server uses the error log to record - information relevant to the error that prevents the server from - starting. The error log is located in the data directory specified - in your my.ini file. The default data directory location is - C:\Program Files\MySQL\MySQL Server 5.6\data, or - C:\ProgramData\Mysql on Windows 7 and Windows Server 2008. The - C:\ProgramData directory is hidden by default. You need to change - your folder options to see the directory and contents. For more - information on the error log and understanding the content, see - Section 5.2.2, "The Error Log." + information relevant to the error that prevents the server + from starting. The error log is located in the data directory + specified in your my.ini file. The default data directory + location is C:\Program Files\MySQL\MySQL Server 5.6\data, or + C:\ProgramData\Mysql on Windows 7 and Windows Server 2008. + The C:\ProgramData directory is hidden by default. You need + to change your folder options to see the directory and + contents. For more information on the error log and + understanding the content, see Section 5.2.2, "The Error + Log." For information regarding possible errors, also consult the - console messages displayed when the MySQL service is starting. Use - the NET START MySQL command from the command line after installing - mysqld as a service to see any error messages regarding the - starting of the MySQL server as a service. See Section 2.3.5.7, - "Starting MySQL as a Windows Service." + console messages displayed when the MySQL service is + starting. Use the NET START MySQL command from the command + line after installing mysqld as a service to see any error + messages regarding the starting of the MySQL server as a + service. See Section 2.3.5.7, "Starting MySQL as a Windows + Service." - The following examples show other common error messages you might - encounter when installing MySQL and starting the server for the - first time: + The following examples show other common error messages you + might encounter when installing MySQL and starting the server + for the first time: - * If the MySQL server cannot find the mysql privileges database - or other critical files, it displays these messages: + * If the MySQL server cannot find the mysql privileges + database or other critical files, it displays these + messages: System error 1067 has occurred. Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist + These messages often occur when the MySQL base or data directories are installed in different locations than the - default locations (C:\Program Files\MySQL\MySQL Server 5.6 and - C:\Program Files\MySQL\MySQL Server 5.6\data, respectively). - This situation can occur when MySQL is upgraded and installed - to a new location, but the configuration file is not updated - to reflect the new location. In addition, old and new - configuration files might conflict. Be sure to delete or - rename any old configuration files when upgrading MySQL. + default locations (C:\Program Files\MySQL\MySQL Server + 5.6 and C:\Program Files\MySQL\MySQL Server 5.6\data, + respectively). + This situation can occur when MySQL is upgraded and + installed to a new location, but the configuration file + is not updated to reflect the new location. In addition, + old and new configuration files might conflict. Be sure + to delete or rename any old configuration files when + upgrading MySQL. If you have installed MySQL to a directory other than - C:\Program Files\MySQL\MySQL Server 5.6, ensure that the MySQL - server is aware of this through the use of a configuration - (my.ini) file. Put the my.ini file in your Windows directory, - typically C:\WINDOWS. To determine its exact location from the - value of the WINDIR environment variable, issue the following - command from the command prompt: + C:\Program Files\MySQL\MySQL Server 5.6, ensure that the + MySQL server is aware of this through the use of a + configuration (my.ini) file. Put the my.ini file in your + Windows directory, typically C:\WINDOWS. To determine its + exact location from the value of the WINDIR environment + variable, issue the following command from the command + prompt: C:\> echo %WINDIR% - You can create or modify an option file with any text editor, - such as Notepad. For example, if MySQL is installed in - E:\mysql and the data directory is D:\MySQLdata, you can - create the option file and set up a [mysqld] section to - specify values for the basedir and datadir options: + + You can create or modify an option file with any text + editor, such as Notepad. For example, if MySQL is + installed in E:\mysql and the data directory is + D:\MySQLdata, you can create the option file and set up a + [mysqld] section to specify values for the basedir and + datadir options: [mysqld] # set basedir to your installation path basedir=E:/mysql # set datadir to the location of your data directory datadir=D:/MySQLdata - Note that Windows path names are specified in option files - using (forward) slashes rather than backslashes. If you do use - backslashes, double them: + + Microsoft Windows path names are specified in option + files using (forward) slashes rather than backslashes. If + you do use backslashes, double them: [mysqld] # set basedir to your installation path basedir=C:\\Program Files\\MySQL\\MySQL Server 5.6 # set datadir to the location of your data directory datadir=D:\\MySQLdata - The rules for use of backslash in option file values are given - in Section 4.2.3.3, "Using Option Files." - If you change the datadir value in your MySQL configuration - file, you must move the contents of the existing MySQL data - directory before restarting the MySQL server. + + The rules for use of backslash in option file values are + given in Section 4.2.6, "Using Option Files." + If you change the datadir value in your MySQL + configuration file, you must move the contents of the + existing MySQL data directory before restarting the MySQL + server. See Section 2.3.5.2, "Creating an Option File." - * If you reinstall or upgrade MySQL without first stopping and - removing the existing MySQL service and install MySQL using - the MySQL Installer, you might see this error: + * If you reinstall or upgrade MySQL without first stopping + and removing the existing MySQL service and install MySQL + using the MySQL Installer, you might see this error: Error: Cannot create Windows service for MySql. Error: 0 - This occurs when the Configuration Wizard tries to install the - service and finds an existing service with the same name. - One solution to this problem is to choose a service name other - than mysql when using the configuration wizard. This enables - the new service to be installed correctly, but leaves the - outdated service in place. Although this is harmless, it is - best to remove old services that are no longer in use. + + This occurs when the Configuration Wizard tries to + install the service and finds an existing service with + the same name. + One solution to this problem is to choose a service name + other than mysql when using the configuration wizard. + This enables the new service to be installed correctly, + but leaves the outdated service in place. Although this + is harmless, it is best to remove old services that are + no longer in use. To permanently remove the old mysql service, execute the - following command as a user with administrative privileges, on - the command line: + following command as a user with administrative + privileges, on the command line: C:\> sc delete mysql [SC] DeleteService SUCCESS + If the sc utility is not available for your version of Windows, download the delsrv utility from - http://www.microsoft.com/windows2000/techinfo/reskit/tools/exi - sting/delsrv-o.asp and use the delsrv mysql syntax. + http://www.microsoft.com/windows2000/techinfo/reskit/tool + s/existing/delsrv-o.asp and use the delsrv mysql syntax. -2.3.7. Upgrading MySQL on Windows +2.3.7 Upgrading MySQL on Windows - This section lists some of the steps to take when upgrading MySQL - on Windows. + To upgrade MySQL on Windows, follow these steps: 1. Review Section 2.11.1, "Upgrading MySQL," for additional information on upgrading MySQL that is not specific to @@ -2652,93 +3026,124 @@ C:\> sc delete mysql http://dev.mysql.com/downloads/. 4. Before upgrading MySQL, stop the server. If the server is - installed as a service, stop the service with the following - command from the command prompt: + installed as a service, stop the service with the + following command from the command prompt: C:\> NET STOP MySQL + If you are not running the MySQL server as a service, use mysqladmin to stop it. For example, before upgrading from - MySQL 5.5 to 5.6, use mysqladmin from MySQL 5.5 as follows: + MySQL 5.5 to 5.6, use mysqladmin from MySQL 5.5 as + follows: C:\> "C:\Program Files\MySQL\MySQL Server 5.5\bin\mysqladmin" -u root - shutdown +shutdown + Note If the MySQL root user account has a password, invoke - mysqladmin with the -p option and supply the password when + mysqladmin with the -p option and enter the password when prompted. 5. Before upgrading to MySQL 5.6 from a version previous to - 4.1.5, or from a version of MySQL installed from a Zip archive - to a version of MySQL installed with the MySQL Installation - Wizard, you must first manually remove the previous - installation and MySQL service (if the server is installed as - a service). + 4.1.5, or from a version of MySQL installed from a Zip + archive to a version of MySQL installed with the MySQL + Installation Wizard, you must first manually remove the + previous installation and MySQL service (if the server is + installed as a service). To remove the MySQL service, use the following command: C:\> C:\mysql\bin\mysqld --remove + If you do not remove the existing service, the MySQL - Installation Wizard may fail to properly install the new MySQL - service. - - 6. If you are using the MySQL Installer, start it as described in - Section 2.3.3, "Installing MySQL on Microsoft Windows Using - MySQL Installer." - - 7. If you are installing MySQL from a Zip archive, extract the - archive. You may either overwrite your existing MySQL - installation (usually located at C:\mysql), or install it into - a different directory, such as C:\mysql5. Overwriting the - existing installation is recommended. - - 8. If you were running MySQL as a Windows service and you had to - remove the service earlier in this procedure, reinstall the - service. (See Section 2.3.5.7, "Starting MySQL as a Windows - Service.") - - 9. Restart the server. For example, use NET START MySQL if you - run MySQL as a service, or invoke mysqld directly otherwise. + Installation Wizard may fail to properly install the new + MySQL service. + + 6. If you are using the MySQL Installer, start it as + described in Section 2.3.3, "Installing MySQL on + Microsoft Windows Using MySQL Installer." + + 7. If you are upgrading MySQL from a Zip archive, extract + the archive. You may either overwrite your existing MySQL + installation (usually located at C:\mysql), or install it + into a different directory, such as C:\mysql5. + Overwriting the existing installation is recommended. + However, for upgrades (as opposed to installing for the + first time), you must remove the data directory from your + existing MySQL installation to avoid replacing your + current data files. To do so, follow these steps: + a. Unzip the Zip archive in some location other than + your current MySQL installation + b. Remove the data directory + c. Rezip the Zip archive + d. Unzip the modified Zip archive on top of your + existing installation + Alternatively: + a. Unzip the Zip archive in some location other than + your current MySQL installation + b. Remove the data directory + c. Move the data directory from the current MySQL + installation to the location of the just-removed + data directory + d. Remove the current MySQL installation + e. Move the unzipped installation to the location of + the just-removed installation + + 8. If you were running MySQL as a Windows service and you + had to remove the service earlier in this procedure, + reinstall the service. (See Section 2.3.5.7, "Starting + MySQL as a Windows Service.") + + 9. Restart the server. For example, use NET START MySQL if + you run MySQL as a service, or invoke mysqld directly + otherwise. 10. As Administrator, run mysql_upgrade to check your tables, - attempt to repair them if necessary, and update your grant - tables if they have changed so that you can take advantage of - any new capabilities. See Section 4.4.7, "mysql_upgrade --- - Check and Upgrade MySQL Tables." - 11. If you encounter errors, see Section 2.3.6, "Troubleshooting a - Microsoft Windows MySQL Server Installation." + attempt to repair them if necessary, and update your + grant tables if they have changed so that you can take + advantage of any new capabilities. See Section 4.4.7, + "mysql_upgrade --- Check and Upgrade MySQL Tables." + 11. If you encounter errors, see Section 2.3.6, + "Troubleshooting a Microsoft Windows MySQL Server + Installation." -2.3.8. Windows Postinstallation Procedures +2.3.8 Windows Postinstallation Procedures - GUI tools exist that perform most of the tasks described below, - including: + GUI tools exist that perform most of the tasks described + below, including: - * MySQL Installer: Used to install and upgrade MySQL products. + * MySQL Installer: Used to install and upgrade MySQL + products. * MySQL Workbench: Manages the MySQL server and edits SQL queries. - * MySQL Notifier: Starts, stops, or restarts the MySQL server, - and monitors its status. + * MySQL Notifier: Starts, stops, or restarts the MySQL + server, and monitors its status. - * MySQL for Excel: Edits MySQL data with Microsoft Excel. + * MySQL for Excel + (http://dev.mysql.com/doc/mysql-for-excel/en/index.html): + Edits MySQL data with Microsoft Excel. - On Windows, you need not create the data directory and the grant - tables. MySQL Windows distributions include the grant tables with - a set of preinitialized accounts in the mysql database under the - data directory. Regarding passwords, if you installed MySQL using - the MySQL Installer, you may have already assigned passwords to - the accounts. (See Section 2.3.3, "Installing MySQL on Microsoft - Windows Using MySQL Installer.") Otherwise, use the - password-assignment procedure given in Section 2.10.2, "Securing - the Initial MySQL Accounts." + On Windows, you need not create the data directory and the + grant tables. MySQL Windows distributions include the grant + tables with a set of preinitialized accounts in the mysql + database under the data directory. Regarding passwords, if + you installed MySQL using the MySQL Installer, you may have + already assigned passwords to the accounts. (See Section + 2.3.3, "Installing MySQL on Microsoft Windows Using MySQL + Installer.") Otherwise, use the password-assignment procedure + given in Section 2.10.2, "Securing the Initial MySQL + Accounts." - Before setting up passwords, you might want to try running some - client programs to make sure that you can connect to the server - and that it is operating properly. Make sure that the server is - running (see Section 2.3.5.4, "Starting the Server for the First - Time"), and then issue the following commands to verify that you - can retrieve information from the server. You may need to specify - directory different from C:\mysql\bin on the command line. If you - used the MySQL Installer, the default directory is C:\Program - Files\MySQL\MySQL Server 5.6, and the mysql and mysqlshow client - programs are in C:\Program Files\MySQL\MySQL Server 5.6\bin. See - Section 2.3.3, "Installing MySQL on Microsoft Windows Using MySQL - Installer," for more information. + Before setting up passwords, you might want to try running + some client programs to make sure that you can connect to the + server and that it is operating properly. Make sure that the + server is running (see Section 2.3.5.4, "Starting the Server + for the First Time"), and then issue the following commands + to verify that you can retrieve information from the server. + You may need to specify directory different from C:\mysql\bin + on the command line. If you installed MySQL using MySQL + Installer, the default directory is C:\Program + Files\MySQL\MySQL Server 5.6, and the mysql and mysqlshow + client programs are in C:\Program Files\MySQL\MySQL Server + 5.6\bin. See Section 2.3.3, "Installing MySQL on Microsoft + Windows Using MySQL Installer," for more information. Use mysqlshow to see what databases exist: C:\> C:\mysql\bin\mysqlshow @@ -2750,20 +3155,22 @@ C:\> C:\mysql\bin\mysqlshow | test | +--------------------+ - The list of installed databases may vary, but will always include - the minimum of mysql and information_schema. In most cases, the - test database will also be installed automatically. - - The preceding command (and commands for other MySQL programs such - as mysql) may not work if the correct MySQL account does not - exist. For example, the program may fail with an error, or you may - not be able to view all databases. If you installed using MySQL - Installer, then the root user will have been created automatically - with the password you supplied. In this case, you should use the - -u root and -p options. (You will also need to use the -u root and - -p options if you have already secured the initial MySQL - accounts.) With -p, you will be prompted for the root password. - For example: + The list of installed databases may vary, but will always + include the minimum of mysql and information_schema. In most + cases, the test database will also be installed + automatically. + + The preceding command (and commands for other MySQL programs + such as mysql) may not work if the correct MySQL account does + not exist. For example, the program may fail with an error, + or you may not be able to view all databases. If you + installed MySQL using MySQL Installer, then the root user + will have been created automatically with the password you + supplied. In this case, you should use the -u root and -p + options. (You will also need to use the -u root and -p + options if you have already secured the initial MySQL + accounts.) With -p, you will be prompted for the root + password. For example: C:\> C:\mysql\bin\mysqlshow -u root -p Enter password: (enter root password here) +--------------------+ @@ -2774,8 +3181,8 @@ Enter password: (enter root password here) | test | +--------------------+ - If you specify a database name, mysqlshow displays a list of the - tables within the database: + If you specify a database name, mysqlshow displays a list of + the tables within the database: C:\> C:\mysql\bin\mysqlshow mysql Database: mysql +---------------------------+ @@ -2803,8 +3210,8 @@ Database: mysql | user | +---------------------------+ - Use the mysql program to select information from a table in the - mysql database: + Use the mysql program to select information from a table in + the mysql database: C:\> C:\mysql\bin\mysql -e "SELECT Host,Db,User FROM mysql.db" +------+--------+------+ | host | db | user | @@ -2813,180 +3220,160 @@ C:\> C:\mysql\bin\mysql -e "SELECT Host,Db,User FROM mysql.db" | % | test_% | | +------+--------+------+ - For more information about mysqlshow and mysql, see Section 4.5.6, - "mysqlshow --- Display Database, Table, and Column Information," - and Section 4.5.1, "mysql --- The MySQL Command-Line Tool." + For more information about mysqlshow and mysql, see Section + 4.5.6, "mysqlshow --- Display Database, Table, and Column + Information," and Section 4.5.1, "mysql --- The MySQL + Command-Line Tool." - If you are running a version of Windows that supports services, - you can set up the MySQL server to run automatically when Windows - starts. See Section 2.3.5.7, "Starting MySQL as a Windows - Service." + If you are running a version of Windows that supports + services, you can set up the MySQL server to run + automatically when Windows starts. See Section 2.3.5.7, + "Starting MySQL as a Windows Service." -2.4. Installing MySQL on Mac OS X - - MySQL for Mac OS X is available in a number of different forms: - - * Native Package Installer format, which uses the native Mac OS - X installer to walk you through the installation of MySQL. For - more information, see Section 2.4.2, "Installing MySQL on Mac - OS X Using Native Packages." You can use the package installer - with Mac OS X 10.3 and later, and the package is available for - both PowerPC and Intel architectures, and 32-bit and 64-bit - architectures. There is no Universal Binary available using - the package installation method. The user you use to perform - the installation must have administrator privileges. - - * Tar package format, which uses a file packaged using the Unix - tar and gzip commands. To use this method, you will need to - open a Terminal window. You do not need administrator - privileges using this method, as you can install the MySQL - server anywhere using this method. For more information on - using this method, you can use the generic instructions for - using a tarball, Section 2.2, "Installing MySQL on Unix/Linux - Using Generic Binaries."You can use the package installer with - Mac OS X 10.3 and later, and available for both PowerPC and - Intel architectures, and both 32-bit and 64-bit architectures. - A Universal Binary, incorporating both Power PC and Intel - architectures and 32-bit and 64-bit binaries is available. - In addition to the core installation, the Package Installer - also includes Section 2.4.3, "Installing the MySQL Startup - Item" and Section 2.4.4, "Installing and Using the MySQL - Preference Pane," both of which simplify the management of - your installation. - - * Mac OS X server includes a version of MySQL as standard. If - you want to use a more recent version than that supplied with - the Mac OS X server release, you can make use of the package - or tar formats. For more information on using the MySQL - bundled with Mac OS X, see Section 2.4.5, "Using the Bundled - MySQL on Mac OS X Server." - - For additional information on using MySQL on Mac OS X, see Section - 2.4.1, "General Notes on Installing MySQL on Mac OS X." - -2.4.1. General Notes on Installing MySQL on Mac OS X +2.4 Installing MySQL on OS X + + For a list of supported OS X versions that the MySQL server + supports, see + http://www.mysql.com/support/supportedplatforms/database.html + . + + MySQL for OS X is available in a number of different forms: + + * Native Package Installer format, which uses the native OS + X installer (DMG) to walk you through the installation of + MySQL. For more information, see Section 2.4.2, + "Installing MySQL on OS X Using Native Packages." You can + use the package installer with OS X. The user you use to + perform the installation must have administrator + privileges. + + * Tar package format, which uses a file packaged using the + Unix tar and gzip commands. To use this method, you will + need to open a Terminal window. You do not need + administrator privileges using this method, as you can + install the MySQL server anywhere using this method. For + more information on using this method, you can use the + generic instructions for using a tarball, Section 2.2, + "Installing MySQL on Unix/Linux Using Generic Binaries." + In addition to the core installation, the Package + Installer also includes Section 2.4.4, "Installing the + MySQL Startup Item" and Section 2.4.5, "Installing and + Using the MySQL Preference Pane," both of which simplify + the management of your installation. + + For additional information on using MySQL on OS X, see + Section 2.4.1, "General Notes on Installing MySQL on OS X." + +2.4.1 General Notes on Installing MySQL on OS X You should keep the following issues and notes in mind: - * The default location for the MySQL Unix socket is different on - Mac OS X and Mac OS X Server depending on the installation - type you chose. The following table shows the default - locations by installation type. - Table 2.5. MySQL Unix Socket Locations on Mac OS X by - Installation Type - - Installation Type Socket Location - Package Installer from MySQL /tmp/mysql.sock - Tarball from MySQL /tmp/mysql.sock - MySQL Bundled with Mac OS X Server /var/mysql/mysql.sock - To prevent issues, you should either change the configuration - of the socket used within your application (for example, - changing php.ini), or you should configure the socket location - using a MySQL configuration file and the socket option. For - more information, see Section 5.1.3, "Server Command Options." - - * You may need (or want) to create a specific mysql user to own - the MySQL directory and data. On Mac OS X 10.4 and lower you - can do this by using the Netinfo Manager application, located - within the Utilities folder within the Applications folder. On - Mac OS X 10.5 and later you can do this through the Directory - Utility. From Mac OS X 10.5 and later (including Mac OS X - Server 10.5) the mysql should already exist. For use in single - user mode, an entry for _mysql (note the underscore prefix) - should already exist within the system /etc/passwd file. - - * Due to a bug in the Mac OS X package installer, you may see - this error message in the destination disk selection dialog: -You cannot install this software on this disk. (null) - If this error occurs, click the Go Back button once to return - to the previous screen. Then click Continue to advance to the - destination disk selection again, and you should be able to - choose the destination disk correctly. We have reported this - bug to Apple and it is investigating this problem. + * OS X 10.4 deprecated startup items in favor of launchd + daemons, and as of OS X 10.10 (Yosemite), startup items + do not function. For these reasons, using launchd daemons + is preferred over startup items. + + * You may need (or want) to create a specific mysql user to + own the MySQL directory and data. You can do this through + the Directory Utility, and the mysql user should already + exist. For use in single user mode, an entry for _mysql + (note the underscore prefix) should already exist within + the system /etc/passwd file. * If you get an "insecure startup item disabled" error when MySQL launches, use the following procedure. Adjust the pathnames appropriately for your system. - 1. Modify the mysql.script using this command (enter it on a - single line): + 1. Modify the mysql.script using this command (enter it + on a single line): shell> sudo /Applications/TextEdit.app/Contents/MacOS/TextEdit /usr/local/mysql/support-files/mysql.server - 2. Locate the option file that defines the basedir value and - modify it to contain these lines: + + 2. Locate the option file that defines the basedir + value and modify it to contain these lines: basedir=/usr/local/mysql datadir=/usr/local/mysql/data - In the /Library/StartupItems/MySQLCOM/ directory, make - the following group ID changes from staff to wheel: + + In the /Library/StartupItems/MySQLCOM/ directory, + make the following group ID changes from staff to + wheel: shell> sudo chgrp wheel MySQLCOM StartupParameters.plist - 3. Start the server from System Preferences or Terminal.app. - * Because the MySQL package installer installs the MySQL - contents into a version and platform specific directory, you - can use this to upgrade and migrate your database between - versions. You will need to either copy the data directory from - the old version to the new version, or alternatively specify - an alternative datadir value to set location of the data - directory. + 3. Start the server from System Preferences or + Terminal.app. - * You might want to add aliases to your shell's resource file to - make it easier to access commonly used programs such as mysql - and mysqladmin from the command line. The syntax for bash is: + * Because the MySQL package installer installs the MySQL + contents into a version and platform specific directory, + you can use this to upgrade and migrate your database + between versions. You will need to either copy the data + directory from the old version to the new version, or + alternatively specify an alternative datadir value to set + location of the data directory. By default, the MySQL + directories are installed under /usr/local/. + + * You might want to add aliases to your shell's resource + file to make it easier to access commonly used programs + such as mysql and mysqladmin from the command line. The + syntax for bash is: alias mysql=/usr/local/mysql/bin/mysql alias mysqladmin=/usr/local/mysql/bin/mysqladmin + For tcsh, use: alias mysql /usr/local/mysql/bin/mysql alias mysqladmin /usr/local/mysql/bin/mysqladmin - Even better, add /usr/local/mysql/bin to your PATH environment - variable. You can do this by modifying the appropriate startup - file for your shell. For more information, see Section 4.2.1, - "Invoking MySQL Programs." - - * After you have copied over the MySQL database files from the - previous installation and have successfully started the new - server, you should consider removing the old installation - files to save disk space. Additionally, you should also remove - older versions of the Package Receipt directories located in + + Even better, add /usr/local/mysql/bin to your PATH + environment variable. You can do this by modifying the + appropriate startup file for your shell. For more + information, see Section 4.2.1, "Invoking MySQL + Programs." + + * After you have copied over the MySQL database files from + the previous installation and have successfully started + the new server, you should consider removing the old + installation files to save disk space. Additionally, you + should also remove older versions of the Package Receipt + directories located in /Library/Receipts/mysql-VERSION.pkg. -2.4.2. Installing MySQL on Mac OS X Using Native Packages + * Prior to OS X 10.7, MySQL server was bundled with OS X + Server. - You can install MySQL on Mac OS X 10.3.x ("Panther") or newer - using a Mac OS X binary package in DMG format instead of the - binary tarball distribution. Please note that older versions of - Mac OS X (for example, 10.1.x or 10.2.x) are not supported by this - package. +2.4.2 Installing MySQL on OS X Using Native Packages - The package is located inside a disk image (.dmg) file that you - first need to mount by double-clicking its icon in the Finder. It - should then mount the image and display its contents. + The package is located inside a disk image (.dmg) file that + you first need to mount by double-clicking its icon in the + Finder. It should then mount the image and display its + contents. Note Before proceeding with the installation, be sure to stop all - running MySQL server instances by using either the MySQL Manager - Application (on Mac OS X Server) or mysqladmin shutdown on the - command line. + running MySQL server instances by using either the MySQL + Manager Application (on OS X Server) or mysqladmin shutdown + on the command line. - When installing from the package version, you should also install - the MySQL Preference Pane, which will enable you to control the - startup and execution of your MySQL server from System - Preferences. For more information, see Section 2.4.4, "Installing - and Using the MySQL Preference Pane." + When installing from the package version, you can also + install the MySQL Preference Pane, which will enable you to + control the startup and execution of your MySQL server from + System Preferences. For more information, see Section 2.4.5, + "Installing and Using the MySQL Preference Pane." When installing using the package installer, the files are - installed into a directory within /usr/local matching the name of - the installation version and platform. For example, the installer - file mysql-5.1.39-osx10.5-x86_64.pkg installs MySQL into - /usr/local/mysql-5.1.39-osx10.5-x86_64 . The following table shows - the layout of the installation directory. + installed into a directory within /usr/local matching the + name of the installation version and platform. For example, + the installer file mysql-5.6-osx10.8-x86_64.dmg installs + MySQL into /usr/local/mysql-5.6-osx10.8-x86_64/ . The + following table shows the layout of the installation + directory. - Table 2.6. MySQL Installation Layout on Mac OS X + Table 2.5 MySQL Installation Layout on OS X Directory Contents of Directory bin Client programs and the mysqld server data Log files, databases - docs Manual in Info format + docs Helper documents, like the Release Notes and build + information include Include (header) files lib Libraries man Unix manual pages @@ -3003,384 +3390,492 @@ alias mysqladmin /usr/local/mysql/bin/mysqladmin created during installation will be created automatically. 1. Download and open the MySQL package installer, which is - provided on a disk image (.dmg) that includes the main MySQL - installation package, the MySQLStartupItem.pkg installation - package, and the MySQL.prefPane. Double-click the disk image - to open it. - - 2. Double-click the MySQL installer package. It will be named - according to the version of MySQL you have downloaded. For - example, if you have downloaded MySQL 5.1.39, double-click - mysql-5.1.39-osx10.5-x86.pkg. - - 3. You will be presented with the opening installer dialog. Click - Continue to begin installation. - MySQL Package Installer: Step 1 - - 4. A copy of the installation instructions and other important - information relevant to this installation are displayed. Click - Continue . - - 5. If you have downloaded the community version of MySQL, you - will be shown a copy of the relevant GNU General Public - License. Click Continue . - - 6. Select the drive you want to use to install the MySQL Startup - Item. The drive must have a valid, bootable, Mac OS X - operating system installed. Click Continue. - MySQL Package Installer: Step 4 - - 7. You will be asked to confirm the details of the installation, - including the space required for the installation. To change - the drive on which the startup item is installed, click either - Go Back or Change Install Location.... To install the startup - item, click Install. - - 8. Once the installation has been completed successfully, you - will be shown an Install Succeeded message. - - For convenience, you may also want to install the startup item and - preference pane. See Section 2.4.3, "Installing the MySQL Startup - Item," and Section 2.4.4, "Installing and Using the MySQL - Preference Pane." + provided on a disk image (.dmg) that includes the main + MySQL installation package file. Double-click the disk + image to open it. + Figure 2.40 MySQL Package Installer: DMG Contents + MySQL Package Installer: DMG Contents + + 2. Double-click the MySQL installer package. It will be + named according to the version of MySQL you have + downloaded. For example, if you have downloaded MySQL + server 5.6.23, double-click + mysql-5.6.23-osx-10.8-x86_64.pkg. + + 3. You will be presented with the opening installer dialog. + Click Continue to begin installation. + Figure 2.41 MySQL Package Installer: Introduction + MySQL Package Installer: Introduction + + 4. If you have downloaded the community version of MySQL, + you will be shown a copy of the relevant GNU General + Public License. Click Continue and then Agree to + continue. + + 5. From the Installation Type page you can either click + Install to execute the installation wizard using all + defaults, click Customize to alter which components to + install (MySQL server, Startup Item, Preference Pane -- + all enabled by default), or click Change Installation + Location to change the type of installation for either + all users, only the user executing the Installer, or + define a custom location. + Figure 2.42 MySQL Package Installer: Installation Type + MySQL Package Installer: Installation Type + Figure 2.43 MySQL Package Installer: Destination Select + (Change Installation Location) + MySQL Package Installer: Destination Select (Change + Installation Location) + Figure 2.44 MySQL Package Installer: Customize + MySQL Package Installer: Customize + + 6. Click Install to begin the installation process. + + 7. Once the installation has been completed successfully, + you will be shown an Install Succeeded message with a + short summary. Now, Close the wizard and begin using the + MySQL server. + Figure 2.45 MySQL Package Installer: Summary + MySQL Package Installer: Summary + + For convenience, you may also want to install a launch daemon + and preference pane. See Section 2.4.3, "Installing a MySQL + Launch Daemon," and Section 2.4.5, "Installing and Using the + MySQL Preference Pane." + +2.4.3 Installing a MySQL Launch Daemon + + OS X uses launch daemons to automatically start, stop, and + manage processes and applications such as MySQL. Using launch + daemons is recommended over startup items on OS X. + Note -2.4.3. Installing the MySQL Startup Item + OS X 10.4 deprecated startup items in favor of launchd + daemons, and as of OS X 10.10 (Yosemite), startup items do + not function. For these reasons, using launchd daemons is + preferred over startup items. + + Here is an example launchd file that starts MySQL: + + + + + + KeepAlive + + Label + com.mysql.mysqld + ProgramArguments + + /usr/local/mysql/bin/mysqld_safe + --user=mysql + + + + + + Adjust the ProgramArguments array according to your system, + as for example your path to mysqld_safe might be different. + After making the proper adjustments, do the following: + + * Save the XML as a file named + /Library/LaunchDaemons/com.mysql.mysql.plist + + * Adjust the file permissions using the Apple recommended + owner "root", owning group "wheel", and file permissions + "644" +shell> sudo chown root:wheel /Library/LaunchDaemons/com.mysql.mysql.pl +ist +shell> sudo chmod 644 /Library/LaunchDaemons/com.mysql.mysql.plist + + + * Enable this new MySQL service +shell> sudo launchctl load -w /Library/LaunchDaemons/com.mysql.mysql.p +list + + The MySQL daemon is now running, and automatically starts + when your system is rebooted. + +2.4.4 Installing the MySQL Startup Item + + The MySQL Installation Package includes a startup item that + can be used to automatically start and stop MySQL. + Important - The MySQL Installation Package includes a startup item that can be - used to automatically start and stop MySQL. + Startup items are deprecated in favor of launchd daemons. For + additional information, see Section 2.4.3, "Installing a + MySQL Launch Daemon." To install the MySQL Startup Item: 1. Download and open the MySQL package installer, which is - provided on a disk image (.dmg) that includes the main MySQL - installation package, the MySQLStartupItem.pkg installation - package, and the MySQL.prefPane. Double-click the disk image - to open it. - - 2. Double-click the MySQLStartItem.pkg file to start the - installation process. - - 3. You will be presented with the Install MySQL Startup Item - dialog. - MySQL Startup Item Installer: Step 1 - Click Continue to continue the installation process. + provided on a disk image (.dmg) that includes the main + MySQL installation package. + Note + Previously, the OS X packages included separate + MySQLStartupItem.pkg and MySQL.prefPane files. They have + since been merged into the main package file. + Figure 2.46 MySQL Package Installer: DMG Contents + MySQL Package Installer: DMG Contents + + 2. Go through the process of installing the MySQL server as + described in the documentation at Section 2.4.2, + "Installing MySQL on OS X Using Native Packages." + + 3. Click Customize at the Installation Type step. The + "Startup Item" option is listed there and enabled by + default. + Figure 2.47 MySQL Installer on OS X: Customize + MySQL Installer on OS X: Customize - 4. A copy of the installation instructions and other important - information relevant to this installation are displayed. Click - Continue . + 4. Complete the MySQL server installation process. - 5. Select the drive you want to use to install the MySQL Startup - Item. The drive must have a valid, bootable, Mac OS X - operating system installed. Click Continue. - MySQL Startup Item Installer: Step 3 + The Startup Item for MySQL is installed into + /Library/StartupItems/MySQLCOM. The Startup Item installation + adds a variable MYSQLCOM=-YES- to the system configuration + file /etc/hostconfig. If you want to disable the automatic + startup of MySQL, change this variable to MYSQLCOM=-NO-. + Note - 6. You will be asked to confirm the details of the installation. - To change the drive on which the startup item is installed, - click either Go Back or Change Install Location.... To install - the startup item, click Install. + Deselecting Automatically Start MySQL Server on Startup from + the MySQL Preference Pane sets the MYSQLCOM variable to -NO-. - 7. Once the installation has been completed successfully, you - will be shown an Install Succeeded message. - MySQL Startup Item Installer: Step 5 + After the installation, you can start and stop the MySQL + server from the MySQL Preference Pane (preferred), or by + running the following commands in a terminal window. You must + have administrator privileges to perform these tasks, and you + may be prompted for your password. - The Startup Item for MySQL is installed into - /Library/StartupItems/MySQLCOM. The Startup Item installation adds - a variable MYSQLCOM=-YES- to the system configuration file - /etc/hostconfig. If you want to disable the automatic startup of - MySQL, change this variable to MYSQLCOM=-NO-. - - After the installation, you can start and stop MySQL by running - the following commands in a terminal window. You must have - administrator privileges to perform these tasks, and you may be - prompted for your password. - - If you have installed the Startup Item, use this command to start - the server: + If you have installed the Startup Item, use this command to + start the server: shell> sudo /Library/StartupItems/MySQLCOM/MySQLCOM start - If you have installed the Startup Item, use this command to stop - the server: + If you have installed the Startup Item, use this command to + stop the server: shell> sudo /Library/StartupItems/MySQLCOM/MySQLCOM stop -2.4.4. Installing and Using the MySQL Preference Pane +2.4.5 Installing and Using the MySQL Preference Pane - The MySQL Package installer disk image also includes a custom - MySQL Preference Pane that enables you to start, stop, and control - automated startup during boot of your MySQL installation. + The MySQL Installation Package includes a MySQL preference + Pane that enables you to start, stop, and control automated + startup during boot of your MySQL installation. To install the MySQL Preference Pane: - 1. Download and open the MySQL package installer package, which - is provided on a disk image (.dmg) that includes the main - MySQL installation package, the MySQLStartupItem.pkg - installation package, and the MySQL.prefPane. Double-click the - disk image to open it. - - 2. Double-click the MySQL.prefPane. The MySQL System Preferences - will open. - - 3. If this is the first time you have installed the preference - pane, you will be asked to confirm installation and whether - you want to install the preference pane for all users, or only - the current user. To install the preference pane for all users - you will need administrator privileges. If necessary, you will - be prompted for the username and password for a user with - administrator privileges. + 1. Download and open the MySQL package installer, which is + provided on a disk image (.dmg) that includes the main + MySQL installation package. + Note + Previously, the OS X packages included separate + MySQLStartupItem.pkg and MySQL.prefPane files. They have + since been merged into the main package file. + Figure 2.48 MySQL Package Installer: DMG Contents + MySQL Package Installer: DMG Contents + + 2. Go through the process of installing the MySQL server, as + described in the documentation at Section 2.4.2, + "Installing MySQL on OS X Using Native Packages." + + 3. Click Customize at the Installation Type step. The + "Preference Pane" option is listed there and enabled by + default. + Figure 2.49 MySQL Installer on OS X: Customize + MySQL Installer on OS X: Customize - 4. If you already have the MySQL Preference Pane installed, you - will be asked to confirm whether you want to overwrite the - existing MySQL Preference Pane. + 4. Complete the MySQL server installation process. Note - The MySQL Preference Pane only starts and stops MySQL installation - installed from the MySQL package installation that have been - installed in the default location. - - Once the MySQL Preference Pane has been installed, you can control - your MySQL server instance using the preference pane. To use the - preference pane, open the System Preferences... from the Apple - menu. Select the MySQL preference pane by clicking the MySQL logo - within the Other section of the preference panes list. - MySQL Preference Pane - - The MySQL Preference Pane shows the current status of the MySQL - server, showing stopped (in red) if the server is not running and - running (in green) if the server has already been started. The - preference pane also shows the current setting for whether the - MySQL server has been set to start automatically. - - * To start MySQL using the preference pane: - Click Start MySQL Server. You may be prompted for the username - and password of a user with administrator privileges to start - the MySQL server. - - * To stop MySQL using the preference pane: - Click Stop MySQL Server. You may be prompted for the username - and password of a user with administrator privileges to stop - the MySQL server. - - * To automatically start the MySQL server when the system boots: - Check the check box next to Automatically Start MySQL Server - on Startup. + The MySQL Preference Pane only starts and stops MySQL + installation installed from the MySQL package installation + that have been installed in the default location. + + Once the MySQL Preference Pane has been installed, you can + control your MySQL server instance using the preference pane. + To use the preference pane, open the System Preferences... + from the Apple menu. Select the MySQL preference pane by + clicking the MySQL logo within the bottom section of the + preference panes list. + + Figure 2.50 MySQL Preference Pane: Location + MySQL Preference Pane: Location + + The MySQL Preference Pane shows the current status of the + MySQL server, showing stopped (in red) if the server is not + running and running (in green) if the server has already been + started. The preference pane also shows the current setting + for whether the MySQL server has been set to start + automatically. + + * To start the MySQL server using the preference pane: + Click Start MySQL Server. You may be prompted for the + username and password of a user with administrator + privileges to start the MySQL server. + + * To stop the MySQL server using the preference pane: + Click Stop MySQL Server. You may be prompted for the + username and password of a user with administrator + privileges to stop the MySQL server. + + * To automatically start the MySQL server when the system + boots: + Check the check box next to Automatically Start MySQL + Server on Startup. * To disable automatic MySQL server startup when the system boots: - Uncheck the check box next to Automatically Start MySQL Server - on Startup. + Uncheck the check box next to Automatically Start MySQL + Server on Startup. You can close the System Preferences... window once you have completed your settings. -2.4.5. Using the Bundled MySQL on Mac OS X Server - - If you are running Mac OS X Server, a version of MySQL should - already be installed. The following table shows the versions of - MySQL that ship with Mac OS X Server versions. +2.5 Installing MySQL on Linux - Table 2.7. MySQL Versions Preinstalled with Mac OS X Server - Mac OS X Server Version MySQL Version - 10.2-10.2.2 3.23.51 - 10.2.3-10.2.6 3.23.53 - 10.3 4.0.14 - 10.3.2 4.0.16 - 10.4.0 4.1.10a - 10.5.0 5.0.45 - 10.6.0 5.0.82 - - The following table shows the installation layout of MySQL on Mac - OS X Server. - - Table 2.8. MySQL Directory Layout for Preinstalled MySQL - Installations on Mac OS X Server - Directory Contents of Directory - /usr/bin Client programs - /var/mysql Log files, databases - /usr/libexec The mysqld server - /usr/share/man Unix manual pages - /usr/share/mysql/mysql-test MySQL test suite - /usr/share/mysql Miscellaneous support files, including error - messages, character set files, sample configuration files, SQL for - database installation - /var/mysql/mysql.sock Location of the MySQL Unix socket - -Additional Resources - - - * For more information on managing the bundled MySQL instance in - Mac OS X Server 10.5, see Mac OS X Server: Web Technologies - Administration For Version 10.5 Leopard - (http://images.apple.com/server/macosx/docs/Web_Technologies_A - dmin_v10.5.pdf). + Linux supports a number of different solutions for installing + MySQL. We recommend that you use one of the distributions + from Oracle, for which several methods for installation are + available: - * For more information on managing the bundled MySQL instance in - Mac OS X Server 10.6, see Mac OS X Server: Web Technologies - Administration Version 10.6 Snow Leopard - (http://manuals.info.apple.com/en_US/WebTech_v10.6.pdf). + * Installing with Yum using the MySQL Yum repository + (http://dev.mysql.com/downloads/repo/yum/). For details, + see Section 2.5.1, "Installing MySQL on Linux Using the + MySQL Yum Repository." - * The MySQL server bundled with Mac OS X Server does not include - the MySQL client libraries and header files required to access - and use MySQL from a third-party driver, such as Perl DBI or - PHP. For more information on obtaining and installing MySQL - libraries, see Mac OS X Server version 10.5: MySQL libraries - available for download (http://support.apple.com/kb/TA25017). - Alternatively, you can ignore the bundled MySQL server and - install MySQL from the package or tarball installation. + * Installing with APT using the MySQL APT Repository + (http://dev.mysql.com/downloads/repo/apt/). For details, + see Section 2.5.3, "Installing MySQL on Linux Using the + MySQL APT Repository." -2.5. Installing MySQL on Linux + * Installing with Zypper using the MySQL SLES Repository + (http://dev.mysql.com/downloads/repo/suse/). For details, + see Section 2.5.4, "Installing MySQL on Linux Using the + MySQL SLES Repository." - Linux supports a number of different solutions for installing - MySQL. We recommend that you use one of the distributions from - Oracle, for which several methods for installation are available: + * Installing using a precompiled RPM package. For more + information, see Section 2.5.5, "Installing MySQL on + Linux Using RPM Packages." - * Installing from a generic binary package in .tar.gz format. - See Section 2.2, "Installing MySQL on Unix/Linux Using Generic - Binaries" for more information. + * Installing using a precompiled Debian package. For more + information, see Section 2.5.6, "Installing MySQL on + Linux Using Debian Packages from Oracle." - * Extracting and compiling MySQL from a source distribution. For - detailed instructions, see Section 2.9, "Installing MySQL from - Source." + * Installing from a generic binary package in .tar.gz + format. See Section 2.2, "Installing MySQL on Unix/Linux + Using Generic Binaries" for more information. - * Installing with Yum using the MySQL Yum repository - (http://dev.mysql.com/downloads/repo/). For detailed - instructions, see Section 2.5.1, "Installing MySQL on Linux - Using the MySQL Yum Repository." + * Installing using Oracle's Unbreakable Linux Network + (ULN). For more information, see Section 2.6, "Installing + MySQL Using Unbreakable Linux Network (ULN)." - * Installing using a precompiled RPM package. For more - information, see Section 2.5.3, "Installing MySQL on Linux - Using RPM Packages." + * Extracting and compiling MySQL from a source + distribution. For detailed instructions, see Section 2.9, + "Installing MySQL from Source." - * Installing using a precompiled Debian package. For more - information, see Section 2.5.4, "Installing MySQL on Linux - Using Debian Packages." - - As an alternative, you can use the package manager on your system - to automatically download and install MySQL with packages from the - native software repositories of your Linux distribution. These - native package are often several versions behind the currently - available release. You will also normally be unable to install - development milestone releases (DMRs), as these are not usually - made available in the native repositories. For more information on - using the native package installers, see Section 2.5.5, - "Installing MySQL on Linux Using Native Package Managers." + As an alternative, you can use the package manager on your + system to automatically download and install MySQL with + packages from the native software repositories of your Linux + distribution. These native packages are often several + versions behind the currently available release. You will + also normally be unable to install development milestone + releases (DMRs), as these are not usually made available in + the native repositories. For more information on using the + native package installers, see Section 2.5.7, "Installing + MySQL on Linux from the Native Software Repositories." Note - For many Linux installations, you will want to set up MySQL to be - started automatically when your machine starts. Many of the native - package installations perform this operation for you, but for - source, binary and RPM solutions you may need to set this up - separately. The required script, mysql.server, can be found in the - support-files directory under the MySQL installation directory or - in a MySQL source tree. You can install it as /etc/init.d/mysql - for automatic MySQL startup and shutdown. See Section 2.10.1.2, - "Starting and Stopping MySQL Automatically." + For many Linux installations, you will want to set up MySQL + to be started automatically when your machine starts. Many of + the native package installations perform this operation for + you, but for source, binary and RPM solutions you may need to + set this up separately. The required script, mysql.server, + can be found in the support-files directory under the MySQL + installation directory or in a MySQL source tree. You can + install it as /etc/init.d/mysql for automatic MySQL startup + and shutdown. See Section 2.10.1.2, "Starting and Stopping + MySQL Automatically." -2.5.1. Installing MySQL on Linux Using the MySQL Yum Repository +2.5.1 Installing MySQL on Linux Using the MySQL Yum Repository - MySQL provides a Yum-style software repository for the following - Linux platforms: + MySQL provides a Yum-style software repository for the + following Linux platforms: - * EL6-based platforms (for example, Red Hat Enterprise Linux 6, - Oracle Linux 6, and CentOS 6) + * EL5, EL6, and EL7-based platforms (for example, the + corresponding versions of Red Hat Enterprise Linux, + Oracle Linux, and CentOS) - * EL5-based platforms (for example, Red Hat Enterprise Linux 5, - Oracle Linux 5, and CentOS 5) - - * Fedora 18, 19, and 20 + * Fedora 20 and 21 Currently, the MySQL Yum repository - (http://dev.mysql.com/downloads/repo/) for the above-mentioned - platforms provides RPM packages for installing the MySQL server, - client, MySQL Workbench, Connector/ODBC, and Connector/Python - (currently not available for EL5-based platforms). - - MySQL does not currently provide software repositories for other - Linux platforms. Refer to Section 2.5, "Installing MySQL on Linux" - for instructions on how to install MySQL on those platforms. - Note - - The MySQL Yum repository service is now in development release. We - encourage you to try it and provide us with feedback. Please - report any bugs or inconsistencies you observe to our Bugs - Database (http://bugs.mysql.com). + (http://dev.mysql.com/downloads/repo/yum/) for the + above-mentioned platforms provides RPM packages for + installing the MySQL server, client, MySQL Workbench, MySQL + Utilities (not available for EL5-based platforms), + Connector/ODBC, and Connector/Python (not available for + EL5-based platforms). Before You Start As a popular, open-source software, MySQL, in its original or - re-packaged form, is widely installed on many systems from various - sources, including different software download sites, software - repositories, and so on. The following instructions assume that no - versions of MySQL (whether distributed by Oracle or other parties) - have already been installed on your system; if that is not the - case, see Section 2.11.1.1, "Upgrading MySQL with the MySQL Yum - Repository" or Section 2.5.2, "Replacing a Third-Party - Distribution of MySQL Using the MySQL Yum Repository." + re-packaged form, is widely installed on many systems from + various sources, including different software download sites, + software repositories, and so on. The following instructions + assume that no versions of MySQL (whether distributed by + Oracle or other parties) have already been installed on your + system; if that is not the case, see Section 2.11.1.1, + "Upgrading MySQL with the MySQL Yum Repository" or Section + 2.5.2, "Replacing a Third-Party Distribution of MySQL Using + the MySQL Yum Repository." -Steps for a Fresh Installation of the latest GA Version of MySQL +Steps for a Fresh Installation of MySQL - Follow the steps below to install the latest GA version of MySQL - with the MySQL Yum repository: + Follow the steps below to install the latest GA version of + MySQL with the MySQL Yum repository: 1. Adding the MySQL Yum Repository First, add the MySQL Yum repository to your system's - repository list. This is a one-time operation, which can be - performed by installing an RPM provided by MySQL. Follow these - steps: + repository list. This is a one-time operation, which can + be performed by installing an RPM provided by MySQL. + Follow these steps: a. Go to the Download MySQL Yum Repository page - (http://dev.mysql.com/downloads/repo) in the MySQL - Developer Zone. + (downloads/repo/yum/ + (http://dev.mysql.com/downloads/repo/yum/)) in the + MySQL Developer Zone. b. Select and download the release package for your platform. - c. Install the downloaded release package with the following - command (except for EL5-based systems), replacing - platform-and-version-specific with the name of the - downloaded RPM file: -shell> sudo yum localinstall platform-and-version-specific.rpm - For an EL6-based system, the command is in the form of: -shell> sudo yum localinstall mysql-community-release-el6-{version-num -ber}.noarch.rpm - For Fedora 18: -shell> sudo yum localinstall mysql-community-release-fc18-{version-nu -mber}.noarch.rpm - For Fedora 19: -shell> sudo yum localinstall mysql-community-release-fc19-{version-nu -mber}.noarch.rpm + c. Install the downloaded release package with the + following command (except for EL5-based systems), + replacing platform-and-version-specific-package-name + with the name of the downloaded RPM package: +shell> sudo yum localinstall platform-and-version-specific-package-nam +e.rpm + + For an EL6-based system, the command is in the form + of: +shell> sudo yum localinstall mysql-community-release-el6-{version-numb +er}.noarch.rpm + + For an EL7-based system: +shell> sudo yum localinstall mysql-community-release-el7-{version-numb +er}.noarch.rpm + For Fedora 20: -shell> sudo yum localinstall mysql-community-release-fc20-{version-nu -mber}.noarch.rpm +shell> sudo yum localinstall mysql-community-release-fc20-{version-num +ber}.noarch.rpm + + For Fedora 21: +shell> sudo yum localinstall mysql-community-release-fc21-{version-num +ber}.noarch.rpm + For an EL5-based system, use the following command instead: -shell> sudo rpm -Uvh mysql-community-release-el5-{version-number}.noa -rch.rpm - The installation command adds the MySQL Yum repository to - your system's repository list as well as downloading the - GnuPG keys to check the integrity of the software - packages. See Section 2.1.4.2, "Signature Checking Using - GnuPG" for details on GnuPG key checking. +shell> sudo rpm -Uvh mysql-community-release-el5-{version-number}.noar +ch.rpm + + The installation command adds the MySQL Yum + repository to your system's repository list and + downloads the GnuPG key to check the integrity of + the software packages. See Section 2.1.4.2, + "Signature Checking Using GnuPG" for details on + GnuPG key checking. You can check that the MySQL Yum repository has been successfully added by the following command: -shell> sudo yum repolist enabled | grep "mysql*-community*" +shell> yum repolist enabled | grep "mysql.*-community.*" + + Note + Once the MySQL Yum repository is enabled on your system, + any system-wide update by the yum update command will + upgrade MySQL packages on your system and also replace + any native third-party packages, if Yum finds + replacements for them in the MySQL Yum repository; see + Section 2.11.1.1, "Upgrading MySQL with the MySQL Yum + Repository" and, for a discussion on some possible + effects of that on your system, see Section 2.11.1.1, "." + + 2. Selecting a Release Series Note - Once the MySQL Yum repository is enabled on your system, any - system-wide update by the yum update command will upgrade - MySQL packages on your system and also replace any native - third-party packages, if Yum finds replacements for them from - within the MySQL Yum repository; see Section 2.11.1.1, - "Upgrading MySQL with the MySQL Yum Repository" and, for a - discussion on some possible effects of that on your system, - see Section 2.11.1.1, "." - - 2. Installing MySQL with Yum + When using the MySQL Yum repository, the latest GA + release of MySQL is selected for installation by default. + If this is what you want, you can skip to the next step, + Section 2.5.1, "." + Within the MySQL Yum repository, different release series + of the MySQL Community Server are hosted in different + subrepositories. The subrepository for the latest GA + series (currently 5.6) is enabled by default, and the + subrepositories for all other series (for example, the + 5.7 series, currently still in developer milestone + release (DMR) status) are disabled by default. Use this + command to see all the subrepositories in the MySQL Yum + repository, and see which of them are enabled or + disabled: +shell> yum repolist all | grep mysql + + To install the latest release from the latest GA series, + no configuration is needed. To install the latest release + from a specific series other than the latest GA series, + disable the subrepository for the latest GA series and + enable the subrepository for the specific series before + running the installation command. If your platform + supports yum-config-manager, you can do that by issuing + these commands, which disable the subrepository for the + 5.6 series and enable the one for the 5.7 series: +shell> sudo yum-config-manager --disable mysql56-community +shell> sudo yum-config-manager --enable mysql57-community-dmr + + Besides using yum-config-manager, you can also select a + release series by editing manually the + /etc/yum.repos.d/mysql-community.repo file. This is a + typical entry for a release series' subrepository in the + file: +# Enable to use MySQL 5.6 +[mysql56-community] +name=MySQL 5.6 Community Server +baseurl=//repo.mysql.com/yum/mysql-5.6-community/el/5/$basearch/ +enabled=1 +gpgcheck=1 +gpgkey=file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql + Find the entry for the subrepository you want to + configure, and edit the enabled option. Specify enabled=0 + to disable a subrepository, or enabled=1 to enable a + subrepository. For example, to install the latest 5.7 + DMR, make sure you have enabled=0 for the above + subrepository entry for MySQL 5.6, and have enabled=1 for + the entry for the 5.7 series: +# Note: MySQL 5.7 is currently in development. For use at your own ris +k. +# Please read with sub pages: https://dev.mysql.com/doc/relnotes/mysql +/5.7/en/ +[mysql57-community-dmr] +name=MySQL 5.7 Community Server Development Milestone Release +baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/6/$basearch/ +enabled=1 +gpgcheck=1 +gpgkey=file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql + + You should only enable subrepository for one release + series at any time. When subrepositories for more than + one release series are enabled, the latest series will be + used by Yum. + Verify that the correct subrepositories have been enabled + and disabled by running the following command and + checking its output: +shell> yum repolist enabled | grep mysql + + + 3. Installing MySQL with Yum Install MySQL by the following command: -shell> sudo yum install mysql-server - This installs the package for MySQL server - (mysql-community-server) and also packages for the components - required to run the server, including packages for the client - (mysql-community-client), the common error messages and - character sets for client and server (mysql-community-common), - and the shared client libraries (mysql-community-libs). +shell> sudo yum install mysql-community-server - 3. Starting and Stopping the MySQL Server + This installs the package for MySQL server + (mysql-community-server) and also packages for the + components required to run the server, including packages + for the client (mysql-community-client), the common error + messages and character sets for client and server + (mysql-community-common), and the shared client libraries + (mysql-community-libs). + + 4. Starting and Stopping the MySQL Server Start the MySQL server with the following command: shell> sudo service mysqld start This is a sample output of the above command: @@ -3393,35 +3888,46 @@ mysqld (pid 3066) is running. Stop the MySQL server with the following command: shell> sudo service mysqld stop - 4. Securing the MySQL Installation - Always run the program mysql_secure_installation to secure - your MySQL installation: + 5. Securing the MySQL Installation + The program mysql_secure_installation allows you to + perform important operations like setting the root + password, removing anonymous users, and so on. Always run + it to secure your MySQL installation: shell> mysql_secure_installation - mysql_secure_installation allows you to perform important - operations like setting root password, removing anonymous - users, and so on. The program is safe and easy to use. It is - important to remember the root password you set though. See - Section 4.4.5, "mysql_secure_installation --- Improve MySQL - Installation Security" for details. + It is important to remember the root password you set. + See Section 4.4.5, "mysql_secure_installation --- Improve + MySQL Installation Security" for details. For more information on the postinstallation procedures, see Section 2.10, "Postinstallation Setup and Testing." + Note + + Compatibility Information for EL7-based platforms: The + following RPM packages from the native software repositories + of the platforms are incompatible with the package from the + MySQL Yum repository that installs the MySQL server. Once you + have installed MySQL using the MySQL Yum repository, you will + not be able to install these packages (and vice versa). + + * akonadi-mysql + + * ocsinventory Installing Additional MySQL Products and Components with Yum - You can use Yum to install and manage individual components of - MySQL. Some of these components are hosted in sub-repositories of - the MySQL Yum repository: for example, the MySQL Connectors are to - be found in the MySQL Connectors Community sub-repository, and the - MySQL Workbench in MySQL Tools Community. You can use the - following command to list the packages for all the MySQL - components available for your platform from the MySQL Yum - repository: -shell> sudo yum --disablerepo=\* --enablerepo='mysql*-community*' lis -t available - - Install any packages of your choice with the following command, - replacing package-name with name of the package: + You can use Yum to install and manage individual components + of MySQL. Some of these components are hosted in + sub-repositories of the MySQL Yum repository: for example, + the MySQL Connectors are to be found in the MySQL Connectors + Community sub-repository, and the MySQL Workbench in MySQL + Tools Community. You can use the following command to list + the packages for all the MySQL components available for your + platform from the MySQL Yum repository: +shell> sudo yum --disablerepo=\* --enablerepo='mysql*-community*' list + available + + Install any packages of your choice with the following + command, replacing package-name with name of the package: shell> sudo yum install package-name For example, to install MySQL Workbench: @@ -3430,214 +3936,248 @@ shell> sudo yum install mysql-workbench-community To install the shared client libraries: shell> sudo yum install mysql-community-libs -Steps for a Fresh Installation of a Developer Milestone Release (DMR) -of MySQL - - Follow the steps below to install a developer milestone release - (DMR) of MySQL with the MySQL Yum repository: - Warning - - Developer milestone releases (DMRs) are for use at your own risk. - Significant development changes take place in milestone releases - and you may encounter compatibility issues, such as data format - changes that require attention in addition to the usual procedure - of running mysql_upgrade. For example, you may find it necessary - to dump your data with mysqldump before the upgrade and reload it - afterward. - - - 1. Add the MySQL Yum repository by following the instructions - given in Section 2.5.1, "." - - 2. Enable and disable the appropriate sub-repositories. Inside - the MySQL Yum repositories, different release series of the - MySQL Community Server are hosted in different - sub-repositories. Sub-repository for the latest GA series - (currently 5.6) is enabled by default, and sub-repositories - for all other series (for example, the 5.7 series, currently - still in developer milestone release (DMR) status) are - disabled by default. Use this command to see all the - sub-repositories in the MySQL Yum repository: -shell> sudo yum repolist all | grep "mysql*-community*" - To install the latest release from a specific series other - than GA series, simply disable the sub-repository for the - latest GA series and enable the sub-repository for the - specific series before running the yum install command. This - is how it can be done, if, for example, you want to install - the 5.7 DMR series: -shell> sudo yum-config-manager --disable mysql56-community -shell> sudo yum-config-manager --enable mysql57-community-dmr - You can also enable and disable sub-repositories by editing - manually the /etc/yum.repos.d/mysql-community.repo file. This - is a typical entry for a sub-repository in the file: -# Enable to use MySQL 5.6 -[mysql56-community] -name=MySQL 5.6 Community Server -baseurl=//repo.mysql.com/yum/mysql-5.6-community/el/5/$basearch/ -enabled=1 -gpgcheck=1 -gpgkey=file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql - Find the entry for the sub-repository you want to configure, - and edit the enabled= line. Make enabled=0 to disable a - sub-repository, or enabled=1 to enable a sub-repository. - You can verify that the enabling and disabling of - sub-repositories have been done correctly by run the following - command and check its output: -shell> sudo yum repolist enabled | grep "mysql*-community*" - Note - You can only enable sub-repository for one release series at a - time. When sub-repositories for more than one release series - are enabled, the latest series will be used by Yum. - Then, install the MySQL server from the chosen series by the - command: -shell> sudo yum install mysql-server - - 3. Follow the instructions given in Section 2.5.1, "" and Section - 2.5.1, "." - Updating MySQL with Yum Besides installation, you can also perform updates for MySQL products and components using the MySQL Yum repository. See - Section 2.11.1.1, "Upgrading MySQL with the MySQL Yum Repository" - for details. + Section 2.11.1.1, "Upgrading MySQL with the MySQL Yum + Repository" for details. -2.5.2. Replacing a Third-Party Distribution of MySQL Using the MySQL +2.5.2 Replacing a Third-Party Distribution of MySQL Using the MySQL Yum Repository - Different distributions of MySQL are distributed by different - parties through their own software repositories or download sites. - You can replace a third-party distribution of MySQL using the - MySQL Yum repository in a few steps. + For supported Yum-based platforms (see Section 2.5.1, + "Installing MySQL on Linux Using the MySQL Yum Repository," + for a list), you can replace a third-party distribution of + MySQL with the latest GA release from MySQL using the MySQL + Yum repository. According to how your third-party + distribution of MySQL was installed, there are different + steps to follow: + +Replacing a Native Third-Party Distribution of MySQL + + If you have installed a third-party distribution of MySQL + from a native software repository (that is, a software + repository provided by your own Linux distribution), follow + these steps: 1. Backing Up Your Database - To avoid loss of data, always back up your database before - trying to replace your MySQL installation using the MySQL Yum - repository. See Chapter 7, "Backup and Recovery" on how to - back up your database. - - 2. Stopping Yum from Receiving MySQL Packages from Third-Party, - Non-Native Repositories - Before you can use the MySQL Yum repository for installing (or - updating) MySQL, you must stop your system from receiving - MySQL packages from any third-party, non-native Yum - repositories. - One way to check whether Yum is now receiving third-party - MySQL distributions from other repositories is to use the - following command: -shell> yum list installed mysql\* - This is a sample output for the command: -mysql.i686 5.1.69-1.el6_4 @updates -mysql-libs.i686 5.1.69-1.el6_4 @updates -mysql-server.i686 5.1.69-1.el6_4 @updates - The output shows the names of the packages of the third-party - MySQL distribution that are installed and, on the right-hand - side, the repository (which is named updates, a native - repository for the Linux distribution) from which they were - installed. - However, sometimes the names of the packages of the - third-party distribution might not contain the string "mysql" - in it. It might be useful to search also with this command: -shell> yum --disablerepo=\* provides mysql\* - The following is a sample output of the command: -MariaDB-compat-10.0.4-1.i686 ... -... -Repo : installed -Matched from: -Other : mysql-libs + To avoid loss of data, always back up your database + before trying to replace your MySQL installation using + the MySQL Yum repository. See Chapter 7, "Backup and + Recovery," on how to back up your database. + + 2. Adding the MySQL Yum Repository + Add the MySQL Yum repository to your system's repository + list by following the instructions given in Section + 2.5.1, "." + 3. Replacing the Native Third-Party Distribution by a Yum + Update + By design, the MySQL Yum repository will replace your + native, third-party MySQL when you perform a yum update + command on the system, or a yum update mysql-server. + After updating MySQL using the Yum repository, applications + compiled with older versions of the shared client libraries + should continue to work. However, if you want to recompile + applications and dynamically link them with the updated + libraries, see Section 2.11.1.1, "," for some special + considerations. -MariaDB-server-10.0.4-1.i686 ... -... -Repo : installed -Matched from: -Other : mysql-server - From the result we can see the names of some of the packages - for the installed third-party distribution of MySQL - (MariaDB-server and MariaDB-compat). To try to get an - exhaustive list of packages installed for this third-party - distribution of MySQL, it might be helpful to search for - installed packages of similar names with, for example, the - following command: +Replacing a Nonnative Third-Party Distribution of MySQL + + If you have installed a third-party distribution of MySQL + from a nonnative software repository (that is, a software + repository not provided by your own Linux distribution), + follow these steps: + + 1. Backing Up Your Database + To avoid loss of data, always back up your database + before trying to replace your MySQL installation using + the MySQL Yum repository. See Chapter 7, "Backup and + Recovery," on how to back up your database. + + 2. Stopping Yum from Receiving MySQL Packages from + Third-Party, Nonnative Repositories + Before you can use the MySQL Yum repository for + installing MySQL, you must stop your system from + receiving MySQL packages from any third-party, nonnative + Yum repositories. + For example, if you have installed MariaDB using their + own software repository, get a list of the installed + MariaDB packages using the following command: shell> yum list installed mariadb\* This is a sample output for the command: MariaDB-common.i686 10.0.4-1 - @mariadb + @mariadb MariaDB-compat.i686 10.0.4-1 - @mariadb + @mariadb MariaDB-server.i686 10.0.4-1 - @mariadb - From the command output, we can identify all the installed - packages (MariaDB-common, MariaDB-compat, and MariaDB-server) - and the third-party Yum repository from which they were - installed (named mariadb). - The next step is to stop Yum from receiving packages from the - third-party Yum repository: + @mariadb + + From the command output, we can identify the installed + packages (MariaDB-common, MariaDB-compat, and + MariaDB-server) and the source of them (a nonnative + software repository named mariadb). + As another example, if you have installed Percona using + their own software repository, get a list of the + installed Percona packages using the following command: +shell> yum list installed Percona\* + This is a sample output for the command: +Percona-Server-client-55.i686 5.5.39-rel36.0.el6 @percona +-release-i386 +Percona-Server-server-55.i686 5.5.39-rel36.0.el6 @percona +-release-i386 +Percona-Server-shared-55.i686 5.5.39-rel36.0.el6 @percona +-release-i386 +percona-release.noarch 0.1-3 @/percon +a-release-0.1-3.noarch + + From the command output, we can identify the installed + packages (Percona-Server-client, Percona-Server-server, + Percona-Server-shared, and percona-release.noarch) and + the source of them (a nonnative software repository named + percona-release). + If you are not sure which third-party MySQL fork you have + installed, this command should reveal it and list the RPM + packages installed for it, as well as the third-party + repository that supplies the packages: +shell> yum --disablerepo=\* provides mysql\* + The next step is to stop Yum from receiving packages from + the nonnative repository. If the yum-config-manager + utility is supported on your platform, you can, for + example, use this command for MariaDB: shell> sudo yum-config-manager --disable mariadb + And use this command for Percona: +shell> sudo yum-config-manager --disable percona-release + You can perform the same task by removing the entry for + the software repository existing in one of the repository + files under the /etc/yum.repos.d/ directory. This is how + the entry typically looks like for MariaDB: +[mariadb] name = MariaDB + baseurl = [base URL for repository] + gpgkey = [URL for GPG key] + gpgcheck =1 + The entry is usually found in the file + /etc/yum.repos.d/MariaDB.repo for MariaDB---delete the + file, or remove entry from it (or from the file in which + you find the entry). Note - For platforms like Fedora 18, 19, and 20 that install MySQL - from the native repositories, this step is usually not - required, unless you have explicitly added a third-party Yum - repository for MySQL packages. - - 3. Adding the MySQL Yum Repository - Once the third-party Yum repository has been disabled, add the - MySQL Yum repository to your system's repository list by - following the instructions given in Section 2.5.1, "." - - 4. Uninstalling the Third-Party MySQL Distribution and Installing - MySQL with the MySQL Yum Repository - The installed third-party MySQL distribution must first be - uninstalled before you can use the MySQL Yum repository to - install MySQL, or the installation process will give an error. - Assuming that, as in the example above, the third-part MySQL - packages you have found are named MariaDB-common, - MariaDB-compat, and MariaDB-server, uninstall them with the - following command: + This step is not necessary for an installation that was + configured with a Yum repository release package (like + Percona) if you are going to remove the release package + (percona-release.noarch for Percona), as shown in the + uninstall command for Percona in Step 3 below. + + 3. Uninstalling the Nonnative Third-Party MySQL Distribution + of MySQL + The nonnative third-party MySQL distribution must first + be uninstalled before you can use the MySQL Yum + repository to install MySQL. For the MariaDB packages + found in Step 2 above, uninstall them with the following + command: shell> sudo yum remove MariaDB-common MariaDB-compat MariaDB-server - Note - If your third-party MySQL distribution was not installed by - Yum or by an RPM installer, you will not be able to detect and - then uninstall it by Yum. If you are not sure what to do in - that case, consult a system administrator or the original - third-party distributor. - Then, install MySQL from the MySQL Yum repository with the - following command: -shell> sudo yum install mysql-server - The MySQL server and other components required to run the - server, including the client, the shared client libraries, and - the common error messages and character sets for client and - server, are now installed from the MySQL Yum repository. To - install more components for MySQL, see Section 2.5.1, "." - Follow the postinstallation procedures exdocbuild-run-cmd - push-docs-to-web-staging.sh downloadsplained in Section 2.10, - "Postinstallation Setup and Testing." - -2.5.3. Installing MySQL on Linux Using RPM Packages + For the Percona packages we found in Step 2 above: +shell> sudo yum remove Percona-Server-client-55 Percona-Server-server- +55 \ + Percona-Server-shared-55.i686 percona-release + + 4. Installing MySQL with the MySQL Yum Repository + Then, install MySQL with the MySQL Yum repository by + following the instructions given in Section 2.5.1, + "Installing MySQL on Linux Using the MySQL Yum + Repository:" . + Important + + + If you have chosen to replace your third-party MySQL + distribution with a newer version of MySQL from the + MySQL Yum repository, remember to run mysql_upgrade + after the server starts, to check and possibly + resolve any incompatibilities between the old data + and the upgraded software. mysql_upgrade also + performs other functions; see Section 4.4.7, + "mysql_upgrade --- Check and Upgrade MySQL Tables" + for details. + + + For EL7-based platforms: See Section 2.5.1, "." + +2.5.3 Installing MySQL on Linux Using the MySQL APT Repository + + The MySQL APT repository provides deb packages for installing + and managing the MySQL server, client, and other components + on the following Linux platforms: : + + * Debian 7.x ("wheezy") + * Ubuntu 12.04 LTS ("Precise Pangolin") + + * Ubuntu 14.04 LTS ("Trusty Tahr") + + * Ubuntu 14.10 ("Utopic Unicorn") + + Instructions for using the MySQL APT Repository are available + in A Quick Guide to Using the MySQL APT Repository + (http://dev.mysql.com/doc/mysql-apt-repo-quick-guide/en/). Note - To install or upgrade to MySQL 5.6.11, be sure to read the special - instructions at the end of this section. + The MySQL APT Repository is now in development release. We + encourage you to try it and provide us with feedback. Please + report any bugs or inconsistencies you observe to our Bugs + Database (http://bugs.mysql.com). + +2.5.4 Installing MySQL on Linux Using the MySQL SLES Repository - The recommended way to install MySQL on RPM-based Linux - distributions that use glibc is by using the RPM packages provided - by MySQL. There are two methods for doing so: for EL5 or EL6-based - platforms and Fedora 18, 19, or 20, this can be done using the - MySQL Yum repository (see Section 2.5.1, "Installing MySQL on - Linux Using the MySQL Yum Repository" for details); for other - platforms, we provide various RPM packages that work for different - platforms, and this section explains how these packages work. - - For non-RPM Linux distributions, you can install MySQL using a - .tar.gz package. See Section 2.2, "Installing MySQL on Unix/Linux - Using Generic Binaries." + The MySQL SLES repository provides RPM packages for + installing and managing the MySQL server, client, and other + components on SUSE Enterprise Linux Server. - Installations created from our Linux RPM distributions result in - files under the system directories shown in the following table. + Instructions for using the MySQL SLES Repository are + available in A Quick Guide to Using the MySQL SLES Repository + (http://dev.mysql.com/doc/mysql-sles-repo-quick-guide/en/). + Note - Table 2.9. MySQL Installation Layout for Linux RPM Packages + The MySQL SLES Repository is now in development release. We + encourage you to try it and provide us with feedback. Please + report any bugs or inconsistencies you observe to our Bugs + Database (http://bugs.mysql.com). + +2.5.5 Installing MySQL on Linux Using RPM Packages + + Note + + To install or upgrade to MySQL 5.6.11 or later, be sure to + read the special instructions at the end of this section. + + The recommended way to install MySQL on RPM-based Linux + distributions that use glibc is by using the RPM packages + provided by MySQL. There are two sources for obtaining the + Community versions of the RPM packages: + + * From the MySQL software repositories, for the following + platforms: + + + For EL5, EL6, or EL7-based platforms and Fedora 20 + or 21, use the MySQL Yum repository (see Section + 2.5.1, "Installing MySQL on Linux Using the MySQL + Yum Repository" for details). + + + For SUSE Enterprise Linux Server, use the MySQL SLES + repository (see Section 2.5.4, "Installing MySQL on + Linux Using the MySQL SLES Repository" for details). + + * From the MySQL Downloads page + (http://dev.mysql.com/downloads/) in the MySQL Developer + Zone (http://dev.mysql.com/), on which we provide various + RPM packages that work for different platforms. + + The discussions in this section only apply to the RPM + packages directly downloaded from the MySQL Developer Zone. + Installations created with these packages result in files + under the system directories shown in the following table. + + Table 2.6 MySQL Installation Layout for Linux RPM Packages + from the MySQL Developer Zone Directory Contents of Directory /usr/bin Client programs and scripts /usr/sbin The mysqld server @@ -3647,354 +4187,485 @@ shell> sudo yum install mysql-server /usr/include/mysql Include (header) files /usr/lib/mysql Libraries /usr/share/mysql Miscellaneous support files, including error - messages, character set files, sample configuration files, SQL for - database installation + messages, character set files, sample configuration files, + SQL for database installation /usr/share/sql-bench Benchmarks Note - RPM distributions of MySQL are also provided by other vendors. Be - aware that they may differ from those built by us in features, - capabilities, and conventions (including communication setup), and - that the instructions in this manual do not necessarily apply to - installing them. The vendor's instructions should be consulted - instead. Because of these differences, RPM packages built by us - check whether such RPMs built by other vendors are installed. If - so, the RPM does not install and produces a message explaining - this. - - Conflicts can arise when an RPM from another vendor is already - installed, such as when a vendor's convention about which files - belong with the server and which belong with the client library - differ from the breakdown used for Oracle packages. In such cases, - attempts to install an Oracle RPM with rpm -i may result in - messages that files in the RPM to be installed conflict with files - from an installed package (denoted mysql-libs in the following - paragraphs). - - We provide a MySQL-shared-compat package with each MySQL release. - This package is meant to replace mysql-libs and provides a - replacement-compatible client library for older MySQL series. - MySQL-shared-compat is set up to make mysql-libs obsolete, but rpm - explicitly refuses to replace obsoleted packages when invoked with - -i (unlike -U), which is why installation with rpm -i produces a - conflict. - - MySQL-shared-compat can safely be installed alongside mysql-libs - because libraries are installed to different locations. Therefore, - it is possible to install shared-compat first, then manually - remove mysql-libs before continuing with the installation. After - mysql-libs is removed, the dynamic linker stops looking for the - client library in the location where mysql-libs puts it, and the - library provided by the MySQL-shared-compat package takes over. + RPM distributions of MySQL are also provided by other + vendors. Be aware that they may differ from those built by us + in features, capabilities, and conventions (including + communication setup), and that the instructions in this + manual do not necessarily apply to installing them. The + vendor's instructions should be consulted instead. Because of + these differences, RPM packages built by us check whether + such RPMs built by other vendors are installed. If so, the + RPM does not install and produces a message explaining this. + + Conflicts can arise when an RPM from another vendor is + already installed, such as when a vendor's convention about + which files belong with the server and which belong with the + client library differ from the breakdown used for Oracle + packages. In such cases, attempts to install an Oracle RPM + with rpm -i may result in messages that files in the RPM to + be installed conflict with files from an installed package + (denoted mysql-libs in the following paragraphs). + + We provide a MySQL-shared-compat package with each MySQL + release. This package is meant to replace mysql-libs and + provides a replacement-compatible client library for older + MySQL series. MySQL-shared-compat is set up to make + mysql-libs obsolete, but rpm explicitly refuses to replace + obsoleted packages when invoked with -i (unlike -U), which is + why installation with rpm -i produces a conflict. + + MySQL-shared-compat can safely be installed alongside + mysql-libs because libraries are installed to different + locations. Therefore, it is possible to install shared-compat + first, then manually remove mysql-libs before continuing with + the installation. After mysql-libs is removed, the dynamic + linker stops looking for the client library in the location + where mysql-libs puts it, and the library provided by the + MySQL-shared-compat package takes over. Another alternative is to install packages using yum. In a - directory containing all RPM packages for a MySQL release, yum - install MySQL*rpm installs them in the correct order and removes - mysql-libs in one step without conflicts. + directory containing all RPM packages for a MySQL release, + yum install MySQL*rpm installs them in the correct order and + removes mysql-libs in one step without conflicts. In most cases, you need to install only the MySQL-server and - MySQL-client packages to get a functional MySQL installation. The - other packages are not required for a standard installation. + MySQL-client packages to get a functional MySQL installation. + The other packages are not required for a standard + installation. As of MySQL 5.6.8, new RPM install operations (not upgrades) - invoke mysql_install_db with the --random-passwords option that - provides for more secure MySQL installation. Invoking - mysql_install_db with --random-passwords causes it to assign a - random password to the MySQL root accounts, set the "password - expired" flag for those accounts, and remove the anonymous-user - MySQL accounts. It will be necessary after installation to start - the server, connect as root using the password written to the - $HOME/.mysql_secret file, and assign a new root password. Until - this is done, root cannot do anything else. This must be done for - each root account you intend to use. To change the password, you - can use the SET PASSWORD statement (for example, with the mysql - client). You can also use mysqladmin or mysql_secure_installation. - For additional details, see Section 4.4.3, "mysql_install_db --- - Initialize MySQL Data Directory." (Install operations using RPMs - for Unbreakable Linux Network are unaffected because they do not - use mysql_install_db.) - - RPMs for MySQL Cluster. Standard MySQL server RPMs built by MySQL - do not provide support for the NDBCLUSTER storage engine. + invoke mysql_install_db with the --random-passwords option + that provides for more secure MySQL installation. Invoking + mysql_install_db with --random-passwords causes it to assign + a random password to the MySQL root accounts, set the + "password expired" flag for those accounts, and not create + anonymous-user MySQL accounts. It will be necessary after + installation to start the server, connect as root using the + password written to the $HOME/.mysql_secret file, and assign + a new root password. Until this is done, root cannot do + anything else. This must be done for each root account you + intend to use. To change the password, you can use the SET + PASSWORD statement (for example, with the mysql client). You + can also use mysqladmin or mysql_secure_installation. For + additional details, see Section 4.4.3, "mysql_install_db --- + Initialize MySQL Data Directory." (Install operations using + RPMs for Unbreakable Linux Network are unaffected because + they do not use mysql_install_db.) Important - When upgrading a MySQL Cluster RPM installation, you must upgrade - all installed RPMs, including the Server and Client RPMs. + RPMs for MySQL Cluster. Standard MySQL server RPMs built by + MySQL do not provide support for the NDBCLUSTER storage + engine. For more information about installing MySQL Cluster + from RPMs, see Section 18.2, "MySQL Cluster Installation." - For more information about installing MySQL Cluster from RPMs, see - Section 17.2, "MySQL Cluster Installation." + When upgrading a MySQL Cluster RPM installation, you must + upgrade all installed RPMs, including the Server and Client + RPMs. For upgrades, if your installation was originally produced by - installing multiple RPM packages, it is best to upgrade all the - packages, not just some. For example, if you previously installed - the server and client RPMs, do not upgrade just the server RPM. - - If you get a dependency failure when trying to install MySQL - packages (for example, error: removing these packages would break - dependencies: libmysqlclient.so.10 is needed by ...), you should - also install the MySQL-shared-compat package, which includes the - shared libraries for older releases for backward compatibility. + installing multiple RPM packages, it is best to upgrade all + the packages, not just some. For example, if you previously + installed the server and client RPMs, do not upgrade just the + server RPM. - The RPM packages shown in the following list are available. The - names shown here use a suffix of .glibc23.i386.rpm, but particular - packages can have different suffixes, described later. + If the data directory exists at RPM installation time, the + installation process does not modify existing data. This has + the effect, for example, that accounts in the grant tables + are not initialized to the default set of accounts. - * MySQL-server-VERSION.glibc23.i386.rpm + If you get a dependency failure when trying to install MySQL + packages (for example, error: removing these packages would + break dependencies: libmysqlclient.so.10 is needed by ...), + you should also install the MySQL-shared-compat package, + which includes the shared libraries for older releases for + backward compatibility. + + The RPM packages shown in the following list are available. + The names shown here use a suffix of + .linux_glibc2.5.i386.rpm, but particular packages can have + different suffixes, described later. If you plan to install + multiple RPM packages, you may wish to download the RPM + Bundle tar file instead, which contains multiple RPM packages + to that you need not download them separately. + + * MySQL-server-VERSION.linux_glibc2.5.i386.rpm The MySQL server. You need this unless you only want to connect to a MySQL server running on another machine. - * MySQL-client-VERSION.glibc23.i386.rpm - The standard MySQL client programs. You probably always want - to install this package. + * MySQL-client-VERSION.linux_glibc2.5.i386.rpm + The standard MySQL client programs. You probably always + want to install this package. - * MySQL-devel-VERSION.glibc23.i386.rpm - The libraries and include files that are needed if to compile - other MySQL clients, such as the Perl modules. Install this - RPM if you intend to compile C API applications. + * MySQL-devel-VERSION.linux_glibc2.5.i386.rpm + The libraries and include files that are needed if to + compile other MySQL clients, such as the Perl modules. + Install this RPM if you intend to compile C API + applications. - * MySQL-shared-VERSION.glibc23.i386.rpm + * MySQL-shared-VERSION.linux_glibc2.5.i386.rpm This package contains the shared libraries - (libmysqlclient.so*) that certain languages and applications - need to dynamically load and use MySQL. It contains - single-threaded and thread-safe libraries. Install this RPM if - you intend to compile or run C API applications that depend on - the shared client library. - - * MySQL-shared-compat-VERSION.glibc23.i386.rpm - This package includes the shared libraries for older releases, - but not the libraries for the current release. It contains - single-threaded and thread-safe libraries. Install this - package if you have applications installed that are - dynamically linked against older versions of MySQL but you - want to upgrade to the current version without breaking the - library dependencies. - As of MySQL 5.6.5, the MySQL-shared-compat RPM package enables - users of Red Hat-provided mysql-*-5.1 RPM packages to migrate - to Oracle-provided MySQL-*-5.5 packages. MySQL-shared-compat - replaces the Red Hat mysql-libs package by replacing - libmysqlclient.so files of the latter package, thus satisfying - dependencies of other packages on mysql-libs. This change - affects only users of Red Hat (or Red Hat-compatible) RPM - packages. Nothing is different for users of Oracle RPM - packages. - - * MySQL-embedded-VERSION.glibc23.i386.rpm + (libmysqlclient.so*) that certain languages and + applications need to dynamically load and use MySQL. It + contains single-threaded and thread-safe libraries. + Install this RPM if you intend to compile or run C API + applications that depend on the shared client library. + + * MySQL-shared-compat-VERSION.linux_glibc2.5.i386.rpm + This package includes the shared libraries for older + releases, but not the libraries for the current release. + It contains single-threaded and thread-safe libraries. + Install this package if you have applications installed + that are dynamically linked against older versions of + MySQL but you want to upgrade to the current version + without breaking the library dependencies. + As of MySQL 5.6.5, the MySQL-shared-compat RPM package + enables users of Red Hat-provided mysql-*-5.1 RPM + packages to migrate to Oracle-provided MySQL-*-5.5 + packages. MySQL-shared-compat replaces the Red Hat + mysql-libs package by replacing libmysqlclient.so files + of the latter package, thus satisfying dependencies of + other packages on mysql-libs. This change affects only + users of Red Hat (or Red Hat-compatible) RPM packages. + Nothing is different for users of Oracle RPM packages. + + * MySQL-embedded-VERSION.linux_glibc2.5.i386.rpm The embedded MySQL server library. - * MySQL-test-VERSION.glibc23.i386.rpm + * MySQL-test-VERSION.linux_glibc2.5.i386.rpm This package includes the MySQL test suite. * MySQL-VERSION.src.rpm This contains the source code for all of the previous - packages. It can also be used to rebuild the RPMs on other - architectures (for example, Alpha or SPARC). + packages. It can also be used to rebuild the RPMs on + other architectures (for example, Alpha or SPARC). - The suffix of RPM package names (following the VERSION value) has - the following syntax: + The suffix of RPM package names (following the VERSION value) + has the following syntax: .PLATFORM.CPU.rpm - The PLATFORM and CPU values indicate the type of system for which - the package is built. PLATFORM indicates the platform and CPU - indicates the processor type or family. + The PLATFORM and CPU values indicate the type of system for + which the package is built. PLATFORM indicates the platform + and CPU indicates the processor type or family. - All packages are dynamically linked against glibc 2.3. The + All packages are dynamically linked against glibc 2.5. The PLATFORM value indicates whether the package is platform - independent or intended for a specific platform, as shown in the - following table. + independent or intended for a specific platform, as shown in + the following table. - Table 2.10. MySQL Linux Installation Packages + Table 2.7 MySQL Linux Installation Packages PLATFORM Value Intended Use - glibc23 Platform independent, should run on any Linux distribution - that supports glibc 2.3 - rhel4, rhel5 Red Hat Enterprise Linux 4 or 5 - el6 Enterprise Linux 6 - sles10, sles11 SuSE Linux Enterprise Server 10 or 11 + linux_glibc25 Platform independent, should run on any Linux + distribution that supports glibc 2.5 + rhel5, rhel6 Red Hat Enterprise Linux 5 or 6 + el6, el7 Enterprise Linux 6 or 7 + sles10, sles11 SUSE Linux Enterprise Server 10 or 11 - In MySQL 5.6, only glibc23 packages are available currently. + In MySQL 5.6, only linux_glibc2.5 packages are available + currently. - The CPU value indicates the processor type or family for which the - package is built. + The CPU value indicates the processor type or family for + which the package is built. - Table 2.11. MySQL Installation Packages for Linux CPU Identifiers + Table 2.8 MySQL Installation Packages for Linux CPU + Identifiers CPU Value Intended Processor Type or Family i386, i586, i686 Pentium processor or better, 32 bit x86_64 64-bit x86 processor ia64 Itanium (IA-64) processor - To see all files in an RPM package (for example, a MySQL-server - RPM), run a command like this: -shell> rpm -qpl MySQL-server-VERSION.glibc23.i386.rpm - - To perform a standard minimal installation, install the server and - client RPMs: -shell> rpm -i MySQL-server-VERSION.glibc23.i386.rpm -shell> rpm -i MySQL-client-VERSION.glibc23.i386.rpm - - To install only the client programs, install just the client RPM: -shell> rpm -i MySQL-client-VERSION.glibc23.i386.rpm - - RPM provides a feature to verify the integrity and authenticity of - packages before installing them. To learn more about this feature, - see Section 2.1.4, "Verifying Package Integrity Using MD5 - Checksums or GnuPG." - - The server RPM places data under the /var/lib/mysql directory. The - RPM also creates a login account for a user named mysql (if one - does not exist) to use for running the MySQL server, and creates - the appropriate entries in /etc/init.d/ to start the server - automatically at boot time. (This means that if you have performed - a previous installation and have made changes to its startup - script, you may want to make a copy of the script so that you do - not lose it when you install a newer RPM.) See Section 2.10.1.2, - "Starting and Stopping MySQL Automatically," for more information - on how MySQL can be started automatically on system startup. - - In MySQL 5.6, during a new installation, the server boot scripts - are installed, but the MySQL server is not started at the end of - the installation, since the status of the server during an - unattended installation is not known. + To see all files in an RPM package (for example, a + MySQL-server RPM), run a command like this: +shell> rpm -qpl MySQL-server-VERSION.linux_glibc2.5.i386.rpm + + To perform a standard minimal installation, install the + server and client RPMs: +shell> rpm -i MySQL-server-VERSION.linux_glibc2.5.i386.rpm +shell> rpm -i MySQL-client-VERSION.linux_glibc2.5.i386.rpm + + To install only the client programs, install just the client + RPM: +shell> rpm -i MySQL-client-VERSION.linux_glibc2.5.i386.rpm + + RPM provides a feature to verify the integrity and + authenticity of packages before installing them. To learn + more about this feature, see Section 2.1.4, "Verifying + Package Integrity Using MD5 Checksums or GnuPG." + + The server RPM places data under the /var/lib/mysql + directory. The RPM also creates a login account for a user + named mysql (if one does not exist) to use for running the + MySQL server, and creates the appropriate entries in + /etc/init.d/ to start the server automatically at boot time. + (This means that if you have performed a previous + installation and have made changes to its startup script, you + may want to make a copy of the script so that you do not lose + it when you install a newer RPM.) See Section 2.10.1.2, + "Starting and Stopping MySQL Automatically," for more + information on how MySQL can be started automatically on + system startup. + + In MySQL 5.6, during a new installation, the server boot + scripts are installed, but the MySQL server is not started at + the end of the installation, since the status of the server + during an unattended installation is not known. In MySQL 5.6, during an upgrade installation using the RPM - packages, if the MySQL server is running when the upgrade occurs, - the MySQL server is stopped, the upgrade occurs, and the MySQL - server is restarted. If the MySQL server is not already running - when the RPM upgrade occurs, the MySQL server is not started at - the end of the installation. + packages, if the MySQL server is running when the upgrade + occurs, the MySQL server is stopped, the upgrade occurs, and + the MySQL server is restarted. If the MySQL server is not + already running when the RPM upgrade occurs, the MySQL server + is not started at the end of the installation. + Note + + If you are upgrading from a community version to a commercial + version of MySQL (which actually requires you to first + uninstall the community version and then install the + commercial version), you must restart the server manually + after the upgrade. If something goes wrong, you can find more information in the - binary installation section. See Section 2.2, "Installing MySQL on - Unix/Linux Using Generic Binaries." + binary installation section. See Section 2.2, "Installing + MySQL on Unix/Linux Using Generic Binaries." Note - The accounts that are listed in the MySQL grant tables initially - have no passwords. After starting the server, you should set up - passwords for them using the instructions in Section 2.10, - "Postinstallation Setup and Testing." + The accounts that are listed in the MySQL grant tables + initially have no passwords. After starting the server, you + should set up passwords for them using the instructions in + Section 2.10, "Postinstallation Setup and Testing." During RPM installation, a user named mysql and a group named - mysql are created on the system. This is done using the useradd, - groupadd, and usermod commands. Those commands require appropriate - administrative privileges, which is required for locally managed - users and groups (as listed in the /etc/passwd and /etc/group - files) by the RPM installation process being run by root. - - If you log in as the mysql user, you may find that MySQL displays - "Invalid (old?) table or database name" errors that mention - .mysqlgui, lost+found, .mysqlgui, .bash_history, .fonts.cache-1, - .lesshst, .mysql_history, .profile, .viminfo, and similar files - created by MySQL or operating system utilities. You can safely - ignore these error messages or remove the files or directories - that cause them if you do not need them. + mysql are created on the system. This is done using the + useradd, groupadd, and usermod commands. Those commands + require appropriate administrative privileges, which is + required for locally managed users and groups (as listed in + the /etc/passwd and /etc/group files) by the RPM installation + process being run by root. + + If you log in as the mysql user, you may find that MySQL + displays "Invalid (old?) table or database name" errors that + mention .mysqlgui, lost+found, .mysqlgui, .bash_history, + .fonts.cache-1, .lesshst, .mysql_history, .profile, .viminfo, + and similar files created by MySQL or operating system + utilities. You can safely ignore these error messages or + remove the files or directories that cause them if you do not + need them. For nonlocal user management (LDAP, NIS, and so forth), the - administrative tools may require additional authentication (such - as a password), and will fail if the installing user does not - provide this authentication. Even if they fail, the RPM - installation will not abort but succeed, and this is intentional. - If they failed, some of the intended transfer of ownership may be - missing, and it is recommended that the system administrator then - manually ensures some appropriate user and group exists and - manually transfers ownership following the actions in the RPM spec - file. - - In MySQL 5.6.11, the RPM spec file has been updated, which has the - following consequences: + administrative tools may require additional authentication + (such as a password), and will fail if the installing user + does not provide this authentication. Even if they fail, the + RPM installation will not abort but succeed, and this is + intentional. If they failed, some of the intended transfer of + ownership may be missing, and it is recommended that the + system administrator then manually ensures some appropriate + user and group exists and manually transfers ownership + following the actions in the RPM spec file. + + In MySQL 5.6.11, the RPM spec file has been updated, which + has the following consequences: * For a non-upgrade installation (no existing MySQL version installed), it possible to install MySQL using yum. - * For upgrades, it is necessary to clean up any earlier MySQL - installations. In effect, the update is performed by removing - the old installations and installing the new one. + * For upgrades, it is necessary to clean up any earlier + MySQL installations. In effect, the update is performed + by removing the old installations and installing the new + one. Additional details follow. - For a non-upgrade installation of MySQL 5.6.11, it is possible to - install using yum: -shell> yum install MySQL-server-NEWVERSION.glibc23.i386.rpm + For a non-upgrade installation of MySQL 5.6.11 or later, it + is possible to install using yum: +shell> yum install MySQL-server-NEWVERSION.linux_glibc2.5.i386.rpm - For upgrades to MySQL 5.6.11, the upgrade is performed by removing - the old installation and installing the new one. To do this, use - the following procedure: + For upgrades to MySQL 5.6.11 or later, the upgrade is + performed by removing the old installation and installing the + new one. To do this, use the following procedure: 1. Remove the existing 5.6.X installation. OLDVERSION is the version to remove. -shell> rpm -e MySQL-server-OLDVERSION.glibc23.i386.rpm - Repeat this step for all installed MySQL RPMs. - - 2. Install the new version. NEWVERSION is the version to install. -shell> rpm -ivh MySQL-server-NEWVERSION.glibc23.i386.rpm - - Alternatively, the removal and installation can be done using yum: -shell> yum remove MySQL-server-OLDVERSION.glibc23.i386.rpm -shell> yum install MySQL-server-NEWVERSION.glibc23.i386.rpm - -2.5.4. Installing MySQL on Linux Using Debian Packages +shell> rpm -e MySQL-server-OLDVERSION.linux_glibc2.5.i386.rpm - Oracle provides Debian packages for installation on Debian or - Debian-like Linux systems. To obtain a package, see Section 2.1.3, - "How to Get MySQL." - Note + Repeat this step for all installed MySQL RPMs. - Debian distributions of MySQL are also provided by other vendors. - Be aware that they may differ from those built by us in features, - capabilities, and conventions (including communication setup), and - that the instructions in this manual do not necessarily apply to - installing them. The vendor's instructions should be consulted - instead. - - Debian package files have names in mysql-MVER-DVER-CPU.deb format. - MVER is the MySQL version and DVER is the Debian version. The CPU - value indicates the processor type or family for which the package - is built, as shown in the following table. - - Table 2.12. MySQL Installation Packages for Linux CPU Identifiers - CPU Value Intended Processor Type or Family - i686 Pentium processor or better, 32 bit - x86_64 64-bit x86 processor - - After downloading a Debian package, use the following command to - install it; + 2. Install the new version. NEWVERSION is the version to + install. +shell> rpm -ivh MySQL-server-NEWVERSION.linux_glibc2.5.i386.rpm + + Alternatively, the removal and installation can be done using + yum: +shell> yum remove MySQL-server-OLDVERSION.linux_glibc2.5.i386.rpm +shell> yum install MySQL-server-NEWVERSION.linux_glibc2.5.i386.rpm + +2.5.6 Installing MySQL on Linux Using Debian Packages from Oracle + + Oracle provides Debian packages for installing MySQL on + Debian or Debian-like Linux systems. The packages are + available through two different channels: + + * The MySQL APT Repository + (http://dev.mysql.com/downloads/repo/apt/), supporting + the Debian 7, Ubuntu 12, and Ubuntu 14 platforms. For + details, see Section 2.5.3, "Installing MySQL on Linux + Using the MySQL APT Repository." + + * The MySQL Developer Zone's Download Area + (http://dev.mysql.com/downloads/). For details, see + Section 2.1.3, "How to Get MySQL." The following are some + information on the Debian packages available there and + the instructions for installing them: + + + You may also need to install the libaio library if + it is not already present on your system: +shell> sudo apt-get install libaio1 + + + + For Debian 7, Ubuntu 12, and Ubuntu 14: + o Various Debian packages are provided in the + MySQL Developer Zone for installing different + components of MySQL. The preferred method is to + use the tarball bundle, which contains the + packages needed for a basic setup of MySQL. The + tarball bundles have names in the format of + mysql-server_MVER-DVER_CPU.deb-bundle.tar. MVER + is the MySQL version and DVER is the Linux + distribution version. The CPU value indicates + the processor type or family for which the + package is built, as shown in the following + table: + Table 2.9 MySQL Debian 7 and Ubuntu + Installation Packages CPU Identifiers + + CPU Value Intended Processor Type or Family + i386 Pentium processor or better, 32 bit + amd64 64-bit x86 processor + o After downloading the tarball, unpack it with + the following command: +shell> tar -xvf mysql-server_MVER-DVER_CPU.deb-bundle.tar + + o In general, install the deb packages unpacked + from the tarball with the command (see + explanations below for the extra steps required + for installing the server package): +shell> sudo dpkg -i package-name.deb + There are four packages to install: + # The database common files (install this + package before the other ones): +shell> sudo dpkg -i mysql-common_MVER-DVER_CPU.deb + # The MySQL server: + Install first the package for the database + common files (see the last bullet), and + then pre-configure your server + installation by the following command: +shell> dpkg-preconfigure mysql-community-server_MVER-DVER_CPU.deb + There are then two requests for you: + @ Supply a password for the root user + for your MySQL installation. + Important + Make sure you remember the root + password you set. Users who want to + set a password later can leave the + password field blank in the dialogue + box and just press OK. However, it is + very important that you set the + password soon using the program + mysql_secure_installation, as people + can gain anonymous access to your + MySQL server until you have secured + the database's root account with a + password. + @ Indicate if you want to install the + test database with "Yes" or "No". + Installation of the test database is + not recommended for production + environments. + Next, install the server package with the + following command: +shell> sudo dpkg -i mysql-community-server_MVER-DVER_CPU.deb + # The MySQL client: +shell> sudo dpkg -i mysql-community-client_MVER-DVER_CPU.deb + # The MySQL shared client library: +shell> sudo dpkg -i libmysqlclient18_MVER-DVER_CPU.deb + Here are where the files are installed on the + system: + # All configuration files (like my.cnf) are + under /etc + # All binaries, libraries, headers, etc., + are under /usr + # The data directory is under /var + + + For Debian 6: + o Debian package files directly downloaded from + the MySQL Developer Zone have names in the + mysql-MVER-DVER-CPU.deb format. MVER is the + MySQL version and DVER is the Debian version. + The CPU value indicates the processor type or + family for which the package is built, as shown + in the following table: + Table 2.10 MySQL Debian 6 Installation Package + CPU Identifiers + + CPU Value Intended Processor Type or Family + i686 Pentium processor or better, 32 bit + x86_64 64-bit x86 processor + o After downloading a Debian package, use the + following command to install it; shell> dpkg -i mysql-MVER-DVER-CPU.deb - The Debian package installs files in the /opt/mysql/server-5.6 - directory. - - You may also need to install the libaio library if it is not - already present on your system: -shell> apt-get install libaio1 + The Debian package installs files under the + /opt/mysql/server-5.6 directory. -2.5.5. Installing MySQL on Linux Using Native Package Managers + Note - Many Linux distributions include a version of the MySQL server, - client tools, and development components in their standard package - management system. This section provides basic instructions for - installing MySQL using those package management systems. + Debian distributions of MySQL are also provided by other + vendors. Be aware that they may differ from those built by + Oracle in features, capabilities, and conventions (including + communication setup), and that the instructions in this + manual do not necessarily apply to installing them. The + vendor's instructions should be consulted instead. + +2.5.7 Installing MySQL on Linux from the Native Software +Repositories + + Many Linux distributions include a version of the MySQL + server, client tools, and development components in their + native software repositories and can be installed with the + platforms' standard package management systems. This section + provides basic instructions for installing MySQL using those + package management systems. Important - Native package are often several versions behind the currently - available release. You will also normally be unable to install - development milestone releases (DMRs), as these are not usually - made available in the native repositories. Before proceeding, we - recommend that you check out the other installation options - described in Section 2.5, "Installing MySQL on Linux." + Native packages are often several versions behind the + currently available release. You will also normally be unable + to install development milestone releases (DMRs), as these + are not usually made available in the native repositories. + Before proceeding, we recommend that you check out the other + installation options described in Section 2.5, "Installing + MySQL on Linux." Distribution specific instructions are shown below: * Red Hat Linux, Fedora, CentOS Note - For EL5 and EL6-based Linux platforms and Fedora 18, 19, and - 20, you can install MySQL using the MySQL Yum repository. See - Section 2.5.1, "Installing MySQL on Linux Using the MySQL Yum - Repository" for details. - For Red Hat and similar distributions, the MySQL distribution - is divided into a number of separate packages, mysql for the - client tools, mysql-server for the server and associated - tools, and mysql-libs for the libraries. The libraries are - required if you want to provide connectivity from different - languages and environments such as Perl, Python and others. - To install, use the yum command to specify the packages that - you want to install. For example: + For EL5, EL6, or EL7-based Linux platforms and Fedora 20 + or 21, you can install MySQL using the MySQL Yum + repository instead of the platform's native software + repository. See Section 2.5.1, "Installing MySQL on Linux + Using the MySQL Yum Repository" for details. + For Red Hat and similar distributions, the MySQL + distribution is divided into a number of separate + packages, mysql for the client tools, mysql-server for + the server and associated tools, and mysql-libs for the + libraries. The libraries are required if you want to + provide connectivity from different languages and + environments such as Perl, Python and others. + To install, use the yum command to specify the packages + that you want to install. For example: root-shell> yum install mysql mysql-server mysql-libs mysql-server Loaded plugins: presto, refresh-packagekit Setting up Install Process @@ -4003,34 +4674,34 @@ Resolving Dependencies ---> Package mysql.x86_64 0:5.1.48-2.fc13 set to be updated ---> Package mysql-libs.x86_64 0:5.1.48-2.fc13 set to be updated ---> Package mysql-server.x86_64 0:5.1.48-2.fc13 set to be updated ---> Processing Dependency: perl-DBD-MySQL for package: mysql-server-5 -.1.48-2.fc13.x86_64 +--> Processing Dependency: perl-DBD-MySQL for package: mysql-server-5. +1.48-2.fc13.x86_64 --> Running transaction check ---> Package perl-DBD-MySQL.x86_64 0:4.017-1.fc13 set to be updated --> Finished Dependency Resolution Dependencies Resolved -===================================================================== -=========== +====================================================================== +========== Package Arch Version Repository - Size -===================================================================== -=========== + Size +====================================================================== +========== Installing: mysql x86_64 5.1.48-2.fc13 updates - 889 k + 889 k mysql-libs x86_64 5.1.48-2.fc13 updates - 1.2 M + 1.2 M mysql-server x86_64 5.1.48-2.fc13 updates - 8.1 M + 8.1 M Installing for dependencies: perl-DBD-MySQL x86_64 4.017-1.fc13 updates - 136 k + 136 k Transaction Summary -===================================================================== -=========== +====================================================================== +========== Install 4 Package(s) Upgrade 0 Package(s) @@ -4042,33 +4713,33 @@ Setting up and reading Presto delta metadata Processing delta metadata Package(s) data still to download: 10 M (1/4): mysql-5.1.48-2.fc13.x86_64.rpm | 889 kB - 00:04 +00:04 (2/4): mysql-libs-5.1.48-2.fc13.x86_64.rpm | 1.2 MB - 00:06 +00:06 (3/4): mysql-server-5.1.48-2.fc13.x86_64.rpm | 8.1 MB - 00:40 +00:40 (4/4): perl-DBD-MySQL-4.017-1.fc13.x86_64.rpm | 136 kB - 00:00 ---------------------------------------------------------------------- ------------ +00:00 +---------------------------------------------------------------------- +---------- Total 201 kB/s | 10 MB - 00:52 +00:52 Running rpm_check_debug Running Transaction Test Transaction Test Succeeded Running Transaction Installing : mysql-libs-5.1.48-2.fc13.x86_64 - 1/4 + 1/4 Installing : mysql-5.1.48-2.fc13.x86_64 - 2/4 + 2/4 Installing : perl-DBD-MySQL-4.017-1.fc13.x86_64 - 3/4 + 3/4 Installing : mysql-server-5.1.48-2.fc13.x86_64 - 4/4 + 4/4 Installed: - mysql.x86_64 0:5.1.48-2.fc13 mysql-libs.x86_64 0:5.1.48- -2.fc13 + mysql.x86_64 0:5.1.48-2.fc13 mysql-libs.x86_64 0:5.1.48-2 +.fc13 mysql-server.x86_64 0:5.1.48-2.fc13 Dependency Installed: @@ -4076,73 +4747,84 @@ Dependency Installed: Complete! - MySQL and the MySQL server should now be installed. A sample - configuration file is installed into /etc/my.cnf. An init - script, to start and stop the server, will have been installed - into /etc/init.d/mysqld. To start the MySQL server use - service: + + MySQL and the MySQL server should now be installed. A + sample configuration file is installed into /etc/my.cnf. + An init script, to start and stop the server, will have + been installed into /etc/init.d/mysqld. To start the + MySQL server use service: root-shell> service mysqld start - To enable the server to be started and stopped automatically - during boot, use chkconfig: + + To enable the server to be started and stopped + automatically during boot, use chkconfig: root-shell> chkconfig --levels 235 mysqld on - Which enables the MySQL server to be started (and stopped) - automatically at the specified the run levels. - The database tables will have been automatically created for - you, if they do not already exist. You should, however, run - mysql_secure_installation to set the root passwords on your - server. + + Which enables the MySQL server to be started (and + stopped) automatically at the specified the run levels. + The database tables will have been automatically created + for you, if they do not already exist. You should, + however, run mysql_secure_installation to set the root + passwords on your server. * Debian, Ubuntu, Kubuntu - On Debian and related distributions, there are two packages, + Note + For Debian 7, Ubuntu 12, and Ubuntu 14, MySQL can be + installed using the MySQL APT Repository + (http://dev.mysql.com/downloads/repo/apt/) instead of the + platform's native software repository. See Section 2.5.3, + "Installing MySQL on Linux Using the MySQL APT + Repository" for details. + On Debian and related distributions, there are two + packages for MySQL in their software repositories, mysql-client and mysql-server, for the client and server components respectively. You should specify an explicit version, for example mysql-client-5.1, to ensure that you install the version of MySQL that you want. - To download and install, including any dependencies, use the - apt-get command, specifying the packages that you want to - install. + To download and install, including any dependencies, use + the apt-get command, specifying the packages that you + want to install. Note Before installing, make sure that you update your apt-get - index files to ensure you are downloading the latest available - version. - A sample installation of the MySQL packages might look like - this (some sections trimmed for clarity): + index files to ensure you are downloading the latest + available version. + A sample installation of the MySQL packages might look + like this (some sections trimmed for clarity): root-shell> apt-get install mysql-client-5.1 mysql-server-5.1 Reading package lists... Done Building dependency tree Reading state information... Done The following packages were automatically installed and are no longer - required: +required: linux-headers-2.6.28-11 linux-headers-2.6.28-11-generic Use 'apt-get autoremove' to remove them. The following extra packages will be installed: bsd-mailx libdbd-mysql-perl libdbi-perl libhtml-template-perl - libmysqlclient15off libmysqlclient16 libnet-daemon-perl libplrpc-pe -rl mailx + libmysqlclient15off libmysqlclient16 libnet-daemon-perl libplrpc-per +l mailx mysql-common postfix Suggested packages: - dbishell libipc-sharedcache-perl tinyca procmail postfix-mysql post -fix-pgsql + dbishell libipc-sharedcache-perl tinyca procmail postfix-mysql postf +ix-pgsql postfix-ldap postfix-pcre sasl2-bin resolvconf postfix-cdb The following NEW packages will be installed bsd-mailx libdbd-mysql-perl libdbi-perl libhtml-template-perl - libmysqlclient15off libmysqlclient16 libnet-daemon-perl libplrpc-pe -rl mailx + libmysqlclient15off libmysqlclient16 libnet-daemon-perl libplrpc-per +l mailx mysql-client-5.1 mysql-common mysql-server-5.1 postfix 0 upgraded, 13 newly installed, 0 to remove and 182 not upgraded. Need to get 1907kB/25.3MB of archives. After this operation, 59.5MB of additional disk space will be used. Do you want to continue [Y/n]? Y -Get: 1 http://gb.archive.ubuntu.com jaunty-updates/main mysql-common -5.1.30really5.0.75-0ubuntu10.5 [63.6kB] -Get: 2 http://gb.archive.ubuntu.com jaunty-updates/main libmysqlclien -t15off 5.1.30really5.0.75-0ubuntu10.5 [1843kB] +Get: 1 http://gb.archive.ubuntu.com jaunty-updates/main mysql-common 5 +.1.30really5.0.75-0ubuntu10.5 [63.6kB] +Get: 2 http://gb.archive.ubuntu.com jaunty-updates/main libmysqlclient +15off 5.1.30really5.0.75-0ubuntu10.5 [1843kB] Fetched 1907kB in 9s (205kB/s) Preconfiguring packages ... Selecting previously deselected package mysql-common. -(Reading database ... 121260 files and directories currently installe -d.) +(Reading database ... 121260 files and directories currently installed +.) ... Processing 1 added doc-base file(s)... Registering documents with scrollkeeper... @@ -4162,48 +4844,50 @@ Setting up mysql-server-5.1 (5.1.31-1ubuntu2) ... ...done. 100825 11:46:15 InnoDB: Started; log sequence number 0 46409 100825 11:46:15 InnoDB: Starting shutdown... -100825 11:46:17 InnoDB: Shutdown completed; log sequence number 0 46 -409 +100825 11:46:17 InnoDB: Shutdown completed; log sequence number 0 464 +09 100825 11:46:17 [Warning] Forcing shutdown of 1 plugins * Starting MySQL database server mysqld ...done. - * Checking for corrupt, not cleanly closed and upgrade needing table -s. + * Checking for corrupt, not cleanly closed and upgrade needing tables +. ... Processing triggers for libc6 ... ldconfig deferred processing now taking place + Note The apt-get command will install a number of packages, - including the MySQL server, in order to provide the typical - tools and application environment. This can mean that you - install a large number of packages in addition to the main - MySQL package. - During installation, the initial database will be created, and - you will be prompted for the MySQL root password (and - confirmation). A configuration file will have been created in - /etc/mysql/my.cnf. An init script will have been created in - /etc/init.d/mysql. - The server will already be started. You can manually start and - stop the server using: + including the MySQL server, in order to provide the + typical tools and application environment. This can mean + that you install a large number of packages in addition + to the main MySQL package. + During installation, the initial database will be + created, and you will be prompted for the MySQL root + password (and confirmation). A configuration file will + have been created in /etc/mysql/my.cnf. An init script + will have been created in /etc/init.d/mysql. + The server will already be started. You can manually + start and stop the server using: root-shell> service mysql [start|stop] - The service will automatically be added to the 2, 3 and 4 run - levels, with stop scripts in the single, shutdown and restart - levels. + + The service will automatically be added to the 2, 3 and 4 + run levels, with stop scripts in the single, shutdown and + restart levels. * Gentoo Linux - As a source-based distribution, installing MySQL on Gentoo - involves downloading the source, patching the Gentoo - specifics, and then compiling the MySQL server and installing - it. This process is handled automatically by the emerge - command. Depending on the version of MySQL that you want to - install, you may need to unmask the specific version that you - want for your chosen platform. - The MySQL server and client tools are provided within a single - package, dev-db/mysql. You can obtain a list of the versions - available to install by looking at the portage directory for - the package: + As a source-based distribution, installing MySQL on + Gentoo involves downloading the source, patching the + Gentoo specifics, and then compiling the MySQL server and + installing it. This process is handled automatically by + the emerge command. Depending on the version of MySQL + that you want to install, you may need to unmask the + specific version that you want for your chosen platform. + The MySQL server and client tools are provided within a + single package, dev-db/mysql. You can obtain a list of + the versions available to install by looking at the + portage directory for the package: root-shell> ls /usr/portage/dev-db/mysql/mysql-5.1* mysql-5.1.39-r1.ebuild mysql-5.1.44-r1.ebuild @@ -4213,322 +4897,294 @@ mysql-5.1.44.ebuild mysql-5.1.45-r1.ebuild mysql-5.1.45.ebuild mysql-5.1.46.ebuild + To install a specific MySQL version, you must specify the entire atom. For example: root-shell> emerge =dev-db/mysql-5.1.46 - A simpler alternative is to use the virtual/mysql-5.1 package, - which will install the latest version: + + A simpler alternative is to use the virtual/mysql-5.1 + package, which will install the latest version: root-shell> emerge =virtual/mysql-5.1 + If the package is masked (because it is not tested or - certified for the current platform), use the ACCEPT_KEYWORDS - environment variable. For example: + certified for the current platform), use the + ACCEPT_KEYWORDS environment variable. For example: root-shell> ACCEPT_KEYWORDS="~x86" emerge =virtual/mysql-5.1 - After installation, you should create a new database using - mysql_install_db, and set the password for the root user on - MySQL. You can use the configuration interface to set the - password and create the initial database: + + After installation, you should create a new database + using mysql_install_db, and set the password for the root + user on MySQL. You can use the configuration interface to + set the password and create the initial database: root-shell> emerge --config =dev-db/mysql-5.1.46 - A sample configuration file will have been created for you in - /etc/mysql/my.cnf, and an init script will have been created - in /etc/init.d/mysql. - To enable MySQL to start automatically at the normal (default) - run levels, you can use: + + A sample configuration file will have been created for + you in /etc/mysql/my.cnf, and an init script will have + been created in /etc/init.d/mysql. + To enable MySQL to start automatically at the normal + (default) run levels, you can use: root-shell> rc-update add mysql default -2.6. Installing MySQL on Solaris and OpenSolaris +2.6 Installing MySQL Using Unbreakable Linux Network (ULN) + + Linux supports a number of different solutions for installing + MySQL, covered in Section 2.5, "Installing MySQL on Linux." + One of the methods, covered in this section, is installing + from Oracles's Unbreakable Linux Network (ULN). You can find + information about Oracle Linux and ULN under + http://linux.oracle.com/. + + To use ULN, you need to obtain a ULN login and register the + machine used for installation with ULN. This is described in + detail in the ULN FAQ + (https://linux.oracle.com/uln_faq.html). The page also + describes how to install and update packages.The MySQL + packages are in the "MySQL for Oracle Linux 6" and "MySQL for + Oracle Linux 7" channels for your system architecture on ULN. + Note + + At the time of this writing, ULN provides MySQL 5.6 for + Oracle Linux 6 and Oracle Linux 7. + + Once MySQL has been installed using ULN, you can find + information on starting and stopping the server, and more, in + this section, particularly under Section 2.5.5, "Installing + MySQL on Linux Using RPM Packages." + + If you're updating an existing MySQL installation to an + installation using ULN, the recommended procedure is to + export your data using mysqldump, remove the existing + installation, install MySQL from ULN, and load the exported + data into your freshly installed MySQL. + + If the existing MySQL installation you're upgrading from is + from a previous release series (prior to MySQL 5.6), make + sure to read the section on upgrading MySQL, Section 2.11.1, + "Upgrading MySQL." + +2.7 Installing MySQL on Solaris and OpenSolaris MySQL on Solaris and OpenSolaris is available in a number of different formats. - * For information on installing using the native Solaris PKG - format, see Section 2.6.1, "Installing MySQL on Solaris Using - a Solaris PKG." + * For information on installing using the native Solaris + PKG format, see Section 2.7.1, "Installing MySQL on + Solaris Using a Solaris PKG." * On OpenSolaris, the standard package repositories include - MySQL packages specially built for OpenSolaris that include - entries for the Service Management Framework (SMF) to enable - control of the installation using the SMF administration - commands. For more information, see Section 2.6.2, "Installing - MySQL on OpenSolaris Using IPS." + MySQL packages specially built for OpenSolaris that + include entries for the Service Management Framework + (SMF) to enable control of the installation using the SMF + administration commands. For more information, see + Section 2.7.2, "Installing MySQL on OpenSolaris Using + IPS." * To use a standard tar binary installation, use the notes - provided in Section 2.2, "Installing MySQL on Unix/Linux Using - Generic Binaries." Check the notes and hints at the end of - this section for Solaris specific notes that you may need - before or after installation. + provided in Section 2.2, "Installing MySQL on Unix/Linux + Using Generic Binaries." Check the notes and hints at the + end of this section for Solaris specific notes that you + may need before or after installation. - To obtain a binary MySQL distribution for Solaris in tarball or - PKG format, http://dev.mysql.com/downloads/mysql/5.6.html. + To obtain a binary MySQL distribution for Solaris in tarball + or PKG format, http://dev.mysql.com/downloads/mysql/5.6.html. - Additional notes to be aware of when installing and using MySQL on - Solaris: + Additional notes to be aware of when installing and using + MySQL on Solaris: - * If you want to use MySQL with the mysql user and group, use - the groupadd and useradd commands: + * If you want to use MySQL with the mysql user and group, + use the groupadd and useradd commands: groupadd mysql useradd -g mysql mysql - * If you install MySQL using a binary tarball distribution on - Solaris, you may run into trouble even before you get the - MySQL distribution unpacked, as the Solaris tar cannot handle - long file names. This means that you may see errors when you - try to unpack MySQL. - If this occurs, you must use GNU tar (gtar) to unpack the - distribution. In Solaris 10 and OpenSolaris gtar is normally - located in /usr/sfw/bin/gtar, but may not be included in the - default path definition. - - * When using Solaris 10 for x86_64, you should mount any file - systems on which you intend to store InnoDB files with the - forcedirectio option. (By default mounting is done without - this option.) Failing to do so will cause a significant drop - in performance when using the InnoDB storage engine on this - platform. - - * If you would like MySQL to start automatically, you can copy - support-files/mysql.server to /etc/init.d and create a - symbolic link to it named /etc/rc3.d/S99mysql.server. - * If too many processes try to connect very rapidly to mysqld, - you should see this error in the MySQL log: + * If you install MySQL using a binary tarball distribution + on Solaris, you may run into trouble even before you get + the MySQL distribution unpacked, as the Solaris tar + cannot handle long file names. This means that you may + see errors when you try to unpack MySQL. + If this occurs, you must use GNU tar (gtar) to unpack the + distribution. In Solaris 10 and OpenSolaris gtar is + normally located in /usr/sfw/bin/gtar, but may not be + included in the default path definition. + + * When using Solaris 10 for x86_64, you should mount any + file systems on which you intend to store InnoDB files + with the forcedirectio option. (By default mounting is + done without this option.) Failing to do so will cause a + significant drop in performance when using the InnoDB + storage engine on this platform. + + * If you would like MySQL to start automatically, you can + copy support-files/mysql.server to /etc/init.d and create + a symbolic link to it named /etc/rc3.d/S99mysql.server. + + * If too many processes try to connect very rapidly to + mysqld, you should see this error in the MySQL log: Error in accept: Protocol error + You might try starting the server with the --back_log=50 option as a workaround for this. * To configure the generation of core files on Solaris you should use the coreadm command. Because of the security - implications of generating a core on a setuid() application, - by default, Solaris does not support core files on setuid() - programs. However, you can modify this behavior using coreadm. - If you enable setuid() core files for the current user, they - will be generated using the mode 600 and owned by the - superuser. + implications of generating a core on a setuid() + application, by default, Solaris does not support core + files on setuid() programs. However, you can modify this + behavior using coreadm. If you enable setuid() core files + for the current user, they will be generated using the + mode 600 and owned by the superuser. -2.6.1. Installing MySQL on Solaris Using a Solaris PKG +2.7.1 Installing MySQL on Solaris Using a Solaris PKG - You can install MySQL on Solaris and OpenSolaris using a binary - package using the native Solaris PKG format instead of the binary - tarball distribution. + You can install MySQL on Solaris and OpenSolaris using a + binary package using the native Solaris PKG format instead of + the binary tarball distribution. To use this package, download the corresponding - mysql-VERSION-solaris10-PLATFORM.pkg.gz file, then uncompress it. - For example: -shell> gunzip mysql-5.6.17-solaris10-x86_64.pkg.gz + mysql-VERSION-solaris10-PLATFORM.pkg.gz file, then uncompress + it. For example: +shell> gunzip mysql-5.6.23-solaris10-x86_64.pkg.gz To install a new package, use pkgadd and follow the onscreen - prompts. You must have root privileges to perform this operation: -shell> pkgadd -d mysql-5.6.17-solaris10-x86_64.pkg + prompts. You must have root privileges to perform this + operation: +shell> pkgadd -d mysql-5.6.23-solaris10-x86_64.pkg The following packages are available: 1 mysql MySQL Community Server (GPL) - (i86pc) 5.6.17 + (i86pc) 5.6.23 Select package(s) you wish to process (or 'all' to process all packages). (default: all) [?,??,q]: - The PKG installer installs all of the files and tools needed, and - then initializes your database if one does not exist. To complete - the installation, you should set the root password for MySQL as - provided in the instructions at the end of the installation. - Alternatively, you can run the mysql_secure_installation script - that comes with the installation. - - By default, the PKG package installs MySQL under the root path - /opt/mysql. You can change only the installation root path when - using pkgadd, which can be used to install MySQL in a different - Solaris zone. If you need to install in a specific directory, use - a binary tar file distribution. - - The pkg installer copies a suitable startup script for MySQL into - /etc/init.d/mysql. To enable MySQL to startup and shutdown - automatically, you should create a link between this file and the - init script directories. For example, to ensure safe startup and - shutdown of MySQL you could use the following commands to add the - right links: + The PKG installer installs all of the files and tools needed, + and then initializes your database if one does not exist. To + complete the installation, you should set the root password + for MySQL as provided in the instructions at the end of the + installation. Alternatively, you can run the + mysql_secure_installation script that comes with the + installation. + + By default, the PKG package installs MySQL under the root + path /opt/mysql. You can change only the installation root + path when using pkgadd, which can be used to install MySQL in + a different Solaris zone. If you need to install in a + specific directory, use a binary tar file distribution. + + The pkg installer copies a suitable startup script for MySQL + into /etc/init.d/mysql. To enable MySQL to startup and + shutdown automatically, you should create a link between this + file and the init script directories. For example, to ensure + safe startup and shutdown of MySQL you could use the + following commands to add the right links: shell> ln /etc/init.d/mysql /etc/rc3.d/S91mysql shell> ln /etc/init.d/mysql /etc/rc0.d/K02mysql - To remove MySQL, the installed package name is mysql. You can use - this in combination with the pkgrm command to remove the + To remove MySQL, the installed package name is mysql. You can + use this in combination with the pkgrm command to remove the installation. - To upgrade when using the Solaris package file format, you must - remove the existing installation before installing the updated - package. Removal of the package does not delete the existing - database information, only the server, binaries and support files. - The typical upgrade sequence is therefore: + To upgrade when using the Solaris package file format, you + must remove the existing installation before installing the + updated package. Removal of the package does not delete the + existing database information, only the server, binaries and + support files. The typical upgrade sequence is therefore: shell> mysqladmin shutdown shell> pkgrm mysql -shell> pkgadd -d mysql-5.6.17-solaris10-x86_64.pkg +shell> pkgadd -d mysql-5.6.23-solaris10-x86_64.pkg shell> mysqld_safe & shell> mysql_upgrade You should check the notes in Section 2.11, "Upgrading or Downgrading MySQL" before performing any upgrade. -2.6.2. Installing MySQL on OpenSolaris Using IPS +2.7.2 Installing MySQL on OpenSolaris Using IPS OpenSolaris includes standard packages for MySQL in the core - repository. The MySQL packages are based on a specific release of - MySQL and updated periodically. For the latest release you must - use either the native Solaris PKG, tar, or source installations. - The native OpenSolaris packages include SMF files so that you can - easily control your MySQL installation, including automatic - startup and recovery, using the native service management tools. - - To install MySQL on OpenSolaris, use the pkg command. You will - need to be logged in as root, or use the pfexec tool, as shown in - the example below: + repository. The MySQL packages are based on a specific + release of MySQL and updated periodically. For the latest + release you must use either the native Solaris PKG, tar, or + source installations. The native OpenSolaris packages include + SMF files so that you can easily control your MySQL + installation, including automatic startup and recovery, using + the native service management tools. + + To install MySQL on OpenSolaris, use the pkg command. You + will need to be logged in as root, or use the pfexec tool, as + shown in the example below: shell> pfexec pkg install SUNWmysql56 The package set installs three individual packages, SUNWmysql56lib, which contains the MySQL client libraries; - SUNWmysql56r which contains the root components, including SMF and - configuration files; and SUNWmysql56u which contains the scripts, - binary tools and other files. You can install these packages - individually if you only need the corresponding components. - - The MySQL files are installed into /usr/mysql which symbolic links - for the sub directories (bin, lib, etc.) to a version specific - directory. For MySQL 5.6, the full installation is located in - /usr/mysql/5.6. The default data directory is /var/mysql/5.6/data. - The configuration file is installed in /etc/mysql/5.6/my.cnf. This - layout permits multiple versions of MySQL to be installed, without - overwriting the data and binaries from other versions. - - Once installed, you must run mysql_install_db to initialize the - database, and use the mysql_secure_installation to secure your - installation. + SUNWmysql56r which contains the root components, including + SMF and configuration files; and SUNWmysql56u which contains + the scripts, binary tools and other files. You can install + these packages individually if you only need the + corresponding components. + + The MySQL files are installed into /usr/mysql which symbolic + links for the sub directories (bin, lib, etc.) to a version + specific directory. For MySQL 5.6, the full installation is + located in /usr/mysql/5.6. The default data directory is + /var/mysql/5.6/data. The configuration file is installed in + /etc/mysql/5.6/my.cnf. This layout permits multiple versions + of MySQL to be installed, without overwriting the data and + binaries from other versions. + + Once installed, you must run mysql_install_db to initialize + the database, and use the mysql_secure_installation to secure + your installation. Using SMF to manage your MySQL installation - Once installed, you can start and stop your MySQL server using the - installed SMF configuration. The service name is mysql, or if you - have multiple versions installed, you should use the full version - name, for example mysql:version_56. To start and enable MySQL to - be started at boot time: + Once installed, you can start and stop your MySQL server + using the installed SMF configuration. The service name is + mysql, or if you have multiple versions installed, you should + use the full version name, for example mysql:version_56. To + start and enable MySQL to be started at boot time: shell> svcadm enable mysql To disable MySQL from starting during boot time, and shut the MySQL server down if it is running, use: shell> svcadm disable mysql - To restart MySQL, for example after a configuration file changes, - use the restart option: + To restart MySQL, for example after a configuration file + changes, use the restart option: shell> svcadm restart mysql - You can also use SMF to configure the data directory and enable - full 64-bit mode. For example, to set the data directory used by - MySQL: -shell> svccfg -svc:> select mysql:version_56 -svc:/application/database/mysql:version_56> setprop mysql/data=/data0 -/mysql - + You can also use SMF to configure the data directory and + enable full 64-bit mode. For example, to set the data + directory used by MySQL: +shell> svccfg +svc:> select mysql:version_56 +svc:/application/database/mysql:version_56> setprop mysql/data=/data0/ +mysql - By default, the 32-bit binaries are used. To enable the 64-bit - server on 64-bit platforms, set the enable_64bit parameter. For - example: -svc:/application/database/mysql:version_56> setprop mysql/enable_64bi -t=1 + By default, the 32-bit binaries are used. To enable the + 64-bit server on 64-bit platforms, set the enable_64bit + parameter. For example: +svc:/application/database/mysql:version_56> setprop mysql/enable_64bit +=1 You need to refresh the SMF after settings these options: shell> svcadm refresh mysql -2.7. Installing MySQL on HP-UX - - MySQL for HP-UX is available in a number of different forms: - - * Using a DEPOT distribution provided at - http://dev.mysql.com/downloads/. Please read the general notes - on HP-UX installation before continuing. For more information - on DEPOT installations, see Section 2.7.2, "Installing MySQL - on HP-UX Using DEPOT Packages." - - * Using a binary tarball distribution provided at - http://dev.mysql.com/downloads/. Please read the general notes - on HP-UX installation before continuing. For more information - on binary installations, see Section 2.2, "Installing MySQL on - Unix/Linux Using Generic Binaries." - -2.7.1. General Notes on Installing MySQL on HP-UX - - Some additional notes on installing and using MySQL on HP-UX: - - * If you install MySQL using a binary tarball distribution on - HP-UX, you may run into trouble even before you get the MySQL - distribution unpacked, as the HP-UX tar cannot handle long - file names. This means that you may see errors when you try to - unpack MySQL. - If this occurs, you must use GNU tar (gtar) to unpack the - distribution. - - * Because of some critical bugs in the standard HP-UX libraries, - you should install the following patches before trying to run - MySQL on HP-UX 11.0: -PHKL_22840 Streams cumulative -PHNE_22397 ARPA cumulative - This solves the problem of getting EWOULDBLOCK from recv() and - EBADF from accept() in threaded applications. - -2.7.2. Installing MySQL on HP-UX Using DEPOT Packages - - The HP-UX DEPOT format packages can be installed using the - swinstall command. You should install the ncurses and zlib - libraries before installing the MySQL DEPOT package. You can use - the free software depothelper tool to install these packages and - any dependencies for you automatically. - - To install using the MySQL DEPOT packages, follow this guide: - - 1. Download the MySQL DEPOT package from - http://dev.mysql.com/downloads/. You must uncompress the - package before installation: -root-shell> gunzip mysql-5.1.48-hpux11.31-ia64-64bit.depot.gz - - 2. Install the DEPOT package using swinstall: -root-shell> swinstall -s mysql-5.1.49-hpux11.31-ia64-64bit.depot - MySQL will be installed into a directory matching the depot - package name, within /usr/local. For convenience, you may want - to create a symbolic link to the installed directory, for - example: -root-shell> ln -s mysql-5.1.49-hpux11.31-ia64-64bit mysql - - 3. Your package is now installed. You should complete the - configuration of MySQL by creating a user and group: -root-shell> /usr/sbin/groupadd mysql -root-shell> /usr/sbin/useradd -g mysql -d /var/lib/mysql/ -s /bin/fal -se mysql - - 4. Create the standard database using the new user/group you have - created, and set the permissions: -root-shell> cd /usr/local/ -root-shell> scripts/mysql_install_db --user=mysql -root-shell> chown -R root . -root-shell> chown -R mysql data - - 5. Finally, secure your new installation by setting the root - passwords, and then start your MySQL server using the mysql - user: -root-shell> mysql_secure_installation -root-shell> mysqld_safe --user=mysql & - -2.8. Installing MySQL on FreeBSD +2.8 Installing MySQL on FreeBSD This section provides information about installing MySQL on variants of FreeBSD Unix. - You can install MySQL on FreeBSD by using the binary distribution - provided by Oracle. For more information, see Section 2.2, - "Installing MySQL on Unix/Linux Using Generic Binaries." + You can install MySQL on FreeBSD by using the binary + distribution provided by Oracle. For more information, see + Section 2.2, "Installing MySQL on Unix/Linux Using Generic + Binaries." - The easiest (and preferred) way to install MySQL is to use the - mysql-server and mysql-client ports available at - http://www.freebsd.org/. Using these ports gives you the following - benefits: + The easiest (and preferred) way to install MySQL is to use + the mysql-server and mysql-client ports available at + http://www.freebsd.org/. Using these ports gives you the + following benefits: - * A working MySQL with all optimizations enabled that are known - to work on your version of FreeBSD. + * A working MySQL with all optimizations enabled that are + known to work on your version of FreeBSD. * Automatic configuration and build. @@ -4537,12 +5193,12 @@ root-shell> mysqld_safe --user=mysql & * The ability to use pkg_info -L to see which files are installed. - * The ability to use pkg_delete to remove MySQL if you no longer - want it on your machine. + * The ability to use pkg_delete to remove MySQL if you no + longer want it on your machine. - The MySQL build process requires GNU make (gmake) to work. If GNU - make is not available, you must install it first before compiling - MySQL. + The MySQL build process requires GNU make (gmake) to work. If + GNU make is not available, you must install it first before + compiling MySQL. To install using the ports system: # cd /usr/ports/databases/mysql51-server @@ -4553,12 +5209,13 @@ root-shell> mysqld_safe --user=mysql & ... The standard port installation places the server into - /usr/local/libexec/mysqld, with the startup script for the MySQL - server placed in /usr/local/etc/rc.d/mysql-server. + /usr/local/libexec/mysqld, with the startup script for the + MySQL server placed in /usr/local/etc/rc.d/mysql-server. Some additional notes on the BSD implementation: - * To remove MySQL after installation using the ports system: + * To remove MySQL after installation using the ports + system: # cd /usr/ports/databases/mysql51-server # make deinstall ... @@ -4566,192 +5223,216 @@ root-shell> mysqld_safe --user=mysql & # make deinstall ... - * If you get problems with the current date in MySQL, setting - the TZ variable should help. See Section 2.12, "Environment - Variables." -2.9. Installing MySQL from Source + * If you get problems with the current date in MySQL, + setting the TZ variable should help. See Section 2.12, + "Environment Variables." + +2.9 Installing MySQL from Source - Building MySQL from the source code enables you to customize build - parameters, compiler optimizations, and installation location. For - a list of systems on which MySQL is known to run, see Section - 2.1.1, "Operating Systems Supported by MySQL Community Server." + Building MySQL from the source code enables you to customize + build parameters, compiler optimizations, and installation + location. For a list of systems on which MySQL is known to + run, see + http://www.mysql.com/support/supportedplatforms/database.html + . - Before you proceed with an installation from source, check whether - Oracle produces a precompiled binary distribution for your - platform and whether it works for you. We put a great deal of - effort into ensuring that our binaries are built with the best - possible options for optimal performance. Instructions for - installing binary distributions are available in Section 2.2, - "Installing MySQL on Unix/Linux Using Generic Binaries." + Before you proceed with an installation from source, check + whether Oracle produces a precompiled binary distribution for + your platform and whether it works for you. We put a great + deal of effort into ensuring that our binaries are built with + the best possible options for optimal performance. + Instructions for installing binary distributions are + available in Section 2.2, "Installing MySQL on Unix/Linux + Using Generic Binaries." Source Installation Methods There are two methods for installing MySQL from source: - * Use a standard MySQL source distribution. To obtain a standard - distribution, see Section 2.1.3, "How to Get MySQL." For - instructions on building from a standard distribution, see - Section 2.9.2, "Installing MySQL Using a Standard Source - Distribution." - Standard distributions are available as compressed tar files, - Zip archives, or RPM packages. Distribution files have names - of the form mysql-VERSION.tar.gz, mysql-VERSION.zip, or - mysql-VERSION.rpm, where VERSION is a number like 5.6.17. File - names for source distributions can be distinguished from those - for precompiled binary distributions in that source - distribution names are generic and include no platform name, - whereas binary distribution names include a platform name - indicating the type of system for which the distribution is - intended (for example, pc-linux-i686 or winx64). - - * Use a MySQL development tree. Development trees have not - necessarily received the same level of testing as standard - release distributions, so this installation method is usually - required only if you need the most recent code changes. For - information on building from one of the development trees, see - Section 2.9.3, "Installing MySQL Using a Development Source - Tree." + * Use a standard MySQL source distribution. To obtain a + standard distribution, see Section 2.1.3, "How to Get + MySQL." For instructions on building from a standard + distribution, see Section 2.9.2, "Installing MySQL Using + a Standard Source Distribution." + Standard distributions are available as compressed tar + files, Zip archives, or RPM packages. Distribution files + have names of the form mysql-VERSION.tar.gz, + mysql-VERSION.zip, or mysql-VERSION.rpm, where VERSION is + a number like 5.6.23. File names for source distributions + can be distinguished from those for precompiled binary + distributions in that source distribution names are + generic and include no platform name, whereas binary + distribution names include a platform name indicating the + type of system for which the distribution is intended + (for example, pc-linux-i686 or winx64). + + * Use a MySQL development tree. For information on building + from one of the development trees, see Section 2.9.3, + "Installing MySQL Using a Development Source Tree." Source Installation System Requirements - Installation of MySQL from source requires several development - tools. Some of these tools are needed no matter whether you use a - standard source distribution or a development source tree. Other - tool requirements depend on which installation method you use. + Installation of MySQL from source requires several + development tools. Some of these tools are needed no matter + whether you use a standard source distribution or a + development source tree. Other tool requirements depend on + which installation method you use. - To install MySQL from source, your system must have the following - tools, regardless of installation method: + To install MySQL from source, your system must have the + following tools, regardless of installation method: - * CMake, which is used as the build framework on all platforms. - CMake can be downloaded from http://www.cmake.org. + * CMake, which is used as the build framework on all + platforms. CMake can be downloaded from + http://www.cmake.org. - * A good make program. Although some platforms come with their - own make implementations, it is highly recommended that you - use GNU make 3.75 or newer. It may already be available on - your system as gmake. GNU make is available from - http://www.gnu.org/software/make/. + * A good make program. Although some platforms come with + their own make implementations, it is highly recommended + that you use GNU make 3.75 or newer. It may already be + available on your system as gmake. GNU make is available + from http://www.gnu.org/software/make/. - * A working ANSI C++ compiler. GCC 4.2.1 or later, Sun Studio 10 - or later, Visual Studio 2008 or later, and many current - vendor-supplied compilers are known to work. + * A working ANSI C++ compiler. GCC 4.2.1 or later, Sun + Studio 12 or later, Visual Studio 2010 or later, and many + current vendor-supplied compilers are known to work. * Perl is needed if you intend to run test scripts. Most Unix-like systems include Perl. On Windows, you can use a version such as ActiveState Perl. - To install MySQL from a standard source distribution, one of the - following tools is required to unpack the distribution file: - - * For a .tar.gz compressed tar file: GNU gunzip to uncompress - the distribution and a reasonable tar to unpack it. If your - tar program supports the z option, it can both uncompress and - unpack the file. - GNU tar is known to work. The standard tar provided with some - operating systems is not able to unpack the long file names in - the MySQL distribution. You should download and install GNU - tar, or if available, use a preinstalled version of GNU tar. - Usually this is available as gnutar, gtar, or as tar within a - GNU or Free Software directory, such as /usr/sfw/bin or - /usr/local/bin. GNU tar is available from - http://www.gnu.org/software/tar/. - - * For a .zip Zip archive: WinZip or another tool that can read - .zip files. - - * For an .rpm RPM package: The rpmbuild program used to build - the distribution unpacks it. - - To install MySQL from a development source tree, the following - additional tools are required: - - * To obtain the source tree, you must have Bazaar installed. The - Bazaar VCS Web site (http://bazaar-vcs.org) has instructions - for downloading and installing Bazaar on different platforms. - Bazaar is supported on any platform that supports Python, and - is therefore compatible with any Linux, Unix, Windows, or Mac - OS X host. - - * bison is needed to generate sql_yacc.cc from sql_yacc.yy You - should use the latest version of bison where possible. - Versions 1.75 and 2.1 are known to work. There have been - reported problems with bison 1.875. If you experience - problems, upgrade to a later, rather than earlier, version. - bison is available from http://www.gnu.org/software/bison/. - bison for Windows can be downloaded from - http://gnuwin32.sourceforge.net/packages/bison.htm. Download - the package labeled "Complete package, excluding sources". On - Windows, the default location for bison is the C:\Program - Files\GnuWin32 directory. Some utilities may fail to find - bison because of the space in the directory name. Also, Visual - Studio may simply hang if there are spaces in the path. You - can resolve these problems by installing into a directory that - does not contain a space; for example C:\GnuWin32. - - * On OpenSolaris and Solaris Express, m4 must be installed in - addition to bison. m4 is available from + To install MySQL from a standard source distribution, one of + the following tools is required to unpack the distribution + file: + + * For a .tar.gz compressed tar file: GNU gunzip to + uncompress the distribution and a reasonable tar to + unpack it. If your tar program supports the z option, it + can both uncompress and unpack the file. + GNU tar is known to work. The standard tar provided with + some operating systems is not able to unpack the long + file names in the MySQL distribution. You should download + and install GNU tar, or if available, use a preinstalled + version of GNU tar. Usually this is available as gnutar, + gtar, or as tar within a GNU or Free Software directory, + such as /usr/sfw/bin or /usr/local/bin. GNU tar is + available from http://www.gnu.org/software/tar/. + + * For a .zip Zip archive: WinZip or another tool that can + read .zip files. + + * For an .rpm RPM package: The rpmbuild program used to + build the distribution unpacks it. + + To install MySQL from a development source tree, the + following additional tools are required: + + * One of the following revision control systems is required + to obtain the development source code: + + + Git: The GitHub Help (https://help.github.com/) + provides instructions for downloading and installing + Git on different platforms. MySQL officially joined + GitHub in September, 2014. For more information + about MySQL's move to GitHub, refer to the + announcement on the MySQL Release Engineering blog: + MySQL on GitHub + (http://mysqlrelease.com/2014/09/mysql-on-github/) + + + Bazaar: The Bazaar VCS Web site + (http://bazaar-vcs.org) provides instructions for + downloading and installing Bazaar on different + platforms. Bazaar is supported on any platform that + supports Python, and is therefore compatible with + any Linux, Unix, Windows, or OS X host. + + * bison 2.1 or newer, available from + http://www.gnu.org/software/bison/. (Version 1 is no + longer supported.) Use the latest version of bison where + possible; if you experience problems, upgrade to a later + version, rather than revert to an earlier one. + bison is available from + http://www.gnu.org/software/bison/. bison for Windows can + be downloaded from + http://gnuwin32.sourceforge.net/packages/bison.htm. + Download the package labeled "Complete package, excluding + sources". On Windows, the default location for bison is + the C:\Program Files\GnuWin32 directory. Some utilities + may fail to find bison because of the space in the + directory name. Also, Visual Studio may simply hang if + there are spaces in the path. You can resolve these + problems by installing into a directory that does not + contain a space; for example C:\GnuWin32. + + * On OpenSolaris and Solaris Express, m4 must be installed + in addition to bison. m4 is available from http://www.gnu.org/software/m4/. Note - If you have to install any programs, modify your PATH environment - variable to include any directories in which the programs are - located. See Section 4.2.4, "Setting Environment Variables." + If you have to install any programs, modify your PATH + environment variable to include any directories in which the + programs are located. See Section 4.2.10, "Setting + Environment Variables." - If you run into problems and need to file a bug report, please use - the instructions in Section 1.7, "How to Report Bugs or Problems." - -2.9.1. MySQL Layout for Source Installation + If you run into problems and need to file a bug report, + please use the instructions in Section 1.7, "How to Report + Bugs or Problems." - By default, when you install MySQL after compiling it from source, - the installation step installs files under /usr/local/mysql. The - component locations under the installation directory are the same - as for binary distributions. See Section 2.2, "MySQL Installation - Layout for Generic Unix/Linux Binary Package," and Section 2.3.1, - "MySQL Installation Layout on Microsoft Windows." To configure - installation locations different from the defaults, use the - options described at Section 2.9.4, "MySQL Source-Configuration - Options." +2.9.1 MySQL Layout for Source Installation + + By default, when you install MySQL after compiling it from + source, the installation step installs files under + /usr/local/mysql. The component locations under the + installation directory are the same as for binary + distributions. See Section 2.2, "MySQL Installation Layout + for Generic Unix/Linux Binary Package," and Section 2.3.1, + "MySQL Installation Layout on Microsoft Windows." To + configure installation locations different from the defaults, + use the options described at Section 2.9.4, "MySQL + Source-Configuration Options." -2.9.2. Installing MySQL Using a Standard Source Distribution +2.9.2 Installing MySQL Using a Standard Source Distribution To install MySQL from a standard source distribution: - 1. Verify that your system satisfies the tool requirements listed - at Section 2.9, "Installing MySQL from Source." + 1. Verify that your system satisfies the tool requirements + listed at Section 2.9, "Installing MySQL from Source." - 2. Obtain a distribution file using the instructions in Section - 2.1.3, "How to Get MySQL." + 2. Obtain a distribution file using the instructions in + Section 2.1.3, "How to Get MySQL." 3. Configure, build, and install the distribution using the instructions in this section. - 4. Perform postinstallation procedures using the instructions in - Section 2.10, "Postinstallation Setup and Testing." + 4. Perform postinstallation procedures using the + instructions in Section 2.10, "Postinstallation Setup and + Testing." In MySQL 5.6, CMake is used as the build framework on all platforms. The instructions given here should enable you to produce a working installation. For additional information on - using CMake to build MySQL, see How to Build MySQL Server with - CMake (http://dev.mysql.com/doc/internals/en/cmake.html). + using CMake to build MySQL, see How to Build MySQL Server + with CMake + (http://dev.mysql.com/doc/internals/en/cmake.html). - If you start from a source RPM, use the following command to make - a binary RPM that you can install. If you do not have rpmbuild, - use rpm instead. + If you start from a source RPM, use the following command to + make a binary RPM that you can install. If you do not have + rpmbuild, use rpm instead. shell> rpmbuild --rebuild --clean MySQL-VERSION.src.rpm - The result is one or more binary RPM packages that you install as - indicated in Section 2.5.3, "Installing MySQL on Linux Using RPM - Packages." - - The sequence for installation from a compressed tar file or Zip - archive source distribution is similar to the process for - installing from a generic binary distribution (see Section 2.2, - "Installing MySQL on Unix/Linux Using Generic Binaries"), except - that it is used on all platforms and includes steps to configure - and compile the distribution. For example, with a compressed tar - file source distribution on Unix, the basic installation command - sequence looks like this: + The result is one or more binary RPM packages that you + install as indicated in Section 2.5.5, "Installing MySQL on + Linux Using RPM Packages." + + The sequence for installation from a compressed tar file or + Zip archive source distribution is similar to the process for + installing from a generic binary distribution (see Section + 2.2, "Installing MySQL on Unix/Linux Using Generic + Binaries"), except that it is used on all platforms and + includes steps to configure and compile the distribution. For + example, with a compressed tar file source distribution on + Unix, the basic installation command sequence looks like + this: # Preconfiguration setup shell> groupadd mysql shell> useradd -r -g mysql mysql @@ -4773,51 +5454,55 @@ shell> bin/mysqld_safe --user=mysql & # Next command is optional shell> cp support-files/mysql.server /etc/init.d/mysql.server - mysql_install_db creates a default option file named my.cnf in the - base installation directory. This file is created from a template - included in the distribution package named my-default.cnf. For - more information, see Section 5.1.2.2, "Using a Sample Default - Server Configuration File." + mysql_install_db creates a default option file named my.cnf + in the base installation directory. This file is created from + a template included in the distribution package named + my-default.cnf. For more information, see Section 5.1.2.2, + "Using a Sample Default Server Configuration File." - A more detailed version of the source-build specific instructions - is shown following. + A more detailed version of the source-build specific + instructions is shown following. Note - The procedure shown here does not set up any passwords for MySQL - accounts. After following the procedure, proceed to Section 2.10, - "Postinstallation Setup and Testing," for postinstallation setup - and testing. + The procedure shown here does not set up any passwords for + MySQL accounts. After following the procedure, proceed to + Section 2.10, "Postinstallation Setup and Testing," for + postinstallation setup and testing. Perform Preconfiguration Setup - On Unix, set up the mysql user and group that will be used to run - and execute the MySQL server and own the database directory. For - details, see Creating a mysql System User and Group, in Section - 2.2, "Installing MySQL on Unix/Linux Using Generic Binaries." Then - perform the following steps as the mysql user, except as noted. + On Unix, set up the mysql user and group that will be used to + run and execute the MySQL server and own the database + directory. For details, see Creating a mysql System User and + Group, in Section 2.2, "Installing MySQL on Unix/Linux Using + Generic Binaries." Then perform the following steps as the + mysql user, except as noted. Obtain and Unpack the Distribution - Pick the directory under which you want to unpack the distribution - and change location into it. + Pick the directory under which you want to unpack the + distribution and change location into it. Obtain a distribution file using the instructions in Section 2.1.3, "How to Get MySQL." Unpack the distribution into the current directory: - * To unpack a compressed tar file, tar can uncompress and unpack - the distribution if it has z option support: + * To unpack a compressed tar file, tar can uncompress and + unpack the distribution if it has z option support: shell> tar zxvf mysql-VERSION.tar.gz + If your tar does not have z option support, use gunzip to unpack the distribution and tar to unpack it: shell> gunzip < mysql-VERSION.tar.gz | tar xvf - + Alternatively, CMake can uncompress and unpack the distribution: shell> cmake -E tar zxvf mysql-VERSION.tar.gz - * To unpack a Zip archive, use WinZip or another tool that can - read .zip files. + + * To unpack a Zip archive, use WinZip or another tool that + can read .zip files. Unpacking the distribution file creates a directory named mysql-VERSION. @@ -4828,36 +5513,40 @@ Configure the Distribution distribution: shell> cd mysql-VERSION - Configure the source directory. The minimum configuration command - includes no options to override configuration defaults: + Configure the source directory. The minimum configuration + command includes no options to override configuration + defaults: shell> cmake . - On Windows, specify the development environment. For example, the - following commands configure MySQL for 32-bit or 64-bit builds, - respectively: -shell> cmake . -G "Visual Studio 9 2008" -shell> cmake . -G "Visual Studio 9 2008 Win64" + On Windows, specify the development environment. For example, + the following commands configure MySQL for 32-bit or 64-bit + builds, respectively: +shell> cmake . -G "Visual Studio 10 2010" +shell> cmake . -G "Visual Studio 10 2010 Win64" - On Mac OS X, to use the Xcode IDE: + On OS X, to use the Xcode IDE: shell> cmake . -G Xcode - When you run cmake, you might want to add options to the command - line. Here are some examples: + When you run cmake, you might want to add options to the + command line. Here are some examples: - * -DBUILD_CONFIG=mysql_release: Configure the source with the - same build options used by Oracle to produce binary + * -DBUILD_CONFIG=mysql_release: Configure the source with + the same build options used by Oracle to produce binary distributions for official MySQL releases. - * -DCMAKE_INSTALL_PREFIX=dir_name: Configure the distribution - for installation under a particular location. + * -DCMAKE_INSTALL_PREFIX=dir_name: Configure the + distribution for installation under a particular + location. - * -DCPACK_MONOLITHIC_INSTALL=1: Cause make package to generate a - single installation file rather than multiple files. + * -DCPACK_MONOLITHIC_INSTALL=1: Cause make package to + generate a single installation file rather than multiple + files. - * -DWITH_DEBUG=1: Build the distribution with debugging support. + * -DWITH_DEBUG=1: Build the distribution with debugging + support. - For a more extensive list of options, see Section 2.9.4, "MySQL - Source-Configuration Options." + For a more extensive list of options, see Section 2.9.4, + "MySQL Source-Configuration Options." To list the configuration options, use one of the following commands: @@ -4866,24 +5555,26 @@ shell> cmake . -LH # overview with help text shell> cmake . -LAH # all params with help text shell> ccmake . # interactive display - If CMake fails, you might need to reconfigure by running it again - with different options. If you do reconfigure, take note of the - following: + If CMake fails, you might need to reconfigure by running it + again with different options. If you do reconfigure, take + note of the following: - * If CMake is run after it has previously been run, it may use - information that was gathered during its previous invocation. - This information is stored in CMakeCache.txt. When CMake - starts up, it looks for that file and reads its contents if it - exists, on the assumption that the information is still - correct. That assumption is invalid when you reconfigure. + * If CMake is run after it has previously been run, it may + use information that was gathered during its previous + invocation. This information is stored in CMakeCache.txt. + When CMake starts up, it looks for that file and reads + its contents if it exists, on the assumption that the + information is still correct. That assumption is invalid + when you reconfigure. - * Each time you run CMake, you must run make again to recompile. - However, you may want to remove old object files from previous - builds first because they were compiled using different - configuration options. + * Each time you run CMake, you must run make again to + recompile. However, you may want to remove old object + files from previous builds first because they were + compiled using different configuration options. To prevent old object files or configuration information from - being used, run these commands on Unix before re-running CMake: + being used, run these commands on Unix before re-running + CMake: shell> make clean shell> rm CMakeCache.txt @@ -4893,14 +5584,14 @@ shell> del CMakeCache.txt If you build out of the source tree (as described later), the CMakeCache.txt file and all built files are in the build - directory, so you can remove that directory to object files and - cached configuration information. + directory, so you can remove that directory to object files + and cached configuration information. - If you are going to send mail to a MySQL mailing list to ask for - configuration assistance, first check the files in the CMakeFiles - directory for useful information about the failure. To file a bug - report, please use the instructions in Section 1.7, "How to Report - Bugs or Problems." + If you are going to send mail to a MySQL mailing list to ask + for configuration assistance, first check the files in the + CMakeFiles directory for useful information about the + failure. To file a bug report, please use the instructions in + Section 1.7, "How to Report Bugs or Problems." Build the Distribution @@ -4911,31 +5602,49 @@ shell> make VERBOSE=1 The second command sets VERBOSE to show the commands for each compiled source. - Use gmake instead on systems where you are using GNU make and it - has been installed as gmake. + Use gmake instead on systems where you are using GNU make and + it has been installed as gmake. On Windows: shell> devenv MySQL.sln /build RelWithDebInfo - It is possible to build out of the source tree to keep the tree - clean. If the top-level source directory is named mysql-src under - your current working directory, you can build in a directory named - build at the same level like this: -shell> mkdir build -shell> cd build + It is possible to build out of the source tree to keep the + tree clean. If the top-level source directory is named + mysql-src under your current working directory, you can build + in a directory named bld at the same level like this: +shell> mkdir bld +shell> cd bld shell> cmake ../mysql-src - If you have gotten to the compilation stage, but the distribution - does not build, see Section 2.9.5, "Dealing with Problems - Compiling MySQL," for help. If that does not solve the problem, - please enter it into our bugs database using the instructions - given in Section 1.7, "How to Report Bugs or Problems." If you - have installed the latest versions of the required tools, and they - crash trying to process our configuration files, please report - that also. However, if you get a command not found error or a - similar problem for required tools, do not report it. Instead, - make sure that all the required tools are installed and that your - PATH variable is set correctly so that your shell can find them. + The build directory need not actually be outside the source + tree. For example, to build in a directory, you can build in + a directory named bld under the top-level source tree, do + this, starting with mysql-src as your current working + directory: +shell> mkdir bld +shell> cd bld +shell> cmake .. + + If you have multiple source trees at the same level (for + example, to build multiple versions of MySQL), the second + strategy can be advantageous. The first strategy places all + build directories at the same level, which requires that you + choose a unique name for each. With the second strategy, you + can use the same name for the build directory within each + source tree. + + If you have gotten to the compilation stage, but the + distribution does not build, see Section 2.9.5, "Dealing with + Problems Compiling MySQL," for help. If that does not solve + the problem, please enter it into our bugs database using the + instructions given in Section 1.7, "How to Report Bugs or + Problems." If you have installed the latest versions of the + required tools, and they crash trying to process our + configuration files, please report that also. However, if you + get a command not found error or a similar problem for + required tools, do not report it. Instead, make sure that all + the required tools are installed and that your PATH variable + is set correctly so that your shell can find them. Install the Distribution @@ -4943,191 +5652,332 @@ Install the Distribution shell> make install This installs the files under the configured installation - directory (by default, /usr/local/mysql). You might need to run - the command as root. + directory (by default, /usr/local/mysql). You might need to + run the command as root. - To install in a specific directory, add a DESTDIR parameter to the - command line: + To install in a specific directory, add a DESTDIR parameter + to the command line: shell> make install DESTDIR="/opt/mysql" - Alternatively, generate installation package files that you can - install where you like: + Alternatively, generate installation package files that you + can install where you like: shell> make package This operation produces one or more .tar.gz files that can be - installed like generic binary distribution packages. See Section - 2.2, "Installing MySQL on Unix/Linux Using Generic Binaries." If - you run CMake with -DCPACK_MONOLITHIC_INSTALL=1, the operation - produces a single file. Otherwise, it produces multiple files. + installed like generic binary distribution packages. See + Section 2.2, "Installing MySQL on Unix/Linux Using Generic + Binaries." If you run CMake with + -DCPACK_MONOLITHIC_INSTALL=1, the operation produces a single + file. Otherwise, it produces multiple files. On Windows, generate the data directory, then create a .zip archive installation package: -shell> devenv MySQL.sln /build RelWithDebInfo /project initial_databa -se +shell> devenv MySQL.sln /build RelWithDebInfo /project initial_databas +e shell> devenv MySQL.sln /build RelWithDebInfo /project package - You can install the resulting .zip archive where you like. See - Section 2.3.5, "Installing MySQL on Microsoft Windows Using a - noinstall Zip Archive." + You can install the resulting .zip archive where you like. + See Section 2.3.5, "Installing MySQL on Microsoft Windows + Using a noinstall Zip Archive." Perform Postinstallation Setup - The remainder of the installation process involves setting up the - configuration file, creating the core databases, and starting the - MySQL server. For instructions, see Section 2.10, - "Postinstallation Setup and Testing." + The remainder of the installation process involves setting up + the configuration file, creating the core databases, and + starting the MySQL server. For instructions, see Section + 2.10, "Postinstallation Setup and Testing." Note - The accounts that are listed in the MySQL grant tables initially - have no passwords. After starting the server, you should set up - passwords for them using the instructions in Section 2.10, - "Postinstallation Setup and Testing." + The accounts that are listed in the MySQL grant tables + initially have no passwords. After starting the server, you + should set up passwords for them using the instructions in + Section 2.10, "Postinstallation Setup and Testing." + +2.9.3 Installing MySQL Using a Development Source Tree + + This section describes how to install MySQL from the latest + development source code, which is currently hosted on both + GitHub (https://github.com/) and Launchpad + (http://launchpad.net/). To obtain the MySQL Server source + code from one of these repository hosting services, you can + set up a local MySQL Git repository or a local MySQL Bazaar + branch. + + * On GitHub (https://github.com/), MySQL Server and other + MySQL projects are found on the MySQL + (https://github.com/mysql) page. The MySQL Server project + is a single repository that contains branches for MySQL + 5.5, 5.6, and 5.7. + MySQL officially joined GitHub in September, 2014. For + more information about MySQL's move to GitHub, refer to + the announcement on the MySQL Release Engineering blog: + MySQL on GitHub + (http://mysqlrelease.com/2014/09/mysql-on-github/) + + * On Launchpad (http://launchpad.net/), MySQL projects, + including MySQL Server, MySQL Workbench, and others are + found on the Oracle/MySQL Engineering + (http://launchpad.net/~mysql) page. For the repositories + related only to MySQL Server, see the MySQL Server + (http://launchpad.net/mysql-server) page. -2.9.3. Installing MySQL Using a Development Source Tree - - This section discusses how to install MySQL from the latest - development source code. Development trees have not necessarily - received the same level of testing as standard release - distributions, so this installation method is usually required - only if you need the most recent code changes. Do not use a - development tree for production systems. If your goal is simply to - get MySQL up and running on your system, you should use a standard - release distribution (either a binary or source distribution). See - Section 2.1.3, "How to Get MySQL." - - MySQL development projects are hosted on Launchpad - (http://launchpad.net/). MySQL projects, including MySQL Server, - MySQL Workbench, and others are available from the Oracle/MySQL - Engineering (http://launchpad.net/~mysql) page. For the - repositories related only to MySQL Server, see the MySQL Server - (http://launchpad.net/mysql-server) page. - - To install MySQL from a development source tree, your system must - satisfy the tool requirements listed at Section 2.9, "Installing - MySQL from Source," including the requirements for Bazaar and - bison. - - To create a local branch of the MySQL development tree on your - machine, use this procedure: - - 1. To obtain a copy of the MySQL source code, you must create a - new Bazaar branch. If you do not already have a Bazaar +Prerequisites for Installing from Development Source + + To install MySQL from a development source tree, your system + must satisfy the tool requirements outlined in Section 2.9, + "Installing MySQL from Source." + +Setting Up a MySQL Git Repository + + To set up a MySQL Git repository on your machine, use this + procedure: + + 1. Clone the MySQL Git repository to your machine. The + following command clones the MySQL Git repository to a + directory named mysql-server. The download size is + approximately 437 MB. The initial download will take some + time to complete, depending on the speed of your + connection. +~$ git clone https://github.com/mysql/mysql-server.git +Cloning into 'mysql-server'... +remote: Counting objects: 1035465, done. +remote: Total 1035465 (delta 0), reused 0 (delta 0) +Receiving objects: 100% (1035465/1035465), 437.48 MiB | 5.10 MiB/s, do +ne. +Resolving deltas: 100% (855607/855607), done. +Checking connectivity... done. +Checking out files: 100% (21902/21902), done. + + 2. When the clone operation completes, the contents of your + local MySQL Git repository appear similar to the + following: +~$ cd mysql-server + +~/mysql-server$ ls +BUILD COPYING libmysqld regex tests +BUILD-CMAKE dbug libservices scripts unitt +est +client Docs man sql VERSI +ON +cmake extra mysql-test sql-bench vio +CMakeLists.txt include mysys sql-common win +cmd-line-utils INSTALL-SOURCE packaging storage zlib +config.h.cmake INSTALL-WIN-SOURCE plugin strings +configure.cmake libmysql README support-files + + 3. Use the git branch -r command to view the remote tracking + branches for the MySQL repository. +~/mysql-server$ git branch -r + origin/5.5 + origin/5.6 + origin/5.7 + origin/HEAD -> origin/5.7 + + 4. To view the branches that are checked out in your local + repository, issue the git branch command. When you cloned + the MySQL Git repository, the MySQL 5.7 branch was + checked out automatically. The asterisk identifies the + 5.7 branch as the active branch. +~/mysql-server$ git branch +* 5.7 + + 5. To check out a different MySQL branch, run the git + checkout command, specifying the branch name. For + example, to checkout the MySQL 5.6 branch: +~/mysql-server$ git checkout 5.6 +Branch 5.6 set up to track remote branch 5.6 from origin. +Switched to a new branch '5.6' + + 6. Run git branch again to verify that the MySQL 5.6 branch + is present. MySQL 5.6, which is the last branch you + checked out, is marked by an asterisk indicating that it + is the active branch. +~/mysql-server$ git branch +* 5.6 + 5.7 + The git checkout command is also used to switch branches. + For example, to make MySQL 5.7 the active branch again, + you would run git checkout 5.7. + + 7. To obtain changes made after your initial setup of the + MySQL Git repository, switch to the branch you want to + update and issue the git pull command: +~/mysql-server$ git checkout 5.6 +~/mysql-server$ git pull + + To examine the commit history, use the git log option: +~/mysql-server$ git log + + You can also browse commit history and source code on the + GitHub MySQL (https://github.com/mysql) site. + If you see changes or code that you have a question + about, send an email to the MySQL internals mailing list. + See Section 1.6.1, "MySQL Mailing Lists." For information + about contributing a patch, see Contributing to MySQL + Server + (http://mysqlserverteam.com/contributing-to-mysql-server/ + ). + + 8. After you have cloned the MySQL Git repository and have + checked out the branch you want to build, you can build + MySQL Server from the source code. Instructions are + provided in Section 2.9.2, "Installing MySQL Using a + Standard Source Distribution," except that you skip the + part about obtaining and unpacking the distribution. + Be careful about installing a build from a distribution + source tree on a production machine. The installation + command may overwrite your live release installation. If + you already have MySQL installed and do not want to + overwrite it, run CMake with values for the + CMAKE_INSTALL_PREFIX, MYSQL_TCP_PORT, and MYSQL_UNIX_ADDR + options different from those used by your production + server. For additional information about preventing + multiple servers from interfering with each other, see + Section 5.3, "Running Multiple MySQL Instances on One + Machine." + Play hard with your new installation. For example, try to + make new features crash. Start by running make test. See + Section 24.1.2, "The MySQL Test Suite." + +Setting Up a MySQL Bazaar Branch + + To setup a MySQL Bazaar branch on your machine, use this + procedure: + + 1. To obtain a copy of the MySQL development source code + hosted on Launchpad (http://launchpad.net/), create a new + Bazaar branch. If you do not already have a Bazaar repository directory set up, you must initialize a new directory: shell> mkdir mysql-server shell> bzr init-repo --trees mysql-server + This is a one-time operation. - 2. Assuming that you have an initialized repository directory, - you can branch from the public MySQL server repositories to - create a local source tree. To create a branch of a specific - version: + 2. Assuming that you have an initialized repository + directory, you can branch from the public MySQL server + repositories to create a local source tree. To create a + branch of a specific version: shell> cd mysql-server shell> bzr branch lp:mysql-server/5.6 mysql-5.6 - This is a one-time operation per source tree. You can branch - the source trees for several versions of MySQL under the - mysql-server directory. - - 3. The initial download will take some time to complete, - depending on the speed of your connection. Please be patient. - Once you have downloaded the first tree, additional trees - should take significantly less time to download. - - 4. When building from the Bazaar branch, you may want to create a - copy of your active branch so that you can make configuration - and other changes without affecting the original branch - contents. You can achieve this by branching from the original - branch: + + This is a one-time operation per source tree. You can + branch the source trees for several versions of MySQL + under the mysql-server directory. + The initial download will take some time to complete, + depending on the speed of your connection. Once you have + downloaded the first tree, additional trees should take + significantly less time to download. + + 3. When building from the Bazaar branch, you may want to + create a copy of your active branch so that you can make + configuration and other changes without affecting the + original branch contents. You can achieve this by + branching from the original branch: shell> bzr branch mysql-5.6 mysql-5.6-build - 5. To obtain changes made after you have set up the branch - initially, update it using the pull option periodically. Use - this command in the top-level directory of the local copy: + + 4. To obtain changes made after you have set up the branch + initially, update it using the pull option periodically. + Use this command in the top-level directory of the local + copy: shell> bzr pull - To examine the changeset comments for the tree, use the log - option to bzr: + + To examine the changeset comments for the tree, use the + log option to bzr: shell> bzr log + You can also browse changesets, comments, and source code online at the Launchpad MySQL Server (http://launchpad.net/mysql-server) page. - If you see diffs (changes) or code that you have a question - about, do not hesitate to send email to the MySQL internals - mailing list. See Section 1.6.1, "MySQL Mailing Lists." If you - think you have a better idea on how to do something, send an - email message to the list with a patch. - - After you have the local branch, you can build MySQL server from - the source code. For information, see Section 2.9.2, "Installing - MySQL Using a Standard Source Distribution," except that you skip - the part about obtaining and unpacking the distribution. - - Be careful about installing a build from a distribution source - tree on a production machine. The installation command may - overwrite your live release installation. If you already have - MySQL installed and do not want to overwrite it, run CMake with - values for the CMAKE_INSTALL_PREFIX, MYSQL_TCP_PORT, and - MYSQL_UNIX_ADDR options different from those used by your - production server. For additional information about preventing - multiple servers from interfering with each other, see Section - 5.3, "Running Multiple MySQL Instances on One Machine." - - Play hard with your new installation. For example, try to make new - features crash. Start by running make test. See Section 23.1.2, - "The MySQL Test Suite." - -2.9.4. MySQL Source-Configuration Options - - The CMake program provides a great deal of control over how you - configure a MySQL source distribution. Typically, you do this - using options on the CMake command line. For information about - options supported by CMake, run either of these commands in the - top-level source directory: + If you see diffs (changes) or code that you have a + question about, do not hesitate to send email to the + MySQL internals mailing list. See Section 1.6.1, "MySQL + Mailing Lists." For information about contributing at + patch, see Contributing to MySQL Server + (http://mysqlserverteam.com/contributing-to-mysql-server/ + ). + + 5. After you have the local branch, you can build MySQL + server from the source code. Instructions are provided in + Section 2.9.2, "Installing MySQL Using a Standard Source + Distribution," except that you skip the part about + obtaining and unpacking the distribution. + Be careful about installing a build from a distribution + source tree on a production machine. The installation + command may overwrite your live release installation. If + you already have MySQL installed and do not want to + overwrite it, run CMake with values for the + CMAKE_INSTALL_PREFIX, MYSQL_TCP_PORT, and MYSQL_UNIX_ADDR + options different from those used by your production + server. For additional information about preventing + multiple servers from interfering with each other, see + Section 5.3, "Running Multiple MySQL Instances on One + Machine." + Play hard with your new installation. For example, try to + make new features crash. Start by running make test. See + Section 24.1.2, "The MySQL Test Suite." + +2.9.4 MySQL Source-Configuration Options + + The CMake program provides a great deal of control over how + you configure a MySQL source distribution. Typically, you do + this using options on the CMake command line. For information + about options supported by CMake, run either of these + commands in the top-level source directory: shell> cmake . -LH shell> ccmake . - You can also affect CMake using certain environment variables. See - Section 2.12, "Environment Variables." + You can also affect CMake using certain environment + variables. See Section 2.12, "Environment Variables." The following table shows the available CMake options. In the Default column, PREFIX stands for the value of the - CMAKE_INSTALL_PREFIX option, which specifies the installation base - directory. This value is used as the parent location for several - of the installation subdirectories. + CMAKE_INSTALL_PREFIX option, which specifies the installation + base directory. This value is used as the parent location for + several of the installation subdirectories. - Table 2.13. MySQL Source-Configuration Option Reference (CMake) + Table 2.11 MySQL Source-Configuration Option Reference + (CMake) Formats Description Default Introduced Removed BUILD_CONFIG Use same build options as official releases CMAKE_BUILD_TYPE Type of build to produce RelWithDebInfo - CMAKE_INSTALL_PREFIX Installation base directory /usr/local/mysql - + CMAKE_C_FLAGS Flags for C Compiler + CMAKE_CXX_FLAGS Flags for C++ Compiler + CMAKE_INSTALL_PREFIX Installation base directory + /usr/local/mysql COMPILATION_COMMENT Comment about compilation environment - CPACK_MONOLITHIC_INSTALL Whether package build produces single - file OFF + CPACK_MONOLITHIC_INSTALL Whether package build produces + single file OFF DEFAULT_CHARSET The default server character set latin1 - DEFAULT_COLLATION The default server collation latin1_swedish_ci - + DEFAULT_COLLATION The default server collation + latin1_swedish_ci ENABLE_DEBUG_SYNC Whether to enable Debug Sync support ON ENABLE_DOWNLOADS Whether to download optional files OFF ENABLE_DTRACE Whether to include DTrace support ENABLE_GCOV Whether to include gcov support 5.6.3 - ENABLE_GPROF Enable gprof (optimized Linux builds only) OFF 5.6.6 - - ENABLED_LOCAL_INFILE Whether to enable LOCAL for LOAD DATA INFILE - OFF + ENABLE_GPROF Enable gprof (optimized Linux builds only) OFF + 5.6.6 + ENABLED_LOCAL_INFILE Whether to enable LOCAL for LOAD DATA + INFILE OFF ENABLED_PROFILING Whether to enable query profiling code ON - IGNORE_AIO_CHECK With -DBUILD_CONFIG=mysql_release, ignore libaio - check OFF 5.6.1 + + IGNORE_AIO_CHECK With -DBUILD_CONFIG=mysql_release, ignore + libaio check OFF 5.6.1 + INNODB_PAGE_ATOMIC_REF_COUNT Enable or disable atomic page + reference counting ON 5.6.16 INSTALL_BINDIR User executables directory PREFIX/bin INSTALL_DOCDIR Documentation directory PREFIX/docs INSTALL_DOCREADMEDIR README file directory PREFIX INSTALL_INCLUDEDIR Header file directory PREFIX/include INSTALL_INFODIR Info file directory PREFIX/docs - INSTALL_LAYOUT Select predefined installation layout STANDALONE - + INSTALL_LAYOUT Select predefined installation layout + STANDALONE INSTALL_LIBDIR Library file directory PREFIX/lib INSTALL_MANDIR Manual page directory PREFIX/man INSTALL_MYSQLSHAREDIR Shared data directory PREFIX/share INSTALL_MYSQLTESTDIR mysql-test directory PREFIX/mysql-test + INSTALL_PLUGINDIR Plugin directory PREFIX/lib/plugin INSTALL_SBINDIR Server executable directory PREFIX/bin INSTALL_SCRIPTDIR Scripts directory PREFIX/scripts @@ -5138,16 +5988,19 @@ shell> ccmake . PREFIX/support-files MEMCACHED_HOME Path to memcached [none] MYSQL_DATADIR Data directory - MYSQL_MAINTAINER_MODE Whether to enable MySQL maintainer-specific - development environment OFF - MYSQL_PROJECT_NAME Windows/Mac OS X project name 3306 5.6.5 + MYSQL_MAINTAINER_MODE Whether to enable MySQL + maintainer-specific development environment OFF + MYSQL_PROJECT_NAME Windows/OS X project name 3306 5.6.5 MYSQL_TCP_PORT TCP/IP port number 3306 MYSQL_UNIX_ADDR Unix socket file /tmp/mysql.sock ODBC_INCLUDES ODBC includes directory ODBC_LIB_DIR ODBC library directory OPTIMIZER_TRACE Whether to support optimizer tracing 5.6.3 + SUNPRO_CXX_LIBRARY Client link library on Solaris 10+ 5.6.20 + SYSCONFDIR Option file directory - WITH_ASAN Enable address sanitizer OFF 5.6.15 + TMPDIR tmpdir default value 5.6.16 + WITH_ASAN Enable AddressSanitizer OFF 5.6.15 WITH_BUNDLED_LIBEVENT Use bundled libevent when building ndbmemcache ON WITH_BUNDLED_MEMCACHED Use bundled memcached when building @@ -5157,107 +6010,117 @@ shell> ccmake . WITH_DEBUG Whether to include debugging support OFF WITH_DEFAULT_COMPILER_OPTIONS Whether to use default compiler options ON 5.6.6 - WITH_DEFAULT_FEATURE_SET Whether to use default feature set ON - 5.6.6 - WITH_EDITLINE Which libedit/editline library to use bundled 5.6.12 - + WITH_DEFAULT_FEATURE_SET Whether to use default feature set + ON 5.6.6 + WITH_EDITLINE Which libedit/editline library to use bundled + 5.6.12 WITH_EMBEDDED_SERVER Whether to build embedded server OFF - WITH_xxx_STORAGE_ENGINE Compile storage engine xxx statically into - server + WITH_EMBEDDED_SHARED_LIBRARY Whether to build a shared + embedded server library OFF 5.6.17 + WITH_xxx_STORAGE_ENGINE Compile storage engine xxx statically + into server WITH_ERROR_INSERT Enable error injection in the NDB storage engine. Should not be used for building binaries intended for production. OFF WITH_EXTRA_CHARSETS Which extra character sets to include all + WITH_INNODB_MEMCACHED Whether to generate memcached shared libraries. OFF WITH_LIBEDIT Use bundled libedit library ON 5.6.12 WITH_LIBEVENT Which libevent library to use bundled 5.6.6 - WITH_LIBWRAP Whether to include libwrap (TCP wrappers) support OFF - - WITH_NDB_BINLOG Enable binary logging by default by mysqld. ON + WITH_LIBWRAP Whether to include libwrap (TCP wrappers) + support OFF + WITH_NDB_BINLOG Enable binary logging by default by mysqld. + ON WITH_NDB_DEBUG Produce a debug build for testing or troubleshooting. OFF WITH_NDB_JAVA Enable building of Java and ClusterJ support. Enabled by default. Supported in MySQL Cluster only. ON - WITH_NDB_PORT Default port used by a management server built with - this option. If this option was not used to build it, the - management server's default port is 1186. [none] + WITH_NDB_PORT Default port used by a management server built + with this option. If this option was not used to build it, + the management server's default port is 1186. [none] WITH_NDB_TEST Include NDB API test programs. OFF - WITH_NDBCLUSTER_STORAGE_ENGINE Build the NDB storage engine ON + WITH_NDBCLUSTER_STORAGE_ENGINE Build the NDB storage engine + ON WITH_NDBMTD Build multi-threaded data node. ON WITH_READLINE Use bundled readline library OFF 5.6.5 WITH_SSL Type of SSL support no WITH_UNIXODBC Enable unixODBC support OFF - WITH_ZLIB Type of zlib support system - WITHOUT_xxx_STORAGE_ENGINE Exclude storage engine xxx from build + WITH_VALGRIND Whether to compile in Valgrind header files OFF + WITH_ZLIB Type of zlib support system + WITHOUT_xxx_STORAGE_ENGINE Exclude storage engine xxx from + build WITHOUT_SERVER Do not build the server OFF The following sections provide more information about CMake options. - * General Options + * Section 2.9.4, "" - * Installation Layout Options + * Section 2.9.4, "" - * Feature Options + * Section 2.9.4, "" - * Options for Compiling MySQL Cluster + * Section 2.9.4, "" - * Compiler Flags + * Section 2.9.4, "" For boolean options, the value may be specified as 1 or ON to enable the option, or as 0 or OFF to disable the option. Many options configure compile-time defaults that can be overridden at server startup. For example, the - CMAKE_INSTALL_PREFIX, MYSQL_TCP_PORT, and MYSQL_UNIX_ADDR options - that configure the default installation base directory location, - TCP/IP port number, and Unix socket file can be changed at server - startup with the --basedir, --port, and --socket options for - mysqld. Where applicable, configuration option descriptions - indicate the corresponding mysqld startup option. + CMAKE_INSTALL_PREFIX, MYSQL_TCP_PORT, and MYSQL_UNIX_ADDR + options that configure the default installation base + directory location, TCP/IP port number, and Unix socket file + can be changed at server startup with the --basedir, --port, + and --socket options for mysqld. Where applicable, + configuration option descriptions indicate the corresponding + mysqld startup option. General Options * -DBUILD_CONFIG=mysql_release - This option configures a source distribution with the same - build options used by Oracle to produce binary distributions - for official MySQL releases. + This option configures a source distribution with the + same build options used by Oracle to produce binary + distributions for official MySQL releases. * -DCMAKE_BUILD_TYPE=type The type of build to produce: + RelWithDebInfo: Enable optimizations and generate - debugging information. This is the default MySQL build - type. + debugging information. This is the default MySQL + build type. + Debug: Disable optimizations and generate debugging information. This build type is also used if the - WITH_DEBUG option is enabled. That is, -DWITH_DEBUG=1 has - the same effect as -DCMAKE_BUILD_TYPE=Debug. + WITH_DEBUG option is enabled. That is, + -DWITH_DEBUG=1 has the same effect as + -DCMAKE_BUILD_TYPE=Debug. * -DCPACK_MONOLITHIC_INSTALL=bool This option affects whether the make package operation - produces multiple installation package files or a single file. - If disabled, the operation produces multiple installation - package files, which may be useful if you want to install only - a subset of a full MySQL installation. If enabled, it produces - a single file for installing everything. + produces multiple installation package files or a single + file. If disabled, the operation produces multiple + installation package files, which may be useful if you + want to install only a subset of a full MySQL + installation. If enabled, it produces a single file for + installing everything. Installation Layout Options - The CMAKE_INSTALL_PREFIX option indicates the base installation - directory. Other options with names of the form INSTALL_xxx that - indicate component locations are interpreted relative to the - prefix and their values are relative pathnames. Their values - should not include the prefix. + The CMAKE_INSTALL_PREFIX option indicates the base + installation directory. Other options with names of the form + INSTALL_xxx that indicate component locations are interpreted + relative to the prefix and their values are relative + pathnames. Their values should not include the prefix. * -DCMAKE_INSTALL_PREFIX=dir_name The installation base directory. - This value can be set at server startup with the --basedir - option. + This value can be set at server startup with the + --basedir option. * -DINSTALL_BINDIR=dir_name Where to install user programs. @@ -5286,10 +6149,11 @@ Installation Layout Options + DEB: DEB package layout (experimental). You can select a predefined layout but modify individual - component installation locations by specifying other options. - For example: + component installation locations by specifying other + options. For example: shell> cmake . -DINSTALL_LAYOUT=SVR4 -DMYSQL_DATADIR=/var/mysql/data + * -DINSTALL_LIBDIR=dir_name Where to install library files. @@ -5300,14 +6164,15 @@ shell> cmake . -DINSTALL_LAYOUT=SVR4 -DMYSQL_DATADIR=/var/mysql/data Where to install shared data files. * -DINSTALL_MYSQLTESTDIR=dir_name - Where to install the mysql-test directory. As of MySQL 5.6.12, - to suppress installation of this directory, explicitly set the - option to the empty value (-DINSTALL_MYSQLTESTDIR=). + Where to install the mysql-test directory. As of MySQL + 5.6.12, to suppress installation of this directory, + explicitly set the option to the empty value + (-DINSTALL_MYSQLTESTDIR=). * -DINSTALL_PLUGINDIR=dir_name The location of the plugin directory. - This value can be set at server startup with the --plugin_dir - option. + This value can be set at server startup with the + --plugin_dir option. * -DINSTALL_SBINDIR=dir_name Where to install the mysqld server. @@ -5320,49 +6185,55 @@ shell> cmake . -DINSTALL_LAYOUT=SVR4 -DMYSQL_DATADIR=/var/mysql/data * -DINSTALL_SQLBENCHDIR=dir_name Where to install the sql-bench directory. To suppress - installation of this directory, explicitly set the option to - the empty value (-DINSTALL_SQLBENCHDIR=). + installation of this directory, explicitly set the option + to the empty value (-DINSTALL_SQLBENCHDIR=). * -DINSTALL_SUPPORTFILESDIR=dir_name Where to install extra support files. * -DMYSQL_DATADIR=dir_name The location of the MySQL data directory. - This value can be set at server startup with the --datadir - option. + This value can be set at server startup with the + --datadir option. * -DODBC_INCLUDES=dir_name - The location of the ODBC includes directory, and may be used - while configuring Connector/ODBC. + The location of the ODBC includes directory, and may be + used while configuring Connector/ODBC. * -DODBC_LIB_DIR=dir_name - The location of the ODBC library directory, and may be used - while configuring Connector/ODBC. + The location of the ODBC library directory, and may be + used while configuring Connector/ODBC. * -DSYSCONFDIR=dir_name The default my.cnf option file directory. - This location cannot be set at server startup, but you can - start the server with a given option file using the - --defaults-file=file_name option, where file_name is the full - path name to the file. + This location cannot be set at server startup, but you + can start the server with a given option file using the + --defaults-file=file_name option, where file_name is the + full path name to the file. + + * -DTMPDIR=dir_name + The default location to use for the tmpdir system + variable. If unspecified, the value defaults to P_tmpdir + in . This option was added in MySQL 5.6.16. Storage Engine Options - Storage engines are built as plugins. You can build a plugin as a - static module (compiled into the server) or a dynamic module - (built as a dynamic library that must be installed into the server - using the INSTALL PLUGIN statement or the --plugin-load option - before it can be used). Some plugins might not support static or - dynamic building. + Storage engines are built as plugins. You can build a plugin + as a static module (compiled into the server) or a dynamic + module (built as a dynamic library that must be installed + into the server using the INSTALL PLUGIN statement or the + --plugin-load option before it can be used). Some plugins + might not support static or dynamic building. - The MyISAM, MERGE, MEMORY, and CSV engines are mandatory (always - compiled into the server) and need not be installed explicitly. + The MyISAM, MERGE, MEMORY, and CSV engines are mandatory + (always compiled into the server) and need not be installed + explicitly. To compile a storage engine statically into the server, use - -DWITH_engine_STORAGE_ENGINE=1. Some permissible engine values are - ARCHIVE, BLACKHOLE, EXAMPLE, FEDERATED, INNOBASE (InnoDB), NDB or - NDBCLUSTER (NDB), PARTITION (partitioning support), and PERFSCHEMA - (Performance Schema). Examples: + -DWITH_engine_STORAGE_ENGINE=1. Some permissible engine + values are ARCHIVE, BLACKHOLE, EXAMPLE, FEDERATED, INNOBASE + (InnoDB), NDB or NDBCLUSTER (NDB), PARTITION (partitioning + support), and PERFSCHEMA (Performance Schema). Examples: -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 @@ -5370,14 +6241,14 @@ Storage Engine Options Note - WITH_NDBCLUSTER_STORAGE_ENGINE is supported only when building - MySQL Cluster using the MySQL Cluster sources. It cannot be used - to enable clustering support in other MySQL source trees or - distributions. In MySQL Cluster NDB 7.3 source distributions, it - is enabled by default. See Section 17.2.2.3, "Building MySQL - Cluster from Source on Linux," and Section 17.2.3.2, "Compiling - and Installing MySQL Cluster from Source on Windows," for more - information. + WITH_NDBCLUSTER_STORAGE_ENGINE is supported only when + building MySQL Cluster using the MySQL Cluster sources. It + cannot be used to enable clustering support in other MySQL + source trees or distributions. In MySQL Cluster source + distributions, it is enabled by default. See Section + 18.2.2.3, "Building MySQL Cluster from Source on Linux," and + Section 18.2.3.2, "Compiling and Installing MySQL Cluster + from Source on Windows," for more information. To exclude a storage engine from the build, use -DWITHOUT_engine_STORAGE_ENGINE=1. Examples: @@ -5386,9 +6257,9 @@ Storage Engine Options -DWITHOUT_PARTITION_STORAGE_ENGINE=1 If neither -DWITH_engine_STORAGE_ENGINE nor - -DWITHOUT_engine_STORAGE_ENGINE are specified for a given storage - engine, the engine is built as a shared module, or excluded if it - cannot be built as a shared module. + -DWITHOUT_engine_STORAGE_ENGINE are specified for a given + storage engine, the engine is built as a shared module, or + excluded if it cannot be built as a shared module. Feature Options @@ -5397,141 +6268,168 @@ Feature Options A descriptive comment about the compilation environment. * -DDEFAULT_CHARSET=charset_name - The server character set. By default, MySQL uses the latin1 - (cp1252 West European) character set. + The server character set. By default, MySQL uses the + latin1 (cp1252 West European) character set. charset_name may be one of binary, armscii8, ascii, big5, - cp1250, cp1251, cp1256, cp1257, cp850, cp852, cp866, cp932, - dec8, eucjpms, euckr, gb2312, gbk, geostd8, greek, hebrew, - hp8, keybcs2, koi8r, koi8u, latin1, latin2, latin5, latin7, - macce, macroman, sjis, swe7, tis620, ucs2, ujis, utf8, - utf8mb4, utf16, utf16le, utf32. The permissible character sets - are listed in the cmake/character_sets.cmake file as the value - of CHARSETS_AVAILABLE. + cp1250, cp1251, cp1256, cp1257, cp850, cp852, cp866, + cp932, dec8, eucjpms, euckr, gb2312, gbk, geostd8, greek, + hebrew, hp8, keybcs2, koi8r, koi8u, latin1, latin2, + latin5, latin7, macce, macroman, sjis, swe7, tis620, + ucs2, ujis, utf8, utf8mb4, utf16, utf16le, utf32. The + permissible character sets are listed in the + cmake/character_sets.cmake file as the value of + CHARSETS_AVAILABLE. This value can be set at server startup with the --character_set_server option. * -DDEFAULT_COLLATION=collation_name The server collation. By default, MySQL uses latin1_swedish_ci. Use the SHOW COLLATION statement to - determine which collations are available for each character - set. + determine which collations are available for each + character set. This value can be set at server startup with the --collation_server option. * -DENABLE_DEBUG_SYNC=bool - Whether to compile the Debug Sync facility into the server. - This facility is used for testing and debugging. This option - is enabled by default, but has no effect unless MySQL is - configured with debugging enabled. If debugging is enabled and - you want to disable Debug Sync, use -DENABLE_DEBUG_SYNC=0. + Whether to compile the Debug Sync facility into the + server. This facility is used for testing and debugging. + This option is enabled by default, but has no effect + unless MySQL is configured with debugging enabled. If + debugging is enabled and you want to disable Debug Sync, + use -DENABLE_DEBUG_SYNC=0. When compiled in, Debug Sync is disabled by default at runtime. To enable it, start mysqld with the --debug-sync-timeout=N option, where N is a timeout value - greater than 0. (The default value is 0, which disables Debug - Sync.) N becomes the default timeout for individual + greater than 0. (The default value is 0, which disables + Debug Sync.) N becomes the default timeout for individual synchronization points. - For a description of the Debug Sync facility and how to use - synchronization points, see MySQL Internals: Test + For a description of the Debug Sync facility and how to + use synchronization points, see MySQL Internals: Test Synchronization - (http://dev.mysql.com/doc/internals/en/test-synchronization.ht - ml). + (http://dev.mysql.com/doc/internals/en/test-synchronizati + on.html). * -DENABLE_DOWNLOADS=bool - Whether to download optional files. For example, with this - option enabled, CMake downloads the Google Test distribution - that is used by the test suite to run unit tests. + Whether to download optional files. For example, with + this option enabled, CMake downloads the Google Test + distribution that is used by the test suite to run unit + tests. * -DENABLE_DTRACE=bool - Whether to include support for DTrace probes. For information - about DTrace, wee Section 5.4, "Tracing mysqld Using DTrace" + Whether to include support for DTrace probes. For + information about DTrace, wee Section 5.4, "Tracing + mysqld Using DTrace" * -DENABLE_GCOV=bool Whether to include gcov support (Linux only). * -DENABLE_GPROF=bool - Whether to enable gprof (optimized Linux builds only). This - option was added in MySQL 5.6.6. + Whether to enable gprof (optimized Linux builds only). + This option was added in MySQL 5.6.6. * -DENABLED_LOCAL_INFILE=bool - Whether to enable LOCAL capability in the client library for - LOAD DATA INFILE. - This option controls client-side LOCAL capability, but the - capability can be set on the server side at server startup - with the --local-infile option. See Section 6.1.6, "Security - Issues with LOAD DATA LOCAL." + Whether to enable LOCAL capability in the client library + for LOAD DATA INFILE. + This option controls client-side LOCAL capability, but + the capability can be set on the server side at server + startup with the --local-infile option. See Section + 6.1.6, "Security Issues with LOAD DATA LOCAL." * -DENABLED_PROFILING=bool - Whether to enable query profiling code (for the SHOW PROFILE - and SHOW PROFILES statements). + Whether to enable query profiling code (for the SHOW + PROFILE and SHOW PROFILES statements). * -DIGNORE_AIO_CHECK=bool - If the -DBUILD_CONFIG=mysql_release option is given on Linux, - the libaio library must be linked in by default. If you do not - have libaio or do not want to install it, you can suppress the - check for it by specifying -DIGNORE_AIO_CHECK=1. This option - was added in MySQL 5.6.1. + If the -DBUILD_CONFIG=mysql_release option is given on + Linux, the libaio library must be linked in by default. + If you do not have libaio or do not want to install it, + you can suppress the check for it by specifying + -DIGNORE_AIO_CHECK=1. This option was added in MySQL + 5.6.1. + + * -DINNODB_PAGE_ATOMIC_REF_COUNT=bool + Whether to enable or disable atomic page reference + counting. Fetching and releasing pages from the buffer + pool and tracking the page state are expensive and + complex operations. Using a page mutex to track these + operations does not scale well. With + INNODB_PAGE_ATOMIC_REF_COUNT=ON (default), fetch and + release is tracked using atomics where available. For + platforms that do not support atomics, set + INNODB_PAGE_ATOMIC_REF_COUNT=OFF to disable atomic page + reference counting. + When atomic page reference counting is enabled (default), + "[Note] InnoDB: Using atomics to ref count buffer pool + pages" is printed to the error log at server startup. If + atomic page reference counting is disabled, "[Note] + InnoDB: Using mutexes to ref count buffer pool pages" is + printed instead. + INNODB_PAGE_ATOMIC_REF_COUNT was introduced with the fix + for MySQL Bug #68079. The option is removed in MySQL + 5.7.5. Support for atomics is required to build MySQL as + of MySQL 5.7.5, which makes the option obsolete. * -DMYSQL_MAINTAINER_MODE=bool Whether to enable a MySQL maintainer-specific development - environment. If enabled, this option causes compiler warnings - to become errors. + environment. If enabled, this option causes compiler + warnings to become errors. * -DMYSQL_PROJECT_NAME=name - For Windows or Mac OS X, the project name to incorporate into - the project file name. This option was added in MySQL 5.6.5. + For Windows or OS X, the project name to incorporate into + the project file name. This option was added in MySQL + 5.6.5. * -DMYSQL_TCP_PORT=port_num - The port number on on which the server listens for TCP/IP + The port number on which the server listens for TCP/IP connections. The default is 3306. This value can be set at server startup with the --port option. * -DMYSQL_UNIX_ADDR=file_name The Unix socket file path on which the server listens for - socket connections. This must be an absolute path name. The - default is /tmp/mysql.sock. + socket connections. This must be an absolute path name. + The default is /tmp/mysql.sock. This value can be set at server startup with the --socket option. * -DOPTIMIZER_TRACE=bool - Whether to support optimizer tracing. See MySQL Internals: - Tracing the Optimizer - (http://dev.mysql.com/doc/internals/en/optimizer-tracing.html) - . This option was added in MySQL 5.6.3. + Whether to support optimizer tracing. See MySQL + Internals: Tracing the Optimizer + (http://dev.mysql.com/doc/internals/en/optimizer-tracing. + html). This option was added in MySQL 5.6.3. * -DWITH_ASAN=bool - Whether to enable address sanitization, for compilers that - support it. The default is off. This option was added in MySQL - 5.6.15. + Whether to enable AddressSanitizer, for compilers that + support it. The default is off. This option was added in + MySQL 5.6.15. * -DWITH_DEBUG=bool Whether to include debugging support. - Configuring MySQL with debugging support enables you to use - the --debug="d,parser_debug" option when you start the server. - This causes the Bison parser that is used to process SQL - statements to dump a parser trace to the server's standard - error output. Typically, this output is written to the error - log. - - * -DWITH_DEFAULT_COMPILER_OPTIONS=bool - Whether to use the flags from - cmake/build_configurations/compiler_options.cmake. This option - was added in MySQL 5.6.6. + Configuring MySQL with debugging support enables you to + use the --debug="d,parser_debug" option when you start + the server. This causes the Bison parser that is used to + process SQL statements to dump a parser trace to the + server's standard error output. Typically, this output is + written to the error log. * -DWITH_DEFAULT_FEATURE_SET=bool Whether to use the flags from - cmake/build_configurations/feature_set.cmake. This option was - added in MySQL 5.6.6. + cmake/build_configurations/feature_set.cmake. This option + was added in MySQL 5.6.6. * -DWITH_EDITLINE=value - Which libedit/editline library to use. The permitted values - are bundled (the default) and system. + Which libedit/editline library to use. The permitted + values are bundled (the default) and system. WITH_EDITLINE was added in MySQL 5.6.12. It replaces WITH_LIBEDIT, which has been removed. * -DWITH_EMBEDDED_SERVER=bool Whether to build the libmysqld embedded server library. + * -DWITH_EMBEDDED_SHARED_LIBRARY=bool + Whether to build a shared libmysqld embedded server + library. This option was added in MySQL 5.6.17. + * -DWITH_EXTRA_CHARSETS=name Which extra character sets to include: @@ -5546,516 +6444,610 @@ Feature Options (libmemcached.so and innodb_engine.so). * -DWITH_LIBEVENT=string - Which libevent library to use. Permitted values are bundled - (default), system, and yes. If you specify system or yes, the - system libevent library is used if present. If the system - library is not found, the bundled libevent library is used. - The libevent library is required by InnoDB memcached. + Which libevent library to use. Permitted values are + bundled (default), system, and yes. If you specify system + or yes, the system libevent library is used if present. + If the system library is not found, the bundled libevent + library is used. The libevent library is required by + InnoDB memcached. * -DWITH_LIBEDIT=bool Whether to use the libedit library bundled with the distribution. - WITH_LIBEDIT was removed in MySQL 5.6.12. Use WITH_EDITLINE - instead. + WITH_LIBEDIT was removed in MySQL 5.6.12. Use + WITH_EDITLINE instead. * -DWITH_LIBWRAP=bool Whether to include libwrap (TCP wrappers) support. * -DWITH_READLINE=bool Whether to use the readline library bundled with the - distribution. This option was removed in MySQL 5.6.5 because - readline is no longer bundled. + distribution. This option was removed in MySQL 5.6.5 + because readline is no longer bundled. * -DWITH_SSL={ssl_type|path_name} - * The type of SSL support to include (if any) or the path name - to the OpenSSL installation to use. + * The type of SSL support to include (if any) or the path + name to the OpenSSL installation to use. + ssl_type can be one of the following values: - o no: No SSL support. This is the default before MySQL - 5.6.6. As of 5.6.6, this is no longer a permitted - value and the default is bundled. - o yes: Use the system SSL library if present, else the - library bundled with the distribution. + o no: No SSL support. This is the default before + MySQL 5.6.6. As of 5.6.6, this is no longer a + permitted value and the default is bundled. + o yes: Use the system SSL library if present, + else the library bundled with the distribution. o bundled: Use the SSL library bundled with the - distribution. This is the default as of MySQL 5.6.6. + distribution. This is the default as of MySQL + 5.6.6. o system: Use the system SSL library. - + path_name, permitted for MySQL 5.6.7 and after, is the - path name to the OpenSSL installation to use. Using this - can be preferable to using the ssl_type value of system, - for it can prevent CMake from detecting and using an - older or incorrect OpenSSL version installed on the - system. (Another permitted way to do the same thing is to - set the CMAKE_PREFIX_PATH option to path_name.) - For information about using SSL support, see Section 6.3.9, - "Using SSL for Secure Connections." + + path_name, permitted for MySQL 5.6.7 and after, is + the path name to the OpenSSL installation to use. + Using this can be preferable to using the ssl_type + value of system, for it can prevent CMake from + detecting and using an older or incorrect OpenSSL + version installed on the system. (Another permitted + way to do the same thing is to set the + CMAKE_PREFIX_PATH option to path_name.) + For information about using SSL support, see Section + 6.3.10, "Using SSL for Secure Connections." * -DWITH_UNIXODBC=1 Enables unixODBC support, for Connector/ODBC. + * -DWITH_VALGRIND=bool + Whether to compile in the Valgrind header files, which + exposes the Valgrind API to MySQL code. The default is + OFF. + To generate a Valgrind-aware debug build, + -DWITH_VALGRIND=1 normally is combined with + -DWITH_DEBUG=1. See Building Debug Configurations + (http://dev.mysql.com/doc/internals/en/debug-configuratio + ns.html). + * -DWITH_ZLIB=zlib_type Some features require that the server be built with compression library support, such as the COMPRESS() and - UNCOMPRESS() functions, and compression of the client/server - protocol. The WITH_ZLIB indicates the source of zlib support: + UNCOMPRESS() functions, and compression of the + client/server protocol. The WITH_ZLIB indicates the + source of zlib support: + bundled: Use the zlib library bundled with the distribution. - + system: Use the system zlib library. This is the default. + + system: Use the system zlib library. This is the + default. * -DWITHOUT_SERVER=bool - Whether to build without the MySQL server. The default is OFF, - which does build the server. + Whether to build without the MySQL server. The default is + OFF, which does build the server. Compiler Flags - To specify compiler flags, set the CFLAGS and CXXFLAGS environment - variables before running CMake. Example: -shell> CFLAGS=-DHAVE_EMBEDDED_PRIVILEGE_CONTROL -shell> CXXFLAGS=-DHAVE_EMBEDDED_PRIVILEGE_CONTROL -shell> export CFLAGS CXXFLAGS -shell> cmake [options] - The following flags control configuration features: + * -DCMAKE_C_FLAGS="flags" + Flags for the C Compiler. - * HAVE_EMBEDDED_PRIVILEGE_CONTROL - By default, authentication for connections to the embedded - server is disabled. To enable connection authentication, - define this flag. + * -DCMAKE_CXX_FLAGS="flags" + Flags for the C++ Compiler. + + * -DWITH_DEFAULT_COMPILER_OPTIONS=bool + Whether to use the flags from + cmake/build_configurations/compiler_options.cmake. This + option was added in MySQL 5.6.6. + Note + All optimization flags were carefully chosen and tested + by the MySQL build team. Overriding them can lead to + unexpected results and is done at your own risk. + + * -DSUNPRO_CXX_LIBRARY="lib_name" + Enable linking against libCstd instead of stlport4 on + Solaris 10 or later. This works only for client code + because the server depends on C++98. Example usage: +cmake -DWITHOUT_SERVER=1 -DSUNPRO_CXX_LIBRARY=Cstd + + This option was added in MySQL 5.6.20. + + To specify your own C and C++ compiler flags, for flags that + do not affect optimization, use the CMAKE_C_FLAGS and + CMAKE_CXX_FLAGS CMake options. + + When providing your own compiler flags, you might want to + specify CMAKE_BUILD_TYPE as well. + + For example, to create a 32-bit release build on a 64-bit + Linux machine, do this: +shell> mkdir bld +shell> cd bld +shell> cmake .. -DCMAKE_C_FLAGS=-m32 \ + -DCMAKE_CXX_FLAGS=-m32 \ + -DCMAKE_BUILD_TYPE=RelWithDebInfo + + If you set flags that affect optimization (-Onumber), you + must set the CMAKE_C_FLAGS_build_type and/or + CMAKE_CXX_FLAGS_build_type options, where build_type + corresponds to the CMAKE_BUILD_TYPE value. To specify a + different optimization for the default build type + (RelWithDebInfo) set the CMAKE_C_FLAGS_RELWITHDEBINFO and + CMAKE_CXX_FLAGS_RELWITHDEBINFO options. For example, to + compile on Linux with -O3 and with debug symbols, do this: +shell> cmake .. -DCMAKE_C_FLAGS_RELWITHDEBINFO="-O3 -g" \ + -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="-O3 -g" CMake Options for Compiling MySQL Cluster - The following options are for use when building MySQL Cluster with - the MySQL Cluster sources; they are not currently supported when - using sources from the MySQL 5.6 Server tree. + The following options are for use when building MySQL Cluster + with the MySQL Cluster sources; they are not currently + supported when using sources from the MySQL 5.6 Server tree. * -DMEMCACHED_HOME=path - Perform the build using the memcached (version 1.6 or later) - installed in the system directory indicated by path. Files - from this installation that are used in the build include the - memcached binary, header files, and libraries, as well as the - memcached_utilities library and the header file - engine_testapp.h. - You must leave this option unset when building ndbmemcache - using the bundled memcached sources (WITH_BUNDLED_MEMCACHED - option); in other words, the bundled sources are used by - default). + Perform the build using the memcached (version 1.6 or + later) installed in the system directory indicated by + path. Files from this installation that are used in the + build include the memcached binary, header files, and + libraries, as well as the memcached_utilities library and + the header file engine_testapp.h. + You must leave this option unset when building + ndbmemcache using the bundled memcached sources + (WITH_BUNDLED_MEMCACHED option); in other words, the + bundled sources are used by default). This option was added in MySQL Cluster NDB 7.2.2. While additional CMake options---such as for SASL - authorization and for providing dtrace support---are available - for use when compiling memcached from external sources, these - options are currently not enabled for the memcached sources - bundled with MySQL Cluster. + authorization and for providing dtrace support---are + available for use when compiling memcached from external + sources, these options are currently not enabled for the + memcached sources bundled with MySQL Cluster. * -DWITH_BUNDLED_LIBEVENT={ON|OFF} - Use the libevent included in the MySQL Cluster sources when - building MySQL Cluster with ndbmemcached support (MySQL - Cluster NDB 7.2.2 and later). Enabled by default. OFF causes - the system's libevent to be used instead. + Use the libevent included in the MySQL Cluster sources + when building MySQL Cluster with ndbmemcached support + (MySQL Cluster NDB 7.2.2 and later). Enabled by default. + OFF causes the system's libevent to be used instead. * -DWITH_BUNDLED_MEMCACHED={ON|OFF} Build the memcached sources included in the MySQL Cluster - source tree (MySQL Cluster NDB 7.2.3 and later), then use the - resulting memcached server when building the ndbmemcache - engine. In this case, make install places the memcached binary - in the installation bin directory, and the ndbmemcache engine - shared object file ndb_engine.so in the installation lib - directory. + source tree (MySQL Cluster NDB 7.2.3 and later), then use + the resulting memcached server when building the + ndbmemcache engine. In this case, make install places the + memcached binary in the installation bin directory, and + the ndbmemcache engine shared object file ndb_engine.so + in the installation lib directory. This option is ON by default. * -DWITH_CLASSPATH=path - Sets the classpath for building MySQL Cluster Connector for - Java. Default is empty. In MySQL Cluster NDB 7.2.9 and later, - this option is ignored if -DWITH_NDB_JAVA=OFF is used. + Sets the classpath for building MySQL Cluster Connector + for Java. The default is empty. In MySQL Cluster NDB + 7.2.9 and later, this option is ignored if + -DWITH_NDB_JAVA=OFF is used. * -DWITH_ERROR_INSERT={ON|OFF} - Enables error injection in the NDB kernel. For testing only; - not intended for use in building production binaries. Default - is OFF. + Enables error injection in the NDB kernel. For testing + only; not intended for use in building production + binaries. The default is OFF. * -DWITH_NDBCLUSTER_STORAGE_ENGINE={ON|OFF} - Build and link in support for the NDB (NDBCLUSTER) storage - engine in mysqld. Default is ON. + Build and link in support for the NDB (NDBCLUSTER) + storage engine in mysqld. The default is ON. * -DWITH_NDBCLUSTER={ON|OFF} This is an alias for WITH_NDBCLUSTER_STORAGE_ENGINE. * -DWITH_NDBMTD={ON|OFF} - Build the multi-threaded data node executable ndbmtd. Default - is ON. + Build the multi-threaded data node executable ndbmtd. The + default is ON. * -DWITH_NDB_BINLOG={ON|OFF} - Enable binary logging by default in the mysqld built using - this option. ON by default. + Enable binary logging by default in the mysqld built + using this option. ON by default. * -DWITH_NDB_DEBUG={ON|OFF} Enable building the debug versions of the MySQL Cluster binaries. OFF by default. * -DWITH_NDB_JAVA={ON|OFF} - Enable building MySQL Cluster with Java support, including - ClusterJ. - This option was added in MySQL Cluster NDB 7.2.9, and is ON by - default. If you do not wish to compile MySQL Cluster with Java - support, you must disable it explicitly by specifying - -DWITH_NDB_JAVA=OFF when running CMake. Otherwise, if Java - cannot be found, configuration of the build fails. + Enable building MySQL Cluster with Java support, + including ClusterJ. + This option was added in MySQL Cluster NDB 7.2.9, and is + ON by default. If you do not wish to compile MySQL + Cluster with Java support, you must disable it explicitly + by specifying -DWITH_NDB_JAVA=OFF when running CMake. + Otherwise, if Java cannot be found, configuration of the + build fails. * -DWITH_NDB_PORT=port - Causes the MySQL Cluster management server (ndb_mgmd) that is - built to use this port by default. If this option is unset, - the resulting management server tries to use port 1186 by - default. + Causes the MySQL Cluster management server (ndb_mgmd) + that is built to use this port by default. If this option + is unset, the resulting management server tries to use + port 1186 by default. * -DWITH_NDB_TEST={ON|OFF} If enabled, include a set of NDB API test programs. The default is OFF. -2.9.5. Dealing with Problems Compiling MySQL +2.9.5 Dealing with Problems Compiling MySQL - The solution to many problems involves reconfiguring. If you do - reconfigure, take note of the following: + The solution to many problems involves reconfiguring. If you + do reconfigure, take note of the following: - * If CMake is run after it has previously been run, it may use - information that was gathered during its previous invocation. - This information is stored in CMakeCache.txt. When CMake - starts up, it looks for that file and reads its contents if it - exists, on the assumption that the information is still - correct. That assumption is invalid when you reconfigure. + * If CMake is run after it has previously been run, it may + use information that was gathered during its previous + invocation. This information is stored in CMakeCache.txt. + When CMake starts up, it looks for that file and reads + its contents if it exists, on the assumption that the + information is still correct. That assumption is invalid + when you reconfigure. - * Each time you run CMake, you must run make again to recompile. - However, you may want to remove old object files from previous - builds first because they were compiled using different - configuration options. + * Each time you run CMake, you must run make again to + recompile. However, you may want to remove old object + files from previous builds first because they were + compiled using different configuration options. To prevent old object files or configuration information from - being used, run these commands on Unix before re-running CMake: + being used, run the following commands before re-running + CMake: + + On Unix: shell> make clean shell> rm CMakeCache.txt - Or, on Windows: + On Windows: shell> devenv MySQL.sln /clean shell> del CMakeCache.txt - If you build out of the source tree, remove and recreate your - build directory before re-running CMake. For instructions on - building outside of the source tree, see How to Build MySQL Server - with CMake (http://dev.mysql.com/doc/internals/en/cmake.html). + If you build outside of the source tree, remove and recreate + your build directory before re-running CMake. For + instructions on building outside of the source tree, see How + to Build MySQL Server with CMake + (http://dev.mysql.com/doc/internals/en/cmake.html). - On some systems, warnings may occur due to differences in system - include files. The following list describes other problems that - have been found to occur most often when compiling MySQL: + On some systems, warnings may occur due to differences in + system include files. The following list describes other + problems that have been found to occur most often when + compiling MySQL: - * To define flags to be used by your C or C++ compilers, specify - them using the CFLAGS and CXXFLAGS environment variables. You - can also specify the compiler names this way using CC and CXX. - For example: + * To define which C and C++ compilers to use, you can + define the CC and CXX environment variables. For example: shell> CC=gcc -shell> CFLAGS=-O3 shell> CXX=g++ -shell> CXXFLAGS=-O3 -shell> export CC CFLAGS CXX CXXFLAGS +shell> export CC CXX + + To specify your own C and C++ compiler flags, use the + CMAKE_C_FLAGS and CMAKE_CXX_FLAGS CMake options. See + Section 2.9.4, "." To see what flags you might need to specify, invoke mysql_config with the --cflags and --cxxflags options. - * If compilation fails, check whether the MYSQL_MAINTAINER_MODE - option is enabled. This mode causes compiler warnings to - become errors, so disabling it may enable compilation to - proceed. + * To see what commands are executed during the compile + stage, after using CMake to configure MySQL, run make + VERBOSE=1 rather than just make. + + * If compilation fails, check whether the + MYSQL_MAINTAINER_MODE option is enabled. This mode causes + compiler warnings to become errors, so disabling it may + enable compilation to proceed. * If your compile fails with errors such as any of the - following, you must upgrade your version of make to GNU make: + following, you must upgrade your version of make to GNU + make: make: Fatal error in reader: Makefile, line 18: Badly formed macro assignment + Or: make: file `Makefile' line 18: Must be a separator (: + Or: pthread.h: No such file or directory + Solaris and FreeBSD are known to have troublesome make programs. GNU make 3.75 is known to work. - * The sql_yacc.cc file is generated from sql_yacc.yy. Normally, - the build process does not need to create sql_yacc.cc because - MySQL comes with a pregenerated copy. However, if you do need - to re-create it, you might encounter this error: + * The sql_yacc.cc file is generated from sql_yacc.yy. + Normally, the build process does not need to create + sql_yacc.cc because MySQL comes with a pregenerated copy. + However, if you do need to re-create it, you might + encounter this error: "sql_yacc.yy", line xxx fatal: default action causes potential... - This is a sign that your version of yacc is deficient. You - probably need to install bison (the GNU version of yacc) and - use that instead. + + This is a sign that your version of yacc is deficient. + You probably need to install a recent version of bison + (the GNU version of yacc) and use that instead. Versions of bison older than 1.75 may report this error: sql_yacc.yy:#####: fatal error: maximum table size (32767) exceeded - The maximum table size is not actually exceeded; the error is - caused by bugs in older versions of bison. - For information about acquiring or updating tools, see the system - requirements in Section 2.9, "Installing MySQL from Source." + The maximum table size is not actually exceeded; the + error is caused by bugs in older versions of bison. + + For information about acquiring or updating tools, see the + system requirements in Section 2.9, "Installing MySQL from + Source." -2.9.6. MySQL Configuration and Third-Party Tools +2.9.6 MySQL Configuration and Third-Party Tools - Third-party tools that need to determine the MySQL version from - the MySQL source can read the VERSION file in the top-level source - directory. The file lists the pieces of the version separately. - For example, if the version is 5.5.8, the file looks like this: + Third-party tools that need to determine the MySQL version + from the MySQL source can read the VERSION file in the + top-level source directory. The file lists the pieces of the + version separately. For example, if the version is MySQL + 5.7.4-m14, the file looks like this: MYSQL_VERSION_MAJOR=5 -MYSQL_VERSION_MINOR=5 -MYSQL_VERSION_PATCH=8 -MYSQL_VERSION_EXTRA= +MYSQL_VERSION_MINOR=7 +MYSQL_VERSION_PATCH=4 +MYSQL_VERSION_EXTRA=-m14 - If the source is not for a General Availability (GA) release, the - MYSQL_VERSION_EXTRA value will be nonempty. For example, the value - for a Release Candidate release would look like this: -MYSQL_VERSION_EXTRA=rc + If the source is not for a General Availablility (GA) + release, the MYSQL_VERSION_EXTRA value will be nonempty. For + the example, the value corresponds to Milestone 14. - To construct a five-digit number from the version components, use - this formula: -MYSQL_VERSION_MAJOR*10000 + MYSQL_VERSION_MINOR*100 + MYSQL_VERSION_P -ATCH + To construct a five-digit number from the version components, + use this formula: +MYSQL_VERSION_MAJOR*10000 + MYSQL_VERSION_MINOR*100 + MYSQL_VERSION_PA +TCH -2.10. Postinstallation Setup and Testing +2.10 Postinstallation Setup and Testing This section discusses post-installation items for Unix-like - systems. If you are using Windows, see Section 2.3.8, "Windows - Postinstallation Procedures." + systems. If you are using Windows, see Section 2.3.8, + "Windows Postinstallation Procedures." After installing MySQL, there are some items that you should address. For example: - * You should initialize the data directory and create the MySQL - grant tables, as describe in Section 2.10.1, "Postinstallation - Procedures for Unix-like Systems." + * You should initialize the data directory and create the + MySQL grant tables, as describe in Section 2.10.1, + "Postinstallation Procedures for Unix-like Systems." - * An important security concern is that the initial accounts in - the grant tables have no passwords. You should assign - passwords to prevent unauthorized access to the MySQL server. - For instructions, see Section 2.10.2, "Securing the Initial - MySQL Accounts." + * An important security concern is that the initial + accounts in the grant tables have no passwords. You + should assign passwords to prevent unauthorized access to + the MySQL server. For instructions, see Section 2.10.2, + "Securing the Initial MySQL Accounts." * Optionally, you can create time zone tables to enable - recognition of named time zones. For instructions, see Section - 4.4.6, "mysql_tzinfo_to_sql --- Load the Time Zone Tables." + recognition of named time zones. For instructions, see + Section 4.4.6, "mysql_tzinfo_to_sql --- Load the Time + Zone Tables." - * If you have trouble getting the server to start, see Section - 2.10.1.3, "Starting and Troubleshooting the MySQL Server." + * If you have trouble getting the server to start, see + Section 2.10.1.3, "Starting and Troubleshooting the MySQL + Server." - * When you are ready to create additional user accounts, you can - find information on the MySQL access control system and - account management in Section 6.2, "The MySQL Access Privilege - System," and Section 6.3, "MySQL User Account Management." + * When you are ready to create additional user accounts, + you can find information on the MySQL access control + system and account management in Section 6.2, "The MySQL + Access Privilege System," and Section 6.3, "MySQL User + Account Management." -2.10.1. Postinstallation Procedures for Unix-like Systems +2.10.1 Postinstallation Procedures for Unix-like Systems - After installing MySQL on a Unix-like system, you must initialize - the grant tables, start the server, and make sure that the server - works satisfactorily. You may also wish to arrange for the server - to be started and stopped automatically when your system starts - and stops. You should also assign passwords to the accounts in the - grant tables. + After installing MySQL on a Unix-like system, you must + initialize the grant tables, start the server, and make sure + that the server works satisfactorily. You may also wish to + arrange for the server to be started and stopped + automatically when your system starts and stops. You should + also assign passwords to the accounts in the grant tables. On a Unix-like system, the grant tables are set up by the mysql_install_db program. For some installation methods, this program is run for you automatically if an existing database cannot be found. - * If you install MySQL on Linux using RPM distributions, the - server RPM runs mysql_install_db. + * If you install MySQL on Linux using RPM distributions, + the server RPM runs mysql_install_db. - * Using the native packaging system on many platforms, including - Debian Linux, Ubuntu Linux, Gentoo Linux and others, the - mysql_install_db command is run for you. + * Using the native packaging system on many platforms, + including Debian Linux, Ubuntu Linux, Gentoo Linux and + others, the mysql_install_db command is run for you. - * If you install MySQL on Mac OS X using a DMG distribution, the - installer runs mysql_install_db. + * If you install MySQL on OS X using a DMG distribution, + the installer runs mysql_install_db. For other platforms and installation types, including generic - binary and source installs, you will need to run mysql_install_db - yourself. + binary and source installs, you will need to run + mysql_install_db yourself. The following procedure describes how to initialize the grant tables (if that has not previously been done) and start the - server. It also suggests some commands that you can use to test - whether the server is accessible and working properly. For - information about starting and stopping the server automatically, - see Section 2.10.1.2, "Starting and Stopping MySQL Automatically." - - After you complete the procedure and have the server running, you - should assign passwords to the accounts created by - mysql_install_db and perhaps restrict access to test databases. - For instructions, see Section 2.10.2, "Securing the Initial MySQL - Accounts." + server. It also suggests some commands that you can use to + test whether the server is accessible and working properly. + For information about starting and stopping the server + automatically, see Section 2.10.1.2, "Starting and Stopping + MySQL Automatically." + + After you complete the procedure and have the server running, + you should assign passwords to the accounts created by + mysql_install_db and perhaps restrict access to test + databases. For instructions, see Section 2.10.2, "Securing + the Initial MySQL Accounts." - In the examples shown here, the server runs under the user ID of - the mysql login account. This assumes that such an account exists. - Either create the account if it does not exist, or substitute the - name of a different existing login account that you plan to use - for running the server. For information about creating the - account, see Creating a mysql System User and Group, in Section - 2.2, "Installing MySQL on Unix/Linux Using Generic Binaries." + In the examples shown here, the server runs under the user ID + of the mysql login account. This assumes that such an account + exists. Either create the account if it does not exist, or + substitute the name of a different existing login account + that you plan to use for running the server. For information + about creating the account, see Creating a mysql System User + and Group, in Section 2.2, "Installing MySQL on Unix/Linux + Using Generic Binaries." - 1. Change location into the top-level directory of your MySQL - installation, represented here by BASEDIR: + 1. Change location into the top-level directory of your + MySQL installation, represented here by BASEDIR: shell> cd BASEDIR - BASEDIR is the installation directory for your MySQL instance. - It is likely to be something like /usr/local/mysql, - /usr/local, or /usr/bin (for installation wtih MySQL Yum - repository, or other means). The following steps assume that - you have changed location to this directory. - You will find several files and subdirectories in the BASEDIR - directory. The most important for installation purposes are - the bin and scripts subdirectories: + + BASEDIR is the installation directory for your MySQL + instance. It is likely to be something like + /usr/local/mysql, /usr/local, or /usr/bin (for + installation wtih MySQL Yum repository, or other means). + The following steps assume that you have changed location + to this directory. + You will find several files and subdirectories in the + BASEDIR directory. The most important for installation + purposes are the bin and scripts subdirectories: + The bin directory contains client programs and the server. You should add the full path name of this - directory to your PATH environment variable so that your - shell finds the MySQL programs properly. See Section - 2.12, "Environment Variables." + directory to your PATH environment variable so that + your shell finds the MySQL programs properly. See + Section 2.12, "Environment Variables." + The scripts directory contains the mysql_install_db - script used to initialize the mysql database containing - the grant tables that store the server access - permissions. + program used to initialize the mysql database + containing the grant tables that store the server + access permissions. 2. If necessary, ensure that the distribution contents are accessible to mysql. If you installed the distribution as - mysql, no further action is required. If you installed the - distribution as root, its contents will be owned by root. - Change its ownership to mysql by executing the following - commands as root in the installation directory. The first - command changes the owner attribute of the files to the mysql - user. The second changes the group attribute to the mysql - group. + mysql, no further action is required. If you installed + the distribution as root, its contents will be owned by + root. Change its ownership to mysql by executing the + following commands as root in the installation directory. + The first command changes the owner attribute of the + files to the mysql user. The second changes the group + attribute to the mysql group. shell> chown -R mysql . shell> chgrp -R mysql . - 3. If necessary, run the mysql_install_db program to set up the - initial MySQL grant tables containing the privileges that - determine how users are permitted to connect to the server. - You will need to do this if you used a distribution type for - which the installation procedure does not run the program for - you. + + 3. If necessary, run the mysql_install_db program to set up + the initial MySQL grant tables containing the privileges + that determine how users are permitted to connect to the + server. You will need to do this if you used a + distribution type for which the installation procedure + does not run the program for you. shell> scripts/mysql_install_db --user=mysql - Typically, mysql_install_db needs to be run only the first - time you install MySQL, so you can skip this step if you are - upgrading an existing installation, However, mysql_install_db - does not overwrite any existing privilege tables, so it should - be safe to run in any circumstances. + + Typically, mysql_install_db needs to be run only the + first time you install MySQL, so you can skip this step + if you are upgrading an existing installation, However, + mysql_install_db does not overwrite any existing + privilege tables, so it should be safe to run in any + circumstances. It might be necessary to specify other options such as - --basedir or --datadir if mysql_install_db does not identify - the correct locations for the installation directory or data - directory. For example: + --basedir or --datadir if mysql_install_db does not + identify the correct locations for the installation + directory or data directory. For example: shell> scripts/mysql_install_db --user=mysql \ --basedir=/opt/mysql/mysql \ --datadir=/opt/mysql/mysql/data - The mysql_install_db script creates the server's data - directory with mysql as the owner. Under the data directory, - it creates directories for the mysql database that holds the - grant tables and the test database that you can use to test - MySQL. The script also creates privilege table entries for - root and anonymous-user accounts. The accounts have no - passwords initially. Section 2.10.2, "Securing the Initial - MySQL Accounts," describes the initial privileges. Briefly, - these privileges permit the MySQL root user to do anything, - and permit anybody to create or use databases with a name of + + The mysql_install_db program creates the server's data + directory with mysql as the owner. Under the data + directory, it creates directories for the mysql database + that holds the grant tables and the test database that + you can use to test MySQL. The script also creates + privilege table entries for root and anonymous-user + accounts. The accounts have no passwords initially. + Section 2.10.2, "Securing the Initial MySQL Accounts," + describes the initial privileges. Briefly, these + privileges permit the MySQL root user to do anything, and + permit anybody to create or use databases with a name of test or starting with test_. See Section 6.2, "The MySQL Access Privilege System," for a complete listing and description of the grant tables. - For a more secure installation, invoke mysql_install_db with - the --random-passwords option. This causes it to assign a - random password to the MySQL root accounts, set the "password - expired" flag for those accounts, and remove the - anonymous-user MySQL accounts. For additional details, see - Section 4.4.3, "mysql_install_db --- Initialize MySQL Data - Directory." (Install operations using RPMs for Unbreakable - Linux Network are unaffected because they do not use - mysql_install_db.) - It is important to make sure that the database directories and - files are owned by the mysql login account so that the server - has read and write access to them when you run it later. To - ensure this if you run mysql_install_db as root, include the - --user option as shown. Otherwise, you should execute the - script while logged in as mysql, in which case you can omit - the --user option from the command. - If you do not want to have the test database, you can remove - it after starting the server, using the instructions in - Section 2.10.2, "Securing the Initial MySQL Accounts." - If you have trouble with mysql_install_db at this point, see - Section 2.10.1.1, "Problems Running mysql_install_db." - - 4. Most of the MySQL installation can be owned by root if you - like. The exception is that the data directory must be owned - by mysql. To accomplish this, run the following commands as - root in the installation directory: + For a more secure installation, invoke mysql_install_db + with the --random-passwords option. This causes it to + assign a random password to the MySQL root accounts, set + the "password expired" flag for those accounts, and + remove the anonymous-user MySQL accounts. For additional + details, see Section 4.4.3, "mysql_install_db --- + Initialize MySQL Data Directory." (Install operations + using RPMs for Unbreakable Linux Network are unaffected + because they do not use mysql_install_db.) + It is important to make sure that the database + directories and files are owned by the mysql login + account so that the server has read and write access to + them when you run it later. To ensure this if you run + mysql_install_db as root, include the --user option as + shown. Otherwise, you should execute the script while + logged in as mysql, in which case you can omit the --user + option from the command. + If you do not want to have the test database, you can + remove it after starting the server, using the + instructions in Section 2.10.2, "Securing the Initial + MySQL Accounts." + If you have trouble with mysql_install_db at this point, + see Section 2.10.1.1, "Problems Running + mysql_install_db." + + 4. Most of the MySQL installation can be owned by root if + you like. The exception is that the data directory must + be owned by mysql. To accomplish this, run the following + commands as root in the installation directory: shell> chown -R root . shell> chown -R mysql data - 5. If the plugin directory (the directory named by the plugin_dir - system variable) is writable by the server, it may be possible - for a user to write executable code to a file in the directory - using SELECT ... INTO DUMPFILE. This can be prevented by - making plugin_dir read only to the server or by setting - --secure-file-priv to a directory where SELECT writes can be - made safely. - - 6. If you installed MySQL using a source distribution, you may - want to optionally copy one of the provided configuration - files from the support-files directory into your /etc - directory. There are different sample configuration files for - different use cases, server types, and CPU and RAM - configurations. If you want to use one of these standard - files, you should copy it to /etc/my.cnf, or /etc/mysql/my.cnf - and edit and check the configuration before starting your - MySQL server for the first time. - If you do not copy one of the standard configuration files, - the MySQL server will be started with the default settings. - If you want MySQL to start automatically when you boot your - machine, you can copy support-files/mysql.server to the - location where your system has its startup files. More - information can be found in the mysql.server script itself, - and in Section 2.10.1.2, "Starting and Stopping MySQL - Automatically." + + 5. If the plugin directory (the directory named by the + plugin_dir system variable) is writable by the server, it + may be possible for a user to write executable code to a + file in the directory using SELECT ... INTO DUMPFILE. + This can be prevented by making plugin_dir read only to + the server or by setting --secure-file-priv to a + directory where SELECT writes can be made safely. + + 6. If you installed MySQL using a source distribution, you + may want to optionally copy one of the provided + configuration files from the support-files directory into + your /etc directory. There are different sample + configuration files for different use cases, server + types, and CPU and RAM configurations. If you want to use + one of these standard files, you should copy it to + /etc/my.cnf, or /etc/mysql/my.cnf and edit and check the + configuration before starting your MySQL server for the + first time. + If you do not copy one of the standard configuration + files, the MySQL server will be started with the default + settings. + If you want MySQL to start automatically when you boot + your machine, you can copy support-files/mysql.server to + the location where your system has its startup files. + More information can be found in the mysql.server script + itself, and in Section 2.10.1.2, "Starting and Stopping + MySQL Automatically." 7. Start the MySQL server: shell> bin/mysqld_safe --user=mysql & + It is important that the MySQL server be run using an - unprivileged (non-root) login account. To ensure this if you - run mysqld_safe as root, include the --user option as shown. - Otherwise, you should execute the script while logged in as - mysql, in which case you can omit the --user option from the - command. - For further instructions for running MySQL as an unprivileged - user, see Section 6.1.5, "How to Run MySQL as a Normal User." - If the command fails immediately and prints mysqld ended, look - for information in the error log (which by default is the - host_name.err file in the data directory). + unprivileged (non-root) login account. To ensure this if + you run mysqld_safe as root, include the --user option as + shown. Otherwise, you should execute the script while + logged in as mysql, in which case you can omit the --user + option from the command. + For further instructions for running MySQL as an + unprivileged user, see Section 6.1.5, "How to Run MySQL + as a Normal User." + If the command fails immediately and prints mysqld ended, + look for information in the error log (which by default + is the host_name.err file in the data directory). If you neglected to create the grant tables by running - mysql_install_db before proceeding to this step, the following - message appears in the error log file when you start the - server: + mysql_install_db before proceeding to this step, the + following message appears in the error log file when you + start the server: mysqld: Can't find file: 'host.frm' - This error also occurs if you run mysql_install_db as root - without the --user option. Remove the data directory and run - mysql_install_db with the --user option as described - previously. - If you have other problems starting the server, see Section - 2.10.1.3, "Starting and Troubleshooting the MySQL Server." For - more information about mysqld_safe, see Section 4.3.2, - "mysqld_safe --- MySQL Server Startup Script." + + This error also occurs if you run mysql_install_db as + root without the --user option. Remove the data directory + and run mysql_install_db with the --user option as + described previously. + If you have other problems starting the server, see + Section 2.10.1.3, "Starting and Troubleshooting the MySQL + Server." For more information about mysqld_safe, see + Section 4.3.2, "mysqld_safe --- MySQL Server Startup + Script." 8. Use mysqladmin to verify that the server is running. The - following commands provide simple tests to check whether the - server is up and responding to connections: + following commands provide simple tests to check whether + the server is up and responding to connections: shell> bin/mysqladmin version shell> bin/mysqladmin variables - The output from mysqladmin version varies slightly depending - on your platform and version of MySQL, but should be similar - to that shown here: + + The output from mysqladmin version varies slightly + depending on your platform and version of MySQL, but + should be similar to that shown here: shell> bin/mysqladmin version -mysqladmin Ver 14.12 Distrib 5.6.17, for pc-linux-gnu on i686 +mysqladmin Ver 14.12 Distrib 5.6.23, for pc-linux-gnu on i686 ... -Server version 5.6.17 +Server version 5.6.23 Protocol version 10 Connection Localhost via UNIX socket UNIX socket /var/lib/mysql/mysql.sock @@ -6064,19 +7056,23 @@ Uptime: 14 days 5 hours 5 min 21 sec Threads: 1 Questions: 366 Slow queries: 0 Opens: 0 Flush tables: 1 Open tables: 19 Queries per second avg: 0.000 - To see what else you can do with mysqladmin, invoke it with - the --help option. + + To see what else you can do with mysqladmin, invoke it + with the --help option. 9. Verify that you can shut down the server: shell> bin/mysqladmin -u root shutdown - 10. Verify that you can start the server again. Do this by using - mysqld_safe or by invoking mysqld directly. For example: + + 10. Verify that you can start the server again. Do this by + using mysqld_safe or by invoking mysqld directly. For + example: shell> bin/mysqld_safe --user=mysql & + If mysqld_safe fails, see Section 2.10.1.3, "Starting and Troubleshooting the MySQL Server." 11. Run some simple tests to verify that you can retrieve - information from the server. The output should be similar to - what is shown here: + information from the server. The output should be similar + to what is shown here: shell> bin/mysqlshow +--------------------+ | Databases | @@ -6120,287 +7116,295 @@ shell> bin/mysql -e "SELECT Host,Db,User FROM db" mysql | % | test | | | % | test_% | | +------+--------+------+ - 12. There is a benchmark suite in the sql-bench directory (under - the MySQL installation directory) that you can use to compare - how MySQL performs on different platforms. The benchmark suite - is written in Perl. It requires the Perl DBI module that - provides a database-independent interface to the various - databases, and some other additional Perl modules: + + 12. There is a benchmark suite in the sql-bench directory + (under the MySQL installation directory) that you can use + to compare how MySQL performs on different platforms. The + benchmark suite is written in Perl. It requires the Perl + DBI module that provides a database-independent interface + to the various databases, and some other additional Perl + modules: DBI DBD::mysql Data::Dumper Data::ShowTable + These modules can be obtained from CPAN - (http://www.cpan.org/). See also Section 2.13.1, "Installing - Perl on Unix." - The sql-bench/Results directory contains the results from many - runs against different databases and platforms. To run all - tests, execute these commands: + (http://www.cpan.org/). See also Section 2.13.1, + "Installing Perl on Unix." + The sql-bench/Results directory contains the results from + many runs against different databases and platforms. To + run all tests, execute these commands: shell> cd sql-bench shell> perl run-all-tests + If you do not have the sql-bench directory, you probably - installed MySQL using RPM files other than the source RPM. - (The source RPM includes the sql-bench benchmark directory.) - In this case, you must first install the benchmark suite - before you can use it. There are separate benchmark RPM files - named mysql-bench-VERSION.i386.rpm that contain benchmark code - and data. - If you have a source distribution, there are also tests in its - tests subdirectory that you can run. For example, to run - auto_increment.tst, execute this command from the top-level - directory of your source distribution: + installed MySQL using RPM files other than the source + RPM. (The source RPM includes the sql-bench benchmark + directory.) In this case, you must first install the + benchmark suite before you can use it. There are separate + benchmark RPM files named mysql-bench-VERSION.i386.rpm + that contain benchmark code and data. + If you have a source distribution, there are also tests + in its tests subdirectory that you can run. For example, + to run auto_increment.tst, execute this command from the + top-level directory of your source distribution: shell> mysql -vvf test < ./tests/auto_increment.tst + The expected result of the test can be found in the ./tests/auto_increment.res file. - 13. At this point, you should have the server running. However, - none of the initial MySQL accounts have a password, and the - server permits permissive access to test databases. To tighten - security, follow the instructions in Section 2.10.2, "Securing - the Initial MySQL Accounts." - - The MySQL 5.6 installation procedure creates time zone tables in - the mysql database but does not populate them. To do so, use the - instructions in Section 10.6, "MySQL Server Time Zone Support." - - To make it more convenient to invoke programs installed in the bin - directory under the installation directory, you can add that - directory to your PATH environment variable setting. That enables - you to run a program by typing only its name, not its entire path - name. See Section 4.2.4, "Setting Environment Variables." - - You can set up new accounts using the bin/mysql_setpermission - script if you install the DBI and DBD::mysql Perl modules. See - Section 4.6.14, "mysql_setpermission --- Interactively Set - Permissions in Grant Tables." For Perl module installation - instructions, see Section 2.13, "Perl Installation Notes." - - If you would like to use mysqlaccess and have the MySQL - distribution in some nonstandard location, you must change the - location where mysqlaccess expects to find the mysql client. Edit - the bin/mysqlaccess script at approximately line 18. Search for a - line that looks like this: -$MYSQL = '/usr/local/bin/mysql'; # path to mysql executable - - Change the path to reflect the location where mysql actually is - stored on your system. If you do not do this, a Broken pipe error - will occur when you run mysqlaccess. - -2.10.1.1. Problems Running mysql_install_db - - The purpose of the mysql_install_db script is to generate new - MySQL privilege tables. It does not overwrite existing MySQL - privilege tables, and it does not affect any other data. - - If you want to re-create your privilege tables, first stop the - mysqld server if it is running. Then rename the mysql directory - under the data directory to save it, and then run - mysql_install_db. Suppose that your current directory is the MySQL - installation directory and that mysql_install_db is located in the - bin directory and the data directory is named data. To rename the - mysql database and re-run mysql_install_db, use these commands. + 13. At this point, you should have the server running. + However, none of the initial MySQL accounts have a + password, and the server permits permissive access to + test databases. To tighten security, follow the + instructions in Section 2.10.2, "Securing the Initial + MySQL Accounts." + + The MySQL 5.6 installation procedure creates time zone tables + in the mysql database but does not populate them. To do so, + use the instructions in Section 10.6, "MySQL Server Time Zone + Support." + + To make it more convenient to invoke programs installed in + the bin directory under the installation directory, you can + add that directory to your PATH environment variable setting. + That enables you to run a program by typing only its name, + not its entire path name. See Section 4.2.10, "Setting + Environment Variables." + +2.10.1.1 Problems Running mysql_install_db + + The purpose of the mysql_install_db program is to generate + new MySQL privilege tables. It does not overwrite existing + MySQL privilege tables, and it does not affect any other + data. + + If you want to re-create your privilege tables, first stop + the mysqld server if it is running. Then rename the mysql + directory under the data directory to save it, and then run + mysql_install_db. Suppose that your current directory is the + MySQL installation directory and that mysql_install_db is + located in the bin directory and the data directory is named + data. To rename the mysql database and re-run + mysql_install_db, use these commands. shell> mv data/mysql data/mysql.old shell> scripts/mysql_install_db --user=mysql - When you run mysql_install_db, you might encounter the following - problems: + When you run mysql_install_db, you might encounter the + following problems: * mysql_install_db fails to install the grant tables - You may find that mysql_install_db fails to install the grant - tables and terminates after displaying the following messages: + You may find that mysql_install_db fails to install the + grant tables and terminates after displaying the + following messages: Starting mysqld daemon with databases from XXXXXX mysqld ended + In this case, you should examine the error log file very - carefully. The log should be located in the directory XXXXXX - named by the error message and should indicate why mysqld did - not start. If you do not understand what happened, include the - log when you post a bug report. See Section 1.7, "How to - Report Bugs or Problems." + carefully. The log should be located in the directory + XXXXXX named by the error message and should indicate why + mysqld did not start. If you do not understand what + happened, include the log when you post a bug report. See + Section 1.7, "How to Report Bugs or Problems." * There is a mysqld process running - This indicates that the server is running, in which case the - grant tables have probably been created already. If so, there - is no need to run mysql_install_db at all because it needs to - be run only once (when you install MySQL the first time). + This indicates that the server is running, in which case + the grant tables have probably been created already. If + so, there is no need to run mysql_install_db at all + because it needs to be run only once (when you install + MySQL the first time). * Installing a second mysqld server does not work when one server is running - This can happen when you have an existing MySQL installation, - but want to put a new installation in a different location. - For example, you might have a production installation, but you - want to create a second installation for testing purposes. - Generally the problem that occurs when you try to run a second - server is that it tries to use a network interface that is in - use by the first server. In this case, you should see one of - the following error messages: + This can happen when you have an existing MySQL + installation, but want to put a new installation in a + different location. For example, you might have a + production installation, but you want to create a second + installation for testing purposes. Generally the problem + that occurs when you try to run a second server is that + it tries to use a network interface that is in use by the + first server. In this case, you should see one of the + following error messages: Can't start server: Bind on TCP/IP port: Address already in use Can't start server: Bind on unix socket... - For instructions on setting up multiple servers, see Section - 5.3, "Running Multiple MySQL Instances on One Machine." + + For instructions on setting up multiple servers, see + Section 5.3, "Running Multiple MySQL Instances on One + Machine." * You do not have write access to the /tmp directory - If you do not have write access to create temporary files or a - Unix socket file in the default location (the /tmp directory) - or the TMP_DIR environment variable, if it has been set, an - error occurs when you run mysql_install_db or the mysqld - server. + If you do not have write access to create temporary files + or a Unix socket file in the default location (the /tmp + directory) or the TMP_DIR environment variable, if it has + been set, an error occurs when you run mysql_install_db + or the mysqld server. You can specify different locations for the temporary - directory and Unix socket file by executing these commands - prior to starting mysql_install_db or mysqld, where - some_tmp_dir is the full path name to some directory for which - you have write permission: + directory and Unix socket file by executing these + commands prior to starting mysql_install_db or mysqld, + where some_tmp_dir is the full path name to some + directory for which you have write permission: shell> TMPDIR=/some_tmp_dir/ shell> MYSQL_UNIX_PORT=/some_tmp_dir/mysql.sock shell> export TMPDIR MYSQL_UNIX_PORT - Then you should be able to run mysql_install_db and start the - server with these commands: + + Then you should be able to run mysql_install_db and start + the server with these commands: shell> scripts/mysql_install_db --user=mysql shell> bin/mysqld_safe --user=mysql & + If mysql_install_db is located in the scripts directory, modify the first command to scripts/mysql_install_db. - See Section C.5.4.5, "How to Protect or Change the MySQL Unix - Socket File," and Section 2.12, "Environment Variables." - - There are some alternatives to running the mysql_install_db script - provided in the MySQL distribution: - - * If you want the initial privileges to be different from the - standard defaults, you can modify mysql_install_db before you - run it. However, it is preferable to use GRANT and REVOKE to - change the privileges after the grant tables have been set up. - In other words, you can run mysql_install_db, and then use - mysql -u root mysql to connect to the server as the MySQL root - user so that you can issue the necessary GRANT and REVOKE - statements. - If you want to install MySQL on several machines with the same - privileges, you can put the GRANT and REVOKE statements in a - file and execute the file as a script using mysql after - running mysql_install_db. For example: + See Section B.5.4.5, "How to Protect or Change the MySQL + Unix Socket File," and Section 2.12, "Environment + Variables." + + There are some alternatives to running the mysql_install_db + program provided in the MySQL distribution: + + * If you want the initial privileges to be different from + the standard defaults, you can modify mysql_install_db + before you run it. However, it is preferable to use GRANT + and REVOKE to change the privileges after the grant + tables have been set up. In other words, you can run + mysql_install_db, and then use mysql -u root mysql to + connect to the server as the MySQL root user so that you + can issue the necessary GRANT and REVOKE statements. + If you want to install MySQL on several machines with the + same privileges, you can put the GRANT and REVOKE + statements in a file and execute the file as a script + using mysql after running mysql_install_db. For example: shell> scripts/mysql_install_db --user=mysql shell> bin/mysql -u root < your_script_file - By doing this, you can avoid having to issue the statements - manually on each machine. - - * It is possible to re-create the grant tables completely after - they have previously been created. You might want to do this - if you are just learning how to use GRANT and REVOKE and have - made so many modifications after running mysql_install_db that - you want to wipe out the tables and start over. - To re-create the grant tables, remove all the .frm, .MYI, and - .MYD files in the mysql database directory. Then run the - mysql_install_db script again. - - * You can start mysqld manually using the --skip-grant-tables - option and add the privilege information yourself using mysql: + + By doing this, you can avoid having to issue the + statements manually on each machine. + + * It is possible to re-create the grant tables completely + after they have previously been created. You might want + to do this if you are just learning how to use GRANT and + REVOKE and have made so many modifications after running + mysql_install_db that you want to wipe out the tables and + start over. + To re-create the grant tables, remove all the .frm, .MYI, + and .MYD files in the mysql database directory. Then run + the mysql_install_db program again. + + * You can start mysqld manually using the + --skip-grant-tables option and add the privilege + information yourself using mysql: shell> bin/mysqld_safe --user=mysql --skip-grant-tables & shell> bin/mysql mysql - From mysql, manually execute the SQL commands contained in - mysql_install_db. Make sure that you run mysqladmin - flush-privileges or mysqladmin reload afterward to tell the - server to reload the grant tables. - Note that by not using mysql_install_db, you not only have to - populate the grant tables manually, you also have to create - them first. -2.10.1.2. Starting and Stopping MySQL Automatically + From mysql, manually execute the SQL commands contained + in mysql_install_db. Make sure that you run mysqladmin + flush-privileges or mysqladmin reload afterward to tell + the server to reload the grant tables. + Note that by not using mysql_install_db, you not only + have to populate the grant tables manually, you also have + to create them first. + +2.10.1.2 Starting and Stopping MySQL Automatically Generally, you start the mysqld server in one of these ways: * Invoke mysqld directly. This works on any platform. * Invoke mysqld_safe, which tries to determine the proper - options for mysqld and then runs it with those options. This - script is used on Unix and Unix-like systems. See Section - 4.3.2, "mysqld_safe --- MySQL Server Startup Script." - - * Invoke mysql.server. This script is used primarily at system - startup and shutdown on systems that use System V-style run - directories (that is, /etc/init.d and run-level specific - directories), where it usually is installed under the name - mysql. The mysql.server script starts the server by invoking - mysqld_safe. See Section 4.3.3, "mysql.server --- MySQL Server - Startup Script." - - * On Mac OS X, install a separate MySQL Startup Item package to - enable the automatic startup of MySQL on system startup. The - Startup Item starts the server by invoking mysql.server. See - Section 2.4.3, "Installing the MySQL Startup Item," for - details. A MySQL Preference Pane also provides control for - starting and stopping MySQL through the System Preferences, - see Section 2.4.4, "Installing and Using the MySQL Preference - Pane." - - * Use the Solaris/OpenSolaris service management framework (SMF) - system to initiate and control MySQL startup. For more - information, see Section 2.6.2, "Installing MySQL on + options for mysqld and then runs it with those options. + This script is used on Unix and Unix-like systems. See + Section 4.3.2, "mysqld_safe --- MySQL Server Startup + Script." + + * Invoke mysql.server. This script is used primarily at + system startup and shutdown on systems that use System + V-style run directories (that is, /etc/init.d and + run-level specific directories), where it usually is + installed under the name mysql. The mysql.server script + starts the server by invoking mysqld_safe. See Section + 4.3.3, "mysql.server --- MySQL Server Startup Script." + + * On OS X, install a separate MySQL Startup Item package to + enable the automatic startup of MySQL on system startup. + The Startup Item starts the server by invoking + mysql.server. See Section 2.4.4, "Installing the MySQL + Startup Item," for details. A MySQL Preference Pane also + provides control for starting and stopping MySQL through + the System Preferences, see Section 2.4.5, "Installing + and Using the MySQL Preference Pane." + + * Use the Solaris/OpenSolaris service management framework + (SMF) system to initiate and control MySQL startup. For + more information, see Section 2.7.2, "Installing MySQL on OpenSolaris Using IPS." - The mysqld_safe and mysql.server scripts, Solaris/OpenSolaris SMF, - and the Mac OS X Startup Item (or MySQL Preference Pane) can be - used to start the server manually, or automatically at system - startup time. mysql.server and the Startup Item also can be used - to stop the server. + The mysqld_safe and mysql.server scripts, Solaris/OpenSolaris + SMF, and the OS X Startup Item (or MySQL Preference Pane) can + be used to start the server manually, or automatically at + system startup time. mysql.server and the Startup Item also + can be used to stop the server. To start or stop the server manually using the mysql.server script, invoke it with start or stop arguments: shell> mysql.server start shell> mysql.server stop - Before mysql.server starts the server, it changes location to the - MySQL installation directory, and then invokes mysqld_safe. If you - want the server to run as some specific user, add an appropriate - user option to the [mysqld] group of the /etc/my.cnf option file, - as shown later in this section. (It is possible that you will need - to edit mysql.server if you've installed a binary distribution of - MySQL in a nonstandard location. Modify it to change location into - the proper directory before it runs mysqld_safe. If you do this, - your modified version of mysql.server may be overwritten if you - upgrade MySQL in the future, so you should make a copy of your - edited version that you can reinstall.) - - mysql.server stop stops the server by sending a signal to it. You - can also stop the server manually by executing mysqladmin + Before mysql.server starts the server, it changes location to + the MySQL installation directory, and then invokes + mysqld_safe. If you want the server to run as some specific + user, add an appropriate user option to the [mysqld] group of + the /etc/my.cnf option file, as shown later in this section. + (It is possible that you will need to edit mysql.server if + you've installed a binary distribution of MySQL in a + nonstandard location. Modify it to change location into the + proper directory before it runs mysqld_safe. If you do this, + your modified version of mysql.server may be overwritten if + you upgrade MySQL in the future, so you should make a copy of + your edited version that you can reinstall.) + + mysql.server stop stops the server by sending a signal to it. + You can also stop the server manually by executing mysqladmin shutdown. - To start and stop MySQL automatically on your server, you need to - add start and stop commands to the appropriate places in your - /etc/rc* files. + To start and stop MySQL automatically on your server, you + need to add start and stop commands to the appropriate places + in your /etc/rc* files. If you use the Linux server RPM package (MySQL-server-VERSION.rpm), or a native Linux package installation, the mysql.server script may be installed in the - /etc/init.d directory with the name mysql. See Section 2.5.3, + /etc/init.d directory with the name mysql. See Section 2.5.5, "Installing MySQL on Linux Using RPM Packages," for more information on the Linux RPM packages. - Some vendors provide RPM packages that install a startup script - under a different name such as mysqld. + Some vendors provide RPM packages that install a startup + script under a different name such as mysqld. - If you install MySQL from a source distribution or using a binary - distribution format that does not install mysql.server + If you install MySQL from a source distribution or using a + binary distribution format that does not install mysql.server automatically, you can install it manually. The script can be - found in the support-files directory under the MySQL installation - directory or in a MySQL source tree. + found in the support-files directory under the MySQL + installation directory or in a MySQL source tree. To install mysql.server manually, copy it to the /etc/init.d - directory with the name mysql, and then make it executable. Do - this by changing location into the appropriate directory where - mysql.server is located and executing these commands: + directory with the name mysql, and then make it executable. + Do this by changing location into the appropriate directory + where mysql.server is located and executing these commands: shell> cp mysql.server /etc/init.d/mysql shell> chmod +x /etc/init.d/mysql Note - Older Red Hat systems use the /etc/rc.d/init.d directory rather - than /etc/init.d. Adjust the preceding commands accordingly. - Alternatively, first create /etc/init.d as a symbolic link that - points to /etc/rc.d/init.d: + Older Red Hat systems use the /etc/rc.d/init.d directory + rather than /etc/init.d. Adjust the preceding commands + accordingly. Alternatively, first create /etc/init.d as a + symbolic link that points to /etc/rc.d/init.d: shell> cd /etc shell> ln -s rc.d/init.d . - After installing the script, the commands needed to activate it to - run at system startup depend on your operating system. On Linux, - you can use chkconfig: + After installing the script, the commands needed to activate + it to run at system startup depend on your operating system. + On Linux, you can use chkconfig: shell> chkconfig --add mysql On some Linux systems, the following command also seems to be @@ -6408,25 +7412,26 @@ shell> chkconfig --add mysql shell> chkconfig --level 345 mysql on On FreeBSD, startup scripts generally should go in - /usr/local/etc/rc.d/. The rc(8) manual page states that scripts in - this directory are executed only if their basename matches the - *.sh shell file name pattern. Any other files or directories - present within the directory are silently ignored. In other words, - on FreeBSD, you should install the mysql.server script as - /usr/local/etc/rc.d/mysql.server.sh to enable automatic startup. - - As an alternative to the preceding setup, some operating systems - also use /etc/rc.local or /etc/init.d/boot.local to start - additional services on startup. To start up MySQL using this - method, you could append a command like the one following to the - appropriate startup file: + /usr/local/etc/rc.d/. The rc(8) manual page states that + scripts in this directory are executed only if their basename + matches the *.sh shell file name pattern. Any other files or + directories present within the directory are silently + ignored. In other words, on FreeBSD, you should install the + mysql.server script as /usr/local/etc/rc.d/mysql.server.sh to + enable automatic startup. + + As an alternative to the preceding setup, some operating + systems also use /etc/rc.local or /etc/init.d/boot.local to + start additional services on startup. To start up MySQL using + this method, you could append a command like the one + following to the appropriate startup file: /bin/sh -c 'cd /usr/local/mysql; ./bin/mysqld_safe --user=mysql &' - For other systems, consult your operating system documentation to - see how to install startup scripts. + For other systems, consult your operating system + documentation to see how to install startup scripts. - You can add options for mysql.server in a global /etc/my.cnf file. - A typical /etc/my.cnf file might look like this: + You can add options for mysql.server in a global /etc/my.cnf + file. A typical /etc/my.cnf file might look like this: [mysqld] datadir=/usr/local/mysql/var socket=/var/tmp/mysql.sock @@ -6436,15 +7441,16 @@ user=mysql [mysql.server] basedir=/usr/local/mysql - The mysql.server script supports the following options: basedir, - datadir, and pid-file. If specified, they must be placed in an - option file, not on the command line. mysql.server supports only - start and stop as command-line arguments. + The mysql.server script supports the following options: + basedir, datadir, and pid-file. If specified, they must be + placed in an option file, not on the command line. + mysql.server supports only start and stop as command-line + arguments. - The following table shows which option groups the server and each - startup script read from option files. + The following table shows which option groups the server and + each startup script read from option files. - Table 2.14. MySQL Startup scripts and supported server option + Table 2.12 MySQL Startup scripts and supported server option groups Script Option Groups mysqld [mysqld], [server], [mysqld-major_version] @@ -6452,208 +7458,230 @@ basedir=/usr/local/mysql mysql.server [mysqld], [mysql.server], [server] [mysqld-major_version] means that groups with names like - [mysqld-5.5] and [mysqld-5.6] are read by servers having versions - 5.5.x, 5.6.x, and so forth. This feature can be used to specify - options that can be read only by servers within a given release - series. + [mysqld-5.5] and [mysqld-5.6] are read by servers having + versions 5.5.x, 5.6.x, and so forth. This feature can be used + to specify options that can be read only by servers within a + given release series. For backward compatibility, mysql.server also reads the - [mysql_server] group and mysqld_safe also reads the [safe_mysqld] - group. However, you should update your option files to use the - [mysql.server] and [mysqld_safe] groups instead when using MySQL - 5.6. + [mysql_server] group and mysqld_safe also reads the + [safe_mysqld] group. However, you should update your option + files to use the [mysql.server] and [mysqld_safe] groups + instead when using MySQL 5.6. For more information on MySQL configuration files and their - structure and contents, see Section 4.2.3.3, "Using Option Files." - -2.10.1.3. Starting and Troubleshooting the MySQL Server - - This section provides troubleshooting suggestions for problems - starting the server on a Unix-like system. If you are using - Windows, see Section 2.3.6, "Troubleshooting a Microsoft Windows - MySQL Server Installation." - - If you have problems starting the server, here are some things to - try: - - * Check the error log to see why the server does not start. Log - files are located in the data directory (typically C:\Program - Files\MySQL\MySQL Server 5.6\data on Windows, - /usr/local/mysql/data for a Unix/Linux binary distribution, - and /usr/local/var for a Unix/Linux source distribution). Look - in the data directory for files with names of the form - host_name.err and host_name.log, where host_name is the name - of your server host. Then examine the last few lines of these - files. Use tail to display them: + structure and contents, see Section 4.2.6, "Using Option + Files." + +2.10.1.3 Starting and Troubleshooting the MySQL Server + + This section provides troubleshooting suggestions for + problems starting the server on a Unix-like system. If you + are using Windows, see Section 2.3.6, "Troubleshooting a + Microsoft Windows MySQL Server Installation." + + If you have problems starting the server, here are some + things to try: + + * Check the error log to see why the server does not start. + Log files are located in the data directory (typically + C:\Program Files\MySQL\MySQL Server 5.6\data on Windows, + /usr/local/mysql/data for a Unix/Linux binary + distribution, and /usr/local/var for a Unix/Linux source + distribution). Look in the data directory for files with + names of the form host_name.err and host_name.log, where + host_name is the name of your server host. Then examine + the last few lines of these files. Use tail to display + them: shell> tail host_name.err shell> tail host_name.log - * Specify any special options needed by the storage engines you - are using. You can create a my.cnf file and specify startup - options for the engines that you plan to use. If you are going - to use storage engines that support transactional tables - (InnoDB, NDB), be sure that you have them configured the way - you want before starting the server. If you are using InnoDB - tables, see Section 14.2.3, "InnoDB Configuration" for - guidelines and Section 14.2.13, "InnoDB Startup Options and - System Variables" for option syntax. - Although storage engines use default values for options that - you omit, Oracle recommends that you review the available - options and specify explicit values for any options whose - defaults are not appropriate for your installation. + + * Specify any special options needed by the storage engines + you are using. You can create a my.cnf file and specify + startup options for the engines that you plan to use. If + you are going to use storage engines that support + transactional tables (InnoDB, NDB), be sure that you have + them configured the way you want before starting the + server. If you are using InnoDB tables, see Section 14.3, + "InnoDB Configuration" for guidelines and Section 14.12, + "InnoDB Startup Options and System Variables" for option + syntax. + Although storage engines use default values for options + that you omit, Oracle recommends that you review the + available options and specify explicit values for any + options whose defaults are not appropriate for your + installation. * Make sure that the server knows where to find the data directory. The mysqld server uses this directory as its - current directory. This is where it expects to find databases - and where it expects to write log files. The server also - writes the pid (process ID) file in the data directory. + current directory. This is where it expects to find + databases and where it expects to write log files. The + server also writes the pid (process ID) file in the data + directory. The default data directory location is hardcoded when the server is compiled. To determine what the default path settings are, invoke mysqld with the --verbose and --help - options. If the data directory is located somewhere else on - your system, specify that location with the --datadir option - to mysqld or mysqld_safe, on the command line or in an option - file. Otherwise, the server will not work properly. As an - alternative to the --datadir option, you can specify mysqld - the location of the base directory under which MySQL is - installed with the --basedir, and mysqld looks for the data - directory there. - To check the effect of specifying path options, invoke mysqld - with those options followed by the --verbose and --help - options. For example, if you change location into the - directory where mysqld is installed and then run the following - command, it shows the effect of starting the server with a - base directory of /usr/local: + options. If the data directory is located somewhere else + on your system, specify that location with the --datadir + option to mysqld or mysqld_safe, on the command line or + in an option file. Otherwise, the server will not work + properly. As an alternative to the --datadir option, you + can specify mysqld the location of the base directory + under which MySQL is installed with the --basedir, and + mysqld looks for the data directory there. + To check the effect of specifying path options, invoke + mysqld with those options followed by the --verbose and + --help options. For example, if you change location into + the directory where mysqld is installed and then run the + following command, it shows the effect of starting the + server with a base directory of /usr/local: shell> ./mysqld --basedir=/usr/local --verbose --help - You can specify other options such as --datadir as well, but - --verbose and --help must be the last options. + + You can specify other options such as --datadir as well, + but --verbose and --help must be the last options. Once you determine the path settings you want, start the server without --verbose and --help. - If mysqld is currently running, you can find out what path - settings it is using by executing this command: + If mysqld is currently running, you can find out what + path settings it is using by executing this command: shell> mysqladmin variables + Or: shell> mysqladmin -h host_name variables + host_name is the name of the MySQL server host. - * Make sure that the server can access the data directory. The - ownership and permissions of the data directory and its - contents must allow the server to read and modify them. - If you get Errcode 13 (which means Permission denied) when - starting mysqld, this means that the privileges of the data - directory or its contents do not permit server access. In this - case, you change the permissions for the involved files and - directories so that the server has the right to use them. You - can also start the server as root, but this raises security - issues and should be avoided. + * Make sure that the server can access the data directory. + The ownership and permissions of the data directory and + its contents must allow the server to read and modify + them. + If you get Errcode 13 (which means Permission denied) + when starting mysqld, this means that the privileges of + the data directory or its contents do not permit server + access. In this case, you change the permissions for the + involved files and directories so that the server has the + right to use them. You can also start the server as root, + but this raises security issues and should be avoided. Change location into the data directory and check the - ownership of the data directory and its contents to make sure - the server has access. For example, if the data directory is - /usr/local/mysql/var, use this command: + ownership of the data directory and its contents to make + sure the server has access. For example, if the data + directory is /usr/local/mysql/var, use this command: shell> ls -la /usr/local/mysql/var - If the data directory or its files or subdirectories are not - owned by the login account that you use for running the - server, change their ownership to that account. If the account - is named mysql, use these commands: + + If the data directory or its files or subdirectories are + not owned by the login account that you use for running + the server, change their ownership to that account. If + the account is named mysql, use these commands: shell> chown -R mysql /usr/local/mysql/var shell> chgrp -R mysql /usr/local/mysql/var - Even with correct ownership, MySQL might fail to start up if - there is other security software running on your system that - manages application access to various parts of the file - system. In this case, reconfigure that software to enable - mysqld to access the directories it uses during normal - operation. - - * Verify that the network interfaces the server wants to use are - available. - If either of the following errors occur, it means that some - other program (perhaps another mysqld server) is using the - TCP/IP port or Unix socket file that mysqld is trying to use: + + Even with correct ownership, MySQL might fail to start up + if there is other security software running on your + system that manages application access to various parts + of the file system. In this case, reconfigure that + software to enable mysqld to access the directories it + uses during normal operation. + + * Verify that the network interfaces the server wants to + use are available. + If either of the following errors occur, it means that + some other program (perhaps another mysqld server) is + using the TCP/IP port or Unix socket file that mysqld is + trying to use: Can't start server: Bind on TCP/IP port: Address already in use Can't start server: Bind on unix socket... - Use ps to determine whether you have another mysqld server - running. If so, shut down the server before starting mysqld - again. (If another server is running, and you really want to - run multiple servers, you can find information about how to do - so in Section 5.3, "Running Multiple MySQL Instances on One - Machine.") + + Use ps to determine whether you have another mysqld + server running. If so, shut down the server before + starting mysqld again. (If another server is running, and + you really want to run multiple servers, you can find + information about how to do so in Section 5.3, "Running + Multiple MySQL Instances on One Machine.") If no other server is running, execute the command telnet - your_host_name tcp_ip_port_number. (The default MySQL port - number is 3306.) Then press Enter a couple of times. If you do - not get an error message like telnet: Unable to connect to - remote host: Connection refused, some other program is using - the TCP/IP port that mysqld is trying to use. Track down what - program this is and disable it, or tell mysqld to listen to a - different port with the --port option. In this case, specify - the same non-default port number for client programs when - connecting to the server using TCP/IP. - Another reason the port might be inaccessible is that you have - a firewall running that blocks connections to it. If so, - modify the firewall settings to permit access to the port. - If the server starts but you cannot connect to it, make sure - that you have an entry in /etc/hosts that looks like this: + your_host_name tcp_ip_port_number. (The default MySQL + port number is 3306.) Then press Enter a couple of times. + If you do not get an error message like telnet: Unable to + connect to remote host: Connection refused, some other + program is using the TCP/IP port that mysqld is trying to + use. Track down what program this is and disable it, or + tell mysqld to listen to a different port with the --port + option. In this case, specify the same non-default port + number for client programs when connecting to the server + using TCP/IP. + Another reason the port might be inaccessible is that you + have a firewall running that blocks connections to it. If + so, modify the firewall settings to permit access to the + port. + If the server starts but you cannot connect to it, make + sure that you have an entry in /etc/hosts that looks like + this: 127.0.0.1 localhost - * If you cannot get mysqld to start, try to make a trace file to - find the problem by using the --debug option. See Section - 23.4.3, "The DBUG Package." -2.10.2. Securing the Initial MySQL Accounts + * If you cannot get mysqld to start, try to make a trace + file to find the problem by using the --debug option. See + Section 24.4.3, "The DBUG Package." + +2.10.2 Securing the Initial MySQL Accounts Part of the MySQL installation process is to set up the mysql database that contains the grant tables: - * Windows distributions contain preinitialized grant tables. + * Windows distributions contain preinitialized grant + tables. * On Unix, the mysql_install_db program populates the grant - tables. Some installation methods run this program for you. - Others require that you execute it manually. For details, see - Section 2.10.1, "Postinstallation Procedures for Unix-like - Systems." + tables. Some installation methods run this program for + you. Others require that you execute it manually. For + details, see Section 2.10.1, "Postinstallation Procedures + for Unix-like Systems." - The mysql.user grant table defines the initial MySQL user accounts - and their access privileges: + The mysql.user grant table defines the initial MySQL user + accounts and their access privileges: - * Some accounts have the user name root. These are superuser - accounts that have all privileges and can do anything. The - initial root account passwords are empty, so anyone can - connect to the MySQL server as root without a password and be - granted all privileges. + * Some accounts have the user name root. These are + superuser accounts that have all privileges and can do + anything. The initial root account passwords are empty, + so anyone can connect to the MySQL server as root without + a password and be granted all privileges. + On Windows, root accounts are created that permit - connections from the local host only. Connections can be - made by specifying the host name localhost, the IP - address 127.0.0.1, or the IPv6 address ::1. If the user - selects the Enable root access from remote machines - option during installation, the Windows installer creates - another root account that permits connections from any - host. - - + On Unix, each root account permits connections from the - local host. Connections can be made by specifying the - host name localhost, the IP address 127.0.0.1, the IPv6 - address ::1, or the actual host name or IP address. - An attempt to connect to the host 127.0.0.1 normally resolves - to the localhost account. However, this fails if the server is - run with the --skip-name-resolve option, so the 127.0.0.1 - account is useful in that case. The ::1 account is used for - IPv6 connections. - - * Some accounts are for anonymous users. These have an empty - user name. The anonymous accounts have no password, so anyone - can use them to connect to the MySQL server. - - + On Windows, there is one anonymous account that permits - connections from the local host. Connections can be made - by specifying a host name of localhost. - - + On Unix, each anonymous account permits connections from - the local host. Connections can be made by specifying a - host name of localhost for one of the accounts, or the - actual host name or IP address for the other. - - To display which accounts exist in the mysql.user table and check - whether their passwords are empty, use the following statement: + connections from the local host only. Connections + can be made by specifying the host name localhost, + the IP address 127.0.0.1, or the IPv6 address ::1. + If the user selects the Enable root access from + remote machines option during installation, the + Windows installer creates another root account that + permits connections from any host. + + + On Unix, each root account permits connections from + the local host. Connections can be made by + specifying the host name localhost, the IP address + 127.0.0.1, the IPv6 address ::1, or the actual host + name or IP address. + An attempt to connect to the host 127.0.0.1 normally + resolves to the localhost account. However, this fails if + the server is run with the --skip-name-resolve option, so + the 127.0.0.1 account is useful in that case. The ::1 + account is used for IPv6 connections. + + * Some accounts are for anonymous users. These have an + empty user name. The anonymous accounts have no password, + so anyone can use them to connect to the MySQL server. + + + On Windows, there is one anonymous account that + permits connections from the local host. Connections + can be made by specifying a host name of localhost. + + + On Unix, each anonymous account permits connections + from the local host. Connections can be made by + specifying a host name of localhost for one of the + accounts, or the actual host name or IP address for + the other. + + To display which accounts exist in the mysql.user table and + check whether their passwords are empty, use the following + statement: mysql> SELECT User, Host, Password FROM mysql.user; +------+--------------------+----------+ | User | Host | Password | @@ -6667,56 +7695,57 @@ mysql> SELECT User, Host, Password FROM mysql.user; +------+--------------------+----------+ This output indicates that there are several root and - anonymous-user accounts, none of which have passwords. The output - might differ on your system, but the presence of accounts with - empty passwords means that your MySQL installation is unprotected - until you do something about it: + anonymous-user accounts, none of which have passwords. The + output might differ on your system, but the presence of + accounts with empty passwords means that your MySQL + installation is unprotected until you do something about it: * You should assign a password to each MySQL root account. - * If you want to prevent clients from connecting as anonymous - users without a password, you should either assign a password - to each anonymous account or else remove the accounts. + * If you want to prevent clients from connecting as + anonymous users without a password, you should either + assign a password to each anonymous account or else + remove the accounts. In addition, the mysql.db table contains rows that permit all accounts to access the test database and other databases with - names that start with test_. This is true even for accounts that - otherwise have no special privileges such as the default anonymous - accounts. This is convenient for testing but inadvisable on - production servers. Administrators who want database access - restricted only to accounts that have permissions granted - explicitly for that purpose should remove these mysql.db table - rows. - - The following instructions describe how to set up passwords for - the initial MySQL accounts, first for the root accounts, then for - the anonymous accounts. The instructions also cover how to remove - the anonymous accounts, should you prefer not to permit anonymous - access at all, and describe how to remove permissive access to - test databases. Replace newpwd in the examples with the password - that you want to use. Replace host_name with the name of the - server host. You can determine this name from the output of the - preceding SELECT statement. For the output shown, host_name is - myhost.example.com. + names that start with test_. This is true even for accounts + that otherwise have no special privileges such as the default + anonymous accounts. This is convenient for testing but + inadvisable on production servers. Administrators who want + database access restricted only to accounts that have + permissions granted explicitly for that purpose should remove + these mysql.db table rows. + + The following instructions describe how to set up passwords + for the initial MySQL accounts, first for the root accounts, + then for the anonymous accounts. The instructions also cover + how to remove the anonymous accounts, should you prefer not + to permit anonymous access at all, and describe how to remove + permissive access to test databases. Replace newpwd in the + examples with the password that you want to use. Replace + host_name with the name of the server host. You can determine + this name from the output of the preceding SELECT statement. + For the output shown, host_name is myhost.example.com. Note - For additional information about setting passwords, see Section - 6.3.5, "Assigning Account Passwords." If you forget your root - password after setting it, see Section C.5.4.1, "How to Reset the - Root Password." + For additional information about setting passwords, see + Section 6.3.5, "Assigning Account Passwords." If you forget + your root password after setting it, see Section B.5.4.1, + "How to Reset the Root Password." You might want to defer setting the passwords until later, to - avoid the need to specify them while you perform additional setup - or testing. However, be sure to set them before using your - installation for production purposes. + avoid the need to specify them while you perform additional + setup or testing. However, be sure to set them before using + your installation for production purposes. - To set up additional accounts, see Section 6.3.2, "Adding User - Accounts." + To set up additional accounts, see Section 6.3.2, "Adding + User Accounts." Assigning root Account Passwords - The root account passwords can be set several ways. The following - discussion demonstrates three methods: + The root account passwords can be set several ways. The + following discussion demonstrates three methods: * Use the SET PASSWORD statement @@ -6724,10 +7753,10 @@ Assigning root Account Passwords * Use the mysqladmin command-line client program - To assign passwords using SET PASSWORD, connect to the server as - root and issue a SET PASSWORD statement for each root account - listed in the mysql.user table. Be sure to encrypt the password - using the PASSWORD() function. + To assign passwords using SET PASSWORD, connect to the server + as root and issue a SET PASSWORD statement for each root + account listed in the mysql.user table. Be sure to encrypt + the password using the PASSWORD() function. For Windows, do this: shell> mysql -u root @@ -6736,8 +7765,8 @@ mysql> SET PASSWORD FOR 'root'@'127.0.0.1' = PASSWORD('newpwd'); mysql> SET PASSWORD FOR 'root'@'::1' = PASSWORD('newpwd'); mysql> SET PASSWORD FOR 'root'@'%' = PASSWORD('newpwd'); - The last statement is unnecessary if the mysql.user table has no - root account with a host value of %. + The last statement is unnecessary if the mysql.user table has + no root account with a host value of %. For Unix, do this: shell> mysql -u root @@ -6746,49 +7775,50 @@ mysql> SET PASSWORD FOR 'root'@'127.0.0.1' = PASSWORD('newpwd'); mysql> SET PASSWORD FOR 'root'@'::1' = PASSWORD('newpwd'); mysql> SET PASSWORD FOR 'root'@'host_name' = PASSWORD('newpwd'); - You can also use a single statement that assigns a password to all - root accounts by using UPDATE to modify the mysql.user table - directly. This method works on any platform: + You can also use a single statement that assigns a password + to all root accounts by using UPDATE to modify the mysql.user + table directly. This method works on any platform: shell> mysql -u root mysql> UPDATE mysql.user SET Password = PASSWORD('newpwd') -> WHERE User = 'root'; mysql> FLUSH PRIVILEGES; - The FLUSH statement causes the server to reread the grant tables. - Without it, the password change remains unnoticed by the server - until you restart it. + The FLUSH statement causes the server to reread the grant + tables. Without it, the password change remains unnoticed by + the server until you restart it. - To assign passwords to the root accounts using mysqladmin, execute - the following commands: + To assign passwords to the root accounts using mysqladmin, + execute the following commands: shell> mysqladmin -u root password "newpwd" shell> mysqladmin -u root -h host_name password "newpwd" Those commands apply both to Windows and to Unix. The double - quotation marks around the password are not always necessary, but - you should use them if the password contains spaces or other - characters that are special to your command interpreter. + quotation marks around the password are not always necessary, + but you should use them if the password contains spaces or + other characters that are special to your command + interpreter. - The mysqladmin method of setting the root account passwords does - not work for the 'root'@'127.0.0.1' or 'root'@'::1' account. Use - the SET PASSWORD method shown earlier. + The mysqladmin method of setting the root account passwords + does not work for the 'root'@'127.0.0.1' or 'root'@'::1' + account. Use the SET PASSWORD method shown earlier. After the root passwords have been set, you must supply the - appropriate password whenever you connect as root to the server. - For example, to shut down the server with mysqladmin, use this - command: + appropriate password whenever you connect as root to the + server. For example, to shut down the server with mysqladmin, + use this command: shell> mysqladmin -u root -p shutdown Enter password: (enter root password here) Assigning Anonymous Account Passwords The mysql commands in the following instructions include a -p - option based on the assumption that you have set the root account - passwords using the preceding instructions and must specify that - password when connecting to the server. + option based on the assumption that you have set the root + account passwords using the preceding instructions and must + specify that password when connecting to the server. To assign passwords to the anonymous accounts, connect to the - server as root, then use either SET PASSWORD or UPDATE. Be sure to - encrypt the password using the PASSWORD() function. + server as root, then use either SET PASSWORD or UPDATE. Be + sure to encrypt the password using the PASSWORD() function. To use SET PASSWORD on Windows, do this: shell> mysql -u root -p @@ -6801,17 +7831,17 @@ Enter password: (enter root password here) mysql> SET PASSWORD FOR ''@'localhost' = PASSWORD('newpwd'); mysql> SET PASSWORD FOR ''@'host_name' = PASSWORD('newpwd'); - To set the anonymous-user account passwords with a single UPDATE - statement, do this (on any platform): + To set the anonymous-user account passwords with a single + UPDATE statement, do this (on any platform): shell> mysql -u root -p Enter password: (enter root password here) mysql> UPDATE mysql.user SET Password = PASSWORD('newpwd') -> WHERE User = ''; mysql> FLUSH PRIVILEGES; - The FLUSH statement causes the server to reread the grant tables. - Without it, the password change remains unnoticed by the server - until you restart it. + The FLUSH statement causes the server to reread the grant + tables. Without it, the password change remains unnoticed by + the server until you restart it. Removing Anonymous Accounts @@ -6829,378 +7859,407 @@ mysql> DROP USER ''@'host_name'; Securing Test Databases - By default, the mysql.db table contains rows that permit access by - any user to the test database and other databases with names that - start with test_. (These rows have an empty User column value, - which for access-checking purposes matches any user name.) This - means that such databases can be used even by accounts that - otherwise possess no privileges. If you want to remove any-user - access to test databases, do so as follows: + By default, the mysql.db table contains rows that permit + access by any user to the test database and other databases + with names that start with test_. (These rows have an empty + User column value, which for access-checking purposes matches + any user name.) This means that such databases can be used + even by accounts that otherwise possess no privileges. If you + want to remove any-user access to test databases, do so as + follows: shell> mysql -u root -p Enter password: (enter root password here) mysql> DELETE FROM mysql.db WHERE Db LIKE 'test%'; mysql> FLUSH PRIVILEGES; - The FLUSH statement causes the server to reread the grant tables. - Without it, the privilege change remains unnoticed by the server - until you restart it. + The FLUSH statement causes the server to reread the grant + tables. Without it, the privilege change remains unnoticed by + the server until you restart it. - With the preceding change, only users who have global database - privileges or privileges granted explicitly for the test database - can use it. However, if you do not want the database to exist at - all, drop it: + With the preceding change, only users who have global + database privileges or privileges granted explicitly for the + test database can use it. However, if you do not want the + database to exist at all, drop it: mysql> DROP DATABASE test; Note - On Windows, you can also perform the process described in this - section during installation with MySQL Installer (see Section - 2.3.3, "Installing MySQL on Microsoft Windows Using MySQL - Installer"). On all platforms, the MySQL distribution includes - mysql_secure_installation, a command-line utility that automates - much of the process of securing a MySQL installation. And MySQL - Workbench is available on all platforms, and also offers the - ability to manage user accounts (see Chapter 25, "MySQL Workbench" - ). - -2.11. Upgrading or Downgrading MySQL - - This section describes the steps to upgrade or downgrade a MySQL - installation. - - Upgrading is a common procedure, as you pick up bug fixes within - the same MySQL release series or significant features between - major MySQL releases. You perform this procedure first on some - test systems to make sure everything works smoothly, and then on - the production systems. - - Downgrading is less common. Typically, you undo an upgrade because - of some compatibility or performance issue that occurs on a - production system, and was not uncovered during initial upgrade - verification on the test systems. As with the upgrade procedure, - perform and verify the downgrade procedure on some test systems - first, before using it on a production system. - -2.11.1. Upgrading MySQL - - As a general rule, to upgrade from one release series to another, - go to the next series rather than skipping a series. To upgrade - from a release series previous to MySQL 5.5, upgrade to each - successive release series in turn until you have reached MySQL - 5.5, and then proceed with the upgrade to MySQL 5.6. For example, - if you currently are running MySQL 5.1 and wish to upgrade to a - newer series, upgrade to MySQL 5.5 first before upgrading to 5.6, - and so forth. For information on upgrading to MySQL 5.5, see the - MySQL 5.5 Reference Manual. - - To upgrade to MySQL 5.6, use the items in the following checklist - as a guide: + On Windows, you can also perform the process described in + this section during installation with MySQL Installer (see + Section 2.3.3, "Installing MySQL on Microsoft Windows Using + MySQL Installer"). On all platforms, the MySQL distribution + includes mysql_secure_installation, a command-line utility + that automates much of the process of securing a MySQL + installation. And MySQL Workbench is available on all + platforms, and also offers the ability to manage user + accounts (see Chapter 26, "MySQL Workbench" ). + +2.11 Upgrading or Downgrading MySQL + + This section describes the steps to upgrade or downgrade a + MySQL installation. + + Upgrading is a common procedure, as you pick up bug fixes + within the same MySQL release series or significant features + between major MySQL releases. You perform this procedure + first on some test systems to make sure everything works + smoothly, and then on the production systems. + + Downgrading is less common. Typically, you undo an upgrade + because of some compatibility or performance issue that + occurs on a production system, and was not uncovered during + initial upgrade verification on the test systems. As with the + upgrade procedure, perform and verify the downgrade procedure + on some test systems first, before using it on a production + system. + +2.11.1 Upgrading MySQL + + As a general rule, to upgrade from one release series to + another, go to the next series rather than skipping a series. + To upgrade from a release series previous to MySQL 5.5, + upgrade to each successive release series in turn until you + have reached MySQL 5.5, and then proceed with the upgrade to + MySQL 5.6. For example, if you currently are running MySQL + 5.1 and wish to upgrade to a newer series, upgrade to MySQL + 5.5 first before upgrading to 5.6, and so forth. For + information on upgrading to MySQL 5.5, see the MySQL 5.5 + Reference Manual. + + To upgrade to MySQL 5.6, use the items in the following + checklist as a guide: * Before any upgrade, back up your databases, including the - mysql database that contains the grant tables. See Section - 7.2, "Database Backup Methods." + mysql database that contains the grant tables. See + Section 7.2, "Database Backup Methods." - * Read all the notes in Section 2.11.1.2, "Upgrading from MySQL - 5.5 to 5.6." These notes enable you to identify upgrade issues - that apply to your current MySQL installation. Some - incompatibilities discussed in that section require your - attention before upgrading. Others require some action after - upgrading. + * Read all the notes in Section 2.11.1.3, "Upgrading from + MySQL 5.5 to 5.6." These notes enable you to identify + upgrade issues that apply to your current MySQL + installation. Some incompatibilities discussed in that + section require your attention before upgrading. Others + require some action after upgrading. * Read the Release Notes - (http://dev.mysql.com/doc/relnotes/mysql/5.6/en/) as well, - which provide information about features that are new in MySQL - 5.6 or differ from those found in earlier MySQL releases. - - * After upgrading to a new version of MySQL, run mysql_upgrade - (see Section 4.4.7, "mysql_upgrade --- Check and Upgrade MySQL - Tables"). This program checks your tables, and attempts to - repair them if necessary. It also updates your grant tables to - make sure that they have the current structure so that you can - take advantage of any new capabilities. (Some releases of - MySQL introduce changes to the structure of the grant tables - to add new privileges or features.) + (http://dev.mysql.com/doc/relnotes/mysql/5.6/en/) as + well, which provide information about features that are + new in MySQL 5.6 or differ from those found in earlier + MySQL releases. + + * After upgrading to a new version of MySQL, run + mysql_upgrade (see Section 4.4.7, "mysql_upgrade --- + Check and Upgrade MySQL Tables"). This program checks + your tables, and attempts to repair them if necessary. It + also updates your grant tables to make sure that they + have the current structure so that you can take advantage + of any new capabilities. (Some releases of MySQL + introduce changes to the structure of the grant tables to + add new privileges or features.) mysql_upgrade does not upgrade the contents of the help tables. For upgrade instructions, see Section 5.1.10, "Server-Side Help." - mysql_upgrade should not be used when the server is running - with --gtid-mode=ON, since it may make changes in - nontransactional system tables in the mysql database, many of - which are MyISAM and cannot be changed to use a different - storage engine. See Section 16.1.3.4, "GTID mode and - mysql_upgrade." + mysql_upgrade should not be used when the server is + running with --gtid-mode=ON, since it may make changes in + nontransactional system tables in the mysql database, + many of which are MyISAM and cannot be changed to use a + different storage engine. See Section 17.1.3.4, "GTID + mode and mysql_upgrade." * If you run MySQL Server on Windows, see Section 2.3.7, "Upgrading MySQL on Windows." - * If you use replication, see Section 16.4.3, "Upgrading a + * If you use replication, see Section 17.4.3, "Upgrading a Replication Setup," for information on upgrading your replication setup. - * If you use InnoDB, consider setting innodb_fast_shutdown to 0 - before shutting down and upgrading your server. When you set - innodb_fast_shutdown to 0, InnoDB does a slow shutdown, a full - purge and an insert buffer merge before shutting down, which - ensures that all data files are fully prepared in case the - upgrade process modifies the file format. + * If you use InnoDB, consider setting innodb_fast_shutdown + to 0 before shutting down and upgrading your server. When + you set innodb_fast_shutdown to 0, InnoDB does a slow + shutdown, a full purge and an insert buffer merge before + shutting down, which ensures that all data files are + fully prepared in case the upgrade process modifies the + file format. * If you upgrade an installation originally produced by - installing multiple RPM packages, it is best to upgrade all - the packages, not just some. For example, if you previously - installed the server and client RPMs, do not upgrade just the - server RPM. - - * If you have created a user-defined function (UDF) with a given - name and upgrade MySQL to a version that implements a new - built-in function with the same name, the UDF becomes - inaccessible. To correct this, use DROP FUNCTION to drop the - UDF, and then use CREATE FUNCTION to re-create the UDF with a - different nonconflicting name. The same is true if the new - version of MySQL implements a built-in function with the same - name as an existing stored function. See Section 9.2.4, - "Function Name Parsing and Resolution," for the rules - describing how the server interprets references to different - kinds of functions. - - For EL5 and EL6-based Linux platforms (for example, Red Hat - Enterprise Linux, Oracle Linux, and CentOS), you can perform an - in-place upgrade of MySQL and its components to the latest GA - releases with the MySQL Yum repository. See Section 2.11.1.1, - "Upgrading MySQL with the MySQL Yum Repository." - - For upgrades between versions of a MySQL release series that has - reached General Availability status, you can move the MySQL format - files and data files between different versions on systems with - the same architecture. For upgrades to a version of a MySQL - release series that is in development status, that is not - necessarily true. Use of development releases is at your own risk. + installing multiple RPM packages, it is best to upgrade + all the packages, not just some. For example, if you + previously installed the server and client RPMs, do not + upgrade just the server RPM. + + * If you have created a user-defined function (UDF) with a + given name and upgrade MySQL to a version that implements + a new built-in function with the same name, the UDF + becomes inaccessible. To correct this, use DROP FUNCTION + to drop the UDF, and then use CREATE FUNCTION to + re-create the UDF with a different nonconflicting name. + The same is true if the new version of MySQL implements a + built-in function with the same name as an existing + stored function. See Section 9.2.4, "Function Name + Parsing and Resolution," for the rules describing how the + server interprets references to different kinds of + functions. + + For EL5, EL6, or EL7-based Linux platforms and Fedora 20 or + 21, you can perform an in-place upgrade of MySQL and its + components with the MySQL Yum repository. See Section + 2.11.1.1, "Upgrading MySQL with the MySQL Yum Repository." + + On Debian 7, Ubuntu 12, and Ubuntu 14, you can perform an + in-place upgrade of MySQL and its components with the MySQL + APT repository. See Section 2.11.1.2, "Upgrading MySQL with + the MySQL APT Repository." + + For upgrades between versions of a MySQL release series that + has reached General Availability status, you can move the + MySQL format files and data files between different versions + on systems with the same architecture. For upgrades to a + version of a MySQL release series that is in development + status, that is not necessarily true. Use of development + releases is at your own risk. If you are cautious about using new versions, you can always - rename your old mysqld before installing a newer one. For example, - if you are using a version of MySQL 5.5 and want to upgrade to - 5.6, rename your current server from mysqld to mysqld-5.5. If your - new mysqld then does something unexpected, you can simply shut it - down and restart with your old mysqld. - - If problems occur, such as that the new mysqld server does not - start or that you cannot connect without a password, verify that - you do not have an old my.cnf file from your previous - installation. You can check this with the --print-defaults option - (for example, mysqld --print-defaults). If this command displays - anything other than the program name, you have an active my.cnf - file that affects server or client operation. - - If, after an upgrade, you experience problems with compiled client - programs, such as Commands out of sync or unexpected core dumps, - you probably have used old header or library files when compiling - your programs. In this case, check the date for your mysql.h file - and libmysqlclient.a library to verify that they are from the new - MySQL distribution. If not, recompile your programs with the new - headers and libraries. Recompilation might also be necessary for - programs compiled against the shared client library if the library - major version number has changed (for example from + rename your old mysqld before installing a newer one. For + example, if you are using a version of MySQL 5.5 and want to + upgrade to 5.6, rename your current server from mysqld to + mysqld-5.5. If your new mysqld then does something + unexpected, you can simply shut it down and restart with your + old mysqld. + + If problems occur, such as that the new mysqld server does + not start or that you cannot connect without a password, + verify that you do not have an old my.cnf file from your + previous installation. You can check this with the + --print-defaults option (for example, mysqld + --print-defaults). If this command displays anything other + than the program name, you have an active my.cnf file that + affects server or client operation. + + If, after an upgrade, you experience problems with compiled + client programs, such as Commands out of sync or unexpected + core dumps, you probably have used old header or library + files when compiling your programs. In this case, check the + date for your mysql.h file and libmysqlclient.a library to + verify that they are from the new MySQL distribution. If not, + recompile your programs with the new headers and libraries. + Recompilation might also be necessary for programs compiled + against the shared client library if the library major + version number has changed (for example from libmysqlclient.so.15 to libmysqlclient.so.16. - If your MySQL installation contains a large amount of data that - might take a long time to convert after an in-place upgrade, you - might find it useful to create a "dummy" database instance for - assessing what conversions might be needed and the work involved - to perform them. Make a copy of your MySQL instance that contains - a full copy of the mysql database, plus all other databases - without data. Run your upgrade procedure on this dummy instance to - see what actions might be needed so that you can better evaluate - the work involved when performing actual data conversion on your + If your MySQL installation contains a large amount of data + that might take a long time to convert after an in-place + upgrade, you might find it useful to create a "dummy" + database instance for assessing what conversions might be + needed and the work involved to perform them. Make a copy of + your MySQL instance that contains a full copy of the mysql + database, plus all other databases without data. Run your + upgrade procedure on this dummy instance to see what actions + might be needed so that you can better evaluate the work + involved when performing actual data conversion on your original database instance. - It is a good idea to rebuild and reinstall the Perl DBD::mysql - module whenever you install a new release of MySQL. The same - applies to other MySQL interfaces as well, such as PHP mysql - extensions and the Python MySQLdb module. - -2.11.1.1. Upgrading MySQL with the MySQL Yum Repository - - For EL5 or EL6-based Linux platforms and Fedora 18, 19, or 20 you - can upgrade MySQL and its components to the latest GA releases - with the MySQL Yum repository. - Note - - Before you perform any upgrade actions, please pay attention to - the following: - - * If your version of MySQL is more than one series older than - the latest GA series (for example, assuming the current GA - release series is 5.6 and you have 5.1.x installed right now), - do NOT use the following instructions to update MySQL, and do - NOT enable the MySQL Yum repository on your system until you - have upgraded MySQL by other means (see Section 2.11.1, - "Upgrading MySQL") to at least the last GA series before the - latest one. - - * Before performing any update to MySQL, follow carefully the - instructions in Section 2.11.1, "Upgrading MySQL." Among other - instructions discussed there, it is especially important to - back up your database before the update. - - * If your MySQL installation is a third-party distribution, - follow the instructions in Section 2.5.2, "Replacing a - Third-Party Distribution of MySQL Using the MySQL Yum - Repository" for upgrading the installation. - - The Yum update performs an in-place update for MySQL (that is, - replaces the old version of the software and then runs the new - version off the old version's data files). It updates MySQL to the - latest release in the same release series. Assuming that you - already have the MySQL Yum repository on your system's repository - list (see Section 2.5.1, "" for details), make sure your Yum - repository setup is up-to-date by running: -shell> sudo yum update mysql-community-release - - You can then update MySQL and its components by the following - command: + It is a good idea to rebuild and reinstall the Perl + DBD::mysql module whenever you install a new release of + MySQL. The same applies to other MySQL interfaces as well, + such as PHP mysql extensions and the Python MySQLdb module. + +2.11.1.1 Upgrading MySQL with the MySQL Yum Repository + + For supported Yum-based platforms (see Section 2.5.1, + "Installing MySQL on Linux Using the MySQL Yum Repository," + for a list), you can perform an in-place upgrade for MySQL + (that is, replacing the old version and then running the new + version off the old data files) with the MySQL Yum + repository. + Notes + + * Before performing any update to MySQL, follow carefully + the instructions in Section 2.11.1, "Upgrading MySQL." + Among other instructions discussed there, it is + especially important to back up your database before the + update. + + * The following instructions assume you have installed + MySQL with the MySQL Yum repository; if that is not the + case, follow the instructions in Section 2.5.2, + "Replacing a Third-Party Distribution of MySQL Using the + MySQL Yum Repository." + + + 1. Selecting a Target Series + By default, the MySQL Yum repository updates MySQL to the + latest version in the release series you have chosen + during installation (see Section 2.5.1, "" for details), + which means, for example, a 5.6.x installation will NOT + be updated to a 5.7.x release automatically. To update to + another release series, you need to first disable the + subrepository for the series that has been selected (by + default, or by yourself) and enable the subrepository for + your target series. To do that, follow the steps + explained in Section 2.5.1, "" for editing the + subrepository entries in + the/etc/yum.repos.d/mysql-community.repo file. + As a general rule, to upgrade from one release series to + another, go to the next series rather than skipping a + series. For example, if you are currently running MySQL + 5.5 and wish to upgrade to 5.7, upgrade to MySQL 5.6 + first before upgrading to 5.7. + Important + For important information about upgrading from MySQL 5.6 + to 5.7, see Upgrading from MySQL 5.6 to 5.7 + (http://dev.mysql.com/doc/refman/5.7/en/upgrading-from-pr + evious-series.html). + + 2. Upgrading MySQL + Upgrade MySQL and its components by the following + command: shell> sudo yum update mysql-server - - Alternatively, you can update the MySQL Yum repository setup and - MySQL at the same time by telling Yum to update everything on your - system (this might take considerably more time): + Alternatively, you can update MySQL by telling Yum to + update everything on your system (this might take + considerably more time): shell> sudo yum update - Note that by default, the yum update command will only update - MySQL to the latest version in the same release series, which - means, for example, a 5.6.x installation will NOT be updated to a - 5.7.x release automatically. To update to the next release series, - after updating the MySQL Yum repository setup as described above, - you need to first disable the sub-repository for your original - version and enable the sub-repository for your target version - before you run the yum update command for MySQL. See the - instructions for doing that in Section 2.5.1, "." - Important - - For important information about upgrading from MySQL 5.6 to 5.7, - see Upgrading from MySQL 5.6 to 5.7 - (http://dev.mysql.com/doc/refman/5.7/en/upgrading-from-previous-se - ries.html). - - The MySQL server always restarts after an update by Yum. Once the - server restarts, you should run mysql_upgrade to check and - possibly resolve any incompatibilities between the old data and - the upgraded software. mysql_upgrade also performs other - functions; see Section 4.4.7, "mysql_upgrade --- Check and Upgrade - MySQL Tables" for details. - - Although we recommend that you update all the MySQL components at - the same time, you can also update only a specific component. You - can use the following command to list all the installed packages - for the MySQL components, which can all be updated with the MySQL - Yum repository: + 3. Restarting MySQL + The MySQL server always restarts after an update by Yum. + Once the server restarts, run mysql_upgrade to check and + possibly resolve any incompatibilities between the old + data and the upgraded software. mysql_upgrade also + performs other functions; see Section 4.4.7, + "mysql_upgrade --- Check and Upgrade MySQL Tables" for + details. + + You can also update only a specific component. Use the + following command to list all the installed packages for the + MySQL components: shell> sudo yum list installed | grep "^mysql" After identifying the package name of the component of your - choice, update the package with the following command, replacing - package-name with the name of the package: + choice, update the package with the following command, + replacing package-name with the name of the package: shell> sudo yum update package-name -Upgrading to the Shared Client Libraries +Upgrading the Shared Client Libraries After updating MySQL using the Yum repository, applications - compiled with older versions of the shared client libraries should - continue to work. + compiled with older versions of the shared client libraries + should continue to work. - If you recompile applications and dynamically link them with the - updated libraries: As typical with new versions of shared + If you recompile applications and dynamically link them with + the updated libraries: As typical with new versions of shared libraries where there are differences or additions in symbol - versioning between the newer and older libraries (for example, - between the newer, standard 5.6 shared client libraries and some - older---prior or variant---versions of the shared libraries - shipped natively by the Linux distributions' software - repositories, or from some other sources), any applications - compiled using the updated, newer shared libraries will require - those updated libraries on systems where the applications are - deployed. And, as expected, if those libraries are not in place, - the applications requiring the shared libraries will fail. So, be - sure to deploy the packages for the shared libraries from MySQL on - those systems. You can do this by adding the MySQL Yum repository + versioning between the newer and older libraries (for + example, between the newer, standard 5.6 shared client + libraries and some older---prior or variant---versions of the + shared libraries shipped natively by the Linux distributions' + software repositories, or from some other sources), any + applications compiled using the updated, newer shared + libraries will require those updated libraries on systems + where the applications are deployed. And, as expected, if + those libraries are not in place, the applications requiring + the shared libraries will fail. So, be sure to deploy the + packages for the shared libraries from MySQL on those + systems. You can do this by adding the MySQL Yum repository to the systems (see Section 2.5.1, "") and install the latest - shared libraries using the instructions given in Section 2.5.1, - "." + shared libraries using the instructions given in Section + 2.5.1, "." + +2.11.1.2 Upgrading MySQL with the MySQL APT Repository -2.11.1.2. Upgrading from MySQL 5.5 to 5.6 + On Debian 7, Ubuntu 12, and Ubuntu 14, you can perform an + in-place upgrade of MySQL and its components with the MySQL + APT repository. See Upgrading MySQL with the MySQL APT + Repository + (http://dev.mysql.com/doc/mysql-apt-repo-quick-guide/en/index + .html#repo-qg-apt-upgrading) in A Quick Guide to Using the + MySQL APT Repository + (http://dev.mysql.com/doc/mysql-apt-repo-quick-guide/en/). + +2.11.1.3 Upgrading from MySQL 5.5 to 5.6 Note - Beginning with MySQL 5.6.6, several MySQL Server parameters have - defaults that differ from previous releases. See the notes - regarding these changes later in this section, particularly - regarding overriding them to preserve backward compatibility if - that is a concern. + Beginning with MySQL 5.6.6, several MySQL Server parameters + have defaults that differ from previous releases. See the + notes regarding these changes later in this section, + particularly regarding overriding them to preserve backward + compatibility if that is a concern. Note - It is good practice to back up your data before installing any new - version of software. Although MySQL works very hard to ensure a - high level of quality, protect your data by making a backup. + It is good practice to back up your data before installing + any new version of software. Although MySQL works very hard + to ensure a high level of quality, protect your data by + making a backup. - To upgrade to 5.6 from any previous version, MySQL recommends that - you dump your tables with mysqldump before upgrading and reload - the dump file after upgrading. Use the --all-databases option to - include all databases in the dump. If your databases include - stored programs, use the --routines and --events options as well. + To upgrade to 5.6 from any previous version, MySQL recommends + that you dump your tables with mysqldump before upgrading and + reload the dump file after upgrading. Use the --all-databases + option to include all databases in the dump. If your + databases include stored programs, use the --routines and + --events options as well. - In general, do the following when upgrading from MySQL 5.5 to 5.6: + In general, do the following when upgrading from MySQL 5.5 to + 5.6: - * Read all the items in these sections to see whether any of - them might affect your applications: + * Read all the items in these sections to see whether any + of them might affect your applications: - + Section 2.11.1, "Upgrading MySQL," has general update - information. + + Section 2.11.1, "Upgrading MySQL," has general + update information. + The items in the change lists provided later in this - section enable you to identify upgrade issues that apply - to your current MySQL installation. Some - incompatibilities discussed there require your attention - before upgrading. Others should be dealt with after - upgrading. + section enable you to identify upgrade issues that + apply to your current MySQL installation. Some + incompatibilities discussed there require your + attention before upgrading. Others should be dealt + with after upgrading. + The MySQL 5.6 Release Notes (http://dev.mysql.com/doc/relnotes/mysql/5.6/en/) - describe significant new features you can use in 5.6 or - that differ from those found in earlier MySQL releases. - Some of these changes may result in incompatibilities. - Note particularly any changes that are marked Known issue or - Incompatible change. These incompatibilities with earlier - versions of MySQL may require your attention before you - upgrade. Our aim is to avoid these changes, but occasionally - they are necessary to correct problems that would be worse - than an incompatibility between releases. If any upgrade issue - applicable to your installation involves an incompatibility - that requires special handling, follow the instructions given - in the incompatibility description. Sometimes this involves - dumping and reloading tables, or use of a statement such as - CHECK TABLE or REPAIR TABLE. + describe significant new features you can use in 5.6 + or that differ from those found in earlier MySQL + releases. Some of these changes may result in + incompatibilities. + Note particularly any changes that are marked Known issue + or Incompatible change. These incompatibilities with + earlier versions of MySQL may require your attention + before you upgrade. Our aim is to avoid these changes, + but occasionally they are necessary to correct problems + that would be worse than an incompatibility between + releases. If any upgrade issue applicable to your + installation involves an incompatibility that requires + special handling, follow the instructions given in the + incompatibility description. Sometimes this involves + dumping and reloading tables, or use of a statement such + as CHECK TABLE or REPAIR TABLE. For dump and reload instructions, see Section 2.11.4, - "Rebuilding or Repairing Tables or Indexes." Any procedure - that involves REPAIR TABLE with the USE_FRM option must be - done before upgrading. Use of this statement with a version of - MySQL different from the one used to create the table (that - is, using it after upgrading) may damage the table. See - Section 13.7.2.5, "REPAIR TABLE Syntax." - - * Before upgrading to a new version of MySQL, Section 2.11.3, - "Checking Whether Tables or Indexes Must Be Rebuilt," to see - whether changes to table formats or to character sets or - collations were made between your current version of MySQL and - the version to which you are upgrading. If so and these - changes result in an incompatibility between MySQL versions, - you will need to upgrade the affected tables using the - instructions in Section 2.11.4, "Rebuilding or Repairing - Tables or Indexes." - - * After upgrading to a new version of MySQL, run mysql_upgrade - (see Section 4.4.7, "mysql_upgrade --- Check and Upgrade MySQL - Tables"). This program checks your tables, and attempts to - repair them if necessary. It also updates your grant tables to - make sure that they have the current structure so that you can - take advantage of any new capabilities. (Some releases of - MySQL introduce changes to the structure of the grant tables - to add new privileges or features.) + "Rebuilding or Repairing Tables or Indexes." Any + procedure that involves REPAIR TABLE with the USE_FRM + option must be done before upgrading. Use of this + statement with a version of MySQL different from the one + used to create the table (that is, using it after + upgrading) may damage the table. See Section 13.7.2.5, + "REPAIR TABLE Syntax." + + * Before upgrading to a new version of MySQL, Section + 2.11.3, "Checking Whether Tables or Indexes Must Be + Rebuilt," to see whether changes to table formats or to + character sets or collations were made between your + current version of MySQL and the version to which you are + upgrading. If so and these changes result in an + incompatibility between MySQL versions, you will need to + upgrade the affected tables using the instructions in + Section 2.11.4, "Rebuilding or Repairing Tables or + Indexes." + + * After upgrading to a new version of MySQL, run + mysql_upgrade (see Section 4.4.7, "mysql_upgrade --- + Check and Upgrade MySQL Tables"). This program checks + your tables, and attempts to repair them if necessary. It + also updates your grant tables to make sure that they + have the current structure so that you can take advantage + of any new capabilities. (Some releases of MySQL + introduce changes to the structure of the grant tables to + add new privileges or features.) mysql_upgrade does not upgrade the contents of the help tables. For upgrade instructions, see Section 5.1.10, "Server-Side Help." @@ -7208,47 +8267,49 @@ Upgrading to the Shared Client Libraries * If you run MySQL Server on Windows, see Section 2.3.7, "Upgrading MySQL on Windows." - * If you use replication, see Section 16.4.3, "Upgrading a + * If you use replication, see Section 17.4.3, "Upgrading a Replication Setup," for information on upgrading your replication setup. - If your MySQL installation contains a large amount of data that - might take a long time to convert after an in-place upgrade, you - might find it useful to create a "dummy" database instance for - assessing what conversions might be needed and the work involved - to perform them. Make a copy of your MySQL instance that contains - a full copy of the mysql database, plus all other databases - without data. Run your upgrade procedure on this dummy instance to - see what actions might be needed so that you can better evaluate - the work involved when performing actual data conversion on your + If your MySQL installation contains a large amount of data + that might take a long time to convert after an in-place + upgrade, you might find it useful to create a "dummy" + database instance for assessing what conversions might be + needed and the work involved to perform them. Make a copy of + your MySQL instance that contains a full copy of the mysql + database, plus all other databases without data. Run your + upgrade procedure on this dummy instance to see what actions + might be needed so that you can better evaluate the work + involved when performing actual data conversion on your original database instance. - Read all the items in the following sections to see whether any of - them might affect your applications: + Read all the items in the following sections to see whether + any of them might affect your applications: Configuration Changes - * Beginning with MySQL 5.6.6, several MySQL Server parameters - have defaults that differ from previous releases. The - motivation for these changes is to provide better out-of-box - performance and to reduce the need for the database - administrator to change settings manually. These changes are - subject to possible revision in future releases as we gain - feedback. + * Beginning with MySQL 5.6.6, several MySQL Server + parameters have defaults that differ from previous + releases. The motivation for these changes is to provide + better out-of-box performance and to reduce the need for + the database administrator to change settings manually. + These changes are subject to possible revision in future + releases as we gain feedback. In some cases, a parameter has a different static default - value. In other cases, the server autosizes a parameter at - startup using a formula based on other related parameters or - server host configuration, rather than using a static value. - For example, the setting for back_log now is its previous - default of 50, adjusted up by an amount proportional to the - value of max_connections. The idea behind autosizing is that - when the server has information available to make a decision - about a parameter setting likely to be better than a fixed - default, it will. - The following table summarizes changes to defaults. Any of - these can be overridden by specifying an explicit value at - server startup. + value. In other cases, the server autosizes a parameter + at startup using a formula based on other related + parameters or server host configuration, rather than + using a static value. For example, the setting for + back_log now is its previous default of 50, adjusted up + by an amount proportional to the value of + max_connections. The idea behind autosizing is that when + the server has information available to make a decision + about a parameter setting likely to be better than a + fixed default, it will. + The following table summarizes changes to defaults. Any + of these can be overridden by specifying an explicit + value at server startup. Parameter Old Default New Default back_log 50 Autosized using max_connections @@ -7270,190 +8331,296 @@ Configuration Changes sync_master_info 0 10000 sync_relay_log 0 10000 sync_relay_log_info 0 10000 - With regard to compatibility with previous releases, the most - important changes are: + With regard to compatibility with previous releases, the + most important changes are: - + innodb_file_per_table is enabled (previously disabled). + + innodb_file_per_table is enabled (previously + disabled). - + innodb_checksum_algorithm is CRC32 (previously INNODB). + + innodb_checksum_algorithm is CRC32 (previously + INNODB). + binlog_checksum is CRC32 (previously NONE). Therefore, if you are upgrading an existing MySQL - installation, have not already changed the values of these - parameters from their previous defaults, and backward - compatibility is a concern, you may want to explicitly set - these parameters to their previous defaults. For example, put - these lines in the server option file: + installation, have not already changed the values of + these parameters from their previous defaults, and + backward compatibility is a concern, you may want to + explicitly set these parameters to their previous + defaults. For example, put these lines in the server + option file: [mysqld] innodb_file_per_table=0 innodb_checksum_algorithm=INNODB binlog_checksum=NONE - Those settings preserve compatibility as follows: - + With the new default of innodb_file_per_table enabled, - ALTER TABLE operations following an upgrade will move - InnoDB tables that are in the system tablespace to - individual .ibd files. Using innodb_file_per_table=0 will - prevent this from happening. - - + Setting innodb_checksum_algorithm=INNODB permits binary - downgrades after upgrading to this release. With a - setting of CRC32, InnoDB would use checksumming that - older MySQL versions cannot use. + Those settings preserve compatibility as follows: - + With binlog_checksum=NONE, the server can be used as a - replication master without causing failure of older - slaves that do not understand binary log checksums. + + With the new default of innodb_file_per_table + enabled, ALTER TABLE operations following an upgrade + will move InnoDB tables that are in the system + tablespace to individual .ibd files. Using + innodb_file_per_table=0 will prevent this from + happening. + + + Setting innodb_checksum_algorithm=INNODB permits + binary downgrades after upgrading to this release. + With a setting of CRC32, InnoDB would use + checksumming that older MySQL versions cannot use. + + + With binlog_checksum=NONE, the server can be used as + a replication master without causing failure of + older slaves that do not understand binary log + checksums. + + * As of MySQL 5.6.5, pre-4.1 passwords and the + mysql_old_password authentication plugin are deprecated. + Passwords stored in the older hash format used before + MySQL 4.1 are less secure than passwords that use the + native password hashing method and should be avoided. To + prevent connections using accounts that have pre-4.1 + password hashes, the secure_auth system variable is now + enabled by default. (To permit connections for accounts + that have such password hashes, start the server with + --secure_auth=0.) + DBAs are advised to convert accounts that use the + mysql_old_password authentication plugin to use + mysql_native_password instead. For account upgrade + instructions, see Section 6.3.8.3, "Migrating Away from + Pre-4.1 Password Hashing and the mysql_old_password + Plugin." + Known issue: In some early development versions of MySQL + 5.6 (5.6.6 to 5.6.10), the server could create accounts + with a mismatched password hash and authentication + plugin. For example, if the default authentication plugin + is mysql_native_password, this sequence of statements + results in an account with a plugin of + mysql_native_password but a pre-4.1 password hash (the + format used by mysql_old_password): +SET old_passwords = 1; +CREATE USER 'jeffrey'@'localhost' IDENTIFIED BY 'mypass'; + + The mismatch produces symptoms such as being unable to + connect to the MySQL server and being unable to use SET + PASSWORD with OLD_PASSWORD() or with old_passwords=1. + As of MySQL 5.6.11, this mismatch no longer occurs. + Instead, the server produces an error: +mysql> SET old_passwords = 1; +mysql> CREATE USER 'jeffrey'@'localhost' IDENTIFIED BY 'mypass'; +ERROR 1827 (HY000): The password hash doesn't have the expected +format. Check if the correct password algorithm is being used with +the PASSWORD() function. + + To deal with an account affected by a mismatch, the DBA + can modify either the plugin or Password column in the + account's mysql.user table row to be consistent with the + other column: + + + Set old_passwords to 0, then assign a new password + to the account using SET PASSWORD and PASSWORD(). + This sets the Password column to have a 4.1 password + hash, consistent with the mysql_native_password + plugin. This is the preferred method of fixing the + account. + + + Alternatively, the DBA can change the plugin to + mysql_old_password to make the plugin match the + password hash format, then flush the privileges. + This is not recommended because the + mysql_old_password plugin and pre-4.1 password + hashing are deprecated and support for them will be + removed in a future version of MySQL. Server Changes - * Incompatible change: It is possible for a column DEFAULT value - to be valid for the sql_mode value at table-creation time but - invalid for the sql_mode value when rows are inserted or - updated. Example: + * Incompatible change: It is possible for a column DEFAULT + value to be valid for the sql_mode value at + table-creation time but invalid for the sql_mode value + when rows are inserted or updated. Example: SET sql_mode = ''; CREATE TABLE t (d DATE DEFAULT 0); SET sql_mode = 'NO_ZERO_DATE,STRICT_ALL_TABLES'; INSERT INTO t (d) VALUES(DEFAULT); - In this case, 0 should be accepted for the CREATE TABLE but - rejected for the INSERT. However, the server did not evaluate - DEFAULT values used for inserts or updates against the current - sql_mode. In the example, the INSERT succeeds and inserts - '0000-00-00' into the DATE column. - As of MySQL 5.6.13, the server applies the proper sql_mode - checks to generate a warning or error at insert or update - time. + + In this case, 0 should be accepted for the CREATE TABLE + but rejected for the INSERT. However, the server did not + evaluate DEFAULT values used for inserts or updates + against the current sql_mode. In the example, the INSERT + succeeds and inserts '0000-00-00' into the DATE column. + As of MySQL 5.6.13, the server applies the proper + sql_mode checks to generate a warning or error at insert + or update time. A resulting incompatibility for replication if you use - statement-based logging (binlog_format=STATEMENT) is that if a - slave is upgraded, a nonupgraded master will execute the - preceding example without error, whereas the INSERT will fail - on the slave and replication will stop. - To deal with this, stop all new statements on the master and - wait until the slaves catch up. Then upgrade the slaves - followed by the master. Alternatively, if you cannot stop new - statements, temporarily change to row-based logging on the - master (binlog_format=ROW) and wait until all slaves have - processed all binary logs produced up to the point of this - change. Then upgrade the slaves followed by the master and - change the master back to statement-based logging. - - * Incompatible change: MySQL 5.6.11 and later supports CREATE - TABLE ... [SUB]PARTITION BY ALGORITHM=n [LINEAR] KEY (...), - which can be used to create a table whose KEY partitioning is - compatible with a MySQL 5.1 server (n=1). (Bug #14521864, Bug - #66462) This syntax is not accepted by MySQL 5.6.10 and - earlier, although it is supported in MySQL 5.5 beginning with - MySQL 5.5.31. mysqldump in MySQL 5.5.31 and later MySQL 5.5 - releases includes the ALGORITHM option when dumping tables - using this option, but surrounds it with conditional comments, - like this: + statement-based logging (binlog_format=STATEMENT) is that + if a slave is upgraded, a nonupgraded master will execute + the preceding example without error, whereas the INSERT + will fail on the slave and replication will stop. + To deal with this, stop all new statements on the master + and wait until the slaves catch up. Then upgrade the + slaves followed by the master. Alternatively, if you + cannot stop new statements, temporarily change to + row-based logging on the master (binlog_format=ROW) and + wait until all slaves have processed all binary logs + produced up to the point of this change. Then upgrade the + slaves followed by the master and change the master back + to statement-based logging. + + * Incompatible change: MySQL 5.6.11 and later supports + CREATE TABLE ... [SUB]PARTITION BY ALGORITHM=n [LINEAR] + KEY (...), which can be used to create a table whose KEY + partitioning is compatible with a MySQL 5.1 server (n=1). + (Bug #14521864, Bug #66462) This syntax is not accepted + by MySQL 5.6.10 and earlier, although it is supported in + MySQL 5.5 beginning with MySQL 5.5.31. mysqldump in MySQL + 5.5.31 and later MySQL 5.5 releases includes the + ALGORITHM option when dumping tables using this option, + but surrounds it with conditional comments, like this: CREATE TABLE t1 (a INT) /*!50100 PARTITION BY KEY */ /*!50531 ALGORITHM = 1 */ /*!50100 () PARTITIONS 3 */ - When importing a dump containing such CREATE TABLE statements - into a MySQL 5.6.10 or earlier MySQL 5.6 server, the versioned - comment is not ignored, which causes a syntax error. - Therefore, prior to importing such a dump file, you must - either change the comments so that the MySQL 5.6 server - ignores them (by removing the string !50531 or replacing it - with !50611, wherever it occurs), or remove them. - This is not an issue with dump files made using MySQL 5.6.11 - or later, where the ALGORITHM option is written using /*!50611 - ... */. + + When importing a dump containing such CREATE TABLE + statements into a MySQL 5.6.10 or earlier MySQL 5.6 + server, the versioned comment is not ignored, which + causes a syntax error. Therefore, prior to importing such + a dump file, you must either change the comments so that + the MySQL 5.6 server ignores them (by removing the string + !50531 or replacing it with !50611, wherever it occurs), + or remove them. + This is not an issue with dump files made using MySQL + 5.6.11 or later, where the ALGORITHM option is written + using /*!50611 ... */. * Incompatible change: For TIME, DATETIME, and TIMESTAMP - columns, the storage required for tables created before MySQL - 5.6.4 differs from storage required for tables created in - 5.6.4 and later. This is due to a change in 5.6.4 that permits - these temporal types to have a fractional part. After - upgrading from MySQL 5.5 to MySQL 5.6.4 or later, it is - recommended that you also upgrade from MySQL 5.5 to MySQL 5.6 - TIME, DATETIME, and TIMESTAMP types. ALTER TABLE currently - allows the creation of tables containing temporal columns in - both MySQL 5.5 and MySQL 5.6.4 (or later) binary format but - this makes it more difficult to recreate tables in cases where - .frm files are not available. Additionally, as of MySQL 5.6.4, - the aforementioned temporal types are more space efficient. - For more information about changes to temporal types in MySQL - 5.6.4, see Section 11.6, "." - - * Due to the temporal type changes described in the previous - incompatible change item above, importing pre-MySQL 5.6.4 - tables that contain DATETIME and TIMESTAMP types into MySQL - 5.6.4 (or later) fails. Importing a MySQL 5.5 table with these - temporal types into MySQL 5.6.4 (or later) is the mostly - likely scenario for this problem to occur. - The following procedures describe workarounds that use the - original pre-MySQL 5.6.4 .frm file to recreate a table with a - row structure that is compatible with 5.6.4 (or later). The - procedures involve changing the original pre-MySQL 5.6.4 .frm - file to use the Memory storage engine instead of InnoDB, - copying the .frm file to the data directory of the destination - instance, and using ALTER TABLE to change the table's storage - engine type back to InnoDB. Use the first procedure if your - tables do not have foreign keys. Use the second procedure, - which has additional steps, if your table includes foreign + columns, the storage required for tables created before + MySQL 5.6.4 differs from storage required for tables + created in 5.6.4 and later. This is due to a change in + 5.6.4 that permits these temporal types to have a + fractional part. After upgrading from MySQL 5.5 to MySQL + 5.6.4 or later, it is recommended that you also upgrade + from MySQL 5.5 to MySQL 5.6 TIME, DATETIME, and TIMESTAMP + types. ALTER TABLE currently allows the creation of + tables containing temporal columns in both MySQL 5.5 and + MySQL 5.6.4 (or later) binary format but this makes it + more difficult to recreate tables in cases where .frm + files are not available. Additionally, as of MySQL 5.6.4, + the aforementioned temporal types are more space + efficient. For more information about changes to temporal + types in MySQL 5.6.4, see Section 11.7, "." + As of MySQL 5.6.16, ALTER TABLE upgrades old temporal + columns to 5.6 format for ADD COLUMN, CHANGE COLUMN, + MODIFY COLUMN, ADD INDEX, and FORCE operations. Hence, + the following statement upgrades a table containing + columns in the old format: +ALTER TABLE tbl_name FORCE; + + This conversion cannot be done using the INPLACE + algorithm because the table must be rebuilt, so + specifying ALGORITHM=INPLACE in these cases results in an + error. Specify ALGORITHM=COPY if necessary. + When ALTER TABLE does produce a temporal-format + conversion, it generates a message that can be displayed + with SHOW WARNINGS: TIME/TIMESTAMP/DATETIME columns of + old format have been upgraded to the new format. + + * Due to the temporal type changes described in the + previous incompatible change item above, importing + pre-MySQL 5.6.4 tables that contain DATETIME and + TIMESTAMP types into MySQL 5.6.4 (or later) fails. + Importing a MySQL 5.5 table with these temporal types + into MySQL 5.6.4 (or later) is the mostly likely scenario + for this problem to occur. + The following procedures describe workarounds that use + the original pre-MySQL 5.6.4 .frm file to recreate a + table with a row structure that is compatible with 5.6.4 + (or later). The procedures involve changing the original + pre-MySQL 5.6.4 .frm file to use the Memory storage + engine instead of InnoDB, copying the .frm file to the + data directory of the destination instance, and using + ALTER TABLE to change the table's storage engine type + back to InnoDB. Use the first procedure if your tables do + not have foreign keys. Use the second procedure, which + has additional steps, if your table includes foreign keys. If the table does not have foreign keys: - 1. Copy the table's original .frm file to the data directory - on the server where you want to import the tablespace. - - 2. Modify the table's .frm file to use the Memory storage - engine instead of the InnoDB storage engine. This - modification requires changing 7 bytes in the .frm file - that define the table's storage engine type. Using a - hexidecimal editing tool: - o Change the byte at offset position 0003, which is - the legacy_db_type, from "0c" (for InnoDB) to "06" - (for Memory), as shown below: + 1. Copy the table's original .frm file to the data + directory on the server where you want to import the + tablespace. + + 2. Modify the table's .frm file to use the Memory + storage engine instead of the InnoDB storage engine. + This modification requires changing 7 bytes in the + .frm file that define the table's storage engine + type. Using a hexidecimal editing tool: + o Change the byte at offset position 0003, which + is the legacy_db_type, from "0c" (for InnoDB) + to "06" (for Memory), as shown below: 00000000 fe 01 09 06 03 00 00 10 01 00 00 30 00 00 10 00 - o The remaining 6 bytes do not have a fixed offset. - Search the .frm file for "InnoDB" to locate the line - with the other 6 bytes. The line appears as shown - below: -00001010 ff 00 00 00 00 00 00 06 00 49 6e 6e 6f 44 42 00 |........ -.InnoDB.| + + o The remaining 6 bytes do not have a fixed + offset. Search the .frm file for "InnoDB" to + locate the line with the other 6 bytes. The + line appears as shown below: +00001010 ff 00 00 00 00 00 00 06 00 49 6e 6e 6f 44 42 00 |......... +InnoDB.| + o Modify the bytes so that the line appears as follows: 00001010 ff 00 00 00 00 00 00 06 00 4d 45 4d 4f 52 59 00 - 3. Run ALTER TABLE ... ENGINE=INNODB to add the table - definition to the InnoDB data dictionary. This creates - the InnoDB table with the temporal data types in the new - format. For the ALTER TABLE operation to complete - successfully, the .frm file must correspond to the - tablespace. - 4. Import the table using ALTER TABLE ... IMPORT TABLESPACE. + 3. Run ALTER TABLE ... ENGINE=INNODB to add the table + definition to the InnoDB data dictionary. This + creates the InnoDB table with the temporal data + types in the new format. For the ALTER TABLE + operation to complete successfully, the .frm file + must correspond to the tablespace. + + 4. Import the table using ALTER TABLE ... IMPORT + TABLESPACE. If table has foreign keys: 1. Recreate the tables with foreign keys using table - definitions from SHOW CREATE TABLE output. The incorrect - temporal column formats do not matter at this point. + definitions from SHOW CREATE TABLE output. The + incorrect temporal column formats do not matter at + this point. 2. Dump all foreign key definitions to a text file by selecting the foreign key information from INFORMATION_SCHEMA.TABLE_CONSTRAINTS and INFORMATION_SCHEMA.KEY_COLUMN_USAGE. - 3. Drop all tables and complete the table import process - described in steps 1 to 4 in the procedure described - above for tables without foreign keys. + 3. Drop all tables and complete the table import + process described in steps 1 to 4 in the procedure + described above for tables without foreign keys. - 4. After the import operation is complete, add the foreign - keys from foreign key definitions that you saved to a - text file. + 4. After the import operation is complete, add the + foreign keys from foreign key definitions that you + saved to a text file. - * Incompatible change: As of MySQL 5.6, the full-text stopword - file is loaded and searched using latin1 if - character_set_server is ucs2, utf16, utf16le, or utf32. If any - table was created with FULLTEXT indexes while the server - character set was ucs2, utf16, utf16le, or utf32, repair it - using this statement: + * Incompatible change: As of MySQL 5.6, the full-text + stopword file is loaded and searched using latin1 if + character_set_server is ucs2, utf16, utf16le, or utf32. + If any table was created with FULLTEXT indexes while the + server character set was ucs2, utf16, utf16le, or utf32, + repair it using this statement: REPAIR TABLE tbl_name QUICK; + + * Incompatible change: In MySQL 5.6.20, the patch for Bug + #69477 limits the size of redo log BLOB writes to 10% of + the redo log file size. As a result of this new limit, + innodb_log_file_size should be set to a value greater + than 10 times the largest BLOB data size found in the + rows of your tables. No action is required if your + innodb_log_file_size setting is already 10 times the + largest BLOB data size or your tables contain no BLOB + data. + In MySQL 5.6.22, the redo log BLOB write limit is relaxed + to 10% of the total redo log size (innodb_log_file_size * + innodb_log_files_in_group). (Bug #19498877) + SQL Changes @@ -7461,401 +8628,439 @@ SQL Changes reserved in MySQL 5.5. See Section 9.3, "Reserved Words." * The YEAR(2) data type has certain issues that you should - consider before choosing to use it. As of MySQL 5.6.6, YEAR(2) - is deprecated. YEAR(2) columns in existing tables are treated - as before, but YEAR(2) in new or altered tables are converted - to YEAR(4). For more information, see Section 11.3.4, "YEAR(2) - Limitations and Migrating to YEAR(4)." - - * As of MySQL 5.6.6, it is explicitly disallowed to assign the - value DEFAULT to stored procedure or function parameters or - stored program local variables (for example with a SET - var_name = DEFAULT statement). This was not previously - supported, or documented as permitted, but is flagged as an - incompatible change in case existing code inadvertently used - this construct. It remains permissible to assign DEFAULT to - system variables, as before, but assigning DEFAULT to - parameters or local variables now results in a syntax error. + consider before choosing to use it. As of MySQL 5.6.6, + YEAR(2) is deprecated. YEAR(2) columns in existing tables + are treated as before, but YEAR(2) in new or altered + tables are converted to YEAR(4). For more information, + see Section 11.3.4, "YEAR(2) Limitations and Migrating to + YEAR(4)." + + * As of MySQL 5.6.6, it is explicitly disallowed to assign + the value DEFAULT to stored procedure or function + parameters or stored program local variables (for example + with a SET var_name = DEFAULT statement). This was not + previously supported, or documented as permitted, but is + flagged as an incompatible change in case existing code + inadvertently used this construct. It remains permissible + to assign DEFAULT to system variables, as before, but + assigning DEFAULT to parameters or local variables now + results in a syntax error. After an upgrade to MySQL 5.6.6 or later, existing stored - programs that use this construct produce a syntax error when - invoked. If a mysqldump file from 5.6.5 or earlier is loaded - into 5.6.6 or later, the load operation fails and affected - stored program definitions must be changed. - - * In MySQL, the TIMESTAMP data type differs in nonstandard ways - from other data types: - - + TIMESTAMP columns not explicitly declared with the NULL - attribute are assigned the NOT NULL attribute. (Columns - of other data types, if not explicitly declared as NOT - NULL, permit NULL values.) Setting such a column to NULL - sets it to the current timestamp. - - + The first TIMESTAMP column in a table, if not declared - with the NULL attribute or an explicit DEFAULT or ON - UPDATE clause, is automatically assigned the DEFAULT - CURRENT_TIMESTAMP and ON UPDATE CURRENT_TIMESTAMP - attributes. + programs that use this construct produce a syntax error + when invoked. If a mysqldump file from 5.6.5 or earlier + is loaded into 5.6.6 or later, the load operation fails + and affected stored program definitions must be changed. + + * In MySQL, the TIMESTAMP data type differs in nonstandard + ways from other data types: + + + TIMESTAMP columns not explicitly declared with the + NULL attribute are assigned the NOT NULL attribute. + (Columns of other data types, if not explicitly + declared as NOT NULL, permit NULL values.) Setting + such a column to NULL sets it to the current + timestamp. + + + The first TIMESTAMP column in a table, if not + declared with the NULL attribute or an explicit + DEFAULT or ON UPDATE clause, is automatically + assigned the DEFAULT CURRENT_TIMESTAMP and ON UPDATE + CURRENT_TIMESTAMP attributes. + TIMESTAMP columns following the first one, if not - declared with the NULL attribute or an explicit DEFAULT - clause, are automatically assigned DEFAULT '0000-00-00 - 00:00:00' (the "zero" timestamp). For inserted rows that - specify no explicit value for such a column, the column - is assigned '0000-00-00 00:00:00' and no warning occurs. - Those nonstandard behaviors remain the default for TIMESTAMP - but as of MySQL 5.6.6 are deprecated and this warning appears - at startup: + declared with the NULL attribute or an explicit + DEFAULT clause, are automatically assigned DEFAULT + '0000-00-00 00:00:00' (the "zero" timestamp). For + inserted rows that specify no explicit value for + such a column, the column is assigned '0000-00-00 + 00:00:00' and no warning occurs. + Those nonstandard behaviors remain the default for + TIMESTAMP but as of MySQL 5.6.6 are deprecated and this + warning appears at startup: [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). + As indicated by the warning, to turn off the nonstandard behaviors, enable the new explicit_defaults_for_timestamp - system variable at server startup. With this variable enabled, - the server handles TIMESTAMP as follows instead: + system variable at server startup. With this variable + enabled, the server handles TIMESTAMP as follows instead: - + TIMESTAMP columns not explicitly declared as NOT NULL - permit NULL values. Setting such a column to NULL sets it - to NULL, not the current timestamp. + + TIMESTAMP columns not explicitly declared as NOT + NULL permit NULL values. Setting such a column to + NULL sets it to NULL, not the current timestamp. + No TIMESTAMP column is assigned the DEFAULT CURRENT_TIMESTAMP or ON UPDATE CURRENT_TIMESTAMP attributes automatically. Those attributes must be explicitly specified. - + TIMESTAMP columns declared as NOT NULL and without an - explicit DEFAULT clause are treated as having no default - value. For inserted rows that specify no explicit value - for such a column, the result depends on the SQL mode. If - strict SQL mode is enabled, an error occurs. If strict - SQL mode is not enabled, the column is assigned the - implicit default of '0000-00-00 00:00:00' and a warning - occurs. This is similar to how MySQL treats other - temporal types such as DATETIME. - To upgrade servers used for replication, upgrade the slaves - first, then the master. Replication between the master and its - slaves should work provided that all use the same value of - explicit_defaults_for_timestamp: - - 1. Bring down the slaves, upgrade them, configure them with - the desired value of explicit_defaults_for_timestamp, and - bring them back up. - The slaves will recognize from the format of the binary - logs received from the master that the master is older - (predates the introduction of - explicit_defaults_for_timestamp) and that operations on - TIMESTAMP columns coming from the master use the old - TIMESTAMP behavior. - - 2. Bring down the master, upgrade it, and configure it with - the same explicit_defaults_for_timestamp value used on - the slaves, and bring it back up. - -2.11.2. Downgrading MySQL - - This section describes what to do to downgrade to an older MySQL - version, in the unlikely case that the previous version worked - better than the new one. - - It is always a good idea to make a backup beforehand, in case a - downgrade fails and leaves the instance in an unusable state. - - To downgrade between General Availability (GA) status versions - within the same release series, typically you just install the new - binaries on top of the old ones and do not make any changes to the - databases. - - Downgrades between milestone releases (or from a GA release to a - milestone release) within the same release series are not - supported and you may encounter issues. - - The following items form a checklist of things to do whenever you - perform a downgrade: - - * Read the upgrading section for the release series from which - you are downgrading to be sure that it does not have any - features you really need. See Section 2.11.1, "Upgrading - MySQL." - - * If there is a downgrading section for that version, read that - as well. - - * To see which new features were added between the version to - which you are downgrading and your current version, see the - Release Notes + + TIMESTAMP columns declared as NOT NULL and without + an explicit DEFAULT clause are treated as having no + default value. For inserted rows that specify no + explicit value for such a column, the result depends + on the SQL mode. If strict SQL mode is enabled, an + error occurs. If strict SQL mode is not enabled, the + column is assigned the implicit default of + '0000-00-00 00:00:00' and a warning occurs. This is + similar to how MySQL treats other temporal types + such as DATETIME. + To upgrade servers used for replication, upgrade the + slaves first, then the master. Replication between the + master and its slaves should work provided that all use + the same value of explicit_defaults_for_timestamp: + + 1. Bring down the slaves, upgrade them, configure them + with the desired value of + explicit_defaults_for_timestamp, and bring them back + up. + The slaves will recognize from the format of the + binary logs received from the master that the master + is older (predates the introduction of + explicit_defaults_for_timestamp) and that operations + on TIMESTAMP columns coming from the master use the + old TIMESTAMP behavior. + + 2. Bring down the master, upgrade it, and configure it + with the same explicit_defaults_for_timestamp value + used on the slaves, and bring it back up. + +2.11.2 Downgrading MySQL + + This section describes what to do to downgrade to an older + MySQL version, in the unlikely case that the previous version + worked better than the new one. + + It is always a good idea to make a backup beforehand, in case + a downgrade fails and leaves the instance in an unusable + state. + + To downgrade between General Availability (GA) status + versions within the same release series, typically you just + install the new binaries on top of the old ones and do not + make any changes to the databases. + + Downgrades between milestone releases (or from a GA release + to a milestone release) within the same release series are + not supported and you may encounter issues. + + The following items form a checklist of things to do whenever + you perform a downgrade: + + * Read the upgrading section for the release series from + which you are downgrading to be sure that it does not + have any features you really need. See Section 2.11.1, + "Upgrading MySQL." + + * If there is a downgrading section for that version, read + that as well. + + * To see which new features were added between the version + to which you are downgrading and your current version, + see the Release Notes (http://dev.mysql.com/doc/relnotes/mysql/5.6/en/). - * Check Section 2.11.3, "Checking Whether Tables or Indexes Must - Be Rebuilt," to see whether changes to table formats or to - character sets or collations were made between your current - version of MySQL and the version to which you are downgrading. - If so and these changes result in an incompatibility between - MySQL versions, you will need to downgrade the affected tables - using the instructions in Section 2.11.4, "Rebuilding or - Repairing Tables or Indexes." - - In most cases, you can move the MySQL format files and data files - between different GA versions on the same architecture as long as - you stay within versions for the same release series of MySQL. - - If you downgrade from one release series to another, there may be - incompatibilities in table storage formats. In this case, use - mysqldump to dump your tables before downgrading. After - downgrading, reload the dump file using mysql or mysqlimport to - re-create your tables. For examples, see Section 2.11.5, "Copying - MySQL Databases to Another Machine." - - A typical symptom of a downward-incompatible table format change - when you downgrade is that you cannot open tables. In that case, - use the following procedure: + * Check Section 2.11.3, "Checking Whether Tables or Indexes + Must Be Rebuilt," to see whether changes to table formats + or to character sets or collations were made between your + current version of MySQL and the version to which you are + downgrading. If so and these changes result in an + incompatibility between MySQL versions, you will need to + downgrade the affected tables using the instructions in + Section 2.11.4, "Rebuilding or Repairing Tables or + Indexes." + + In most cases, you can move the MySQL format files and data + files between different GA versions on the same architecture + as long as you stay within versions for the same release + series of MySQL. + + If you downgrade from one release series to another, there + may be incompatibilities in table storage formats. In this + case, use mysqldump to dump your tables before downgrading. + After downgrading, reload the dump file using mysql or + mysqlimport to re-create your tables. For examples, see + Section 2.11.5, "Copying MySQL Databases to Another Machine." + + A typical symptom of a downward-incompatible table format + change when you downgrade is that you cannot open tables. In + that case, use the following procedure: 1. Stop the older MySQL server that you are downgrading to. 2. Restart the newer MySQL server you are downgrading from. - 3. Dump any tables that were inaccessible to the older server by - using mysqldump to create a dump file. + 3. Dump any tables that were inaccessible to the older + server by using mysqldump to create a dump file. 4. Stop the newer MySQL server and restart the older one. - 5. Reload the dump file into the older server. Your tables should - be accessible. + 5. Reload the dump file into the older server. Your tables + should be accessible. - If system tables in the mysql database changed, downgrading might - introduce some loss of functionality or require some adjustments. - Here are some examples: + If system tables in the mysql database changed, downgrading + might introduce some loss of functionality or require some + adjustments. Here are some examples: - * Trigger creation requires the TRIGGER privilege as of MySQL - 5.1. In MySQL 5.0, there is no TRIGGER privilege and SUPER is - required instead. If you downgrade from MySQL 5.1 to 5.0, you - will need to give the SUPER privilege to those accounts that - had the TRIGGER privilege in 5.1. + * Trigger creation requires the TRIGGER privilege as of + MySQL 5.1. In MySQL 5.0, there is no TRIGGER privilege + and SUPER is required instead. If you downgrade from + MySQL 5.1 to 5.0, you will need to give the SUPER + privilege to those accounts that had the TRIGGER + privilege in 5.1. - * Triggers were added in MySQL 5.0, so if you downgrade from 5.0 - to 4.1, you cannot use triggers at all. + * Triggers were added in MySQL 5.0, so if you downgrade + from 5.0 to 4.1, you cannot use triggers at all. - * The mysql.proc.comment column definition changed between MySQL - 5.1 and 5.5. After a downgrade from 5.5 to 5.1, this table is - seen as corrupt and in need of repair. To workaround this - problem, execute mysql_upgrade from the version of MySQL to - which you downgraded. + * The mysql.proc.comment column definition changed between + MySQL 5.1 and 5.5. After a downgrade from 5.5 to 5.1, + this table is seen as corrupt and in need of repair. To + workaround this problem, execute mysql_upgrade from the + version of MySQL to which you downgraded. -2.11.2.1. Downgrading to MySQL 5.5 +2.11.2.1 Downgrading to MySQL 5.5 - When downgrading to MySQL 5.5 from MySQL 5.6, keep in mind the - following issues relating to features found in MySQL 5.6, but not - in MySQL 5.5: + When downgrading to MySQL 5.5 from MySQL 5.6, keep in mind + the following issues relating to behavior or features in + MySQL 5.6 that differ in MySQL 5.5: System Tables * The mysql.user table in MySQL 5.6 has a password_expired - column. The mysql.user table in MySQL 5.5 does not. This means - that an account with an expired password in MySQL 5.6 will - work normally in MySQL 5.5. + column. The mysql.user table in MySQL 5.5 does not. This + means that an account with an expired password in MySQL + 5.6 will work normally in MySQL 5.5. + +Data Types + + + * For TIME, DATETIME, and TIMESTAMP columns, the storage + required for tables created before MySQL 5.6.4 differs + from storage required for tables created in 5.6.4 and + later. This is due to a change in 5.6.4 that permits + these temporal types to have a fractional part. To + downgrade to a version older than 5.6.4, dump affected + tables with mysqldump before downgrading, and reload the + tables after downgrading. InnoDB - * InnoDB search indexes (with a type of FULLTEXT), introduced in - MySQL 5.6.4, are not compatible with earlier versions of - MySQL, including earlier releases in the 5.6 series. Drop such - indexes before performing a downgrade. + * InnoDB search indexes (with a type of FULLTEXT), + introduced in MySQL 5.6.4, are not compatible with + earlier versions of MySQL, including earlier releases in + the 5.6 series. Drop such indexes before performing a + downgrade. * InnoDB small page sizes specified by the innodb_page_size configuration option, introduced in MySQL 5.6.4, are not - compatible with earlier versions of MySQL, including earlier - releases in the 5.6 series. Dump all InnoDB tables in - instances that use a smaller InnoDB page size, drop the - tables, and re-create and reload them after the downgrade. + compatible with earlier versions of MySQL, including + earlier releases in the 5.6 series. Dump all InnoDB + tables in instances that use a smaller InnoDB page size, + drop the tables, and re-create and reload them after the + downgrade. Replication - * As of MySQL 5.6, the relay-log.info file contains a line count - and a replication delay value, so the file format differs from - that in older versions. See Section 16.2.2.2, "Slave Status - Logs." If you downgrade a slave server to a version older than - MySQL 5.6, the older server will not read the file correctly. - To address this, modify the file in a text editor to delete - the initial line containing the number of lines. - - * Beginning with MySQL 5.6.6, the MySQL Server employs Version 2 - binary log events when writing the binary log. Binary logs - written using Version 2 log events cannot by read by earlier - versions of MySQL Server. To generate a binary log that is - written using Version 1 log events readable by older servers, - start the MySQL 5.6.6 or later server using - --log-bin-use-v1-row-events=1, which forces the server to - employ Version 1 events when writing the binary log. - -2.11.3. Checking Whether Tables or Indexes Must Be Rebuilt - - A binary upgrade or downgrade is one that installs one version of - MySQL "in place" over an existing version, without dumping and - reloading tables: - - 1. Stop the server for the existing version if it is running. - - 2. Install a different version of MySQL. This is an upgrade if - the new version is higher than the original version, a + * As of MySQL 5.6, the relay-log.info file contains a line + count and a replication delay value, so the file format + differs from that in older versions. See Section + 17.2.2.2, "Slave Status Logs." If you downgrade a slave + server to a version older than MySQL 5.6, the older + server will not read the file correctly. To address this, + modify the file in a text editor to delete the initial + line containing the number of lines. + + * Beginning with MySQL 5.6.6, the MySQL Server employs + Version 2 binary log events when writing the binary log. + Binary logs written using Version 2 log events cannot by + read by earlier versions of MySQL Server. To generate a + binary log that is written using Version 1 log events + readable by older servers, start the MySQL 5.6.6 or later + server using --log-bin-use-v1-row-events=1, which forces + the server to employ Version 1 events when writing the + binary log. + +2.11.3 Checking Whether Tables or Indexes Must Be Rebuilt + + A binary upgrade or downgrade is one that installs one + version of MySQL "in place" over an existing version, without + dumping and reloading tables: + + 1. Stop the server for the existing version if it is + running. + + 2. Install a different version of MySQL. This is an upgrade + if the new version is higher than the original version, a downgrade if the version is lower. 3. Start the server for the new version. - In many cases, the tables from the previous version of MySQL can - be used without problem by the new version. However, sometimes - changes occur that require tables or table indexes to be rebuilt, - as described in this section. If you have tables that are affected - by any of the issues described here, rebuild the tables or indexes - as necessary using the instructions given in Section 2.11.4, - "Rebuilding or Repairing Tables or Indexes." + In many cases, the tables from the previous version of MySQL + can be used without problem by the new version. However, + sometimes changes occur that require tables or table indexes + to be rebuilt, as described in this section. If you have + tables that are affected by any of the issues described here, + rebuild the tables or indexes as necessary using the + instructions given in Section 2.11.4, "Rebuilding or + Repairing Tables or Indexes." Table Incompatibilities - After a binary upgrade to MySQL 5.1 from a MySQL 5.0 installation - that contains ARCHIVE tables, accessing those tables causes the - server to crash, even if you have run mysql_upgrade or CHECK TABLE - ... FOR UPGRADE. To work around this problem, use mysqldump to - dump all ARCHIVE tables before upgrading, and reload them into - MySQL 5.1 after upgrading. The same problem occurs for binary - downgrades from MySQL 5.1 to 5.0. + After a binary upgrade to MySQL 5.1 from a MySQL 5.0 + installation that contains ARCHIVE tables, accessing those + tables causes the server to crash, even if you have run + mysql_upgrade or CHECK TABLE ... FOR UPGRADE. To work around + this problem, use mysqldump to dump all ARCHIVE tables before + upgrading, and reload them into MySQL 5.1 after upgrading. + The same problem occurs for binary downgrades from MySQL 5.1 + to 5.0. - The upgrade problem is fixed in MySQL 5.6.4: The server can open - ARCHIVE tables created in MySQL 5.0. However, it remains the - recommended upgrade procedure to dump 5.0 ARCHIVE tables before - upgrading and reload them after upgrading. + The upgrade problem is fixed in MySQL 5.6.4: The server can + open ARCHIVE tables created in MySQL 5.0. However, it remains + the recommended upgrade procedure to dump 5.0 ARCHIVE tables + before upgrading and reload them after upgrading. Index Incompatibilities In MySQL 5.6.3, the length limit for index prefix keys is - increased from 767 bytes to 3072 bytes, for InnoDB tables using - ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED. See Section 14.2.6.7, - "Limits on InnoDB Tables" for details. This change is also - backported to MySQL 5.5.14. If you downgrade from one of these - releases or higher, to an earlier release with a lower length - limit, the index prefix keys could be truncated at 767 bytes or - the downgrade could fail. This issue could only occur if the - configuration option innodb_large_prefix was enabled on the server - being downgraded. + increased from 767 bytes to 3072 bytes, for InnoDB tables + using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED. See + Section 14.6.7, "Limits on InnoDB Tables" for details. This + change is also backported to MySQL 5.5.14. If you downgrade + from one of these releases or higher, to an earlier release + with a lower length limit, the index prefix keys could be + truncated at 767 bytes or the downgrade could fail. This + issue could only occur if the configuration option + innodb_large_prefix was enabled on the server being + downgraded. If you perform a binary upgrade without dumping and reloading tables, you cannot upgrade directly from MySQL 4.1 to 5.1 or - higher. This occurs due to an incompatible change in the MyISAM - table index format in MySQL 5.0. Upgrade from MySQL 4.1 to 5.0 and - repair all MyISAM tables. Then upgrade from MySQL 5.0 to 5.1 and - check and repair your tables. + higher. This occurs due to an incompatible change in the + MyISAM table index format in MySQL 5.0. Upgrade from MySQL + 4.1 to 5.0 and repair all MyISAM tables. Then upgrade from + MySQL 5.0 to 5.1 and check and repair your tables. Modifications to the handling of character sets or collations - might change the character sort order, which causes the ordering - of entries in any index that uses an affected character set or - collation to be incorrect. Such changes result in several possible - problems: + might change the character sort order, which causes the + ordering of entries in any index that uses an affected + character set or collation to be incorrect. Such changes + result in several possible problems: * Comparison results that differ from previous results - * Inability to find some index values due to misordered index - entries + * Inability to find some index values due to misordered + index entries * Misordered ORDER BY results - * Tables that CHECK TABLE reports as being in need of repair + * Tables that CHECK TABLE reports as being in need of + repair - The solution to these problems is to rebuild any indexes that use - an affected character set or collation, either by dropping and - re-creating the indexes, or by dumping and reloading the entire - table. In some cases, it is possible to alter affected columns to - use a different collation. For information about rebuilding - indexes, see Section 2.11.4, "Rebuilding or Repairing Tables or - Indexes." + The solution to these problems is to rebuild any indexes that + use an affected character set or collation, either by + dropping and re-creating the indexes, or by dumping and + reloading the entire table. In some cases, it is possible to + alter affected columns to use a different collation. For + information about rebuilding indexes, see Section 2.11.4, + "Rebuilding or Repairing Tables or Indexes." - To check whether a table has indexes that must be rebuilt, consult - the following list. It indicates which versions of MySQL - introduced character set or collation changes that require indexes - to be rebuilt. Each entry indicates the version in which the - change occurred and the character sets or collations that the - change affects. If the change is associated with a particular bug - report, the bug number is given. + To check whether a table has indexes that must be rebuilt, + consult the following list. It indicates which versions of + MySQL introduced character set or collation changes that + require indexes to be rebuilt. Each entry indicates the + version in which the change occurred and the character sets + or collations that the change affects. If the change is + associated with a particular bug report, the bug number is + given. The list applies both for binary upgrades and downgrades. For - example, Bug #27877 was fixed in MySQL 5.1.24, so it applies to - upgrades from versions older than 5.1.24 to 5.1.24 or newer, and - to downgrades from 5.1.24 or newer to versions older than 5.1.24. - - In many cases, you can use CHECK TABLE ... FOR UPGRADE to identify - tables for which index rebuilding is required. It will report this - message: + example, Bug #27877 was fixed in MySQL 5.1.24, so it applies + to upgrades from versions older than 5.1.24 to 5.1.24 or + newer, and to downgrades from 5.1.24 or newer to versions + older than 5.1.24. + + In many cases, you can use CHECK TABLE ... FOR UPGRADE to + identify tables for which index rebuilding is required. It + will report this message: Table upgrade required. Please do "REPAIR TABLE `tbl_name`" or dump/reload to fix it! - In these cases, you can also use mysqlcheck --check-upgrade or - mysql_upgrade, which execute CHECK TABLE. However, the use of - CHECK TABLE applies only after upgrades, not downgrades. Also, - CHECK TABLE is not applicable to all storage engines. For details - about which storage engines CHECK TABLE supports, see Section - 13.7.2.2, "CHECK TABLE Syntax." + In these cases, you can also use mysqlcheck --check-upgrade + or mysql_upgrade, which execute CHECK TABLE. However, the use + of CHECK TABLE applies only after upgrades, not downgrades. + Also, CHECK TABLE is not applicable to all storage engines. + For details about which storage engines CHECK TABLE supports, + see Section 13.7.2.2, "CHECK TABLE Syntax." These changes cause index rebuilding to be necessary: * MySQL 5.1.24 (Bug #27877) Affects indexes that use the utf8_general_ci or - ucs2_general_ci collation for columns that contain 'ß' LATIN - SMALL LETTER SHARP S (German). The bug fix corrected an error - in the original collations but introduced an incompatibility - such that 'ß' compares equal to characters with which it - previously compared different. - Affected tables can be detected by CHECK TABLE ... FOR UPGRADE - as of MySQL 5.1.30 (see Bug #40053). - A workaround for this issue is implemented as of MySQL 5.1.62, - 5.5.21, and 5.6.5. The workaround involves altering affected - columns to use the utf8_general_mysql500_ci and - ucs2_general_mysql500_ci collations, which preserve the - original pre-5.1.24 ordering of utf8_general_ci and - ucs2_general_ci. + ucs2_general_ci collation for columns that contain 'ß' + LATIN SMALL LETTER SHARP S (German). The bug fix + corrected an error in the original collations but + introduced an incompatibility such that 'ß' compares + equal to characters with which it previously compared + different. + Affected tables can be detected by CHECK TABLE ... FOR + UPGRADE as of MySQL 5.1.30 (see Bug #40053). + A workaround for this issue is implemented as of MySQL + 5.1.62, 5.5.21, and 5.6.5. The workaround involves + altering affected columns to use the + utf8_general_mysql500_ci and ucs2_general_mysql500_ci + collations, which preserve the original pre-5.1.24 + ordering of utf8_general_ci and ucs2_general_ci. * MySQL 5.0.48, 5.1.23 (Bug #27562) - Affects indexes that use the ascii_general_ci collation for - columns that contain any of these characters: '`' GRAVE - ACCENT, '[' LEFT SQUARE BRACKET, '\' REVERSE SOLIDUS, ']' - RIGHT SQUARE BRACKET, '~' TILDE - Affected tables can be detected by CHECK TABLE ... FOR UPGRADE - as of MySQL 5.1.29 (see Bug #39585). + Affects indexes that use the ascii_general_ci collation + for columns that contain any of these characters: '`' + GRAVE ACCENT, '[' LEFT SQUARE BRACKET, '\' REVERSE + SOLIDUS, ']' RIGHT SQUARE BRACKET, '~' TILDE + Affected tables can be detected by CHECK TABLE ... FOR + UPGRADE as of MySQL 5.1.29 (see Bug #39585). * MySQL 5.0.48, 5.1.21 (Bug #29461) - Affects indexes for columns that use any of these character - sets: eucjpms, euc_kr, gb2312, latin7, macce, ujis - Affected tables can be detected by CHECK TABLE ... FOR UPGRADE - as of MySQL 5.1.29 (see Bug #39585). - -2.11.4. Rebuilding or Repairing Tables or Indexes - - This section describes how to rebuild a table, following changes - to MySQL such as how data types or character sets are handled. For - example, an error in a collation might have been corrected, - requiring a table rebuild to update the indexes for character - columns that use the collation. (For examples, see Section 2.11.3, - "Checking Whether Tables or Indexes Must Be Rebuilt.") You might - also need to repair or upgrade a table, as indicated by a table - check operation such as that performed by CHECK TABLE, mysqlcheck, - or mysql_upgrade. - - Methods for rebuilding a table include dumping and reloading it, - or using ALTER TABLE or REPAIR TABLE. + Affects indexes for columns that use any of these + character sets: eucjpms, euc_kr, gb2312, latin7, macce, + ujis + Affected tables can be detected by CHECK TABLE ... FOR + UPGRADE as of MySQL 5.1.29 (see Bug #39585). + +2.11.4 Rebuilding or Repairing Tables or Indexes + + This section describes how to rebuild a table, following + changes to MySQL such as how data types or character sets are + handled. For example, an error in a collation might have been + corrected, requiring a table rebuild to update the indexes + for character columns that use the collation. (For examples, + see Section 2.11.3, "Checking Whether Tables or Indexes Must + Be Rebuilt.") You might also need to repair or upgrade a + table, as indicated by a table check operation such as that + performed by CHECK TABLE, mysqlcheck, or mysql_upgrade. + + Methods for rebuilding a table include dumping and reloading + it, or using ALTER TABLE or REPAIR TABLE. REPAIR TABLE only + applies to MyISAM, ARCHIVE, and CSV tables. Note - If you are rebuilding tables because a different version of MySQL - will not handle them after a binary (in-place) upgrade or - downgrade, you must use the dump-and-reload method. Dump the - tables before upgrading or downgrading using your original version - of MySQL. Then reload the tables after upgrading or downgrading. + If you are rebuilding tables because a different version of + MySQL will not handle them after a binary (in-place) upgrade + or downgrade, you must use the dump-and-reload method. Dump + the tables before upgrading or downgrading using your + original version of MySQL. Then reload the tables after + upgrading or downgrading. - If you use the dump-and-reload method of rebuilding tables only - for the purpose of rebuilding indexes, you can perform the dump - either before or after upgrading or downgrading. Reloading still - must be done afterward. + If you use the dump-and-reload method of rebuilding tables + only for the purpose of rebuilding indexes, you can perform + the dump either before or after upgrading or downgrading. + Reloading still must be done afterward. - To rebuild a table by dumping and reloading it, use mysqldump to - create a dump file and mysql to reload the file: + To rebuild a table by dumping and reloading it, use mysqldump + to create a dump file and mysql to reload the file: shell> mysqldump db_name t1 > dump.sql shell> mysql db_name < dump.sql @@ -7864,85 +9069,94 @@ shell> mysql db_name < dump.sql shell> mysqldump db_name > dump.sql shell> mysql db_name < dump.sql - To rebuild all tables in all databases, use the --all-databases - option: + To rebuild all tables in all databases, use the + --all-databases option: shell> mysqldump --all-databases > dump.sql shell> mysql < dump.sql - To rebuild a table with ALTER TABLE, use a "null" alteration; that - is, an ALTER TABLE statement that "changes" the table to use the - storage engine that it already has. For example, if t1 is a MyISAM - table, use this statement: -mysql> ALTER TABLE t1 ENGINE = MyISAM; - - If you are not sure which storage engine to specify in the ALTER - TABLE statement, use SHOW CREATE TABLE to display the table - definition. + To rebuild a table with ALTER TABLE, use a "null" alteration; + that is, an ALTER TABLE statement that "changes" the table to + use the storage engine that it already has. For example, if + t1 is an InnoDB table, use this statement: +mysql> ALTER TABLE t1 ENGINE = InnoDB; + + If you are not sure which storage engine to specify in the + ALTER TABLE statement, use SHOW CREATE TABLE to display the + table definition. + + If you need to rebuild an InnoDB table because a CHECK TABLE + operation indicates that a table upgrade is required, use + mysqldump to create a dump file and mysql to reload the file, + as described earlier. If the CHECK TABLE operation indicates + that there is a corruption or causes InnoDB to fail, refer to + Section 14.19.2, "Forcing InnoDB Recovery" for information + about using the innodb_force_recovery option to restart + InnoDB. To understand the type of problem that CHECK TABLE + may be encountering, refer to the InnoDB notes in Section + 13.7.2.2, "CHECK TABLE Syntax." - If you must rebuild a table because a table checking operation - indicates that the table is corrupt or needs an upgrade, you can - use REPAIR TABLE if that statement supports the table's storage - engine. For example, to repair a MyISAM table, use this statement: + For MyISAM, ARCHIVE, or CSV tables, you can use REPAIR TABLE + if the table checking operation indicates that there is a + corruption or that an upgrade is required. For example, to + repair a MyISAM table, use this statement: mysql> REPAIR TABLE t1; - For storage engines such as InnoDB that REPAIR TABLE does not - support, use mysqldump to create a dump file and mysql to reload - the file, as described earlier. - - For specifics about which storage engines REPAIR TABLE supports, - see Section 13.7.2.5, "REPAIR TABLE Syntax." - - mysqlcheck --repair provides command-line access to the REPAIR - TABLE statement. This can be a more convenient means of repairing - tables because you can use the --databases or --all-databases - option to repair all tables in specific databases or all - databases, respectively: + mysqlcheck --repair provides command-line access to the + REPAIR TABLE statement. This can be a more convenient means + of repairing tables because you can use the --databases or + --all-databases option to repair all tables in specific + databases or all databases, respectively: shell> mysqlcheck --repair --databases db_name ... shell> mysqlcheck --repair --all-databases - For incompatibilities introduced in MySQL 5.1.24 by the fix for - Bug #27877 that corrected the utf8_general_ci and ucs2_general_ci - collations, a workaround is implemented as of MySQL 5.1.62, - 5.5.21, and 5.6.5. Upgrade to one of those versions, then convert - each affected table using one of the following methods. In each - case, the workaround altering affected columns to use the - utf8_general_mysql500_ci and ucs2_general_mysql500_ci collations, - which preserve the original pre-5.1.24 ordering of utf8_general_ci - and ucs2_general_ci. + For incompatibilities introduced in MySQL 5.1.24 by the fix + for Bug #27877 that corrected the utf8_general_ci and + ucs2_general_ci collations, a workaround is implemented as of + MySQL 5.1.62, 5.5.21, and 5.6.5. Upgrade to one of those + versions, then convert each affected table using one of the + following methods. In each case, the workaround altering + affected columns to use the utf8_general_mysql500_ci and + ucs2_general_mysql500_ci collations, which preserve the + original pre-5.1.24 ordering of utf8_general_ci and + ucs2_general_ci. * To convert an affected table after a binary upgrade that - leaves the table files in place, alter the table to use the - new collation. Suppose that the table t1 contains one or more - problematic utf8 columns. To convert the table at the table - level, use a statement like this: + leaves the table files in place, alter the table to use + the new collation. Suppose that the table t1 contains one + or more problematic utf8 columns. To convert the table at + the table level, use a statement like this: ALTER TABLE t1 CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_mysql500_ci; + To apply the change on a column-specific basis, use a - statement like this (be sure to repeat the column definition - as originally specified except for the COLLATE clause): + statement like this (be sure to repeat the column + definition as originally specified except for the COLLATE + clause): ALTER TABLE t1 -MODIFY c1 CHAR(N) CHARACTER SET utf8 COLLATE utf8_general_mysql500_ci -; +MODIFY c1 CHAR(N) CHARACTER SET utf8 COLLATE utf8_general_mysql500_ci; + - * To upgrade the table using a dump and reload procedure, dump - the table using mysqldump, modify the CREATE TABLE statement - in the dump file to use the new collation, and reload the - table. + * To upgrade the table using a dump and reload procedure, + dump the table using mysqldump, modify the CREATE TABLE + statement in the dump file to use the new collation, and + reload the table. - After making the appropriate changes, CHECK TABLE should report no - error. + After making the appropriate changes, CHECK TABLE should + report no error. -2.11.5. Copying MySQL Databases to Another Machine +2.11.5 Copying MySQL Databases to Another Machine + + In cases where you need to transfer databases between + different architectures, you can use mysqldump to create a + file containing SQL statements. You can then transfer the + file to the other machine and feed it as input to the mysql + client. + Note You can copy the .frm, .MYI, and .MYD files for MyISAM tables between different architectures that support the same floating-point format. (MySQL takes care of any byte-swapping - issues.) See Section 14.3, "The MyISAM Storage Engine." - - In cases where you need to transfer databases between different - architectures, you can use mysqldump to create a file containing - SQL statements. You can then transfer the file to the other - machine and feed it as input to the mysql client. + issues.) See Section 15.2, "The MyISAM Storage Engine." Use mysqldump --help to see what options are available. @@ -7952,28 +9166,28 @@ MODIFY c1 CHAR(N) CHARACTER SET utf8 COLLATE utf8_general_mysql500_ci shell> mysqladmin -h 'other_hostname' create db_name shell> mysqldump db_name | mysql -h 'other_hostname' db_name - If you want to copy a database from a remote machine over a slow - network, you can use these commands: + If you want to copy a database from a remote machine over a + slow network, you can use these commands: shell> mysqladmin create db_name -shell> mysqldump -h 'other_hostname' --compress db_name | mysql db_na -me +shell> mysqldump -h 'other_hostname' --compress db_name | mysql db_nam +e - You can also store the dump in a file, transfer the file to the - target machine, and then load the file into the database there. - For example, you can dump a database to a compressed file on the - source machine like this: + You can also store the dump in a file, transfer the file to + the target machine, and then load the file into the database + there. For example, you can dump a database to a compressed + file on the source machine like this: shell> mysqldump --quick db_name | gzip > db_name.gz - Transfer the file containing the database contents to the target - machine and run these commands there: + Transfer the file containing the database contents to the + target machine and run these commands there: shell> mysqladmin create db_name shell> gunzip < db_name.gz | mysql db_name You can also use mysqldump and mysqlimport to transfer the - database. For large tables, this is much faster than simply using - mysqldump. In the following commands, DUMPDIR represents the full - path name of the directory you use to store the output from - mysqldump. + database. For large tables, this is much faster than simply + using mysqldump. In the following commands, DUMPDIR + represents the full path name of the directory you use to + store the output from mysqldump. First, create the directory for the output files and dump the database: @@ -7981,50 +9195,49 @@ shell> mkdir DUMPDIR shell> mysqldump --tab=DUMPDIR db_name Then transfer the files in the DUMPDIR directory to some - corresponding directory on the target machine and load the files - into MySQL there: + corresponding directory on the target machine and load the + files into MySQL there: shell> mysqladmin create db_name # create database -shell> cat DUMPDIR/*.sql | mysql db_name # create tables in databas -e +shell> cat DUMPDIR/*.sql | mysql db_name # create tables in database shell> mysqlimport db_name DUMPDIR/*.txt # load data into tables - Do not forget to copy the mysql database because that is where the - grant tables are stored. You might have to run commands as the - MySQL root user on the new machine until you have the mysql - database in place. + Do not forget to copy the mysql database because that is + where the grant tables are stored. You might have to run + commands as the MySQL root user on the new machine until you + have the mysql database in place. - After you import the mysql database on the new machine, execute - mysqladmin flush-privileges so that the server reloads the grant - table information. + After you import the mysql database on the new machine, + execute mysqladmin flush-privileges so that the server + reloads the grant table information. -2.12. Environment Variables +2.12 Environment Variables - This section lists all the environment variables that are used - directly or indirectly by MySQL. Most of these can also be found - in other places in this manual. + This section lists all the environment variables that are + used directly or indirectly by MySQL. Most of these can also + be found in other places in this manual. - Note that any options on the command line take precedence over - values specified in option files and environment variables, and - values in option files take precedence over values in environment - variables. + Note that any options on the command line take precedence + over values specified in option files and environment + variables, and values in option files take precedence over + values in environment variables. - In many cases, it is preferable to use an option file instead of - environment variables to modify the behavior of MySQL. See Section - 4.2.3.3, "Using Option Files." + In many cases, it is preferable to use an option file instead + of environment variables to modify the behavior of MySQL. See + Section 4.2.6, "Using Option Files." Variable Description CXX The name of your C++ compiler (for running CMake). CC The name of your C compiler (for running CMake). - CFLAGS Flags for your C compiler (for running CMake). - CXXFLAGS Flags for your C++ compiler (for running CMake). DBI_USER The default user name for Perl DBI. DBI_TRACE Trace options for Perl DBI. HOME The default path for the mysql history file is $HOME/.mysql_history. - LD_RUN_PATH Used to specify the location of libmysqlclient.so. + LD_RUN_PATH Used to specify the location of + libmysqlclient.so. LIBMYSQL_ENABLE_CLEARTEXT_PLUGIN Enable mysql_clear_password - authentication plugin; see Section 6.3.7.7, "The Cleartext + authentication plugin; see Section 6.3.8.7, "The Cleartext Client-Side Authentication Plugin." - LIBMYSQL_PLUGIN_DIR Directory in which to look for client plugins. + LIBMYSQL_PLUGIN_DIR Directory in which to look for client + plugins. LIBMYSQL_PLUGINS Client plugins to preload. MYSQL_DEBUG Debug trace options when debugging. MYSQL_GROUP_SUFFIX Option group suffix value (like specifying @@ -8034,219 +9247,228 @@ shell> mysqlimport db_name DUMPDIR/*.txt # load data into tables $HOME/.mysql_history. MYSQL_HISTIGNORE Patterns specifying statements not to log to $HOME/.mysql_history. - MYSQL_HOME The path to the directory in which the server-specific - my.cnf file resides. - MYSQL_HOST The default host name used by the mysql command-line - client. + MYSQL_HOME The path to the directory in which the + server-specific my.cnf file resides. + MYSQL_HOST The default host name used by the mysql + command-line client. MYSQL_PS1 The command prompt to use in the mysql command-line client. - MYSQL_PWD The default password when connecting to mysqld. Note - that using this is insecure. See Section 6.1.2.1, "End-User - Guidelines for Password Security." + MYSQL_PWD The default password when connecting to mysqld. + Note that using this is insecure. See Section 6.1.2.1, + "End-User Guidelines for Password Security." MYSQL_TCP_PORT The default TCP/IP port number. - MYSQL_TEST_LOGIN_FILE The name of the .mylogin.cnf login file. + MYSQL_TEST_LOGIN_FILE The name of the .mylogin.cnf login + file. MYSQL_UNIX_PORT The default Unix socket file name; used for connections to localhost. PATH Used by the shell to find MySQL programs. TMPDIR The directory where temporary files are created. TZ This should be set to your local time zone. See Section - C.5.4.6, "Time Zone Problems." - UMASK The user-file creation mode when creating files. See note - following table. + B.5.4.6, "Time Zone Problems." + UMASK The user-file creation mode when creating files. See + note following table. UMASK_DIR The user-directory creation mode when creating directories. See note following table. - USER The default user name on Windows when connecting to mysqld. + USER The default user name on Windows when connecting to + mysqld. - For information about the mysql history file, see Section 4.5.1.3, - "mysql Logging." + For information about the mysql history file, see Section + 4.5.1.3, "mysql Logging." - MYSQL_TEST_LOGIN_FILE is the path name of the login file (the file - created by mysql_config_editor). If not set, the default value is - %APPDATA%\MySQL\.mylogin.cnf directory on Windows and - $HOME/.mylogin.cnf on non-Windows systems. See Section 4.6.6, - "mysql_config_editor --- MySQL Configuration Utility." + MYSQL_TEST_LOGIN_FILE is the path name of the login file (the + file created by mysql_config_editor). If not set, the default + value is %APPDATA%\MySQL\.mylogin.cnf directory on Windows + and $HOME/.mylogin.cnf on non-Windows systems. See Section + 4.6.6, "mysql_config_editor --- MySQL Configuration Utility." - The UMASK and UMASK_DIR variables, despite their names, are used - as modes, not masks: + The UMASK and UMASK_DIR variables, despite their names, are + used as modes, not masks: - * If UMASK is set, mysqld uses ($UMASK | 0600) as the mode for - file creation, so that newly created files have a mode in the - range from 0600 to 0666 (all values octal). + * If UMASK is set, mysqld uses ($UMASK | 0600) as the mode + for file creation, so that newly created files have a + mode in the range from 0600 to 0666 (all values octal). - * If UMASK_DIR is set, mysqld uses ($UMASK_DIR | 0700) as the - base mode for directory creation, which then is AND-ed with - ~(~$UMASK & 0666), so that newly created directories have a - mode in the range from 0700 to 0777 (all values octal). The - AND operation may remove read and write permissions from the - directory mode, but not execute permissions. + * If UMASK_DIR is set, mysqld uses ($UMASK_DIR | 0700) as + the base mode for directory creation, which then is + AND-ed with ~(~$UMASK & 0666), so that newly created + directories have a mode in the range from 0700 to 0777 + (all values octal). The AND operation may remove read and + write permissions from the directory mode, but not + execute permissions. - MySQL assumes that the value for UMASK or UMASK_DIR is in octal if - it starts with a zero. + MySQL assumes that the value for UMASK or UMASK_DIR is in + octal if it starts with a zero. -2.13. Perl Installation Notes +2.13 Perl Installation Notes The Perl DBI module provides a generic interface for database - access. You can write a DBI script that works with many different - database engines without change. To use DBI, you must install the - DBI module, as well as a DataBase Driver (DBD) module for each - type of database server you want to access. For MySQL, this driver - is the DBD::mysql module. - - Perl, and the DBD::MySQL module for DBI must be installed if you - want to run the MySQL benchmark scripts; see Section 8.12.2, "The - MySQL Benchmark Suite." + access. You can write a DBI script that works with many + different database engines without change. To use DBI, you + must install the DBI module, as well as a DataBase Driver + (DBD) module for each type of database server you want to + access. For MySQL, this driver is the DBD::mysql module. + + Perl, and the DBD::MySQL module for DBI must be installed if + you want to run the MySQL benchmark scripts; see Section + 8.12.2, "The MySQL Benchmark Suite." Note - Perl support is not included with MySQL distributions. You can - obtain the necessary modules from http://search.cpan.org for Unix, - or by using the ActiveState ppm program on Windows. The following - sections describe how to do this. + Perl support is not included with MySQL distributions. You + can obtain the necessary modules from http://search.cpan.org + for Unix, or by using the ActiveState ppm program on Windows. + The following sections describe how to do this. - The DBI/DBD interface requires Perl 5.6.0, and 5.6.1 or later is - preferred. DBI does not work if you have an older version of Perl. - You should use DBD::mysql 4.009 or higher. Although earlier - versions are available, they do not support the full functionality - of MySQL 5.6. + The DBI/DBD interface requires Perl 5.6.0, and 5.6.1 or later + is preferred. DBI does not work if you have an older version + of Perl. You should use DBD::mysql 4.009 or higher. Although + earlier versions are available, they do not support the full + functionality of MySQL 5.6. -2.13.1. Installing Perl on Unix +2.13.1 Installing Perl on Unix - MySQL Perl support requires that you have installed MySQL client - programming support (libraries and header files). Most - installation methods install the necessary files. If you install - MySQL from RPM files on Linux, be sure to install the developer - RPM as well. The client programs are in the client RPM, but client - programming support is in the developer RPM. + MySQL Perl support requires that you have installed MySQL + client programming support (libraries and header files). Most + installation methods install the necessary files. If you + install MySQL from RPM files on Linux, be sure to install the + developer RPM as well. The client programs are in the client + RPM, but client programming support is in the developer RPM. - The files you need for Perl support can be obtained from the CPAN - (Comprehensive Perl Archive Network) at http://search.cpan.org. + The files you need for Perl support can be obtained from the + CPAN (Comprehensive Perl Archive Network) at + http://search.cpan.org. - The easiest way to install Perl modules on Unix is to use the CPAN - module. For example: + The easiest way to install Perl modules on Unix is to use the + CPAN module. For example: shell> perl -MCPAN -e shell cpan> install DBI cpan> install DBD::mysql - The DBD::mysql installation runs a number of tests. These tests - attempt to connect to the local MySQL server using the default - user name and password. (The default user name is your login name - on Unix, and ODBC on Windows. The default password is "no - password.") If you cannot connect to the server with those values - (for example, if your account has a password), the tests fail. You - can use force install DBD::mysql to ignore the failed tests. + The DBD::mysql installation runs a number of tests. These + tests attempt to connect to the local MySQL server using the + default user name and password. (The default user name is + your login name on Unix, and ODBC on Windows. The default + password is "no password.") If you cannot connect to the + server with those values (for example, if your account has a + password), the tests fail. You can use force install + DBD::mysql to ignore the failed tests. - DBI requires the Data::Dumper module. It may be installed; if not, - you should install it before installing DBI. + DBI requires the Data::Dumper module. It may be installed; if + not, you should install it before installing DBI. - It is also possible to download the module distributions in the - form of compressed tar archives and build the modules manually. - For example, to unpack and build a DBI distribution, use a - procedure such as this: + It is also possible to download the module distributions in + the form of compressed tar archives and build the modules + manually. For example, to unpack and build a DBI + distribution, use a procedure such as this: 1. Unpack the distribution into the current directory: shell> gunzip < DBI-VERSION.tar.gz | tar xvf - + This command creates a directory named DBI-VERSION. - 2. Change location into the top-level directory of the unpacked - distribution: + 2. Change location into the top-level directory of the + unpacked distribution: shell> cd DBI-VERSION + 3. Build the distribution and compile everything: shell> perl Makefile.PL shell> make shell> make test shell> make install - The make test command is important because it verifies that the - module is working. Note that when you run that command during the - DBD::mysql installation to exercise the interface code, the MySQL - server must be running or the test fails. + The make test command is important because it verifies that + the module is working. Note that when you run that command + during the DBD::mysql installation to exercise the interface + code, the MySQL server must be running or the test fails. It is a good idea to rebuild and reinstall the DBD::mysql - distribution whenever you install a new release of MySQL. This - ensures that the latest versions of the MySQL client libraries are - installed correctly. + distribution whenever you install a new release of MySQL. + This ensures that the latest versions of the MySQL client + libraries are installed correctly. - If you do not have access rights to install Perl modules in the - system directory or if you want to install local Perl modules, the - following reference may be useful: - http://servers.digitaldaze.com/extensions/perl/modules.html#module - s + If you do not have access rights to install Perl modules in + the system directory or if you want to install local Perl + modules, the following reference may be useful: + http://learn.perl.org/faq/perlfaq8.html#How-do-I-keep-my-own- + module-library-directory- - Look under the heading "Installing New Modules that Require - Locally Installed Modules." +2.13.2 Installing ActiveState Perl on Windows -2.13.2. Installing ActiveState Perl on Windows - - On Windows, you should do the following to install the MySQL DBD - module with ActiveState Perl: + On Windows, you should do the following to install the MySQL + DBD module with ActiveState Perl: 1. Get ActiveState Perl from - http://www.activestate.com/Products/ActivePerl/ and install - it. + http://www.activestate.com/Products/ActivePerl/ and + install it. 2. Open a console window. - 3. If necessary, set the HTTP_proxy variable. For example, you - might try a setting like this: + 3. If necessary, set the HTTP_proxy variable. For example, + you might try a setting like this: C:\> set HTTP_proxy=my.proxy.com:3128 + 4. Start the PPM program: C:\> C:\perl\bin\ppm.pl + 5. If you have not previously done so, install DBI: ppm> install DBI + 6. If this succeeds, run the following command: ppm> install DBD-mysql - This procedure should work with ActiveState Perl 5.6 or newer. + This procedure should work with ActiveState Perl 5.6 or + newer. - If you cannot get the procedure to work, you should install the - ODBC driver instead and connect to the MySQL server through ODBC: + If you cannot get the procedure to work, you should install + the ODBC driver instead and connect to the MySQL server + through ODBC: use DBI; $dbh= DBI->connect("DBI:ODBC:$dsn",$user,$password) || die "Got error $DBI::errstr when connecting to $dsn\n"; -2.13.3. Problems Using the Perl DBI/DBD Interface +2.13.3 Problems Using the Perl DBI/DBD Interface - If Perl reports that it cannot find the ../mysql/mysql.so module, - the problem is probably that Perl cannot locate the - libmysqlclient.so shared library. You should be able to fix this - problem by one of the following methods: + If Perl reports that it cannot find the ../mysql/mysql.so + module, the problem is probably that Perl cannot locate the + libmysqlclient.so shared library. You should be able to fix + this problem by one of the following methods: * Copy libmysqlclient.so to the directory where your other shared libraries are located (probably /usr/lib or /lib). - * Modify the -L options used to compile DBD::mysql to reflect - the actual location of libmysqlclient.so. + * Modify the -L options used to compile DBD::mysql to + reflect the actual location of libmysqlclient.so. - * On Linux, you can add the path name of the directory where - libmysqlclient.so is located to the /etc/ld.so.conf file. + * On Linux, you can add the path name of the directory + where libmysqlclient.so is located to the /etc/ld.so.conf + file. - * Add the path name of the directory where libmysqlclient.so is - located to the LD_RUN_PATH environment variable. Some systems - use LD_LIBRARY_PATH instead. + * Add the path name of the directory where + libmysqlclient.so is located to the LD_RUN_PATH + environment variable. Some systems use LD_LIBRARY_PATH + instead. - Note that you may also need to modify the -L options if there are - other libraries that the linker fails to find. For example, if the - linker cannot find libc because it is in /lib and the link command - specifies -L/usr/lib, change the -L option to -L/lib or add -L/lib - to the existing link command. + Note that you may also need to modify the -L options if there + are other libraries that the linker fails to find. For + example, if the linker cannot find libc because it is in /lib + and the link command specifies -L/usr/lib, change the -L + option to -L/lib or add -L/lib to the existing link command. - If you get the following errors from DBD::mysql, you are probably - using gcc (or using an old binary compiled with gcc): + If you get the following errors from DBD::mysql, you are + probably using gcc (or using an old binary compiled with + gcc): /usr/bin/perl: can't resolve symbol '__moddi3' /usr/bin/perl: can't resolve symbol '__divdi3' Add -L/usr/lib/gcc-lib/... -lgcc to the link command when the mysql.so library gets built (check the output from make for - mysql.so when you compile the Perl client). The -L option should - specify the path name of the directory where libgcc.a is located - on your system. - - Another cause of this problem may be that Perl and MySQL are not - both compiled with gcc. In this case, you can solve the mismatch - by compiling both with gcc. + mysql.so when you compile the Perl client). The -L option + should specify the path name of the directory where libgcc.a + is located on your system. - Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights - reserved. Legal Notices + Another cause of this problem may be that Perl and MySQL are + not both compiled with gcc. In this case, you can solve the + mismatch by compiling both with gcc. diff --git a/mysql-wsrep-5.6/README b/mysql-wsrep-5.6/README index 0e5a814e..d7ae7e1c 100644 --- a/mysql-wsrep-5.6/README +++ b/mysql-wsrep-5.6/README @@ -5,7 +5,7 @@ For the avoidance of doubt, this particular copy of the software is released under the version 2 of the GNU General Public License. MySQL is brought to you by Oracle. -Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. +Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. License information can be found in the COPYING file. diff --git a/mysql-wsrep-5.6/VERSION b/mysql-wsrep-5.6/VERSION index 3d1e30fb..f84d42f3 100644 --- a/mysql-wsrep-5.6/VERSION +++ b/mysql-wsrep-5.6/VERSION @@ -1,4 +1,4 @@ MYSQL_VERSION_MAJOR=5 MYSQL_VERSION_MINOR=6 -MYSQL_VERSION_PATCH=16 +MYSQL_VERSION_PATCH=23 MYSQL_VERSION_EXTRA= diff --git a/mysql-wsrep-5.6/client/client_priv.h b/mysql-wsrep-5.6/client/client_priv.h index 24678211..bd7f0111 100644 --- a/mysql-wsrep-5.6/client/client_priv.h +++ b/mysql-wsrep-5.6/client/client_priv.h @@ -1,5 +1,5 @@ /* - Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2001, 2014, 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 @@ -99,6 +99,7 @@ enum options_client OPT_CONFIG_ALL, OPT_SERVER_PUBLIC_KEY, OPT_ENABLE_CLEARTEXT_PLUGIN, + OPT_CONNECTION_SERVER_ID, OPT_MAX_CLIENT_OPTION }; diff --git a/mysql-wsrep-5.6/client/mysql.cc b/mysql-wsrep-5.6/client/mysql.cc index 7e3456f3..450bda04 100644 --- a/mysql-wsrep-5.6/client/mysql.cc +++ b/mysql-wsrep-5.6/client/mysql.cc @@ -1,5 +1,5 @@ /* - Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2000, 2014, 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 @@ -1315,9 +1315,9 @@ int main(int argc,char *argv[]) put_info("Welcome to the MySQL monitor. Commands end with ; or \\g.", INFO_INFO); - sprintf((char*) glob_buffer.ptr(), - "Your MySQL connection id is %lu\nServer version: %s\n", - mysql_thread_id(&mysql), server_version_string(&mysql)); + snprintf((char*) glob_buffer.ptr(), glob_buffer.alloced_length(), + "Your MySQL connection id is %lu\nServer version: %s\n", + mysql_thread_id(&mysql), server_version_string(&mysql)); put_info((char*) glob_buffer.ptr(),INFO_INFO); put_info(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000"), INFO_INFO); @@ -1404,6 +1404,17 @@ int main(int argc,char *argv[]) sig_handler mysql_end(int sig) { +#ifndef _WIN32 + /* + Ingnoring SIGQUIT, SIGINT and SIGHUP signals when cleanup process starts. + This will help in resolving the double free issues, which occures in case + the signal handler function is started in between the clean up function. + */ + signal(SIGQUIT, SIG_IGN); + signal(SIGINT, SIG_IGN); + signal(SIGHUP, SIG_IGN); +#endif + mysql_close(&mysql); #ifdef HAVE_READLINE if (!status.batch && !quick && !opt_html && !opt_xml && diff --git a/mysql-wsrep-5.6/client/mysql_config_editor.cc b/mysql-wsrep-5.6/client/mysql_config_editor.cc index e1b46315..5997e63a 100644 --- a/mysql-wsrep-5.6/client/mysql_config_editor.cc +++ b/mysql-wsrep-5.6/client/mysql_config_editor.cc @@ -1,5 +1,5 @@ /* - Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2012, 2014, 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 @@ -49,8 +49,8 @@ static int g_fd; excluding the header part. */ static size_t file_size; -static char *opt_user= NULL, *opt_password= NULL, *opt_host=NULL, - *opt_login_path= NULL, *opt_socket= NULL, *opt_port= NULL; +static const char *opt_user= NULL, *opt_password= NULL, *opt_host=NULL, + *opt_login_path= "client", *opt_socket= NULL, *opt_port= NULL; static char my_login_file[FN_REFLEN]; static char my_key[LOGIN_KEY_LEN]; @@ -140,11 +140,11 @@ static struct my_option my_set_command_options[]= {"password", 'p', "Prompt for password to be entered into the login file.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"user", 'u', "User name to be entered into the login file.", &opt_user, - &opt_user, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + &opt_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"socket", 'S', "Socket path to be entered into login file.", &opt_socket, - &opt_socket, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + &opt_socket, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"port", 'P', "Port number to be entered into login file.", &opt_port, - &opt_port, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + &opt_port, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"warn", 'w', "Warn and ask for confirmation if set command attempts to " "overwrite an existing login path (enabled by default).", &opt_warn, &opt_warn, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, @@ -454,10 +454,6 @@ static int do_handle_options(int argc, char *argv[]) if ( argc_cmd > 1) goto error; - /* If NULL, set it to 'client' (default) */ - if (!opt_login_path) - opt_login_path= my_strdup("client", MYF(MY_WME)); - done: my_free(ptr); DBUG_RETURN(command); @@ -776,7 +772,7 @@ static my_bool check_and_create_login_file(void) { verbose_msg("File exists.\n"); - file_size= stat_info.st_size; + file_size= (size_t) stat_info.st_size; #ifdef _WIN32 if (1) @@ -943,7 +939,7 @@ static void mask_password_and_print(char *buf) static void remove_options(DYNAMIC_STRING *file_buf, const char *path_name) { /* If nope of the options are specified remove the entire path. */ - if (!opt_remove_host && !opt_remove_pass && !opt_remove_user + if (!opt_remove_host && !opt_remove_pass && !opt_remove_user && !opt_remove_socket && !opt_remove_port) { remove_login_path(file_buf, path_name); @@ -1046,7 +1042,7 @@ static void remove_login_path(DYNAMIC_STRING *file_buf, const char *path_name) DBUG_ENTER("remove_login_path"); char *start=NULL, *end= NULL; - int tot_len, len, diff; + int to_move, len, diff; if((start= locate_login_path(file_buf, path_name)) == NULL) /* login path was not found, skip.. */ @@ -1058,7 +1054,7 @@ static void remove_login_path(DYNAMIC_STRING *file_buf, const char *path_name) { end ++; /* Move past '\n' */ len= ((diff= (start - end)) > 0) ? diff : - diff; - tot_len= file_buf->length - len ; + to_move= file_buf->length - (end - file_buf->str); } else { @@ -1067,7 +1063,7 @@ static void remove_login_path(DYNAMIC_STRING *file_buf, const char *path_name) goto done; } - while(tot_len --) + while(to_move --) *(start ++)= *(end ++); *start= '\0'; @@ -1295,7 +1291,7 @@ error: @param plain [in] Plain text to be encrypted. @param plain_len [in] Length of the plain text. - @param cipher [in] Encrypted cipher text. + @param cipher [out] Encrypted cipher text. @return -1 if error encountered, length encrypted, otherwise. @@ -1306,9 +1302,12 @@ static int encrypt_buffer(const char *plain, int plain_len, char cipher[]) DBUG_ENTER("encrypt_buffer"); int aes_len; - aes_len= my_aes_get_size(plain_len); + aes_len= my_aes_get_size(plain_len, my_aes_128_ecb); - if (my_aes_encrypt(plain, plain_len, cipher, my_key, LOGIN_KEY_LEN) == aes_len) + if (my_aes_encrypt((const unsigned char *) plain, plain_len, + (unsigned char *) cipher, + (const unsigned char *) my_key, LOGIN_KEY_LEN, + my_aes_128_ecb, NULL) == aes_len) DBUG_RETURN(aes_len); verbose_msg("Error! Couldn't encrypt the buffer.\n"); @@ -1321,7 +1320,7 @@ static int encrypt_buffer(const char *plain, int plain_len, char cipher[]) @param cipher [in] Cipher text to be decrypted. @param cipher_len [in] Length of the cipher text. - @param plain [in] Decrypted plain text. + @param plain [out] Decrypted plain text. @return -1 if error encountered, length decrypted, otherwise. @@ -1332,8 +1331,11 @@ static int decrypt_buffer(const char *cipher, int cipher_len, char plain[]) DBUG_ENTER("decrypt_buffer"); int aes_length; - if ((aes_length= my_aes_decrypt(cipher, cipher_len, (char *) plain, - my_key, LOGIN_KEY_LEN)) > 0) + if ((aes_length= my_aes_decrypt((const unsigned char *) cipher, cipher_len, + (unsigned char *) plain, + (const unsigned char *) my_key, + LOGIN_KEY_LEN, + my_aes_128_ecb, NULL)) > 0) DBUG_RETURN(aes_length); verbose_msg("Error! Couldn't decrypt the buffer.\n"); diff --git a/mysql-wsrep-5.6/client/mysql_upgrade.c b/mysql-wsrep-5.6/client/mysql_upgrade.c index c72a1303..929d8be6 100644 --- a/mysql-wsrep-5.6/client/mysql_upgrade.c +++ b/mysql-wsrep-5.6/client/mysql_upgrade.c @@ -476,6 +476,7 @@ static void find_tool(char *tool_executable_name, const char *tool_name, */ if (run_tool(tool_executable_name, &ds_tmp, /* Get output from command, discard*/ + "--no-defaults", "--help", "2>&1", IF_WIN("> NUL", "> /dev/null"), diff --git a/mysql-wsrep-5.6/client/mysqladmin.cc b/mysql-wsrep-5.6/client/mysqladmin.cc index b87a884b..4d3f6749 100644 --- a/mysql-wsrep-5.6/client/mysqladmin.cc +++ b/mysql-wsrep-5.6/client/mysqladmin.cc @@ -1,5 +1,5 @@ /* - Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2000, 2014, 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 @@ -40,7 +40,7 @@ ulonglong last_values[MAX_MYSQL_VAR]; static int interval=0; static my_bool option_force=0,interrupted=0,new_line=0, opt_compress=0, opt_relative=0, opt_verbose=0, opt_vertical=0, - tty_password= 0, opt_nobeep; + tty_password= 0, opt_nobeep, opt_secure_auth= TRUE; static my_bool debug_info_flag= 0, debug_check_flag= 0; static uint tcp_port = 0, option_wait = 0, option_silent=0, nr_iterations; static uint opt_count_iterations= 0, my_end_arg; @@ -75,6 +75,7 @@ extern "C" my_bool get_one_option(int optid, const struct my_option *opt, char *argument); static my_bool sql_connect(MYSQL *mysql, uint wait); static int execute_commands(MYSQL *mysql,int argc, char **argv); +static char **mask_password(int argc, char ***argv); static int drop_db(MYSQL *mysql,const char *db); extern "C" sig_handler endprog(int signal_number); static void nice_time(ulong sec,char *buff); @@ -181,6 +182,9 @@ static struct my_option my_long_options[] = "Currently only works with extended-status.", &opt_relative, &opt_relative, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"secure-auth", OPT_SECURE_AUTH, "Refuse client connecting to server if it" + " uses old (pre-4.1.1) protocol.", &opt_secure_auth, + &opt_secure_auth, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, #ifdef HAVE_SMEM {"shared-memory-base-name", OPT_SHARED_MEMORY_BASE_NAME, "Base name of shared memory.", &shared_memory_base_name, &shared_memory_base_name, @@ -311,11 +315,11 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), int main(int argc,char *argv[]) { - int error= 0, ho_error; + int error= 0, ho_error, temp_argc; int first_command; my_bool can_handle_passwords; MYSQL mysql; - char **commands, **save_argv; + char **commands, **save_argv, **temp_argv; MY_INIT(argv[0]); mysql_init(&mysql); @@ -330,6 +334,9 @@ int main(int argc,char *argv[]) free_defaults(save_argv); exit(ho_error); } + temp_argv= mask_password(argc, &argv); + temp_argc= argc; + if (debug_info_flag) my_end_arg= MY_CHECK_ERROR | MY_GIVE_INFO; if (debug_check_flag) @@ -340,7 +347,7 @@ int main(int argc,char *argv[]) usage(); exit(1); } - commands = argv; + commands = temp_argv; if (tty_password) opt_password = get_tty_password(NullS); @@ -349,6 +356,8 @@ int main(int argc,char *argv[]) if (opt_bind_addr) mysql_options(&mysql,MYSQL_OPT_BIND,opt_bind_addr); + if (!opt_secure_auth) + mysql_options(&mysql, MYSQL_SECURE_AUTH,(char*)&opt_secure_auth); if (opt_compress) mysql_options(&mysql,MYSQL_OPT_COMPRESS,NullS); if (opt_connect_timeout) @@ -504,6 +513,13 @@ int main(int argc,char *argv[]) my_free(shared_memory_base_name); #endif free_defaults(save_argv); + temp_argc--; + while(temp_argc >= 0) + { + my_free(temp_argv[temp_argc]); + temp_argc--; + } + my_free(temp_argv); my_end(my_end_arg); exit(error ? 1 : 0); return 0; @@ -977,7 +993,10 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv) } } else + { + print_cmdline_password_warning(); typed_password= argv[1]; + } if (typed_password[0]) { @@ -1161,6 +1180,47 @@ error: return 0; } +/** + @brief Masking the password if it is passed as command line argument. + + @details It works in Linux and changes cmdline in ps and /proc/pid/cmdline, + but it won't work for history file of shell. + The command line arguments are copied to another array and the + password in the argv is masked. This function is called just after + "handle_options" because in "handle_options", the agrv pointers + are altered which makes freeing of dynamically allocated memory + difficult. The password masking is done before all other operations + in order to minimise the time frame of password visibility via cmdline. + + @param argc command line options (count) + @param argv command line options (values) + + @return temp_argv copy of argv +*/ + +static char **mask_password(int argc, char ***argv) +{ + char **temp_argv; + temp_argv= (char **)(my_malloc(sizeof(char *) * argc, MYF(MY_WME))); + argc--; + while (argc > 0) + { + temp_argv[argc]= my_strdup((*argv)[argc], MYF(MY_FAE)); + if (find_type((*argv)[argc - 1],&command_typelib, FIND_TYPE_BASIC) == ADMIN_PASSWORD || + find_type((*argv)[argc - 1],&command_typelib, FIND_TYPE_BASIC) == ADMIN_OLD_PASSWORD) + { + char *start= (*argv)[argc]; + while (*start) + *start++= 'x'; + start= (*argv)[argc]; + if (*start) + start[1]= 0; /* Cut length of argument */ + } + argc--; + } + temp_argv[argc]= my_strdup((*argv)[argc], MYF(MY_FAE)); + return(temp_argv); +} static void print_version(void) { diff --git a/mysql-wsrep-5.6/client/mysqlbinlog.cc b/mysql-wsrep-5.6/client/mysqlbinlog.cc index 3b031ae0..711f9b3e 100644 --- a/mysql-wsrep-5.6/client/mysqlbinlog.cc +++ b/mysql-wsrep-5.6/client/mysqlbinlog.cc @@ -1,5 +1,5 @@ /* - Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2000, 2014, 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 @@ -69,7 +69,7 @@ using std::max; #define CLIENT_CAPABILITIES (CLIENT_LONG_PASSWORD | CLIENT_LONG_FLAG | CLIENT_LOCAL_FILES) char server_version[SERVER_VERSION_LENGTH]; -ulong server_id = 0; +ulong filter_server_id = 0; /* One statement can result in a sequence of several events: Intvar_log_events, User_var_log_events, and Rand_log_events, followed by one @@ -125,12 +125,16 @@ static my_bool force_if_open_opt= 1, raw_mode= 0; static my_bool to_last_remote_log= 0, stop_never= 0; static my_bool opt_verify_binlog_checksum= 1; static ulonglong offset = 0; -static uint stop_never_server_id= 1; +static int64 stop_never_slave_server_id= -1; +#ifndef DBUG_OFF +static int64 connection_server_id= -1; +#endif //DBUG_OFF static char* host = 0; static int port= 0; static uint my_end_arg; static const char* sock= 0; static char *opt_plugin_dir= 0, *opt_default_auth= 0; +static my_bool opt_secure_auth= TRUE; #ifdef HAVE_SMEM static char *shared_memory_base_name= 0; @@ -149,7 +153,6 @@ static ulonglong start_position, stop_position; static char *start_datetime_str, *stop_datetime_str; static my_time_t start_datetime= 0, stop_datetime= MY_TIME_T_MAX; static ulonglong rec_count= 0; -static ushort binlog_flags = 0; static MYSQL* mysql = NULL; static char* dirname_for_local_load= 0; static uint opt_server_id_bits = 0; @@ -195,7 +198,9 @@ static Exit_status dump_local_log_entries(PRINT_EVENT_INFO *print_event_info, const char* logname); 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_single_log(PRINT_EVENT_INFO *print_event_info, + const char* logname); +static Exit_status dump_multiple_logs(int argc, char **argv); static Exit_status safe_connect(); /* @@ -868,7 +873,7 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev, events. */ if (ev_type != ROTATE_EVENT && - server_id && (server_id != ev->server_id)) + filter_server_id && (filter_server_id != ev->server_id)) goto end; } if (((my_time_t) (ev->when.tv_sec) >= stop_datetime) @@ -944,9 +949,20 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev, { in_transaction= false; print_event_info->skipped_event_in_transaction= false; + if (print_event_info->is_gtid_next_set) + print_event_info->is_gtid_next_valid= false; } else if (starts_group) in_transaction= true; + else + { + /* + We are not in a transaction and are not seeing a BEGIN or + COMMIT. So this is an implicitly committing DDL. + */ + if (print_event_info->is_gtid_next_set && !in_transaction) + print_event_info->is_gtid_next_valid= false; + } ev->print(result_file, print_event_info); if (head->error == -1) @@ -1283,6 +1299,8 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev, case GTID_LOG_EVENT: { seen_gtids= true; + print_event_info->is_gtid_next_set= true; + print_event_info->is_gtid_next_valid= true; if (print_event_info->skipped_event_in_transaction == true) fprintf(result_file, "COMMIT /* added by mysqlbinlog */%s\n", print_event_info->delimiter); print_event_info->skipped_event_in_transaction= false; @@ -1296,6 +1314,8 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev, { in_transaction= false; print_event_info->skipped_event_in_transaction= false; + if (print_event_info->is_gtid_next_set) + print_event_info->is_gtid_next_valid= false; ev->print(result_file, print_event_info); if (head->error == -1) goto err; @@ -1318,9 +1338,11 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev, since there may be no gtids on the next one. */ seen_gtids= false; - fprintf(result_file, "SET @@SESSION.GTID_NEXT= 'AUTOMATIC' " - "/* added by mysqlbinlog */ %s\n", - print_event_info->delimiter); + fprintf(result_file, "%sAUTOMATIC' /* added by mysqlbinlog */ %s\n", + Gtid_log_event::SET_STRING_PREFIX, + print_event_info->delimiter); + print_event_info->is_gtid_next_set= false; + print_event_info->is_gtid_next_valid= true; } } ev->print(result_file, print_event_info); @@ -1472,9 +1494,12 @@ static struct my_option my_long_options[] = "prefix for the file names.", &output_file, &output_file, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"secure-auth", OPT_SECURE_AUTH, "Refuse client connecting to server if it" + " uses old (pre-4.1.1) protocol.", &opt_secure_auth, + &opt_secure_auth, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, {"server-id", OPT_SERVER_ID, "Extract only binlog entries created by the server having the given id.", - &server_id, &server_id, 0, GET_ULONG, + &filter_server_id, &filter_server_id, 0, GET_ULONG, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"server-id-bits", 0, "Set number of significant bits in server-id", @@ -1529,9 +1554,15 @@ static struct my_option my_long_options[] = &stop_never, &stop_never, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"stop-never-slave-server-id", OPT_WAIT_SERVER_ID, - "The slave server ID used for stop-never", - &stop_never_server_id, &stop_never_server_id, 0, - GET_UINT, REQUIRED_ARG, 65535, 1, 65535, 0, 0, 0}, + "The slave server_id used for --read-from-remote-server --stop-never.", + &stop_never_slave_server_id, &stop_never_slave_server_id, 0, + GET_LL, REQUIRED_ARG, -1, -1, 0xFFFFFFFFLL, 0, 0, 0}, +#ifndef DBUG_OFF + {"connection-server-id", OPT_CONNECTION_SERVER_ID, + "The slave server_id used for --read-from-remote-server.", + &connection_server_id, &connection_server_id, 0, + GET_LL, REQUIRED_ARG, -1, -1, 0xFFFFFFFFLL, 0, 0, 0}, +#endif {"stop-position", OPT_STOP_POSITION, "Stop reading the binlog at position N. Applies to the last binlog " "passed on the command line.", @@ -1833,6 +1864,8 @@ static Exit_status safe_connect() mysql_options(mysql, MYSQL_OPT_PROTOCOL, (char*) &opt_protocol); if (opt_bind_addr) mysql_options(mysql, MYSQL_OPT_BIND, opt_bind_addr); + if (!opt_secure_auth) + mysql_options(mysql, MYSQL_SECURE_AUTH,(char*)&opt_secure_auth); #ifdef HAVE_SMEM if (shared_memory_base_name) mysql_options(mysql, MYSQL_SHARED_MEMORY_BASE_NAME, @@ -1864,11 +1897,35 @@ static Exit_status safe_connect() @retval OK_STOP No error, but the end of the specified range of events to process has been reached and the program should terminate. */ -static Exit_status dump_log_entries(const char* logname) +static Exit_status dump_single_log(PRINT_EVENT_INFO *print_event_info, + const char* logname) { - DBUG_ENTER("dump_log_entries"); + DBUG_ENTER("dump_single_log"); + + Exit_status rc= OK_CONTINUE; + + switch (opt_remote_proto) + { + case BINLOG_LOCAL: + rc= dump_local_log_entries(print_event_info, logname); + break; + case BINLOG_DUMP_NON_GTID: + case BINLOG_DUMP_GTID: + rc= dump_remote_log_entries(print_event_info, logname); + break; + default: + DBUG_ASSERT(0); + break; + } + DBUG_RETURN(rc); +} + +static Exit_status dump_multiple_logs(int argc, char **argv) +{ + DBUG_ENTER("dump_multiple_logs"); Exit_status rc= OK_CONTINUE; + PRINT_EVENT_INFO print_event_info; if (!print_event_info.init_ok()) DBUG_RETURN(ERROR_STOP); @@ -1884,18 +1941,18 @@ static Exit_status dump_log_entries(const char* logname) print_event_info.verbose= short_form ? 0 : verbose; - switch (opt_remote_proto) + // Dump all logs. + my_off_t save_stop_position= stop_position; + stop_position= ~(my_off_t)0; + for (int i= 0; i < argc; i++) { - case BINLOG_LOCAL: - rc= dump_local_log_entries(&print_event_info, logname); - break; - case BINLOG_DUMP_NON_GTID: - case BINLOG_DUMP_GTID: - rc= dump_remote_log_entries(&print_event_info, logname); - break; - default: - DBUG_ASSERT(0); - break; + if (i == argc - 1) // last log, --stop-position applies + stop_position= save_stop_position; + if ((rc= dump_single_log(&print_event_info, argv[i])) != OK_CONTINUE) + break; + + // For next log, --start-position does not apply + start_position= BIN_LOG_HEADER_SIZE; } if (buff_ev.elements > 0) @@ -1922,6 +1979,14 @@ static Exit_status dump_log_entries(const char* logname) if (print_event_info.skipped_event_in_transaction) fprintf(result_file, "COMMIT /* added by mysqlbinlog */%s\n", print_event_info.delimiter); + if (!print_event_info.is_gtid_next_valid) + { + fprintf(result_file, "%sAUTOMATIC' /* added by mysqlbinlog */%s\n", + Gtid_log_event::SET_STRING_PREFIX, + print_event_info.delimiter); + print_event_info.is_gtid_next_set= false; + print_event_info.is_gtid_next_valid= true; + } fprintf(result_file, "DELIMITER ;\n"); strmov(print_event_info.delimiter, ";"); } @@ -2016,6 +2081,12 @@ err: } +static int get_dump_flags() +{ + return stop_never ? 0 : BINLOG_DUMP_NON_BLOCK; +} + + /** Requests binlog dump from a remote server and prints the events it receives. @@ -2064,7 +2135,21 @@ static Exit_status dump_remote_log_entries(PRINT_EVENT_INFO *print_event_info, Fake a server ID to log continously. This will show as a slave on the mysql server. */ - server_id= ((to_last_remote_log && stop_never) ? stop_never_server_id : 0); + if (to_last_remote_log && stop_never) + { + if (stop_never_slave_server_id == -1) + server_id= 1; + else + server_id= stop_never_slave_server_id; + } + else + server_id= 0; +#ifndef DBUG_OFF + if (connection_server_id != -1) + server_id= connection_server_id; + +#endif + size_t tlen = strlen(logname); if (tlen > UINT_MAX) { @@ -2092,7 +2177,7 @@ static Exit_status dump_remote_log_entries(PRINT_EVENT_INFO *print_event_info, */ int4store(ptr_buffer, (uint32) start_position); ptr_buffer+= ::BINLOG_POS_OLD_INFO_SIZE; - int2store(ptr_buffer, binlog_flags); + int2store(ptr_buffer, get_dump_flags()); ptr_buffer+= ::BINLOG_FLAGS_INFO_SIZE; int4store(ptr_buffer, server_id); ptr_buffer+= ::BINLOG_SERVER_ID_INFO_SIZE; @@ -2123,7 +2208,7 @@ static Exit_status dump_remote_log_entries(PRINT_EVENT_INFO *print_event_info, } uchar* ptr_buffer= command_buffer; - int2store(ptr_buffer, binlog_flags); + int2store(ptr_buffer, get_dump_flags()); ptr_buffer+= ::BINLOG_FLAGS_INFO_SIZE; int4store(ptr_buffer, server_id); ptr_buffer+= ::BINLOG_SERVER_ID_INFO_SIZE; @@ -2286,8 +2371,14 @@ static Exit_status dump_remote_log_entries(PRINT_EVENT_INFO *print_event_info, error("Could not create log file '%s'", log_file_name); DBUG_RETURN(ERROR_STOP); } - my_fwrite(result_file, (const uchar*) BINLOG_MAGIC, - BIN_LOG_HEADER_SIZE, MYF(0)); + DBUG_EXECUTE_IF("simulate_result_file_write_error_for_FD_event", + DBUG_SET("+d,simulate_fwrite_error");); + if (my_fwrite(result_file, (const uchar*) BINLOG_MAGIC, + BIN_LOG_HEADER_SIZE, MYF(MY_NABP))) + { + error("Could not write into log file '%s'", log_file_name); + DBUG_RETURN(ERROR_STOP); + } /* Need to handle these events correctly in raw mode too or this could get messy @@ -2310,7 +2401,13 @@ static Exit_status dump_remote_log_entries(PRINT_EVENT_INFO *print_event_info, if (raw_mode) { - my_fwrite(result_file, net->read_pos + 1 , len - 1, MYF(0)); + DBUG_EXECUTE_IF("simulate_result_file_write_error", + DBUG_SET("+d,simulate_fwrite_error");); + if (my_fwrite(result_file, net->read_pos + 1 , len - 1, MYF(MY_NABP))) + { + error("Could not write into log file '%s'", log_file_name); + retval= ERROR_STOP; + } if (ev) { ev->temp_buf=0; @@ -2763,6 +2860,15 @@ static int args_post_process(void) global_sid_lock->unlock(); +#ifndef DBUG_OFF + if (connection_server_id == 0 && stop_never) + error("Cannot set --server-id=0 when --stop-never is specified."); + if (connection_server_id != -1 && stop_never_slave_server_id != -1) + error("Cannot set --connection-server-id= %lld and " + "--stop-never-slave-server-id= %lld. ", connection_server_id, + stop_never_slave_server_id); +#endif + DBUG_RETURN(OK_CONTINUE); } @@ -2806,22 +2912,22 @@ int main(int argc, char** argv) { char **defaults_argv; Exit_status retval= OK_CONTINUE; - ulonglong save_stop_position; MY_INIT(argv[0]); DBUG_ENTER("main"); DBUG_PROCESS(argv[0]); my_init_time(); // for time functions - /* + tzset(); // set tzname + /* A pointer of type Log_event can point to INTVAR USER_VAR RANDOM - events, when we allocate a element of sizeof(Log_event*) + events, when we allocate a element of sizeof(Log_event*) for the DYNAMIC_ARRAY. */ - if((my_init_dynamic_array(&buff_ev, sizeof(buff_event_info), + if((my_init_dynamic_array(&buff_ev, sizeof(buff_event_info), INTVAR_DYNAMIC_INIT, INTVAR_DYNAMIC_INCR))) exit(1); @@ -2847,6 +2953,7 @@ int main(int argc, char** argv) exit(1); } + umask(((~my_umask) & 0666)); /* Check for argument conflicts and do any post-processing */ if (args_post_process() == ERROR_STOP) exit(1); @@ -2902,17 +3009,7 @@ int main(int argc, char** argv) "\n/*!40101 SET NAMES %s */;\n", charset); } - for (save_stop_position= stop_position, stop_position= ~(my_off_t)0 ; - (--argc >= 0) ; ) - { - if (argc == 0) // last log, --stop-position applies - stop_position= save_stop_position; - if ((retval= dump_log_entries(*argv++)) != OK_CONTINUE) - break; - - // For next log, --start-position does not apply - start_position= BIN_LOG_HEADER_SIZE; - } + retval= dump_multiple_logs(argc, argv); if (!raw_mode) { diff --git a/mysql-wsrep-5.6/client/mysqlcheck.c b/mysql-wsrep-5.6/client/mysqlcheck.c index 51d4c16d..e40fb75a 100644 --- a/mysql-wsrep-5.6/client/mysqlcheck.c +++ b/mysql-wsrep-5.6/client/mysqlcheck.c @@ -1,5 +1,5 @@ /* - Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2001, 2014, 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 @@ -41,7 +41,7 @@ static my_bool opt_alldbs = 0, opt_check_only_changed = 0, opt_extended = 0, opt_silent = 0, opt_auto_repair = 0, ignore_errors = 0, tty_password= 0, opt_frm= 0, debug_info_flag= 0, debug_check_flag= 0, opt_fix_table_names= 0, opt_fix_db_names= 0, opt_upgrade= 0, - opt_write_binlog= 1; + opt_write_binlog= 1, opt_secure_auth=TRUE; static uint verbose = 0, opt_mysql_port=0; static int my_end_arg; static char * opt_mysql_unix_port = 0; @@ -144,6 +144,9 @@ static struct my_option my_long_options[] = "when commands should not be sent to replication slaves.", &opt_write_binlog, &opt_write_binlog, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, + {"secure-auth", OPT_SECURE_AUTH, "Refuse client connecting to server if it" + " uses old (pre-4.1.1) protocol.", &opt_secure_auth, + &opt_secure_auth, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, {"optimize", 'o', "Optimize table.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"password", 'p', @@ -891,6 +894,8 @@ static int dbConnect(char *host, char *user, char *passwd) mysql_options(&mysql_connection,MYSQL_OPT_PROTOCOL,(char*)&opt_protocol); if (opt_bind_addr) mysql_options(&mysql_connection, MYSQL_OPT_BIND, opt_bind_addr); + if (!opt_secure_auth) + mysql_options(&mysql_connection, MYSQL_SECURE_AUTH,(char*)&opt_secure_auth); #ifdef HAVE_SMEM if (shared_memory_base_name) mysql_options(&mysql_connection,MYSQL_SHARED_MEMORY_BASE_NAME,shared_memory_base_name); diff --git a/mysql-wsrep-5.6/client/mysqldump.c b/mysql-wsrep-5.6/client/mysqldump.c index 307e7fc0..b440ccfe 100644 --- a/mysql-wsrep-5.6/client/mysqldump.c +++ b/mysql-wsrep-5.6/client/mysqldump.c @@ -1,5 +1,5 @@ /* - Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2000, 2014, 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 @@ -109,7 +109,8 @@ static my_bool verbose= 0, opt_no_create_info= 0, opt_no_data= 0, opt_slave_apply= 0, opt_include_master_host_port= 0, opt_events= 0, opt_comments_used= 0, - opt_alltspcs=0, opt_notspcs= 0, opt_drop_trigger= 0; + opt_alltspcs=0, opt_notspcs= 0, opt_drop_trigger= 0, + opt_secure_auth= 1; static my_bool insert_pat_inited= 0, debug_info_flag= 0, debug_check_flag= 0; static ulong opt_max_allowed_packet, opt_net_buffer_length; static MYSQL mysql_connection,*mysql=0; @@ -508,6 +509,9 @@ static struct my_option my_long_options[] = {"socket", 'S', "The socket file to use for connection.", &opt_mysql_unix_port, &opt_mysql_unix_port, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"secure-auth", OPT_SECURE_AUTH, "Refuse client connecting to server if it" + " uses old (pre-4.1.1) protocol.", &opt_secure_auth, + &opt_secure_auth, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, #include {"tab",'T', "Create tab-separated textfile for each table to given path. (Create .sql " @@ -610,7 +614,7 @@ static void verbose_msg(const char *fmt, ...) void check_io(FILE *file) { - if (ferror(file)) + if (ferror(file) || errno == 5) die(EX_EOF, "Got errno %d on write", errno); } @@ -1519,6 +1523,8 @@ static int connect_to_db(char *host, char *user,char *passwd) mysql_options(&mysql_connection,MYSQL_OPT_PROTOCOL,(char*)&opt_protocol); if (opt_bind_addr) mysql_options(&mysql_connection,MYSQL_OPT_BIND,opt_bind_addr); + if (!opt_secure_auth) + mysql_options(&mysql_connection,MYSQL_SECURE_AUTH,(char*)&opt_secure_auth); #ifdef HAVE_SMEM if (shared_memory_base_name) mysql_options(&mysql_connection,MYSQL_SHARED_MEMORY_BASE_NAME,shared_memory_base_name); @@ -2568,7 +2574,7 @@ static uint get_table_structure(char *table, char *db, char *table_type, if (strcmp (table_type, "VIEW") == 0) /* view */ print_comment(sql_file, 0, - "\n--\n-- Temporary table structure for view %s\n--\n\n", + "\n--\n-- Temporary view structure for view %s\n--\n\n", result_table); else print_comment(sql_file, 0, @@ -2595,7 +2601,7 @@ static uint get_table_structure(char *table, char *db, char *table_type, char *scv_buff= NULL; my_ulonglong n_cols; - verbose_msg("-- It's a view, create dummy table for view\n"); + verbose_msg("-- It's a view, create dummy view\n"); /* save "show create" statement for later */ if ((row= mysql_fetch_row(result)) && (scv_buff=row[1])) @@ -2668,7 +2674,7 @@ static uint get_table_structure(char *table, char *db, char *table_type, fprintf(sql_file, "SET @saved_cs_client = @@character_set_client;\n" "SET character_set_client = utf8;\n" - "/*!50001 CREATE TABLE %s (\n", + "/*!50001 CREATE VIEW %s AS SELECT \n", result_table); /* @@ -2677,31 +2683,24 @@ static uint get_table_structure(char *table, char *db, char *table_type, there should be a _trailing_ comma. */ + row= mysql_fetch_row(result); /* - The actual column type doesn't matter anyway, since the table will - be dropped at run time. - We do tinyint to avoid hitting the row size limit. + A temporary view is created to resolve the view interdependencies. + This temporary view is dropped when the actual view is created. */ - fprintf(sql_file, " %s tinyint NOT NULL", + + fprintf(sql_file, " 1 AS %s", quote_name(row[0], name_buff, 0)); while((row= mysql_fetch_row(result))) { - /* col name, col type */ - fprintf(sql_file, ",\n %s tinyint NOT NULL", + fprintf(sql_file, ",\n 1 AS %s", quote_name(row[0], name_buff, 0)); } - /* - Stand-in tables are always MyISAM tables as the default - engine might have a column-limit that's lower than the - number of columns in the view, and MyISAM support is - guaranteed to be in the server anyway. - */ - fprintf(sql_file, - "\n) ENGINE=MyISAM */;\n" + fprintf(sql_file,"*/;\n" "SET character_set_client = @saved_cs_client;\n"); check_io(sql_file); @@ -3629,7 +3628,8 @@ static void dump_table(char *table, char *db) field->type == MYSQL_TYPE_BLOB || field->type == MYSQL_TYPE_LONG_BLOB || field->type == MYSQL_TYPE_MEDIUM_BLOB || - field->type == MYSQL_TYPE_TINY_BLOB)) ? 1 : 0; + field->type == MYSQL_TYPE_TINY_BLOB || + field->type == MYSQL_TYPE_GEOMETRY)) ? 1 : 0; if (extended_insert && !opt_xml) { if (i == 0) @@ -5580,15 +5580,8 @@ static my_bool get_view_structure(char *table, char* db) "\n--\n-- Final view structure for view %s\n--\n\n", result_table); - /* Table might not exist if this view was dumped with --tab. */ - fprintf(sql_file, "/*!50001 DROP TABLE IF EXISTS %s*/;\n", opt_quoted_table); - if (opt_drop) - { - fprintf(sql_file, "/*!50001 DROP VIEW IF EXISTS %s*/;\n", - opt_quoted_table); - check_io(sql_file); - } - + verbose_msg("-- Dropping the temporary view structure created\n"); + fprintf(sql_file, "/*!50001 DROP VIEW IF EXISTS %s*/;\n", opt_quoted_table); my_snprintf(query, sizeof(query), "SELECT CHECK_OPTION, DEFINER, SECURITY_TYPE, " @@ -5762,7 +5755,7 @@ static void dynstr_realloc_checked(DYNAMIC_STRING *str, ulong additional_size) int main(int argc, char **argv) { char bin_log_name[FN_REFLEN]; - int exit_code; + int exit_code, md_result_fd; MY_INIT("mysqldump"); compatible_mode_normal_str[0]= 0; @@ -5861,19 +5854,36 @@ int main(int argc, char **argv) dump_all_tablespaces(); dump_all_databases(); } - else if (argc > 1 && !opt_databases) - { - /* Only one database and selected table(s) */ - if (!opt_alltspcs && !opt_notspcs) - dump_tablespaces_for_tables(*argv, (argv + 1), (argc -1)); - dump_selected_tables(*argv, (argv + 1), (argc - 1)); - } else { - /* One or more databases, all tables */ - if (!opt_alltspcs && !opt_notspcs) - dump_tablespaces_for_databases(argv); - dump_databases(argv); + // Check all arguments meet length condition. Currently database and table + // names are limited to NAME_LEN bytes and stack-based buffers assumes + // that escaped name will be not longer than NAME_LEN*2 + 2 bytes long. + int argument; + for (argument= 0; argument < argc; argument++) + { + size_t argument_length= strlen(argv[argument]); + if (argument_length > NAME_LEN) + { + die(EX_CONSCHECK, "[ERROR] Argument '%s' is too long, it cannot be " + "name for any table or database.\n", argv[argument]); + } + } + + if (argc > 1 && !opt_databases) + { + /* Only one database and selected table(s) */ + if (!opt_alltspcs && !opt_notspcs) + dump_tablespaces_for_tables(*argv, (argv + 1), (argc - 1)); + dump_selected_tables(*argv, (argv + 1), (argc - 1)); + } + else + { + /* One or more databases, all tables */ + if (!opt_alltspcs && !opt_notspcs) + dump_tablespaces_for_databases(argv); + dump_databases(argv); + } } /* if --dump-slave , start the slave sql thread */ @@ -5890,8 +5900,19 @@ int main(int argc, char **argv) if (opt_slave_apply && add_slave_statements()) goto err; - /* ensure dumped data flushed */ - if (md_result_file && fflush(md_result_file)) + if (md_result_file) + md_result_fd= my_fileno(md_result_file); + + /* + Ensure dumped data flushed. + First we will flush the file stream data to kernel buffers with fflush(). + Second we will flush the kernel buffers data to physical disk file with + my_sync(), this will make sure the data succeessfully dumped to disk file. + fsync() fails with EINVAL if stdout is not redirected to any file, hence + MY_IGNORE_BADFD is passed to ingnore that error. + */ + if (md_result_file && + (fflush(md_result_file) || my_sync(md_result_fd, MYF(MY_IGNORE_BADFD)))) { if (!first_error) first_error= EX_MYSQLERR; diff --git a/mysql-wsrep-5.6/client/mysqlimport.c b/mysql-wsrep-5.6/client/mysqlimport.c index 17637493..94a1d711 100644 --- a/mysql-wsrep-5.6/client/mysqlimport.c +++ b/mysql-wsrep-5.6/client/mysqlimport.c @@ -1,5 +1,5 @@ /* - Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2000, 2014, 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 @@ -47,7 +47,7 @@ static char *add_load_option(char *ptr,const char *object, static my_bool verbose=0,lock_tables=0,ignore_errors=0,opt_delete=0, replace=0,silent=0,ignore=0,opt_compress=0, - opt_low_priority= 0, tty_password= 0; + opt_low_priority= 0, tty_password= 0, opt_secure_auth= 1; static my_bool debug_info_flag= 0, debug_check_flag= 0; static uint opt_use_threads=0, opt_local_file=0, my_end_arg= 0; static char *opt_password=0, *current_user=0, @@ -161,6 +161,9 @@ static struct my_option my_long_options[] = 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"replace", 'r', "If duplicate unique key was found, replace old row.", &replace, &replace, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"secure-auth", OPT_SECURE_AUTH, "Refuse client connecting to server if it" + " uses old (pre-4.1.1) protocol.", + &opt_secure_auth, &opt_secure_auth, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, #ifdef HAVE_SMEM {"shared-memory-base-name", OPT_SHARED_MEMORY_BASE_NAME, "Base name of shared memory.", &shared_memory_base_name, &shared_memory_base_name, @@ -440,6 +443,8 @@ static MYSQL *db_connect(char *host, char *database, mysql_options(mysql,MYSQL_OPT_PROTOCOL,(char*)&opt_protocol); if (opt_bind_addr) mysql_options(mysql,MYSQL_OPT_BIND,opt_bind_addr); + if (!opt_secure_auth) + mysql_options(mysql, MYSQL_SECURE_AUTH,(char*)&opt_secure_auth); #ifdef HAVE_SMEM if (shared_memory_base_name) mysql_options(mysql,MYSQL_SHARED_MEMORY_BASE_NAME,shared_memory_base_name); diff --git a/mysql-wsrep-5.6/client/mysqlshow.c b/mysql-wsrep-5.6/client/mysqlshow.c index 13dc20e0..755ef31d 100644 --- a/mysql-wsrep-5.6/client/mysqlshow.c +++ b/mysql-wsrep-5.6/client/mysqlshow.c @@ -1,5 +1,5 @@ /* - Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2000, 2014, 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 @@ -38,6 +38,7 @@ static uint my_end_arg= 0; static uint opt_verbose=0; static char *default_charset= (char*) MYSQL_AUTODETECT_CHARSET_NAME; static char *opt_plugin_dir= 0, *opt_default_auth= 0; +static my_bool opt_secure_auth= TRUE; #ifdef HAVE_SMEM static char *shared_memory_base_name=0; @@ -132,6 +133,8 @@ int main(int argc, char **argv) mysql_options(&mysql,MYSQL_OPT_PROTOCOL,(char*)&opt_protocol); if (opt_bind_addr) mysql_options(&mysql,MYSQL_OPT_BIND,opt_bind_addr); + if (!opt_secure_auth) + mysql_options(&mysql, MYSQL_SECURE_AUTH,(char*)&opt_secure_auth); #ifdef HAVE_SMEM if (shared_memory_base_name) mysql_options(&mysql,MYSQL_SHARED_MEMORY_BASE_NAME,shared_memory_base_name); @@ -244,6 +247,9 @@ static struct my_option my_long_options[] = {"protocol", OPT_MYSQL_PROTOCOL, "The protocol to use for connection (tcp, socket, pipe, memory).", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"secure-auth", OPT_SECURE_AUTH, "Refuse client connecting to server if it" + " uses old (pre-4.1.1) protocol.", &opt_secure_auth, + &opt_secure_auth, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, #ifdef HAVE_SMEM {"shared-memory-base-name", OPT_SHARED_MEMORY_BASE_NAME, "Base name of shared memory.", &shared_memory_base_name, diff --git a/mysql-wsrep-5.6/client/mysqlslap.c b/mysql-wsrep-5.6/client/mysqlslap.c index d75195fd..54585034 100644 --- a/mysql-wsrep-5.6/client/mysqlslap.c +++ b/mysql-wsrep-5.6/client/mysqlslap.c @@ -1,5 +1,5 @@ /* - Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2005, 2014, 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 @@ -126,6 +126,7 @@ static char *host= NULL, *opt_password= NULL, *user= NULL, *post_system= NULL, *opt_mysql_unix_port= NULL; static char *opt_plugin_dir= 0, *opt_default_auth= 0; +static my_bool opt_secure_auth= TRUE; static uint opt_enable_cleartext_plugin= 0; static my_bool using_opt_enable_cleartext_plugin= 0; @@ -346,6 +347,8 @@ int main(int argc, char **argv) #endif if (opt_protocol) mysql_options(&mysql,MYSQL_OPT_PROTOCOL,(char*)&opt_protocol); + if (!opt_secure_auth && slap_connect(&mysql)) + mysql_options(&mysql, MYSQL_SECURE_AUTH,(char*)&opt_secure_auth); #ifdef HAVE_SMEM if (shared_memory_base_name) mysql_options(&mysql,MYSQL_SHARED_MEMORY_BASE_NAME,shared_memory_base_name); @@ -684,6 +687,9 @@ static struct my_option my_long_options[] = {"query", 'q', "Query to run or file containing query to run.", &user_supplied_query, &user_supplied_query, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"secure-auth", OPT_SECURE_AUTH, "Refuse client connecting to server if it" + " uses old (pre-4.1.1) protocol.", &opt_secure_auth, + &opt_secure_auth, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, #ifdef HAVE_SMEM {"shared-memory-base-name", OPT_SHARED_MEMORY_BASE_NAME, "Base name of shared memory.", &shared_memory_base_name, diff --git a/mysql-wsrep-5.6/cmake/build_configurations/compiler_options.cmake b/mysql-wsrep-5.6/cmake/build_configurations/compiler_options.cmake index da1cce0e..a27ff7ac 100644 --- a/mysql-wsrep-5.6/cmake/build_configurations/compiler_options.cmake +++ b/mysql-wsrep-5.6/cmake/build_configurations/compiler_options.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2012, 2014, 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 @@ -43,47 +43,16 @@ IF(UNIX) SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 ${COMMON_CXX_FLAGS}") ENDIF() - # HPUX flags - IF(CMAKE_SYSTEM_NAME MATCHES "HP-UX") - IF(CMAKE_C_COMPILER_ID MATCHES "HP") - IF(CMAKE_SYSTEM_PROCESSOR MATCHES "ia64") - SET(COMMON_C_FLAGS "+DSitanium2 -mt -AC99") - SET(COMMON_CXX_FLAGS "+DSitanium2 -mt -Aa") - SET(CMAKE_C_FLAGS_DEBUG "+O0 -g ${COMMON_C_FLAGS}") - SET(CMAKE_CXX_FLAGS_DEBUG "+O0 -g ${COMMON_CXX_FLAGS}") - # We have seen compiler bugs with optimisation and -g, so disabled for now - SET(CMAKE_C_FLAGS_RELWITHDEBINFO "+O2 ${COMMON_C_FLAGS}") - SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "+O2 ${COMMON_CXX_FLAGS}") - ENDIF() - ENDIF() - SET(WITH_SSL no) - ENDIF() - - # Linux flags - IF(CMAKE_SYSTEM_NAME MATCHES "Linux") - IF(CMAKE_C_COMPILER_ID MATCHES "Intel") - SET(COMMON_C_FLAGS "-static-intel -static-libgcc -g -mp -restrict") - SET(COMMON_CXX_FLAGS "-static-intel -static-libgcc -g -mp -restrict") - IF(CMAKE_SYSTEM_PROCESSOR MATCHES "ia64") - SET(COMMON_C_FLAGS "${COMMON_C_FLAGS} -no-ftz -no-prefetch") - SET(COMMON_CXX_FLAGS "${COMMON_CXX_FLAGS} -no-ftz -no-prefetch") - ENDIF() - SET(CMAKE_C_FLAGS_DEBUG "${COMMON_C_FLAGS}") - SET(CMAKE_CXX_FLAGS_DEBUG "${COMMON_CXX_FLAGS}") - SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-O3 -unroll2 -ip ${COMMON_C_FLAGS}") - SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 -unroll2 -ip ${COMMON_CXX_FLAGS}") - SET(WITH_SSL no) - ENDIF() + # Default Clang flags + IF(CMAKE_C_COMPILER_ID MATCHES "Clang") + SET(COMMON_C_FLAGS "-g -fno-omit-frame-pointer -fno-strict-aliasing") + SET(CMAKE_C_FLAGS_DEBUG "${COMMON_C_FLAGS}") + SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-O3 ${COMMON_C_FLAGS}") ENDIF() - - # OSX flags - IF(APPLE) - SET(COMMON_C_FLAGS "-g -fno-strict-aliasing") - SET(COMMON_CXX_FLAGS "-g -fno-strict-aliasing") - SET(CMAKE_C_FLAGS_DEBUG "${COMMON_C_FLAGS}") + IF(CMAKE_CXX_COMPILER_ID MATCHES "Clang") + SET(COMMON_CXX_FLAGS "-g -fno-omit-frame-pointer -fno-strict-aliasing") SET(CMAKE_CXX_FLAGS_DEBUG "${COMMON_CXX_FLAGS}") - SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-Os ${COMMON_C_FLAGS}") - SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-Os ${COMMON_CXX_FLAGS}") + SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 ${COMMON_CXX_FLAGS}") ENDIF() # Solaris flags @@ -93,9 +62,15 @@ IF(UNIX) SET(WITH_MYSQLD_LDFLAGS "-lmtmalloc" CACHE STRING "") ENDIF() IF(CMAKE_C_COMPILER_ID MATCHES "SunPro") + + SET(SUNPRO_CXX_LIBRARY "stlport4" CACHE STRING + "What C++ library to use. The server needs stlport4. It is possible to build the client libraries with -DWITHOUT_SERVER=1 -DSUNPRO_CXX_LIBRARY=Cstd") + + MESSAGE(STATUS "SUNPRO_CXX_LIBRARY ${SUNPRO_CXX_LIBRARY}") + IF(CMAKE_SYSTEM_PROCESSOR MATCHES "i386") SET(COMMON_C_FLAGS "-g -mt -fsimple=1 -ftrap=%none -nofstore -xbuiltin=%all -xlibmil -xlibmopt -xtarget=generic") - SET(COMMON_CXX_FLAGS "-g0 -mt -fsimple=1 -ftrap=%none -nofstore -xbuiltin=%all -xlibmil -xlibmopt -xtarget=generic -library=stlport4") + SET(COMMON_CXX_FLAGS "-g0 -mt -fsimple=1 -ftrap=%none -nofstore -xbuiltin=%all -xlibmil -xlibmopt -xtarget=generic -library=${SUNPRO_CXX_LIBRARY}") # We have to specify "-xO1" for DEBUG flags here, # see http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6879978 SET(CMAKE_C_FLAGS_DEBUG "-xO1 ${COMMON_C_FLAGS}") @@ -110,7 +85,7 @@ IF(UNIX) ELSE() # Assume !x86 is SPARC SET(COMMON_C_FLAGS "-g -Xa -xstrconst -mt") - SET(COMMON_CXX_FLAGS "-g0 -mt -library=stlport4") + SET(COMMON_CXX_FLAGS "-g0 -mt -library=${SUNPRO_CXX_LIBRARY}") IF(32BIT) SET(COMMON_C_FLAGS "${COMMON_C_FLAGS} -xarch=sparc") SET(COMMON_CXX_FLAGS "${COMMON_CXX_FLAGS} -xarch=sparc") diff --git a/mysql-wsrep-5.6/cmake/build_configurations/feature_set.cmake b/mysql-wsrep-5.6/cmake/build_configurations/feature_set.cmake index 656a360f..29ad01a3 100644 --- a/mysql-wsrep-5.6/cmake/build_configurations/feature_set.cmake +++ b/mysql-wsrep-5.6/cmake/build_configurations/feature_set.cmake @@ -77,6 +77,5 @@ IF(FEATURE_SET) ENDFOREACH() ENDIF() -OPTION(ENABLED_LOCAL_INFILE "" ON) SET(WITH_SSL bundled CACHE STRING "") SET(WITH_ZLIB bundled CACHE STRING "") diff --git a/mysql-wsrep-5.6/cmake/build_configurations/mysql_release.cmake b/mysql-wsrep-5.6/cmake/build_configurations/mysql_release.cmake index 3cbb1b56..87dd43a5 100644 --- a/mysql-wsrep-5.6/cmake/build_configurations/mysql_release.cmake +++ b/mysql-wsrep-5.6/cmake/build_configurations/mysql_release.cmake @@ -19,6 +19,7 @@ INCLUDE(CheckIncludeFiles) INCLUDE(CheckLibraryExists) OPTION(DEBUG_EXTNAME "" ON) +OPTION(ENABLED_LOCAL_INFILE "" ON) IF(NOT COMPILATION_COMMENT) SET(COMPILATION_COMMENT "MySQL Community Server (GPL)") diff --git a/mysql-wsrep-5.6/cmake/compile_flags.cmake b/mysql-wsrep-5.6/cmake/compile_flags.cmake new file mode 100644 index 00000000..5e872f98 --- /dev/null +++ b/mysql-wsrep-5.6/cmake/compile_flags.cmake @@ -0,0 +1,44 @@ +# Copyright (c) 2014, 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 + + +## ADD_COMPILE_FLAGS( COMPILE_FLAGS ) +MACRO(ADD_COMPILE_FLAGS) + SET(FILES "") + SET(FLAGS "") + SET(COMPILE_FLAGS) + FOREACH(ARG ${ARGV}) + IF(ARG STREQUAL "COMPILE_FLAGS") + SET(COMPILE_FLAGS "COMPILE_FLAGS") + ELSEIF(COMPILE_FLAGS) + LIST(APPEND FLAGS ${ARG}) + ELSE() + LIST(APPEND FILES ${ARG}) + ENDIF() + ENDFOREACH() + FOREACH(FILE ${FILES}) + FOREACH(FLAG ${FLAGS}) + GET_SOURCE_FILE_PROPERTY(PROP ${FILE} COMPILE_FLAGS) + IF(NOT PROP) + SET(PROP ${FLAG}) + ELSE() + SET(PROP "${PROP} ${FLAG}") + ENDIF() + SET_SOURCE_FILES_PROPERTIES( + ${FILE} PROPERTIES COMPILE_FLAGS "${PROP}" + ) + ENDFOREACH() + ENDFOREACH() +ENDMACRO() diff --git a/mysql-wsrep-5.6/cmake/cpack_source_ignore_files.cmake b/mysql-wsrep-5.6/cmake/cpack_source_ignore_files.cmake index fdceba1d..078df6c6 100644 --- a/mysql-wsrep-5.6/cmake/cpack_source_ignore_files.cmake +++ b/mysql-wsrep-5.6/cmake/cpack_source_ignore_files.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2014, 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 @@ -14,9 +14,6 @@ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA SET(CPACK_SOURCE_IGNORE_FILES -\\\\.bzr/ -\\\\.bzr-mysql -\\\\.bzrignore CMakeCache\\\\.txt cmake_dist\\\\.cmake CPackSourceConfig\\\\.cmake diff --git a/mysql-wsrep-5.6/cmake/dtrace.cmake b/mysql-wsrep-5.6/cmake/dtrace.cmake index 771a28bc..400b8126 100644 --- a/mysql-wsrep-5.6/cmake/dtrace.cmake +++ b/mysql-wsrep-5.6/cmake/dtrace.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2014, 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 @@ -40,7 +40,16 @@ MACRO(CHECK_DTRACE) SET(ENABLE_DTRACE ON CACHE BOOL "Enable dtrace") ENDIF() SET(HAVE_DTRACE ${ENABLE_DTRACE}) - IF(CMAKE_SYSTEM_NAME MATCHES "SunOS") + EXECUTE_PROCESS( + COMMAND ${DTRACE} -V + OUTPUT_VARIABLE out) + IF(out MATCHES "Sun D" OR out MATCHES "Oracle D") + IF(NOT CMAKE_SYSTEM_NAME MATCHES "FreeBSD" AND + NOT CMAKE_SYSTEM_NAME MATCHES "Darwin") + SET(HAVE_REAL_DTRACE_INSTRUMENTING ON CACHE BOOL "Real DTrace detected") + ENDIF() + ENDIF() + IF(HAVE_REAL_DTRACE_INSTRUMENTING) IF(CMAKE_SIZEOF_VOID_P EQUAL 4) SET(DTRACE_FLAGS -32 CACHE INTERNAL "DTrace architecture flags") ELSE() @@ -93,7 +102,7 @@ FUNCTION(DTRACE_INSTRUMENT target) ADD_DEPENDENCIES(${target} gen_dtrace_header) # Invoke dtrace to generate object file and link it together with target. - IF(CMAKE_SYSTEM_NAME MATCHES "SunOS") + IF(HAVE_REAL_DTRACE_INSTRUMENTING) SET(objdir ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${target}.dir) SET(outfile ${objdir}/${target}_dtrace.o) GET_TARGET_PROPERTY(target_type ${target} TYPE) @@ -110,12 +119,22 @@ FUNCTION(DTRACE_INSTRUMENT target) WORKING_DIRECTORY ${objdir} ) ELSEIF(CMAKE_SYSTEM_NAME MATCHES "Linux") + # dtrace on Linux runs gcc and uses flags from environment + SET(CFLAGS_SAVED $ENV{CFLAGS}) + # We want to strip off all warning flags, including -Werror=xxx-xx, + # but keep flags like + # -Wp,-D_FORTIFY_SOURCE=2 + STRING(REGEX REPLACE "-W[A-Za-z0-9][-A-Za-z0-9=]+" "" + C_FLAGS "${CMAKE_C_FLAGS}") + + SET(ENV{CFLAGS} ${C_FLAGS}) SET(outfile "${CMAKE_BINARY_DIR}/probes_mysql.o") # Systemtap object EXECUTE_PROCESS( COMMAND ${DTRACE} -G -s ${CMAKE_SOURCE_DIR}/include/probes_mysql.d.base -o ${outfile} ) + SET(ENV{CFLAGS} ${CFLAGS_SAVED}) ENDIF() # Do not try to extend the library if we have not built the .o file @@ -151,7 +170,7 @@ ENDFUNCTION() # run them again through dtrace -G to generate an ELF file that links # to mysqld. MACRO (DTRACE_INSTRUMENT_STATIC_LIBS target libs) -IF(CMAKE_SYSTEM_NAME MATCHES "SunOS" AND ENABLE_DTRACE) +IF(HAVE_REAL_DTRACE_INSTRUMENTING AND ENABLE_DTRACE) # Filter out non-static libraries in the list, if any SET(static_libs) FOREACH(lib ${libs}) diff --git a/mysql-wsrep-5.6/cmake/info_macros.cmake.in b/mysql-wsrep-5.6/cmake/info_macros.cmake.in index 1b19134d..fc2f8849 100644 --- a/mysql-wsrep-5.6/cmake/info_macros.cmake.in +++ b/mysql-wsrep-5.6/cmake/info_macros.cmake.in @@ -1,4 +1,4 @@ -# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2014, 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 @@ -23,11 +23,14 @@ # If further variables are used in this file, add them to this list. SET(VERSION "@VERSION@") +SET(MAJOR_VERSION "@MAJOR_VERSION@") +SET(MINOR_VERSION "@MINOR_VERSION@") +SET(PATCH_VERSION "@PATCH_VERSION@") SET(CMAKE_SOURCE_DIR "@CMAKE_SOURCE_DIR@") SET(CMAKE_BINARY_DIR "@CMAKE_BINARY_DIR@") SET(CMAKE_GENERATOR "@CMAKE_GENERATOR@") SET(CMAKE_SIZEOF_VOID_P "@CMAKE_SIZEOF_VOID_P@") -SET(BZR_EXECUTABLE "@BZR_EXECUTABLE@") +SET(GIT_EXECUTABLE "@GIT_EXECUTABLE@") SET(CMAKE_CROSSCOMPILING "@CMAKE_CROSSCOMPILING@") SET(CMAKE_HOST_SYSTEM "@CMAKE_HOST_SYSTEM@") SET(CMAKE_HOST_SYSTEM_PROCESSOR "@CMAKE_HOST_SYSTEM_PROCESSOR@") @@ -36,34 +39,51 @@ SET(CMAKE_SYSTEM_PROCESSOR "@CMAKE_SYSTEM_PROCESSOR@") # Create an "INFO_SRC" file with information about the source (only). -# We use "bzr version-info", if possible, and the "VERSION" contents. +# We use "git log", if possible, and the "VERSION" contents. # -# Outside development (BZR tree), the "INFO_SRC" file will not be modified +# Outside development (git tree), the "INFO_SRC" file will not be modified # provided it exists (from "make dist" or a source tarball creation). MACRO(CREATE_INFO_SRC target_dir) SET(INFO_SRC "${target_dir}/INFO_SRC") - IF(BZR_EXECUTABLE AND EXISTS ${CMAKE_SOURCE_DIR}/.bzr) - # Sources are in a BZR repository: Always update. - # Add a timeout in case BZR hangs forever ... + SET(PERLSCRIPT + "use warnings; use POSIX qw(strftime); " + "print strftime \"%F %T %z\", localtime;") + EXECUTE_PROCESS( + COMMAND perl -e "${PERLSCRIPT}" + RESULT_VARIABLE result + OUTPUT_VARIABLE bdate + ERROR_VARIABLE error + ) + IF(error) + MESSAGE(STATUS "Could not determine build-date: <${error}>") + ENDIF() + + IF(GIT_EXECUTABLE AND EXISTS ${CMAKE_SOURCE_DIR}/.git) + # Sources are in a GIT repository: Always update. EXECUTE_PROCESS( - COMMAND ${BZR_EXECUTABLE} version-info ${CMAKE_SOURCE_DIR} + COMMAND ${GIT_EXECUTABLE} rev-parse --abbrev-ref HEAD + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + OUTPUT_VARIABLE bname + ) + + EXECUTE_PROCESS( + COMMAND ${GIT_EXECUTABLE} log -1 + --pretty="commit: %H%ndate: %ci%nbuild-date: ${bdate} %nshort: %h%nbranch: ${bname}" + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} OUTPUT_VARIABLE VERSION_INFO - RESULT_VARIABLE RESULT - ERROR_VARIABLE ERROR - TIMEOUT 10 ) - IF(NOT RESULT EQUAL 0) - MESSAGE(STATUS "Error from ${BZR_EXECUTABLE}: ${ERROR}") - SET(BZR_EXECUTABLE) - ENDIF() + + ## Output from git is quoted with "", remove them. + STRING(REPLACE "\"" "" VERSION_INFO "${VERSION_INFO}") FILE(WRITE ${INFO_SRC} "${VERSION_INFO}\n") # to debug, add: FILE(APPEND ${INFO_SRC} "\nResult ${RESULT}\n") # For better readability ... - FILE(APPEND ${INFO_SRC} "\nMySQL source ${VERSION}\n") + FILE(APPEND ${INFO_SRC} + "MySQL source ${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}\n") ELSEIF(EXISTS ${INFO_SRC}) - # Outside a BZR tree, there is no need to change an existing "INFO_SRC", + # Outside a git tree, there is no need to change an existing "INFO_SRC", # it cannot be improved. ELSEIF(EXISTS ${CMAKE_SOURCE_DIR}/Docs/INFO_SRC) # If we are building from a source distribution, it also contains "INFO_SRC". diff --git a/mysql-wsrep-5.6/cmake/info_src.cmake b/mysql-wsrep-5.6/cmake/info_src.cmake index 97776b70..ce9873cc 100644 --- a/mysql-wsrep-5.6/cmake/info_src.cmake +++ b/mysql-wsrep-5.6/cmake/info_src.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2014, 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 @@ -16,11 +16,11 @@ # The sole purpose of this cmake control file is to create the "INFO_SRC" file. -# As long as and "bzr pull" (or "bzr commit") is followed by a "cmake", +# As long as and "git pull" (or "git commit") is followed by a "cmake", # the call in top level "CMakeLists.txt" is sufficient. # This file is to provide a separate target for the "make" phase, -# to ensure the BZR revision-id is correct even after a sequence -# cmake ; make ; bzr pull ; make +# to ensure the git commit hash is correct even after a sequence +# cmake ; make ; git pull ; make # Get the macros which handle the "INFO_*" files. diff --git a/mysql-wsrep-5.6/cmake/install_macros.cmake b/mysql-wsrep-5.6/cmake/install_macros.cmake index 792d6fb6..83bd6bd0 100644 --- a/mysql-wsrep-5.6/cmake/install_macros.cmake +++ b/mysql-wsrep-5.6/cmake/install_macros.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2014, 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 @@ -21,26 +21,35 @@ MACRO (INSTALL_DEBUG_SYMBOLS targets) GET_TARGET_PROPERTY(location ${target} LOCATION) GET_TARGET_PROPERTY(type ${target} TYPE) IF(NOT INSTALL_LOCATION) - IF(type MATCHES "STATIC_LIBRARY" OR type MATCHES "MODULE_LIBRARY" OR type MATCHES "SHARED_LIBRARY") + IF(type MATCHES "STATIC_LIBRARY" + OR type MATCHES "MODULE_LIBRARY" + OR type MATCHES "SHARED_LIBRARY") SET(INSTALL_LOCATION "lib") ELSEIF(type MATCHES "EXECUTABLE") SET(INSTALL_LOCATION "bin") ELSE() - MESSAGE(FATAL_ERROR "cannot determine type of ${target}. Don't now where to install") + MESSAGE(FATAL_ERROR + "cannot determine type of ${target}. Don't now where to install") ENDIF() ENDIF() STRING(REPLACE ".exe" ".pdb" pdb_location ${location}) STRING(REPLACE ".dll" ".pdb" pdb_location ${pdb_location}) STRING(REPLACE ".lib" ".pdb" pdb_location ${pdb_location}) IF(CMAKE_GENERATOR MATCHES "Visual Studio") - STRING(REPLACE "${CMAKE_CFG_INTDIR}" "\${CMAKE_INSTALL_CONFIG_NAME}" pdb_location ${pdb_location}) + STRING(REPLACE + "${CMAKE_CFG_INTDIR}" "\${CMAKE_INSTALL_CONFIG_NAME}" + pdb_location ${pdb_location}) ENDIF() IF(target STREQUAL "mysqld") SET(comp Server) ELSE() SET(comp Debuginfo) ENDIF() - INSTALL(FILES ${pdb_location} DESTINATION ${INSTALL_LOCATION} COMPONENT ${comp}) + # No .pdb file for static libraries. + IF(NOT type MATCHES "STATIC_LIBRARY") + INSTALL(FILES ${pdb_location} + DESTINATION ${INSTALL_LOCATION} COMPONENT ${comp}) + ENDIF() ENDFOREACH() ENDIF() ENDMACRO() diff --git a/mysql-wsrep-5.6/cmake/libutils.cmake b/mysql-wsrep-5.6/cmake/libutils.cmake index 3967dbe9..3d210322 100644 --- a/mysql-wsrep-5.6/cmake/libutils.cmake +++ b/mysql-wsrep-5.6/cmake/libutils.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2014, 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 diff --git a/mysql-wsrep-5.6/cmake/maintainer.cmake b/mysql-wsrep-5.6/cmake/maintainer.cmake index 5360e8a9..c537d002 100644 --- a/mysql-wsrep-5.6/cmake/maintainer.cmake +++ b/mysql-wsrep-5.6/cmake/maintainer.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2010, 2014, 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 @@ -13,44 +13,39 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -INCLUDE(CheckCCompilerFlag) - -# Setup GCC (GNU C compiler) warning options. -MACRO(SET_MYSQL_MAINTAINER_GNU_C_OPTIONS) - SET(MY_MAINTAINER_WARNINGS - "-Wall -Wextra -Wunused -Wwrite-strings -Wno-strict-aliasing -Werror") - - CHECK_C_COMPILER_FLAG("-Wdeclaration-after-statement" - HAVE_DECLARATION_AFTER_STATEMENT) - IF(HAVE_DECLARATION_AFTER_STATEMENT) - SET(MY_MAINTAINER_DECLARATION_AFTER_STATEMENT - "-Wdeclaration-after-statement") - ENDIF() - SET(MY_MAINTAINER_C_WARNINGS - "${MY_MAINTAINER_WARNINGS} ${MY_MAINTAINER_DECLARATION_AFTER_STATEMENT}" - CACHE STRING "C warning options used in maintainer builds.") - # Do not make warnings in checks into errors. - SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Wno-error") -ENDMACRO() - - -# Setup G++ (GNU C++ compiler) warning options. -MACRO(SET_MYSQL_MAINTAINER_GNU_CXX_OPTIONS) - SET(MY_MAINTAINER_CXX_WARNINGS - "${MY_MAINTAINER_WARNINGS} -Wno-unused-parameter -Woverloaded-virtual" - CACHE STRING "C++ warning options used in maintainer builds.") -ENDMACRO() - -# Setup ICC (Intel C Compiler) warning options. -MACRO(SET_MYSQL_MAINTAINER_INTEL_C_OPTIONS) - SET(MY_MAINTAINER_WARNINGS "-Wcheck") - SET(MY_MAINTAINER_C_WARNINGS "${MY_MAINTAINER_WARNINGS}" - CACHE STRING "C warning options used in maintainer builds.") -ENDMACRO() - -# Setup ICPC (Intel C++ Compiler) warning options. -MACRO(SET_MYSQL_MAINTAINER_INTEL_CXX_OPTIONS) - SET(MY_MAINTAINER_CXX_WARNINGS "${MY_MAINTAINER_WARNINGS}" - CACHE STRING "C++ warning options used in maintainer builds.") -ENDMACRO() - +# Common warning flags for GCC, G++, Clang and Clang++ +SET(MY_WARNING_FLAGS "-Wall -Wextra -Wformat-security") +MY_CHECK_C_COMPILER_FLAG("-Wvla" HAVE_WVLA) # Requires GCC 4.3+ or Clang +IF(HAVE_WVLA) + SET(MY_WARNING_FLAGS "${MY_WARNING_FLAGS} -Wvla") +ENDIF() + +# Common warning flags for GCC and Clang +SET(MY_C_WARNING_FLAGS + "${MY_WARNING_FLAGS} -Wwrite-strings -Wdeclaration-after-statement") + +# Common warning flags for G++ and Clang++ +SET(MY_CXX_WARNING_FLAGS + "${MY_WARNING_FLAGS} -Woverloaded-virtual -Wno-unused-parameter") + +# Extra warning flags for Clang++ +IF(CMAKE_CXX_COMPILER_ID MATCHES "Clang") + SET(MY_CXX_WARNING_FLAGS + "${MY_CXX_WARNING_FLAGS} -Wno-null-conversion -Wno-unused-private-field") +ENDIF() + +# Turn on Werror (warning => error) when using maintainer mode. +IF(MYSQL_MAINTAINER_MODE) + SET(MY_C_WARNING_FLAGS "${MY_C_WARNING_FLAGS} -Werror") + SET(MY_CXX_WARNING_FLAGS "${MY_CXX_WARNING_FLAGS} -Werror") + SET(COMPILE_FLAG_WERROR 1) +ENDIF() + +# Set warning flags for GCC/Clang +IF(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang") + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${MY_C_WARNING_FLAGS}") +ENDIF() +# Set warning flags for G++/Clang++ +IF(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${MY_CXX_WARNING_FLAGS}") +ENDIF() diff --git a/mysql-wsrep-5.6/cmake/make_dist.cmake.in b/mysql-wsrep-5.6/cmake/make_dist.cmake.in index ada27c36..8b845b92 100644 --- a/mysql-wsrep-5.6/cmake/make_dist.cmake.in +++ b/mysql-wsrep-5.6/cmake/make_dist.cmake.in @@ -1,4 +1,4 @@ -# Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2014, 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 @@ -14,7 +14,7 @@ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # Make source distribution -# If bzr is present, run bzr export. +# If git is present, run git archive. # Otherwise, just run cpack with source configuration. SET(CMAKE_SOURCE_DIR "@CMAKE_SOURCE_DIR@") @@ -22,13 +22,12 @@ SET(CMAKE_BINARY_DIR "@CMAKE_BINARY_DIR@") SET(CPACK_SOURCE_PACKAGE_FILE_NAME "@CPACK_SOURCE_PACKAGE_FILE_NAME@") SET(CMAKE_CPACK_COMMAND "@CMAKE_CPACK_COMMAND@") SET(CMAKE_COMMAND "@CMAKE_COMMAND@") -SET(BZR_EXECUTABLE "@BZR_EXECUTABLE@") +SET(GIT_EXECUTABLE "@GIT_EXECUTABLE@") SET(GTAR_EXECUTABLE "@GTAR_EXECUTABLE@") SET(TAR_EXECUTABLE "@TAR_EXECUTABLE@") SET(CMAKE_GENERATOR "@CMAKE_GENERATOR@") SET(CMAKE_MAKE_PROGRAM "@CMAKE_MAKE_PROGRAM@") SET(CMAKE_SYSTEM_NAME "@CMAKE_SYSTEM_NAME@") -SET(PLUGIN_REPOS "@PLUGIN_REPOS@") SET(VERSION "@VERSION@") @@ -40,38 +39,54 @@ SET(PACKAGE_DIR ${CMAKE_BINARY_DIR}/${CPACK_SOURCE_PACKAGE_FILE_NAME}) FILE(REMOVE_RECURSE ${PACKAGE_DIR}) FILE(REMOVE ${PACKAGE_DIR}.tar.gz ) -IF(BZR_EXECUTABLE) - MESSAGE(STATUS "Running bzr export") +# Only allow git if source dir itself is a git repository +IF(GIT_EXECUTABLE) EXECUTE_PROCESS( - COMMAND "${BZR_EXECUTABLE}" export - ${PACKAGE_DIR} + COMMAND "${GIT_EXECUTABLE}" rev-parse --show-toplevel + OUTPUT_VARIABLE GIT_ROOT + ERROR_VARIABLE GIT_ROOT_ERROR + OUTPUT_STRIP_TRAILING_WHITESPACE WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} RESULT_VARIABLE RESULT ) - IF(NOT RESULT EQUAL 0) - SET(BZR_EXECUTABLE) + IF(NOT RESULT EQUAL 0 OR NOT GIT_ROOT STREQUAL ${CMAKE_SOURCE_DIR}) + MESSAGE(STATUS "This is not a git repository") + SET(GIT_EXECUTABLE) ENDIF() ENDIF() -IF(BZR_EXECUTABLE) - FOREACH(REPO ${PLUGIN_REPOS}) - GET_FILENAME_COMPONENT(PLUGIN_NAME ${REPO} NAME) - SET(DEST ${PACKAGE_DIR}/plugin/${PLUGIN_NAME}) - MESSAGE(STATUS "Running bzr export for plugin/${PLUGIN_NAME}") +IF(GIT_EXECUTABLE) + MESSAGE(STATUS "Running git archive -o ${PACKAGE_DIR}.tar") + EXECUTE_PROCESS( + COMMAND "${GIT_EXECUTABLE}" archive --format=tar + --prefix=${CPACK_SOURCE_PACKAGE_FILE_NAME}/ -o ${PACKAGE_DIR}.tar HEAD + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + RESULT_VARIABLE RESULT + ) + IF(NOT RESULT EQUAL 0) + SET(GIT_EXECUTABLE) + ELSE() + # Unpack tarball EXECUTE_PROCESS( - COMMAND "${BZR_EXECUTABLE}" export ${DEST} - WORKING_DIRECTORY ${REPO} - RESULT_VARIABLE RESULT + COMMAND ${CMAKE_COMMAND} -E tar xf ${PACKAGE_DIR}.tar + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + RESULT_VARIABLE TAR_RESULT ) - IF(NOT RESULT EQUAL 0) - MESSAGE(STATUS "bzr export failed") + IF(NOT TAR_RESULT EQUAL 0) + SET(GIT_EXECUTABLE) + ELSE() + # Remove tarball after unpacking + EXECUTE_PROCESS( + COMMAND ${CMAKE_COMMAND} -E remove ${PACKAGE_DIR}.tar + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + ) ENDIF() - ENDFOREACH() + ENDIF() ENDIF() -IF(NOT BZR_EXECUTABLE) - MESSAGE(STATUS "bzr not found or source dir is not a repo, use CPack") +IF(NOT GIT_EXECUTABLE) + MESSAGE(STATUS "git not found or source dir is not a repo, use CPack") IF(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR) # In-source build is the worst option, we have to cleanup source tree. diff --git a/mysql-wsrep-5.6/cmake/os/Darwin.cmake b/mysql-wsrep-5.6/cmake/os/Darwin.cmake index 53b9ad1e..4bb0a85d 100644 --- a/mysql-wsrep-5.6/cmake/os/Darwin.cmake +++ b/mysql-wsrep-5.6/cmake/os/Darwin.cmake @@ -15,24 +15,6 @@ # This file includes OSX specific options and quirks, related to system checks -# Workaround for CMake bug#9051 -# (CMake does not pass CMAKE_OSX_SYSROOT and CMAKE_OSX_DEPLOYMENT_TARGET when -# running TRY_COMPILE) - -IF(CMAKE_OSX_SYSROOT) - SET(ENV{CMAKE_OSX_SYSROOT} ${CMAKE_OSX_SYSROOT}) -ENDIF() -IF(CMAKE_OSX_SYSROOT) - SET(ENV{MACOSX_DEPLOYMENT_TARGET} ${OSX_DEPLOYMENT_TARGET}) -ENDIF() - -IF(CMAKE_OSX_DEPLOYMENT_TARGET) - # Workaround linker problems on OSX 10.4 - IF(CMAKE_OSX_DEPLOYMENT_TARGET VERSION_LESS "10.5") - ADD_DEFINITIONS(-fno-common) - ENDIF() -ENDIF() - # This is used for the version_compile_machine variable. IF(CMAKE_SIZEOF_VOID_P MATCHES 8) SET(MYSQL_MACHINE_TYPE "x86_64") diff --git a/mysql-wsrep-5.6/cmake/os/Linux.cmake b/mysql-wsrep-5.6/cmake/os/Linux.cmake index 5a1bd2f2..350e1503 100644 --- a/mysql-wsrep-5.6/cmake/os/Linux.cmake +++ b/mysql-wsrep-5.6/cmake/os/Linux.cmake @@ -20,7 +20,6 @@ INCLUDE(CheckSymbolExists) # Something that needs to be set on legacy reasons SET(TARGET_OS_LINUX 1) -SET(HAVE_NPTL 1) SET(_GNU_SOURCE 1) # Fix CMake (< 2.8) flags. -rdynamic exports too many symbols. diff --git a/mysql-wsrep-5.6/cmake/os/Windows.cmake b/mysql-wsrep-5.6/cmake/os/Windows.cmake index 06108445..d320bf3b 100644 --- a/mysql-wsrep-5.6/cmake/os/Windows.cmake +++ b/mysql-wsrep-5.6/cmake/os/Windows.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2010, 2014, 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 @@ -63,28 +63,37 @@ IF(MINGW AND CMAKE_SIZEOF_VOID_P EQUAL 4) ENDIF() IF(MSVC) - # Enable debug info also in Release build, and create PDB to be able to analyze - # crashes - FOREACH(lang C CXX) - SET(CMAKE_${lang}_FLAGS_RELEASE "${CMAKE_${lang}_FLAGS_RELEASE} /Zi") - ENDFOREACH() + # Enable debug info also in Release build, + # and create PDB to be able to analyze crashes. FOREACH(type EXE SHARED MODULE) - SET(CMAKE_{type}_LINKER_FLAGS_RELEASE "${CMAKE_${type}_LINKER_FLAGS_RELEASE} /debug") + SET(CMAKE_{type}_LINKER_FLAGS_RELEASE + "${CMAKE_${type}_LINKER_FLAGS_RELEASE} /debug") ENDFOREACH() - # Force static runtime libraries - # Choose C++ exception handling: - # If /EH is not specified, the compiler will catch structured and - # C++ exceptions, but will not destroy C++ objects that will go out of - # scope as a result of the exception. - # /EHsc catches C++ exceptions only and tells the compiler to assume that - # extern C functions never throw a C++ exception. + # For release types Debug Release RelWithDebInfo (but not MinSizeRel): + # - Force static runtime libraries + # - Choose C++ exception handling: + # If /EH is not specified, the compiler will catch structured and + # C++ exceptions, but will not destroy C++ objects that will go out of + # scope as a result of the exception. + # /EHsc catches C++ exceptions only and tells the compiler to assume that + # extern C functions never throw a C++ exception. + # - Choose debugging information: + # /Z7 + # Produces an .obj file containing full symbolic debugging + # information for use with the debugger. The symbolic debugging + # information includes the names and types of variables, as well as + # functions and line numbers. No .pdb file is produced by the compiler. + FOREACH(lang C CXX) + SET(CMAKE_${lang}_FLAGS_RELEASE "${CMAKE_${lang}_FLAGS_RELEASE} /Z7") + ENDFOREACH() FOREACH(flag - CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_RELWITHDEBINFO - CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_DEBUG_INIT + CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_RELWITHDEBINFO + CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_DEBUG_INIT CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_RELWITHDEBINFO - CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_DEBUG_INIT) + CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_DEBUG_INIT) STRING(REPLACE "/MD" "/MT" "${flag}" "${${flag}}") + STRING(REPLACE "/Zi" "/Z7" "${flag}" "${${flag}}") SET("${flag}" "${${flag}} /EHsc") ENDFOREACH() diff --git a/mysql-wsrep-5.6/cmake/os/WindowsCache.cmake b/mysql-wsrep-5.6/cmake/os/WindowsCache.cmake index ec40e9e7..a1764ad7 100644 --- a/mysql-wsrep-5.6/cmake/os/WindowsCache.cmake +++ b/mysql-wsrep-5.6/cmake/os/WindowsCache.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -20,6 +20,7 @@ # different results. IF(MSVC) +SET(HAVE_LLVM_LIBCPP CACHE INTERNAL "") SET(HAVE_ACCESS 1 CACHE INTERNAL "") SET(HAVE_AIO_H CACHE INTERNAL "") SET(HAVE_AIO_READ CACHE INTERNAL "") @@ -87,7 +88,7 @@ SET(HAVE_GETRLIMIT CACHE INTERNAL "") SET(HAVE_GETRUSAGE CACHE INTERNAL "") SET(HAVE_GETTIMEOFDAY CACHE INTERNAL "") SET(HAVE_GETWD CACHE INTERNAL "") -SET(HAVE_GMTIME_R CACHE INTERNAL "") +SET(HAVE_GMTIME_R 1 CACHE INTERNAL "") SET(HAVE_GRP_H CACHE INTERNAL "") SET(HAVE_IA64INTRIN_H CACHE INTERNAL "") SET(HAVE_IEEEFP_H CACHE INTERNAL "") @@ -110,7 +111,7 @@ SET(HAVE_LANGINFO_H CACHE INTERNAL "") SET(HAVE_LDIV 1 CACHE INTERNAL "") SET(HAVE_LIMITS_H 1 CACHE INTERNAL "") SET(HAVE_LOCALE_H 1 CACHE INTERNAL "") -SET(HAVE_LOCALTIME_R CACHE INTERNAL "") +SET(HAVE_LOCALTIME_R 1 CACHE INTERNAL "") SET(HAVE_LOG2 CACHE INTERNAL "") SET(HAVE_LONGJMP 1 CACHE INTERNAL "") SET(HAVE_LRAND48 CACHE INTERNAL "") diff --git a/mysql-wsrep-5.6/cmake/plugin.cmake b/mysql-wsrep-5.6/cmake/plugin.cmake index 2d70245d..e946f0ff 100644 --- a/mysql-wsrep-5.6/cmake/plugin.cmake +++ b/mysql-wsrep-5.6/cmake/plugin.cmake @@ -232,11 +232,4 @@ MACRO(CONFIGURE_PLUGINS) ADD_SUBDIRECTORY(${dir}) ENDIF() ENDFOREACH() - FOREACH(dir ${dirs_plugin}) - IF (EXISTS ${dir}/.bzr) - MESSAGE(STATUS "Found repo ${dir}/.bzr") - LIST(APPEND PLUGIN_BZR_REPOS "${dir}") - ENDIF() - ENDFOREACH() - SET(PLUGIN_REPOS "${PLUGIN_BZR_REPOS}" CACHE INTERNAL "") ENDMACRO() diff --git a/mysql-wsrep-5.6/cmake/ssl.cmake b/mysql-wsrep-5.6/cmake/ssl.cmake index 206d6f14..81719d2e 100644 --- a/mysql-wsrep-5.6/cmake/ssl.cmake +++ b/mysql-wsrep-5.6/cmake/ssl.cmake @@ -52,6 +52,9 @@ MACRO (MYSQL_USE_BUNDLED_SSL) ${CMAKE_SOURCE_DIR}/extra/yassl/taocrypt/include ) SET(SSL_LIBRARIES yassl taocrypt) + IF(CMAKE_SYSTEM_NAME MATCHES "SunOS") + SET(SSL_LIBRARIES ${SSL_LIBRARIES} ${LIBSOCKET}) + ENDIF() SET(SSL_INCLUDE_DIRS ${INC_DIRS}) SET(SSL_INTERNAL_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/extra/yassl/taocrypt/mySTL) SET(SSL_DEFINES "-DHAVE_YASSL -DYASSL_PREFIX -DHAVE_OPENSSL -DMULTI_THREADED") @@ -234,7 +237,7 @@ MACRO (MYSQL_CHECK_SSL) ENDIF() ELSE() MESSAGE(SEND_ERROR - "Wrong option for WITH_SSL. Valid values are : "${WITH_SSL_DOC}) + "Wrong option for WITH_SSL. Valid values are : ${WITH_SSL_DOC}") ENDIF() ENDMACRO() diff --git a/mysql-wsrep-5.6/config.h.cmake b/mysql-wsrep-5.6/config.h.cmake index 665ac6f2..987be271 100644 --- a/mysql-wsrep-5.6/config.h.cmake +++ b/mysql-wsrep-5.6/config.h.cmake @@ -1,4 +1,4 @@ -/* Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2009, 2014, 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 @@ -19,6 +19,7 @@ /* Headers we may want to use. */ #cmakedefine STDC_HEADERS 1 #cmakedefine _GNU_SOURCE 1 +#cmakedefine HAVE_LLVM_LIBCPP 1 #cmakedefine HAVE_ALLOCA_H 1 #cmakedefine HAVE_AIO_H 1 #cmakedefine HAVE_ARPA_INET_H 1 @@ -187,7 +188,6 @@ #cmakedefine HAVE_LSTAT 1 #cmakedefine HAVE_MEMALIGN 1 /* #cmakedefine HAVE_MLOCK 1 see Bug#54662 */ -#cmakedefine HAVE_NPTL 1 #cmakedefine HAVE_NL_LANGINFO 1 #cmakedefine HAVE_MADVISE 1 #cmakedefine HAVE_DECL_MADVISE 1 diff --git a/mysql-wsrep-5.6/configure.cmake b/mysql-wsrep-5.6/configure.cmake index 843bdf44..e1c17936 100644 --- a/mysql-wsrep-5.6/configure.cmake +++ b/mysql-wsrep-5.6/configure.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2014, 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 @@ -21,6 +21,7 @@ INCLUDE (CheckLibraryExists) INCLUDE (CheckFunctionExists) INCLUDE (CheckCCompilerFlag) INCLUDE (CheckCSourceRuns) +INCLUDE (CheckCXXSourceRuns) INCLUDE (CheckSymbolExists) @@ -57,40 +58,39 @@ ENDIF() # other threads. SET(SIGNAL_WITH_VIO_SHUTDOWN 1) -# Always enable -Wall for gnu C/C++ -# Remember to strip off these in scripts/CMakeLists.txt -IF(CMAKE_COMPILER_IS_GNUCXX) - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-unused-parameter") -ENDIF() -IF(CMAKE_COMPILER_IS_GNUCC) - SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall") -ENDIF() - -# Remember to strip off these in scripts/CMakeLists.txt -IF(CMAKE_CXX_COMPILER_ID MATCHES "Clang") - SET(CMAKE_CXX_FLAGS - "${CMAKE_CXX_FLAGS} -Wall -Wno-null-conversion -Wno-unused-private-field") -ENDIF() -IF(CMAKE_C_COMPILER_ID MATCHES "Clang") - SET(CMAKE_C_FLAGS - "${CMAKE_C_FLAGS} -Wall -Wno-null-conversion -Wno-unused-private-field") -ENDIF() - # The default C++ library for SunPro is really old, and not standards compliant. -# http://developers.sun.com/solaris/articles/cmp_stlport_libCstd.html +# http://www.oracle.com/technetwork/server-storage/solaris10/cmp-stlport-libcstd-142559.html # Use stlport rather than Rogue Wave. IF(CMAKE_SYSTEM_NAME MATCHES "SunOS") IF(CMAKE_CXX_COMPILER_ID MATCHES "SunPro") - SET(CMAKE_CXX_FLAGS - "${CMAKE_CXX_FLAGS} -library=stlport4") + IF(SUNPRO_CXX_LIBRARY) + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -library=${SUNPRO_CXX_LIBRARY}") + ELSE() + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -library=stlport4") + ENDIF() ENDIF() ENDIF() +# Check to see if we are using LLVM's libc++ rather than e.g. libstd++ +# Can then check HAVE_LLBM_LIBCPP later without including e.g. ciso646. +CHECK_CXX_SOURCE_RUNS(" +#include +int main() +{ +#ifdef _LIBCPP_VERSION + return 0; +#else + return 1; +#endif +}" HAVE_LLVM_LIBCPP) + MACRO(DIRNAME IN OUT) GET_FILENAME_COMPONENT(${OUT} ${IN} PATH) ENDMACRO() -IF(CMAKE_SYSTEM_NAME MATCHES "SunOS" AND CMAKE_C_COMPILER_ID MATCHES "SunPro") +IF(CMAKE_SYSTEM_NAME MATCHES "SunOS" AND + CMAKE_C_COMPILER_ID MATCHES "SunPro" AND + CMAKE_CXX_FLAGS MATCHES "stlport4") DIRNAME(${CMAKE_CXX_COMPILER} CXX_PATH) SET(STLPORT_SUFFIX "lib/stlport4") IF(CMAKE_SIZEOF_VOID_P EQUAL 8 AND CMAKE_SYSTEM_PROCESSOR MATCHES "sparc") diff --git a/mysql-wsrep-5.6/extra/mysql_waitpid.c b/mysql-wsrep-5.6/extra/mysql_waitpid.c index 23177eb5..9e0c76e0 100644 --- a/mysql-wsrep-5.6/extra/mysql_waitpid.c +++ b/mysql-wsrep-5.6/extra/mysql_waitpid.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2003, 2014, 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 @@ -64,6 +64,10 @@ int main(int argc, char *argv[]) progname= argv[0]; + fprintf(stderr, + "Warning: %s is deprecated and will be removed in a future version.\n", + progname); + if (handle_options(&argc, &argv, my_long_options, get_one_option)) exit(-1); if (!argv[0] || !argv[1] || (pid= atoi(argv[0])) <= 0 || diff --git a/mysql-wsrep-5.6/extra/replace.c b/mysql-wsrep-5.6/extra/replace.c index 09bdb60b..591e8d00 100644 --- a/mysql-wsrep-5.6/extra/replace.c +++ b/mysql-wsrep-5.6/extra/replace.c @@ -1,5 +1,5 @@ /* - Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2000, 2014, 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 @@ -1020,7 +1020,7 @@ FILE *in,*out; updated=retain=0; reset_buffer(); - while ((error=fill_buffer_retaining(fileno(in),retain)) > 0) + while ((error=fill_buffer_retaining(my_fileno(in),retain)) > 0) { end_of_line=buffer ; buffer[bufbytes]=0; /* Sentinel */ diff --git a/mysql-wsrep-5.6/extra/yassl/CMakeLists.txt b/mysql-wsrep-5.6/extra/yassl/CMakeLists.txt index ca23f333..8115b3da 100644 --- a/mysql-wsrep-5.6/extra/yassl/CMakeLists.txt +++ b/mysql-wsrep-5.6/extra/yassl/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -33,7 +33,6 @@ SET(YASSL_SOURCES src/buffer.cpp src/cert_wrapper.cpp src/crypto_wrapper.cpp sr ADD_CONVENIENCE_LIBRARY(yassl ${YASSL_SOURCES}) RESTRICT_SYMBOL_EXPORTS(yassl) -INSTALL_DEBUG_SYMBOLS(yassl) IF(MSVC) INSTALL_DEBUG_TARGET(yassl DESTINATION ${INSTALL_LIBDIR}/debug) ENDIF() diff --git a/mysql-wsrep-5.6/extra/yassl/README b/mysql-wsrep-5.6/extra/yassl/README index 24bdf32f..da399c3d 100644 --- a/mysql-wsrep-5.6/extra/yassl/README +++ b/mysql-wsrep-5.6/extra/yassl/README @@ -12,7 +12,71 @@ before calling SSL_new(); *** end Note *** -yaSSL Release notes, version 2.2.2 (7/5/2012) +yaSSL Release notes, version 2.3.7 (12/10/2014) + This release of yaSSL fixes the potential to process duplicate handshake + messages by explicitly marking/checking received handshake messages. + +yaSSL Release notes, version 2.3.6 (11/25/2014) + + This release of yaSSL fixes some valgrind warnings/errors including + uninitialized reads and off by one index errors induced from fuzzing + the handshake. These were reported by Oracle. + +yaSSL Release notes, version 2.3.5 (9/29/2014) + + This release of yaSSL fixes an RSA Padding check vulnerability reported by + Intel Security Advanced Threat Research team + +See normal build instructions below under 1.0.6. +See libcurl build instructions below under 1.3.0 and note in 1.5.8. + + +yaSSL Release notes, version 2.3.4 (8/15/2014) + + This release of yaSSL adds checking to the input_buffer class itself. + +See normal build instructions below under 1.0.6. +See libcurl build instructions below under 1.3.0 and note in 1.5.8. + + +yaSSL Release notes, version 2.3.2 (7/25/2014) + + This release of yaSSL updates test certs. + +See normal build instructions below under 1.0.6. +See libcurl build instructions below under 1.3.0 and note in 1.5.8. + + +*****************yaSSL Release notes, version 2.3.0 (12/5/2013) + + This release of yaSSL updates asm for newer GCC versions. + +See normal build instructions below under 1.0.6. +See libcurl build instructions below under 1.3.0 and note in 1.5.8. + + +*****************yaSSL Release notes, version 2.2.3 (4/23/2013) + + This release of yaSSL updates the test certificates as they were expired + +See normal build instructions below under 1.0.6. +See libcurl build instructions below under 1.3.0 and note in 1.5.8. + + +*****************yaSSL Release notes, version 2.2.2d (2/5/2013) + + This release of yaSSL contains countermeasuers for the Lucky 13 TLS 1.1 + CBC timing padding attack identified by Nadhem AlFardan and Kenneth Paterson + see: http://www.isg.rhul.ac.uk/tls/ + + It also adds SHA2 certificate verification and better checks for malicious + input. + +See normal build instructions below under 1.0.6. +See libcurl build instructions below under 1.3.0 and note in 1.5.8. + + +*****************yaSSL Release notes, version 2.2.2 (7/5/2012) This release of yaSSL contains bug fixes and more security checks around malicious certificates. diff --git a/mysql-wsrep-5.6/extra/yassl/certs/ca-cert.pem b/mysql-wsrep-5.6/extra/yassl/certs/ca-cert.pem index 6a0cf898..7e64eb47 100644 --- a/mysql-wsrep-5.6/extra/yassl/certs/ca-cert.pem +++ b/mysql-wsrep-5.6/extra/yassl/certs/ca-cert.pem @@ -1,56 +1,87 @@ +-----BEGIN CERTIFICATE----- +MIIEqjCCA5KgAwIBAgIJAJpBR82hFGKMMA0GCSqGSIb3DQEBBQUAMIGUMQswCQYD +VQQGEwJVUzEQMA4GA1UECAwHTW9udGFuYTEQMA4GA1UEBwwHQm96ZW1hbjERMA8G +A1UECgwIU2F3dG9vdGgxEzARBgNVBAsMCkNvbnN1bHRpbmcxGDAWBgNVBAMMD3d3 +dy53b2xmc3NsLmNvbTEfMB0GCSqGSIb3DQEJARYQaW5mb0B3b2xmc3NsLmNvbTAe +Fw0xNDA3MTEwMzIwMDhaFw0xNzA0MDYwMzIwMDhaMIGUMQswCQYDVQQGEwJVUzEQ +MA4GA1UECAwHTW9udGFuYTEQMA4GA1UEBwwHQm96ZW1hbjERMA8GA1UECgwIU2F3 +dG9vdGgxEzARBgNVBAsMCkNvbnN1bHRpbmcxGDAWBgNVBAMMD3d3dy53b2xmc3Ns +LmNvbTEfMB0GCSqGSIb3DQEJARYQaW5mb0B3b2xmc3NsLmNvbTCCASIwDQYJKoZI +hvcNAQEBBQADggEPADCCAQoCggEBAL8Myi0Ush6EQlvNOB9K8k11EPG2NZ/fyn0D +mNOs3gNm7irx2LB9bgdUCxCYIU2AyxIg58xP3kV9yXJ3MurKkLtpUhADL6jzlcXx +i2JWG+9nb6QQQZWtCpvjpcCw0nB2UDBbqOgILHztp6J6jTgpHKzH7fJ8lbCVgn1J +XDjNdyXvvYB1U5Q8PcpjW58VtdMdEy8Z0TzbdjrMuH3J5cLX2kBv2CHccxtCLVOc +/hr8fat6Nj+Y3oR8BWfOahQ4h6nxjLVoy2h/cSAr9aBj9VYvoybSt2+xWhfXOJkI +/pNYb/7DE0kIFgunTWcAUjFnI06Y7VFFHbkE2Qvs2CizS73tNnkCAwEAAaOB/DCB ++TAdBgNVHQ4EFgQUJ45nEXTDJh0/7TNjs6TYHTDl6NUwgckGA1UdIwSBwTCBvoAU +J45nEXTDJh0/7TNjs6TYHTDl6NWhgZqkgZcwgZQxCzAJBgNVBAYTAlVTMRAwDgYD +VQQIDAdNb250YW5hMRAwDgYDVQQHDAdCb3plbWFuMREwDwYDVQQKDAhTYXd0b290 +aDETMBEGA1UECwwKQ29uc3VsdGluZzEYMBYGA1UEAwwPd3d3LndvbGZzc2wuY29t +MR8wHQYJKoZIhvcNAQkBFhBpbmZvQHdvbGZzc2wuY29tggkAmkFHzaEUYowwDAYD +VR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOCAQEAeXgMbXmIkfw6FZz5J2IW8CEf ++n0/oqgyHvfyEal0FnRe3BjK8AAq1QMGJjDxR4P9Mm787apPfQxjYDEvfAy/mWaH +7ScIhi3EM+iYIxz+o9uaSU78WkLvccM/rdxKqNKjHQmsMwR7hvNtAFmjyNvRPHP2 +DpDWXkngvzZjCHulsI81O1aMETVJBBzQ57pWxQ0KkY3Wt2IZNBJSTNJtfMU9DxiB +VMv2POWE0tZxFewaNAvwoCF0Q8ijsN/ZZ9rirZNI+KCHvXkU4GIK3/cxLjF70TIq +Cv5dFO/ZZFDkg5G8cA3XiI3ZvIQOxRqzv2QCTlGRpKKFFYOv8FubKElfsrMD2A== +-----END CERTIFICATE----- Certificate: Data: Version: 3 (0x2) Serial Number: - 8a:37:22:65:73:f5:aa:e8 - Signature Algorithm: md5WithRSAEncryption - Issuer: C=US, ST=Montana, L=Bozeman, O=sawtooth, OU=consulting, CN=www.sawtooth-consulting.com/emailAddress=info@yassl.com + 9a:41:47:cd:a1:14:62:8c + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, ST=Montana, L=Bozeman, O=Sawtooth, OU=Consulting, CN=www.wolfssl.com/emailAddress=info@wolfssl.com Validity - Not Before: Jun 30 18:47:10 2010 GMT - Not After : Mar 26 18:47:10 2013 GMT - Subject: C=US, ST=Montana, L=Bozeman, O=sawtooth, OU=consulting, CN=www.sawtooth-consulting.com/emailAddress=info@yassl.com + Not Before: Jul 11 03:20:08 2014 GMT + Not After : Apr 6 03:20:08 2017 GMT + Subject: C=US, ST=Montana, L=Bozeman, O=Sawtooth, OU=Consulting, CN=www.wolfssl.com/emailAddress=info@wolfssl.com Subject Public Key Info: Public Key Algorithm: rsaEncryption - RSA Public Key: (512 bit) - Modulus (512 bit): - 00:97:30:b9:1a:92:ef:25:4f:ca:4c:11:31:95:1a: - e1:c0:10:19:0a:20:b9:37:80:1a:57:38:02:4e:1b: - c5:0f:28:4f:da:e3:c9:16:aa:50:bd:4a:fb:b7:71: - c7:35:cc:63:81:c1:dd:9d:33:f9:38:16:88:32:a0: - aa:56:23:03:a3 + Public-Key: (2048 bit) + Modulus: + 00:bf:0c:ca:2d:14:b2:1e:84:42:5b:cd:38:1f:4a: + f2:4d:75:10:f1:b6:35:9f:df:ca:7d:03:98:d3:ac: + de:03:66:ee:2a:f1:d8:b0:7d:6e:07:54:0b:10:98: + 21:4d:80:cb:12:20:e7:cc:4f:de:45:7d:c9:72:77: + 32:ea:ca:90:bb:69:52:10:03:2f:a8:f3:95:c5:f1: + 8b:62:56:1b:ef:67:6f:a4:10:41:95:ad:0a:9b:e3: + a5:c0:b0:d2:70:76:50:30:5b:a8:e8:08:2c:7c:ed: + a7:a2:7a:8d:38:29:1c:ac:c7:ed:f2:7c:95:b0:95: + 82:7d:49:5c:38:cd:77:25:ef:bd:80:75:53:94:3c: + 3d:ca:63:5b:9f:15:b5:d3:1d:13:2f:19:d1:3c:db: + 76:3a:cc:b8:7d:c9:e5:c2:d7:da:40:6f:d8:21:dc: + 73:1b:42:2d:53:9c:fe:1a:fc:7d:ab:7a:36:3f:98: + de:84:7c:05:67:ce:6a:14:38:87:a9:f1:8c:b5:68: + cb:68:7f:71:20:2b:f5:a0:63:f5:56:2f:a3:26:d2: + b7:6f:b1:5a:17:d7:38:99:08:fe:93:58:6f:fe:c3: + 13:49:08:16:0b:a7:4d:67:00:52:31:67:23:4e:98: + ed:51:45:1d:b9:04:d9:0b:ec:d8:28:b3:4b:bd:ed: + 36:79 Exponent: 65537 (0x10001) X509v3 extensions: X509v3 Subject Key Identifier: - 3B:66:FD:A0:40:C6:F4:E2:70:CF:21:1A:0C:4F:67:FE:B7:4B:42:09 + 27:8E:67:11:74:C3:26:1D:3F:ED:33:63:B3:A4:D8:1D:30:E5:E8:D5 X509v3 Authority Key Identifier: - keyid:3B:66:FD:A0:40:C6:F4:E2:70:CF:21:1A:0C:4F:67:FE:B7:4B:42:09 - DirName:/C=US/ST=Montana/L=Bozeman/O=sawtooth/OU=consulting/CN=www.sawtooth-consulting.com/emailAddress=info@yassl.com - serial:8A:37:22:65:73:F5:AA:E8 + keyid:27:8E:67:11:74:C3:26:1D:3F:ED:33:63:B3:A4:D8:1D:30:E5:E8:D5 + DirName:/C=US/ST=Montana/L=Bozeman/O=Sawtooth/OU=Consulting/CN=www.wolfssl.com/emailAddress=info@wolfssl.com + serial:9A:41:47:CD:A1:14:62:8C X509v3 Basic Constraints: CA:TRUE - Signature Algorithm: md5WithRSAEncryption - 32:65:a2:b1:dc:6d:e0:8d:8b:c8:58:29:8e:b8:18:4b:62:88: - 13:67:f8:6c:75:46:75:8f:8a:19:a6:a3:d5:3c:fc:57:4e:7a: - 68:a9:fc:93:dc:ae:29:7d:bb:4e:ec:ea:55:fa:a4:e3:00:61: - f4:b0:34:6d:d1:d5:a4:64:24:f8 ------BEGIN CERTIFICATE----- -MIIDQDCCAuqgAwIBAgIJAIo3ImVz9aroMA0GCSqGSIb3DQEBBAUAMIGeMQswCQYD -VQQGEwJVUzEQMA4GA1UECBMHTW9udGFuYTEQMA4GA1UEBxMHQm96ZW1hbjERMA8G -A1UEChMIc2F3dG9vdGgxEzARBgNVBAsTCmNvbnN1bHRpbmcxJDAiBgNVBAMTG3d3 -dy5zYXd0b290aC1jb25zdWx0aW5nLmNvbTEdMBsGCSqGSIb3DQEJARYOaW5mb0B5 -YXNzbC5jb20wHhcNMTAwNjMwMTg0NzEwWhcNMTMwMzI2MTg0NzEwWjCBnjELMAkG -A1UEBhMCVVMxEDAOBgNVBAgTB01vbnRhbmExEDAOBgNVBAcTB0JvemVtYW4xETAP -BgNVBAoTCHNhd3Rvb3RoMRMwEQYDVQQLEwpjb25zdWx0aW5nMSQwIgYDVQQDExt3 -d3cuc2F3dG9vdGgtY29uc3VsdGluZy5jb20xHTAbBgkqhkiG9w0BCQEWDmluZm9A -eWFzc2wuY29tMFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAJcwuRqS7yVPykwRMZUa -4cAQGQoguTeAGlc4Ak4bxQ8oT9rjyRaqUL1K+7dxxzXMY4HB3Z0z+TgWiDKgqlYj -A6MCAwEAAaOCAQcwggEDMB0GA1UdDgQWBBQ7Zv2gQMb04nDPIRoMT2f+t0tCCTCB -0wYDVR0jBIHLMIHIgBQ7Zv2gQMb04nDPIRoMT2f+t0tCCaGBpKSBoTCBnjELMAkG -A1UEBhMCVVMxEDAOBgNVBAgTB01vbnRhbmExEDAOBgNVBAcTB0JvemVtYW4xETAP -BgNVBAoTCHNhd3Rvb3RoMRMwEQYDVQQLEwpjb25zdWx0aW5nMSQwIgYDVQQDExt3 -d3cuc2F3dG9vdGgtY29uc3VsdGluZy5jb20xHTAbBgkqhkiG9w0BCQEWDmluZm9A -eWFzc2wuY29tggkAijciZXP1qugwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQQF -AANBADJlorHcbeCNi8hYKY64GEtiiBNn+Gx1RnWPihmmo9U8/FdOemip/JPcril9 -u07s6lX6pOMAYfSwNG3R1aRkJPg= ------END CERTIFICATE----- + Signature Algorithm: sha1WithRSAEncryption + 79:78:0c:6d:79:88:91:fc:3a:15:9c:f9:27:62:16:f0:21:1f: + fa:7d:3f:a2:a8:32:1e:f7:f2:11:a9:74:16:74:5e:dc:18:ca: + f0:00:2a:d5:03:06:26:30:f1:47:83:fd:32:6e:fc:ed:aa:4f: + 7d:0c:63:60:31:2f:7c:0c:bf:99:66:87:ed:27:08:86:2d:c4: + 33:e8:98:23:1c:fe:a3:db:9a:49:4e:fc:5a:42:ef:71:c3:3f: + ad:dc:4a:a8:d2:a3:1d:09:ac:33:04:7b:86:f3:6d:00:59:a3: + c8:db:d1:3c:73:f6:0e:90:d6:5e:49:e0:bf:36:63:08:7b:a5: + b0:8f:35:3b:56:8c:11:35:49:04:1c:d0:e7:ba:56:c5:0d:0a: + 91:8d:d6:b7:62:19:34:12:52:4c:d2:6d:7c:c5:3d:0f:18:81: + 54:cb:f6:3c:e5:84:d2:d6:71:15:ec:1a:34:0b:f0:a0:21:74: + 43:c8:a3:b0:df:d9:67:da:e2:ad:93:48:f8:a0:87:bd:79:14: + e0:62:0a:df:f7:31:2e:31:7b:d1:32:2a:0a:fe:5d:14:ef:d9: + 64:50:e4:83:91:bc:70:0d:d7:88:8d:d9:bc:84:0e:c5:1a:b3: + bf:64:02:4e:51:91:a4:a2:85:15:83:af:f0:5b:9b:28:49:5f: + b2:b3:03:d8 diff --git a/mysql-wsrep-5.6/extra/yassl/certs/ca-key.pem b/mysql-wsrep-5.6/extra/yassl/certs/ca-key.pem index 45d7b149..774feba0 100644 --- a/mysql-wsrep-5.6/extra/yassl/certs/ca-key.pem +++ b/mysql-wsrep-5.6/extra/yassl/certs/ca-key.pem @@ -1,9 +1,27 @@ -----BEGIN RSA PRIVATE KEY----- -MIIBOQIBAAJBAJcwuRqS7yVPykwRMZUa4cAQGQoguTeAGlc4Ak4bxQ8oT9rjyRaq -UL1K+7dxxzXMY4HB3Z0z+TgWiDKgqlYjA6MCAwEAAQJAEQ9TY7c+uuQU/J5YDO4a -mRR37tegbq3Kyxqrz+p8QuhqLDtVh13GaF7rVU70vyNHm+cgihUyzho/PViAkPBo -qQIhAMU8/RDhDLgL5BxID4sxKIVBtg+imFSbyKVyg7oQLUcXAiEAxDu94O45Cf4a -np9R0thumY/QqWpCkycWAB7fFEuaf1UCIEH+bg4/vqm2ENUFp23DPPOZUPlaRe3J -UhFJh5mx3/RxAiBq++8vfHFYg1Lb/BxOCXVy/zdRxf753ytdcXdJx1Y56QIgVgpN -FNfYJofQfWaP96sjlc0usrT28uceHx0QmHqolVc= +MIIEpAIBAAKCAQEAvwzKLRSyHoRCW804H0ryTXUQ8bY1n9/KfQOY06zeA2buKvHY +sH1uB1QLEJghTYDLEiDnzE/eRX3Jcncy6sqQu2lSEAMvqPOVxfGLYlYb72dvpBBB +la0Km+OlwLDScHZQMFuo6AgsfO2nonqNOCkcrMft8nyVsJWCfUlcOM13Je+9gHVT +lDw9ymNbnxW10x0TLxnRPNt2Osy4fcnlwtfaQG/YIdxzG0ItU5z+Gvx9q3o2P5je +hHwFZ85qFDiHqfGMtWjLaH9xICv1oGP1Vi+jJtK3b7FaF9c4mQj+k1hv/sMTSQgW +C6dNZwBSMWcjTpjtUUUduQTZC+zYKLNLve02eQIDAQABAoIBAD1uTmAahH+dhXzh +Swd84NaZKt6d+TY0DncOPgjqT+UGJtT2OPffDQ8cLgai9CponGNy4zXmBJGRtcGx +pFSs18b7QaDWdW+9C06/sVLoX0kmmFZHx97p6jxgAb8o3DG/SV+TSYd6gVuWS03K +XDhPt+Gy08ch2jwShwfkG9xD7OjsVGHn9u2mCy7134J/xh9hGZykgznfIYWJb3ev +hhUyCKJaCyZh+3AMypw4fbwi7uujqBYA+YqAHgCEqEpB+IQDZy8jWy+baybDBzSU +owM7ctWfcuCtzDSrvcfV9SYwhQ8wIzlS/zzLmSFNiKWr7mK5x+C7R4fBac9z8zC+ +zjkEnOUCgYEA4XZFgFm200nfCu8S1g/wt8sqN7+n+LVN9TE1reSjlKHb8ZattQVk +hYP8G1spqr74Jj92fq0c8MvXJrQbBY5Whn4IYiHBhtZHeT63XaTGOtexdCD2UJdB +BFPtPybWb5H6aCbsKtya8efc+3PweUMbIaNZBGNSB8nX5tEbXV6W+lMCgYEA2O1O +ZGFrkQxhAbUPu0RnUx7cB8Qkfp5shCORDOQSBBZNeJjMlj0gTg9Fmrb4s5MNsqIb +KfImecjF0nh+XnPy13Bhu0DOYQX+aR6CKeYUuKHnltAjPwWTAPLhTX7tt5Zs9/Dk +0c8BmE/cdFSqbV5aQTH+/5q2oAXdqRBU+GvQqoMCgYAh0wSKROtQt3xmv4cr5ihO +6oPi6TXh8hFH/6H1/J8t5TqB/AEDb1OtVCe2Uu7lVtETq+GzD3WQCoS0ocCMDNae +RrorPrUx7WO7pNUNj3LN0R4mNeu+G3L9mzm0h7cT9eqDRZOYuo/kSsy0TKh/CLpB +SahJKD1ePcHONwDL+SzdUQKBgQChV58+udavg22DP4/70NyozgMJI7GhG2PKxElW +NSvRLmVglQVVmRE1/dXfRMeliHJfsoJRqHFFkzbPXB9hUQwFgOivxXu6XiLjPHXD +hAVVbdY6LYSJkzPLONqqMQXNzmwt3VXTVwvwpTVqsK4xukOWygDHS+MZEkPTQvpv +6oDA0QKBgQC524kgNCdwYjTqXyViEvOdgb9I7poOwY0Q/2WanS0aipRayMClpYRh +ntQkue+pncl3C8dwZj26yFTf0jPh9X/5J2G+V0Xdt0UXJPUj5DgOkSfu4yDYFMiU +R3dAd0UYng3OeT9XMVYJSWe+lFhP9sSr4onj44rABVUsJMBKlwQnmg== -----END RSA PRIVATE KEY----- diff --git a/mysql-wsrep-5.6/extra/yassl/certs/client-cert.der b/mysql-wsrep-5.6/extra/yassl/certs/client-cert.der index c2a75119..293985ad 100644 Binary files a/mysql-wsrep-5.6/extra/yassl/certs/client-cert.der and b/mysql-wsrep-5.6/extra/yassl/certs/client-cert.der differ diff --git a/mysql-wsrep-5.6/extra/yassl/certs/client-cert.pem b/mysql-wsrep-5.6/extra/yassl/certs/client-cert.pem index 7acc9a85..38330d53 100644 --- a/mysql-wsrep-5.6/extra/yassl/certs/client-cert.pem +++ b/mysql-wsrep-5.6/extra/yassl/certs/client-cert.pem @@ -2,54 +2,86 @@ Certificate: Data: Version: 3 (0x2) Serial Number: - c5:d7:6c:11:36:f0:35:e1 - Signature Algorithm: md5WithRSAEncryption - Issuer: C=US, ST=Oregon, L=Portland, O=yaSSL, OU=programming, CN=www.yassl.com/emailAddress=info@yassl.com + b6:63:af:8f:5d:62:57:a0 + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, ST=Montana, L=Bozeman, O=wolfSSL, OU=Programming, CN=www.wolfssl.com/emailAddress=info@wolfssl.com Validity - Not Before: Jun 30 18:39:39 2010 GMT - Not After : Mar 26 18:39:40 2013 GMT - Subject: C=US, ST=Oregon, L=Portland, O=yaSSL, OU=programming, CN=www.yassl.com/emailAddress=info@yassl.com + Not Before: Jul 11 17:39:44 2014 GMT + Not After : Apr 6 17:39:44 2017 GMT + Subject: C=US, ST=Montana, L=Bozeman, O=wolfSSL, OU=Programming, CN=www.wolfssl.com/emailAddress=info@wolfssl.com Subject Public Key Info: Public Key Algorithm: rsaEncryption - RSA Public Key: (512 bit) - Modulus (512 bit): - 00:bd:51:4a:14:fd:6a:19:84:0c:33:38:fc:27:32: - 9c:97:0b:fc:a4:18:60:69:4e:d9:d8:78:50:0b:e9: - 20:5d:d6:1d:70:1c:0c:24:9f:23:82:cc:3a:01:d5: - 97:17:b2:73:6c:86:cf:b5:f1:e5:ce:68:0c:d9:a2: - 12:39:7c:f2:53 + Public-Key: (2048 bit) + Modulus: + 00:c3:03:d1:2b:fe:39:a4:32:45:3b:53:c8:84:2b: + 2a:7c:74:9a:bd:aa:2a:52:07:47:d6:a6:36:b2:07: + 32:8e:d0:ba:69:7b:c6:c3:44:9e:d4:81:48:fd:2d: + 68:a2:8b:67:bb:a1:75:c8:36:2c:4a:d2:1b:f7:8b: + ba:cf:0d:f9:ef:ec:f1:81:1e:7b:9b:03:47:9a:bf: + 65:cc:7f:65:24:69:a6:e8:14:89:5b:e4:34:f7:c5: + b0:14:93:f5:67:7b:3a:7a:78:e1:01:56:56:91:a6: + 13:42:8d:d2:3c:40:9c:4c:ef:d1:86:df:37:51:1b: + 0c:a1:3b:f5:f1:a3:4a:35:e4:e1:ce:96:df:1b:7e: + bf:4e:97:d0:10:e8:a8:08:30:81:af:20:0b:43:14: + c5:74:67:b4:32:82:6f:8d:86:c2:88:40:99:36:83: + ba:1e:40:72:22:17:d7:52:65:24:73:b0:ce:ef:19: + cd:ae:ff:78:6c:7b:c0:12:03:d4:4e:72:0d:50:6d: + 3b:a3:3b:a3:99:5e:9d:c8:d9:0c:85:b3:d9:8a:d9: + 54:26:db:6d:fa:ac:bb:ff:25:4c:c4:d1:79:f4:71: + d3:86:40:18:13:b0:63:b5:72:4e:30:c4:97:84:86: + 2d:56:2f:d7:15:f7:7f:c0:ae:f5:fc:5b:e5:fb:a1: + ba:d3 Exponent: 65537 (0x10001) X509v3 extensions: X509v3 Subject Key Identifier: - 5C:F7:29:21:69:7A:09:78:9E:7B:CD:53:42:02:EC:CE:29:0D:11:DF + 33:D8:45:66:D7:68:87:18:7E:54:0D:70:27:91:C7:26:D7:85:65:C0 X509v3 Authority Key Identifier: - keyid:5C:F7:29:21:69:7A:09:78:9E:7B:CD:53:42:02:EC:CE:29:0D:11:DF - DirName:/C=US/ST=Oregon/L=Portland/O=yaSSL/OU=programming/CN=www.yassl.com/emailAddress=info@yassl.com - serial:C5:D7:6C:11:36:F0:35:E1 + keyid:33:D8:45:66:D7:68:87:18:7E:54:0D:70:27:91:C7:26:D7:85:65:C0 + DirName:/C=US/ST=Montana/L=Bozeman/O=wolfSSL/OU=Programming/CN=www.wolfssl.com/emailAddress=info@wolfssl.com + serial:B6:63:AF:8F:5D:62:57:A0 X509v3 Basic Constraints: CA:TRUE - Signature Algorithm: md5WithRSAEncryption - b4:a5:f1:71:26:4d:b9:ff:54:f3:09:1f:ac:e1:19:59:e5:ec: - 57:e3:f1:0b:b2:8f:f3:29:eb:6b:c6:fa:27:33:3e:91:d0:77: - 43:c9:ce:1e:0f:71:07:a9:f7:26:e0:7e:ff:30:7d:52:0a:e1: - 80:48:46:bb:99:e9:d9:77:ce:75 + Signature Algorithm: sha1WithRSAEncryption + 85:10:90:c5:5d:de:25:8c:f2:57:7b:2d:14:1c:05:f9:71:63: + 40:b0:e3:c1:c1:2e:13:2a:7a:b7:d6:24:58:87:eb:03:fb:0d: + af:e0:f4:d0:c8:bc:51:36:10:4f:79:cc:4f:66:7d:af:99:cb: + 7b:ce:68:94:c6:36:aa:42:6e:8c:78:5b:b2:85:ca:d1:e1:a8: + 31:d1:81:d9:f9:c1:a3:9e:34:43:ef:0a:79:7d:3e:83:61:fc: + 14:5c:d1:dd:bc:0e:d7:51:b7:71:6e:41:7e:8b:2c:5a:9a:cb: + 77:4b:6a:f5:06:ff:02:af:1e:e6:63:4f:bc:44:d9:3f:56:9e: + 09:9c:43:f9:55:21:32:46:82:09:86:a9:7b:74:1c:9e:5a:2a: + bf:03:79:91:cb:f2:29:7f:c9:15:82:89:b9:53:cd:7e:07:90: + a9:5d:76:e1:19:5e:0d:58:b8:59:d5:0d:df:23:ab:6b:63:76: + 19:9e:9c:df:b0:57:49:6c:d0:86:97:c3:6c:3c:fa:e0:56:c2: + 1b:e3:a1:42:1a:58:62:85:9d:74:19:83:08:af:59:90:f8:99: + bd:67:d3:4a:ea:0e:c9:ca:61:8a:0d:8a:42:cc:90:e9:2e:c2: + 54:73:7f:5e:af:8d:e2:32:cb:45:20:d6:19:4d:5b:77:31:cc: + 0f:2d:c0:7e -----BEGIN CERTIFICATE----- -MIIDDjCCArigAwIBAgIJAMXXbBE28DXhMA0GCSqGSIb3DQEBBAUAMIGOMQswCQYD -VQQGEwJVUzEPMA0GA1UECBMGT3JlZ29uMREwDwYDVQQHEwhQb3J0bGFuZDEOMAwG -A1UEChMFeWFTU0wxFDASBgNVBAsTC3Byb2dyYW1taW5nMRYwFAYDVQQDEw13d3cu -eWFzc2wuY29tMR0wGwYJKoZIhvcNAQkBFg5pbmZvQHlhc3NsLmNvbTAeFw0xMDA2 -MzAxODM5MzlaFw0xMzAzMjYxODM5NDBaMIGOMQswCQYDVQQGEwJVUzEPMA0GA1UE -CBMGT3JlZ29uMREwDwYDVQQHEwhQb3J0bGFuZDEOMAwGA1UEChMFeWFTU0wxFDAS -BgNVBAsTC3Byb2dyYW1taW5nMRYwFAYDVQQDEw13d3cueWFzc2wuY29tMR0wGwYJ -KoZIhvcNAQkBFg5pbmZvQHlhc3NsLmNvbTBcMA0GCSqGSIb3DQEBAQUAA0sAMEgC -QQC9UUoU/WoZhAwzOPwnMpyXC/ykGGBpTtnYeFAL6SBd1h1wHAwknyOCzDoB1ZcX -snNshs+18eXOaAzZohI5fPJTAgMBAAGjgfYwgfMwHQYDVR0OBBYEFFz3KSFpegl4 -nnvNU0IC7M4pDRHfMIHDBgNVHSMEgbswgbiAFFz3KSFpegl4nnvNU0IC7M4pDRHf -oYGUpIGRMIGOMQswCQYDVQQGEwJVUzEPMA0GA1UECBMGT3JlZ29uMREwDwYDVQQH -EwhQb3J0bGFuZDEOMAwGA1UEChMFeWFTU0wxFDASBgNVBAsTC3Byb2dyYW1taW5n -MRYwFAYDVQQDEw13d3cueWFzc2wuY29tMR0wGwYJKoZIhvcNAQkBFg5pbmZvQHlh -c3NsLmNvbYIJAMXXbBE28DXhMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEEBQAD -QQC0pfFxJk25/1TzCR+s4RlZ5exX4/ELso/zKetrxvonMz6R0HdDyc4eD3EHqfcm -4H7/MH1SCuGASEa7menZd851 +MIIEqjCCA5KgAwIBAgIJALZjr49dYlegMA0GCSqGSIb3DQEBBQUAMIGUMQswCQYD +VQQGEwJVUzEQMA4GA1UECAwHTW9udGFuYTEQMA4GA1UEBwwHQm96ZW1hbjEQMA4G +A1UECgwHd29sZlNTTDEUMBIGA1UECwwLUHJvZ3JhbW1pbmcxGDAWBgNVBAMMD3d3 +dy53b2xmc3NsLmNvbTEfMB0GCSqGSIb3DQEJARYQaW5mb0B3b2xmc3NsLmNvbTAe +Fw0xNDA3MTExNzM5NDRaFw0xNzA0MDYxNzM5NDRaMIGUMQswCQYDVQQGEwJVUzEQ +MA4GA1UECAwHTW9udGFuYTEQMA4GA1UEBwwHQm96ZW1hbjEQMA4GA1UECgwHd29s +ZlNTTDEUMBIGA1UECwwLUHJvZ3JhbW1pbmcxGDAWBgNVBAMMD3d3dy53b2xmc3Ns +LmNvbTEfMB0GCSqGSIb3DQEJARYQaW5mb0B3b2xmc3NsLmNvbTCCASIwDQYJKoZI +hvcNAQEBBQADggEPADCCAQoCggEBAMMD0Sv+OaQyRTtTyIQrKnx0mr2qKlIHR9am +NrIHMo7Quml7xsNEntSBSP0taKKLZ7uhdcg2LErSG/eLus8N+e/s8YEee5sDR5q/ +Zcx/ZSRppugUiVvkNPfFsBST9Wd7Onp44QFWVpGmE0KN0jxAnEzv0YbfN1EbDKE7 +9fGjSjXk4c6W3xt+v06X0BDoqAgwga8gC0MUxXRntDKCb42GwohAmTaDuh5AciIX +11JlJHOwzu8Zza7/eGx7wBID1E5yDVBtO6M7o5lencjZDIWz2YrZVCbbbfqsu/8l +TMTRefRx04ZAGBOwY7VyTjDEl4SGLVYv1xX3f8Cu9fxb5fuhutMCAwEAAaOB/DCB ++TAdBgNVHQ4EFgQUM9hFZtdohxh+VA1wJ5HHJteFZcAwgckGA1UdIwSBwTCBvoAU +M9hFZtdohxh+VA1wJ5HHJteFZcChgZqkgZcwgZQxCzAJBgNVBAYTAlVTMRAwDgYD +VQQIDAdNb250YW5hMRAwDgYDVQQHDAdCb3plbWFuMRAwDgYDVQQKDAd3b2xmU1NM +MRQwEgYDVQQLDAtQcm9ncmFtbWluZzEYMBYGA1UEAwwPd3d3LndvbGZzc2wuY29t +MR8wHQYJKoZIhvcNAQkBFhBpbmZvQHdvbGZzc2wuY29tggkAtmOvj11iV6AwDAYD +VR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOCAQEAhRCQxV3eJYzyV3stFBwF+XFj +QLDjwcEuEyp6t9YkWIfrA/sNr+D00Mi8UTYQT3nMT2Z9r5nLe85olMY2qkJujHhb +soXK0eGoMdGB2fnBo540Q+8KeX0+g2H8FFzR3bwO11G3cW5BfossWprLd0tq9Qb/ +Aq8e5mNPvETZP1aeCZxD+VUhMkaCCYape3QcnloqvwN5kcvyKX/JFYKJuVPNfgeQ +qV124RleDVi4WdUN3yOra2N2GZ6c37BXSWzQhpfDbDz64FbCG+OhQhpYYoWddBmD +CK9ZkPiZvWfTSuoOycphig2KQsyQ6S7CVHN/Xq+N4jLLRSDWGU1bdzHMDy3Afg== -----END CERTIFICATE----- diff --git a/mysql-wsrep-5.6/extra/yassl/certs/client-key.der b/mysql-wsrep-5.6/extra/yassl/certs/client-key.der index 6e8b432a..94dc253a 100644 Binary files a/mysql-wsrep-5.6/extra/yassl/certs/client-key.der and b/mysql-wsrep-5.6/extra/yassl/certs/client-key.der differ diff --git a/mysql-wsrep-5.6/extra/yassl/certs/client-key.pem b/mysql-wsrep-5.6/extra/yassl/certs/client-key.pem index 92c052fe..c4e7ad22 100644 --- a/mysql-wsrep-5.6/extra/yassl/certs/client-key.pem +++ b/mysql-wsrep-5.6/extra/yassl/certs/client-key.pem @@ -1,9 +1,27 @@ -----BEGIN RSA PRIVATE KEY----- -MIIBPAIBAAJBAL1RShT9ahmEDDM4/CcynJcL/KQYYGlO2dh4UAvpIF3WHXAcDCSf -I4LMOgHVlxeyc2yGz7Xx5c5oDNmiEjl88lMCAwEAAQJAVGHWLlLhpqvXsEEXCvWh -HCYono+K8YVGzhiaPSTU212fCoQryIxsXQKGBjhFdZm96DZWp+Vd/t/u+B4ZeaqY -+QIhAOBEfbFtdZqk5OmbbRsRVPI7+YYmubgY1TVIPqmxHQ4NAiEA2BrTQkjOb3ul -A/SZO04fJUZsm7Ng92FWHDJsRancSd8CIQCmGbQqZBK1TamJZ6dAY+7RViAx/p6Q -vjuzMeXPUrFdRQIhAMkfBhg9bCqjFyt8PBPOm/vz8+ZgZlE0/JAXeV7IPCVfAiEA -gZwCFm1ghGxmaoB424YC4DHeDeN/g9xwJHT7EuM9Mvc= +MIIEpAIBAAKCAQEAwwPRK/45pDJFO1PIhCsqfHSavaoqUgdH1qY2sgcyjtC6aXvG +w0Se1IFI/S1oootnu6F1yDYsStIb94u6zw357+zxgR57mwNHmr9lzH9lJGmm6BSJ +W+Q098WwFJP1Z3s6enjhAVZWkaYTQo3SPECcTO/Rht83URsMoTv18aNKNeThzpbf +G36/TpfQEOioCDCBryALQxTFdGe0MoJvjYbCiECZNoO6HkByIhfXUmUkc7DO7xnN +rv94bHvAEgPUTnINUG07ozujmV6dyNkMhbPZitlUJttt+qy7/yVMxNF59HHThkAY +E7BjtXJOMMSXhIYtVi/XFfd/wK71/Fvl+6G60wIDAQABAoIBAQCi5thfEHFkCJ4u +bdFtHoXSCrGMR84sUWqgEp5T3pFMHW3qWXvyd6rZxtmKq9jhFuRjJv+1bBNZuOOl +yHIXLgyfb+VZP3ZvSbERwlouFikN3reO3EDVou7gHqH0vpfbhmOWFM2YCWAtMHac +PM3miO5HknkLWgDiXl8RfH35CLcgBokqXf0AqyLh8LO8JKleJg4fAC3+IZpTW23T +K6uUgmhDNtj2L8Yi/LVBXQ0zYOqkfX7oS1WRVtNcV48flBcvqt7pnqj0z4pMjqDk +VnOyz0+GxWk88yQgi1yWDPprEjuaZ8HfxpaypdWSDZsJQmgkEEXUUOQXOUjQNYuU +bRHej8pZAoGBAOokp/lpM+lx3FJ9iCEoL0neunIW6cxHeogNlFeEWBY6gbA/os+m +bB6wBikAj+d3dqzbysfZXps/JpBSrvw4kAAUu7QPWJTnL2p+HE9BIdQxWR9OihqN +p1dsItjl9H4yphDLZKVVA4emJwWMw9e2J7JNujDaR49U0z2LhI2UmFilAoGBANU4 +G8OPxZMMRwtvNZLFsI1GyJIYj/WACvfvof6AubUqusoYsF2lB9CTjdicBBzUYo6m +JoEB/86KKmM0NUCqbYDeiSNqV02ebq2TTlaQC22dc4sMric93k7wqsVseGdslFKc +N2dsLe+7r9+mkDzER8+Nlp6YqbSfxaZQ3LPw+3QXAoGAXoMJYr26fKK/QnT1fBzS +ackEDYV+Pj0kEsMYe/Mp818OdmxZdeRBhGmdMvPNIquwNbpKsjzl2Vi2Yk9d3uWe +CspTsiz3nrNrClt5ZexukU6SIPb8/Bbt03YM4ux/smkTa3gOWkZktF63JaBadTpL +78c8Pvf9JrggxJkKmnO+wxkCgYEAukSTFKw0GTtfkWCs97TWgQU2UVM96GXcry7c +YT7Jfbh/h/A7mwOCKTfOck4R1bHBDAegmZFKjX/sec/xObXphexi99p9vGRNIjwO +8tZR9YfYmcARIF0PKf1b4q7ZHNkhVm38hNBf7RAVHBgh58Q9S9fQnmqVzyLJA3ue +42AB/C8CgYAR0EvPG2e5nxB1R4ZlrjHCxjCsWQZQ2Q+1cAb38NPIYnyo2m72IT/T +f1/qiqs/2Spe81HSwjA34y2jdQ0eTSE01VdwXIm/cuxKbmjVzRh0M06MOkWP5pZA +62P5GYY6Ud2JS7Dz+Z9dKJU4vjWrylznk1M0oUVdEzllQkahn831vw== -----END RSA PRIVATE KEY----- diff --git a/mysql-wsrep-5.6/extra/yassl/certs/client-keyEnc.pem b/mysql-wsrep-5.6/extra/yassl/certs/client-keyEnc.pem index f6b857fc..0097c076 100644 --- a/mysql-wsrep-5.6/extra/yassl/certs/client-keyEnc.pem +++ b/mysql-wsrep-5.6/extra/yassl/certs/client-keyEnc.pem @@ -1,12 +1,12 @@ -----BEGIN RSA PRIVATE KEY----- Proc-Type: 4,ENCRYPTED -DEK-Info: DES-CBC,B9D8FB94E38635AB +DEK-Info: DES-EDE3-CBC,BDE979D13CCC0ABD -e7bVyzL1RF6p7hl8GDaOrRTcgB4ip+pWWUcnNf6y2tsuAQx/c/Bd5c9ZDc3L5AXC -oOAzWYB+ay1vWkmAQB4ivFS5QzGDf8870d4FbOejwmgPhiHdZNw5xNwscAN6ps0v -dFaUrR9nzWmbycsQCjXZGIZtGFCtXkA8Gdl5OMO4o+rzM0muNPS5fb++x7oNl1YG -gjReu2sQ85dPfMlnoHhr8Pz9LBcxVyOmcqtmT0SOSuPcoj6aDtcZ+EY9MQf6SR9E -ysmrJKMtp+ABgXglAj5hbT0dMpoJ2KpJYk62JAh/A6DDyv5YYUI0W57xY5+QzaV+ -YXnIvqwLjJ3cXEV4YH7ozLHAESgnAAUoQsin42rrRKt7GxjSdBoFhWjH69V2nl65 -LYRNjE1O5BBEX+rz0S+fe2ZZgT17kUr7eLZCq15J+L5xWQ7R4ERc0w== +N7yz2JV13EmQ7MZPL5wamid5+G1V1gp8FKqMemAC5JDxonS/W9oViMLUcxbfPTDx +FznKdYSVTIQ7vv3ofmDG4MEyV/2C568N2kdtAw+jTfrZFN+IU9CI+W+In/nacirF +02sAcvDMofustnooKNOO7/iyb5+3vRvEt5vSSRQn5WuSQ9sUKjuzoLs/lbf7fyAt +4NeqfI3rYBZXxiUOLITOGXzGNRuFoY+o2uDCfelLAJ8uhiVG6ME3LeJEo1dT5lZ8 +CSJOLPasKg0iG4V7olM4j9FvAfZr48RRsSfUen756Jo2HpI4bad8LKhFYIdNs2Au +WwKLmjpo6QB9hBmRshR04rEXPdrgTqLBExCE08PyaGYnWU8ggWritCeBzDQFj/n4 +sI+NO0Mymuvg98e5RpO52lg3Xnqv9RIK3guLFOmI6aEHC0PS4WwOEQ== -----END RSA PRIVATE KEY----- diff --git a/mysql-wsrep-5.6/extra/yassl/certs/dsa-cert.pem b/mysql-wsrep-5.6/extra/yassl/certs/dsa-cert.pem index ed1138da..10d533ed 100644 --- a/mysql-wsrep-5.6/extra/yassl/certs/dsa-cert.pem +++ b/mysql-wsrep-5.6/extra/yassl/certs/dsa-cert.pem @@ -1,70 +1,22 @@ -Certificate: - Data: - Version: 3 (0x2) - Serial Number: - ce:df:23:31:64:b4:13:da - Signature Algorithm: dsaWithSHA1 - Issuer: C=US, ST=Oregon, L=Portland, O=yaSSL, OU=testing, CN=www.yassl.com/emailAddress=info@yassl.com - Validity - Not Before: Jun 30 18:56:38 2010 GMT - Not After : Mar 26 18:56:39 2013 GMT - Subject: C=US, ST=Oregon, L=Portland, O=yaSSL, OU=testing, CN=www.yassl.com/emailAddress=info@yassl.com - Subject Public Key Info: - Public Key Algorithm: dsaEncryption - DSA Public Key: - pub: - 04:84:a0:26:31:72:0c:e8:4f:5d:53:17:62:b1:80: - ca:c0:16:5f:c3:1e:ea:c5:d9:98:38:f9:be:56:53: - 47:68:ce:08:22:57:1c:bb:0d:77:91:cf:5b:36:ed: - f3:24:82:90:8a:cd:90:7c:db:77:f9:17:2d:73:73: - ef:bb:b9:82 - P: - 00:99:29:69:80:c9:3c:98:68:45:a9:82:fe:67:eb: - 95:88:c5:b4:0c:d6:26:45:95:19:2c:a0:20:5b:7e: - df:69:e9:dc:c3:0f:f3:61:0a:25:9b:f2:21:01:6a: - cd:aa:8c:37:e7:ca:66:db:56:f4:0f:7d:7a:d1:18: - b9:42:fd:1b:11 - Q: - 00:ad:25:29:ab:0a:9f:09:1c:c1:ad:03:20:76:7f: - a6:b7:dd:4d:03:09 - G: - 12:88:99:da:e7:d0:0b:93:9b:e6:ee:3c:21:7f:9c: - b3:b4:8d:a5:8c:e2:37:80:3f:17:d1:81:4f:bd:f0: - 71:b6:32:08:54:dd:bf:01:e2:b3:77:06:64:75:8a: - 04:d6:79:39:b1:02:03:03:c6:06:74:e5:90:05:0a: - 10:46:19:31 - X509v3 extensions: - X509v3 Subject Key Identifier: - BE:F9:8C:5D:D6:1C:B4:EE:81:DD:36:56:0A:21:E4:61:44:73:E9:E2 - X509v3 Authority Key Identifier: - keyid:BE:F9:8C:5D:D6:1C:B4:EE:81:DD:36:56:0A:21:E4:61:44:73:E9:E2 - DirName:/C=US/ST=Oregon/L=Portland/O=yaSSL/OU=testing/CN=www.yassl.com/emailAddress=info@yassl.com - serial:CE:DF:23:31:64:B4:13:DA - - X509v3 Basic Constraints: - CA:TRUE - Signature Algorithm: dsaWithSHA1 - 30:2d:02:14:00:a3:21:20:34:6a:2c:f9:fb:76:d7:20:c9:c0: - 35:1b:64:9a:c2:83:02:15:00:a4:59:ac:6d:da:85:48:ff:f5: - 0d:49:72:c8:cd:91:fc:ec:2f:5c:63 -----BEGIN CERTIFICATE----- -MIIDfjCCAz2gAwIBAgIJAM7fIzFktBPaMAkGByqGSM44BAMwgYoxCzAJBgNVBAYT -AlVTMQ8wDQYDVQQIEwZPcmVnb24xETAPBgNVBAcTCFBvcnRsYW5kMQ4wDAYDVQQK -EwV5YVNTTDEQMA4GA1UECxMHdGVzdGluZzEWMBQGA1UEAxMNd3d3Lnlhc3NsLmNv -bTEdMBsGCSqGSIb3DQEJARYOaW5mb0B5YXNzbC5jb20wHhcNMTAwNjMwMTg1NjM4 -WhcNMTMwMzI2MTg1NjM5WjCBijELMAkGA1UEBhMCVVMxDzANBgNVBAgTBk9yZWdv -bjERMA8GA1UEBxMIUG9ydGxhbmQxDjAMBgNVBAoTBXlhU1NMMRAwDgYDVQQLEwd0 -ZXN0aW5nMRYwFAYDVQQDEw13d3cueWFzc2wuY29tMR0wGwYJKoZIhvcNAQkBFg5p -bmZvQHlhc3NsLmNvbTCB8DCBqAYHKoZIzjgEATCBnAJBAJkpaYDJPJhoRamC/mfr -lYjFtAzWJkWVGSygIFt+32np3MMP82EKJZvyIQFqzaqMN+fKZttW9A99etEYuUL9 -GxECFQCtJSmrCp8JHMGtAyB2f6a33U0DCQJAEoiZ2ufQC5Ob5u48IX+cs7SNpYzi -N4A/F9GBT73wcbYyCFTdvwHis3cGZHWKBNZ5ObECAwPGBnTlkAUKEEYZMQNDAAJA -BISgJjFyDOhPXVMXYrGAysAWX8Me6sXZmDj5vlZTR2jOCCJXHLsNd5HPWzbt8ySC -kIrNkHzbd/kXLXNz77u5gqOB8jCB7zAdBgNVHQ4EFgQUvvmMXdYctO6B3TZWCiHk -YURz6eIwgb8GA1UdIwSBtzCBtIAUvvmMXdYctO6B3TZWCiHkYURz6eKhgZCkgY0w -gYoxCzAJBgNVBAYTAlVTMQ8wDQYDVQQIEwZPcmVnb24xETAPBgNVBAcTCFBvcnRs -YW5kMQ4wDAYDVQQKEwV5YVNTTDEQMA4GA1UECxMHdGVzdGluZzEWMBQGA1UEAxMN -d3d3Lnlhc3NsLmNvbTEdMBsGCSqGSIb3DQEJARYOaW5mb0B5YXNzbC5jb22CCQDO -3yMxZLQT2jAMBgNVHRMEBTADAQH/MAkGByqGSM44BAMDMAAwLQIUAKMhIDRqLPn7 -dtcgycA1G2SawoMCFQCkWaxt2oVI//UNSXLIzZH87C9cYw== +MIIDqzCCA2ugAwIBAgIJAMGqrgDU6DyhMAkGByqGSM44BAMwgY4xCzAJBgNVBAYT +AlVTMQ8wDQYDVQQIDAZPcmVnb24xETAPBgNVBAcMCFBvcnRsYW5kMRAwDgYDVQQK +DAd3b2xmU1NMMRAwDgYDVQQLDAd0ZXN0aW5nMRYwFAYDVQQDDA13d3cueWFzc2wu +Y29tMR8wHQYJKoZIhvcNAQkBFhBpbmZvQHdvbGZzc2wuY29tMB4XDTEzMDQyMjIw +MDk0NFoXDTE2MDExNzIwMDk0NFowgY4xCzAJBgNVBAYTAlVTMQ8wDQYDVQQIDAZP +cmVnb24xETAPBgNVBAcMCFBvcnRsYW5kMRAwDgYDVQQKDAd3b2xmU1NMMRAwDgYD +VQQLDAd0ZXN0aW5nMRYwFAYDVQQDDA13d3cueWFzc2wuY29tMR8wHQYJKoZIhvcN +AQkBFhBpbmZvQHdvbGZzc2wuY29tMIIBuDCCASwGByqGSM44BAEwggEfAoGBAL1R +7koy4IrH6sbh6nDEUUPPKgfhxxLCWCVexF2+qzANEr+hC9M002haJXFOfeS9DyoO +WFbL0qMZOuqv+22CaHnoUWl7q3PjJOAI3JH0P54ZyUPuU1909RzgTdIDp5+ikbr7 +KYjnltL73FQVMbjTZQKthIpPn3MjYcF+4jp2W2zFAhUAkcntYND6MGf+eYzIJDN2 +L7SonHUCgYEAklpxErfqznIZjVvqqHFaq+mgAL5J8QrKVmdhYZh/Y8z4jCjoCA8o +TDoFKxf7s2ZzgaPKvglaEKiYqLqic9qY78DYJswzQMLFvjsF4sFZ+pYCBdWPQI4N +PgxCiznK6Ce+JH9ikSBvMvG+tevjr2UpawDIHX3+AWYaZBZwKADAaboDgYUAAoGB +AJ3LY89yHyvQ/TsQ6zlYbovjbk/ogndsMqPdNUvL4RuPTgJP/caaDDa0XJ7ak6A7 +TJ+QheLNwOXoZPYJC4EGFSDAXpYniGhbWIrVTCGe6lmZDfnx40WXS0kk3m/DHaC0 +3ElLAiybxVGxyqoUfbT3Zv1JwftWMuiqHH5uADhdXuXVo1AwTjAdBgNVHQ4EFgQU +IJjk416o4v8qpH9LBtXlR9v8gccwHwYDVR0jBBgwFoAUIJjk416o4v8qpH9LBtXl +R9v8gccwDAYDVR0TBAUwAwEB/zAJBgcqhkjOOAQDAy8AMCwCFCjGKIdOSV12LcTu +k08owGM6YkO1AhQe+K173VuaO/OsDNsxZlKpyH8+1g== -----END CERTIFICATE----- diff --git a/mysql-wsrep-5.6/extra/yassl/certs/dsa1024.der b/mysql-wsrep-5.6/extra/yassl/certs/dsa1024.der new file mode 100644 index 00000000..db880d51 Binary files /dev/null and b/mysql-wsrep-5.6/extra/yassl/certs/dsa1024.der differ diff --git a/mysql-wsrep-5.6/extra/yassl/certs/dsa1024.pem b/mysql-wsrep-5.6/extra/yassl/certs/dsa1024.pem new file mode 100644 index 00000000..5478ebfc --- /dev/null +++ b/mysql-wsrep-5.6/extra/yassl/certs/dsa1024.pem @@ -0,0 +1,12 @@ +-----BEGIN DSA PRIVATE KEY----- +MIIBvAIBAAKBgQC9Ue5KMuCKx+rG4epwxFFDzyoH4ccSwlglXsRdvqswDRK/oQvT +NNNoWiVxTn3kvQ8qDlhWy9KjGTrqr/ttgmh56FFpe6tz4yTgCNyR9D+eGclD7lNf +dPUc4E3SA6efopG6+ymI55bS+9xUFTG402UCrYSKT59zI2HBfuI6dltsxQIVAJHJ +7WDQ+jBn/nmMyCQzdi+0qJx1AoGBAJJacRK36s5yGY1b6qhxWqvpoAC+SfEKylZn +YWGYf2PM+Iwo6AgPKEw6BSsX+7Nmc4Gjyr4JWhComKi6onPamO/A2CbMM0DCxb47 +BeLBWfqWAgXVj0CODT4MQos5yugnviR/YpEgbzLxvrXr469lKWsAyB19/gFmGmQW +cCgAwGm6AoGBAJ3LY89yHyvQ/TsQ6zlYbovjbk/ogndsMqPdNUvL4RuPTgJP/caa +DDa0XJ7ak6A7TJ+QheLNwOXoZPYJC4EGFSDAXpYniGhbWIrVTCGe6lmZDfnx40WX +S0kk3m/DHaC03ElLAiybxVGxyqoUfbT3Zv1JwftWMuiqHH5uADhdXuXVAhQ01VXa +Rr8IPem35lKghVKnq/kGQw== +-----END DSA PRIVATE KEY----- diff --git a/mysql-wsrep-5.6/extra/yassl/certs/server-cert.pem b/mysql-wsrep-5.6/extra/yassl/certs/server-cert.pem index 1ec53c02..f56cba9d 100644 --- a/mysql-wsrep-5.6/extra/yassl/certs/server-cert.pem +++ b/mysql-wsrep-5.6/extra/yassl/certs/server-cert.pem @@ -1,39 +1,173 @@ Certificate: Data: - Version: 1 (0x0) + Version: 3 (0x2) Serial Number: 1 (0x1) - Signature Algorithm: md5WithRSAEncryption - Issuer: C=US, ST=Montana, L=Bozeman, O=sawtooth, OU=consulting, CN=www.sawtooth-consulting.com/emailAddress=info@yassl.com + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, ST=Montana, L=Bozeman, O=Sawtooth, OU=Consulting, CN=www.wolfssl.com/emailAddress=info@wolfssl.com Validity - Not Before: Jun 30 18:52:17 2010 GMT - Not After : Mar 26 18:52:17 2013 GMT - Subject: C=US, ST=Montana, L=Bozeman, O=yaSSL, OU=support, CN=www.yassl.com/emailAddress=info@yassl.com + Not Before: Jul 11 17:20:14 2014 GMT + Not After : Apr 6 17:20:14 2017 GMT + Subject: C=US, ST=Montana, L=Bozeman, O=wolfSSL, OU=Support, CN=www.wolfssl.com/emailAddress=info@wolfssl.com Subject Public Key Info: Public Key Algorithm: rsaEncryption - RSA Public Key: (512 bit) - Modulus (512 bit): - 00:c6:7b:c0:68:81:2f:de:82:3f:f9:ac:c3:86:4a: - 66:b7:ec:d4:f1:f6:64:21:ff:f5:a2:34:42:d0:38: - 9f:c6:dd:3b:6e:26:65:6a:54:96:dd:d2:7b:eb:36: - a2:ae:7e:2a:9e:7e:56:a5:b6:87:9f:15:c7:18:66: - 7e:16:77:e2:a7 + Public-Key: (2048 bit) + Modulus: + 00:c0:95:08:e1:57:41:f2:71:6d:b7:d2:45:41:27: + 01:65:c6:45:ae:f2:bc:24:30:b8:95:ce:2f:4e:d6: + f6:1c:88:bc:7c:9f:fb:a8:67:7f:fe:5c:9c:51:75: + f7:8a:ca:07:e7:35:2f:8f:e1:bd:7b:c0:2f:7c:ab: + 64:a8:17:fc:ca:5d:7b:ba:e0:21:e5:72:2e:6f:2e: + 86:d8:95:73:da:ac:1b:53:b9:5f:3f:d7:19:0d:25: + 4f:e1:63:63:51:8b:0b:64:3f:ad:43:b8:a5:1c:5c: + 34:b3:ae:00:a0:63:c5:f6:7f:0b:59:68:78:73:a6: + 8c:18:a9:02:6d:af:c3:19:01:2e:b8:10:e3:c6:cc: + 40:b4:69:a3:46:33:69:87:6e:c4:bb:17:a6:f3:e8: + dd:ad:73:bc:7b:2f:21:b5:fd:66:51:0c:bd:54:b3: + e1:6d:5f:1c:bc:23:73:d1:09:03:89:14:d2:10:b9: + 64:c3:2a:d0:a1:96:4a:bc:e1:d4:1a:5b:c7:a0:c0: + c1:63:78:0f:44:37:30:32:96:80:32:23:95:a1:77: + ba:13:d2:97:73:e2:5d:25:c9:6a:0d:c3:39:60:a4: + b4:b0:69:42:42:09:e9:d8:08:bc:33:20:b3:58:22: + a7:aa:eb:c4:e1:e6:61:83:c5:d2:96:df:d9:d0:4f: + ad:d7 Exponent: 65537 (0x10001) - Signature Algorithm: md5WithRSAEncryption - 58:a9:98:e7:16:52:4c:40:e7:e1:47:92:19:1b:3a:8f:97:6c: - 7b:b7:b0:cb:20:6d:ad:b5:d3:47:58:d8:e4:f2:3e:32:e9:ef: - 87:77:e5:54:36:f4:8d:50:8d:07:b4:77:45:ea:9d:a4:33:36: - 9b:0b:e0:74:58:11:c5:01:7b:4d + X509v3 extensions: + X509v3 Subject Key Identifier: + B3:11:32:C9:92:98:84:E2:C9:F8:D0:3B:6E:03:42:CA:1F:0E:8E:3C + X509v3 Authority Key Identifier: + keyid:27:8E:67:11:74:C3:26:1D:3F:ED:33:63:B3:A4:D8:1D:30:E5:E8:D5 + DirName:/C=US/ST=Montana/L=Bozeman/O=Sawtooth/OU=Consulting/CN=www.wolfssl.com/emailAddress=info@wolfssl.com + serial:9A:41:47:CD:A1:14:62:8C + + X509v3 Basic Constraints: + CA:TRUE + Signature Algorithm: sha1WithRSAEncryption + 3d:8c:70:05:5b:62:4b:bf:6c:b6:48:61:01:10:1d:5e:05:ba: + 55:94:2c:ae:59:6f:97:80:5d:6c:86:ec:9a:eb:15:45:44:e4: + 56:f8:75:ca:8a:45:32:f4:c7:e1:fa:f2:98:1c:91:d3:3f:e8: + 0e:c9:1b:fa:e1:79:99:67:0e:0d:6b:8a:ec:1a:2c:59:c4:34: + 04:8d:39:77:cd:b5:e9:60:5b:82:bf:34:ce:ed:c6:4f:3f:b4: + 5c:4d:8a:b4:f4:0a:04:12:a0:56:c1:e1:33:37:a1:54:87:48: + e9:81:c2:0f:8f:6f:d3:52:4c:4c:32:4c:6b:9f:3a:04:8f:77: + 5d:ad:dc:3d:2b:f2:c9:df:3c:60:5d:d8:fc:86:72:7c:3d:d0: + 84:4b:8c:df:26:43:fe:c0:cc:5b:e1:36:b3:3d:32:28:a3:ef: + 0c:20:d6:b1:50:39:d6:67:a9:8b:84:bc:92:34:eb:19:23:e8: + 10:8f:ea:bd:18:8c:93:27:3c:74:75:8e:58:04:fa:2a:74:44: + 7d:fc:4d:39:df:54:17:ba:78:e1:5d:6a:70:d3:7c:a2:80:81: + e6:19:51:91:c3:44:51:ec:bb:88:a9:53:e1:d7:a9:8c:28:f4: + 21:1c:42:51:09:b4:12:6d:a0:d6:25:09:85:c6:2a:0c:af:a7: + 58:e6:52:8b -----BEGIN CERTIFICATE----- -MIICFDCCAb4CAQEwDQYJKoZIhvcNAQEEBQAwgZ4xCzAJBgNVBAYTAlVTMRAwDgYD -VQQIEwdNb250YW5hMRAwDgYDVQQHEwdCb3plbWFuMREwDwYDVQQKEwhzYXd0b290 -aDETMBEGA1UECxMKY29uc3VsdGluZzEkMCIGA1UEAxMbd3d3LnNhd3Rvb3RoLWNv -bnN1bHRpbmcuY29tMR0wGwYJKoZIhvcNAQkBFg5pbmZvQHlhc3NsLmNvbTAeFw0x -MDA2MzAxODUyMTdaFw0xMzAzMjYxODUyMTdaMIGKMQswCQYDVQQGEwJVUzEQMA4G -A1UECBMHTW9udGFuYTEQMA4GA1UEBxMHQm96ZW1hbjEOMAwGA1UEChMFeWFTU0wx -EDAOBgNVBAsTB3N1cHBvcnQxFjAUBgNVBAMTDXd3dy55YXNzbC5jb20xHTAbBgkq -hkiG9w0BCQEWDmluZm9AeWFzc2wuY29tMFwwDQYJKoZIhvcNAQEBBQADSwAwSAJB -AMZ7wGiBL96CP/msw4ZKZrfs1PH2ZCH/9aI0QtA4n8bdO24mZWpUlt3Se+s2oq5+ -Kp5+VqW2h58VxxhmfhZ34qcCAwEAATANBgkqhkiG9w0BAQQFAANBAFipmOcWUkxA -5+FHkhkbOo+XbHu3sMsgba2100dY2OTyPjLp74d35VQ29I1QjQe0d0XqnaQzNpsL -4HRYEcUBe00= +MIIEnjCCA4agAwIBAgIBATANBgkqhkiG9w0BAQUFADCBlDELMAkGA1UEBhMCVVMx +EDAOBgNVBAgMB01vbnRhbmExEDAOBgNVBAcMB0JvemVtYW4xETAPBgNVBAoMCFNh +d3Rvb3RoMRMwEQYDVQQLDApDb25zdWx0aW5nMRgwFgYDVQQDDA93d3cud29sZnNz +bC5jb20xHzAdBgkqhkiG9w0BCQEWEGluZm9Ad29sZnNzbC5jb20wHhcNMTQwNzEx +MTcyMDE0WhcNMTcwNDA2MTcyMDE0WjCBkDELMAkGA1UEBhMCVVMxEDAOBgNVBAgM +B01vbnRhbmExEDAOBgNVBAcMB0JvemVtYW4xEDAOBgNVBAoMB3dvbGZTU0wxEDAO +BgNVBAsMB1N1cHBvcnQxGDAWBgNVBAMMD3d3dy53b2xmc3NsLmNvbTEfMB0GCSqG +SIb3DQEJARYQaW5mb0B3b2xmc3NsLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEP +ADCCAQoCggEBAMCVCOFXQfJxbbfSRUEnAWXGRa7yvCQwuJXOL07W9hyIvHyf+6hn +f/5cnFF194rKB+c1L4/hvXvAL3yrZKgX/Mpde7rgIeVyLm8uhtiVc9qsG1O5Xz/X +GQ0lT+FjY1GLC2Q/rUO4pRxcNLOuAKBjxfZ/C1loeHOmjBipAm2vwxkBLrgQ48bM +QLRpo0YzaYduxLsXpvPo3a1zvHsvIbX9ZlEMvVSz4W1fHLwjc9EJA4kU0hC5ZMMq +0KGWSrzh1Bpbx6DAwWN4D0Q3MDKWgDIjlaF3uhPSl3PiXSXJag3DOWCktLBpQkIJ +6dgIvDMgs1gip6rrxOHmYYPF0pbf2dBPrdcCAwEAAaOB/DCB+TAdBgNVHQ4EFgQU +sxEyyZKYhOLJ+NA7bgNCyh8OjjwwgckGA1UdIwSBwTCBvoAUJ45nEXTDJh0/7TNj +s6TYHTDl6NWhgZqkgZcwgZQxCzAJBgNVBAYTAlVTMRAwDgYDVQQIDAdNb250YW5h +MRAwDgYDVQQHDAdCb3plbWFuMREwDwYDVQQKDAhTYXd0b290aDETMBEGA1UECwwK +Q29uc3VsdGluZzEYMBYGA1UEAwwPd3d3LndvbGZzc2wuY29tMR8wHQYJKoZIhvcN +AQkBFhBpbmZvQHdvbGZzc2wuY29tggkAmkFHzaEUYowwDAYDVR0TBAUwAwEB/zAN +BgkqhkiG9w0BAQUFAAOCAQEAPYxwBVtiS79stkhhARAdXgW6VZQsrllvl4BdbIbs +musVRUTkVvh1yopFMvTH4frymByR0z/oDskb+uF5mWcODWuK7BosWcQ0BI05d821 +6WBbgr80zu3GTz+0XE2KtPQKBBKgVsHhMzehVIdI6YHCD49v01JMTDJMa586BI93 +Xa3cPSvyyd88YF3Y/IZyfD3QhEuM3yZD/sDMW+E2sz0yKKPvDCDWsVA51mepi4S8 +kjTrGSPoEI/qvRiMkyc8dHWOWAT6KnREffxNOd9UF7p44V1qcNN8ooCB5hlRkcNE +Uey7iKlT4depjCj0IRxCUQm0Em2g1iUJhcYqDK+nWOZSiw== +-----END CERTIFICATE----- +Certificate: + Data: + Version: 3 (0x2) + Serial Number: + 9a:41:47:cd:a1:14:62:8c + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, ST=Montana, L=Bozeman, O=Sawtooth, OU=Consulting, CN=www.wolfssl.com/emailAddress=info@wolfssl.com + Validity + Not Before: Jul 11 03:20:08 2014 GMT + Not After : Apr 6 03:20:08 2017 GMT + Subject: C=US, ST=Montana, L=Bozeman, O=Sawtooth, OU=Consulting, CN=www.wolfssl.com/emailAddress=info@wolfssl.com + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + Public-Key: (2048 bit) + Modulus: + 00:bf:0c:ca:2d:14:b2:1e:84:42:5b:cd:38:1f:4a: + f2:4d:75:10:f1:b6:35:9f:df:ca:7d:03:98:d3:ac: + de:03:66:ee:2a:f1:d8:b0:7d:6e:07:54:0b:10:98: + 21:4d:80:cb:12:20:e7:cc:4f:de:45:7d:c9:72:77: + 32:ea:ca:90:bb:69:52:10:03:2f:a8:f3:95:c5:f1: + 8b:62:56:1b:ef:67:6f:a4:10:41:95:ad:0a:9b:e3: + a5:c0:b0:d2:70:76:50:30:5b:a8:e8:08:2c:7c:ed: + a7:a2:7a:8d:38:29:1c:ac:c7:ed:f2:7c:95:b0:95: + 82:7d:49:5c:38:cd:77:25:ef:bd:80:75:53:94:3c: + 3d:ca:63:5b:9f:15:b5:d3:1d:13:2f:19:d1:3c:db: + 76:3a:cc:b8:7d:c9:e5:c2:d7:da:40:6f:d8:21:dc: + 73:1b:42:2d:53:9c:fe:1a:fc:7d:ab:7a:36:3f:98: + de:84:7c:05:67:ce:6a:14:38:87:a9:f1:8c:b5:68: + cb:68:7f:71:20:2b:f5:a0:63:f5:56:2f:a3:26:d2: + b7:6f:b1:5a:17:d7:38:99:08:fe:93:58:6f:fe:c3: + 13:49:08:16:0b:a7:4d:67:00:52:31:67:23:4e:98: + ed:51:45:1d:b9:04:d9:0b:ec:d8:28:b3:4b:bd:ed: + 36:79 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Subject Key Identifier: + 27:8E:67:11:74:C3:26:1D:3F:ED:33:63:B3:A4:D8:1D:30:E5:E8:D5 + X509v3 Authority Key Identifier: + keyid:27:8E:67:11:74:C3:26:1D:3F:ED:33:63:B3:A4:D8:1D:30:E5:E8:D5 + DirName:/C=US/ST=Montana/L=Bozeman/O=Sawtooth/OU=Consulting/CN=www.wolfssl.com/emailAddress=info@wolfssl.com + serial:9A:41:47:CD:A1:14:62:8C + + X509v3 Basic Constraints: + CA:TRUE + Signature Algorithm: sha1WithRSAEncryption + 79:78:0c:6d:79:88:91:fc:3a:15:9c:f9:27:62:16:f0:21:1f: + fa:7d:3f:a2:a8:32:1e:f7:f2:11:a9:74:16:74:5e:dc:18:ca: + f0:00:2a:d5:03:06:26:30:f1:47:83:fd:32:6e:fc:ed:aa:4f: + 7d:0c:63:60:31:2f:7c:0c:bf:99:66:87:ed:27:08:86:2d:c4: + 33:e8:98:23:1c:fe:a3:db:9a:49:4e:fc:5a:42:ef:71:c3:3f: + ad:dc:4a:a8:d2:a3:1d:09:ac:33:04:7b:86:f3:6d:00:59:a3: + c8:db:d1:3c:73:f6:0e:90:d6:5e:49:e0:bf:36:63:08:7b:a5: + b0:8f:35:3b:56:8c:11:35:49:04:1c:d0:e7:ba:56:c5:0d:0a: + 91:8d:d6:b7:62:19:34:12:52:4c:d2:6d:7c:c5:3d:0f:18:81: + 54:cb:f6:3c:e5:84:d2:d6:71:15:ec:1a:34:0b:f0:a0:21:74: + 43:c8:a3:b0:df:d9:67:da:e2:ad:93:48:f8:a0:87:bd:79:14: + e0:62:0a:df:f7:31:2e:31:7b:d1:32:2a:0a:fe:5d:14:ef:d9: + 64:50:e4:83:91:bc:70:0d:d7:88:8d:d9:bc:84:0e:c5:1a:b3: + bf:64:02:4e:51:91:a4:a2:85:15:83:af:f0:5b:9b:28:49:5f: + b2:b3:03:d8 +-----BEGIN CERTIFICATE----- +MIIEqjCCA5KgAwIBAgIJAJpBR82hFGKMMA0GCSqGSIb3DQEBBQUAMIGUMQswCQYD +VQQGEwJVUzEQMA4GA1UECAwHTW9udGFuYTEQMA4GA1UEBwwHQm96ZW1hbjERMA8G +A1UECgwIU2F3dG9vdGgxEzARBgNVBAsMCkNvbnN1bHRpbmcxGDAWBgNVBAMMD3d3 +dy53b2xmc3NsLmNvbTEfMB0GCSqGSIb3DQEJARYQaW5mb0B3b2xmc3NsLmNvbTAe +Fw0xNDA3MTEwMzIwMDhaFw0xNzA0MDYwMzIwMDhaMIGUMQswCQYDVQQGEwJVUzEQ +MA4GA1UECAwHTW9udGFuYTEQMA4GA1UEBwwHQm96ZW1hbjERMA8GA1UECgwIU2F3 +dG9vdGgxEzARBgNVBAsMCkNvbnN1bHRpbmcxGDAWBgNVBAMMD3d3dy53b2xmc3Ns +LmNvbTEfMB0GCSqGSIb3DQEJARYQaW5mb0B3b2xmc3NsLmNvbTCCASIwDQYJKoZI +hvcNAQEBBQADggEPADCCAQoCggEBAL8Myi0Ush6EQlvNOB9K8k11EPG2NZ/fyn0D +mNOs3gNm7irx2LB9bgdUCxCYIU2AyxIg58xP3kV9yXJ3MurKkLtpUhADL6jzlcXx +i2JWG+9nb6QQQZWtCpvjpcCw0nB2UDBbqOgILHztp6J6jTgpHKzH7fJ8lbCVgn1J +XDjNdyXvvYB1U5Q8PcpjW58VtdMdEy8Z0TzbdjrMuH3J5cLX2kBv2CHccxtCLVOc +/hr8fat6Nj+Y3oR8BWfOahQ4h6nxjLVoy2h/cSAr9aBj9VYvoybSt2+xWhfXOJkI +/pNYb/7DE0kIFgunTWcAUjFnI06Y7VFFHbkE2Qvs2CizS73tNnkCAwEAAaOB/DCB ++TAdBgNVHQ4EFgQUJ45nEXTDJh0/7TNjs6TYHTDl6NUwgckGA1UdIwSBwTCBvoAU +J45nEXTDJh0/7TNjs6TYHTDl6NWhgZqkgZcwgZQxCzAJBgNVBAYTAlVTMRAwDgYD +VQQIDAdNb250YW5hMRAwDgYDVQQHDAdCb3plbWFuMREwDwYDVQQKDAhTYXd0b290 +aDETMBEGA1UECwwKQ29uc3VsdGluZzEYMBYGA1UEAwwPd3d3LndvbGZzc2wuY29t +MR8wHQYJKoZIhvcNAQkBFhBpbmZvQHdvbGZzc2wuY29tggkAmkFHzaEUYowwDAYD +VR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOCAQEAeXgMbXmIkfw6FZz5J2IW8CEf ++n0/oqgyHvfyEal0FnRe3BjK8AAq1QMGJjDxR4P9Mm787apPfQxjYDEvfAy/mWaH +7ScIhi3EM+iYIxz+o9uaSU78WkLvccM/rdxKqNKjHQmsMwR7hvNtAFmjyNvRPHP2 +DpDWXkngvzZjCHulsI81O1aMETVJBBzQ57pWxQ0KkY3Wt2IZNBJSTNJtfMU9DxiB +VMv2POWE0tZxFewaNAvwoCF0Q8ijsN/ZZ9rirZNI+KCHvXkU4GIK3/cxLjF70TIq +Cv5dFO/ZZFDkg5G8cA3XiI3ZvIQOxRqzv2QCTlGRpKKFFYOv8FubKElfsrMD2A== -----END CERTIFICATE----- diff --git a/mysql-wsrep-5.6/extra/yassl/certs/server-key.pem b/mysql-wsrep-5.6/extra/yassl/certs/server-key.pem index 154d661b..d1627f4d 100644 --- a/mysql-wsrep-5.6/extra/yassl/certs/server-key.pem +++ b/mysql-wsrep-5.6/extra/yassl/certs/server-key.pem @@ -1,9 +1,27 @@ -----BEGIN RSA PRIVATE KEY----- -MIIBOwIBAAJBAMZ7wGiBL96CP/msw4ZKZrfs1PH2ZCH/9aI0QtA4n8bdO24mZWpU -lt3Se+s2oq5+Kp5+VqW2h58VxxhmfhZ34qcCAwEAAQJBAJSbGxgjgV+rTZL2Ev58 -viN/IoB25cm/Bn4Heu7DNn2A2kpdGX2cCaf7rEQoIKCiHxvopvxOcd/7nLS/gNli -dCECIQD/cX/9fvB1Uajw0fmvwNON9+3P9uJSqpig90zL32pwjQIhAMbqee9TBMN4 -TxXbgWqA92PrCXe8WDZ3PwoJqdR6MRUDAiEAny+TDF1z6hiWiGTCDgXDkKBlwgjf -p5aKgR077XzwLu0CICVpWEGg1ZaF/CnaPP7w/pZ2UDOK4vRrfRnAM4bY7H5NAiBS -1eXJ/MCZ2uPfpl7XK2BU9P69KdKUk5WHxdRchVvcDg== +MIIEpQIBAAKCAQEAwJUI4VdB8nFtt9JFQScBZcZFrvK8JDC4lc4vTtb2HIi8fJ/7 +qGd//lycUXX3isoH5zUvj+G9e8AvfKtkqBf8yl17uuAh5XIuby6G2JVz2qwbU7lf +P9cZDSVP4WNjUYsLZD+tQ7ilHFw0s64AoGPF9n8LWWh4c6aMGKkCba/DGQEuuBDj +xsxAtGmjRjNph27Euxem8+jdrXO8ey8htf1mUQy9VLPhbV8cvCNz0QkDiRTSELlk +wyrQoZZKvOHUGlvHoMDBY3gPRDcwMpaAMiOVoXe6E9KXc+JdJclqDcM5YKS0sGlC +Qgnp2Ai8MyCzWCKnquvE4eZhg8XSlt/Z0E+t1wIDAQABAoIBAQCa0DQPUmIFUAHv +n+1kbsLE2hryhNeSEEiSxOlq64t1bMZ5OPLJckqGZFSVd8vDmp231B2kAMieTuTd +x7pnFsF0vKnWlI8rMBr77d8hBSPZSjm9mGtlmrjcxH3upkMVLj2+HSJgKnMw1T7Y +oqyGQy7E9WReP4l1DxHYUSVOn9iqo85gs+KK2X4b8GTKmlsFC1uqy+XjP24yIgXz +0PrvdFKB4l90073/MYNFdfpjepcu1rYZxpIm5CgGUFAOeC6peA0Ul7QS2DFAq6EB +QcIw+AdfFuRhd9Jg8p+N6PS662PeKpeB70xs5lU0USsoNPRTHMRYCj+7r7X3SoVD +LTzxWFiBAoGBAPIsVHY5I2PJEDK3k62vvhl1loFk5rW4iUJB0W3QHBv4G6xpyzY8 +ZH3c9Bm4w2CxV0hfUk9ZOlV/MsAZQ1A/rs5vF/MOn0DKTq0VO8l56cBZOHNwnAp8 +yTpIMqfYSXUKhcLC/RVz2pkJKmmanwpxv7AEpox6Wm9IWlQ7xrFTF9/nAoGBAMuT +3ncVXbdcXHzYkKmYLdZpDmOzo9ymzItqpKISjI57SCyySzfcBhh96v52odSh6T8N +zRtfr1+elltbD6F8r7ObkNtXczrtsCNErkFPHwdCEyNMy/r0FKTV9542fFufqDzB +hV900jkt/9CE3/uzIHoumxeu5roLrl9TpFLtG8SRAoGBAOyY2rvV/vlSSn0CVUlv +VW5SL4SjK7OGYrNU0mNS2uOIdqDvixWl0xgUcndex6MEH54ZYrUbG57D8rUy+UzB +qusMJn3UX0pRXKRFBnBEp1bA1CIUdp7YY1CJkNPiv4GVkjFBhzkaQwsYpVMfORpf +H0O8h2rfbtMiAP4imHBOGhkpAoGBAIpBVihRnl/Ungs7mKNU8mxW1KrpaTOFJAza +1AwtxL9PAmk4fNTm3Ezt1xYRwz4A58MmwFEC3rt1nG9WnHrzju/PisUr0toGakTJ +c/5umYf4W77xfOZltU9s8MnF/xbKixsX4lg9ojerAby/QM5TjI7t7+5ZneBj5nxe +9Y5L8TvBAoGATUX5QIzFW/QqGoq08hysa+kMVja3TnKW1eWK0uL/8fEYEz2GCbjY +dqfJHHFSlDBD4PF4dP1hG0wJzOZoKnGtHN9DvFbbpaS+NXCkXs9P/ABVmTo9I89n +WvUi+LUp0EQR6zUuRr79jhiyX6i/GTKh9dwD5nyaHwx8qbAOITc78bA= -----END RSA PRIVATE KEY----- diff --git a/mysql-wsrep-5.6/extra/yassl/certs/server-keyEnc.pem b/mysql-wsrep-5.6/extra/yassl/certs/server-keyEnc.pem index d3500a1b..e5ab57d4 100644 --- a/mysql-wsrep-5.6/extra/yassl/certs/server-keyEnc.pem +++ b/mysql-wsrep-5.6/extra/yassl/certs/server-keyEnc.pem @@ -1,12 +1,30 @@ -----BEGIN RSA PRIVATE KEY----- Proc-Type: 4,ENCRYPTED -DEK-Info: DES-CBC,08132C1FFF5BC8CC +DEK-Info: DES-CBC,136C7D8A69656668 -gsvuAsGmB8AkR23M25w4E6wuywfBey1Jqh3g71gJcnsUYwynex9dvfAU0lTowOXh -sb7ld1KNjEMzrht9AC1IC0iE1rLqvRQZOdJ7h3n7aHZQ4a/HjcwAhqJq0ZW45m6Q -mpoO5fRISjx2VbKFRUz6Xj2x0/do3IjQhpuUDVrTFFe1sEySM6APZ6CVpcnTOyPR -ADyLDKzOi2E+sj1UXs58pct56FaqTIZPUEflICU3k6q9FPU6gsYANRLfzegclkv4 -JAx6mKVSJuYnjCCppx8WBwGJa1J1GcYRJ3qFfdbUzL4bcXTvoFkJEnDkHsXgDUS6 -xmT0XGT3IMaW8cwQ8KD8m5YYI/L26Mas/w3eA2ekyMR8pYICjXp/YZtcKxxkQSVE -Uv/+D+20KbNAHIW5Mrxf61cX/CggGEbVP8ZhDY1flh8= +jvNTyPaztxPIoAzbdmZnD0Zw2+60tMxNc0GMHNmeOyG25aHP/dT+TWiKFpFVkkkY +uoCIhYUyw7gmpw+CnRJwWd+ans4nrvAjwy5oWJvarvsyUpjqvnPoIlAqd+d4TDKN +eESzcI76+gHdisAtCrQD+fGqgTZhli5TgDbnpasL/QnY2qDlutvakkVw7gPXe156 +2Phy8WN+efr65J6wt3K/dj7Datl9u4JeHQK81gYyWBVX+EagEjPGDzkFQCj9Z0q7 +8K3iB5GW1JAqJS0IfZPB40AnSTF/n1TL1SN3qfU3l7hTGNrx9o7580bgDEoAR7pI +F8eZlS15KHtZmh11AnU1KTKZ6kmgnNqeMTGMN6N0ct2wMKW1dV87eTDlF0oiR2ol +XwtFgKmrIjfpmzkdWjbJmWnGMjD56KdiFZga/ZyKMsPrVoYLgfJEpn36iQspfygx +HCGNTf0PjIsjEWU0WyQiF86t+c45W3wNFsv/AxVyfMl+su02yrd6u2ecuQDir3Cs +b2k8IKtQgVe/NIpEWLKuiHG5oedIPPQyDYK5uq+gHxCGeOoKnWlsWFEHZRiza4X5 +tbgTrJB8Sw0ENWrvVGGmQZN4pSImlsMwzQ2qik5CQ00N1b3+56/obn0z75I3bUSb +tC5g8DRjl6oclAenNgh/MYMT287y5W2dD4npxHcekX4O3J2CDXNfg4vV2j5GRxtg +LVJdYE2p7bpYePCDHrYng8b9ubBprx0CrEnkIvvtUjzNPf6VDL0+MBKl+XgR2/nz +iRqTuZnlGGOyM+KYDwXpgwfs/HfvFGksxTAlO/40GkGh+WGPaIoNyCK0SgQKhyb4 +JIkR0vd2/yLg3lWMJrGwh7A0Gm07Z/781oURP3uWd+PaCOgGcd5ipcAjcEyuxNly +AthipWqmQWUcbf6Z2N9j3OA22Hv2Uzk8HSfi9VOZtL9svdEEZ0NnOekJgnc6stQp +bXiknlK/T5WdrWxSyCfgUq68Vf6DFfIRAVuFdJ3WHT2wVXHrDfft6D+Ne/XCxPoE +8zGmkyusaph33UHQ1oNyUbLbwcDCDSmOo8gYoedD3IwxtMA3wJRugomqosItwV8X +vkgmcy8eSE/+gZUxJEN2gnLcfKFhCkC80J6oFhmoDD6vuUnPHcFdKZgVPw2rzPk5 +Vb1kX+gpORplYmKpq1vz/ujscL4T0TmYLz02hkIS4edpW55ncTTv7JWefpRiTB1J +RB3td3me4htqR+YIDWJ+emrOmqsCG2WvpAS+MTw2mj1jYk9LL/ZYobTjSCEWmuwT +yVK6m303irR7HQDauxhslRFgoK21w63viOyj5NKIU1gQtaAANGDxcgORC1XLjjgt +oNutSQA+7P42vfHSHK4cnTBXl6V32H/GyVpdHQOZqSrqIjgLmUZodSmRPROxosZF +a46B1O7m/rJFxkiKW4vod+/WqjoE0Hhfrb8rRrkRjzGeCqqSSnQ3vrunVkvF8hlA +b6FOv4ZBJL4piC1GKH+rscqke9NEiDqXN8C3iYz86jbck/Ha21yUS8T3X7N52sg+ +B3AmOGnLK6BebYeto9vZxQjacChJZSixSxLV+l9/nVQ0+mW42azHdzk0ru59TGAj -----END RSA PRIVATE KEY----- diff --git a/mysql-wsrep-5.6/extra/yassl/examples/client/client.cpp b/mysql-wsrep-5.6/extra/yassl/examples/client/client.cpp index fc05b66a..102ed617 100644 --- a/mysql-wsrep-5.6/extra/yassl/examples/client/client.cpp +++ b/mysql-wsrep-5.6/extra/yassl/examples/client/client.cpp @@ -18,6 +18,10 @@ /* client.cpp */ +// takes an optional command line argument of cipher list to make scripting +// easier + + #include "../../testsuite/test.hpp" //#define TEST_RESUME @@ -73,11 +77,16 @@ void client_test(void* args) #ifdef NON_BLOCKING tcp_set_nonblocking(sockfd); #endif - SSL_METHOD* method = TLSv1_client_method(); SSL_CTX* ctx = SSL_CTX_new(method); set_certs(ctx); + if (argc >= 2) { + printf("setting cipher list to %s\n", argv[1]); + if (SSL_CTX_set_cipher_list(ctx, argv[1]) != SSL_SUCCESS) { + ClientError(ctx, NULL, sockfd, "set_cipher_list error\n"); + } + } SSL* ssl = SSL_new(ctx); SSL_set_fd(ssl, sockfd); diff --git a/mysql-wsrep-5.6/extra/yassl/examples/server/server.cpp b/mysql-wsrep-5.6/extra/yassl/examples/server/server.cpp index 173ce8fb..1540f6d3 100644 --- a/mysql-wsrep-5.6/extra/yassl/examples/server/server.cpp +++ b/mysql-wsrep-5.6/extra/yassl/examples/server/server.cpp @@ -18,6 +18,9 @@ /* server.cpp */ +// takes 2 optional command line argument to make scripting +// if the first command line argument is 'n' client auth is disabled +// if the second command line argument is 'd' DSA certs are used instead of RSA #include "../../testsuite/test.hpp" @@ -69,6 +72,9 @@ THREAD_RETURN YASSL_API server_test(void* args) char** argv = 0; set_args(argc, argv, *static_cast(args)); +#ifdef SERVER_READY_FILE + set_file_ready("server_ready", *static_cast(args)); +#endif tcp_accept(sockfd, clientfd, *static_cast(args)); tcp_close(sockfd); @@ -77,8 +83,21 @@ THREAD_RETURN YASSL_API server_test(void* args) SSL_CTX* ctx = SSL_CTX_new(method); //SSL_CTX_set_cipher_list(ctx, "RC4-SHA:RC4-MD5"); - SSL_CTX_set_verify(ctx, SSL_VERIFY_PEER, 0); - set_serverCerts(ctx); + + // should we disable client auth + if (argc >= 2 && argv[1][0] == 'n') + printf("disabling client auth\n"); + else + SSL_CTX_set_verify(ctx, SSL_VERIFY_PEER, 0); + + // are we using DSA certs + if (argc >= 3 && argv[2][0] == 'd') { + printf("using DSA certs\n"); + set_dsaServerCerts(ctx); + } + else { + set_serverCerts(ctx); + } DH* dh = set_tmpDH(ctx); SSL* ssl = SSL_new(ctx); diff --git a/mysql-wsrep-5.6/extra/yassl/include/buffer.hpp b/mysql-wsrep-5.6/extra/yassl/include/buffer.hpp index 27f71199..77d2ed81 100644 --- a/mysql-wsrep-5.6/extra/yassl/include/buffer.hpp +++ b/mysql-wsrep-5.6/extra/yassl/include/buffer.hpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2000, 2014, 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 @@ -48,7 +48,11 @@ const uint AUTO = 0xFEEDBEEF; struct NoCheck { - void check(uint, uint); + int check(uint, uint); +}; + +struct Check { + int check(uint, uint); }; /* input_buffer operates like a smart c style array with a checking option, @@ -60,11 +64,13 @@ struct NoCheck { * write to the buffer bulk wise and have the correct size */ -class input_buffer : public NoCheck { +class input_buffer : public Check { uint size_; // number of elements in buffer uint current_; // current offset position in buffer byte* buffer_; // storage for buffer byte* end_; // end of storage marker + int error_; // error number + byte zero_; // for returning const reference to zero byte public: input_buffer(); @@ -93,6 +99,10 @@ public: uint get_remaining() const; + int get_error() const; + + void set_error(); + void set_current(uint i); // read only access through [], advance current @@ -103,7 +113,7 @@ public: bool eof(); // peek ahead - byte peek() const; + byte peek(); // write function, should use at/near construction void assign(const byte* t, uint s); diff --git a/mysql-wsrep-5.6/extra/yassl/include/cert_wrapper.hpp b/mysql-wsrep-5.6/extra/yassl/include/cert_wrapper.hpp index da0be6a3..8e3393b4 100644 --- a/mysql-wsrep-5.6/extra/yassl/include/cert_wrapper.hpp +++ b/mysql-wsrep-5.6/extra/yassl/include/cert_wrapper.hpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2005, 2014, 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 @@ -89,6 +89,7 @@ class CertManager { bool verifyNone_; // no error if verify fails bool failNoCert_; bool sendVerify_; + bool sendBlankCert_; VerifyCallback verifyCallback_; // user verify callback public: CertManager(); @@ -116,16 +117,18 @@ public: bool verifyNone() const; bool failNoCert() const; bool sendVerify() const; + bool sendBlankCert() const; void setVerifyPeer(); void setVerifyNone(); void setFailNoCert(); void setSendVerify(); + void setSendBlankCert(); void setPeerX509(X509*); void setVerifyCallback(VerifyCallback); private: CertManager(const CertManager&); // hide copy - CertManager& operator=(const CertManager&); // and assign + CertManager& operator=(const CertManager&); // and assigin }; diff --git a/mysql-wsrep-5.6/extra/yassl/include/openssl/crypto.h b/mysql-wsrep-5.6/extra/yassl/include/openssl/crypto.h index 22bbbbf5..103fcbb0 100644 --- a/mysql-wsrep-5.6/extra/yassl/include/openssl/crypto.h +++ b/mysql-wsrep-5.6/extra/yassl/include/openssl/crypto.h @@ -1,5 +1,6 @@ /* Copyright (C) 2005, 2007 MySQL AB + Use is subject to license terms 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 diff --git a/mysql-wsrep-5.6/extra/yassl/include/openssl/des.h b/mysql-wsrep-5.6/extra/yassl/include/openssl/des.h index 6e2ebbd8..f7394b65 100644 --- a/mysql-wsrep-5.6/extra/yassl/include/openssl/des.h +++ b/mysql-wsrep-5.6/extra/yassl/include/openssl/des.h @@ -1,5 +1,6 @@ /* Copyright (C) 2005 MySQL AB + Use is subject to license terms 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 diff --git a/mysql-wsrep-5.6/extra/yassl/include/openssl/des_old.h b/mysql-wsrep-5.6/extra/yassl/include/openssl/des_old.h index 1223a380..b6e2e3e9 100644 --- a/mysql-wsrep-5.6/extra/yassl/include/openssl/des_old.h +++ b/mysql-wsrep-5.6/extra/yassl/include/openssl/des_old.h @@ -1,5 +1,6 @@ /* Copyright (C) 2007 MySQL AB + Use is subject to license terms 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 diff --git a/mysql-wsrep-5.6/extra/yassl/include/openssl/engine.h b/mysql-wsrep-5.6/extra/yassl/include/openssl/engine.h index cadb05a9..15ddcd14 100644 --- a/mysql-wsrep-5.6/extra/yassl/include/openssl/engine.h +++ b/mysql-wsrep-5.6/extra/yassl/include/openssl/engine.h @@ -1,5 +1,6 @@ /* Copyright (C) 2006 MySQL AB + Use is subject to license terms 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 diff --git a/mysql-wsrep-5.6/extra/yassl/include/openssl/err.h b/mysql-wsrep-5.6/extra/yassl/include/openssl/err.h index 23f2f139..94847429 100644 --- a/mysql-wsrep-5.6/extra/yassl/include/openssl/err.h +++ b/mysql-wsrep-5.6/extra/yassl/include/openssl/err.h @@ -1,5 +1,6 @@ /* Copyright (C) 2005, 2006 MySQL AB + Use is subject to license terms 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 diff --git a/mysql-wsrep-5.6/extra/yassl/include/openssl/evp.h b/mysql-wsrep-5.6/extra/yassl/include/openssl/evp.h index eccdcdff..6aa7335d 100644 --- a/mysql-wsrep-5.6/extra/yassl/include/openssl/evp.h +++ b/mysql-wsrep-5.6/extra/yassl/include/openssl/evp.h @@ -1,5 +1,6 @@ /* Copyright (C) 2007 MySQL AB + Use is subject to license terms 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 diff --git a/mysql-wsrep-5.6/extra/yassl/include/openssl/generate_prefix_files.pl b/mysql-wsrep-5.6/extra/yassl/include/openssl/generate_prefix_files.pl index 9f8f2b17..eb3536c4 100755 --- a/mysql-wsrep-5.6/extra/yassl/include/openssl/generate_prefix_files.pl +++ b/mysql-wsrep-5.6/extra/yassl/include/openssl/generate_prefix_files.pl @@ -1,6 +1,7 @@ #!/usr/bin/perl # Copyright (C) 2006 MySQL AB +# Use is subject to license terms # # 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 diff --git a/mysql-wsrep-5.6/extra/yassl/include/openssl/hmac.h b/mysql-wsrep-5.6/extra/yassl/include/openssl/hmac.h index 478d92e0..5da6644e 100644 --- a/mysql-wsrep-5.6/extra/yassl/include/openssl/hmac.h +++ b/mysql-wsrep-5.6/extra/yassl/include/openssl/hmac.h @@ -1,5 +1,6 @@ /* Copyright (C) 2007 MySQL AB + Use is subject to license terms 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 diff --git a/mysql-wsrep-5.6/extra/yassl/include/openssl/lhash.h b/mysql-wsrep-5.6/extra/yassl/include/openssl/lhash.h index 34bc34c3..6d64df7d 100644 --- a/mysql-wsrep-5.6/extra/yassl/include/openssl/lhash.h +++ b/mysql-wsrep-5.6/extra/yassl/include/openssl/lhash.h @@ -1,5 +1,6 @@ /* Copyright (C) 2005 MySQL AB + Use is subject to license terms 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 diff --git a/mysql-wsrep-5.6/extra/yassl/include/openssl/md4.h b/mysql-wsrep-5.6/extra/yassl/include/openssl/md4.h index 2718d170..8a864993 100644 --- a/mysql-wsrep-5.6/extra/yassl/include/openssl/md4.h +++ b/mysql-wsrep-5.6/extra/yassl/include/openssl/md4.h @@ -1,5 +1,6 @@ /* Copyright (C) 2006 MySQL AB + Use is subject to license terms 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 diff --git a/mysql-wsrep-5.6/extra/yassl/include/openssl/md5.h b/mysql-wsrep-5.6/extra/yassl/include/openssl/md5.h index 9400649e..b54ebcd9 100644 --- a/mysql-wsrep-5.6/extra/yassl/include/openssl/md5.h +++ b/mysql-wsrep-5.6/extra/yassl/include/openssl/md5.h @@ -1,5 +1,6 @@ /* Copyright (C) 2005, 2006 MySQL AB + Use is subject to license terms 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 diff --git a/mysql-wsrep-5.6/extra/yassl/include/openssl/objects.h b/mysql-wsrep-5.6/extra/yassl/include/openssl/objects.h index ec00e04e..ed2c0294 100644 --- a/mysql-wsrep-5.6/extra/yassl/include/openssl/objects.h +++ b/mysql-wsrep-5.6/extra/yassl/include/openssl/objects.h @@ -1,5 +1,6 @@ /* Copyright (C) 2007 MySQL AB + Use is subject to license terms 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 diff --git a/mysql-wsrep-5.6/extra/yassl/include/openssl/opensslv.h b/mysql-wsrep-5.6/extra/yassl/include/openssl/opensslv.h index bafcfaec..88b9ca6d 100644 --- a/mysql-wsrep-5.6/extra/yassl/include/openssl/opensslv.h +++ b/mysql-wsrep-5.6/extra/yassl/include/openssl/opensslv.h @@ -1,5 +1,6 @@ /* Copyright (C) 2005 MySQL AB + Use is subject to license terms 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 diff --git a/mysql-wsrep-5.6/extra/yassl/include/openssl/pem.h b/mysql-wsrep-5.6/extra/yassl/include/openssl/pem.h index 3762b959..c467e461 100644 --- a/mysql-wsrep-5.6/extra/yassl/include/openssl/pem.h +++ b/mysql-wsrep-5.6/extra/yassl/include/openssl/pem.h @@ -1,5 +1,6 @@ /* Copyright (C) 2006 MySQL AB + Use is subject to license terms 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 diff --git a/mysql-wsrep-5.6/extra/yassl/include/openssl/pkcs12.h b/mysql-wsrep-5.6/extra/yassl/include/openssl/pkcs12.h index 71ba287e..c3f8ee67 100644 --- a/mysql-wsrep-5.6/extra/yassl/include/openssl/pkcs12.h +++ b/mysql-wsrep-5.6/extra/yassl/include/openssl/pkcs12.h @@ -1,5 +1,6 @@ /* Copyright (C) 2006 MySQL AB + Use is subject to license terms 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 diff --git a/mysql-wsrep-5.6/extra/yassl/include/openssl/prefix_crypto.h b/mysql-wsrep-5.6/extra/yassl/include/openssl/prefix_crypto.h index ff3aea14..895dd51a 100644 --- a/mysql-wsrep-5.6/extra/yassl/include/openssl/prefix_crypto.h +++ b/mysql-wsrep-5.6/extra/yassl/include/openssl/prefix_crypto.h @@ -1,5 +1,6 @@ /* Copyright (C) 2006 MySQL AB + Use is subject to license terms 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 diff --git a/mysql-wsrep-5.6/extra/yassl/include/openssl/rand.h b/mysql-wsrep-5.6/extra/yassl/include/openssl/rand.h index 136a0145..9e0cedf3 100644 --- a/mysql-wsrep-5.6/extra/yassl/include/openssl/rand.h +++ b/mysql-wsrep-5.6/extra/yassl/include/openssl/rand.h @@ -1,5 +1,6 @@ /* Copyright (C) 2005 MySQL AB + Use is subject to license terms 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 diff --git a/mysql-wsrep-5.6/extra/yassl/include/openssl/rsa.h b/mysql-wsrep-5.6/extra/yassl/include/openssl/rsa.h index b20da32b..95305a84 100644 --- a/mysql-wsrep-5.6/extra/yassl/include/openssl/rsa.h +++ b/mysql-wsrep-5.6/extra/yassl/include/openssl/rsa.h @@ -1,5 +1,6 @@ /* Copyright (C) 2005, 2006 MySQL AB + Use is subject to license terms 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 diff --git a/mysql-wsrep-5.6/extra/yassl/include/openssl/sha.h b/mysql-wsrep-5.6/extra/yassl/include/openssl/sha.h index 79b46ec8..5b7c6bd2 100644 --- a/mysql-wsrep-5.6/extra/yassl/include/openssl/sha.h +++ b/mysql-wsrep-5.6/extra/yassl/include/openssl/sha.h @@ -1,5 +1,6 @@ /* Copyright (C) 2007 MySQL AB + Use is subject to license terms 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 diff --git a/mysql-wsrep-5.6/extra/yassl/include/openssl/ssl.h b/mysql-wsrep-5.6/extra/yassl/include/openssl/ssl.h index 033c72a7..a6ef8232 100644 --- a/mysql-wsrep-5.6/extra/yassl/include/openssl/ssl.h +++ b/mysql-wsrep-5.6/extra/yassl/include/openssl/ssl.h @@ -1,5 +1,5 @@ /* - Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2005, 2014, 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 @@ -34,7 +34,7 @@ #include "rsa.h" -#define YASSL_VERSION "2.2.2" +#define YASSL_VERSION "2.3.7" #if defined(__cplusplus) diff --git a/mysql-wsrep-5.6/extra/yassl/include/openssl/x509.h b/mysql-wsrep-5.6/extra/yassl/include/openssl/x509.h index eb60bcbc..74eb83eb 100644 --- a/mysql-wsrep-5.6/extra/yassl/include/openssl/x509.h +++ b/mysql-wsrep-5.6/extra/yassl/include/openssl/x509.h @@ -1,5 +1,6 @@ /* Copyright (C) 2006 MySQL AB + Use is subject to license terms 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 diff --git a/mysql-wsrep-5.6/extra/yassl/include/openssl/x509v3.h b/mysql-wsrep-5.6/extra/yassl/include/openssl/x509v3.h index 1215826f..b48e9b48 100644 --- a/mysql-wsrep-5.6/extra/yassl/include/openssl/x509v3.h +++ b/mysql-wsrep-5.6/extra/yassl/include/openssl/x509v3.h @@ -1,5 +1,6 @@ /* Copyright (C) 2006 MySQL AB + Use is subject to license terms 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 diff --git a/mysql-wsrep-5.6/extra/yassl/include/yassl_int.hpp b/mysql-wsrep-5.6/extra/yassl/include/yassl_int.hpp index fabf4559..3735827b 100644 --- a/mysql-wsrep-5.6/extra/yassl/include/yassl_int.hpp +++ b/mysql-wsrep-5.6/extra/yassl/include/yassl_int.hpp @@ -107,6 +107,25 @@ enum AcceptState { }; +// track received messages to explicitly disallow duplicate messages +struct RecvdMessages { + uint8 gotClientHello_; + uint8 gotServerHello_; + uint8 gotCert_; + uint8 gotServerKeyExchange_; + uint8 gotCertRequest_; + uint8 gotServerHelloDone_; + uint8 gotCertVerify_; + uint8 gotClientKeyExchange_; + uint8 gotFinished_; + RecvdMessages() : gotClientHello_(0), gotServerHello_(0), gotCert_(0), + gotServerKeyExchange_(0), gotCertRequest_(0), + gotServerHelloDone_(0), gotCertVerify_(0), + gotClientKeyExchange_(0), gotFinished_(0) + {} +}; + + // combines all states class States { RecordLayerState recordLayer_; @@ -115,6 +134,7 @@ class States { ServerState serverState_; ConnectState connectState_; AcceptState acceptState_; + RecvdMessages recvdMessages_; char errorString_[MAX_ERROR_SZ]; YasslError what_; public: @@ -137,6 +157,7 @@ public: AcceptState& UseAccept(); char* useString(); void SetError(YasslError); + int SetMessageRecvd(HandShakeType); private: States(const States&); // hide copy States& operator=(const States&); // and assign diff --git a/mysql-wsrep-5.6/extra/yassl/src/buffer.cpp b/mysql-wsrep-5.6/extra/yassl/src/buffer.cpp index ea09f787..231e0aec 100644 --- a/mysql-wsrep-5.6/extra/yassl/src/buffer.cpp +++ b/mysql-wsrep-5.6/extra/yassl/src/buffer.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2005, 2014, 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 @@ -34,8 +34,19 @@ namespace yaSSL { -void NoCheck::check(uint, uint) +/* return 0 on check success, always true for NoCheck policy */ +int NoCheck::check(uint, uint) { + return 0; +} + +/* return 0 on check success */ +int Check::check(uint i, uint max) +{ + if (i < max) + return 0; + + return -1; } @@ -50,18 +61,20 @@ void NoCheck::check(uint, uint) input_buffer::input_buffer() - : size_(0), current_(0), buffer_(0), end_(0) + : size_(0), current_(0), buffer_(0), end_(0), error_(0), zero_(0) {} input_buffer::input_buffer(uint s) - : size_(0), current_(0), buffer_(NEW_YS byte[s]), end_(buffer_ + s) + : size_(0), current_(0), buffer_(NEW_YS byte[s]), end_(buffer_ + s), + error_(0), zero_(0) {} // with assign input_buffer::input_buffer(uint s, const byte* t, uint len) - : size_(0), current_(0), buffer_(NEW_YS byte[s]), end_(buffer_ + s) + : size_(0), current_(0), buffer_(NEW_YS byte[s]), end_(buffer_ + s), + error_(0), zero_(0) { assign(t, len); } @@ -76,8 +89,10 @@ input_buffer::~input_buffer() // users can pass defualt zero length buffer and then allocate void input_buffer::allocate(uint s) { - buffer_ = NEW_YS byte[s]; - end_ = buffer_ + s; + if (error_ == 0) { + buffer_ = NEW_YS byte[s]; + end_ = buffer_ + s; + } } @@ -92,40 +107,67 @@ byte* input_buffer::get_buffer() const // if you know the size before the write use assign() void input_buffer::add_size(uint i) { - check(size_ + i-1, get_capacity()); - size_ += i; + if (error_ == 0 && check(size_ + i-1, get_capacity()) == 0) + size_ += i; + else + error_ = -1; } uint input_buffer::get_capacity() const { - return (uint) (end_ - buffer_); + if (error_ == 0) + return end_ - buffer_; + + return 0; } uint input_buffer::get_current() const { - return current_; + if (error_ == 0) + return current_; + + return 0; } uint input_buffer::get_size() const { - return size_; + if (error_ == 0) + return size_; + + return 0; } uint input_buffer::get_remaining() const { - return size_ - current_; + if (error_ == 0) + return size_ - current_; + + return 0; +} + + +int input_buffer::get_error() const +{ + return error_; +} + + +void input_buffer::set_error() +{ + error_ = -1; } void input_buffer::set_current(uint i) { - if (i) - check(i - 1, size_); - current_ = i; + if (error_ == 0 && i && check(i - 1, size_) == 0) + current_ = i; + else + error_ = -1; } @@ -133,40 +175,59 @@ void input_buffer::set_current(uint i) // user passes in AUTO index for ease of use const byte& input_buffer::operator[](uint i) { - check(current_, size_); - return buffer_[current_++]; + if (error_ == 0 && check(current_, size_) == 0) + return buffer_[current_++]; + + error_ = -1; + return zero_; } // end of input test bool input_buffer::eof() { + if (error_ != 0) + return true; + return current_ >= size_; } // peek ahead -byte input_buffer::peek() const +byte input_buffer::peek() { - return buffer_[current_]; + if (error_ == 0 && check(current_, size_) == 0) + return buffer_[current_]; + + error_ = -1; + return 0; } // write function, should use at/near construction void input_buffer::assign(const byte* t, uint s) { - check(current_, get_capacity()); - add_size(s); - memcpy(&buffer_[current_], t, s); + if (t && error_ == 0 && check(current_, get_capacity()) == 0) { + add_size(s); + if (error_ == 0) { + memcpy(&buffer_[current_], t, s); + return; // success + } + } + + error_ = -1; } // use read to query input, adjusts current void input_buffer::read(byte* dst, uint length) { - check(current_ + length - 1, size_); - memcpy(dst, &buffer_[current_], length); - current_ += length; + if (dst && error_ == 0 && check(current_ + length - 1, size_) == 0) { + memcpy(dst, &buffer_[current_], length); + current_ += length; + } else { + error_ = -1; + } } diff --git a/mysql-wsrep-5.6/extra/yassl/src/cert_wrapper.cpp b/mysql-wsrep-5.6/extra/yassl/src/cert_wrapper.cpp index 752e9cf5..af94f5bc 100644 --- a/mysql-wsrep-5.6/extra/yassl/src/cert_wrapper.cpp +++ b/mysql-wsrep-5.6/extra/yassl/src/cert_wrapper.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2005, 2014, 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 @@ -91,7 +91,7 @@ opaque* x509::use_buffer() //CertManager CertManager::CertManager() : peerX509_(0), selfX509_(0), verifyPeer_(false), verifyNone_(false), failNoCert_(false), - sendVerify_(false), verifyCallback_(0) + sendVerify_(false), sendBlankCert_(false), verifyCallback_(0) {} @@ -143,6 +143,11 @@ void CertManager::setVerifyNone() verifyNone_ = true; } +bool CertManager::sendBlankCert() const +{ + return sendBlankCert_; +} + void CertManager::setFailNoCert() { @@ -155,6 +160,11 @@ void CertManager::setSendVerify() sendVerify_ = true; } +void CertManager::setSendBlankCert() +{ + sendBlankCert_ = true; +} + void CertManager::setVerifyCallback(VerifyCallback vc) { diff --git a/mysql-wsrep-5.6/extra/yassl/src/crypto_wrapper.cpp b/mysql-wsrep-5.6/extra/yassl/src/crypto_wrapper.cpp index cde3baf5..52994364 100644 --- a/mysql-wsrep-5.6/extra/yassl/src/crypto_wrapper.cpp +++ b/mysql-wsrep-5.6/extra/yassl/src/crypto_wrapper.cpp @@ -950,9 +950,9 @@ x509* PemToDer(FILE* file, CertType type, EncryptedInfo* info) info->set = true; } } - // get blank line - if (fgets(line, sizeof(line), file)) begin = ftell(file); + if (fgets(line,sizeof(line), file)) // get blank line + begin = ftell(file); } } diff --git a/mysql-wsrep-5.6/extra/yassl/src/handshake.cpp b/mysql-wsrep-5.6/extra/yassl/src/handshake.cpp index 280974c1..e63d69e9 100644 --- a/mysql-wsrep-5.6/extra/yassl/src/handshake.cpp +++ b/mysql-wsrep-5.6/extra/yassl/src/handshake.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2005, 2014, 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 @@ -522,7 +522,7 @@ void buildSHA_CertVerify(SSL& ssl, byte* digest) // some clients still send sslv2 client hello void ProcessOldClientHello(input_buffer& input, SSL& ssl) { - if (input.get_remaining() < 2) { + if (input.get_error() || input.get_remaining() < 2) { ssl.SetError(bad_input); return; } @@ -549,20 +549,24 @@ void ProcessOldClientHello(input_buffer& input, SSL& ssl) byte len[2]; - input.read(len, sizeof(len)); + len[0] = input[AUTO]; + len[1] = input[AUTO]; ato16(len, ch.suite_len_); - input.read(len, sizeof(len)); + len[0] = input[AUTO]; + len[1] = input[AUTO]; uint16 sessionLen; ato16(len, sessionLen); ch.id_len_ = sessionLen; - input.read(len, sizeof(len)); + len[0] = input[AUTO]; + len[1] = input[AUTO]; uint16 randomLen; ato16(len, randomLen); - if (ch.suite_len_ > MAX_SUITE_SZ || sessionLen > ID_LEN || - randomLen > RAN_LEN) { + if (input.get_error() || ch.suite_len_ > MAX_SUITE_SZ || + ch.suite_len_ > input.get_remaining() || + sessionLen > ID_LEN || randomLen > RAN_LEN) { ssl.SetError(bad_input); return; } @@ -580,13 +584,12 @@ void ProcessOldClientHello(input_buffer& input, SSL& ssl) ch.suite_len_ = j; if (ch.id_len_) - input.read(ch.session_id_, ch.id_len_); + input.read(ch.session_id_, ch.id_len_); // id_len_ from sessionLen if (randomLen < RAN_LEN) memset(ch.random_, 0, RAN_LEN - randomLen); input.read(&ch.random_[RAN_LEN - randomLen], randomLen); - ch.Process(input, ssl); } @@ -783,6 +786,9 @@ int DoProcessReply(SSL& ssl) ssl.verifyState(hdr); } + if (ssl.GetError()) + return 0; + // make sure we have enough input in buffer to process this record if (needHdr || hdr.length_ > buffer.get_remaining()) { // put header in front for next time processing @@ -795,6 +801,9 @@ int DoProcessReply(SSL& ssl) while (buffer.get_current() < hdr.length_ + RECORD_HEADER + offset) { // each message in record, can be more than 1 if not encrypted + if (ssl.GetError()) + return 0; + if (ssl.getSecurity().get_parms().pending_ == false) { // cipher on // sanity check for malicious/corrupted/illegal input if (buffer.get_remaining() < hdr.length_) { @@ -1155,6 +1164,8 @@ void sendCertificateVerify(SSL& ssl, BufferOutput buffer) { if (ssl.GetError()) return; + if(ssl.getCrypto().get_certManager().sendBlankCert()) return; + CertificateVerify verify; verify.Build(ssl); RecordLayerHeader rlHeader; diff --git a/mysql-wsrep-5.6/extra/yassl/src/ssl.cpp b/mysql-wsrep-5.6/extra/yassl/src/ssl.cpp index ae4c1eef..028e0fa4 100644 --- a/mysql-wsrep-5.6/extra/yassl/src/ssl.cpp +++ b/mysql-wsrep-5.6/extra/yassl/src/ssl.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2005, 2014, 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 @@ -790,7 +790,10 @@ int SSL_CTX_load_verify_locations(SSL_CTX* ctx, const char* file, strncpy(name, path, MAX_PATH - 1 - HALF_PATH); strncat(name, "/", 1); strncat(name, entry->d_name, HALF_PATH); - if (stat(name, &buf) < 0) return SSL_BAD_STAT; + if (stat(name, &buf) < 0) { + closedir(dir); + return SSL_BAD_STAT; + } if (S_ISREG(buf.st_mode)) ret = read_file(ctx, name, SSL_FILETYPE_PEM, CA); diff --git a/mysql-wsrep-5.6/extra/yassl/src/yassl_imp.cpp b/mysql-wsrep-5.6/extra/yassl/src/yassl_imp.cpp index e7dab13c..69ba469b 100644 --- a/mysql-wsrep-5.6/extra/yassl/src/yassl_imp.cpp +++ b/mysql-wsrep-5.6/extra/yassl/src/yassl_imp.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2005, 2014, 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 @@ -220,18 +220,29 @@ void DH_Server::build(SSL& ssl) // read PreMaster secret and decrypt, server side void EncryptedPreMasterSecret::read(SSL& ssl, input_buffer& input) { + if (input.get_error()) { + ssl.SetError(bad_input); + return; + } + const CertManager& cert = ssl.getCrypto().get_certManager(); RSA rsa(cert.get_privateKey(), cert.get_privateKeyLength(), false); uint16 cipherLen = rsa.get_cipherLength(); if (ssl.isTLS()) { byte len[2]; - input.read(len, sizeof(len)); + len[0] = input[AUTO]; + len[1] = input[AUTO]; ato16(len, cipherLen); } alloc(cipherLen); input.read(secret_, length_); + if (input.get_error()) { + ssl.SetError(bad_input); + return; + } opaque preMasterSecret[SECRET_LEN]; + memset(preMasterSecret, 0, sizeof(preMasterSecret)); rsa.decrypt(preMasterSecret, secret_, length_, ssl.getCrypto().get_random()); @@ -277,6 +288,11 @@ void EncryptedPreMasterSecret::alloc(int sz) // read client's public key, server side void ClientDiffieHellmanPublic::read(SSL& ssl, input_buffer& input) { + if (input.get_error() || input.get_remaining() < (uint)LENGTH_SZ) { + ssl.SetError(bad_input); + return; + } + DiffieHellman& dh = ssl.useCrypto().use_dh(); uint16 keyLength; @@ -285,8 +301,17 @@ void ClientDiffieHellmanPublic::read(SSL& ssl, input_buffer& input) tmp[1] = input[AUTO]; ato16(tmp, keyLength); + if (keyLength < dh.get_agreedKeyLength()/2) { + ssl.SetError(bad_input); + return; + } + alloc(keyLength); input.read(Yc_, keyLength); + if (input.get_error()) { + ssl.SetError(bad_input); + return; + } dh.makeAgreement(Yc_, keyLength); // because of encoding, first byte might be 0, don't use for preMaster @@ -331,6 +356,10 @@ void ClientDiffieHellmanPublic::alloc(int sz, bool offset) // read server's p, g, public key and sig, client side void DH_Server::read(SSL& ssl, input_buffer& input) { + if (input.get_error() || input.get_remaining() < (uint)LENGTH_SZ) { + ssl.SetError(bad_input); + return; + } uint16 length, messageTotal = 6; // pSz + gSz + pubSz byte tmp[2]; @@ -341,6 +370,10 @@ void DH_Server::read(SSL& ssl, input_buffer& input) messageTotal += length; input.read(parms_.alloc_p(length), length); + if (input.get_error() || input.get_remaining() < (uint)LENGTH_SZ) { + ssl.SetError(bad_input); + return; + } // g tmp[0] = input[AUTO]; @@ -349,6 +382,10 @@ void DH_Server::read(SSL& ssl, input_buffer& input) messageTotal += length; input.read(parms_.alloc_g(length), length); + if (input.get_error() || input.get_remaining() < (uint)LENGTH_SZ) { + ssl.SetError(bad_input); + return; + } // pub tmp[0] = input[AUTO]; @@ -357,20 +394,36 @@ void DH_Server::read(SSL& ssl, input_buffer& input) messageTotal += length; input.read(parms_.alloc_pub(length), length); + if (input.get_error() || input.get_remaining() < (uint)LENGTH_SZ) { + ssl.SetError(bad_input); + return; + } // save message for hash verify input_buffer message(messageTotal); input.set_current(input.get_current() - messageTotal); input.read(message.get_buffer(), messageTotal); message.add_size(messageTotal); + if (input.get_error() || input.get_remaining() < (uint)LENGTH_SZ) { + ssl.SetError(bad_input); + return; + } // signature tmp[0] = input[AUTO]; tmp[1] = input[AUTO]; ato16(tmp, length); + if (length == 0) { + ssl.SetError(bad_input); + return; + } signature_ = NEW_YS byte[length]; input.read(signature_, length); + if (input.get_error()) { + ssl.SetError(bad_input); + return; + } // verify signature byte hash[FINISHED_SZ]; @@ -645,6 +698,10 @@ void HandShakeHeader::Process(input_buffer& input, SSL& ssl) { ssl.verifyState(*this); if (ssl.GetError()) return; + if (input.get_error()) { + ssl.SetError(bad_input); + return; + } const HandShakeFactory& hsf = ssl.getFactory().getHandShake(); mySTL::auto_ptr hs(hsf.CreateObject(type_)); if (!hs.get()) { @@ -810,8 +867,19 @@ uint16 ChangeCipherSpec::get_length() const // CipherSpec processing handler -void ChangeCipherSpec::Process(input_buffer&, SSL& ssl) +void ChangeCipherSpec::Process(input_buffer& input, SSL& ssl) { + if (input.get_error()) { + ssl.SetError(bad_input); + return; + } + + // detect duplicate change_cipher + if (ssl.getSecurity().get_parms().pending_ == false) { + ssl.order_error(); + return; + } + ssl.useSecurity().use_parms().pending_ = false; if (ssl.getSecurity().get_resuming()) { if (ssl.getSecurity().get_parms().entity_ == client_end) @@ -873,6 +941,11 @@ output_buffer& operator<<(output_buffer& output, const Alert& a) // Alert processing handler void Alert::Process(input_buffer& input, SSL& ssl) { + if (input.get_error()) { + ssl.SetError(bad_input); + return; + } + if (ssl.getSecurity().get_parms().pending_ == false) { // encrypted alert int aSz = get_length(); // alert size already read on input opaque verify[SHA_LEN]; @@ -890,12 +963,19 @@ void Alert::Process(input_buffer& input, SSL& ssl) if (ssl.getSecurity().get_parms().cipher_type_ == block) { int ivExtra = 0; + opaque fill; if (ssl.isTLSv1_1()) ivExtra = ssl.getCrypto().get_cipher().get_blockSize(); int padSz = ssl.getSecurity().get_parms().encrypt_size_ - ivExtra - aSz - digestSz; - input.set_current(input.get_current() + padSz); + for (int i = 0; i < padSz; i++) + fill = input[AUTO]; + } + + if (input.get_error()) { + ssl.SetError(bad_input); + return; } // verify @@ -1112,6 +1192,11 @@ static int timing_verify(SSL& ssl, const byte* input, int padLen, int t, // Process handler for Data void Data::Process(input_buffer& input, SSL& ssl) { + if (input.get_error()) { + ssl.SetError(bad_input); + return; + } + int msgSz = ssl.getSecurity().get_parms().encrypt_size_; int pad = 0, padSz = 0; int ivExtra = 0; @@ -1154,7 +1239,7 @@ void Data::Process(input_buffer& input, SSL& ssl) int dataSz = msgSz - ivExtra - digestSz - pad - padSz; - if (dataSz < 0) { + if (dataSz < 0 || dataSz > (MAX_RECORD_SIZE + COMPRESS_EXTRA)) { ssl.SetError(bad_input); return; } @@ -1180,6 +1265,10 @@ void Data::Process(input_buffer& input, SSL& ssl) // advance past mac and fill input.set_current(input.get_current() + digestSz + pad + padSz); + if (input.get_error()) { + ssl.SetError(bad_input); + return; + } } @@ -1199,22 +1288,38 @@ output_buffer& operator<<(output_buffer& output, const HandShakeBase& hs) Certificate::Certificate(const x509* cert) : cert_(cert) { - set_length(cert_->get_length() + 2 * CERT_HEADER); // list and cert size + if (cert) + set_length(cert_->get_length() + 2 * CERT_HEADER); // list and cert size + else + set_length(CERT_HEADER); // total blank cert size, just list header } const opaque* Certificate::get_buffer() const { - return cert_->get_buffer(); + if (cert_) + return cert_->get_buffer(); + + return NULL; } // output operator for Certificate output_buffer& operator<<(output_buffer& output, const Certificate& cert) { - uint sz = cert.get_length() - 2 * CERT_HEADER; + uint sz = cert.get_length(); opaque tmp[CERT_HEADER]; + if ((int)sz > CERT_HEADER) + sz -= 2 * CERT_HEADER; // actual cert, not including headers + else { + sz = 0; // blank cert case + c32to24(sz, tmp); + output.write(tmp, CERT_HEADER); + + return output; + } + c32to24(sz + CERT_HEADER, tmp); output.write(tmp, CERT_HEADER); c32to24(sz, tmp); @@ -1228,6 +1333,11 @@ output_buffer& operator<<(output_buffer& output, const Certificate& cert) // certificate processing handler void Certificate::Process(input_buffer& input, SSL& ssl) { + if (input.get_error()) { + ssl.SetError(bad_input); + return; + } + CertManager& cm = ssl.useCrypto().use_certManager(); uint32 list_sz; @@ -1264,9 +1374,11 @@ void Certificate::Process(input_buffer& input, SSL& ssl) ssl.SetError(YasslError(bad_input)); return; } - x509* myCert; - cm.AddPeerCert(myCert = NEW_YS x509(cert_sz)); - input.read(myCert->use_buffer(), myCert->get_length()); + if (cert_sz) { + x509* myCert; + cm.AddPeerCert(myCert = NEW_YS x509(cert_sz)); + input.read(myCert->use_buffer(), myCert->get_length()); + } list_sz -= cert_sz + CERT_HEADER; } @@ -1394,6 +1506,10 @@ input_buffer& operator>>(input_buffer& input, ServerHello& hello) // Session hello.id_len_ = input[AUTO]; + if (hello.id_len_ > ID_LEN) { + input.set_error(); + return input; + } if (hello.id_len_) input.read(hello.session_id_, hello.id_len_); @@ -1434,8 +1550,13 @@ output_buffer& operator<<(output_buffer& output, const ServerHello& hello) // Server Hello processing handler -void ServerHello::Process(input_buffer&, SSL& ssl) +void ServerHello::Process(input_buffer& input, SSL& ssl) { + if (input.get_error()) { + ssl.SetError(bad_input); + return; + } + if (ssl.GetMultiProtocol()) { // SSLv23 support if (ssl.isTLS() && server_version_.minor_ < 1) // downgrade to SSLv3 @@ -1529,8 +1650,12 @@ const opaque* ServerHello::get_random() const // Server Hello Done processing handler -void ServerHelloDone::Process(input_buffer&, SSL& ssl) +void ServerHelloDone::Process(input_buffer& input, SSL& ssl) { + if (input.get_error()) { + ssl.SetError(bad_input); + return; + } ssl.useStates().useClient() = serverHelloDoneComplete; } @@ -1649,8 +1774,13 @@ output_buffer& operator<<(output_buffer& output, const ClientHello& hello) // Client Hello processing handler -void ClientHello::Process(input_buffer&, SSL& ssl) +void ClientHello::Process(input_buffer& input, SSL& ssl) { + if (input.get_error()) { + ssl.SetError(bad_input); + return; + } + // store version for pre master secret ssl.useSecurity().use_connection().chVersion_ = client_version_; @@ -1782,9 +1912,17 @@ output_buffer& operator<<(output_buffer& output, const ServerKeyExchange& sk) // Server Key Exchange processing handler void ServerKeyExchange::Process(input_buffer& input, SSL& ssl) { + if (input.get_error()) { + ssl.SetError(bad_input); + return; + } createKey(ssl); if (ssl.GetError()) return; server_key_->read(ssl, input); + if (input.get_error()) { + ssl.SetError(bad_input); + return; + } ssl.useStates().useClient() = serverKeyExchangeComplete; } @@ -1906,27 +2044,32 @@ input_buffer& operator>>(input_buffer& input, CertificateRequest& request) { // types request.typeTotal_ = input[AUTO]; + if (request.typeTotal_ > CERT_TYPES) { + input.set_error(); + return input; + } for (int i = 0; i < request.typeTotal_; i++) request.certificate_types_[i] = ClientCertificateType(input[AUTO]); - byte tmp[REQUEST_HEADER]; - input.read(tmp, sizeof(tmp)); + byte tmp[2]; + tmp[0] = input[AUTO]; + tmp[1] = input[AUTO]; uint16 sz; ato16(tmp, sz); // authorities while (sz) { uint16 dnSz; - input.read(tmp, sizeof(tmp)); + tmp[0] = input[AUTO]; + tmp[1] = input[AUTO]; ato16(tmp, dnSz); - - DistinguishedName dn; - request.certificate_authorities_.push_back(dn = NEW_YS - byte[REQUEST_HEADER + dnSz]); - memcpy(dn, tmp, REQUEST_HEADER); - input.read(&dn[REQUEST_HEADER], dnSz); + + input.set_current(input.get_current() + dnSz); sz -= dnSz + REQUEST_HEADER; + + if (input.get_error()) + break; } return input; @@ -1965,13 +2108,17 @@ output_buffer& operator<<(output_buffer& output, // CertificateRequest processing handler -void CertificateRequest::Process(input_buffer&, SSL& ssl) +void CertificateRequest::Process(input_buffer& input, SSL& ssl) { + if (input.get_error()) { + ssl.SetError(bad_input); + return; + } CertManager& cm = ssl.useCrypto().use_certManager(); - // make sure user provided cert and key before sending and using - if (cm.get_cert() && cm.get_privateKey()) - cm.setSendVerify(); + cm.setSendVerify(); + if (cm.get_cert() == NULL || cm.get_privateKey() == NULL) + cm.setSendBlankCert(); // send blank cert, OpenSSL requires now } @@ -2049,12 +2196,18 @@ output_buffer& CertificateVerify::get(output_buffer& out) const input_buffer& operator>>(input_buffer& input, CertificateVerify& request) { byte tmp[VERIFY_HEADER]; - input.read(tmp, sizeof(tmp)); + tmp[0] = input[AUTO]; + tmp[1] = input[AUTO]; uint16 sz = 0; ato16(tmp, sz); request.set_length(sz); + if (sz == 0) { + input.set_error(); + return input; + } + request.signature_ = NEW_YS byte[sz]; input.read(request.signature_, sz); @@ -2073,8 +2226,13 @@ output_buffer& operator<<(output_buffer& output, // CertificateVerify processing handler -void CertificateVerify::Process(input_buffer&, SSL& ssl) +void CertificateVerify::Process(input_buffer& input, SSL& ssl) { + if (input.get_error()) { + ssl.SetError(bad_input); + return; + } + const Hashes& hashVerify = ssl.getHashes().get_certVerify(); const CertManager& cert = ssl.getCrypto().get_certManager(); @@ -2113,9 +2271,17 @@ output_buffer& operator<<(output_buffer& output, const ClientKeyExchange& ck) // Client Key Exchange processing handler void ClientKeyExchange::Process(input_buffer& input, SSL& ssl) { + if (input.get_error()) { + ssl.SetError(bad_input); + return; + } createKey(ssl); if (ssl.GetError()) return; client_key_->read(ssl, input); + if (input.get_error()) { + ssl.SetError(bad_input); + return; + } if (ssl.getCrypto().get_certManager().verifyPeer()) build_certHashes(ssl, ssl.useHashes().use_certVerify()); @@ -2202,11 +2368,19 @@ output_buffer& operator<<(output_buffer& output, const Finished& fin) // Finished processing handler void Finished::Process(input_buffer& input, SSL& ssl) { + if (input.get_error()) { + ssl.SetError(bad_input); + return; + } // verify hashes const Finished& verify = ssl.getHashes().get_verify(); uint finishedSz = ssl.isTLS() ? TLS_FINISHED_SZ : FINISHED_SZ; input.read(hashes_.md5_, finishedSz); + if (input.get_error()) { + ssl.SetError(bad_input); + return; + } if (memcmp(&hashes_, &verify.hashes_, finishedSz)) { ssl.SetError(verify_error); @@ -2228,19 +2402,23 @@ void Finished::Process(input_buffer& input, SSL& ssl) opaque mac[SHA_LEN]; // max size int digestSz = ssl.getCrypto().get_digest().get_digestSize(); input.read(mac, digestSz); + if (input.get_error()) { + ssl.SetError(bad_input); + return; + } uint ivExtra = 0; if (ssl.getSecurity().get_parms().cipher_type_ == block) if (ssl.isTLSv1_1()) ivExtra = ssl.getCrypto().get_cipher().get_blockSize(); + opaque fill; int padSz = ssl.getSecurity().get_parms().encrypt_size_ - ivExtra - HANDSHAKE_HEADER - finishedSz - digestSz; - input.set_current(input.get_current() + padSz); - - // verify mac - if (memcmp(mac, verifyMAC, digestSz)) { - ssl.SetError(verify_error); + for (int i = 0; i < padSz; i++) + fill = input[AUTO]; + if (input.get_error()) { + ssl.SetError(bad_input); return; } diff --git a/mysql-wsrep-5.6/extra/yassl/src/yassl_int.cpp b/mysql-wsrep-5.6/extra/yassl/src/yassl_int.cpp index 8dce8bd1..16858a6e 100644 --- a/mysql-wsrep-5.6/extra/yassl/src/yassl_int.cpp +++ b/mysql-wsrep-5.6/extra/yassl/src/yassl_int.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2005, 2014, 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 @@ -256,6 +256,77 @@ void States::SetError(YasslError ye) } +// mark message recvd, check for duplicates, return 0 on success +int States::SetMessageRecvd(HandShakeType hst) +{ + switch (hst) { + case hello_request: + break; // could send more than one + + case client_hello: + if (recvdMessages_.gotClientHello_) + return -1; + recvdMessages_.gotClientHello_ = 1; + break; + + case server_hello: + if (recvdMessages_.gotServerHello_) + return -1; + recvdMessages_.gotServerHello_ = 1; + break; + + case certificate: + if (recvdMessages_.gotCert_) + return -1; + recvdMessages_.gotCert_ = 1; + break; + + case server_key_exchange: + if (recvdMessages_.gotServerKeyExchange_) + return -1; + recvdMessages_.gotServerKeyExchange_ = 1; + break; + + case certificate_request: + if (recvdMessages_.gotCertRequest_) + return -1; + recvdMessages_.gotCertRequest_ = 1; + break; + + case server_hello_done: + if (recvdMessages_.gotServerHelloDone_) + return -1; + recvdMessages_.gotServerHelloDone_ = 1; + break; + + case certificate_verify: + if (recvdMessages_.gotCertVerify_) + return -1; + recvdMessages_.gotCertVerify_ = 1; + break; + + case client_key_exchange: + if (recvdMessages_.gotClientKeyExchange_) + return -1; + recvdMessages_.gotClientKeyExchange_ = 1; + break; + + case finished: + if (recvdMessages_.gotFinished_) + return -1; + recvdMessages_.gotFinished_ = 1; + break; + + + default: + return -1; + + } + + return 0; +} + + sslFactory::sslFactory() : messageFactory_(InitMessageFactory), handShakeFactory_(InitHandShakeFactory), @@ -1251,6 +1322,11 @@ void SSL::verifyState(const HandShakeHeader& hsHeader) return; } + if (states_.SetMessageRecvd(hsHeader.get_handshakeType()) != 0) { + order_error(); + return; + } + if (secure_.get_parms().entity_ == client_end) verifyClientState(hsHeader.get_handshakeType()); else @@ -2638,8 +2714,9 @@ ASN1_STRING* StringHolder::GetString() int DeCompress(input_buffer& in, int sz, input_buffer& out) { byte tmp[LENGTH_SZ]; - - in.read(tmp, sizeof(tmp)); + + tmp[0] = in[AUTO]; + tmp[1] = in[AUTO]; uint16 len; ato16(tmp, len); diff --git a/mysql-wsrep-5.6/extra/yassl/taocrypt/CMakeLists.txt b/mysql-wsrep-5.6/extra/yassl/taocrypt/CMakeLists.txt index aa71ce32..267030ea 100644 --- a/mysql-wsrep-5.6/extra/yassl/taocrypt/CMakeLists.txt +++ b/mysql-wsrep-5.6/extra/yassl/taocrypt/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2006, 2014, 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 @@ -36,7 +36,6 @@ ENDIF() ADD_CONVENIENCE_LIBRARY(taocrypt ${TAOCRYPT_SOURCES}) RESTRICT_SYMBOL_EXPORTS(taocrypt) -INSTALL_DEBUG_SYMBOLS(taocrypt) IF(MSVC) INSTALL_DEBUG_TARGET(taocrypt DESTINATION ${INSTALL_LIBDIR}/debug) ENDIF() diff --git a/mysql-wsrep-5.6/extra/yassl/taocrypt/include/asn.hpp b/mysql-wsrep-5.6/extra/yassl/taocrypt/include/asn.hpp index cfa8cee5..bc3eebe6 100644 --- a/mysql-wsrep-5.6/extra/yassl/taocrypt/include/asn.hpp +++ b/mysql-wsrep-5.6/extra/yassl/taocrypt/include/asn.hpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2000, 2014, 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 @@ -261,8 +261,8 @@ enum ContentType { HUH = 651 }; enum SigType { SHAwDSA = 517, MD2wRSA = 646, MD5wRSA = 648, SHAwRSA = 649, SHA256wRSA = 655, SHA384wRSA = 656, SHA512wRSA = 657, SHA256wDSA = 416 }; -enum HashType { MD2h = 646, MD5h = 649, SHAh = 88, SHA256h = 414, - SHA384h = 415, SHA512h = 416 }; +enum HashType { MD2h = 646, MD5h = 649, SHAh = 88, SHA256h = 414, SHA384h = 415, + SHA512h = 416 }; enum KeyType { DSAk = 515, RSAk = 645 }; // sums of algo OID @@ -300,11 +300,11 @@ private: byte* signature_; char issuer_[ASN_NAME_MAX]; // Names char subject_[ASN_NAME_MAX]; // Names - char beforeDate_[MAX_DATE_SZ]; // valid before date - byte beforeDateType_; // beforeDate time type - char afterDate_[MAX_DATE_SZ]; // valid after date - byte afterDateType_; // afterDate time type - bool verify_; // Default to yes, but could be off + char beforeDate_[MAX_DATE_SZ+1]; // valid before date, +null term + byte beforeDateType_; // beforeDate time type + char afterDate_[MAX_DATE_SZ+1]; // valid after date, +null term + byte afterDateType_; // afterDate time type + bool verify_; // Default to yes, but could be off void ReadHeader(); void Decode(SignerList*, CertType); diff --git a/mysql-wsrep-5.6/extra/yassl/taocrypt/include/block.hpp b/mysql-wsrep-5.6/extra/yassl/taocrypt/include/block.hpp index d7a69211..4f58c82f 100644 --- a/mysql-wsrep-5.6/extra/yassl/taocrypt/include/block.hpp +++ b/mysql-wsrep-5.6/extra/yassl/taocrypt/include/block.hpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2000, 2014, 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 @@ -74,7 +74,7 @@ typename A::pointer StdReallocate(A& a, T* p, typename A::size_type oldSize, if (preserve) { A b = A(); typename A::pointer newPointer = b.allocate(newSize, 0); - memcpy(newPointer, p, sizeof(T) * min((word32) oldSize, (word32) newSize)); + memcpy(newPointer, p, sizeof(T) * min(oldSize, newSize)); a.deallocate(p, oldSize); STL::swap(a, b); return newPointer; @@ -186,9 +186,9 @@ public: ~Block() { allocator_.deallocate(buffer_, sz_); } private: + A allocator_; word32 sz_; // size in Ts T* buffer_; - A allocator_; }; diff --git a/mysql-wsrep-5.6/extra/yassl/taocrypt/include/integer.hpp b/mysql-wsrep-5.6/extra/yassl/taocrypt/include/integer.hpp index e1a2ed5f..75a3ee3d 100644 --- a/mysql-wsrep-5.6/extra/yassl/taocrypt/include/integer.hpp +++ b/mysql-wsrep-5.6/extra/yassl/taocrypt/include/integer.hpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2000, 2014, 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 @@ -45,6 +45,14 @@ #endif +#ifdef TAOCRYPT_X86ASM_AVAILABLE + #if defined(__GNUC__) && (__GNUC__ >= 4) + // GCC 4 or greater optimizes too much inline on recursive for bigint, + // -O3 just as fast without asm here anyway + #undef TAOCRYPT_X86ASM_AVAILABLE + #endif +#endif + #ifdef TAOCRYPT_X86ASM_AVAILABLE #ifdef _M_IX86 diff --git a/mysql-wsrep-5.6/extra/yassl/taocrypt/include/misc.hpp b/mysql-wsrep-5.6/extra/yassl/taocrypt/include/misc.hpp index 7624ef97..cb4d26e7 100644 --- a/mysql-wsrep-5.6/extra/yassl/taocrypt/include/misc.hpp +++ b/mysql-wsrep-5.6/extra/yassl/taocrypt/include/misc.hpp @@ -124,15 +124,22 @@ void CleanUp(); // no gas on these systems ?, disable for now -#if defined(__sun__) || defined (__APPLE__) +#if defined(__sun__) + #undef TAOCRYPT_DISABLE_X86ASM #define TAOCRYPT_DISABLE_X86ASM #endif // icc problem with -03 and integer, disable for now #if defined(__INTEL_COMPILER) + #undef TAOCRYPT_DISABLE_X86ASM #define TAOCRYPT_DISABLE_X86ASM #endif +// indpedent of build system, unless ia32 asm is enabled disable it +#if !defined(TAOCRYPT_ENABLE_X86ASM) + #undef TAOCRYPT_DISABLE_X86ASM + #define TAOCRYPT_DISABLE_X86ASM +#endif // Turn on ia32 ASM for Big Integer // CodeWarrior defines _MSC_VER diff --git a/mysql-wsrep-5.6/extra/yassl/taocrypt/include/pwdbased.hpp b/mysql-wsrep-5.6/extra/yassl/taocrypt/include/pwdbased.hpp index 9025cc1a..cf4dff5c 100644 --- a/mysql-wsrep-5.6/extra/yassl/taocrypt/include/pwdbased.hpp +++ b/mysql-wsrep-5.6/extra/yassl/taocrypt/include/pwdbased.hpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2000, 2014, 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 @@ -16,6 +16,7 @@ MA 02110-1301 USA. */ + /* pwdbased.hpp defines PBKDF2 from PKCS #5 */ @@ -48,10 +49,7 @@ word32 PBKDF2_HMAC::DeriveKey(byte* derived, word32 dLen, const byte* pwd, word32 pLen, const byte* salt, word32 sLen, word32 iterations) const { - if (dLen > MaxDerivedKeyLength()) - return 0; - - if (iterations < 0) + if (dLen > MaxDerivedKeyLength()) return 0; ByteBlock buffer(T::DIGEST_SIZE); diff --git a/mysql-wsrep-5.6/extra/yassl/taocrypt/include/runtime.hpp b/mysql-wsrep-5.6/extra/yassl/taocrypt/include/runtime.hpp index ef7ce092..4c743625 100644 --- a/mysql-wsrep-5.6/extra/yassl/taocrypt/include/runtime.hpp +++ b/mysql-wsrep-5.6/extra/yassl/taocrypt/include/runtime.hpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2000, 2014, 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 @@ -34,7 +34,10 @@ // Handler for pure virtual functions namespace __Crun { - void pure_error(void); + static void pure_error(void) + { + // "Pure virtual method called, Aborted", GCC 4.2 str cmp fix + } } // namespace __Crun #endif // __sun @@ -48,7 +51,15 @@ extern "C" { #if defined(DO_TAOCRYPT_KERNEL_MODE) #include "kernelc.hpp" #endif - int __cxa_pure_virtual () __attribute__ ((weak)); + +/* Disallow inline __cxa_pure_virtual() */ +static int __cxa_pure_virtual() __attribute__((noinline, used)); +static int __cxa_pure_virtual() +{ + // oops, pure virtual called! + return 0; +} + } // extern "C" #endif // __GNUC__ > 2 diff --git a/mysql-wsrep-5.6/extra/yassl/taocrypt/include/sha.hpp b/mysql-wsrep-5.6/extra/yassl/taocrypt/include/sha.hpp index 5ff86dd1..cf6d0d09 100644 --- a/mysql-wsrep-5.6/extra/yassl/taocrypt/include/sha.hpp +++ b/mysql-wsrep-5.6/extra/yassl/taocrypt/include/sha.hpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2000, 2014, 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 diff --git a/mysql-wsrep-5.6/extra/yassl/taocrypt/src/aes.cpp b/mysql-wsrep-5.6/extra/yassl/taocrypt/src/aes.cpp index 9b04e7b0..ee4c7a6e 100644 --- a/mysql-wsrep-5.6/extra/yassl/taocrypt/src/aes.cpp +++ b/mysql-wsrep-5.6/extra/yassl/taocrypt/src/aes.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2000, 2014, 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 @@ -52,7 +52,7 @@ void AES::Process(byte* out, const byte* in, word32 sz) in += BLOCK_SIZE; } else if (mode_ == CBC) { - if (dir_ == ENCRYPTION) + if (dir_ == ENCRYPTION) { while (blocks--) { r_[0] ^= *(word32*)in; r_[1] ^= *(word32*)(in + 4); @@ -65,7 +65,8 @@ void AES::Process(byte* out, const byte* in, word32 sz) out += BLOCK_SIZE; in += BLOCK_SIZE; } - else + } + else { while (blocks--) { AsmDecrypt(in, out, (void*)Td0); @@ -78,7 +79,8 @@ void AES::Process(byte* out, const byte* in, word32 sz) out += BLOCK_SIZE; in += BLOCK_SIZE; } - } + } + } } #endif // DO_AES_ASM @@ -452,27 +454,30 @@ void AES::decrypt(const byte* inBlock, const byte* xorBlock, #if defined(DO_AES_ASM) #ifdef __GNUC__ - #define AS1(x) asm(#x); - #define AS2(x, y) asm(#x ", " #y); + #define AS1(x) #x ";" + #define AS2(x, y) #x ", " #y ";" #define PROLOG() \ - asm(".intel_syntax noprefix"); \ - AS2( movd mm3, edi ) \ - AS2( movd mm4, ebx ) \ - AS2( sub esp, 4 ) \ - AS2( movd mm7, ebp ) \ - AS2( mov [ebp - 4], esi ) \ - AS2( mov ecx, DWORD PTR [ebp + 8] ) \ - AS2( mov esi, DWORD PTR [ebp + 12] ) \ - AS2( mov ebp, DWORD PTR [ebp + 20] ) - + __asm__ __volatile__ \ + ( \ + ".intel_syntax noprefix;" \ + "push ebx;" \ + "push ebp;" \ + "movd mm7, ebp;" \ + "movd mm4, eax;" \ + "mov ebp, edx;" \ + "sub esp, 4;" #define EPILOG() \ - AS2( mov esi, [ebp - 4] ) \ - AS2( mov esp, ebp ) \ - AS2( movd ebx, mm4 ) \ - AS2( movd edi, mm3 ) \ - AS1( emms ) \ - asm(".att_syntax"); + "add esp, 4;" \ + "pop ebp;" \ + "pop ebx;" \ + "emms;" \ + ".att_syntax;" \ + : \ + : "c" (this), "S" (inBlock), "d" (boxes), "a" (outBlock) \ + : "%edi", "memory", "cc" \ + ); + #else #define AS1(x) __asm x #define AS2(x, y) __asm x, y @@ -504,6 +509,8 @@ void AES::decrypt(const byte* inBlock, const byte* xorBlock, #ifdef _MSC_VER __declspec(naked) +#else + __attribute__ ((noinline)) #endif void AES::AsmEncrypt(const byte* inBlock, byte* outBlock, void* boxes) const { @@ -537,7 +544,11 @@ void AES::AsmEncrypt(const byte* inBlock, byte* outBlock, void* boxes) const AS2( xor ecx, DWORD PTR [edi + 8] ) // s2 AS2( xor edx, DWORD PTR [edi + 12] ) // s3 - AS1(loop1: ) +#ifdef _MSC_VER + AS1( loop1: ) // loop1 +#else + AS1(1: ) // loop1 +#endif /* Put0 (mm0) = Te0[get0,rs 24] ^ Te1[get1,rs 16] ^ @@ -652,7 +663,11 @@ void AES::AsmEncrypt(const byte* inBlock, byte* outBlock, void* boxes) const AS1( dec edi ) AS2( movd mm5, edi ) - AS1( jnz loop1 ) +#ifdef _MSC_VER + AS1( jnz loop1) // loop1 +#else + AS1( jnz 1b ) // loop1 +#endif // last round /* @@ -799,9 +814,9 @@ void AES::AsmEncrypt(const byte* inBlock, byte* outBlock, void* boxes) const // store #ifdef __GNUC__ - AS2( mov esi, DWORD PTR [ebp + 16] ) // outBlock + AS2( movd esi, mm4 ) // outBlock #else - AS2( mov esi, DWORD PTR [ebp + 12] ) // outBlock + AS2( mov esi, DWORD PTR [ebp + 12] ) // outBlock #endif AS1( bswap ecx ) @@ -819,6 +834,8 @@ void AES::AsmEncrypt(const byte* inBlock, byte* outBlock, void* boxes) const #ifdef _MSC_VER __declspec(naked) +#else + __attribute__ ((noinline)) #endif void AES::AsmDecrypt(const byte* inBlock, byte* outBlock, void* boxes) const { @@ -853,7 +870,11 @@ void AES::AsmDecrypt(const byte* inBlock, byte* outBlock, void* boxes) const AS2( xor edx, DWORD PTR [edi + 12] ) // s3 - AS1(loop2: ) +#ifdef _MSC_VER + AS1( loop2: ) // loop2 +#else + AS1(2: ) // loop2 +#endif /* Put0 (mm0) = Td0[GETBYTE(get0, rs24)] ^ Td1[GETBYTE(get3, rs16)] ^ @@ -964,7 +985,11 @@ void AES::AsmDecrypt(const byte* inBlock, byte* outBlock, void* boxes) const AS1( dec edi ) AS2( movd mm5, edi ) - AS1( jnz loop2 ) +#ifdef _MSC_VER + AS1( jnz loop2) // loop2 +#else + AS1( jnz 2b ) // loop2 +#endif // last round /* @@ -1114,9 +1139,9 @@ void AES::AsmDecrypt(const byte* inBlock, byte* outBlock, void* boxes) const // store #ifdef __GNUC__ - AS2( mov esi, DWORD PTR [ebp + 16] ) // outBlock + AS2( movd esi, mm4 ) // outBlock #else - AS2( mov esi, DWORD PTR [ebp + 12] ) // outBlock + AS2( mov esi, DWORD PTR [ebp + 12] ) // outBlock #endif AS2( mov DWORD PTR [esi], eax ) AS2( mov DWORD PTR [esi + 4], ebx ) diff --git a/mysql-wsrep-5.6/extra/yassl/taocrypt/src/algebra.cpp b/mysql-wsrep-5.6/extra/yassl/taocrypt/src/algebra.cpp index c0dbfbe6..ace17047 100644 --- a/mysql-wsrep-5.6/extra/yassl/taocrypt/src/algebra.cpp +++ b/mysql-wsrep-5.6/extra/yassl/taocrypt/src/algebra.cpp @@ -1,4 +1,5 @@ -/* Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. +/* + Copyright (c) 2000, 2014, 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 @@ -183,10 +184,10 @@ Integer AbstractGroup::CascadeScalarMultiply(const Element &x, struct WindowSlider { - WindowSlider(const Integer &expIn, bool fastNegateIn, + WindowSlider(const Integer &exp, bool fastNegate, unsigned int windowSizeIn=0) - : exp(expIn), windowModulus(Integer::One()), windowSize(windowSizeIn), - windowBegin(0), fastNegate(fastNegateIn), firstTime(true), + : exp(exp), windowModulus(Integer::One()), windowSize(windowSizeIn), + windowBegin(0), fastNegate(fastNegate), firstTime(true), finished(false) { if (windowSize == 0) diff --git a/mysql-wsrep-5.6/extra/yassl/taocrypt/src/arc4.cpp b/mysql-wsrep-5.6/extra/yassl/taocrypt/src/arc4.cpp index a76a3790..10a3a7d6 100644 --- a/mysql-wsrep-5.6/extra/yassl/taocrypt/src/arc4.cpp +++ b/mysql-wsrep-5.6/extra/yassl/taocrypt/src/arc4.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2000, 2014, 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 @@ -111,28 +111,26 @@ void ARC4::Process(byte* out, const byte* in, word32 length) void ARC4::AsmProcess(byte* out, const byte* in, word32 length) { #ifdef __GNUC__ - #define AS1(x) asm(#x); - #define AS2(x, y) asm(#x ", " #y); + #define AS1(x) #x ";" + #define AS2(x, y) #x ", " #y ";" #define PROLOG() \ - asm(".intel_syntax noprefix"); \ - AS2( movd mm3, edi ) \ - AS2( movd mm4, ebx ) \ - AS2( movd mm5, esi ) \ - AS2( movd mm6, ebp ) \ - AS2( mov ecx, DWORD PTR [ebp + 8] ) \ - AS2( mov edi, DWORD PTR [ebp + 12] ) \ - AS2( mov esi, DWORD PTR [ebp + 16] ) \ - AS2( mov ebp, DWORD PTR [ebp + 20] ) - + __asm__ __volatile__ \ + ( \ + ".intel_syntax noprefix;" \ + "push ebx;" \ + "push ebp;" \ + "mov ebp, eax;" #define EPILOG() \ - AS2( movd ebp, mm6 ) \ - AS2( movd esi, mm5 ) \ - AS2( movd ebx, mm4 ) \ - AS2( mov esp, ebp ) \ - AS2( movd edi, mm3 ) \ - AS1( emms ) \ - asm(".att_syntax"); + "pop ebp;" \ + "pop ebx;" \ + "emms;" \ + ".att_syntax;" \ + : \ + : "c" (this), "D" (out), "S" (in), "a" (length) \ + : "%edx", "memory", "cc" \ + ); + #else #define AS1(x) __asm x #define AS2(x, y) __asm x, y @@ -178,7 +176,11 @@ void ARC4::AsmProcess(byte* out, const byte* in, word32 length) AS2( movzx eax, BYTE PTR [ebp + ecx] ) -AS1( begin: ) +#ifdef _MSC_VER + AS1( loopStart: ) // loopStart +#else + AS1( 0: ) // loopStart for some gas (need numeric for jump back +#endif // y = (y+a) & 0xff; AS2( add edx, eax ) @@ -215,7 +217,11 @@ AS1( begin: ) AS1( inc edi ) AS1( dec DWORD PTR [esp] ) - AS1( jnz begin ) +#ifdef _MSC_VER + AS1( jnz loopStart ) // loopStart +#else + AS1( jnz 0b ) // loopStart +#endif // write back to x_ and y_ @@ -225,6 +231,8 @@ AS1( begin: ) AS1( nothing: ) + // inline adjust + AS2( add esp, 4 ) // fix room on stack EPILOG() } diff --git a/mysql-wsrep-5.6/extra/yassl/taocrypt/src/asn.cpp b/mysql-wsrep-5.6/extra/yassl/taocrypt/src/asn.cpp index 65ba213a..7c9e91e1 100644 --- a/mysql-wsrep-5.6/extra/yassl/taocrypt/src/asn.cpp +++ b/mysql-wsrep-5.6/extra/yassl/taocrypt/src/asn.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2000, 2014, 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 @@ -685,7 +685,7 @@ word32 CertDecoder::GetSignature() } sigLength_ = GetLength(source_); - if (sigLength_ == 0 || source_.IsLeft(sigLength_) == false) { + if (sigLength_ <= 1 || source_.IsLeft(sigLength_) == false) { source_.SetError(CONTENT_E); return 0; } @@ -773,7 +773,7 @@ void CertDecoder::GetName(NameType nt) while (source_.get_index() < length) { GetSet(); if (source_.GetError().What() == SET_E) { - source_.SetError(NO_ERROR_E); // extensions may only have sequence + source_.SetError(NO_ERROR_E); // extensions may only have sequence source_.prev(); } GetSequence(); @@ -844,10 +844,8 @@ void CertDecoder::GetName(NameType nt) if (source_.IsLeft(length) == false) return; if (email) { - if (!(ptr = AddTag(ptr, buf_end, "/emailAddress=", 14, length))) { - source_.SetError(CONTENT_E); - return; - } + if (!(ptr = AddTag(ptr, buf_end, "/emailAddress=", 14, length))) + return; } source_.advance(length); @@ -1018,11 +1016,17 @@ bool CertDecoder::ConfirmSignature(Source& pub) RSA_PublicKey pubKey(pub); RSAES_Encryptor enc(pubKey); + if (pubKey.FixedCiphertextLength() != sigLength_) { + source_.SetError(SIG_LEN_E); + return false; + } + return enc.SSL_Verify(build.get_buffer(), build.size(), signature_); } else { // DSA // extract r and s from sequence byte seqDecoded[DSA_SIG_SZ]; + memset(seqDecoded, 0, sizeof(seqDecoded)); DecodeDSA_Signature(seqDecoded, signature_, sigLength_); DSA_PublicKey pubKey(pub); @@ -1080,12 +1084,10 @@ word32 DER_Encoder::SetAlgoID(HashType aOID, byte* output) 0x02, 0x02, 0x05, 0x00}; static const byte sha256AlgoID[] = { 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x01, 0x05, 0x00 }; -#ifdef WORD64_AVAILABLE static const byte sha384AlgoID[] = { 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x02, 0x05, 0x00 }; static const byte sha512AlgoID[] = { 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x03, 0x05, 0x00 }; -#endif int algoSz = 0; const byte* algoName = 0; @@ -1100,7 +1102,6 @@ word32 DER_Encoder::SetAlgoID(HashType aOID, byte* output) algoName = sha256AlgoID; break; -#ifdef WORD64_AVAILABLE case SHA384h: algoSz = sizeof(sha384AlgoID); algoName = sha384AlgoID; @@ -1110,7 +1111,6 @@ word32 DER_Encoder::SetAlgoID(HashType aOID, byte* output) algoSz = sizeof(sha512AlgoID); algoName = sha512AlgoID; break; -#endif case MD2h: algoSz = sizeof(md2AlgoID); diff --git a/mysql-wsrep-5.6/extra/yassl/taocrypt/src/blowfish.cpp b/mysql-wsrep-5.6/extra/yassl/taocrypt/src/blowfish.cpp index cedae6af..9491c930 100644 --- a/mysql-wsrep-5.6/extra/yassl/taocrypt/src/blowfish.cpp +++ b/mysql-wsrep-5.6/extra/yassl/taocrypt/src/blowfish.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2000, 2014, 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 @@ -54,7 +54,7 @@ void Blowfish::Process(byte* out, const byte* in, word32 sz) in += BLOCK_SIZE; } else if (mode_ == CBC) { - if (dir_ == ENCRYPTION) + if (dir_ == ENCRYPTION) { while (blocks--) { r_[0] ^= *(word32*)in; r_[1] ^= *(word32*)(in + 4); @@ -66,7 +66,8 @@ void Blowfish::Process(byte* out, const byte* in, word32 sz) out += BLOCK_SIZE; in += BLOCK_SIZE; } - else + } + else { while (blocks--) { AsmProcess(in, out); @@ -78,6 +79,7 @@ void Blowfish::Process(byte* out, const byte* in, word32 sz) out += BLOCK_SIZE; in += BLOCK_SIZE; } + } } } @@ -222,23 +224,26 @@ void Blowfish::ProcessAndXorBlock(const byte* in, const byte* xOr, byte* out) #if defined(DO_BLOWFISH_ASM) #ifdef __GNUC__ - #define AS1(x) asm(#x); - #define AS2(x, y) asm(#x ", " #y); + #define AS1(x) #x ";" + #define AS2(x, y) #x ", " #y ";" #define PROLOG() \ - asm(".intel_syntax noprefix"); \ - AS2( movd mm3, edi ) \ - AS2( movd mm4, ebx ) \ - AS2( movd mm5, esi ) \ - AS2( mov ecx, DWORD PTR [ebp + 8] ) \ - AS2( mov esi, DWORD PTR [ebp + 12] ) - + __asm__ __volatile__ \ + ( \ + ".intel_syntax noprefix;" \ + "push ebx;" \ + "push ebp;" \ + "movd mm3, eax;" #define EPILOG() \ - AS2( movd esi, mm5 ) \ - AS2( movd ebx, mm4 ) \ - AS2( movd edi, mm3 ) \ - AS1( emms ) \ - asm(".att_syntax"); + "pop ebp;" \ + "pop ebx;" \ + "emms;" \ + ".att_syntax;" \ + : \ + : "c" (this), "S" (inBlock), "a" (outBlock) \ + : "%edi", "%edx", "memory", "cc" \ + ); + #else #define AS1(x) __asm x #define AS2(x, y) __asm x, y @@ -287,6 +292,8 @@ void Blowfish::ProcessAndXorBlock(const byte* in, const byte* xOr, byte* out) #ifdef _MSC_VER __declspec(naked) +#else + __attribute__ ((noinline)) #endif void Blowfish::AsmProcess(const byte* inBlock, byte* outBlock) const { @@ -335,7 +342,7 @@ void Blowfish::AsmProcess(const byte* inBlock, byte* outBlock) const #endif #ifdef __GNUC__ - AS2( mov edi, [ebp + 16] ) // outBlock + AS2( movd edi, mm3 ) // outBlock #else AS2( mov edi, [ebp + 12] ) // outBlock #endif diff --git a/mysql-wsrep-5.6/extra/yassl/taocrypt/src/des.cpp b/mysql-wsrep-5.6/extra/yassl/taocrypt/src/des.cpp index 3d101f87..673c21ed 100644 --- a/mysql-wsrep-5.6/extra/yassl/taocrypt/src/des.cpp +++ b/mysql-wsrep-5.6/extra/yassl/taocrypt/src/des.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2000, 2014, 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 @@ -473,7 +473,7 @@ void DES_EDE3::ProcessAndXorBlock(const byte* in, const byte* xOr, uses ecx */ -#define AsmIPERM() {\ +#define AsmIPERM() \ AS2( rol ebx, 4 ) \ AS2( mov ecx, eax ) \ AS2( xor ecx, ebx ) \ @@ -504,7 +504,7 @@ void DES_EDE3::ProcessAndXorBlock(const byte* in, const byte* xOr, AS2( and ecx, 0xaaaaaaaa ) \ AS2( xor eax, ecx ) \ AS2( rol eax, 1 ) \ - AS2( xor ebx, ecx ) } + AS2( xor ebx, ecx ) /* Uses FPERM algorithm from above @@ -514,7 +514,7 @@ void DES_EDE3::ProcessAndXorBlock(const byte* in, const byte* xOr, uses ecx */ -#define AsmFPERM() {\ +#define AsmFPERM() \ AS2( ror ebx, 1 ) \ AS2( mov ecx, eax ) \ AS2( xor ecx, ebx ) \ @@ -545,7 +545,7 @@ void DES_EDE3::ProcessAndXorBlock(const byte* in, const byte* xOr, AS2( and ecx, 0xf0f0f0f0 ) \ AS2( xor eax, ecx ) \ AS2( xor ebx, ecx ) \ - AS2( ror eax, 4 ) } + AS2( ror eax, 4 ) @@ -642,31 +642,33 @@ void DES_EDE3::ProcessAndXorBlock(const byte* in, const byte* xOr, #ifdef _MSC_VER __declspec(naked) +#else + __attribute__ ((noinline)) #endif void DES_EDE3::AsmProcess(const byte* in, byte* out, void* box) const { #ifdef __GNUC__ - #define AS1(x) asm(#x); - #define AS2(x, y) asm(#x ", " #y); - - asm(".intel_syntax noprefix"); + #define AS1(x) #x ";" + #define AS2(x, y) #x ", " #y ";" #define PROLOG() \ - AS2( movd mm3, edi ) \ - AS2( movd mm4, ebx ) \ - AS2( movd mm5, esi ) \ - AS2( movd mm6, ebp ) \ - AS2( mov edx, DWORD PTR [ebp + 8] ) \ - AS2( mov esi, DWORD PTR [ebp + 12] ) \ - AS2( mov ebp, DWORD PTR [ebp + 20] ) - - // ebp restored at end - #define EPILOG() \ - AS2( movd edi, mm3 ) \ - AS2( movd ebx, mm4 ) \ - AS2( movd esi, mm5 ) \ - AS1( emms ) \ - asm(".att_syntax"); + __asm__ __volatile__ \ + ( \ + ".intel_syntax noprefix;" \ + "push ebx;" \ + "push ebp;" \ + "movd mm6, ebp;" \ + "movd mm7, ecx;" \ + "mov ebp, eax;" + #define EPILOG() \ + "pop ebp;" \ + "pop ebx;" \ + "emms;" \ + ".att_syntax;" \ + : \ + : "d" (this), "S" (in), "a" (box), "c" (out) \ + : "%edi", "memory", "cc" \ + ); #else #define AS1(x) __asm x @@ -756,7 +758,7 @@ void DES_EDE3::AsmProcess(const byte* in, byte* out, void* box) const AS1( bswap eax ) #ifdef __GNUC__ - AS2( mov esi, DWORD PTR [ebp + 16] ) // outBlock + AS2( movd esi, mm7 ) // outBlock #else AS2( mov esi, DWORD PTR [ebp + 12] ) // outBlock #endif diff --git a/mysql-wsrep-5.6/extra/yassl/taocrypt/src/integer.cpp b/mysql-wsrep-5.6/extra/yassl/taocrypt/src/integer.cpp index 8aef0759..b356e6be 100644 --- a/mysql-wsrep-5.6/extra/yassl/taocrypt/src/integer.cpp +++ b/mysql-wsrep-5.6/extra/yassl/taocrypt/src/integer.cpp @@ -1,4 +1,5 @@ -/* Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. +/* + Copyright (c) 2000, 2014, 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 @@ -50,8 +51,9 @@ #include #endif #elif defined(_MSC_VER) && defined(_M_IX86) - #pragma message("You do not seem to have the Visual C++ Processor Pack ") +/* #pragma message("You do not seem to have the Visual C++ Processor Pack ") #pragma message("installed, so use of SSE2 intrinsics will be disabled.") +*/ #elif defined(__GNUC__) && defined(__i386__) /* #warning You do not have GCC 3.3 or later, or did not specify the -msse2 \ compiler option. Use of SSE2 intrinsics will be disabled. @@ -68,7 +70,7 @@ template CPP_TYPENAME AlignedAllocator::pointer AlignedAllocator::allocate( size_type n, const void *) { - if (n > max_size()) + if (n > this->max_size()) return 0; if (n == 0) return 0; @@ -275,7 +277,12 @@ DWord() {} word GetHighHalfAsBorrow() const {return 0-halfs_.high;} private: - struct dword_struct + union + { + #ifdef TAOCRYPT_NATIVE_DWORD_AVAILABLE + dword whole_; + #endif + struct { #ifdef LITTLE_ENDIAN_ORDER word low; @@ -284,14 +291,7 @@ private: word high; word low; #endif - }; - - union - { - #ifdef TAOCRYPT_NATIVE_DWORD_AVAILABLE - dword whole_; - #endif - struct dword_struct halfs_; + } halfs_; }; }; @@ -1194,24 +1194,20 @@ public: #define AS1(x) #x ";" #define AS2(x, y) #x ", " #y ";" #define AddPrologue \ - word res; \ __asm__ __volatile__ \ ( \ "push %%ebx;" /* save this manually, in case of -fPIC */ \ - "mov %3, %%ebx;" \ + "mov %2, %%ebx;" \ ".intel_syntax noprefix;" \ "push ebp;" #define AddEpilogue \ "pop ebp;" \ ".att_syntax prefix;" \ "pop %%ebx;" \ - "mov %%eax, %0;" \ - : "=g" (res) \ + : \ : "c" (C), "d" (A), "m" (B), "S" (N) \ : "%edi", "memory", "cc" \ - ); \ - return res; - + ); #define MulPrologue \ __asm__ __volatile__ \ ( \ @@ -2605,18 +2601,20 @@ void Integer::Decode(Source& source) void Integer::Decode(const byte* input, unsigned int inputLen, Signedness s) { unsigned int idx(0); - byte b = input[idx++]; + byte b = 0; + if (inputLen>0) + b = input[idx]; // peek sign_ = ((s==SIGNED) && (b & 0x80)) ? NEGATIVE : POSITIVE; while (inputLen>0 && (sign_==POSITIVE ? b==0 : b==0xff)) { - inputLen--; - b = input[idx++]; + idx++; // skip + if (--inputLen>0) + b = input[idx]; // peek } reg_.CleanNew(RoundupSize(BytesToWords(inputLen))); - --idx; for (unsigned int i=inputLen; i > 0; i--) { b = input[idx++]; diff --git a/mysql-wsrep-5.6/extra/yassl/taocrypt/src/md5.cpp b/mysql-wsrep-5.6/extra/yassl/taocrypt/src/md5.cpp index ee0d64ac..45cfa8a3 100644 --- a/mysql-wsrep-5.6/extra/yassl/taocrypt/src/md5.cpp +++ b/mysql-wsrep-5.6/extra/yassl/taocrypt/src/md5.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2000, 2014, 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 @@ -224,31 +224,31 @@ void MD5::Update(const byte* data, word32 len) #ifdef _MSC_VER __declspec(naked) +#else + __attribute__ ((noinline)) #endif void MD5::AsmTransform(const byte* data, word32 times) { #ifdef __GNUC__ - #define AS1(x) asm(#x); - #define AS2(x, y) asm(#x ", " #y); + #define AS1(x) #x ";" + #define AS2(x, y) #x ", " #y ";" #define PROLOG() \ - asm(".intel_syntax noprefix"); \ - AS2( movd mm3, edi ) \ - AS2( movd mm4, ebx ) \ - AS2( movd mm5, esi ) \ - AS2( movd mm6, ebp ) \ - AS2( mov ecx, DWORD PTR [ebp + 8] ) \ - AS2( mov edi, DWORD PTR [ebp + 12] ) \ - AS2( mov eax, DWORD PTR [ebp + 16] ) - + __asm__ __volatile__ \ + ( \ + ".intel_syntax noprefix;" \ + "push ebx;" \ + "push ebp;" #define EPILOG() \ - AS2( movd ebp, mm6 ) \ - AS2( movd esi, mm5 ) \ - AS2( movd ebx, mm4 ) \ - AS2( mov esp, ebp ) \ - AS2( movd edi, mm3 ) \ - AS1( emms ) \ - asm(".att_syntax"); + "pop ebp;" \ + "pop ebx;" \ + "emms;" \ + ".att_syntax;" \ + : \ + : "c" (this), "D" (data), "a" (times) \ + : "%esi", "%edx", "memory", "cc" \ + ); + #else #define AS1(x) __asm x #define AS2(x, y) __asm x, y @@ -294,7 +294,11 @@ void MD5::AsmTransform(const byte* data, word32 times) AS2( mov ecx, [esi + 8] ) // c AS2( mov edx, [esi + 12] ) // d -AS1(loopStart:) +#ifdef _MSC_VER + AS1( loopStart: ) // loopStart +#else + AS1( 0: ) // loopStart for some gas (need numeric for jump back +#endif // set up AS2( mov esi, ecx ) @@ -389,7 +393,11 @@ AS1(loopStart:) AS2( movd ebp, mm2 ) // times AS1( dec ebp ) AS2( movd mm2, ebp ) - AS1( jnz loopStart ) +#ifdef _MSC_VER + AS1( jnz loopStart ) // loopStart +#else + AS1( jnz 0b ) // loopStart +#endif EPILOG() diff --git a/mysql-wsrep-5.6/extra/yassl/taocrypt/src/misc.cpp b/mysql-wsrep-5.6/extra/yassl/taocrypt/src/misc.cpp index b576d3d5..fd9e8b92 100644 --- a/mysql-wsrep-5.6/extra/yassl/taocrypt/src/misc.cpp +++ b/mysql-wsrep-5.6/extra/yassl/taocrypt/src/misc.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2000, 2014, 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 @@ -84,17 +84,7 @@ namespace STL = STL_NAMESPACE; } -#ifdef __sun - -// Handler for pure virtual functions -namespace __Crun { - void pure_error() { - } -} - -#endif - -#if defined(__ICC) || defined(__INTEL_COMPILER) || (__GNUC__ > 2) +#if defined(__ICC) || defined(__INTEL_COMPILER) extern "C" { @@ -175,6 +165,14 @@ word Crop(word value, unsigned int size) #ifdef TAOCRYPT_X86ASM_AVAILABLE +#ifndef _MSC_VER + static jmp_buf s_env; + static void SigIllHandler(int) + { + longjmp(s_env, 1); + } +#endif + bool HaveCpuId() { diff --git a/mysql-wsrep-5.6/extra/yassl/taocrypt/src/rabbit.cpp b/mysql-wsrep-5.6/extra/yassl/taocrypt/src/rabbit.cpp index 2c0f6bec..5e32f383 100644 --- a/mysql-wsrep-5.6/extra/yassl/taocrypt/src/rabbit.cpp +++ b/mysql-wsrep-5.6/extra/yassl/taocrypt/src/rabbit.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2000, 2014, 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 @@ -198,7 +198,6 @@ void Rabbit::Process(byte* output, const byte* input, word32 msglen) { /* Temporary variables */ word32 i; - byte buffer[16]; /* Encrypt/decrypt all full blocks */ while (msglen >= 16) { @@ -227,17 +226,23 @@ void Rabbit::Process(byte* output, const byte* input, word32 msglen) /* Encrypt/decrypt remaining data */ if (msglen) { + + word32 tmp[4]; + byte* buffer = (byte*)tmp; + + memset(tmp, 0, sizeof(tmp)); /* help static analysis */ + /* Iterate the system */ NextState(Work); /* Generate 16 bytes of pseudo-random data */ - *(word32*)(buffer+ 0) = LITTLE32(workCtx_.x[0] ^ + tmp[0] = LITTLE32(workCtx_.x[0] ^ (workCtx_.x[5]>>16) ^ U32V(workCtx_.x[3]<<16)); - *(word32*)(buffer+ 4) = LITTLE32(workCtx_.x[2] ^ + tmp[1] = LITTLE32(workCtx_.x[2] ^ (workCtx_.x[7]>>16) ^ U32V(workCtx_.x[5]<<16)); - *(word32*)(buffer+ 8) = LITTLE32(workCtx_.x[4] ^ + tmp[2] = LITTLE32(workCtx_.x[4] ^ (workCtx_.x[1]>>16) ^ U32V(workCtx_.x[7]<<16)); - *(word32*)(buffer+12) = LITTLE32(workCtx_.x[6] ^ + tmp[3] = LITTLE32(workCtx_.x[6] ^ (workCtx_.x[3]>>16) ^ U32V(workCtx_.x[1]<<16)); /* Encrypt/decrypt the data */ diff --git a/mysql-wsrep-5.6/extra/yassl/taocrypt/src/random.cpp b/mysql-wsrep-5.6/extra/yassl/taocrypt/src/random.cpp index 084871c5..4b89b5b3 100644 --- a/mysql-wsrep-5.6/extra/yassl/taocrypt/src/random.cpp +++ b/mysql-wsrep-5.6/extra/yassl/taocrypt/src/random.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -27,6 +27,7 @@ #include #if defined(_WIN32) + #define _WIN32_WINNT 0x0400 #include #include #else diff --git a/mysql-wsrep-5.6/extra/yassl/taocrypt/src/ripemd.cpp b/mysql-wsrep-5.6/extra/yassl/taocrypt/src/ripemd.cpp index f77010ca..5d03dc61 100644 --- a/mysql-wsrep-5.6/extra/yassl/taocrypt/src/ripemd.cpp +++ b/mysql-wsrep-5.6/extra/yassl/taocrypt/src/ripemd.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2000, 2014, 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 @@ -507,31 +507,31 @@ void RIPEMD160::Transform() #ifdef _MSC_VER __declspec(naked) +#else + __attribute__ ((noinline)) #endif void RIPEMD160::AsmTransform(const byte* data, word32 times) { #ifdef __GNUC__ - #define AS1(x) asm(#x); - #define AS2(x, y) asm(#x ", " #y); + #define AS1(x) #x ";" + #define AS2(x, y) #x ", " #y ";" #define PROLOG() \ - asm(".intel_syntax noprefix"); \ - AS2( movd mm3, edi ) \ - AS2( movd mm4, ebx ) \ - AS2( movd mm5, esi ) \ - AS2( movd mm6, ebp ) \ - AS2( mov ecx, DWORD PTR [ebp + 8] ) \ - AS2( mov edi, DWORD PTR [ebp + 12] ) \ - AS2( mov edx, DWORD PTR [ebp + 16] ) - + __asm__ __volatile__ \ + ( \ + ".intel_syntax noprefix;" \ + "push ebx;" \ + "push ebp;" #define EPILOG() \ - AS2( movd ebp, mm6 ) \ - AS2( movd esi, mm5 ) \ - AS2( movd ebx, mm4 ) \ - AS2( mov esp, ebp ) \ - AS2( movd edi, mm3 ) \ - AS1( emms ) \ - asm(".att_syntax"); + "pop ebp;" \ + "pop ebx;" \ + "emms;" \ + ".att_syntax;" \ + : \ + : "c" (this), "D" (data), "d" (times) \ + : "%esi", "%eax", "memory", "cc" \ + ); + #else #define AS1(x) __asm x #define AS2(x, y) __asm x, y @@ -569,7 +569,11 @@ void RIPEMD160::AsmTransform(const byte* data, word32 times) AS2( sub esp, 24 ) // make room for tmp a1 - e1 AS2( movd mm1, esi ) // store digest_ -AS1( loopStart: ) +#ifdef _MSC_VER + AS1( loopStart: ) // loopStart +#else + AS1( 0: ) // loopStart for some gas (need numeric for jump back +#endif AS2( movd mm2, edx ) // store times_ @@ -821,8 +825,14 @@ AS1( loopStart: ) AS2( movd edx, mm2 ) // times AS2( movd edi, mm0 ) // data, already advanced AS1( dec edx ) - AS1( jnz loopStart ) +#ifdef _MSC_VER + AS1( jnz loopStart ) // loopStart +#else + AS1( jnz 0b ) // loopStart +#endif + // inline adjust + AS2( add esp, 24 ) // fix room on stack EPILOG() } diff --git a/mysql-wsrep-5.6/extra/yassl/taocrypt/src/rsa.cpp b/mysql-wsrep-5.6/extra/yassl/taocrypt/src/rsa.cpp index 69c59402..79a8a8f1 100644 --- a/mysql-wsrep-5.6/extra/yassl/taocrypt/src/rsa.cpp +++ b/mysql-wsrep-5.6/extra/yassl/taocrypt/src/rsa.cpp @@ -177,7 +177,7 @@ word32 RSA_BlockType1::UnPad(const byte* pkcsBlock, word32 pkcsBlockLen, // skip past the padding until we find the separator unsigned i=1; - while (i= CR_ERROR_FIRST && (X) <= CR_ERROR_LAST)? \ + client_errors[(X)-CR_ERROR_FIRST]: client_errors[CR_UNKNOWN_ERROR]) + #endif #define CLIENT_ERRMAP 2 /* Errormap used by my_error() */ diff --git a/mysql-wsrep-5.6/include/my_aes.h b/mysql-wsrep-5.6/include/my_aes.h index 24ddb6e7..1631a306 100644 --- a/mysql-wsrep-5.6/include/my_aes.h +++ b/mysql-wsrep-5.6/include/my_aes.h @@ -1,7 +1,7 @@ #ifndef MY_AES_INCLUDED #define MY_AES_INCLUDED -/* Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2000, 2014, 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 @@ -22,46 +22,108 @@ C_MODE_START -#define AES_KEY_LENGTH 128 /* Must be 128 192 or 256 */ - -/* - my_aes_encrypt - Crypt buffer with AES encryption algorithm. - source - Pointer to data for encryption - source_length - size of encryption data - dest - buffer to place encrypted data (must be large enough) - key - Key to be used for encryption - kel_length - Length of the key. Will handle keys of any length +/** AES IV size is 16 bytes for all supported ciphers except ECB */ +#define MY_AES_IV_SIZE 16 + + +/** Supported AES cipher/block mode combos */ +enum my_aes_opmode +{ + my_aes_128_ecb, + my_aes_192_ecb, + my_aes_256_ecb, + my_aes_128_cbc, + my_aes_192_cbc, + my_aes_256_cbc, +#ifndef HAVE_YASSL + my_aes_128_cfb1, + my_aes_192_cfb1, + my_aes_256_cfb1, + my_aes_128_cfb8, + my_aes_192_cfb8, + my_aes_256_cfb8, + my_aes_128_cfb128, + my_aes_192_cfb128, + my_aes_256_cfb128, + my_aes_128_ofb, + my_aes_192_ofb, + my_aes_256_ofb, +#endif +}; + +#define MY_AES_BEGIN my_aes_128_ecb +#ifdef HAVE_YASSL +#define MY_AES_END my_aes_256_cbc +#else +#define MY_AES_END my_aes_256_ofb +#endif + +/* If bad data discovered during decoding */ +#define MY_AES_BAD_DATA -1 + +/** String representations of the supported AES modes. Keep in sync with my_aes_opmode */ +extern const char *my_aes_opmode_names[]; + +/** + Encrypt a buffer using AES + + @param source [in] Pointer to data for encryption + @param source_length [in] Size of encryption data + @param dest [out] Buffer to place encrypted data (must be large enough) + @param key [in] Key to be used for encryption + @param key_length [in] Length of the key. Will handle keys of any length + @param mode [in] encryption mode + @param iv [in] 16 bytes initialization vector if needed. Otherwise NULL + @return size of encrypted data, or negative in case of error +*/ - returns - size of encrypted data, or negative in case of error. +int my_aes_encrypt(const unsigned char *source, uint32 source_length, + unsigned char *dest, + const unsigned char *key, uint32 key_length, + enum my_aes_opmode mode, const unsigned char *iv); + +/** + Decrypt an AES encrypted buffer + + @param source Pointer to data for decryption + @param source_length size of encrypted data + @param dest buffer to place decrypted data (must be large enough) + @param key Key to be used for decryption + @param key_length Length of the key. Will handle keys of any length + @param mode encryption mode + @param iv 16 bytes initialization vector if needed. Otherwise NULL + @return size of original data. */ -int my_aes_encrypt(const char *source, int source_length, char *dest, - const char *key, int key_length); -/* - my_aes_decrypt - DeCrypt buffer with AES encryption algorithm. - source - Pointer to data for decryption - source_length - size of encrypted data - dest - buffer to place decrypted data (must be large enough) - key - Key to be used for decryption - kel_length - Length of the key. Will handle keys of any length +int my_aes_decrypt(const unsigned char *source, uint32 source_length, + unsigned char *dest, + const unsigned char *key, uint32 key_length, + enum my_aes_opmode mode, const unsigned char *iv); - returns - size of original data, or negative in case of error. +/** + Calculate the size of a buffer large enough for encrypted data + + @param source_length length of data to be encrypted + @param mode encryption mode + @return size of buffer required to store encrypted data */ +int my_aes_get_size(uint32 source_length, enum my_aes_opmode mode); -int my_aes_decrypt(const char *source, int source_length, char *dest, - const char *key, int key_length); +/** + Return true if the AES cipher and block mode requires an IV -/* - my_aes_get_size - get size of buffer which will be large enough for encrypted - data - source_length - length of data to be encrypted + SYNOPSIS + my_aes_needs_iv() + @param mode encryption mode - returns - size of buffer required to store encrypted data + @retval TRUE IV needed + @retval FALSE IV not needed */ -int my_aes_get_size(int source_length); +my_bool my_aes_needs_iv(my_aes_opmode opmode); + C_MODE_END diff --git a/mysql-wsrep-5.6/include/my_base.h b/mysql-wsrep-5.6/include/my_base.h index dbf80de4..b314d985 100644 --- a/mysql-wsrep-5.6/include/my_base.h +++ b/mysql-wsrep-5.6/include/my_base.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2000, 2014, 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 @@ -204,7 +204,9 @@ enum ha_extra_function { Prepare table for export (e.g. quiesce the table and write table metadata). */ - HA_EXTRA_EXPORT + HA_EXTRA_EXPORT, + /** Do secondary sort by handler::ref (rowid) after key sort. */ + HA_EXTRA_SECONDARY_SORT_ROWID }; /* Compatible option, to be deleted in 6.0 */ @@ -483,7 +485,8 @@ is the global server default. */ #define HA_ERR_FTS_EXCEED_RESULT_CACHE_LIMIT 188 /* FTS query exceeds result cache limit */ #define HA_ERR_TEMP_FILE_WRITE_FAILURE 189 /* Temporary file write failure */ #define HA_ERR_INNODB_FORCED_RECOVERY 190 /* Innodb is in force recovery mode */ -#define HA_ERR_LAST 190 /* Copy of last error nr */ +#define HA_ERR_FTS_TOO_MANY_WORDS_IN_PHRASE 191 /* Too many words in a phrase */ +#define HA_ERR_LAST 191 /* Copy of last error nr */ /* Number of different errors */ #define HA_ERR_ERRORS (HA_ERR_LAST - HA_ERR_FIRST + 1) @@ -538,7 +541,6 @@ typedef ulong key_part_map; #define HA_STATE_BUFF_SAVED 512 /* If current keybuff is info->buff */ #define HA_STATE_ROW_CHANGED 1024 /* To invalide ROW cache */ #define HA_STATE_EXTEND_BLOCK 2048 -#define HA_STATE_RNEXT_SAME 4096 /* rnext_same occupied lastkey2 */ /* myisampack expects no more than 32 field types. */ enum en_fieldtype { diff --git a/mysql-wsrep-5.6/include/my_default.h b/mysql-wsrep-5.6/include/my_default.h index 3a9260f0..1c217d45 100644 --- a/mysql-wsrep-5.6/include/my_default.h +++ b/mysql-wsrep-5.6/include/my_default.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2012, 2014, 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 @@ -36,6 +36,7 @@ int get_defaults_options(int argc, char **argv, char **group_suffix, char **login_path); int my_load_defaults(const char *conf_file, const char **groups, int *argc, char ***argv, const char ***); +int check_file_permissions(const char *file_name); int load_defaults(const char *conf_file, const char **groups, int *argc, char ***argv); int my_search_option_files(const char *conf_file, int *argc, diff --git a/mysql-wsrep-5.6/include/my_getopt.h b/mysql-wsrep-5.6/include/my_getopt.h index ef89bb80..dd9cd2f0 100644 --- a/mysql-wsrep-5.6/include/my_getopt.h +++ b/mysql-wsrep-5.6/include/my_getopt.h @@ -1,5 +1,5 @@ /* - Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2002, 2014, 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 @@ -113,6 +113,7 @@ extern int my_handle_options (int *argc, char ***argv, const struct my_option *longopts, my_get_one_option, const char **command_list); +extern void print_cmdline_password_warning(); extern void my_cleanup_options(const struct my_option *options); extern void my_cleanup_options(const struct my_option *options); extern void my_print_help(const struct my_option *options); diff --git a/mysql-wsrep-5.6/include/my_global.h b/mysql-wsrep-5.6/include/my_global.h index 4ad213fa..aadaffe5 100644 --- a/mysql-wsrep-5.6/include/my_global.h +++ b/mysql-wsrep-5.6/include/my_global.h @@ -333,9 +333,6 @@ C_MODE_END #ifdef HAVE_FCNTL_H #include #endif -#ifdef HAVE_SYS_TIMEB_H -#include /* Avoid warnings on SCO */ -#endif #if TIME_WITH_SYS_TIME # include # include @@ -763,38 +760,28 @@ inline unsigned long long my_double2ulonglong(double d) #define SIZE_T_MAX (~((size_t) 0)) #endif -#ifndef isfinite -#ifdef HAVE_FINITE -#define isfinite(x) finite(x) -#else -#define finite(x) (1.0 / fabs(x) > 0.0) -#endif /* HAVE_FINITE */ -#endif /* isfinite */ - #include -#ifndef HAVE_ISNAN -#define isnan(x) ((x) != (x)) -#endif -C_MODE_START -extern double my_double_isnan(double x); -C_MODE_END -#ifdef HAVE_ISINF -/* Check if C compiler is affected by GCC bug #39228 */ -#if !defined(__cplusplus) && defined(HAVE_BROKEN_ISINF) -/* Force store/reload of the argument to/from a 64-bit double */ -static inline double my_isinf(double x) -{ - volatile double t= x; - return isinf(t); -} +#if (__cplusplus >= 201103L) + /* For C++11 use the new std functions rather than C99 macros. */ + #include + #define my_isfinite(X) std::isfinite(X) + #define my_isnan(X) std::isnan(X) + #define my_isinf(X) std::isinf(X) #else -/* System-provided isinf() is available and safe to use */ -#define my_isinf(X) isinf(X) -#endif -#else /* !HAVE_ISINF */ -#define my_isinf(X) (!finite(X) && !isnan(X)) -#endif + #ifdef HAVE_LLVM_LIBCPP /* finite is deprecated in libc++ */ + #define my_isfinite(X) isfinite(X) + #else + #define my_isfinite(X) finite(X) + #endif + #define my_isnan(X) isnan(X) + #ifdef HAVE_ISINF + /* System-provided isinf() is available and safe to use */ + #define my_isinf(X) isinf(X) + #else /* !HAVE_ISINF */ + #define my_isinf(X) (!my_isfinite(X) && !my_isnan(X)) + #endif +#endif /* __cplusplus >= 201103L */ /* Define missing math constants. */ #ifndef M_PI diff --git a/mysql-wsrep-5.6/include/my_pthread.h b/mysql-wsrep-5.6/include/my_pthread.h index 1d31f5b2..4e099c70 100644 --- a/mysql-wsrep-5.6/include/my_pthread.h +++ b/mysql-wsrep-5.6/include/my_pthread.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2000, 2014, 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 @@ -144,8 +144,18 @@ int pthread_attr_init(pthread_attr_t *connect_att); int pthread_attr_setstacksize(pthread_attr_t *connect_att,DWORD stack); int pthread_attr_destroy(pthread_attr_t *connect_att); int my_pthread_once(my_pthread_once_t *once_control,void (*init_routine)(void)); -struct tm *localtime_r(const time_t *timep,struct tm *tmp); -struct tm *gmtime_r(const time_t *timep,struct tm *tmp); + +static inline struct tm *localtime_r(const time_t *timep, struct tm *tmp) +{ + localtime_s(tmp, timep); + return tmp; +} + +static inline struct tm *gmtime_r(const time_t *clock, struct tm *res) +{ + gmtime_s(res, clock); + return res; +} void pthread_exit(void *a); int pthread_join(pthread_t thread, void **value_ptr); @@ -853,18 +863,7 @@ extern void **my_thread_var_dbug(); extern uint my_thread_end_wait_time; #define my_thread_var (_my_thread_var()) #define my_errno my_thread_var->thr_errno -/* - Keep track of shutdown,signal, and main threads so that my_end() will not - report errors with them -*/ - -/* Which kind of thread library is in use */ - -#define THD_LIB_OTHER 1 -#define THD_LIB_NPTL 2 -#define THD_LIB_LT 4 -extern uint thd_lib_detected; /* thread_safe_xxx functions are for critical statistic or counters. diff --git a/mysql-wsrep-5.6/include/my_rnd.h b/mysql-wsrep-5.6/include/my_rnd.h index cf57e8dc..7dc0234c 100644 --- a/mysql-wsrep-5.6/include/my_rnd.h +++ b/mysql-wsrep-5.6/include/my_rnd.h @@ -30,6 +30,7 @@ extern "C" { #endif double my_rnd_ssl(struct rand_struct *rand_st); +int my_rand_buffer(unsigned char *buffer, size_t buffer_size); #ifdef __cplusplus } diff --git a/mysql-wsrep-5.6/include/mysql/plugin.h b/mysql-wsrep-5.6/include/mysql/plugin.h index a14ad35d..3cf31af0 100644 --- a/mysql-wsrep-5.6/include/mysql/plugin.h +++ b/mysql-wsrep-5.6/include/mysql/plugin.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2005, 2014, 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 diff --git a/mysql-wsrep-5.6/include/mysql_version.h.in b/mysql-wsrep-5.6/include/mysql_version.h.in index ab774502..21ad1562 100644 --- a/mysql-wsrep-5.6/include/mysql_version.h.in +++ b/mysql-wsrep-5.6/include/mysql_version.h.in @@ -1,6 +1,7 @@ -/* Copyright (c) 1996, 1999-2004, 2007 MySQL AB - Use is subject to license terms - This file is public domain and comes with NO WARRANTY of any kind */ +/* Copyright Abandoned 1996,1999 TCX DataKonsult AB & Monty Program KB + & Detron HB, 1996, 1999-2004, 2007 MySQL AB. + This file is public domain and comes with NO WARRANTY of any kind +*/ /* Version numbers for protocol & mysqld */ diff --git a/mysql-wsrep-5.6/include/queues.h b/mysql-wsrep-5.6/include/queues.h index 3ece9c22..2581cec2 100644 --- a/mysql-wsrep-5.6/include/queues.h +++ b/mysql-wsrep-5.6/include/queues.h @@ -44,6 +44,7 @@ typedef struct st_queue { #define queue_element(queue,index) ((queue)->root[index+1]) #define queue_end(queue) ((queue)->root[(queue)->elements]) #define queue_replaced(queue) _downheap(queue,1) +#define queue_set_compare(queue, cmp) (queue)->compare= cmp #define queue_set_cmp_arg(queue, set_arg) (queue)->first_cmp_arg= set_arg #define queue_set_max_at_top(queue, set_arg) \ (queue)->max_at_top= set_arg ? -1 : 1 diff --git a/mysql-wsrep-5.6/include/t_ctype.h b/mysql-wsrep-5.6/include/t_ctype.h index c019189d..c53deb21 100644 --- a/mysql-wsrep-5.6/include/t_ctype.h +++ b/mysql-wsrep-5.6/include/t_ctype.h @@ -1,4 +1,5 @@ /* Copyright (C) 2000 MySQL AB + Use is subject to license terms 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 diff --git a/mysql-wsrep-5.6/include/welcome_copyright_notice.h b/mysql-wsrep-5.6/include/welcome_copyright_notice.h index 4b00f0db..eb2bf260 100644 --- a/mysql-wsrep-5.6/include/welcome_copyright_notice.h +++ b/mysql-wsrep-5.6/include/welcome_copyright_notice.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2010, 2015, 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 @@ -16,7 +16,7 @@ #ifndef _welcome_copyright_notice_h_ #define _welcome_copyright_notice_h_ -#define COPYRIGHT_NOTICE_CURRENT_YEAR "2014" +#define COPYRIGHT_NOTICE_CURRENT_YEAR "2015" /* This define specifies copyright notice which is displayed by every MySQL diff --git a/mysql-wsrep-5.6/libmysql/CMakeLists.txt b/mysql-wsrep-5.6/libmysql/CMakeLists.txt index a2ce148f..16a6a5e1 100644 --- a/mysql-wsrep-5.6/libmysql/CMakeLists.txt +++ b/mysql-wsrep-5.6/libmysql/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2006, 2014, 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 @@ -183,7 +183,6 @@ ENDIF() MERGE_LIBRARIES(mysqlclient STATIC ${LIBS} COMPONENT Development) # Visual Studio users need debug static library for debug projects -INSTALL_DEBUG_SYMBOLS(clientlib) IF(MSVC) INSTALL_DEBUG_TARGET(mysqlclient DESTINATION ${INSTALL_LIBDIR}/debug) INSTALL_DEBUG_TARGET(clientlib DESTINATION ${INSTALL_LIBDIR}/debug) diff --git a/mysql-wsrep-5.6/libmysql/authentication_win/CMakeLists.txt b/mysql-wsrep-5.6/libmysql/authentication_win/CMakeLists.txt index 8cf8862e..447a69ba 100644 --- a/mysql-wsrep-5.6/libmysql/authentication_win/CMakeLists.txt +++ b/mysql-wsrep-5.6/libmysql/authentication_win/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2014, 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 @@ -32,7 +32,6 @@ TARGET_LINK_LIBRARIES(auth_win_client Secur32) SOURCE_GROUP(Headers REGULAR_EXPRESSION ".*h$") -INSTALL_DEBUG_SYMBOLS(auth_win_client) IF(MSVC) INSTALL_DEBUG_TARGET(auth_win_client DESTINATION ${INSTALL_LIBDIR}/debug) ENDIF() diff --git a/mysql-wsrep-5.6/libmysql/errmsg.c b/mysql-wsrep-5.6/libmysql/errmsg.c index f2c09f98..fa679d18 100644 --- a/mysql-wsrep-5.6/libmysql/errmsg.c +++ b/mysql-wsrep-5.6/libmysql/errmsg.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2000, 2014, 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 @@ -107,6 +107,8 @@ const char** get_client_errmsgs() void init_client_errs(void) { + compile_time_assert(array_elements(client_errors) == + (CR_ERROR_LAST - CR_ERROR_FIRST + 2)); (void) my_error_register(get_client_errmsgs, CR_ERROR_FIRST, CR_ERROR_LAST); } diff --git a/mysql-wsrep-5.6/libmysql/libmysql.c b/mysql-wsrep-5.6/libmysql/libmysql.c index 88f1b766..af8f3d6f 100644 --- a/mysql-wsrep-5.6/libmysql/libmysql.c +++ b/mysql-wsrep-5.6/libmysql/libmysql.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2000, 2014, 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 @@ -1335,6 +1335,10 @@ static my_bool my_realloc_str(NET *net, ulong length) res= net_realloc(net, buf_length + length); if (res) { + if (net->last_errno == ER_OUT_OF_RESOURCES) + net->last_errno= CR_OUT_OF_MEMORY; + else if (net->last_errno == ER_NET_PACKET_TOO_LARGE) + net->last_errno= CR_NET_PACKET_TOO_LARGE; strmov(net->sqlstate, unknown_sqlstate); strmov(net->last_error, ER(net->last_errno)); } @@ -4332,7 +4336,27 @@ int cli_read_binary_rows(MYSQL_STMT *stmt) /* end of data */ *prev_ptr= 0; mysql->warning_count= uint2korr(cp+1); - mysql->server_status= uint2korr(cp+3); + /* + OUT parameters result sets has SERVER_PS_OUT_PARAMS and + SERVER_MORE_RESULTS_EXISTS flags in first EOF_Packet only. + Last EOF_Packet of OUT parameters result sets have no + SERVER_MORE_RESULTS_EXISTS flag as described here: + http://dev.mysql.com/doc/internals/en/stored-procedures.html#out-parameter-set + Following code reads last EOF_Packet of result set and can clear + those flags in server_status if we don't preserve them. + Without SERVER_MORE_RESULTS_EXISTS flag mysql_stmt_next_result fails + to read OK_Packet after OUT parameters result set. + So we need to preserve SERVER_MORE_RESULTS_EXISTS flag for OUT + parameters result set. + */ + if (mysql->server_status & SERVER_PS_OUT_PARAMS) + { + mysql->server_status= uint2korr(cp+3) + | SERVER_PS_OUT_PARAMS + | (mysql->server_status & SERVER_MORE_RESULTS_EXISTS); + } + else + mysql->server_status= uint2korr(cp+3); DBUG_PRINT("info",("status: %u warning_count: %u", mysql->server_status, mysql->warning_count)); DBUG_RETURN(0); diff --git a/mysql-wsrep-5.6/libmysqld/CMakeLists.txt b/mysql-wsrep-5.6/libmysqld/CMakeLists.txt index aebae04b..a9244d9f 100644 --- a/mysql-wsrep-5.6/libmysqld/CMakeLists.txt +++ b/mysql-wsrep-5.6/libmysqld/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2006, 2014, 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 @@ -129,3 +129,37 @@ IF(MSVC AND NOT DISABLE_SHARED) MERGE_LIBRARIES(libmysqld SHARED ${LIBS} EXPORTS ${CLIENT_API_FUNCTIONS} COMPONENT Embedded) ENDIF() + +OPTION(WITH_EMBEDDED_SHARED_LIBRARY + "Generate shared version of embedded library (in addition to the static one)" + OFF) +IF(WITH_EMBEDDED_SHARED_LIBRARY) + MERGE_LIBRARIES(libmysqld SHARED + mysqlserver + EXPORTS ${CLIENT_API_FUNCTIONS} + OUTPUT_NAME "mysqld" + COMPONENT Embedded) + SET_TARGET_PROPERTIES(libmysqld PROPERTIES + VERSION "${SHARED_LIB_MAJOR_VERSION}.${SHARED_LIB_MINOR_VERSION}.0" + SOVERSION "${SHARED_LIB_MAJOR_VERSION}" + ) + + GET_TARGET_PROPERTY(libmysqld_link_flags libmysqld LINK_FLAGS) + IF(NOT libmysqld_link_flag) + SET(libmysqld_link_flags) + ENDIF() + SET(libmysqld_link_flags + "${CMAKE_SHARED_LIBRARY_C_FLAGS} ${libmysqld_link_flags}") + SET_TARGET_PROPERTIES(libmysqld + PROPERTIES LINK_FLAGS "${libmysqld_link_flags}") + + IF(LINK_FLAG_NO_UNDEFINED) + SET(libmysqld_link_flags + "${libmysqld_link_flags} ${LINK_FLAG_NO_UNDEFINED}") + SET_TARGET_PROPERTIES(libmysqld + PROPERTIES LINK_FLAGS "${libmysqld_link_flags}") + ENDIF() + + SET_TARGET_PROPERTIES(libmysqld PROPERTIES CLEAN_DIRECT_OUTPUT 1) + SET_TARGET_PROPERTIES(mysqlserver PROPERTIES CLEAN_DIRECT_OUTPUT 1) +ENDIF() diff --git a/mysql-wsrep-5.6/libmysqld/examples/test-run b/mysql-wsrep-5.6/libmysqld/examples/test-run index e322180b..757f4f61 100755 --- a/mysql-wsrep-5.6/libmysqld/examples/test-run +++ b/mysql-wsrep-5.6/libmysqld/examples/test-run @@ -1,6 +1,7 @@ #! /bin/sh # Copyright (C) 2001, 2006 MySQL AB +# Use is subject to license terms # # 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 diff --git a/mysql-wsrep-5.6/libmysqld/lib_sql.cc b/mysql-wsrep-5.6/libmysqld/lib_sql.cc index 4e0e4969..33b50ea8 100644 --- a/mysql-wsrep-5.6/libmysqld/lib_sql.cc +++ b/mysql-wsrep-5.6/libmysqld/lib_sql.cc @@ -2,6 +2,9 @@ * Copyright (c) 2000 * SWsoft company * + * Modifications copyright (c) 2001, 2014. Oracle and/or its affiliates. + * All rights reserved. + * * This material is provided "as is", with absolutely no warranty expressed * or implied. Any use is at your own risk. * @@ -424,11 +427,7 @@ static void emb_free_embedded_thd(MYSQL *mysql) thd->clear_data_list(); thd->store_globals(); thd->release_resources(); - - mysql_mutex_lock(&LOCK_thread_count); remove_global_thread(thd); - mysql_mutex_unlock(&LOCK_thread_count); - delete thd; my_pthread_setspecific_ptr(THR_THD, 0); mysql->thd=0; diff --git a/mysql-wsrep-5.6/man/comp_err.1 b/mysql-wsrep-5.6/man/comp_err.1 index 65e7f45f..7d311abe 100644 --- a/mysql-wsrep-5.6/man/comp_err.1 +++ b/mysql-wsrep-5.6/man/comp_err.1 @@ -2,12 +2,12 @@ .\" Title: \fBcomp_err\fR .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 01/14/2014 +.\" Date: 01/16/2015 .\" Manual: MySQL Database System .\" Source: MySQL 5.6 .\" Language: English .\" -.TH "\FBCOMP_ERR\FR" "1" "01/14/2014" "MySQL 5\&.6" "MySQL Database System" +.TH "\FBCOMP_ERR\FR" "1" "01/16/2015" "MySQL 5\&.6" "MySQL Database System" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -124,8 +124,8 @@ The character set directory\&. The default is Write a debugging log\&. A typical \fIdebug_options\fR string is -\*(Aqd:t:O,\fIfile_name\fR\*(Aq\&. The default is -\*(Aqd:t:O,/tmp/comp_err\&.trace\*(Aq\&. +d:t:O,\fIfile_name\fR\&. The default is +d:t:O,/tmp/comp_err\&.trace\&. .RE .sp .RS 4 @@ -264,7 +264,7 @@ Display version information and exit\&. .SH "COPYRIGHT" .br .PP -Copyright \(co 1997, 2014, Oracle and/or its affiliates. All rights reserved. +Copyright \(co 1997, 2015, Oracle and/or its affiliates. All rights reserved. .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/mysql-wsrep-5.6/man/innochecksum.1 b/mysql-wsrep-5.6/man/innochecksum.1 index 7cb6cc33..bf8a4e3b 100644 --- a/mysql-wsrep-5.6/man/innochecksum.1 +++ b/mysql-wsrep-5.6/man/innochecksum.1 @@ -2,12 +2,12 @@ .\" Title: \fBinnochecksum\fR .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 01/14/2014 +.\" Date: 01/16/2015 .\" Manual: MySQL Database System .\" Source: MySQL 5.6 .\" Language: English .\" -.TH "\FBINNOCHECKSUM\FR" "1" "01/14/2014" "MySQL 5\&.6" "MySQL Database System" +.TH "\FBINNOCHECKSUM\FR" "1" "01/16/2015" "MySQL 5\&.6" "MySQL Database System" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -154,7 +154,7 @@ Verbose mode; print a progress indicator every five seconds\&. .SH "COPYRIGHT" .br .PP -Copyright \(co 1997, 2014, Oracle and/or its affiliates. All rights reserved. +Copyright \(co 1997, 2015, Oracle and/or its affiliates. All rights reserved. .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/mysql-wsrep-5.6/man/msql2mysql.1 b/mysql-wsrep-5.6/man/msql2mysql.1 index aaca06fd..472e2e64 100644 --- a/mysql-wsrep-5.6/man/msql2mysql.1 +++ b/mysql-wsrep-5.6/man/msql2mysql.1 @@ -2,12 +2,12 @@ .\" Title: \fBmsql2mysql\fR .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 01/14/2014 +.\" Date: 01/16/2015 .\" Manual: MySQL Database System .\" Source: MySQL 5.6 .\" Language: English .\" -.TH "\FBMSQL2MYSQL\FR" "1" "01/14/2014" "MySQL 5\&.6" "MySQL Database System" +.TH "\FBMSQL2MYSQL\FR" "1" "01/16/2015" "MySQL 5\&.6" "MySQL Database System" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -34,6 +34,22 @@ msql2mysql \- convert mSQL programs for use with MySQL .HP \w'\fBmsql2mysql\fR\fB\fIC\-source\-file\fR\fR\fB\ \&.\&.\&.\fR\ 'u \fBmsql2mysql\fR\fB\fIC\-source\-file\fR\fR\fB \&.\&.\&.\fR .SH "DESCRIPTION" +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBNote\fR +.ps -1 +.br +.PP +This utility is deprecated in MySQL 5\&.6\&.17 and removed in MySQL 5\&.7 +.sp .5v +.RE .PP Initially, the MySQL C API was developed to be very similar to that for the mSQL database system\&. Because of this, mSQL programs often can be converted relatively easily for use with MySQL by changing the names of the C API functions\&. .PP @@ -69,7 +85,7 @@ utility to make the function name substitutions\&. See .SH "COPYRIGHT" .br .PP -Copyright \(co 1997, 2014, Oracle and/or its affiliates. All rights reserved. +Copyright \(co 1997, 2015, Oracle and/or its affiliates. All rights reserved. .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/mysql-wsrep-5.6/man/my_print_defaults.1 b/mysql-wsrep-5.6/man/my_print_defaults.1 index 6f5e3d19..83b5f960 100644 --- a/mysql-wsrep-5.6/man/my_print_defaults.1 +++ b/mysql-wsrep-5.6/man/my_print_defaults.1 @@ -2,12 +2,12 @@ .\" Title: \fBmy_print_defaults\fR .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 01/14/2014 +.\" Date: 01/16/2015 .\" Manual: MySQL Database System .\" Source: MySQL 5.6 .\" Language: English .\" -.TH "\FBMY_PRINT_DEFAULTS" "1" "01/14/2014" "MySQL 5\&.6" "MySQL Database System" +.TH "\FBMY_PRINT_DEFAULTS" "1" "01/16/2015" "MySQL 5\&.6" "MySQL Database System" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -115,8 +115,8 @@ Read only the given option file\&. Write a debugging log\&. A typical \fIdebug_options\fR string is -\*(Aqd:t:o,\fIfile_name\fR\*(Aq\&. The default is -\*(Aqd:t:o,/tmp/my_print_defaults\&.trace\*(Aq\&. +d:t:o,\fIfile_name\fR\&. The default is +d:t:o,/tmp/my_print_defaults\&.trace\&. .RE .sp .RS 4 @@ -168,7 +168,14 @@ In addition to the groups named on the command line, read groups that have the g .sp Read options from the named login path in the \&.mylogin\&.cnf -login file\&. See +login file\&. A +\(lqlogin path\(rq +is an option group that permits only a limited set of options: +\fBhost\fR, +\fBuser\fR, and +\fBpassword\fR\&. Think of a login path as a set of values that indicate the server host and the credentials for authenticating with the server\&. To create the login path file, use the +\fBmysql_config_editor\fR +utility\&. See \fBmysql_config_editor\fR(1)\&. This option was added in MySQL 5\&.6\&.6\&. .RE .sp @@ -222,7 +229,7 @@ Display version information and exit\&. .SH "COPYRIGHT" .br .PP -Copyright \(co 1997, 2014, Oracle and/or its affiliates. All rights reserved. +Copyright \(co 1997, 2015, Oracle and/or its affiliates. All rights reserved. .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/mysql-wsrep-5.6/man/myisam_ftdump.1 b/mysql-wsrep-5.6/man/myisam_ftdump.1 index c35c27b9..d08a4f6f 100644 --- a/mysql-wsrep-5.6/man/myisam_ftdump.1 +++ b/mysql-wsrep-5.6/man/myisam_ftdump.1 @@ -2,12 +2,12 @@ .\" Title: \fBmyisam_ftdump\fR .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 01/14/2014 +.\" Date: 01/16/2015 .\" Manual: MySQL Database System .\" Source: MySQL 5.6 .\" Language: English .\" -.TH "\FBMYISAM_FTDUMP\FR" "1" "01/14/2014" "MySQL 5\&.6" "MySQL Database System" +.TH "\FBMYISAM_FTDUMP\FR" "1" "01/16/2015" "MySQL 5\&.6" "MySQL Database System" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -251,7 +251,7 @@ Verbose mode\&. Print more output about what the program does\&. .SH "COPYRIGHT" .br .PP -Copyright \(co 1997, 2014, Oracle and/or its affiliates. All rights reserved. +Copyright \(co 1997, 2015, Oracle and/or its affiliates. All rights reserved. .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/mysql-wsrep-5.6/man/myisamchk.1 b/mysql-wsrep-5.6/man/myisamchk.1 index 7e63cd0a..7d383979 100644 --- a/mysql-wsrep-5.6/man/myisamchk.1 +++ b/mysql-wsrep-5.6/man/myisamchk.1 @@ -2,12 +2,12 @@ .\" Title: \fBmyisamchk\fR .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 01/14/2014 +.\" Date: 01/16/2015 .\" Manual: MySQL Database System .\" Source: MySQL 5.6 .\" Language: English .\" -.TH "\FBMYISAMCHK\FR" "1" "01/14/2014" "MySQL 5\&.6" "MySQL Database System" +.TH "\FBMYISAMCHK\FR" "1" "01/16/2015" "MySQL 5\&.6" "MySQL Database System" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -249,10 +249,8 @@ Section\ \&13.7.2.2, \(lqCHECK TABLE Syntax\(rq\&. \fBmyisamchk\fR supports the following options, which can be specified on the command line or in the [myisamchk] -group of an option file\&. -\fBmyisamchk\fR -also supports the options for processing option files described at -Section\ \&4.2.3.4, \(lqCommand-Line Options that Affect Option-File Handling\(rq\&. +group of an option file\&. For information about option files used by MySQL programs, see +Section\ \&4.2.6, \(lqUsing Option Files\(rq\&. .SH "MYISAMCHK GENERAL OPTIONS" .\" options: myisamchk .\" myisamchk: options @@ -308,8 +306,110 @@ Display a help message and exit\&. Options are presented in a single list\&. Write a debugging log\&. A typical \fIdebug_options\fR string is -\*(Aqd:t:o,\fIfile_name\fR\*(Aq\&. The default is -\*(Aqd:t:o,/tmp/myisamchk\&.trace\*(Aq\&. +d:t:o,\fIfile_name\fR\&. The default is +d:t:o,/tmp/myisamchk\&.trace\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +.\" myisamchk: defaults-extra-file option +.\" defaults-extra-file option: myisamchk +\fB\-\-defaults\-extra\-file=\fR\fB\fIfile_name\fR\fR +.sp +Read this option file after the global option file but (on Unix) before the user option file\&. If the file does not exist or is otherwise inaccessible, an error occurs\&. +\fIfile_name\fR +is interpreted relative to the current directory if given as a relative path name rather than a full path name\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +.\" myisamchk: defaults-file option +.\" defaults-file option: myisamchk +\fB\-\-defaults\-file=\fR\fB\fIfile_name\fR\fR +.sp +Use only the given option file\&. If the file does not exist or is otherwise inaccessible, an error occurs\&. +\fIfile_name\fR +is interpreted relative to the current directory if given as a relative path name rather than a full path name\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +.\" myisamchk: defaults-group-suffix option +.\" defaults-group-suffix option: myisamchk +\fB\-\-defaults\-group\-suffix=\fR\fB\fIstr\fR\fR +.sp +Read not only the usual option groups, but also groups with the usual names and a suffix of +\fIstr\fR\&. For example, +\fBmyisamchk\fR +normally reads the +[myisamchk] +group\&. If the +\fB\-\-defaults\-group\-suffix=_other\fR +option is given, +\fBmyisamchk\fR +also reads the +[myisamchk_other] +group\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +.\" myisamchk: no-defaults option +.\" no-defaults option: myisamchk +\fB\-\-no\-defaults\fR +.sp +Do not read any option files\&. If program startup fails due to reading unknown options from an option file, +\fB\-\-no\-defaults\fR +can be used to prevent them from being read\&. +.sp +The exception is that the +\&.mylogin\&.cnf +file, if it exists, is read in all cases\&. This permits passwords to be specified in a safer way than on the command line even when +\fB\-\-no\-defaults\fR +is used\&. (\&.mylogin\&.cnf +is created by the +\fBmysql_config_editor\fR +utility\&. See +\fBmysql_config_editor\fR(1)\&.) +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +.\" myisamchk: print-defaults option +.\" print-defaults option: myisamchk +\fB\-\-print\-defaults\fR +.sp +Print the program name and all options that it gets from option files\&. .RE .sp .RS 4 @@ -2492,7 +2592,7 @@ instead of .SH "COPYRIGHT" .br .PP -Copyright \(co 1997, 2014, Oracle and/or its affiliates. All rights reserved. +Copyright \(co 1997, 2015, Oracle and/or its affiliates. All rights reserved. .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/mysql-wsrep-5.6/man/myisamlog.1 b/mysql-wsrep-5.6/man/myisamlog.1 index c90c52ae..393dfb28 100644 --- a/mysql-wsrep-5.6/man/myisamlog.1 +++ b/mysql-wsrep-5.6/man/myisamlog.1 @@ -2,12 +2,12 @@ .\" Title: \fBmyisamlog\fR .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 01/14/2014 +.\" Date: 01/16/2015 .\" Manual: MySQL Database System .\" Source: MySQL 5.6 .\" Language: English .\" -.TH "\FBMYISAMLOG\FR" "1" "01/14/2014" "MySQL 5\&.6" "MySQL Database System" +.TH "\FBMYISAMLOG\FR" "1" "01/16/2015" "MySQL 5\&.6" "MySQL Database System" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -228,7 +228,7 @@ Display version information\&. .SH "COPYRIGHT" .br .PP -Copyright \(co 1997, 2014, Oracle and/or its affiliates. All rights reserved. +Copyright \(co 1997, 2015, Oracle and/or its affiliates. All rights reserved. .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/mysql-wsrep-5.6/man/myisampack.1 b/mysql-wsrep-5.6/man/myisampack.1 index 58395a92..2dad2da5 100644 --- a/mysql-wsrep-5.6/man/myisampack.1 +++ b/mysql-wsrep-5.6/man/myisampack.1 @@ -2,12 +2,12 @@ .\" Title: \fBmyisampack\fR .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 01/14/2014 +.\" Date: 01/16/2015 .\" Manual: MySQL Database System .\" Source: MySQL 5.6 .\" Language: English .\" -.TH "\FBMYISAMPACK\FR" "1" "01/14/2014" "MySQL 5\&.6" "MySQL Database System" +.TH "\FBMYISAMPACK\FR" "1" "01/16/2015" "MySQL 5\&.6" "MySQL Database System" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -122,7 +122,7 @@ to rebuild its indexes\&. .PP \fBmyisampack\fR supports the following options\&. It also reads option files and supports the options for processing them described at -Section\ \&4.2.3.4, \(lqCommand-Line Options that Affect Option-File Handling\(rq\&. +Section\ \&4.2.7, \(lqCommand-Line Options that Affect Option-File Handling\(rq\&. .sp .RS 4 .ie n \{\ @@ -189,8 +189,8 @@ Section\ \&10.5, \(lqCharacter Set Configuration\(rq\&. Write a debugging log\&. A typical \fIdebug_options\fR string is -\*(Aqd:t:o,\fIfile_name\fR\*(Aq\&. The default is -\*(Aqd:t:o\*(Aq\&. +d:t:o,\fIfile_name\fR\&. The default is +d:t:o\&. .RE .sp .RS 4 @@ -853,7 +853,7 @@ option to .SH "COPYRIGHT" .br .PP -Copyright \(co 1997, 2014, Oracle and/or its affiliates. All rights reserved. +Copyright \(co 1997, 2015, Oracle and/or its affiliates. All rights reserved. .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/mysql-wsrep-5.6/man/mysql-stress-test.pl.1 b/mysql-wsrep-5.6/man/mysql-stress-test.pl.1 index 1a259472..9fc64e78 100644 --- a/mysql-wsrep-5.6/man/mysql-stress-test.pl.1 +++ b/mysql-wsrep-5.6/man/mysql-stress-test.pl.1 @@ -2,12 +2,12 @@ .\" Title: \fBmysql-stress-test.pl\fR .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 01/10/2014 +.\" Date: 01/15/2015 .\" Manual: MySQL Database System .\" Source: MySQL .\" Language: English .\" -.TH "\FBMYSQL\-STRESS\-TE" "1" "01/10/2014" "MySQL" "MySQL Database System" +.TH "\FBMYSQL\-STRESS\-TE" "1" "01/15/2015" "MySQL" "MySQL Database System" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -498,7 +498,7 @@ Verbose mode\&. Print more information about what the program does\&. .SH "COPYRIGHT" .br .PP -Copyright \(co 2006, 2013, Oracle and/or its affiliates. All rights reserved. +Copyright \(co 2006, 2015, Oracle and/or its affiliates. All rights reserved. .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/mysql-wsrep-5.6/man/mysql-test-run.pl.1 b/mysql-wsrep-5.6/man/mysql-test-run.pl.1 index f84323ce..a4d880d4 100644 --- a/mysql-wsrep-5.6/man/mysql-test-run.pl.1 +++ b/mysql-wsrep-5.6/man/mysql-test-run.pl.1 @@ -2,12 +2,12 @@ .\" Title: \fBmysql-test-run.pl\fR .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 01/10/2014 +.\" Date: 01/15/2015 .\" Manual: MySQL Database System .\" Source: MySQL .\" Language: English .\" -.TH "\FBMYSQL\-TEST\-RUN\" "1" "01/10/2014" "MySQL" "MySQL Database System" +.TH "\FBMYSQL\-TEST\-RUN\" "1" "01/15/2015" "MySQL" "MySQL Database System" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -1582,7 +1582,7 @@ MTR_PORT_BASE\&. was added in MySQL 5\&.1\&.45 as a more logical alternative to \fB\-\-build\-thread\fR\&. If both are used, \fB\-\-port\-base\fR -takes presedence\&. +takes precedence\&. .RE .sp .RS 4 @@ -1797,7 +1797,7 @@ Do not apply combinations; ignore combinations file or option\&. .\" skip-ndb option: mysql-test-run.pl \fB\-\-skip\-ndb\fR .sp -Do not start NDB Cluster; skip Cluster test cases\&. From MySQL 5\&.1\&.52, this is the default and so this option does not do anything but is kept for backwards compatibility\&. +Do not start NDB Cluster; skip Cluster test cases\&. From MySQL 5\&.1\&.52, this is the default and so this option does not do anything but is kept for backward compatibility\&. .RE .sp .RS 4 @@ -2551,7 +2551,7 @@ in their name\&. .SH "COPYRIGHT" .br .PP -Copyright \(co 2006, 2013, Oracle and/or its affiliates. All rights reserved. +Copyright \(co 2006, 2015, Oracle and/or its affiliates. All rights reserved. .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/mysql-wsrep-5.6/man/mysql.1 b/mysql-wsrep-5.6/man/mysql.1 index 723d8b21..4cef6582 100644 --- a/mysql-wsrep-5.6/man/mysql.1 +++ b/mysql-wsrep-5.6/man/mysql.1 @@ -2,12 +2,12 @@ .\" Title: \fBmysql\fR .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 01/14/2014 +.\" Date: 01/16/2015 .\" Manual: MySQL Database System .\" Source: MySQL 5.6 .\" Language: English .\" -.TH "\FBMYSQL\FR" "1" "01/14/2014" "MySQL 5\&.6" "MySQL Database System" +.TH "\FBMYSQL\FR" "1" "01/16/2015" "MySQL 5\&.6" "MySQL Database System" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -121,10 +121,8 @@ supports the following options, which can be specified on the command line or in [mysql] and [client] -groups of an option file\&. -\fBmysql\fR -also supports the options for processing option files described at -Section\ \&4.2.3.4, \(lqCommand-Line Options that Affect Option-File Handling\(rq\&. +groups of an option file\&. For information about option files used by MySQL programs, see +Section\ \&4.2.6, \(lqUsing Option Files\(rq\&. .sp .RS 4 .ie n \{\ @@ -160,11 +158,32 @@ to disable rehashing\&. That causes \fBmysql\fR to start faster, but you must issue the rehash -command if you want to use name completion\&. +command or its +\e# +shortcut if you want to use name completion\&. .sp To complete a name, enter the first part and press Tab\&. If the name is unambiguous, \fBmysql\fR completes it\&. Otherwise, you can press Tab again to see the possible names that begin with what you have typed so far\&. Completion does not occur if there is no default database\&. +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBNote\fR +.ps -1 +.br +This feature requires a MySQL client that is compiled with the +\fBreadline\fR +library\&. Typically, the +\fBreadline\fR +library is not available on Windows\&. +.sp .5v +.RE .RE .sp .RS 4 @@ -260,7 +279,7 @@ This option was added in MySQL 5\&.6\&.3\&. .\" bind-address option: mysql \fB\-\-bind\-address=\fR\fB\fIip_address\fR\fR .sp -On a computer having multiple network interfaces, this option can be used to select which interface is employed when connecting to the MySQL server\&. +On a computer having multiple network interfaces, use this option to select which interface to use for connecting to the MySQL server\&. .sp This option is supported beginning with MySQL 5\&.6\&.1\&. .RE @@ -394,8 +413,8 @@ The database to use\&. This is useful primarily in an option file\&. Write a debugging log\&. A typical \fIdebug_options\fR string is -\*(Aqd:t:o,\fIfile_name\fR\*(Aq\&. The default is -\*(Aqd:t:o,/tmp/mysql\&.trace\*(Aq\&. +d:t:o,\fIfile_name\fR\&. The default is +d:t:o,/tmp/mysql\&.trace\&. .RE .sp .RS 4 @@ -463,7 +482,7 @@ as the default character set for the client and connection\&. .sp A common issue that can occur when the operating system uses utf8 -or another multi\-byte character set is that output from the +or another multibyte character set is that output from the \fBmysql\fR client is formatted incorrectly, due to the fact that the MySQL client uses the latin1 @@ -481,6 +500,70 @@ Section\ \&10.5, \(lqCharacter Set Configuration\(rq, for more information\&. .sp -1 .IP \(bu 2.3 .\} +.\" mysql: defaults-extra-file option +.\" defaults-extra-file option: mysql +\fB\-\-defaults\-extra\-file=\fR\fB\fIfile_name\fR\fR +.sp +Read this option file after the global option file but (on Unix) before the user option file\&. If the file does not exist or is otherwise inaccessible, an error occurs\&. +\fIfile_name\fR +is interpreted relative to the current directory if given as a relative path name rather than a full path name\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +.\" mysql: defaults-file option +.\" defaults-file option: mysql +\fB\-\-defaults\-file=\fR\fB\fIfile_name\fR\fR +.sp +Use only the given option file\&. If the file does not exist or is otherwise inaccessible, an error occurs\&. +\fIfile_name\fR +is interpreted relative to the current directory if given as a relative path name rather than a full path name\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +.\" mysql: defaults-group-suffix option +.\" defaults-group-suffix option: mysql +\fB\-\-defaults\-group\-suffix=\fR\fB\fIstr\fR\fR +.sp +Read not only the usual option groups, but also groups with the usual names and a suffix of +\fIstr\fR\&. For example, +\fBmysql\fR +normally reads the +[client] +and +[mysql] +groups\&. If the +\fB\-\-defaults\-group\-suffix=_other\fR +option is given, +\fBmysql\fR +also reads the +[client_other] +and +[mysql_other] +groups\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} .\" mysql: delimiter option .\" delimiter option: mysql \fB\-\-delimiter=\fR\fB\fIstr\fR\fR @@ -525,7 +608,7 @@ the section called \(lqMYSQL COMMANDS\(rq\&. Enable the mysql_clear_password cleartext authentication plugin\&. (See -Section\ \&6.3.7.7, \(lqThe Cleartext Client-Side Authentication Plugin\(rq\&.) This option was added in MySQL 5\&.6\&.7\&. +Section\ \&6.3.8.7, \(lqThe Cleartext Client-Side Authentication Plugin\(rq\&.) This option was added in MySQL 5\&.6\&.7\&. .RE .sp .RS 4 @@ -543,7 +626,7 @@ Section\ \&6.3.7.7, \(lqThe Cleartext Client-Side Authentication Plugin\(rq\&.) .sp Execute the statement and quit\&. The default output format is like that produced with \fB\-\-batch\fR\&. See -Section\ \&4.2.3.1, \(lqUsing Options on the Command Line\(rq, for some examples\&. With this option, +Section\ \&4.2.4, \(lqUsing Options on the Command Line\(rq, for some examples\&. With this option, \fBmysql\fR does not use the history file\&. .RE @@ -696,6 +779,31 @@ has no effect if the server does not also support it\&. .sp -1 .IP \(bu 2.3 .\} +.\" mysql: login-path option +.\" login-path option: mysql +\fB\-\-login\-path=\fR\fB\fIname\fR\fR +.sp +Read options from the named login path in the +\&.mylogin\&.cnf +login file\&. A +\(lqlogin path\(rq +is an option group that permits only a limited set of options: +\fBhost\fR, +\fBuser\fR, and +\fBpassword\fR\&. Think of a login path as a set of values that indicate the server host and the credentials for authenticating with the server\&. To create the login path file, use the +\fBmysql_config_editor\fR +utility\&. See +\fBmysql_config_editor\fR(1)\&. This option was added in MySQL 5\&.6\&.6\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} .\" mysql: named-commands option .\" named-commands option: mysql \fB\-\-named\-commands\fR, @@ -727,7 +835,7 @@ the section called \(lqMYSQL COMMANDS\(rq\&. \fB\-A\fR .sp This has the same effect as -\fB\-skip\-auto\-rehash\fR\&. See the description for +\fB\-\-skip\-auto\-rehash\fR\&. See the description for \fB\-\-auto\-rehash\fR\&. .RE .sp @@ -755,6 +863,33 @@ Do not beep when errors occur\&. .sp -1 .IP \(bu 2.3 .\} +.\" mysql: no-defaults option +.\" no-defaults option: mysql +\fB\-\-no\-defaults\fR +.sp +Do not read any option files\&. If program startup fails due to reading unknown options from an option file, +\fB\-\-no\-defaults\fR +can be used to prevent them from being read\&. +.sp +The exception is that the +\&.mylogin\&.cnf +file, if it exists, is read in all cases\&. This permits passwords to be specified in a safer way than on the command line even when +\fB\-\-no\-defaults\fR +is used\&. (\&.mylogin\&.cnf +is created by the +\fBmysql_config_editor\fR +utility\&. See +\fBmysql_config_editor\fR(1)\&.) +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} .\" mysql: one-database option .\" one-database option: mysql \fB\-\-one\-database\fR, @@ -963,6 +1098,21 @@ The TCP/IP port number to use for the connection\&. .sp -1 .IP \(bu 2.3 .\} +.\" mysql: print-defaults option +.\" print-defaults option: mysql +\fB\-\-print\-defaults\fR +.sp +Print the program name and all options that it gets from option files\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} .\" mysql: prompt option .\" prompt option: mysql \fB\-\-prompt=\fR\fB\fIformat_str\fR\fR @@ -1130,7 +1280,8 @@ to disable it\&. \fBNote\fR .ps -1 .br -Passwords that use the pre\-4\&.1 hashing method are less secure than passwords that use the native password hashing method and should be avoided\&. Pre\-4\&.1 passwords are deprecated and support for them will be removed in a future MySQL release\&. +Passwords that use the pre\-4\&.1 hashing method are less secure than passwords that use the native password hashing method and should be avoided\&. Pre\-4\&.1 passwords are deprecated and support for them will be removed in a future MySQL release\&. For account upgrade instructions, see +Section\ \&6.3.8.3, \(lqMigrating Away from Pre-4.1 Password Hashing and the mysql_old_password Plugin\(rq\&. .sp .5v .RE .RE @@ -1156,7 +1307,7 @@ The server sends the public key to the client as needed, so it is not necessary For additional discussion regarding use of the sha256_password plugin, including how to get the RSA public key, see -Section\ \&6.3.7.4, \(lqThe SHA-256 Authentication Plugin\(rq\&. +Section\ \&6.3.8.4, \(lqThe SHA-256 Authentication Plugin\(rq\&. .sp This option is available only if MySQL was built using OpenSSL\&. It was added in MySQL 5\&.6\&.6 under the name \fB\-\-server\-public\-key\fR @@ -1172,6 +1323,26 @@ and renamed in 5\&.6\&.7 to .sp -1 .IP \(bu 2.3 .\} +.\" mysql: shared-memory-base-name option +.\" shared-memory-base-name option: mysql +\fB\-\-shared\-memory\-base\-name=\fR\fB\fIname\fR\fR +.sp +On Windows, the shared\-memory name to use, for connections made using shared memory to a local server\&. The default value is +MYSQL\&. The shared\-memory name is case sensitive\&. +.sp +The server must be started with the +\fB\-\-shared\-memory\fR +option to enable shared\-memory connections\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} .\" mysql: show-warnings option .\" show-warnings option: mysql \fB\-\-show\-warnings\fR @@ -1281,7 +1452,7 @@ localhost, the Unix socket file to use, or, on Windows, the name of the named pi Options that begin with \fB\-\-ssl\fR specify whether to connect to the server using SSL and indicate where to find SSL keys and certificates\&. See -Section\ \&6.3.9.4, \(lqSSL Command Options\(rq\&. +Section\ \&6.3.10.4, \(lqSSL Command Options\(rq\&. .RE .sp .RS 4 @@ -1753,8 +1924,8 @@ is set to something other than the default of \(lq;\(rq, instances of that character are sent to the server without interpretation\&. However, the server itself still interprets \(lq;\(rq as a statement delimiter and processes statements accordingly\&. This behavior on the server side comes into play for multiple\-statement execution (see -Section\ \&22.8.17, \(lqC API Support for Multiple Statement Execution\(rq), and for parsing the body of stored procedures and functions, triggers, and events (see -Section\ \&19.1, \(lqDefining Stored Programs\(rq)\&. +Section\ \&23.8.17, \(lqC API Support for Multiple Statement Execution\(rq), and for parsing the body of stored procedures and functions, triggers, and events (see +Section\ \&20.1, \(lqDefining Stored Programs\(rq)\&. .RE .sp .RS 4 @@ -1885,7 +2056,7 @@ tee\&. nowarning, \ew .sp -Enable display of warnings after each statement\&. +Disable display of warnings after each statement\&. .RE .sp .RS 4 @@ -2566,7 +2737,7 @@ prompt=(\e\eu@\e\eh) [\e\ed]>\e\e_ In this example, note that the backslashes are doubled\&. If you set the prompt using the prompt option in an option file, it is advisable to double the backslashes when using the special prompt options\&. There is some overlap in the set of permissible prompt options and the set of special escape sequences that are recognized in option files\&. (The rules for escape sequences in option files are listed in -Section\ \&4.2.3.3, \(lqUsing Option Files\(rq\&.) The overlap may cause you problems if you use single backslashes\&. For example, +Section\ \&4.2.6, \(lqUsing Option Files\(rq\&.) The overlap may cause you problems if you use single backslashes\&. For example, \es is interpreted as a space rather than as the current seconds value\&. The following example shows how to define a prompt within an option file to include the current time in HH:MM:SS> @@ -2631,8 +2802,7 @@ client logs statements executed interactively to a history file\&. By default, t in your home directory\&. To specify a different file, set the value of the MYSQL_HISTFILE environment variable\&. - How Logging Occurs -.PP +How Logging Occurs.PP Statement logging occurs as follows: .sp .RS 4 @@ -2787,8 +2957,7 @@ shell> \fBmysql \-\-histignore="*UPDATE*:*DELETE*"\fR .RE .\} .sp - Controlling the History File -.PP +Controlling the History File.PP The \&.mysql_history file should be protected with a restrictive access mode because sensitive information might be written to it, such as the text of SQL statements that contain passwords\&. See @@ -2950,7 +3119,7 @@ mysql> SHOW BINARY LOGS; .RE .\} .PP -The search string can contain the the wildcard characters +The search string can contain the wildcard characters \(lq%\(rq and \(lq_\(rq\&. These have the same meaning as for pattern\-matching operations performed with the @@ -3426,11 +3595,11 @@ client with the option\&. .PP For more information about auto\-reconnect and its effect on state information when a reconnection occurs, see -Section\ \&22.8.16, \(lqControlling Automatic Reconnection Behavior\(rq\&. +Section\ \&23.8.16, \(lqControlling Automatic Reconnection Behavior\(rq\&. .SH "COPYRIGHT" .br .PP -Copyright \(co 1997, 2014, Oracle and/or its affiliates. All rights reserved. +Copyright \(co 1997, 2015, Oracle and/or its affiliates. All rights reserved. .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/mysql-wsrep-5.6/man/mysql.server.1 b/mysql-wsrep-5.6/man/mysql.server.1 index eb975fa7..8fe9b922 100644 --- a/mysql-wsrep-5.6/man/mysql.server.1 +++ b/mysql-wsrep-5.6/man/mysql.server.1 @@ -2,12 +2,12 @@ .\" Title: \fBmysql.server\fR .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 01/14/2014 +.\" Date: 01/16/2015 .\" Manual: MySQL Database System .\" Source: MySQL 5.6 .\" Language: English .\" -.TH "\FBMYSQL\&.SERVER\FR" "1" "01/14/2014" "MySQL 5\&.6" "MySQL Database System" +.TH "\FBMYSQL\&.SERVER\FR" "1" "01/16/2015" "MySQL 5\&.6" "MySQL Database System" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -36,7 +36,7 @@ mysql.server \- MySQL server startup script .SH "DESCRIPTION" .PP MySQL distributions on Unix include a script named -\fBmysql\&.server\fR\&. It can be used on systems such as Linux and Solaris that use System V\-style run directories to start and stop system services\&. It is also used by the Mac OS X Startup Item for MySQL\&. +\fBmysql\&.server\fR\&. It can be used on systems such as Linux and Solaris that use System V\-style run directories to start and stop system services\&. It is also used by the OS X Startup Item for MySQL\&. .PP \fBmysql\&.server\fR can be found in the @@ -49,7 +49,7 @@ script will be installed in the /etc/init\&.d directory with the name mysql\&. You need not install it manually\&. See -Section\ \&2.5.3, \(lqInstalling MySQL on Linux Using RPM Packages\(rq, for more information on the Linux RPM packages\&. +Section\ \&2.5.5, \(lqInstalling MySQL on Linux Using RPM Packages\(rq, for more information on the Linux RPM packages\&. .PP Some vendors provide RPM packages that install a startup script under a different name such as \fBmysqld\fR\&. @@ -128,7 +128,7 @@ The path name of the file in which the server should write its process ID\&. .\} .\" mysql.server: service-startup-timeout option .\" service-startup-timeout option: mysql.server -\fB\-\-service\-startup\-timeout=\fR\fB\fIfile_name\fR\fR +\fB\-\-service\-startup\-timeout=\fR\fB\fIseconds\fR\fR .sp How long in seconds to wait for confirmation of server startup\&. If the server does not start within this time, \fBmysql\&.server\fR @@ -170,7 +170,7 @@ The login user name to use for running .SH "COPYRIGHT" .br .PP -Copyright \(co 1997, 2014, Oracle and/or its affiliates. All rights reserved. +Copyright \(co 1997, 2015, Oracle and/or its affiliates. All rights reserved. .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/mysql-wsrep-5.6/man/mysql_client_test.1 b/mysql-wsrep-5.6/man/mysql_client_test.1 index 06985def..5b590540 100644 --- a/mysql-wsrep-5.6/man/mysql_client_test.1 +++ b/mysql-wsrep-5.6/man/mysql_client_test.1 @@ -2,12 +2,12 @@ .\" Title: \fBmysql_client_test\fR .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 01/10/2014 +.\" Date: 01/15/2015 .\" Manual: MySQL Database System .\" Source: MySQL .\" Language: English .\" -.TH "\FBMYSQL_CLIENT_TEST" "1" "01/10/2014" "MySQL" "MySQL Database System" +.TH "\FBMYSQL_CLIENT_TEST" "1" "01/15/2015" "MySQL" "MySQL Database System" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -335,7 +335,7 @@ mysql\-test/var\&. .SH "COPYRIGHT" .br .PP -Copyright \(co 2006, 2013, Oracle and/or its affiliates. All rights reserved. +Copyright \(co 2006, 2015, Oracle and/or its affiliates. All rights reserved. .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/mysql-wsrep-5.6/man/mysql_config.1 b/mysql-wsrep-5.6/man/mysql_config.1 index 486bd140..1d33b086 100644 --- a/mysql-wsrep-5.6/man/mysql_config.1 +++ b/mysql-wsrep-5.6/man/mysql_config.1 @@ -2,12 +2,12 @@ .\" Title: \fBmysql_config\fR .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 01/14/2014 +.\" Date: 01/16/2015 .\" Manual: MySQL Database System .\" Source: MySQL 5.6 .\" Language: English .\" -.TH "\FBMYSQL_CONFIG\FR" "1" "01/14/2014" "MySQL 5\&.6" "MySQL Database System" +.TH "\FBMYSQL_CONFIG\FR" "1" "01/16/2015" "MySQL 5\&.6" "MySQL Database System" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -248,7 +248,7 @@ shell> \fBgcc \-o progname progname\&.o `mysql_config \-\-libs`\fR .SH "COPYRIGHT" .br .PP -Copyright \(co 1997, 2014, Oracle and/or its affiliates. All rights reserved. +Copyright \(co 1997, 2015, Oracle and/or its affiliates. All rights reserved. .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/mysql-wsrep-5.6/man/mysql_config_editor.1 b/mysql-wsrep-5.6/man/mysql_config_editor.1 index 49228fdb..2c45bc34 100644 --- a/mysql-wsrep-5.6/man/mysql_config_editor.1 +++ b/mysql-wsrep-5.6/man/mysql_config_editor.1 @@ -2,12 +2,12 @@ .\" Title: \fBmysql_config_editor\fR .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 01/14/2014 +.\" Date: 01/16/2015 .\" Manual: MySQL Database System .\" Source: MySQL 5.6 .\" Language: English .\" -.TH "\FBMYSQL_CONFIG_EDIT" "1" "01/14/2014" "MySQL 5\&.6" "MySQL Database System" +.TH "\FBMYSQL_CONFIG_EDIT" "1" "01/16/2015" "MySQL 5\&.6" "MySQL Database System" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -106,7 +106,7 @@ host = 127\&.0\&.0\&.1 When you invoke a client program to connect to the server, \&.mylogin\&.cnf is used in conjunction with other option files\&. Its precedence is higher than other option files, but less than options specified explicitly on the client command line\&. For information about the order in which option files are used, see -Section\ \&4.2.3.3, \(lqUsing Option Files\(rq\&. +Section\ \&4.2.6, \(lqUsing Option Files\(rq\&. .PP Invoke mysql_config_editor @@ -206,7 +206,7 @@ command: .RS 4 .\} .nf -shell> mysql_config_editor print \-\-all +shell> \fBmysql_config_editor print \-\-all\fR [local] user = localuser password = ***** @@ -284,8 +284,7 @@ file, if it exists, is read in all cases, even when the option is used\&. This permits passwords to be specified in a safer way than on the command line even if \fB\-\-no\-defaults\fR is present\&. - \fBmysql_config_editor\fR Commands -.PP +mysql_config_editor Commands.PP This section describes the permitted \fBmysql_config_editor\fR commands, and the interpretation of options that have a command\-specific meaning\&. In addition, @@ -667,8 +666,7 @@ prints a warning and prompts for confirmation\&. To suppress the warning and pro \fB\-\-skip\-warn\fR option\&. .RE - \fBmysql_config_editor\fR Options -.PP +mysql_config_editor Options.PP \fBmysql_config_editor\fR supports the following options\&. .sp @@ -724,8 +722,8 @@ command, print all login paths in the login file\&. Write a debugging log\&. A typical \fIdebug_options\fR string is -\*(Aqd:t:o,\fIfile_name\fR\*(Aq\&. The default is -\*(Aqd:t:o,/tmp/mysql_config_editor\&.trace\*(Aq\&. +d:t:o,\fIfile_name\fR\&. The default is +d:t:o\&. .RE .sp .RS 4 @@ -743,7 +741,7 @@ string is .sp For the set -command, the host name to write to to the login path\&. For the +command, the host name to write to the login path\&. For the remove command, removes the host name from the login path\&. .RE @@ -775,7 +773,7 @@ option, to enable users to specify which login path to use for connecting to a M \fB\-\-login\-path\fR must be the first option given, which is not true for \fBmysql_config_editor\fR\&. See -Section\ \&4.2.3.4, \(lqCommand-Line Options that Affect Option-File Handling\(rq\&. +Section\ \&4.2.7, \(lqCommand-Line Options that Affect Option-File Handling\(rq\&. .RE .sp .RS 4 @@ -926,7 +924,7 @@ to disable it\&. .SH "COPYRIGHT" .br .PP -Copyright \(co 1997, 2014, Oracle and/or its affiliates. All rights reserved. +Copyright \(co 1997, 2015, Oracle and/or its affiliates. All rights reserved. .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/mysql-wsrep-5.6/man/mysql_convert_table_format.1 b/mysql-wsrep-5.6/man/mysql_convert_table_format.1 index d3a04eb9..0b86e454 100644 --- a/mysql-wsrep-5.6/man/mysql_convert_table_format.1 +++ b/mysql-wsrep-5.6/man/mysql_convert_table_format.1 @@ -2,12 +2,12 @@ .\" Title: \fBmysql_convert_table_format\fR .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 01/14/2014 +.\" Date: 01/16/2015 .\" Manual: MySQL Database System .\" Source: MySQL 5.6 .\" Language: English .\" -.TH "\FBMYSQL_CONVERT_TAB" "1" "01/14/2014" "MySQL 5\&.6" "MySQL Database System" +.TH "\FBMYSQL_CONVERT_TAB" "1" "01/16/2015" "MySQL 5\&.6" "MySQL Database System" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -34,6 +34,22 @@ mysql_convert_table_format \- convert tables to use a given storage engine .HP \w'\fBmysql_convert_table_format\ [\fR\fB\fIoptions\fR\fR\fB]\ \fR\fB\fIdb_name\fR\fR\ 'u \fBmysql_convert_table_format [\fR\fB\fIoptions\fR\fR\fB] \fR\fB\fIdb_name\fR\fR .SH "DESCRIPTION" +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBNote\fR +.ps -1 +.br +.PP +This utility is deprecated in MySQL 5\&.6\&.17 and removed in MySQL 5\&.7 +.sp .5v +.RE .PP \fBmysql_convert_table_format\fR converts the tables in a database to use a particular storage engine (MyISAM @@ -225,7 +241,7 @@ Display version information and exit\&. .SH "COPYRIGHT" .br .PP -Copyright \(co 1997, 2014, Oracle and/or its affiliates. All rights reserved. +Copyright \(co 1997, 2015, Oracle and/or its affiliates. All rights reserved. .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/mysql-wsrep-5.6/man/mysql_find_rows.1 b/mysql-wsrep-5.6/man/mysql_find_rows.1 index 537509f1..18f6af87 100644 --- a/mysql-wsrep-5.6/man/mysql_find_rows.1 +++ b/mysql-wsrep-5.6/man/mysql_find_rows.1 @@ -2,12 +2,12 @@ .\" Title: \fBmysql_find_rows\fR .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 01/14/2014 +.\" Date: 01/16/2015 .\" Manual: MySQL Database System .\" Source: MySQL 5.6 .\" Language: English .\" -.TH "\FBMYSQL_FIND_ROWS\F" "1" "01/14/2014" "MySQL 5\&.6" "MySQL Database System" +.TH "\FBMYSQL_FIND_ROWS\F" "1" "01/16/2015" "MySQL 5\&.6" "MySQL Database System" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -34,6 +34,22 @@ mysql_find_rows \- extract SQL statements from files .HP \w'\fBmysql_find_rows\ [\fR\fB\fIoptions\fR\fR\fB]\ [\fR\fB\fIfile_name\fR\fR\fB\ \&.\&.\&.]\fR\ 'u \fBmysql_find_rows [\fR\fB\fIoptions\fR\fR\fB] [\fR\fB\fIfile_name\fR\fR\fB \&.\&.\&.]\fR .SH "DESCRIPTION" +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBNote\fR +.ps -1 +.br +.PP +This utility is deprecated in MySQL 5\&.6\&.17 and removed in MySQL 5\&.7 +.sp .5v +.RE .PP \fBmysql_find_rows\fR reads files containing SQL statements and extracts statements that match a given regular expression or that contain @@ -160,7 +176,7 @@ Start output from this row\&. .SH "COPYRIGHT" .br .PP -Copyright \(co 1997, 2014, Oracle and/or its affiliates. All rights reserved. +Copyright \(co 1997, 2015, Oracle and/or its affiliates. All rights reserved. .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/mysql-wsrep-5.6/man/mysql_fix_extensions.1 b/mysql-wsrep-5.6/man/mysql_fix_extensions.1 index 3023ae5e..6c6f7152 100644 --- a/mysql-wsrep-5.6/man/mysql_fix_extensions.1 +++ b/mysql-wsrep-5.6/man/mysql_fix_extensions.1 @@ -2,12 +2,12 @@ .\" Title: \fBmysql_fix_extensions\fR .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 01/14/2014 +.\" Date: 01/16/2015 .\" Manual: MySQL Database System .\" Source: MySQL 5.6 .\" Language: English .\" -.TH "\FBMYSQL_FIX_EXTENSI" "1" "01/14/2014" "MySQL 5\&.6" "MySQL Database System" +.TH "\FBMYSQL_FIX_EXTENSI" "1" "01/16/2015" "MySQL 5\&.6" "MySQL Database System" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -34,6 +34,22 @@ mysql_fix_extensions \- normalize table file name extensions .HP \w'\fBmysql_fix_extensions\ \fR\fB\fIdata_dir\fR\fR\ 'u \fBmysql_fix_extensions \fR\fB\fIdata_dir\fR\fR .SH "DESCRIPTION" +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBNote\fR +.ps -1 +.br +.PP +This utility is deprecated in MySQL 5\&.6\&.17 and removed in MySQL 5\&.7 +.sp .5v +.RE .PP \fBmysql_fix_extensions\fR converts the extensions for @@ -70,7 +86,7 @@ shell> \fBmysql_fix_extensions \fR\fB\fIdata_dir\fR\fR .SH "COPYRIGHT" .br .PP -Copyright \(co 1997, 2014, Oracle and/or its affiliates. All rights reserved. +Copyright \(co 1997, 2015, Oracle and/or its affiliates. All rights reserved. .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/mysql-wsrep-5.6/man/mysql_install_db.1 b/mysql-wsrep-5.6/man/mysql_install_db.1 index 49bf6ff3..8b9ce8be 100644 --- a/mysql-wsrep-5.6/man/mysql_install_db.1 +++ b/mysql-wsrep-5.6/man/mysql_install_db.1 @@ -2,12 +2,12 @@ .\" Title: \fBmysql_install_db\fR .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 01/14/2014 +.\" Date: 01/16/2015 .\" Manual: MySQL Database System .\" Source: MySQL 5.6 .\" Language: English .\" -.TH "\FBMYSQL_INSTALL_DB\" "1" "01/14/2014" "MySQL 5\&.6" "MySQL Database System" +.TH "\FBMYSQL_INSTALL_DB\" "1" "01/16/2015" "MySQL 5\&.6" "MySQL Database System" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -60,12 +60,10 @@ assumes it to be in use and writes a new file named my\-new\&.cnf instead\&. .PP -With one exception, the settings in the default option file are commented and have no effect\&. The exception is that the file changes the +With one exception, the settings in the default option file are commented and have no effect\&. The exception is that the file sets the sql_mode -system variable from its default of -NO_ENGINE_SUBSTITUTION -to also include -STRICT_TRANS_TABLES\&. This setting produces a server configuration that results in errors rather than warnings for bad data in operations that modify transactional tables\&. See +system variable to +NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES\&. This setting produces a server configuration that results in errors rather than warnings for bad data in operations that modify transactional tables\&. See Section\ \&5.1.7, \(lqServer SQL Modes\(rq\&. .PP To invoke @@ -82,13 +80,12 @@ shell> \fBmysql_install_db [\fR\fB\fIoptions\fR\fR\fB]\fR .\} .PP Because the MySQL server, -\fBmysqld\fR, needs to access the data directory when it runs later, you should either run +\fBmysqld\fR, must access the data directory when it runs later, you should either run \fBmysql_install_db\fR from the same system account that will be used for running -\fBmysqld\fR -or run it as +\fBmysqld\fR, or run it as root -and use the +and specify the \fB\-\-user\fR option to indicate the user name that \fBmysqld\fR @@ -111,15 +108,45 @@ shell> \fBscripts/mysql_install_db \-\-user=mysql \e\fR .if n \{\ .RE .\} +.sp +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBNote\fR +.ps -1 +.br .PP +After \fBmysql_install_db\fR -needs to invoke -\fBmysqld\fR -with the -\fB\-\-bootstrap\fR +sets up the +InnoDB +system tablespace, changes to some tablespace characteristics require setting up a whole new +instance\&. This includes the file name of the first file in the system tablespace and the number of undo logs\&. If you do not want to use the default values, make sure that the settings for the +innodb_data_file_path and -\fB\-\-skip\-grant\-tables\fR -options\&. +innodb_log_file_size +configuration parameters are in place in the MySQL +configuration file +before running +\fBmysql_install_db\fR\&. Also make sure to specify as necessary other parameters that affect the creation and location of +InnoDB +files, such as +innodb_data_home_dir +and +innodb_log_group_home_dir\&. +.PP +If those options are in your configuration file but that file is not in a location that MySQL reads by default, specify the file location using the +\fB\-\-defaults\-extra\-file\fR +option when you run +\fBmysql_install_db\fR\&. +.sp .5v +.RE .if n \{\ .sp .\} @@ -143,20 +170,6 @@ or set TMPDIR to point to the system temporary directory (usually /tmp)\&. -.PP -After -\fBmysql_install_db\fR -sets up the -InnoDB -system tablespace, changes to some of tablespace characteristics require setting up a whole new -instance\&. This includes the file name of the first file in the system tablespace and the number of undo logs\&. If you do not want to use the default values, make sure that the settings for the -innodb_data_file_path -and -innodb_log_file_size -configuration options are in place in the MySQL -configuration file -before running -\fBmysql_install_db\fR\&. .sp .5v .RE .PP @@ -168,11 +181,23 @@ group of an option file\&. (Options that are common to can also be specified in the [mysqld] group\&.) Other options are passed to -\fBmysqld\fR\&. For information about option files, see -Section\ \&4.2.3.3, \(lqUsing Option Files\(rq\&. -\fBmysql_install_db\fR -also supports the options for processing option files described at -Section\ \&4.2.3.4, \(lqCommand-Line Options that Affect Option-File Handling\(rq\&. +\fBmysqld\fR\&. For information about option files used by MySQL programs, see +Section\ \&4.2.6, \(lqUsing Option Files\(rq\&. +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +.\" mysql_install_db: help option +.\" help option: mysql_install_db +\fB\-\-help\fR +.sp +Display a help message and exit\&. +.RE .sp .RS 4 .ie n \{\ @@ -197,12 +222,41 @@ The path to the MySQL installation directory\&. .sp -1 .IP \(bu 2.3 .\} +.\" mysql_install_db: builddir option +.\" builddir option: mysql_install_db +\fB\-\-builddir=\fR\fB\fIpath\fR\fR +.sp +For use with +\fB\-\-srcdir\fR +and out\-of\-source builds\&. Set this to the location of the directory where the built files reside\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +.\" mysql_install_db: cross-bootstrap option +.\" cross-bootstrap option: mysql_install_db +\fB\-\-cross\-bootstrap\fR +.sp +For internal use\&. This option is used for building system tables on one host intended for another\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} .\" mysql_install_db: datadir option .\" datadir option: mysql_install_db -.\" mysql_install_db: ldata option -.\" ldata option: mysql_install_db -\fB\-\-datadir=\fR\fB\fIpath\fR\fR, -\fB\-\-ldata=\fR\fB\fIpath\fR\fR +\fB\-\-datadir=\fR\fB\fIpath\fR\fR .sp The path to the MySQL data directory\&. Beginning with MySQL 5\&.6\&.8, \fBmysql_install_db\fR @@ -217,13 +271,98 @@ is more strict about the option value\&. Only the last component of the path nam .sp -1 .IP \(bu 2.3 .\} +.\" defaults-extra-file option +\fB\-\-defaults\-extra\-file=\fR\fB\fIfile_name\fR\fR +.sp +Read this option file after the global option file but (on Unix) before the user option file\&. If the file does not exist or is otherwise inaccessible, an error occurs\&. +\fIfile_name\fR +is interpreted relative to the current directory if given as a relative path name rather than a full path name\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +.\" defaults-file option +\fB\-\-defaults\-file=\fR\fB\fIfile_name\fR\fR +.sp +Use only the given option file\&. If the file does not exist or is otherwise inaccessible, an error occurs\&. +\fIfile_name\fR +is interpreted relative to the current directory if given as a relative path name rather than a full path name\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} .\" mysql_install_db: force option .\" force option: mysql_install_db \fB\-\-force\fR .sp Cause \fBmysql_install_db\fR -to run even if DNS does not work\&. Grant table entries that normally use host names will use IP addresses\&. +to run even if DNS does not work\&. Grant table entries normally created using host names will use IP addresses instead\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +.\" mysql_install_db: keep-my-cnf option +.\" keep-my-cnf option: mysql_install_db +\fB\-\-keep\-my\-cnf\fR +.sp +Tell +\fBmysql_install_db\fR +preserve any existing +my\&.cnf +file and not create a new default +my\&.cnf +file\&. This option was added in MySQL 5\&.6\&.20\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +.\" mysql_install_db: ldata option +.\" ldata option: mysql_install_db +\fB\-\-ldata=\fR\fB\fIpath\fR\fR +.sp +A synonym for +\fB\-\-datadir\fR\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +.\" no-defaults option +\fB\-\-no\-defaults\fR +.sp +Do not read any option files\&. If program startup fails due to reading unknown options from an option file, +\fB\-\-no\-defaults\fR +can be used to prevent them from being read\&. .RE .sp .RS 4 @@ -252,9 +391,9 @@ causes it to perform the following actions in addition to its normal operation: .sp -1 .IP \(bu 2.3 .\} -Create a random password, assign it to the initial MySQL +The installation process creates a random password, assigns it to the initial MySQL root -accounts, and set the +accounts, and sets the \(lqpassword expired\(rq flag for those accounts\&. .RE @@ -267,7 +406,10 @@ flag for those accounts\&. .sp -1 .IP \(bu 2.3 .\} -Write the initial password file to the +.\" .mysql_secret file +The initial random +root +password is written to the \&.mysql_secret file in the directory named by the HOME @@ -295,14 +437,14 @@ is created with mode 600 to be accessible only to the system user for whom it is .sp -1 .IP \(bu 2.3 .\} -Remove the anonymous\-user MySQL accounts\&. +No anonymous\-user MySQL accounts are created\&. .RE .sp As a result of these actions, it is necessary after installation to start the server, connect as root using the password written to the \&.mysql_secret -file, and to assign a new +file, and specify a new root password\&. Until this is done, root @@ -403,9 +545,9 @@ looks for support files such as the error message file and the file for populati The system (login) user name to use for running \fBmysqld\fR\&. Files and directories created by \fBmysqld\fR -will be owned by this user\&. You must be +will be owned by this user\&. You must be the system root -to use this option\&. By default, +user to use this option\&. By default, \fBmysqld\fR runs using your current login name and files and directories that it creates will be owned by you\&. .RE @@ -442,7 +584,7 @@ For internal use\&. This option is used for creating Windows distributions\&. .SH "COPYRIGHT" .br .PP -Copyright \(co 1997, 2014, Oracle and/or its affiliates. All rights reserved. +Copyright \(co 1997, 2015, Oracle and/or its affiliates. All rights reserved. .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/mysql-wsrep-5.6/man/mysql_plugin.1 b/mysql-wsrep-5.6/man/mysql_plugin.1 index e8f5100c..b2339988 100644 --- a/mysql-wsrep-5.6/man/mysql_plugin.1 +++ b/mysql-wsrep-5.6/man/mysql_plugin.1 @@ -2,12 +2,12 @@ .\" Title: \fBmysql_plugin\fR .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 01/14/2014 +.\" Date: 01/16/2015 .\" Manual: MySQL Database System .\" Source: MySQL 5.6 .\" Language: English .\" -.TH "\FBMYSQL_PLUGIN\FR" "1" "01/14/2014" "MySQL 5\&.6" "MySQL Database System" +.TH "\FBMYSQL_PLUGIN\FR" "1" "01/16/2015" "MySQL 5\&.6" "MySQL Database System" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -163,8 +163,8 @@ recognizes the \fB\-\-basedir\fR, \fB\-\-datadir\fR, and \fB\-\-plugin\-dir\fR -options and ignores others\&. For information about option files, see -Section\ \&4.2.3.3, \(lqUsing Option Files\(rq\&. +options and ignores others\&. For information about option files used by MySQL programs, see +Section\ \&4.2.6, \(lqUsing Option Files\(rq\&. .sp .RS 4 .ie n \{\ @@ -370,7 +370,7 @@ Display version information and exit\&. .SH "COPYRIGHT" .br .PP -Copyright \(co 1997, 2014, Oracle and/or its affiliates. All rights reserved. +Copyright \(co 1997, 2015, Oracle and/or its affiliates. All rights reserved. .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/mysql-wsrep-5.6/man/mysql_secure_installation.1 b/mysql-wsrep-5.6/man/mysql_secure_installation.1 index 526156c1..9b3384bf 100644 --- a/mysql-wsrep-5.6/man/mysql_secure_installation.1 +++ b/mysql-wsrep-5.6/man/mysql_secure_installation.1 @@ -2,12 +2,12 @@ .\" Title: \fBmysql_secure_installation\fR .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 01/14/2014 +.\" Date: 01/16/2015 .\" Manual: MySQL Database System .\" Source: MySQL 5.6 .\" Language: English .\" -.TH "\FBMYSQL_SECURE_INST" "1" "01/14/2014" "MySQL 5\&.6" "MySQL Database System" +.TH "\FBMYSQL_SECURE_INST" "1" "01/16/2015" "MySQL 5\&.6" "MySQL Database System" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -110,7 +110,7 @@ When executed, the script prompts you to determine which actions to perform\&. .SH "COPYRIGHT" .br .PP -Copyright \(co 1997, 2014, Oracle and/or its affiliates. All rights reserved. +Copyright \(co 1997, 2015, Oracle and/or its affiliates. All rights reserved. .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/mysql-wsrep-5.6/man/mysql_setpermission.1 b/mysql-wsrep-5.6/man/mysql_setpermission.1 index 8c6cd6c3..822e10c3 100644 --- a/mysql-wsrep-5.6/man/mysql_setpermission.1 +++ b/mysql-wsrep-5.6/man/mysql_setpermission.1 @@ -2,12 +2,12 @@ .\" Title: \fBmysql_setpermission\fR .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 01/14/2014 +.\" Date: 01/16/2015 .\" Manual: MySQL Database System .\" Source: MySQL 5.6 .\" Language: English .\" -.TH "\FBMYSQL_SETPERMISSI" "1" "01/14/2014" "MySQL 5\&.6" "MySQL Database System" +.TH "\FBMYSQL_SETPERMISSI" "1" "01/16/2015" "MySQL 5\&.6" "MySQL Database System" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -34,6 +34,22 @@ mysql_setpermission \- interactively set permissions in grant tables .HP \w'\fBmysql_setpermission\ [\fR\fB\fIoptions\fR\fR\fB]\fR\ 'u \fBmysql_setpermission [\fR\fB\fIoptions\fR\fR\fB]\fR .SH "DESCRIPTION" +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBNote\fR +.ps -1 +.br +.PP +This utility is deprecated in MySQL 5\&.6\&.17 and removed in MySQL 5\&.7 +.sp .5v +.RE .PP \fBmysql_setpermission\fR is a Perl script that was originally written and contributed by Luuk de Boer\&. It interactively sets permissions in the MySQL grant tables\&. @@ -172,7 +188,7 @@ The MySQL user name to use when connecting to the server\&. .SH "COPYRIGHT" .br .PP -Copyright \(co 1997, 2014, Oracle and/or its affiliates. All rights reserved. +Copyright \(co 1997, 2015, Oracle and/or its affiliates. All rights reserved. .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/mysql-wsrep-5.6/man/mysql_tzinfo_to_sql.1 b/mysql-wsrep-5.6/man/mysql_tzinfo_to_sql.1 index 0d52d8dc..80d6b2dd 100644 --- a/mysql-wsrep-5.6/man/mysql_tzinfo_to_sql.1 +++ b/mysql-wsrep-5.6/man/mysql_tzinfo_to_sql.1 @@ -2,12 +2,12 @@ .\" Title: \fBmysql_tzinfo_to_sql\fR .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 01/14/2014 +.\" Date: 01/16/2015 .\" Manual: MySQL Database System .\" Source: MySQL 5.6 .\" Language: English .\" -.TH "\FBMYSQL_TZINFO_TO_S" "1" "01/14/2014" "MySQL 5\&.6" "MySQL Database System" +.TH "\FBMYSQL_TZINFO_TO_S" "1" "01/16/2015" "MySQL 5\&.6" "MySQL Database System" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -42,7 +42,7 @@ program loads the time zone tables in the mysql database\&. It is used on systems that have a zoneinfo -database (the set of files describing time zones)\&. Examples of such systems are Linux, FreeBSD, Solaris, and Mac OS X\&. One likely location for these files is the +database (the set of files describing time zones)\&. Examples of such systems are Linux, FreeBSD, Solaris, and OS X\&. One likely location for these files is the /usr/share/zoneinfo directory (/usr/share/lib/zoneinfo on Solaris)\&. If your system does not have a zoneinfo database, you can use the downloadable package described in @@ -122,7 +122,7 @@ After running .SH "COPYRIGHT" .br .PP -Copyright \(co 1997, 2014, Oracle and/or its affiliates. All rights reserved. +Copyright \(co 1997, 2015, Oracle and/or its affiliates. All rights reserved. .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/mysql-wsrep-5.6/man/mysql_upgrade.1 b/mysql-wsrep-5.6/man/mysql_upgrade.1 index de7fb92a..d0f89e75 100644 --- a/mysql-wsrep-5.6/man/mysql_upgrade.1 +++ b/mysql-wsrep-5.6/man/mysql_upgrade.1 @@ -2,12 +2,12 @@ .\" Title: \fBmysql_upgrade\fR .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 01/14/2014 +.\" Date: 01/16/2015 .\" Manual: MySQL Database System .\" Source: MySQL 5.6 .\" Language: English .\" -.TH "\FBMYSQL_UPGRADE\FR" "1" "01/14/2014" "MySQL 5\&.6" "MySQL Database System" +.TH "\FBMYSQL_UPGRADE\FR" "1" "01/16/2015" "MySQL 5\&.6" "MySQL Database System" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -42,14 +42,21 @@ examines all tables in all databases for incompatibilities with the current vers \fBmysql_upgrade\fR also upgrades the system tables so that you can take advantage of new privileges or capabilities that might have been added\&. .PP -\fBmysql_upgrade\fR -should be executed each time you upgrade MySQL\&. -.PP If \fBmysql_upgrade\fR finds that a table has a possible incompatibility, it performs a table check and, if problems are found, attempts a table repair\&. If the table cannot be repaired, see Section\ \&2.11.4, \(lqRebuilding or Repairing Tables or Indexes\(rq for manual table repair strategies\&. +.PP +You should execute +\fBmysql_upgrade\fR +each time you upgrade MySQL\&. +.PP +If you install MySQL from RPM packages on Linux, you must install the server and client RPMs\&. +\fBmysql_upgrade\fR +is included in the server RPM but requires the client RPM because the latter includes +\fBmysqlcheck\fR\&. (See +Section\ \&2.5.5, \(lqInstalling MySQL on Linux Using RPM Packages\(rq\&.) .if n \{\ .sp .\} @@ -93,7 +100,7 @@ Section\ \&2.11.1, \(lqUpgrading MySQL\(rq, for instructions on determining whet .RE .PP To use -\fBmysql_upgrade\fR, make sure that the server is running, and then invoke it like this: +\fBmysql_upgrade\fR, make sure that the server is running\&. Then invoke it like this: .sp .if n \{\ .RS 4 @@ -108,6 +115,26 @@ shell> \fBmysql_upgrade [\fR\fB\fIoptions\fR\fR\fB]\fR After running \fBmysql_upgrade\fR, stop the server and restart it so that any changes made to the system tables take effect\&. .PP +If you have multiple MySQL server instances running, invoke +\fBmysql_upgrade\fR +with connection parameters appropriate for connecting to the desired server\&. For example, with servers running on the local host on parts 3306 through 3308, upgrade each of them by connecting to the appropriate port: +.sp +.if n \{\ +.RS 4 +.\} +.nf +shell> \fBmysql_upgrade \-\-protocol=tcp \-P 3306 [\fR\fB\fIother_options\fR\fR\fB]\fR +shell> \fBmysql_upgrade \-\-protocol=tcp \-P 3307 [\fR\fB\fIother_options\fR\fR\fB]\fR +shell> \fBmysql_upgrade \-\-protocol=tcp \-P 3308 [\fR\fB\fIother_options\fR\fR\fB]\fR +.fi +.if n \{\ +.RE +.\} +.PP +For local host connections on Unix, the +\fB\-\-protocol=tcp\fR +option forces a connection using TCP/IP rather than the Unix socket file\&. +.PP \fBmysql_upgrade\fR executes the following commands to check and repair tables and to upgrade the system tables: .sp @@ -115,9 +142,15 @@ executes the following commands to check and repair tables and to upgrade the sy .RS 4 .\} .nf -mysqlcheck \-\-all\-databases \-\-check\-upgrade \-\-auto\-repair -mysql < \fIfix_priv_tables\fR -mysqlcheck \-\-all\-databases \-\-check\-upgrade \-\-fix\-db\-names \-\-fix\-table\-names +mysqlcheck \-\-no\-defaults \-\-databases + \-\-fix\-db\-names \-\-fix\-table\-names mysql +mysqlcheck \-\-no\-defaults \-\-check\-upgrade \-\-databases + \-\-auto\-repair mysql +mysql < fix_priv_tables +mysqlcheck \-\-no\-defaults \-\-all\-databases + \-\-skip\-database=mysql \-\-fix\-db\-names \-\-fix\-table\-names +mysqlcheck \-\-no\-defaults \-\-check\-upgrade \-\-all\-databases + \-\-skip\-database=mysql \-\-auto\-repair .fi .if n \{\ .RE @@ -133,6 +166,28 @@ Notes about the preceding commands: .sp -1 .IP \(bu 2.3 .\} +\fBmysql_upgrade\fR +also adds +\fB\-\-write\-binlog\fR +or +\fB\-\-skip\-write\-binlog\fR +to the +\fBmysqlcheck\fR +commands, depending on whether the +\fB\-\-write\-binlog\fR +option was specified on the +\fBmysql_upgrade\fR +command\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} Because \fBmysql_upgrade\fR invokes @@ -181,6 +236,7 @@ All checked and repaired tables are marked with the current MySQL version number with the same version of the server, it can tell whether there is any need to check or repair the table again\&. .\" mysql_upgrade_info file: mysql_upgrade .\" mysql_upgrade: mysql_upgrade_info file +.\" data directory: mysql_upgrade_info file .PP \fBmysql_upgrade\fR also saves the MySQL version number in a file named @@ -189,18 +245,13 @@ in the data directory\&. This is used to quickly check whether all tables have b \fB\-\-force\fR option\&. .PP -If you install MySQL from RPM packages on Linux, you must install the server and client RPMs\&. -\fBmysql_upgrade\fR -is included in the server RPM but requires the client RPM because the latter includes -\fBmysqlcheck\fR\&. (See -Section\ \&2.5.3, \(lqInstalling MySQL on Linux Using RPM Packages\(rq\&.) -.PP \fBmysql_upgrade\fR does not upgrade the contents of the help tables\&. For upgrade instructions, see Section\ \&5.1.10, \(lqServer-Side Help\(rq\&. .PP +By default, \fBmysql_upgrade\fR -runs by default as the MySQL +runs as the MySQL root user\&. If the root @@ -221,7 +272,7 @@ shell> \fBmysql \-u root \-p\fR Enter password: \fB****\fR <\- enter root password here mysql> \fBSET PASSWORD = PASSWORD(\*(Aqroot\-password\*(Aq);\fR mysql> \fBquit\fR -shell> \fBmysql_upgrade\fR +shell> \fBmysql_upgrade [\fR\fB\fIoptions\fR\fR\fB]\fR .fi .if n \{\ .RE @@ -232,13 +283,9 @@ supports the following options, which can be specified on the command line or in [mysql_upgrade] and [client] -groups of an option file\&. Other options are passed to -\fBmysqlcheck\fR\&. For example, it might be necessary to specify the -\fB\-\-password[=\fR\fB\fIpassword\fR\fR\fB]\fR -option\&. -\fBmysql_upgrade\fR -also supports the options for processing option files described at -Section\ \&4.2.3.4, \(lqCommand-Line Options that Affect Option-File Handling\(rq\&. +groups of an option file\&. Unrecognized options are passed to +\fBmysqlcheck\fR\&. For information about option files, see +Section\ \&4.2.6, \(lqUsing Option Files\(rq\&. .sp .RS 4 .ie n \{\ @@ -265,7 +312,7 @@ Display a short help message and exit\&. .\} .\" mysql_upgrade: basedir option .\" basedir option: mysql_upgrade -\fB\-\-basedir=\fR\fB\fIpath\fR\fR +\fB\-\-basedir=\fR\fB\fIdir_name\fR\fR .sp The path to the MySQL installation directory\&. This option is accepted for backward compatibility but ignored\&. It is removed in MySQL 5\&.7\&. .RE @@ -278,9 +325,40 @@ The path to the MySQL installation directory\&. This option is accepted for back .sp -1 .IP \(bu 2.3 .\} +.\" mysql_upgrade: character-sets-dir option +.\" character-sets-dir option: mysql_upgrade +\fB\-\-character\-sets\-dir=\fR\fB\fIpath\fR\fR +.sp +The directory where character sets are installed\&. See +Section\ \&10.5, \(lqCharacter Set Configuration\(rq\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +.\" mysql_upgrade: compress option +.\" compress option: mysql_upgrade +\fB\-\-compress\fR +.sp +Compress all information sent between the client and the server if both support compression\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} .\" mysql_upgrade: datadir option .\" datadir option: mysql_upgrade -\fB\-\-datadir=\fR\fB\fIpath\fR\fR +\fB\-\-datadir=\fR\fB\fIdir_name\fR\fR .sp The path to the data directory\&. This option is accepted for backward compatibility but ignored\&. It is removed in MySQL 5\&.7\&. .RE @@ -293,6 +371,26 @@ The path to the data directory\&. This option is accepted for backward compatibi .sp -1 .IP \(bu 2.3 .\} +.\" mysql_upgrade: debug option +.\" debug option: mysql_upgrade +\fB\-\-debug[=\fR\fB\fIdebug_options\fR\fR\fB]\fR, +\fB\-# [\fR\fB\fIdebug_options\fR\fR\fB]\fR +.sp +Write a debugging log\&. A typical +\fIdebug_options\fR +string is +d:t:o,\fIfile_name\fR\&. The default is +d:t:O,/tmp/mysql_upgrade\&.trace\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} .\" mysql_upgrade: debug-check option .\" debug-check option: mysql_upgrade \fB\-\-debug\-check\fR @@ -342,15 +440,95 @@ This option was added in MySQL 5\&.6\&.2\&. .sp -1 .IP \(bu 2.3 .\} +.\" mysql_upgrade: default-character-set option +.\" default-character-set option: mysql_upgrade +\fB\-\-default\-character\-set=\fR\fB\fIcharset_name\fR\fR +.sp +Use +\fIcharset_name\fR +as the default character set\&. See +Section\ \&10.5, \(lqCharacter Set Configuration\(rq\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +.\" mysql_upgrade: defaults-extra-file option +.\" defaults-extra-file option: mysql_upgrade +\fB\-\-defaults\-extra\-file=\fR\fB\fIfile_name\fR\fR +.sp +Read this option file after the global option file but (on Unix) before the user option file\&. If the file does not exist or is otherwise inaccessible, an error occurs\&. +\fIfile_name\fR +is interpreted relative to the current directory if given as a relative path name rather than a full path name\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +.\" mysql_upgrade: defaults-file option +.\" defaults-file option: mysql_upgrade +\fB\-\-defaults\-file=\fR\fB\fIfile_name\fR\fR +.sp +Use only the given option file\&. If the file does not exist or is otherwise inaccessible, an error occurs\&. +\fIfile_name\fR +is interpreted relative to the current directory if given as a relative path name rather than a full path name\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +.\" mysql_upgrade: defaults-group-suffix option +.\" defaults-group-suffix option: mysql_upgrade +\fB\-\-defaults\-group\-suffix=\fR\fB\fIstr\fR\fR +.sp +Read not only the usual option groups, but also groups with the usual names and a suffix of +\fIstr\fR\&. For example, +\fBmysql_upgrade\fR +normally reads the +[client] +and +[mysql_upgrade] +groups\&. If the +\fB\-\-defaults\-group\-suffix=_other\fR +option is given, +\fBmysql_upgrade\fR +also reads the +[client_other] +and +[mysql_upgrade_other] +groups\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} .\" mysql_upgrade: force option .\" force option: mysql_upgrade \fB\-\-force\fR .sp Ignore the mysql_upgrade_info -file and force execution of -\fBmysqlcheck\fR -even if +file and force execution even if \fBmysql_upgrade\fR has already been executed for the current version of MySQL\&. .RE @@ -363,6 +541,119 @@ has already been executed for the current version of MySQL\&. .sp -1 .IP \(bu 2.3 .\} +.\" mysql_upgrade: host option +.\" host option: mysql_upgrade +\fB\-\-host=\fR\fB\fIhost_name\fR\fR, +\fB\-h \fR\fB\fIhost_name\fR\fR +.sp +Connect to the MySQL server on the given host\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +.\" mysql_upgrade: login-path option +.\" login-path option: mysql_upgrade +\fB\-\-login\-path=\fR\fB\fIname\fR\fR +.sp +Read options from the named login path in the +\&.mylogin\&.cnf +login file\&. A +\(lqlogin path\(rq +is an option group that permits only a limited set of options: +\fBhost\fR, +\fBuser\fR, and +\fBpassword\fR\&. Think of a login path as a set of values that indicate the server host and the credentials for authenticating with the server\&. To create the login path file, use the +\fBmysql_config_editor\fR +utility\&. See +\fBmysql_config_editor\fR(1)\&. This option was added in MySQL 5\&.6\&.6\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +.\" mysql_upgrade: no-defaults option +.\" no-defaults option: mysql_upgrade +\fB\-\-no\-defaults\fR +.sp +Do not read any option files\&. If program startup fails due to reading unknown options from an option file, +\fB\-\-no\-defaults\fR +can be used to prevent them from being read\&. +.sp +The exception is that the +\&.mylogin\&.cnf +file, if it exists, is read in all cases\&. This permits passwords to be specified in a safer way than on the command line even when +\fB\-\-no\-defaults\fR +is used\&. (\&.mylogin\&.cnf +is created by the +\fBmysql_config_editor\fR +utility\&. See +\fBmysql_config_editor\fR(1)\&.) +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +.\" mysql_upgrade: password option +.\" password option: mysql_upgrade +\fB\-\-password[=\fR\fB\fIpassword\fR\fR\fB]\fR, +\fB\-p[\fR\fB\fIpassword\fR\fR\fB]\fR +.sp +The password to use when connecting to the server\&. If you use the short option form (\fB\-p\fR), you +\fIcannot\fR +have a space between the option and the password\&. If you omit the +\fIpassword\fR +value following the +\fB\-\-password\fR +or +\fB\-p\fR +option on the command line, +\fBmysql_upgrade\fR +prompts for one\&. +.sp +Specifying a password on the command line should be considered insecure\&. See +Section\ \&6.1.2.1, \(lqEnd-User Guidelines for Password Security\(rq\&. You can use an option file to avoid giving the password on the command line\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +.\" mysql_upgrade: pipe option +.\" pipe option: mysql_upgrade +\fB\-\-pipe\fR, +\fB\-W\fR +.sp +On Windows, connect to the server using a named pipe\&. This option applies only if the server supports named\-pipe connections\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} .\" mysql_upgrade: plugin-dir option .\" plugin-dir option: mysql_upgrade \fB\-\-plugin\-dir=\fR\fB\fIpath\fR\fR @@ -385,9 +676,111 @@ This option was added in MySQL 5\&.6\&.2\&. .sp -1 .IP \(bu 2.3 .\} +.\" mysql_upgrade: port option +.\" port option: mysql_upgrade +\fB\-\-port=\fR\fB\fIport_num\fR\fR, +\fB\-P \fR\fB\fIport_num\fR\fR +.sp +The TCP/IP port number to use for the connection\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +.\" mysql_upgrade: print-defaults option +.\" print-defaults option: mysql_upgrade +\fB\-\-print\-defaults\fR +.sp +Print the program name and all options that it gets from option files\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +.\" mysql_upgrade: protocol option +.\" protocol option: mysql_upgrade +\fB\-\-protocol={TCP|SOCKET|PIPE|MEMORY}\fR +.sp +The connection protocol to use for connecting to the server\&. It is useful when the other connection parameters normally would cause a protocol to be used other than the one you want\&. For details on the permissible values, see +Section\ \&4.2.2, \(lqConnecting to the MySQL Server\(rq\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +.\" mysql_upgrade: shared-memory-base-name option +.\" shared-memory-base-name option: mysql_upgrade +\fB\-\-shared\-memory\-base\-name=\fR\fB\fIname\fR\fR +.sp +On Windows, the shared\-memory name to use, for connections made using shared memory to a local server\&. The default value is +MYSQL\&. The shared\-memory name is case sensitive\&. +.sp +The server must be started with the +\fB\-\-shared\-memory\fR +option to enable shared\-memory connections\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +.\" mysql_upgrade: socket option +.\" socket option: mysql_upgrade +\fB\-\-socket=\fR\fB\fIpath\fR\fR, +\fB\-S \fR\fB\fIpath\fR\fR +.sp +For connections to +localhost, the Unix socket file to use, or, on Windows, the name of the named pipe to use\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +.\" mysql_upgrade: SSL options +.\" SSL options: mysql_upgrade +\fB\-\-ssl*\fR +.sp +Options that begin with +\fB\-\-ssl\fR +specify whether to connect to the server using SSL and indicate where to find SSL keys and certificates\&. See +Section\ \&6.3.10.4, \(lqSSL Command Options\(rq\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} .\" mysql_upgrade: tmpdir option .\" tmpdir option: mysql_upgrade -\fB\-\-tmpdir=\fR\fB\fIpath\fR\fR, +\fB\-\-tmpdir=\fR\fB\fIdir_name\fR\fR, \fB\-t \fR\fB\fIpath\fR\fR .sp The path name of the directory to use for creating temporary files\&. @@ -481,7 +874,7 @@ Cause binary logging to be enabled while runs\&. In MySQL 5\&.6\&.6 and earlier, this was the default behavior\&. (To disable binary logging during the upgrade, it was necessary to use the inverse of this option, by starting the program with \fB\-\-skip\-write\-binlog\fR\&.) Beginning with MySQL 5\&.6\&.7, binary logging by \fBmysql_upgrade\fR -is disabled by default (Bug #14221043), and you must invoke the program explicitly with +is disabled by default (Bug #14221043)\&. Invoke the program explicitly with \fB\-\-write\-binlog\fR if you want its actions to be written to the binary log\&. (Also beginning with MySQL 5\&.6\&.7, the \fB\-\-skip\-write\-binlog\fR @@ -494,12 +887,12 @@ is not recommended with a MySQL Server that is running with global transaction i might need to perform on system tables using a nontransactional storage engine such as MyISAM to fail\&. See -Section\ \&16.1.3.4, \(lqRestrictions on Replication with GTIDs\(rq, for more information\&. +Section\ \&17.1.3.4, \(lqRestrictions on Replication with GTIDs\(rq, for more information\&. .RE .SH "COPYRIGHT" .br .PP -Copyright \(co 1997, 2014, Oracle and/or its affiliates. All rights reserved. +Copyright \(co 1997, 2015, Oracle and/or its affiliates. All rights reserved. .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/mysql-wsrep-5.6/man/mysql_waitpid.1 b/mysql-wsrep-5.6/man/mysql_waitpid.1 index 53accda8..bb9be3af 100644 --- a/mysql-wsrep-5.6/man/mysql_waitpid.1 +++ b/mysql-wsrep-5.6/man/mysql_waitpid.1 @@ -2,12 +2,12 @@ .\" Title: \fBmysql_waitpid\fR .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 01/14/2014 +.\" Date: 01/16/2015 .\" Manual: MySQL Database System .\" Source: MySQL 5.6 .\" Language: English .\" -.TH "\FBMYSQL_WAITPID\FR" "1" "01/14/2014" "MySQL 5\&.6" "MySQL Database System" +.TH "\FBMYSQL_WAITPID\FR" "1" "01/16/2015" "MySQL 5\&.6" "MySQL Database System" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -40,6 +40,8 @@ signals a process to terminate and waits for the process to exit\&. It uses the kill() system call and Unix signals, so it runs on Unix and Unix\-like systems\&. .PP +This program is deprecated as of MySQL 5\&.6\&.19 and is removed in MySQL 5\&.7\&. +.PP Invoke \fBmysql_waitpid\fR like this: @@ -129,7 +131,7 @@ Display version information and exit\&. .SH "COPYRIGHT" .br .PP -Copyright \(co 1997, 2014, Oracle and/or its affiliates. All rights reserved. +Copyright \(co 1997, 2015, Oracle and/or its affiliates. All rights reserved. .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/mysql-wsrep-5.6/man/mysql_zap.1 b/mysql-wsrep-5.6/man/mysql_zap.1 index b518a647..9928a46f 100644 --- a/mysql-wsrep-5.6/man/mysql_zap.1 +++ b/mysql-wsrep-5.6/man/mysql_zap.1 @@ -2,12 +2,12 @@ .\" Title: \fBmysql_zap\fR .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 01/14/2014 +.\" Date: 01/16/2015 .\" Manual: MySQL Database System .\" Source: MySQL 5.6 .\" Language: English .\" -.TH "\FBMYSQL_ZAP\FR" "1" "01/14/2014" "MySQL 5\&.6" "MySQL Database System" +.TH "\FBMYSQL_ZAP\FR" "1" "01/16/2015" "MySQL 5\&.6" "MySQL Database System" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -40,6 +40,8 @@ kills processes that match a pattern\&. It uses the \fBps\fR command and Unix signals, so it runs on Unix and Unix\-like systems\&. .PP +This program is deprecated as of MySQL 5\&.6\&.19 and is removed in MySQL 5\&.7\&. +.PP Invoke \fBmysql_zap\fR like this: @@ -125,7 +127,7 @@ Test mode\&. Display information about each process but do not kill it\&. .SH "COPYRIGHT" .br .PP -Copyright \(co 1997, 2014, Oracle and/or its affiliates. All rights reserved. +Copyright \(co 1997, 2015, Oracle and/or its affiliates. All rights reserved. .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/mysql-wsrep-5.6/man/mysqlaccess.1 b/mysql-wsrep-5.6/man/mysqlaccess.1 index 615e5060..7cabeb6c 100644 --- a/mysql-wsrep-5.6/man/mysqlaccess.1 +++ b/mysql-wsrep-5.6/man/mysqlaccess.1 @@ -2,12 +2,12 @@ .\" Title: \fBmysqlaccess\fR .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 01/14/2014 +.\" Date: 01/16/2015 .\" Manual: MySQL Database System .\" Source: MySQL 5.6 .\" Language: English .\" -.TH "\FBMYSQLACCESS\FR" "1" "01/14/2014" "MySQL 5\&.6" "MySQL Database System" +.TH "\FBMYSQLACCESS\FR" "1" "01/16/2015" "MySQL 5\&.6" "MySQL Database System" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -34,6 +34,22 @@ mysqlaccess \- client for checking access privileges .HP \w'\fBmysqlaccess\ [\fR\fB\fIhost_name\fR\fR\fB\ [\fR\fB\fIuser_name\fR\fR\fB\ [\fR\fB\fIdb_name\fR\fR\fB]]]\ [\fR\fB\fIoptions\fR\fR\fB]\fR\ 'u \fBmysqlaccess [\fR\fB\fIhost_name\fR\fR\fB [\fR\fB\fIuser_name\fR\fR\fB [\fR\fB\fIdb_name\fR\fR\fB]]] [\fR\fB\fIoptions\fR\fR\fB]\fR .SH "DESCRIPTION" +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBNote\fR +.ps -1 +.br +.PP +This utility is deprecated in MySQL 5\&.6\&.17 and removed in MySQL 5\&.7 +.sp .5v +.RE .PP \fBmysqlaccess\fR is a diagnostic tool that Yves Carlier has provided for the MySQL distribution\&. It checks the access privileges for a host name, user name, and database combination\&. Note that @@ -432,7 +448,7 @@ error will occur when you run .SH "COPYRIGHT" .br .PP -Copyright \(co 1997, 2014, Oracle and/or its affiliates. All rights reserved. +Copyright \(co 1997, 2015, Oracle and/or its affiliates. All rights reserved. .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/mysql-wsrep-5.6/man/mysqladmin.1 b/mysql-wsrep-5.6/man/mysqladmin.1 index d8fd49d2..bc36a2dd 100644 --- a/mysql-wsrep-5.6/man/mysqladmin.1 +++ b/mysql-wsrep-5.6/man/mysqladmin.1 @@ -2,12 +2,12 @@ .\" Title: \fBmysqladmin\fR .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 01/14/2014 +.\" Date: 01/16/2015 .\" Manual: MySQL Database System .\" Source: MySQL 5.6 .\" Language: English .\" -.TH "\FBMYSQLADMIN\FR" "1" "01/14/2014" "MySQL 5\&.6" "MySQL Database System" +.TH "\FBMYSQLADMIN\FR" "1" "01/16/2015" "MySQL 5\&.6" "MySQL Database System" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -84,7 +84,7 @@ debug Tell the server to write debug information to the error log\&. Format and content of this information is subject to change\&. .sp This includes information about the Event Scheduler\&. See -Section\ \&19.4.5, \(lqEvent Scheduler Status\(rq\&. +Section\ \&20.4.5, \(lqEvent Scheduler Status\(rq\&. .RE .sp .RS 4 @@ -577,10 +577,8 @@ supports the following options, which can be specified on the command line or in [mysqladmin] and [client] -groups of an option file\&. -\fBmysqladmin\fR -also supports the options for processing option files described at -Section\ \&4.2.3.4, \(lqCommand-Line Options that Affect Option-File Handling\(rq\&. +groups of an option file\&. For information about option files used by MySQL programs, see +Section\ \&4.2.6, \(lqUsing Option Files\(rq\&. .sp .RS 4 .ie n \{\ @@ -610,7 +608,7 @@ Display a help message and exit\&. .\" bind-address option: mysqladmin \fB\-\-bind\-address=\fR\fB\fIip_address\fR\fR .sp -On a computer having multiple network interfaces, this option can be used to select which interface is employed when connecting to the MySQL server\&. +On a computer having multiple network interfaces, use this option to select which interface to use for connecting to the MySQL server\&. .sp This option is supported beginning with MySQL 5\&.6\&.1\&. .RE @@ -681,8 +679,8 @@ option is given\&. Write a debugging log\&. A typical \fIdebug_options\fR string is -\*(Aqd:t:o,\fIfile_name\fR\*(Aq\&. The default is -\*(Aqd:t:o,/tmp/mysqladmin\&.trace\*(Aq\&. +d:t:o,\fIfile_name\fR\&. The default is +d:t:o,/tmp/mysqladmin\&.trace\&. .RE .sp .RS 4 @@ -757,6 +755,70 @@ Section\ \&10.5, \(lqCharacter Set Configuration\(rq\&. .sp -1 .IP \(bu 2.3 .\} +.\" mysqladmin: defaults-extra-file option +.\" defaults-extra-file option: mysqladmin +\fB\-\-defaults\-extra\-file=\fR\fB\fIfile_name\fR\fR +.sp +Read this option file after the global option file but (on Unix) before the user option file\&. If the file does not exist or is otherwise inaccessible, an error occurs\&. +\fIfile_name\fR +is interpreted relative to the current directory if given as a relative path name rather than a full path name\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +.\" mysqladmin: defaults-file option +.\" defaults-file option: mysqladmin +\fB\-\-defaults\-file=\fR\fB\fIfile_name\fR\fR +.sp +Use only the given option file\&. If the file does not exist or is otherwise inaccessible, an error occurs\&. +\fIfile_name\fR +is interpreted relative to the current directory if given as a relative path name rather than a full path name\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +.\" mysqladmin: defaults-group-suffix option +.\" defaults-group-suffix option: mysqladmin +\fB\-\-defaults\-group\-suffix=\fR\fB\fIstr\fR\fR +.sp +Read not only the usual option groups, but also groups with the usual names and a suffix of +\fIstr\fR\&. For example, +\fBmysqladmin\fR +normally reads the +[client] +and +[mysqladmin] +groups\&. If the +\fB\-\-defaults\-group\-suffix=_other\fR +option is given, +\fBmysqladmin\fR +also reads the +[client_other] +and +[mysqladmin_other] +groups\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} .\" mysqladmin: enable-cleartext-plugin option .\" enable-cleartext-plugin option: mysqladmin \fB\-\-enable\-cleartext\-plugin\fR @@ -764,7 +826,7 @@ Section\ \&10.5, \(lqCharacter Set Configuration\(rq\&. Enable the mysql_clear_password cleartext authentication plugin\&. (See -Section\ \&6.3.7.7, \(lqThe Cleartext Client-Side Authentication Plugin\(rq\&.) This option was added in MySQL 5\&.6\&.7\&. +Section\ \&6.3.8.7, \(lqThe Cleartext Client-Side Authentication Plugin\(rq\&.) This option was added in MySQL 5\&.6\&.7\&. .RE .sp .RS 4 @@ -809,6 +871,31 @@ Connect to the MySQL server on the given host\&. .sp -1 .IP \(bu 2.3 .\} +.\" mysqladmin: login-path option +.\" login-path option: mysqladmin +\fB\-\-login\-path=\fR\fB\fIname\fR\fR +.sp +Read options from the named login path in the +\&.mylogin\&.cnf +login file\&. A +\(lqlogin path\(rq +is an option group that permits only a limited set of options: +\fBhost\fR, +\fBuser\fR, and +\fBpassword\fR\&. Think of a login path as a set of values that indicate the server host and the credentials for authenticating with the server\&. To create the login path file, use the +\fBmysql_config_editor\fR +utility\&. See +\fBmysql_config_editor\fR(1)\&. This option was added in MySQL 5\&.6\&.6\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} .\" mysqladmin: no-beep option .\" no-beep option: mysqladmin \fB\-\-no\-beep\fR, @@ -825,6 +912,33 @@ Suppress the warning beep that is emitted by default for errors such as a failur .sp -1 .IP \(bu 2.3 .\} +.\" mysqladmin: no-defaults option +.\" no-defaults option: mysqladmin +\fB\-\-no\-defaults\fR +.sp +Do not read any option files\&. If program startup fails due to reading unknown options from an option file, +\fB\-\-no\-defaults\fR +can be used to prevent them from being read\&. +.sp +The exception is that the +\&.mylogin\&.cnf +file, if it exists, is read in all cases\&. This permits passwords to be specified in a safer way than on the command line even when +\fB\-\-no\-defaults\fR +is used\&. (\&.mylogin\&.cnf +is created by the +\fBmysql_config_editor\fR +utility\&. See +\fBmysql_config_editor\fR(1)\&.) +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} .\" mysqladmin: password option .\" password option: mysqladmin \fB\-\-password[=\fR\fB\fIpassword\fR\fR\fB]\fR, @@ -906,6 +1020,21 @@ The TCP/IP port number to use for the connection\&. .sp -1 .IP \(bu 2.3 .\} +.\" mysqladmin: print-defaults option +.\" print-defaults option: mysqladmin +\fB\-\-print\-defaults\fR +.sp +Print the program name and all options that it gets from option files\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} .\" mysqladmin: protocol option .\" protocol option: mysqladmin \fB\-\-protocol={TCP|SOCKET|PIPE|MEMORY}\fR @@ -942,6 +1071,59 @@ command\&. .sp -1 .IP \(bu 2.3 .\} +.\" mysqladmin: secure-auth option +.\" secure-auth option: mysqladmin +\fB\-\-secure\-auth\fR +.sp +Do not send passwords to the server in old (pre\-4\&.1) format\&. This prevents connections except for servers that use the newer password format\&. This option is enabled by default; use +\fB\-\-skip\-secure\-auth\fR +to disable it\&. This option was added in MySQL 5\&.6\&.17\&. +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBNote\fR +.ps -1 +.br +Passwords that use the pre\-4\&.1 hashing method are less secure than passwords that use the native password hashing method and should be avoided\&. Pre\-4\&.1 passwords are deprecated and support for them will be removed in a future MySQL release\&. For account upgrade instructions, see +Section\ \&6.3.8.3, \(lqMigrating Away from Pre-4.1 Password Hashing and the mysql_old_password Plugin\(rq\&. +.sp .5v +.RE +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +.\" mysqladmin: shared-memory-base-name option +.\" shared-memory-base-name option: mysqladmin +\fB\-\-shared\-memory\-base\-name=\fR\fB\fIname\fR\fR +.sp +On Windows, the shared\-memory name to use, for connections made using shared memory to a local server\&. The default value is +MYSQL\&. The shared\-memory name is case sensitive\&. +.sp +The server must be started with the +\fB\-\-shared\-memory\fR +option to enable shared\-memory connections\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} .\" mysqladmin: silent option .\" silent option: mysqladmin \fB\-\-silent\fR, @@ -1006,7 +1188,7 @@ localhost, the Unix socket file to use, or, on Windows, the name of the named pi Options that begin with \fB\-\-ssl\fR specify whether to connect to the server using SSL and indicate where to find SSL keys and certificates\&. See -Section\ \&6.3.9.4, \(lqSSL Command Options\(rq\&. +Section\ \&6.3.10.4, \(lqSSL Command Options\(rq\&. .RE .sp .RS 4 @@ -1127,7 +1309,7 @@ The maximum number of seconds to wait for server shutdown\&. The default value i .SH "COPYRIGHT" .br .PP -Copyright \(co 1997, 2014, Oracle and/or its affiliates. All rights reserved. +Copyright \(co 1997, 2015, Oracle and/or its affiliates. All rights reserved. .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/mysql-wsrep-5.6/man/mysqlbinlog.1 b/mysql-wsrep-5.6/man/mysqlbinlog.1 index 1ac5968c..0eb82b81 100644 --- a/mysql-wsrep-5.6/man/mysqlbinlog.1 +++ b/mysql-wsrep-5.6/man/mysqlbinlog.1 @@ -2,12 +2,12 @@ .\" Title: \fBmysqlbinlog\fR .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 01/14/2014 +.\" Date: 01/16/2015 .\" Manual: MySQL Database System .\" Source: MySQL 5.6 .\" Language: English .\" -.TH "\FBMYSQLBINLOG\FR" "1" "01/14/2014" "MySQL 5\&.6" "MySQL Database System" +.TH "\FBMYSQLBINLOG\FR" "1" "01/16/2015" "MySQL 5\&.6" "MySQL Database System" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -43,7 +43,7 @@ utility\&. You can also use \fBmysqlbinlog\fR to display the contents of relay log files written by a slave server in a replication setup because relay logs have the same format as binary logs\&. The binary log and relay log are discussed further in Section\ \&5.2.4, \(lqThe Binary Log\(rq, and -Section\ \&16.2.2, \(lqReplication Relay and Status Logs\(rq\&. +Section\ \&17.2.2, \(lqReplication Relay and Status Logs\(rq\&. .PP Invoke \fBmysqlbinlog\fR @@ -74,7 +74,7 @@ shell> \fBmysqlbinlog binlog\&.0000003\fR .PP The output includes events contained in binlog\&.000003\&. For statement\-based logging, event information includes the SQL statement, the ID of the server on which it was executed, the timestamp when the statement was executed, how much time it took, and so forth\&. For row\-based logging, the event indicates a row change rather than an SQL statement\&. See -Section\ \&16.1.2, \(lqReplication Formats\(rq, for information about logging modes\&. +Section\ \&17.1.2, \(lqReplication Formats\(rq, for information about logging modes\&. .PP Events are preceded by header comments that provide additional information\&. For example: .sp @@ -92,7 +92,7 @@ Events are preceded by header comments that provide additional information\&. Fo .PP In the first line, the number following at -indicates the starting position of the event in the binary log file\&. +indicates the file offset, or starting position, of the event in the binary log file\&. .PP The second line starts with a date and time indicating when the statement started on the server where the event originated\&. For replication, this timestamp is propagated to slave servers\&. server id @@ -107,6 +107,22 @@ exec_time is the time spent executing the event, on a master server\&. On a slave, it is the difference of the end execution time on the slave minus the beginning execution time on the master\&. The difference serves as an indicator of how much replication lags behind the master\&. error_code indicates the result from executing the event\&. Zero means that no error occurred\&. +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBNote\fR +.ps -1 +.br +.PP +When using event groups, the file offsets of events may be grouped together and the comments of events may be grouped together\&. Do not mistake these grouped events for blank file offsets\&. +.sp .5v +.RE .PP The output from \fBmysqlbinlog\fR @@ -128,15 +144,21 @@ option\&. To read remote binary logs, the connection parameter options can be gi \fB\-\-read\-from\-remote\-server\fR option\&. .PP +When running +\fBmysqlbinlog\fR +against a large binary log, be careful that the filesystem has enough space for the resulting files\&. To configure the directory that +\fBmysqlbinlog\fR +uses for temporary files, use the +TMPDIR +environment variable\&. +.PP \fBmysqlbinlog\fR supports the following options, which can be specified on the command line or in the [mysqlbinlog] and [client] -groups of an option file\&. -\fBmysqlbinlog\fR -also supports the options for processing option files described at -Section\ \&4.2.3.4, \(lqCommand-Line Options that Affect Option-File Handling\(rq\&. +groups of an option file\&. For information about option files used by MySQL programs, see +Section\ \&4.2.6, \(lqUsing Option Files\(rq\&. .sp .RS 4 .ie n \{\ @@ -267,7 +289,7 @@ the section called \(lqMYSQLBINLOG ROW EVENT DISPLAY\(rq\&. .\" bind-address option: mysqlbinlog \fB\-\-bind\-address=\fR\fB\fIip_address\fR\fR .sp -On a computer having multiple network interfaces, this option can be used to select which interface is employed when connecting to the MySQL server\&. +On a computer having multiple network interfaces, use this option to select which interface to use for connecting to the MySQL server\&. .sp This option is supported beginning with MySQL 5\&.6\&.1\&. .RE @@ -286,9 +308,7 @@ This option is supported beginning with MySQL 5\&.6\&.1\&. .TS allbox tab(:); l l s s -l l s s -l l s s -^ l l s +l l l s ^ l l s ^ l l s ^ l l s. @@ -298,21 +318,8 @@ T}:T{ \-\-binlog\-row\-event\-max\-size=# T} T{ -\fBOption\-File Format\fR +\fBPermitted Values\fR (64\-bit platforms) T}:T{ -binlog\-row\-event\-max\-size -T} -T{ -\ \& -T}:T{ -\fBPermitted Values\fR -T} -:T{ -\fBPlatform Bit Size\fR -T}:T{ -64 -T} -:T{ \fBType\fR T}:T{ numeric @@ -323,9 +330,14 @@ T}:T{ 4294967040 T} :T{ -\fBRange\fR +\fBMin Value\fR +T}:T{ +256 +T} +:T{ +\fBMax Value\fR T}:T{ -256 \&.\&. 18446744073709547520 +18446744073709547520 T} .TE .sp 1 @@ -356,6 +368,31 @@ Section\ \&10.5, \(lqCharacter Set Configuration\(rq\&. .sp -1 .IP \(bu 2.3 .\} +.\" mysqlbinlog: connection-server-id option +.\" connection-server-id option: mysqlbinlog +\fB\-\-connection\-server\-id=\fR\fB\fIserver_id\fR\fR +.sp +This option is used to test a MySQL server for support of the +BINLOG_DUMP_NON_BLOCK +connection flag, which was inadvertently removed in MySQL 5\&.6\&.5, and restored in MySQL 5\&.6\&.20 (Bug #18000079, Bug #71178)\&. It is not required for normal operation\&. +.sp +The effective default and minimum values for this option depend on whether +\fBmysqlbinlog\fR +is run in blocking mode or non\-blocking mode\&. When +\fBmysqlbinlog\fR +is run in blocking mode, the default (and minimum) value is 1; when run in non\-blocking mode, the default (and minimum) value is 0\&. +.sp +This option was added in MySQL 5\&.6\&.20\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} .\" mysqlbinlog: database option .\" database option: mysqlbinlog \fB\-\-database=\fR\fB\fIdb_name\fR\fR, @@ -517,8 +554,8 @@ option did not work correctly with a log written by a GTID\-enabled MySQL server Write a debugging log\&. A typical \fIdebug_options\fR string is -\*(Aqd:t:o,\fIfile_name\fR\*(Aq\&. The default is -\*(Aqd:t:o,/tmp/mysqlbinlog\&.trace\*(Aq\&. +d:t:o,\fIfile_name\fR\&. The default is +d:t:o,/tmp/mysqlbinlog\&.trace\&. .RE .sp .RS 4 @@ -577,6 +614,70 @@ This option was added in MySQL 5\&.6\&.2\&. .sp -1 .IP \(bu 2.3 .\} +.\" mysqlbinlog: defaults-extra-file option +.\" defaults-extra-file option: mysqlbinlog +\fB\-\-defaults\-extra\-file=\fR\fB\fIfile_name\fR\fR +.sp +Read this option file after the global option file but (on Unix) before the user option file\&. If the file does not exist or is otherwise inaccessible, an error occurs\&. +\fIfile_name\fR +is interpreted relative to the current directory if given as a relative path name rather than a full path name\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +.\" mysqlbinlog: defaults-file option +.\" defaults-file option: mysqlbinlog +\fB\-\-defaults\-file=\fR\fB\fIfile_name\fR\fR +.sp +Use only the given option file\&. If the file does not exist or is otherwise inaccessible, an error occurs\&. +\fIfile_name\fR +is interpreted relative to the current directory if given as a relative path name rather than a full path name\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +.\" mysqlbinlog: defaults-group-suffix option +.\" defaults-group-suffix option: mysqlbinlog +\fB\-\-defaults\-group\-suffix=\fR\fB\fIstr\fR\fR +.sp +Read not only the usual option groups, but also groups with the usual names and a suffix of +\fIstr\fR\&. For example, +\fBmysqlbinlog\fR +normally reads the +[client] +and +[mysqlbinlog] +groups\&. If the +\fB\-\-defaults\-group\-suffix=_other\fR +option is given, +\fBmysqlbinlog\fR +also reads the +[client_other] +and +[mysqlbinlog_other] +groups\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} .\" mysqlbinlog: disable-log-bin option .\" disable-log-bin option: mysqlbinlog \fB\-\-disable\-log\-bin\fR, @@ -743,6 +844,58 @@ or any other MySQL program\&. .sp -1 .IP \(bu 2.3 .\} +.\" mysqlbinlog: login-path option +.\" login-path option: mysqlbinlog +\fB\-\-login\-path=\fR\fB\fIname\fR\fR +.sp +Read options from the named login path in the +\&.mylogin\&.cnf +login file\&. A +\(lqlogin path\(rq +is an option group that permits only a limited set of options: +\fBhost\fR, +\fBuser\fR, and +\fBpassword\fR\&. Think of a login path as a set of values that indicate the server host and the credentials for authenticating with the server\&. To create the login path file, use the +\fBmysql_config_editor\fR +utility\&. See +\fBmysql_config_editor\fR(1)\&. This option was added in MySQL 5\&.6\&.6\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +.\" mysqlbinlog: no-defaults option +.\" no-defaults option: mysqlbinlog +\fB\-\-no\-defaults\fR +.sp +Do not read any option files\&. If program startup fails due to reading unknown options from an option file, +\fB\-\-no\-defaults\fR +can be used to prevent them from being read\&. +.sp +The exception is that the +\&.mylogin\&.cnf +file, if it exists, is read in all cases\&. This permits passwords to be specified in a safer way than on the command line even when +\fB\-\-no\-defaults\fR +is used\&. (\&.mylogin\&.cnf +is created by the +\fBmysql_config_editor\fR +utility\&. See +\fBmysql_config_editor\fR(1)\&.) +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} .\" mysqlbinlog: offset option .\" offset option: mysqlbinlog \fB\-\-offset=\fR\fB\fIN\fR\fR, @@ -830,6 +983,21 @@ The TCP/IP port number to use for connecting to a remote server\&. .sp -1 .IP \(bu 2.3 .\} +.\" mysqlbinlog: print-defaults option +.\" print-defaults option: mysqlbinlog +\fB\-\-print\-defaults\fR +.sp +Print the program name and all options that it gets from option files\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} .\" mysqlbinlog: protocol option .\" protocol option: mysqlbinlog \fB\-\-protocol={TCP|SOCKET|PIPE|MEMORY}\fR @@ -966,6 +1134,39 @@ option value is treated as a prefix that modifies output file names\&. .sp -1 .IP \(bu 2.3 .\} +.\" mysqlbinlog: secure-auth option +.\" secure-auth option: mysqlbinlog +\fB\-\-secure\-auth\fR +.sp +Do not send passwords to the server in old (pre\-4\&.1) format\&. This prevents connections except for servers that use the newer password format\&. This option is enabled by default; use +\fB\-\-skip\-secure\-auth\fR +to disable it\&. This option was added in MySQL 5\&.6\&.17\&. +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBNote\fR +.ps -1 +.br +Passwords that use the pre\-4\&.1 hashing method are less secure than passwords that use the native password hashing method and should be avoided\&. Pre\-4\&.1 passwords are deprecated and support for them will be removed in a future MySQL release\&. For account upgrade instructions, see +Section\ \&6.3.8.3, \(lqMigrating Away from Pre-4.1 Password Hashing and the mysql_old_password Plugin\(rq\&. +.sp .5v +.RE +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} .\" mysqlbinlog: server-id option .\" server-id option: mysqlbinlog \fB\-\-server\-id=\fR\fB\fIid\fR\fR @@ -1027,6 +1228,26 @@ statement to the output to specify the character set to be used for processing l .sp -1 .IP \(bu 2.3 .\} +.\" mysqlbinlog: shared-memory-base-name option +.\" shared-memory-base-name option: mysqlbinlog +\fB\-\-shared\-memory\-base\-name=\fR\fB\fIname\fR\fR +.sp +On Windows, the shared\-memory name to use, for connections made using shared memory to a local server\&. The default value is +MYSQL\&. The shared\-memory name is case sensitive\&. +.sp +The server must be started with the +\fB\-\-shared\-memory\fR +option to enable shared\-memory connections\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} .\" mysqlbinlog: short-form option .\" short-form option: mysqlbinlog \fB\-\-short\-form\fR, @@ -1047,7 +1268,23 @@ Display only the statements contained in the log, without any extra information .\" skip-gtids option: mysqlbinlog \fB\-\-skip\-gtids[=(true|false)]\fR .sp -Do not display any GTIDs\&. Not recommended in production\&. Added in MySQL 5\&.6\&.5\&. +Do not display any GTIDs in the output\&. This is needed when writing to a dump file from one or more binary logs containing GTIDs, as shown in this example: +.sp +.if n \{\ +.RS 4 +.\} +.nf +shell> \fBmysqlbinlog \-\-skip\-gtids binlog\&.000001 > /tmp/dump\&.sql\fR +shell> \fBmysqlbinlog \-\-skip\-gtids binlog\&.000002 >> /tmp/dump\&.sql\fR +shell> \fBmysql \-u root \-p \-e "source /tmp/dump\&.sql"\fR +.fi +.if n \{\ +.RE +.\} +.sp +The use of this option is otherwise not normally recommended in production\&. +.sp +This option was added in MySQL 5\&.6\&.5\&. .RE .sp .RS 4 @@ -2262,7 +2499,7 @@ for variable\-length strings\&. .sp -1 .IP \(bu 2.3 .\} -For multi\-byte character sets, the maximum number of bytes per character is not present in the binary log, so the length for string types is displayed in bytes rather than in characters\&. For example, +For multibyte character sets, the maximum number of bytes per character is not present in the binary log, so the length for string types is displayed in bytes rather than in characters\&. For example, STRING(4) will be used as the data type for values from either of these column types: .sp @@ -2514,8 +2751,7 @@ With \fB\-\-to\-last\-log\fR to read to the last log file because that option is implied\&. .RE - Output File Naming -.PP +Output File Naming.PP Without \fB\-\-raw\fR, \fBmysqlbinlog\fR @@ -2573,8 +2809,7 @@ T}:T{ T} .TE .sp 1 - Example: \fBmysqldump\fR + \fBmysqlbinlog\fR for Backup and Restore -.PP +Example: mysqldump + mysqlbinlog for Backup and Restore.PP The following example describes a simple scenario that shows how to use \fBmysqldump\fR and @@ -2747,7 +2982,7 @@ specifies a nonzero server ID\&. .SH "COPYRIGHT" .br .PP -Copyright \(co 1997, 2014, Oracle and/or its affiliates. All rights reserved. +Copyright \(co 1997, 2015, Oracle and/or its affiliates. All rights reserved. .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/mysql-wsrep-5.6/man/mysqlbug.1 b/mysql-wsrep-5.6/man/mysqlbug.1 index 9fc3f3af..c9504160 100644 --- a/mysql-wsrep-5.6/man/mysqlbug.1 +++ b/mysql-wsrep-5.6/man/mysqlbug.1 @@ -2,12 +2,12 @@ .\" Title: \fBmysqlbug\fR .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 01/14/2014 +.\" Date: 01/16/2015 .\" Manual: MySQL Database System .\" Source: MySQL 5.6 .\" Language: English .\" -.TH "\FBMYSQLBUG\FR" "1" "01/14/2014" "MySQL 5\&.6" "MySQL Database System" +.TH "\FBMYSQLBUG\FR" "1" "01/16/2015" "MySQL 5\&.6" "MySQL Database System" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -35,14 +35,14 @@ mysqlbug \- generate bug report \fBmysqlbug\fR .SH "DESCRIPTION" .PP -This program is obsolete\&. +This program is obsolete\&. It is deprecated as of MySQL 5\&.6\&.19 and is removed in MySQL 5\&.7\&. .PP The normal way to report bugs is to visit \m[blue]\fB\%http://bugs.mysql.com/\fR\m[], which is the address for our bugs database\&. This database is public and can be browsed and searched by anyone\&. If you log in to the system, you can enter new reports\&. .SH "COPYRIGHT" .br .PP -Copyright \(co 1997, 2014, Oracle and/or its affiliates. All rights reserved. +Copyright \(co 1997, 2015, Oracle and/or its affiliates. All rights reserved. .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/mysql-wsrep-5.6/man/mysqlcheck.1 b/mysql-wsrep-5.6/man/mysqlcheck.1 index 6f6ba9cb..70585a8b 100644 --- a/mysql-wsrep-5.6/man/mysqlcheck.1 +++ b/mysql-wsrep-5.6/man/mysqlcheck.1 @@ -2,12 +2,12 @@ .\" Title: \fBmysqlcheck\fR .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 01/14/2014 +.\" Date: 01/16/2015 .\" Manual: MySQL Database System .\" Source: MySQL 5.6 .\" Language: English .\" -.TH "\FBMYSQLCHECK\FR" "1" "01/14/2014" "MySQL 5\&.6" "MySQL Database System" +.TH "\FBMYSQLCHECK\FR" "1" "01/16/2015" "MySQL 5\&.6" "MySQL Database System" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -204,10 +204,8 @@ supports the following options, which can be specified on the command line or in [mysqlcheck] and [client] -groups of an option file\&. -\fBmysqlcheck\fR -also supports the options for processing option files described at -Section\ \&4.2.3.4, \(lqCommand-Line Options that Affect Option-File Handling\(rq\&. +groups of an option file\&. For information about option files used by MySQL programs, see +Section\ \&4.2.6, \(lqUsing Option Files\(rq\&. .sp .RS 4 .ie n \{\ @@ -240,7 +238,13 @@ Display a help message and exit\&. .sp Check all tables in all databases\&. This is the same as using the \fB\-\-databases\fR -option and naming all the databases on the command line\&. +option and naming all the databases on the command line, except that the +INFORMATION_SCHEMA +and +performace_schema +databases are not dumped\&. They can be dumped by explicitly naming them with the +\fB\-\-databases\fR +option\&. .RE .sp .RS 4 @@ -302,7 +306,7 @@ If a checked table is corrupted, automatically fix it\&. Any necessary repairs a .\" bind-address option: mysqlcheck \fB\-\-bind\-address=\fR\fB\fIip_address\fR\fR .sp -On a computer having multiple network interfaces, this option can be used to select which interface is employed when connecting to the MySQL server\&. +On a computer having multiple network interfaces, use this option to select which interface to use for connecting to the MySQL server\&. .sp This option is supported beginning with MySQL 5\&.6\&.1\&. .RE @@ -410,6 +414,16 @@ Compress all information sent between the client and the server if both support Process all tables in the named databases\&. Normally, \fBmysqlcheck\fR treats the first name argument on the command line as a database name and following names as table names\&. With this option, it treats all name arguments as database names\&. +.sp +This option may be used to dump the +INFORMATION_SCHEMA +and +performace_schema +databases, which normally are not dumped even with the +\fB\-\-all\-databases\fR +option\&. (Also use the +\fB\-\-skip\-lock\-tables\fR +option\&.) .RE .sp .RS 4 @@ -428,8 +442,8 @@ treats the first name argument on the command line as a database name and follow Write a debugging log\&. A typical \fIdebug_options\fR string is -\*(Aqd:t:o,\fIfile_name\fR\*(Aq\&. The default is -\*(Aqd:t:o\*(Aq\&. +d:t:o,\fIfile_name\fR\&. The default is +d:t:o\&. .RE .sp .RS 4 @@ -488,6 +502,70 @@ Section\ \&10.5, \(lqCharacter Set Configuration\(rq\&. .sp -1 .IP \(bu 2.3 .\} +.\" mysqlcheck: defaults-extra-file option +.\" defaults-extra-file option: mysqlcheck +\fB\-\-defaults\-extra\-file=\fR\fB\fIfile_name\fR\fR +.sp +Read this option file after the global option file but (on Unix) before the user option file\&. If the file does not exist or is otherwise inaccessible, an error occurs\&. +\fIfile_name\fR +is interpreted relative to the current directory if given as a relative path name rather than a full path name\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +.\" mysqlcheck: defaults-file option +.\" defaults-file option: mysqlcheck +\fB\-\-defaults\-file=\fR\fB\fIfile_name\fR\fR +.sp +Use only the given option file\&. If the file does not exist or is otherwise inaccessible, an error occurs\&. +\fIfile_name\fR +is interpreted relative to the current directory if given as a relative path name rather than a full path name\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +.\" mysqlcheck: defaults-group-suffix option +.\" defaults-group-suffix option: mysqlcheck +\fB\-\-defaults\-group\-suffix=\fR\fB\fIstr\fR\fR +.sp +Read not only the usual option groups, but also groups with the usual names and a suffix of +\fIstr\fR\&. For example, +\fBmysqlcheck\fR +normally reads the +[client] +and +[mysqlcheck] +groups\&. If the +\fB\-\-defaults\-group\-suffix=_other\fR +option is given, +\fBmysqlcheck\fR +also reads the +[client_other] +and +[mysqlcheck_other] +groups\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} .\" mysqlcheck: extended option .\" extended option: mysqlcheck \fB\-\-extended\fR, @@ -602,6 +680,31 @@ Connect to the MySQL server on the given host\&. .sp -1 .IP \(bu 2.3 .\} +.\" mysqlcheck: login-path option +.\" login-path option: mysqlcheck +\fB\-\-login\-path=\fR\fB\fIname\fR\fR +.sp +Read options from the named login path in the +\&.mylogin\&.cnf +login file\&. A +\(lqlogin path\(rq +is an option group that permits only a limited set of options: +\fBhost\fR, +\fBuser\fR, and +\fBpassword\fR\&. Think of a login path as a set of values that indicate the server host and the credentials for authenticating with the server\&. To create the login path file, use the +\fBmysql_config_editor\fR +utility\&. See +\fBmysql_config_editor\fR(1)\&. This option was added in MySQL 5\&.6\&.6\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} .\" mysqlcheck: medium-check option .\" medium-check option: mysqlcheck \fB\-\-medium\-check\fR, @@ -620,6 +723,33 @@ operation\&. This finds only 99\&.99% of all errors, which should be good enough .sp -1 .IP \(bu 2.3 .\} +.\" mysqlcheck: no-defaults option +.\" no-defaults option: mysqlcheck +\fB\-\-no\-defaults\fR +.sp +Do not read any option files\&. If program startup fails due to reading unknown options from an option file, +\fB\-\-no\-defaults\fR +can be used to prevent them from being read\&. +.sp +The exception is that the +\&.mylogin\&.cnf +file, if it exists, is read in all cases\&. This permits passwords to be specified in a safer way than on the command line even when +\fB\-\-no\-defaults\fR +is used\&. (\&.mylogin\&.cnf +is created by the +\fBmysql_config_editor\fR +utility\&. See +\fBmysql_config_editor\fR(1)\&.) +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} .\" mysqlcheck: optimize option .\" optimize option: mysqlcheck \fB\-\-optimize\fR, @@ -719,6 +849,21 @@ The TCP/IP port number to use for the connection\&. .sp -1 .IP \(bu 2.3 .\} +.\" mysqlcheck: print-defaults option +.\" print-defaults option: mysqlcheck +\fB\-\-print\-defaults\fR +.sp +Print the program name and all options that it gets from option files\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} .\" mysqlcheck: protocol option .\" protocol option: mysqlcheck \fB\-\-protocol={TCP|SOCKET|PIPE|MEMORY}\fR @@ -769,6 +914,59 @@ Perform a repair that can fix almost anything except unique keys that are not un .sp -1 .IP \(bu 2.3 .\} +.\" mysqlcheck: secure-auth option +.\" secure-auth option: mysqlcheck +\fB\-\-secure\-auth\fR +.sp +Do not send passwords to the server in old (pre\-4\&.1) format\&. This prevents connections except for servers that use the newer password format\&. This option is enabled by default; use +\fB\-\-skip\-secure\-auth\fR +to disable it\&. This option was added in MySQL 5\&.6\&.17\&. +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBNote\fR +.ps -1 +.br +Passwords that use the pre\-4\&.1 hashing method are less secure than passwords that use the native password hashing method and should be avoided\&. Pre\-4\&.1 passwords are deprecated and support for them will be removed in a future MySQL release\&. For account upgrade instructions, see +Section\ \&6.3.8.3, \(lqMigrating Away from Pre-4.1 Password Hashing and the mysql_old_password Plugin\(rq\&. +.sp .5v +.RE +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +.\" mysqlcheck: shared-memory-base-name option +.\" shared-memory-base-name option: mysqlcheck +\fB\-\-shared\-memory\-base\-name=\fR\fB\fIname\fR\fR +.sp +On Windows, the shared\-memory name to use, for connections made using shared memory to a local server\&. The default value is +MYSQL\&. The shared\-memory name is case sensitive\&. +.sp +The server must be started with the +\fB\-\-shared\-memory\fR +option to enable shared\-memory connections\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} .\" mysqlcheck: silent option .\" silent option: mysqlcheck \fB\-\-silent\fR, @@ -825,7 +1023,7 @@ localhost, the Unix socket file to use, or, on Windows, the name of the named pi Options that begin with \fB\-\-ssl\fR specify whether to connect to the server using SSL and indicate where to find SSL keys and certificates\&. See -Section\ \&6.3.9.4, \(lqSSL Command Options\(rq\&. +Section\ \&6.3.10.4, \(lqSSL Command Options\(rq\&. .RE .sp .RS 4 @@ -945,7 +1143,7 @@ when these statements should not be sent to replication slaves or run when using .SH "COPYRIGHT" .br .PP -Copyright \(co 1997, 2014, Oracle and/or its affiliates. All rights reserved. +Copyright \(co 1997, 2015, Oracle and/or its affiliates. All rights reserved. .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/mysql-wsrep-5.6/man/mysqld.8 b/mysql-wsrep-5.6/man/mysqld.8 index 482e593c..4913cd1d 100644 --- a/mysql-wsrep-5.6/man/mysqld.8 +++ b/mysql-wsrep-5.6/man/mysqld.8 @@ -2,12 +2,12 @@ .\" Title: \fBmysqld\fR .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 01/14/2014 +.\" Date: 01/16/2015 .\" Manual: MySQL Database System .\" Source: MySQL 5.6 .\" Language: English .\" -.TH "\FBMYSQLD\FR" "8" "01/14/2014" "MySQL 5\&.6" "MySQL Database System" +.TH "\FBMYSQLD\FR" "8" "01/16/2015" "MySQL 5\&.6" "MySQL Database System" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -62,7 +62,7 @@ Chapter\ \&2, Installing and Upgrading MySQL\&. .SH "COPYRIGHT" .br .PP -Copyright \(co 1997, 2014, Oracle and/or its affiliates. All rights reserved. +Copyright \(co 1997, 2015, Oracle and/or its affiliates. All rights reserved. .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/mysql-wsrep-5.6/man/mysqld_multi.1 b/mysql-wsrep-5.6/man/mysqld_multi.1 index 20e0835f..ce737a58 100644 --- a/mysql-wsrep-5.6/man/mysqld_multi.1 +++ b/mysql-wsrep-5.6/man/mysqld_multi.1 @@ -2,12 +2,12 @@ .\" Title: \fBmysqld_multi\fR .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 01/14/2014 +.\" Date: 01/16/2015 .\" Manual: MySQL Database System .\" Source: MySQL 5.6 .\" Language: English .\" -.TH "\FBMYSQLD_MULTI\FR" "1" "01/14/2014" "MySQL 5\&.6" "MySQL Database System" +.TH "\FBMYSQLD_MULTI\FR" "1" "01/16/2015" "MySQL 5\&.6" "MySQL Database System" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -301,9 +301,9 @@ binary to be used to stop servers\&. .sp The \fBmysqld\fR -binary to be used\&. Note that you can specify +binary to be used\&. You can specify \fBmysqld_safe\fR -as the value for this option also\&. If you use +as the value for this option\&. If you use \fBmysqld_safe\fR to start the server, you can include the mysqld @@ -359,7 +359,7 @@ rather than to the log file\&. By default, output goes to the log file\&. \fB\-\-password=\fR\fB\fIpassword\fR\fR .sp The password of the MySQL account to use when invoking -\fBmysqladmin\fR\&. Note that the password value is not optional for this option, unlike for other MySQL programs\&. +\fBmysqladmin\fR\&. The password value is not optional for this option, unlike for other MySQL programs\&. .RE .sp .RS 4 @@ -539,7 +539,7 @@ mysql> \fBGRANT SHUTDOWN ON *\&.*\fR See Section\ \&6.2, \(lqThe MySQL Access Privilege System\(rq\&. You have to do this for each \fBmysqld\fR -server\&. Change the connection parameters appropriately when connecting to each one\&. Note that the host name part of the account name must permit you to connect as +server\&. Change the connection parameters appropriately when connecting to each one\&. The host name part of the account name must permit you to connect as multi_admin from the host where you want to run \fBmysqld_multi\fR\&. @@ -586,7 +586,7 @@ monitors its \fBmysqld\fR process and restarts it if the process terminates due to a signal sent using kill \-9 -or for other reasons, such as a segmentation fault\&. Please note that the +or for other reasons, such as a segmentation fault\&. The \fBmysqld_safe\fR script might require that you start it from a certain place\&. This means that you might have to change location to a certain directory before running \fBmysqld_multi\fR\&. If you have problems starting, please see the @@ -686,11 +686,11 @@ user = jani .\} .PP See -Section\ \&4.2.3.3, \(lqUsing Option Files\(rq\&. +Section\ \&4.2.6, \(lqUsing Option Files\(rq\&. .SH "COPYRIGHT" .br .PP -Copyright \(co 1997, 2014, Oracle and/or its affiliates. All rights reserved. +Copyright \(co 1997, 2015, Oracle and/or its affiliates. All rights reserved. .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/mysql-wsrep-5.6/man/mysqld_safe.1 b/mysql-wsrep-5.6/man/mysqld_safe.1 index 33c061a4..b0863bc3 100644 --- a/mysql-wsrep-5.6/man/mysqld_safe.1 +++ b/mysql-wsrep-5.6/man/mysqld_safe.1 @@ -2,12 +2,12 @@ .\" Title: \fBmysqld_safe\fR .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 01/14/2014 +.\" Date: 01/16/2015 .\" Manual: MySQL Database System .\" Source: MySQL 5.6 .\" Language: English .\" -.TH "\FBMYSQLD_SAFE\FR" "1" "01/14/2014" "MySQL 5\&.6" "MySQL Database System" +.TH "\FBMYSQLD_SAFE\FR" "1" "01/16/2015" "MySQL 5\&.6" "MySQL Database System" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -70,7 +70,7 @@ are passed to if they are specified on the command line, but ignored if they are specified in the [mysqld_safe] group of an option file\&. See -Section\ \&4.2.3.3, \(lqUsing Option Files\(rq\&. +Section\ \&4.2.6, \(lqUsing Option Files\(rq\&. .PP \fBmysqld_safe\fR reads all options from the @@ -100,13 +100,15 @@ For backward compatibility, \fBmysqld_safe\fR also reads [safe_mysqld] -sections, although you should rename such sections to +sections, although it is preferable to rename +[safe_mysqld] +sections to [mysqld_safe] -in MySQL 5\&.6 installations\&. +sections\&. .PP \fBmysqld_safe\fR supports the following options\&. It also reads option files and supports the options for processing them described at -Section\ \&4.2.3.4, \(lqCommand-Line Options that Affect Option-File Handling\(rq\&. +Section\ \&4.2.7, \(lqCommand-Line Options that Affect Option-File Handling\(rq\&. .sp .RS 4 .ie n \{\ @@ -472,11 +474,26 @@ Do not read any option files\&. This must be the first option on the command lin The number of files that \fBmysqld\fR should be able to open\&. The option value is passed to -\fBulimit \-n\fR\&. Note that you need to start +\fBulimit \-n\fR\&. +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBNote\fR +.ps -1 +.br +You must start \fBmysqld_safe\fR as root -for this to work properly! +for this to function properly\&. +.sp .5v +.RE .RE .sp .RS 4 @@ -588,7 +605,7 @@ When syslog is used, the daemon\&.err -syslog priority/facility is used for all log messages\&. +syslog facility/severity is used for all log messages\&. .RE .sp .RS 4 @@ -608,11 +625,11 @@ syslog, messages from \fBmysqld_safe\fR and \fBmysqld\fR -are written with a tag of +are written with identifiers of mysqld_safe and -mysqld, respectively\&. To specify a suffix for the tag, use -\fB\-\-syslog\-tag=\fR\fB\fItag\fR\fR, which modifies the tags to be +mysqld, respectively\&. To specify a suffix for the identifiers, use +\fB\-\-syslog\-tag=\fR\fB\fItag\fR\fR, which modifies the identifiers to be mysqld_safe\-\fItag\fR and mysqld\-\fItag\fR\&. @@ -755,7 +772,7 @@ shell> \fBbin/mysqld_safe &\fR .PP If \fBmysqld_safe\fR -fails, even when invoked from the MySQL installation directory, you can specify the +fails, even when invoked from the MySQL installation directory, specify the \fB\-\-ledir\fR and \fB\-\-datadir\fR @@ -790,11 +807,7 @@ options for controlling the destination of these messages: .sp -1 .IP \(bu 2.3 .\} -\fB\-\-syslog\fR: Write error messages to -syslog -on systems that support the -\fBlogger\fR -program\&. +\fB\-\-log\-error=\fR\fB\fIfile_name\fR\fR: Write error messages to the named error file\&. .RE .sp .RS 4 @@ -805,11 +818,11 @@ program\&. .sp -1 .IP \(bu 2.3 .\} -\fB\-\-skip\-syslog\fR: Do not write error messages to -syslog\&. Messages are written to the default error log file (\fIhost_name\fR\&.err -in the data directory), or to a named file if the -\fB\-\-log\-error\fR -option is given\&. +\fB\-\-syslog\fR: Write error messages to +syslog +on systems that support the +\fBlogger\fR +program\&. .RE .sp .RS 4 @@ -820,16 +833,20 @@ option is given\&. .sp -1 .IP \(bu 2.3 .\} -\fB\-\-log\-error=\fR\fB\fIfile_name\fR\fR: Write error messages to the named error file\&. +\fB\-\-skip\-syslog\fR: Do not write error messages to +syslog\&. Messages are written to the default error log file (\fIhost_name\fR\&.err +in the data directory), or to a named file if the +\fB\-\-log\-error\fR +option is given\&. .RE .PP If none of these options is given, the default is \fB\-\-skip\-syslog\fR\&. .PP If -\fB\-\-syslog\fR -and \fB\-\-log\-error\fR +and +\fB\-\-syslog\fR are both given, a warning is issued and \fB\-\-log\-error\fR takes precedence\&. @@ -840,24 +857,10 @@ writes a message, notices go to the logging destination (syslog or the error log file) and stdout\&. Errors go to the logging destination and stderr\&. -.PP -Normally, you should not edit the -\fBmysqld_safe\fR -script\&. Instead, configure -\fBmysqld_safe\fR -by using command\-line options or options in the -[mysqld_safe] -section of a -my\&.cnf -option file\&. In rare cases, it might be necessary to edit -\fBmysqld_safe\fR -to get it to start the server properly\&. However, if you do this, your modified version of -\fBmysqld_safe\fR -might be overwritten if you upgrade MySQL in the future, so you should make a copy of your edited version that you can reinstall\&. .SH "COPYRIGHT" .br .PP -Copyright \(co 1997, 2014, Oracle and/or its affiliates. All rights reserved. +Copyright \(co 1997, 2015, Oracle and/or its affiliates. All rights reserved. .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/mysql-wsrep-5.6/man/mysqldump.1 b/mysql-wsrep-5.6/man/mysqldump.1 index 516a4386..74719081 100644 --- a/mysql-wsrep-5.6/man/mysqldump.1 +++ b/mysql-wsrep-5.6/man/mysqldump.1 @@ -2,12 +2,12 @@ .\" Title: \fBmysqldump\fR .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 01/14/2014 +.\" Date: 01/16/2015 .\" Manual: MySQL Database System .\" Source: MySQL 5.6 .\" Language: English .\" -.TH "\FBMYSQLDUMP\FR" "1" "01/14/2014" "MySQL 5\&.6" "MySQL Database System" +.TH "\FBMYSQLDUMP\FR" "1" "01/16/2015" "MySQL 5\&.6" "MySQL Database System" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -69,8 +69,7 @@ ALTER DATABASE statements that change the database collation\&. These may be used when dumping stored programs to preserve their character encodings\&. To reload a dump file containing such statements, the ALTER privilege for the affected database is required\&. - Performance and Scalability Considerations -.PP +Performance and Scalability Considerations.PP mysqldump advantages include the convenience and flexibility of viewing or even editing the output before restoring\&. You can clone databases for development and DBA work, or produce slight variations of an existing database for testing\&. It is not intended as a fast or scalable solution for backing up substantial amounts of data\&. With large data sizes, even if the backup step takes a reasonable time, restoring the data can be very slow because replaying the SQL statements involves disk I/O for insertion, index creation, and so on\&. .PP @@ -99,7 +98,7 @@ InnoDB backups with minimal disruption; it can also back up tables from MyISAM and other storage engines; and it provides a number of convenient options to accommodate different backup scenarios\&. See -Section\ \&24.2, \(lqMySQL Enterprise Backup\(rq\&. +Section\ \&25.2, \(lqMySQL Enterprise Backup\(rq\&. .RE .sp .RS 4 @@ -144,8 +143,7 @@ option\&. For additional information about \fBmysqldump\fR, see Section\ \&7.4, \(lqUsing mysqldump for Backups\(rq\&. - Syntax -.PP +Syntax.PP There are in general three ways to use \fBmysqldump\fR\(emin order to dump a set of one or more tables, a set of one or more complete databases, or an entire MySQL server\(emas shown here: .sp @@ -172,19 +170,15 @@ To see a list of the options your version of \fBmysqldump\fR supports, issue the command \fBmysqldump \-\-help\fR\&. - Option Syntax \- Alphabetical Summary -.PP +Option Syntax \- Alphabetical Summary.PP \fBmysqldump\fR supports the following options, which can be specified on the command line or in the [mysqldump] and [client] -groups of an option file\&. -\fBmysqldump\fR -also supports the options for processing option files described at -Section\ \&4.2.3.4, \(lqCommand-Line Options that Affect Option-File Handling\(rq\&. - Connection Options -.PP +groups of an option file\&. For information about option files used by MySQL programs, see +Section\ \&4.2.6, \(lqUsing Option Files\(rq\&. +Connection Options.PP The \fBmysqldump\fR command logs into a MySQL server to extract information\&. The following options specify how to connect to the MySQL server, either on the same machine or a remote system\&. @@ -201,7 +195,7 @@ command logs into a MySQL server to extract information\&. The following options .\" bind-address option: mysqldump \fB\-\-bind\-address=\fR\fB\fIip_address\fR\fR .sp -On a computer having multiple network interfaces, this option can be used to select which interface is employed when connecting to the MySQL server\&. +On a computer having multiple network interfaces, use this option to select which interface to use for connecting to the MySQL server\&. .sp This option is supported beginning with MySQL 5\&.6\&.1\&. .RE @@ -263,6 +257,31 @@ localhost\&. .sp -1 .IP \(bu 2.3 .\} +.\" mysqldump: login-path option +.\" login-path option: mysqldump +\fB\-\-login\-path=\fR\fB\fIname\fR\fR +.sp +Read options from the named login path in the +\&.mylogin\&.cnf +login file\&. A +\(lqlogin path\(rq +is an option group that permits only a limited set of options: +\fBhost\fR, +\fBuser\fR, and +\fBpassword\fR\&. Think of a login path as a set of values that indicate the server host and the credentials for authenticating with the server\&. To create the login path file, use the +\fBmysql_config_editor\fR +utility\&. See +\fBmysql_config_editor\fR(1)\&. This option was added in MySQL 5\&.6\&.6\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} .\" mysqldump: password option .\" password option: mysqldump \fB\-\-password[=\fR\fB\fIpassword\fR\fR\fB]\fR, @@ -360,6 +379,39 @@ Section\ \&4.2.2, \(lqConnecting to the MySQL Server\(rq\&. .sp -1 .IP \(bu 2.3 .\} +.\" mysqldump: secure-auth option +.\" secure-auth option: mysqldump +\fB\-\-secure\-auth\fR +.sp +Do not send passwords to the server in old (pre\-4\&.1) format\&. This prevents connections except for servers that use the newer password format\&. This option is enabled by default; use +\fB\-\-skip\-secure\-auth\fR +to disable it\&. This option was added in MySQL 5\&.6\&.17\&. +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBNote\fR +.ps -1 +.br +Passwords that use the pre\-4\&.1 hashing method are less secure than passwords that use the native password hashing method and should be avoided\&. Pre\-4\&.1 passwords are deprecated and support for them will be removed in a future MySQL release\&. For account upgrade instructions, see +Section\ \&6.3.8.3, \(lqMigrating Away from Pre-4.1 Password Hashing and the mysql_old_password Plugin\(rq\&. +.sp .5v +.RE +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} .\" mysqldump: socket option .\" socket option: mysqldump \fB\-\-socket=\fR\fB\fIpath\fR\fR, @@ -384,7 +436,7 @@ localhost, the Unix socket file to use, or, on Windows, the name of the named pi Options that begin with \fB\-\-ssl\fR specify whether to connect to the server using SSL and indicate where to find SSL keys and certificates\&. See -Section\ \&6.3.9.4, \(lqSSL Command Options\(rq\&. +Section\ \&6.3.10.4, \(lqSSL Command Options\(rq\&. .RE .sp .RS 4 @@ -444,8 +496,115 @@ length\&. If you increase this variable, ensure that the net_buffer_length variable in the MySQL server is at least this large\&. .RE - DDL Options -.PP +Option\-File Options.PP +These options are used to control which option files to read\&. +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +.\" mysqldump: defaults-extra-file option +.\" defaults-extra-file option: mysqldump +\fB\-\-defaults\-extra\-file=\fR\fB\fIfile_name\fR\fR +.sp +Read this option file after the global option file but (on Unix) before the user option file\&. If the file does not exist or is otherwise inaccessible, an error occurs\&. +\fIfile_name\fR +is interpreted relative to the current directory if given as a relative path name rather than a full path name\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +.\" mysqldump: defaults-file option +.\" defaults-file option: mysqldump +\fB\-\-defaults\-file=\fR\fB\fIfile_name\fR\fR +.sp +Use only the given option file\&. If the file does not exist or is otherwise inaccessible, an error occurs\&. +\fIfile_name\fR +is interpreted relative to the current directory if given as a relative path name rather than a full path name\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +.\" mysqldump: defaults-group-suffix option +.\" defaults-group-suffix option: mysqldump +\fB\-\-defaults\-group\-suffix=\fR\fB\fIstr\fR\fR +.sp +Read not only the usual option groups, but also groups with the usual names and a suffix of +\fIstr\fR\&. For example, +\fBmysqldump\fR +normally reads the +[client] +and +[mysqldump] +groups\&. If the +\fB\-\-defaults\-group\-suffix=_other\fR +option is given, +\fBmysqldump\fR +also reads the +[client_other] +and +[mysqldump_other] +groups\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +.\" mysqldump: no-defaults option +.\" no-defaults option: mysqldump +\fB\-\-no\-defaults\fR +.sp +Do not read any option files\&. If program startup fails due to reading unknown options from an option file, +\fB\-\-no\-defaults\fR +can be used to prevent them from being read\&. +.sp +The exception is that the +\&.mylogin\&.cnf +file, if it exists, is read in all cases\&. This permits passwords to be specified in a safer way than on the command line even when +\fB\-\-no\-defaults\fR +is used\&. (\&.mylogin\&.cnf +is created by the +\fBmysql_config_editor\fR +utility\&. See +\fBmysql_config_editor\fR(1)\&.) +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +.\" mysqldump: print-defaults option +.\" print-defaults option: mysqldump +\fB\-\-print\-defaults\fR +.sp +Print the program name and all options that it gets from option files\&. +.RE +DDL Options.PP Usage scenarios for \fBmysqldump\fR include setting up an entire new MySQL instance (including database tables), and replacing data inside an existing instance with existing databases and tables\&. The following options let you specify which things to tear down and set up when restoring a dump, by encoding various DDL statements within the dump file\&. @@ -632,8 +791,7 @@ statements rather than INSERT statements\&. .RE - Debug Options -.PP +Debug Options.PP The following options print debugging information, encode debugging information in the dump file, or let the dump operation proceed regardless of potential problems\&. .sp .RS 4 @@ -684,8 +842,8 @@ Write additional information in the dump file such as program version, server ve Write a debugging log\&. A typical \fIdebug_options\fR string is -\*(Aqd:t:o,\fIfile_name\fR\*(Aq\&. The default value is -\*(Aqd:t:o,/tmp/mysqldump\&.trace\*(Aq\&. +d:t:o,\fIfile_name\fR\&. The default value is +d:t:o,/tmp/mysqldump\&.trace\&. .RE .sp .RS 4 @@ -830,8 +988,7 @@ option\&. .sp Verbose mode\&. Print more information about what the program does\&. .RE - Help Options -.PP +Help Options.PP The following options display information about the \fBmysqldump\fR command itself\&. @@ -867,8 +1024,7 @@ Display a help message and exit\&. .sp Display version information and exit\&. .RE - Internationalization Options -.PP +Internationalization Options.PP The following options change how the \fBmysqldump\fR command represents character data with national language settings\&. @@ -907,8 +1063,7 @@ as the default character set\&. See Section\ \&10.5, \(lqCharacter Set Configuration\(rq\&. If no character set is specified, \fBmysqldump\fR uses -utf8, and earlier versions use -latin1\&. +utf8\&. .RE .sp .RS 4 @@ -949,8 +1104,7 @@ SET NAMES statement, use \fB\-\-skip\-set\-charset\fR\&. .RE - Replication Options -.PP +Replication Options.PP The \fBmysqldump\fR command is frequently used to create an empty instance, or an instance including data, on a slave server in a replication configuration\&. The following options apply to dumping and restoring data on replication master and slave servers\&. @@ -1104,7 +1258,7 @@ option, which overrides and causes it to be ignored if both options are used\&. .sp Prior to MySQL 5\&.6\&.4, this option was required for dumping the replication log tables (see -Section\ \&16.2.2, \(lqReplication Relay and Status Logs\(rq)\&. +Section\ \&17.2.2, \(lqReplication Relay and Status Logs\(rq)\&. .RE .sp .RS 4 @@ -1158,8 +1312,7 @@ T} .sp 1 This option was added in MySQL 5\&.6\&.9\&. .RE - Format Options -.PP +Format Options.PP The following options specify how to represent the entire dump file or certain kinds of data in the dump file\&. They also control whether certain optional information is written to the dump file\&. .sp .RS 4 @@ -1568,8 +1721,7 @@ Prior to MySQL 5\&.6\&.5, this option prevented the \fB\-\-routines\fR option from working correctly\(emthat is, no stored routines, triggers, or events could be dumped in XML format\&. (Bug #11760384, Bug #52792) .RE - Filtering Options -.PP +Filtering Options.PP The following options control which kinds of schema objects are written to the dump file: by category, such as triggers or events; by name, for example, choosing which databases and tables to dump; or even filtering rows from the table data using a WHERE clause\&. @@ -1596,7 +1748,7 @@ slave_master_info and slave_relay_log_info tables (see -Section\ \&16.2.2, \(lqReplication Relay and Status Logs\(rq) were not included by this option\&. +Section\ \&17.2.2, \(lqReplication Relay and Status Logs\(rq) were not included by this option\&. .RE .sp .RS 4 @@ -1775,8 +1927,7 @@ Examples: .RE .\} .RE - Performance Options -.PP +Performance Options.PP The following options are the most relevant for the performance particularly of the restore operations\&. For large data sets, restore operation (processing the INSERT statements in the dump file) is the most time\-consuming part\&. When it is urgent to restore data quickly, plan and test the performance of this stage in advance\&. For restore times measured in hours, you might prefer an alternative backup and restore solution, such as @@ -1942,8 +2093,7 @@ See the description for the \fB\-\-opt\fR option\&. .RE - Transactional Options -.PP +Transactional Options.PP The following options trade off the performance of the dump operation, against the reliability and consistency of the exported data\&. .sp .RS 4 @@ -2120,6 +2270,26 @@ table, but makes the dump operation take considerably longer\&. .sp -1 .IP \(bu 2.3 .\} +.\" mysqldump: shared-memory-base-name option +.\" shared-memory-base-name option: mysqldump +\fB\-\-shared\-memory\-base\-name=\fR\fB\fIname\fR\fR +.sp +On Windows, the shared\-memory name to use, for connections made using shared memory to a local server\&. The default value is +MYSQL\&. The shared\-memory name is case sensitive\&. +.sp +The server must be started with the +\fB\-\-shared\-memory\fR +option to enable shared\-memory connections\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} .\" mysqldump: single-transaction option .\" single-transaction option: mysqldump \fB\-\-single\-transaction\fR @@ -2168,7 +2338,7 @@ option with the \fB\-\-quick\fR option\&. .RE - Option Groups +Option Groups .sp .RS 4 .ie n \{\ @@ -2209,8 +2379,7 @@ When you selectively enable or disable the effect of a group option, order is im would not have the intended effect; it is the same as \fB\-\-skip\-opt\fR by itself\&. - Examples -.PP +Examples.PP To make a backup of an entire database: .sp .if n \{\ @@ -2296,7 +2465,7 @@ provides a way of making an online backup: .RS 4 .\} .nf -shell> \fBmysqldump \-\-all\-databases \-\-single\-transaction > all_databases\&.sql\fR +shell> \fBmysqldump \-\-all\-databases \-\-master\-data \-\-single\-transaction > all_databases\&.sql\fR .fi .if n \{\ .RE @@ -2385,26 +2554,23 @@ for all features except index disabling and table locking, use \fB\-\-disable\-keys\fR \fB\-\-lock\-tables\fR\&. .RE - Restrictions - .\" mysqldump: views +Restrictions.\" mysqldump: views .\" mysqldump: problems .\" mysqldump: workarounds .PP \fBmysqldump\fR does not dump the INFORMATION_SCHEMA -database by default\&. To dump -INFORMATION_SCHEMA, name it explicitly on the command line and also use the +or +performance_schema +database by default\&. To dump either of these, name it explicitly on the command line and also use the \fB\-\-skip\-lock\-tables\fR +option\&. You can also name them with the +\fB\-\-databases\fR option\&. .PP \fBmysqldump\fR -never dumps the -performance_schema -database\&. -.PP -\fBmysqldump\fR -also does not dump the MySQL Cluster +does not dump the MySQL Cluster ndbinfo information database\&. .PP @@ -2419,12 +2585,12 @@ mysql database\&. As of 5\&.6\&.6, the dump includes statements to recreate those tables so that they are not missing after reloading the dump file\&. Log table contents are not dumped\&. .PP If you encounter problems backing up views due to insufficient privileges, see -Section\ \&E.5, \(lqRestrictions on Views\(rq +Section\ \&D.5, \(lqRestrictions on Views\(rq for a workaround\&. .SH "COPYRIGHT" .br .PP -Copyright \(co 1997, 2014, Oracle and/or its affiliates. All rights reserved. +Copyright \(co 1997, 2015, Oracle and/or its affiliates. All rights reserved. .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/mysql-wsrep-5.6/man/mysqldumpslow.1 b/mysql-wsrep-5.6/man/mysqldumpslow.1 index fa140a33..4f7fc912 100644 --- a/mysql-wsrep-5.6/man/mysqldumpslow.1 +++ b/mysql-wsrep-5.6/man/mysqldumpslow.1 @@ -2,12 +2,12 @@ .\" Title: \fBmysqldumpslow\fR .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 01/14/2014 +.\" Date: 01/16/2015 .\" Manual: MySQL Database System .\" Source: MySQL 5.6 .\" Language: English .\" -.TH "\FBMYSQLDUMPSLOW\FR" "1" "01/14/2014" "MySQL 5\&.6" "MySQL Database System" +.TH "\FBMYSQLDUMPSLOW\FR" "1" "01/16/2015" "MySQL 5\&.6" "MySQL Database System" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -323,7 +323,7 @@ Count: 3 Time=2\&.13s (6s) Lock=0\&.00s (0s) Rows=0\&.0 (0), root[root]@local .SH "COPYRIGHT" .br .PP -Copyright \(co 1997, 2014, Oracle and/or its affiliates. All rights reserved. +Copyright \(co 1997, 2015, Oracle and/or its affiliates. All rights reserved. .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/mysql-wsrep-5.6/man/mysqlhotcopy.1 b/mysql-wsrep-5.6/man/mysqlhotcopy.1 index 5180dda9..9e585051 100644 --- a/mysql-wsrep-5.6/man/mysqlhotcopy.1 +++ b/mysql-wsrep-5.6/man/mysqlhotcopy.1 @@ -2,12 +2,12 @@ .\" Title: \fBmysqlhotcopy\fR .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 01/14/2014 +.\" Date: 01/16/2015 .\" Manual: MySQL Database System .\" Source: MySQL 5.6 .\" Language: English .\" -.TH "\FBMYSQLHOTCOPY\FR" "1" "01/14/2014" "MySQL 5\&.6" "MySQL Database System" +.TH "\FBMYSQLHOTCOPY\FR" "1" "01/16/2015" "MySQL 5\&.6" "MySQL Database System" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -38,6 +38,22 @@ mysqlhotcopy \- a database backup program .HP \w'\fBmysqlhotcopy\ \fR\fB\fIarguments\fR\fR\ 'u \fBmysqlhotcopy \fR\fB\fIarguments\fR\fR .SH "DESCRIPTION" +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBNote\fR +.ps -1 +.br +.PP +This utility is deprecated in MySQL 5\&.6\&.20 and removed in MySQL 5\&.7 +.sp .5v +.RE .PP \fBmysqlhotcopy\fR is a Perl script that was originally written and contributed by Tim Bunce\&. It uses @@ -113,8 +129,8 @@ supports the following options, which can be specified on the command line or in [mysqlhotcopy] and [client] -groups of an option file\&. For information about option files, see -Section\ \&4.2.3.3, \(lqUsing Option Files\(rq\&. +groups of an option file\&. For information about option files used by MySQL programs, see +Section\ \&4.2.6, \(lqUsing Option Files\(rq\&. .sp .RS 4 .ie n \{\ @@ -542,7 +558,7 @@ shell> \fBperldoc mysqlhotcopy\fR .SH "COPYRIGHT" .br .PP -Copyright \(co 1997, 2014, Oracle and/or its affiliates. All rights reserved. +Copyright \(co 1997, 2015, Oracle and/or its affiliates. All rights reserved. .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/mysql-wsrep-5.6/man/mysqlimport.1 b/mysql-wsrep-5.6/man/mysqlimport.1 index dc84b2f6..a42b7050 100644 --- a/mysql-wsrep-5.6/man/mysqlimport.1 +++ b/mysql-wsrep-5.6/man/mysqlimport.1 @@ -2,12 +2,12 @@ .\" Title: \fBmysqlimport\fR .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 01/14/2014 +.\" Date: 01/16/2015 .\" Manual: MySQL Database System .\" Source: MySQL 5.6 .\" Language: English .\" -.TH "\FBMYSQLIMPORT\FR" "1" "01/14/2014" "MySQL 5\&.6" "MySQL Database System" +.TH "\FBMYSQLIMPORT\FR" "1" "01/16/2015" "MySQL 5\&.6" "MySQL Database System" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -78,10 +78,8 @@ supports the following options, which can be specified on the command line or in [mysqlimport] and [client] -groups of an option file\&. -\fBmysqlimport\fR -also supports the options for processing option files described at -Section\ \&4.2.3.4, \(lqCommand-Line Options that Affect Option-File Handling\(rq\&. +groups of an option file\&. For information about option files used by MySQL programs, see +Section\ \&4.2.6, \(lqUsing Option Files\(rq\&. .sp .RS 4 .ie n \{\ @@ -111,7 +109,7 @@ Display a help message and exit\&. .\" bind-address option: mysqlimport \fB\-\-bind\-address=\fR\fB\fIip_address\fR\fR .sp -On a computer having multiple network interfaces, this option can be used to select which interface is employed when connecting to the MySQL server\&. +On a computer having multiple network interfaces, use this option to select which interface to use for connecting to the MySQL server\&. .sp This option is supported beginning with MySQL 5\&.6\&.1\&. .RE @@ -180,8 +178,8 @@ Compress all information sent between the client and the server if both support Write a debugging log\&. A typical \fIdebug_options\fR string is -\*(Aqd:t:o,\fIfile_name\fR\*(Aq\&. The default is -\*(Aqd:t:o\*(Aq\&. +d:t:o,\fIfile_name\fR\&. The default is +d:t:o\&. .RE .sp .RS 4 @@ -258,6 +256,70 @@ This option was added in MySQL 5\&.6\&.2\&. .sp -1 .IP \(bu 2.3 .\} +.\" mysqlimport: defaults-extra-file option +.\" defaults-extra-file option: mysqlimport +\fB\-\-defaults\-extra\-file=\fR\fB\fIfile_name\fR\fR +.sp +Read this option file after the global option file but (on Unix) before the user option file\&. If the file does not exist or is otherwise inaccessible, an error occurs\&. +\fIfile_name\fR +is interpreted relative to the current directory if given as a relative path name rather than a full path name\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +.\" mysqlimport: defaults-file option +.\" defaults-file option: mysqlimport +\fB\-\-defaults\-file=\fR\fB\fIfile_name\fR\fR +.sp +Use only the given option file\&. If the file does not exist or is otherwise inaccessible, an error occurs\&. +\fIfile_name\fR +is interpreted relative to the current directory if given as a relative path name rather than a full path name\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +.\" mysqlimport: defaults-group-suffix option +.\" defaults-group-suffix option: mysqlimport +\fB\-\-defaults\-group\-suffix=\fR\fB\fIstr\fR\fR +.sp +Read not only the usual option groups, but also groups with the usual names and a suffix of +\fIstr\fR\&. For example, +\fBmysqlimport\fR +normally reads the +[client] +and +[mysqlimport] +groups\&. If the +\fB\-\-defaults\-group\-suffix=_other\fR +option is given, +\fBmysqlimport\fR +also reads the +[client_other] +and +[mysqlimport_other] +groups\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} .\" mysqlimport: delete option .\" delete option: mysqlimport \fB\-\-delete\fR, @@ -423,6 +485,31 @@ tables for writing before processing any text files\&. This ensures that all tab .sp -1 .IP \(bu 2.3 .\} +.\" mysqlimport: login-path option +.\" login-path option: mysqlimport +\fB\-\-login\-path=\fR\fB\fIname\fR\fR +.sp +Read options from the named login path in the +\&.mylogin\&.cnf +login file\&. A +\(lqlogin path\(rq +is an option group that permits only a limited set of options: +\fBhost\fR, +\fBuser\fR, and +\fBpassword\fR\&. Think of a login path as a set of values that indicate the server host and the credentials for authenticating with the server\&. To create the login path file, use the +\fBmysql_config_editor\fR +utility\&. See +\fBmysql_config_editor\fR(1)\&. This option was added in MySQL 5\&.6\&.6\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} .\" mysqlimport: low-priority option .\" low-priority option: mysqlimport \fB\-\-low\-priority\fR @@ -443,6 +530,33 @@ MERGE)\&. .sp -1 .IP \(bu 2.3 .\} +.\" mysqlimport: no-defaults option +.\" no-defaults option: mysqlimport +\fB\-\-no\-defaults\fR +.sp +Do not read any option files\&. If program startup fails due to reading unknown options from an option file, +\fB\-\-no\-defaults\fR +can be used to prevent them from being read\&. +.sp +The exception is that the +\&.mylogin\&.cnf +file, if it exists, is read in all cases\&. This permits passwords to be specified in a safer way than on the command line even when +\fB\-\-no\-defaults\fR +is used\&. (\&.mylogin\&.cnf +is created by the +\fBmysql_config_editor\fR +utility\&. See +\fBmysql_config_editor\fR(1)\&.) +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} .\" mysqlimport: password option .\" password option: mysqlimport \fB\-\-password[=\fR\fB\fIpassword\fR\fR\fB]\fR, @@ -526,6 +640,21 @@ The TCP/IP port number to use for the connection\&. .sp -1 .IP \(bu 2.3 .\} +.\" mysqlimport: print-defaults option +.\" print-defaults option: mysqlimport +\fB\-\-print\-defaults\fR +.sp +Print the program name and all options that it gets from option files\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} .\" mysqlimport: protocol option .\" protocol option: mysqlimport \fB\-\-protocol={TCP|SOCKET|PIPE|MEMORY}\fR @@ -564,6 +693,59 @@ options control handling of input rows that duplicate existing rows on unique ke .sp -1 .IP \(bu 2.3 .\} +.\" mysqlimport: secure-auth option +.\" secure-auth option: mysqlimport +\fB\-\-secure\-auth\fR +.sp +Do not send passwords to the server in old (pre\-4\&.1) format\&. This prevents connections except for servers that use the newer password format\&. This option is enabled by default; use +\fB\-\-skip\-secure\-auth\fR +to disable it\&. This option was added in MySQL 5\&.6\&.17\&. +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBNote\fR +.ps -1 +.br +Passwords that use the pre\-4\&.1 hashing method are less secure than passwords that use the native password hashing method and should be avoided\&. Pre\-4\&.1 passwords are deprecated and support for them will be removed in a future MySQL release\&. For account upgrade instructions, see +Section\ \&6.3.8.3, \(lqMigrating Away from Pre-4.1 Password Hashing and the mysql_old_password Plugin\(rq\&. +.sp .5v +.RE +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +.\" mysqlimport: shared-memory-base-name option +.\" shared-memory-base-name option: mysqlimport +\fB\-\-shared\-memory\-base\-name=\fR\fB\fIname\fR\fR +.sp +On Windows, the shared\-memory name to use, for connections made using shared memory to a local server\&. The default value is +MYSQL\&. The shared\-memory name is case sensitive\&. +.sp +The server must be started with the +\fB\-\-shared\-memory\fR +option to enable shared\-memory connections\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} .\" mysqlimport: silent option .\" silent option: mysqlimport \fB\-\-silent\fR, @@ -604,7 +786,7 @@ localhost, the Unix socket file to use, or, on Windows, the name of the named pi Options that begin with \fB\-\-ssl\fR specify whether to connect to the server using SSL and indicate where to find SSL keys and certificates\&. See -Section\ \&6.3.9.4, \(lqSSL Command Options\(rq\&. +Section\ \&6.3.10.4, \(lqSSL Command Options\(rq\&. .RE .sp .RS 4 @@ -708,7 +890,7 @@ shell> \fBmysql \-e \*(AqSELECT * FROM imptest\*(Aq test\fR .SH "COPYRIGHT" .br .PP -Copyright \(co 1997, 2014, Oracle and/or its affiliates. All rights reserved. +Copyright \(co 1997, 2015, Oracle and/or its affiliates. All rights reserved. .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/mysql-wsrep-5.6/man/mysqlshow.1 b/mysql-wsrep-5.6/man/mysqlshow.1 index bb1f3526..b4943488 100644 --- a/mysql-wsrep-5.6/man/mysqlshow.1 +++ b/mysql-wsrep-5.6/man/mysqlshow.1 @@ -2,12 +2,12 @@ .\" Title: \fBmysqlshow\fR .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 01/14/2014 +.\" Date: 01/16/2015 .\" Manual: MySQL Database System .\" Source: MySQL 5.6 .\" Language: English .\" -.TH "\FBMYSQLSHOW\FR" "1" "01/14/2014" "MySQL 5\&.6" "MySQL Database System" +.TH "\FBMYSQLSHOW\FR" "1" "01/16/2015" "MySQL 5\&.6" "MySQL Database System" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -125,10 +125,8 @@ supports the following options, which can be specified on the command line or in [mysqlshow] and [client] -groups of an option file\&. -\fBmysqlshow\fR -also supports the options for processing option files described at -Section\ \&4.2.3.4, \(lqCommand-Line Options that Affect Option-File Handling\(rq\&. +groups of an option file\&. For information about option files used by MySQL programs, see +Section\ \&4.2.6, \(lqUsing Option Files\(rq\&. .sp .RS 4 .ie n \{\ @@ -158,7 +156,7 @@ Display a help message and exit\&. .\" bind-address option: mysqlshow \fB\-\-bind\-address=\fR\fB\fIip_address\fR\fR .sp -On a computer having multiple network interfaces, this option can be used to select which interface is employed when connecting to the MySQL server\&. +On a computer having multiple network interfaces, use this option to select which interface to use for connecting to the MySQL server\&. .sp This option is supported beginning with MySQL 5\&.6\&.1\&. .RE @@ -227,8 +225,8 @@ tables\&. Write a debugging log\&. A typical \fIdebug_options\fR string is -\*(Aqd:t:o,\fIfile_name\fR\*(Aq\&. The default is -\*(Aqd:t:o\*(Aq\&. +d:t:o,\fIfile_name\fR\&. The default is +d:t:o\&. .RE .sp .RS 4 @@ -305,6 +303,70 @@ This option was added in MySQL 5\&.6\&.2\&. .sp -1 .IP \(bu 2.3 .\} +.\" mysqlshow: defaults-extra-file option +.\" defaults-extra-file option: mysqlshow +\fB\-\-defaults\-extra\-file=\fR\fB\fIfile_name\fR\fR +.sp +Read this option file after the global option file but (on Unix) before the user option file\&. If the file does not exist or is otherwise inaccessible, an error occurs\&. +\fIfile_name\fR +is interpreted relative to the current directory if given as a relative path name rather than a full path name\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +.\" mysqlshow: defaults-file option +.\" defaults-file option: mysqlshow +\fB\-\-defaults\-file=\fR\fB\fIfile_name\fR\fR +.sp +Use only the given option file\&. If the file does not exist or is otherwise inaccessible, an error occurs\&. +\fIfile_name\fR +is interpreted relative to the current directory if given as a relative path name rather than a full path name\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +.\" mysqlshow: defaults-group-suffix option +.\" defaults-group-suffix option: mysqlshow +\fB\-\-defaults\-group\-suffix=\fR\fB\fIstr\fR\fR +.sp +Read not only the usual option groups, but also groups with the usual names and a suffix of +\fIstr\fR\&. For example, +\fBmysqlshow\fR +normally reads the +[client] +and +[mysqlshow] +groups\&. If the +\fB\-\-defaults\-group\-suffix=_other\fR +option is given, +\fBmysqlshow\fR +also reads the +[client_other] +and +[mysqlshow_other] +groups\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} .\" mysqlshow: host option .\" host option: mysqlshow \fB\-\-host=\fR\fB\fIhost_name\fR\fR, @@ -337,6 +399,58 @@ Show table indexes\&. .sp -1 .IP \(bu 2.3 .\} +.\" mysqlshow: login-path option +.\" login-path option: mysqlshow +\fB\-\-login\-path=\fR\fB\fIname\fR\fR +.sp +Read options from the named login path in the +\&.mylogin\&.cnf +login file\&. A +\(lqlogin path\(rq +is an option group that permits only a limited set of options: +\fBhost\fR, +\fBuser\fR, and +\fBpassword\fR\&. Think of a login path as a set of values that indicate the server host and the credentials for authenticating with the server\&. To create the login path file, use the +\fBmysql_config_editor\fR +utility\&. See +\fBmysql_config_editor\fR(1)\&. This option was added in MySQL 5\&.6\&.6\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +.\" mysqlshow: no-defaults option +.\" no-defaults option: mysqlshow +\fB\-\-no\-defaults\fR +.sp +Do not read any option files\&. If program startup fails due to reading unknown options from an option file, +\fB\-\-no\-defaults\fR +can be used to prevent them from being read\&. +.sp +The exception is that the +\&.mylogin\&.cnf +file, if it exists, is read in all cases\&. This permits passwords to be specified in a safer way than on the command line even when +\fB\-\-no\-defaults\fR +is used\&. (\&.mylogin\&.cnf +is created by the +\fBmysql_config_editor\fR +utility\&. See +\fBmysql_config_editor\fR(1)\&.) +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} .\" mysqlshow: password option .\" password option: mysqlshow \fB\-\-password[=\fR\fB\fIpassword\fR\fR\fB]\fR, @@ -420,6 +534,21 @@ The TCP/IP port number to use for the connection\&. .sp -1 .IP \(bu 2.3 .\} +.\" mysqlshow: print-defaults option +.\" print-defaults option: mysqlshow +\fB\-\-print\-defaults\fR +.sp +Print the program name and all options that it gets from option files\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} .\" mysqlshow: protocol option .\" protocol option: mysqlshow \fB\-\-protocol={TCP|SOCKET|PIPE|MEMORY}\fR @@ -436,6 +565,59 @@ Section\ \&4.2.2, \(lqConnecting to the MySQL Server\(rq\&. .sp -1 .IP \(bu 2.3 .\} +.\" mysqlshow: secure-auth option +.\" secure-auth option: mysqlshow +\fB\-\-secure\-auth\fR +.sp +Do not send passwords to the server in old (pre\-4\&.1) format\&. This prevents connections except for servers that use the newer password format\&. This option is enabled by default; use +\fB\-\-skip\-secure\-auth\fR +to disable it\&. This option was added in MySQL 5\&.6\&.17\&. +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBNote\fR +.ps -1 +.br +Passwords that use the pre\-4\&.1 hashing method are less secure than passwords that use the native password hashing method and should be avoided\&. Pre\-4\&.1 passwords are deprecated and support for them will be removed in a future MySQL release\&. For account upgrade instructions, see +Section\ \&6.3.8.3, \(lqMigrating Away from Pre-4.1 Password Hashing and the mysql_old_password Plugin\(rq\&. +.sp .5v +.RE +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +.\" mysqlshow: shared-memory-base-name option +.\" shared-memory-base-name option: mysqlshow +\fB\-\-shared\-memory\-base\-name=\fR\fB\fIname\fR\fR +.sp +On Windows, the shared\-memory name to use, for connections made using shared memory to a local server\&. The default value is +MYSQL\&. The shared\-memory name is case sensitive\&. +.sp +The server must be started with the +\fB\-\-shared\-memory\fR +option to enable shared\-memory connections\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} .\" mysqlshow: show-table-type option .\" show-table-type option: mysqlshow \fB\-\-show\-table\-type\fR, @@ -480,7 +662,7 @@ localhost, the Unix socket file to use, or, on Windows, the name of the named pi Options that begin with \fB\-\-ssl\fR specify whether to connect to the server using SSL and indicate where to find SSL keys and certificates\&. See -Section\ \&6.3.9.4, \(lqSSL Command Options\(rq\&. +Section\ \&6.3.10.4, \(lqSSL Command Options\(rq\&. .RE .sp .RS 4 @@ -549,7 +731,7 @@ Display version information and exit\&. .SH "COPYRIGHT" .br .PP -Copyright \(co 1997, 2014, Oracle and/or its affiliates. All rights reserved. +Copyright \(co 1997, 2015, Oracle and/or its affiliates. All rights reserved. .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/mysql-wsrep-5.6/man/mysqlslap.1 b/mysql-wsrep-5.6/man/mysqlslap.1 index fae287a6..496a230e 100644 --- a/mysql-wsrep-5.6/man/mysqlslap.1 +++ b/mysql-wsrep-5.6/man/mysqlslap.1 @@ -2,12 +2,12 @@ .\" Title: \fBmysqlslap\fR .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 01/14/2014 +.\" Date: 01/16/2015 .\" Manual: MySQL Database System .\" Source: MySQL 5.6 .\" Language: English .\" -.TH "\FBMYSQLSLAP\FR" "1" "01/14/2014" "MySQL 5\&.6" "MySQL Database System" +.TH "\FBMYSQLSLAP\FR" "1" "01/16/2015" "MySQL 5\&.6" "MySQL Database System" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -162,10 +162,8 @@ supports the following options, which can be specified on the command line or in [mysqlslap] and [client] -groups of an option file\&. -\fBmysqlslap\fR -also supports the options for processing option files described at -Section\ \&4.2.3.4, \(lqCommand-Line Options that Affect Option-File Handling\(rq\&. +groups of an option file\&. For information about option files used by MySQL programs, see +Section\ \&4.2.6, \(lqUsing Option Files\(rq\&. .sp .RS 4 .ie n \{\ @@ -466,8 +464,8 @@ Generate output in comma\-separated values format\&. The output goes to the name Write a debugging log\&. A typical \fIdebug_options\fR string is -\*(Aqd:t:o,\fIfile_name\fR\*(Aq\&. The default is -\*(Aqd:t:o,/tmp/mysqlslap\&.trace\*(Aq\&. +d:t:o,\fIfile_name\fR\&. The default is +d:t:o,/tmp/mysqlslap\&.trace\&. .RE .sp .RS 4 @@ -527,6 +525,70 @@ This option was added in MySQL 5\&.6\&.2\&. .sp -1 .IP \(bu 2.3 .\} +.\" mysqlslap: defaults-extra-file option +.\" defaults-extra-file option: mysqlslap +\fB\-\-defaults\-extra\-file=\fR\fB\fIfile_name\fR\fR +.sp +Read this option file after the global option file but (on Unix) before the user option file\&. If the file does not exist or is otherwise inaccessible, an error occurs\&. +\fIfile_name\fR +is interpreted relative to the current directory if given as a relative path name rather than a full path name\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +.\" mysqlslap: defaults-file option +.\" defaults-file option: mysqlslap +\fB\-\-defaults\-file=\fR\fB\fIfile_name\fR\fR +.sp +Use only the given option file\&. If the file does not exist or is otherwise inaccessible, an error occurs\&. +\fIfile_name\fR +is interpreted relative to the current directory if given as a relative path name rather than a full path name\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +.\" mysqlslap: defaults-group-suffix option +.\" defaults-group-suffix option: mysqlslap +\fB\-\-defaults\-group\-suffix=\fR\fB\fIstr\fR\fR +.sp +Read not only the usual option groups, but also groups with the usual names and a suffix of +\fIstr\fR\&. For example, +\fBmysqlslap\fR +normally reads the +[client] +and +[mysqlslap] +groups\&. If the +\fB\-\-defaults\-group\-suffix=_other\fR +option is given, +\fBmysqlslap\fR +also reads the +[client_other] +and +[mysqlslap_other] +groups\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} .\" mysqlslap: delimiter option .\" delimiter option: mysqlslap \fB\-\-delimiter=\fR\fB\fIstr\fR\fR, @@ -567,7 +629,7 @@ statements\&. The default is 0 (connections are not detached)\&. Enable the mysql_clear_password cleartext authentication plugin\&. (See -Section\ \&6.3.7.7, \(lqThe Cleartext Client-Side Authentication Plugin\(rq\&.) This option was added in MySQL 5\&.6\&.7\&. +Section\ \&6.3.8.7, \(lqThe Cleartext Client-Side Authentication Plugin\(rq\&.) This option was added in MySQL 5\&.6\&.7\&. .RE .sp .RS 4 @@ -626,6 +688,31 @@ The number of times to run the tests\&. .sp -1 .IP \(bu 2.3 .\} +.\" mysqlslap: login-path option +.\" login-path option: mysqlslap +\fB\-\-login\-path=\fR\fB\fIname\fR\fR +.sp +Read options from the named login path in the +\&.mylogin\&.cnf +login file\&. A +\(lqlogin path\(rq +is an option group that permits only a limited set of options: +\fBhost\fR, +\fBuser\fR, and +\fBpassword\fR\&. Think of a login path as a set of values that indicate the server host and the credentials for authenticating with the server\&. To create the login path file, use the +\fBmysql_config_editor\fR +utility\&. See +\fBmysql_config_editor\fR(1)\&. This option was added in MySQL 5\&.6\&.6\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} .\" mysqlslap: no-drop option .\" no-drop option: mysqlslap \fB\-\-no\-drop\fR @@ -643,6 +730,33 @@ from dropping any schema it creates during the test run\&. This option was added .sp -1 .IP \(bu 2.3 .\} +.\" mysqlslap: no-defaults option +.\" no-defaults option: mysqlslap +\fB\-\-no\-defaults\fR +.sp +Do not read any option files\&. If program startup fails due to reading unknown options from an option file, +\fB\-\-no\-defaults\fR +can be used to prevent them from being read\&. +.sp +The exception is that the +\&.mylogin\&.cnf +file, if it exists, is read in all cases\&. This permits passwords to be specified in a safer way than on the command line even when +\fB\-\-no\-defaults\fR +is used\&. (\&.mylogin\&.cnf +is created by the +\fBmysql_config_editor\fR +utility\&. See +\fBmysql_config_editor\fR(1)\&.) +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} .\" mysqlslap: number-char-cols option .\" number-char-cols option: mysqlslap \fB\-\-number\-char\-cols=\fR\fB\fIN\fR\fR, @@ -828,21 +942,6 @@ The file or string containing the statement to execute after the tests have comp .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: shared-memory-base-name option -.\" shared-memory-base-name option: mysqlslap -\fB\-\-shared\-memory\-base\-name=\fR\fB\fIname\fR\fR -.sp -On Windows, the shared\-memory name to use, for connections made using shared memory to a local server\&. This option applies only if the server supports shared\-memory connections\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} .\" mysqlslap: post-system option .\" post-system option: mysqlslap \fB\-\-post\-system=\fR\fB\fIstr\fR\fR @@ -892,6 +991,21 @@ before running the tests\&. This execution is not counted for timing purposes\&. .sp -1 .IP \(bu 2.3 .\} +.\" mysqlslap: print-defaults option +.\" print-defaults option: mysqlslap +\fB\-\-print\-defaults\fR +.sp +Print the program name and all options that it gets from option files\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} .\" mysqlslap: protocol option .\" protocol option: mysqlslap \fB\-\-protocol={TCP|SOCKET|PIPE|MEMORY}\fR @@ -926,6 +1040,54 @@ statement to use for retrieving data\&. .sp -1 .IP \(bu 2.3 .\} +.\" mysqlslap: secure-auth option +.\" secure-auth option: mysqlslap +\fB\-\-secure\-auth\fR +.sp +Do not send passwords to the server in old (pre\-4\&.1) format\&. This prevents connections except for servers that use the newer password format\&. This option is enabled by default; use +\fB\-\-skip\-secure\-auth\fR +to disable it\&. This option was added in MySQL 5\&.6\&.17\&. +.if n \{\ +.sp +.\} +.RS 4 +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +.ps +1 +\fBNote\fR +.ps -1 +.br +Passwords that use the pre\-4\&.1 hashing method are less secure than passwords that use the native password hashing method and should be avoided\&. Pre\-4\&.1 passwords are deprecated and support for them will be removed in a future MySQL release\&. For account upgrade instructions, see +Section\ \&6.3.8.3, \(lqMigrating Away from Pre-4.1 Password Hashing and the mysql_old_password Plugin\(rq\&. +.sp .5v +.RE +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +.\" mysqlslap: shared-memory-base-name option +.\" shared-memory-base-name option: mysqlslap +\fB\-\-shared\-memory\-base\-name=\fR\fB\fIname\fR\fR +.sp +On Windows, the shared\-memory name to use, for connections made using shared memory to a local server\&. This option applies only if the server supports shared\-memory connections\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} .\" mysqlslap: silent option .\" silent option: mysqlslap \fB\-\-silent\fR, @@ -966,7 +1128,7 @@ localhost, the Unix socket file to use, or, on Windows, the name of the named pi Options that begin with \fB\-\-ssl\fR specify whether to connect to the server using SSL and indicate where to find SSL keys and certificates\&. See -Section\ \&6.3.9.4, \(lqSSL Command Options\(rq\&. +Section\ \&6.3.10.4, \(lqSSL Command Options\(rq\&. .RE .sp .RS 4 @@ -1019,7 +1181,7 @@ Display version information and exit\&. .SH "COPYRIGHT" .br .PP -Copyright \(co 1997, 2014, Oracle and/or its affiliates. All rights reserved. +Copyright \(co 1997, 2015, Oracle and/or its affiliates. All rights reserved. .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/mysql-wsrep-5.6/man/mysqltest.1 b/mysql-wsrep-5.6/man/mysqltest.1 index bf05cfbc..98def1e5 100644 --- a/mysql-wsrep-5.6/man/mysqltest.1 +++ b/mysql-wsrep-5.6/man/mysqltest.1 @@ -2,12 +2,12 @@ .\" Title: \fBmysqltest\fR .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 01/10/2014 +.\" Date: 01/15/2015 .\" Manual: MySQL Database System .\" Source: MySQL .\" Language: English .\" -.TH "\FBMYSQLTEST\FR" "1" "01/10/2014" "MySQL" "MySQL Database System" +.TH "\FBMYSQLTEST\FR" "1" "01/15/2015" "MySQL" "MySQL Database System" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -909,7 +909,7 @@ statement is wrapped inside a view\&. This option was added in MySQL 5\&.0\&.19\ .SH "COPYRIGHT" .br .PP -Copyright \(co 2006, 2013, Oracle and/or its affiliates. All rights reserved. +Copyright \(co 2006, 2015, Oracle and/or its affiliates. All rights reserved. .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP @@ -921,7 +921,7 @@ You should have received a copy of the GNU General Public License along with the .IP " 1." 4 The SHA-256 Authentication Plugin .RS 4 -\%http://dev.mysql.com/doc/refman/5.6/en/sha256-authentication-plugin.html +\%http://dev.mysql.com/doc/refman/5.7/en/sha256-authentication-plugin.html .RE .SH "SEE ALSO" For more information, please refer to the MySQL Reference Manual, diff --git a/mysql-wsrep-5.6/man/ndb-common-options.1 b/mysql-wsrep-5.6/man/ndb-common-options.1 index 360f0810..e21c2c34 100644 --- a/mysql-wsrep-5.6/man/ndb-common-options.1 +++ b/mysql-wsrep-5.6/man/ndb-common-options.1 @@ -2,12 +2,12 @@ .\" Title: Options Common to MySQL Cluster Programs .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 01/14/2014 +.\" Date: 01/16/2015 .\" Manual: MySQL Database System .\" Source: MySQL 5.6 .\" Language: English .\" -.TH "OPTIONS COMMON TO MY" "1" "01/14/2014" "MySQL 5\&.6" "MySQL Database System" +.TH "OPTIONS COMMON TO MY" "1" "01/16/2015" "MySQL 5\&.6" "MySQL Database System" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -97,7 +97,7 @@ The options in the following table are common to all MySQL Cluster executables ( .nr an-no-space-flag 1 .nr an-break-flag 1 .br -.B Table\ \&17.30.\ \&Common MySQL Cluster Program Options and Variables: MySQL Cluster NDB 7.3 +.B Table\ \&18.98.\ \& This table describes command-line options common to all MySQL Cluster programs .TS allbox tab(:); lB lB lB. @@ -106,7 +106,7 @@ Format T}:T{ Description T}:T{ -Added / Removed +Added or Removed T} .T& l l l @@ -129,7 +129,7 @@ T}:T{ Display help message and exit T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -139,22 +139,22 @@ T{ .PP -c T}:T{ -Set connection string for connecting to ndb_mgmd\&. Syntax: - [nodeid=;][host=][:]\&. - Overrides entries specified in NDB_CONNECTSTRING or my\&.cnf\&. +Set connection string for connecting to ndb_mgmd. Syntax: + [nodeid=;][host=][:]. + Overrides entries specified in NDB_CONNECTSTRING or my.cnf. T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP --ndb-mgmd-host=host[:port] T}:T{ -Set the host (and port, if desired) for connecting to the management - server +Set the host (and port, if desired) for connecting to management + server T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -163,7 +163,7 @@ T}:T{ Set node id for this node T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -172,26 +172,26 @@ T}:T{ Select nodes for transactions in a more optimal way T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP --character-sets-dir=path T}:T{ -Directory where character sets are +Directory where character sets are installed T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP --debug=options T}:T{ -Enable output from debug calls\&. Can be used only for versions compiled - with debugging enabled +Enable output from debug calls. Can be used only for versions + compiled with debugging enabled T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -200,7 +200,7 @@ T}:T{ Write core on errors (defaults to TRUE in debug builds) T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -211,16 +211,16 @@ T}:T{ Output version information and exit T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} .TE .sp 1 .PP For options specific to individual MySQL Cluster programs, see -Section\ \&17.4, \(lqMySQL Cluster Programs\(rq\&. +Section\ \&18.4, \(lqMySQL Cluster Programs\(rq\&. .PP See -Section\ \&17.3.4.2, \(lqMySQL Server Options for MySQL Cluster\(rq, for +Section\ \&18.3.4.2, \(lqMySQL Server Options for MySQL Cluster\(rq, for \fBmysqld\fR options relating to MySQL Cluster\&. .sp @@ -241,7 +241,6 @@ options relating to MySQL Cluster\&. .TS allbox tab(:); l l s s -l l s s l l s s. T{ \fBCommand\-Line Format\fR @@ -253,11 +252,6 @@ T{ T}:T{ \-\-usage T} -T{ -\ \& -T}:T{ -\-? -T} .TE .sp 1 Prints a short list with descriptions of the available command options\&. @@ -277,8 +271,7 @@ Prints a short list with descriptions of the available command options\&. .TS allbox tab(:); l l s s -l l s s -^ l l s +l l l s ^ l l s. T{ \fBCommand\-Line Format\fR @@ -286,11 +279,8 @@ T}:T{ \-\-character\-sets\-dir=path T} T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ file name @@ -322,9 +312,7 @@ Tells the program where to find character set information\&. allbox tab(:); l l s s l l s s -l l s s -l l s s -^ l l s +l l l s ^ l l s. T{ \fBCommand\-Line Format\fR @@ -337,16 +325,8 @@ T}:T{ \-\-connect\-string=connectstring T} T{ -\ \& -T}:T{ -\-c -T} -T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ string @@ -371,7 +351,7 @@ shell> \fBndbd \-\-ndb\-connectstring="nodeid=2;host=ndb_mgmd\&.mysql\&.com:1186 .\} .sp For more information, see -Section\ \&17.3.2.3, \(lqMySQL Cluster Connection Strings\(rq\&. +Section\ \&18.3.2.3, \(lqMySQL Cluster Connection Strings\(rq\&. .RE .sp .RS 4 @@ -387,8 +367,7 @@ Section\ \&17.3.2.3, \(lqMySQL Cluster Connection Strings\(rq\&. .TS allbox tab(:); l l s s -l l s s -^ l l s +l l l s ^ l l s. T{ \fBCommand\-Line Format\fR @@ -396,11 +375,8 @@ T}:T{ \-\-core\-file T} T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ boolean @@ -440,8 +416,7 @@ is disabled by default\&. .TS allbox tab(:); l l s s -l l s s -^ l l s +l l l s ^ l l s. T{ \fBCommand\-Line Format\fR @@ -449,11 +424,8 @@ T}:T{ \-\-debug=options T} T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ string @@ -483,9 +455,7 @@ process\&. .TS allbox tab(:); l l s s -l l s s -l l s s -^ l l s +l l l s ^ l l s. T{ \fBCommand\-Line Format\fR @@ -493,16 +463,8 @@ T}:T{ \-\-ndb\-mgmd\-host=host[:port] T} T{ -\fBOption\-File Format\fR -T}:T{ -ndb\-mgmd\-host -T} -T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ string @@ -532,8 +494,7 @@ option instead\&. .TS allbox tab(:); l l s s -l l s s -^ l l s +l l l s ^ l l s. T{ \fBCommand\-Line Format\fR @@ -541,11 +502,8 @@ T}:T{ \-\-ndb\-nodeid=# T} T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ numeric @@ -559,7 +517,7 @@ T} .sp 1 Sets this node\*(Aqs MySQL Cluster node ID\&. \fIThe range of permitted values depends on the node\*(Aqs type (data, management, or API) and the MySQL Cluster software version\fR\&. See -Section\ \&17.1.6.2, \(lqLimits and Differences of MySQL Cluster from Standard MySQL Limits\(rq, for more information\&. +Section\ \&18.1.6.2, \(lqLimits and Differences of MySQL Cluster from Standard MySQL Limits\(rq, for more information\&. .RE .sp .RS 4 @@ -575,8 +533,7 @@ Section\ \&17.1.6.2, \(lqLimits and Differences of MySQL Cluster from Standard M .TS allbox tab(:); l l s s -l l s s -^ l l s +l l l s ^ l l s. T{ \fBCommand\-Line Format\fR @@ -584,11 +541,8 @@ T}:T{ \-\-ndb\-optimized\-node\-selection T} T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ boolean @@ -617,29 +571,23 @@ Optimize selection of nodes for transactions\&. Enabled by default\&. \fB\-V\fR .TS allbox tab(:); -l l s s l l s s. T{ \fBCommand\-Line Format\fR T}:T{ \-\-version T} -T{ -\ \& -T}:T{ -\-V -T} .TE .sp 1 Prints the MySQL Cluster version number of the executable\&. The version number is relevant because not all versions can be used together, and the MySQL Cluster startup process verifies that the versions of the binaries being used can co\-exist in the same cluster\&. This is also important when performing an online (rolling) software upgrade or downgrade of MySQL Cluster\&. .sp See -Section\ \&17.5.5, \(lqPerforming a Rolling Restart of a MySQL Cluster\(rq), for more information\&. +Section\ \&18.5.5, \(lqPerforming a Rolling Restart of a MySQL Cluster\(rq), for more information\&. .RE .SH "COPYRIGHT" .br .PP -Copyright \(co 1997, 2014, Oracle and/or its affiliates. All rights reserved. +Copyright \(co 1997, 2015, Oracle and/or its affiliates. All rights reserved. .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/mysql-wsrep-5.6/man/ndb_blob_tool.1 b/mysql-wsrep-5.6/man/ndb_blob_tool.1 index 3249a86d..13a702d5 100644 --- a/mysql-wsrep-5.6/man/ndb_blob_tool.1 +++ b/mysql-wsrep-5.6/man/ndb_blob_tool.1 @@ -2,12 +2,12 @@ .\" Title: \fBndb_blob_tool\fR .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 01/14/2014 +.\" Date: 01/16/2015 .\" Manual: MySQL Database System .\" Source: MySQL 5.6 .\" Language: English .\" -.TH "\FBNDB_BLOB_TOOL\FR" "1" "01/14/2014" "MySQL 5\&.6" "MySQL Database System" +.TH "\FBNDB_BLOB_TOOL\FR" "1" "01/16/2015" "MySQL 5\&.6" "MySQL Database System" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -94,7 +94,7 @@ Options Common to MySQL Cluster Programs(1)\&. .nr an-no-space-flag 1 .nr an-break-flag 1 .br -.B Table\ \&17.14.\ \&ndb_blob_tool Options and Variables: MySQL Cluster NDB 7.3 +.B Table\ \&18.82.\ \& This table describes command-line options for the ndb_blob_tool program .TS allbox tab(:); lB lB lB. @@ -103,7 +103,7 @@ Format T}:T{ Description T}:T{ -Added / Removed +Added or Removed T} .T& l l l @@ -118,7 +118,7 @@ T}:T{ Check for orphan blob parts T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -126,10 +126,10 @@ T{ .PP -d T}:T{ -Database to find the table in\&. +Database to find the table in. T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -138,7 +138,7 @@ T}:T{ Delete orphan blob parts T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -147,7 +147,7 @@ T}:T{ Write orphan keys to specified file T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -158,7 +158,7 @@ T}:T{ Verbose output T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} .TE .sp 1 @@ -177,8 +177,7 @@ T} .TS allbox tab(:); l l s s -l l s s -^ l l s +l l l s ^ l l s. T{ \fBCommand\-Line Format\fR @@ -186,11 +185,8 @@ T}:T{ \-\-check\-orphans T} T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ boolean @@ -220,9 +216,7 @@ Check for orphaned BLOB parts in MySQL Cluster tables\&. .TS allbox tab(:); l l s s -l l s s -l l s s -^ l l s +l l l s ^ l l s. T{ \fBCommand\-Line Format\fR @@ -230,16 +224,8 @@ T}:T{ \-\-database=db_name T} T{ -\ \& -T}:T{ -\-d -T} -T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ string @@ -268,8 +254,7 @@ Specify the database to find the table in\&. .TS allbox tab(:); l l s s -l l s s -^ l l s +l l l s ^ l l s. T{ \fBCommand\-Line Format\fR @@ -277,11 +262,8 @@ T}:T{ \-\-delete\-orphans T} T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ boolean @@ -310,8 +292,7 @@ Remove orphaned BLOB parts from MySQL Cluster tables\&. .TS allbox tab(:); l l s s -l l s s -^ l l s +l l l s ^ l l s. T{ \fBCommand\-Line Format\fR @@ -319,11 +300,8 @@ T}:T{ \-\-dump\-file=file T} T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ file name @@ -353,9 +331,7 @@ Writes a list of orphaned BLOB column parts to .TS allbox tab(:); l l s s -l l s s -l l s s -^ l l s +l l l s ^ l l s. T{ \fBCommand\-Line Format\fR @@ -363,16 +339,8 @@ T}:T{ \-\-verbose T} T{ -\ \& -T}:T{ -\-v -T} -T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ boolean @@ -386,8 +354,7 @@ T} .sp 1 Provide extra information in the tool\*(Aqs output regarding its progress\&. .RE - Example -.PP +Example.PP First we create an NDB table in the @@ -479,11 +446,11 @@ BLOB column parts are created by NDB for this column\&. See -Section\ \&11.6, \(lqData Type Storage Requirements\(rq, for more information\&. +Section\ \&11.7, \(lqData Type Storage Requirements\(rq, for more information\&. .SH "COPYRIGHT" .br .PP -Copyright \(co 1997, 2014, Oracle and/or its affiliates. All rights reserved. +Copyright \(co 1997, 2015, Oracle and/or its affiliates. All rights reserved. .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/mysql-wsrep-5.6/man/ndb_config.1 b/mysql-wsrep-5.6/man/ndb_config.1 index 42cb9b6d..de1958ac 100644 --- a/mysql-wsrep-5.6/man/ndb_config.1 +++ b/mysql-wsrep-5.6/man/ndb_config.1 @@ -2,12 +2,12 @@ .\" Title: \fBndb_config\fR .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 01/14/2014 +.\" Date: 01/16/2015 .\" Manual: MySQL Database System .\" Source: MySQL 5.6 .\" Language: English .\" -.TH "\FBNDB_CONFIG\FR" "1" "01/14/2014" "MySQL 5\&.6" "MySQL Database System" +.TH "\FBNDB_CONFIG\FR" "1" "01/16/2015" "MySQL 5\&.6" "MySQL Database System" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -69,7 +69,7 @@ Options Common to MySQL Cluster Programs(1)\&. .nr an-no-space-flag 1 .nr an-break-flag 1 .br -.B Table\ \&17.15.\ \&ndb_config Options and Variables: MySQL Cluster NDB 7.3 +.B Table\ \&18.83.\ \& This table describes command-line options for the ndb_config program .TS allbox tab(:); lB lB lB. @@ -78,7 +78,7 @@ Format T}:T{ Description T}:T{ -Added / Removed +Added or Removed T} .T& l l l @@ -100,20 +100,20 @@ T{ .PP --nodes T}:T{ -Print node information (DB section) only\&. +Print node information (DB section) only. T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP --connections T}:T{ -Print CONNECTIONS section information only\&. Cannot be used with \-\-nodes - or \-\-system option\&. +Print CONNECTIONS section information only. Cannot be used with + --nodes or --system option. T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -124,7 +124,7 @@ T}:T{ One or more query options (attributes) T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -133,7 +133,7 @@ T}:T{ Specify host T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -142,7 +142,7 @@ T}:T{ Specify node type T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -153,7 +153,7 @@ T}:T{ Get configuration of node with this ID T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -164,7 +164,7 @@ T}:T{ Field separator T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -175,76 +175,76 @@ T}:T{ Row separator T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP --config-file=path T}:T{ -Set the path to config\&.ini file +Set the path to config.ini file T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP --mycnf T}:T{ -Read configuration data from my\&.cnf file +Read configuration data from my.cnf file T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP -c T}:T{ -Short form for \-\-ndb\-connectstring +Short form for --ndb-connectstring T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP --configinfo T}:T{ -Dumps information about all NDB configuration parameters in text format - with default, maximum, and minimum values\&. Use with \-\-xml to - obtain XML output\&. +Dumps information about all NDB configuration parameters in text + format with default, maximum, and minimum values. Use with --xml + to obtain XML output. T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP --configinfo --xml T}:T{ -Use \-\-xml with \-\-configinfo to obtain a dump of all NDB configuration - parameters in XML format with default, maximum, and minimum - values\&. +Use --xml with --configinfo to obtain a dump of all NDB + configuration parameters in XML format with default, maximum, and + minimum values. T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP --system T}:T{ -Print SYSTEM section information only\&. Cannot be used with \-\-nodes or - \-\-connections option\&. +Print SYSTEM section information only. Cannot be used with --nodes + or --connections option. T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP --config_from_node=# T}:T{ -Obtain configuration data from the node having this ID (must be a data - node)\&. +Obtain configuration data from the node having this ID (must be a + data node). T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} .TE .sp 1 @@ -265,7 +265,6 @@ T} .TS allbox tab(:); l l s s -l l s s l l s s. T{ \fBCommand\-Line Format\fR @@ -277,11 +276,6 @@ T{ T}:T{ \-\-usage T} -T{ -\ \& -T}:T{ -\-? -T} .TE .sp 1 Causes @@ -303,7 +297,7 @@ to print a list of available options, and then exit\&. .TS allbox tab(:); l l s s -l l s s +l l l s ^ l l s ^ l l s ^ l l s. @@ -313,11 +307,8 @@ T}:T{ \-\-config_from_node=# T} T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ numeric @@ -328,9 +319,14 @@ T}:T{ none T} :T{ -\fBRange\fR +\fBMin Value\fR +T}:T{ +1 +T} +:T{ +\fBMax Value\fR T}:T{ -1 \&.\&. 48 +48 T} .TE .sp 1 @@ -355,18 +351,12 @@ fails with an error\&. (To obtain configuration data from the management node in \fB\-V\fR .TS allbox tab(:); -l l s s l l s s. T{ \fBCommand\-Line Format\fR T}:T{ \-\-version T} -T{ -\ \& -T}:T{ -\-V -T} .TE .sp 1 Causes @@ -390,9 +380,7 @@ to print a version information string, and then exit\&. allbox tab(:); l l s s l l s s -l l s s -l l s s -^ l l s +l l l s ^ l l s. T{ \fBCommand\-Line Format\fR @@ -405,16 +393,8 @@ T}:T{ \-\-connect\-string=connectstring T} T{ -\ \& -T}:T{ -\-c -T} -T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ string @@ -427,7 +407,7 @@ T} .TE .sp 1 Specifies the connection string to use in connecting to the management server\&. The format for the connection string is the same as described in -Section\ \&17.3.2.3, \(lqMySQL Cluster Connection Strings\(rq, and defaults to +Section\ \&18.3.2.3, \(lqMySQL Cluster Connection Strings\(rq, and defaults to localhost:1186\&. .RE .sp @@ -445,8 +425,7 @@ localhost:1186\&. .TS allbox tab(:); l l s s -l l s s -^ l l s +l l l s ^ l l s. T{ \fBCommand\-Line Format\fR @@ -454,11 +433,8 @@ T}:T{ \-\-config\-file=path T} T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ file name @@ -488,8 +464,7 @@ is invoked, then an absolute path must be used\&. .TS allbox tab(:); l l s s -l l s s -^ l l s +l l l s ^ l l s. T{ \fBCommand\-Line Format\fR @@ -497,11 +472,8 @@ T}:T{ \-\-mycnf T} T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ boolean @@ -534,9 +506,7 @@ file\&. .TS allbox tab(:); l l s s -l l s s -l l s s -^ l l s +l l l s ^ l l s. T{ \fBCommand\-Line Format\fR @@ -544,16 +514,8 @@ T}:T{ \-\-query=string T} T{ -\ \& -T}:T{ -\-q -T} -T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ string @@ -611,8 +573,7 @@ If a given parameter is not applicable to a certain type of node, than an empty .TS allbox tab(:); l l s s -l l s s -^ l l s +l l l s ^ l l s. T{ \fBCommand\-Line Format\fR @@ -620,11 +581,8 @@ T}:T{ \-\-host=name T} T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ string @@ -686,8 +644,7 @@ in the same fashion\&. .TS allbox tab(:); l l s s -l l s s -^ l l s +l l l s ^ l l s. T{ \fBCommand\-Line Format\fR @@ -695,11 +652,8 @@ T}:T{ \-\-ndb\-nodeid=# T} T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ numeric @@ -730,8 +684,7 @@ is the preferred form\&. .TS allbox tab(:); l l s s -l l s s -^ l l s +l l l s ^ l l s. T{ \fBCommand\-Line Format\fR @@ -739,11 +692,8 @@ T}:T{ \-\-nodes T} T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ boolean @@ -779,8 +729,7 @@ or .TS allbox tab(:); l l s s -l l s s -^ l l s +l l l s ^ l l s. T{ \fBCommand\-Line Format\fR @@ -788,11 +737,8 @@ T}:T{ \-\-connections T} T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ boolean @@ -828,8 +774,7 @@ or .TS allbox tab(:); l l s s -l l s s -^ l l s +l l l s ^ l l s. T{ \fBCommand\-Line Format\fR @@ -837,11 +782,8 @@ T}:T{ \-\-system T} T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ boolean @@ -880,8 +822,7 @@ options\&. .TS allbox tab(:); l l s s -l l s s -^ l l s +l l l s ^ l l s ^ lt l s ^ ^ l s @@ -892,11 +833,8 @@ T}:T{ \-\-type=name T} T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ enumeration @@ -904,6 +842,7 @@ T} :T{ \fBDefault\fR T}:T{ +[none] T} :T{ \fBValid Values\fR @@ -941,9 +880,7 @@ ndb_mgmd) are returned\&. .TS allbox tab(:); l l s s -l l s s -l l s s -^ l l s +l l l s ^ l l s. T{ \fBCommand\-Line Format\fR @@ -951,16 +888,8 @@ T}:T{ \-\-fields=string T} T{ -\ \& -T}:T{ -\-f -T} -T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ string @@ -1013,9 +942,7 @@ for the linefeed character), then it must be quoted\&. .TS allbox tab(:); l l s s -l l s s -l l s s -^ l l s +l l l s ^ l l s. T{ \fBCommand\-Line Format\fR @@ -1023,16 +950,8 @@ T}:T{ \-\-rows=string T} T{ -\ \& -T}:T{ -\-r -T} -T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ string @@ -1192,8 +1111,7 @@ Default: 0 (Min: 0, Max: 4294967039) .TS allbox tab(:); l l s s -l l s s -^ l l s +l l l s ^ l l s. T{ \fBCommand\-Line Format\fR @@ -1201,11 +1119,8 @@ T}:T{ \-\-configinfo \-\-xml T} T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ boolean @@ -1229,7 +1144,7 @@ option\&. A portion of the resulting output is shown in this example: .\} .nf shell> \fBndb_config \-\-configinfo \-\-xml\fR -
@@ -1383,7 +1298,7 @@ with \fB\-\-configinfo\fR serves no purpose\&. .RE - Examples +Examples .sp .RS 4 .ie n \{\ @@ -1520,7 +1435,7 @@ option\&. .SH "COPYRIGHT" .br .PP -Copyright \(co 1997, 2014, Oracle and/or its affiliates. All rights reserved. +Copyright \(co 1997, 2015, Oracle and/or its affiliates. All rights reserved. .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/mysql-wsrep-5.6/man/ndb_cpcd.1 b/mysql-wsrep-5.6/man/ndb_cpcd.1 index 5d7c275f..c1b5d680 100644 --- a/mysql-wsrep-5.6/man/ndb_cpcd.1 +++ b/mysql-wsrep-5.6/man/ndb_cpcd.1 @@ -2,12 +2,12 @@ .\" Title: \fBndb_cpcd\fR .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 01/14/2014 +.\" Date: 01/16/2015 .\" Manual: MySQL Database System .\" Source: MySQL 5.6 .\" Language: English .\" -.TH "\FBNDB_CPCD\FR" "1" "01/14/2014" "MySQL 5\&.6" "MySQL Database System" +.TH "\FBNDB_CPCD\FR" "1" "01/16/2015" "MySQL 5\&.6" "MySQL Database System" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -39,7 +39,7 @@ A utility having this name was formerly part of an internal automated test frame .SH "COPYRIGHT" .br .PP -Copyright \(co 1997, 2014, Oracle and/or its affiliates. All rights reserved. +Copyright \(co 1997, 2015, Oracle and/or its affiliates. All rights reserved. .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/mysql-wsrep-5.6/man/ndb_delete_all.1 b/mysql-wsrep-5.6/man/ndb_delete_all.1 index 8224b3f3..cb1a796b 100644 --- a/mysql-wsrep-5.6/man/ndb_delete_all.1 +++ b/mysql-wsrep-5.6/man/ndb_delete_all.1 @@ -2,12 +2,12 @@ .\" Title: \fBndb_delete_all\fR .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 01/14/2014 +.\" Date: 01/16/2015 .\" Manual: MySQL Database System .\" Source: MySQL 5.6 .\" Language: English .\" -.TH "\FBNDB_DELETE_ALL\FR" "1" "01/14/2014" "MySQL 5\&.6" "MySQL Database System" +.TH "\FBNDB_DELETE_ALL\FR" "1" "01/16/2015" "MySQL 5\&.6" "MySQL Database System" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -42,7 +42,7 @@ table\&. In some cases, this can be much faster than DELETE or even TRUNCATE TABLE\&. - Usage +Usage .sp .if n \{\ .RS 4 @@ -70,7 +70,7 @@ Options Common to MySQL Cluster Programs(1)\&. .nr an-no-space-flag 1 .nr an-break-flag 1 .br -.B Table\ \&17.16.\ \&ndb_delete_all Options and Variables: MySQL Cluster NDB 7.3 +.B Table\ \&18.84.\ \& This table describes command-line options for the ndb_delete_all program .TS allbox tab(:); lB lB lB. @@ -79,7 +79,7 @@ Format T}:T{ Description T}:T{ -Added / Removed +Added or Removed T} .T& l l l @@ -88,14 +88,14 @@ l l l l l l. T{ .PP -\-\-database=dbname, +--database=dbname, .PP -\-d +-d T}:T{ Name of the database in which the table is found T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -103,28 +103,29 @@ T{ .PP -t T}:T{ -Perform the delete in a single transaction (may run out of operations) +Perform the delete in a single transaction (may run out of + operations) T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP -\-\-tupscan +--tupscan T}:T{ Run tup scan T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP -\-\-diskscan +--diskscan T}:T{ Run disk scan T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} .TE .sp 1 @@ -162,7 +163,7 @@ With very large tables, using this option may cause the number of operations ava .SH "COPYRIGHT" .br .PP -Copyright \(co 1997, 2014, Oracle and/or its affiliates. All rights reserved. +Copyright \(co 1997, 2015, Oracle and/or its affiliates. All rights reserved. .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/mysql-wsrep-5.6/man/ndb_desc.1 b/mysql-wsrep-5.6/man/ndb_desc.1 index 7e71ede5..197054f8 100644 --- a/mysql-wsrep-5.6/man/ndb_desc.1 +++ b/mysql-wsrep-5.6/man/ndb_desc.1 @@ -2,12 +2,12 @@ .\" Title: \fBndb_desc\fR .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 01/14/2014 +.\" Date: 01/16/2015 .\" Manual: MySQL Database System .\" Source: MySQL 5.6 .\" Language: English .\" -.TH "\FBNDB_DESC\FR" "1" "01/14/2014" "MySQL 5\&.6" "MySQL Database System" +.TH "\FBNDB_DESC\FR" "1" "01/16/2015" "MySQL 5\&.6" "MySQL Database System" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -39,7 +39,7 @@ ndb_desc \- describe NDB tables provides a detailed description of one or more NDB tables\&. - Usage +Usage .sp .if n \{\ .RS 4 @@ -52,8 +52,7 @@ ndb_desc \-c \fIconnect_string\fR \fIindex_name\fR \-d \fIdb_name\fR \-t \fItbl_ .RE .\} .sp - Sample Output -.PP +Sample Output.PP MySQL table creation and population statements: .sp .if n \{\ @@ -228,7 +227,7 @@ ALTER TABLESPACE ts_1 .\} .PP (For more information on the statements just shown and the objects created by them, see -Section\ \&17.5.12.1, \(lqMySQL Cluster Disk Data Objects\(rq, as well as +Section\ \&18.5.12.1, \(lqMySQL Cluster Disk Data Objects\(rq, as well as Section\ \&13.1.14, \(lqCREATE LOGFILE GROUP Syntax\(rq, and Section\ \&13.1.18, \(lqCREATE TABLESPACE Syntax\(rq\&.) .PP @@ -323,7 +322,7 @@ Options Common to MySQL Cluster Programs(1)\&. .nr an-no-space-flag 1 .nr an-break-flag 1 .br -.B Table\ \&17.17.\ \&ndb_desc Options and Variables: MySQL Cluster NDB 7.3 +.B Table\ \&18.85.\ \& This table describes command-line options for the ndb_desc program .TS allbox tab(:); lB lB lB. @@ -332,7 +331,7 @@ Format T}:T{ Description T}:T{ -Added / Removed +Added or Removed T} .T& l l l @@ -348,11 +347,11 @@ T{ .PP -b T}:T{ -Include partition information for BLOB tables in output\&. Requires that - the \-p option also be used +Include partition information for BLOB tables in output. Requires + that the -p option also be used T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -363,7 +362,7 @@ T}:T{ Name of database containing table T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -371,11 +370,11 @@ T{ .PP -n T}:T{ -Include partition\-to\-data\-node mappings in output\&. Requires that the \-p - option also be used +Include partition-to-data-node mappings in output. Requires that + the -p option also be used T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -386,7 +385,7 @@ T}:T{ Display information about partitions T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -397,7 +396,7 @@ T}:T{ Number of times to retry the connection (once per second) T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -405,11 +404,11 @@ T{ .PP -t T}:T{ -Specify the table in which to find an index\&. When this option is used, - \-p and \-n have no effect and are ignored\&. +Specify the table in which to find an index. When this option is + used, -p and -n have no effect and are ignored. T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -420,7 +419,7 @@ T}:T{ Use unqualified table names T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} .TE .sp 1 @@ -551,7 +550,7 @@ Use unqualified table names\&. .SH "COPYRIGHT" .br .PP -Copyright \(co 1997, 2014, Oracle and/or its affiliates. All rights reserved. +Copyright \(co 1997, 2015, Oracle and/or its affiliates. All rights reserved. .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/mysql-wsrep-5.6/man/ndb_drop_index.1 b/mysql-wsrep-5.6/man/ndb_drop_index.1 index d8355945..a468fa99 100644 --- a/mysql-wsrep-5.6/man/ndb_drop_index.1 +++ b/mysql-wsrep-5.6/man/ndb_drop_index.1 @@ -2,12 +2,12 @@ .\" Title: \fBndb_drop_index\fR .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 01/14/2014 +.\" Date: 01/16/2015 .\" Manual: MySQL Database System .\" Source: MySQL 5.6 .\" Language: English .\" -.TH "\FBNDB_DROP_INDEX\FR" "1" "01/14/2014" "MySQL 5\&.6" "MySQL Database System" +.TH "\FBNDB_DROP_INDEX\FR" "1" "01/16/2015" "MySQL 5\&.6" "MySQL Database System" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -40,7 +40,7 @@ drops the specified index from an NDB table\&. \fIIt is recommended that you use this utility only as an example for writing NDB API applications\fR\(emsee the Warning later in this section for details\&. - Usage +Usage .sp .if n \{\ .RS 4 @@ -68,7 +68,7 @@ Options Common to MySQL Cluster Programs(1)\&. .nr an-no-space-flag 1 .nr an-break-flag 1 .br -.B Table\ \&17.18.\ \&ndb_drop_index Options and Variables: MySQL Cluster NDB 7.3 +.B Table\ \&18.86.\ \& This table describes command-line options for the ndb_drop_index program .TS allbox tab(:); lB lB lB. @@ -77,20 +77,20 @@ Format T}:T{ Description T}:T{ -Added / Removed +Added or Removed T} .T& l l l. T{ .PP -\-\-database=dbname, +--database=dbname, .PP -\-d +-d T}:T{ Name of the database in which the table is found T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} .TE .sp 1 @@ -123,7 +123,7 @@ Enter password: ******* Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with \-A Welcome to the MySQL monitor\&. Commands end with ; or \eg\&. -Your MySQL connection id is 7 to server version: 5\&.6\&.14\-ndb\-7\&.3\&.4 +Your MySQL connection id is 7 to server version: 5\&.6\&.22\-ndb\-7\&.3\&.9 Type \*(Aqhelp;\*(Aq or \*(Aq\eh\*(Aq for help\&. Type \*(Aq\ec\*(Aq to clear the buffer\&. mysql> \fBSHOW TABLES;\fR +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ @@ -154,7 +154,7 @@ utility (see .SH "COPYRIGHT" .br .PP -Copyright \(co 1997, 2014, Oracle and/or its affiliates. All rights reserved. +Copyright \(co 1997, 2015, Oracle and/or its affiliates. All rights reserved. .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/mysql-wsrep-5.6/man/ndb_drop_table.1 b/mysql-wsrep-5.6/man/ndb_drop_table.1 index b212fa5e..7c73fcd5 100644 --- a/mysql-wsrep-5.6/man/ndb_drop_table.1 +++ b/mysql-wsrep-5.6/man/ndb_drop_table.1 @@ -2,12 +2,12 @@ .\" Title: \fBndb_drop_table\fR .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 01/14/2014 +.\" Date: 01/16/2015 .\" Manual: MySQL Database System .\" Source: MySQL 5.6 .\" Language: English .\" -.TH "\FBNDB_DROP_TABLE\FR" "1" "01/14/2014" "MySQL 5\&.6" "MySQL Database System" +.TH "\FBNDB_DROP_TABLE\FR" "1" "01/16/2015" "MySQL 5\&.6" "MySQL Database System" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -45,7 +45,7 @@ DROP TABLE statement on an NDB table\&. - Usage +Usage .sp .if n \{\ .RS 4 @@ -66,7 +66,7 @@ Options Common to MySQL Cluster Programs(1)\&. .nr an-no-space-flag 1 .nr an-break-flag 1 .br -.B Table\ \&17.19.\ \&ndb_drop_table Options and Variables: MySQL Cluster NDB 7.3 +.B Table\ \&18.87.\ \& This table describes command-line options for the ndb_drop_table program .TS allbox tab(:); lB lB lB. @@ -75,27 +75,27 @@ Format T}:T{ Description T}:T{ -Added / Removed +Added or Removed T} .T& l l l. T{ .PP -\-\-database=dbname, +--database=dbname, .PP -\-d +-d T}:T{ Name of the database in which the table is found T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} .TE .sp 1 .SH "COPYRIGHT" .br .PP -Copyright \(co 1997, 2014, Oracle and/or its affiliates. All rights reserved. +Copyright \(co 1997, 2015, Oracle and/or its affiliates. All rights reserved. .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/mysql-wsrep-5.6/man/ndb_error_reporter.1 b/mysql-wsrep-5.6/man/ndb_error_reporter.1 index cb9ff9f1..07c5c686 100644 --- a/mysql-wsrep-5.6/man/ndb_error_reporter.1 +++ b/mysql-wsrep-5.6/man/ndb_error_reporter.1 @@ -2,12 +2,12 @@ .\" Title: \fBndb_error_reporter\fR .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 01/14/2014 +.\" Date: 01/16/2015 .\" Manual: MySQL Database System .\" Source: MySQL 5.6 .\" Language: English .\" -.TH "\FBNDB_ERROR_REPORTE" "1" "01/14/2014" "MySQL 5\&.6" "MySQL Database System" +.TH "\FBNDB_ERROR_REPORTE" "1" "01/16/2015" "MySQL 5\&.6" "MySQL Database System" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -58,7 +58,7 @@ options were also added in this release (Bug #16602002)\&. .nr an-no-space-flag 1 .nr an-break-flag 1 .br -.B Table\ \&17.20.\ \&ndb_error_reporter Options and Variables: MySQL Cluster NDB 7.3 +.B Table\ \&18.88.\ \& This table describes command-line options for the ndb_error_reporter program .TS allbox tab(:); lB lB lB. @@ -67,7 +67,7 @@ Format T}:T{ Description T}:T{ -Added / Removed +Added or Removed T} .T& l l l @@ -78,42 +78,43 @@ T{ .PP --connection-timeout=timeout T}:T{ -Number of seconds to wait when connecting to nodes before timing out\&. +Number of seconds to wait when connecting to nodes before timing + out. T}:T{ .PP -ADDED: NDB 7\&.3\&.3 +ADDED: NDB 7.3.3 T} T{ .PP --dry-scp T}:T{ -Disable scp with remote hosts; used only for testing\&. +Disable scp with remote hosts; used only for testing. T}:T{ .PP -ADDED: NDB 7\&.3\&.3 +ADDED: NDB 7.3.3 T} T{ .PP --fs T}:T{ -Include file system data in error report; can use a large amount of disk - space +Include file system data in error report; can use a large amount + of disk space T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP --skip-nodegroup=nodegroup_id T}:T{ -Skip all nodes in the node group having this ID\&. +Skip all nodes in the node group having this ID. T}:T{ .PP -ADDED: NDB 7\&.3\&.3 +ADDED: NDB 7.3.3 T} .TE .sp 1 - Usage +Usage .sp .if n \{\ .RS 4 @@ -151,8 +152,7 @@ also accepts the options listed here: allbox tab(:); l l s s l l s s -l l s s -^ l l s +l l l s ^ l l s. T{ \fBIntroduced\fR @@ -165,11 +165,8 @@ T}:T{ \-\-connection\-timeout=timeout T} T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ integer @@ -198,8 +195,7 @@ Wait this many seconds when trying to connect to nodes before timing out\&. allbox tab(:); l l s s l l s s -l l s s -^ l l s +l l l s ^ l l s. T{ \fBIntroduced\fR @@ -212,11 +208,8 @@ T}:T{ \-\-dry\-scp T} T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ boolean @@ -246,8 +239,7 @@ without using scp from remote hosts\&. Used for testing only\&. .TS allbox tab(:); l l s s -l l s s -^ l l s +l l l s ^ l l s. T{ \fBCommand\-Line Format\fR @@ -255,11 +247,8 @@ T}:T{ \-\-fs T} T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ boolean @@ -292,8 +281,7 @@ send archives created using this option to Oracle unless you are specifically re allbox tab(:); l l s s l l s s -l l s s -^ l l s +l l l s ^ l l s. T{ \fBIntroduced\fR @@ -306,11 +294,8 @@ T}:T{ \-\-connection\-timeout=timeout T} T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ integer @@ -327,7 +312,7 @@ Skip all nodes belong to the node group having the supplied node group ID\&. .SH "COPYRIGHT" .br .PP -Copyright \(co 1997, 2014, Oracle and/or its affiliates. All rights reserved. +Copyright \(co 1997, 2015, Oracle and/or its affiliates. All rights reserved. .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/mysql-wsrep-5.6/man/ndb_index_stat.1 b/mysql-wsrep-5.6/man/ndb_index_stat.1 index b08a819e..6e5ed099 100644 --- a/mysql-wsrep-5.6/man/ndb_index_stat.1 +++ b/mysql-wsrep-5.6/man/ndb_index_stat.1 @@ -2,12 +2,12 @@ .\" Title: \fBndb_index_stat\fR .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 01/14/2014 +.\" Date: 01/16/2015 .\" Manual: MySQL Database System .\" Source: MySQL 5.6 .\" Language: English .\" -.TH "\FBNDB_INDEX_STAT\FR" "1" "01/14/2014" "MySQL 5\&.6" "MySQL Database System" +.TH "\FBNDB_INDEX_STAT\FR" "1" "01/16/2015" "MySQL 5\&.6" "MySQL Database System" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -36,9 +36,10 @@ ndb_index_stat \- NDB index statistics utility .SH "DESCRIPTION" .PP \fBndb_index_stat\fR -\&.\&.\&. - Usage -.PP +provides per\-fragment statistical information about indexes on +NDB +tables\&. This includes cache version and age, number of index entries per partition, and memory consumption by indexes\&. +Usage.PP To obtain basic index statistics about a given NDB table, invoke @@ -66,22 +67,71 @@ mytable in the test database: +.\" ndb_index_stat: interpreting output +.\" ndb_index_stat: example .sp .if n \{\ .RS 4 .\} .nf shell> \fBndb_index_stat \-d test mytable\fR -table:mytable index:PRIMARY fragCount:4 -sampleVersion:2 loadTime:1336751773 sampleCount:0 keyBytes:0 -query cache: valid:1 sampleCount:0 totalBytes:0 -times in ms: save: 12\&.380 sort: 0\&.001 +table:City index:PRIMARY fragCount:2 +sampleVersion:3 loadTime:1399585986 sampleCount:1994 keyBytes:7976 +query cache: valid:1 sampleCount:1994 totalBytes:27916 +times in ms: save: 7\&.133 sort: 1\&.974 sort per sample: 0\&.000 NDBT_ProgramExit: 0 \- OK .fi .if n \{\ .RE .\} .PP +sampleVersion +is the version number of the cache from which the statistics data is taken\&. Running +\fBndb_index_stat\fR +with the +\fB\-\-update\fR +option causes sampleVersion to be incremented\&. +.PP +loadTime +shows when the cache was last updated\&. This is expressed as seconds since the Unix Epoch\&. +.PP +sampleCount +is the number of index entries found per partition\&. You can estimate the total number of entries by multiplying this by the number of fragments (shown as +fragCount)\&. +.PP +sampleCount +can be compared with the cardinality of +SHOW INDEX +or +INFORMATION_SCHEMA\&.STATISTICS, although the latter two provide a view of the table as a whole, while +\fBndb_index_stat\fR +provides a per\-fragment average\&. +.PP +keyBytes +is the number of bytes used by the index\&. In this example, the primary key is an integer, which requires four bytes for each index, so +keyBytes +can be calculated in this case as shown here: +.sp +.if n \{\ +.RS 4 +.\} +.nf + keyBytes = sampleCount * (4 bytes per index) = 1994 * 4 = 7976 +.fi +.if n \{\ +.RE +.\} +.PP +This information can also be obtained using the corresponding column definitions from +INFORMATION_SCHEMA\&.COLUMNS +(this requires a MySQL Server and a MySQL client application)\&. +.PP +totalBytes +is the total memory consumed by all indexes on the table, in bytes\&. +.PP +Timings shown in the preceding examples are specific to each invocation of +\fBndb_index_stat\fR\&. +.PP The \fB\-\-verbose\fR option provides some additional output, as shown here: @@ -108,8 +158,7 @@ shell> .RE .\} .sp - Options -.PP +Options.PP The following table includes options that are specific to the MySQL Cluster \fBndb_index_stat\fR utility\&. Additional descriptions are listed following the table\&. For options common to most MySQL Cluster programs (including @@ -120,7 +169,7 @@ Options Common to MySQL Cluster Programs(1)\&. .nr an-no-space-flag 1 .nr an-break-flag 1 .br -.B Table\ \&17.21.\ \&ndb_index_stat Options and Variables: MySQL Cluster NDB 7.3 +.B Table\ \&18.89.\ \& This table describes command-line options for the ndb_index_stat program .TS allbox tab(:); lB lB lB. @@ -129,7 +178,7 @@ Format T}:T{ Description T}:T{ -Added / Removed +Added or Removed T} .T& l l l @@ -148,146 +197,146 @@ l l l l l l. T{ .PP -\-\-database=name, +--database=name, .PP -\-d +-d T}:T{ -Name of the database containing the table\&. +Name of the database containing the table. T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP -\-\-delete +--delete T}:T{ -Delete index statistics for the given table, stopping any auto\-update - previously configured\&. +Delete index statistics for the given table, stopping any + auto-update previously configured. T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP -\-\-update +--update T}:T{ -Update index statistics for the given table, restarting any auto\-update - previously configured\&. +Update index statistics for the given table, restarting any + auto-update previously configured. T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP -\-\-dump +--dump T}:T{ -Print the query cache\&. +Print the query cache. T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP -\-\-query=# +--query=# T}:T{ -Perform a number of random range queries on first key attr (must be int - unsigned)\&. +Perform a number of random range queries on first key attr (must + be int unsigned). T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP -\-\-sys\-drop +--sys-drop T}:T{ -Drop any statistics tables and events in NDB kernel (all statistics are - lost) +Drop any statistics tables and events in NDB kernel (all + statistics are lost) T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP -\-\-sys\-create +--sys-create T}:T{ -Create all statistics tables and events in NDB kernel, if none of them - already exist +Create all statistics tables and events in NDB kernel, if none of + them already exist T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP -\-\-sys\-create\-if\-not\-exist +--sys-create-if-not-exist T}:T{ Create any statistics tables and events in NDB kernel that do not - already exist\&. + already exist. T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP -\-\-sys\-create\-if\-not\-valid +--sys-create-if-not-valid T}:T{ -Create any statistics tables or events that do not already exist in the - NDB kernel\&. after dropping any that are invalid\&. +Create any statistics tables or events that do not already exist + in the NDB kernel. after dropping any that are invalid. T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP -\-\-sys\-check +--sys-check T}:T{ -Verify that NDB system index statistics and event tables exist\&. +Verify that NDB system index statistics and event tables exist. T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP -\-\-sys\-skip\-tables +--sys-skip-tables T}:T{ -Do not apply sys\-* options to tables\&. +Do not apply sys-* options to tables. T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP -\-\-sys\-skip\-events +--sys-skip-events T}:T{ -Do not apply sys\-* options to events\&. +Do not apply sys-* options to events. T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP -\-\-verbose, +--verbose, .PP -\-v +-v T}:T{ Turn on verbose output T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP -\-\-loops=# +--loops=# T}:T{ -Set the number of times to perform a given command\&. Default is 0\&. +Set the number of times to perform a given command. Default is 0. T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} .TE .sp 1 .PP -\fBndb_index_stat statistics options\fR. The following options are used to generate index statistics\&. They work with a given table and database\&. They cannot be mixed with -ndb_index_stat system options\&. +\fBndb_index_stat statistics options\fR. The following options are used to generate index statistics\&. They work with a given table and database\&. They cannot be mixed with system options (see +ndb_index_stat system options)\&. .sp .RS 4 .ie n \{\ @@ -304,8 +353,7 @@ ndb_index_stat system options\&. .TS allbox tab(:); l l s s -l l s s -l l s s +l l l s ^ l l s ^ l l s ^ l l s. @@ -315,16 +363,8 @@ T}:T{ \-\-database=name T} T{ -\ \& -T}:T{ -\-d -T} -T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ string @@ -335,9 +375,12 @@ T}:T{ [none] T} :T{ -\fBRange\fR +\fBMin Value\fR +T}:T{ +T} +:T{ +\fBMax Value\fR T}:T{ -\&.\&. T} .TE .sp 1 @@ -357,7 +400,7 @@ The name of the database that contains the table being queried\&. .TS allbox tab(:); l l s s -l l s s +l l l s ^ l l s ^ l l s ^ l l s. @@ -367,11 +410,8 @@ T}:T{ \-\-delete T} T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ boolean @@ -379,12 +419,15 @@ T} :T{ \fBDefault\fR T}:T{ -true +false T} :T{ -\fBRange\fR +\fBMin Value\fR +T}:T{ +T} +:T{ +\fBMax Value\fR T}:T{ -\&.\&. T} .TE .sp 1 @@ -404,7 +447,7 @@ Delete the index statistics for the given table, stopping any auto\-update that .TS allbox tab(:); l l s s -l l s s +l l l s ^ l l s ^ l l s ^ l l s. @@ -414,11 +457,8 @@ T}:T{ \-\-update T} T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ boolean @@ -426,16 +466,19 @@ T} :T{ \fBDefault\fR T}:T{ -true +false +T} +:T{ +\fBMin Value\fR +T}:T{ T} :T{ -\fBRange\fR +\fBMax Value\fR T}:T{ -\&.\&. T} .TE .sp 1 -Update the index statistics for the given table, and restart any auto\-update that previously configured\&. +Update the index statistics for the given table, and restart any auto\-update that was previously configured\&. .RE .sp .RS 4 @@ -451,7 +494,7 @@ Update the index statistics for the given table, and restart any auto\-update th .TS allbox tab(:); l l s s -l l s s +l l l s ^ l l s ^ l l s ^ l l s. @@ -461,11 +504,8 @@ T}:T{ \-\-dump T} T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ boolean @@ -473,12 +513,15 @@ T} :T{ \fBDefault\fR T}:T{ -true +false T} :T{ -\fBRange\fR +\fBMin Value\fR +T}:T{ +T} +:T{ +\fBMax Value\fR T}:T{ -\&.\&. T} .TE .sp 1 @@ -498,7 +541,7 @@ Dump the contents of the query cache\&. .TS allbox tab(:); l l s s -l l s s +l l l s ^ l l s ^ l l s ^ l l s. @@ -508,11 +551,8 @@ T}:T{ \-\-query=# T} T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ numeric @@ -523,17 +563,22 @@ T}:T{ 0 T} :T{ -\fBRange\fR +\fBMin Value\fR +T}:T{ +0 +T} +:T{ +\fBMax Value\fR T}:T{ -0 \&.\&. MAX_INT +MAX_INT T} .TE .sp 1 Perform random range queries on first key attribute (must be int unsigned)\&. .RE .PP -\fBndb_index_stat system options\fR. The following options are used to generate and update the statistics tables in the NDB kernel\&. They cannot be mixed with -ndb_index_stat statistics options\&. +\fBndb_index_stat system options\fR. The following options are used to generate and update the statistics tables in the NDB kernel\&. None of these options can be mixed with statistics options (see +ndb_index_stat statistics options)\&. .sp .RS 4 .ie n \{\ @@ -548,7 +593,7 @@ ndb_index_stat statistics options\&. .TS allbox tab(:); l l s s -l l s s +l l l s ^ l l s ^ l l s ^ l l s. @@ -558,11 +603,8 @@ T}:T{ \-\-sys\-drop T} T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ boolean @@ -570,12 +612,15 @@ T} :T{ \fBDefault\fR T}:T{ -true +false +T} +:T{ +\fBMin Value\fR +T}:T{ T} :T{ -\fBRange\fR +\fBMax Value\fR T}:T{ -\&.\&. T} .TE .sp 1 @@ -596,7 +641,7 @@ Drop all statistics tables and events in the NDB kernel\&. .TS allbox tab(:); l l s s -l l s s +l l l s ^ l l s ^ l l s ^ l l s. @@ -606,11 +651,8 @@ T}:T{ \-\-sys\-create T} T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ boolean @@ -618,12 +660,15 @@ T} :T{ \fBDefault\fR T}:T{ -true +false T} :T{ -\fBRange\fR +\fBMin Value\fR +T}:T{ +T} +:T{ +\fBMax Value\fR T}:T{ -\&.\&. T} .TE .sp 1 @@ -643,7 +688,7 @@ Create all statistics tables and events in the NDB kernel\&. This works only if .TS allbox tab(:); l l s s -l l s s +l l l s ^ l l s ^ l l s ^ l l s. @@ -653,11 +698,8 @@ T}:T{ \-\-sys\-create\-if\-not\-exist T} T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ boolean @@ -665,12 +707,15 @@ T} :T{ \fBDefault\fR T}:T{ -true +false +T} +:T{ +\fBMin Value\fR +T}:T{ T} :T{ -\fBRange\fR +\fBMax Value\fR T}:T{ -\&.\&. T} .TE .sp 1 @@ -690,7 +735,7 @@ Create any NDB system statistics tables or events (or both) that do not already .TS allbox tab(:); l l s s -l l s s +l l l s ^ l l s ^ l l s ^ l l s. @@ -700,11 +745,8 @@ T}:T{ \-\-sys\-create\-if\-not\-valid T} T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ boolean @@ -712,12 +754,15 @@ T} :T{ \fBDefault\fR T}:T{ -true +false +T} +:T{ +\fBMin Value\fR +T}:T{ T} :T{ -\fBRange\fR +\fBMax Value\fR T}:T{ -\&.\&. T} .TE .sp 1 @@ -737,7 +782,7 @@ Create any NDB system statistics tables or events that do not already exist, aft .TS allbox tab(:); l l s s -l l s s +l l l s ^ l l s ^ l l s ^ l l s. @@ -747,11 +792,8 @@ T}:T{ \-\-sys\-check T} T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ boolean @@ -759,12 +801,15 @@ T} :T{ \fBDefault\fR T}:T{ -true +false T} :T{ -\fBRange\fR +\fBMin Value\fR +T}:T{ +T} +:T{ +\fBMax Value\fR T}:T{ -\&.\&. T} .TE .sp 1 @@ -784,7 +829,7 @@ Verify that all required system statistics tables and events exist in the NDB ke .TS allbox tab(:); l l s s -l l s s +l l l s ^ l l s ^ l l s ^ l l s. @@ -794,11 +839,8 @@ T}:T{ \-\-sys\-skip\-tables T} T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ boolean @@ -806,12 +848,15 @@ T} :T{ \fBDefault\fR T}:T{ -true +false +T} +:T{ +\fBMin Value\fR +T}:T{ T} :T{ -\fBRange\fR +\fBMax Value\fR T}:T{ -\&.\&. T} .TE .sp 1 @@ -833,7 +878,7 @@ options to any statistics tables\&. .TS allbox tab(:); l l s s -l l s s +l l l s ^ l l s ^ l l s ^ l l s. @@ -843,11 +888,8 @@ T}:T{ \-\-sys\-skip\-events T} T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ boolean @@ -855,12 +897,15 @@ T} :T{ \fBDefault\fR T}:T{ -true +false T} :T{ -\fBRange\fR +\fBMin Value\fR +T}:T{ +T} +:T{ +\fBMax Value\fR T}:T{ -\&.\&. T} .TE .sp 1 @@ -882,8 +927,7 @@ options to any events\&. .TS allbox tab(:); l l s s -l l s s -l l s s +l l l s ^ l l s ^ l l s ^ l l s. @@ -893,16 +937,8 @@ T}:T{ \-\-verbose T} T{ -\ \& -T}:T{ -\-v -T} -T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ boolean @@ -910,12 +946,15 @@ T} :T{ \fBDefault\fR T}:T{ -true +false +T} +:T{ +\fBMin Value\fR +T}:T{ T} :T{ -\fBRange\fR +\fBMax Value\fR T}:T{ -\&.\&. T} .TE .sp 1 @@ -935,7 +974,7 @@ Turn on verbose output\&. .TS allbox tab(:); l l s s -l l s s +l l l s ^ l l s ^ l l s ^ l l s. @@ -945,11 +984,8 @@ T}:T{ \-\-loops=# T} T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ numeric @@ -960,9 +996,14 @@ T}:T{ 0 T} :T{ -\fBRange\fR +\fBMin Value\fR +T}:T{ +0 +T} +:T{ +\fBMax Value\fR T}:T{ -0 \&.\&. MAX_INT +MAX_INT T} .TE .sp 1 @@ -971,7 +1012,7 @@ Repeat commands this number of times (for use in testing)\&. .SH "COPYRIGHT" .br .PP -Copyright \(co 1997, 2014, Oracle and/or its affiliates. All rights reserved. +Copyright \(co 1997, 2015, Oracle and/or its affiliates. All rights reserved. .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/mysql-wsrep-5.6/man/ndb_mgm.1 b/mysql-wsrep-5.6/man/ndb_mgm.1 index 382ebaa0..3b892e7e 100644 --- a/mysql-wsrep-5.6/man/ndb_mgm.1 +++ b/mysql-wsrep-5.6/man/ndb_mgm.1 @@ -2,12 +2,12 @@ .\" Title: \fBndb_mgm\fR .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 01/14/2014 +.\" Date: 01/16/2015 .\" Manual: MySQL Database System .\" Source: MySQL 5.6 .\" Language: English .\" -.TH "\FBNDB_MGM\FR" "1" "01/14/2014" "MySQL 5\&.6" "MySQL Database System" +.TH "\FBNDB_MGM\FR" "1" "01/16/2015" "MySQL 5\&.6" "MySQL Database System" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -87,7 +87,7 @@ Options Common to MySQL Cluster Programs(1)\&. .nr an-no-space-flag 1 .nr an-break-flag 1 .br -.B Table\ \&17.13.\ \&ndb_mgm Options and Variables: MySQL Cluster NDB 7.3 +.B Table\ \&18.81.\ \& This table describes command-line options for the ndb_mgm program .TS allbox tab(:); lB lB lB. @@ -96,7 +96,7 @@ Format T}:T{ Description T}:T{ -Added / Removed +Added or Removed T} .T& l l l @@ -110,7 +110,7 @@ T}:T{ Specify number of tries for connecting to ndb_mgmd (0 = infinite) T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -121,7 +121,7 @@ T}:T{ Execute command and exit T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} .TE .sp 1 @@ -140,18 +140,12 @@ T} \fB\-e \fR\fBcommand\fR .TS allbox tab(:); -l l s s l l s s. T{ \fBCommand\-Line Format\fR T}:T{ \-\-execute=name T} -T{ -\ \& -T}:T{ -\-e -T} .TE .sp 1 This option can be used to send a command to the MySQL Cluster management client from the system shell\&. For example, either of the following is equivalent to executing @@ -176,7 +170,7 @@ or option works with the \fBmysql\fR command\-line client\&. See -Section\ \&4.2.3.1, \(lqUsing Options on the Command Line\(rq\&. +Section\ \&4.2.4, \(lqUsing Options on the Command Line\(rq\&. .if n \{\ .sp .\} @@ -208,9 +202,7 @@ be enclosed in quotation marks\&. Either single or double quotation marks may be .TS allbox tab(:); l l s s -l l s s -l l s s -^ l l s +l l l s ^ l l s. T{ \fBCommand\-Line Format\fR @@ -218,16 +210,8 @@ T}:T{ \-\-try\-reconnect=# T} T{ -\ \& -T}:T{ -\-t -T} -T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ boolean @@ -247,11 +231,11 @@ before giving up and reporting an error instead\&. Additional information about using \fBndb_mgm\fR can be found in -Section\ \&17.5.2, \(lqCommands in the MySQL Cluster Management Client\(rq\&. +Section\ \&18.5.2, \(lqCommands in the MySQL Cluster Management Client\(rq\&. .SH "COPYRIGHT" .br .PP -Copyright \(co 1997, 2014, Oracle and/or its affiliates. All rights reserved. +Copyright \(co 1997, 2015, Oracle and/or its affiliates. All rights reserved. .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/mysql-wsrep-5.6/man/ndb_mgmd.8 b/mysql-wsrep-5.6/man/ndb_mgmd.8 index 1f188b3c..28d1a8a4 100644 --- a/mysql-wsrep-5.6/man/ndb_mgmd.8 +++ b/mysql-wsrep-5.6/man/ndb_mgmd.8 @@ -2,12 +2,12 @@ .\" Title: \fBndb_mgmd\fR .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 01/14/2014 +.\" Date: 01/16/2015 .\" Manual: MySQL Database System .\" Source: MySQL 5.6 .\" Language: English .\" -.TH "\FBNDB_MGMD\FR" "8" "01/14/2014" "MySQL 5\&.6" "MySQL Database System" +.TH "\FBNDB_MGMD\FR" "8" "01/16/2015" "MySQL 5\&.6" "MySQL Database System" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -54,7 +54,7 @@ Options Common to MySQL Cluster Programs(1)\&. .nr an-no-space-flag 1 .nr an-break-flag 1 .br -.B Table\ \&17.12.\ \&ndb_mgmd Options and Variables: MySQL Cluster NDB 7.3 +.B Table\ \&18.80.\ \& This table describes command-line options for the ndb_mgmd program .TS allbox tab(:); lB lB lB. @@ -63,7 +63,7 @@ Format T}:T{ Description T}:T{ -Added / Removed +Added or Removed T} .T& l l l @@ -86,16 +86,14 @@ T{ .PP --config-file=file, .PP --f, -.PP --c +-f T}:T{ -Specify the cluster configuration file; in NDB\-6\&.4\&.0 and later, needs - \-\-reload or \-\-initial to override configuration cache if - present +Specify the cluster configuration file; in NDB-6.4.0 and later, + needs --reload or --initial to override configuration cache if + present T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -103,10 +101,11 @@ T{ .PP --config-dir=directory T}:T{ -Specify the cluster management server\*(Aqs configuration cache directory +Specify the cluster management server's configuration cache + directory T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -115,7 +114,7 @@ T}:T{ Local bind address T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -126,7 +125,7 @@ T}:T{ Print full configuration and exit T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -137,7 +136,7 @@ T}:T{ Run ndb_mgmd in daemon mode (default) T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -146,27 +145,27 @@ T}:T{ Do not run ndb_mgmd as a daemon T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP --interactive T}:T{ Run ndb_mgmd in interactive mode (not officially supported in - production; for testing purposes only) + production; for testing purposes only) T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP --log-name=name T}:T{ -A name to use when writing messages applying to this node in the cluster - log\&. +A name to use when writing messages applying to this node in the + cluster log. T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -175,77 +174,77 @@ T}:T{ Do not provide any node id checks T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP --mycnf T}:T{ -Read cluster configuration data from the my\&.cnf file +Read cluster configuration data from the my.cnf file T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP --reload T}:T{ -Causes the management server to compare the configuration file with its - configuration cache +Causes the management server to compare the configuration file + with its configuration cache T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP --initial T}:T{ -Causes the management server reload its configuration data from the - configuration file, bypassing the configuration cache +Causes the management server reload its configuration data from + the configuration file, bypassing the configuration cache T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP --nowait-nodes=list T}:T{ -Do not wait for these management nodes when starting this management - server\&. Also requires \-\-ndb\-nodeid to be used\&. +Do not wait for these management nodes when starting this + management server. Also requires --ndb-nodeid to be used. T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP --config-cache[=TRUE|FALSE] T}:T{ -Enable the management server configuration cache; TRUE by default\&. +Enable the management server configuration cache; TRUE by default. T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP --install[=name] T}:T{ -Used to install the management server process as a Windows service\&. Does - not apply on non\-Windows platforms\&. +Used to install the management server process as a Windows + service. Does not apply on non-Windows platforms. T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP --remove[=name] T}:T{ -Used to remove a management server process that was previously installed - as a Windows service, optionally specifying the name of the - service to be removed\&. Does not apply on non\-Windows - platforms\&. +Used to remove a management server process that was previously + installed as a Windows service, optionally specifying the name of + the service to be removed. Does not apply on non-Windows + platforms. T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} .TE .sp 1 @@ -263,8 +262,7 @@ T} .TS allbox tab(:); l l s s -l l s s -^ l l s +l l l s ^ l l s. T{ \fBCommand\-Line Format\fR @@ -272,11 +270,8 @@ T}:T{ \-\-bind\-address=ip_address T} T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ string @@ -309,8 +304,7 @@ is not specified, the management client attempts to use port 1186\&. .TS allbox tab(:); l l s s -l l s s -^ l l s +l l l s ^ l l s. T{ \fBCommand\-Line Format\fR @@ -318,11 +312,8 @@ T}:T{ \-\-no\-nodeid\-checks T} T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ boolean @@ -351,8 +342,7 @@ Do not perform any checks of node IDs\&. allbox tab(:); l l s s l l s s -l l s s -^ l l s +l l l s ^ l l s. T{ \fBCommand\-Line Format\fR @@ -365,11 +355,8 @@ T}:T{ \-\-config\-dir=directory T} T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ file name @@ -399,8 +386,7 @@ is an alias for this option\&. .TS allbox tab(:); l l s s -l l s s -^ l l s +l l l s ^ l l s. T{ \fBCommand\-Line Format\fR @@ -408,11 +394,8 @@ T}:T{ \-\-config\-cache[=TRUE|FALSE] T} T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ boolean @@ -431,7 +414,7 @@ TRUE, or ON), can be used to disable the management server\*(Aqs configuration cache, so that it reads its configuration from config\&.ini every time it starts (see -Section\ \&17.3.2, \(lqMySQL Cluster Configuration Files\(rq)\&. You can do this by starting the +Section\ \&18.3.2, \(lqMySQL Cluster Configuration Files\(rq)\&. You can do this by starting the \fBndb_mgmd\fR process with any one of the following options: .sp @@ -556,12 +539,7 @@ is used\&. (Bug #13428853) .TS allbox tab(:); l l s s -l l s s -l l s s -^ l l s -^ l l s -l l s s -^ l l s +l l l s ^ l l s. T{ \fBCommand\-Line Format\fR @@ -569,31 +547,8 @@ T}:T{ \-\-config\-file=file T} T{ -\ \& -T}:T{ -\-f -T} -T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ -\fBType\fR -T}:T{ -file name -T} -:T{ -\fBDefault\fR T}:T{ -\&./config\&.ini -T} -T{ -\ \& -T}:T{ -\fBPermitted Values\fR -T} -:T{ \fBType\fR T}:T{ file name @@ -621,7 +576,7 @@ option, or because the management server could not find any configuration cache\ \fBndb_mgmd\fR was started with \fB\-\-config\-cache=OFF\fR\&. See -Section\ \&17.3.2, \(lqMySQL Cluster Configuration Files\(rq, for more information\&. +Section\ \&18.3.2, \(lqMySQL Cluster Configuration Files\(rq, for more information\&. .sp Formerly, using this option together with \fB\-\-initial\fR @@ -642,8 +597,7 @@ caused removal of the configuration cache even if the file was not found\&. This .TS allbox tab(:); l l s s -l l s s -^ l l s +l l l s ^ l l s. T{ \fBCommand\-Line Format\fR @@ -651,11 +605,8 @@ T}:T{ \-\-mycnf T} T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ boolean @@ -687,9 +638,7 @@ file\&. .TS allbox tab(:); l l s s -l l s s -l l s s -^ l l s +l l l s ^ l l s. T{ \fBCommand\-Line Format\fR @@ -697,16 +646,8 @@ T}:T{ \-\-daemon T} T{ -\ \& -T}:T{ -\-d -T} -T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ boolean @@ -740,8 +681,7 @@ on Windows platforms\&. .TS allbox tab(:); l l s s -l l s s -^ l l s +l l l s ^ l l s. T{ \fBCommand\-Line Format\fR @@ -749,11 +689,8 @@ T}:T{ \-\-interactive T} T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ boolean @@ -785,8 +722,7 @@ client session is started as soon as the management server is running\&. This op .TS allbox tab(:); l l s s -l l s s -^ l l s +l l l s ^ l l s. T{ \fBCommand\-Line Format\fR @@ -794,11 +730,8 @@ T}:T{ \-\-initial T} T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ boolean @@ -811,7 +744,7 @@ T} .TE .sp 1 Configuration data is cached internally, rather than being read from the cluster global configuration file each time the management server is started (see -Section\ \&17.3.2, \(lqMySQL Cluster Configuration Files\(rq)\&. Using the +Section\ \&18.3.2, \(lqMySQL Cluster Configuration Files\(rq)\&. Using the \fB\-\-initial\fR option overrides this behavior, by forcing the management server to delete any existing cache files, and then to re\-read the configuration data from the cluster configuration file and to build a new cache\&. .sp @@ -834,7 +767,7 @@ When a management server starts, it checks for another management server in the ignores \fB\-\-initial\fR unless it is the only management server running\&. This behavior also has implications when performing a rolling restart of a MySQL Cluster with multiple management nodes\&. See -Section\ \&17.5.5, \(lqPerforming a Rolling Restart of a MySQL Cluster\(rq, for more information\&. +Section\ \&18.5.5, \(lqPerforming a Rolling Restart of a MySQL Cluster\(rq, for more information\&. .sp Formerly, using this option together with the \fB\-\-config\-file\fR @@ -854,8 +787,7 @@ option caused removal of the configuration cache even if the file was not found\ .TS allbox tab(:); l l s s -l l s s -^ l l s +l l l s ^ l l s. T{ \fBCommand\-Line Format\fR @@ -863,11 +795,8 @@ T}:T{ \-\-log\-name=name T} T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ string @@ -895,8 +824,7 @@ Provides a name to be used for this node in the cluster log\&. .TS allbox tab(:); l l s s -l l s s -^ l l s +l l l s ^ l l s. T{ \fBCommand\-Line Format\fR @@ -904,11 +832,8 @@ T}:T{ \-\-nodaemon T} T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ boolean @@ -944,9 +869,7 @@ on Windows is to run in the foreground, making this option unnecessary on Window .TS allbox tab(:); l l s s -l l s s -l l s s -^ l l s +l l l s ^ l l s. T{ \fBCommand\-Line Format\fR @@ -954,16 +877,8 @@ T}:T{ \-\-print\-full\-config T} T{ -\ \& -T}:T{ -\-P -T} -T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ boolean @@ -995,8 +910,7 @@ process prints information about the cluster setup including an extensive list o .TS allbox tab(:); l l s s -l l s s -^ l l s +l l l s ^ l l s. T{ \fBCommand\-Line Format\fR @@ -1004,11 +918,8 @@ T}:T{ \-\-reload T} T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ boolean @@ -1021,7 +932,7 @@ T} .TE .sp 1 In MySQL Cluster NDB 7\&.3, configuration data is stored internally rather than being read from the cluster global configuration file each time the management server is started (see -Section\ \&17.3.2, \(lqMySQL Cluster Configuration Files\(rq)\&. Using this option forces the management server to check its internal data store against the cluster configuration file and to reload the configuration if it finds that the configuration file does not match the cache\&. Existing configuration cache files are preserved, but not used\&. +Section\ \&18.3.2, \(lqMySQL Cluster Configuration Files\(rq)\&. Using this option forces the management server to check its internal data store against the cluster configuration file and to reload the configuration if it finds that the configuration file does not match the cache\&. Existing configuration cache files are preserved, but not used\&. .sp This differs in two ways from the \fB\-\-initial\fR @@ -1040,7 +951,7 @@ When a management server starts, it checks for another management server in the ignores \fB\-\-reload\fR unless it is the only management server running\&. This behavior also has implications when performing a rolling restart of a MySQL Cluster with multiple management nodes\&. See -Section\ \&17.5.5, \(lqPerforming a Rolling Restart of a MySQL Cluster\(rq, for more information\&. +Section\ \&18.5.5, \(lqPerforming a Rolling Restart of a MySQL Cluster\(rq, for more information\&. .RE .sp .RS 4 @@ -1056,7 +967,7 @@ Section\ \&17.5.5, \(lqPerforming a Rolling Restart of a MySQL Cluster\(rq, for .TS allbox tab(:); l l s s -l l s s +l l l s ^ l l s ^ l l s ^ l l s. @@ -1066,11 +977,8 @@ T}:T{ \-\-nowait\-nodes=list T} T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ numeric @@ -1080,9 +988,14 @@ T} T}:T{ T} :T{ -\fBRange\fR +\fBMin Value\fR T}:T{ -1 \&.\&. 255 +1 +T} +:T{ +\fBMax Value\fR +T}:T{ +255 T} .TE .sp 1 @@ -1165,7 +1078,7 @@ shell> \fBndbd \-c 192\&.168\&.0\&.150,192\&.168\&.0\&.151\fR The same is true with regard to the connection string used with any \fBmysqld\fR processes that you wish to start as MySQL Cluster SQL nodes connected to this cluster\&. See -Section\ \&17.3.2.3, \(lqMySQL Cluster Connection Strings\(rq, for more information\&. +Section\ \&18.3.2.3, \(lqMySQL Cluster Connection Strings\(rq, for more information\&. .sp When used with \fBndb_mgmd\fR, this option affects the behavior of the management node with regard to other management nodes only\&. Do not confuse it with the @@ -1199,7 +1112,7 @@ management server, its configuration must match that of the management server th It is not strictly necessary to specify a connection string when starting the management server\&. However, if you are using more than one management server, a connection string should be provided and each node in the cluster should specify its node ID explicitly\&. .PP See -Section\ \&17.3.2.3, \(lqMySQL Cluster Connection Strings\(rq, for information about using connection strings\&. +Section\ \&18.3.2.3, \(lqMySQL Cluster Connection Strings\(rq, for information about using connection strings\&. \fBndb_mgmd\fR(8), describes other options for \fBndb_mgmd\fR\&. .PP @@ -1226,7 +1139,7 @@ is the unique node identifier\&. .\" config.ini (MySQL Cluster) config\&.ini is the configuration file for the cluster as a whole\&. This file is created by the user and read by the management server\&. -Section\ \&17.3, \(lqConfiguration of MySQL Cluster NDB 7.3\(rq, discusses how to set up this file\&. +Section\ \&18.3, \(lqConfiguration of MySQL Cluster\(rq, discusses how to set up this file\&. .RE .sp .RS 4 @@ -1239,7 +1152,7 @@ Section\ \&17.3, \(lqConfiguration of MySQL Cluster NDB 7.3\(rq, discusses how t .\} ndb_\fInode_id\fR_cluster\&.log is the cluster events log file\&. Examples of such events include checkpoint startup and completion, node startup events, node failures, and levels of memory usage\&. A complete listing of cluster events with descriptions may be found in -Section\ \&17.5, \(lqManagement of MySQL Cluster\(rq\&. +Section\ \&18.5, \(lqManagement of MySQL Cluster\(rq\&. .sp When the size of the cluster log reaches one million bytes, the file is renamed to ndb_\fInode_id\fR_cluster\&.log\&.\fIseq_id\fR, where @@ -1290,7 +1203,7 @@ is the process ID file used when running the management server as a daemon\&. allbox tab(:); l l s s l l s s -^ l l s +l l l s ^ l l s. T{ \fBCommand\-Line Format\fR @@ -1298,11 +1211,13 @@ T}:T{ \-\-install[=name] T} T{ -\ \& +\fBPlatform Specific\fR T}:T{ -\fBPermitted Values\fR +Windows T} -:T{ +T{ +\fBPermitted Values\fR +T}:T{ \fBType\fR T}:T{ string @@ -1353,7 +1268,7 @@ option has no effect on non\-Windows platforms\&. allbox tab(:); l l s s l l s s -^ l l s +l l l s ^ l l s. T{ \fBCommand\-Line Format\fR @@ -1361,11 +1276,13 @@ T}:T{ \-\-remove[=name] T} T{ -\ \& +\fBPlatform Specific\fR T}:T{ -\fBPermitted Values\fR +Windows T} -:T{ +T{ +\fBPermitted Values\fR +T}:T{ \fBType\fR T}:T{ string @@ -1389,7 +1306,7 @@ option has no effect on non\-Windows platforms\&. .SH "COPYRIGHT" .br .PP -Copyright \(co 1997, 2014, Oracle and/or its affiliates. All rights reserved. +Copyright \(co 1997, 2015, Oracle and/or its affiliates. All rights reserved. .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/mysql-wsrep-5.6/man/ndb_print_backup_file.1 b/mysql-wsrep-5.6/man/ndb_print_backup_file.1 index 055cb58d..ac788d18 100644 --- a/mysql-wsrep-5.6/man/ndb_print_backup_file.1 +++ b/mysql-wsrep-5.6/man/ndb_print_backup_file.1 @@ -2,12 +2,12 @@ .\" Title: \fBndb_print_backup_file\fR .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 01/14/2014 +.\" Date: 01/16/2015 .\" Manual: MySQL Database System .\" Source: MySQL 5.6 .\" Language: English .\" -.TH "\FBNDB_PRINT_BACKUP_" "1" "01/14/2014" "MySQL 5\&.6" "MySQL Database System" +.TH "\FBNDB_PRINT_BACKUP_" "1" "01/16/2015" "MySQL 5\&.6" "MySQL Database System" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -37,7 +37,7 @@ ndb_print_backup_file \- print NDB backup file contents .PP \fBndb_print_backup_file\fR obtains diagnostic information from a cluster backup file\&. - Usage +Usage .sp .if n \{\ .RS 4 @@ -57,7 +57,7 @@ file) found in a cluster backup directory\&. These files are found in the data n BACKUP\-\fI#\fR, where \fI#\fR is the sequence number for the backup\&. For more information about cluster backup files and their contents, see -Section\ \&17.5.3.1, \(lqMySQL Cluster Backup Concepts\(rq\&. +Section\ \&18.5.3.1, \(lqMySQL Cluster Backup Concepts\(rq\&. .PP Like \fBndb_print_schema_file\fR @@ -68,13 +68,12 @@ NDB utilities that are intended to be run on a management server host or to connect to a management server) \fBndb_print_backup_file\fR must be run on a cluster data node, since it accesses the data node file system directly\&. Because it does not make use of the management server, this utility can be used when the management server is not running, and even when the cluster has been completely shut down\&. - Additional Options -.PP +Additional Options.PP None\&. .SH "COPYRIGHT" .br .PP -Copyright \(co 1997, 2014, Oracle and/or its affiliates. All rights reserved. +Copyright \(co 1997, 2015, Oracle and/or its affiliates. All rights reserved. .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/mysql-wsrep-5.6/man/ndb_print_schema_file.1 b/mysql-wsrep-5.6/man/ndb_print_schema_file.1 index 769bcd67..d28b3a5f 100644 --- a/mysql-wsrep-5.6/man/ndb_print_schema_file.1 +++ b/mysql-wsrep-5.6/man/ndb_print_schema_file.1 @@ -2,12 +2,12 @@ .\" Title: \fBndb_print_schema_file\fR .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 01/14/2014 +.\" Date: 01/16/2015 .\" Manual: MySQL Database System .\" Source: MySQL 5.6 .\" Language: English .\" -.TH "\FBNDB_PRINT_SCHEMA_" "1" "01/14/2014" "MySQL 5\&.6" "MySQL Database System" +.TH "\FBNDB_PRINT_SCHEMA_" "1" "01/16/2015" "MySQL 5\&.6" "MySQL Database System" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -37,7 +37,7 @@ ndb_print_schema_file \- print NDB schema file contents .PP \fBndb_print_schema_file\fR obtains diagnostic information from a cluster schema file\&. - Usage +Usage .sp .if n \{\ .RS 4 @@ -51,7 +51,7 @@ ndb_print_schema_file \fIfile_name\fR .PP \fIfile_name\fR is the name of a cluster schema file\&. For more information about cluster schema files, see -\m[blue]\fBMySQL Cluster Data Node FileSystemDir Files\fR\m[]\&\s-2\u[1]\d\s+2\&. +\m[blue]\fBMySQL Cluster Data Node File System Directory Files\fR\m[]\&\s-2\u[1]\d\s+2\&. .PP Like \fBndb_print_backup_file\fR @@ -62,13 +62,12 @@ NDB utilities that are intended to be run on a management server host or to connect to a management server) \fBndb_schema_backup_file\fR must be run on a cluster data node, since it accesses the data node file system directly\&. Because it does not make use of the management server, this utility can be used when the management server is not running, and even when the cluster has been completely shut down\&. - Additional Options -.PP +Additional Options.PP None\&. .SH "COPYRIGHT" .br .PP -Copyright \(co 1997, 2014, Oracle and/or its affiliates. All rights reserved. +Copyright \(co 1997, 2015, Oracle and/or its affiliates. All rights reserved. .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP @@ -78,7 +77,7 @@ You should have received a copy of the GNU General Public License along with the .sp .SH "NOTES" .IP " 1." 4 -MySQL Cluster Data Node FileSystemDir Files +MySQL Cluster Data Node File System Directory Files .RS 4 \%http://dev.mysql.com/doc/ndbapi/en/ndb-internals-ndbd-filesystemdir-files.html .RE diff --git a/mysql-wsrep-5.6/man/ndb_print_sys_file.1 b/mysql-wsrep-5.6/man/ndb_print_sys_file.1 index 4c0db434..a49701f3 100644 --- a/mysql-wsrep-5.6/man/ndb_print_sys_file.1 +++ b/mysql-wsrep-5.6/man/ndb_print_sys_file.1 @@ -2,12 +2,12 @@ .\" Title: \fBndb_print_sys_file\fR .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 01/14/2014 +.\" Date: 01/16/2015 .\" Manual: MySQL Database System .\" Source: MySQL 5.6 .\" Language: English .\" -.TH "\FBNDB_PRINT_SYS_FIL" "1" "01/14/2014" "MySQL 5\&.6" "MySQL Database System" +.TH "\FBNDB_PRINT_SYS_FIL" "1" "01/16/2015" "MySQL 5\&.6" "MySQL Database System" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -37,7 +37,7 @@ ndb_print_sys_file \- print NDB system file contents .PP \fBndb_print_sys_file\fR obtains diagnostic information from a MySQL Cluster system file\&. - Usage +Usage .sp .if n \{\ .RS 4 @@ -54,7 +54,7 @@ is the name of a cluster system file (sysfile)\&. Cluster system files are locat ndb_\fI#\fR_fs/D\fI#\fR/DBDIH/P\fI#\fR\&.sysfile\&. In each case, the \fI#\fR represents a number (not necessarily the same number)\&. For more information, see -\m[blue]\fBMySQL Cluster Data Node FileSystemDir Files\fR\m[]\&\s-2\u[1]\d\s+2\&. +\m[blue]\fBMySQL Cluster Data Node File System Directory Files\fR\m[]\&\s-2\u[1]\d\s+2\&. .PP Like \fBndb_print_backup_file\fR @@ -65,13 +65,12 @@ NDB utilities that are intended to be run on a management server host or to connect to a management server) \fBndb_print_backup_file\fR must be run on a cluster data node, since it accesses the data node file system directly\&. Because it does not make use of the management server, this utility can be used when the management server is not running, and even when the cluster has been completely shut down\&. - Additional Options -.PP +Additional Options.PP None\&. .SH "COPYRIGHT" .br .PP -Copyright \(co 1997, 2014, Oracle and/or its affiliates. All rights reserved. +Copyright \(co 1997, 2015, Oracle and/or its affiliates. All rights reserved. .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP @@ -81,7 +80,7 @@ You should have received a copy of the GNU General Public License along with the .sp .SH "NOTES" .IP " 1." 4 -MySQL Cluster Data Node FileSystemDir Files +MySQL Cluster Data Node File System Directory Files .RS 4 \%http://dev.mysql.com/doc/ndbapi/en/ndb-internals-ndbd-filesystemdir-files.html .RE diff --git a/mysql-wsrep-5.6/man/ndb_restore.1 b/mysql-wsrep-5.6/man/ndb_restore.1 index f5c66580..e6b312a6 100644 --- a/mysql-wsrep-5.6/man/ndb_restore.1 +++ b/mysql-wsrep-5.6/man/ndb_restore.1 @@ -2,12 +2,12 @@ .\" Title: \fBndb_restore\fR .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 01/14/2014 +.\" Date: 01/16/2015 .\" Manual: MySQL Database System .\" Source: MySQL 5.6 .\" Language: English .\" -.TH "\FBNDB_RESTORE\FR" "1" "01/14/2014" "MySQL 5\&.6" "MySQL Database System" +.TH "\FBNDB_RESTORE\FR" "1" "01/16/2015" "MySQL 5\&.6" "MySQL Database System" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -48,7 +48,7 @@ directory\&. This program reads the files created as a result of the backup and must be executed once for each of the backup files that were created by the START BACKUP command used to create the backup (see -Section\ \&17.5.3.2, \(lqUsing The MySQL Cluster Management Client to Create a Backup\(rq)\&. This is equal to the number of data nodes in the cluster at the time that the backup was created\&. +Section\ \&18.5.3.2, \(lqUsing The MySQL Cluster Management Client to Create a Backup\(rq)\&. This is equal to the number of data nodes in the cluster at the time that the backup was created\&. .\" single user mode (MySQL Cluster): and ndb_restore .if n \{\ .sp @@ -65,7 +65,7 @@ Section\ \&17.5.3.2, \(lqUsing The MySQL Cluster Management Client to Create a B .PP Before using \fBndb_restore\fR, it is recommended that the cluster be running in single user mode, unless you are restoring multiple data nodes in parallel\&. See -Section\ \&17.5.8, \(lqMySQL Cluster Single User Mode\(rq, for more information\&. +Section\ \&18.5.8, \(lqMySQL Cluster Single User Mode\(rq, for more information\&. .sp .5v .RE .PP @@ -78,7 +78,7 @@ Options Common to MySQL Cluster Programs(1)\&. .nr an-no-space-flag 1 .nr an-break-flag 1 .br -.B Table\ \&17.23.\ \&ndb_restore Options and Variables: MySQL Cluster NDB 7.3 +.B Table\ \&18.91.\ \& This table describes command-line options for the ndb_restore program .TS allbox tab(:); lB lB lB. @@ -87,7 +87,7 @@ Format T}:T{ Description T}:T{ -Added / Removed +Added or Removed T} .T& l l l @@ -130,6 +130,8 @@ l l l l l l l l l l l l +l l l +l l l l l l. T{ .PP @@ -137,10 +139,10 @@ T{ .PP -c T}:T{ -Alias for \-\-connectstring\&. +Alias for --connectstring. T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -151,7 +153,7 @@ T}:T{ Back up files from node with this ID T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -162,7 +164,7 @@ T}:T{ Restore from the backup with the given ID T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -173,7 +175,7 @@ T}:T{ Restore table data and logs into NDB Cluster using the NDB API T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -184,7 +186,7 @@ T}:T{ Restore metadata to NDB Cluster using the NDB API T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -192,11 +194,11 @@ T{ .PP -u T}:T{ -Do not upgrade array type for varsize attributes which do not already - resize VAR data, and do not change column attributes +Do not upgrade array type for varsize attributes which do not + already resize VAR data, and do not change column attributes T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -207,7 +209,7 @@ T}:T{ Allow attributes to be promoted when restoring data from backup T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -215,11 +217,11 @@ T{ .PP -P T}:T{ -Allow preservation of trailing spaces (including padding) when promoting - fixed\-width string types to variable\-width types +Allow preservation of trailing spaces (including padding) when + promoting fixed-width string types to variable-width types T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -230,7 +232,7 @@ T}:T{ Do not restore objects relating to Disk Data T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -238,12 +240,12 @@ T{ .PP -e T}:T{ -Restore epoch info into the status table\&. Convenient on a MySQL Cluster - replication slave for starting replication\&. The row in - mysql\&.ndb_apply_status with id 0 will be updated/inserted\&. +Restore epoch info into the status table. Convenient on a MySQL + Cluster replication slave for starting replication. The row in + mysql.ndb_apply_status with id 0 will be updated/inserted. T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -254,7 +256,7 @@ T}:T{ Skip table structure check during restoring of data T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -265,17 +267,17 @@ T}:T{ Number of parallel transactions to use while restoring data T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP --print T}:T{ -Print metadata, data and log to stdout (equivalent to \-\-print_meta - \-\-print_data \-\-print_log) +Print metadata, data and log to stdout (equivalent to --print_meta + --print_data --print_log) T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -284,7 +286,7 @@ T}:T{ Print metadata to stdout T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -293,7 +295,7 @@ T}:T{ Print data to stdout T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -302,7 +304,7 @@ T}:T{ Print to stdout T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -311,7 +313,7 @@ T}:T{ Path to backup files directory T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -319,11 +321,11 @@ T{ .PP -f T}:T{ -Do not ignore system table during restore\&. Experimental only; not for - production use +Do not ignore system table during restore. Experimental only; not + for production use T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -331,11 +333,11 @@ T{ .PP -z T}:T{ -Nodegroup map for NDBCLUSTER storage engine\&. Syntax: list of - (source_nodegroup, destination_nodegroup) +Nodegroup map for NDBCLUSTER storage engine. Syntax: list of + (source_nodegroup, destination_nodegroup) T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -344,7 +346,7 @@ T}:T{ Fields are enclosed with the indicated character T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -353,7 +355,7 @@ T}:T{ Fields are terminated by the indicated character T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -362,7 +364,7 @@ T}:T{ Fields are optionally enclosed with the indicated character T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -371,7 +373,7 @@ T}:T{ Lines are terminated by the indicated character T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -380,7 +382,7 @@ T}:T{ Print binary types in hexadecimal format T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -388,19 +390,19 @@ T{ .PP -T T}:T{ -Creates a tab\-separated \&.txt file for each table in the given path +Creates a tab-separated .txt file for each table in the given path T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP --append T}:T{ -Append data to a tab\-delimited file +Append data to a tab-delimited file T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -409,17 +411,17 @@ T}:T{ Print status of restoration each given number of seconds T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP --no-binlog T}:T{ If a mysqld is connected and using binary logging, do not log the - restored data + restored data T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -428,97 +430,110 @@ T}:T{ Level of verbosity in output T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP --include-databases=db-list T}:T{ -List of one or more databases to restore (excludes those not named) +List of one or more databases to restore (excludes those not + named) T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP --exclude-databases=db-list T}:T{ -List of one or more databases to exclude (includes those not named) +List of one or more databases to exclude (includes those not + named) T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP --include-tables=table-list T}:T{ -List of one or more tables to restore (excludes those in same database - that are not named); each table reference must include the - database name +List of one or more tables to restore (excludes those in same + database that are not named); each table reference must include + the database name T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP --exclude-tables=table-list T}:T{ -List of one or more tables to exclude (includes those in same database - that are not not named); each table reference must include - the database name +List of one or more tables to exclude (includes those in the same + database that are not named); each table reference must include + the database name T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP --exclude-missing-columns T}:T{ -Causes columns from the backup version of a table that are missing from - the version of the table in the database to be ignored\&. +Causes columns from the backup version of a table that are missing + from the version of the table in the database to be ignored. T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases +T} +T{ +.PP +--exclude-missing-tables +T}:T{ +Causes tables from the backup that are missing from the database + to be ignored. +T}:T{ +.PP +ADDED: NDB 7.3.7 T} T{ .PP --disable-indexes T}:T{ -Causes indexes from a backup to be ignored; may decrease time needed to - restore data\&. +Causes indexes from a backup to be ignored; may decrease time + needed to restore data. T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP --rebuild-indexes T}:T{ -Causes multi\-threaded ordered index rebuilding of indexes found in the - backup\&. +Causes multi-threaded rebuilding of ordered indexes found in the + backup. Number of threads used is determined by setting + BuildIndexThreads parameter. T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP --skip-broken-objects T}:T{ -Causes missing blob tables in the backup file to be ignored\&. +Causes missing blob tables in the backup file to be ignored. T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP --skip-unknown-objects T}:T{ -Causes schema objects not recognized by ndb_restore to be ignored when - restoring a backup made from a newer MySQL Cluster version - to an older version\&. +Causes schema objects not recognized by ndb_restore to be ignored + when restoring a backup made from a newer MySQL Cluster version to + an older version. T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -527,7 +542,7 @@ T}:T{ Restores to a database with a different name than the original T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -535,25 +550,49 @@ T{ .PP -L T}:T{ -Allow lossy conversions of column values (type demotions or changes in - sign) when restoring data from backup +Allow lossy conversions of column values (type demotions or + changes in sign) when restoring data from backup T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP --restore-privilege-tables T}:T{ -Restore MySQL privilege tables that were previously moved to NDB\&. +Restore MySQL privilege tables that were previously moved to NDB. T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases +T} +T{ +.PP +--exclude-intermediate-sql-tables[=TRUE|FALSE] +T}:T{ +If TRUE (the default), do not restore any intermediate tables + (having names prefixed with '#sql-') that were left over from + copying ALTER TABLE operations. +T}:T{ +.PP +ADDED: NDB 7.3.6 T} .TE .sp 1 +.\" ndb_restore: typical and required options .PP Typical options for this utility are shown here: +.PP +Normally, when restoring from a MySQL Cluster backup, +\fBndb_restore\fR +requires at a minimum the +\fB\-\-nodeid\fR +(short form: +\fB\-n\fR), +\fB\-\-backupid\fR +(short form: +\fB\-b\fR), and +\fB\-\-backup_path\fR +options\&. .sp .if n \{\ .RS 4 @@ -572,7 +611,7 @@ The option is used to specify a connection string which tells ndb_restore where to locate the cluster management server\&. (See -Section\ \&17.3.2.3, \(lqMySQL Cluster Connection Strings\(rq, for information on connection strings\&.) If this option is not used, then +Section\ \&18.3.2.3, \(lqMySQL Cluster Connection Strings\(rq, for information on connection strings\&.) If this option is not used, then \fBndb_restore\fR attempts to connect to a management server on localhost:1186\&. This utility acts as a cluster API node, and so requires a free connection @@ -590,7 +629,7 @@ or section in config\&.ini that is not being used for a MySQL server or other application for this reason (see -Section\ \&17.3.2.7, \(lqDefining SQL and Other API Nodes in a MySQL Cluster\(rq)\&. +Section\ \&18.3.2.7, \(lqDefining SQL and Other API Nodes in a MySQL Cluster\(rq)\&. .PP You can verify that \fBndb_restore\fR @@ -713,7 +752,7 @@ column can be restored to a column of type INT or BIGINT\&. See -Section\ \&16.4.1.9.2, \(lqReplication of Columns Having Different Data Types\(rq, for a table of type conversions currently supported by attribute promotion\&. +Section\ \&17.4.1.9.2, \(lqReplication of Columns Having Different Data Types\(rq, for a table of type conversions currently supported by attribute promotion\&. .PP Attribute promotion by \fBndb_restore\fR @@ -756,6 +795,12 @@ or BLOB were not handled correctly (Bug #17325051)\&. .PP +Prior to MySQL Cluster NDB 7\&.3\&.7, demotion of +TEXT +to +TINYTEXT +was not handled correctly (Bug #18875137)\&. +.PP When converting between character data types and TEXT or @@ -774,6 +819,10 @@ TEXT in the same invocation of \fBndb_restore\fR\&. .PP +Converting between +TEXT +columns using different character sets is not supported\&. Beginning with MySQL Cluster NDB 7\&.3\&.7, it is expressly disallowed (Bug #18875137)\&. +.PP When performing conversions of character or binary types to TEXT or @@ -791,9 +840,7 @@ following a successful restoration\&. .TS allbox tab(:); l l s s -l l s s -l l s s -^ l l s +l l l s ^ l l s. T{ \fBCommand\-Line Format\fR @@ -801,16 +848,8 @@ T}:T{ \-\-lossy\-conversions T} T{ -\ \& -T}:T{ -\-L -T} -T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ boolean @@ -828,7 +867,7 @@ This option is intended to complement the option\&. Using \fB\-\-lossy\-conversions\fR allows lossy conversions of column values (type demotions or changes in sign) when restoring data from backup\&. With some exceptions, the rules governing demotion are the same as for MySQL replication; see -Section\ \&16.4.1.9.2, \(lqReplication of Columns Having Different Data Types\(rq, for information about specific type conversions currently supported by attribute demotion\&. +Section\ \&17.4.1.9.2, \(lqReplication of Columns Having Different Data Types\(rq, for information about specific type conversions currently supported by attribute demotion\&. .PP \fBndb_restore\fR reports any truncation of data that it performs during lossy conversions once per attribute and column\&. @@ -882,7 +921,7 @@ The option is used to specify the ID or sequence number of the backup, and is the same number shown by the management client in the Backup \fIbackup_id\fR completed message displayed upon completion of a backup\&. (See -Section\ \&17.5.3.2, \(lqUsing The MySQL Cluster Management Client to Create a Backup\(rq\&.) +Section\ \&18.5.3.2, \(lqUsing The MySQL Cluster Management Client to Create a Backup\(rq\&.) .if n \{\ .sp .\} @@ -910,7 +949,7 @@ having in the id column is updated if it already exists; such a row is inserted if it does not already exist\&. (See -Section\ \&17.6.9, \(lqMySQL Cluster Backups With MySQL Cluster Replication\(rq\&.) +Section\ \&18.6.9, \(lqMySQL Cluster Backups With MySQL Cluster Replication\(rq\&.) .PP .\" restore_data option (ndb_restore) \fB\-\-restore_data\fR @@ -942,7 +981,7 @@ to restore the privilege tables\&. This works only if the privilege tables were converted to NDB before the backup was taken\&. For more information, see -Section\ \&17.5.14, \(lqDistributed MySQL Privileges for MySQL Cluster\(rq\&. +Section\ \&18.5.14, \(lqDistributed MySQL Privileges for MySQL Cluster\(rq\&. .PP .\" backup_path option (ndb_restore) .\" ndb_restore: backup_path option @@ -971,7 +1010,7 @@ and must be run twice\(emonce for each database node in the cluster where the backup was taken\&. However, \fBndb_restore\fR cannot always restore backups made from a cluster running one version of MySQL to a cluster running a different MySQL version\&. See -Section\ \&17.2.8, \(lqUpgrading and Downgrading MySQL Cluster NDB 7.3\(rq, for more information\&. +Section\ \&18.2.8, \(lqUpgrading and Downgrading MySQL Cluster NDB 7.3\(rq, for more information\&. .if n \{\ .sp .\} @@ -1034,7 +1073,7 @@ stdout\&. TEXT and BLOB -column values are always truncated to the first 256 bytes in the output; this cannot currently be overridden when using +column values are always truncated\&. In MySQL Cluster NDB 7\&.3\&.7 and earlier, such values are truncated to the first 240 bytes in the output; in MySQL Cluster NDB 7\&.3\&.8 and later, they are truncated to 256 bytes\&. (Bug #14571512, Bug #65467) This cannot currently be overridden when using \fB\-\-print_data\fR\&. .PP Several additional options are available for use with the @@ -1057,18 +1096,12 @@ stdout, or to a file\&. These are similar to some of the options used with \fB\-T\fR .TS allbox tab(:); -l l s s l l s s. T{ \fBCommand\-Line Format\fR T}:T{ \-\-tab=path T} -T{ -\ \& -T}:T{ -\-T -T} .TE .sp 1 This option causes @@ -1093,8 +1126,7 @@ for the current directory\&. .TS allbox tab(:); l l s s -l l s s -^ l l s +l l l s ^ l l s. T{ \fBCommand\-Line Format\fR @@ -1102,11 +1134,8 @@ T}:T{ \-\-fields\-enclosed\-by=char T} T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ string @@ -1134,8 +1163,7 @@ Each column values are enclosed by the string passed to this option (regardless .TS allbox tab(:); l l s s -l l s s -^ l l s +l l l s ^ l l s. T{ \fBCommand\-Line Format\fR @@ -1143,11 +1171,8 @@ T}:T{ \-\-fields\-optionally\-enclosed\-by T} T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ string @@ -1180,8 +1205,7 @@ ENUM)\&. .TS allbox tab(:); l l s s -l l s s -^ l l s +l l l s ^ l l s. T{ \fBCommand\-Line Format\fR @@ -1189,11 +1213,8 @@ T}:T{ \-\-fields\-terminated\-by=char T} T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ string @@ -1246,8 +1267,7 @@ If this option is used, all binary values are output in hexadecimal format\&. .TS allbox tab(:); l l s s -l l s s -^ l l s +l l l s ^ l l s. T{ \fBCommand\-Line Format\fR @@ -1255,11 +1275,8 @@ T}:T{ \-\-fields\-terminated\-by=char T} T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ string @@ -1413,7 +1430,7 @@ to their binary logs\&. This option stops \fBndb_restore\fR from restoring any MySQL Cluster Disk Data objects, such as tablespaces and log file groups; see -Section\ \&17.5.12, \(lqMySQL Cluster Disk Data Tables\(rq, for more information about these\&. +Section\ \&18.5.12, \(lqMySQL Cluster Disk Data Tables\(rq, for more information about these\&. .PP .\" ndb_restore: parallelism option .\" parallelism option (ndb_restore) @@ -1480,8 +1497,7 @@ One or more tables from a single database .TS allbox tab(:); l l s s -l l s s -^ l l s +l l l s ^ l l s. T{ \fBCommand\-Line Format\fR @@ -1489,11 +1505,8 @@ T}:T{ \-\-include\-databases=db\-list T} T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ string @@ -1511,8 +1524,7 @@ T} .TS allbox tab(:); l l s s -l l s s -^ l l s +l l l s ^ l l s. T{ \fBCommand\-Line Format\fR @@ -1520,11 +1532,8 @@ T}:T{ \-\-include\-tables=table\-list T} T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ string @@ -1637,8 +1646,7 @@ shell> \fBndb_restore [\&.\&.\&.] \-\-include\-databases=db1,db2 \-\-include\-ta .TS allbox tab(:); l l s s -l l s s -^ l l s +l l l s ^ l l s. T{ \fBCommand\-Line Format\fR @@ -1646,11 +1654,8 @@ T}:T{ \-\-exclude\-databases=db\-list T} T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ string @@ -1668,8 +1673,7 @@ T} .TS allbox tab(:); l l s s -l l s s -^ l l s +l l l s ^ l l s. T{ \fBCommand\-Line Format\fR @@ -1677,11 +1681,8 @@ T}:T{ \-\-exclude\-tables=table\-list T} T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ string @@ -1903,6 +1904,30 @@ option\&. When this option is used, \fBndb_restore\fR ignores any columns missing from tables being restored as compared to the versions of those tables found in the backup\&. This option applies to all tables being restored\&. If you wish to apply this option only to selected tables or databases, you can use it in combination with one or more of the options described in the previous paragraph to do so, then restore data to the remaining tables using a complementary set of these options\&. .PP +.\" ndb_restore: exclude-missing-tables option +.\" exclude-missing-tables option (ndb_restore) +\fB\-\-exclude\-missing\-tables\fR +.TS +allbox tab(:); +l l s s +l l s s. +T{ +\fBIntroduced\fR +T}:T{ +5\&.6\&.21\-ndb\-7\&.3\&.7 +T} +T{ +\fBCommand\-Line Format\fR +T}:T{ +\-\-exclude\-missing\-tables +T} +.TE +.sp 1 +.PP +Beginning with MySQL Cluster NDB 7\&.3\&.7, it is also possible to restore only selected tables columns using this option, which causes +\fBndb_restore\fR +to ignore any tables from the backup that are not found in the target database\&. +.PP .\" ndb_restore: disable-indexes option .\" disable-indexes option (ndb_restore) \fB\-\-disable\-indexes\fR @@ -1938,7 +1963,27 @@ You can use this option with \fBndb_restore\fR to cause multi\-threaded rebuilding of the ordered indexes while restoring a native NDB -backup\&. +backup\&. The number of threads used for building ordered indexes by +\fBndb_restore\fR +with this option is controlled by the +BuildIndexThreads +data node configuration parameter\&. +.\" indexes: and ndb_restore +.PP +It is necessary to use this option only for the first run of +\fBndb_restore\fR; this causes all ordered indexes to be rebuilt without using +\fB\-\-rebuild\-indexes\fR +again when restoring subsequent nodes\&. You should use this option prior to inserting new rows into the database; otherwise, it is possible for a row to be inserted that later causes a unique constraint violation when trying to rebuild the indexes\&. +.PP +Rebuilding of unique indexes uses disk write bandwidth for redo logging and local checkpointing\&. An insufficient amount of this bandwith can lead to redo buffer overload or log overload errors\&. In such cases you can run +\fBndb_restore\fR +\fB\-\-rebuild\-indexes\fR +again; the process resumes at the point where the error occurred\&. You can also do this when you have encountered temporarary errors\&. You can repeat execution of +\fBndb_restore\fR +\fB\-\-rebuild\-indexes\fR +indefinitely; you may be able to stop such errors by reducing the value of +DiskCheckpointSpeed +to provide additional disk bandwidth to redo logging\&. .PP .\" ndb_restore: skip-broken-objects option .\" skip-broken-objects option (ndb_restore) @@ -1988,8 +2033,7 @@ backup\&. This can be used for restoring a backup made from a cluster running My .TS allbox tab(:); l l s s -l l s s -^ l l s +l l l s ^ l l s. T{ \fBCommand\-Line Format\fR @@ -1997,11 +2041,8 @@ T}:T{ \-\-rewrite\-database=olddb,newdb T} T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ string @@ -2079,6 +2120,58 @@ When restoring from multiple backup databases into a single target database usin .sp .5v .RE .PP +.\" ndb_restore: exclude-intermediate-sql-tables option +.\" exclude-intermediate-sql-tables option (ndb_restore) +\fB\-\-exclude\-intermediate\-sql\-tables[=TRUE|FALSE]\fR +.TS +allbox tab(:); +l l s s +l l s s +l l l s +^ l l s. +T{ +\fBIntroduced\fR +T}:T{ +5\&.6\&.17\-ndb\-7\&.3\&.6 +T} +T{ +\fBCommand\-Line Format\fR +T}:T{ +\-\-exclude\-intermediate\-sql\-tables[=TRUE|FALSE] +T} +T{ +\fBPermitted Values\fR +T}:T{ +\fBType\fR +T}:T{ +boolean +T} +:T{ +\fBDefault\fR +T}:T{ +TRUE +T} +.TE +.sp 1 +.PP +When performing copying +ALTER TABLE +operations, +\fBmysqld\fR +creates intermediate tables (whose names are prefixed with +#sql\-)\&. When +TRUE, the +\fB\-\-exclude\-intermediate\-sql\-tables\fR +option keeps +\fBndb_restore\fR +from restoring such tables that may have been left over from such operations\&. This option is +TRUE +by default\&. +.PP +The +\fB\-\-exclude\-intermediate\-sql\-tables\fR +option was introduced in MySQL Cluster NDB 7\&.3\&.6\&. (Bug #17882305) +.PP \fBError reporting\fR. .\" ndb_restore: errors \fBndb_restore\fR reports both temporary and permanent errors\&. In the case of temporary errors, it may able to recover from them, and reports @@ -2108,7 +2201,7 @@ START SLAVE\&. This is a known issue in MySQL Cluster\&. .SH "COPYRIGHT" .br .PP -Copyright \(co 1997, 2014, Oracle and/or its affiliates. All rights reserved. +Copyright \(co 1997, 2015, Oracle and/or its affiliates. All rights reserved. .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/mysql-wsrep-5.6/man/ndb_select_all.1 b/mysql-wsrep-5.6/man/ndb_select_all.1 index 07138a76..467e8848 100644 --- a/mysql-wsrep-5.6/man/ndb_select_all.1 +++ b/mysql-wsrep-5.6/man/ndb_select_all.1 @@ -2,12 +2,12 @@ .\" Title: \fBndb_select_all\fR .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 01/14/2014 +.\" Date: 01/16/2015 .\" Manual: MySQL Database System .\" Source: MySQL 5.6 .\" Language: English .\" -.TH "\FBNDB_SELECT_ALL\FR" "1" "01/14/2014" "MySQL 5\&.6" "MySQL Database System" +.TH "\FBNDB_SELECT_ALL\FR" "1" "01/16/2015" "MySQL 5\&.6" "MySQL Database System" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -40,7 +40,7 @@ prints all rows from an NDB table to stdout\&. - Usage +Usage .sp .if n \{\ .RS 4 @@ -61,7 +61,7 @@ Options Common to MySQL Cluster Programs(1)\&. .nr an-no-space-flag 1 .nr an-break-flag 1 .br -.B Table\ \&17.24.\ \&ndb_select_all Options and Variables: MySQL Cluster NDB 7.3 +.B Table\ \&18.92.\ \& This table describes command-line options for the ndb_select_all program .TS allbox tab(:); lB lB lB. @@ -70,7 +70,7 @@ Format T}:T{ Description T}:T{ -Added / Removed +Added or Removed T} .T& l l l @@ -96,7 +96,7 @@ T}:T{ Name of the database in which the table is found T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -107,7 +107,7 @@ T}:T{ Degree of parallelism T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -118,7 +118,7 @@ T}:T{ Lock type T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -129,7 +129,7 @@ T}:T{ Sort resultset according to index whose name is supplied T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -140,7 +140,7 @@ T}:T{ Sort resultset in descending order (requires order flag) T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -151,7 +151,7 @@ T}:T{ Print header (set to 0|FALSE to disable headers in output) T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -162,7 +162,7 @@ T}:T{ Output numbers in hexadecimal format T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -173,17 +173,17 @@ T}:T{ Set a column delimiter T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP --disk T}:T{ Print disk references (useful only for Disk Data tables having - nonindexed columns) + nonindexed columns) T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -192,7 +192,7 @@ T}:T{ Print rowid T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -201,7 +201,7 @@ T}:T{ Include GCI in output T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -210,7 +210,7 @@ T}:T{ Include GCI and row epoch in output T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -221,7 +221,7 @@ T}:T{ Scan in tup order T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -230,7 +230,7 @@ T}:T{ Do not print table column data T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} .TE .sp 1 @@ -454,8 +454,8 @@ column providing information about the fragments in which rows are stored\&. Adds a GCI column to the output showing the global checkpoint at which each row was last updated\&. See -Section\ \&17.1, \(lqMySQL Cluster Overview\(rq, and -Section\ \&17.5.6.2, \(lqMySQL Cluster Log Events\(rq, for more information about checkpoints\&. +Section\ \&18.1, \(lqMySQL Cluster Overview\(rq, and +Section\ \&18.5.6.2, \(lqMySQL Cluster Log Events\(rq, for more information about checkpoints\&. .RE .sp .RS 4 @@ -505,8 +505,7 @@ Scan the table in the order of the tuples\&. .sp Causes any table data to be omitted\&. .RE - Sample Output -.PP +Sample Output.PP Output from a MySQL SELECT statement: @@ -603,7 +602,7 @@ NDBT_ProgramExit: 0 \- OK .SH "COPYRIGHT" .br .PP -Copyright \(co 1997, 2014, Oracle and/or its affiliates. All rights reserved. +Copyright \(co 1997, 2015, Oracle and/or its affiliates. All rights reserved. .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/mysql-wsrep-5.6/man/ndb_select_count.1 b/mysql-wsrep-5.6/man/ndb_select_count.1 index cd29f3a8..37fd7e42 100644 --- a/mysql-wsrep-5.6/man/ndb_select_count.1 +++ b/mysql-wsrep-5.6/man/ndb_select_count.1 @@ -2,12 +2,12 @@ .\" Title: \fBndb_select_count\fR .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 01/14/2014 +.\" Date: 01/16/2015 .\" Manual: MySQL Database System .\" Source: MySQL 5.6 .\" Language: English .\" -.TH "\FBNDB_SELECT_COUNT\" "1" "01/14/2014" "MySQL 5\&.6" "MySQL Database System" +.TH "\FBNDB_SELECT_COUNT\" "1" "01/16/2015" "MySQL 5\&.6" "MySQL Database System" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -40,7 +40,7 @@ prints the number of rows in one or more NDB tables\&. With a single table, the result is equivalent to that obtained by using the MySQL statement SELECT COUNT(*) FROM \fItbl_name\fR\&. - Usage +Usage .sp .if n \{\ .RS 4 @@ -61,7 +61,7 @@ Options Common to MySQL Cluster Programs(1)\&. .nr an-no-space-flag 1 .nr an-break-flag 1 .br -.B Table\ \&17.25.\ \&ndb_select_count Options and Variables: MySQL Cluster NDB 7.3 +.B Table\ \&18.93.\ \& This table describes command-line options for the ndb_select_count program .TS allbox tab(:); lB lB lB. @@ -70,7 +70,7 @@ Format T}:T{ Description T}:T{ -Added / Removed +Added or Removed T} .T& l l l @@ -78,43 +78,43 @@ l l l l l l. T{ .PP -\-\-database=dbname, +--database=dbname, .PP -\-d +-d T}:T{ Name of the database in which the table is found T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP -\-\-parallelism=#, +--parallelism=#, .PP -\-p +-p T}:T{ Degree of parallelism T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP -\-\-lock=#, +--lock=#, .PP -\-l +-l T}:T{ Lock type T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} .TE .sp 1 .PP You can obtain row counts from multiple tables in the same database by listing the table names separated by spaces when invoking this command, as shown under \fBSample Output\fR\&. - Sample Output +Sample Output .sp .if n \{\ .RS 4 @@ -131,7 +131,7 @@ NDBT_ProgramExit: 0 \- OK .SH "COPYRIGHT" .br .PP -Copyright \(co 1997, 2014, Oracle and/or its affiliates. All rights reserved. +Copyright \(co 1997, 2015, Oracle and/or its affiliates. All rights reserved. .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/mysql-wsrep-5.6/man/ndb_setup.py.1 b/mysql-wsrep-5.6/man/ndb_setup.py.1 index 62ccebf9..773767a3 100644 --- a/mysql-wsrep-5.6/man/ndb_setup.py.1 +++ b/mysql-wsrep-5.6/man/ndb_setup.py.1 @@ -2,12 +2,12 @@ .\" Title: \fBndb_setup.py\fR .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 01/14/2014 +.\" Date: 01/16/2015 .\" Manual: MySQL Database System .\" Source: MySQL 5.6 .\" Language: English .\" -.TH "\FBNDB_SETUP\&.PY\FR" "1" "01/14/2014" "MySQL 5\&.6" "MySQL Database System" +.TH "\FBNDB_SETUP\&.PY\FR" "1" "01/16/2015" "MySQL 5\&.6" "MySQL Database System" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -42,9 +42,8 @@ starts the MySQL Cluster Auto\-Installer and opens the installer\*(Aqs Start pag This section describes usage of and program options for the command\-line tool only\&. For information about using the Auto\-Installer GUI that is spawned when \fBndb_setup\&.py\fR is invoked, see -Section\ \&17.2.1, \(lqThe MySQL Cluster Auto-Installer\(rq\&. - Usage -.PP +Section\ \&18.2.1, \(lqThe MySQL Cluster Auto-Installer\(rq\&. +Usage.PP All platforms: .sp .if n \{\ @@ -79,7 +78,7 @@ The following table includes all options that are supported by the MySQL Cluster .nr an-no-space-flag 1 .nr an-break-flag 1 .br -.B Table\ \&17.26.\ \&ndb_setup\&.py Options and Variables: MySQL Cluster NDB 7.3 +.B Table\ \&18.94.\ \& This table describes command-line options for the ndb_setup.py program .TS allbox tab(:); lB lB lB. @@ -88,7 +87,7 @@ Format T}:T{ Description T}:T{ -Added / Removed +Added or Removed T} .T& l l l @@ -108,10 +107,10 @@ T{ .PP -s T}:T{ -Page that the web browser opens when starting\&. +Page that the web browser opens when starting. T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -119,11 +118,11 @@ T{ .PP -a T}:T{ -File containing list of client certificates allowed to connect to the - server +File containing list of client certificates allowed to connect to + the server T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -131,11 +130,11 @@ T{ .PP -c T}:T{ -File containing X509 certificate that identifies the server\&. (Default: - cfg\&.pem) +File containing X509 certificate that identifies the server. + (Default: cfg.pem) T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -143,11 +142,11 @@ T{ .PP -d T}:T{ -Python logging module debug level\&. One of DEBUG, INFO, WARNING - (default), ERROR, or CRITICAL\&. +Python logging module debug level. One of DEBUG, INFO, WARNING + (default), ERROR, or CRITICAL. T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -158,7 +157,7 @@ T}:T{ Print help message T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -166,10 +165,11 @@ T{ .PP -k T}:T{ -Specify file containing private key (if not included in \-\-cert\-file) +Specify file containing private key (if not included in + --cert-file) T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -180,7 +180,7 @@ T}:T{ Do not open the start page in a browser, merely start the tool T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -191,18 +191,19 @@ T}:T{ Specify the port used by the web server T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP -\-\-server\-log\-file=file, +--server-log-file=file, .PP o T}:T{ -Log requests to this file\&. Use \*(Aq\-\*(Aq to force logging to stderr instead\&. +Log requests to this file. Use '-' to force logging to stderr + instead. T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -213,18 +214,18 @@ T}:T{ The name of the server to connect with T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP -\-\-use\-https, +--use-https, .PP -\-S +-S T}:T{ -Use secure (HTTPS) client\-server connection +Use secure (HTTPS) client-server connection T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} .TE .sp 1 @@ -244,9 +245,7 @@ T} .TS allbox tab(:); l l s s -l l s s -l l s s -^ l l s +l l l s ^ l l s. T{ \fBCommand\-Line Format\fR @@ -254,16 +253,8 @@ T}:T{ \-\-browser\-start\-page=filename T} T{ -\ \& -T}:T{ -\-s -T} -T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ string @@ -294,9 +285,7 @@ index\&.html\&. .TS allbox tab(:); l l s s -l l s s -l l s s -^ l l s +l l l s ^ l l s. T{ \fBCommand\-Line Format\fR @@ -304,16 +293,8 @@ T}:T{ \-\-ca\-certs\-file=filename T} T{ -\ \& -T}:T{ -\-a -T} -T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ file name @@ -343,9 +324,7 @@ Specify a file containing a list of client certificates which are allowed to con .TS allbox tab(:); l l s s -l l s s -l l s s -^ l l s +l l l s ^ l l s. T{ \fBCommand\-Line Format\fR @@ -353,16 +332,8 @@ T}:T{ \-\-cert\-file=filename T} T{ -\ \& -T}:T{ -\-c -T} -T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ file name @@ -393,9 +364,7 @@ cfg\&.pem\&. .TS allbox tab(:); l l s s -l l s s -l l s s -^ l l s +l l l s ^ l l s ^ lt l s ^ ^ l s @@ -407,16 +376,8 @@ T}:T{ \-\-debug\-level=level T} T{ -\ \& -T}:T{ -\-d -T} -T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ enumeration @@ -466,18 +427,12 @@ is the default\&. \fB\-h\fR .TS allbox tab(:); -l l s s l l s s. T{ \fBCommand\-Line Format\fR T}:T{ \-\-help T} -T{ -\ \& -T}:T{ -\-h -T} .TE .sp 1 Print a help message\&. @@ -498,9 +453,7 @@ Print a help message\&. .TS allbox tab(:); l l s s -l l s s -l l s s -^ l l s +l l l s ^ l l s. T{ \fBCommand\-Line Format\fR @@ -508,16 +461,8 @@ T}:T{ \-\-key\-file=file T} T{ -\ \& -T}:T{ -\-k -T} -T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ file name @@ -529,7 +474,7 @@ T}:T{ T} .TE .sp 1 -Specify a file containing the private key if this is not included in in the X509 certificate file (\fB\-\-cert\-file\fR)\&. The default is an empty string, which means that no such file is used\&. +Specify a file containing the private key if this is not included in the X509 certificate file (\fB\-\-cert\-file\fR)\&. The default is an empty string, which means that no such file is used\&. .RE .sp .RS 4 @@ -546,18 +491,12 @@ Specify a file containing the private key if this is not included in in the X509 \fB\-n\fR .TS allbox tab(:); -l l s s l l s s. T{ \fBCommand\-Line Format\fR T}:T{ \-\-no\-browser T} -T{ -\ \& -T}:T{ -\-n -T} .TE .sp 1 Start the installation and configuration tool, but do not open the Start page in a browser\&. @@ -578,8 +517,7 @@ Start the installation and configuration tool, but do not open the Start page in .TS allbox tab(:); l l s s -l l s s -l l s s +l l l s ^ l l s ^ l l s ^ l l s. @@ -589,16 +527,8 @@ T}:T{ \-\-port=# T} T{ -\ \& -T}:T{ -\-p -T} -T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ numeric @@ -609,9 +539,14 @@ T}:T{ 8081 T} :T{ -\fBRange\fR +\fBMin Value\fR T}:T{ -1 \&.\&. 65535 +1 +T} +:T{ +\fBMax Value\fR +T}:T{ +65535 T} .TE .sp 1 @@ -634,8 +569,7 @@ Set the port used by the web server\&. The default is 8081\&. allbox tab(:); l l s s l l s s -l l s s -^ l l s +l l l s ^ l l s ^ lt l s. T{ @@ -649,11 +583,8 @@ T}:T{ o T} T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ file name @@ -692,9 +623,7 @@ stderr, rather than to a file, use a .TS allbox tab(:); l l s s -l l s s -l l s s -^ l l s +l l l s ^ l l s. T{ \fBCommand\-Line Format\fR @@ -702,16 +631,8 @@ T}:T{ \-\-server\-name=name T} T{ -\ \& -T}:T{ -\-N -T} -T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ string @@ -741,18 +662,12 @@ localhost\&. \fB\-S\fR .TS allbox tab(:); -l l s s l l s s. T{ \fBCommand\-Line Format\fR T}:T{ \-\-use\-https T} -T{ -\ \& -T}:T{ -\-S -T} .TE .sp 1 Make the browser use a secure (HTTPS) connection with the server\&. @@ -760,7 +675,7 @@ Make the browser use a secure (HTTPS) connection with the server\&. .SH "COPYRIGHT" .br .PP -Copyright \(co 1997, 2014, Oracle and/or its affiliates. All rights reserved. +Copyright \(co 1997, 2015, Oracle and/or its affiliates. All rights reserved. .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/mysql-wsrep-5.6/man/ndb_show_tables.1 b/mysql-wsrep-5.6/man/ndb_show_tables.1 index e99b7337..d84124d4 100644 --- a/mysql-wsrep-5.6/man/ndb_show_tables.1 +++ b/mysql-wsrep-5.6/man/ndb_show_tables.1 @@ -2,12 +2,12 @@ .\" Title: \fBndb_show_tables\fR .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 01/14/2014 +.\" Date: 01/16/2015 .\" Manual: MySQL Database System .\" Source: MySQL 5.6 .\" Language: English .\" -.TH "\FBNDB_SHOW_TABLES\F" "1" "01/14/2014" "MySQL 5\&.6" "MySQL Database System" +.TH "\FBNDB_SHOW_TABLES\F" "1" "01/16/2015" "MySQL 5\&.6" "MySQL Database System" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -52,7 +52,7 @@ Options Common to MySQL Cluster Programs(1)\&. .nr an-no-space-flag 1 .nr an-break-flag 1 .br -.B Table\ \&17.27.\ \&ndb_show_tables Options and Variables: MySQL Cluster NDB 7.3 +.B Table\ \&18.95.\ \& This table describes command-line options for the ndb_show_tables program .TS allbox tab(:); lB lB lB. @@ -61,7 +61,7 @@ Format T}:T{ Description T}:T{ -Added / Removed +Added or Removed T} .T& l l l @@ -79,7 +79,7 @@ T}:T{ Specifies the database in which the table is found T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -90,7 +90,7 @@ T}:T{ Number of times to repeat output T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -101,7 +101,7 @@ T}:T{ Limit output to objects of this type T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -112,7 +112,7 @@ T}:T{ Do not qualify table names T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -123,7 +123,7 @@ T}:T{ Return output suitable for MySQL LOAD DATA INFILE statement T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -132,11 +132,11 @@ T}:T{ Show table temporary flag T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} .TE .sp 1 - Usage +Usage .sp .if n \{\ .RS 4 @@ -307,7 +307,7 @@ API applications such as .SH "COPYRIGHT" .br .PP -Copyright \(co 1997, 2014, Oracle and/or its affiliates. All rights reserved. +Copyright \(co 1997, 2015, Oracle and/or its affiliates. All rights reserved. .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/mysql-wsrep-5.6/man/ndb_size.pl.1 b/mysql-wsrep-5.6/man/ndb_size.pl.1 index e33fb2fe..149f3d3a 100644 --- a/mysql-wsrep-5.6/man/ndb_size.pl.1 +++ b/mysql-wsrep-5.6/man/ndb_size.pl.1 @@ -2,12 +2,12 @@ .\" Title: \fBndb_size.pl\fR .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 01/14/2014 +.\" Date: 01/16/2015 .\" Manual: MySQL Database System .\" Source: MySQL 5.6 .\" Language: English .\" -.TH "\FBNDB_SIZE\&.PL\FR" "1" "01/14/2014" "MySQL 5\&.6" "MySQL Database System" +.TH "\FBNDB_SIZE\&.PL\FR" "1" "01/16/2015" "MySQL 5\&.6" "MySQL Database System" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -38,7 +38,7 @@ ndb_size.pl \- NDBCLUSTER Size Requirement Estimator This is a Perl script that can be used to estimate the amount of space that would be required by a MySQL database if it were converted to use the NDBCLUSTER storage engine\&. Unlike the other utilities discussed in this section, it does not require access to a MySQL Cluster (in fact, there is no reason for it to do so)\&. However, it does need to access the MySQL server on which the database to be tested resides\&. - Requirements +Requirements .sp .RS 4 .ie n \{\ @@ -102,7 +102,7 @@ Options Common to MySQL Cluster Programs(1)\&. .nr an-no-space-flag 1 .nr an-break-flag 1 .br -.B Table\ \&17.28.\ \&ndb_size\&.pl Options and Variables: MySQL Cluster NDB 7.3 +.B Table\ \&18.96.\ \& This table describes command-line options for the ndb_size.pl program .TS allbox tab(:); lB lB lB. @@ -111,7 +111,7 @@ Format T}:T{ Description T}:T{ -Added / Removed +Added or Removed T} .T& l l l @@ -129,11 +129,11 @@ T{ .PP --database=dbname T}:T{ -The database or databases to examine; accepts a comma\-delimited list; - the default is ALL (use all databases found on the server) +The database or databases to examine; accepts a comma-delimited + list; the default is ALL (use all databases found on the server) T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -142,7 +142,7 @@ T}:T{ Specify host and optional port as host[:port] T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -151,7 +151,7 @@ T}:T{ Specify a socket to connect to T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -160,7 +160,7 @@ T}:T{ Specify a MySQL user name T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -169,7 +169,7 @@ T}:T{ Specify a MySQL user password T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -178,25 +178,25 @@ T}:T{ Set output format (text or HTML) T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP --excludetables=tbl_list T}:T{ -Skip any tables in a comma\-separated list of tables +Skip any tables in a comma-separated list of tables T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP --excludedbs=db_list T}:T{ -Skip any databases in a comma\-separated list of databases +Skip any databases in a comma-separated list of databases T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -205,17 +205,17 @@ T}:T{ Saves all queries to the database into the file specified T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP --loadqueries=file T}:T{ Loads all queries from the file specified; does not connect to a - database + database T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -224,11 +224,11 @@ T}:T{ Designates a table to handle unique index size calculations T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} .TE .sp 1 - Usage +Usage .sp .if n \{\ .RS 4 @@ -397,7 +397,7 @@ required per table and table row\&. .SH "COPYRIGHT" .br .PP -Copyright \(co 1997, 2014, Oracle and/or its affiliates. All rights reserved. +Copyright \(co 1997, 2015, Oracle and/or its affiliates. All rights reserved. .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/mysql-wsrep-5.6/man/ndb_waiter.1 b/mysql-wsrep-5.6/man/ndb_waiter.1 index 953b487c..8c7c83e5 100644 --- a/mysql-wsrep-5.6/man/ndb_waiter.1 +++ b/mysql-wsrep-5.6/man/ndb_waiter.1 @@ -2,12 +2,12 @@ .\" Title: \fBndb_waiter\fR .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 01/14/2014 +.\" Date: 01/16/2015 .\" Manual: MySQL Database System .\" Source: MySQL 5.6 .\" Language: English .\" -.TH "\FBNDB_WAITER\FR" "1" "01/14/2014" "MySQL 5\&.6" "MySQL Database System" +.TH "\FBNDB_WAITER\FR" "1" "01/16/2015" "MySQL 5\&.6" "MySQL Database System" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -142,7 +142,7 @@ Options Common to MySQL Cluster Programs(1)\&. .nr an-no-space-flag 1 .nr an-break-flag 1 .br -.B Table\ \&17.29.\ \&ndb_waiter Options and Variables: MySQL Cluster NDB 7.3 +.B Table\ \&18.97.\ \& This table describes command-line options for the ndb_waiter program .TS allbox tab(:); lB lB lB. @@ -151,7 +151,7 @@ Format T}:T{ Description T}:T{ -Added / Removed +Added or Removed T} .T& l l l @@ -169,7 +169,7 @@ T}:T{ Wait for cluster to reach NO CONTACT state T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -178,7 +178,7 @@ T}:T{ Wait for cluster to reach NOT STARTED state T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -187,7 +187,7 @@ T}:T{ Wait for cluster to enter single user mode T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -195,20 +195,20 @@ T{ .PP -t T}:T{ -Wait this many seconds, then exit whether or not cluster has reached - desired state; default is 2 minutes (120 seconds) +Wait this many seconds, then exit whether or not cluster has + reached desired state; default is 2 minutes (120 seconds) T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP --nowait-nodes=list T}:T{ -List of nodes not to be waited for\&. +List of nodes not to be waited for. T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -216,14 +216,14 @@ T{ .PP -w T}:T{ -List of nodes to be waited for\&. +List of nodes to be waited for. T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} .TE .sp 1 - Usage +Usage .sp .if n \{\ .RS 4 @@ -234,7 +234,7 @@ ndb_waiter [\-c \fIconnect_string\fR] .if n \{\ .RE .\} - Additional Options +Additional Options .sp .RS 4 .ie n \{\ @@ -481,7 +481,7 @@ Connecting to mgmsrv at (null)\&. .SH "COPYRIGHT" .br .PP -Copyright \(co 1997, 2014, Oracle and/or its affiliates. All rights reserved. +Copyright \(co 1997, 2015, Oracle and/or its affiliates. All rights reserved. .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/mysql-wsrep-5.6/man/ndbd.8 b/mysql-wsrep-5.6/man/ndbd.8 index fe62a840..449f7b0d 100644 --- a/mysql-wsrep-5.6/man/ndbd.8 +++ b/mysql-wsrep-5.6/man/ndbd.8 @@ -2,12 +2,12 @@ .\" Title: \fBndbd\fR .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 01/14/2014 +.\" Date: 01/16/2015 .\" Manual: MySQL Database System .\" Source: MySQL 5.6 .\" Language: English .\" -.TH "\FBNDBD\FR" "8" "01/14/2014" "MySQL 5\&.6" "MySQL Database System" +.TH "\FBNDBD\FR" "8" "01/16/2015" "MySQL 5\&.6" "MySQL Database System" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -59,7 +59,7 @@ Options Common to MySQL Cluster Programs(1)\&. .nr an-no-space-flag 1 .nr an-break-flag 1 .br -.B Table\ \&17.10.\ \&ndbd Options and Variables: MySQL Cluster NDB 7.3 +.B Table\ \&18.78.\ \& This table describes command-line options for the ndbd program .TS allbox tab(:); lB lB lB. @@ -68,7 +68,7 @@ Format T}:T{ Description T}:T{ -Added / Removed +Added or Removed T} .T& l l l @@ -87,11 +87,11 @@ T{ .PP --initial T}:T{ -Perform initial start of ndbd, including cleaning the file system\&. - Consult the documentation before using this option +Perform initial start of ndbd, including cleaning the file system. + Consult the documentation before using this option T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -99,11 +99,11 @@ T{ .PP -n T}:T{ -Don\*(Aqt start ndbd immediately; ndbd waits for command to start from - ndb_mgmd +Don't start ndbd immediately; ndbd waits for command to start + from ndb_mgmd T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -111,10 +111,10 @@ T{ .PP -d T}:T{ -Start ndbd as daemon (default); override with \-\-nodaemon +Start ndbd as daemon (default); override with --nodaemon T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -123,36 +123,36 @@ T}:T{ Do not start ndbd as daemon; provided for testing purposes T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP --foreground T}:T{ Run ndbd in foreground, provided for debugging purposes (implies - \-\-nodaemon) + --nodaemon) T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP --nowait-nodes=list T}:T{ -Do not wait for these data nodes to start (takes comma\-separated list of - node IDs)\&. Also requires \-\-ndb\-nodeid to be used\&. +Do not wait for these data nodes to start (takes comma-separated + list of node IDs). Also requires --ndb-nodeid to be used. T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP --initial-start T}:T{ -Perform partial initial start (requires \-\-nowait\-nodes) +Perform partial initial start (requires --nowait-nodes) T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -161,46 +161,47 @@ T}:T{ Local bind address T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP --install[=name] T}:T{ -Used to install the data node process as a Windows service\&. Does not - apply on non\-Windows platforms\&. +Used to install the data node process as a Windows service. Does + not apply on non-Windows platforms. T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP --remove[=name] T}:T{ -Used to remove a data node process that was previously installed as a - Windows service\&. Does not apply on non\-Windows platforms\&. +Used to remove a data node process that was previously installed + as a Windows service. Does not apply on non-Windows platforms. T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP --connect-retries=# T}:T{ -Number of times to try contacting the management server; set to \-1 to - keep trying indefinitely +Number of times to try contacting the management server; set to -1 + to keep trying indefinitely T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP --connect-delay=# T}:T{ -Time to wait between attempts to contact a management server, in seconds +Time to wait between attempts to contact a management server, in + seconds T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} .TE .sp 1 @@ -237,8 +238,7 @@ wherever the latter occurs in this section\&. .TS allbox tab(:); l l s s -l l s s -^ l l s +l l l s ^ l l s. T{ \fBCommand\-Line Format\fR @@ -246,11 +246,8 @@ T}:T{ \-\-bind\-address=name T} T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ string @@ -279,9 +276,7 @@ to bind to a specific network interface (host name or IP address)\&. This option .TS allbox tab(:); l l s s -l l s s -l l s s -^ l l s +l l l s ^ l l s. T{ \fBCommand\-Line Format\fR @@ -289,16 +284,8 @@ T}:T{ \-\-daemon T} T{ -\ \& -T}:T{ -\-d -T} -T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ boolean @@ -337,8 +324,7 @@ on Windows platforms\&. .TS allbox tab(:); l l s s -l l s s -^ l l s +l l l s ^ l l s. T{ \fBCommand\-Line Format\fR @@ -346,11 +332,8 @@ T}:T{ \-\-nodaemon T} T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ boolean @@ -389,8 +372,7 @@ on Windows is to run in the foreground, making this option unnecessary on Window .TS allbox tab(:); l l s s -l l s s -^ l l s +l l l s ^ l l s. T{ \fBCommand\-Line Format\fR @@ -398,11 +380,8 @@ T}:T{ \-\-foreground T} T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ boolean @@ -443,8 +422,7 @@ on Windows platforms\&. .TS allbox tab(:); l l s s -l l s s -^ l l s +l l l s ^ l l s. T{ \fBCommand\-Line Format\fR @@ -452,11 +430,8 @@ T}:T{ \-\-initial T} T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ boolean @@ -556,7 +531,7 @@ Backup files that have already been created by the affected node .IP \(bu 2.3 .\} MySQL Cluster Disk Data files (see -Section\ \&17.5.12, \(lqMySQL Cluster Disk Data Tables\(rq)\&. +Section\ \&18.5.12, \(lqMySQL Cluster Disk Data Tables\(rq)\&. .RE .sp This option also has no effect on recovery of data by a data node that is just starting (or restarting) from data nodes that are already running\&. This recovery of data occurs automatically, and requires no user intervention in a MySQL Cluster that is running normally\&. @@ -581,8 +556,7 @@ necessary to do so\&. .TS allbox tab(:); l l s s -l l s s -^ l l s +l l l s ^ l l s. T{ \fBCommand\-Line Format\fR @@ -590,11 +564,8 @@ T}:T{ \-\-initial\-start T} T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ boolean @@ -660,8 +631,7 @@ option for .TS allbox tab(:); l l s s -l l s s -^ l l s +l l l s ^ l l s. T{ \fBCommand\-Line Format\fR @@ -669,11 +639,8 @@ T}:T{ \-\-nowait\-nodes=list T} T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ string @@ -718,9 +685,7 @@ If you wanted to start up the same cluster as in the previous example without on .TS allbox tab(:); l l s s -l l s s -l l s s -^ l l s +l l l s ^ l l s. T{ \fBCommand\-Line Format\fR @@ -728,16 +693,8 @@ T}:T{ \-\-nostart T} T{ -\ \& -T}:T{ -\-n -T} -T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ boolean @@ -756,7 +713,7 @@ not to start automatically\&. When this option is used, connects to the management server, obtains configuration data from it, and initializes communication objects\&. However, it does not actually start the execution engine until specifically requested to do so by the management server\&. This can be accomplished by issuing the proper START command in the management client (see -Section\ \&17.5.2, \(lqCommands in the MySQL Cluster Management Client\(rq)\&. +Section\ \&18.5.2, \(lqCommands in the MySQL Cluster Management Client\(rq)\&. .RE .sp .RS 4 @@ -774,7 +731,7 @@ Section\ \&17.5.2, \(lqCommands in the MySQL Cluster Management Client\(rq)\&. allbox tab(:); l l s s l l s s -^ l l s +l l l s ^ l l s. T{ \fBCommand\-Line Format\fR @@ -782,11 +739,13 @@ T}:T{ \-\-install[=name] T} T{ -\ \& +\fBPlatform Specific\fR T}:T{ -\fBPermitted Values\fR +Windows T} -:T{ +T{ +\fBPermitted Values\fR +T}:T{ \fBType\fR T}:T{ string @@ -842,7 +801,7 @@ option has no effect on non\-Windows platforms\&. allbox tab(:); l l s s l l s s -^ l l s +l l l s ^ l l s. T{ \fBCommand\-Line Format\fR @@ -850,11 +809,13 @@ T}:T{ \-\-remove[=name] T} T{ -\ \& +\fBPlatform Specific\fR T}:T{ -\fBPermitted Values\fR +Windows T} -:T{ +T{ +\fBPermitted Values\fR +T}:T{ \fBType\fR T}:T{ string @@ -890,7 +851,7 @@ option has no effect on non\-Windows platforms\&. .TS allbox tab(:); l l s s -l l s s +l l l s ^ l l s ^ l l s ^ l l s. @@ -900,11 +861,8 @@ T}:T{ \-\-connect\-retries=# T} T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ numeric @@ -915,9 +873,14 @@ T}:T{ 12 T} :T{ -\fBRange\fR +\fBMin Value\fR T}:T{ -\-1 \&.\&. 65535 +\-1 +T} +:T{ +\fBMax Value\fR +T}:T{ +65535 T} .TE .sp 1 @@ -940,7 +903,7 @@ option\&. .TS allbox tab(:); l l s s -l l s s +l l l s ^ l l s ^ l l s ^ l l s. @@ -950,11 +913,8 @@ T}:T{ \-\-connect\-delay=# T} T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ numeric @@ -965,9 +925,14 @@ T}:T{ 5 T} :T{ -\fBRange\fR +\fBMin Value\fR T}:T{ -0 \&.\&. 3600 +0 +T} +:T{ +\fBMax Value\fR +T}:T{ +3600 T} .TE .sp 1 @@ -1149,9 +1114,10 @@ shell> \fBndbd \-\-connect\-string="nodeid=2;host=ndb_mgmd\&.mysql\&.com:1186"\f .\} .PP See -Section\ \&17.3.2.3, \(lqMySQL Cluster Connection Strings\(rq, for additional information about this issue\&. -\fBndbd\fR(8), describes other options for -\fBndbd\fR\&. +Section\ \&18.3.2.3, \(lqMySQL Cluster Connection Strings\(rq, for additional information about this issue\&. +Options Common to MySQL Cluster Programs(1), describes other command\-line options which can be used with +\fBndbd\fR\&. For information about data node configuration parameters, see +Section\ \&18.3.2.6, \(lqDefining MySQL Cluster Data Nodes\(rq\&. .PP When \fBndbd\fR @@ -1175,11 +1141,11 @@ process can consume up to 2 CPUs if permitted to do so\&. For a machine with many CPUs it is possible to use several \fBndbd\fR processes which belong to different node groups; however, such a configuration is still considered experimental and is not supported for MySQL 5\&.6 in a production setting\&. See -Section\ \&17.1.6, \(lqKnown Limitations of MySQL Cluster\(rq\&. +Section\ \&18.1.6, \(lqKnown Limitations of MySQL Cluster\(rq\&. .SH "COPYRIGHT" .br .PP -Copyright \(co 1997, 2014, Oracle and/or its affiliates. All rights reserved. +Copyright \(co 1997, 2015, Oracle and/or its affiliates. All rights reserved. .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/mysql-wsrep-5.6/man/ndbd_redo_log_reader.1 b/mysql-wsrep-5.6/man/ndbd_redo_log_reader.1 index 1c81fd5b..fec5339d 100644 --- a/mysql-wsrep-5.6/man/ndbd_redo_log_reader.1 +++ b/mysql-wsrep-5.6/man/ndbd_redo_log_reader.1 @@ -2,12 +2,12 @@ .\" Title: \fBndbd_redo_log_reader\fR .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 01/14/2014 +.\" Date: 01/16/2015 .\" Manual: MySQL Database System .\" Source: MySQL 5.6 .\" Language: English .\" -.TH "\FBNDBD_REDO_LOG_REA" "1" "01/14/2014" "MySQL 5\&.6" "MySQL Database System" +.TH "\FBNDBD_REDO_LOG_REA" "1" "01/16/2015" "MySQL 5\&.6" "MySQL Database System" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -55,7 +55,7 @@ Options Common to MySQL Cluster Programs(1)\&. .nr an-no-space-flag 1 .nr an-break-flag 1 .br -.B Table\ \&17.22.\ \&ndbd_redo_log_reader Options and Variables: MySQL Cluster NDB 7.3 +.B Table\ \&18.90.\ \& This table describes command-line options for the ndbd_redo_log_reader program .TS allbox tab(:); lB lB lB. @@ -64,7 +64,7 @@ Format T}:T{ Description T}:T{ -Added / Removed +Added or Removed T} .T& l l l @@ -77,7 +77,7 @@ T}:T{ Do not print records T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -86,7 +86,7 @@ T}:T{ Do not check records for errors T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -95,11 +95,11 @@ T}:T{ Print usage information T}:T{ .PP -ADDED: NDB 7\&.3\&.4 +ADDED: NDB 7.3.4 T} .TE .sp 1 - Usage +Usage .sp .if n \{\ .RS 4 @@ -116,7 +116,7 @@ is the name of a cluster redo log file\&. redo log files are located in the numb ndb_\fI#\fR_fs/D\fI#\fR/LCP/\fI#\fR/T\fI#\fRF\fI#\fR\&.Data\&. In each case, the \fI#\fR represents a number (not necessarily the same number)\&. For more information, see -\m[blue]\fBMySQL Cluster Data Node FileSystemDir Files\fR\m[]\&\s-2\u[1]\d\s+2\&. +\m[blue]\fBMySQL Cluster Data Node File System Directory Files\fR\m[]\&\s-2\u[1]\d\s+2\&. .PP The name of the file to be read may be followed by one or more of the options listed here: .sp @@ -131,8 +131,7 @@ The name of the file to be read may be followed by one or more of the options li .TS allbox tab(:); l l s s -l l s s -^ l l s +l l l s ^ l l s. T{ \fBCommand\-Line Format\fR @@ -140,11 +139,8 @@ T}:T{ \-noprint T} T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ boolean @@ -170,8 +166,7 @@ T} .TS allbox tab(:); l l s s -l l s s -^ l l s +l l l s ^ l l s. T{ \fBCommand\-Line Format\fR @@ -179,11 +174,8 @@ T}:T{ \-nocheck T} T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ boolean @@ -213,7 +205,7 @@ l l s s. T{ \fBIntroduced\fR T}:T{ -5\&.6\&.14\-ndb\-7\&.3\&.4 +5\&.6\&.15\-ndb\-7\&.3\&.4 T} T{ \fBCommand\-Line Format\fR @@ -239,7 +231,7 @@ must be run on a cluster data node, since it accesses the data node file system .SH "COPYRIGHT" .br .PP -Copyright \(co 1997, 2014, Oracle and/or its affiliates. All rights reserved. +Copyright \(co 1997, 2015, Oracle and/or its affiliates. All rights reserved. .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP @@ -249,7 +241,7 @@ You should have received a copy of the GNU General Public License along with the .sp .SH "NOTES" .IP " 1." 4 -MySQL Cluster Data Node FileSystemDir Files +MySQL Cluster Data Node File System Directory Files .RS 4 \%http://dev.mysql.com/doc/ndbapi/en/ndb-internals-ndbd-filesystemdir-files.html .RE diff --git a/mysql-wsrep-5.6/man/ndbinfo_select_all.1 b/mysql-wsrep-5.6/man/ndbinfo_select_all.1 index 8f99a468..0736aa7d 100644 --- a/mysql-wsrep-5.6/man/ndbinfo_select_all.1 +++ b/mysql-wsrep-5.6/man/ndbinfo_select_all.1 @@ -2,12 +2,12 @@ .\" Title: \fBndbinfo_select_all\fR .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 01/14/2014 +.\" Date: 01/16/2015 .\" Manual: MySQL Database System .\" Source: MySQL 5.6 .\" Language: English .\" -.TH "\FBNDBINFO_SELECT_AL" "1" "01/14/2014" "MySQL 5\&.6" "MySQL Database System" +.TH "\FBNDBINFO_SELECT_AL" "1" "01/16/2015" "MySQL 5\&.6" "MySQL Database System" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -120,7 +120,7 @@ Options Common to MySQL Cluster Programs(1)\&. .nr an-no-space-flag 1 .nr an-break-flag 1 .br -.B Table\ \&17.11.\ \&ndbinfo_select_all Options and Variables: MySQL Cluster NDB 7.3 +.B Table\ \&18.79.\ \& This table describes command-line options for the ndbinfo_select_all program .TS allbox tab(:); lB lB lB. @@ -129,7 +129,7 @@ Format T}:T{ Description T}:T{ -Added / Removed +Added or Removed T} .T& l l l @@ -140,10 +140,10 @@ T{ .PP --delay=# T}:T{ -Set the delay in seconds between loops\&. Default is 5\&. +Set the delay in seconds between loops. Default is 5. T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -151,10 +151,10 @@ T{ .PP -l T}:T{ -Set the number of times to perform the select\&. Default is 1\&. +Set the number of times to perform the select. Default is 1. T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -162,10 +162,10 @@ T{ .PP -d T}:T{ -Name of the database where the table located\&. +Name of the database where the table located. T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} T{ .PP @@ -173,10 +173,10 @@ T{ .PP -p T}:T{ -Set the degree of parallelism\&. +Set the degree of parallelism. T}:T{ .PP -All MySQL 5\&.6 based releases +All MySQL 5.6 based releases T} .TE .sp 1 @@ -194,7 +194,7 @@ T} .TS allbox tab(:); l l s s -l l s s +l l l s ^ l l s ^ l l s ^ l l s. @@ -204,11 +204,8 @@ T}:T{ \-\-delay=# T} T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ numeric @@ -219,9 +216,14 @@ T}:T{ 5 T} :T{ -\fBRange\fR +\fBMin Value\fR T}:T{ -0 \&.\&. MAX_INT +0 +T} +:T{ +\fBMax Value\fR +T}:T{ +MAX_INT T} .TE .sp 1 @@ -245,8 +247,7 @@ is set to 0 or 1\&. .TS allbox tab(:); l l s s -l l s s -l l s s +l l l s ^ l l s ^ l l s ^ l l s. @@ -256,16 +257,8 @@ T}:T{ \-\-loops=# T} T{ -\ \& -T}:T{ -\-l -T} -T{ -\ \& -T}:T{ \fBPermitted Values\fR -T} -:T{ +T}:T{ \fBType\fR T}:T{ numeric @@ -276,9 +269,14 @@ T}:T{ 1 T} :T{ -\fBRange\fR +\fBMin Value\fR +T}:T{ +0 +T} +:T{ +\fBMax Value\fR T}:T{ -0 \&.\&. MAX_INT +MAX_INT T} .TE .sp 1 @@ -289,7 +287,7 @@ to set the time between loops\&. .SH "COPYRIGHT" .br .PP -Copyright \(co 1997, 2014, Oracle and/or its affiliates. All rights reserved. +Copyright \(co 1997, 2015, Oracle and/or its affiliates. All rights reserved. .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/mysql-wsrep-5.6/man/ndbmtd.8 b/mysql-wsrep-5.6/man/ndbmtd.8 index 3fd96d0c..b884308a 100644 --- a/mysql-wsrep-5.6/man/ndbmtd.8 +++ b/mysql-wsrep-5.6/man/ndbmtd.8 @@ -2,12 +2,12 @@ .\" Title: \fBndbmtd\fR .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 01/14/2014 +.\" Date: 01/16/2015 .\" Manual: MySQL Database System .\" Source: MySQL 5.6 .\" Language: English .\" -.TH "\FBNDBMTD\FR" "8" "01/14/2014" "MySQL 5\&.6" "MySQL Database System" +.TH "\FBNDBMTD\FR" "8" "01/16/2015" "MySQL 5\&.6" "MySQL Database System" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -59,7 +59,7 @@ Command\-line options and configuration parameters used with also apply to \fBndbmtd\fR\&. For more information about these options and parameters, see \fBndbd\fR(8), and -Section\ \&17.3.2.6, \(lqDefining MySQL Cluster Data Nodes\(rq, respectively\&. +Section\ \&18.3.2.6, \(lqDefining MySQL Cluster Data Nodes\(rq, respectively\&. .PP \fBndbmtd\fR is also file system\-compatible with @@ -203,7 +203,7 @@ concurrently on different data nodes in the same MySQL Cluster\&. However, such .SH "COPYRIGHT" .br .PP -Copyright \(co 1997, 2014, Oracle and/or its affiliates. All rights reserved. +Copyright \(co 1997, 2015, Oracle and/or its affiliates. All rights reserved. .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/mysql-wsrep-5.6/man/perror.1 b/mysql-wsrep-5.6/man/perror.1 index f04bcd2f..c6551e03 100644 --- a/mysql-wsrep-5.6/man/perror.1 +++ b/mysql-wsrep-5.6/man/perror.1 @@ -2,12 +2,12 @@ .\" Title: \fBperror\fR .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 01/14/2014 +.\" Date: 01/16/2015 .\" Manual: MySQL Database System .\" Source: MySQL 5.6 .\" Language: English .\" -.TH "\FBPERROR\FR" "1" "01/14/2014" "MySQL 5\&.6" "MySQL Database System" +.TH "\FBPERROR\FR" "1" "01/16/2015" "MySQL 5\&.6" "MySQL Database System" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -190,7 +190,7 @@ Display version information and exit\&. .SH "COPYRIGHT" .br .PP -Copyright \(co 1997, 2014, Oracle and/or its affiliates. All rights reserved. +Copyright \(co 1997, 2015, Oracle and/or its affiliates. All rights reserved. .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/mysql-wsrep-5.6/man/replace.1 b/mysql-wsrep-5.6/man/replace.1 index 123a0032..cbb77293 100644 --- a/mysql-wsrep-5.6/man/replace.1 +++ b/mysql-wsrep-5.6/man/replace.1 @@ -2,12 +2,12 @@ .\" Title: \fBreplace\fR .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 01/14/2014 +.\" Date: 01/16/2015 .\" Manual: MySQL Database System .\" Source: MySQL 5.6 .\" Language: English .\" -.TH "\FBREPLACE\FR" "1" "01/14/2014" "MySQL 5\&.6" "MySQL Database System" +.TH "\FBREPLACE\FR" "1" "01/16/2015" "MySQL 5\&.6" "MySQL Database System" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -169,7 +169,7 @@ Display version information and exit\&. .SH "COPYRIGHT" .br .PP -Copyright \(co 1997, 2014, Oracle and/or its affiliates. All rights reserved. +Copyright \(co 1997, 2015, Oracle and/or its affiliates. All rights reserved. .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/mysql-wsrep-5.6/man/resolve_stack_dump.1 b/mysql-wsrep-5.6/man/resolve_stack_dump.1 index 86e1a707..b0c0ad9e 100644 --- a/mysql-wsrep-5.6/man/resolve_stack_dump.1 +++ b/mysql-wsrep-5.6/man/resolve_stack_dump.1 @@ -2,12 +2,12 @@ .\" Title: \fBresolve_stack_dump\fR .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 01/14/2014 +.\" Date: 01/16/2015 .\" Manual: MySQL Database System .\" Source: MySQL 5.6 .\" Language: English .\" -.TH "\FBRESOLVE_STACK_DUM" "1" "01/14/2014" "MySQL 5\&.6" "MySQL Database System" +.TH "\FBRESOLVE_STACK_DUM" "1" "01/16/2015" "MySQL 5\&.6" "MySQL Database System" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -125,11 +125,11 @@ Display version information and exit\&. .RE .PP For more information, see -Section\ \&23.4.1.5, \(lqUsing a Stack Trace\(rq\&. +Section\ \&24.4.1.5, \(lqUsing a Stack Trace\(rq\&. .SH "COPYRIGHT" .br .PP -Copyright \(co 1997, 2014, Oracle and/or its affiliates. All rights reserved. +Copyright \(co 1997, 2015, Oracle and/or its affiliates. All rights reserved. .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/mysql-wsrep-5.6/man/resolveip.1 b/mysql-wsrep-5.6/man/resolveip.1 index e0ab41d5..4efad013 100644 --- a/mysql-wsrep-5.6/man/resolveip.1 +++ b/mysql-wsrep-5.6/man/resolveip.1 @@ -2,12 +2,12 @@ .\" Title: \fBresolveip\fR .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 01/14/2014 +.\" Date: 01/16/2015 .\" Manual: MySQL Database System .\" Source: MySQL 5.6 .\" Language: English .\" -.TH "\FBRESOLVEIP\FR" "1" "01/14/2014" "MySQL 5\&.6" "MySQL Database System" +.TH "\FBRESOLVEIP\FR" "1" "01/16/2015" "MySQL 5\&.6" "MySQL Database System" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -108,7 +108,7 @@ Display version information and exit\&. .SH "COPYRIGHT" .br .PP -Copyright \(co 1997, 2014, Oracle and/or its affiliates. All rights reserved. +Copyright \(co 1997, 2015, Oracle and/or its affiliates. All rights reserved. .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/mysql-wsrep-5.6/mysql-test/collections/default.daily b/mysql-wsrep-5.6/mysql-test/collections/default.daily index c72727bf..67c4c293 100644 --- a/mysql-wsrep-5.6/mysql-test/collections/default.daily +++ b/mysql-wsrep-5.6/mysql-test/collections/default.daily @@ -19,6 +19,10 @@ perl mysql-test-run.pl --force --timer --debug-server --parallel=auto --experime # Additional modes for rpl. Multi-Threaded Slave perl mysql-test-run.pl --timer --debug-server --force --parallel=auto --comment=rpl_MTS-debug --vardir=var-mts-rpl-debug --experimental=collections/default.experimental --mysqld=--slave-parallel-workers=4 --mysqld=--slave-transaction-retries=0 --suite=rpl +# Additional GTID coverage (rpl suite with gtid_mode=ON) +perl mysql-test-run.pl --force --timer --debug-server --parallel=auto --experimental=collections/default.experimental --comment=rpl_gtid-debug --vardir=var-rpl_gtid-debug --suite=rpl --mysqld=--enforce-gtid-consistency --mysqld=--log-slave-updates --mysqld=--gtid-mode=on --skip-test-list=collections/disabled-gtid-on.list + + # Additional GTID coverage (binlog suite with gtid_mode=ON) perl mysql-test-run.pl --force --timer --debug-server --parallel=auto --experimental=collections/default.experimental --comment=binlog_gtid-debug --vardir=var-binlog_gtid-debug --suite=binlog --mysqld=--binlog-checksum=CRC32 --mysqld=--enforce-gtid-consistency --mysqld=--log-slave-updates --mysqld=--gtid-mode=on --skip-test-list=collections/disabled-gtid-on.list diff --git a/mysql-wsrep-5.6/mysql-test/collections/default.experimental b/mysql-wsrep-5.6/mysql-test/collections/default.experimental index cf4b0132..25194282 100644 --- a/mysql-wsrep-5.6/mysql-test/collections/default.experimental +++ b/mysql-wsrep-5.6/mysql-test/collections/default.experimental @@ -14,7 +14,6 @@ main.index_merge_innodb # BUG#11754168 2012-05-08 jorgen Doing parts.partition_debug_innodb # Bug#14150368 2013-03-07 anitha Failing very frequently on PB2 rpl.rpl_delayed_slave # BUG#11764654 rpl_delayed_slave fails sporadically in pb -rpl.rpl_innodb_bug28430 # Bug#11754425 rpl.rpl_show_slave_running # BUG#12346048 2011-04-11 sven fails sporadically on pb2 rpl.rpl_spec_variables @solaris # Bug #17337114 2013-08-20 Luis Soares failing on pb2 with timeout for 'CHECK WARNINGS' rpl.rpl_gtid_logs_without_rotate_or_stop_event @windows # Bug#16207800 2013-02-09 anitha Fails very frequently on windows @@ -28,4 +27,3 @@ innodb.innodb_bug14676111 # bug#17026780 2013-07-08 anitha Or # normal developer builds. # Internal tests should *not* be listed in the public default.experimental! -i_innodb.innodb_bug14712710 bug#14765080 has been assigned to Thayu diff --git a/mysql-wsrep-5.6/mysql-test/collections/default.push b/mysql-wsrep-5.6/mysql-test/collections/default.push index 62002ce5..872b97fc 100644 --- a/mysql-wsrep-5.6/mysql-test/collections/default.push +++ b/mysql-wsrep-5.6/mysql-test/collections/default.push @@ -1,5 +1,5 @@ perl mysql-test-run.pl --timer --debug-server --force --parallel=auto --comment=n_mix-debug --vardir=var-n_mix --mysqld=--binlog-format=mixed --experimental=collections/default.experimental --skip-test-list=collections/disabled-per-push.list --unit-tests perl mysql-test-run.pl --timer --debug-server --force --parallel=auto --comment=rpl_binlog_ps_row-debug --vardir=var-rpl_binlog-ps_row --suite=rpl,binlog --ps-protocol --mysqld=--binlog-format=row --experimental=collections/default.experimental --skip-test-list=collections/disabled-per-push.list -perl mysql-test-run.pl --timer --debug-server --force --parallel=auto --comment=main_embedded-debug --vardir=var-main_emebbed --suite=main --embedded --experimental=collections/default.experimental --skip-test-list=collections/disabled-per-push.list +perl mysql-test-run.pl --timer --force --parallel=auto --comment=main_embedded-debug --vardir=var-main_embedded --suite=main --embedded --experimental=collections/default.experimental --skip-test-list=collections/disabled-per-push.list perl mysql-test-run.pl --timer --debug-server --force --parallel=auto --comment=innodb_4k_size-debug --vardir=var-innodb-4k --experimental=collections/default.experimental --suite=innodb --mysqld=--innodb-page-size=4k --skip-test-list=collections/disabled-per-push.list perl mysql-test-run.pl --timer --debug-server --force --parallel=auto --comment=rpl_binlog_n_mix_MTS-debug --vardir=var-mts-rpl-binlog-n_mix --mysqld=--binlog-format=mixed --experimental=collections/default.experimental --mysqld=--slave-parallel-workers=4 --mysqld=--slave-transaction-retries=0 --suite=rpl --skip-test-list=collections/disabled-per-push.list diff --git a/mysql-wsrep-5.6/mysql-test/collections/default.release.done b/mysql-wsrep-5.6/mysql-test/collections/default.release.done index a27b3bf8..3d1016bb 100644 --- a/mysql-wsrep-5.6/mysql-test/collections/default.release.done +++ b/mysql-wsrep-5.6/mysql-test/collections/default.release.done @@ -1 +1 @@ -/export/home/pb2/build/sb_0-11248614-1389713532.93/mysql-5.6.16-release-export-6194787_gpl/mysql-test/collections/default.release.in +/export/home/pb2/build/sb_0-14135359-1421674846.01/mysql-5.6.23-release-export-7480611_gpl/mysql-test/collections/default.release.in diff --git a/mysql-wsrep-5.6/mysql-test/collections/default.weekly b/mysql-wsrep-5.6/mysql-test/collections/default.weekly index 35df86b8..2ea6dc0c 100644 --- a/mysql-wsrep-5.6/mysql-test/collections/default.weekly +++ b/mysql-wsrep-5.6/mysql-test/collections/default.weekly @@ -47,6 +47,8 @@ perl mysql-test-run.pl --timer --force --debug-server --comment=memcached-debug # Non debug runs of default suites in normal modes perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=normal-non-debug --vardir=var-normal-non-debug --report-features --skip-test-list=collections/disabled-weekly.list +# Additional GTID coverage (rpl suite with gtid_mode=ON) +perl mysql-test-run.pl --force --timer --debug-server --parallel=auto --experimental=collections/default.experimental --comment=rpl_gtid-debug --vardir=var-rpl_gtid-debug --suite=rpl --mysqld=--enforce-gtid-consistency --mysqld=--log-slave-updates --mysqld=--gtid-mode=on --skip-test-list=collections/disabled-gtid-on.list --big-test --testcase-timeout=60 --suite-timeout=360 # Multi-Thread Slave diff --git a/mysql-wsrep-5.6/mysql-test/collections/disabled-gtid-on.list b/mysql-wsrep-5.6/mysql-test/collections/disabled-gtid-on.list index 9c994efb..828191fa 100644 --- a/mysql-wsrep-5.6/mysql-test/collections/disabled-gtid-on.list +++ b/mysql-wsrep-5.6/mysql-test/collections/disabled-gtid-on.list @@ -3,3 +3,4 @@ binlog.binlog_variables_relay_log : No need to test. Binary log off binlog.binlog_base64_flag : No need to test. Binary log off. binlog.binlog_hexdump : No need to test. Binary log off. binlog.binlog_old_versions : No need to test. Binary log off. +rpl.rpl_server_uuid : No need to test. Non-transactional tables involved. diff --git a/mysql-wsrep-5.6/mysql-test/extra/binlog_tests/binlog_mysqlbinlog_fill.inc b/mysql-wsrep-5.6/mysql-test/extra/binlog_tests/binlog_mysqlbinlog_fill.inc new file mode 100644 index 00000000..44a7f5f7 --- /dev/null +++ b/mysql-wsrep-5.6/mysql-test/extra/binlog_tests/binlog_mysqlbinlog_fill.inc @@ -0,0 +1,53 @@ +# ==== Purpose ==== +# +# Add [position|datetime] data to mysqlbinlog. To generate a binary log with +# a few deterministic,increasing timestamps. +# +# ==== Implementation ==== + +# We need to set fixed timestamps in this test. +# Use a date in the future to keep a growing timestamp along the +# binlog (including the Start_log_event). This test will work +# unchanged everywhere, because mysql-test-run has fixed TZ, which it +# exports (so mysqlbinlog has same fixed TZ). +# +# ===== Assumption ======== +# As this is a generic file and be used by other test, So we have made an +# assumption that a table is already created with defination like +# CREATE TABLE t1 (a INT); +# + +# Binlog 1: +# One transaction with timestamp 2031-01-01 12:00:00 +--let $datetime_1= 2031-01-01 12:00:00 +eval SET TIMESTAMP= UNIX_TIMESTAMP("$datetime_1"); +INSERT INTO t1 VALUES(1); +--let $pos_1= query_get_value(SHOW MASTER STATUS, Position, 1) + +# One transaction with timestamp 2032-01-01 12:00:00 +--let $datetime_2= 2032-01-01 12:00:00 +eval SET TIMESTAMP= UNIX_TIMESTAMP("$datetime_2"); +INSERT INTO t1 VALUES(2); +--let $pos_2= query_get_value(SHOW MASTER STATUS, Position, 1) + +# One transaction with timestamp 2033-01-01 12:00:00 +eval SET TIMESTAMP= UNIX_TIMESTAMP("2033-01-01 12:00:00"); +INSERT INTO t1 VALUES(3); + +--let $file_1= query_get_value(SHOW MASTER STATUS, File, 1) +FLUSH LOGS; + +#Binlog 2: +# One transaction with timestamp 2034-01-01 12:00:00 +SET TIMESTAMP= UNIX_TIMESTAMP("2034-01-01 12:00:00"); +INSERT INTO t1 VALUES(4); +--let $pos_3= query_get_value(SHOW MASTER STATUS, Position, 1) + +# One transaction with timestamp 2035-01-01 12:00:00 +--let $datetime_3= 2035-01-01 12:00:00 +eval SET TIMESTAMP= UNIX_TIMESTAMP("$datetime_3"); +INSERT INTO t1 VALUES(5); + +--let $file_2= query_get_value(SHOW MASTER STATUS, File, 1) +FLUSH LOGS; + diff --git a/mysql-wsrep-5.6/mysql-test/extra/binlog_tests/binlog_mysqlbinlog_start_stop.inc b/mysql-wsrep-5.6/mysql-test/extra/binlog_tests/binlog_mysqlbinlog_start_stop.inc index c0b13f53..982175ed 100644 --- a/mysql-wsrep-5.6/mysql-test/extra/binlog_tests/binlog_mysqlbinlog_start_stop.inc +++ b/mysql-wsrep-5.6/mysql-test/extra/binlog_tests/binlog_mysqlbinlog_start_stop.inc @@ -11,36 +11,7 @@ CREATE TABLE t1 (a INT); RESET MASTER; -# We need to set fixed timestamps in this test. -# Use a date in the future to keep a growing timestamp along the -# binlog (including the Start_log_event). This test will work -# unchanged everywhere, because mysql-test-run has fixed TZ, which it -# exports (so mysqlbinlog has same fixed TZ). ---let $datetime_1= 2031-01-01 12:00:00 -eval SET TIMESTAMP= UNIX_TIMESTAMP("$datetime_1"); -INSERT INTO t1 VALUES(1); ---let $pos_1= query_get_value(SHOW MASTER STATUS, Position, 1) - ---let $datetime_2= 2032-01-01 12:00:00 -eval SET TIMESTAMP= UNIX_TIMESTAMP("$datetime_2"); -INSERT INTO t1 VALUES(2); ---let $pos_2= query_get_value(SHOW MASTER STATUS, Position, 1) - -eval SET TIMESTAMP= UNIX_TIMESTAMP("2033-01-01 12:00:00"); -INSERT INTO t1 VALUES(3); - ---let $file_1= query_get_value(SHOW MASTER STATUS, File, 1) -FLUSH LOGS; - -SET TIMESTAMP= UNIX_TIMESTAMP("2034-01-01 12:00:00"); -INSERT INTO t1 VALUES(4); ---let $pos_3= query_get_value(SHOW MASTER STATUS, Position, 1) ---let $datetime_3= 2035-01-01 12:00:00 -eval SET TIMESTAMP= UNIX_TIMESTAMP("$datetime_3"); -INSERT INTO t1 VALUES(5); - ---let $file_2= query_get_value(SHOW MASTER STATUS, File, 1) -FLUSH LOGS; +--source extra/binlog_tests/binlog_mysqlbinlog_fill.inc --let $MYSQLD_DATADIR= `select @@datadir` @@ -80,12 +51,14 @@ FLUSH LOGS; --let $extra_options= --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT $file_1 $file_2 --source extra/binlog_tests/mysqlbinlog_start_stop_1.inc + # ==== to-last-log ==== --let $extra_options= --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT $file_1 ---let $option= --to-last-log +--let $options= --to-last-log --source extra/binlog_tests/mysqlbinlog_start_stop_2.inc + --echo --echo ==== clean up ==== DROP TABLE t1; diff --git a/mysql-wsrep-5.6/mysql-test/extra/binlog_tests/mysqlbinlog_start_stop_1.inc b/mysql-wsrep-5.6/mysql-test/extra/binlog_tests/mysqlbinlog_start_stop_1.inc index 42748df5..7b1ca145 100644 --- a/mysql-wsrep-5.6/mysql-test/extra/binlog_tests/mysqlbinlog_start_stop_1.inc +++ b/mysql-wsrep-5.6/mysql-test/extra/binlog_tests/mysqlbinlog_start_stop_1.inc @@ -27,26 +27,26 @@ # $extra_options # Options for mysqlbinlog, specifying which input file to read. ---let $option= --base64-output=never +--let $options= --base64-output=never --source extra/binlog_tests/mysqlbinlog_start_stop_2.inc ---let $option= --offset=2 +--let $options= --offset=2 --source extra/binlog_tests/mysqlbinlog_start_stop_2.inc ---let $option= --start-position=$start_position +--let $options= --start-position=$start_position --source extra/binlog_tests/mysqlbinlog_start_stop_2.inc ---let $option= --stop-position=$stop_position +--let $options= --stop-position=$stop_position --source extra/binlog_tests/mysqlbinlog_start_stop_2.inc ---let $option= --start-position=$start_position --stop-position=$stop_position +--let $options= --start-position=$start_position --stop-position=$stop_position --source extra/binlog_tests/mysqlbinlog_start_stop_2.inc ---let $option= "--start-datetime=$start_datetime" +--let $options= "--start-datetime=$start_datetime" --source extra/binlog_tests/mysqlbinlog_start_stop_2.inc ---let $option= "--stop-datetime=$stop_datetime" +--let $options= "--stop-datetime=$stop_datetime" --source extra/binlog_tests/mysqlbinlog_start_stop_2.inc ---let $option= "--start-datetime=$start_datetime" "--stop-datetime=$stop_datetime" +--let $options= "--start-datetime=$start_datetime" "--stop-datetime=$stop_datetime" --source extra/binlog_tests/mysqlbinlog_start_stop_2.inc diff --git a/mysql-wsrep-5.6/mysql-test/extra/binlog_tests/mysqlbinlog_start_stop_2.inc b/mysql-wsrep-5.6/mysql-test/extra/binlog_tests/mysqlbinlog_start_stop_2.inc index 103f33d0..108cefec 100644 --- a/mysql-wsrep-5.6/mysql-test/extra/binlog_tests/mysqlbinlog_start_stop_2.inc +++ b/mysql-wsrep-5.6/mysql-test/extra/binlog_tests/mysqlbinlog_start_stop_2.inc @@ -20,15 +20,24 @@ # Pretty-print $option_text ---let $option_text= `SELECT SUBSTR(REPLACE('$option', '"', ''), 3)` -while (`SELECT LOCATE('=', '$option_text')`) +--let $option_text= `SELECT REPLACE('$options', '"', '')` +--let $eq_pos= `SELECT LOCATE('=', '$option_text')` +while ($eq_pos != 0) { - --let $dash_pos= `SELECT LOCATE('--', '$option_text')` - --let $option_text= `SELECT CONCAT(SUBSTR('$option_text', 1, LOCATE('=', '$option_text') - 1), IF($dash_pos, CONCAT(' ', SUBSTR('$option_text', $dash_pos + 2)), ''))` + --let $dash_pos= `SELECT LOCATE('--', '$option_text', $eq_pos)` + --let $left_part= `SELECT SUBSTR('$option_text', 1, $eq_pos - 1)` + --let $right_part= + if ($dash_pos != 0) { + --let $right_part= `SELECT CONCAT(' ', SUBSTR('$option_text', $dash_pos + 2))` + } + --let $option_text= $left_part$right_part + --let $eq_pos= `SELECT LOCATE('=', '$option_text')` } +--let $option_text= `SELECT REPLACE('$option_text', '--', '')` + --echo --echo ---- $option_text ---- # Print output --replace_regex /SET @@SESSION.GTID_NEXT= '.*'/SET @@SESSION.GTID_NEXT= 'GTID'/ /([0-9A-Fa-f\-]{36})\:[0-9]+\-[0-9]+/UUID:#-#/ ---exec $MYSQL_BINLOG --short-form $option $extra_options +--exec $MYSQL_BINLOG --short-form $options $extra_options diff --git a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/grep_pattern.inc b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/grep_pattern.inc new file mode 100644 index 00000000..a51b57b8 --- /dev/null +++ b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/grep_pattern.inc @@ -0,0 +1,22 @@ +# Please set GREP_FILE and GREP_PATTERN environment variables +# to work this file properly. +--perl + use strict; + my $file= $ENV{'GREP_FILE'} or die "grep file not set"; + my $pattern= $ENV{'GREP_PATTERN'} or die "pattern is not set"; + open(FILE, "$file") or die("Unable to open $file: $!\n"); + my $count = 0; + print "Matching lines are:\n"; + while () { + my $line = $_; + if ($line =~ /$pattern/) { + print "$line\n"; + $count++; + } + } + if ($count == 0) { + print "None\n"; + } + print "Occurrences of the $pattern in the input file : $count\n"; + close(FILE); +EOF diff --git a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_auto_increment.test b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_auto_increment.test index a7e8af22..ff68e306 100644 --- a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_auto_increment.test +++ b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_auto_increment.test @@ -8,7 +8,7 @@ eval create table t1 (a int not null auto_increment,b int, primary key (a)) engi insert into t1 values (NULL,1),(NULL,2),(NULL,3); select * from t1; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc select * from t1; connection master; drop table t1; @@ -19,7 +19,7 @@ delete from t1 where b=4; insert into t1 values (NULL,5),(NULL,6); select * from t1; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc select * from t1; connection master; @@ -38,7 +38,7 @@ set @@insert_id=400; insert into t1 values(NULL),(NULL); select * from t1; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc select * from t1; connection master; drop table t1; @@ -56,7 +56,7 @@ set @@insert_id=400; insert into t1 values(NULL),(NULL); select * from t1; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc select * from t1; connection master; drop table t1; @@ -74,7 +74,7 @@ set @@insert_id=600; insert ignore into t1 values(600),(NULL),(NULL),(610),(NULL); select * from t1; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc select * from t1; connection master; drop table t1; @@ -86,7 +86,7 @@ set @@session.auto_increment_increment=10, @@session.auto_increment_offset=1; eval create table t1 (a int not null auto_increment, primary key (a)) engine=$engine_type2; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc insert into t1 values(2),(12),(22),(32),(42); connection master; @@ -94,7 +94,7 @@ insert into t1 values (NULL),(NULL); insert into t1 values (3),(NULL),(NULL); select * from t1; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc select * from t1; # Test for BUG#20524 "auto_increment_* not observed when inserting @@ -129,7 +129,7 @@ set auto_increment_increment=1000; set auto_increment_offset=700; insert into t3 values(null); select * from t3 order by a; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc select * from t1 order by a; select * from t2 order by a; select * from t3 order by a; @@ -137,7 +137,7 @@ select * from t3 order by a; connection master; drop table t1,t2,t3; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc # # BUG#41986 Replication slave does not pick up proper AUTO_INCREMENT value for Innodb tables @@ -149,7 +149,7 @@ CREATE TABLE t1 (id MEDIUMINT NOT NULL AUTO_INCREMENT PRIMARY KEY) ENGINE=innodb INSERT INTO t1 VALUES (NULL), (NULL), (NULL); show create table t1; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc show create table t1; connection master; @@ -200,7 +200,7 @@ SELECT * FROM t2; INSERT INTO t1 VALUES(4); INSERT INTO t2 VALUES(4); FLUSH LOGS; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc let $diff_tables= master:t1, slave:t1; source include/diff_tables.inc; @@ -211,7 +211,7 @@ source include/diff_tables.inc; connection master; DROP TABLE t1; DROP TABLE t2; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc connection master; let $MYSQLD_DATADIR= `SELECT @@DATADIR`; @@ -230,7 +230,7 @@ connection slave; source include/start_slave.inc; connection master; --exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.saved | $MYSQL test -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc let $diff_tables= master:t1, slave:t1; source include/diff_tables.inc; @@ -243,7 +243,7 @@ source include/diff_tables.inc; DROP TABLE t1; DROP TABLE t2; SET SQL_MODE=''; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc # # BUG#56662 @@ -263,12 +263,12 @@ INSERT INTO t1(id,data) VALUES(0,2); SET SQL_MODE=0; COMMIT; SELECT * FROM t1; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc SELECT * FROM t1; connection master; DROP TABLE t1; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc # # WL#5872 "avoid using global heap memory to remember autoincrement @@ -277,12 +277,12 @@ sync_slave_with_master; connection master; eval create table t1(a int auto_increment primary key) engine=$engine_type; insert into t1 values (null),(null),(1025),(null); -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc select * from t1; let $diff_tables= master:t1, slave:t1; --source include/diff_tables.inc connection master; drop table t1; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc --source include/rpl_end.inc diff --git a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_auto_increment_insert_view.test b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_auto_increment_insert_view.test index 30b25955..a6684959 100644 --- a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_auto_increment_insert_view.test +++ b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_auto_increment_insert_view.test @@ -26,7 +26,7 @@ connection master; INSERT INTO v16(c1) VALUES (23), (24); INSERT INTO v16(c1) VALUES (25), (26); commit; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc --echo #Test if the results are consistent on master and slave --echo #for 'INSERT DATA INTO VIEW WHICH INVOKES TRIGGERS' let $diff_tables= master:t3, slave:t3; @@ -37,7 +37,7 @@ DROP TABLE t1; DROP TABLE t2; DROP TABLE t3; DROP VIEW v16; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc diff --git a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_auto_increment_invoke_trigger.test b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_auto_increment_invoke_trigger.test index f93d4353..1f166368 100644 --- a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_auto_increment_invoke_trigger.test +++ b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_auto_increment_invoke_trigger.test @@ -57,7 +57,7 @@ source include/show_binlog_events.inc; commit; connection master; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc --echo #Test if the results are consistent on master and slave --echo #for 'INVOKES A TRIGGER with $trigger_action action' let $diff_tables= master:t2, slave:t2; @@ -75,5 +75,5 @@ DROP TABLE t4; DROP TABLE t5; DROP TABLE t6; DROP FUNCTION f1_insert_triggered; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc diff --git a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_autoinc_func_invokes_trigger.test b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_autoinc_func_invokes_trigger.test index d7c26ea4..41900b9c 100644 --- a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_autoinc_func_invokes_trigger.test +++ b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_autoinc_func_invokes_trigger.test @@ -38,7 +38,7 @@ source include/show_binlog_events.inc; commit; connection master; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc --echo #Test if the results are consistent on master and slave --echo #for 'CALLS A FUNCTION which INVOKES A TRIGGER with $insert_action action' let $diff_tables= master:t2, slave:t2; @@ -51,5 +51,5 @@ drop table t1; drop table t2; drop table t3; drop function f1_two_inserts_trigger; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc diff --git a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_binlog_error.inc b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_binlog_error.inc new file mode 100644 index 00000000..2ee30462 --- /dev/null +++ b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_binlog_error.inc @@ -0,0 +1,483 @@ +# BUG#46166: MYSQL_BIN_LOG::new_file_impl is not propagating error +# when generating new name. +# +# WHY +# === +# +# We want to check whether error is reported or not when +# new_file_impl fails (this may happen when rotation is not +# possible because there is some problem finding an +# unique filename). +# +# HOW +# === +# +# Test cases are documented inline. +# +# The size of the data is tuned to match file sizes and rotations, so +# it is only executed in statement-based replication. + +-- source include/have_innodb.inc +-- source include/have_debug.inc +-- source include/master-slave.inc +-- source include/have_binlog_format_statement.inc + +-- echo ####################################################################### +-- echo ####################### PART 1: MASTER TESTS ########################## +-- echo ####################################################################### + + +### ACTION: stopping slave as it is not needed for the first part of +### the test + +-- connection slave +-- source include/stop_slave.inc +-- connection master + +--disable_query_log +call mtr.add_suppression("Can't generate a unique log-filename"); +call mtr.add_suppression("Writing one row to the row-based binary log failed.*"); +call mtr.add_suppression("Warning: [+-]?\d+ files and [+-]?\d+ streams is left open"); +call mtr.add_suppression("Error writing file .*"); +call mtr.add_suppression("The server was unable to create a new log file. " + "An incident event has been written to the binary " + "log which will stop the slaves."); +--enable_query_log + +--let $old_debug = `select @@global.debug` + +### ACTION: create a large file (> 4096 bytes) that will be later used +### in LOAD DATA INFILE to check binlog errors in its vacinity +-- let $load_file= $MYSQLTEST_VARDIR/tmp/bug_46166.data +-- let $MYSQLD_DATADIR= `select @@datadir` +-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +-- eval SELECT repeat('x',8192) INTO OUTFILE '$load_file' + +### ACTION: create a small file (< 4096 bytes) that will be later used +### in LOAD DATA INFILE to check for absence of binlog errors +### when file loading this file does not force flushing and +### rotating the binary log +-- let $load_file2= $MYSQLTEST_VARDIR/tmp/bug_46166-2.data +-- let $MYSQLD_DATADIR= `select @@datadir` +-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +-- eval SELECT repeat('x',10) INTO OUTFILE '$load_file2' + +RESET MASTER; + +-- echo ###################### TEST #1 + +### ASSERTION: no problem flushing logs (should show two binlogs) +FLUSH LOGS; +-- echo # assert: must show two binlogs +-- source include/show_binary_logs.inc + +-- echo ###################### TEST #2 + +### ASSERTION: check that FLUSH LOGS actually fails and reports +### failure back to the user if find_uniq_filename fails +### (should show just one binlog) + +RESET MASTER; +--disable_query_log +eval SET GLOBAL debug=IF(LENGTH('$old_debug') > 0, CONCAT('$old_debug', ":d,error_unique_log_filename"), 'd,error_unique_log_filename'); +--enable_query_log +-- error ER_NO_UNIQUE_LOGFILE +FLUSH LOGS; +-- echo # assert: must show one binlog +-- source include/show_binary_logs.inc + +### ACTION: clean up and move to next test +--disable_query_log +eval SET GLOBAL debug='$old_debug'; +--enable_query_log +RESET MASTER; + +-- echo ###################### TEST #3 + +### ACTION: create some tables (t1, t2, t4) and insert some values in +### table t1 +CREATE TABLE t1 (a INT); +CREATE TABLE t2 (a VARCHAR(16384)) Engine=InnoDB; +CREATE TABLE t4 (a VARCHAR(16384)) Engine=MyISAM; +INSERT INTO t1 VALUES (1); +RESET MASTER; + +### ASSERTION: we force rotation of the binary log because it exceeds +### the max_binlog_size option (should show three binary +### logs) + +-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +-- eval LOAD DATA INFILE '$load_file' INTO TABLE t2 + +# shows two binary logs +-- echo # assert: must show three binlog +-- source include/show_binary_logs.inc + +# clean up the table and the binlog to be used in next part of test +--disable_query_log +eval SET GLOBAL debug='$old_debug'; +--enable_query_log +DELETE FROM t2; +RESET MASTER; + +-- echo ###################### TEST #4 + +# Loading a row using LOAD DATA INFILE causing a binary log error +# should be rolled back. + +--disable_query_log +eval SET GLOBAL debug=IF(LENGTH('$old_debug') > 0, CONCAT('$old_debug', ":d,info,debug,enter,return,query,error_unique_log_filename"), 'd,info,debug,enter,return,query,error_unique_log_filename'); +--enable_query_log + +# Table should be empty to start with +SELECT count(*) FROM t2; + +-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +-- error ER_NO_UNIQUE_LOGFILE +-- eval LOAD DATA INFILE '$load_file' INTO TABLE t2 + +# show table +-- echo # assert: must still be empty since the LOAD DATA INFILE failed +SELECT count(*) FROM t2; + +# clean up the table and the binlog to be used in next part of test +--disable_query_log +eval SET GLOBAL debug='$old_debug'; +--enable_query_log +DELETE FROM t2; +RESET MASTER; + +-- echo ###################### TEST #5 + +### ASSERTION: load the small file into a transactional table and +### check that it succeeds + +--disable_query_log +eval SET GLOBAL debug=IF(LENGTH('$old_debug') > 0, CONCAT('$old_debug', ":d,error_unique_log_filename"), 'd,error_unique_log_filename'); +--enable_query_log +-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +-- eval LOAD DATA INFILE '$load_file2' INTO TABLE t2 + +# show table +-- echo # assert: must show one entry +SELECT count(*) FROM t2; + +# clean up the table and the binlog to be used in next part of test +--disable_query_log +eval SET GLOBAL debug='$old_debug'; +--enable_query_log +DELETE FROM t2; +RESET MASTER; + +-- echo ###################### TEST #6 + +# A failing LOAD DATA INFILE inside a transaction cause the commit to +# fail, rolling back the entire statement. + +--disable_query_log +eval SET GLOBAL debug=IF(LENGTH('$old_debug') > 0, CONCAT('$old_debug', ":d,error_unique_log_filename"), 'd,error_unique_log_filename'); +--enable_query_log + +-- echo # Table should be empty +SELECT count(*) FROM t2; + +SET AUTOCOMMIT=0; +INSERT INTO t2 VALUES ('muse'); +-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +-- eval LOAD DATA INFILE '$load_file' INTO TABLE t2 +INSERT INTO t2 VALUES ('muse'); +-- error ER_NO_UNIQUE_LOGFILE +COMMIT; + +### ACTION: Show the contents of the table after the test +-- echo # Table should still be empty since the commit failed. +SELECT count(*) FROM t2; + +### ACTION: clean up and move to the next test +SET AUTOCOMMIT= 1; +--disable_query_log +eval SET GLOBAL debug='$old_debug'; +--enable_query_log +DELETE FROM t2; +RESET MASTER; + +-- echo ###################### TEST #7 + +### ASSERTION: check that on a non-transactional table, if rotation +### fails then an error is reported and an incident event +### is written to the current binary log. + +--disable_query_log +eval SET GLOBAL debug=IF(LENGTH('$old_debug') > 0, CONCAT('$old_debug', ":d,error_unique_log_filename"), 'd,error_unique_log_filename'); +--enable_query_log +SELECT count(*) FROM t4; +-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +-- error ER_NO_UNIQUE_LOGFILE +-- eval LOAD DATA INFILE '$load_file' INTO TABLE t4 + +-- echo # assert: must show 1 entry +SELECT count(*) FROM t4; + +-- echo ### check that the incident event is written to the current log +--disable_query_log +eval SET GLOBAL debug='$old_debug'; +--enable_query_log +-- let $binlog_limit= 1 +-- source include/show_binlog_events.inc + +# clean up and move to next test +DELETE FROM t4; +RESET MASTER; + +-- echo ###################### TEST #8 + +### ASSERTION: check that statements end up in error but they succeed +### on changing the data. + +# Insert some rows into t2, we will both try to insert and delete from +# it. + +SET @xxx = REPEAT('xxx', 1000); +SET @yyy = REPEAT('yyy', 1000); +INSERT INTO t2 VALUES (@xxx),(@yyy); + +--disable_query_log +eval SET GLOBAL debug=IF(LENGTH('$old_debug') > 0, CONCAT('$old_debug', ":d,error_unique_log_filename"), 'd,error_unique_log_filename'); +--enable_query_log +-- echo # must show 0 entries +SELECT count(*) FROM t4; +-- echo # must show 2 entries +SELECT count(*) FROM t2; + +-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +-- error ER_NO_UNIQUE_LOGFILE +-- eval LOAD DATA INFILE '$load_file' INTO TABLE t4 +-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +-- error ER_NO_UNIQUE_LOGFILE +-- eval LOAD DATA INFILE '$load_file' INTO TABLE t2 +set @aaa = repeat('aaa',1000); +set @bbb = repeat('bbb',1000); +set @ccc = repeat('ccc',1000); +-- error ER_NO_UNIQUE_LOGFILE +INSERT INTO t2 VALUES (@aaa), (@bbb), (@ccc); + +-- echo # INFO: Count(*) Before Offending DELETEs +-- echo # assert: must show 1 entry +SELECT count(*) FROM t4; +-- echo # assert: must show 2 entries since the LOAD DATA INFILE and +-- echo # INSERT INTO above was rolled back due to error. Only the +-- echo # original rows remain +SELECT count(*) FROM t2; + +-- error ER_NO_UNIQUE_LOGFILE +DELETE FROM t4 WHERE a IN (@xxx, @yyy) OR 1; +-- error ER_NO_UNIQUE_LOGFILE +DELETE FROM t2 WHERE a IN (@aaa, @bbb, @ccc) OR 1; + +-- echo # INFO: Count(*) After Offending DELETEs +-- echo # assert: must show zero entries +SELECT count(*) FROM t4; +-- echo # assert: must show 2 entries: the original two rows +SELECT count(*) FROM t2; + +# remove fault injection +--disable_query_log +eval SET GLOBAL debug='$old_debug'; +--enable_query_log + +# Empty t2 for following testing +DELETE FROM t2; + +-- echo ###################### TEST #9 + +### ASSERTION: check that if we disable binlogging, then statements +### succeed. +--disable_query_log +eval SET GLOBAL debug=IF(LENGTH('$old_debug') > 0, CONCAT('$old_debug', ":d,error_unique_log_filename"), 'd,error_unique_log_filename'); +--enable_query_log +SET SQL_LOG_BIN=0; +INSERT INTO t2 VALUES ('aaa'), ('bbb'), ('ccc'), ('ddd'); +INSERT INTO t4 VALUES ('eee'), ('fff'), ('ggg'), ('hhh'); +-- echo # assert: must show four entries +SELECT count(*) FROM t2; +SELECT count(*) FROM t4; +DELETE FROM t2; +DELETE FROM t4; +-- echo # assert: must show zero entries +SELECT count(*) FROM t2; +SELECT count(*) FROM t4; +SET SQL_LOG_BIN=1; +--disable_query_log +eval SET GLOBAL debug='$old_debug'; +--enable_query_log + +-- echo ###################### TEST #10 + +### ASSERTION: check that error is reported if there is a failure +### while registering the index file and the binary log +### file or failure to write the rotate event. + +call mtr.add_suppression("MYSQL_BIN_LOG::open failed to sync the index file."); +call mtr.add_suppression("Could not open .*"); + +RESET MASTER; +SHOW WARNINGS; + +# +d,fault_injection_registering_index => injects fault on MYSQL_BIN_LOG::open +# normalize strerror message for solaris10-sparc-64bit as long as errno is OK +--disable_query_log +eval SET GLOBAL debug=IF(LENGTH('$old_debug') > 0, CONCAT('$old_debug', ":d,fault_injection_registering_index"), 'd,fault_injection_registering_index'); +--enable_query_log +-- replace_regex /\.[\\\/]master/master/ /errno: 1 - .*\)/errno: 1 - Operation not permitted)/ +-- error ER_CANT_OPEN_FILE +FLUSH LOGS; +--disable_query_log +eval SET GLOBAL debug='$old_debug'; +--enable_query_log + +-- error ER_NO_BINARY_LOGGING +SHOW BINARY LOGS; + +# issue some statements and check that they don't fail +CREATE TABLE t5 (a INT); +INSERT INTO t4 VALUES ('bbbbb'); +INSERT INTO t2 VALUES ('aaaaa'); +DELETE FROM t4; +DELETE FROM t2; +DROP TABLE t5; + +-- echo ###################### TEST #11 + +### ASSERTION: check that error is reported if there is a failure +### while opening the index file and the binary log file or +### failure to write the rotate event. + +# restart the server so that we have binlog again +--let $rpl_server_number= 1 +--source include/rpl_restart_server.inc + +# +d,fault_injection_openning_index => injects fault on MYSQL_BIN_LOG::open_index_file +--disable_query_log +eval SET GLOBAL debug=IF(LENGTH('$old_debug') > 0, CONCAT('$old_debug', ":d,fault_injection_openning_index"), 'd,fault_injection_openning_index'); +--enable_query_log +# normalize strerror message for solaris10-sparc-64bit as long as errno is OK +-- replace_regex /\.[\\\/]master/master/ /errno: 1 - .*\)/errno: 1 - Operation not permitted)/ +-- error ER_CANT_OPEN_FILE +FLUSH LOGS; +--disable_query_log +eval SET GLOBAL debug='$old_debug'; +--enable_query_log + +-- error ER_FLUSH_MASTER_BINLOG_CLOSED +RESET MASTER; + +# issue some statements and check that they don't fail +CREATE TABLE t5 (a INT); +INSERT INTO t4 VALUES ('bbbbb'); +INSERT INTO t2 VALUES ('aaaaa'); +DELETE FROM t4; +DELETE FROM t2; +DROP TABLE t5; + +# restart the server so that we have binlog again +--let $rpl_server_number= 1 +--source include/rpl_restart_server.inc + +-- echo ###################### TEST #12 + +### ASSERTION: check that error is reported if there is a failure +### while writing the rotate event when creating a new log +### file. + +# +d,fault_injection_new_file_rotate_event => injects fault on MYSQL_BIN_LOG::MYSQL_BIN_LOG::new_file_impl +--disable_query_log +eval SET GLOBAL debug=IF(LENGTH('$old_debug') > 0, CONCAT('$old_debug', ":d,fault_injection_new_file_rotate_event"), 'd,fault_injection_new_file_rotate_event'); +--enable_query_log +-- error ER_ERROR_ON_WRITE +FLUSH LOGS; +--disable_query_log +eval SET GLOBAL debug='$old_debug'; +--enable_query_log + +-- error ER_FLUSH_MASTER_BINLOG_CLOSED +RESET MASTER; +# issue some statements and check that they don't fail +CREATE TABLE t5 (a INT); +INSERT INTO t4 VALUES ('bbbbb'); +INSERT INTO t2 VALUES ('aaaaa'); +DELETE FROM t4; +DELETE FROM t2; +DROP TABLE t5; + +# restart the server so that we have binlog again +--let $rpl_server_number= 1 +--source include/rpl_restart_server.inc + +## clean up +--disable_query_log +eval SET GLOBAL debug= '$old_debug'; +--enable_query_log +DROP TABLE t1, t2, t4; +RESET MASTER; + +# restart slave again +-- connection slave +-- source include/start_slave.inc +-- connection master + +-- echo ####################################################################### +-- echo ####################### PART 2: SLAVE TESTS ########################### +-- echo ####################################################################### + +### setup +--source include/rpl_reset.inc +-- connection slave + +# slave suppressions + +call mtr.add_suppression("Slave I/O: Relay log write failure: could not queue event from master.*"); +call mtr.add_suppression("Error writing file .*"); +call mtr.add_suppression("Could not open .*"); +call mtr.add_suppression("MYSQL_BIN_LOG::open failed to sync the index file."); +call mtr.add_suppression("Can't generate a unique log-filename .*"); +-- echo ###################### TEST #13 + +#### ASSERTION: check against unique log filename error +-- let $io_thd_injection_fault_flag= error_unique_log_filename +-- let $slave_io_errno= 1595 +-- let $show_slave_io_error= 1 +-- source include/io_thd_fault_injection.inc + +-- echo ###################### TEST #14 + +#### ASSERTION: check against rotate failing +-- let $io_thd_injection_fault_flag= fault_injection_new_file_rotate_event +-- let $slave_io_errno= 1595 +-- let $show_slave_io_error= 1 +-- source include/io_thd_fault_injection.inc + +-- echo ###################### TEST #15 + +#### ASSERTION: check against relay log open failure +-- let $io_thd_injection_fault_flag= fault_injection_registering_index +-- let $slave_io_errno= 1595 +-- let $show_slave_io_error= 1 +-- source include/io_thd_fault_injection.inc + +-- echo ###################### TEST #16 + +#### ASSERTION: check against relay log index open failure +-- let $io_thd_injection_fault_flag= fault_injection_openning_index +-- let $slave_io_errno= 1595 +-- let $show_slave_io_error= 1 +-- source include/io_thd_fault_injection.inc + +### clean up +-- source include/stop_slave_sql.inc +--disable_query_log +eval SET GLOBAL debug='$old_debug'; +--enable_query_log +RESET SLAVE; +RESET MASTER; +--let $rpl_only_running_threads= 1 +--source include/rpl_end.inc diff --git a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_blackhole.test b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_blackhole.test index 1a0eeb3c..6476366a 100644 --- a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_blackhole.test +++ b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_blackhole.test @@ -19,7 +19,7 @@ connection master; eval $statement; --echo [on slave] -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc --echo # Expect 0 SELECT COUNT(*) FROM t1; let $after = query_get_value("SHOW MASTER STATUS", Position, 1); diff --git a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_change_master.test b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_change_master.test index b24e45ab..a19cc605 100644 --- a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_change_master.test +++ b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_change_master.test @@ -10,7 +10,7 @@ let $save_master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1); connection master; # Make SQL slave thread advance a bit create table t1(n int); -sync_slave_with_master; +--sync_slave_with_master select * from t1; # Now stop it and make I/O slave thread be ahead stop slave sql_thread; @@ -48,7 +48,7 @@ sync_with_master; select * from t1; connection master; drop table t1; -sync_slave_with_master; +--sync_slave_with_master # End of 4.1 tests @@ -67,7 +67,7 @@ insert into t1 values (2); # Note: the master positon saved by this will also be used by the # 'sync_with_master' below. -sync_slave_with_master; +--sync_slave_with_master # Check if the table t1 and t2 are identical on master and slave; --let $diff_tables= master:t1, slave:t1 @@ -102,7 +102,7 @@ source include/wait_for_slave_io_to_start.inc; eval set global relay_log_purge=$relay_log_purge; connection master; drop table t1; -sync_slave_with_master; +--sync_slave_with_master } # diff --git a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_charset.test b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_charset.test index 5009dff8..13e87798 100644 --- a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_charset.test +++ b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_charset.test @@ -12,7 +12,7 @@ select "--- --master--" as ""; --enable_query_log show create database mysqltest2; show create database mysqltest3; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc --disable_query_log select "--- --slave--" as ""; --enable_query_log @@ -27,7 +27,7 @@ create database mysqltest3; select "--- --master--" as ""; --enable_query_log show create database mysqltest3; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc --disable_query_log select "--- --slave--" as ""; --enable_query_log @@ -47,7 +47,7 @@ insert into t1 (b) values(@@character_set_connection); insert into t1 (b) values(@@collation_connection); --echo --- --master-- select * from t1 order by a; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc --echo --- --slave-- select * from mysqltest2.t1 order by a; @@ -61,7 +61,7 @@ insert into t1 (b) values(@@collation_connection); insert into t1 (b) values(LEAST("Müller","Muffler")); --echo --- --master-- select * from t1 order by a; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc --echo --- --slave-- select * from mysqltest2.t1 order by a; @@ -83,14 +83,14 @@ truncate table t1; insert into t1 (b) values(collation(@a)); --echo --- --master-- select * from t1 order by a; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc --echo --- --slave-- select * from mysqltest2.t1 order by a; connection master; drop database mysqltest2; drop database mysqltest3; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc # Check that we can change global.collation_server (since 5.0.3) @@ -115,12 +115,12 @@ SET CHARACTER_SET_CLIENT=koi8r, CHARACTER_SET_RESULTS=koi8r; INSERT INTO t1 (c1, c2) VALUES ('îÕ, ÚÁ ÒÙÂÁÌËÕ','îÕ, ÚÁ ÒÙÂÁÌËÕ'); select hex(c1), hex(c2) from t1; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc select hex(c1), hex(c2) from t1; connection master; drop table t1; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc # # BUG#6676: Derivation of variables must be correct on slave diff --git a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_commit_after_flush.test b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_commit_after_flush.test index 7de4f421..5f15e57f 100644 --- a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_commit_after_flush.test +++ b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_commit_after_flush.test @@ -4,11 +4,11 @@ begin; insert into t1 values(1); flush tables with read lock; commit; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc # cleanup connection master; unlock tables; drop table t1; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc # End of 4.1 tests diff --git a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_conflicts.test b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_conflicts.test index 08f122bc..db62c7cc 100644 --- a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_conflicts.test +++ b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_conflicts.test @@ -61,8 +61,7 @@ connection master; CREATE TABLE t1(a INT PRIMARY KEY); --echo [on slave] -sync_slave_with_master; - +--source include/sync_slave_sql_with_master.inc --echo ==== Test: SQL thread sees 'INSERT' of existing key ==== @@ -121,7 +120,7 @@ DELETE FROM t1; INSERT INTO t1 VALUES (1); --echo [on slave] -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc DELETE FROM t1 WHERE a = 1; --echo ---- On master, remove the row that does not exist on slave ---- @@ -171,4 +170,4 @@ connection master; DROP TABLE t1; --echo [on slave] ---sync_slave_with_master +--source include/sync_slave_sql_with_master.inc diff --git a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_crash_safe.inc b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_crash_safe.inc index 2b109773..6a2d3720 100644 --- a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_crash_safe.inc +++ b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_crash_safe.inc @@ -95,7 +95,10 @@ if ($commands != '') { if ($failure != 'd,crash_after_apply') { - --let $outcome= O1 + if ($failure != 'd,crash_after_commit_before_update_pos') + { + --let $outcome= O1 + } } } --echo FAILURE $failure and OUTCOME $outcome diff --git a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_crash_safe.test b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_crash_safe.test index 63d69778..128d446e 100644 --- a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_crash_safe.test +++ b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_crash_safe.test @@ -2,16 +2,17 @@ # This test case aims at checking if a slave does not go out of sync after # injecting crashes at specific points. The following scenarios are analyzed: # -# |------------+-----------------------+---------+---------+---------| -# | SCENARIO # | SCENARIO | CRASH-1 | CRASH-2 | CRASH-3 | -# |------------+-----------------------+---------+---------+---------| -# | 1 | T | O1 | O1 | O2 | -# | 2 | T-* | O1 | O1 | O2 | -# | 3 | B T T-* C | O1 | O1 | O2 | -# | 4 | B T-* T C | O1 | O1 | O2 | -# | 5 | N | O3 | O3 | O2 | -# | 6 | N-* | O3 | O3 | O2 | -# |------------+-----------------------+---------+---------+---------| +# Following table represents the outcomes when Rli are on table. +# |------------+-----------------------+---------+---------+---------+---------| +# | SCENARIO # | SCENARIO | CRASH-1 | CRASH-2 | CRASH-3 | CRASH-4 | +# |------------+-----------------------+---------+---------+---------+---------| +# | 1 | T | O1 | O1 | O2 | O2 | +# | 2 | T-* | O1 | O1 | O2 | O2 | +# | 3 | B T T-* C | O1 | O1 | O2 | O2 | +# | 4 | B T-* T C | O1 | O1 | O2 | O2 | +# | 5 | N | O3 | O3 | O2 | O3 | +# | 6 | N-* | O3 | O3 | O2 | O3 | +# |------------+-----------------------+---------+---------+---------+---------| # # Legend: # @@ -45,6 +46,9 @@ # CRASH-3 - crash_after_commit_and_update_pos - after committing and updating # the positions. # +# CRASH-4 - crash_after_commit_before_update_pos - after committing and +# updating positions in (FILE). +# # After injecting the faults, we expect the following outcomes: # # O1. In this case, the slave shall correctly recover to "S" without going out @@ -88,7 +92,7 @@ connection master; --echo # EXECUTE CASES CRASHING THE XID --echo ################################################################################### connection master; ---let $failures= d,crash_after_apply d,crash_before_update_pos d,crash_after_update_pos_before_apply +--let $failures= d,crash_after_apply d,crash_before_update_pos d,crash_after_update_pos_before_apply d,crash_after_commit_before_update_pos # # Executes a set of tests while there are crash points in $failures. # @@ -209,13 +213,13 @@ while ($failures != '') --echo # CHECK CONSISTENCY --echo ################################################################################### connection master; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc connection master; let $MYSQLD_DATADIR= `SELECT @@datadir`; ---exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLD_DATADIR/test-crash-master.sql ---exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLD_DATADIR/test-crash-slave.sql +--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --set-gtid-purged=off --no-create-info test > $MYSQLD_DATADIR/test-crash-master.sql +--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --set-gtid-purged=off --no-create-info test > $MYSQLD_DATADIR/test-crash-slave.sql --diff_files $MYSQLD_DATADIR/test-crash-master.sql $MYSQLD_DATADIR/test-crash-slave.sql --echo ################################################################################### diff --git a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_ddl.test b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_ddl.test index 3b0348cc..9bd24641 100644 --- a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_ddl.test +++ b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_ddl.test @@ -129,7 +129,7 @@ # Some preparations ############################################################### # The sync_slave_with_master is needed to make the xids deterministic. -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc --echo --echo -------- switch to master ------- @@ -148,7 +148,7 @@ eval CREATE TABLE mysqltest1.t1 (f1 BIGINT) ENGINE=$engine_type; # slave uses MyISAM for the table mysqltest.t1. # This is not valid in case of suite/rpl_ndb/rpl_ndb_ddl.test which sources # also this script. -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc connection slave; if (`SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'mysqltest1' AND TABLE_NAME = 't1' @@ -186,7 +186,7 @@ eval CREATE TEMPORARY TABLE mysqltest1.t23 (f1 BIGINT) ENGINE=$temp_engine_type; # SET AUTOCOMMIT = 0; use mysqltest1; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc --echo --echo -------- switch to slave -------- connection slave; @@ -326,7 +326,7 @@ let $my_master_commit= true; let $my_slave_commit= true; --source include/rpl_stmt_seq.inc SELECT * FROM mysqltest1.t7; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc --echo --echo -------- switch to slave -------- connection slave; diff --git a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_deadlock.test b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_deadlock.test index cd744df4..7af424e8 100644 --- a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_deadlock.test +++ b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_deadlock.test @@ -181,9 +181,7 @@ START SLAVE; let $slave_sql_errno= 1205; # ER_LOCK_TIMEOUT let $show_slave_sql_error= 0; -let $rpl_debug= 1; source include/wait_for_slave_sql_error.inc; -let $rpl_debug= 0; rollback; diff --git a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_delete_no_where.test b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_delete_no_where.test index 914bedc6..4ecdb724 100644 --- a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_delete_no_where.test +++ b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_delete_no_where.test @@ -4,14 +4,14 @@ eval create table t1 (a int, b int) engine=$engine_type; insert into t1 values(1,1); -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc select * from t1; connection master; delete from t1; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc select * from t1; # cleanup connection master; drop table t1; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc diff --git a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_do_table_filter_insensitive.inc b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_do_table_filter_insensitive.inc new file mode 100644 index 00000000..02d4254d --- /dev/null +++ b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_do_table_filter_insensitive.inc @@ -0,0 +1,16 @@ +# +# Bug #51639 +# This test verifies that 'do table'filters will follow +# the setting of lower_case_table_name to be case +# insensitive but accent sensitive when setting +# lower_case_table_name > 0 +# + +-- source include/master-slave.inc +-- source include/have_binlog_format_statement.inc + +-- source extra/rpl_tests/rpl_filters.test +let $replicate_do_table= query_get_value(SHOW SLAVE STATUS, Replicate_Do_Table, 1); +--echo Replicate_Do_Table: $replicate_do_table + +--source include/rpl_end.inc diff --git a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_do_table_filter_sensitive.inc b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_do_table_filter_sensitive.inc new file mode 100644 index 00000000..b04e2848 --- /dev/null +++ b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_do_table_filter_sensitive.inc @@ -0,0 +1,16 @@ +# +# Bug #51639 +# This test verifies that 'do table'filters will follow +# the setting of lower_case_table_name to be case +# sensitive and accent sensitive when setting +# lower_case_table_name == 0 +# + +-- source include/master-slave.inc +-- source include/have_binlog_format_statement.inc + +-- source extra/rpl_tests/rpl_filters.test +let $replicate_do_table= query_get_value(SHOW SLAVE STATUS, Replicate_Do_Table, 1); +--echo Replicate_Do_Table: $replicate_do_table + +--source include/rpl_end.inc diff --git a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_filters.test b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_filters.test index e2f42be3..d3e92626 100644 --- a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_filters.test +++ b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_filters.test @@ -12,11 +12,10 @@ INSERT INTO t2 VALUES (1); -- echo # On master -- source include/show_binlog_events.inc --- sync_slave_with_master +-- source include/sync_slave_sql_with_master.inc -- echo # On slave -- source include/show_binlog_events.inc -- connection master DROP DATABASE mydb; --- sync_slave_with_master - +-- source include/sync_slave_sql_with_master.inc diff --git a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_flsh_tbls.test b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_flsh_tbls.test index 6f7d6e4c..d85ec247 100644 --- a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_flsh_tbls.test +++ b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_flsh_tbls.test @@ -32,7 +32,7 @@ flush tables; let $wait_binlog_event= flush tables; source include/wait_for_binlog_event.inc; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc # Check that the slave is not confused. select * from t3; # Note that all this confusion may cause warnings 'table xx is open on rename' diff --git a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_foreign_key.test b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_foreign_key.test index db646a73..f20a31ab 100644 --- a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_foreign_key.test +++ b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_foreign_key.test @@ -13,7 +13,7 @@ INSERT INTO t2 VALUES (NULL,LAST_INSERT_ID()); SET FOREIGN_KEY_CHECKS=1; SELECT * FROM t1 ORDER BY a; SELECT * FROM t2 ORDER BY b; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc SELECT * FROM t1 ORDER BY a; SELECT * FROM t2 ORDER BY b; @@ -25,13 +25,13 @@ SET FOREIGN_KEY_CHECKS=0; # error and error code for error ER_DUP_ENTRY. Bug 16677 --error 1022, ER_DUP_ENTRY INSERT INTO t3 VALUES (1),(1); -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc connection master; SET FOREIGN_KEY_CHECKS=0; DROP TABLE IF EXISTS t1,t2,t3; SET FOREIGN_KEY_CHECKS=1; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc # # Bug #32468 delete rows event on a table with foreign key constraint fails @@ -50,7 +50,7 @@ set foreign_key_checks=0; delete from t1; --echo must sync w/o a problem (could not with the buggy code) -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc select count(*) from t1 /* must be zero */; diff --git a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_gtid_drop_table.inc b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_gtid_drop_table.inc new file mode 100644 index 00000000..edd61462 --- /dev/null +++ b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_gtid_drop_table.inc @@ -0,0 +1,48 @@ +# ==== Purpose ==== +# +# This include will try to issue the $statement after setting GTID_NEXT to the +# $next_gtid variable expecting $expected_error if it is defined and non-zero. +# +# If the $expected_error is defined and non-zero, this include will also +# rollback the statement to release the ownership of the previously set GTID. +# +# ==== Usage ==== +# +# --let $statement= XXX +# --let $next_gtid= 'UUID:NUMBER' +# [--$expected_error= ER_XXX] +# --source extra/rpl_tests/rpl_gtid_drop_table.inc +# +# Parameters: +# $statement +# The SQL statement to be executed. +# +# $next_gtid +# The GTID to be set as GTID_NEXT. +# +# $expected_error +# The error expected when issuing the command. +# Optional, not set means no expected error. + +if (!$statement) +{ + --die ERROR IN TEST: the "statement" variable must be set +} + +if (!$next_gtid) +{ + --die ERROR IN TEST: the "next_gtid" variable must be set +} + +--eval SET GTID_NEXT= $next_gtid +if ($expected_error) +{ + --echo ## Expecting error $expected_error after the statement + --error $expected_error + --eval $statement + ROLLBACK; +} +if (!$expected_error) +{ + --eval $statement +} diff --git a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_gtids_restart_slave_io_lost_trx.test b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_gtids_restart_slave_io_lost_trx.test new file mode 100644 index 00000000..902c6361 --- /dev/null +++ b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_gtids_restart_slave_io_lost_trx.test @@ -0,0 +1,112 @@ +# +# This test will verify if the slave SQL thread and the slave IO thread behave +# correctly when the IO thread is restarted in the middle of a transaction. +# +# It is expected that the IO thread will retrieve again the partial transaction +# from the beginning and that the SQL thread will rollback the partially +# retrieved transaction before applying the fully retrieved one. +# +# This test will insert some data in the master and then will stop the slave +# IO thread right after queuing an event of a given type, starting the IO +# thread again to fully retrieve the partially received transaction. +# + +--source include/have_gtid.inc + +# As this test depends on the use of a User_var_log_event in a DML statement +# we have to use statement based replication. +--source include/have_binlog_format_statement.inc +--source include/force_restart.inc +# Enable auto_position protocol +--let $use_gtids= 1 +--let $rpl_gtid_utils= 1 +--source include/master-slave.inc +# Test should run only on debug build +source include/have_debug.inc; +source include/have_debug_sync.inc; + +# Initial setup +--connection master +CREATE TABLE t1(i INT) ENGINE=InnoDB; +# The following "FLUSH LOGS" will make the master to clear the "created" flag +# of the Format Description events in the next binlog files (and also in +# their replicated versions in the slave's relaylog). +FLUSH LOGS; +--source include/sync_slave_sql_with_master.inc +SET @save_debug=@@global.debug; + +# +# Actual test starts here. +# +# Test will do the following five iterations +# 1.Stop I/O thread after reading GTID_LOG_EVENT +# 2.Stop I/O thread after reading QUERY_LOG_EVENT +# 3.Stop I/O thread after reading XID_LOG_EVENT +# which is equal to I/O thread sync with master +# 4.Stop I/O thread after the gtid is in EXECUTED_GTID_SET +# i.e., after sync slave sql thread with master. +# 5.Stop I/O thread after reading USER_VAR_LOG_EVENT +# and after that make sure there are no missing gtid events +# i.e., we will verify this by doing diff between master:t1, +# slave:t1. + +--let $i=1 +while ($i <= 5) +{ + if ($i == 1) + { + SET GLOBAL DEBUG='d,stop_io_after_reading_gtid_log_event'; + } + if ($i == 2) + { + SET GLOBAL DEBUG='d,stop_io_after_reading_query_log_event'; + } + if ($i == 3) + { + # Stopping sql thread to make sure that case 3 is not equal to case 4. + --source include/stop_slave_sql.inc + SET GLOBAL DEBUG='d,stop_io_after_reading_xid_log_event'; + } + if ($i == 5) + { + SET GLOBAL DEBUG='d,stop_io_after_reading_user_var_log_event'; + } + --connection master + BEGIN; + --eval INSERT INTO t1 VALUES ($i) + --eval SET @v= $i * 100 + --eval INSERT INTO t1 VALUES (@v) + COMMIT; + --connection slave + if ($i == 4) + { + --connection master + --source include/sync_slave_sql_with_master.inc + --source include/stop_slave_io.inc + } + --source include/wait_for_slave_io_to_stop.inc + # Remove the debug point and restart the slave threads + SET GLOBAL DEBUG= @save_debug; + + --source include/start_slave_io.inc + if ($i == 3) + { + --source include/start_slave_sql.inc + } + # Do one more insert on master and then sync slave with master (to make sure + # that re-replicating the events are done successfully. + --connection master + --eval INSERT INTO t1 VALUES ($i) + --source include/sync_slave_sql_with_master.inc + # Now compare master and slave's t1 table data + # to prove that there are no missing gtids. + --let diff_tables= master:t1, slave:t1 + --source include/diff_tables.inc + --inc $i +} + +# Cleanup +--connection master +DROP TABLE t1; + +--source include/rpl_end.inc diff --git a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_heartbeat_2slaves.inc b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_heartbeat_2slaves.inc new file mode 100644 index 00000000..1ad4d11b --- /dev/null +++ b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_heartbeat_2slaves.inc @@ -0,0 +1,133 @@ +############################################################# +# Author: Serge Kozlov +# Date: 02/19/2009 +# Purpose: Testing heartbeat for schema +# 1 master and 2 slaves +############################################################# +--let $rpl_topology= 1->2,1->3 +--source include/rpl_init.inc + +--let $rpl_connection_name= master +--let $rpl_server_number= 1 +--source include/rpl_connect.inc + +--let $rpl_connection_name= slave_1 +--let $rpl_server_number= 2 +--source include/rpl_connect.inc + +--let $rpl_connection_name= slave_2 +--let $rpl_server_number= 3 +--source include/rpl_connect.inc + +# +# Set different heartbeat periods for slaves +# +--connection slave_1 +--source include/stop_slave.inc +CHANGE MASTER TO MASTER_HEARTBEAT_PERIOD = 0.1; +--source include/start_slave.inc +--connection slave_2 +--source include/stop_slave.inc +--replace_column 2 #### +CHANGE MASTER TO MASTER_HEARTBEAT_PERIOD = 1; +--source include/start_slave.inc + +# +# Testing heartbeat for one master and two slaves +# + +# Check that heartbeat events sent to both slaves with correct periods +--connection slave_1 +let $status_var= slave_received_heartbeats; +let $status_var_value= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1); +let $status_var_comparsion= >; +--source include/wait_for_status_var.inc +--echo Slave has received heartbeat event +--connection slave_2 +let $status_var= slave_received_heartbeats; +let $status_var_value= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1); +let $status_var_comparsion= >; +--source include/wait_for_status_var.inc +--let $assert_cond= [slave_1:SHOW STATUS LIKE "slave_received_heartbeats", Value, 1] > [slave_2:SHOW STATUS LIKE "slave_received_heartbeats", Value, 1] +--let $assert_text= slave_1 should have received more heartbeats than slave_2 +--source include/assert.inc +--echo + +# Create topology master->slave_2->slave_1 and check that slave_1 +# receives heartbeat while slave_2 gets data. + +# slave_2 was started w/o --log-slave-updates because slave_2 should +# not send data from master to slave_1 + +--source include/rpl_stop_slaves.inc +--let $rpl_topology= 1->3->2 +--source include/rpl_change_topology.inc +--source include/rpl_start_slaves.inc +--connection slave_1 +--source include/stop_slave.inc +--replace_column 2 #### +CHANGE MASTER TO MASTER_HEARTBEAT_PERIOD=0.1; +--source include/start_slave.inc + +# Check heartbeat for new replication channel slave_2->slave +let $status_var= slave_received_heartbeats; +let $status_var_value= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1); +let $status_var_comparsion= >; +--source include/wait_for_status_var.inc +--echo slave_1 has received heartbeat event +--connection master +--echo [on master] +CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(10), c LONGTEXT); +INSERT INTO t1 VALUES (1, 'on master', ''); +SHOW TABLES; +--echo [on slave_2] +--let $sync_slave_connection= slave_2 +--source include/sync_slave_sql_with_master.inc +SHOW TABLES; +let $slave_2_pos_before= query_get_value(SHOW SLAVE STATUS, Read_Master_Log_Pos, 1); +--echo [on slave_1] +--let $sync_slave_connection= slave_1 +--source include/sync_slave_sql_with_master.inc +SHOW TABLES; +--connection master +--echo [on master] +--echo creating updates on master and send to slave_2 during 5 second +# Generate events on master and send to slave_2 during 5 second +let $i= 1; +let $j= 1; +let $k= 1; +--disable_query_log +while ($i) { + eval SET @c_text=REPEAT('1234567890', $j); + eval UPDATE t1 SET a=$j, c=@c_text; + --connection slave_2 + let $slave_2_pos= query_get_value(SHOW SLAVE STATUS, Read_Master_Log_Pos, 1); + if (`SELECT ($k*($slave_2_pos - $slave_2_pos_before)) > 0`) { + --connection slave_1 + let $slave_1_rcvd_heartbeats_before= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1); + let $k= 0; + let $time_before = `SELECT NOW()`; + } + if (`SELECT ((1-$k)*TIMESTAMPDIFF(SECOND,'$time_before',NOW())) > 5`) { + let $i= 0; + } + --connection master + inc $j; + sleep 0.1; +} +--enable_query_log +--connection slave_1 +--echo [on slave_1] +--let $assert_cond= [SHOW STATUS LIKE "slave_received_heartbeats", Value, 1] > $slave_1_rcvd_heartbeats_before +--let $assert_text= slave_1 should have received heartbeats +--source include/assert.inc +--echo + +# +# Clean up +# +--echo *** Clean up *** +--connection master +DROP TABLE t1; + +--source include/rpl_end.inc diff --git a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_ignore_table_filter_insensitive.inc b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_ignore_table_filter_insensitive.inc new file mode 100644 index 00000000..63daed8b --- /dev/null +++ b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_ignore_table_filter_insensitive.inc @@ -0,0 +1,15 @@ +# +# Bug #51639 +# This test verifies that 'ignore table' filter will follow +# the setting of lower_case_table_name to be case insensitive +# but accent sensitive when setting lower_case_table_name>0 +# + +-- source include/master-slave.inc +-- source include/have_binlog_format_statement.inc + +-- source extra/rpl_tests/rpl_filters.test +let $replicate_ignore_table= query_get_value(SHOW SLAVE STATUS, Replicate_Ignore_Table, 1); +--echo Replicate_Ignore_Table: $replicate_ignore_table + +--source include/rpl_end.inc diff --git a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_ignore_table_filter_sensitive.inc b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_ignore_table_filter_sensitive.inc new file mode 100644 index 00000000..2e7dfe89 --- /dev/null +++ b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_ignore_table_filter_sensitive.inc @@ -0,0 +1,15 @@ +# +# Bug #51639 +# This test verifies that 'ignore table' filter will follow +# the setting of lower_case_table_name to be case sensitive +# and accent sensitive when setting lower_case_table_name=0 +# + +-- source include/master-slave.inc +-- source include/have_binlog_format_statement.inc + +-- source extra/rpl_tests/rpl_filters.test +let $replicate_ignore_table= query_get_value(SHOW SLAVE STATUS, Replicate_Ignore_Table, 1); +--echo Replicate_Ignore_Table: $replicate_ignore_table + +--source include/rpl_end.inc diff --git a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_implicit_commit_binlog.test b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_implicit_commit_binlog.test index a509b698..c94160f2 100644 --- a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_implicit_commit_binlog.test +++ b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_implicit_commit_binlog.test @@ -658,7 +658,7 @@ SET AUTOCOMMIT= 1; --echo ################################################################################### --echo # CHECK CONSISTENCY --echo ################################################################################### ---sync_slave_with_master +--source include/sync_slave_sql_with_master.inc --let $diff_tables= master:tt_1,slave:tt_1 --source include/diff_tables.inc @@ -672,4 +672,4 @@ DROP TABLE tt_1; DROP TABLE tt_2; DROP TABLE nt_1; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc diff --git a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_insert_delayed.test b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_insert_delayed.test index d158b659..5a687e46 100644 --- a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_insert_delayed.test +++ b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_insert_delayed.test @@ -24,7 +24,7 @@ let $query = "INSERT DELAYED INTO t1 VALUES (null, 'Dr. No'), (null, 'From Russi FLUSH TABLE t1; # another way to be sure INSERT DELAYED has inserted SELECT COUNT(*) FROM t1; # when bug existed slave failed below ("duplicate key" error at random INSERT) -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc use mysqlslap; SELECT COUNT(*) FROM t1; @@ -52,7 +52,7 @@ if (`SELECT @@global.binlog_format != 'STATEMENT'`) } flush table t1; select * from t1; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc # when bug existed in statement-based binlogging, t1 on slave had # different content from on master select * from t1; @@ -74,7 +74,7 @@ if (`SELECT @@global.binlog_format != 'STATEMENT'`) } flush table t1; # to wait for INSERT DELAYED to be done select * from t1; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc # when bug existed in statement-based binlogging, query was binlogged # with error_code=0 so slave stopped select * from t1; @@ -83,7 +83,7 @@ select * from t1; connection master; USE test; DROP SCHEMA mysqlslap; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc use test; connection master; @@ -129,7 +129,7 @@ if (`SELECT @@global.binlog_format = 'STATEMENT'`) } select * from t1; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc echo On slave; if (`SELECT @@global.binlog_format = 'STATEMENT'`) { @@ -144,7 +144,7 @@ select * from t1; # clean up connection master; drop table t1; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc if (`SELECT @@global.binlog_format != 'ROW'`) { #flush the logs after the test diff --git a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_insert_id.test b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_insert_id.test index 32d861bd..9a4baab2 100644 --- a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_insert_id.test +++ b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_insert_id.test @@ -42,7 +42,7 @@ eval create table t2(b int auto_increment, c int, key(b)) engine=$engine_type; insert into t1 values (1),(2),(3); insert into t1 values (null); insert into t2 values (null,last_insert_id()); -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc select * from t1 ORDER BY a; select * from t2 ORDER BY b; connection master; @@ -61,7 +61,7 @@ insert into t1 values (null),(null),(null); insert into t2 values (5,0); insert into t2 values (null,last_insert_id()); SET FOREIGN_KEY_CHECKS=1; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc select * from t1; select * from t2; connection master; @@ -80,13 +80,13 @@ insert into t2 values (5,0); --disable_warnings ONCE insert into t2 (c) select * from t1 ORDER BY a; select * from t2 ORDER BY b; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc select * from t1 ORDER BY a; select * from t2 ORDER BY b; connection master; drop table t1; drop table t2; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc --echo # --echo # Bug#8412: Error codes reported in binary log for CHARACTER SET, @@ -100,10 +100,10 @@ SET FOREIGN_KEY_CHECKS=0; # Duplicate Key Errors --error 1022, ER_DUP_ENTRY INSERT INTO t1 VALUES (1),(1); -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc connection master; drop table t1; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc --echo # --echo # Bug#14553: NULL in WHERE resets LAST_INSERT_ID @@ -119,7 +119,7 @@ insert into t2 (a) select a from t1 where a is null; insert into t2 (a) select a from t1 where a is null; --enable_warnings select * from t2; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc connection slave; select * from t2; connection master; @@ -205,7 +205,7 @@ call foo(); select * from t1; select * from t2; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc select * from t1; select * from t2; connection master; @@ -232,7 +232,7 @@ set sql_log_bin=1; insert into t1 values(null,100); select * from t1 order by n; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc # make slave's table autoinc counter bigger insert into t1 values(null,200),(null,300); delete from t1 where b <> 100; @@ -243,7 +243,7 @@ select * from t1 order by n; connection master; replace into t1 values(null,100),(null,350); select * from t1 order by n; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc select * from t1 order by n; # Same test as for REPLACE, but for ON DUPLICATE KEY UPDATE @@ -255,7 +255,7 @@ connection master; --disable_warnings ONCE insert into t1 values (NULL,400),(3,500),(NULL,600) on duplicate key UPDATE n=1000; select * from t1 order by n; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc select * from t1 order by n; # and now test for the bug: @@ -265,7 +265,7 @@ eval create table t1 (n int primary key auto_increment not null, b int, unique(b)) engine=$engine_type; insert into t1 values(null,100); select * from t1 order by n; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc insert into t1 values(null,200),(null,300); delete from t1 where b <> 100; select * from t1 order by n; @@ -274,12 +274,12 @@ connection master; --disable_warnings ONCE insert into t1 values(null,100),(null,350) on duplicate key update n=2; select * from t1 order by n; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc select * from t1 order by n; connection master; drop table t1; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc # # BUG#24432 "INSERT... ON DUPLICATE KEY UPDATE skips auto_increment values" @@ -292,7 +292,7 @@ eval CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY AUTO_INCREMENT, b INT, --disable_warnings ONCE INSERT INTO t1(b) VALUES(1),(1),(2) ON DUPLICATE KEY UPDATE t1.b=10; SELECT * FROM t1 ORDER BY a; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc SELECT * FROM t1 ORDER BY a; connection master; drop table t1; @@ -335,7 +335,7 @@ ON DUPLICATE KEY UPDATE t1.field_3 = t2.field_c; --enable_warnings SELECT * FROM t1 ORDER BY id; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc SELECT * FROM t1 ORDER BY id; connection master; drop table t1, t2; @@ -382,7 +382,7 @@ CALL p1(); SELECT * FROM t1 ORDER BY id; SELECT * FROM t2 ORDER BY id; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc SELECT * FROM t1 ORDER BY id; SELECT * FROM t2 ORDER BY id; @@ -463,7 +463,7 @@ SELECT f3(); SELECT * FROM t1 ORDER BY i; SELECT * FROM t2 ORDER BY i; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc SELECT * FROM t1; SELECT * FROM t2; @@ -475,7 +475,7 @@ DROP FUNCTION f3; DROP TABLE t1, t2; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc --echo # --echo # End of 5.0 tests @@ -521,7 +521,7 @@ insert into t1 select insid(); select * from t1 order by id; select * from t2 order by id; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc select * from t1 order by id; select * from t2 order by id; @@ -546,7 +546,7 @@ call foo(); select * from t1 order by n; select * from t2 order by id; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc select * from t1 order by n; select * from t2 order by id; diff --git a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_insert_id_pk.test b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_insert_id_pk.test index f6152180..58593b70 100644 --- a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_insert_id_pk.test +++ b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_insert_id_pk.test @@ -19,7 +19,7 @@ create table t2(b int auto_increment, c int, primary key(b)); insert into t1 values (1),(2),(3); insert into t1 values (null); insert into t2 values (null,last_insert_id()); -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc select * from t1 ORDER BY a; select * from t2 ORDER BY b; connection master; @@ -38,7 +38,7 @@ insert into t1 values (null),(null),(null); insert into t2 values (5,0); insert into t2 values (null,last_insert_id()); SET FOREIGN_KEY_CHECKS=1; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc select * from t1; select * from t2; connection master; @@ -55,13 +55,13 @@ insert into t2 values (5,0); --disable_warnings ONCE insert into t2 (c) select * from t1 ORDER BY a; select * from t2 ORDER BY b; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc select * from t1 ORDER BY a; select * from t2 ORDER BY b; connection master; drop table t1; drop table t2; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc # # Bug#8412: Error codes reported in binary log for CHARACTER SET, @@ -74,7 +74,7 @@ SET FOREIGN_KEY_CHECKS=0; # Duplicate Key Errors codes --error 1022, ER_DUP_ENTRY INSERT INTO t1 VALUES (1),(1); -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc connection master; drop table t1; diff --git a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_insert_ignore.test b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_insert_ignore.test index f422ef35..ef3d1cb7 100644 --- a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_insert_ignore.test +++ b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_insert_ignore.test @@ -38,7 +38,7 @@ INSERT IGNORE INTO t1 SELECT NULL, t2.b FROM t2 ORDER BY t2.a; --source include/assert.inc # Compare master and slave ---sync_slave_with_master +--source include/sync_slave_sql_with_master.inc --let $diff_tables= master:test.t1 , slave:test.t1 --source include/diff_tables.inc @@ -66,6 +66,7 @@ if (`SELECT @@BINLOG_FORMAT != 'STATEMENT'`) } if (`SELECT @@BINLOG_FORMAT = 'STATEMENT'`) { + --source extra/rpl_tests/rpl_insert_ignore_gtid_on.inc --let $assert_cond= \'[\'SHOW BINLOG EVENTS IN "$binlog_file" FROM $binlog_start LIMIT 2, 1\', Info, 1]\' LIKE \'%$statement_file\' --let $assert_text= In SBR or MIXED modes, the event in the binlog should be the same that was executed. In RBR mode, binlog position should stay unchanged. } @@ -109,6 +110,7 @@ if (`SELECT @@BINLOG_FORMAT != 'STATEMENT'`) } if (`SELECT @@BINLOG_FORMAT = 'STATEMENT'`) { + --source extra/rpl_tests/rpl_insert_ignore_gtid_on.inc --let $assert_cond= \'[\'SHOW BINLOG EVENTS IN "$binlog_file" FROM $binlog_start LIMIT 1, 1\', Info, 1]\' LIKE \'%$statement_file\' --let $assert_text= In SBR or MIXED modes, the event in the binlog should be the same that was executed. In RBR mode, binlog position should stay unchanged. } @@ -118,4 +120,4 @@ if (`SELECT @@BINLOG_FORMAT = 'STATEMENT'`) # Clean up --connection master drop table t1, t2; ---sync_slave_with_master +--source include/sync_slave_sql_with_master.inc diff --git a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_insert_ignore_gtid_on.inc b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_insert_ignore_gtid_on.inc new file mode 100644 index 00000000..5f95feb5 --- /dev/null +++ b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_insert_ignore_gtid_on.inc @@ -0,0 +1,17 @@ +if (!`SELECT COUNT(*) = 0 OR VARIABLE_VALUE != 'ON' FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME = 'GTID_MODE'`) +{ + --let $i=1 + --let $j=1 + while ($i) + { + --let $temp= query_get_value("SHOW BINLOG EVENTS", Pos, $j) + --let $temp2=`select $binlog_start - $temp` + if($temp2==0) + { + --let $binlog_offset= query_get_value(SHOW BINLOG EVENTS, End_log_pos, $j) + dec $i; + } + inc $j; + } + --let $binlog_start= $binlog_offset +} diff --git a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_kill_query.inc b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_kill_query.inc new file mode 100644 index 00000000..4a94a143 --- /dev/null +++ b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_kill_query.inc @@ -0,0 +1,129 @@ +# ==== Purpose ==== +# +# This is an auxiliary file used by rpl_kill_query.test. +# +# The purpose is to generate a statement that updates a +# non-transactional table, and kill the statement in the middle, +# so that it gets half-executed. +# +# ==== Usage ==== +# +# --let $database= DATABASE +# --let $table= TABLE +# --source include/rpl_kill_query.inc +# +# Parameters: +# $database +# The current database will be set to $database before executing the +# killed statement. +# +# $table +# The statement will modify this table. +# +# Assumptions: +# - $database should *not* be created before executing this script. +# +# ==== Implementation ==== +# +# Apparently, not all statements can be killed in the middle; a simple +# INSERT does not seem to work. One case that can be killed is an +# INSERT with a trigger; then there is a check for being killed in the +# trigger invocation. +# +# So our approach is to put a BEFORE INSERT trigger on the table. The +# trigger will execute fast for the first row, and go to sleep for the +# second row. This allows us to kill the query in the middle of the +# sleep. Then, we make sure to wait until *after* the first row is +# inserted, and *before* the sleep is finished. That ensures that at +# least one row is inserted in the trigger table, and not both rows +# are inserted in the main table, so the statement is half-executed, +# as required. +# +# To sleep on the second row, we use a SLEEP() inside a condition that +# is triggered only for the second row. +# +# To indicate to other threads that the first row has been inserted, +# we do SET @@GLOBAL.BINLOG_FORMAT = ROW before going to sleep. (It +# does not seem to be enough to wait for rows to be inserted in the +# main table or trigger table, probably since locks prevent other +# threads from seeing the partial insert even in a non-transactional +# table.) This will not affect execution since the global values is +# only used as default for new connections. +# +# As a sanity-check, we verify that after the query is killed, at most +# one row has been inserted in the main table, and at least one row +# has been inserted in the second table. + + +--let $_rkq_current_database_old= `SELECT DATABASE()` + +--let $assert_cond= @@GLOBAL.BINLOG_FORMAT = "STATEMENT" +--let $assert_text= Test only works if binlog_format is statement +--source include/assert.inc + +# Get connection id +--source include/rpl_connection_master.inc +--let $connection_id= `SELECT CONNECTION_ID()` + +# Create database, table, and trigger table +eval CREATE DATABASE $database; +eval USE $database; +eval CREATE TABLE $table (a INT) ENGINE = MyISAM; +eval CREATE TABLE trigger_table (a INT) ENGINE = MyISAM; + +# This master-only trigger will sleep for N seconds when the value N +# is inserted to a row. +SET SQL_LOG_BIN=0; +--delimiter | +eval +CREATE TRIGGER trig1 BEFORE INSERT ON $table FOR EACH ROW +BEGIN + IF NEW.a != 0 THEN + SET @@GLOBAL.BINLOG_FORMAT = 'row'; + DO SLEEP(1000000); + END IF; + INSERT INTO trigger_table VALUES (1); +END| +--delimiter ; +SET SQL_LOG_BIN=1; + +# Sleep 1000000 seconds before inserting the second row. +--send +eval INSERT INTO $table VALUES (0), (1); + +# Wait until the sleep for the second row happens. +--source include/rpl_connection_master1.inc + +--let $wait_condition= SELECT @@GLOBAL.BINLOG_FORMAT = 'ROW' +--let $show_rpl_debug_info= 1 +--source include/wait_condition.inc + +# Kill query. +--replace_result $connection_id +eval KILL QUERY $connection_id; + +# Get the error message. +--source include/rpl_connection_master.inc +--error ER_QUERY_INTERRUPTED +reap; + +SET @@GLOBAL.BINLOG_FORMAT = 'STATEMENT'; + +# Check that at most one row was inserted in main table. +--let $assert_text= At most one row should be inserted in $database.$table +--let $assert_cond= COUNT(*) <= 1 FROM $database.$table +--source include/assert.inc + +# Check that at least one row was inserted in trigger table. +--let $assert_text= At least one row should be inserted in $database.trigger_table +--let $assert_cond= COUNT(*) >= 1 FROM $database.trigger_table +--source include/assert.inc + +# Clean up. +SET SQL_LOG_BIN=0; +eval DROP TRIGGER trig1; +SET SQL_LOG_BIN=1; +DROP TABLE trigger_table; +eval DROP TABLE $table; +eval DROP DATABASE $database; +--eval USE $_rkq_current_database_old diff --git a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_loaddata.test b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_loaddata.test index 4dda9219..70121194 100644 --- a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_loaddata.test +++ b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_loaddata.test @@ -45,7 +45,7 @@ create table t3 (day date,id int(9),category enum('a','b','c'),name varchar(60)) insert into t3 select * from t2; --enable_warnings -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc select * from t1; select * from t3; @@ -57,7 +57,7 @@ drop table t2; drop table t3; create table t1(a int, b int, unique(b)); -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc # See if slave stops when there's a duplicate entry for key error in LOAD DATA @@ -238,7 +238,7 @@ connect (conn2,localhost,root,,*NO-ONE*); -- disconnect conn2 -- connection master --- sync_slave_with_master +-- source include/sync_slave_sql_with_master.inc -- eval use $db1 let $diff_tables= master:$db1.t1, slave:$db1.t1; @@ -249,7 +249,7 @@ source include/diff_tables.inc; -- eval DROP DATABASE $db1 -- eval DROP DATABASE $db2 --- sync_slave_with_master +-- source include/sync_slave_sql_with_master.inc # BUG#49479: LOAD DATA INFILE is binlogged without escaping field names -- source include/rpl_reset.inc @@ -260,7 +260,7 @@ CREATE TABLE t1 (`key` TEXT, `text` TEXT); LOAD DATA INFILE '../../std_data/loaddata2.dat' REPLACE INTO TABLE `t1` FIELDS TERMINATED BY ','; SELECT * FROM t1; --- sync_slave_with_master +-- source include/sync_slave_sql_with_master.inc -- connection master DROP TABLE t1; diff --git a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_loaddata_s.inc b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_loaddata_s.inc new file mode 100644 index 00000000..23f3b7c5 --- /dev/null +++ b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_loaddata_s.inc @@ -0,0 +1,26 @@ +# See if the slave logs (in its own binlog, with --log-slave-updates) a +# replicated LOAD DATA INFILE correctly when it has binlog_*_db rules. +# This is for BUG#1100 (LOAD DATA INFILE was half-logged). + +-- source include/have_binlog_format_mixed_or_statement.inc +-- source include/master-slave.inc + +connection slave; +# Not sure why we connect to slave and then try to reset master, but I will leave it [JBM] +reset master; + +connection master; +# 'test' is the current database +create table test.t1(a int, b int, unique(b)); +load data infile '../../std_data/rpl_loaddata.dat' into table test.t1; + +# Test logging on slave; +--source include/sync_slave_sql_with_master.inc +select count(*) from test.t1; # check that LOAD was replicated +source include/show_binlog_events.inc; + +# Cleanup +connection master; +drop table test.t1; +--source include/sync_slave_sql_with_master.inc +--source include/rpl_end.inc diff --git a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_loadfile.test b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_loadfile.test index 85620b58..6196dc00 100644 --- a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_loadfile.test +++ b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_loadfile.test @@ -21,7 +21,7 @@ delimiter ;| CALL test.p1(); SELECT * FROM test.t1 ORDER BY blob_column; save_master_pos; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc connection slave; # Need to allow some time when NDB engine is used for # the injector thread to have time to populate binlog @@ -33,4 +33,4 @@ SELECT * FROM test.t1 ORDER BY blob_column; connection master; DROP PROCEDURE IF EXISTS test.p1; DROP TABLE test.t1; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc diff --git a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_log.test b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_log.test index 9d161393..625096f1 100644 --- a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_log.test +++ b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_log.test @@ -9,7 +9,7 @@ # test the slave immediately writes DROP TEMPORARY TABLE this_old_table). # We wait for the slave to have written all he wants to the binlog # (otherwise RESET MASTER may come too early). -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc source include/stop_slave.inc; --source include/wait_for_slave_to_stop.inc reset master; @@ -34,9 +34,22 @@ select count(*) from t1; source include/show_binlog_events.inc; let $binlog_limit= 1; -source include/show_binlog_events.inc; +if (!`SELECT COUNT(*) = 0 OR VARIABLE_VALUE != 'ON' FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME = 'GTID_MODE'`) +{ + # if GTID_MODE=ON, there is the extra event entry the binary log: Gtid_log_event + --let $binlog_limit= 2,1 +} -let $binlog_limit= 1,4; +source include/show_binlog_events.inc; +--let $from_event= 1 +--let $number_of_events= 4 +if (!`SELECT COUNT(*) = 0 OR VARIABLE_VALUE != 'ON' FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME = 'GTID_MODE'`) +{ + # if GTID_MODE=ON, there is the extra event entry the binary log: Gtid_log_event + --let $from_event= `SELECT $from_event * 2 + 1` + --let $number_of_events= `SELECT $number_of_events * 2 - 2` +} +let $binlog_limit= $from_event,$number_of_events; source include/show_binlog_events.inc; let $binlog_limit=; flush logs; @@ -65,7 +78,7 @@ eval create table t3 (a int)ENGINE=$engine_type; connection master; select * from t1 order by 1 asc; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc #check t1 on slave to ensure whether it's identical with on master select * from t1 order by 1 asc; @@ -85,7 +98,7 @@ source include/show_binlog_events.inc; --replace_column 2 # show binary logs; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc --replace_column 2 # show binary logs; @@ -136,4 +149,4 @@ drop table t1; # End of 4.1 tests -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc diff --git a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_max_relay_size.test b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_max_relay_size.test index d8cd4f2d..b17c2a7b 100644 --- a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_max_relay_size.test +++ b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_max_relay_size.test @@ -89,7 +89,7 @@ flush logs; # log we just closed. But a trick to achieve this is do an update on the master. connection master; create table t1 (a int); -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc --source include/check_slave_is_running.inc --echo # @@ -99,7 +99,7 @@ sync_slave_with_master; flush logs; connection master; drop table t1; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc --source include/check_slave_is_running.inc connection master; diff --git a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_mts_crash_safe.inc b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_mts_crash_safe.inc index a6aaabb5..1efbd5a9 100644 --- a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_mts_crash_safe.inc +++ b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_mts_crash_safe.inc @@ -119,9 +119,7 @@ if ($commands == recovery) --let $rpl_server_number= 2 --let $rpl_server_parameters= --skip-slave-start --relay-log-recovery=0 --slave-parallel-workers=0 - --let $rpl_debug= 1 --source include/rpl_start_server.inc - --let $rpl_debug= 0 START SLAVE UNTIL SQL_AFTER_MTS_GAPS; --let $slave_param= Until_Condition @@ -134,9 +132,7 @@ if ($commands == recovery) --echo ** regular restart ** --let $rpl_server_number= 2 --let $rpl_server_parameters= --skip-slave-start --slave-transaction-retries=0 --relay-log-info-repository=TABLE --master-info-repository=TABLE --sync-master-info=1 - --let $rpl_debug= 1 --source include/rpl_restart_server.inc - --let $rpl_debug= 0 #### Checking if the recovery worked and the coordinator has an updated state. #### --connection slave diff --git a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_mts_crash_safe.test b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_mts_crash_safe.test index f2fdc689..b81797fc 100644 --- a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_mts_crash_safe.test +++ b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_mts_crash_safe.test @@ -110,14 +110,14 @@ while ($count_debug_groups <= $max_groups) --source include/start_slave.inc --connection master ---sync_slave_with_master +--source include/sync_slave_sql_with_master.inc --connection master let $MYSQLD_DATADIR= `SELECT @@datadir`; ---exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLD_DATADIR/test-mts-crash-master.sql ---exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLD_DATADIR/test-mts-crash-slave.sql +--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info --set-gtid-purged=off test > $MYSQLD_DATADIR/test-mts-crash-master.sql +--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info --set-gtid-purged=off test > $MYSQLD_DATADIR/test-mts-crash-slave.sql --diff_files $MYSQLD_DATADIR/test-mts-crash-master.sql $MYSQLD_DATADIR/test-mts-crash-slave.sql diff --git a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_mts_execute_partial_trx_in_relay_log.inc b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_mts_execute_partial_trx_in_relay_log.inc new file mode 100644 index 00000000..bf91ef5a --- /dev/null +++ b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_mts_execute_partial_trx_in_relay_log.inc @@ -0,0 +1,36 @@ +# ==== Implementation ==== +# +# 1. Set debug point to rotate relay log after table_map_event. +# 2. Wait for io thread to receive table_map_event and stop it. +# 3. Start the io thread after it is stopped. +# 4. Check that there is no failure on replication. +# + +# Initial setup +--source include/rpl_connection_master.inc +CREATE TABLE t1(i INT) ENGINE=InnoDB; +FLUSH LOGS; +--source include/sync_slave_sql_with_master.inc + +# Set debug point to rotate relay log after table_map_event. +SET @save_debug=@@global.debug; +SET GLOBAL DEBUG='d,stop_io_after_reading_table_map_event'; +--source include/rpl_connection_master.inc +INSERT INTO t1 VALUES (1); + +--source include/rpl_connection_slave.inc +# Wait for io thread to receive table_map_event and stop it. +--source include/wait_for_slave_io_to_stop.inc +SET GLOBAL DEBUG= @save_debug; + +# Start the io thread after it is stopped. +--source include/start_slave_io.inc + +# Check that their is no failure on replication. +--source include/rpl_connection_master.inc +--source include/sync_slave_sql_with_master.inc + +# Cleanup +--source include/rpl_connection_master.inc +DROP TABLE t1; +--source include/rpl_end.inc diff --git a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_multi_query.test b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_multi_query.test index ae2a3aa4..30333101 100644 --- a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_multi_query.test +++ b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_multi_query.test @@ -17,7 +17,7 @@ insert into mysqltest.t1 values(3); insert into mysqltest.t1 values(4); insert into mysqltest.t1 values(5)/ delimiter ;/ -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc select * from mysqltest.t1; connection master; source include/show_binlog_events.inc; diff --git a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_multi_update.test b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_multi_update.test index cdbdbc19..7fc1f411 100644 --- a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_multi_update.test +++ b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_multi_update.test @@ -23,7 +23,7 @@ SELECT * FROM t2 ORDER BY a; --disable_warnings ONCE UPDATE t1, t2 SET t1.b = t2.b WHERE t1.a = t2.a; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc # End of 4.1 tests diff --git a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_multi_update2.test b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_multi_update2.test index b85927a2..0d54aab5 100644 --- a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_multi_update2.test +++ b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_multi_update2.test @@ -39,25 +39,24 @@ SELECT * FROM t2 ORDER BY a; connection master; drop table t1,t2; -sync_slave_with_master; - +--source include/sync_slave_sql_with_master.inc # # BUG#13236 multi-update with subquery & --replicate-ignore-table # reset master; - +connection slave; +RESET MASTER; connection master; CREATE TABLE t1 ( a INT ); INSERT INTO t1 VALUES (0); UPDATE t1, (SELECT 3 as b) AS x SET t1.a = x.b; select * from t1; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc connection slave; select * from t1; connection master; drop table t1; -sync_slave_with_master; - +--source include/sync_slave_sql_with_master.inc # End of 4.1 tests diff --git a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_multi_update3.test b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_multi_update3.test index f7d4815e..faff4e21 100644 --- a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_multi_update3.test +++ b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_multi_update3.test @@ -32,7 +32,7 @@ UPDATE t2, (SELECT a FROM t1 ORDER BY a) AS t SET t2.b = t.a+5 ; SELECT * FROM t1 ORDER BY a; SELECT * FROM t2 ORDER BY a; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc connection slave; SELECT * FROM t1 ORDER BY a; SELECT * FROM t2 ORDER BY a; @@ -84,7 +84,7 @@ UPDATE t1 a, t2 AND a.a4 = 'foo' AND a.a5 = 'bar'; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc connection slave; SELECT * FROM t1; SELECT * FROM t2; @@ -151,7 +151,7 @@ SET a.x = b.x, ) WHERE b.x = 23; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc connection slave; SELECT * FROM t1; @@ -212,7 +212,7 @@ select "-- MASTER AFTER JOIN --" as ""; select * from t1; select * from t2; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc select "-- SLAVE AFTER JOIN --" as ""; select * from t1; diff --git a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_not_null.test b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_not_null.test index cbb6b787..e10b335f 100644 --- a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_not_null.test +++ b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_not_null.test @@ -68,7 +68,7 @@ INSERT INTO t4(a,c) VALUES (4, 4); INSERT INTO t4(a) VALUES (5); --echo ************* SHOWING THE RESULT SETS WITH INSERTS ************* -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc --echo TABLES t1 and t2 must be equal otherwise an error will be thrown. let $diff_tables= master:t1, slave:t1; @@ -96,7 +96,7 @@ UPDATE t1 set b= NULL, c= 300 where a= 1; REPLACE INTO t1(a,b,c) VALUES (2, NULL, 300); --echo ************* SHOWING THE RESULT SETS WITH UPDATES and REPLACES ************* -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc --echo TABLES t1 and t2 must be equal otherwise an error will be thrown. let $diff_tables= master:t1, slave:t1; @@ -110,7 +110,7 @@ DROP TABLE t2; DROP TABLE t3; DROP TABLE t4; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc connection master; @@ -134,7 +134,7 @@ INSERT INTO t1(a) VALUES (5); --echo ************* SHOWING THE RESULT SETS WITH INSERTS ************* --echo TABLES t1 and t2 must be different. -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc connection master; SELECT a,b+0,c+0 FROM t1 ORDER BY a; connection slave; @@ -150,7 +150,7 @@ REPLACE INTO t1(a,b,c) VALUES (2, NULL, b'00'); --echo ************* SHOWING THE RESULT SETS WITH UPDATES and REPLACES ************* --echo TABLES t1 and t2 must be equal otherwise an error will be thrown. -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc let $diff_tables= master:t1, slave:t1; source include/diff_tables.inc; @@ -158,7 +158,7 @@ connection master; DROP TABLE t1; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc --echo ################################################################################ --echo # NULL ---> NOT NULL (STRICT MODE) @@ -336,7 +336,7 @@ UPDATE t3 SET b = NULL where a = 4; --echo ************* SHOWING THE RESULT SETS ************* connection master; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc connection master; SELECT * FROM t1 ORDER BY a; @@ -357,4 +357,4 @@ DROP TABLE t1; DROP TABLE t2; DROP TABLE t3; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc diff --git a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_parallel_load.test b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_parallel_load.test index db4de7c8..0772aa4d 100644 --- a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_parallel_load.test +++ b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_parallel_load.test @@ -47,7 +47,7 @@ while($i) --enable_query_log -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc #connection slave; --disable_query_log @@ -227,7 +227,7 @@ while($i) } --disable_query_log - sync_slave_with_master; + --source include/sync_slave_sql_with_master.inc let $diff_tables=master:test$i1.tm_nk, slave:test$i1.tm_nk; @@ -266,4 +266,4 @@ while($i) --enable_result_log --enable_query_log -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc diff --git a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_parallel_load_innodb.test b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_parallel_load_innodb.test index d83e6f4b..05faf554 100644 --- a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_parallel_load_innodb.test +++ b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_parallel_load_innodb.test @@ -75,7 +75,7 @@ while($i) --enable_query_log -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc #connection slave; --disable_query_log @@ -306,7 +306,7 @@ while($i) } --disable_query_log - sync_slave_with_master; + --source include/sync_slave_sql_with_master.inc let $diff_tables=master:test$i1.ti_nk, slave:test$i1.ti_nk; source include/diff_tables.inc; @@ -337,5 +337,5 @@ while($i) --enable_result_log --enable_query_log -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc diff --git a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_record_compare.test b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_record_compare.test index b674b76d..b6ae80fc 100644 --- a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_record_compare.test +++ b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_record_compare.test @@ -14,14 +14,14 @@ INSERT INTO t1 ( c5, c6 ) VALUES ( NULL, 35 ); -- disable_warnings UPDATE t1 SET c5 = 'a'; -- enable_warnings --- sync_slave_with_master +-- source include/sync_slave_sql_with_master.inc -- let $diff_tables= master:t1, slave:t1 -- source include/diff_tables.inc --connection master DROP TABLE t1; --- sync_slave_with_master +-- source include/sync_slave_sql_with_master.inc -- echo ## case #1.1 - last_null_bit_pos==0 in record_compare with X bit -- echo ## (1 column less and no varchar) @@ -35,14 +35,14 @@ INSERT INTO t1 ( c5, c6 ) VALUES ( NULL, 35 ); -- disable_warnings UPDATE t1 SET c5 = 'a'; -- enable_warnings --- sync_slave_with_master +-- source include/sync_slave_sql_with_master.inc -- let $diff_tables= master:t1, slave:t1 -- source include/diff_tables.inc --connection master DROP TABLE t1; --- sync_slave_with_master +-- source include/sync_slave_sql_with_master.inc -- echo ## case #2 - X bit is wrongly set. @@ -53,12 +53,12 @@ DROP TABLE t1; INSERT INTO t1(c1) VALUES (10); INSERT INTO t1(c1) VALUES (NULL); UPDATE t1 SET c1= 0; --- sync_slave_with_master +-- source include/sync_slave_sql_with_master.inc -- let $diff_tables= master:t1, slave:t1 -- source include/diff_tables.inc -- connection master DROP TABLE t1; --- sync_slave_with_master +-- source include/sync_slave_sql_with_master.inc diff --git a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_relayrotate.test b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_relayrotate.test index 5f8c93c0..2b076ce3 100644 --- a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_relayrotate.test +++ b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_relayrotate.test @@ -11,7 +11,7 @@ # We have to sync with master, to ensure slave had time to start properly # before we stop it. If not, we get errors about UNIX_TIMESTAMP() in the log. connection master; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc connection slave; stop slave; connection master; diff --git a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_row_001.test b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_row_001.test index 8eb684e0..d51a2d47 100644 --- a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_row_001.test +++ b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_row_001.test @@ -1,3 +1,4 @@ +--source include/not_gtid_enabled.inc let $LOAD_FILE= $MYSQLTEST_VARDIR/std_data/words.dat; CREATE TABLE t1 (word CHAR(20) NOT NULL); --replace_result $LOAD_FILE LOAD_FILE @@ -65,6 +66,7 @@ save_master_pos; # Try to cause a large relay log lag on the slave by locking t1 connection slave; +RESET MASTER; LOCK TABLES t1 READ; START SLAVE; UNLOCK TABLES; diff --git a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_row_UUID.test b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_row_UUID.test index 368596d4..75949416 100644 --- a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_row_UUID.test +++ b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_row_UUID.test @@ -44,7 +44,7 @@ select fn1(0); eval create table t2 (a int) engine=$engine_type; insert into t2 values(fn1(2)); -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc SHOW CREATE TABLE test.t1; # Dump the databases and so we can see if they match diff --git a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_row_basic.test b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_row_basic.test index cb747c0e..4ae6b144 100644 --- a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_row_basic.test +++ b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_row_basic.test @@ -18,7 +18,7 @@ let $slave_com_update_before= query_get_value(SHOW GLOBAL STATUS LIKE 'com_updat connection master; eval CREATE TABLE t1 (C1 CHAR(1), C2 CHAR(1), INDEX (C1)$extra_index_t1) ENGINE = $type ; SELECT * FROM t1; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc SELECT * FROM t1; # Testing insert @@ -26,7 +26,7 @@ connection master; INSERT INTO t1 VALUES ('A','B'), ('X','Y'), ('X','X'); INSERT INTO t1 VALUES ('A','C'), ('X','Z'), ('A','A'); SELECT * FROM t1 ORDER BY C1,C2; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc SELECT * FROM t1 ORDER BY C1,C2; # Testing delete @@ -35,7 +35,7 @@ SELECT * FROM t1 ORDER BY C1,C2; connection master; DELETE FROM t1 WHERE C1 = C2; SELECT * FROM t1 ORDER BY C1,C2; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc SELECT * FROM t1 ORDER BY C1,C2; # @@ -46,7 +46,7 @@ SELECT * FROM t1 ORDER BY C1,C2; connection master; UPDATE t1 SET C2 = 'I' WHERE C1 = 'A' AND C2 = 'C'; SELECT * FROM t1 ORDER BY C1,C2; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc SELECT * FROM t1 ORDER BY C1,C2; #BUG#12662190 - COM_COMMIT IS NOT INCREMENTED FROM THE BINARY LOGS ON SLAVE, COM_BEGIN IS @@ -80,7 +80,7 @@ let $slave_com_update_after= query_get_value(SHOW GLOBAL STATUS LIKE 'com_update connection master; UPDATE t1 SET c2 = 'Q' WHERE c1 = 'A' AND c2 = 'N'; SELECT * FROM t1 ORDER BY c1,c2; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc SELECT * FROM t1 ORDER BY c1,c2; # @@ -93,14 +93,14 @@ INSERT INTO t2 (6,'A',35), (7,'A',50), (8,'A',64), (9,'A',81); SELECT * FROM t2 ORDER BY c1,c2; SELECT * FROM t2 WHERE c2 = c1 * c1 ORDER BY c1,c2; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc SELECT * FROM t2 ORDER BY c1,c2; SELECT * FROM t2 WHERE c2 = c1 * c1 ORDER BY c1,c2; connection master; UPDATE t2 SET c2 = c1*c1 WHERE c2 != c1*c1; SELECT * FROM t2 WHERE c2 = c1 * c1 ORDER BY c1,c2; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc SELECT * FROM t2 WHERE c2 = c1 * c1 ORDER BY c1,c2; # Testing update with a condition that does not match any rows, but @@ -108,13 +108,13 @@ SELECT * FROM t2 WHERE c2 = c1 * c1 ORDER BY c1,c2; connection master; UPDATE t2 SET c12 = 'Q' WHERE c1 = 1 AND c2 = 999; SELECT * FROM t2 ORDER BY c1,c2; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc SELECT * FROM t2 ORDER BY c1,c2; connection master; DELETE FROM t2 WHERE c1 % 4 = 0; SELECT * FROM t2 ORDER BY c1,c2; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc SELECT * FROM t2 ORDER BY c1,c2; connection master; @@ -129,19 +129,19 @@ eval CREATE TABLE t3 (C1 CHAR(1), C2 CHAR(1), pk1 INT, C3 CHAR(1), pk2 INT, PRIM INSERT INTO t3 VALUES ('A','B',1,'B',1), ('X','Y',2,'B',1), ('X','X',3,'B',1); INSERT INTO t3 VALUES ('A','C',1,'B',2), ('X','Z',2,'B',2), ('A','A',3,'B',2); SELECT * FROM t3 ORDER BY C1,C2; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc SELECT * FROM t3 ORDER BY C1,C2; connection master; DELETE FROM t3 WHERE C1 = C2; SELECT * FROM t3 ORDER BY C1,C2; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc SELECT * FROM t3 ORDER BY C1,C2; connection master; UPDATE t3 SET C2 = 'I' WHERE C1 = 'A' AND C2 = 'C'; SELECT * FROM t3 ORDER BY C1,C2; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc SELECT * FROM t3 ORDER BY C1,C2; # @@ -154,7 +154,7 @@ eval CREATE TABLE t6 (C1 CHAR(1), C2 CHAR(1), C3 INT$extra_index_t6) ENGINE = $t INSERT INTO t6 VALUES ('A','B',1), ('X','Y',2), ('X','X',3); INSERT INTO t6 VALUES ('A','C',4), ('X','Z',5), ('A','A',6); SELECT * FROM t6 ORDER BY C3; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc SELECT * FROM t6 ORDER BY C3; # Testing delete @@ -163,7 +163,7 @@ SELECT * FROM t6 ORDER BY C3; connection master; DELETE FROM t6 WHERE C1 = C2; SELECT * FROM t6 ORDER BY C3; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc SELECT * FROM t6 ORDER BY C3; # @@ -174,7 +174,7 @@ SELECT * FROM t6 ORDER BY C3; connection master; UPDATE t6 SET C2 = 'I' WHERE C1 = 'A' AND C2 = 'C'; SELECT * FROM t6 ORDER BY C3; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc SELECT * FROM t6 ORDER BY C3; # now mixing the 3 tables without begin/commit @@ -185,7 +185,7 @@ INSERT INTO t5 VALUES ('A','C',4), ('X','Z',5), ('A','A',6); UPDATE t5,t2,t3 SET t5.C2='Q', t2.c12='R', t3.C3 ='S' WHERE t5.C1 = t2.c12 AND t5.C1 = t3.C1; SELECT * FROM t5,t2,t3 WHERE t5.C2='Q' AND t2.c12='R' AND t3.C3 ='S' ORDER BY t5.C3,t2.c1,t3.pk1,t3.pk2; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc SELECT * FROM t5,t2,t3 WHERE t5.C2='Q' AND t2.c12='R' AND t3.C3 ='S' ORDER BY t5.C3,t2.c1,t3.pk1,t3.pk2; # @@ -203,7 +203,7 @@ eval CREATE TABLE t4 (C1 CHAR(1) PRIMARY KEY, B1 BIT(1), B2 BIT(1) NOT NULL DEFA INSERT INTO t4 SET C1 = 1; SELECT C1,HEX(B1),HEX(B2) FROM t4 ORDER BY C1; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc SELECT C1,HEX(B1),HEX(B2) FROM t4 ORDER BY C1; if (`select char_length('$bit_field_special') > 0`) { @@ -215,7 +215,7 @@ if (`select char_length('$bit_field_special') > 0`) { # connection master; eval CREATE TABLE t7 (C1 INT PRIMARY KEY, C2 INT) ENGINE = $type ; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc --echo --- on slave: original values --- INSERT INTO t7 VALUES (1,3), (2,6), (3,9); SELECT * FROM t7 ORDER BY C1; @@ -229,7 +229,7 @@ connection master; --echo --- on master: new values inserted --- INSERT INTO t7 VALUES (1,2), (2,4), (3,6); SELECT * FROM t7 ORDER BY C1; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc set @@global.slave_exec_mode= default; --echo --- on slave: old values should be overwritten by replicated values --- @@ -253,7 +253,7 @@ INSERT INTO t8 VALUES (11,99,33); INSERT INTO t8 VALUES (11,22,99); SELECT * FROM t8 ORDER BY a; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc --echo --- on slave --- SELECT * FROM t8 ORDER BY a; INSERT INTO t8 VALUES (1,2,3), (2,4,6), (3,6,9); @@ -269,7 +269,7 @@ connection master; # We insert a row that will cause conflict on the primary key but not # on the other keys. INSERT INTO t8 VALUES (2,4,8); -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc set @@global.slave_exec_mode= default; --echo --- on slave --- @@ -284,7 +284,7 @@ SELECT * FROM t8 ORDER BY a; # Clean up t1 so that we can use it. connection master; DELETE FROM t1; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc # Just to get a clean binary log --source include/rpl_reset.inc @@ -293,7 +293,7 @@ sync_slave_with_master; connection master; INSERT INTO t1 VALUES ('K','K'), ('L','L'), ('M','M'); --echo **** On Master **** -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc # since bug#31552/31609 idempotency is not default any longer. In order # the following test DELETE FROM t1 to pass the mode is switched # temprorarily @@ -303,7 +303,7 @@ DELETE FROM t1 WHERE C1 = 'L'; connection master; DELETE FROM t1; query_vertical SELECT COUNT(*) FROM t1 ORDER BY c1,c2; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc set @@global.slave_exec_mode= default; source include/check_slave_is_running.inc; query_vertical SELECT COUNT(*) FROM t1 ORDER BY c1,c2; @@ -321,7 +321,8 @@ INSERT INTO t1 VALUES( '2005-11-14 01:01:01', '2005-11-14 01:01:02', '2005-11-14'); --echo **** On Slave **** -sync_slave_with_master slave; +--let $sync_slave_connection= slave +--source include/sync_slave_sql_with_master.inc SELECT * FROM t1; # @@ -330,7 +331,7 @@ SELECT * FROM t1; connection master; DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc # # BUG#37426: RBR breaks for CHAR() UTF8 fields > 85 chars @@ -360,14 +361,14 @@ eval CREATE TABLE t2 (i INT NOT NULL, c CHAR(16) CHARACTER SET utf8 NOT NULL, j INT NOT NULL) ENGINE = $type ; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc ALTER TABLE t2 MODIFY c CHAR(128) CHARACTER SET utf8 NOT NULL; connection master; eval CREATE TABLE t3 (i INT NOT NULL, c CHAR(128) CHARACTER SET utf8 NOT NULL, j INT NOT NULL) ENGINE = $type ; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc ALTER TABLE t3 MODIFY c CHAR(16) CHARACTER SET utf8 NOT NULL; connection master; @@ -378,14 +379,14 @@ eval CREATE TABLE t4 (i INT NOT NULL, eval CREATE TABLE t5 (i INT NOT NULL, c CHAR(255) CHARACTER SET utf8 NOT NULL, j INT NOT NULL) ENGINE = $type ; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc ALTER TABLE t5 MODIFY c CHAR(16) CHARACTER SET utf8 NOT NULL; connection master; eval CREATE TABLE t6 (i INT NOT NULL, c CHAR(255) CHARACTER SET utf8 NOT NULL, j INT NOT NULL) ENGINE = $type ; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc ALTER TABLE t6 MODIFY c CHAR(128) CHARACTER SET utf8 NOT NULL; connection master; @@ -401,7 +402,7 @@ SET GLOBAL SLAVE_TYPE_CONVERSIONS = 'ALL_NON_LOSSY'; connection master; INSERT INTO t1 VALUES (1, "", 1); INSERT INTO t1 VALUES (2, repeat(_utf8'a', 16), 2); -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc let $diff_tables= master:t1, slave:t1; source include/diff_tables.inc; @@ -410,7 +411,7 @@ source include/diff_tables.inc; connection master; INSERT INTO t2 VALUES (1, "", 1); INSERT INTO t2 VALUES (2, repeat(_utf8'a', 16), 2); -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc let $diff_tables= master:t2, slave:t2; source include/diff_tables.inc; @@ -429,7 +430,7 @@ call mtr.add_suppression("The slave coordinator and worker threads are stopped, connection master; INSERT INTO t4 VALUES (1, "", 1); INSERT INTO t4 VALUES (2, repeat(_utf8'a', 128), 2); -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc let $diff_tables= master:t4, slave:t4; source include/diff_tables.inc; @@ -460,14 +461,14 @@ connection slave; connection master; INSERT INTO t7 VALUES (1, "", 1); INSERT INTO t7 VALUES (2, repeat(_utf8'a', 255), 2); -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc let $diff_tables= master:t7, slave:t7; source include/diff_tables.inc; connection master; drop table t1, t2, t3, t4, t5, t6, t7; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc # # BUG#32709: Assertion failed: trx_data->empty(), file .\log.cc, line 1293 @@ -480,14 +481,14 @@ INSERT INTO t1 VALUES (1), (2), (3); --error ER_DUP_ENTRY UPDATE t1 SET a = 10; INSERT INTO t1 VALUES (4); -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc let $diff_tables= master:t1, slave:t1; source include/diff_tables.inc; connection master; drop table t1; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc # # Bug #38230 Differences between master and slave after @@ -557,7 +558,7 @@ UPDATE t1 SET `pk` = 6 ORDER BY `int_key` LIMIT 6; DELETE FROM t2 WHERE `pk` < 7 LIMIT 1; UPDATE t1 SET `int_key` = 4 ORDER BY `pk` LIMIT 6; ---sync_slave_with_master +--source include/sync_slave_sql_with_master.inc --echo *** results: t2 must be consistent **** let $diff_tables= master:t2, slave:t2; @@ -596,14 +597,14 @@ INSERT INTO t1 ( a ) VALUES ( 3 ); UPDATE t1 SET a = 0 WHERE a < 4; UPDATE t1 SET a = 8 WHERE a < 5; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc let $diff_tables= master:t1, slave:t1; source include/diff_tables.inc; connection master; drop table t1; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc # # Bug #39752: Replication failure on RBR + MyISAM + no PK @@ -666,9 +667,10 @@ INSERT INTO t1 ( a ) VALUES ( 1 ); UPDATE t1 SET a = 9 WHERE a < 5 LIMIT 3; --enable_warnings -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc if (`select char_length('$bit_field_special') > 0`) { + connection slave; SET GLOBAL SLAVE_TYPE_CONVERSIONS = @saved_slave_type_conversions; } @@ -677,4 +679,4 @@ source include/diff_tables.inc; connection master; drop table t1; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc diff --git a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_row_blob.test b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_row_blob.test index 762daa81..139adee6 100644 --- a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_row_blob.test +++ b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_row_blob.test @@ -33,10 +33,7 @@ INSERT INTO test.t1 VALUES (NULL, repeat('b',16*1024)); SELECT LENGTH(data) FROM test.t1 WHERE c1 = 1; SELECT LENGTH(data) FROM test.t1 WHERE c1 = 2; SELECT LENGTH(data) FROM test.t1 WHERE c1 = 3; -save_master_pos; -connection slave; -sync_with_master; ---source include/wait_for_ndb_to_binlog.inc +--source include/sync_slave_sql_with_master.inc --echo --echo **** Data Insert Validation Slave Section test.t1 **** --echo @@ -56,10 +53,7 @@ UPDATE t1 set data=repeat('c',17*1024) where c1 = 2; --echo SELECT LENGTH(data) FROM test.t1 WHERE c1 = 1; SELECT LENGTH(data) FROM test.t1 WHERE c1 = 2; -save_master_pos; -connection slave; -sync_with_master; ---source include/wait_for_ndb_to_binlog.inc +--source include/sync_slave_sql_with_master.inc --echo --echo **** Data Update Validation Slave Section test.t1 **** --echo @@ -127,10 +121,7 @@ SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3) FROM test.t2 WHERE c1=1; SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3) FROM test.t2 WHERE c1=2; -save_master_pos; -connection slave; -sync_with_master; ---source include/wait_for_ndb_to_binlog.inc +--source include/sync_slave_sql_with_master.inc --echo --echo **** Data Insert Validation Slave Section test.t2 **** --echo @@ -153,10 +144,7 @@ SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3) FROM test.t2 WHERE c1=1; SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3) FROM test.t2 WHERE c1=2; -save_master_pos; -connection slave; -sync_with_master; ---source include/wait_for_ndb_to_binlog.inc +--source include/sync_slave_sql_with_master.inc --echo --echo **** Data Update Validation Slave Section test.t2 **** --echo @@ -180,4 +168,4 @@ DROP TABLE IF EXISTS test.t2; # if cluster is shutdown while not all tables are # properly dropped, the table becomes inconsistent # and wrecks later test cases ---sync_slave_with_master +--source include/sync_slave_sql_with_master.inc diff --git a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_row_delayed_ins.test b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_row_delayed_ins.test index bad308ff..b635a755 100644 --- a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_row_delayed_ins.test +++ b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_row_delayed_ins.test @@ -1,6 +1,7 @@ # See if INSERT DELAYED gets replicated # Only in row-based, as we do SHOW BINLOG EVENTS +-- source include/not_gtid_enabled.inc -- source include/have_binlog_format_row.inc -- source include/master-slave.inc diff --git a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_row_event_max_size.inc b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_row_event_max_size.inc new file mode 100644 index 00000000..f0aed1e5 --- /dev/null +++ b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_row_event_max_size.inc @@ -0,0 +1,95 @@ +# +# Bug #49931 and Bug #49932 +# This test verifies if the slave I/O thread and slave SQL thread +# will check the bigger one of the values of 'max_allowed_packet' +# and 'binlog-row-event-max-size' when reading log event from +# binlog, and the added 'binlog-row-event-max-size' mysqlbinlog +# option works fine. +# + +source include/master-slave.inc; +source include/have_binlog_format_row.inc; + +--let $binlog_filename= query_get_value(SHOW MASTER STATUS, File, 1) +--let $MYSQLD_DATADIR= `select @@datadir` + +let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1); +CREATE TABLE t1 (a int not null auto_increment, data1 LONGBLOB, + data2 LONGBLOB, PRIMARY KEY(a)); + +let $start_pos= query_get_value("SHOW MASTER STATUS", Position, 1); +INSERT INTO t1 (data1, data2) VALUES (repeat('a',1000000), repeat('a', 1000000)); +let $end_pos= query_get_value("SHOW MASTER STATUS", Position, 1); +#FLUSH LOGS; +DELETE FROM t1 WHERE a = 1; +--echo # On master, test the inserted data is deleted +SELECT LENGTH(data1), LENGTH(data2) FROM t1 WHERE a = 1; + +let $old_max_allowed_packet= `SELECT @@global.max_allowed_packet`; +SET @@global.max_allowed_packet=4194304; +FLUSH LOGS; +--let $prefix=`SELECT UUID()` +--let $binlog_uuid_filename= $MYSQLTEST_VARDIR/tmp/$prefix-bin.log +--copy_file $MYSQLD_DATADIR/$binlog_filename $binlog_uuid_filename +--source include/rpl_reset.inc + +--echo # On master, test the added 'binlog-row-event-max-size' mysqlbinlog option +--echo # works fine and the data is inserted by executing the dumped ROW event +--exec $MYSQL_BINLOG --binlog-row-event-max-size=2097152 --start-position=$start_pos --stop-position=$end_pos $binlog_uuid_filename | $MYSQL test 2>&1 +SELECT LENGTH(data1), LENGTH(data2) FROM t1 WHERE a = 1; +eval set @@global.max_allowed_packet= $old_max_allowed_packet; + +INSERT INTO t1 (data1, data2) VALUES (repeat('a',1048576), repeat('a',1048576)); + +--source include/show_binlog_events2.inc + +--source include/sync_slave_sql_with_master.inc +--echo # On slave, test the row event data is replicated when the value of +--echo # the bigger one of max_allowed_packet and binlog_row_event_max_size +--echo # is larger than the required size. +SELECT LENGTH(data1), LENGTH(data2) FROM t1 WHERE a = 1; + +--echo # On slave, test the row event data is replicated when the value of +--echo # the bigger one of max_allowed_packet and binlog_row_event_max_size +--echo # is equal to the required size. +SELECT LENGTH(data1), LENGTH(data2) FROM t1 WHERE a = 2; + +connection master; +DROP TABLE t1; + +--source include/sync_slave_sql_with_master.inc +--source include/rpl_reset.inc + +--echo # Test it will cause ER_MASTER_FATAL_ERROR_READING_BINLOG when the value +--echo # of the bigger one of max_allowed_packet and binlog_row_event_max_size +--echo # is lower than the the required size. +connection master; + +CREATE TABLE t1 (a int not null auto_increment, data1 LONGBLOB, + data2 LONGBLOB, data3 LONGBLOB, PRIMARY KEY(a)); + +--source include/sync_slave_sql_with_master.inc +--connection master + +INSERT INTO t1 (data1, data2, data3) VALUES (repeat('a', @@global.max_allowed_packet), repeat('a', @@global.max_allowed_packet), repeat('a', @@global.max_allowed_packet)); + +SELECT LENGTH(data1), LENGTH(data2), LENGTH(data3) FROM t1 WHERE a = 1; + +drop table t1; +--source include/sync_slave_sql_with_master.inc + +connection slave; +call mtr.add_suppression("Slave I/O: Got fatal error 1236 from master when reading data from binary log: .*"); +call mtr.add_suppression("Found invalid event in binary log"); +call mtr.add_suppression("The slave coordinator and worker threads are stopped, possibly leaving data in inconsistent state"); + +--echo ==== clean up ==== + +# clear errno +--source include/stop_slave.inc +RESET SLAVE; +RESET MASTER; + +--remove_file $binlog_uuid_filename +--let $rpl_only_running_threads= 1 +--source include/rpl_end.inc diff --git a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_row_func003.test b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_row_func003.test index 6b58dc11..043af9f1 100644 --- a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_row_func003.test +++ b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_row_func003.test @@ -54,14 +54,8 @@ INSERT INTO test.t1 VALUES (null,test.f1()); ROLLBACK; SET AUTOCOMMIT=1; -# Sync master and slave for all engines except NDB -if (`SELECT UPPER(LEFT('$engine_type', 3)) != 'NDB'`) { - sync_slave_with_master; - connection master; -} -# Sync master and slave for NDB engine -let $wait_time= 6; ---source include/wait_for_ndb_to_binlog.inc +--source include/sync_slave_sql_with_master.inc +connection master; # Time to dump the databases and so we can see if they match diff --git a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_row_idempotency.test b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_row_idempotency.test index b0e17fad..85b674c7 100644 --- a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_row_idempotency.test +++ b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_row_idempotency.test @@ -31,7 +31,7 @@ set foreign_key_checks=1 /* ensure the check */; insert into ti1 values (1),(2),(3); insert into ti2 set a=2, b=2; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc #connection slave; select * from ti1 order by b /* must be (1),(2),(3) */; @@ -48,7 +48,7 @@ delete from ti1 where b=1; select * from ti1 order by b /* must be (2),(3) */; # slave must catch up (expect some warnings in error.log) -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc #connection slave; select * from ti1 order by b /* must stays as were on master (1),(2),(3) */; @@ -59,7 +59,7 @@ connection master; insert into ti2 set a=3, b=3; # slave must catch up (expect some warnings in error.log) -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc #connection slave; select * from ti2 order by b /* must be (1,1),(2,2) - not inserted */; @@ -104,7 +104,7 @@ set foreign_key_checks=1 /* ensure the check */; insert into ti1 values (1),(2),(3); insert into ti2 set a=2, b=2; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc #connection slave; select * from ti1 order by b /* must be (1),(2),(3) */; @@ -135,13 +135,13 @@ set foreign_key_checks= 1; set global slave_exec_mode='IDEMPOTENT'; start slave sql_thread; connection master; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc #connection slave; set global slave_exec_mode='STRICT'; connection master; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc #connection slave; --echo *** conspire the following insert failure @@ -169,13 +169,13 @@ set foreign_key_checks= 1; set global slave_exec_mode='IDEMPOTENT'; start slave sql_thread; connection master; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc #connection slave; set global slave_exec_mode='STRICT'; connection master; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc select * from ti2 order by b /* must be (2,2),(3,3) */; @@ -207,7 +207,7 @@ set foreign_key_checks= 1; set global slave_exec_mode='IDEMPOTENT'; start slave sql_thread; connection master; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc #connection slave; set global slave_exec_mode='STRICT'; @@ -219,7 +219,7 @@ CREATE TABLE t1 (a INT PRIMARY KEY); CREATE TABLE t2 (a INT); INSERT INTO t1 VALUES (-1),(-2),(-3); INSERT INTO t2 VALUES (-1),(-2),(-3); -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc #connection slave; DELETE FROM t1 WHERE a = -2; @@ -239,7 +239,7 @@ enable_query_log; set global slave_exec_mode='IDEMPOTENT'; start slave sql_thread; connection master; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc #connection slave; set global slave_exec_mode='STRICT'; @@ -257,7 +257,7 @@ enable_query_log; set global slave_exec_mode='IDEMPOTENT'; start slave sql_thread; connection master; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc #connection slave; set global slave_exec_mode='STRICT'; @@ -279,7 +279,7 @@ enable_query_log; set global slave_exec_mode='IDEMPOTENT'; start slave sql_thread; connection master; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc #connection slave; set global slave_exec_mode='STRICT'; @@ -299,7 +299,7 @@ enable_query_log; set global slave_exec_mode='IDEMPOTENT'; start slave sql_thread; connection master; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc #connection slave; SET @@global.slave_exec_mode= @old_slave_exec_mode; @@ -308,6 +308,6 @@ SET @@global.slave_exec_mode= @old_slave_exec_mode; connection master; drop table t1,t2,ti2,ti1; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc set @@global.slave_exec_mode= @old_slave_exec_mode; diff --git a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_row_show_relaylog_events.inc b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_row_show_relaylog_events.inc new file mode 100644 index 00000000..7d37c0bb --- /dev/null +++ b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_row_show_relaylog_events.inc @@ -0,0 +1,20 @@ +# BUG#28777 SHOW BINLOG EVENTS does not work on relay log files +# +# GOAL +# ==== +# +# Test that SHOW BINLOG EVENTS and the new SHOW RELAYLOG EVENTS works after +# the patch, both on master and slave. +# +# HOW +# === +# +# This test issues SHOW [BINLOG|RELAYLOG] EVENTS both on master and slave after +# some statements have been issued. + +-- source include/master-slave.inc +-- source include/have_binlog_format_row.inc +-- source include/not_mts_slave_parallel_workers.inc + +-- source extra/rpl_tests/rpl_show_relaylog_events.inc +--source include/rpl_end.inc diff --git a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_row_sp002.test b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_row_sp002.test index 90c273eb..10b8edfa 100644 --- a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_row_sp002.test +++ b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_row_sp002.test @@ -52,7 +52,7 @@ SELECT * FROM test.t2; let $message=< -- test 1 select slave after p1 -- >; --source include/show_msg.inc -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc SELECT * FROM test.t1; SELECT * FROM test.t2; @@ -65,7 +65,7 @@ SELECT * FROM test.t2; let $message=< -- test 1 select slave after p2 -- >; --source include/show_msg.inc -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc SELECT * FROM test.t1; SELECT * FROM test.t2; @@ -113,7 +113,7 @@ SELECT * FROM test.t2; let $message=< -- test 2 select Slave after p1 -- >; --source include/show_msg.inc -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc SELECT * FROM test.t1; SELECT * FROM test.t2; @@ -128,7 +128,7 @@ SELECT * FROM test.t2; let $message=< -- test 1 select Slave after p2 -- >; --source include/show_msg.inc -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc SELECT * FROM test.t1; SELECT * FROM test.t2; @@ -168,7 +168,7 @@ while ($n) ROLLBACK; select * from test.t3; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc select * from test.t3; connection master; @@ -187,7 +187,7 @@ while ($n) COMMIT; select * from test.t3; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc select * from test.t3; connection master; diff --git a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_row_sp003.test b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_row_sp003.test index d2c2ea0c..ad282293 100644 --- a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_row_sp003.test +++ b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_row_sp003.test @@ -54,9 +54,7 @@ SELECT release_lock("test"); connection master; SELECT * FROM test.t1; #show binlog events; ---source include/wait_for_ndb_to_binlog.inc -sync_slave_with_master; -connection slave; +--source include/sync_slave_sql_with_master.inc SELECT * FROM test.t1; connection master; @@ -67,8 +65,7 @@ CALL test.p1(); SELECT release_lock("test"); SELECT * FROM test.t1; -sync_slave_with_master; -connection slave; +--source include/sync_slave_sql_with_master.inc SELECT * FROM test.t1; connection master; #show binlog events from 720; @@ -76,6 +73,6 @@ connection master; DROP PROCEDURE IF EXISTS test.p1; DROP PROCEDURE IF EXISTS test.p2; DROP TABLE IF EXISTS test.t1; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc # End of 5.0 test case diff --git a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_row_sp006.test b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_row_sp006.test index 16a8374a..c69b6980 100644 --- a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_row_sp006.test +++ b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_row_sp006.test @@ -54,11 +54,11 @@ END| delimiter ;| CALL p2(); -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc connection master; CALL p1(); -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc connection master; @@ -79,6 +79,6 @@ DROP PROCEDURE p2; diff_files $MYSQLTEST_VARDIR/tmp/sp006_master.sql $MYSQLTEST_VARDIR/tmp/sp006_slave.sql; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc # End of 5.1 test case diff --git a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_row_sp007.test b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_row_sp007.test index 492cd2d8..bdfabadf 100644 --- a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_row_sp007.test +++ b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_row_sp007.test @@ -30,7 +30,7 @@ SELECT * FROM test.t1; let $message=< ---- Slave selects-- >; --source include/show_msg.inc -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc SELECT * FROM test.t1; let $message=< ---- Master selects-- >; @@ -41,7 +41,7 @@ SELECT * FROM test.t1; let $message=< ---- Slave selects-- >; --source include/show_msg.inc -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc SELECT * FROM test.t1; connection master; diff --git a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_set_null.test b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_set_null.test index 3755c8bb..ed32e4ea 100644 --- a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_set_null.test +++ b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_set_null.test @@ -35,7 +35,7 @@ -- eval CREATE TABLE t1 (c1 BIT, c2 INT) Engine=$engine INSERT INTO `t1` VALUES ( 1, 1 ); UPDATE t1 SET c1=NULL where c2=1; --- sync_slave_with_master +-- source include/sync_slave_sql_with_master.inc -- let $diff_tables= master:t1, slave:t1 -- source include/diff_tables.inc @@ -43,14 +43,14 @@ UPDATE t1 SET c1=NULL where c2=1; -- connection master # triggers switch to row mode when on mixed DELETE FROM t1 WHERE c2=1 LIMIT 1; --- sync_slave_with_master +-- source include/sync_slave_sql_with_master.inc -- let $diff_tables= master:t1, slave:t1 -- source include/diff_tables.inc -- connection master DROP TABLE t1; --- sync_slave_with_master +-- source include/sync_slave_sql_with_master.inc -- source include/rpl_reset.inc @@ -64,7 +64,7 @@ DROP TABLE t1; INSERT INTO t1 ( c1 ) VALUES ( 'w' ) ; SELECT * FROM t1; UPDATE t1 SET c1=NULL WHERE c1='w'; --- sync_slave_with_master +-- source include/sync_slave_sql_with_master.inc -- let $diff_tables= master:t1, slave:t1 -- source include/diff_tables.inc @@ -72,11 +72,11 @@ UPDATE t1 SET c1=NULL WHERE c1='w'; -- connection master # triggers switch to row mode when on mixed DELETE FROM t1 LIMIT 2; --- sync_slave_with_master +-- source include/sync_slave_sql_with_master.inc -- let $diff_tables= master:t1, slave:t1 -- source include/diff_tables.inc -- connection master DROP TABLE t1; --- sync_slave_with_master +-- source include/sync_slave_sql_with_master.inc diff --git a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_show_relaylog_events.inc b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_show_relaylog_events.inc index a56e08ec..115beb01 100644 --- a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_show_relaylog_events.inc +++ b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_show_relaylog_events.inc @@ -18,7 +18,7 @@ INSERT INTO t1 VALUES (3); --let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1) --source extra/rpl_tests/rpl_show_log_events_with_varying_options.inc ---sync_slave_with_master +--source include/sync_slave_sql_with_master.inc --let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1) --source extra/rpl_tests/rpl_show_log_events_with_varying_options.inc @@ -49,7 +49,7 @@ DROP TABLE t1; --let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1) --source extra/rpl_tests/rpl_show_log_events_with_varying_options.inc ---sync_slave_with_master +--source include/sync_slave_sql_with_master.inc --let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1) --source extra/rpl_tests/rpl_show_log_events_with_varying_options.inc diff --git a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_stm_insert_delayed.inc b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_stm_insert_delayed.inc new file mode 100644 index 00000000..92d57625 --- /dev/null +++ b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_stm_insert_delayed.inc @@ -0,0 +1,10 @@ +--source include/have_binlog_format_statement.inc +--source include/master-slave.inc +--source include/not_embedded.inc +--source include/not_windows.inc + +disable_query_log; +call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); +enable_query_log; +--source extra/rpl_tests/rpl_insert_delayed.test +--source include/rpl_end.inc diff --git a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_stm_mix_show_relaylog_events.inc b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_stm_mix_show_relaylog_events.inc new file mode 100644 index 00000000..4b9af69c --- /dev/null +++ b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_stm_mix_show_relaylog_events.inc @@ -0,0 +1,20 @@ +# BUG#28777 SHOW BINLOG EVENTS does not work on relay log files +# +# GOAL +# ==== +# +# Test that SHOW BINLOG EVENTS and the new SHOW RELAYLOG EVENTS works after +# the patch, both on master and slave. +# +# HOW +# === +# +# This test issues SHOW [BINLOG|RELAYLOG] EVENTS both on master and slave after +# some statements have been issued. + +-- source include/master-slave.inc +-- source include/have_binlog_format_mixed_or_statement.inc +-- source include/not_mts_slave_parallel_workers.inc + +-- source extra/rpl_tests/rpl_show_relaylog_events.inc +--source include/rpl_end.inc diff --git a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_stop_slave.test b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_stop_slave.test index 64e69ceb..3aaec3ad 100644 --- a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_stop_slave.test +++ b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_stop_slave.test @@ -42,6 +42,10 @@ send STOP SLAVE SQL_THREAD; connection slave1; --echo # To resume slave SQL thread SET DEBUG_SYNC= 'now SIGNAL signal.continue'; +# wait for the sql thread to come out of the +# waiting phase before resetting the signals +--let $wait_condition= select count(*)=0 from information_schema.processlist where state LIKE '%debug sync point%' and info LIKE '%INSERT INTO t1 VALUES (1)%' +--source include/wait_condition.inc SET DEBUG_SYNC= 'RESET'; --echo diff --git a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_stress_test.inc b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_stress_test.inc index 7c7529d9..be50f38c 100644 --- a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_stress_test.inc +++ b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_stress_test.inc @@ -16,7 +16,7 @@ while ($i < $n) --enable_result_log --enable_query_log ---sync_slave_with_master +--source include/sync_slave_sql_with_master.inc --echo # Build connections to master server --disable_query_log diff --git a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_sv_relay_space.test b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_sv_relay_space.test index eeb54901..622792c7 100644 --- a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_sv_relay_space.test +++ b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_sv_relay_space.test @@ -18,7 +18,7 @@ INSERT INTO t1 SET name='Caleb', age=1; ALTER TABLE t1 ADD id int(8) ZEROFILL AUTO_INCREMENT PRIMARY KEY, ALGORITHM=COPY; SELECT * FROM t1 ORDER BY id; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc SELECT * FROM t1 ORDER BY id; connection master; DROP TABLE t1; diff --git a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_trig004.test b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_trig004.test index 1a738db2..031e6853 100644 --- a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_trig004.test +++ b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_trig004.test @@ -35,10 +35,7 @@ INSERT INTO test.t2 VALUES (1, 0.0); #show binlog events; select * from test.t1; select * from test.t2; -let $wait_time= 10; ---source include/wait_for_ndb_to_binlog.inc -sync_slave_with_master; -connection slave; +--source include/sync_slave_sql_with_master.inc select * from test.t1; select * from test.t2; @@ -48,5 +45,5 @@ DROP TRIGGER test.t1_bi_t2; DROP TABLE test.t1; DROP TABLE test.t2; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc # End of 5.0 test case diff --git a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_truncate_helper.test b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_truncate_helper.test index d1d0e06e..0d49738d 100644 --- a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_truncate_helper.test +++ b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_truncate_helper.test @@ -4,11 +4,11 @@ connection master; eval CREATE TABLE t1 (a INT, b LONG) ENGINE=$engine; INSERT INTO t1 VALUES (1,1), (2,2); -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc --echo **** On Master **** connection master; eval $trunc_stmt t1; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc let $diff_tables= master:t1, slave:t1; source include/diff_tables.inc; @@ -19,15 +19,15 @@ connection master; SET @count := 1; eval CREATE TABLE t2 (a INT, b LONG) ENGINE=$engine; CREATE TRIGGER trg1 BEFORE DELETE ON t1 FOR EACH ROW SET @count := @count + 1; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc --echo **** On Master **** connection master; eval $trunc_stmt t1; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc let $diff_tables= master:t2, slave:t2; source include/diff_tables.inc; connection master; DROP TABLE t1,t2; -sync_slave_with_master; +--source include/sync_slave_sql_with_master.inc diff --git a/mysql-wsrep-5.6/mysql-test/include/begin_include_file.inc b/mysql-wsrep-5.6/mysql-test/include/begin_include_file.inc index 90606389..d2116699 100644 --- a/mysql-wsrep-5.6/mysql-test/include/begin_include_file.inc +++ b/mysql-wsrep-5.6/mysql-test/include/begin_include_file.inc @@ -34,6 +34,7 @@ # # # At the beginning of include/my_file.inc: # --let $include_filename= my_file.inc +# [--let $include_silent= 1] # [--let $rpl_debug= 1] # --source include/begin_include_file.inc # @@ -74,6 +75,13 @@ if (!$_include_file_depth) if ($rpl_debug) { --echo $_include_file_indent==== BEGIN include/$include_filename ==== + # Print this text (just once) to prevent checking in result files containing + # debug info. + if (!$printed_this_should_not_be_checked_in) + { + --echo DO_NOT_CHECK_IN_THIS_LINE: \$rpl_debug should only be used for debugging. Never check in a test that has $rpl_debug=1. + --let $printed_this_should_not_be_checked_in= 1 + } } --let $_include_file_enabled_warnings= $ENABLED_WARNINGS$_include_file_enabled_warnings diff --git a/mysql-wsrep-5.6/mysql-test/include/change_file_perms.inc b/mysql-wsrep-5.6/mysql-test/include/change_file_perms.inc new file mode 100644 index 00000000..1157bf7e --- /dev/null +++ b/mysql-wsrep-5.6/mysql-test/include/change_file_perms.inc @@ -0,0 +1,12 @@ +# $file_perms need to be in octal base +# Provide a file name and the required new file permissions. +# The file's permissions will be changed as per the input file +# permissions. + +--perl +use strict; +my $file_perms= $ENV{'_FILE_PERMS_'} or die "File permissions are not set"; +my $input_file= $ENV{'_INPUT_FILE_'} or die "Input file is not set"; +die ('Unable to find file \'$input_file\'') unless (-e $input_file); +chmod(oct($file_perms), $input_file) or die ('Unable to set file permissions for file \'$input_file\''); +EOF diff --git a/mysql-wsrep-5.6/mysql-test/include/check_ipv4_mapped.inc b/mysql-wsrep-5.6/mysql-test/include/check_ipv4_mapped.inc old mode 100755 new mode 100644 diff --git a/mysql-wsrep-5.6/mysql-test/include/default_my.cnf b/mysql-wsrep-5.6/mysql-test/include/default_my.cnf index 173292f5..d1d906d7 100644 --- a/mysql-wsrep-5.6/mysql-test/include/default_my.cnf +++ b/mysql-wsrep-5.6/mysql-test/include/default_my.cnf @@ -1,4 +1,5 @@ # Copyright (c) 2007 MySQL AB, 2009, 2010 Sun Microsystems, Inc. +# Use is subject to license terms # # 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 diff --git a/mysql-wsrep-5.6/mysql-test/include/eval.inc b/mysql-wsrep-5.6/mysql-test/include/eval.inc index f2d3f889..2595983e 100644 --- a/mysql-wsrep-5.6/mysql-test/include/eval.inc +++ b/mysql-wsrep-5.6/mysql-test/include/eval.inc @@ -36,7 +36,6 @@ # # --let $eval_expr= [SHOW SLAVE STATUS, Relay_Log_Pos, 1] + 47 # [--let $eval_no_result= 1] -# [--let $eval_quiet= 1] # [--let $rpl_debug= 1] # --source include/eval.inc # --echo Result was '$eval_result' diff --git a/mysql-wsrep-5.6/mysql-test/include/func_aes_block.inc b/mysql-wsrep-5.6/mysql-test/include/func_aes_block.inc new file mode 100644 index 00000000..32808f40 --- /dev/null +++ b/mysql-wsrep-5.6/mysql-test/include/func_aes_block.inc @@ -0,0 +1,130 @@ +# +# Parameters: +# +# $block_mode + + +--echo #### $block_mode + +SET @IVA=REPEAT('a', 16); +SET @IVB=REPEAT('b', 16); +SET @KEY1=REPEAT('c', 16); +SET @KEY2=REPEAT('d', 16); + + +--echo #### 128-$block_mode + +eval SET SESSION block_encryption_mode="aes-128-$block_mode"; + +--echo # must throw an error without an IV +--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT +SELECT AES_ENCRYPT('a', @KEY1); + +--echo block mode dependent. Must be non-0 and non-null +SELECT LENGTH(AES_ENCRYPT('a', @KEY1, @IVA)); + +--echo block mode dependent +SELECT TO_BASE64(AES_ENCRYPT('a', @KEY1, @IVA)); + +--echo # must be equal +SELECT 'a' = AES_DECRYPT(AES_ENCRYPT('a', @KEY1, @IVA), @KEY1, @IVA); + +--echo # must not be equal +SELECT 'a' = AES_DECRYPT(AES_ENCRYPT('a',@KEY1, @IVA), @KEY1, @IVB); +SELECT 'a' = AES_DECRYPT(AES_ENCRYPT('a',@KEY1, @IVA), @KEY2, @IVA); +SELECT 'a' = AES_DECRYPT(AES_ENCRYPT('b',@KEY1, @IVA), @KEY1, @IVA); + + +--echo #### 192-$block_mode + +eval SET SESSION block_encryption_mode="aes-192-$block_mode"; + +--echo # must throw an error without an IV +--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT +SELECT AES_ENCRYPT('a', @KEY1); + +--echo # must be equal +SELECT 'a' = AES_DECRYPT(AES_ENCRYPT('a',@KEY1, @IVA), @KEY1, @IVA); + +--echo # must not be equal +SELECT 'a' = AES_DECRYPT(AES_ENCRYPT('a',@KEY1, @IVA), @KEY1, @IVB); +SELECT 'a' = AES_DECRYPT(AES_ENCRYPT('a',@KEY1, @IVA), @KEY2, @IVA); +SELECT 'a' = AES_DECRYPT(AES_ENCRYPT('b',@KEY1, @IVA), @KEY1, @IVA); + + +--echo #### 256-$block_mode + +eval SET SESSION block_encryption_mode="aes-256-$block_mode"; + +--echo # must throw an error without an IV +--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT +SELECT AES_ENCRYPT('a', @KEY1); + +--echo # must be equal +SELECT 'a' = AES_DECRYPT(AES_ENCRYPT('a',@KEY1, @IVA), @KEY1, @IVA); + +--echo # must not be equal +SELECT 'a' = AES_DECRYPT(AES_ENCRYPT('a',@KEY1, @IVA), @KEY1, @IVB); +SELECT 'a' = AES_DECRYPT(AES_ENCRYPT('a',@KEY1, @IVA), @KEY2, @IVA); +SELECT 'a' = AES_DECRYPT(AES_ENCRYPT('b',@KEY1, @IVA), @KEY1, @IVA); + +SET SESSION block_encryption_mode=DEFAULT; + + +--echo #### 128, 192 and 256 bit $block_mode + + +eval CREATE TABLE aes_$block_mode(a VARCHAR(128), b128 VARCHAR(144), + b192 VARCHAR(144), b256 CHAR(144)); +eval INSERT INTO aes_$block_mode (a) VALUES (REPEAT('a', 128)); +eval INSERT INTO aes_$block_mode (a) VALUES (REPEAT(0x00313233, 32)); + +eval SET SESSION block_encryption_mode="aes-128-$block_mode"; +eval UPDATE aes_$block_mode SET b128 = AES_ENCRYPT(a, @KEY1, @IVA); + +eval SET SESSION block_encryption_mode="aes-192-$block_mode"; +eval UPDATE aes_$block_mode SET b192 = AES_ENCRYPT(a, @KEY1, @IVA); + +eval SET SESSION block_encryption_mode="aes-256-$block_mode"; +eval UPDATE aes_$block_mode SET b256 = AES_ENCRYPT(a, @KEY1, @IVA); + +--echo # must return 0 +eval SELECT COUNT(*) FROM aes_$block_mode WHERE b128 = b192 OR B192 = b256 OR b128=b256; + +eval SET SESSION block_encryption_mode="aes-256-$block_mode"; + +--echo # must return 2 +eval SELECT COUNT(*) FROM aes_$block_mode WHERE a = AES_DECRYPT(b256, @KEY1, @IVA); + +--echo # must return 0 +eval SELECT COUNT(*) FROM aes_$block_mode WHERE a = AES_DECRYPT(b256, 'b', @IVA); + +--echo # must return 0 +eval SELECT COUNT(*) FROM aes_$block_mode WHERE a = AES_DECRYPT(b256, @KEY1, @IVB); + +eval SET SESSION block_encryption_mode="aes-192-$block_mode"; + +--echo # must return 2 +eval SELECT COUNT(*) FROM aes_$block_mode WHERE a = AES_DECRYPT(b192, @KEY1, @IVA); + +--echo # must return 0 +eval SELECT COUNT(*) FROM aes_$block_mode WHERE a = AES_DECRYPT(b192, @KEY2, @IVA); + +--echo # must return 0 +eval SELECT COUNT(*) FROM aes_$block_mode WHERE a = AES_DECRYPT(b256, @KEY1, @IVB); + +eval SET SESSION block_encryption_mode="aes-128-$block_mode"; + +--echo # must return 2 +eval SELECT COUNT(*) FROM aes_$block_mode WHERE a = AES_DECRYPT(b128, @KEY1, @IVA); + +--echo # must return 0 +eval SELECT COUNT(*) FROM aes_$block_mode WHERE a = AES_DECRYPT(b128, @KEY2, @IVA); + +--echo # must return 0 +eval SELECT COUNT(*) FROM aes_$block_mode WHERE a = AES_DECRYPT(b256, @KEY2, @IVB); + + +SET SESSION block_encryption_mode=DEFAULT; +eval DROP TABLE aes_$block_mode; + diff --git a/mysql-wsrep-5.6/mysql-test/include/get_file_permissions.inc b/mysql-wsrep-5.6/mysql-test/include/get_file_permissions.inc new file mode 100644 index 00000000..576bbd9f --- /dev/null +++ b/mysql-wsrep-5.6/mysql-test/include/get_file_permissions.inc @@ -0,0 +1,9 @@ +--perl +use strict; +my $input_file= $ENV{'_INPUT_FILE_'} or die "Input file is not set"; +my $mode = (stat($input_file))[2]; +open(FILE, ">", "$ENV{MYSQL_TMP_DIR}/permissions.inc") or die; +my $perm= $mode & 07777; +print FILE "let \$FILE_PERMISSIONS= $perm;\n"; +close FILE; +EOF diff --git a/mysql-wsrep-5.6/mysql-test/include/get_ndb_epochs.inc b/mysql-wsrep-5.6/mysql-test/include/get_ndb_epochs.inc new file mode 100644 index 00000000..0fd17807 --- /dev/null +++ b/mysql-wsrep-5.6/mysql-test/include/get_ndb_epochs.inc @@ -0,0 +1,60 @@ +# ==== Purpose ==== +# +# Extract the epoch values from SHOW ENGINE NDB STATUS. +# +# ==== Usage ==== +# +# --source include/get_ndb_epochs.inc +# --echo $ndb_latest_epoch +# --echo $ndb_latest_trans_epoch +# --echo $ndb_latest_received_binlog_epoch +# --echo $ndb_latest_handled_binlog_epoch +# --echo $ndb_latest_applied_binlog_epoch +# +# ==== Parameters ==== +# +# $ndb_status_binlog_row +# The row number of the output of SHOW ENGINE NDB STATUS +# last was seen. +# No need to set explictly, but used between sourcing this +# include file several times, since it is highly probable +# (but not certain) that same row number also applies next +# time. + +if (!$ndb_status_binlog_row) +{ + let $ndb_status_binlog_row = 1; +} + +# Try two times, in case the row number of binlog state changes +# between two invocations of SHOW ENGINE NDB STATUS. +let $attempts= 2; +while ($attempts) +{ + let $q= query_get_value(SHOW ENGINE NDB STATUS, Status, $ndb_status_binlog_row); + if ( `SELECT '$q' = 'No such row'` ) + { + dec $attempts; + if (!$attempts) + { + echo ERROR IN TEST: No binlog row found in SHOW ENGINE NDB STATUS; + die ERROR IN TEST: No binlog row found in SHOW ENGINE NDB STATUS; + } + # row will be increased to 1 further down + let $ndb_status_binlog_row = 0; + } + if (`SELECT INSTR('$q', 'latest_epoch=')`) + { + let $attempts = 0 ; + } + if ($attempts) + { + inc $ndb_status_binlog_row; + } +} + +let $ndb_latest_epoch= `SELECT SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING('$q', INSTR('$q', 'latest_epoch=')), ',', 1), '=', -1)`; +let $ndb_latest_trans_epoch= `SELECT SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING('$q', INSTR('$q', 'latest_trans_epoch=')), ',', 1), '=', -1)`; +let $ndb_latest_received_binlog_epoch= `SELECT SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING('$q', INSTR('$q', 'latest_received_binlog_epoch=')), ',', 1), '=', -1)`; +let $ndb_latest_handled_binlog_epoch= `SELECT SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING('$q', INSTR('$q', 'latest_handled_binlog_epoch=')), ',', 1), '=', -1)`; +let $ndb_latest_applied_binlog_epoch= `SELECT SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING('$q', INSTR('$q', 'latest_applied_binlog_epoch=')), ',', 1), '=', -1)`; diff --git a/mysql-wsrep-5.6/mysql-test/include/gtid_step_assert.inc b/mysql-wsrep-5.6/mysql-test/include/gtid_step_assert.inc new file mode 100644 index 00000000..95725ab5 --- /dev/null +++ b/mysql-wsrep-5.6/mysql-test/include/gtid_step_assert.inc @@ -0,0 +1,96 @@ +# ==== Purpose ==== +# +# Assert that exactly one GTID (or a specified number) was added to +# @@GLOBAL.GTID_EXECUTED since last call to gtid_step_reset.inc or +# gtid_step_assert.inc +# +# ==== Usage ==== +# +# [--let $gtid_step_count= N] +# [--let $gtid_step_only_count= [0|1]] +# [--let $gtid_step_uuid= UUID] +# --source include/gtid_step_assert.inc +# +# Parameters: +# $gtid_step_count +# Assert that N GTIDs were added to @@GLOBAL.GTID_EXECUTED. If +# this is not given, the default value is 1. +# +# $gtid_step_only_count +# By default, this script checks the numeric component of the +# GTIDs added to @@GLOBAL.GTID_EXECUTED to see that the correct +# number was generated. If this parameter is nonzero, it only +# counts the number of added GTIDs to see that it is equal to +# $gtid_step_count, without caring that they were generated in +# order (or generated on this server). +# +# $gtid_step_uuid +# By default, when $gtid_step_count is not set, asserts that the +# uuid component of all GTIDs added to @@GLOBAL.GTID_EXECUTED is +# equal to @@GLOBAL.SERVER_UUID. If this parameter is given, uses +# that UUID instead. +# +# ==== Example ==== +# +# # (1) Remember the current position. +# --source include/gtid_step_reset.inc +# CREATE TABLE t1 (a INT); +# # (2) Assert that exactly one GTID was generated since (1). +# --source include/gtid_step_assert.inc +# INSERT INTO t1 VALUES (1); +# INSERT INTO t1 VALUES (2); +# # (3) Assert that exactly 2 GTIDs were generated since (2). +# --let $gtid_step_count= 2 +# --source include/gtid_step_assert.inc +# # (4) Assert that no GTID was generated since (3). +# --let $gtid_step_count= 0 +# --source include/gtid_step_assert.inc + +if ($uuidf == '') +{ + --die You must source gtid_utils.inc before using gtid_step_assert.inc +} + +--let $_gtid_step_count= 1 +if ($gtid_step_count != '') +{ + --let $_gtid_step_count= $gtid_step_count +} + +--let $_gtid_step_only_count= 0 +if ($gtid_step_only_count != '') +{ + --let $_gtid_step_only_count= $gtid_step_only_count +} + +--let $include_filename= gtid_step_assert.inc [count=$_gtid_step_count, only_count=$_gtid_step_only_count] +--source include/begin_include_file.inc + +--let $_gtid_step_uuid= $gtid_step_uuid +if ($_gtid_step_uuid == '') +{ + --let $_gtid_step_uuid= `SELECT @@GLOBAL.SERVER_UUID` +} + +--let $_gsa_extra_debug_eval_old= $extra_debug_eval +--let $extra_debug_eval= @@GLOBAL.GTID_EXECUTED, GTID_NEXT_GENERATED_SET("$gtid_step_last", "$_gtid_step_uuid", $_gtid_step_count), GTID_SUBTRACT(@@GLOBAL.GTID_EXECUTED, "$gtid_step_last") + +if ($_gtid_step_only_count) +{ + --let $assert_text= Exactly $_gtid_step_count GTIDs should have been committed since last invocation + --let $assert_cond= GTID_COUNT(GTID_SUBTRACT(@@GLOBAL.GTID_EXECUTED, "$gtid_step_last")) = $_gtid_step_count + --source include/assert.inc +} +if (!$_gtid_step_only_count) +{ + --let $assert_text= Exactly $_gtid_step_count GTIDs should have been generated since last invocation + --let $assert_cond= GTID_NEXT_GENERATED_SET("$gtid_step_last", "$_gtid_step_uuid", $_gtid_step_count) = GTID_SUBTRACT(@@GLOBAL.GTID_EXECUTED, "$gtid_step_last") + --source include/assert.inc +} + +--let $extra_debug_eval= $_gsa_extra_debug_eval_old + +--source include/gtid_step_reset.inc + +--let $include_filename= gtid_step_assert.inc +--source include/end_include_file.inc diff --git a/mysql-wsrep-5.6/mysql-test/include/gtid_step_reset.inc b/mysql-wsrep-5.6/mysql-test/include/gtid_step_reset.inc new file mode 100644 index 00000000..4dcaeff5 --- /dev/null +++ b/mysql-wsrep-5.6/mysql-test/include/gtid_step_reset.inc @@ -0,0 +1,18 @@ +# ==== Purpose ==== +# +# Remember the current value of @@GLOBAL.GTID_EXECUTED to be used by +# subsequent calls to gtid_step_assert.inc +# +# ==== Usage ==== +# +# --source include/gtid_step_reset.inc +# +# See gtid_step_assert.inc for details and examples. + +--let $include_filename= gtid_step_reset.inc +--source include/begin_include_file.inc + +--let $gtid_step_last= `SELECT @@GLOBAL.GTID_EXECUTED` + +--let $include_filename= gtid_step_reset.inc +--source include/end_include_file.inc diff --git a/mysql-wsrep-5.6/mysql-test/include/gtid_utils.inc b/mysql-wsrep-5.6/mysql-test/include/gtid_utils.inc index ba460c7e..c5ccf018 100644 --- a/mysql-wsrep-5.6/mysql-test/include/gtid_utils.inc +++ b/mysql-wsrep-5.6/mysql-test/include/gtid_utils.inc @@ -4,22 +4,33 @@ # The functions are typically useful to check assertions related to # GTIDs. The following functions are defined: # -# GTID_IS_EQUAL(g1, g2) -# True if g1 and g2 are the same set -# GTID_IS_DISJOINT(g1, g2) -# True if g1 and g2 are disjoint -# GTID_IS_DISJOINT_UNION(g1, g2, sum) -# True if sum is the disjoint union of g1 and g2 -# GTID_UNION(g1, g2) -# Return the union of g1 and g2 -# GTID_INTERSECTION(g1, g2) -# Return the union of g1 and g2 -# GTID_SYMMETRIC_DIFFERENCE(g1, g2) -# Return the symmetric difference of g1 and g2 -# GTID_SUBTRACT_UUID(gtid, uuid) +# GTID_IS_EQUAL(gtid_set_1, gtid_set_2) +# True if gtid_set_1 and gtid_set_2 are the same set +# GTID_IS_DISJOINT(gtid_set_1, gtid_set_2) +# True if gtid_set_1 and gtid_set_2 are disjoint +# GTID_IS_DISJOINT_UNION(gtid_set_1, gtid_set_2, sum) +# True if sum is the disjoint union of gtid_set_1 and gtid_set_2 +# GTID_NORMALIZE(gtid_set) +# Return the gtid set in a normalized form: all uuids in alphabetic +# order, all intervals compressed and in order, no whitespace, all +# lowercase. +# GTID_UNION(gtid_set_1, gtid_set_2) +# Return the union of gtid_set_1 and gtid_set_2 +# GTID_INTERSECTION(gtid_set_1, gtid_set_2) +# Return the intersection of gtid_set_1 and gtid_set_2 +# GTID_SYMMETRIC_DIFFERENCE(gtid_set_1, gtid_set_2) +# Return the symmetric difference of gtid_set_1 and gtid_set_2 +# GTID_SUBTRACT_UUID(gtid_set, uuid) # Remove the UUID from the GTID set -# GTID_INTERSECTION_WITH_UUID(gtid, uuid) +# GTID_INTERSECTION_WITH_UUID(gtid_set, uuid) # Return only the gtids with the given uuid from the GTID set +# GTID_COUNT(gtid_set) +# Return the number of gtids in the gtid_set. +# GTID_NEXT_GENERATED(gtid_set, uuid) +# Return the next GNO that will be generated for the given uuid. +# GTID_NEXT_GENERATED_SET(gtid_set, uuid, count) +# Return the GTID set consisting of the next 'count' GTIDs that will +# be generated for the given uuid. # GTID_COMPARE(old, diff, new) # The same as GTID_IS_DISJOINT_UNION, except it has the following # additional feature: if diff begins by '~', then it returns true @@ -38,10 +49,18 @@ # # ==== Usage ==== # +# You should not normally source this file directly; instead set +# $rpl_gtid_utils=1 before sourcing master-slave.inc or rpl_init.inc. +# Then, the functions are automatically dropped in rpl_end.inc, and +# RESET MASTER is executed so that the functions do not pollute the +# binary log. +# +# If you really need to use this file manually, do this: +# # 1. Create the stored functions at the beginning of the test script: # # --source include/gtid_utils.inc -# +# # 2. Use the functions as you like during the test script. # # 3. Delete the stored functions at the end of the test script: @@ -52,7 +71,10 @@ --let $include_filename= gtid_utils.inc --source include/begin_include_file.inc ---disable_query_log +if (!$rpl_debug) +{ + --disable_query_log +} --delimiter | @@ -75,60 +97,131 @@ --let $uuidf= ffffffff-ffff-ffff-ffff-ffffffffffff # Return nonzero if the two gtid_sets are equal. -CREATE FUNCTION GTID_IS_EQUAL(g1 TEXT(10000), g2 TEXT(10000)) +CREATE FUNCTION GTID_IS_EQUAL(gtid_set_1 TEXT(10000), gtid_set_2 TEXT(10000)) RETURNS INT -BEGIN - RETURN GTID_SUBSET(g1, g2) AND GTID_SUBSET(g2, g1); -END| +RETURN GTID_SUBSET(gtid_set_1, gtid_set_2) AND GTID_SUBSET(gtid_set_2, gtid_set_1)| # Return nonzero if the two gtid_sets are disjoint. -CREATE FUNCTION GTID_IS_DISJOINT(g1 TEXT(10000), g2 TEXT(10000)) +CREATE FUNCTION GTID_IS_DISJOINT(gtid_set_1 TEXT(10000), gtid_set_2 TEXT(10000)) RETURNS INT -BEGIN - RETURN GTID_SUBSET(g1, GTID_SUBTRACT(g1, g2)); -END| +RETURN GTID_SUBSET(gtid_set_1, GTID_SUBTRACT(gtid_set_1, gtid_set_2))| -# Return true if g1 union g2 = sum, and g1 and g2 are disjoint. -CREATE FUNCTION GTID_IS_DISJOINT_UNION(g1 TEXT(10000), g2 TEXT(10000), sum TEXT(10000)) +# Return true if gtid_set_1 union gtid_set_2 = sum, and gtid_set_1 and gtid_set_2 are disjoint. +CREATE FUNCTION GTID_IS_DISJOINT_UNION(gtid_set_1 TEXT(10000), gtid_set_2 TEXT(10000), sum TEXT(10000)) RETURNS INT -BEGIN - RETURN GTID_IS_EQUAL(GTID_SUBTRACT(sum, g1), g2) AND - GTID_IS_EQUAL(GTID_SUBTRACT(sum, g2), g1); -END| +RETURN GTID_IS_EQUAL(GTID_SUBTRACT(sum, gtid_set_1), gtid_set_2) AND + GTID_IS_EQUAL(GTID_SUBTRACT(sum, gtid_set_2), gtid_set_1)| -# Return the union of g1 and g2. -CREATE FUNCTION GTID_UNION(g1 TEXT(10000), g2 TEXT(10000)) +# Return a normalized form of the GTID (all uppercase, no whitespace, +# no duplicates, uuids in alphabetic order, intervals in numeric +# order). +CREATE FUNCTION GTID_NORMALIZE(g TEXT(10000)) RETURNS TEXT(10000) -BEGIN - RETURN GTID_SUBTRACT(CONCAT(g1, ',', g2), ''); -END| +RETURN GTID_SUBTRACT(g, '')| -# Return the intersection of g1 and g2. -CREATE FUNCTION GTID_INTERSECT(g1 TEXT(10000), g2 TEXT(10000)) +# Return the union of gtid_set_1 and gtid_set_2. +CREATE FUNCTION GTID_UNION(gtid_set_1 TEXT(10000), gtid_set_2 TEXT(10000)) RETURNS TEXT(10000) -BEGIN - RETURN GTID_SUBTRACT(g1, GTID_SUBTRACT(g1, g2)); -END| +RETURN GTID_NORMALIZE(CONCAT(gtid_set_1, ',', gtid_set_2))| -# Return the symmetric difference between g1 and g2. -CREATE FUNCTION GTID_SYMMETRIC_DIFFERENCE(g1 TEXT(10000), g2 TEXT(10000)) +# Return the intersection of gtid_set_1 and gtid_set_2. +CREATE FUNCTION GTID_INTERSECTION(gtid_set_1 TEXT(10000), gtid_set_2 TEXT(10000)) RETURNS TEXT(10000) -BEGIN - RETURN SUBTRACT(CONCAT(g1, ',', g2), GTID_INTERSECTION(g1, g2)); -END| +RETURN GTID_SUBTRACT(gtid_set_1, GTID_SUBTRACT(gtid_set_1, gtid_set_2))| + +# Return the symmetric difference between gtid_set_1 and gtid_set_2. +CREATE FUNCTION GTID_SYMMETRIC_DIFFERENCE(gtid_set_1 TEXT(10000), gtid_set_2 TEXT(10000)) +RETURNS TEXT(10000) +RETURN GTID_SUBTRACT(CONCAT(gtid_set_1, ',', gtid_set_2), GTID_INTERSECTION(gtid_set_1, gtid_set_2))| # Return the gtid with uuid removed. -CREATE FUNCTION GTID_SUBTRACT_UUID(gtid TEXT(10000), uuid TEXT(10000)) +CREATE FUNCTION GTID_SUBTRACT_UUID(gtid_set TEXT(10000), uuid TEXT(100)) RETURNS TEXT(10000) +RETURN GTID_SUBTRACT(gtid_set, CONCAT(UUID, ':1-', 1 << 63 - 1))| + +# Return the intersection of gtid and uuid. +CREATE FUNCTION GTID_INTERSECTION_WITH_UUID(gtid_set TEXT(10000), uuid TEXT(100)) +RETURNS TEXT(10000) +RETURN GTID_SUBTRACT(gtid_set, GTID_SUBTRACT_UUID(gtid_set, uuid))| + +# If the first argument is nonzero, return it, else return the second argument +CREATE FUNCTION IFZERO(a INT, b INT) +RETURNS INT +RETURN IF(a = 0, b, a)| + +# Like the builtin LOCATE, but returns length+1 rather than 0 if nothing found. +CREATE FUNCTION LOCATE2(needle TEXT(10000), haystack TEXT(10000), offset INT) +RETURNS INT +RETURN IFZERO(LOCATE(needle, haystack, offset), LENGTH(haystack) + 1)| + +# Return the number of GTIDs in the given GTID set. +CREATE FUNCTION GTID_COUNT(gtid_set TEXT(10000)) +RETURNS INT BEGIN - RETURN GTID_SUBTRACT(gtid, CONCAT(UUID, ':1-', 1 << 62)); + DECLARE result BIGINT DEFAULT 0; + DECLARE colon_pos INT; + DECLARE next_dash_pos INT; + DECLARE next_colon_pos INT; + DECLARE next_comma_pos INT; + SET gtid_set = GTID_NORMALIZE(gtid_set); + SET colon_pos = LOCATE2(':', gtid_set, 1); + WHILE colon_pos != LENGTH(gtid_set) + 1 DO + SET next_dash_pos = LOCATE2('-', gtid_set, colon_pos + 1); + SET next_colon_pos = LOCATE2(':', gtid_set, colon_pos + 1); + SET next_comma_pos = LOCATE2(',', gtid_set, colon_pos + 1); + IF next_dash_pos < next_colon_pos AND next_dash_pos < next_comma_pos THEN + SET result = result + + SUBSTR(gtid_set, next_dash_pos + 1, + LEAST(next_colon_pos, next_comma_pos) - (next_dash_pos + 1)) - + SUBSTR(gtid_set, colon_pos + 1, next_dash_pos - (colon_pos + 1)) + 1; + ELSE + SET result = result + 1; + END IF; + SET colon_pos = next_colon_pos; + END WHILE; + RETURN result; END| -# Return the intersection of gtid and uuid. -CREATE FUNCTION GTID_INTERSECT_UUID(gtid TEXT(10000), uuid TEXT(10000)) +# Return the next GNO (numeric component) to be generated for the given UUID +CREATE FUNCTION GTID_NEXT_GENERATED(gtid_set TEXT(10000), uuid TEXT(100)) +RETURNS INT +BEGIN + DECLARE gtid_uuid TEXT(10000) DEFAULT GTID_INTERSECTION_WITH_UUID(gtid_set, uuid); + DECLARE colon_pos INT DEFAULT LOCATE2(':', gtid_uuid, 1); + DECLARE next_dash_pos INT DEFAULT LOCATE2('-', gtid_uuid, colon_pos + 1); + DECLARE next_comma_pos INT DEFAULT LOCATE2(',', gtid_uuid, colon_pos + 1); + DECLARE next_colon_pos INT DEFAULT LOCATE2(':', gtid_uuid, colon_pos + 1); + IF gtid_uuid = '' THEN + RETURN 1; + ELSEIF SUBSTR(gtid_uuid, colon_pos + 1, + LEAST(next_dash_pos, next_comma_pos, next_colon_pos) - + (colon_pos + 1)) != '1' THEN + RETURN 1; + ELSEIF next_dash_pos < LEAST(next_comma_pos, next_colon_pos) THEN + RETURN SUBSTR(gtid_uuid, next_dash_pos + 1, + LEAST(next_comma_pos, next_colon_pos) - + (next_dash_pos + 1)) + 1; + ELSE + RETURN 2; + END IF; +END| + +# Return a GTID set consisting of the the next 'count' GTIDs that will +# be generated for the given UUID. +# This is inefficient if count is big, consider optimizing it if needed. +CREATE FUNCTION GTID_NEXT_GENERATED_SET(gtid_set TEXT(10000), uuid TEXT(100), count INT) RETURNS TEXT(10000) BEGIN - RETURN GTID_SUBTRACT(gtid, GTID_SUBTRACT_UUID(gtid, uuid)); + DECLARE result TEXT(10000) DEFAULT ''; + DECLARE number INT; + DECLARE new_gtid VARCHAR(100); + WHILE count > 0 DO + SET new_gtid = CONCAT(uuid, ':', GTID_NEXT_GENERATED(gtid_set, uuid)); + SET result = GTID_UNION(result, new_gtid); + SET gtid_set = GTID_UNION(gtid_set, new_gtid); + SET count = count - 1; + END WHILE; + RETURN result; END| # Return true if gtid_set 'new' is obtained by adding 'diff' to 'old', @@ -137,16 +230,7 @@ END| # removed) from 'new'. CREATE FUNCTION GTID_COMPARE(old TEXT(10000), diff TEXT(10000), new TEXT(10000)) RETURNS INT -BEGIN - DECLARE tilde_pos INT DEFAULT LOCATE('~', diff); - DECLARE to_add TEXT(10000); - DECLARE to_remove TEXT(10000); - IF tilde_pos != 0 THEN - RETURN GTID_IS_DISJOINT_UNION(new, SUBSTR(diff, 2), old); - ELSE - RETURN GTID_IS_DISJOINT_UNION(old, diff, new); - END IF; -END| +RETURN IF(SUBSTR(diff, 1, 1) != '~', GTID_IS_DISJOINT_UNION(old, diff, new), GTID_IS_DISJOINT_UNION(new, SUBSTR(diff, 2), old))| # convert strings like '1:4-5,97:1' to # '01010101-0101-0101-0101-010101010101:4-5,97979797-9797-9797-9797-979797979797:1' diff --git a/mysql-wsrep-5.6/mysql-test/include/gtid_utils_end.inc b/mysql-wsrep-5.6/mysql-test/include/gtid_utils_end.inc index 6219367c..425f6b4c 100644 --- a/mysql-wsrep-5.6/mysql-test/include/gtid_utils_end.inc +++ b/mysql-wsrep-5.6/mysql-test/include/gtid_utils_end.inc @@ -14,11 +14,17 @@ DROP FUNCTION GTID_IS_EQUAL; DROP FUNCTION GTID_IS_DISJOINT; DROP FUNCTION GTID_IS_DISJOINT_UNION; +DROP FUNCTION GTID_NORMALIZE; DROP FUNCTION GTID_UNION; -DROP FUNCTION GTID_INTERSECT; +DROP FUNCTION GTID_INTERSECTION; DROP FUNCTION GTID_SYMMETRIC_DIFFERENCE; DROP FUNCTION GTID_SUBTRACT_UUID; -DROP FUNCTION GTID_INTERSECT_UUID; +DROP FUNCTION GTID_INTERSECTION_WITH_UUID; +DROP FUNCTION IFZERO; +DROP FUNCTION LOCATE2; +DROP FUNCTION GTID_COUNT; +DROP FUNCTION GTID_NEXT_GENERATED; +DROP FUNCTION GTID_NEXT_GENERATED_SET; DROP FUNCTION GTID_COMPARE; DROP FUNCTION NUMBER_TO_UUID; DROP FUNCTION UUID_TO_NUMBER; diff --git a/mysql-wsrep-5.6/mysql-test/include/have_QC_Disabled.inc b/mysql-wsrep-5.6/mysql-test/include/have_QC_Disabled.inc old mode 100755 new mode 100644 diff --git a/mysql-wsrep-5.6/mysql-test/include/have_perfschema.inc b/mysql-wsrep-5.6/mysql-test/include/have_perfschema.inc index 9e998ac4..ce52b17f 100644 --- a/mysql-wsrep-5.6/mysql-test/include/have_perfschema.inc +++ b/mysql-wsrep-5.6/mysql-test/include/have_perfschema.inc @@ -1,4 +1,5 @@ # Copyright (C) 2010 Sun Microsystems, Inc. +# Use is subject to license terms # # 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 diff --git a/mysql-wsrep-5.6/mysql-test/include/have_util_nc.inc b/mysql-wsrep-5.6/mysql-test/include/have_util_nc.inc new file mode 100644 index 00000000..2e95dcec --- /dev/null +++ b/mysql-wsrep-5.6/mysql-test/include/have_util_nc.inc @@ -0,0 +1,53 @@ +# ==== Purpose ==== +# +# Check if nc/netcat utility is available +# The variable $nc contains name of utility +# (nc or netcat) +# +# ==== Usage ==== +# +# --source include/have_util_nc.inc +# ... +# --exec $nc some options +# + +disable_result_log; +disable_query_log; + +--let $nc= +--let $_outfile= $MYSQLTEST_VARDIR/tmp/have_nc.tmp + +# find nc + +--error 0,1,127 +--exec nc -h > $_outfile 2>&1 +--eval SET @content = LOAD_FILE('$_outfile') +--remove_file $_outfile + +if (`SELECT LOCATE('usage', @content) > 0`) { + --let $nc= nc + SET @content=""; +} + +# find netcat + +if (`SELECT '$nc' = ''`) { + --error 0,1,127 + --exec netcat -h > $_outfile 2>&1 + --eval SET @content = LOAD_FILE('$_outfile') + --remove_file $_outfile +} + +if (`SELECT LOCATE('usage', @content) > 0`) { + --let $nc= netcat + SET @content=""; +} + +# Skip the test case if utility not found +if (`SELECT '$nc' = ''`) { + --skip nc/netcat not found +} + +enable_query_log; +enable_result_log; + diff --git a/mysql-wsrep-5.6/mysql-test/include/install_semisync.inc b/mysql-wsrep-5.6/mysql-test/include/install_semisync.inc index b85ec48e..b110022b 100644 --- a/mysql-wsrep-5.6/mysql-test/include/install_semisync.inc +++ b/mysql-wsrep-5.6/mysql-test/include/install_semisync.inc @@ -5,7 +5,6 @@ --source include/begin_include_file.inc --source include/not_embedded.inc ---source include/not_gtid_enabled.inc --source include/have_semisync_plugin.inc --connection master diff --git a/mysql-wsrep-5.6/mysql-test/include/linux.inc b/mysql-wsrep-5.6/mysql-test/include/linux.inc new file mode 100644 index 00000000..f2ef6387 --- /dev/null +++ b/mysql-wsrep-5.6/mysql-test/include/linux.inc @@ -0,0 +1,5 @@ +if (`select convert(@@version_compile_os using latin1) IN ("Linux") = 0`) +{ + skip Needs Linux; +} + diff --git a/mysql-wsrep-5.6/mysql-test/include/master-slave.inc b/mysql-wsrep-5.6/mysql-test/include/master-slave.inc index 9cc177e5..99000fe7 100644 --- a/mysql-wsrep-5.6/mysql-test/include/master-slave.inc +++ b/mysql-wsrep-5.6/mysql-test/include/master-slave.inc @@ -12,12 +12,13 @@ # [--let $rpl_debug= 1] # [--let $slave_timeout= NUMBER] # [--let $use_gtids= 1] +# [--let $rpl_gtid_utils= 1] # --source include/master-slave.inc # # Parameters: # $rpl_check_server_ids, $rpl_skip_reset_master_and_slave, # $rpl_skip_change_master, $rpl_skip_start_slave, $rpl_debug, -# $slave_timeout, $use_gtids +# $slave_timeout, $use_gtids, $rpl_gtid_utils # See include/rpl_init.inc # # $rpl_server_count diff --git a/mysql-wsrep-5.6/mysql-test/include/memcache_config.inc b/mysql-wsrep-5.6/mysql-test/include/memcache_config.inc old mode 100755 new mode 100644 diff --git a/mysql-wsrep-5.6/mysql-test/include/rpl_change_topology.inc b/mysql-wsrep-5.6/mysql-test/include/rpl_change_topology.inc index 29960cf2..01035497 100644 --- a/mysql-wsrep-5.6/mysql-test/include/rpl_change_topology.inc +++ b/mysql-wsrep-5.6/mysql-test/include/rpl_change_topology.inc @@ -231,6 +231,16 @@ if (!$rpl_skip_change_master) { --echo \$_rpl_server='$_rpl_server' \$_rpl_master='$_rpl_master' } + if (!$use_gtids) + { + --let $rpl_connection_name= server_$_rpl_server + --source include/rpl_connection.inc + --let $_master_auto_position= query_get_value(SHOW SLAVE STATUS, Auto_Position, 1) + if ($_master_auto_position == 1) + { + CHANGE MASTER TO MASTER_AUTO_POSITION= 0; + } + } if ($_rpl_master != '') { # Get port number diff --git a/mysql-wsrep-5.6/mysql-test/include/rpl_connection_master1.inc b/mysql-wsrep-5.6/mysql-test/include/rpl_connection_master1.inc new file mode 100644 index 00000000..372a1d12 --- /dev/null +++ b/mysql-wsrep-5.6/mysql-test/include/rpl_connection_master1.inc @@ -0,0 +1,2 @@ +let $rpl_connection_name= master1; +source include/rpl_connection.inc; diff --git a/mysql-wsrep-5.6/mysql-test/include/rpl_end.inc b/mysql-wsrep-5.6/mysql-test/include/rpl_end.inc index f671c442..541f0b99 100644 --- a/mysql-wsrep-5.6/mysql-test/include/rpl_end.inc +++ b/mysql-wsrep-5.6/mysql-test/include/rpl_end.inc @@ -16,6 +16,7 @@ # # [--let $rpl_only_running_threads= 1] # [--let $rpl_debug= 1] +# [--let $rpl_gtid_utils= 1] # --source include/rpl_end.inc # # Parameters: @@ -27,6 +28,9 @@ # $rpl_debug # See include/rpl_init.inc # +# $rpl_gtid_utils +# Source include/gtid_utils_end.inc on every server. +# # Note: # This script will fail if Last_SQL_Error or Last_IO_Error is # nonempty. If you expect an error in the SQL thread, you should @@ -82,6 +86,7 @@ while ($_rpl_server) # mtr configures server 2 to be a slave before it runs the test. We # have to restore that state now, so we change topology to 1->2. --let $rpl_topology= none +--let $use_gtids= 0 --source include/rpl_change_topology.inc @@ -90,6 +95,15 @@ while ($_rpl_server) --let $_rpl_one= _1 while ($_rpl_server) { + if ($rpl_gtid_utils) + { + # Drop gtid_utils + --let $rpl_connection_name= server_$_rpl_server + --source include/rpl_connection.inc + --source include/gtid_utils_end.inc + --connection default + } + # Unconfigure connections --disconnect server_$_rpl_server --disconnect server_$_rpl_server$_rpl_one --dec $_rpl_server diff --git a/mysql-wsrep-5.6/mysql-test/include/rpl_init.inc b/mysql-wsrep-5.6/mysql-test/include/rpl_init.inc index c7e407e5..f0f6e32f 100644 --- a/mysql-wsrep-5.6/mysql-test/include/rpl_init.inc +++ b/mysql-wsrep-5.6/mysql-test/include/rpl_init.inc @@ -51,6 +51,7 @@ # [--let $rpl_debug= 1] # [--let $slave_timeout= NUMBER] # [--let $use_gtids= 1] +# [--let $rpl_gtid_utils= 1] # --source include/rpl_init.inc # # Parameters: @@ -107,6 +108,10 @@ # $use_gtids # Use option MASTER_AUTO_POSITION = 1 to CHANGE MASTER. # +# $rpl_gtid_utils +# Create stored functions for GTID manipulation on every server (see +# gtid_utils.inc). +# # # ==== Side effects ==== # @@ -198,6 +203,10 @@ while ($_rpl_server) --let $rpl_connection_name= server_$_rpl_server --source include/rpl_connection.inc USE test; + if ($rpl_gtid_utils) + { + --source include/gtid_utils.inc + } if (!$rpl_skip_reset_master_and_slave) { RESET MASTER; @@ -245,6 +254,10 @@ if ($rpl_check_server_ids) # $rpl_master_list must be set so that include/rpl_change_topology.inc # knows which servers are initialized and not. +if (!`SELECT COUNT(*) = 0 OR VARIABLE_VALUE != 'ON' FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME = 'GTID_MODE'`) +{ + --let $use_gtids=1 +} --let $rpl_master_list= `SELECT REPEAT('x', $rpl_server_count * LENGTH($rpl_server_count))` --source include/rpl_change_topology.inc diff --git a/mysql-wsrep-5.6/mysql-test/include/rpl_stop_server.inc b/mysql-wsrep-5.6/mysql-test/include/rpl_stop_server.inc index 98c7bb82..42898ca8 100644 --- a/mysql-wsrep-5.6/mysql-test/include/rpl_stop_server.inc +++ b/mysql-wsrep-5.6/mysql-test/include/rpl_stop_server.inc @@ -6,6 +6,7 @@ # # --let $rpl_server_number= N # [--let $rpl_debug= 1] +# [--let $rpl_force_stop= 1] # --source include/rpl_stop_server.inc # # Parameters: @@ -17,6 +18,8 @@ # # $rpl_debug # See include/rpl_init.inc +# $rpl_force_stop +# Kill the server immediately i.e., --shutdown_server 0 # # ==== See also ==== # @@ -48,11 +51,15 @@ if ($rpl_debug) # Send shutdown to the connected server and give # it 14 seconds to die before zapping it -shutdown_server 14; - +--let $shutdown_server_timeout= 14 +if ($rpl_force_stop) +{ + # if force_stop is set, shutdown server immediately(equal to killing the server) + --let $shutdown_server_timeout= 0 +} +shutdown_server $shutdown_server_timeout; --source include/wait_until_disconnected.inc - --let $rpl_connection_name= $_rpl_stop_server_old_connection --source include/rpl_connection.inc --dec $_include_file_depth diff --git a/mysql-wsrep-5.6/mysql-test/include/save_io_thread_pos.inc b/mysql-wsrep-5.6/mysql-test/include/save_io_thread_pos.inc index e59ee162..a266d871 100644 --- a/mysql-wsrep-5.6/mysql-test/include/save_io_thread_pos.inc +++ b/mysql-wsrep-5.6/mysql-test/include/save_io_thread_pos.inc @@ -28,7 +28,7 @@ if ($use_gtids) { - --let $_saved_gtids= query_get_value(SHOW SLAVE STATUS, Retrieved_Gtid_set, 1) + --let $_saved_gtids= query_get_value(SHOW SLAVE STATUS, Retrieved_Gtid_Set, 1) if ($rpl_debug) { --echo save_io_thread_pos.inc saved gtid='$_saved_gtids' diff --git a/mysql-wsrep-5.6/mysql-test/include/save_master_pos.inc b/mysql-wsrep-5.6/mysql-test/include/save_master_pos.inc index 16d6e974..fd54f09b 100644 --- a/mysql-wsrep-5.6/mysql-test/include/save_master_pos.inc +++ b/mysql-wsrep-5.6/mysql-test/include/save_master_pos.inc @@ -27,18 +27,21 @@ --let $include_filename= save_master_pos.inc --source include/begin_include_file.inc +# +# Always save master positions, this will be useful to check missing GTIDs. +# +--let $_saved_file= query_get_value(SHOW MASTER STATUS, File, 1) +--let $_saved_pos= query_get_value(SHOW MASTER STATUS, Position, 1) if ($use_gtids) { --let $_saved_gtids= `SELECT @@global.gtid_executed` if ($rpl_debug) { - --echo save_master_pos saved gtid='$_saved_gtids' + --echo save_master_pos saved gtid='$_saved_gtids', file='$_saved_file', pos='$_saved_pos' } } if (!$use_gtids) { - --let $_saved_file= query_get_value(SHOW MASTER STATUS, File, 1) - --let $_saved_pos= query_get_value(SHOW MASTER STATUS, Position, 1) if ($rpl_debug) { --echo save_master_pos saved file='$_saved_file', pos='$_saved_pos' diff --git a/mysql-wsrep-5.6/mysql-test/include/show_all_binlogs.inc b/mysql-wsrep-5.6/mysql-test/include/show_all_binlogs.inc new file mode 100644 index 00000000..e8985f93 --- /dev/null +++ b/mysql-wsrep-5.6/mysql-test/include/show_all_binlogs.inc @@ -0,0 +1,66 @@ +# ==== Purpose ==== +# +# Print the contents of all binary logs to the result log. This must +# only be used for debugging. +# +# ==== Usage ==== +# +# [--let $output_file= FILENAME] +# [--let $append= 1] +# [--let $rpl_debug= 1] +# --source include/show_all_binlogs.inc +# +# Parameters: +# +# $output_file +# By default, output is printed to the result log. If you need to +# print it to a specific file, specify the filename with this +# parameter. +# +# $append +# By default, if $output_file is specified and the file exists, +# this script truncates the file before it writes to it. If +# $append is specified, the file is not truncated and the contents +# of the binary log is appended to the end. +# +# $rpl_debug +# See rpl_init.inc + +--let $include_filename= show_all_binlogs.inc +--source include/begin_include_file.inc + + +--disable_query_log + +if ($output_file == '') +{ + --echo DO_NOT_CHECK_IN_THIS_LINE: include/show_all_binlogs.inc should only be used for debugging. Never check in a test that calls it on success. +} + +--let $number= 1 +--let $binlog_file= query_get_value(SHOW BINARY LOGS, Log_name, $number) +while ($binlog_file != 'No such row') +{ + --let $statement= SHOW BINLOG EVENTS IN '$binlog_file' + --let $header= ======== $statement ======== + + if ($output_file != '') + { + --let $write_var= $header + --let $write_to_file= $output_file + --source include/write_var_to_file.inc + + --source include/write_result_to_file.inc + } + if ($output_file == '') + { + --echo $header + eval $statement; + } + --inc $number + + --let $binlog_file= query_get_value(SHOW BINARY LOGS, Log_name, $number) +} + + +--source include/end_include_file.inc diff --git a/mysql-wsrep-5.6/mysql-test/include/show_all_relay_logs.inc b/mysql-wsrep-5.6/mysql-test/include/show_all_relay_logs.inc new file mode 100644 index 00000000..1e5cb73e --- /dev/null +++ b/mysql-wsrep-5.6/mysql-test/include/show_all_relay_logs.inc @@ -0,0 +1,70 @@ +# ==== Purpose ==== +# +# Print the contents of all relay logs to the result log. This must +# only be used for debugging. +# +# ==== Usage ==== +# +# [--let $output_file= FILENAME] +# [--let $append= 1] +# [--let $rpl_debug= 1] +# --source include/show_all_binlogs.inc +# +# Parameters: +# +# $output_file +# By default, output is printed to the result log. If you need to +# print it to a specific file, specify the filename with this +# parameter. +# +# $append +# By default, if $output_file is specified and the file exists, +# this script truncates the file before it writes to it. If +# $append is specified, the file is not truncated and the contents +# of the binary log is appended to the end. +# +# $rpl_debug +# See rpl_init.inc + +--let $include_filename= show_all_relay_logs.inc +--source include/begin_include_file.inc + + +--disable_query_log + +if ($output_file == '') +{ + --echo DO_NOT_CHECK_IN_THIS_LINE: include/show_all_relay_logs.inc should only be used for debugging. Never check in a test that calls it on success. +} + +--let $last_relay_log_file= query_get_value(SHOW SLAVE STATUS, Relay_Log_File, 1) +--let $relay_log_base= `SELECT SUBSTRING_INDEX('$last_relay_log_file', '.', 1)` +--let $relay_log_count= `SELECT CONCAT('1', SUBSTRING_INDEX('$last_relay_log_file', '.', -1)) - 1000000` +--let $number= 1 +while ($number <= $relay_log_count) +{ + --let $padded_number= `SELECT LPAD('$number', 6, '0')` + --let $statement= SHOW RELAYLOG EVENTS IN '$relay_log_base.$padded_number' + --let $header= ======== $statement ======== + + if ($output_file != '') + { + --let $write_to_file= $output_file + --let $write_var= $header + --let $allow_error= 1 + --source include/write_var_to_file.inc + + --source include/write_result_to_file.inc + } + if ($output_file == '') + { + --echo $header + --error 0, 1220 # 1220 = ER_ERROR_WHEN_EXECUTING_COMMAND + eval $statement; + } + + --inc $number +} + + +--source include/end_include_file.inc diff --git a/mysql-wsrep-5.6/mysql-test/include/show_rpl_debug_info.inc b/mysql-wsrep-5.6/mysql-test/include/show_rpl_debug_info.inc index a20520ee..2399dd75 100644 --- a/mysql-wsrep-5.6/mysql-test/include/show_rpl_debug_info.inc +++ b/mysql-wsrep-5.6/mysql-test/include/show_rpl_debug_info.inc @@ -21,6 +21,8 @@ # ==== Usage ==== # # [--let $rpl_only_current_connection= 1] +# [--let $extra_debug_info= some text] +# [--let $extra_debug_eval= expression parsable by include/eval.inc] # --source include/show_rpl_debug_info.inc # # Parameters: @@ -28,7 +30,14 @@ # By default, debug info is printed from all connections, starting # with the current connection. If this variable is set, debug # info is printed only for the current connection. -# +# +# $extra_debug_info +# This text is printed verbatim to the output. Useful for helper +# scripts to supply extra diagnostic output. +# +# $extra_debug_eval +# Expression in the form expected by include/eval.inc, which will +# be evaluated and printed to the output. # # ==== Side effects ==== # @@ -56,6 +65,8 @@ if ($_rpl_server == '') } --inc $_rpl_server +--echo DO_NOT_CHECK_IN_THIS_LINE: include/show_rpl_debug_info.inc should only be used for debugging. Never check in a test that calls it on success. + --echo CURRENT_CONNECTION = '$_rpl_old_con' while ($_rpl_server) @@ -124,6 +135,12 @@ while ($_rpl_server) --echo rand_seed: '$rand_seed' _rand_state: '$_rand_state' --echo extra debug info if any: '$extra_debug_info' +if ($extra_debug_eval) +{ + --let $eval_expr= $extra_debug_eval + --source include/eval.inc + --echo extra evaluated debug info: '$eval_result' +} --connection $_rpl_old_con --enable_abort_on_error diff --git a/mysql-wsrep-5.6/mysql-test/include/shutdown_mysqld.inc b/mysql-wsrep-5.6/mysql-test/include/shutdown_mysqld.inc old mode 100755 new mode 100644 diff --git a/mysql-wsrep-5.6/mysql-test/include/start_mysqld.inc b/mysql-wsrep-5.6/mysql-test/include/start_mysqld.inc old mode 100755 new mode 100644 diff --git a/mysql-wsrep-5.6/mysql-test/include/stop_dump_threads.inc b/mysql-wsrep-5.6/mysql-test/include/stop_dump_threads.inc index 9ffc826f..afeb6cb8 100644 --- a/mysql-wsrep-5.6/mysql-test/include/stop_dump_threads.inc +++ b/mysql-wsrep-5.6/mysql-test/include/stop_dump_threads.inc @@ -15,7 +15,7 @@ --disable_query_log --disable_result_log ---let $_sdt_dump_thread_id= `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE COMMAND = 'Binlog dump'` +--let $_sdt_dump_thread_id= `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE COMMAND = 'Binlog dump' OR COMMAND = 'Binlog Dump GTID'` while ($_sdt_dump_thread_id != '') { @@ -23,10 +23,9 @@ while ($_sdt_dump_thread_id != '') --let $wait_condition= SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE ID = $_sdt_dump_thread_id --source include/wait_condition.inc - --let $_sdt_dump_thread_id= `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE COMMAND = 'Binlog dump'` + --let $_sdt_dump_thread_id= `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE COMMAND = 'Binlog dump' OR COMMAND = 'Binlog Dump GTID'` } - --let $show_rpl_debug_info= $_sdt_show_rpl_debug_info_old --let $include_filename= stop_dump_threads.inc diff --git a/mysql-wsrep-5.6/mysql-test/include/subquery.inc b/mysql-wsrep-5.6/mysql-test/include/subquery.inc index 8d973f68..119414c8 100644 --- a/mysql-wsrep-5.6/mysql-test/include/subquery.inc +++ b/mysql-wsrep-5.6/mysql-test/include/subquery.inc @@ -6178,5 +6178,21 @@ SELECT 1 FROM t2 WHERE c > ANY (SELECT a FROM t1 WHERE b >= 3) IS TRUE; DROP TABLE t1, t2; +--echo # Bug #18014565 - WRONG RESULT COMPUTATION USING ALL() AND GROUP BY +--echo # + +CREATE TABLE t1 ( + f1 INTEGER, + f2 INTEGER +); + +INSERT INTO t1 VALUES (1,3),(1,6),(2,3),(2,6); + +SELECT f1, SUM(f2) AS sum FROM t1 GROUP BY f1 HAVING sum > ALL (SELECT 1); + +DROP TABLE t1; + +--echo # End of test for Bug#18014565 + set @@optimizer_switch=@old_opt_switch; # New tests go here. diff --git a/mysql-wsrep-5.6/mysql-test/include/subquery_mat.inc b/mysql-wsrep-5.6/mysql-test/include/subquery_mat.inc index 93cbf287..15de01bc 100644 --- a/mysql-wsrep-5.6/mysql-test/include/subquery_mat.inc +++ b/mysql-wsrep-5.6/mysql-test/include/subquery_mat.inc @@ -1417,6 +1417,53 @@ eval $query; DROP TABLE t1,t2,t3; +--echo # +--echo # Bug#19297190 NOT IN DOESN'T RETURN EXPECTED RESULT +--echo # + +CREATE TABLE t1 (a VARCHAR(500) CHARACTER SET UTF8) ENGINE=INNODB; + +# Fill the table with 32 distinct long rows (>32kB of data) +SET @str= repeat("a",450); +SET @num=1000; +INSERT INTO t1 VALUES (CONCAT((@num:=@num+1), @str)); +INSERT INTO t1 SELECT CONCAT((@num:=@num+1), @str) FROM t1; +INSERT INTO t1 SELECT CONCAT((@num:=@num+1), @str) FROM t1; +INSERT INTO t1 SELECT CONCAT((@num:=@num+1), @str) FROM t1; +INSERT INTO t1 SELECT CONCAT((@num:=@num+1), @str) FROM t1; +INSERT INTO t1 SELECT CONCAT((@num:=@num+1), @str) FROM t1; +SELECT COUNT(*) FROM t1; + +ANALYZE TABLE t1; + +let $query= +SELECT COUNT(*) +FROM t1 +WHERE t1.a NOT IN ( + SELECT t2.a FROM t1 as t2 +); + +# If subq-mat is used, this will force MEMORY->MYISAM tmp table conversion: +set @save_heap_size= @@max_heap_table_size; +set @@max_heap_table_size= 16384; + +# Uses IN->EXISTS because field too long for subq-materialization: +eval EXPLAIN $query; +eval $query; + +# Make field just below the length limit: +# Silence truncation warnings: +--disable_warnings +ALTER TABLE t1 MODIFY a VARCHAR(332) CHARACTER SET UTF8; +--enable_warnings + +# Now subquery materialization can be used, and result is still correct: +eval EXPLAIN $query; +eval $query; + +DROP TABLE t1; +set @@max_heap_table_size= @save_heap_size; + --echo # End of 5.6 tests set @@optimizer_switch=@old_opt_switch; diff --git a/mysql-wsrep-5.6/mysql-test/include/subquery_sj.inc b/mysql-wsrep-5.6/mysql-test/include/subquery_sj.inc index 34aa48dd..208932cb 100644 --- a/mysql-wsrep-5.6/mysql-test/include/subquery_sj.inc +++ b/mysql-wsrep-5.6/mysql-test/include/subquery_sj.inc @@ -6442,6 +6442,86 @@ DROP TABLE t1, t2; --echo # End of test for bug#14064201. +--echo # +--echo # Bug#18223655:ASSERTION FAILED: (INT)IDX >= 0 +--echo # && IDX < PARENT_JOIN->TABLES +--echo # + +CREATE TABLE b (d INT); +CREATE TABLE c (a INT, b INT,c INT,d BLOB NOT NULL); + +SELECT(SELECT 1 + FROM b WHERE(SELECT 1 IN (SELECT 1 FROM b WHERE 1 NOT BETWEEN d AND 1) + FROM b) IN (SELECT d FROM c)) as cc FROM b; + +INSERT INTO b VALUE(1); +INSERT INTO c VALUES(1,2,3,'1'),(2,3,4,'1'),(3,4,5,'C'); +SELECT(SELECT d FROM b WHERE(SELECT d IN + (SELECT d FROM b WHERE 1 NOT BETWEEN d AND 1) FROM b) IN + (SELECT d FROM c)) as cc FROM c; +DROP TABLE b,c; + +--echo # +--echo # Bug#18447874:WRONG RESULT COMING FROM SEMI-JOIN +--echo # +CREATE TABLE b ( + d INT(11) +); +CREATE TABLE c ( + d BLOB +) ; +CREATE TABLE d ( + b INT(11) +); + +INSERT INTO b VALUES(1),(2),(4); +INSERT INTO c VALUES(1),(2),(3); +SELECT 1 FROM b WHERE (SELECT 1 FROM d ) IN (SELECT d FROM c) ; +INSERT INTO d VALUES(2); +SELECT 1 FROM b WHERE (SELECT 1 FROM d ) IN (SELECT d FROM c) ; + +DROP TABLE b,c,d; + +--echo # +--echo # Bug#17292723:INCORRECT RESULT FOR (SELECT...) IN (SELECT...) STATEMENT +--echo # +CREATE TABLE t1 ( + ID int(11) NOT NULL AUTO_INCREMENT, + id2 int(11) DEFAULT NULL, + id3 int(11) DEFAULT NULL, + id4 varchar(150) COLLATE utf8_spanish_ci NOT NULL, + id5 int(11) DEFAULT NULL, + PRIMARY KEY (ID), + KEY id2 (id2), + KEY id3 (id3), + KEY id5 (id5) +) ENGINE=InnoDB; + +INSERT INTO t1 VALUES +(123,1,1,'1',NULL), +(124,1,1,'2',NULL), +(125,1,1,'4',NULL), +(126,1,1,'3',NULL), +(127,1,1,'6',NULL), +(128,1,1,'8',NULL); + +CREATE TABLE t2 ( + id6 int(11) NOT NULL, + id7 int(11) NOT NULL, + PRIMARY KEY (id6,id7), + KEY id7 (id7) +) ENGINE=InnoDB; + +INSERT INTO t2 VALUES (126,123),(130,123),(135,123); + +SELECT ID + FROM t1 p0 + WHERE p0.id3=1 + AND ( (SELECT p1.id FROM t1 p1 WHERE p1.id=123) IN (SELECT p3.id FROM t2 +p2, t1 p3 WHERE p0.id=p2.id6 AND p2.id7=p3.id)); + +DROP TABLE t1,t2; + set @@optimizer_switch=@old_opt_switch; # New tests go here. diff --git a/mysql-wsrep-5.6/mysql-test/include/sync_slave_sql.inc b/mysql-wsrep-5.6/mysql-test/include/sync_slave_sql.inc index 4f9fc052..834acad8 100644 --- a/mysql-wsrep-5.6/mysql-test/include/sync_slave_sql.inc +++ b/mysql-wsrep-5.6/mysql-test/include/sync_slave_sql.inc @@ -22,6 +22,11 @@ # # $use_gtids # If set, uses GTIDs instead of filename and offset for positions. +# +# $ignore_gtids_on_sync +# Forces the use of master file and position, even if $use_gtids is set. +# This might be used if the slave will not have all the GTIDs of the master +# but have to read and apply all master events to the end. --let $include_filename= sync_slave_sql.inc --source include/begin_include_file.inc @@ -34,10 +39,40 @@ if (!$_sss_slave_timeout) if ($rpl_debug) { - --echo use_gtids='$use_gtids' _saved_gtids='$_saved_gtids' _saved_file='$_saved_file' _saved_pos='$_saved_pos' timeout='$_sss_slave_timeout' + --echo use_gtids='$use_gtids' ignore_gtids_on_sync='$ignore_gtids_on_sync' _saved_gtids='$_saved_gtids' _saved_file='$_saved_file' _saved_pos='$_saved_pos' timeout='$_sss_slave_timeout' +} + +# +# Verify if the SQL thread is already updated by the master position +# regardless the use if GTIDs. If the SQL thread is already updated, +# we can reduce the slave timeout of WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS +# to a minimum because there in nothing else to sync. +# As there is a possibility of missing GTIDs on slave, this reduced +# timeout will make mtr throw an error almost promptly, without having +# to wait 300 seconds to notice a sync problem between master and slave. +# +--let $_slave_master_file= query_get_value(SHOW SLAVE STATUS, Relay_Master_Log_File, 1) +--let $_slave_master_pos= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1) +if ($_slave_master_file == $_saved_file) +{ + if ($_slave_master_pos == $_saved_pos) + { + if ($rpl_debug) + { + --echo debug: It seems that SQL thread is already synced (by verifying master file and position) + --echo debug: Changing slave timeout to 1 seconds + } + --let $_sss_slave_timeout= 1 + } +} + +--let $_sync_with_gtids= $use_gtids +if ($ignore_gtids_on_sync) +{ + --let $_sync_with_gtids= 0 } -if ($use_gtids) +if ($_sync_with_gtids) { if ($rpl_debug) { @@ -45,7 +80,7 @@ if ($use_gtids) } --let $_sss_result= `SELECT WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS('$_saved_gtids', $_sss_slave_timeout)` } -if (!$use_gtids) +if (!$_sync_with_gtids) { if ($rpl_debug) { @@ -61,7 +96,7 @@ if ($_sss_result == '') } if ($_sss_result == -1) { - --let $error_type= Timeout after $slave_timeout seconds. + --let $error_type= Timeout after $_sss_slave_timeout seconds. } if ($_sss_result < 0) diff --git a/mysql-wsrep-5.6/mysql-test/include/sync_slave_sql_with_master.inc b/mysql-wsrep-5.6/mysql-test/include/sync_slave_sql_with_master.inc index 7204f0b2..e2c5c52d 100644 --- a/mysql-wsrep-5.6/mysql-test/include/sync_slave_sql_with_master.inc +++ b/mysql-wsrep-5.6/mysql-test/include/sync_slave_sql_with_master.inc @@ -37,6 +37,7 @@ --let $include_filename= sync_slave_sql_with_master.inc --source include/begin_include_file.inc +--source include/wait_for_ndb_committed_to_binlog.inc --source include/save_master_pos.inc --let $rpl_connection_name= slave diff --git a/mysql-wsrep-5.6/mysql-test/include/truncate_file.inc b/mysql-wsrep-5.6/mysql-test/include/truncate_file.inc index 2326d6c0..c55627b5 100644 --- a/mysql-wsrep-5.6/mysql-test/include/truncate_file.inc +++ b/mysql-wsrep-5.6/mysql-test/include/truncate_file.inc @@ -9,8 +9,8 @@ if (!$file) let TRUNCATE_FILE= $file; perl; -use Env; -Env::import('TRUNCATE_FILE'); -open FILE, '>', $TRUNCATE_FILE || die "Can not open file $file"; +my $filename = $ENV{'TRUNCATE_FILE'}; +$filename =~ s/\/\//\//; +open FILE, '>', $filename || die "Can not open file $filename"; close FILE; EOF diff --git a/mysql-wsrep-5.6/mysql-test/include/uninstall_semisync.inc b/mysql-wsrep-5.6/mysql-test/include/uninstall_semisync.inc index 18e43486..dfe286b1 100644 --- a/mysql-wsrep-5.6/mysql-test/include/uninstall_semisync.inc +++ b/mysql-wsrep-5.6/mysql-test/include/uninstall_semisync.inc @@ -13,6 +13,11 @@ UNINSTALL PLUGIN rpl_semi_sync_slave; --connection master +# After BUG#17638477 fix, uninstallation of rpl_semi_sync_master +# is not allowed when there are semi sync slaves. Hence kill +# all dump threads before uninstalling it. +SET GLOBAL rpl_semi_sync_master_enabled = OFF; +--source include/stop_dump_threads.inc UNINSTALL PLUGIN rpl_semi_sync_master; --enable_warnings diff --git a/mysql-wsrep-5.6/mysql-test/include/wait_for_ndb_committed_to_binlog.inc b/mysql-wsrep-5.6/mysql-test/include/wait_for_ndb_committed_to_binlog.inc new file mode 100644 index 00000000..08dcbac4 --- /dev/null +++ b/mysql-wsrep-5.6/mysql-test/include/wait_for_ndb_committed_to_binlog.inc @@ -0,0 +1,57 @@ +# ==== Purpose ==== +# +# Several test primitives from mysql-test/extra/rpl_tests +# are shared for test cases for MyISAM, InnoDB, NDB and +# other engines. +# For NDB engine all events will be added by NDB injector +# so tests only can continue after injector is ready, +# this file waits for all committed transactions (at start +# of file) are injected into the binlog. +# +# ==== Usage ==== +# +# let $wait_timeout= 150; +# --source include/wait_for_ndb_committed_to_binlog.inc +# +# ==== Parameters ===== +# +# $wait_timeout +# Time to wait in seconds for epoch to be injected in binlog. +# On timeout test dies. +# + +if (`SELECT 1 FROM information_schema.engines WHERE engine = 'ndbcluster' AND support IN ('YES', 'DEFAULT')`) +{ + let $max_run_time= 150; + if ($wait_timeout) + { + let $max_run_time= $wait_timeout; + } + # Reset $wait_timeout so that its value won't be used on subsequent + # calls, and default will be used instead. + let $wait_timeout= 0; + + # The smallest timespan till UNIX_TIMESTAMP() gets incremented is ~0 seconds. + # We add one second to avoid the case that somebody measures timespans on a + # real clock with fractions of seconds, detects that n seconds are sufficient, + # assigns n to this routine and suffers because he sometimes gets n - 1 + # seconds in reality. + + let $max_end_time= `SELECT UNIX_TIMESTAMP() + $max_run_time + 1`; + + source include/get_ndb_epochs.inc; + + while (`SELECT $ndb_latest_trans_epoch > $ndb_latest_handled_binlog_epoch AND UNIX_TIMESTAMP() <= $max_end_time`) + { + # Sleep a bit to avoid too heavy load. + sleep 0.1; + + source include/get_ndb_epochs.inc; + } + + if (`SELECT $ndb_latest_trans_epoch > $ndb_latest_handled_binlog_epoch`) + { + echo ERROR IN TEST: Timeout in waiting for epoch $ndb_latest_trans_epoch to be handled, last handled is $ndb_latest_handled_binlog_epoch; + die ERROR IN TEST: Timeout in waiting for epoch to be handled; + } +} diff --git a/mysql-wsrep-5.6/mysql-test/include/wait_for_slave_param.inc b/mysql-wsrep-5.6/mysql-test/include/wait_for_slave_param.inc index 75db9a31..d181f955 100644 --- a/mysql-wsrep-5.6/mysql-test/include/wait_for_slave_param.inc +++ b/mysql-wsrep-5.6/mysql-test/include/wait_for_slave_param.inc @@ -12,7 +12,7 @@ # [--let $slave_timeout= NUMBER] # [--let $slave_error_param= [Slave_SQL_Errno | Slave_IO_Errno]] # [--let $rpl_debug= 1] -# --source include/slave_wait_param.inc +# --source include/wait_for_slave_param.inc # # Parameters: # diff --git a/mysql-wsrep-5.6/mysql-test/include/wait_for_slave_sql_error.inc b/mysql-wsrep-5.6/mysql-test/include/wait_for_slave_sql_error.inc index d2818f65..8697ca05 100644 --- a/mysql-wsrep-5.6/mysql-test/include/wait_for_slave_sql_error.inc +++ b/mysql-wsrep-5.6/mysql-test/include/wait_for_slave_sql_error.inc @@ -6,7 +6,7 @@ # # ==== Usage ==== # -# --let $slave_sql_errno= NUMBER +# --let $slave_sql_errno= NUMBER [, NUMBER ...] [# comment] # [--let $show_slave_sql_error= 1] # [--let $rpl_debug= 1] # [--let $slave_timeout= NUMBER] @@ -14,7 +14,13 @@ # # Parameters: # $slave_sql_errno -# The expected SQL error number. This is required. +# The expected SQL error numbers. This can be either a single +# number, or a comma-separated list of numbers. Examples: +# --let $slave_sql_errno= 1040, 1053, 2002, 2003, 2006, 2013 +# --let $slave_sql_errno= 1593 # ER_SLAVE_FATAL_ERROR +# It is allowed to add a comment at the end of the line, and it +# is strongly advised to put the symbolic name of the error in +# this comment, like the example above. # (After BUG#41956 has been fixed, this will be required to be a # symbolic name instead of a number.) # @@ -50,7 +56,15 @@ if ($slave_sql_errno == '') { --die !!!ERROR IN TEST: you must set \$slave_sql_errno before sourcing wait_for_slave_sql_error.inc } -if (`SELECT $_wfsse_errno NOT IN ($slave_sql_errno)`) { +# Strip away comments +--let $_slave_sql_errno= `SELECT IF(LOCATE('#', '$slave_sql_errno') != 0, SUBSTR('$slave_sql_errno', 1, LOCATE('#', '$slave_sql_errno') - 1), '$slave_sql_errno')` + +if ($rpl_debug) +{ + --echo # debug: slave_sql_errno='$_slave_sql_errno'; stripped from comments='$_slave_sql_errno' wfsie_errno='$_wfsie_errno' +} + +if (`SELECT $_wfsse_errno NOT IN ($_slave_sql_errno)`) { --echo **** Slave stopped with wrong error code: $_wfsse_errno (expected $slave_sql_errno) **** source include/show_rpl_debug_info.inc; --echo **** Slave stopped with wrong error code: $_wfsse_errno (expected $slave_sql_errno) **** diff --git a/mysql-wsrep-5.6/mysql-test/include/wait_for_slave_sql_to_stop.inc b/mysql-wsrep-5.6/mysql-test/include/wait_for_slave_sql_to_stop.inc index 492b3237..f81768cd 100644 --- a/mysql-wsrep-5.6/mysql-test/include/wait_for_slave_sql_to_stop.inc +++ b/mysql-wsrep-5.6/mysql-test/include/wait_for_slave_sql_to_stop.inc @@ -31,6 +31,7 @@ --let $slave_param= Slave_SQL_Running --let $slave_param_value= No +--let $slave_param_comparison= = --let $slave_error_param= Last_SQL_Errno --source include/wait_for_slave_param.inc --let $slave_error_param= diff --git a/mysql-wsrep-5.6/mysql-test/include/wait_show_condition.inc b/mysql-wsrep-5.6/mysql-test/include/wait_show_condition.inc index ae1600a7..2afde7ff 100644 --- a/mysql-wsrep-5.6/mysql-test/include/wait_show_condition.inc +++ b/mysql-wsrep-5.6/mysql-test/include/wait_show_condition.inc @@ -9,7 +9,7 @@ # # USAGE # -# All rows of the result must fulfil the condition if $all_rows_fulfil is 1 +# All rows of the result must fulfil the condition if $wait_for_all is 1 # else at least one of the result must fulfil the condition. # let $wait_for_all= 1; # let $show_statement= SHOW PROCESSLIST; @@ -87,6 +87,11 @@ if ($wait_for_all != 1) # We are behind the last row of the result set. let $process_result= 0; let $do_loop= 0; + # For string fields and for "!=" comparision, it is possible that + # above if condition (i.e., SELECT '$field_value' $condition) is + # true and the current if condition is also true. So set $found=0 + # here explicitly + let $found= 0; } inc $rowno; } diff --git a/mysql-wsrep-5.6/mysql-test/include/write_result_to_file.inc b/mysql-wsrep-5.6/mysql-test/include/write_result_to_file.inc index 80d67a0c..75caf021 100644 --- a/mysql-wsrep-5.6/mysql-test/include/write_result_to_file.inc +++ b/mysql-wsrep-5.6/mysql-test/include/write_result_to_file.inc @@ -12,6 +12,8 @@ # --let $statement= # --let $output_file= {|GENERATE} # [--let $dont_print_statement= 1] +# [--let $allow_error= 1] +# [--let $append= 1] # --source include/write_result_to_file.inc # # Parameters: @@ -27,6 +29,14 @@ # By default, the statement is echoed to the result log. If the # statement contains non-deterministic output, set this variable # to suppress it. +# +# $allow_error +# By default, this script causes the test to fail if the statement +# generates an error. If $allow_error is set, errors are ignored. +# +# $append +# By default, any existing file is overwritten. If $append is +# specified, and the file exists, it appends to the file. # Get the port and socket used by mysqld on current connection --let _WRTF_SERVER_PORT= `SELECT @@PORT` @@ -58,19 +68,37 @@ if ($output_file == GENERATE) } --let _WRTF_OUTPUT_FILE= $output_file +if ($allow_error) +{ + --let _WRTF_ALLOW_ERROR= 1 +} +if (!$allow_error) +{ + --let _WRTF_ALLOW_ERROR= 0 +} +if ($append) +{ + --let _WRTF_APPEND= 1 +} +if (!$append) +{ + --let _WRTF_APPEND= 0 +} + perl; use strict; my $stmt= $ENV{'_WRTF_STATEMENT'}; # Connecting mysql to same mysqld as current connectiona # by overriding port and socket - my $mysql = $ENV{'MYSQL'}; + my $mysql= $ENV{'MYSQL'}; my $server_port= $ENV{'_WRTF_SERVER_PORT'}; my $server_socket= $ENV{'_WRTF_SERVER_SOCKET'}; + my $redirection_type= $ENV{'_WRTF_APPEND'} ? '>>' : '>'; $mysql .= " --port=$server_port --socket=$server_socket"; my $outfile = $ENV{'_WRTF_OUTPUT_FILE'}; - open MYSQL, "| $mysql > $outfile" or die "Failed to open MYSQL pipe: '$mysql > $outfile'"; + open MYSQL, "| $mysql $redirection_type $outfile" or die "Failed to open MYSQL pipe: '$mysql > $outfile'"; print MYSQL $stmt, ';' or die "Error printing statement to MYSQL pipe: $!"; - close MYSQL or die "Error closing MYSQL pipe: $!"; + close MYSQL or $ENV{'_WRTF_ALLOW_ERROR'} or die "Error closing MYSQL pipe: $!"; EOF --let $include_filename= write_result_to_file.inc [$write_result_msg] diff --git a/mysql-wsrep-5.6/mysql-test/lib/My/SafeProcess/CMakeLists.txt b/mysql-wsrep-5.6/mysql-test/lib/My/SafeProcess/CMakeLists.txt index ada3777b..c75e09f5 100644 --- a/mysql-wsrep-5.6/mysql-test/lib/My/SafeProcess/CMakeLists.txt +++ b/mysql-wsrep-5.6/mysql-test/lib/My/SafeProcess/CMakeLists.txt @@ -29,7 +29,7 @@ IF(CMAKE_SYSTEM_NAME MATCHES "SunOS") STRING(REPLACE " -library=stlport4" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) STRING(REPLACE " -library=stlport4" "" CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG}) STRING(REPLACE " -library=stlport4" "" CMAKE_CXX_FLAGS_RELWITHDEBINFO ${CMAKE_CXX_FLAGS_RELWITHDEBINFO}) - STRING(REGEX REPLACE " -R[^ ]+" "" CMAKE_CXX_LINK_FLAGS ${CMAKE_CXX_LINK_FLAGS}) + STRING(REGEX REPLACE " -R[^ ]+" "" CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS}") ENDIF() ENDIF() diff --git a/mysql-wsrep-5.6/mysql-test/lib/mtr_cases.pm b/mysql-wsrep-5.6/mysql-test/lib/mtr_cases.pm index ae1d465e..45867d21 100644 --- a/mysql-wsrep-5.6/mysql-test/lib/mtr_cases.pm +++ b/mysql-wsrep-5.6/mysql-test/lib/mtr_cases.pm @@ -1,5 +1,5 @@ # -*- cperl -*- -# Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2005, 2014, 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 @@ -336,7 +336,7 @@ sub collect_one_suite($) # Build a hash of disabled testcases for this suite # ---------------------------------------------------------------------- my %disabled; - my @disabled_collection= @{$opt_skip_test_list} if defined @{$opt_skip_test_list}; + my @disabled_collection= @{$opt_skip_test_list} if $opt_skip_test_list; unshift (@disabled_collection, "$testdir/disabled.def"); for my $skip (@disabled_collection) { diff --git a/mysql-wsrep-5.6/mysql-test/lib/mtr_match.pm b/mysql-wsrep-5.6/mysql-test/lib/mtr_match.pm index 6fc9832a..140885b6 100644 --- a/mysql-wsrep-5.6/mysql-test/lib/mtr_match.pm +++ b/mysql-wsrep-5.6/mysql-test/lib/mtr_match.pm @@ -1,5 +1,6 @@ # -*- cperl -*- # Copyright (C) 2004-2008 MySQL AB +# Use is subject to license terms # # 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 diff --git a/mysql-wsrep-5.6/mysql-test/mysql-test-run.pl b/mysql-wsrep-5.6/mysql-test/mysql-test-run.pl index b293ae39..82b5d1c6 100755 --- a/mysql-wsrep-5.6/mysql-test/mysql-test-run.pl +++ b/mysql-wsrep-5.6/mysql-test/mysql-test-run.pl @@ -1,7 +1,7 @@ #!/usr/bin/perl # -*- cperl -*- -# Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2014, 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 @@ -235,6 +235,7 @@ our $opt_ddd; our $opt_client_ddd; my $opt_boot_ddd; our $opt_manual_gdb; +our $opt_manual_lldb; our $opt_manual_dbx; our $opt_manual_ddd; our $opt_manual_debug; @@ -420,7 +421,6 @@ sub main { ); mtr_error("Could not create testcase server port: $!") unless $server; my $server_port = $server->sockport(); - mtr_report("Using server port $server_port"); if ($opt_resfile) { resfile_init("$opt_vardir/mtr-results.txt"); @@ -478,7 +478,7 @@ sub main { # Send Ctrl-C to any children still running kill("INT", keys(%children)); - if (!IS_WINDOWS) { + if (!IS_WINDOWS) { # Wait for children to exit foreach my $pid (keys %children) { @@ -492,7 +492,7 @@ sub main { } } - if ( not defined @$completed ) { + if ( not $completed ) { mtr_error("Test suite aborted"); } @@ -1093,6 +1093,7 @@ sub command_line_setup { 'gdb' => \$opt_gdb, 'client-gdb' => \$opt_client_gdb, 'manual-gdb' => \$opt_manual_gdb, + 'manual-lldb' => \$opt_manual_lldb, 'boot-gdb' => \$opt_boot_gdb, 'manual-debug' => \$opt_manual_debug, 'ddd' => \$opt_ddd, @@ -1549,8 +1550,9 @@ sub command_line_setup { $opt_debugger= undef; } - if ( $opt_gdb || $opt_ddd || $opt_manual_gdb || $opt_manual_ddd || - $opt_manual_debug || $opt_debugger || $opt_dbx || $opt_manual_dbx) + if ( $opt_gdb || $opt_ddd || $opt_manual_gdb || $opt_manual_lldb || + $opt_manual_ddd || $opt_manual_debug || $opt_debugger || $opt_dbx || + $opt_manual_dbx) { mtr_error("You need to use the client debug options for the", "embedded server. Ex: --client-gdb"); @@ -1576,9 +1578,9 @@ sub command_line_setup { # -------------------------------------------------------------------------- # Check debug related options # -------------------------------------------------------------------------- - if ( $opt_gdb || $opt_client_gdb || $opt_ddd || $opt_client_ddd || - $opt_manual_gdb || $opt_manual_ddd || $opt_manual_debug || - $opt_dbx || $opt_client_dbx || $opt_manual_dbx || + if ( $opt_gdb || $opt_client_gdb || $opt_ddd || $opt_client_ddd || + $opt_manual_gdb || $opt_manual_lldb || $opt_manual_ddd || + $opt_manual_debug || $opt_dbx || $opt_client_dbx || $opt_manual_dbx || $opt_debugger || $opt_client_debugger ) { # Indicate that we are using debugger @@ -2473,6 +2475,11 @@ sub environment_setup { "$basedir/tests/bug25714"); $ENV{'MYSQL_BUG25714'}= native_path($exe_bug25714); + # ---------------------------------------------------- + # Get the bin dir + # ---------------------------------------------------- + $ENV{'MYSQL_BIN_PATH'}= native_path($bindir); + # ---------------------------------------------------- # mysql_fix_privilege_tables.sql # ---------------------------------------------------- @@ -2538,6 +2545,14 @@ sub environment_setup { "$path_client_bindir/perror"); $ENV{'MY_PERROR'}= native_path($exe_perror); + # ---------------------------------------------------- + # replace + # ---------------------------------------------------- + my $exe_replace= mtr_exe_exists(vs_config_dirs('extra', 'replace'), + "$basedir/extra/replace", + "$path_client_bindir/replace"); + $ENV{'REPLACE'}= native_path($exe_replace); + # Create an environment variable to make it possible # to detect that valgrind is being used from test cases $ENV{'VALGRIND_TEST'}= $opt_valgrind; @@ -5159,10 +5174,17 @@ sub mysqld_arguments ($$$) { my $found_skip_core= 0; my $found_no_console= 0; + my $found_log_error= 0; foreach my $arg ( @$extra_opts ) { # Skip --defaults-file option since it's handled above. next if $arg =~ /^--defaults-file/; + + + if ($arg eq "--log-error") + { + $found_log_error= 1; + } # Allow --skip-core-file to be set in -[master|slave].opt file if ($arg eq "--skip-core-file") @@ -5193,7 +5215,7 @@ sub mysqld_arguments ($$$) { } } $opt_skip_core = $found_skip_core; - if (IS_WINDOWS && !$found_no_console) + if (IS_WINDOWS && !$found_no_console && !$found_log_error) { # Trick the server to send output to stderr, with --console mtr_add_arg($args, "--console"); @@ -5255,6 +5277,10 @@ sub mysqld_start ($$) { { gdb_arguments(\$args, \$exe, $mysqld->name()); } + elsif ( $opt_manual_lldb ) + { + lldb_arguments(\$args, \$exe, $mysqld->name()); + } elsif ( $opt_ddd || $opt_manual_ddd ) { ddd_arguments(\$args, \$exe, $mysqld->name()); @@ -6014,6 +6040,24 @@ sub start_mysqltest ($) { return $proc; } +sub create_debug_statement { + my $args= shift; + my $input= shift; + + # Put $args into a single string + my $str= join(" ", @$$args); + my $runline= $input ? "run $str < $input" : "run $str"; + + # add quotes to escape ; in plugin_load option + my $pos1 = index($runline, "--plugin_load="); + if ( $pos1 != -1 ) { + my $pos2 = index($runline, " ",$pos1); + substr($runline,$pos1+14,0) = "\""; + substr($runline,$pos2+1,0) = "\""; + } + + return $runline; +} # # Modify the exe and args so that program is run in gdb in xterm @@ -6029,9 +6073,7 @@ sub gdb_arguments { # Remove the old gdbinit file unlink($gdb_init_file); - # Put $args into a single string - my $str= join(" ", @$$args); - my $runline= $input ? "run $str < $input" : "run $str"; + my $runline=create_debug_statement($args,$input); # write init file for mysqld or client mtr_tofile($gdb_init_file, @@ -6067,6 +6109,32 @@ sub gdb_arguments { $$exe= "xterm"; } + # +# Modify the exe and args so that program is run in lldb +# +sub lldb_arguments { + my $args= shift; + my $exe= shift; + my $type= shift; + my $input= shift; + + my $lldb_init_file= "$opt_vardir/tmp/lldbinit.$type"; + unlink($lldb_init_file); + + my $runline=create_debug_statement($args,$input); + + # write init file for mysqld or client + mtr_tofile($lldb_init_file, + "b main\n" . + $runline); + + print "\nTo start lldb for $type, type in another window:\n"; + print "cd $glob_mysql_test_dir && lldb -s $lldb_init_file $$exe\n"; + + # Indicate the exe should not be started + $$exe= undef; + return; +} # # Modify the exe and args so that program is run in ddd @@ -6082,9 +6150,7 @@ sub ddd_arguments { # Remove the old gdbinit file unlink($gdb_init_file); - # Put $args into a single string - my $str= join(" ", @$$args); - my $runline= $input ? "run $str < $input" : "run $str"; + my $runline=create_debug_statement($args,$input); # write init file for mysqld or client mtr_tofile($gdb_init_file, @@ -6545,6 +6611,8 @@ Options for debugging the product test(s) manual-dbx Let user manually start mysqld in dbx, before running test(s) + manual-lldb Let user manually start mysqld in lldb, before running + test(s) strace-client Create strace output for mysqltest client, strace-server Create strace output for mysqltest server, max-save-core Limit the number of core files saved (to avoid filling diff --git a/mysql-wsrep-5.6/mysql-test/purify.supp b/mysql-wsrep-5.6/mysql-test/purify.supp index 230dae20..0bb31d00 100644 --- a/mysql-wsrep-5.6/mysql-test/purify.supp +++ b/mysql-wsrep-5.6/mysql-test/purify.supp @@ -1,4 +1,5 @@ # Copyright (C) 2005, 2007 MySQL AB +# Use is subject to license terms # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public diff --git a/mysql-wsrep-5.6/mysql-test/r/alter_table.result b/mysql-wsrep-5.6/mysql-test/r/alter_table.result index 5c87afdf..fc505a08 100644 --- a/mysql-wsrep-5.6/mysql-test/r/alter_table.result +++ b/mysql-wsrep-5.6/mysql-test/r/alter_table.result @@ -850,6 +850,8 @@ id drop table t1; set @orig_sql_mode = @@sql_mode; set sql_mode="no_zero_date"; +Warnings: +Warning 1681 'NO_ZERO_DATE' is deprecated and will be removed in a future release. create table t1(f1 int); alter table t1 add column f2 datetime not null, add column f21 date not null; insert into t1 values(1,'2000-01-01','2000-01-01'); @@ -1445,24 +1447,6 @@ rename table t2 to t1; execute stmt1; deallocate prepare stmt1; drop table t2; -# -# Bug#11938817 ALTER BEHAVIOR DIFFERENT THEN DOCUMENTED -# -DROP TABLE IF EXISTS t1; -CREATE TABLE t1(a INT) engine=innodb; -INSERT INTO t1 VALUES (1), (2); -# This should not do anything -ALTER TABLE t1; -affected rows: 0 -# Check that we rebuild the table -ALTER TABLE t1 engine=innodb; -affected rows: 2 -info: Records: 2 Duplicates: 0 Warnings: 0 -# This should also rebuild the table -ALTER TABLE t1 FORCE; -affected rows: 2 -info: Records: 2 Duplicates: 0 Warnings: 0 -DROP TABLE t1; # Bug#11748057 (formerly known as 34972): ALTER TABLE statement doesn't # identify correct column name. # @@ -1872,8 +1856,8 @@ ALTER TABLE tm1 DEFAULT CHARACTER SET utf8; affected rows: 2 info: Records: 2 Duplicates: 0 Warnings: 0 ALTER TABLE ti1 FORCE; -affected rows: 2 -info: Records: 2 Duplicates: 0 Warnings: 0 +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 ALTER TABLE tm1 FORCE; affected rows: 2 info: Records: 2 Duplicates: 0 Warnings: 0 diff --git a/mysql-wsrep-5.6/mysql-test/r/bug17076131.result b/mysql-wsrep-5.6/mysql-test/r/bug17076131.result new file mode 100644 index 00000000..3c8aa65b --- /dev/null +++ b/mysql-wsrep-5.6/mysql-test/r/bug17076131.result @@ -0,0 +1,12 @@ +# +# Bug#17076131 MYSQLDUMP FAILS WHEN ERR LOG ON RUNNING SERVER IS +# DELETED ON WINDOWS +# +# Creating file aliases. +# Executing mysqldump normally. +# Removing Error_log file. +# Executing mysqldump after deleting error_log file. +# Checking diff of the 2 dumps. +# No Difference found. +# Clean Up. +# End of Test. diff --git a/mysql-wsrep-5.6/mysql-test/r/check_auto_permission.result b/mysql-wsrep-5.6/mysql-test/r/check_auto_permission.result new file mode 100644 index 00000000..ea34c445 --- /dev/null +++ b/mysql-wsrep-5.6/mysql-test/r/check_auto_permission.result @@ -0,0 +1,3 @@ +CALL mtr.add_suppression("World-writable config file './auto.cnf' is ignored"); +CALL mtr.add_suppression("World-writable config file './auto.cnf' has been removed."); +include/assert.inc [File permissions should be equl to decimal 432(i.e octal 660).] diff --git a/mysql-wsrep-5.6/mysql-test/r/connect.result b/mysql-wsrep-5.6/mysql-test/r/connect.result index 4103119d..06cacfde 100644 --- a/mysql-wsrep-5.6/mysql-test/r/connect.result +++ b/mysql-wsrep-5.6/mysql-test/r/connect.result @@ -81,12 +81,15 @@ SET GLOBAL secure_auth = OFF; Warnings: Warning 1287 'pre-4.1 password hash' is deprecated and will be removed in a future release. Please use post-4.1 password hash instead update mysql.user set password=old_password("gambling2"), plugin="mysql_old_password" where user=_binary"test"; +Warnings: +Warning 1287 'OLD_PASSWORD' is deprecated and will be removed in a future release. Please use PASSWORD instead flush privileges; set password=""; set password='gambling3'; ERROR HY000: Password hash should be a 16-digit hexadecimal number set password=old_password('gambling3'); Warnings: +Warning 1287 'OLD_PASSWORD' is deprecated and will be removed in a future release. Please use PASSWORD instead Warning 1287 'pre-4.1 password hash' is deprecated and will be removed in a future release. Please use post-4.1 password hash instead show tables; Tables_in_mysql @@ -252,10 +255,12 @@ SET old_passwords=1; CREATE USER old_pwd@localhost IDENTIFIED WITH 'mysql_old_password'; SET PASSWORD FOR old_pwd@localhost= OLD_PASSWORD('aha'); Warnings: +Warning 1287 'OLD_PASSWORD' is deprecated and will be removed in a future release. Please use PASSWORD instead Warning 1287 'pre-4.1 password hash' is deprecated and will be removed in a future release. Please use post-4.1 password hash instead #Expect deprecation warning SET PASSWORD FOR old_pwd@localhost = OLD_PASSWORD('aha2'); Warnings: +Warning 1287 'OLD_PASSWORD' is deprecated and will be removed in a future release. Please use PASSWORD instead Warning 1287 'pre-4.1 password hash' is deprecated and will be removed in a future release. Please use post-4.1 password hash instead #Expect deprecation warning GRANT SELECT on test.* TO old_gpwd@localhost @@ -266,6 +271,7 @@ GRANT SELECT on test.* TO old_gpwd@localhost IDENTIFIED WITH 'mysql_old_password'; SET PASSWORD FOR old_gpwd@localhost= OLD_PASSWORD('aha4'); Warnings: +Warning 1287 'OLD_PASSWORD' is deprecated and will be removed in a future release. Please use PASSWORD instead Warning 1287 'pre-4.1 password hash' is deprecated and will be removed in a future release. Please use post-4.1 password hash instead #Expected normal flush, no warnings FLUSH PRIVILEGES; diff --git a/mysql-wsrep-5.6/mysql-test/r/count_distinct.result b/mysql-wsrep-5.6/mysql-test/r/count_distinct.result index 6874e6d8..86cff147 100644 --- a/mysql-wsrep-5.6/mysql-test/r/count_distinct.result +++ b/mysql-wsrep-5.6/mysql-test/r/count_distinct.result @@ -94,3 +94,161 @@ count(distinct i) 2 drop table t1; drop view v1; +# +# Bug#11760197: INCORRECT RESULTS WITH COUNT DISTINCT AND BIG_TABLES +# +CREATE TABLE t1 (a INT PRIMARY KEY); +INSERT INTO t1 VALUES (1),(2); +SET @big_tables_save= @@big_tables; +SET SESSION big_tables=0; +SELECT COUNT(DISTINCT t1.a) FROM t1,t1 t2 WHERE t1.a = 1; +COUNT(DISTINCT t1.a) +1 +SET SESSION big_tables=1; +SELECT COUNT(DISTINCT t1.a) FROM t1,t1 t2 WHERE t1.a = 1; +COUNT(DISTINCT t1.a) +1 +DROP TABLE t1; +CREATE TABLE t1 (a BLOB ,PRIMARY KEY(a(10))); +INSERT INTO t1 VALUES (1),(2); +SET SESSION big_tables=0; +SELECT COUNT(DISTINCT t1.a) FROM t1,t1 t2 WHERE t1.a = 1; +COUNT(DISTINCT t1.a) +1 +SELECT COUNT(DISTINCT t1.a) FROM t1,t1 t2 WHERE t1.a = '1'; +COUNT(DISTINCT t1.a) +1 +SET SESSION big_tables=1; +SELECT COUNT(DISTINCT t1.a) FROM t1,t1 t2 WHERE t1.a = 1; +COUNT(DISTINCT t1.a) +1 +SELECT COUNT(DISTINCT t1.a) FROM t1,t1 t2 WHERE t1.a = '1'; +COUNT(DISTINCT t1.a) +1 +DROP TABLE t1; +CREATE TABLE t1 (a CHAR PRIMARY KEY); +INSERT INTO t1 VALUES (1),(2); +SET SESSION big_tables=0; +SELECT COUNT(DISTINCT t1.a) FROM t1,t1 t2 WHERE t1.a = 1; +COUNT(DISTINCT t1.a) +1 +SELECT COUNT(DISTINCT t1.a) FROM t1,t1 t2 WHERE t1.a = '1'; +COUNT(DISTINCT t1.a) +1 +SET SESSION big_tables=1; +SELECT COUNT(DISTINCT t1.a) FROM t1,t1 t2 WHERE t1.a = 1; +COUNT(DISTINCT t1.a) +1 +SELECT COUNT(DISTINCT t1.a) FROM t1,t1 t2 WHERE t1.a = '1'; +COUNT(DISTINCT t1.a) +1 +SET SESSION big_tables= @big_tables_save; +DROP TABLE t1; +# +# BUG#17607155: ASSERTION FAILED: +# ((ITEM_RESULT_FIELD*)ITEM)->RESULT_FIELD +# +CREATE TABLE t (a INT)ENGINE=INNODB; +INSERT t VALUES(1); +SELECT '' FROM t GROUP BY 1 WITH ROLLUP HAVING GROUP_CONCAT(''); + +DROP TABLE t; +# +# BUG#17957913: ASSERTION `((ITEM_RESULT_FIELD*)ITEM)->RESULT_FIELD' +# FAILS IN CREATE_TMP_FIELD +# +CREATE TABLE t1 ( i INT ); +INSERT INTO t1 VALUES (1),(2); +SELECT GROUP_CONCAT(i,'foo') AS f1 FROM t1 GROUP BY 'a' WITH ROLLUP; +f1 +1foo,2foo +1foo,2foo +DROP TABLE t1; +# +# Bug #17555462: SELECT DISTINCT OF VIEW WITH CONSTANT STRING +# RETURNS WRONG RESULT +# +CREATE TABLE t (x char(3)); +INSERT INTO t VALUES ('foo'), ('bar'); +CREATE VIEW v AS SELECT 'x' AS x FROM t; +SELECT DISTINCT x FROM v; +x +x +DROP TABLE t; +DROP VIEW v; +# +# Bug #17634335 SELECT DISTINCT...GROUP BY RETURNS WRONG +# RESULTS IN SOME CASES +# +CREATE TABLE t1 ( +a int(11) DEFAULT NULL, +b int(11) DEFAULT NULL, +c int(11) DEFAULT NULL +) ENGINE=InnoDB; +INSERT INTO t1 +VALUES (1,1,1),(1,2,1),(1,3,0), +(1,4,0),(2,1,1),(2,2,1),(2,3,0),(2,4,0); +SELECT DISTINCT a, b +FROM (SELECT * FROM t1 ORDER BY a, b) AS f +GROUP BY a,c; +a b +1 3 +1 1 +2 3 +2 1 +SELECT DISTINCT a, b, 0 +FROM (SELECT * FROM t1 ORDER BY a, b) AS f +GROUP BY a,c; +a b 0 +1 3 0 +1 1 0 +2 3 0 +2 1 0 +DROP TABLE t1; +# +# Bug #18853696 WRONG RESULT FOR COUNT DISTINCT OF RESULT +# OF JOINED DERIVED TABLE +# +CREATE TABLE t1 ( +pk INT NOT NULL, +col_varchar_key VARCHAR(1), +col_varchar_nokey VARCHAR(1), +PRIMARY KEY (pk), +KEY col_varchar_key (col_varchar_key) +); +INSERT INTO t1 VALUES (10,'x','x'); +INSERT INTO t1 VALUES (11,'d','d'); +INSERT INTO t1 VALUES (12,'r','r'); +INSERT INTO t1 VALUES (13,'f','f'); +INSERT INTO t1 VALUES (14,'y','y'); +CREATE TABLE t2 ( +pk INT NOT NULL, +col_int_nokey INT, +col_varchar_key VARCHAR(1), +PRIMARY KEY (pk), +KEY col_varchar_key (col_varchar_key) +); +INSERT INTO t2 VALUES (1,7,'x'); +SELECT COUNT( DISTINCT table1.col_varchar_key ) +FROM t2 AS table1 +JOIN (SELECT * FROM t1) AS table2 +ON ( table2.pk = table1.col_int_nokey ) +WHERE table1.pk = 1; +COUNT( DISTINCT table1.col_varchar_key ) +0 +SELECT COUNT( DISTINCT table1.col_varchar_key ) +FROM t2 AS table1 +JOIN t1 AS table2 +ON ( table2.pk = table1.col_int_nokey ) +WHERE table1.pk = 1; +COUNT( DISTINCT table1.col_varchar_key ) +0 +SELECT COUNT( table1.col_varchar_key ) +FROM t2 AS table1 +JOIN (SELECT * FROM t1) AS table2 +ON ( table2.pk = table1.col_int_nokey ) +WHERE table1.pk = 1; +COUNT( table1.col_varchar_key ) +0 +DROP TABLE t1,t2; +# End of test for Bug#18853696 diff --git a/mysql-wsrep-5.6/mysql-test/r/create.result b/mysql-wsrep-5.6/mysql-test/r/create.result index 6f7dd984..daa0d01f 100644 --- a/mysql-wsrep-5.6/mysql-test/r/create.result +++ b/mysql-wsrep-5.6/mysql-test/r/create.result @@ -318,7 +318,7 @@ Level Code Message Note 1050 Table 't1' already exists show status like "Opened_tables"; Variable_name Value -Opened_tables 2 +Opened_tables 1 select * from t1; a b 1 1 @@ -1982,6 +1982,8 @@ DROP TABLE IF EXISTS t3; CREATE TABLE t1(c1 TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, c2 TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00'); SET sql_mode = NO_ZERO_DATE; +Warnings: +Warning 1681 'NO_ZERO_DATE' is deprecated and will be removed in a future release. CREATE TABLE t2(c1 TIMESTAMP, c2 TIMESTAMP DEFAULT 0); Warnings: diff --git a/mysql-wsrep-5.6/mysql-test/r/ctype_binary.result b/mysql-wsrep-5.6/mysql-test/r/ctype_binary.result index 76758efd..4c27cf78 100644 --- a/mysql-wsrep-5.6/mysql-test/r/ctype_binary.result +++ b/mysql-wsrep-5.6/mysql-test/r/ctype_binary.result @@ -494,7 +494,12 @@ drop table t1; select old_password('a'), hex(old_password('a')); old_password('a') hex(old_password('a')) 60671c896665c3fa 36303637316338393636363563336661 +Warnings: +Warning 1287 'OLD_PASSWORD' is deprecated and will be removed in a future release. Please use PASSWORD instead +Warning 1287 'OLD_PASSWORD' is deprecated and will be removed in a future release. Please use PASSWORD instead create table t1 as select old_password('a') as c1; +Warnings: +Warning 1287 'OLD_PASSWORD' is deprecated and will be removed in a future release. Please use PASSWORD instead show create table t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -2578,6 +2583,8 @@ SELECT charset(@x), collation(@x); charset(@x) collation(@x) binary binary SET @x=old_password('a'); +Warnings: +Warning 1287 'OLD_PASSWORD' is deprecated and will be removed in a future release. Please use PASSWORD instead SELECT charset(@x), collation(@x); charset(@x) collation(@x) binary binary diff --git a/mysql-wsrep-5.6/mysql-test/r/ctype_cp1251.result b/mysql-wsrep-5.6/mysql-test/r/ctype_cp1251.result index 97c3f4af..948285b4 100644 --- a/mysql-wsrep-5.6/mysql-test/r/ctype_cp1251.result +++ b/mysql-wsrep-5.6/mysql-test/r/ctype_cp1251.result @@ -886,7 +886,12 @@ drop table t1; select old_password('a'), hex(old_password('a')); old_password('a') hex(old_password('a')) 60671c896665c3fa 36303637316338393636363563336661 +Warnings: +Warning 1287 'OLD_PASSWORD' is deprecated and will be removed in a future release. Please use PASSWORD instead +Warning 1287 'OLD_PASSWORD' is deprecated and will be removed in a future release. Please use PASSWORD instead create table t1 as select old_password('a') as c1; +Warnings: +Warning 1287 'OLD_PASSWORD' is deprecated and will be removed in a future release. Please use PASSWORD instead show create table t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -2970,6 +2975,8 @@ SELECT charset(@x), collation(@x); charset(@x) collation(@x) cp1251 cp1251_general_ci SET @x=old_password('a'); +Warnings: +Warning 1287 'OLD_PASSWORD' is deprecated and will be removed in a future release. Please use PASSWORD instead SELECT charset(@x), collation(@x); charset(@x) collation(@x) cp1251 cp1251_general_ci diff --git a/mysql-wsrep-5.6/mysql-test/r/ctype_cp932.result b/mysql-wsrep-5.6/mysql-test/r/ctype_cp932.result new file mode 100644 index 00000000..4b170ee4 --- /dev/null +++ b/mysql-wsrep-5.6/mysql-test/r/ctype_cp932.result @@ -0,0 +1,35 @@ +# +# Bug #11755818 LIKE DOESN'T MATCH WHEN CP932_BIN/SJIS_BIN COLLATIONS ARE +# USED. +# +SET @old_character_set_client= @@character_set_client; +SET @old_character_set_connection= @@character_set_connection; +SET @old_character_set_results= @@character_set_results; +SET character_set_client= 'utf8'; +SET character_set_connection= 'utf8'; +SET character_set_results= 'utf8'; +CREATE TABLE t1 (a VARCHAR(10) COLLATE cp932_bin); +INSERT INTO t1 VALUES('ï½¶ï½¶'); +SELECT * FROM t1 WHERE a LIKE '%ï½¶'; +a +ï½¶ï½¶ +SELECT * FROM t1 WHERE a LIKE '_ï½¶'; +a +ï½¶ï½¶ +SELECT * FROM t1 WHERE a LIKE '%_ï½¶'; +a +ï½¶ï½¶ +ALTER TABLE t1 MODIFY a VARCHAR(100) COLLATE sjis_bin; +SELECT * FROM t1 WHERE a LIKE '%ï½¶'; +a +ï½¶ï½¶ +SELECT * FROM t1 WHERE a LIKE '_ï½¶'; +a +ï½¶ï½¶ +SELECT * FROM t1 WHERE a LIKE '%_ï½¶'; +a +ï½¶ï½¶ +DROP TABLE t1; +SET @@character_set_client= @old_character_set_client; +SET @@character_set_connection= @old_character_set_connection; +SET @@character_set_results= @old_character_set_results; diff --git a/mysql-wsrep-5.6/mysql-test/r/ctype_latin1.result b/mysql-wsrep-5.6/mysql-test/r/ctype_latin1.result index 52c26226..99426346 100644 --- a/mysql-wsrep-5.6/mysql-test/r/ctype_latin1.result +++ b/mysql-wsrep-5.6/mysql-test/r/ctype_latin1.result @@ -913,7 +913,12 @@ drop table t1; select old_password('a'), hex(old_password('a')); old_password('a') hex(old_password('a')) 60671c896665c3fa 36303637316338393636363563336661 +Warnings: +Warning 1287 'OLD_PASSWORD' is deprecated and will be removed in a future release. Please use PASSWORD instead +Warning 1287 'OLD_PASSWORD' is deprecated and will be removed in a future release. Please use PASSWORD instead create table t1 as select old_password('a') as c1; +Warnings: +Warning 1287 'OLD_PASSWORD' is deprecated and will be removed in a future release. Please use PASSWORD instead show create table t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -2997,6 +3002,8 @@ SELECT charset(@x), collation(@x); charset(@x) collation(@x) latin1 latin1_swedish_ci SET @x=old_password('a'); +Warnings: +Warning 1287 'OLD_PASSWORD' is deprecated and will be removed in a future release. Please use PASSWORD instead SELECT charset(@x), collation(@x); charset(@x) collation(@x) latin1 latin1_swedish_ci diff --git a/mysql-wsrep-5.6/mysql-test/r/ctype_ldml.result b/mysql-wsrep-5.6/mysql-test/r/ctype_ldml.result index 25f25c4f..da2d3290 100644 --- a/mysql-wsrep-5.6/mysql-test/r/ctype_ldml.result +++ b/mysql-wsrep-5.6/mysql-test/r/ctype_ldml.result @@ -819,7 +819,7 @@ ERROR HY000: Unknown collation: 'utf8_5624_2' SHOW WARNINGS; Level Code Message Error 1273 Unknown collation: 'utf8_5624_2' -Warning 1273 Syntax error at '[strength tertiary]' +Warning 1273 Syntax error at '[strength tertiary]' for COLLATION : utf8_5624_2 # # WL#5624, reset before primary ignorable # diff --git a/mysql-wsrep-5.6/mysql-test/r/ctype_uca.result b/mysql-wsrep-5.6/mysql-test/r/ctype_uca.result index 14a48b80..9dbe8809 100644 --- a/mysql-wsrep-5.6/mysql-test/r/ctype_uca.result +++ b/mysql-wsrep-5.6/mysql-test/r/ctype_uca.result @@ -7120,5 +7120,19 @@ F0909080 30D2 𐐀 F09090A8 30D2 𐐨 DROP TABLE t1; # +# Bug #16204175 : COLLATION NAME MISSING FROM LOG MESSAGES +# ABOUT LDML DEFINITION PROBLEMS +# +# Check whether the new collation is loaded after restart +SHOW COLLATION LIKE 'utf8_test'; +Collation Charset Id Default Compiled Sortlen +utf8_test utf8 248 8 +# Create a table with the unknown collation. +CREATE TABLE t1(id INT PRIMARY KEY, c CHAR(1) COLLATE utf8_test); +ERROR HY000: Unknown collation: 'utf8_test' +# Below error is caused as a result of this test. The error message +# contains collation name which is added as a part of the fix. +call mtr.add_suppression("Shift expected at '' for COLLATION : utf8_test"); +# # End of 5.6 tests # diff --git a/mysql-wsrep-5.6/mysql-test/r/ctype_ucs.result b/mysql-wsrep-5.6/mysql-test/r/ctype_ucs.result index d43e8a25..842229b9 100644 --- a/mysql-wsrep-5.6/mysql-test/r/ctype_ucs.result +++ b/mysql-wsrep-5.6/mysql-test/r/ctype_ucs.result @@ -1831,7 +1831,12 @@ drop table t1; select old_password('a'), hex(old_password('a')); old_password('a') hex(old_password('a')) 0705298948d1f92f 0030003700300035003200390038003900340038006400310066003900320066 +Warnings: +Warning 1287 'OLD_PASSWORD' is deprecated and will be removed in a future release. Please use PASSWORD instead +Warning 1287 'OLD_PASSWORD' is deprecated and will be removed in a future release. Please use PASSWORD instead create table t1 as select old_password('a') as c1; +Warnings: +Warning 1287 'OLD_PASSWORD' is deprecated and will be removed in a future release. Please use PASSWORD instead show create table t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -3915,6 +3920,8 @@ SELECT charset(@x), collation(@x); charset(@x) collation(@x) ucs2 ucs2_general_ci SET @x=old_password('a'); +Warnings: +Warning 1287 'OLD_PASSWORD' is deprecated and will be removed in a future release. Please use PASSWORD instead SELECT charset(@x), collation(@x); charset(@x) collation(@x) ucs2 ucs2_general_ci diff --git a/mysql-wsrep-5.6/mysql-test/r/ctype_utf8.result b/mysql-wsrep-5.6/mysql-test/r/ctype_utf8.result index 03edc7be..52e84818 100644 --- a/mysql-wsrep-5.6/mysql-test/r/ctype_utf8.result +++ b/mysql-wsrep-5.6/mysql-test/r/ctype_utf8.result @@ -2740,7 +2740,12 @@ drop table t1; select old_password('a'), hex(old_password('a')); old_password('a') hex(old_password('a')) 60671c896665c3fa 36303637316338393636363563336661 +Warnings: +Warning 1287 'OLD_PASSWORD' is deprecated and will be removed in a future release. Please use PASSWORD instead +Warning 1287 'OLD_PASSWORD' is deprecated and will be removed in a future release. Please use PASSWORD instead create table t1 as select old_password('a') as c1; +Warnings: +Warning 1287 'OLD_PASSWORD' is deprecated and will be removed in a future release. Please use PASSWORD instead show create table t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -4824,6 +4829,8 @@ SELECT charset(@x), collation(@x); charset(@x) collation(@x) utf8 utf8_general_ci SET @x=old_password('a'); +Warnings: +Warning 1287 'OLD_PASSWORD' is deprecated and will be removed in a future release. Please use PASSWORD instead SELECT charset(@x), collation(@x); charset(@x) collation(@x) utf8 utf8_general_ci diff --git a/mysql-wsrep-5.6/mysql-test/r/ddl_i18n_koi8r.result b/mysql-wsrep-5.6/mysql-test/r/ddl_i18n_koi8r.result index 739b79d3..d1253b8e 100644 --- a/mysql-wsrep-5.6/mysql-test/r/ddl_i18n_koi8r.result +++ b/mysql-wsrep-5.6/mysql-test/r/ddl_i18n_koi8r.result @@ -260,7 +260,7 @@ END| SHOW CREATE PROCEDURE p1| Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation -p1 CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`( +p1 NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`( INOUT ÐÁÒÁÍ1 CHAR(10), OUT ÐÁÒÁÍ2 CHAR(10)) BEGIN @@ -281,7 +281,7 @@ END koi8r koi8r_general_ci utf8_unicode_ci SHOW CREATE PROCEDURE p2| Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation -p2 CREATE DEFINER=`root`@`localhost` PROCEDURE `p2`( +p2 NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `p2`( INOUT ÐÁÒÁÍ1 CHAR(10) CHARACTER SET utf8, OUT ÐÁÒÁÍ2 CHAR(10) CHARACTER SET utf8) BEGIN @@ -302,7 +302,7 @@ END koi8r koi8r_general_ci utf8_unicode_ci SHOW CREATE PROCEDURE mysqltest2.p3| Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation -p3 CREATE DEFINER=`root`@`localhost` PROCEDURE `p3`( +p3 NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `p3`( INOUT ÐÁÒÁÍ1 CHAR(10), OUT ÐÁÒÁÍ2 CHAR(10)) BEGIN @@ -323,7 +323,7 @@ END koi8r koi8r_general_ci utf8_unicode_ci SHOW CREATE PROCEDURE mysqltest2.p4| Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation -p4 CREATE DEFINER=`root`@`localhost` PROCEDURE `p4`( +p4 NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `p4`( INOUT ÐÁÒÁÍ1 CHAR(10) CHARACTER SET utf8, OUT ÐÁÒÁÍ2 CHAR(10) CHARACTER SET utf8) BEGIN @@ -376,7 +376,7 @@ COLLATION( ' @@character_set_client AS c8; SET ÐÁÒÁÍ1 = 'a'; SET ÐÁÒÁÍ2 = 'b'; -END NULL NULL SQL NO CONTAINS SQL NULL DEFINER CREATED ALTERED root@localhost koi8r koi8r_general_ci utf8_unicode_ci +END NULL NULL SQL NO CONTAINS SQL NULL DEFINER CREATED ALTERED NO_ENGINE_SUBSTITUTION root@localhost koi8r koi8r_general_ci utf8_unicode_ci SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE routine_name = 'p2'| SPECIFIC_NAME ROUTINE_CATALOG ROUTINE_SCHEMA ROUTINE_NAME ROUTINE_TYPE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_NAME COLLATION_NAME DTD_IDENTIFIER ROUTINE_BODY ROUTINE_DEFINITION EXTERNAL_NAME EXTERNAL_LANGUAGE PARAMETER_STYLE IS_DETERMINISTIC SQL_DATA_ACCESS SQL_PATH SECURITY_TYPE CREATED LAST_ALTERED SQL_MODE ROUTINE_COMMENT DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION @@ -394,7 +394,7 @@ COLLATION( ' @@character_set_client AS c8; SET ÐÁÒÁÍ1 = 'a'; SET ÐÁÒÁÍ2 = 'b'; -END NULL NULL SQL NO CONTAINS SQL NULL DEFINER CREATED ALTERED root@localhost koi8r koi8r_general_ci utf8_unicode_ci +END NULL NULL SQL NO CONTAINS SQL NULL DEFINER CREATED ALTERED NO_ENGINE_SUBSTITUTION root@localhost koi8r koi8r_general_ci utf8_unicode_ci SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE routine_name = 'p3'| SPECIFIC_NAME ROUTINE_CATALOG ROUTINE_SCHEMA ROUTINE_NAME ROUTINE_TYPE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_NAME COLLATION_NAME DTD_IDENTIFIER ROUTINE_BODY ROUTINE_DEFINITION EXTERNAL_NAME EXTERNAL_LANGUAGE PARAMETER_STYLE IS_DETERMINISTIC SQL_DATA_ACCESS SQL_PATH SECURITY_TYPE CREATED LAST_ALTERED SQL_MODE ROUTINE_COMMENT DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION @@ -412,7 +412,7 @@ COLLATION( ' @@character_set_client AS c8; SET ÐÁÒÁÍ1 = 'a'; SET ÐÁÒÁÍ2 = 'b'; -END NULL NULL SQL NO CONTAINS SQL NULL DEFINER CREATED ALTERED root@localhost koi8r koi8r_general_ci utf8_unicode_ci +END NULL NULL SQL NO CONTAINS SQL NULL DEFINER CREATED ALTERED NO_ENGINE_SUBSTITUTION root@localhost koi8r koi8r_general_ci utf8_unicode_ci SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE routine_name = 'p4'| SPECIFIC_NAME ROUTINE_CATALOG ROUTINE_SCHEMA ROUTINE_NAME ROUTINE_TYPE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_NAME COLLATION_NAME DTD_IDENTIFIER ROUTINE_BODY ROUTINE_DEFINITION EXTERNAL_NAME EXTERNAL_LANGUAGE PARAMETER_STYLE IS_DETERMINISTIC SQL_DATA_ACCESS SQL_PATH SECURITY_TYPE CREATED LAST_ALTERED SQL_MODE ROUTINE_COMMENT DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION @@ -430,7 +430,7 @@ COLLATION( ' @@character_set_client AS c8; SET ÐÁÒÁÍ1 = 'a'; SET ÐÁÒÁÍ2 = 'b'; -END NULL NULL SQL NO CONTAINS SQL NULL DEFINER CREATED ALTERED root@localhost koi8r koi8r_general_ci utf8_unicode_ci +END NULL NULL SQL NO CONTAINS SQL NULL DEFINER CREATED ALTERED NO_ENGINE_SUBSTITUTION root@localhost koi8r koi8r_general_ci utf8_unicode_ci SET @a = '1'| @@ -506,7 +506,7 @@ set names koi8r| SHOW CREATE PROCEDURE p1| Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation -p1 CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`( +p1 NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`( INOUT ÐÁÒÁÍ1 CHAR(10), OUT ÐÁÒÁÍ2 CHAR(10)) BEGIN @@ -527,7 +527,7 @@ END koi8r koi8r_general_ci utf8_unicode_ci SHOW CREATE PROCEDURE p2| Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation -p2 CREATE DEFINER=`root`@`localhost` PROCEDURE `p2`( +p2 NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `p2`( INOUT ÐÁÒÁÍ1 CHAR(10) CHARACTER SET utf8, OUT ÐÁÒÁÍ2 CHAR(10) CHARACTER SET utf8) BEGIN @@ -548,7 +548,7 @@ END koi8r koi8r_general_ci utf8_unicode_ci SHOW CREATE PROCEDURE mysqltest2.p3| Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation -p3 CREATE DEFINER=`root`@`localhost` PROCEDURE `p3`( +p3 NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `p3`( INOUT ÐÁÒÁÍ1 CHAR(10), OUT ÐÁÒÁÍ2 CHAR(10)) BEGIN @@ -569,7 +569,7 @@ END koi8r koi8r_general_ci utf8_unicode_ci SHOW CREATE PROCEDURE mysqltest2.p4| Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation -p4 CREATE DEFINER=`root`@`localhost` PROCEDURE `p4`( +p4 NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `p4`( INOUT ÐÁÒÁÍ1 CHAR(10) CHARACTER SET utf8, OUT ÐÁÒÁÍ2 CHAR(10) CHARACTER SET utf8) BEGIN @@ -622,7 +622,7 @@ COLLATION( ' @@character_set_client AS c8; SET ÐÁÒÁÍ1 = 'a'; SET ÐÁÒÁÍ2 = 'b'; -END NULL NULL SQL NO CONTAINS SQL NULL DEFINER CREATED ALTERED root@localhost koi8r koi8r_general_ci utf8_unicode_ci +END NULL NULL SQL NO CONTAINS SQL NULL DEFINER CREATED ALTERED NO_ENGINE_SUBSTITUTION root@localhost koi8r koi8r_general_ci utf8_unicode_ci SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE routine_name = 'p2'| SPECIFIC_NAME ROUTINE_CATALOG ROUTINE_SCHEMA ROUTINE_NAME ROUTINE_TYPE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_NAME COLLATION_NAME DTD_IDENTIFIER ROUTINE_BODY ROUTINE_DEFINITION EXTERNAL_NAME EXTERNAL_LANGUAGE PARAMETER_STYLE IS_DETERMINISTIC SQL_DATA_ACCESS SQL_PATH SECURITY_TYPE CREATED LAST_ALTERED SQL_MODE ROUTINE_COMMENT DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION @@ -640,7 +640,7 @@ COLLATION( ' @@character_set_client AS c8; SET ÐÁÒÁÍ1 = 'a'; SET ÐÁÒÁÍ2 = 'b'; -END NULL NULL SQL NO CONTAINS SQL NULL DEFINER CREATED ALTERED root@localhost koi8r koi8r_general_ci utf8_unicode_ci +END NULL NULL SQL NO CONTAINS SQL NULL DEFINER CREATED ALTERED NO_ENGINE_SUBSTITUTION root@localhost koi8r koi8r_general_ci utf8_unicode_ci SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE routine_name = 'p3'| SPECIFIC_NAME ROUTINE_CATALOG ROUTINE_SCHEMA ROUTINE_NAME ROUTINE_TYPE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_NAME COLLATION_NAME DTD_IDENTIFIER ROUTINE_BODY ROUTINE_DEFINITION EXTERNAL_NAME EXTERNAL_LANGUAGE PARAMETER_STYLE IS_DETERMINISTIC SQL_DATA_ACCESS SQL_PATH SECURITY_TYPE CREATED LAST_ALTERED SQL_MODE ROUTINE_COMMENT DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION @@ -658,7 +658,7 @@ COLLATION( ' @@character_set_client AS c8; SET ÐÁÒÁÍ1 = 'a'; SET ÐÁÒÁÍ2 = 'b'; -END NULL NULL SQL NO CONTAINS SQL NULL DEFINER CREATED ALTERED root@localhost koi8r koi8r_general_ci utf8_unicode_ci +END NULL NULL SQL NO CONTAINS SQL NULL DEFINER CREATED ALTERED NO_ENGINE_SUBSTITUTION root@localhost koi8r koi8r_general_ci utf8_unicode_ci SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE routine_name = 'p4'| SPECIFIC_NAME ROUTINE_CATALOG ROUTINE_SCHEMA ROUTINE_NAME ROUTINE_TYPE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_NAME COLLATION_NAME DTD_IDENTIFIER ROUTINE_BODY ROUTINE_DEFINITION EXTERNAL_NAME EXTERNAL_LANGUAGE PARAMETER_STYLE IS_DETERMINISTIC SQL_DATA_ACCESS SQL_PATH SECURITY_TYPE CREATED LAST_ALTERED SQL_MODE ROUTINE_COMMENT DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION @@ -676,7 +676,7 @@ COLLATION( ' @@character_set_client AS c8; SET ÐÁÒÁÍ1 = 'a'; SET ÐÁÒÁÍ2 = 'b'; -END NULL NULL SQL NO CONTAINS SQL NULL DEFINER CREATED ALTERED root@localhost koi8r koi8r_general_ci utf8_unicode_ci +END NULL NULL SQL NO CONTAINS SQL NULL DEFINER CREATED ALTERED NO_ENGINE_SUBSTITUTION root@localhost koi8r koi8r_general_ci utf8_unicode_ci SET @a = '1'| @@ -732,7 +732,7 @@ ALTER DATABASE `mysqltest1` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; /*!50003 SET character_set_results = koi8r */ ; /*!50003 SET collation_connection = koi8r_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = '' */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`( INOUT ÐÁÒÁÍ1 CHAR(10), @@ -766,7 +766,7 @@ ALTER DATABASE `mysqltest1` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; /*!50003 SET character_set_results = koi8r */ ; /*!50003 SET collation_connection = koi8r_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = '' */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `p2`( INOUT ÐÁÒÁÍ1 CHAR(10) CHARACTER SET utf8, @@ -808,7 +808,7 @@ ALTER DATABASE `mysqltest2` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; /*!50003 SET character_set_results = koi8r */ ; /*!50003 SET collation_connection = koi8r_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = '' */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `p3`( INOUT ÐÁÒÁÍ1 CHAR(10), @@ -842,7 +842,7 @@ ALTER DATABASE `mysqltest2` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; /*!50003 SET character_set_results = koi8r */ ; /*!50003 SET collation_connection = koi8r_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = '' */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `p4`( INOUT ÐÁÒÁÍ1 CHAR(10) CHARACTER SET utf8, @@ -908,7 +908,7 @@ set names koi8r| SHOW CREATE PROCEDURE p1| Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation -p1 CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`( +p1 NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`( INOUT ÐÁÒÁÍ1 CHAR(10), OUT ÐÁÒÁÍ2 CHAR(10)) BEGIN @@ -929,7 +929,7 @@ END koi8r koi8r_general_ci utf8_unicode_ci SHOW CREATE PROCEDURE p2| Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation -p2 CREATE DEFINER=`root`@`localhost` PROCEDURE `p2`( +p2 NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `p2`( INOUT ÐÁÒÁÍ1 CHAR(10) CHARACTER SET utf8, OUT ÐÁÒÁÍ2 CHAR(10) CHARACTER SET utf8) BEGIN @@ -950,7 +950,7 @@ END koi8r koi8r_general_ci utf8_unicode_ci SHOW CREATE PROCEDURE mysqltest2.p3| Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation -p3 CREATE DEFINER=`root`@`localhost` PROCEDURE `p3`( +p3 NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `p3`( INOUT ÐÁÒÁÍ1 CHAR(10), OUT ÐÁÒÁÍ2 CHAR(10)) BEGIN @@ -971,7 +971,7 @@ END koi8r koi8r_general_ci utf8_unicode_ci SHOW CREATE PROCEDURE mysqltest2.p4| Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation -p4 CREATE DEFINER=`root`@`localhost` PROCEDURE `p4`( +p4 NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `p4`( INOUT ÐÁÒÁÍ1 CHAR(10) CHARACTER SET utf8, OUT ÐÁÒÁÍ2 CHAR(10) CHARACTER SET utf8) BEGIN @@ -1024,7 +1024,7 @@ COLLATION( ' @@character_set_client AS c8; SET ÐÁÒÁÍ1 = 'a'; SET ÐÁÒÁÍ2 = 'b'; -END NULL NULL SQL NO CONTAINS SQL NULL DEFINER CREATED ALTERED root@localhost koi8r koi8r_general_ci utf8_unicode_ci +END NULL NULL SQL NO CONTAINS SQL NULL DEFINER CREATED ALTERED NO_ENGINE_SUBSTITUTION root@localhost koi8r koi8r_general_ci utf8_unicode_ci SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE routine_name = 'p2'| SPECIFIC_NAME ROUTINE_CATALOG ROUTINE_SCHEMA ROUTINE_NAME ROUTINE_TYPE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_NAME COLLATION_NAME DTD_IDENTIFIER ROUTINE_BODY ROUTINE_DEFINITION EXTERNAL_NAME EXTERNAL_LANGUAGE PARAMETER_STYLE IS_DETERMINISTIC SQL_DATA_ACCESS SQL_PATH SECURITY_TYPE CREATED LAST_ALTERED SQL_MODE ROUTINE_COMMENT DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION @@ -1042,7 +1042,7 @@ COLLATION( ' @@character_set_client AS c8; SET ÐÁÒÁÍ1 = 'a'; SET ÐÁÒÁÍ2 = 'b'; -END NULL NULL SQL NO CONTAINS SQL NULL DEFINER CREATED ALTERED root@localhost koi8r koi8r_general_ci utf8_unicode_ci +END NULL NULL SQL NO CONTAINS SQL NULL DEFINER CREATED ALTERED NO_ENGINE_SUBSTITUTION root@localhost koi8r koi8r_general_ci utf8_unicode_ci SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE routine_name = 'p3'| SPECIFIC_NAME ROUTINE_CATALOG ROUTINE_SCHEMA ROUTINE_NAME ROUTINE_TYPE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_NAME COLLATION_NAME DTD_IDENTIFIER ROUTINE_BODY ROUTINE_DEFINITION EXTERNAL_NAME EXTERNAL_LANGUAGE PARAMETER_STYLE IS_DETERMINISTIC SQL_DATA_ACCESS SQL_PATH SECURITY_TYPE CREATED LAST_ALTERED SQL_MODE ROUTINE_COMMENT DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION @@ -1060,7 +1060,7 @@ COLLATION( ' @@character_set_client AS c8; SET ÐÁÒÁÍ1 = 'a'; SET ÐÁÒÁÍ2 = 'b'; -END NULL NULL SQL NO CONTAINS SQL NULL DEFINER CREATED ALTERED root@localhost koi8r koi8r_general_ci utf8_unicode_ci +END NULL NULL SQL NO CONTAINS SQL NULL DEFINER CREATED ALTERED NO_ENGINE_SUBSTITUTION root@localhost koi8r koi8r_general_ci utf8_unicode_ci SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE routine_name = 'p4'| SPECIFIC_NAME ROUTINE_CATALOG ROUTINE_SCHEMA ROUTINE_NAME ROUTINE_TYPE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_NAME COLLATION_NAME DTD_IDENTIFIER ROUTINE_BODY ROUTINE_DEFINITION EXTERNAL_NAME EXTERNAL_LANGUAGE PARAMETER_STYLE IS_DETERMINISTIC SQL_DATA_ACCESS SQL_PATH SECURITY_TYPE CREATED LAST_ALTERED SQL_MODE ROUTINE_COMMENT DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION @@ -1078,7 +1078,7 @@ COLLATION( ' @@character_set_client AS c8; SET ÐÁÒÁÍ1 = 'a'; SET ÐÁÒÁÍ2 = 'b'; -END NULL NULL SQL NO CONTAINS SQL NULL DEFINER CREATED ALTERED root@localhost koi8r koi8r_general_ci utf8_unicode_ci +END NULL NULL SQL NO CONTAINS SQL NULL DEFINER CREATED ALTERED NO_ENGINE_SUBSTITUTION root@localhost koi8r koi8r_general_ci utf8_unicode_ci SET @a = '1'| @@ -1200,7 +1200,7 @@ END| SHOW CREATE TRIGGER trg1| Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation -trg1 CREATE DEFINER=`root`@`localhost` TRIGGER trg1 BEFORE INSERT ON t1 FOR EACH ROW +trg1 NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER trg1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN DECLARE ÐÅÒÅÍ1 CHAR(10); INSERT INTO log VALUES(COLLATION(ÐÅÒÅÍ1)); @@ -1216,7 +1216,7 @@ END koi8r koi8r_general_ci utf8_unicode_ci SHOW CREATE TRIGGER trg2| Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation -trg2 CREATE DEFINER=`root`@`localhost` TRIGGER trg2 AFTER INSERT ON t1 FOR EACH ROW +trg2 NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER trg2 AFTER INSERT ON t1 FOR EACH ROW BEGIN DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; INSERT INTO log VALUES(COLLATION(ÐÅÒÅÍ1)); @@ -1232,7 +1232,7 @@ END koi8r koi8r_general_ci utf8_unicode_ci SHOW CREATE TRIGGER mysqltest2.trg3| Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation -trg3 CREATE DEFINER=`root`@`localhost` TRIGGER mysqltest2.trg3 BEFORE INSERT ON mysqltest2.t1 FOR EACH ROW +trg3 NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER mysqltest2.trg3 BEFORE INSERT ON mysqltest2.t1 FOR EACH ROW BEGIN DECLARE ÐÅÒÅÍ1 CHAR(10); INSERT INTO log VALUES(COLLATION(ÐÅÒÅÍ1)); @@ -1248,7 +1248,7 @@ END koi8r koi8r_general_ci utf8_unicode_ci SHOW CREATE TRIGGER mysqltest2.trg4| Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation -trg4 CREATE DEFINER=`root`@`localhost` TRIGGER mysqltest2.trg4 AFTER INSERT ON mysqltest2.t1 FOR EACH ROW +trg4 NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER mysqltest2.trg4 AFTER INSERT ON mysqltest2.t1 FOR EACH ROW BEGIN DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; INSERT INTO log VALUES(COLLATION(ÐÅÒÅÍ1)); @@ -1276,7 +1276,7 @@ INSERT INTO log VALUES(@@character_set_client); SET @a1 = 'ÔÅËÓÔ'; SET @a1 = 'ÔÅËÓÔ'; SET @a2 = 'ÔÅËÓÔ'; -END BEFORE NULL root@localhost koi8r koi8r_general_ci utf8_unicode_ci +END BEFORE NULL NO_ENGINE_SUBSTITUTION root@localhost koi8r koi8r_general_ci utf8_unicode_ci trg2 INSERT t1 BEGIN DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; INSERT INTO log VALUES(COLLATION(ÐÅÒÅÍ1)); @@ -1288,7 +1288,7 @@ INSERT INTO log VALUES(@@character_set_client); SET @b1 = 'ÔÅËÓÔ'; SET @b1 = 'ÔÅËÓÔ'; SET @b2 = 'ÔÅËÓÔ'; -END AFTER NULL root@localhost koi8r koi8r_general_ci utf8_unicode_ci +END AFTER NULL NO_ENGINE_SUBSTITUTION root@localhost koi8r koi8r_general_ci utf8_unicode_ci use mysqltest2| @@ -1305,7 +1305,7 @@ INSERT INTO log VALUES(@@character_set_client); SET @a1 = 'ÔÅËÓÔ'; SET @a1 = 'ÔÅËÓÔ'; SET @a2 = 'ÔÅËÓÔ'; -END BEFORE NULL root@localhost koi8r koi8r_general_ci utf8_unicode_ci +END BEFORE NULL NO_ENGINE_SUBSTITUTION root@localhost koi8r koi8r_general_ci utf8_unicode_ci trg4 INSERT t1 BEGIN DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; INSERT INTO log VALUES(COLLATION(ÐÅÒÅÍ1)); @@ -1317,7 +1317,7 @@ INSERT INTO log VALUES(@@character_set_client); SET @b1 = 'ÔÅËÓÔ'; SET @b1 = 'ÔÅËÓÔ'; SET @b2 = 'ÔÅËÓÔ'; -END AFTER NULL root@localhost koi8r koi8r_general_ci utf8_unicode_ci +END AFTER NULL NO_ENGINE_SUBSTITUTION root@localhost koi8r koi8r_general_ci utf8_unicode_ci use mysqltest1| @@ -1334,7 +1334,7 @@ INSERT INTO log VALUES(@@character_set_client); SET @a1 = 'ÔÅËÓÔ'; SET @a1 = 'ÔÅËÓÔ'; SET @a2 = 'ÔÅËÓÔ'; -END ROW BEFORE NULL NULL OLD NEW CREATED root@localhost koi8r koi8r_general_ci utf8_unicode_ci +END ROW BEFORE NULL NULL OLD NEW CREATED NO_ENGINE_SUBSTITUTION root@localhost koi8r koi8r_general_ci utf8_unicode_ci SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg2'| TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION @@ -1349,7 +1349,7 @@ INSERT INTO log VALUES(@@character_set_client); SET @b1 = 'ÔÅËÓÔ'; SET @b1 = 'ÔÅËÓÔ'; SET @b2 = 'ÔÅËÓÔ'; -END ROW AFTER NULL NULL OLD NEW CREATED root@localhost koi8r koi8r_general_ci utf8_unicode_ci +END ROW AFTER NULL NULL OLD NEW CREATED NO_ENGINE_SUBSTITUTION root@localhost koi8r koi8r_general_ci utf8_unicode_ci SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg3'| TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION @@ -1364,7 +1364,7 @@ INSERT INTO log VALUES(@@character_set_client); SET @a1 = 'ÔÅËÓÔ'; SET @a1 = 'ÔÅËÓÔ'; SET @a2 = 'ÔÅËÓÔ'; -END ROW BEFORE NULL NULL OLD NEW CREATED root@localhost koi8r koi8r_general_ci utf8_unicode_ci +END ROW BEFORE NULL NULL OLD NEW CREATED NO_ENGINE_SUBSTITUTION root@localhost koi8r koi8r_general_ci utf8_unicode_ci SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg4'| TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION @@ -1379,7 +1379,7 @@ INSERT INTO log VALUES(@@character_set_client); SET @b1 = 'ÔÅËÓÔ'; SET @b1 = 'ÔÅËÓÔ'; SET @b2 = 'ÔÅËÓÔ'; -END ROW AFTER NULL NULL OLD NEW CREATED root@localhost koi8r koi8r_general_ci utf8_unicode_ci +END ROW AFTER NULL NULL OLD NEW CREATED NO_ENGINE_SUBSTITUTION root@localhost koi8r koi8r_general_ci utf8_unicode_ci SET @a1 = '1'| @@ -1473,7 +1473,7 @@ use mysqltest1| SHOW CREATE TRIGGER trg1| Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation -trg1 CREATE DEFINER=`root`@`localhost` TRIGGER trg1 BEFORE INSERT ON t1 FOR EACH ROW +trg1 NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER trg1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN DECLARE ÐÅÒÅÍ1 CHAR(10); INSERT INTO log VALUES(COLLATION(ÐÅÒÅÍ1)); @@ -1489,7 +1489,7 @@ END koi8r koi8r_general_ci utf8_unicode_ci SHOW CREATE TRIGGER trg2| Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation -trg2 CREATE DEFINER=`root`@`localhost` TRIGGER trg2 AFTER INSERT ON t1 FOR EACH ROW +trg2 NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER trg2 AFTER INSERT ON t1 FOR EACH ROW BEGIN DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; INSERT INTO log VALUES(COLLATION(ÐÅÒÅÍ1)); @@ -1505,7 +1505,7 @@ END koi8r koi8r_general_ci utf8_unicode_ci SHOW CREATE TRIGGER mysqltest2.trg3| Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation -trg3 CREATE DEFINER=`root`@`localhost` TRIGGER mysqltest2.trg3 BEFORE INSERT ON mysqltest2.t1 FOR EACH ROW +trg3 NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER mysqltest2.trg3 BEFORE INSERT ON mysqltest2.t1 FOR EACH ROW BEGIN DECLARE ÐÅÒÅÍ1 CHAR(10); INSERT INTO log VALUES(COLLATION(ÐÅÒÅÍ1)); @@ -1521,7 +1521,7 @@ END koi8r koi8r_general_ci utf8_unicode_ci SHOW CREATE TRIGGER mysqltest2.trg4| Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation -trg4 CREATE DEFINER=`root`@`localhost` TRIGGER mysqltest2.trg4 AFTER INSERT ON mysqltest2.t1 FOR EACH ROW +trg4 NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER mysqltest2.trg4 AFTER INSERT ON mysqltest2.t1 FOR EACH ROW BEGIN DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; INSERT INTO log VALUES(COLLATION(ÐÅÒÅÍ1)); @@ -1549,7 +1549,7 @@ INSERT INTO log VALUES(@@character_set_client); SET @a1 = 'ÔÅËÓÔ'; SET @a1 = 'ÔÅËÓÔ'; SET @a2 = 'ÔÅËÓÔ'; -END BEFORE NULL root@localhost koi8r koi8r_general_ci utf8_unicode_ci +END BEFORE NULL NO_ENGINE_SUBSTITUTION root@localhost koi8r koi8r_general_ci utf8_unicode_ci trg2 INSERT t1 BEGIN DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; INSERT INTO log VALUES(COLLATION(ÐÅÒÅÍ1)); @@ -1561,7 +1561,7 @@ INSERT INTO log VALUES(@@character_set_client); SET @b1 = 'ÔÅËÓÔ'; SET @b1 = 'ÔÅËÓÔ'; SET @b2 = 'ÔÅËÓÔ'; -END AFTER NULL root@localhost koi8r koi8r_general_ci utf8_unicode_ci +END AFTER NULL NO_ENGINE_SUBSTITUTION root@localhost koi8r koi8r_general_ci utf8_unicode_ci use mysqltest2| @@ -1578,7 +1578,7 @@ INSERT INTO log VALUES(@@character_set_client); SET @a1 = 'ÔÅËÓÔ'; SET @a1 = 'ÔÅËÓÔ'; SET @a2 = 'ÔÅËÓÔ'; -END BEFORE NULL root@localhost koi8r koi8r_general_ci utf8_unicode_ci +END BEFORE NULL NO_ENGINE_SUBSTITUTION root@localhost koi8r koi8r_general_ci utf8_unicode_ci trg4 INSERT t1 BEGIN DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; INSERT INTO log VALUES(COLLATION(ÐÅÒÅÍ1)); @@ -1590,7 +1590,7 @@ INSERT INTO log VALUES(@@character_set_client); SET @b1 = 'ÔÅËÓÔ'; SET @b1 = 'ÔÅËÓÔ'; SET @b2 = 'ÔÅËÓÔ'; -END AFTER NULL root@localhost koi8r koi8r_general_ci utf8_unicode_ci +END AFTER NULL NO_ENGINE_SUBSTITUTION root@localhost koi8r koi8r_general_ci utf8_unicode_ci use mysqltest1| @@ -1607,7 +1607,7 @@ INSERT INTO log VALUES(@@character_set_client); SET @a1 = 'ÔÅËÓÔ'; SET @a1 = 'ÔÅËÓÔ'; SET @a2 = 'ÔÅËÓÔ'; -END ROW BEFORE NULL NULL OLD NEW CREATED root@localhost koi8r koi8r_general_ci utf8_unicode_ci +END ROW BEFORE NULL NULL OLD NEW CREATED NO_ENGINE_SUBSTITUTION root@localhost koi8r koi8r_general_ci utf8_unicode_ci SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg2'| TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION @@ -1622,7 +1622,7 @@ INSERT INTO log VALUES(@@character_set_client); SET @b1 = 'ÔÅËÓÔ'; SET @b1 = 'ÔÅËÓÔ'; SET @b2 = 'ÔÅËÓÔ'; -END ROW AFTER NULL NULL OLD NEW CREATED root@localhost koi8r koi8r_general_ci utf8_unicode_ci +END ROW AFTER NULL NULL OLD NEW CREATED NO_ENGINE_SUBSTITUTION root@localhost koi8r koi8r_general_ci utf8_unicode_ci SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg3'| TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION @@ -1637,7 +1637,7 @@ INSERT INTO log VALUES(@@character_set_client); SET @a1 = 'ÔÅËÓÔ'; SET @a1 = 'ÔÅËÓÔ'; SET @a2 = 'ÔÅËÓÔ'; -END ROW BEFORE NULL NULL OLD NEW CREATED root@localhost koi8r koi8r_general_ci utf8_unicode_ci +END ROW BEFORE NULL NULL OLD NEW CREATED NO_ENGINE_SUBSTITUTION root@localhost koi8r koi8r_general_ci utf8_unicode_ci SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg4'| TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION @@ -1652,7 +1652,7 @@ INSERT INTO log VALUES(@@character_set_client); SET @b1 = 'ÔÅËÓÔ'; SET @b1 = 'ÔÅËÓÔ'; SET @b2 = 'ÔÅËÓÔ'; -END ROW AFTER NULL NULL OLD NEW CREATED root@localhost koi8r koi8r_general_ci utf8_unicode_ci +END ROW AFTER NULL NULL OLD NEW CREATED NO_ENGINE_SUBSTITUTION root@localhost koi8r koi8r_general_ci utf8_unicode_ci SET @a1 = '1'| @@ -1750,7 +1750,7 @@ ALTER DATABASE `mysqltest1` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; /*!50003 SET character_set_results = koi8r */ ; /*!50003 SET collation_connection = koi8r_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = '' */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER trg1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN @@ -1779,7 +1779,7 @@ ALTER DATABASE `mysqltest1` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; /*!50003 SET character_set_results = koi8r */ ; /*!50003 SET collation_connection = koi8r_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = '' */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER trg2 AFTER INSERT ON t1 FOR EACH ROW BEGIN @@ -1829,7 +1829,7 @@ ALTER DATABASE `mysqltest2` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; /*!50003 SET character_set_results = koi8r */ ; /*!50003 SET collation_connection = koi8r_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = '' */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER mysqltest2.trg3 BEFORE INSERT ON mysqltest2.t1 FOR EACH ROW BEGIN @@ -1858,7 +1858,7 @@ ALTER DATABASE `mysqltest2` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; /*!50003 SET character_set_results = koi8r */ ; /*!50003 SET collation_connection = koi8r_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = '' */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER mysqltest2.trg4 AFTER INSERT ON mysqltest2.t1 FOR EACH ROW BEGIN @@ -1908,7 +1908,7 @@ use mysqltest1| SHOW CREATE TRIGGER trg1| Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation -trg1 CREATE DEFINER=`root`@`localhost` TRIGGER trg1 BEFORE INSERT ON t1 FOR EACH ROW +trg1 NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER trg1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN DECLARE ÐÅÒÅÍ1 CHAR(10); INSERT INTO log VALUES(COLLATION(ÐÅÒÅÍ1)); @@ -1924,7 +1924,7 @@ END koi8r koi8r_general_ci utf8_unicode_ci SHOW CREATE TRIGGER trg2| Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation -trg2 CREATE DEFINER=`root`@`localhost` TRIGGER trg2 AFTER INSERT ON t1 FOR EACH ROW +trg2 NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER trg2 AFTER INSERT ON t1 FOR EACH ROW BEGIN DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; INSERT INTO log VALUES(COLLATION(ÐÅÒÅÍ1)); @@ -1940,7 +1940,7 @@ END koi8r koi8r_general_ci utf8_unicode_ci SHOW CREATE TRIGGER mysqltest2.trg3| Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation -trg3 CREATE DEFINER=`root`@`localhost` TRIGGER mysqltest2.trg3 BEFORE INSERT ON mysqltest2.t1 FOR EACH ROW +trg3 NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER mysqltest2.trg3 BEFORE INSERT ON mysqltest2.t1 FOR EACH ROW BEGIN DECLARE ÐÅÒÅÍ1 CHAR(10); INSERT INTO log VALUES(COLLATION(ÐÅÒÅÍ1)); @@ -1956,7 +1956,7 @@ END koi8r koi8r_general_ci utf8_unicode_ci SHOW CREATE TRIGGER mysqltest2.trg4| Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation -trg4 CREATE DEFINER=`root`@`localhost` TRIGGER mysqltest2.trg4 AFTER INSERT ON mysqltest2.t1 FOR EACH ROW +trg4 NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER mysqltest2.trg4 AFTER INSERT ON mysqltest2.t1 FOR EACH ROW BEGIN DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; INSERT INTO log VALUES(COLLATION(ÐÅÒÅÍ1)); @@ -1984,7 +1984,7 @@ INSERT INTO log VALUES(@@character_set_client); SET @a1 = 'ÔÅËÓÔ'; SET @a1 = 'ÔÅËÓÔ'; SET @a2 = 'ÔÅËÓÔ'; -END BEFORE NULL root@localhost koi8r koi8r_general_ci utf8_unicode_ci +END BEFORE NULL NO_ENGINE_SUBSTITUTION root@localhost koi8r koi8r_general_ci utf8_unicode_ci trg2 INSERT t1 BEGIN DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; INSERT INTO log VALUES(COLLATION(ÐÅÒÅÍ1)); @@ -1996,7 +1996,7 @@ INSERT INTO log VALUES(@@character_set_client); SET @b1 = 'ÔÅËÓÔ'; SET @b1 = 'ÔÅËÓÔ'; SET @b2 = 'ÔÅËÓÔ'; -END AFTER NULL root@localhost koi8r koi8r_general_ci utf8_unicode_ci +END AFTER NULL NO_ENGINE_SUBSTITUTION root@localhost koi8r koi8r_general_ci utf8_unicode_ci use mysqltest2| @@ -2013,7 +2013,7 @@ INSERT INTO log VALUES(@@character_set_client); SET @a1 = 'ÔÅËÓÔ'; SET @a1 = 'ÔÅËÓÔ'; SET @a2 = 'ÔÅËÓÔ'; -END BEFORE NULL root@localhost koi8r koi8r_general_ci utf8_unicode_ci +END BEFORE NULL NO_ENGINE_SUBSTITUTION root@localhost koi8r koi8r_general_ci utf8_unicode_ci trg4 INSERT t1 BEGIN DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; INSERT INTO log VALUES(COLLATION(ÐÅÒÅÍ1)); @@ -2025,7 +2025,7 @@ INSERT INTO log VALUES(@@character_set_client); SET @b1 = 'ÔÅËÓÔ'; SET @b1 = 'ÔÅËÓÔ'; SET @b2 = 'ÔÅËÓÔ'; -END AFTER NULL root@localhost koi8r koi8r_general_ci utf8_unicode_ci +END AFTER NULL NO_ENGINE_SUBSTITUTION root@localhost koi8r koi8r_general_ci utf8_unicode_ci use mysqltest1| @@ -2042,7 +2042,7 @@ INSERT INTO log VALUES(@@character_set_client); SET @a1 = 'ÔÅËÓÔ'; SET @a1 = 'ÔÅËÓÔ'; SET @a2 = 'ÔÅËÓÔ'; -END ROW BEFORE NULL NULL OLD NEW CREATED root@localhost koi8r koi8r_general_ci utf8_unicode_ci +END ROW BEFORE NULL NULL OLD NEW CREATED NO_ENGINE_SUBSTITUTION root@localhost koi8r koi8r_general_ci utf8_unicode_ci SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg2'| TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION @@ -2057,7 +2057,7 @@ INSERT INTO log VALUES(@@character_set_client); SET @b1 = 'ÔÅËÓÔ'; SET @b1 = 'ÔÅËÓÔ'; SET @b2 = 'ÔÅËÓÔ'; -END ROW AFTER NULL NULL OLD NEW CREATED root@localhost koi8r koi8r_general_ci utf8_unicode_ci +END ROW AFTER NULL NULL OLD NEW CREATED NO_ENGINE_SUBSTITUTION root@localhost koi8r koi8r_general_ci utf8_unicode_ci SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg3'| TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION @@ -2072,7 +2072,7 @@ INSERT INTO log VALUES(@@character_set_client); SET @a1 = 'ÔÅËÓÔ'; SET @a1 = 'ÔÅËÓÔ'; SET @a2 = 'ÔÅËÓÔ'; -END ROW BEFORE NULL NULL OLD NEW CREATED root@localhost koi8r koi8r_general_ci utf8_unicode_ci +END ROW BEFORE NULL NULL OLD NEW CREATED NO_ENGINE_SUBSTITUTION root@localhost koi8r koi8r_general_ci utf8_unicode_ci SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg4'| TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION @@ -2087,7 +2087,7 @@ INSERT INTO log VALUES(@@character_set_client); SET @b1 = 'ÔÅËÓÔ'; SET @b1 = 'ÔÅËÓÔ'; SET @b2 = 'ÔÅËÓÔ'; -END ROW AFTER NULL NULL OLD NEW CREATED root@localhost koi8r koi8r_general_ci utf8_unicode_ci +END ROW AFTER NULL NULL OLD NEW CREATED NO_ENGINE_SUBSTITUTION root@localhost koi8r koi8r_general_ci utf8_unicode_ci SET @a1 = '1'| @@ -2226,7 +2226,7 @@ END| SHOW CREATE EVENT ev1| Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation -ev1 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `ev1` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN +ev1 NO_ENGINE_SUBSTITUTION SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `ev1` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN DECLARE ÐÅÒÅÍ1 CHAR(10); SELECT COLLATION(ÐÅÒÅÍ1) AS c1, @@ -2239,7 +2239,7 @@ END koi8r koi8r_general_ci utf8_unicode_ci SHOW CREATE EVENT ev2| Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation -ev2 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `ev2` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN +ev2 NO_ENGINE_SUBSTITUTION SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `ev2` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; SELECT COLLATION(ÐÅÒÅÍ1) AS c1, @@ -2252,7 +2252,7 @@ END koi8r koi8r_general_ci utf8_unicode_ci SHOW CREATE EVENT mysqltest2.ev3| Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation -ev3 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `ev3` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN +ev3 NO_ENGINE_SUBSTITUTION SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `ev3` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; SELECT COLLATION(ÐÅÒÅÍ1) AS c1, @@ -2265,7 +2265,7 @@ END koi8r koi8r_general_ci utf8_unicode_ci SHOW CREATE EVENT mysqltest2.ev3| Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation -ev3 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `ev3` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN +ev3 NO_ENGINE_SUBSTITUTION SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `ev3` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; SELECT COLLATION(ÐÅÒÅÍ1) AS c1, @@ -2303,7 +2303,7 @@ COLLATION( ' COLLATION( 'ÔÅËÓÔ') AS c4, @@collation_connection AS c5, @@character_set_client AS c6; -END ONE TIME 2030-01-01 00:00:00 NULL NULL NULL NULL ENABLED NOT PRESERVE CREATED LAST_ALTERED NULL 1 koi8r koi8r_general_ci utf8_unicode_ci +END ONE TIME 2030-01-01 00:00:00 NULL NULL NO_ENGINE_SUBSTITUTION NULL NULL ENABLED NOT PRESERVE CREATED LAST_ALTERED NULL 1 koi8r koi8r_general_ci utf8_unicode_ci SELECT * FROM INFORMATION_SCHEMA.EVENTS WHERE event_name = 'ev2'| EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER TIME_ZONE EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD SQL_MODE STARTS ENDS STATUS ON_COMPLETION CREATED LAST_ALTERED LAST_EXECUTED EVENT_COMMENT ORIGINATOR CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION @@ -2316,7 +2316,7 @@ COLLATION( ' COLLATION( 'ÔÅËÓÔ') AS c4, @@collation_connection AS c5, @@character_set_client AS c6; -END ONE TIME 2030-01-01 00:00:00 NULL NULL NULL NULL ENABLED NOT PRESERVE CREATED LAST_ALTERED NULL 1 koi8r koi8r_general_ci utf8_unicode_ci +END ONE TIME 2030-01-01 00:00:00 NULL NULL NO_ENGINE_SUBSTITUTION NULL NULL ENABLED NOT PRESERVE CREATED LAST_ALTERED NULL 1 koi8r koi8r_general_ci utf8_unicode_ci SELECT * FROM INFORMATION_SCHEMA.EVENTS WHERE event_name = 'ev3'| EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER TIME_ZONE EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD SQL_MODE STARTS ENDS STATUS ON_COMPLETION CREATED LAST_ALTERED LAST_EXECUTED EVENT_COMMENT ORIGINATOR CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION @@ -2329,7 +2329,7 @@ COLLATION( ' COLLATION( 'ÔÅËÓÔ') AS c4, @@collation_connection AS c5, @@character_set_client AS c6; -END ONE TIME 2030-01-01 00:00:00 NULL NULL NULL NULL ENABLED NOT PRESERVE CREATED LAST_ALTERED NULL 1 koi8r koi8r_general_ci utf8_unicode_ci +END ONE TIME 2030-01-01 00:00:00 NULL NULL NO_ENGINE_SUBSTITUTION NULL NULL ENABLED NOT PRESERVE CREATED LAST_ALTERED NULL 1 koi8r koi8r_general_ci utf8_unicode_ci SELECT * FROM INFORMATION_SCHEMA.EVENTS WHERE event_name = 'ev4'| EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER TIME_ZONE EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD SQL_MODE STARTS ENDS STATUS ON_COMPLETION CREATED LAST_ALTERED LAST_EXECUTED EVENT_COMMENT ORIGINATOR CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION @@ -2342,7 +2342,7 @@ COLLATION( ' COLLATION( 'ÔÅËÓÔ') AS c4, @@collation_connection AS c5, @@character_set_client AS c6; -END ONE TIME 2030-01-01 00:00:00 NULL NULL NULL NULL ENABLED NOT PRESERVE CREATED LAST_ALTERED NULL 1 koi8r koi8r_general_ci utf8_unicode_ci +END ONE TIME 2030-01-01 00:00:00 NULL NULL NO_ENGINE_SUBSTITUTION NULL NULL ENABLED NOT PRESERVE CREATED LAST_ALTERED NULL 1 koi8r koi8r_general_ci utf8_unicode_ci ALTER DATABASE mysqltest1 COLLATE cp866_general_ci| @@ -2361,7 +2361,7 @@ set names koi8r| SHOW CREATE EVENT ev1| Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation -ev1 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `ev1` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN +ev1 NO_ENGINE_SUBSTITUTION SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `ev1` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN DECLARE ÐÅÒÅÍ1 CHAR(10); SELECT COLLATION(ÐÅÒÅÍ1) AS c1, @@ -2374,7 +2374,7 @@ END koi8r koi8r_general_ci utf8_unicode_ci SHOW CREATE EVENT ev2| Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation -ev2 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `ev2` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN +ev2 NO_ENGINE_SUBSTITUTION SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `ev2` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; SELECT COLLATION(ÐÅÒÅÍ1) AS c1, @@ -2387,7 +2387,7 @@ END koi8r koi8r_general_ci utf8_unicode_ci SHOW CREATE EVENT mysqltest2.ev3| Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation -ev3 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `ev3` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN +ev3 NO_ENGINE_SUBSTITUTION SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `ev3` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; SELECT COLLATION(ÐÅÒÅÍ1) AS c1, @@ -2400,7 +2400,7 @@ END koi8r koi8r_general_ci utf8_unicode_ci SHOW CREATE EVENT mysqltest2.ev3| Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation -ev3 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `ev3` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN +ev3 NO_ENGINE_SUBSTITUTION SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `ev3` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; SELECT COLLATION(ÐÅÒÅÍ1) AS c1, @@ -2438,7 +2438,7 @@ COLLATION( ' COLLATION( 'ÔÅËÓÔ') AS c4, @@collation_connection AS c5, @@character_set_client AS c6; -END ONE TIME 2030-01-01 00:00:00 NULL NULL NULL NULL ENABLED NOT PRESERVE CREATED LAST_ALTERED NULL 1 koi8r koi8r_general_ci utf8_unicode_ci +END ONE TIME 2030-01-01 00:00:00 NULL NULL NO_ENGINE_SUBSTITUTION NULL NULL ENABLED NOT PRESERVE CREATED LAST_ALTERED NULL 1 koi8r koi8r_general_ci utf8_unicode_ci SELECT * FROM INFORMATION_SCHEMA.EVENTS WHERE event_name = 'ev2'| EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER TIME_ZONE EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD SQL_MODE STARTS ENDS STATUS ON_COMPLETION CREATED LAST_ALTERED LAST_EXECUTED EVENT_COMMENT ORIGINATOR CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION @@ -2451,7 +2451,7 @@ COLLATION( ' COLLATION( 'ÔÅËÓÔ') AS c4, @@collation_connection AS c5, @@character_set_client AS c6; -END ONE TIME 2030-01-01 00:00:00 NULL NULL NULL NULL ENABLED NOT PRESERVE CREATED LAST_ALTERED NULL 1 koi8r koi8r_general_ci utf8_unicode_ci +END ONE TIME 2030-01-01 00:00:00 NULL NULL NO_ENGINE_SUBSTITUTION NULL NULL ENABLED NOT PRESERVE CREATED LAST_ALTERED NULL 1 koi8r koi8r_general_ci utf8_unicode_ci SELECT * FROM INFORMATION_SCHEMA.EVENTS WHERE event_name = 'ev3'| EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER TIME_ZONE EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD SQL_MODE STARTS ENDS STATUS ON_COMPLETION CREATED LAST_ALTERED LAST_EXECUTED EVENT_COMMENT ORIGINATOR CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION @@ -2464,7 +2464,7 @@ COLLATION( ' COLLATION( 'ÔÅËÓÔ') AS c4, @@collation_connection AS c5, @@character_set_client AS c6; -END ONE TIME 2030-01-01 00:00:00 NULL NULL NULL NULL ENABLED NOT PRESERVE CREATED LAST_ALTERED NULL 1 koi8r koi8r_general_ci utf8_unicode_ci +END ONE TIME 2030-01-01 00:00:00 NULL NULL NO_ENGINE_SUBSTITUTION NULL NULL ENABLED NOT PRESERVE CREATED LAST_ALTERED NULL 1 koi8r koi8r_general_ci utf8_unicode_ci SELECT * FROM INFORMATION_SCHEMA.EVENTS WHERE event_name = 'ev4'| EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER TIME_ZONE EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD SQL_MODE STARTS ENDS STATUS ON_COMPLETION CREATED LAST_ALTERED LAST_EXECUTED EVENT_COMMENT ORIGINATOR CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION @@ -2477,7 +2477,7 @@ COLLATION( ' COLLATION( 'ÔÅËÓÔ') AS c4, @@collation_connection AS c5, @@character_set_client AS c6; -END ONE TIME 2030-01-01 00:00:00 NULL NULL NULL NULL ENABLED NOT PRESERVE CREATED LAST_ALTERED NULL 1 koi8r koi8r_general_ci utf8_unicode_ci +END ONE TIME 2030-01-01 00:00:00 NULL NULL NO_ENGINE_SUBSTITUTION NULL NULL ENABLED NOT PRESERVE CREATED LAST_ALTERED NULL 1 koi8r koi8r_general_ci utf8_unicode_ci ---> Dump of mysqltest1 @@ -2494,7 +2494,7 @@ ALTER DATABASE `mysqltest1` CHARACTER SET utf8 COLLATE utf8_unicode_ci ;; /*!50003 SET character_set_results = koi8r */ ;; /*!50003 SET collation_connection = koi8r_general_ci */ ;; /*!50003 SET @saved_sql_mode = @@sql_mode */ ;; -/*!50003 SET sql_mode = '' */ ;; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;; /*!50003 SET @saved_time_zone = @@time_zone */ ;; /*!50003 SET time_zone = 'SYSTEM' */ ;; /*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `ev1` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN @@ -2522,7 +2522,7 @@ ALTER DATABASE `mysqltest1` CHARACTER SET utf8 COLLATE utf8_unicode_ci ;; /*!50003 SET character_set_results = koi8r */ ;; /*!50003 SET collation_connection = koi8r_general_ci */ ;; /*!50003 SET @saved_sql_mode = @@sql_mode */ ;; -/*!50003 SET sql_mode = '' */ ;; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;; /*!50003 SET @saved_time_zone = @@time_zone */ ;; /*!50003 SET time_zone = 'SYSTEM' */ ;; /*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `ev2` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN @@ -2561,7 +2561,7 @@ ALTER DATABASE `mysqltest2` CHARACTER SET utf8 COLLATE utf8_unicode_ci ;; /*!50003 SET character_set_results = koi8r */ ;; /*!50003 SET collation_connection = koi8r_general_ci */ ;; /*!50003 SET @saved_sql_mode = @@sql_mode */ ;; -/*!50003 SET sql_mode = '' */ ;; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;; /*!50003 SET @saved_time_zone = @@time_zone */ ;; /*!50003 SET time_zone = 'SYSTEM' */ ;; /*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `ev3` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN @@ -2589,7 +2589,7 @@ ALTER DATABASE `mysqltest2` CHARACTER SET utf8 COLLATE utf8_unicode_ci ;; /*!50003 SET character_set_results = koi8r */ ;; /*!50003 SET collation_connection = koi8r_general_ci */ ;; /*!50003 SET @saved_sql_mode = @@sql_mode */ ;; -/*!50003 SET sql_mode = '' */ ;; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;; /*!50003 SET @saved_time_zone = @@time_zone */ ;; /*!50003 SET time_zone = 'SYSTEM' */ ;; /*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `ev4` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN @@ -2634,7 +2634,7 @@ set names koi8r| SHOW CREATE EVENT ev1| Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation -ev1 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `ev1` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN +ev1 NO_ENGINE_SUBSTITUTION SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `ev1` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN DECLARE ÐÅÒÅÍ1 CHAR(10); SELECT COLLATION(ÐÅÒÅÍ1) AS c1, @@ -2647,7 +2647,7 @@ END koi8r koi8r_general_ci utf8_unicode_ci SHOW CREATE EVENT ev2| Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation -ev2 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `ev2` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN +ev2 NO_ENGINE_SUBSTITUTION SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `ev2` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; SELECT COLLATION(ÐÅÒÅÍ1) AS c1, @@ -2660,7 +2660,7 @@ END koi8r koi8r_general_ci utf8_unicode_ci SHOW CREATE EVENT mysqltest2.ev3| Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation -ev3 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `ev3` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN +ev3 NO_ENGINE_SUBSTITUTION SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `ev3` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; SELECT COLLATION(ÐÅÒÅÍ1) AS c1, @@ -2673,7 +2673,7 @@ END koi8r koi8r_general_ci utf8_unicode_ci SHOW CREATE EVENT mysqltest2.ev3| Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation -ev3 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `ev3` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN +ev3 NO_ENGINE_SUBSTITUTION SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `ev3` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; SELECT COLLATION(ÐÅÒÅÍ1) AS c1, @@ -2711,7 +2711,7 @@ COLLATION( ' COLLATION( 'ÔÅËÓÔ') AS c4, @@collation_connection AS c5, @@character_set_client AS c6; -END ONE TIME 2030-01-01 00:00:00 NULL NULL NULL NULL ENABLED NOT PRESERVE CREATED LAST_ALTERED NULL 1 koi8r koi8r_general_ci utf8_unicode_ci +END ONE TIME 2030-01-01 00:00:00 NULL NULL NO_ENGINE_SUBSTITUTION NULL NULL ENABLED NOT PRESERVE CREATED LAST_ALTERED NULL 1 koi8r koi8r_general_ci utf8_unicode_ci SELECT * FROM INFORMATION_SCHEMA.EVENTS WHERE event_name = 'ev2'| EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER TIME_ZONE EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD SQL_MODE STARTS ENDS STATUS ON_COMPLETION CREATED LAST_ALTERED LAST_EXECUTED EVENT_COMMENT ORIGINATOR CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION @@ -2724,7 +2724,7 @@ COLLATION( ' COLLATION( 'ÔÅËÓÔ') AS c4, @@collation_connection AS c5, @@character_set_client AS c6; -END ONE TIME 2030-01-01 00:00:00 NULL NULL NULL NULL ENABLED NOT PRESERVE CREATED LAST_ALTERED NULL 1 koi8r koi8r_general_ci utf8_unicode_ci +END ONE TIME 2030-01-01 00:00:00 NULL NULL NO_ENGINE_SUBSTITUTION NULL NULL ENABLED NOT PRESERVE CREATED LAST_ALTERED NULL 1 koi8r koi8r_general_ci utf8_unicode_ci SELECT * FROM INFORMATION_SCHEMA.EVENTS WHERE event_name = 'ev3'| EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER TIME_ZONE EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD SQL_MODE STARTS ENDS STATUS ON_COMPLETION CREATED LAST_ALTERED LAST_EXECUTED EVENT_COMMENT ORIGINATOR CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION @@ -2737,7 +2737,7 @@ COLLATION( ' COLLATION( 'ÔÅËÓÔ') AS c4, @@collation_connection AS c5, @@character_set_client AS c6; -END ONE TIME 2030-01-01 00:00:00 NULL NULL NULL NULL ENABLED NOT PRESERVE CREATED LAST_ALTERED NULL 1 koi8r koi8r_general_ci utf8_unicode_ci +END ONE TIME 2030-01-01 00:00:00 NULL NULL NO_ENGINE_SUBSTITUTION NULL NULL ENABLED NOT PRESERVE CREATED LAST_ALTERED NULL 1 koi8r koi8r_general_ci utf8_unicode_ci SELECT * FROM INFORMATION_SCHEMA.EVENTS WHERE event_name = 'ev4'| EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER TIME_ZONE EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD SQL_MODE STARTS ENDS STATUS ON_COMPLETION CREATED LAST_ALTERED LAST_EXECUTED EVENT_COMMENT ORIGINATOR CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION @@ -2750,7 +2750,7 @@ COLLATION( ' COLLATION( 'ÔÅËÓÔ') AS c4, @@collation_connection AS c5, @@character_set_client AS c6; -END ONE TIME 2030-01-01 00:00:00 NULL NULL NULL NULL ENABLED NOT PRESERVE CREATED LAST_ALTERED NULL 1 koi8r koi8r_general_ci utf8_unicode_ci +END ONE TIME 2030-01-01 00:00:00 NULL NULL NO_ENGINE_SUBSTITUTION NULL NULL ENABLED NOT PRESERVE CREATED LAST_ALTERED NULL 1 koi8r koi8r_general_ci utf8_unicode_ci ------------------------------------------------------------------- DDL statements within stored routine. diff --git a/mysql-wsrep-5.6/mysql-test/r/ddl_i18n_utf8.result b/mysql-wsrep-5.6/mysql-test/r/ddl_i18n_utf8.result index 007a4f14..76b54366 100644 --- a/mysql-wsrep-5.6/mysql-test/r/ddl_i18n_utf8.result +++ b/mysql-wsrep-5.6/mysql-test/r/ddl_i18n_utf8.result @@ -260,7 +260,7 @@ END| SHOW CREATE PROCEDURE p1| Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation -p1 CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`( +p1 NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`( INOUT парам1 CHAR(10), OUT парам2 CHAR(10)) BEGIN @@ -281,7 +281,7 @@ END utf8 utf8_general_ci utf8_unicode_ci SHOW CREATE PROCEDURE p2| Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation -p2 CREATE DEFINER=`root`@`localhost` PROCEDURE `p2`( +p2 NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `p2`( INOUT парам1 CHAR(10) CHARACTER SET utf8, OUT парам2 CHAR(10) CHARACTER SET utf8) BEGIN @@ -302,7 +302,7 @@ END utf8 utf8_general_ci utf8_unicode_ci SHOW CREATE PROCEDURE mysqltest2.p3| Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation -p3 CREATE DEFINER=`root`@`localhost` PROCEDURE `p3`( +p3 NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `p3`( INOUT парам1 CHAR(10), OUT парам2 CHAR(10)) BEGIN @@ -323,7 +323,7 @@ END utf8 utf8_general_ci utf8_unicode_ci SHOW CREATE PROCEDURE mysqltest2.p4| Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation -p4 CREATE DEFINER=`root`@`localhost` PROCEDURE `p4`( +p4 NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `p4`( INOUT парам1 CHAR(10) CHARACTER SET utf8, OUT парам2 CHAR(10) CHARACTER SET utf8) BEGIN @@ -376,7 +376,7 @@ COLLATION( 'текст') AS c6, @@character_set_client AS c8; SET парам1 = 'a'; SET парам2 = 'b'; -END NULL NULL SQL NO CONTAINS SQL NULL DEFINER CREATED ALTERED root@localhost utf8 utf8_general_ci utf8_unicode_ci +END NULL NULL SQL NO CONTAINS SQL NULL DEFINER CREATED ALTERED NO_ENGINE_SUBSTITUTION root@localhost utf8 utf8_general_ci utf8_unicode_ci SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE routine_name = 'p2'| SPECIFIC_NAME ROUTINE_CATALOG ROUTINE_SCHEMA ROUTINE_NAME ROUTINE_TYPE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_NAME COLLATION_NAME DTD_IDENTIFIER ROUTINE_BODY ROUTINE_DEFINITION EXTERNAL_NAME EXTERNAL_LANGUAGE PARAMETER_STYLE IS_DETERMINISTIC SQL_DATA_ACCESS SQL_PATH SECURITY_TYPE CREATED LAST_ALTERED SQL_MODE ROUTINE_COMMENT DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION @@ -394,7 +394,7 @@ COLLATION( 'текст') AS c6, @@character_set_client AS c8; SET парам1 = 'a'; SET парам2 = 'b'; -END NULL NULL SQL NO CONTAINS SQL NULL DEFINER CREATED ALTERED root@localhost utf8 utf8_general_ci utf8_unicode_ci +END NULL NULL SQL NO CONTAINS SQL NULL DEFINER CREATED ALTERED NO_ENGINE_SUBSTITUTION root@localhost utf8 utf8_general_ci utf8_unicode_ci SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE routine_name = 'p3'| SPECIFIC_NAME ROUTINE_CATALOG ROUTINE_SCHEMA ROUTINE_NAME ROUTINE_TYPE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_NAME COLLATION_NAME DTD_IDENTIFIER ROUTINE_BODY ROUTINE_DEFINITION EXTERNAL_NAME EXTERNAL_LANGUAGE PARAMETER_STYLE IS_DETERMINISTIC SQL_DATA_ACCESS SQL_PATH SECURITY_TYPE CREATED LAST_ALTERED SQL_MODE ROUTINE_COMMENT DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION @@ -412,7 +412,7 @@ COLLATION( 'текст') AS c6, @@character_set_client AS c8; SET парам1 = 'a'; SET парам2 = 'b'; -END NULL NULL SQL NO CONTAINS SQL NULL DEFINER CREATED ALTERED root@localhost utf8 utf8_general_ci utf8_unicode_ci +END NULL NULL SQL NO CONTAINS SQL NULL DEFINER CREATED ALTERED NO_ENGINE_SUBSTITUTION root@localhost utf8 utf8_general_ci utf8_unicode_ci SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE routine_name = 'p4'| SPECIFIC_NAME ROUTINE_CATALOG ROUTINE_SCHEMA ROUTINE_NAME ROUTINE_TYPE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_NAME COLLATION_NAME DTD_IDENTIFIER ROUTINE_BODY ROUTINE_DEFINITION EXTERNAL_NAME EXTERNAL_LANGUAGE PARAMETER_STYLE IS_DETERMINISTIC SQL_DATA_ACCESS SQL_PATH SECURITY_TYPE CREATED LAST_ALTERED SQL_MODE ROUTINE_COMMENT DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION @@ -430,7 +430,7 @@ COLLATION( 'текст') AS c6, @@character_set_client AS c8; SET парам1 = 'a'; SET парам2 = 'b'; -END NULL NULL SQL NO CONTAINS SQL NULL DEFINER CREATED ALTERED root@localhost utf8 utf8_general_ci utf8_unicode_ci +END NULL NULL SQL NO CONTAINS SQL NULL DEFINER CREATED ALTERED NO_ENGINE_SUBSTITUTION root@localhost utf8 utf8_general_ci utf8_unicode_ci SET @a = '1'| @@ -506,7 +506,7 @@ set names utf8| SHOW CREATE PROCEDURE p1| Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation -p1 CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`( +p1 NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`( INOUT парам1 CHAR(10), OUT парам2 CHAR(10)) BEGIN @@ -527,7 +527,7 @@ END utf8 utf8_general_ci utf8_unicode_ci SHOW CREATE PROCEDURE p2| Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation -p2 CREATE DEFINER=`root`@`localhost` PROCEDURE `p2`( +p2 NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `p2`( INOUT парам1 CHAR(10) CHARACTER SET utf8, OUT парам2 CHAR(10) CHARACTER SET utf8) BEGIN @@ -548,7 +548,7 @@ END utf8 utf8_general_ci utf8_unicode_ci SHOW CREATE PROCEDURE mysqltest2.p3| Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation -p3 CREATE DEFINER=`root`@`localhost` PROCEDURE `p3`( +p3 NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `p3`( INOUT парам1 CHAR(10), OUT парам2 CHAR(10)) BEGIN @@ -569,7 +569,7 @@ END utf8 utf8_general_ci utf8_unicode_ci SHOW CREATE PROCEDURE mysqltest2.p4| Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation -p4 CREATE DEFINER=`root`@`localhost` PROCEDURE `p4`( +p4 NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `p4`( INOUT парам1 CHAR(10) CHARACTER SET utf8, OUT парам2 CHAR(10) CHARACTER SET utf8) BEGIN @@ -622,7 +622,7 @@ COLLATION( 'текст') AS c6, @@character_set_client AS c8; SET парам1 = 'a'; SET парам2 = 'b'; -END NULL NULL SQL NO CONTAINS SQL NULL DEFINER CREATED ALTERED root@localhost utf8 utf8_general_ci utf8_unicode_ci +END NULL NULL SQL NO CONTAINS SQL NULL DEFINER CREATED ALTERED NO_ENGINE_SUBSTITUTION root@localhost utf8 utf8_general_ci utf8_unicode_ci SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE routine_name = 'p2'| SPECIFIC_NAME ROUTINE_CATALOG ROUTINE_SCHEMA ROUTINE_NAME ROUTINE_TYPE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_NAME COLLATION_NAME DTD_IDENTIFIER ROUTINE_BODY ROUTINE_DEFINITION EXTERNAL_NAME EXTERNAL_LANGUAGE PARAMETER_STYLE IS_DETERMINISTIC SQL_DATA_ACCESS SQL_PATH SECURITY_TYPE CREATED LAST_ALTERED SQL_MODE ROUTINE_COMMENT DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION @@ -640,7 +640,7 @@ COLLATION( 'текст') AS c6, @@character_set_client AS c8; SET парам1 = 'a'; SET парам2 = 'b'; -END NULL NULL SQL NO CONTAINS SQL NULL DEFINER CREATED ALTERED root@localhost utf8 utf8_general_ci utf8_unicode_ci +END NULL NULL SQL NO CONTAINS SQL NULL DEFINER CREATED ALTERED NO_ENGINE_SUBSTITUTION root@localhost utf8 utf8_general_ci utf8_unicode_ci SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE routine_name = 'p3'| SPECIFIC_NAME ROUTINE_CATALOG ROUTINE_SCHEMA ROUTINE_NAME ROUTINE_TYPE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_NAME COLLATION_NAME DTD_IDENTIFIER ROUTINE_BODY ROUTINE_DEFINITION EXTERNAL_NAME EXTERNAL_LANGUAGE PARAMETER_STYLE IS_DETERMINISTIC SQL_DATA_ACCESS SQL_PATH SECURITY_TYPE CREATED LAST_ALTERED SQL_MODE ROUTINE_COMMENT DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION @@ -658,7 +658,7 @@ COLLATION( 'текст') AS c6, @@character_set_client AS c8; SET парам1 = 'a'; SET парам2 = 'b'; -END NULL NULL SQL NO CONTAINS SQL NULL DEFINER CREATED ALTERED root@localhost utf8 utf8_general_ci utf8_unicode_ci +END NULL NULL SQL NO CONTAINS SQL NULL DEFINER CREATED ALTERED NO_ENGINE_SUBSTITUTION root@localhost utf8 utf8_general_ci utf8_unicode_ci SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE routine_name = 'p4'| SPECIFIC_NAME ROUTINE_CATALOG ROUTINE_SCHEMA ROUTINE_NAME ROUTINE_TYPE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_NAME COLLATION_NAME DTD_IDENTIFIER ROUTINE_BODY ROUTINE_DEFINITION EXTERNAL_NAME EXTERNAL_LANGUAGE PARAMETER_STYLE IS_DETERMINISTIC SQL_DATA_ACCESS SQL_PATH SECURITY_TYPE CREATED LAST_ALTERED SQL_MODE ROUTINE_COMMENT DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION @@ -676,7 +676,7 @@ COLLATION( 'текст') AS c6, @@character_set_client AS c8; SET парам1 = 'a'; SET парам2 = 'b'; -END NULL NULL SQL NO CONTAINS SQL NULL DEFINER CREATED ALTERED root@localhost utf8 utf8_general_ci utf8_unicode_ci +END NULL NULL SQL NO CONTAINS SQL NULL DEFINER CREATED ALTERED NO_ENGINE_SUBSTITUTION root@localhost utf8 utf8_general_ci utf8_unicode_ci SET @a = '1'| @@ -732,7 +732,7 @@ ALTER DATABASE `mysqltest1` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; /*!50003 SET character_set_results = utf8 */ ; /*!50003 SET collation_connection = utf8_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = '' */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`( INOUT парам1 CHAR(10), @@ -766,7 +766,7 @@ ALTER DATABASE `mysqltest1` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; /*!50003 SET character_set_results = utf8 */ ; /*!50003 SET collation_connection = utf8_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = '' */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `p2`( INOUT парам1 CHAR(10) CHARACTER SET utf8, @@ -808,7 +808,7 @@ ALTER DATABASE `mysqltest2` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; /*!50003 SET character_set_results = utf8 */ ; /*!50003 SET collation_connection = utf8_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = '' */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `p3`( INOUT парам1 CHAR(10), @@ -842,7 +842,7 @@ ALTER DATABASE `mysqltest2` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; /*!50003 SET character_set_results = utf8 */ ; /*!50003 SET collation_connection = utf8_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = '' */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `p4`( INOUT парам1 CHAR(10) CHARACTER SET utf8, @@ -908,7 +908,7 @@ set names utf8| SHOW CREATE PROCEDURE p1| Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation -p1 CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`( +p1 NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`( INOUT парам1 CHAR(10), OUT парам2 CHAR(10)) BEGIN @@ -929,7 +929,7 @@ END utf8 utf8_general_ci utf8_unicode_ci SHOW CREATE PROCEDURE p2| Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation -p2 CREATE DEFINER=`root`@`localhost` PROCEDURE `p2`( +p2 NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `p2`( INOUT парам1 CHAR(10) CHARACTER SET utf8, OUT парам2 CHAR(10) CHARACTER SET utf8) BEGIN @@ -950,7 +950,7 @@ END utf8 utf8_general_ci utf8_unicode_ci SHOW CREATE PROCEDURE mysqltest2.p3| Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation -p3 CREATE DEFINER=`root`@`localhost` PROCEDURE `p3`( +p3 NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `p3`( INOUT парам1 CHAR(10), OUT парам2 CHAR(10)) BEGIN @@ -971,7 +971,7 @@ END utf8 utf8_general_ci utf8_unicode_ci SHOW CREATE PROCEDURE mysqltest2.p4| Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation -p4 CREATE DEFINER=`root`@`localhost` PROCEDURE `p4`( +p4 NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `p4`( INOUT парам1 CHAR(10) CHARACTER SET utf8, OUT парам2 CHAR(10) CHARACTER SET utf8) BEGIN @@ -1024,7 +1024,7 @@ COLLATION( 'текст') AS c6, @@character_set_client AS c8; SET парам1 = 'a'; SET парам2 = 'b'; -END NULL NULL SQL NO CONTAINS SQL NULL DEFINER CREATED ALTERED root@localhost utf8 utf8_general_ci utf8_unicode_ci +END NULL NULL SQL NO CONTAINS SQL NULL DEFINER CREATED ALTERED NO_ENGINE_SUBSTITUTION root@localhost utf8 utf8_general_ci utf8_unicode_ci SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE routine_name = 'p2'| SPECIFIC_NAME ROUTINE_CATALOG ROUTINE_SCHEMA ROUTINE_NAME ROUTINE_TYPE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_NAME COLLATION_NAME DTD_IDENTIFIER ROUTINE_BODY ROUTINE_DEFINITION EXTERNAL_NAME EXTERNAL_LANGUAGE PARAMETER_STYLE IS_DETERMINISTIC SQL_DATA_ACCESS SQL_PATH SECURITY_TYPE CREATED LAST_ALTERED SQL_MODE ROUTINE_COMMENT DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION @@ -1042,7 +1042,7 @@ COLLATION( 'текст') AS c6, @@character_set_client AS c8; SET парам1 = 'a'; SET парам2 = 'b'; -END NULL NULL SQL NO CONTAINS SQL NULL DEFINER CREATED ALTERED root@localhost utf8 utf8_general_ci utf8_unicode_ci +END NULL NULL SQL NO CONTAINS SQL NULL DEFINER CREATED ALTERED NO_ENGINE_SUBSTITUTION root@localhost utf8 utf8_general_ci utf8_unicode_ci SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE routine_name = 'p3'| SPECIFIC_NAME ROUTINE_CATALOG ROUTINE_SCHEMA ROUTINE_NAME ROUTINE_TYPE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_NAME COLLATION_NAME DTD_IDENTIFIER ROUTINE_BODY ROUTINE_DEFINITION EXTERNAL_NAME EXTERNAL_LANGUAGE PARAMETER_STYLE IS_DETERMINISTIC SQL_DATA_ACCESS SQL_PATH SECURITY_TYPE CREATED LAST_ALTERED SQL_MODE ROUTINE_COMMENT DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION @@ -1060,7 +1060,7 @@ COLLATION( 'текст') AS c6, @@character_set_client AS c8; SET парам1 = 'a'; SET парам2 = 'b'; -END NULL NULL SQL NO CONTAINS SQL NULL DEFINER CREATED ALTERED root@localhost utf8 utf8_general_ci utf8_unicode_ci +END NULL NULL SQL NO CONTAINS SQL NULL DEFINER CREATED ALTERED NO_ENGINE_SUBSTITUTION root@localhost utf8 utf8_general_ci utf8_unicode_ci SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE routine_name = 'p4'| SPECIFIC_NAME ROUTINE_CATALOG ROUTINE_SCHEMA ROUTINE_NAME ROUTINE_TYPE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_NAME COLLATION_NAME DTD_IDENTIFIER ROUTINE_BODY ROUTINE_DEFINITION EXTERNAL_NAME EXTERNAL_LANGUAGE PARAMETER_STYLE IS_DETERMINISTIC SQL_DATA_ACCESS SQL_PATH SECURITY_TYPE CREATED LAST_ALTERED SQL_MODE ROUTINE_COMMENT DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION @@ -1078,7 +1078,7 @@ COLLATION( 'текст') AS c6, @@character_set_client AS c8; SET парам1 = 'a'; SET парам2 = 'b'; -END NULL NULL SQL NO CONTAINS SQL NULL DEFINER CREATED ALTERED root@localhost utf8 utf8_general_ci utf8_unicode_ci +END NULL NULL SQL NO CONTAINS SQL NULL DEFINER CREATED ALTERED NO_ENGINE_SUBSTITUTION root@localhost utf8 utf8_general_ci utf8_unicode_ci SET @a = '1'| @@ -1200,7 +1200,7 @@ END| SHOW CREATE TRIGGER trg1| Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation -trg1 CREATE DEFINER=`root`@`localhost` TRIGGER trg1 BEFORE INSERT ON t1 FOR EACH ROW +trg1 NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER trg1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN DECLARE перем1 CHAR(10); INSERT INTO log VALUES(COLLATION(перем1)); @@ -1216,7 +1216,7 @@ END utf8 utf8_general_ci utf8_unicode_ci SHOW CREATE TRIGGER trg2| Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation -trg2 CREATE DEFINER=`root`@`localhost` TRIGGER trg2 AFTER INSERT ON t1 FOR EACH ROW +trg2 NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER trg2 AFTER INSERT ON t1 FOR EACH ROW BEGIN DECLARE перем1 CHAR(10) CHARACTER SET utf8; INSERT INTO log VALUES(COLLATION(перем1)); @@ -1232,7 +1232,7 @@ END utf8 utf8_general_ci utf8_unicode_ci SHOW CREATE TRIGGER mysqltest2.trg3| Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation -trg3 CREATE DEFINER=`root`@`localhost` TRIGGER mysqltest2.trg3 BEFORE INSERT ON mysqltest2.t1 FOR EACH ROW +trg3 NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER mysqltest2.trg3 BEFORE INSERT ON mysqltest2.t1 FOR EACH ROW BEGIN DECLARE перем1 CHAR(10); INSERT INTO log VALUES(COLLATION(перем1)); @@ -1248,7 +1248,7 @@ END utf8 utf8_general_ci utf8_unicode_ci SHOW CREATE TRIGGER mysqltest2.trg4| Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation -trg4 CREATE DEFINER=`root`@`localhost` TRIGGER mysqltest2.trg4 AFTER INSERT ON mysqltest2.t1 FOR EACH ROW +trg4 NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER mysqltest2.trg4 AFTER INSERT ON mysqltest2.t1 FOR EACH ROW BEGIN DECLARE перем1 CHAR(10) CHARACTER SET utf8; INSERT INTO log VALUES(COLLATION(перем1)); @@ -1276,7 +1276,7 @@ INSERT INTO log VALUES(@@character_set_client); SET @a1 = 'текст'; SET @a2 = 'текст'; SET @a3 = 'текст'; -END BEFORE NULL root@localhost utf8 utf8_general_ci utf8_unicode_ci +END BEFORE NULL NO_ENGINE_SUBSTITUTION root@localhost utf8 utf8_general_ci utf8_unicode_ci trg2 INSERT t1 BEGIN DECLARE перем1 CHAR(10) CHARACTER SET utf8; INSERT INTO log VALUES(COLLATION(перем1)); @@ -1288,7 +1288,7 @@ INSERT INTO log VALUES(@@character_set_client); SET @b1 = 'текст'; SET @b2 = 'текст'; SET @b3 = 'текст'; -END AFTER NULL root@localhost utf8 utf8_general_ci utf8_unicode_ci +END AFTER NULL NO_ENGINE_SUBSTITUTION root@localhost utf8 utf8_general_ci utf8_unicode_ci use mysqltest2| @@ -1305,7 +1305,7 @@ INSERT INTO log VALUES(@@character_set_client); SET @a1 = 'текст'; SET @a2 = 'текст'; SET @a3 = 'текст'; -END BEFORE NULL root@localhost utf8 utf8_general_ci utf8_unicode_ci +END BEFORE NULL NO_ENGINE_SUBSTITUTION root@localhost utf8 utf8_general_ci utf8_unicode_ci trg4 INSERT t1 BEGIN DECLARE перем1 CHAR(10) CHARACTER SET utf8; INSERT INTO log VALUES(COLLATION(перем1)); @@ -1317,7 +1317,7 @@ INSERT INTO log VALUES(@@character_set_client); SET @b1 = 'текст'; SET @b2 = 'текст'; SET @b3 = 'текст'; -END AFTER NULL root@localhost utf8 utf8_general_ci utf8_unicode_ci +END AFTER NULL NO_ENGINE_SUBSTITUTION root@localhost utf8 utf8_general_ci utf8_unicode_ci use mysqltest1| @@ -1334,7 +1334,7 @@ INSERT INTO log VALUES(@@character_set_client); SET @a1 = 'текст'; SET @a2 = 'текст'; SET @a3 = 'текст'; -END ROW BEFORE NULL NULL OLD NEW CREATED root@localhost utf8 utf8_general_ci utf8_unicode_ci +END ROW BEFORE NULL NULL OLD NEW CREATED NO_ENGINE_SUBSTITUTION root@localhost utf8 utf8_general_ci utf8_unicode_ci SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg2'| TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION @@ -1349,7 +1349,7 @@ INSERT INTO log VALUES(@@character_set_client); SET @b1 = 'текст'; SET @b2 = 'текст'; SET @b3 = 'текст'; -END ROW AFTER NULL NULL OLD NEW CREATED root@localhost utf8 utf8_general_ci utf8_unicode_ci +END ROW AFTER NULL NULL OLD NEW CREATED NO_ENGINE_SUBSTITUTION root@localhost utf8 utf8_general_ci utf8_unicode_ci SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg3'| TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION @@ -1364,7 +1364,7 @@ INSERT INTO log VALUES(@@character_set_client); SET @a1 = 'текст'; SET @a2 = 'текст'; SET @a3 = 'текст'; -END ROW BEFORE NULL NULL OLD NEW CREATED root@localhost utf8 utf8_general_ci utf8_unicode_ci +END ROW BEFORE NULL NULL OLD NEW CREATED NO_ENGINE_SUBSTITUTION root@localhost utf8 utf8_general_ci utf8_unicode_ci SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg4'| TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION @@ -1379,7 +1379,7 @@ INSERT INTO log VALUES(@@character_set_client); SET @b1 = 'текст'; SET @b2 = 'текст'; SET @b3 = 'текст'; -END ROW AFTER NULL NULL OLD NEW CREATED root@localhost utf8 utf8_general_ci utf8_unicode_ci +END ROW AFTER NULL NULL OLD NEW CREATED NO_ENGINE_SUBSTITUTION root@localhost utf8 utf8_general_ci utf8_unicode_ci SET @a1 = '1'| @@ -1473,7 +1473,7 @@ use mysqltest1| SHOW CREATE TRIGGER trg1| Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation -trg1 CREATE DEFINER=`root`@`localhost` TRIGGER trg1 BEFORE INSERT ON t1 FOR EACH ROW +trg1 NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER trg1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN DECLARE перем1 CHAR(10); INSERT INTO log VALUES(COLLATION(перем1)); @@ -1489,7 +1489,7 @@ END utf8 utf8_general_ci utf8_unicode_ci SHOW CREATE TRIGGER trg2| Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation -trg2 CREATE DEFINER=`root`@`localhost` TRIGGER trg2 AFTER INSERT ON t1 FOR EACH ROW +trg2 NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER trg2 AFTER INSERT ON t1 FOR EACH ROW BEGIN DECLARE перем1 CHAR(10) CHARACTER SET utf8; INSERT INTO log VALUES(COLLATION(перем1)); @@ -1505,7 +1505,7 @@ END utf8 utf8_general_ci utf8_unicode_ci SHOW CREATE TRIGGER mysqltest2.trg3| Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation -trg3 CREATE DEFINER=`root`@`localhost` TRIGGER mysqltest2.trg3 BEFORE INSERT ON mysqltest2.t1 FOR EACH ROW +trg3 NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER mysqltest2.trg3 BEFORE INSERT ON mysqltest2.t1 FOR EACH ROW BEGIN DECLARE перем1 CHAR(10); INSERT INTO log VALUES(COLLATION(перем1)); @@ -1521,7 +1521,7 @@ END utf8 utf8_general_ci utf8_unicode_ci SHOW CREATE TRIGGER mysqltest2.trg4| Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation -trg4 CREATE DEFINER=`root`@`localhost` TRIGGER mysqltest2.trg4 AFTER INSERT ON mysqltest2.t1 FOR EACH ROW +trg4 NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER mysqltest2.trg4 AFTER INSERT ON mysqltest2.t1 FOR EACH ROW BEGIN DECLARE перем1 CHAR(10) CHARACTER SET utf8; INSERT INTO log VALUES(COLLATION(перем1)); @@ -1549,7 +1549,7 @@ INSERT INTO log VALUES(@@character_set_client); SET @a1 = 'текст'; SET @a2 = 'текст'; SET @a3 = 'текст'; -END BEFORE NULL root@localhost utf8 utf8_general_ci utf8_unicode_ci +END BEFORE NULL NO_ENGINE_SUBSTITUTION root@localhost utf8 utf8_general_ci utf8_unicode_ci trg2 INSERT t1 BEGIN DECLARE перем1 CHAR(10) CHARACTER SET utf8; INSERT INTO log VALUES(COLLATION(перем1)); @@ -1561,7 +1561,7 @@ INSERT INTO log VALUES(@@character_set_client); SET @b1 = 'текст'; SET @b2 = 'текст'; SET @b3 = 'текст'; -END AFTER NULL root@localhost utf8 utf8_general_ci utf8_unicode_ci +END AFTER NULL NO_ENGINE_SUBSTITUTION root@localhost utf8 utf8_general_ci utf8_unicode_ci use mysqltest2| @@ -1578,7 +1578,7 @@ INSERT INTO log VALUES(@@character_set_client); SET @a1 = 'текст'; SET @a2 = 'текст'; SET @a3 = 'текст'; -END BEFORE NULL root@localhost utf8 utf8_general_ci utf8_unicode_ci +END BEFORE NULL NO_ENGINE_SUBSTITUTION root@localhost utf8 utf8_general_ci utf8_unicode_ci trg4 INSERT t1 BEGIN DECLARE перем1 CHAR(10) CHARACTER SET utf8; INSERT INTO log VALUES(COLLATION(перем1)); @@ -1590,7 +1590,7 @@ INSERT INTO log VALUES(@@character_set_client); SET @b1 = 'текст'; SET @b2 = 'текст'; SET @b3 = 'текст'; -END AFTER NULL root@localhost utf8 utf8_general_ci utf8_unicode_ci +END AFTER NULL NO_ENGINE_SUBSTITUTION root@localhost utf8 utf8_general_ci utf8_unicode_ci use mysqltest1| @@ -1607,7 +1607,7 @@ INSERT INTO log VALUES(@@character_set_client); SET @a1 = 'текст'; SET @a2 = 'текст'; SET @a3 = 'текст'; -END ROW BEFORE NULL NULL OLD NEW CREATED root@localhost utf8 utf8_general_ci utf8_unicode_ci +END ROW BEFORE NULL NULL OLD NEW CREATED NO_ENGINE_SUBSTITUTION root@localhost utf8 utf8_general_ci utf8_unicode_ci SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg2'| TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION @@ -1622,7 +1622,7 @@ INSERT INTO log VALUES(@@character_set_client); SET @b1 = 'текст'; SET @b2 = 'текст'; SET @b3 = 'текст'; -END ROW AFTER NULL NULL OLD NEW CREATED root@localhost utf8 utf8_general_ci utf8_unicode_ci +END ROW AFTER NULL NULL OLD NEW CREATED NO_ENGINE_SUBSTITUTION root@localhost utf8 utf8_general_ci utf8_unicode_ci SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg3'| TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION @@ -1637,7 +1637,7 @@ INSERT INTO log VALUES(@@character_set_client); SET @a1 = 'текст'; SET @a2 = 'текст'; SET @a3 = 'текст'; -END ROW BEFORE NULL NULL OLD NEW CREATED root@localhost utf8 utf8_general_ci utf8_unicode_ci +END ROW BEFORE NULL NULL OLD NEW CREATED NO_ENGINE_SUBSTITUTION root@localhost utf8 utf8_general_ci utf8_unicode_ci SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg4'| TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION @@ -1652,7 +1652,7 @@ INSERT INTO log VALUES(@@character_set_client); SET @b1 = 'текст'; SET @b2 = 'текст'; SET @b3 = 'текст'; -END ROW AFTER NULL NULL OLD NEW CREATED root@localhost utf8 utf8_general_ci utf8_unicode_ci +END ROW AFTER NULL NULL OLD NEW CREATED NO_ENGINE_SUBSTITUTION root@localhost utf8 utf8_general_ci utf8_unicode_ci SET @a1 = '1'| @@ -1750,7 +1750,7 @@ ALTER DATABASE `mysqltest1` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; /*!50003 SET character_set_results = utf8 */ ; /*!50003 SET collation_connection = utf8_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = '' */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER trg1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN @@ -1779,7 +1779,7 @@ ALTER DATABASE `mysqltest1` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; /*!50003 SET character_set_results = utf8 */ ; /*!50003 SET collation_connection = utf8_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = '' */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER trg2 AFTER INSERT ON t1 FOR EACH ROW BEGIN @@ -1829,7 +1829,7 @@ ALTER DATABASE `mysqltest2` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; /*!50003 SET character_set_results = utf8 */ ; /*!50003 SET collation_connection = utf8_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = '' */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER mysqltest2.trg3 BEFORE INSERT ON mysqltest2.t1 FOR EACH ROW BEGIN @@ -1858,7 +1858,7 @@ ALTER DATABASE `mysqltest2` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; /*!50003 SET character_set_results = utf8 */ ; /*!50003 SET collation_connection = utf8_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = '' */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER mysqltest2.trg4 AFTER INSERT ON mysqltest2.t1 FOR EACH ROW BEGIN @@ -1908,7 +1908,7 @@ use mysqltest1| SHOW CREATE TRIGGER trg1| Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation -trg1 CREATE DEFINER=`root`@`localhost` TRIGGER trg1 BEFORE INSERT ON t1 FOR EACH ROW +trg1 NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER trg1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN DECLARE перем1 CHAR(10); INSERT INTO log VALUES(COLLATION(перем1)); @@ -1924,7 +1924,7 @@ END utf8 utf8_general_ci utf8_unicode_ci SHOW CREATE TRIGGER trg2| Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation -trg2 CREATE DEFINER=`root`@`localhost` TRIGGER trg2 AFTER INSERT ON t1 FOR EACH ROW +trg2 NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER trg2 AFTER INSERT ON t1 FOR EACH ROW BEGIN DECLARE перем1 CHAR(10) CHARACTER SET utf8; INSERT INTO log VALUES(COLLATION(перем1)); @@ -1940,7 +1940,7 @@ END utf8 utf8_general_ci utf8_unicode_ci SHOW CREATE TRIGGER mysqltest2.trg3| Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation -trg3 CREATE DEFINER=`root`@`localhost` TRIGGER mysqltest2.trg3 BEFORE INSERT ON mysqltest2.t1 FOR EACH ROW +trg3 NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER mysqltest2.trg3 BEFORE INSERT ON mysqltest2.t1 FOR EACH ROW BEGIN DECLARE перем1 CHAR(10); INSERT INTO log VALUES(COLLATION(перем1)); @@ -1956,7 +1956,7 @@ END utf8 utf8_general_ci utf8_unicode_ci SHOW CREATE TRIGGER mysqltest2.trg4| Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation -trg4 CREATE DEFINER=`root`@`localhost` TRIGGER mysqltest2.trg4 AFTER INSERT ON mysqltest2.t1 FOR EACH ROW +trg4 NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER mysqltest2.trg4 AFTER INSERT ON mysqltest2.t1 FOR EACH ROW BEGIN DECLARE перем1 CHAR(10) CHARACTER SET utf8; INSERT INTO log VALUES(COLLATION(перем1)); @@ -1984,7 +1984,7 @@ INSERT INTO log VALUES(@@character_set_client); SET @a1 = 'текст'; SET @a2 = 'текст'; SET @a3 = 'текст'; -END BEFORE NULL root@localhost utf8 utf8_general_ci utf8_unicode_ci +END BEFORE NULL NO_ENGINE_SUBSTITUTION root@localhost utf8 utf8_general_ci utf8_unicode_ci trg2 INSERT t1 BEGIN DECLARE перем1 CHAR(10) CHARACTER SET utf8; INSERT INTO log VALUES(COLLATION(перем1)); @@ -1996,7 +1996,7 @@ INSERT INTO log VALUES(@@character_set_client); SET @b1 = 'текст'; SET @b2 = 'текст'; SET @b3 = 'текст'; -END AFTER NULL root@localhost utf8 utf8_general_ci utf8_unicode_ci +END AFTER NULL NO_ENGINE_SUBSTITUTION root@localhost utf8 utf8_general_ci utf8_unicode_ci use mysqltest2| @@ -2013,7 +2013,7 @@ INSERT INTO log VALUES(@@character_set_client); SET @a1 = 'текст'; SET @a2 = 'текст'; SET @a3 = 'текст'; -END BEFORE NULL root@localhost utf8 utf8_general_ci utf8_unicode_ci +END BEFORE NULL NO_ENGINE_SUBSTITUTION root@localhost utf8 utf8_general_ci utf8_unicode_ci trg4 INSERT t1 BEGIN DECLARE перем1 CHAR(10) CHARACTER SET utf8; INSERT INTO log VALUES(COLLATION(перем1)); @@ -2025,7 +2025,7 @@ INSERT INTO log VALUES(@@character_set_client); SET @b1 = 'текст'; SET @b2 = 'текст'; SET @b3 = 'текст'; -END AFTER NULL root@localhost utf8 utf8_general_ci utf8_unicode_ci +END AFTER NULL NO_ENGINE_SUBSTITUTION root@localhost utf8 utf8_general_ci utf8_unicode_ci use mysqltest1| @@ -2042,7 +2042,7 @@ INSERT INTO log VALUES(@@character_set_client); SET @a1 = 'текст'; SET @a2 = 'текст'; SET @a3 = 'текст'; -END ROW BEFORE NULL NULL OLD NEW CREATED root@localhost utf8 utf8_general_ci utf8_unicode_ci +END ROW BEFORE NULL NULL OLD NEW CREATED NO_ENGINE_SUBSTITUTION root@localhost utf8 utf8_general_ci utf8_unicode_ci SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg2'| TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION @@ -2057,7 +2057,7 @@ INSERT INTO log VALUES(@@character_set_client); SET @b1 = 'текст'; SET @b2 = 'текст'; SET @b3 = 'текст'; -END ROW AFTER NULL NULL OLD NEW CREATED root@localhost utf8 utf8_general_ci utf8_unicode_ci +END ROW AFTER NULL NULL OLD NEW CREATED NO_ENGINE_SUBSTITUTION root@localhost utf8 utf8_general_ci utf8_unicode_ci SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg3'| TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION @@ -2072,7 +2072,7 @@ INSERT INTO log VALUES(@@character_set_client); SET @a1 = 'текст'; SET @a2 = 'текст'; SET @a3 = 'текст'; -END ROW BEFORE NULL NULL OLD NEW CREATED root@localhost utf8 utf8_general_ci utf8_unicode_ci +END ROW BEFORE NULL NULL OLD NEW CREATED NO_ENGINE_SUBSTITUTION root@localhost utf8 utf8_general_ci utf8_unicode_ci SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg4'| TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION @@ -2087,7 +2087,7 @@ INSERT INTO log VALUES(@@character_set_client); SET @b1 = 'текст'; SET @b2 = 'текст'; SET @b3 = 'текст'; -END ROW AFTER NULL NULL OLD NEW CREATED root@localhost utf8 utf8_general_ci utf8_unicode_ci +END ROW AFTER NULL NULL OLD NEW CREATED NO_ENGINE_SUBSTITUTION root@localhost utf8 utf8_general_ci utf8_unicode_ci SET @a1 = '1'| @@ -2226,7 +2226,7 @@ END| SHOW CREATE EVENT ev1| Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation -ev1 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `ev1` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN +ev1 NO_ENGINE_SUBSTITUTION SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `ev1` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN DECLARE перем1 CHAR(10); SELECT COLLATION(перем1) AS c1, @@ -2239,7 +2239,7 @@ END utf8 utf8_general_ci utf8_unicode_ci SHOW CREATE EVENT ev2| Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation -ev2 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `ev2` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN +ev2 NO_ENGINE_SUBSTITUTION SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `ev2` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN DECLARE перем1 CHAR(10) CHARACTER SET utf8; SELECT COLLATION(перем1) AS c1, @@ -2252,7 +2252,7 @@ END utf8 utf8_general_ci utf8_unicode_ci SHOW CREATE EVENT mysqltest2.ev3| Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation -ev3 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `ev3` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN +ev3 NO_ENGINE_SUBSTITUTION SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `ev3` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN DECLARE перем1 CHAR(10) CHARACTER SET utf8; SELECT COLLATION(перем1) AS c1, @@ -2265,7 +2265,7 @@ END utf8 utf8_general_ci utf8_unicode_ci SHOW CREATE EVENT mysqltest2.ev3| Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation -ev3 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `ev3` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN +ev3 NO_ENGINE_SUBSTITUTION SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `ev3` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN DECLARE перем1 CHAR(10) CHARACTER SET utf8; SELECT COLLATION(перем1) AS c1, @@ -2303,7 +2303,7 @@ COLLATION( 'текст') AS c3, COLLATION( 'текст') AS c4, @@collation_connection AS c5, @@character_set_client AS c6; -END ONE TIME 2030-01-01 00:00:00 NULL NULL NULL NULL ENABLED NOT PRESERVE CREATED LAST_ALTERED NULL 1 utf8 utf8_general_ci utf8_unicode_ci +END ONE TIME 2030-01-01 00:00:00 NULL NULL NO_ENGINE_SUBSTITUTION NULL NULL ENABLED NOT PRESERVE CREATED LAST_ALTERED NULL 1 utf8 utf8_general_ci utf8_unicode_ci SELECT * FROM INFORMATION_SCHEMA.EVENTS WHERE event_name = 'ev2'| EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER TIME_ZONE EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD SQL_MODE STARTS ENDS STATUS ON_COMPLETION CREATED LAST_ALTERED LAST_EXECUTED EVENT_COMMENT ORIGINATOR CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION @@ -2316,7 +2316,7 @@ COLLATION( 'текст') AS c3, COLLATION( 'текст') AS c4, @@collation_connection AS c5, @@character_set_client AS c6; -END ONE TIME 2030-01-01 00:00:00 NULL NULL NULL NULL ENABLED NOT PRESERVE CREATED LAST_ALTERED NULL 1 utf8 utf8_general_ci utf8_unicode_ci +END ONE TIME 2030-01-01 00:00:00 NULL NULL NO_ENGINE_SUBSTITUTION NULL NULL ENABLED NOT PRESERVE CREATED LAST_ALTERED NULL 1 utf8 utf8_general_ci utf8_unicode_ci SELECT * FROM INFORMATION_SCHEMA.EVENTS WHERE event_name = 'ev3'| EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER TIME_ZONE EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD SQL_MODE STARTS ENDS STATUS ON_COMPLETION CREATED LAST_ALTERED LAST_EXECUTED EVENT_COMMENT ORIGINATOR CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION @@ -2329,7 +2329,7 @@ COLLATION( 'текст') AS c3, COLLATION( 'текст') AS c4, @@collation_connection AS c5, @@character_set_client AS c6; -END ONE TIME 2030-01-01 00:00:00 NULL NULL NULL NULL ENABLED NOT PRESERVE CREATED LAST_ALTERED NULL 1 utf8 utf8_general_ci utf8_unicode_ci +END ONE TIME 2030-01-01 00:00:00 NULL NULL NO_ENGINE_SUBSTITUTION NULL NULL ENABLED NOT PRESERVE CREATED LAST_ALTERED NULL 1 utf8 utf8_general_ci utf8_unicode_ci SELECT * FROM INFORMATION_SCHEMA.EVENTS WHERE event_name = 'ev4'| EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER TIME_ZONE EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD SQL_MODE STARTS ENDS STATUS ON_COMPLETION CREATED LAST_ALTERED LAST_EXECUTED EVENT_COMMENT ORIGINATOR CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION @@ -2342,7 +2342,7 @@ COLLATION( 'текст') AS c3, COLLATION( 'текст') AS c4, @@collation_connection AS c5, @@character_set_client AS c6; -END ONE TIME 2030-01-01 00:00:00 NULL NULL NULL NULL ENABLED NOT PRESERVE CREATED LAST_ALTERED NULL 1 utf8 utf8_general_ci utf8_unicode_ci +END ONE TIME 2030-01-01 00:00:00 NULL NULL NO_ENGINE_SUBSTITUTION NULL NULL ENABLED NOT PRESERVE CREATED LAST_ALTERED NULL 1 utf8 utf8_general_ci utf8_unicode_ci ALTER DATABASE mysqltest1 COLLATE cp866_general_ci| @@ -2361,7 +2361,7 @@ set names utf8| SHOW CREATE EVENT ev1| Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation -ev1 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `ev1` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN +ev1 NO_ENGINE_SUBSTITUTION SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `ev1` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN DECLARE перем1 CHAR(10); SELECT COLLATION(перем1) AS c1, @@ -2374,7 +2374,7 @@ END utf8 utf8_general_ci utf8_unicode_ci SHOW CREATE EVENT ev2| Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation -ev2 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `ev2` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN +ev2 NO_ENGINE_SUBSTITUTION SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `ev2` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN DECLARE перем1 CHAR(10) CHARACTER SET utf8; SELECT COLLATION(перем1) AS c1, @@ -2387,7 +2387,7 @@ END utf8 utf8_general_ci utf8_unicode_ci SHOW CREATE EVENT mysqltest2.ev3| Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation -ev3 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `ev3` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN +ev3 NO_ENGINE_SUBSTITUTION SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `ev3` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN DECLARE перем1 CHAR(10) CHARACTER SET utf8; SELECT COLLATION(перем1) AS c1, @@ -2400,7 +2400,7 @@ END utf8 utf8_general_ci utf8_unicode_ci SHOW CREATE EVENT mysqltest2.ev3| Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation -ev3 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `ev3` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN +ev3 NO_ENGINE_SUBSTITUTION SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `ev3` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN DECLARE перем1 CHAR(10) CHARACTER SET utf8; SELECT COLLATION(перем1) AS c1, @@ -2438,7 +2438,7 @@ COLLATION( 'текст') AS c3, COLLATION( 'текст') AS c4, @@collation_connection AS c5, @@character_set_client AS c6; -END ONE TIME 2030-01-01 00:00:00 NULL NULL NULL NULL ENABLED NOT PRESERVE CREATED LAST_ALTERED NULL 1 utf8 utf8_general_ci utf8_unicode_ci +END ONE TIME 2030-01-01 00:00:00 NULL NULL NO_ENGINE_SUBSTITUTION NULL NULL ENABLED NOT PRESERVE CREATED LAST_ALTERED NULL 1 utf8 utf8_general_ci utf8_unicode_ci SELECT * FROM INFORMATION_SCHEMA.EVENTS WHERE event_name = 'ev2'| EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER TIME_ZONE EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD SQL_MODE STARTS ENDS STATUS ON_COMPLETION CREATED LAST_ALTERED LAST_EXECUTED EVENT_COMMENT ORIGINATOR CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION @@ -2451,7 +2451,7 @@ COLLATION( 'текст') AS c3, COLLATION( 'текст') AS c4, @@collation_connection AS c5, @@character_set_client AS c6; -END ONE TIME 2030-01-01 00:00:00 NULL NULL NULL NULL ENABLED NOT PRESERVE CREATED LAST_ALTERED NULL 1 utf8 utf8_general_ci utf8_unicode_ci +END ONE TIME 2030-01-01 00:00:00 NULL NULL NO_ENGINE_SUBSTITUTION NULL NULL ENABLED NOT PRESERVE CREATED LAST_ALTERED NULL 1 utf8 utf8_general_ci utf8_unicode_ci SELECT * FROM INFORMATION_SCHEMA.EVENTS WHERE event_name = 'ev3'| EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER TIME_ZONE EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD SQL_MODE STARTS ENDS STATUS ON_COMPLETION CREATED LAST_ALTERED LAST_EXECUTED EVENT_COMMENT ORIGINATOR CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION @@ -2464,7 +2464,7 @@ COLLATION( 'текст') AS c3, COLLATION( 'текст') AS c4, @@collation_connection AS c5, @@character_set_client AS c6; -END ONE TIME 2030-01-01 00:00:00 NULL NULL NULL NULL ENABLED NOT PRESERVE CREATED LAST_ALTERED NULL 1 utf8 utf8_general_ci utf8_unicode_ci +END ONE TIME 2030-01-01 00:00:00 NULL NULL NO_ENGINE_SUBSTITUTION NULL NULL ENABLED NOT PRESERVE CREATED LAST_ALTERED NULL 1 utf8 utf8_general_ci utf8_unicode_ci SELECT * FROM INFORMATION_SCHEMA.EVENTS WHERE event_name = 'ev4'| EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER TIME_ZONE EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD SQL_MODE STARTS ENDS STATUS ON_COMPLETION CREATED LAST_ALTERED LAST_EXECUTED EVENT_COMMENT ORIGINATOR CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION @@ -2477,7 +2477,7 @@ COLLATION( 'текст') AS c3, COLLATION( 'текст') AS c4, @@collation_connection AS c5, @@character_set_client AS c6; -END ONE TIME 2030-01-01 00:00:00 NULL NULL NULL NULL ENABLED NOT PRESERVE CREATED LAST_ALTERED NULL 1 utf8 utf8_general_ci utf8_unicode_ci +END ONE TIME 2030-01-01 00:00:00 NULL NULL NO_ENGINE_SUBSTITUTION NULL NULL ENABLED NOT PRESERVE CREATED LAST_ALTERED NULL 1 utf8 utf8_general_ci utf8_unicode_ci ---> Dump of mysqltest1 @@ -2494,7 +2494,7 @@ ALTER DATABASE `mysqltest1` CHARACTER SET utf8 COLLATE utf8_unicode_ci ;; /*!50003 SET character_set_results = utf8 */ ;; /*!50003 SET collation_connection = utf8_general_ci */ ;; /*!50003 SET @saved_sql_mode = @@sql_mode */ ;; -/*!50003 SET sql_mode = '' */ ;; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;; /*!50003 SET @saved_time_zone = @@time_zone */ ;; /*!50003 SET time_zone = 'SYSTEM' */ ;; /*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `ev1` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN @@ -2522,7 +2522,7 @@ ALTER DATABASE `mysqltest1` CHARACTER SET utf8 COLLATE utf8_unicode_ci ;; /*!50003 SET character_set_results = utf8 */ ;; /*!50003 SET collation_connection = utf8_general_ci */ ;; /*!50003 SET @saved_sql_mode = @@sql_mode */ ;; -/*!50003 SET sql_mode = '' */ ;; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;; /*!50003 SET @saved_time_zone = @@time_zone */ ;; /*!50003 SET time_zone = 'SYSTEM' */ ;; /*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `ev2` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN @@ -2561,7 +2561,7 @@ ALTER DATABASE `mysqltest2` CHARACTER SET utf8 COLLATE utf8_unicode_ci ;; /*!50003 SET character_set_results = utf8 */ ;; /*!50003 SET collation_connection = utf8_general_ci */ ;; /*!50003 SET @saved_sql_mode = @@sql_mode */ ;; -/*!50003 SET sql_mode = '' */ ;; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;; /*!50003 SET @saved_time_zone = @@time_zone */ ;; /*!50003 SET time_zone = 'SYSTEM' */ ;; /*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `ev3` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN @@ -2589,7 +2589,7 @@ ALTER DATABASE `mysqltest2` CHARACTER SET utf8 COLLATE utf8_unicode_ci ;; /*!50003 SET character_set_results = utf8 */ ;; /*!50003 SET collation_connection = utf8_general_ci */ ;; /*!50003 SET @saved_sql_mode = @@sql_mode */ ;; -/*!50003 SET sql_mode = '' */ ;; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;; /*!50003 SET @saved_time_zone = @@time_zone */ ;; /*!50003 SET time_zone = 'SYSTEM' */ ;; /*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `ev4` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN @@ -2634,7 +2634,7 @@ set names utf8| SHOW CREATE EVENT ev1| Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation -ev1 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `ev1` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN +ev1 NO_ENGINE_SUBSTITUTION SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `ev1` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN DECLARE перем1 CHAR(10); SELECT COLLATION(перем1) AS c1, @@ -2647,7 +2647,7 @@ END utf8 utf8_general_ci utf8_unicode_ci SHOW CREATE EVENT ev2| Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation -ev2 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `ev2` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN +ev2 NO_ENGINE_SUBSTITUTION SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `ev2` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN DECLARE перем1 CHAR(10) CHARACTER SET utf8; SELECT COLLATION(перем1) AS c1, @@ -2660,7 +2660,7 @@ END utf8 utf8_general_ci utf8_unicode_ci SHOW CREATE EVENT mysqltest2.ev3| Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation -ev3 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `ev3` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN +ev3 NO_ENGINE_SUBSTITUTION SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `ev3` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN DECLARE перем1 CHAR(10) CHARACTER SET utf8; SELECT COLLATION(перем1) AS c1, @@ -2673,7 +2673,7 @@ END utf8 utf8_general_ci utf8_unicode_ci SHOW CREATE EVENT mysqltest2.ev3| Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation -ev3 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `ev3` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN +ev3 NO_ENGINE_SUBSTITUTION SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `ev3` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN DECLARE перем1 CHAR(10) CHARACTER SET utf8; SELECT COLLATION(перем1) AS c1, @@ -2711,7 +2711,7 @@ COLLATION( 'текст') AS c3, COLLATION( 'текст') AS c4, @@collation_connection AS c5, @@character_set_client AS c6; -END ONE TIME 2030-01-01 00:00:00 NULL NULL NULL NULL ENABLED NOT PRESERVE CREATED LAST_ALTERED NULL 1 utf8 utf8_general_ci utf8_unicode_ci +END ONE TIME 2030-01-01 00:00:00 NULL NULL NO_ENGINE_SUBSTITUTION NULL NULL ENABLED NOT PRESERVE CREATED LAST_ALTERED NULL 1 utf8 utf8_general_ci utf8_unicode_ci SELECT * FROM INFORMATION_SCHEMA.EVENTS WHERE event_name = 'ev2'| EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER TIME_ZONE EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD SQL_MODE STARTS ENDS STATUS ON_COMPLETION CREATED LAST_ALTERED LAST_EXECUTED EVENT_COMMENT ORIGINATOR CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION @@ -2724,7 +2724,7 @@ COLLATION( 'текст') AS c3, COLLATION( 'текст') AS c4, @@collation_connection AS c5, @@character_set_client AS c6; -END ONE TIME 2030-01-01 00:00:00 NULL NULL NULL NULL ENABLED NOT PRESERVE CREATED LAST_ALTERED NULL 1 utf8 utf8_general_ci utf8_unicode_ci +END ONE TIME 2030-01-01 00:00:00 NULL NULL NO_ENGINE_SUBSTITUTION NULL NULL ENABLED NOT PRESERVE CREATED LAST_ALTERED NULL 1 utf8 utf8_general_ci utf8_unicode_ci SELECT * FROM INFORMATION_SCHEMA.EVENTS WHERE event_name = 'ev3'| EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER TIME_ZONE EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD SQL_MODE STARTS ENDS STATUS ON_COMPLETION CREATED LAST_ALTERED LAST_EXECUTED EVENT_COMMENT ORIGINATOR CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION @@ -2737,7 +2737,7 @@ COLLATION( 'текст') AS c3, COLLATION( 'текст') AS c4, @@collation_connection AS c5, @@character_set_client AS c6; -END ONE TIME 2030-01-01 00:00:00 NULL NULL NULL NULL ENABLED NOT PRESERVE CREATED LAST_ALTERED NULL 1 utf8 utf8_general_ci utf8_unicode_ci +END ONE TIME 2030-01-01 00:00:00 NULL NULL NO_ENGINE_SUBSTITUTION NULL NULL ENABLED NOT PRESERVE CREATED LAST_ALTERED NULL 1 utf8 utf8_general_ci utf8_unicode_ci SELECT * FROM INFORMATION_SCHEMA.EVENTS WHERE event_name = 'ev4'| EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER TIME_ZONE EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD SQL_MODE STARTS ENDS STATUS ON_COMPLETION CREATED LAST_ALTERED LAST_EXECUTED EVENT_COMMENT ORIGINATOR CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION @@ -2750,7 +2750,7 @@ COLLATION( 'текст') AS c3, COLLATION( 'текст') AS c4, @@collation_connection AS c5, @@character_set_client AS c6; -END ONE TIME 2030-01-01 00:00:00 NULL NULL NULL NULL ENABLED NOT PRESERVE CREATED LAST_ALTERED NULL 1 utf8 utf8_general_ci utf8_unicode_ci +END ONE TIME 2030-01-01 00:00:00 NULL NULL NO_ENGINE_SUBSTITUTION NULL NULL ENABLED NOT PRESERVE CREATED LAST_ALTERED NULL 1 utf8 utf8_general_ci utf8_unicode_ci ------------------------------------------------------------------- DDL statements within stored routine. diff --git a/mysql-wsrep-5.6/mysql-test/r/debug_sync.result b/mysql-wsrep-5.6/mysql-test/r/debug_sync.result index 25fdf523..e3905ae4 100644 --- a/mysql-wsrep-5.6/mysql-test/r/debug_sync.result +++ b/mysql-wsrep-5.6/mysql-test/r/debug_sync.result @@ -2,7 +2,7 @@ SET DEBUG_SYNC= 'RESET'; DROP TABLE IF EXISTS t1; SHOW VARIABLES LIKE 'DEBUG_SYNC'; Variable_name Value -debug_sync ON - current signal: '' +debug_sync ON - signals: '' SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2 TIMEOUT 6 EXECUTE 2 HIT_LIMIT 3'; SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2 TIMEOUT 6 EXECUTE 2'; SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2 TIMEOUT 6 HIT_LIMIT 3'; @@ -150,34 +150,34 @@ SET @myvar= 'now SIGNAL from_myvar'; SET DEBUG_SYNC= @myvar; SHOW VARIABLES LIKE 'DEBUG_SYNC'; Variable_name Value -debug_sync ON - current signal: 'from_myvar' +debug_sync ON - signals: 'from_myvar' SET DEBUG_SYNC= LEFT('now SIGNAL from_function_cut_here', 24); SHOW VARIABLES LIKE 'DEBUG_SYNC'; Variable_name Value -debug_sync ON - current signal: 'from_function' +debug_sync ON - signals: 'from_function,from_myvar' SET DEBUG_SYNC= 'now SIGNAL something'; SHOW VARIABLES LIKE 'DEBUG_SYNC'; Variable_name Value -debug_sync ON - current signal: 'something' +debug_sync ON - signals: 'from_function,from_myvar,something' SET DEBUG_SYNC= 'now WAIT_FOR nothing TIMEOUT 0'; Warnings: Warning #### debug sync point wait timed out SET DEBUG_SYNC= 'now SIGNAL nothing'; SHOW VARIABLES LIKE 'DEBUG_SYNC'; Variable_name Value -debug_sync ON - current signal: 'nothing' +debug_sync ON - signals: 'from_function,from_myvar,nothing,something' SET DEBUG_SYNC= 'now WAIT_FOR nothing TIMEOUT 0'; SET DEBUG_SYNC= 'now SIGNAL something EXECUTE 0'; SHOW VARIABLES LIKE 'DEBUG_SYNC'; Variable_name Value -debug_sync ON - current signal: 'nothing' +debug_sync ON - signals: 'from_function,from_myvar,something' SET DEBUG_SYNC= 'now WAIT_FOR anotherthing TIMEOUT 0 EXECUTE 0'; SET DEBUG_SYNC= 'now HIT_LIMIT 1'; ERROR HY000: debug sync point hit limit reached SET DEBUG_SYNC= 'RESET'; SHOW VARIABLES LIKE 'DEBUG_SYNC'; Variable_name Value -debug_sync ON - current signal: '' +debug_sync ON - signals: '' SET DEBUG_SYNC= 'p1abcd SIGNAL s1 EXECUTE 2'; SET DEBUG_SYNC= 'p2abc SIGNAL s2 EXECUTE 2'; SET DEBUG_SYNC= 'p9abcdef SIGNAL s9 EXECUTE 2'; @@ -190,23 +190,23 @@ SET DEBUG_SYNC= 'p3abcdef SIGNAL s3 EXECUTE 2'; SET DEBUG_SYNC= 'p4a TEST'; SHOW VARIABLES LIKE 'DEBUG_SYNC'; Variable_name Value -debug_sync ON - current signal: 's4' +debug_sync ON - signals: 's4' SET DEBUG_SYNC= 'p1abcd TEST'; SHOW VARIABLES LIKE 'DEBUG_SYNC'; Variable_name Value -debug_sync ON - current signal: 's1' +debug_sync ON - signals: 's1,s4' SET DEBUG_SYNC= 'p7 TEST'; SHOW VARIABLES LIKE 'DEBUG_SYNC'; Variable_name Value -debug_sync ON - current signal: 's7' +debug_sync ON - signals: 's1,s4,s7' SET DEBUG_SYNC= 'p9abcdef TEST'; SHOW VARIABLES LIKE 'DEBUG_SYNC'; Variable_name Value -debug_sync ON - current signal: 's9' +debug_sync ON - signals: 's1,s4,s7,s9' SET DEBUG_SYNC= 'p3abcdef TEST'; SHOW VARIABLES LIKE 'DEBUG_SYNC'; Variable_name Value -debug_sync ON - current signal: 's3' +debug_sync ON - signals: 's1,s3,s4,s7,s9' SET DEBUG_SYNC= 'p1abcd CLEAR'; SET DEBUG_SYNC= 'p2abc CLEAR'; SET DEBUG_SYNC= 'p5abcde CLEAR'; @@ -219,19 +219,19 @@ SET DEBUG_SYNC= 'p7 CLEAR'; SET DEBUG_SYNC= 'p1abcd TEST'; SHOW VARIABLES LIKE 'DEBUG_SYNC'; Variable_name Value -debug_sync ON - current signal: 's3' +debug_sync ON - signals: 's1,s3,s4,s7,s9' SET DEBUG_SYNC= 'p7 TEST'; SHOW VARIABLES LIKE 'DEBUG_SYNC'; Variable_name Value -debug_sync ON - current signal: 's3' +debug_sync ON - signals: 's1,s3,s4,s7,s9' SET DEBUG_SYNC= 'p9abcdef TEST'; SHOW VARIABLES LIKE 'DEBUG_SYNC'; Variable_name Value -debug_sync ON - current signal: 's3' +debug_sync ON - signals: 's1,s3,s4,s7,s9' SET DEBUG_SYNC= 'RESET'; SHOW VARIABLES LIKE 'DEBUG_SYNC'; Variable_name Value -debug_sync ON - current signal: '' +debug_sync ON - signals: '' CREATE USER mysqltest_1@localhost; GRANT SUPER ON *.* TO mysqltest_1@localhost; connection con1, mysqltest_1 diff --git a/mysql-wsrep-5.6/mysql-test/r/delayed.result b/mysql-wsrep-5.6/mysql-test/r/delayed.result index a45a0526..b5b6576a 100644 --- a/mysql-wsrep-5.6/mysql-test/r/delayed.result +++ b/mysql-wsrep-5.6/mysql-test/r/delayed.result @@ -334,6 +334,8 @@ id f1 0 test1 1 ab SET SQL_MODE='ERROR_FOR_DIVISION_BY_ZERO,STRICT_ALL_TABLES'; +Warnings: +Warning 1681 'ERROR_FOR_DIVISION_BY_ZERO' is deprecated and will be removed in a future release. INSERT DELAYED INTO t1 VALUES(mod(1,0),"test3"); ERROR 22012: Division by 0 CREATE TABLE t2 ( @@ -341,6 +343,9 @@ CREATE TABLE t2 ( `f1` date ); SET SQL_MODE='NO_ZERO_DATE,STRICT_ALL_TABLES,NO_ZERO_IN_DATE'; +Warnings: +Warning 1681 'NO_ZERO_DATE' is deprecated and will be removed in a future release. +Warning 1681 'NO_ZERO_IN_DATE' is deprecated and will be removed in a future release. INSERT DELAYED INTO t2 VALUES (0,'0000-00-00'); ERROR 22007: Incorrect date value: '0000-00-00' for column 'f1' at row 1 INSERT DELAYED INTO t2 VALUES (0,'2007-00-00'); diff --git a/mysql-wsrep-5.6/mysql-test/r/derived.result b/mysql-wsrep-5.6/mysql-test/r/derived.result index 12e8a2ab..14391f41 100644 --- a/mysql-wsrep-5.6/mysql-test/r/derived.result +++ b/mysql-wsrep-5.6/mysql-test/r/derived.result @@ -1978,3 +1978,229 @@ SELECT * FROM (SELECT * FROM t1) AS a1 RIGHT JOIN t3 LEFT JOIN t2 ON d=c ON a=c; a b d c NULL NULL 0 NULL DROP TABLE t1, t2, t3; +# +# Bug #17814492 - INVALID RESULTS FROM SUBQUERY WITH IN CLAUSE +# +CREATE TABLE t1 ( +a INTEGER NOT NULL, +b VARCHAR(1000) NOT NULL, +c TEXT NOT NULL +)ENGINE=InnoDB; +INSERT INTO t1 VALUES (1, 'xxx', 'abc'); +INSERT INTO t1 VALUES (2, 'yyy', 'abc'); +INSERT INTO t1 SELECT a, b, c FROM t1 WHERE b='yyy'; +INSERT INTO t1 SELECT a, b, c FROM t1 WHERE b='yyy'; +INSERT INTO t1 SELECT a, b, c FROM t1 WHERE b='yyy'; +CREATE TABLE t2 ( +a INTEGER NOT NULL +)ENGINE=InnoDB; +INSERT INTO t2 VALUES (1), (2); +SET @save_optimizer_switch= @@optimizer_switch; +SET @@SESSION.optimizer_switch="index_condition_pushdown=on"; +EXPLAIN SELECT a1.a, a1.b, a1.c FROM (SELECT a, b, c FROM t1 ) a1 +JOIN t2 ON a1.a=t2.a WHERE a1.b='xxx'; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 2 NULL +1 PRIMARY ref 4 test.t2.a 2 Using where +2 DERIVED t1 ALL NULL NULL NULL NULL 9 NULL +SELECT a1.a, a1.b, a1.c FROM (SELECT a, b, c FROM t1 ) a1 +JOIN t2 ON a1.a=t2.a WHERE a1.b='xxx'; +a b c +1 xxx abc +SET @@SESSION.optimizer_switch= @save_optimizer_switch; +DROP TABLE t2, t1; +# End of test for Bug #17814492 +# +# Bug #18607971 : 5.5 TO 5.6 REGRESSION WITH A SUBQUERY IN THE FROM +# CLAUSE. +# +CREATE TABLE t(id INT PRIMARY KEY, +c1 INT, c2 INT, key(c2)) engine=InnoDB; +INSERT INTO t(id, c1, c2) VALUES(1, 2, 3), (2, 3, 4), (3, 3, 4), (4, 3, 4); +ANALYZE TABLE t; +Table Op Msg_type Msg_text +test.t analyze status OK +EXPLAIN SELECT * FROM +(SELECT t1.c1 +FROM t t1 INNER JOIN t t2 ON t1.c1= 3 +GROUP BY t1.c1) a, t b +WHERE b.id BETWEEN 1 AND 10; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY system NULL NULL NULL NULL 1 NULL +1 PRIMARY b range PRIMARY PRIMARY 4 NULL 4 Using where +2 DERIVED t1 ALL NULL NULL NULL NULL 4 Using where +2 DERIVED t2 index NULL c2 5 NULL 4 Using index; Using join buffer (Block Nested Loop) +EXPLAIN SELECT * FROM +(SELECT t1.id +FROM t t1 INNER JOIN t t2 ON t1.id=1 AND t1.c1=t2.id +GROUP BY t1.id, t2.c2) a, t b +WHERE b.id BETWEEN 1 AND 10; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY system NULL NULL NULL NULL 1 NULL +1 PRIMARY b range PRIMARY PRIMARY 4 NULL 4 Using where +2 DERIVED t1 const PRIMARY PRIMARY 4 const 1 NULL +2 DERIVED t2 const PRIMARY PRIMARY 4 const 1 NULL +EXPLAIN SELECT * FROM +(SELECT t1.c1 +FROM t t1 INNER JOIN t t2 ON t1.c1= 3 AND t2.c2= 3 +GROUP BY t1.c1) a, t b +WHERE b.id BETWEEN 1 AND 10; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY system NULL NULL NULL NULL 1 NULL +1 PRIMARY b range PRIMARY PRIMARY 4 NULL 4 Using where +2 DERIVED t2 ref c2 c2 5 const 1 Using index +2 DERIVED t1 ALL NULL NULL NULL NULL 4 Using where; Using join buffer (Block Nested Loop) +EXPLAIN SELECT * FROM +(SELECT t1.c1 +FROM t t1 INNER JOIN t t2 ON t1.c1= 3 AND t2.c2= 3 +GROUP BY t1.c1, t2.c2) a, t b +WHERE b.id BETWEEN 1 AND 10; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY system NULL NULL NULL NULL 1 NULL +1 PRIMARY b range PRIMARY PRIMARY 4 NULL 4 Using where +2 DERIVED t2 ref c2 c2 5 const 1 Using index +2 DERIVED t1 ALL NULL NULL NULL NULL 4 Using where; Using join buffer (Block Nested Loop) +EXPLAIN SELECT * FROM +(SELECT t1.c1 +FROM t t1 INNER JOIN t t2 ON t1.c1= 3 AND t2.c2= 3 +GROUP BY t1.c1, t1.id) a, t b +WHERE b.id BETWEEN 1 AND 10; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY b range PRIMARY PRIMARY 4 NULL 4 Using where +1 PRIMARY ALL NULL NULL NULL NULL 4 Using join buffer (Block Nested Loop) +2 DERIVED t2 ref c2 c2 5 const 1 Using index; Using temporary; Using filesort +2 DERIVED t1 ALL NULL NULL NULL NULL 4 Using where; Using join buffer (Block Nested Loop) +EXPLAIN SELECT * FROM +(SELECT t1.id +FROM t t1 INNER JOIN t t2 ON t1.id=1 AND t1.c1=t2.c1 +GROUP BY t2.c1, t1.id) a, t b +WHERE b.id BETWEEN 1 AND 10; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY system NULL NULL NULL NULL 1 NULL +1 PRIMARY b range PRIMARY PRIMARY 4 NULL 4 Using where +2 DERIVED t1 const PRIMARY PRIMARY 4 const 1 NULL +2 DERIVED t2 ALL NULL NULL NULL NULL 4 Using where +EXPLAIN SELECT * FROM +(SELECT t1.id +FROM t t1 INNER JOIN t t2 ON t1.id=1 AND t1.c1=t2.id +GROUP BY t2.c1, t1.id) a, t b +WHERE b.id BETWEEN 1 AND 10; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY system NULL NULL NULL NULL 1 NULL +1 PRIMARY b range PRIMARY PRIMARY 4 NULL 4 Using where +2 DERIVED t1 const PRIMARY PRIMARY 4 const 1 NULL +2 DERIVED t2 const PRIMARY PRIMARY 4 const 1 NULL +EXPLAIN SELECT * FROM +(SELECT t1.id +FROM t t1 INNER JOIN t t2 ON t1.id=1 AND t1.c1=t2.id +GROUP BY t2.c2, t1.id) a, t b +WHERE b.id BETWEEN 1 AND 10; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY system NULL NULL NULL NULL 1 NULL +1 PRIMARY b range PRIMARY PRIMARY 4 NULL 4 Using where +2 DERIVED t1 const PRIMARY PRIMARY 4 const 1 NULL +2 DERIVED t2 const PRIMARY PRIMARY 4 const 1 NULL +EXPLAIN SELECT * FROM +(SELECT t1.id +FROM t t1 INNER JOIN t t2 ON t1.id=1 AND t1.c1=t2.id +GROUP BY t1.id, t2.c2) a, t b +WHERE b.id BETWEEN 1 AND 10; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY system NULL NULL NULL NULL 1 NULL +1 PRIMARY b range PRIMARY PRIMARY 4 NULL 4 Using where +2 DERIVED t1 const PRIMARY PRIMARY 4 const 1 NULL +2 DERIVED t2 const PRIMARY PRIMARY 4 const 1 NULL +EXPLAIN SELECT * FROM +(SELECT t1.id +FROM t t1 INNER JOIN t t2 INNER JOIN t t3 ON t1.id=1 AND t1.c1=t2.id AND t2.c1=t3.id +GROUP BY t1.id, t2.c2, t3.c2) a, t b +WHERE b.id BETWEEN 1 AND 10; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY system NULL NULL NULL NULL 1 NULL +1 PRIMARY b range PRIMARY PRIMARY 4 NULL 4 Using where +2 DERIVED t1 const PRIMARY PRIMARY 4 const 1 NULL +2 DERIVED t2 const PRIMARY PRIMARY 4 const 1 NULL +2 DERIVED t3 const PRIMARY PRIMARY 4 const 1 NULL +EXPLAIN SELECT * FROM +(SELECT DISTINCT t1.id +FROM t t1 +WHERE t1.id= 1) a, t b +WHERE b.id BETWEEN 1 AND 10; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY system NULL NULL NULL NULL 1 NULL +1 PRIMARY b range PRIMARY PRIMARY 4 NULL 4 Using where +2 DERIVED t1 const PRIMARY PRIMARY 4 const 1 Using index +EXPLAIN SELECT * FROM +(SELECT t1.id + 1 +FROM t t1 INNER JOIN t t2 ON t1.id= 1 +GROUP BY t1.id + 1) a, t b +WHERE b.id BETWEEN 1 AND 10; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY system NULL NULL NULL NULL 1 NULL +1 PRIMARY b range PRIMARY PRIMARY 4 NULL 4 Using where +2 DERIVED t1 const PRIMARY PRIMARY 4 const 1 Using index +2 DERIVED t2 index NULL c2 5 NULL 4 Using index +EXPLAIN SELECT * FROM +(SELECT t1.c1 +FROM t t1 INNER JOIN t t2 ON t1.c1= 3 +GROUP BY 1.5) a, t b +WHERE b.id BETWEEN 1 AND 10; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY system NULL NULL NULL NULL 1 NULL +1 PRIMARY b range PRIMARY PRIMARY 4 NULL 4 Using where +2 DERIVED t1 ALL NULL NULL NULL NULL 4 Using where +2 DERIVED t2 index NULL c2 5 NULL 4 Using index; Using join buffer (Block Nested Loop) +EXPLAIN SELECT * FROM +(SELECT t1.id +FROM t t1 INNER JOIN t t2 ON mod(t1.id,1000)= 1 +GROUP BY t1.id) a, t b +WHERE b.id BETWEEN 1 AND 10; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY b range PRIMARY PRIMARY 4 NULL 4 Using where +1 PRIMARY ALL NULL NULL NULL NULL 16 Using join buffer (Block Nested Loop) +2 DERIVED t1 index PRIMARY,c2 c2 5 NULL 4 Using where; Using index; Using temporary; Using filesort +2 DERIVED t2 index NULL c2 5 NULL 4 Using index; Using join buffer (Block Nested Loop) +EXPLAIN SELECT * FROM +(SELECT t1.id + 1 +FROM t t1 INNER JOIN t t2 ON t1.id + 1= 2 +GROUP BY t1.id + 1) a, t b +WHERE b.id BETWEEN 1 AND 10; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY system NULL NULL NULL NULL 1 NULL +1 PRIMARY b range PRIMARY PRIMARY 4 NULL 4 Using where +2 DERIVED t1 index PRIMARY,c2 c2 5 NULL 4 Using where; Using index +2 DERIVED t2 index NULL c2 5 NULL 4 Using index; Using join buffer (Block Nested Loop) +CREATE VIEW v1 AS SELECT c1 a FROM t WHERE c1 = 3; +CREATE VIEW v2 AS SELECT c2 b FROM t WHERE c2 > 3; +EXPLAIN SELECT * FROM (SELECT v1.a +FROM v1 LEFT OUTER JOIN v2 ON v1.a = v2.b +GROUP BY v1.a) p, t q +WHERE q.id BETWEEN 1 AND 10; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY system NULL NULL NULL NULL 1 NULL +1 PRIMARY q range PRIMARY PRIMARY 4 NULL 4 Using where +2 DERIVED t ALL NULL NULL NULL NULL 4 Using where +2 DERIVED t ref c2 c2 5 const 1 Using where; Using index +DROP VIEW v1; +CREATE VIEW v1 AS SELECT c1 a FROM t; +EXPLAIN SELECT * FROM (SELECT v1.a +FROM v1 LEFT OUTER JOIN v2 ON v1.a = v2.b AND v1.a = 10 +GROUP BY v1.a) p, t q +WHERE q.id BETWEEN 1 AND 10; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY q range PRIMARY PRIMARY 4 NULL 4 Using where +1 PRIMARY ALL NULL NULL NULL NULL 4 Using join buffer (Block Nested Loop) +2 DERIVED t ALL NULL NULL NULL NULL 4 Using temporary; Using filesort +2 DERIVED t ref c2 c2 5 func 1 Using where; Using index +EXPLAIN SELECT * FROM (SELECT v1.a +FROM v1 LEFT OUTER JOIN v2 ON v1.a = v2.b +WHERE v1.a = 3 +GROUP BY v1.a) p, t q +WHERE q.id BETWEEN 1 AND 10; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY system NULL NULL NULL NULL 1 NULL +1 PRIMARY q range PRIMARY PRIMARY 4 NULL 4 Using where +2 DERIVED t ALL NULL NULL NULL NULL 4 Using where +2 DERIVED t ref c2 c2 5 const 1 Using where; Using index +DROP VIEW v1, v2; +DROP TABLE t; diff --git a/mysql-wsrep-5.6/mysql-test/r/distinct.result b/mysql-wsrep-5.6/mysql-test/r/distinct.result index bc602f0d..a69d5247 100644 --- a/mysql-wsrep-5.6/mysql-test/r/distinct.result +++ b/mysql-wsrep-5.6/mysql-test/r/distinct.result @@ -212,12 +212,12 @@ select distinct 1 from t1,t3 where t1.a=t3.a; show status like 'Handler_read%'; Variable_name Value Handler_read_first 1 -Handler_read_key 1 +Handler_read_key 4 Handler_read_last 0 -Handler_read_next 0 +Handler_read_next 208 Handler_read_prev 0 Handler_read_rnd 0 -Handler_read_rnd_next 2 +Handler_read_rnd_next 1 explain SELECT distinct t1.a from t1; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index PRIMARY PRIMARY 4 NULL 4 Using index diff --git a/mysql-wsrep-5.6/mysql-test/r/dynamic_tracing.result b/mysql-wsrep-5.6/mysql-test/r/dynamic_tracing.result new file mode 100644 index 00000000..28d1576c --- /dev/null +++ b/mysql-wsrep-5.6/mysql-test/r/dynamic_tracing.result @@ -0,0 +1,39 @@ +CREATE PROCEDURE create_table_and_insert_rows() +BEGIN +DECLARE count INT; +SET count = 1; +SELECT SLEEP(10); +CREATE TABLE t1 (f1 INT); +INSERT INTO t1 VALUES (7894); +WHILE count <= 5 DO +INSERT INTO t1 SELECT * FROM t1; +SET count = count + 1; +END WHILE; +SET count = 1; +WHILE count <= 10000 DO +SELECT SQL_NO_CACHE count(*) from t1; +SET count = count + 1; +END WHILE; +END +$ +CALL create_table_and_insert_rows(); +SELECT SLEEP(4); + + Dynamic tracing ...... started. + + query-parse-start : 1 + query-parse-done : 1 + select-start : 1 + select-done : 1 + net-read-start : 1 + net-read-done : 1 + handler_rdlock_start : 1 + handler_rdlock_done : 1 + + Expected probe hits : 8 + Actual probe hits : 8 + + Dynamic tracing ...... completed. + +DROP TABLE t1; +DROP PROCEDURE create_table_and_insert_rows; diff --git a/mysql-wsrep-5.6/mysql-test/r/events_bugs.result b/mysql-wsrep-5.6/mysql-test/r/events_bugs.result index 4447f96f..8aad6f8d 100644 --- a/mysql-wsrep-5.6/mysql-test/r/events_bugs.result +++ b/mysql-wsrep-5.6/mysql-test/r/events_bugs.result @@ -728,6 +728,10 @@ DROP USER mysqltest_u1@localhost; drop procedure if exists p; set @old_mode= @@sql_mode; set @@sql_mode= cast(pow(2,32)-1 as unsigned integer); +Warnings: +Warning 1681 'ERROR_FOR_DIVISION_BY_ZERO' is deprecated and will be removed in a future release. +Warning 1681 'NO_ZERO_DATE' is deprecated and will be removed in a future release. +Warning 1681 'NO_ZERO_IN_DATE' is deprecated and will be removed in a future release. create event e1 on schedule every 1 day do select 1; select @@sql_mode into @full_mode; set @@sql_mode= @old_mode; diff --git a/mysql-wsrep-5.6/mysql-test/r/file_contents.result b/mysql-wsrep-5.6/mysql-test/r/file_contents.result index 110769e1..0b0d5d59 100644 --- a/mysql-wsrep-5.6/mysql-test/r/file_contents.result +++ b/mysql-wsrep-5.6/mysql-test/r/file_contents.result @@ -1,6 +1,6 @@ Checking 'INFO_SRC' and 'INFO_BIN' -INFO_SRC: Found MySQL version number / Found BZR revision id +INFO_SRC: Found MySQL version number / Found GIT revision id INFO_BIN: Found 'Compiler ... used' line / Found 'Feature flags' line End of tests diff --git a/mysql-wsrep-5.6/mysql-test/r/func_aes.result b/mysql-wsrep-5.6/mysql-test/r/func_aes.result new file mode 100644 index 00000000..5bede7f2 --- /dev/null +++ b/mysql-wsrep-5.6/mysql-test/r/func_aes.result @@ -0,0 +1,411 @@ +# Tests of the AES functionality +# +# WL#6781: Support multiple AES encryption modes +# +#### AES_ENCRYPT return type +# must be aes-128-ecb +SELECT @@block_encryption_mode; +@@block_encryption_mode +aes-128-ecb +# must work and return a string +SELECT TO_BASE64(AES_ENCRYPT('a', 'b')); +TO_BASE64(AES_ENCRYPT('a', 'b')) +VIE8melxXCgTE0xsFy5JTg== +# must return 16 +SELECT LENGTH(AES_ENCRYPT('a', 'b')); +LENGTH(AES_ENCRYPT('a', 'b')) +16 +# must return binary +SELECT CHARSET(AES_ENCRYPT('a', 'b')); +CHARSET(AES_ENCRYPT('a', 'b')) +binary +# must be equal +SELECT AES_ENCRYPT('a', 'b') = AES_ENCRYPT('a', 'b'); +AES_ENCRYPT('a', 'b') = AES_ENCRYPT('a', 'b') +1 +#### AES_ENCRYPT parameters +# must return NULL +SELECT AES_ENCRYPT('a', NULL); +AES_ENCRYPT('a', NULL) +NULL +SELECT AES_ENCRYPT(NULL, 'a'); +AES_ENCRYPT(NULL, 'a') +NULL +SELECT AES_ENCRYPT(NULL, NULL); +AES_ENCRYPT(NULL, NULL) +NULL +# must return value +SELECT TO_BASE64(AES_ENCRYPT('a', 0)); +TO_BASE64(AES_ENCRYPT('a', 0)) +aYJapBqdtJb5LdZYNnyvSQ== +SELECT TO_BASE64(AES_ENCRYPT('a', 12.04)); +TO_BASE64(AES_ENCRYPT('a', 12.04)) +zsb8jPtLNXiWI5Kzwf0V0A== +SELECT TO_BASE64(AES_ENCRYPT(0, 'a')); +TO_BASE64(AES_ENCRYPT(0, 'a')) +6k2i7KJUMBKiOkGToSMgxg== +SELECT TO_BASE64(AES_ENCRYPT(12.04, 'a')); +TO_BASE64(AES_ENCRYPT(12.04, 'a')) +TXCHis1z3ZT2p2daWZfwLg== +SELECT TO_BASE64(AES_ENCRYPT(0, 0)); +TO_BASE64(AES_ENCRYPT(0, 0)) +Nop3grbtyVAOy+Ycpyx7RA== +SELECT TO_BASE64(AES_ENCRYPT(12.04, 12.04)); +TO_BASE64(AES_ENCRYPT(12.04, 12.04)) +W4FA3x/RuDuacxCfEQY4pQ== +#### parameter conversion +must be equal +SELECT AES_ENCRYPT('a', 12.04) = AES_ENCRYPT('a', '12.04'); +AES_ENCRYPT('a', 12.04) = AES_ENCRYPT('a', '12.04') +1 +SELECT AES_ENCRYPT('a', 0) = AES_ENCRYPT('a', '0'); +AES_ENCRYPT('a', 0) = AES_ENCRYPT('a', '0') +1 +SELECT AES_ENCRYPT(12.04, 'a') = AES_ENCRYPT('12.04', 'a'); +AES_ENCRYPT(12.04, 'a') = AES_ENCRYPT('12.04', 'a') +1 +SELECT AES_ENCRYPT(0, 'a') = AES_ENCRYPT('0', 'a'); +AES_ENCRYPT(0, 'a') = AES_ENCRYPT('0', 'a') +1 +SELECT AES_ENCRYPT('\x0Z', 'a') = AES_ENCRYPT('\x0Z', 'a'); +AES_ENCRYPT('\x0Z', 'a') = AES_ENCRYPT('\x0Z', 'a') +1 +SELECT AES_ENCRYPT('a', '\x0Z') = AES_ENCRYPT('a', '\x0Z'); +AES_ENCRYPT('a', '\x0Z') = AES_ENCRYPT('a', '\x0Z') +1 +# must not be equal +SELECT AES_ENCRYPT('a', '\x0Y') = AES_ENCRYPT('a', '\x0Z'); +AES_ENCRYPT('a', '\x0Y') = AES_ENCRYPT('a', '\x0Z') +0 +SELECT AES_ENCRYPT('\x0Y', 'a') = AES_ENCRYPT('\x0Z', 'a'); +AES_ENCRYPT('\x0Y', 'a') = AES_ENCRYPT('\x0Z', 'a') +0 +#### algorithm +# must not be equal +SELECT AES_ENCRYPT('a', 'a') = AES_ENCRYPT('b', 'a'); +AES_ENCRYPT('a', 'a') = AES_ENCRYPT('b', 'a') +0 +SELECT AES_ENCRYPT('a', 'a') = AES_ENCRYPT('a', 'b'); +AES_ENCRYPT('a', 'a') = AES_ENCRYPT('a', 'b') +0 +SELECT AES_ENCRYPT('a', 'a') = AES_ENCRYPT('aa', 'a'); +AES_ENCRYPT('a', 'a') = AES_ENCRYPT('aa', 'a') +0 +SELECT AES_ENCRYPT('a', 'a') = AES_ENCRYPT('a', 'aa'); +AES_ENCRYPT('a', 'a') = AES_ENCRYPT('a', 'aa') +0 +SELECT AES_ENCRYPT('a', 'a') = AES_ENCRYPT(REPEAT('a',1000), 'a'); +AES_ENCRYPT('a', 'a') = AES_ENCRYPT(REPEAT('a',1000), 'a') +0 +SELECT AES_ENCRYPT('a', 'a') = AES_ENCRYPT('a', REPEAT('a',1000)); +AES_ENCRYPT('a', 'a') = AES_ENCRYPT('a', REPEAT('a',1000)) +0 +#### persistense +CREATE TABLE t1 (a BINARY(16) PRIMARY KEY); +# must pass without a warning +INSERT INTO t1 VALUES (AES_ENCRYPT('a','a')); +# must fail +INSERT INTO t1 VALUES (AES_ENCRYPT('a','a')); +ERROR 23000: Duplicate entry '{ W]\xA1\x06u\x9D\xBD\xB1\xA3.\xE2\xD9\xA7t' for key 'PRIMARY' +# must pass +INSERT INTO t1 VALUES (AES_ENCRYPT('b','a')); +# must return 1 +SELECT COUNT(*) FROM t1 WHERE a = AES_ENCRYPT('a', 'a'); +COUNT(*) +1 +# must return 1 +SELECT COUNT(*) FROM t1 WHERE a = AES_ENCRYPT('b', 'a'); +COUNT(*) +1 +# must return 0 +SELECT COUNT(*) FROM t1 WHERE a = AES_ENCRYPT('c', 'a'); +COUNT(*) +0 +SELECT COUNT(*) FROM t1 WHERE a = AES_ENCRYPT('a', 'c'); +COUNT(*) +0 +SELECT TO_BASE64(a) FROM t1 ORDER BY a; +TO_BASE64(a) +eyBXXaEGdZ29saMu4tmndA== +nZ4GgEfF5ib3dWk0Is8MFw== +# cleanup +DROP TABLE t1; +#### IV +# must be equal +SELECT AES_ENCRYPT('a', 'a') = AES_ENCRYPT('a', 'a', REPEAT('a', 16)); +AES_ENCRYPT('a', 'a') = AES_ENCRYPT('a', 'a', REPEAT('a', 16)) +1 +Warnings: +Warning 1618 option ignored +SELECT AES_ENCRYPT('a', 'a') = AES_ENCRYPT('a', 'a', REPEAT('b', 16)); +AES_ENCRYPT('a', 'a') = AES_ENCRYPT('a', 'a', REPEAT('b', 16)) +1 +Warnings: +Warning 1618 option ignored +# must return a warning +SELECT TO_BASE64(AES_ENCRYPT('a', 'a', 'a')); +TO_BASE64(AES_ENCRYPT('a', 'a', 'a')) +eyBXXaEGdZ29saMu4tmndA== +Warnings: +Warning 1618 option ignored +# must pass +SELECT TO_BASE64(AES_ENCRYPT('a', 'a', NULL)); +TO_BASE64(AES_ENCRYPT('a', 'a', NULL)) +eyBXXaEGdZ29saMu4tmndA== +Warnings: +Warning 1618 option ignored +SELECT TO_BASE64(AES_ENCRYPT('a', 'a', REPEAT('a', 1024))); +TO_BASE64(AES_ENCRYPT('a', 'a', REPEAT('a', 1024))) +eyBXXaEGdZ29saMu4tmndA== +Warnings: +Warning 1618 option ignored +SELECT TO_BASE64(AES_ENCRYPT('a', 'a', RANDOM_BYTES(16))); +TO_BASE64(AES_ENCRYPT('a', 'a', RANDOM_BYTES(16))) +eyBXXaEGdZ29saMu4tmndA== +Warnings: +Warning 1618 option ignored +#### RANDOM_BYTES +# must be 1 +SELECT LENGTH(RANDOM_BYTES(1)); +LENGTH(RANDOM_BYTES(1)) +1 +# must return binary +SELECT CHARSET(RANDOM_BYTES(1)); +CHARSET(RANDOM_BYTES(1)) +binary +# must return an error +SELECT RANDOM_BYTES(1000000000000); +ERROR 22003: length value is out of range in 'random_bytes' +SELECT LENGTH(RANDOM_BYTES(0)); +ERROR 22003: length value is out of range in 'random_bytes' +#### AES_DECRYPT +# must return binary +SELECT CHARSET(AES_DECRYPT(AES_ENCRYPT('a', 'a'), 'a')); +CHARSET(AES_DECRYPT(AES_ENCRYPT('a', 'a'), 'a')) +binary +# must return 1 +SELECT LENGTH(AES_DECRYPT(AES_ENCRYPT('a', 'a'), 'a')); +LENGTH(AES_DECRYPT(AES_ENCRYPT('a', 'a'), 'a')) +1 +# must be equal +SELECT AES_DECRYPT(AES_ENCRYPT('a','a'), 'a') = 'a'; +AES_DECRYPT(AES_ENCRYPT('a','a'), 'a') = 'a' +1 +# must be equal +SELECT AES_DECRYPT(AES_ENCRYPT(_UTF8'Жоро', 'a'), 'a') = _UTF8'Жоро'; +AES_DECRYPT(AES_ENCRYPT(_UTF8'Жоро', 'a'), 'a') = _UTF8'Жоро' +1 +SELECT AES_DECRYPT(AES_ENCRYPT('Жоро', 'a'), 'a') = 'Жоро'; +AES_DECRYPT(AES_ENCRYPT('Жоро', 'a'), 'a') = 'Жоро' +1 +# must be NULL +SELECT AES_DECRYPT(NULL, 'a'); +AES_DECRYPT(NULL, 'a') +NULL +SELECT AES_DECRYPT('a', NULL); +AES_DECRYPT('a', NULL) +NULL +SELECT AES_DECRYPT(NULL, NULL); +AES_DECRYPT(NULL, NULL) +NULL +#### AES_DECRYPT IV +# must be equal +SELECT 'a' = AES_DECRYPT(AES_ENCRYPT('a', 'a'), 'a', NULL); +'a' = AES_DECRYPT(AES_ENCRYPT('a', 'a'), 'a', NULL) +1 +Warnings: +Warning 1618 option ignored +SELECT 'a' = AES_DECRYPT(AES_ENCRYPT('a', 'a'), 'a', REPEAT('a',16)); +'a' = AES_DECRYPT(AES_ENCRYPT('a', 'a'), 'a', REPEAT('a',16)) +1 +Warnings: +Warning 1618 option ignored +SELECT 'a' = AES_DECRYPT(AES_ENCRYPT('a', 'a'), 'a', REPEAT('a',100)); +'a' = AES_DECRYPT(AES_ENCRYPT('a', 'a'), 'a', REPEAT('a',100)) +1 +Warnings: +Warning 1618 option ignored +# must return a warning +SELECT TO_BASE64(AES_DECRYPT(AES_ENCRYPT('a', 'a'), 'a', 'a')); +TO_BASE64(AES_DECRYPT(AES_ENCRYPT('a', 'a'), 'a', 'a')) +YQ== +Warnings: +Warning 1618 option ignored +#### 128, 192 and 256 bit ECB +CREATE TABLE aes_ecb(a VARCHAR(16), b128 CHAR(16), b192 CHAR(16), b256 CHAR(16)); +INSERT INTO aes_ecb (a) VALUES ('a'), ('Жоро'), (REPEAT('a', 10)); +SET SESSION block_encryption_mode='aes-128-ecb'; +UPDATE aes_ecb SET b128 = AES_ENCRYPT(a, 'a'); +SET SESSION block_encryption_mode='aes-192-ecb'; +UPDATE aes_ecb SET b192 = AES_ENCRYPT(a, 'a'); +SET SESSION block_encryption_mode='aes-256-ecb'; +UPDATE aes_ecb SET b256 = AES_ENCRYPT(a, 'a'); +# must return 0 +SELECT COUNT(*) FROM aes_ecb WHERE b128 = b192 OR B192 = b256 OR b128=b256; +COUNT(*) +0 +SET SESSION block_encryption_mode='aes-256-ecb'; +# must return 3 +SELECT COUNT(*) FROM aes_ecb WHERE a = AES_DECRYPT(b256, 'a'); +COUNT(*) +3 +# must return 0 +SELECT COUNT(*) FROM aes_ecb WHERE a = AES_DECRYPT(b256, 'b'); +COUNT(*) +0 +SET SESSION block_encryption_mode='aes-192-ecb'; +# must return 3 +SELECT COUNT(*) FROM aes_ecb WHERE a = AES_DECRYPT(b192, 'a'); +COUNT(*) +3 +# must return 0 +SELECT COUNT(*) FROM aes_ecb WHERE a = AES_DECRYPT(b192, 'b'); +COUNT(*) +0 +SET SESSION block_encryption_mode='aes-128-ecb'; +# must return 3 +SELECT COUNT(*) FROM aes_ecb WHERE a = AES_DECRYPT(b128, 'a'); +COUNT(*) +3 +# must return 0 +SELECT COUNT(*) FROM aes_ecb WHERE a = AES_DECRYPT(b128, 'b'); +COUNT(*) +0 +SET SESSION block_encryption_mode=DEFAULT; +DROP TABLE aes_ecb; +#### cbc +SET @IVA=REPEAT('a', 16); +SET @IVB=REPEAT('b', 16); +SET @KEY1=REPEAT('c', 16); +SET @KEY2=REPEAT('d', 16); +#### 128-cbc +SET SESSION block_encryption_mode="aes-128-cbc"; +# must throw an error without an IV +SELECT AES_ENCRYPT('a', @KEY1); +ERROR 42000: Incorrect parameter count in the call to native function 'aes_encrypt' +block mode dependent. Must be non-0 and non-null +SELECT LENGTH(AES_ENCRYPT('a', @KEY1, @IVA)); +LENGTH(AES_ENCRYPT('a', @KEY1, @IVA)) +16 +block mode dependent +SELECT TO_BASE64(AES_ENCRYPT('a', @KEY1, @IVA)); +TO_BASE64(AES_ENCRYPT('a', @KEY1, @IVA)) +EDJBpPTlIfYc8nytlcwy0Q== +# must be equal +SELECT 'a' = AES_DECRYPT(AES_ENCRYPT('a', @KEY1, @IVA), @KEY1, @IVA); +'a' = AES_DECRYPT(AES_ENCRYPT('a', @KEY1, @IVA), @KEY1, @IVA) +1 +# must not be equal +SELECT 'a' = AES_DECRYPT(AES_ENCRYPT('a',@KEY1, @IVA), @KEY1, @IVB); +'a' = AES_DECRYPT(AES_ENCRYPT('a',@KEY1, @IVA), @KEY1, @IVB) +0 +SELECT 'a' = AES_DECRYPT(AES_ENCRYPT('a',@KEY1, @IVA), @KEY2, @IVA); +'a' = AES_DECRYPT(AES_ENCRYPT('a',@KEY1, @IVA), @KEY2, @IVA) +NULL +SELECT 'a' = AES_DECRYPT(AES_ENCRYPT('b',@KEY1, @IVA), @KEY1, @IVA); +'a' = AES_DECRYPT(AES_ENCRYPT('b',@KEY1, @IVA), @KEY1, @IVA) +0 +#### 192-cbc +SET SESSION block_encryption_mode="aes-192-cbc"; +# must throw an error without an IV +SELECT AES_ENCRYPT('a', @KEY1); +ERROR 42000: Incorrect parameter count in the call to native function 'aes_encrypt' +# must be equal +SELECT 'a' = AES_DECRYPT(AES_ENCRYPT('a',@KEY1, @IVA), @KEY1, @IVA); +'a' = AES_DECRYPT(AES_ENCRYPT('a',@KEY1, @IVA), @KEY1, @IVA) +1 +# must not be equal +SELECT 'a' = AES_DECRYPT(AES_ENCRYPT('a',@KEY1, @IVA), @KEY1, @IVB); +'a' = AES_DECRYPT(AES_ENCRYPT('a',@KEY1, @IVA), @KEY1, @IVB) +0 +SELECT 'a' = AES_DECRYPT(AES_ENCRYPT('a',@KEY1, @IVA), @KEY2, @IVA); +'a' = AES_DECRYPT(AES_ENCRYPT('a',@KEY1, @IVA), @KEY2, @IVA) +NULL +SELECT 'a' = AES_DECRYPT(AES_ENCRYPT('b',@KEY1, @IVA), @KEY1, @IVA); +'a' = AES_DECRYPT(AES_ENCRYPT('b',@KEY1, @IVA), @KEY1, @IVA) +0 +#### 256-cbc +SET SESSION block_encryption_mode="aes-256-cbc"; +# must throw an error without an IV +SELECT AES_ENCRYPT('a', @KEY1); +ERROR 42000: Incorrect parameter count in the call to native function 'aes_encrypt' +# must be equal +SELECT 'a' = AES_DECRYPT(AES_ENCRYPT('a',@KEY1, @IVA), @KEY1, @IVA); +'a' = AES_DECRYPT(AES_ENCRYPT('a',@KEY1, @IVA), @KEY1, @IVA) +1 +# must not be equal +SELECT 'a' = AES_DECRYPT(AES_ENCRYPT('a',@KEY1, @IVA), @KEY1, @IVB); +'a' = AES_DECRYPT(AES_ENCRYPT('a',@KEY1, @IVA), @KEY1, @IVB) +0 +SELECT 'a' = AES_DECRYPT(AES_ENCRYPT('a',@KEY1, @IVA), @KEY2, @IVA); +'a' = AES_DECRYPT(AES_ENCRYPT('a',@KEY1, @IVA), @KEY2, @IVA) +NULL +SELECT 'a' = AES_DECRYPT(AES_ENCRYPT('b',@KEY1, @IVA), @KEY1, @IVA); +'a' = AES_DECRYPT(AES_ENCRYPT('b',@KEY1, @IVA), @KEY1, @IVA) +0 +SET SESSION block_encryption_mode=DEFAULT; +#### 128, 192 and 256 bit cbc +CREATE TABLE aes_cbc(a VARCHAR(128), b128 VARCHAR(144), +b192 VARCHAR(144), b256 CHAR(144)); +INSERT INTO aes_cbc (a) VALUES (REPEAT('a', 128)); +INSERT INTO aes_cbc (a) VALUES (REPEAT(0x00313233, 32)); +SET SESSION block_encryption_mode="aes-128-cbc"; +UPDATE aes_cbc SET b128 = AES_ENCRYPT(a, @KEY1, @IVA); +SET SESSION block_encryption_mode="aes-192-cbc"; +UPDATE aes_cbc SET b192 = AES_ENCRYPT(a, @KEY1, @IVA); +SET SESSION block_encryption_mode="aes-256-cbc"; +UPDATE aes_cbc SET b256 = AES_ENCRYPT(a, @KEY1, @IVA); +# must return 0 +SELECT COUNT(*) FROM aes_cbc WHERE b128 = b192 OR B192 = b256 OR b128=b256; +COUNT(*) +0 +SET SESSION block_encryption_mode="aes-256-cbc"; +# must return 2 +SELECT COUNT(*) FROM aes_cbc WHERE a = AES_DECRYPT(b256, @KEY1, @IVA); +COUNT(*) +2 +# must return 0 +SELECT COUNT(*) FROM aes_cbc WHERE a = AES_DECRYPT(b256, 'b', @IVA); +COUNT(*) +0 +# must return 0 +SELECT COUNT(*) FROM aes_cbc WHERE a = AES_DECRYPT(b256, @KEY1, @IVB); +COUNT(*) +0 +SET SESSION block_encryption_mode="aes-192-cbc"; +# must return 2 +SELECT COUNT(*) FROM aes_cbc WHERE a = AES_DECRYPT(b192, @KEY1, @IVA); +COUNT(*) +2 +# must return 0 +SELECT COUNT(*) FROM aes_cbc WHERE a = AES_DECRYPT(b192, @KEY2, @IVA); +COUNT(*) +0 +# must return 0 +SELECT COUNT(*) FROM aes_cbc WHERE a = AES_DECRYPT(b256, @KEY1, @IVB); +COUNT(*) +0 +SET SESSION block_encryption_mode="aes-128-cbc"; +# must return 2 +SELECT COUNT(*) FROM aes_cbc WHERE a = AES_DECRYPT(b128, @KEY1, @IVA); +COUNT(*) +2 +# must return 0 +SELECT COUNT(*) FROM aes_cbc WHERE a = AES_DECRYPT(b128, @KEY2, @IVA); +COUNT(*) +0 +# must return 0 +SELECT COUNT(*) FROM aes_cbc WHERE a = AES_DECRYPT(b256, @KEY2, @IVB); +COUNT(*) +0 +SET SESSION block_encryption_mode=DEFAULT; +DROP TABLE aes_cbc; +# +# Bug #18259229: SERVER CRASHES WITH THE FUNCTION RANDOM_BYTES() +# +# INT_MAX - 9 (terminating 0 + rounding). Should not crash +SELECT RANDOM_BYTES(2147483647 - 9); +ERROR 22003: length value is out of range in 'random_bytes' +# +# End of 5.7 tests +# diff --git a/mysql-wsrep-5.6/mysql-test/r/func_aes_cfb1.result b/mysql-wsrep-5.6/mysql-test/r/func_aes_cfb1.result new file mode 100644 index 00000000..2667d46f --- /dev/null +++ b/mysql-wsrep-5.6/mysql-test/r/func_aes_cfb1.result @@ -0,0 +1,132 @@ +# Tests of the AES CFB1 block mode +#### cfb1 +SET @IVA=REPEAT('a', 16); +SET @IVB=REPEAT('b', 16); +SET @KEY1=REPEAT('c', 16); +SET @KEY2=REPEAT('d', 16); +#### 128-cfb1 +SET SESSION block_encryption_mode="aes-128-cfb1"; +# must throw an error without an IV +SELECT AES_ENCRYPT('a', @KEY1); +ERROR 42000: Incorrect parameter count in the call to native function 'aes_encrypt' +block mode dependent. Must be non-0 and non-null +SELECT LENGTH(AES_ENCRYPT('a', @KEY1, @IVA)); +LENGTH(AES_ENCRYPT('a', @KEY1, @IVA)) +1 +block mode dependent +SELECT TO_BASE64(AES_ENCRYPT('a', @KEY1, @IVA)); +TO_BASE64(AES_ENCRYPT('a', @KEY1, @IVA)) +eg== +# must be equal +SELECT 'a' = AES_DECRYPT(AES_ENCRYPT('a', @KEY1, @IVA), @KEY1, @IVA); +'a' = AES_DECRYPT(AES_ENCRYPT('a', @KEY1, @IVA), @KEY1, @IVA) +1 +# must not be equal +SELECT 'a' = AES_DECRYPT(AES_ENCRYPT('a',@KEY1, @IVA), @KEY1, @IVB); +'a' = AES_DECRYPT(AES_ENCRYPT('a',@KEY1, @IVA), @KEY1, @IVB) +0 +SELECT 'a' = AES_DECRYPT(AES_ENCRYPT('a',@KEY1, @IVA), @KEY2, @IVA); +'a' = AES_DECRYPT(AES_ENCRYPT('a',@KEY1, @IVA), @KEY2, @IVA) +0 +SELECT 'a' = AES_DECRYPT(AES_ENCRYPT('b',@KEY1, @IVA), @KEY1, @IVA); +'a' = AES_DECRYPT(AES_ENCRYPT('b',@KEY1, @IVA), @KEY1, @IVA) +0 +#### 192-cfb1 +SET SESSION block_encryption_mode="aes-192-cfb1"; +# must throw an error without an IV +SELECT AES_ENCRYPT('a', @KEY1); +ERROR 42000: Incorrect parameter count in the call to native function 'aes_encrypt' +# must be equal +SELECT 'a' = AES_DECRYPT(AES_ENCRYPT('a',@KEY1, @IVA), @KEY1, @IVA); +'a' = AES_DECRYPT(AES_ENCRYPT('a',@KEY1, @IVA), @KEY1, @IVA) +1 +# must not be equal +SELECT 'a' = AES_DECRYPT(AES_ENCRYPT('a',@KEY1, @IVA), @KEY1, @IVB); +'a' = AES_DECRYPT(AES_ENCRYPT('a',@KEY1, @IVA), @KEY1, @IVB) +0 +SELECT 'a' = AES_DECRYPT(AES_ENCRYPT('a',@KEY1, @IVA), @KEY2, @IVA); +'a' = AES_DECRYPT(AES_ENCRYPT('a',@KEY1, @IVA), @KEY2, @IVA) +0 +SELECT 'a' = AES_DECRYPT(AES_ENCRYPT('b',@KEY1, @IVA), @KEY1, @IVA); +'a' = AES_DECRYPT(AES_ENCRYPT('b',@KEY1, @IVA), @KEY1, @IVA) +0 +#### 256-cfb1 +SET SESSION block_encryption_mode="aes-256-cfb1"; +# must throw an error without an IV +SELECT AES_ENCRYPT('a', @KEY1); +ERROR 42000: Incorrect parameter count in the call to native function 'aes_encrypt' +# must be equal +SELECT 'a' = AES_DECRYPT(AES_ENCRYPT('a',@KEY1, @IVA), @KEY1, @IVA); +'a' = AES_DECRYPT(AES_ENCRYPT('a',@KEY1, @IVA), @KEY1, @IVA) +1 +# must not be equal +SELECT 'a' = AES_DECRYPT(AES_ENCRYPT('a',@KEY1, @IVA), @KEY1, @IVB); +'a' = AES_DECRYPT(AES_ENCRYPT('a',@KEY1, @IVA), @KEY1, @IVB) +0 +SELECT 'a' = AES_DECRYPT(AES_ENCRYPT('a',@KEY1, @IVA), @KEY2, @IVA); +'a' = AES_DECRYPT(AES_ENCRYPT('a',@KEY1, @IVA), @KEY2, @IVA) +0 +SELECT 'a' = AES_DECRYPT(AES_ENCRYPT('b',@KEY1, @IVA), @KEY1, @IVA); +'a' = AES_DECRYPT(AES_ENCRYPT('b',@KEY1, @IVA), @KEY1, @IVA) +0 +SET SESSION block_encryption_mode=DEFAULT; +#### 128, 192 and 256 bit cfb1 +CREATE TABLE aes_cfb1(a VARCHAR(128), b128 VARCHAR(144), +b192 VARCHAR(144), b256 CHAR(144)); +INSERT INTO aes_cfb1 (a) VALUES (REPEAT('a', 128)); +INSERT INTO aes_cfb1 (a) VALUES (REPEAT(0x00313233, 32)); +SET SESSION block_encryption_mode="aes-128-cfb1"; +UPDATE aes_cfb1 SET b128 = AES_ENCRYPT(a, @KEY1, @IVA); +SET SESSION block_encryption_mode="aes-192-cfb1"; +UPDATE aes_cfb1 SET b192 = AES_ENCRYPT(a, @KEY1, @IVA); +SET SESSION block_encryption_mode="aes-256-cfb1"; +UPDATE aes_cfb1 SET b256 = AES_ENCRYPT(a, @KEY1, @IVA); +# must return 0 +SELECT COUNT(*) FROM aes_cfb1 WHERE b128 = b192 OR B192 = b256 OR b128=b256; +COUNT(*) +0 +SET SESSION block_encryption_mode="aes-256-cfb1"; +# must return 2 +SELECT COUNT(*) FROM aes_cfb1 WHERE a = AES_DECRYPT(b256, @KEY1, @IVA); +COUNT(*) +2 +# must return 0 +SELECT COUNT(*) FROM aes_cfb1 WHERE a = AES_DECRYPT(b256, 'b', @IVA); +COUNT(*) +0 +# must return 0 +SELECT COUNT(*) FROM aes_cfb1 WHERE a = AES_DECRYPT(b256, @KEY1, @IVB); +COUNT(*) +0 +SET SESSION block_encryption_mode="aes-192-cfb1"; +# must return 2 +SELECT COUNT(*) FROM aes_cfb1 WHERE a = AES_DECRYPT(b192, @KEY1, @IVA); +COUNT(*) +2 +# must return 0 +SELECT COUNT(*) FROM aes_cfb1 WHERE a = AES_DECRYPT(b192, @KEY2, @IVA); +COUNT(*) +0 +# must return 0 +SELECT COUNT(*) FROM aes_cfb1 WHERE a = AES_DECRYPT(b256, @KEY1, @IVB); +COUNT(*) +0 +SET SESSION block_encryption_mode="aes-128-cfb1"; +# must return 2 +SELECT COUNT(*) FROM aes_cfb1 WHERE a = AES_DECRYPT(b128, @KEY1, @IVA); +COUNT(*) +2 +# must return 0 +SELECT COUNT(*) FROM aes_cfb1 WHERE a = AES_DECRYPT(b128, @KEY2, @IVA); +COUNT(*) +0 +# must return 0 +SELECT COUNT(*) FROM aes_cfb1 WHERE a = AES_DECRYPT(b256, @KEY2, @IVB); +COUNT(*) +0 +SET SESSION block_encryption_mode=DEFAULT; +DROP TABLE aes_cfb1; +SET SESSION block_encryption_mode=default; +# +# End of 5.7 tests +# diff --git a/mysql-wsrep-5.6/mysql-test/r/func_aes_cfb128.result b/mysql-wsrep-5.6/mysql-test/r/func_aes_cfb128.result new file mode 100644 index 00000000..9098052c --- /dev/null +++ b/mysql-wsrep-5.6/mysql-test/r/func_aes_cfb128.result @@ -0,0 +1,132 @@ +# Tests of the AES CFB128 block mode +#### cfb128 +SET @IVA=REPEAT('a', 16); +SET @IVB=REPEAT('b', 16); +SET @KEY1=REPEAT('c', 16); +SET @KEY2=REPEAT('d', 16); +#### 128-cfb128 +SET SESSION block_encryption_mode="aes-128-cfb128"; +# must throw an error without an IV +SELECT AES_ENCRYPT('a', @KEY1); +ERROR 42000: Incorrect parameter count in the call to native function 'aes_encrypt' +block mode dependent. Must be non-0 and non-null +SELECT LENGTH(AES_ENCRYPT('a', @KEY1, @IVA)); +LENGTH(AES_ENCRYPT('a', @KEY1, @IVA)) +1 +block mode dependent +SELECT TO_BASE64(AES_ENCRYPT('a', @KEY1, @IVA)); +TO_BASE64(AES_ENCRYPT('a', @KEY1, @IVA)) +Pw== +# must be equal +SELECT 'a' = AES_DECRYPT(AES_ENCRYPT('a', @KEY1, @IVA), @KEY1, @IVA); +'a' = AES_DECRYPT(AES_ENCRYPT('a', @KEY1, @IVA), @KEY1, @IVA) +1 +# must not be equal +SELECT 'a' = AES_DECRYPT(AES_ENCRYPT('a',@KEY1, @IVA), @KEY1, @IVB); +'a' = AES_DECRYPT(AES_ENCRYPT('a',@KEY1, @IVA), @KEY1, @IVB) +0 +SELECT 'a' = AES_DECRYPT(AES_ENCRYPT('a',@KEY1, @IVA), @KEY2, @IVA); +'a' = AES_DECRYPT(AES_ENCRYPT('a',@KEY1, @IVA), @KEY2, @IVA) +0 +SELECT 'a' = AES_DECRYPT(AES_ENCRYPT('b',@KEY1, @IVA), @KEY1, @IVA); +'a' = AES_DECRYPT(AES_ENCRYPT('b',@KEY1, @IVA), @KEY1, @IVA) +0 +#### 192-cfb128 +SET SESSION block_encryption_mode="aes-192-cfb128"; +# must throw an error without an IV +SELECT AES_ENCRYPT('a', @KEY1); +ERROR 42000: Incorrect parameter count in the call to native function 'aes_encrypt' +# must be equal +SELECT 'a' = AES_DECRYPT(AES_ENCRYPT('a',@KEY1, @IVA), @KEY1, @IVA); +'a' = AES_DECRYPT(AES_ENCRYPT('a',@KEY1, @IVA), @KEY1, @IVA) +1 +# must not be equal +SELECT 'a' = AES_DECRYPT(AES_ENCRYPT('a',@KEY1, @IVA), @KEY1, @IVB); +'a' = AES_DECRYPT(AES_ENCRYPT('a',@KEY1, @IVA), @KEY1, @IVB) +0 +SELECT 'a' = AES_DECRYPT(AES_ENCRYPT('a',@KEY1, @IVA), @KEY2, @IVA); +'a' = AES_DECRYPT(AES_ENCRYPT('a',@KEY1, @IVA), @KEY2, @IVA) +0 +SELECT 'a' = AES_DECRYPT(AES_ENCRYPT('b',@KEY1, @IVA), @KEY1, @IVA); +'a' = AES_DECRYPT(AES_ENCRYPT('b',@KEY1, @IVA), @KEY1, @IVA) +0 +#### 256-cfb128 +SET SESSION block_encryption_mode="aes-256-cfb128"; +# must throw an error without an IV +SELECT AES_ENCRYPT('a', @KEY1); +ERROR 42000: Incorrect parameter count in the call to native function 'aes_encrypt' +# must be equal +SELECT 'a' = AES_DECRYPT(AES_ENCRYPT('a',@KEY1, @IVA), @KEY1, @IVA); +'a' = AES_DECRYPT(AES_ENCRYPT('a',@KEY1, @IVA), @KEY1, @IVA) +1 +# must not be equal +SELECT 'a' = AES_DECRYPT(AES_ENCRYPT('a',@KEY1, @IVA), @KEY1, @IVB); +'a' = AES_DECRYPT(AES_ENCRYPT('a',@KEY1, @IVA), @KEY1, @IVB) +0 +SELECT 'a' = AES_DECRYPT(AES_ENCRYPT('a',@KEY1, @IVA), @KEY2, @IVA); +'a' = AES_DECRYPT(AES_ENCRYPT('a',@KEY1, @IVA), @KEY2, @IVA) +0 +SELECT 'a' = AES_DECRYPT(AES_ENCRYPT('b',@KEY1, @IVA), @KEY1, @IVA); +'a' = AES_DECRYPT(AES_ENCRYPT('b',@KEY1, @IVA), @KEY1, @IVA) +0 +SET SESSION block_encryption_mode=DEFAULT; +#### 128, 192 and 256 bit cfb128 +CREATE TABLE aes_cfb128(a VARCHAR(128), b128 VARCHAR(144), +b192 VARCHAR(144), b256 CHAR(144)); +INSERT INTO aes_cfb128 (a) VALUES (REPEAT('a', 128)); +INSERT INTO aes_cfb128 (a) VALUES (REPEAT(0x00313233, 32)); +SET SESSION block_encryption_mode="aes-128-cfb128"; +UPDATE aes_cfb128 SET b128 = AES_ENCRYPT(a, @KEY1, @IVA); +SET SESSION block_encryption_mode="aes-192-cfb128"; +UPDATE aes_cfb128 SET b192 = AES_ENCRYPT(a, @KEY1, @IVA); +SET SESSION block_encryption_mode="aes-256-cfb128"; +UPDATE aes_cfb128 SET b256 = AES_ENCRYPT(a, @KEY1, @IVA); +# must return 0 +SELECT COUNT(*) FROM aes_cfb128 WHERE b128 = b192 OR B192 = b256 OR b128=b256; +COUNT(*) +0 +SET SESSION block_encryption_mode="aes-256-cfb128"; +# must return 2 +SELECT COUNT(*) FROM aes_cfb128 WHERE a = AES_DECRYPT(b256, @KEY1, @IVA); +COUNT(*) +2 +# must return 0 +SELECT COUNT(*) FROM aes_cfb128 WHERE a = AES_DECRYPT(b256, 'b', @IVA); +COUNT(*) +0 +# must return 0 +SELECT COUNT(*) FROM aes_cfb128 WHERE a = AES_DECRYPT(b256, @KEY1, @IVB); +COUNT(*) +0 +SET SESSION block_encryption_mode="aes-192-cfb128"; +# must return 2 +SELECT COUNT(*) FROM aes_cfb128 WHERE a = AES_DECRYPT(b192, @KEY1, @IVA); +COUNT(*) +2 +# must return 0 +SELECT COUNT(*) FROM aes_cfb128 WHERE a = AES_DECRYPT(b192, @KEY2, @IVA); +COUNT(*) +0 +# must return 0 +SELECT COUNT(*) FROM aes_cfb128 WHERE a = AES_DECRYPT(b256, @KEY1, @IVB); +COUNT(*) +0 +SET SESSION block_encryption_mode="aes-128-cfb128"; +# must return 2 +SELECT COUNT(*) FROM aes_cfb128 WHERE a = AES_DECRYPT(b128, @KEY1, @IVA); +COUNT(*) +2 +# must return 0 +SELECT COUNT(*) FROM aes_cfb128 WHERE a = AES_DECRYPT(b128, @KEY2, @IVA); +COUNT(*) +0 +# must return 0 +SELECT COUNT(*) FROM aes_cfb128 WHERE a = AES_DECRYPT(b256, @KEY2, @IVB); +COUNT(*) +0 +SET SESSION block_encryption_mode=DEFAULT; +DROP TABLE aes_cfb128; +SET SESSION block_encryption_mode=default; +# +# End of 5.7 tests +# diff --git a/mysql-wsrep-5.6/mysql-test/r/func_aes_cfb8.result b/mysql-wsrep-5.6/mysql-test/r/func_aes_cfb8.result new file mode 100644 index 00000000..44158cb8 --- /dev/null +++ b/mysql-wsrep-5.6/mysql-test/r/func_aes_cfb8.result @@ -0,0 +1,132 @@ +# Tests of the AES CFB8 block mode +#### cfb8 +SET @IVA=REPEAT('a', 16); +SET @IVB=REPEAT('b', 16); +SET @KEY1=REPEAT('c', 16); +SET @KEY2=REPEAT('d', 16); +#### 128-cfb8 +SET SESSION block_encryption_mode="aes-128-cfb8"; +# must throw an error without an IV +SELECT AES_ENCRYPT('a', @KEY1); +ERROR 42000: Incorrect parameter count in the call to native function 'aes_encrypt' +block mode dependent. Must be non-0 and non-null +SELECT LENGTH(AES_ENCRYPT('a', @KEY1, @IVA)); +LENGTH(AES_ENCRYPT('a', @KEY1, @IVA)) +1 +block mode dependent +SELECT TO_BASE64(AES_ENCRYPT('a', @KEY1, @IVA)); +TO_BASE64(AES_ENCRYPT('a', @KEY1, @IVA)) +Pw== +# must be equal +SELECT 'a' = AES_DECRYPT(AES_ENCRYPT('a', @KEY1, @IVA), @KEY1, @IVA); +'a' = AES_DECRYPT(AES_ENCRYPT('a', @KEY1, @IVA), @KEY1, @IVA) +1 +# must not be equal +SELECT 'a' = AES_DECRYPT(AES_ENCRYPT('a',@KEY1, @IVA), @KEY1, @IVB); +'a' = AES_DECRYPT(AES_ENCRYPT('a',@KEY1, @IVA), @KEY1, @IVB) +0 +SELECT 'a' = AES_DECRYPT(AES_ENCRYPT('a',@KEY1, @IVA), @KEY2, @IVA); +'a' = AES_DECRYPT(AES_ENCRYPT('a',@KEY1, @IVA), @KEY2, @IVA) +0 +SELECT 'a' = AES_DECRYPT(AES_ENCRYPT('b',@KEY1, @IVA), @KEY1, @IVA); +'a' = AES_DECRYPT(AES_ENCRYPT('b',@KEY1, @IVA), @KEY1, @IVA) +0 +#### 192-cfb8 +SET SESSION block_encryption_mode="aes-192-cfb8"; +# must throw an error without an IV +SELECT AES_ENCRYPT('a', @KEY1); +ERROR 42000: Incorrect parameter count in the call to native function 'aes_encrypt' +# must be equal +SELECT 'a' = AES_DECRYPT(AES_ENCRYPT('a',@KEY1, @IVA), @KEY1, @IVA); +'a' = AES_DECRYPT(AES_ENCRYPT('a',@KEY1, @IVA), @KEY1, @IVA) +1 +# must not be equal +SELECT 'a' = AES_DECRYPT(AES_ENCRYPT('a',@KEY1, @IVA), @KEY1, @IVB); +'a' = AES_DECRYPT(AES_ENCRYPT('a',@KEY1, @IVA), @KEY1, @IVB) +0 +SELECT 'a' = AES_DECRYPT(AES_ENCRYPT('a',@KEY1, @IVA), @KEY2, @IVA); +'a' = AES_DECRYPT(AES_ENCRYPT('a',@KEY1, @IVA), @KEY2, @IVA) +0 +SELECT 'a' = AES_DECRYPT(AES_ENCRYPT('b',@KEY1, @IVA), @KEY1, @IVA); +'a' = AES_DECRYPT(AES_ENCRYPT('b',@KEY1, @IVA), @KEY1, @IVA) +0 +#### 256-cfb8 +SET SESSION block_encryption_mode="aes-256-cfb8"; +# must throw an error without an IV +SELECT AES_ENCRYPT('a', @KEY1); +ERROR 42000: Incorrect parameter count in the call to native function 'aes_encrypt' +# must be equal +SELECT 'a' = AES_DECRYPT(AES_ENCRYPT('a',@KEY1, @IVA), @KEY1, @IVA); +'a' = AES_DECRYPT(AES_ENCRYPT('a',@KEY1, @IVA), @KEY1, @IVA) +1 +# must not be equal +SELECT 'a' = AES_DECRYPT(AES_ENCRYPT('a',@KEY1, @IVA), @KEY1, @IVB); +'a' = AES_DECRYPT(AES_ENCRYPT('a',@KEY1, @IVA), @KEY1, @IVB) +0 +SELECT 'a' = AES_DECRYPT(AES_ENCRYPT('a',@KEY1, @IVA), @KEY2, @IVA); +'a' = AES_DECRYPT(AES_ENCRYPT('a',@KEY1, @IVA), @KEY2, @IVA) +0 +SELECT 'a' = AES_DECRYPT(AES_ENCRYPT('b',@KEY1, @IVA), @KEY1, @IVA); +'a' = AES_DECRYPT(AES_ENCRYPT('b',@KEY1, @IVA), @KEY1, @IVA) +0 +SET SESSION block_encryption_mode=DEFAULT; +#### 128, 192 and 256 bit cfb8 +CREATE TABLE aes_cfb8(a VARCHAR(128), b128 VARCHAR(144), +b192 VARCHAR(144), b256 CHAR(144)); +INSERT INTO aes_cfb8 (a) VALUES (REPEAT('a', 128)); +INSERT INTO aes_cfb8 (a) VALUES (REPEAT(0x00313233, 32)); +SET SESSION block_encryption_mode="aes-128-cfb8"; +UPDATE aes_cfb8 SET b128 = AES_ENCRYPT(a, @KEY1, @IVA); +SET SESSION block_encryption_mode="aes-192-cfb8"; +UPDATE aes_cfb8 SET b192 = AES_ENCRYPT(a, @KEY1, @IVA); +SET SESSION block_encryption_mode="aes-256-cfb8"; +UPDATE aes_cfb8 SET b256 = AES_ENCRYPT(a, @KEY1, @IVA); +# must return 0 +SELECT COUNT(*) FROM aes_cfb8 WHERE b128 = b192 OR B192 = b256 OR b128=b256; +COUNT(*) +0 +SET SESSION block_encryption_mode="aes-256-cfb8"; +# must return 2 +SELECT COUNT(*) FROM aes_cfb8 WHERE a = AES_DECRYPT(b256, @KEY1, @IVA); +COUNT(*) +2 +# must return 0 +SELECT COUNT(*) FROM aes_cfb8 WHERE a = AES_DECRYPT(b256, 'b', @IVA); +COUNT(*) +0 +# must return 0 +SELECT COUNT(*) FROM aes_cfb8 WHERE a = AES_DECRYPT(b256, @KEY1, @IVB); +COUNT(*) +0 +SET SESSION block_encryption_mode="aes-192-cfb8"; +# must return 2 +SELECT COUNT(*) FROM aes_cfb8 WHERE a = AES_DECRYPT(b192, @KEY1, @IVA); +COUNT(*) +2 +# must return 0 +SELECT COUNT(*) FROM aes_cfb8 WHERE a = AES_DECRYPT(b192, @KEY2, @IVA); +COUNT(*) +0 +# must return 0 +SELECT COUNT(*) FROM aes_cfb8 WHERE a = AES_DECRYPT(b256, @KEY1, @IVB); +COUNT(*) +0 +SET SESSION block_encryption_mode="aes-128-cfb8"; +# must return 2 +SELECT COUNT(*) FROM aes_cfb8 WHERE a = AES_DECRYPT(b128, @KEY1, @IVA); +COUNT(*) +2 +# must return 0 +SELECT COUNT(*) FROM aes_cfb8 WHERE a = AES_DECRYPT(b128, @KEY2, @IVA); +COUNT(*) +0 +# must return 0 +SELECT COUNT(*) FROM aes_cfb8 WHERE a = AES_DECRYPT(b256, @KEY2, @IVB); +COUNT(*) +0 +SET SESSION block_encryption_mode=DEFAULT; +DROP TABLE aes_cfb8; +SET SESSION block_encryption_mode=default; +# +# End of 5.7 tests +# diff --git a/mysql-wsrep-5.6/mysql-test/r/func_aes_misc.result b/mysql-wsrep-5.6/mysql-test/r/func_aes_misc.result new file mode 100644 index 00000000..7553b97d --- /dev/null +++ b/mysql-wsrep-5.6/mysql-test/r/func_aes_misc.result @@ -0,0 +1,255 @@ +############################################## +#### Tests for ECB Mode +############################################## +SET @IV='abcd1234efgh5678'; +SET @KEYS=REPEAT('c', 16); +SET @ENCSTR=REPEAT('d', 256); +"--------------------------------------------" +##################### Testing with mode : aes-128-ecb +SET SESSION block_encryption_mode="aes-128-ecb"; +SELECT @@global.block_encryption_mode; +@@global.block_encryption_mode +aes-128-ecb +SELECT @@session.block_encryption_mode; +@@session.block_encryption_mode +aes-128-ecb +####Test without tables +should return 1 +SELECT AES_DECRYPT(AES_ENCRYPT(@ENCSTR, @KEYS), @KEYS)=@ENCSTR; +AES_DECRYPT(AES_ENCRYPT(@ENCSTR, @KEYS), @KEYS)=@ENCSTR +1 +should return 1 +SELECT AES_DECRYPT(AES_ENCRYPT(@ENCSTR, @KEYS, @IV), @KEYS, @IV)=@ENCSTR; +AES_DECRYPT(AES_ENCRYPT(@ENCSTR, @KEYS, @IV), @KEYS, @IV)=@ENCSTR +1 +Warnings: +Warning 1618 option ignored +Warning 1618 option ignored +####Test with InnoDB tables +DROP TABLE IF EXISTS t1; +Warnings: +Note 1051 Unknown table 'test.t1' +CREATE TABLE t1(f1 varchar(256)); +INSERT INTO t1 values(@ENCSTR); +should return 1 +SELECT AES_DECRYPT(AES_ENCRYPT(@ENCSTR, @KEYS), @KEYS)=@ENCSTR FROM t1; +AES_DECRYPT(AES_ENCRYPT(@ENCSTR, @KEYS), @KEYS)=@ENCSTR +1 +should return 1 +SELECT AES_DECRYPT(AES_ENCRYPT(@ENCSTR, @KEYS, @IV), @KEYS, @IV)=@ENCSTR FROM t1; +AES_DECRYPT(AES_ENCRYPT(@ENCSTR, @KEYS, @IV), @KEYS, @IV)=@ENCSTR +1 +Warnings: +Warning 1618 option ignored +Warning 1618 option ignored +####Test with MyISAM tables +DROP TABLE IF EXISTS t1; +CREATE TABLE t1(f1 varchar(256)) engine=MyISAM; +INSERT INTO t1 values(@ENCSTR); +should return 1 +SELECT AES_DECRYPT(AES_ENCRYPT(@ENCSTR, @KEYS), @KEYS)=@ENCSTR FROM t1; +AES_DECRYPT(AES_ENCRYPT(@ENCSTR, @KEYS), @KEYS)=@ENCSTR +1 +should return 1 +SELECT AES_DECRYPT(AES_ENCRYPT(@ENCSTR, @KEYS, @IV), @KEYS, @IV)=@ENCSTR FROM t1; +AES_DECRYPT(AES_ENCRYPT(@ENCSTR, @KEYS, @IV), @KEYS, @IV)=@ENCSTR +1 +Warnings: +Warning 1618 option ignored +Warning 1618 option ignored +"--------------------------------------------" +##################### Testing with mode : aes-192-ecb +SET SESSION block_encryption_mode="aes-192-ecb"; +SELECT @@global.block_encryption_mode; +@@global.block_encryption_mode +aes-128-ecb +SELECT @@session.block_encryption_mode; +@@session.block_encryption_mode +aes-192-ecb +####Test without tables +should return 1 +SELECT AES_DECRYPT(AES_ENCRYPT(@ENCSTR, @KEYS), @KEYS)=@ENCSTR; +AES_DECRYPT(AES_ENCRYPT(@ENCSTR, @KEYS), @KEYS)=@ENCSTR +1 +should return 1 +SELECT AES_DECRYPT(AES_ENCRYPT(@ENCSTR, @KEYS, @IV), @KEYS, @IV)=@ENCSTR; +AES_DECRYPT(AES_ENCRYPT(@ENCSTR, @KEYS, @IV), @KEYS, @IV)=@ENCSTR +1 +Warnings: +Warning 1618 option ignored +Warning 1618 option ignored +####Test with InnoDB tables +DROP TABLE IF EXISTS t1; +CREATE TABLE t1(f1 varchar(256)); +INSERT INTO t1 values(@ENCSTR); +should return 1 +SELECT AES_DECRYPT(AES_ENCRYPT(@ENCSTR, @KEYS), @KEYS)=@ENCSTR FROM t1; +AES_DECRYPT(AES_ENCRYPT(@ENCSTR, @KEYS), @KEYS)=@ENCSTR +1 +should return 1 +SELECT AES_DECRYPT(AES_ENCRYPT(@ENCSTR, @KEYS, @IV), @KEYS, @IV)=@ENCSTR FROM t1; +AES_DECRYPT(AES_ENCRYPT(@ENCSTR, @KEYS, @IV), @KEYS, @IV)=@ENCSTR +1 +Warnings: +Warning 1618 option ignored +Warning 1618 option ignored +####Test with MyISAM tables +DROP TABLE IF EXISTS t1; +CREATE TABLE t1(f1 varchar(256)) engine=MyISAM; +INSERT INTO t1 values(@ENCSTR); +should return 1 +SELECT AES_DECRYPT(AES_ENCRYPT(@ENCSTR, @KEYS), @KEYS)=@ENCSTR FROM t1; +AES_DECRYPT(AES_ENCRYPT(@ENCSTR, @KEYS), @KEYS)=@ENCSTR +1 +should return 1 +SELECT AES_DECRYPT(AES_ENCRYPT(@ENCSTR, @KEYS, @IV), @KEYS, @IV)=@ENCSTR FROM t1; +AES_DECRYPT(AES_ENCRYPT(@ENCSTR, @KEYS, @IV), @KEYS, @IV)=@ENCSTR +1 +Warnings: +Warning 1618 option ignored +Warning 1618 option ignored +"--------------------------------------------" +##################### Testing with mode : aes-256-ecb +SET SESSION block_encryption_mode="aes-256-ecb"; +should return 1 +SELECT @@global.block_encryption_mode; +@@global.block_encryption_mode +aes-128-ecb +should return 1 +SELECT @@session.block_encryption_mode; +@@session.block_encryption_mode +aes-256-ecb +####Test without tables +should return 1 +SELECT AES_DECRYPT(AES_ENCRYPT(@ENCSTR, @KEYS), @KEYS)=@ENCSTR; +AES_DECRYPT(AES_ENCRYPT(@ENCSTR, @KEYS), @KEYS)=@ENCSTR +1 +should return 1 +SELECT AES_DECRYPT(AES_ENCRYPT(@ENCSTR, @KEYS, @IV), @KEYS, @IV)=@ENCSTR; +AES_DECRYPT(AES_ENCRYPT(@ENCSTR, @KEYS, @IV), @KEYS, @IV)=@ENCSTR +1 +Warnings: +Warning 1618 option ignored +Warning 1618 option ignored +####Test with InnoDB tables +DROP TABLE IF EXISTS t1; +CREATE TABLE t1(f1 varchar(256)); +INSERT INTO t1 values(@ENCSTR); +should return 1 +SELECT AES_DECRYPT(AES_ENCRYPT(@ENCSTR, @KEYS), @KEYS)=@ENCSTR FROM t1; +AES_DECRYPT(AES_ENCRYPT(@ENCSTR, @KEYS), @KEYS)=@ENCSTR +1 +should return 1 +SELECT AES_DECRYPT(AES_ENCRYPT(@ENCSTR, @KEYS, @IV), @KEYS, @IV)=@ENCSTR FROM t1; +AES_DECRYPT(AES_ENCRYPT(@ENCSTR, @KEYS, @IV), @KEYS, @IV)=@ENCSTR +1 +Warnings: +Warning 1618 option ignored +Warning 1618 option ignored +####Test with MyISAM tables +DROP TABLE IF EXISTS t1; +CREATE TABLE t1(f1 varchar(256)) engine=MyISAM; +INSERT INTO t1 values(@ENCSTR); +should return 1 +SELECT AES_DECRYPT(AES_ENCRYPT(@ENCSTR, @KEYS), @KEYS)=@ENCSTR FROM t1; +AES_DECRYPT(AES_ENCRYPT(@ENCSTR, @KEYS), @KEYS)=@ENCSTR +1 +should return 1 +SELECT AES_DECRYPT(AES_ENCRYPT(@ENCSTR, @KEYS, @IV), @KEYS, @IV)=@ENCSTR FROM t1; +AES_DECRYPT(AES_ENCRYPT(@ENCSTR, @KEYS, @IV), @KEYS, @IV)=@ENCSTR +1 +Warnings: +Warning 1618 option ignored +Warning 1618 option ignored +DROP TABLE IF EXISTS t1; +"--------------------------------------------" +############################################## +"Tests related to RANDOM_BYTES()" +############################################## +should return 1 +select LENGTH(RANDOM_BYTES(1))=1; +LENGTH(RANDOM_BYTES(1))=1 +1 +should return 1 +select LENGTH(RANDOM_BYTES(1024))=1024; +LENGTH(RANDOM_BYTES(1024))=1024 +1 +SET @KEYS=RANDOM_BYTES(1); +SET @KEYS=RANDOM_BYTES(1024); +select RANDOM_BYTES(0); +ERROR 22003: length value is out of range in 'random_bytes' +select RANDOM_BYTES(1025); +ERROR 22003: length value is out of range in 'random_bytes' +############################################## +"Tests related to boundary values of IV" +############################################## +SET @IV='abcdefghijklmnophelloworldworldisgreat'; +SET @IV1='abcdefghijklmnopqrstuvwxyz'; +SET @KEYS='helloworld'; +SET @ENCSTR=REPEAT('K',100); +SET @@session.block_encryption_mode = 'aes-256-cbc'; +should return 1 +select AES_ENCRYPT(@ENCSTR, @KEYS, @IV)=AES_ENCRYPT(@ENCSTR, @KEYS, @IV1); +AES_ENCRYPT(@ENCSTR, @KEYS, @IV)=AES_ENCRYPT(@ENCSTR, @KEYS, @IV1) +1 +############################################## +"Few negative tests with invalid/different keys and IV" +############################################## +SET @IV='ijkl8765mnop2345'; +SET @KEYS='helloworld1234567890'; +SET @ENCSTR=REPEAT('J',255); +SET @@session.block_encryption_mode = 'aes-128-ecb'; +DROP TABLE IF EXISTS t1; +Warnings: +Note 1051 Unknown table 'test.t1' +CREATE TABLE t1(f1 varchar(256)); +INSERT INTO t1 values(AES_ENCRYPT(@ENCSTR, @KEYS, @IV)); +Warnings: +Warning 1618 option ignored +Combination1.............. +SET @@session.block_encryption_mode = 'aes-192-ecb'; +should return NULL +SELECT AES_DECRYPT(f1, @KEYS, @IV)=@ENCSTR FROM t1; +AES_DECRYPT(f1, @KEYS, @IV)=@ENCSTR +NULL +Warnings: +Warning 1618 option ignored +Combination2.............. +SET @@session.block_encryption_mode = 'aes-256-ecb'; +should return NULL +SELECT AES_DECRYPT(f1, @KEYS, @IV)=@ENCSTR FROM t1; +AES_DECRYPT(f1, @KEYS, @IV)=@ENCSTR +NULL +Warnings: +Warning 1618 option ignored +Combination3.............. +SET @@session.block_encryption_mode = 'aes-128-cbc'; +should return 0 or NULL +SELECT COALESCE (AES_DECRYPT(f1, @KEYS, @IV)=@ENCSTR,0) FROM t1; +COALESCE (AES_DECRYPT(f1, @KEYS, @IV)=@ENCSTR,0) +0 +Combination4.............. +SET @@session.block_encryption_mode = 'aes-192-cbc'; +should return NULL +SELECT AES_DECRYPT(f1, @KEYS, @IV)=@ENCSTR FROM t1; +AES_DECRYPT(f1, @KEYS, @IV)=@ENCSTR +NULL +Combination5.............. +SET @@session.block_encryption_mode = 'aes-256-cbc'; +should return NULL +SELECT AES_DECRYPT(f1, @KEYS, @IV)=@ENCSTR FROM t1; +AES_DECRYPT(f1, @KEYS, @IV)=@ENCSTR +NULL +Combination6.............. +SET @@session.block_encryption_mode = 'aes-128-ecb'; +should return 1 +SELECT AES_DECRYPT(f1, @KEYS, @IV)=@ENCSTR FROM t1; +AES_DECRYPT(f1, @KEYS, @IV)=@ENCSTR +1 +Warnings: +Warning 1618 option ignored +SET @@session.block_encryption_mode = DEFAULT; +DROP TABLE IF EXISTS t1; +# +# End of 5.7 tests +# diff --git a/mysql-wsrep-5.6/mysql-test/r/func_aes_ofb.result b/mysql-wsrep-5.6/mysql-test/r/func_aes_ofb.result new file mode 100644 index 00000000..06160063 --- /dev/null +++ b/mysql-wsrep-5.6/mysql-test/r/func_aes_ofb.result @@ -0,0 +1,132 @@ +# Tests of the AES ofb block mode +#### ofb +SET @IVA=REPEAT('a', 16); +SET @IVB=REPEAT('b', 16); +SET @KEY1=REPEAT('c', 16); +SET @KEY2=REPEAT('d', 16); +#### 128-ofb +SET SESSION block_encryption_mode="aes-128-ofb"; +# must throw an error without an IV +SELECT AES_ENCRYPT('a', @KEY1); +ERROR 42000: Incorrect parameter count in the call to native function 'aes_encrypt' +block mode dependent. Must be non-0 and non-null +SELECT LENGTH(AES_ENCRYPT('a', @KEY1, @IVA)); +LENGTH(AES_ENCRYPT('a', @KEY1, @IVA)) +1 +block mode dependent +SELECT TO_BASE64(AES_ENCRYPT('a', @KEY1, @IVA)); +TO_BASE64(AES_ENCRYPT('a', @KEY1, @IVA)) +Pw== +# must be equal +SELECT 'a' = AES_DECRYPT(AES_ENCRYPT('a', @KEY1, @IVA), @KEY1, @IVA); +'a' = AES_DECRYPT(AES_ENCRYPT('a', @KEY1, @IVA), @KEY1, @IVA) +1 +# must not be equal +SELECT 'a' = AES_DECRYPT(AES_ENCRYPT('a',@KEY1, @IVA), @KEY1, @IVB); +'a' = AES_DECRYPT(AES_ENCRYPT('a',@KEY1, @IVA), @KEY1, @IVB) +0 +SELECT 'a' = AES_DECRYPT(AES_ENCRYPT('a',@KEY1, @IVA), @KEY2, @IVA); +'a' = AES_DECRYPT(AES_ENCRYPT('a',@KEY1, @IVA), @KEY2, @IVA) +0 +SELECT 'a' = AES_DECRYPT(AES_ENCRYPT('b',@KEY1, @IVA), @KEY1, @IVA); +'a' = AES_DECRYPT(AES_ENCRYPT('b',@KEY1, @IVA), @KEY1, @IVA) +0 +#### 192-ofb +SET SESSION block_encryption_mode="aes-192-ofb"; +# must throw an error without an IV +SELECT AES_ENCRYPT('a', @KEY1); +ERROR 42000: Incorrect parameter count in the call to native function 'aes_encrypt' +# must be equal +SELECT 'a' = AES_DECRYPT(AES_ENCRYPT('a',@KEY1, @IVA), @KEY1, @IVA); +'a' = AES_DECRYPT(AES_ENCRYPT('a',@KEY1, @IVA), @KEY1, @IVA) +1 +# must not be equal +SELECT 'a' = AES_DECRYPT(AES_ENCRYPT('a',@KEY1, @IVA), @KEY1, @IVB); +'a' = AES_DECRYPT(AES_ENCRYPT('a',@KEY1, @IVA), @KEY1, @IVB) +0 +SELECT 'a' = AES_DECRYPT(AES_ENCRYPT('a',@KEY1, @IVA), @KEY2, @IVA); +'a' = AES_DECRYPT(AES_ENCRYPT('a',@KEY1, @IVA), @KEY2, @IVA) +0 +SELECT 'a' = AES_DECRYPT(AES_ENCRYPT('b',@KEY1, @IVA), @KEY1, @IVA); +'a' = AES_DECRYPT(AES_ENCRYPT('b',@KEY1, @IVA), @KEY1, @IVA) +0 +#### 256-ofb +SET SESSION block_encryption_mode="aes-256-ofb"; +# must throw an error without an IV +SELECT AES_ENCRYPT('a', @KEY1); +ERROR 42000: Incorrect parameter count in the call to native function 'aes_encrypt' +# must be equal +SELECT 'a' = AES_DECRYPT(AES_ENCRYPT('a',@KEY1, @IVA), @KEY1, @IVA); +'a' = AES_DECRYPT(AES_ENCRYPT('a',@KEY1, @IVA), @KEY1, @IVA) +1 +# must not be equal +SELECT 'a' = AES_DECRYPT(AES_ENCRYPT('a',@KEY1, @IVA), @KEY1, @IVB); +'a' = AES_DECRYPT(AES_ENCRYPT('a',@KEY1, @IVA), @KEY1, @IVB) +0 +SELECT 'a' = AES_DECRYPT(AES_ENCRYPT('a',@KEY1, @IVA), @KEY2, @IVA); +'a' = AES_DECRYPT(AES_ENCRYPT('a',@KEY1, @IVA), @KEY2, @IVA) +0 +SELECT 'a' = AES_DECRYPT(AES_ENCRYPT('b',@KEY1, @IVA), @KEY1, @IVA); +'a' = AES_DECRYPT(AES_ENCRYPT('b',@KEY1, @IVA), @KEY1, @IVA) +0 +SET SESSION block_encryption_mode=DEFAULT; +#### 128, 192 and 256 bit ofb +CREATE TABLE aes_ofb(a VARCHAR(128), b128 VARCHAR(144), +b192 VARCHAR(144), b256 CHAR(144)); +INSERT INTO aes_ofb (a) VALUES (REPEAT('a', 128)); +INSERT INTO aes_ofb (a) VALUES (REPEAT(0x00313233, 32)); +SET SESSION block_encryption_mode="aes-128-ofb"; +UPDATE aes_ofb SET b128 = AES_ENCRYPT(a, @KEY1, @IVA); +SET SESSION block_encryption_mode="aes-192-ofb"; +UPDATE aes_ofb SET b192 = AES_ENCRYPT(a, @KEY1, @IVA); +SET SESSION block_encryption_mode="aes-256-ofb"; +UPDATE aes_ofb SET b256 = AES_ENCRYPT(a, @KEY1, @IVA); +# must return 0 +SELECT COUNT(*) FROM aes_ofb WHERE b128 = b192 OR B192 = b256 OR b128=b256; +COUNT(*) +0 +SET SESSION block_encryption_mode="aes-256-ofb"; +# must return 2 +SELECT COUNT(*) FROM aes_ofb WHERE a = AES_DECRYPT(b256, @KEY1, @IVA); +COUNT(*) +2 +# must return 0 +SELECT COUNT(*) FROM aes_ofb WHERE a = AES_DECRYPT(b256, 'b', @IVA); +COUNT(*) +0 +# must return 0 +SELECT COUNT(*) FROM aes_ofb WHERE a = AES_DECRYPT(b256, @KEY1, @IVB); +COUNT(*) +0 +SET SESSION block_encryption_mode="aes-192-ofb"; +# must return 2 +SELECT COUNT(*) FROM aes_ofb WHERE a = AES_DECRYPT(b192, @KEY1, @IVA); +COUNT(*) +2 +# must return 0 +SELECT COUNT(*) FROM aes_ofb WHERE a = AES_DECRYPT(b192, @KEY2, @IVA); +COUNT(*) +0 +# must return 0 +SELECT COUNT(*) FROM aes_ofb WHERE a = AES_DECRYPT(b256, @KEY1, @IVB); +COUNT(*) +0 +SET SESSION block_encryption_mode="aes-128-ofb"; +# must return 2 +SELECT COUNT(*) FROM aes_ofb WHERE a = AES_DECRYPT(b128, @KEY1, @IVA); +COUNT(*) +2 +# must return 0 +SELECT COUNT(*) FROM aes_ofb WHERE a = AES_DECRYPT(b128, @KEY2, @IVA); +COUNT(*) +0 +# must return 0 +SELECT COUNT(*) FROM aes_ofb WHERE a = AES_DECRYPT(b256, @KEY2, @IVB); +COUNT(*) +0 +SET SESSION block_encryption_mode=DEFAULT; +DROP TABLE aes_ofb; +SET SESSION block_encryption_mode=default; +# +# End of 5.7 tests +# diff --git a/mysql-wsrep-5.6/mysql-test/r/func_crypt.result b/mysql-wsrep-5.6/mysql-test/r/func_crypt.result index 31eb20b9..f449efc6 100644 --- a/mysql-wsrep-5.6/mysql-test/r/func_crypt.result +++ b/mysql-wsrep-5.6/mysql-test/r/func_crypt.result @@ -20,15 +20,21 @@ password('') select old_password('abc'); old_password('abc') 7cd2b5942be28759 +Warnings: +Warning 1287 'OLD_PASSWORD' is deprecated and will be removed in a future release. Please use PASSWORD instead select old_password(''); old_password('') +Warnings: +Warning 1287 'OLD_PASSWORD' is deprecated and will be removed in a future release. Please use PASSWORD instead select password('gabbagabbahey'); password('gabbagabbahey') *B0F99D2963660DD7E16B751EC9EE2F17B6A68FA6 select old_password('idkfa'); old_password('idkfa') 5c078dc54ca0fcca +Warnings: +Warning 1287 'OLD_PASSWORD' is deprecated and will be removed in a future release. Please use PASSWORD instead select length(password('1')); length(password('1')) 41 @@ -41,6 +47,8 @@ aaqPiZY5xR5l. select old_password(NULL); old_password(NULL) NULL +Warnings: +Warning 1287 'OLD_PASSWORD' is deprecated and will be removed in a future release. Please use PASSWORD instead select password(NULL); password(NULL) @@ -51,12 +59,16 @@ password('') select old_password(''); old_password('') +Warnings: +Warning 1287 'OLD_PASSWORD' is deprecated and will be removed in a future release. Please use PASSWORD instead select password('idkfa'); password('idkfa') *B669C9DAC3AA6F2254B03CDEF8DFDD6B2D1054BA select old_password('idkfa'); old_password('idkfa') 5c078dc54ca0fcca +Warnings: +Warning 1287 'OLD_PASSWORD' is deprecated and will be removed in a future release. Please use PASSWORD instead set old_passwords=1; select password('idkfa'); password('idkfa') @@ -64,6 +76,8 @@ password('idkfa') select old_password('idkfa'); old_password('idkfa') 5c078dc54ca0fcca +Warnings: +Warning 1287 'OLD_PASSWORD' is deprecated and will be removed in a future release. Please use PASSWORD instead set global old_passwords=0; select password('idkfa'); password('idkfa') @@ -71,6 +85,8 @@ password('idkfa') select old_password('idkfa'); old_password('idkfa') 5c078dc54ca0fcca +Warnings: +Warning 1287 'OLD_PASSWORD' is deprecated and will be removed in a future release. Please use PASSWORD instead set old_passwords=0; select password('idkfa '); password('idkfa ') @@ -84,13 +100,18 @@ password(' idkfa') select old_password('idkfa'); old_password('idkfa') 5c078dc54ca0fcca +Warnings: +Warning 1287 'OLD_PASSWORD' is deprecated and will be removed in a future release. Please use PASSWORD instead select old_password(' i d k f a '); old_password(' i d k f a ') 5c078dc54ca0fcca +Warnings: +Warning 1287 'OLD_PASSWORD' is deprecated and will be removed in a future release. Please use PASSWORD instead explain extended select password('idkfa '), old_password('idkfa'); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: +Warning 1287 'OLD_PASSWORD' is deprecated and will be removed in a future release. Please use PASSWORD instead Note 1003 /* select#1 */ select password('idkfa ') AS `password('idkfa ')`,old_password('idkfa') AS `old_password('idkfa')` select encrypt('1234','_.'); encrypt('1234','_.') @@ -104,6 +125,8 @@ INSERT INTO t1 VALUES (REPEAT('a', 1024)); SELECT OLD_PASSWORD(c1), PASSWORD(c1) FROM t1; OLD_PASSWORD(c1) PASSWORD(c1) 77023ffe214c04ff *82E58A2C08AAFE72C8EB523069CD8ADB33F78F58 +Warnings: +Warning 1287 'OLD_PASSWORD' is deprecated and will be removed in a future release. Please use PASSWORD instead DROP TABLE t1; End of 5.0 tests # diff --git a/mysql-wsrep-5.6/mysql-test/r/group_min_max.result b/mysql-wsrep-5.6/mysql-test/r/group_min_max.result index 683f51c5..78ae0012 100644 --- a/mysql-wsrep-5.6/mysql-test/r/group_min_max.result +++ b/mysql-wsrep-5.6/mysql-test/r/group_min_max.result @@ -3004,7 +3004,7 @@ COUNT(DISTINCT a, b) SUM(DISTINCT a) 0 NULL EXPLAIN SELECT SUM(DISTINCT a), MAX(b) FROM t2 GROUP BY a; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range a a 5 NULL 9 Using index for group-by +1 SIMPLE t2 index a a 15 NULL 16 Using index SELECT SUM(DISTINCT a), MAX(b) FROM t2 GROUP BY a; SUM(DISTINCT a) MAX(b) 1 8 @@ -3032,7 +3032,7 @@ SELECT 42 * (a + c + COUNT(DISTINCT c, a, b)) FROM t2 GROUP BY a, b, c; 168 EXPLAIN SELECT (SUM(DISTINCT a) + MAX(b)) FROM t2 GROUP BY a; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range a a 5 NULL 9 Using index for group-by +1 SIMPLE t2 index a a 15 NULL 16 Using index SELECT (SUM(DISTINCT a) + MAX(b)) FROM t2 GROUP BY a; (SUM(DISTINCT a) + MAX(b)) 9 @@ -3060,3 +3060,81 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 range PRIMARY PRIMARY 5 NULL 9 Using index for group-by (scanning) drop table t1; # End of test#50539. +# +# Bug#17217128 - BAD INTERACTION BETWEEN MIN/MAX AND +# "HAVING SUM(DISTINCT)": WRONG RESULTS. +# +CREATE TABLE t (a INT, b INT, KEY(a,b)); +INSERT INTO t VALUES (1,1), (2,2), (3,3), (4,4), (1,0), (3,2), (4,5); +set optimizer_trace_max_mem_size=1048576; +set @@session.optimizer_trace='enabled=on'; +set end_markers_in_json=on; +ANALYZE TABLE t; +Table Op Msg_type Msg_text +test.t analyze status OK +SELECT a, SUM(DISTINCT a), MIN(b) FROM t GROUP BY a; +a SUM(DISTINCT a) MIN(b) +1 1 0 +2 2 2 +3 3 2 +4 4 4 +EXPLAIN SELECT a, SUM(DISTINCT a), MIN(b) FROM t GROUP BY a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t index a a 10 NULL 7 Using index +SELECT TRACE RLIKE 'have_both_agg_distinct_and_min_max' AS OK +FROM INFORMATION_SCHEMA.OPTIMIZER_TRACE; +OK +1 +SELECT a, SUM(DISTINCT a), MAX(b) FROM t GROUP BY a; +a SUM(DISTINCT a) MAX(b) +1 1 1 +2 2 2 +3 3 3 +4 4 5 +EXPLAIN SELECT a, SUM(DISTINCT a), MAX(b) FROM t GROUP BY a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t index a a 10 NULL 7 Using index +SELECT TRACE RLIKE 'have_both_agg_distinct_and_min_max' AS OK +FROM INFORMATION_SCHEMA.OPTIMIZER_TRACE; +OK +1 +SELECT a, MAX(b) FROM t GROUP BY a HAVING SUM(DISTINCT a); +a MAX(b) +1 1 +2 2 +3 3 +4 5 +EXPLAIN SELECT a, MAX(b) FROM t GROUP BY a HAVING SUM(DISTINCT a); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t index a a 10 NULL 7 Using index +SELECT TRACE RLIKE 'have_both_agg_distinct_and_min_max' AS OK +FROM INFORMATION_SCHEMA.OPTIMIZER_TRACE; +OK +1 +SELECT SUM(DISTINCT a), MIN(b), MAX(b) FROM t; +SUM(DISTINCT a) MIN(b) MAX(b) +10 0 5 +EXPLAIN SELECT SUM(DISTINCT a), MIN(b), MAX(b) FROM t; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t index a a 10 NULL 7 Using index +SELECT TRACE RLIKE 'have_both_agg_distinct_and_min_max' AS OK +FROM INFORMATION_SCHEMA.OPTIMIZER_TRACE; +OK +1 +SELECT a, SUM(DISTINCT a), MIN(b), MAX(b) FROM t GROUP BY a; +a SUM(DISTINCT a) MIN(b) MAX(b) +1 1 0 1 +2 2 2 2 +3 3 2 3 +4 4 4 5 +EXPLAIN SELECT a, SUM(DISTINCT a), MIN(b), MAX(b) FROM t GROUP BY a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t index a a 10 NULL 7 Using index +SELECT TRACE RLIKE 'have_both_agg_distinct_and_min_max' AS OK +FROM INFORMATION_SCHEMA.OPTIMIZER_TRACE; +OK +1 +SET optimizer_trace_max_mem_size=DEFAULT; +SET optimizer_trace=DEFAULT; +SET end_markers_in_json=DEFAULT; +DROP TABLE t; diff --git a/mysql-wsrep-5.6/mysql-test/r/group_min_max_innodb.result b/mysql-wsrep-5.6/mysql-test/r/group_min_max_innodb.result index 320c0ec1..a56dc011 100644 --- a/mysql-wsrep-5.6/mysql-test/r/group_min_max_innodb.result +++ b/mysql-wsrep-5.6/mysql-test/r/group_min_max_innodb.result @@ -119,3 +119,205 @@ COUNT(DISTINCT a) 1 DROP TABLE t1; End of 5.5 tests +# +# Bug#17909656 - WRONG RESULTS FOR A SIMPLE QUERY WITH GROUP BY +# +CREATE TABLE t0 ( +i1 INTEGER NOT NULL +); +INSERT INTO t0 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10), +(11),(12),(13),(14),(15),(16),(17),(18),(19),(20), +(21),(22),(23),(24),(25),(26),(27),(28),(29),(30); +CREATE TABLE t1 ( +c1 CHAR(1) NOT NULL, +i1 INTEGER NOT NULL, +i2 INTEGER NOT NULL, +UNIQUE KEY k1 (c1,i2) +) ENGINE=InnoDB; +INSERT INTO t1 SELECT 'A',i1,i1 FROM t0; +INSERT INTO t1 SELECT 'B',i1,i1 FROM t0; +INSERT INTO t1 SELECT 'C',i1,i1 FROM t0; +INSERT INTO t1 SELECT 'D',i1,i1 FROM t0; +INSERT INTO t1 SELECT 'E',i1,i1 FROM t0; +INSERT INTO t1 SELECT 'F',i1,i1 FROM t0; +CREATE TABLE t2 ( +c1 CHAR(1) NOT NULL, +i1 INTEGER NOT NULL, +i2 INTEGER NOT NULL, +UNIQUE KEY k2 (c1,i1,i2) +) ENGINE=InnoDB; +INSERT INTO t2 SELECT 'A',i1,i1 FROM t0; +INSERT INTO t2 SELECT 'B',i1,i1 FROM t0; +INSERT INTO t2 SELECT 'C',i1,i1 FROM t0; +INSERT INTO t2 SELECT 'D',i1,i1 FROM t0; +INSERT INTO t2 SELECT 'E',i1,i1 FROM t0; +INSERT INTO t2 SELECT 'F',i1,i1 FROM t0; +ANALYZE TABLE t1; +ANALYZE TABLE t2; +set optimizer_trace_max_mem_size=1048576; +set @@session.optimizer_trace='enabled=on'; +set end_markers_in_json=on; +EXPLAIN SELECT c1, max(i2) FROM t1 WHERE (c1 = 'C' AND i2 = 17) OR ( c1 = 'F') +GROUP BY c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range k1 k1 5 NULL ROWS Using where; Using index +SELECT c1, max(i2) FROM t1 WHERE (c1 = 'C' AND i2 = 17) OR ( c1 = 'F') +GROUP BY c1; +c1 max(i2) +C 17 +F 30 +SELECT TRACE RLIKE 'minmax_keypart_in_disjunctive_query' +AS OK FROM INFORMATION_SCHEMA.OPTIMIZER_TRACE; +OK +1 +EXPLAIN SELECT c1, max(i2) FROM t1 WHERE (c1 = 'C' OR ( c1 = 'F' AND i2 = 17)) +GROUP BY c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range k1 k1 5 NULL ROWS Using where; Using index +SELECT c1, max(i2) FROM t1 WHERE (c1 = 'C' OR ( c1 = 'F' AND i2 = 17)) +GROUP BY c1; +c1 max(i2) +C 30 +F 17 +SELECT TRACE RLIKE 'minmax_keypart_in_disjunctive_query' +AS OK FROM INFORMATION_SCHEMA.OPTIMIZER_TRACE; +OK +1 +EXPLAIN SELECT c1, max(i2) FROM t1 WHERE (c1 = 'C' OR c1 = 'F' ) AND ( i2 = 17 ) +GROUP BY c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range k1 k1 5 NULL ROWS Using where; Using index for group-by +SELECT c1, max(i2) FROM t1 WHERE (c1 = 'C' OR c1 = 'F' ) AND ( i2 = 17 ) +GROUP BY c1; +c1 max(i2) +C 17 +F 17 +SELECT TRACE RLIKE 'minmax_keypart_in_disjunctive_query' +AS OK FROM INFORMATION_SCHEMA.OPTIMIZER_TRACE; +OK +0 +EXPLAIN SELECT c1, max(i2) FROM t1 +WHERE ((c1 = 'C' AND (i2 = 40 OR i2 = 30)) OR ( c1 = 'F' AND (i2 = 40 ))) +GROUP BY c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range k1 k1 5 NULL ROWS Using where; Using index +SELECT c1, max(i2) FROM t1 +WHERE ((c1 = 'C' AND (i2 = 40 OR i2 = 30)) OR ( c1 = 'F' AND (i2 = 40 ))) +GROUP BY c1; +c1 max(i2) +C 30 +SELECT TRACE RLIKE 'minmax_keypart_in_disjunctive_query' +AS OK FROM INFORMATION_SCHEMA.OPTIMIZER_TRACE; +OK +1 +EXPLAIN SELECT c1, i1, max(i2) FROM t2 +WHERE (c1 = 'C' OR ( c1 = 'F' AND i1 < 35)) AND ( i2 = 17 ) +GROUP BY c1,i1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 range k2 k2 5 NULL ROWS Using where; Using index +SELECT c1, i1, max(i2) FROM t2 +WHERE (c1 = 'C' OR ( c1 = 'F' AND i1 < 35)) AND ( i2 = 17 ) +GROUP BY c1,i1; +c1 i1 max(i2) +C 17 17 +F 17 17 +SELECT TRACE RLIKE 'minmax_keypart_in_disjunctive_query' +AS OK FROM INFORMATION_SCHEMA.OPTIMIZER_TRACE; +OK +0 +EXPLAIN SELECT c1, i1, max(i2) FROM t2 +WHERE (((c1 = 'C' AND i1 < 40) OR ( c1 = 'F' AND i1 < 35)) AND ( i2 = 17 )) +GROUP BY c1,i1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 range k2 k2 5 NULL ROWS Using where; Using index +SELECT c1, i1, max(i2) FROM t2 +WHERE (((c1 = 'C' AND i1 < 40) OR ( c1 = 'F' AND i1 < 35)) AND ( i2 = 17 )) +GROUP BY c1,i1; +c1 i1 max(i2) +C 17 17 +F 17 17 +SELECT TRACE RLIKE 'minmax_keypart_in_disjunctive_query' +AS OK FROM INFORMATION_SCHEMA.OPTIMIZER_TRACE; +OK +0 +EXPLAIN SELECT c1, i1, max(i2) FROM t2 +WHERE ((c1 = 'C' AND i1 < 40) OR ( c1 = 'F' AND i1 < 35) OR ( i2 = 17 )) +GROUP BY c1,i1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 index k2 k2 9 NULL ROWS Using where; Using index +SELECT c1, i1, max(i2) FROM t2 +WHERE ((c1 = 'C' AND i1 < 40) OR ( c1 = 'F' AND i1 < 35) OR ( i2 = 17 )) +GROUP BY c1,i1; +c1 i1 max(i2) +A 17 17 +B 17 17 +C 1 1 +C 2 2 +C 3 3 +C 4 4 +C 5 5 +C 6 6 +C 7 7 +C 8 8 +C 9 9 +C 10 10 +C 11 11 +C 12 12 +C 13 13 +C 14 14 +C 15 15 +C 16 16 +C 17 17 +C 18 18 +C 19 19 +C 20 20 +C 21 21 +C 22 22 +C 23 23 +C 24 24 +C 25 25 +C 26 26 +C 27 27 +C 28 28 +C 29 29 +C 30 30 +D 17 17 +E 17 17 +F 1 1 +F 2 2 +F 3 3 +F 4 4 +F 5 5 +F 6 6 +F 7 7 +F 8 8 +F 9 9 +F 10 10 +F 11 11 +F 12 12 +F 13 13 +F 14 14 +F 15 15 +F 16 16 +F 17 17 +F 18 18 +F 19 19 +F 20 20 +F 21 21 +F 22 22 +F 23 23 +F 24 24 +F 25 25 +F 26 26 +F 27 27 +F 28 28 +F 29 29 +F 30 30 +SELECT TRACE RLIKE 'minmax_keypart_in_disjunctive_query' +AS OK FROM INFORMATION_SCHEMA.OPTIMIZER_TRACE; +OK +0 +SET optimizer_trace_max_mem_size=DEFAULT; +SET optimizer_trace=DEFAULT; +SET end_markers_in_json=DEFAULT; +DROP TABLE t0,t1,t2; diff --git a/mysql-wsrep-5.6/mysql-test/r/have_cp1251.require b/mysql-wsrep-5.6/mysql-test/r/have_cp1251.require index 465e8338..a4e66df9 100644 --- a/mysql-wsrep-5.6/mysql-test/r/have_cp1251.require +++ b/mysql-wsrep-5.6/mysql-test/r/have_cp1251.require @@ -1,2 +1,2 @@ Collation Charset Id Default Compiled Sortlen -cp1251_general_ci cp1251 51 Yes 0 +cp1251_general_ci cp1251 51 Yes Yes 1 diff --git a/mysql-wsrep-5.6/mysql-test/r/have_cp866.require b/mysql-wsrep-5.6/mysql-test/r/have_cp866.require index da2a3e2f..7efa36b9 100644 --- a/mysql-wsrep-5.6/mysql-test/r/have_cp866.require +++ b/mysql-wsrep-5.6/mysql-test/r/have_cp866.require @@ -1,2 +1,2 @@ Collation Charset Id Default Compiled Sortlen -cp866_general_ci cp866 36 Yes 0 +cp866_general_ci cp866 36 Yes Yes 1 diff --git a/mysql-wsrep-5.6/mysql-test/r/have_koi8r.require b/mysql-wsrep-5.6/mysql-test/r/have_koi8r.require index b109b9ae..2df3fdd2 100644 --- a/mysql-wsrep-5.6/mysql-test/r/have_koi8r.require +++ b/mysql-wsrep-5.6/mysql-test/r/have_koi8r.require @@ -1,2 +1,2 @@ Collation Charset Id Default Compiled Sortlen -koi8r_general_ci koi8r 7 Yes 0 +koi8r_general_ci koi8r 7 Yes Yes 1 diff --git a/mysql-wsrep-5.6/mysql-test/r/information_schema-big.result b/mysql-wsrep-5.6/mysql-test/r/information_schema-big.result index 8e86b3b0..b8b6dc6d 100644 --- a/mysql-wsrep-5.6/mysql-test/r/information_schema-big.result +++ b/mysql-wsrep-5.6/mysql-test/r/information_schema-big.result @@ -17,7 +17,8 @@ WHERE c2.table_schema = t.table_schema AND c2.table_name = t.table_name AND c2.column_name LIKE '%SCHEMA%' ) -AND t.table_name NOT LIKE 'innodb%'; +AND t.table_name NOT LIKE 'ndb%' + AND t.table_name NOT LIKE 'innodb%'; table_name column_name CHARACTER_SETS CHARACTER_SET_NAME COLLATIONS COLLATION_NAME @@ -64,7 +65,8 @@ WHERE c2.table_schema = 'information_schema' AND c2.table_name = t.table_name AND c2.column_name LIKE '%SCHEMA%' ) -AND t.table_name NOT LIKE 'innodb%'; +AND t.table_name NOT LIKE 'ndb%' + AND t.table_name NOT LIKE 'innodb%'; table_name column_name CHARACTER_SETS CHARACTER_SET_NAME COLLATIONS COLLATION_NAME diff --git a/mysql-wsrep-5.6/mysql-test/r/information_schema.result b/mysql-wsrep-5.6/mysql-test/r/information_schema.result index 6a2cba5f..fce2f40d 100644 --- a/mysql-wsrep-5.6/mysql-test/r/information_schema.result +++ b/mysql-wsrep-5.6/mysql-test/r/information_schema.result @@ -2080,6 +2080,21 @@ t6 e timestamp 6 drop database mysqltest; use test; # +# Test for bug #16869534 - "QUERYING SUBSET OF COLUMNS DOESN'T USE TABLE +# CACHE; OPENED_TABLES INCREASES" +# +SELECT * FROM INFORMATION_SCHEMA.TABLES; +SELECT VARIABLE_VALUE INTO @val1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE +VARIABLE_NAME LIKE 'Opened_tables'; +SELECT ENGINE FROM INFORMATION_SCHEMA.TABLES; +# The below SELECT query should give same output as above SELECT query. +SELECT VARIABLE_VALUE INTO @val2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE +VARIABLE_NAME LIKE 'Opened_tables'; +# The below select should return '1' +SELECT @val1 = @val2; +@val1 = @val2 +1 +# # End of 5.5 tests # # diff --git a/mysql-wsrep-5.6/mysql-test/r/innodb_mysql_lock.result b/mysql-wsrep-5.6/mysql-test/r/innodb_mysql_lock.result index e51e7552..59b0079b 100644 --- a/mysql-wsrep-5.6/mysql-test/r/innodb_mysql_lock.result +++ b/mysql-wsrep-5.6/mysql-test/r/innodb_mysql_lock.result @@ -199,7 +199,10 @@ ERROR 23000: Duplicate entry '1' for key 'b' # Also check that copy algorithm is used ALTER IGNORE TABLE t1 ADD UNIQUE INDEX (b); affected rows: 3 -info: Records: 3 Duplicates: 2 Warnings: 0 +info: Records: 3 Duplicates: 2 Warnings: 1 +Warnings: +Warning 1681 'IGNORE' is deprecated and will be removed in a future release. SHOW WARNINGS; Level Code Message +Warning 1681 'IGNORE' is deprecated and will be removed in a future release. DROP TABLE t1; diff --git a/mysql-wsrep-5.6/mysql-test/r/innodb_mysql_sync.result b/mysql-wsrep-5.6/mysql-test/r/innodb_mysql_sync.result index ec2ae4ce..e4a17d55 100644 --- a/mysql-wsrep-5.6/mysql-test/r/innodb_mysql_sync.result +++ b/mysql-wsrep-5.6/mysql-test/r/innodb_mysql_sync.result @@ -359,3 +359,184 @@ Note 1831 Duplicate index 'i4' defined on the table 'test.t1'. This is deprecate SET DEBUG_SYNC= 'RESET'; DROP TABLE t1; SET DEBUG_SYNC= 'RESET'; +# +#BUG#13975225:ONLINE OPTIMIZE TABLE FOR INNODB TABLES +# +SET DEBUG_SYNC= 'alter_table_inplace_after_lock_downgrade SIGNAL downgraded WAIT_FOR continue'; +#Setting up INNODB table. +CREATE TABLE t1(fld1 INT, fld2 INT, fld3 INT) ENGINE= INNODB; +INSERT INTO t1 VALUES (155, 45, 55); +#Concurrent INSERT, UPDATE, SELECT and DELETE is supported +#during OPTIMIZE TABLE operation for INNODB tables. +connection default; +#OPTIMIZE TABLE operation. +OPTIMIZE TABLE t1; +connection con1; +SET DEBUG_SYNC= 'now WAIT_FOR downgraded'; +# With the patch, concurrent DML operation succeeds. +INSERT INTO t1 VALUES (10, 11, 12); +UPDATE t1 SET fld1= 20 WHERE fld1= 155; +DELETE FROM t1 WHERE fld1= 20; +SELECT * from t1; +fld1 fld2 fld3 +10 11 12 +SET DEBUG_SYNC= 'now SIGNAL continue'; +connection default; +Table Op Msg_type Msg_text +test.t1 optimize note Table does not support optimize, doing recreate + analyze instead +test.t1 optimize status OK +DROP TABLE t1; +SET DEBUG_SYNC= 'RESET'; +#Concurrent INSERT, UPDATE, SELECT and DELETE is supported +#during OPTIMIZE TABLE operation for Partitioned table. +SET DEBUG_SYNC= 'alter_table_inplace_after_lock_downgrade SIGNAL downgraded WAIT_FOR continue'; +#Setup PARTITIONED table. +CREATE TABLE t1(fld1 INT) ENGINE= INNODB PARTITION BY HASH(fld1) PARTITIONS 4; +INSERT INTO t1 VALUES(10); +#OPTIMIZE TABLE operation. +OPTIMIZE TABLE t1; +connection con1; +SET DEBUG_SYNC= 'now WAIT_FOR downgraded'; +# With the patch, concurrent DML operation succeeds. +INSERT INTO t1 VALUES (30); +UPDATE t1 SET fld1= 20 WHERE fld1= 10; +DELETE FROM t1 WHERE fld1= 20; +SELECT * from t1; +fld1 +30 +SET DEBUG_SYNC= 'now SIGNAL continue'; +connection default; +Table Op Msg_type Msg_text +test.t1 optimize note Table does not support optimize, doing recreate + analyze instead +test.t1 optimize status OK +DROP TABLE t1; +SET DEBUG_SYNC= 'RESET'; +#ALTER TABLE FORCE and ALTER TABLE ENGINE uses online rebuild +#of the table. +CREATE TABLE t1(fld1 INT, fld2 INT) ENGINE=INNODB; +INSERT INTO t1 VALUES(10, 20); +ALTER TABLE t1 FORCE; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +ALTER TABLE t1 ENGINE=INNODB; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +#ALTER TABLE FORCE, ALTER TABLE ENGINE and OPTIMIZE TABLE uses +#table copy when the old_alter_table enabled. +SET SESSION old_alter_table= TRUE; +affected rows: 0 +ALTER TABLE t1 FORCE; +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 +ALTER TABLE t1 ENGINE= INNODB; +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 +SET DEBUG_SYNC= 'alter_table_copy_after_lock_upgrade SIGNAL upgraded'; +affected rows: 0 +#OPTIMIZE TABLE operation using table copy. +OPTIMIZE TABLE t1; +connection con1; +SET DEBUG_SYNC= 'now WAIT_FOR upgraded'; +affected rows: 0 +INSERT INTO t1 VALUES(10, 20); +affected rows: 1 +connection default; +Table Op Msg_type Msg_text +test.t1 optimize note Table does not support optimize, doing recreate + analyze instead +test.t1 optimize status OK +affected rows: 2 +SET DEBUG_SYNC= 'RESET'; +affected rows: 0 +SET SESSION old_alter_table= FALSE; +affected rows: 0 +#ALTER TABLE FORCE and ALTER TABLE ENGINE uses table copy +#when ALGORITHM COPY is used. +ALTER TABLE t1 FORCE, ALGORITHM= COPY; +affected rows: 2 +info: Records: 2 Duplicates: 0 Warnings: 0 +ALTER TABLE t1 ENGINE= INNODB, ALGORITHM= COPY; +affected rows: 2 +info: Records: 2 Duplicates: 0 Warnings: 0 +DROP TABLE t1; +#OPTIMIZE TABLE on a table with FULLTEXT index uses +#ALTER TABLE FORCE using COPY algorithm here. This +#test case ensures the COPY table debug sync point is hit. +SET DEBUG_SYNC= 'alter_table_copy_after_lock_upgrade SIGNAL upgraded'; +#Setup a table with FULLTEXT index. +connection default; +CREATE TABLE t1(fld1 CHAR(10), FULLTEXT(fld1)) ENGINE= INNODB; +INSERT INTO t1 VALUES("String1"); +#OPTIMIZE TABLE operation. +OPTIMIZE TABLE t1; +connection con1; +SET DEBUG_SYNC= 'now WAIT_FOR upgraded'; +INSERT INTO t1 VALUES("String2"); +connection default; +Table Op Msg_type Msg_text +test.t1 optimize note Table does not support optimize, doing recreate + analyze instead +test.t1 optimize status OK +SET DEBUG_SYNC= 'RESET'; +DROP TABLE t1; +#Test which demonstrates that ALTER TABLE, OPTIMIZE PARTITION +#takes OPTIMIZE TABLE code path, hence does an online rebuild +#of the table with the patch. +connection default; +SET DEBUG_SYNC= 'alter_table_inplace_after_lock_downgrade SIGNAL downgraded WAIT_FOR continue'; +#Setup PARTITIONED table. +CREATE TABLE t1(fld1 INT) ENGINE= INNODB PARTITION BY HASH(fld1) PARTITIONS 4; +INSERT INTO t1 VALUES(10); +#OPTIMIZE ALL PARTITIONS operation. +ALTER TABLE t1 OPTIMIZE PARTITION ALL; +connection con1; +SET DEBUG_SYNC= 'now WAIT_FOR downgraded'; +# With the patch, concurrent DML operation succeeds. +INSERT INTO t1 VALUES (30); +UPDATE t1 SET fld1= 20 WHERE fld1= 10; +DELETE FROM t1 WHERE fld1= 20; +SELECT * from t1; +fld1 +30 +SET DEBUG_SYNC= 'now SIGNAL continue'; +connection default; +Table Op Msg_type Msg_text +test.t1 optimize note Table does not support optimize on partitions. All partitions will be rebuilt and analyzed. +test.t1 optimize status OK +SET DEBUG_SYNC= 'RESET'; +#OPTIMIZE PER PARTITION operation. +SET DEBUG_SYNC= 'alter_table_inplace_after_lock_downgrade SIGNAL downgraded WAIT_FOR continue'; +ALTER TABLE t1 OPTIMIZE PARTITION p0; +connection con1; +SET DEBUG_SYNC= 'now WAIT_FOR downgraded'; +# With the patch, concurrent DML operation succeeds. +INSERT INTO t1 VALUES (30); +UPDATE t1 SET fld1= 20 WHERE fld1= 10; +DELETE FROM t1 WHERE fld1= 20; +SELECT * from t1; +fld1 +30 +30 +SET DEBUG_SYNC= 'now SIGNAL continue'; +connection default; +Table Op Msg_type Msg_text +test.t1 optimize note Table does not support optimize on partitions. All partitions will be rebuilt and analyzed. +test.t1 optimize status OK +SET DEBUG_SYNC= 'RESET'; +# Test case for Bug#11938817 (ALTER BEHAVIOR DIFFERENT THEN DOCUMENTED). +# This should not do anything +ALTER TABLE t1; +affected rows: 0 +SET DEBUG_SYNC = 'row_log_table_apply1_before SIGNAL rebuild'; +# Check that we rebuild the table +ALTER TABLE t1 engine=innodb; +connection con1; +SET DEBUG_SYNC= 'now WAIT_FOR rebuild'; +connection default; +SET DEBUG_SYNC= 'RESET'; +SET DEBUG_SYNC = 'row_log_table_apply1_before SIGNAL rebuild'; +# Check that we rebuild the table +ALTER TABLE t1 FORCE; +connection con1; +SET DEBUG_SYNC= 'now WAIT_FOR rebuild'; +connection default; +SET DEBUG_SYNC= 'RESET'; +DROP TABLE t1; diff --git a/mysql-wsrep-5.6/mysql-test/r/innodb_recovery_with_upper_case_names.result b/mysql-wsrep-5.6/mysql-test/r/innodb_recovery_with_upper_case_names.result new file mode 100644 index 00000000..29434562 --- /dev/null +++ b/mysql-wsrep-5.6/mysql-test/r/innodb_recovery_with_upper_case_names.result @@ -0,0 +1,48 @@ +Bug #18412598 UNCLEAN SYSTEM SHUTDOWN RECOVERY FAILS +FOR SCHEMA WITH CAPITAL LETTERS +create database MYDB; +USE MYDB; +CREATE TABLE mytable (id int primary key) ENGINE=innodb; +CREATE TABLE FOO (id int,constraint FOREIGN KEY (id) REFERENCES mytable(id) ON DELETE CASCADE) ENGINE=innodb; +CREATE TABLE mytable_ref (id int,constraint FOREIGN KEY (id) REFERENCES FOO(id) ON DELETE CASCADE) ENGINE=innodb; +INSERT INTO mytable VALUES (10),(20),(30),(40); +INSERT INTO FOO VALUES (20),(10); +INSERT INTO mytable_ref VALUES (20),(10); +SHOW VARIABLES LIKE 'innodb_fast_shutdown'; +Variable_name Value +innodb_fast_shutdown 2 +START TRANSACTION; +INSERT INTO mytable VALUES (50); +INSERT INTO FOO VALUES (50); +INSERT INTO mytable_ref VALUES (50); +# Restart the server. This will go into crash recovery mode +USE MYDB; +SELECT * FROM mytable; +id +10 +20 +30 +40 +SELECT * FROM FOO; +id +10 +20 +SELECT * FROM mytable_ref; +id +10 +20 +DELETE FROM mytable WHERE id =10; +SELECT * FROM FOO; +id +20 +SELECT * FROM mytable_ref; +id +20 +CREATE TABLE MYtable (id int) ENGINE=innodb; +ERROR 42S01: Table 'mytable' already exists +CREATE TABLE Foo (id int) ENGINE=innodb; +ERROR 42S01: Table 'foo' already exists +DROP TABLE mytable_ref,FOO; +DROP TABLE mytable; +use test; +DROP DATABASE MYDB; diff --git a/mysql-wsrep-5.6/mysql-test/r/insert.result b/mysql-wsrep-5.6/mysql-test/r/insert.result index 8bc5839d..6f7169e9 100644 --- a/mysql-wsrep-5.6/mysql-test/r/insert.result +++ b/mysql-wsrep-5.6/mysql-test/r/insert.result @@ -664,6 +664,8 @@ End of 5.0 tests. drop table if exists t1; create table t1 (data varchar(4) not null); set sql_mode='error_for_division_by_zero'; +Warnings: +Warning 1681 'ERROR_FOR_DIVISION_BY_ZERO' is deprecated and will be removed in a future release. # # Demonstrate that the number of warnings matches # the information in mysql_info(). diff --git a/mysql-wsrep-5.6/mysql-test/r/loaddata.result b/mysql-wsrep-5.6/mysql-test/r/loaddata.result index 328d26ee..8ccc1a3d 100644 --- a/mysql-wsrep-5.6/mysql-test/r/loaddata.result +++ b/mysql-wsrep-5.6/mysql-test/r/loaddata.result @@ -520,3 +520,15 @@ LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug11735141.txt' INTO TABLE t1; ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field drop table t1; End of 5.1 tests +# +# Bug#11759519 INFINITE HANG WITH 100% CPU USAGE WITH LOAD DATA LOCAL AND IMPORT ERRORS +# +SET @old_mode= @@sql_mode; +CREATE TABLE t1 (fld1 INT); +SET sql_mode='strict_all_tables'; +# Without fix, load data hangs forever. +LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/mysql' REPLACE INTO TABLE t1 +FIELDS TERMINATED BY 't' LINES TERMINATED BY ''; +Got one of the listed errors +SET @@sql_mode= @old_mode; +DROP TABLE t1; diff --git a/mysql-wsrep-5.6/mysql-test/r/lock_sync.result b/mysql-wsrep-5.6/mysql-test/r/lock_sync.result index 219cc083..52d2d979 100644 --- a/mysql-wsrep-5.6/mysql-test/r/lock_sync.result +++ b/mysql-wsrep-5.6/mysql-test/r/lock_sync.result @@ -752,6 +752,9 @@ SET DEBUG_SYNC="RESET"; DROP TABLE IF EXISTS t1; CREATE TABLE t1(a INT) engine=InnoDB; INSERT INTO t1 VALUES (1), (2); +# Note: This test now provides coverage for the scenario where +# opening of table during analyze phase of OPTIMIZE TABLE +# fails (instead of original coverage for open_ltable() code). # Connection con1 SET SESSION lock_wait_timeout= 1; SET DEBUG_SYNC= 'ha_admin_open_ltable SIGNAL opti_recreate WAIT_FOR opti_analyze'; @@ -761,7 +764,7 @@ OPTIMIZE TABLE t1; SET DEBUG_SYNC= 'now WAIT_FOR opti_recreate'; SET DEBUG_SYNC= 'after_lock_tables_takes_lock SIGNAL thrlock WAIT_FOR release_thrlock'; # Sending: -INSERT INTO t1 VALUES (3); +LOCK TABLES t1 WRITE; # Connection default SET DEBUG_SYNC= 'now WAIT_FOR thrlock'; SET DEBUG_SYNC= 'now SIGNAL opti_analyze'; @@ -775,7 +778,7 @@ Warnings: Error 1205 Lock wait timeout exceeded; try restarting transaction SET DEBUG_SYNC= 'now SIGNAL release_thrlock'; # Connection con2 -# Reaping: INSERT INTO t1 VALUES (3) +# Reaping: LOCK TABLES t1 WRITE # Connection default DROP TABLE t1; SET DEBUG_SYNC= 'RESET'; @@ -814,3 +817,90 @@ Warning 1356 View 'test.v1' references invalid table(s) or column(s) or function SET DEBUG_SYNC= 'RESET'; DROP VIEW v1; DROP TABLE t1; +# +#Bug#18110156: RECREATE+ANALYZE OPTIMIZE TABLE T AND ONLINE +# ALTER TABLE T MAY DEADLOCK +CREATE TABLE t1 (fld1 INT) ENGINE=InnoDB; +connection con1; +SET DEBUG_SYNC= 'before_lock_tables_takes_lock SIGNAL before_thr_lock WAIT_FOR do_thr_lock EXECUTE 3'; +SET DEBUG_SYNC= 'ha_admin_open_ltable SIGNAL opti_recreate WAIT_FOR opti_analyze'; +OPTIMIZE TABLE t1; +connection con2; +# Skip thr_lock acquisition during the initial phase of OPTIMIZE TABLE +SET DEBUG_SYNC= 'now WAIT_FOR before_thr_lock'; +SET DEBUG_SYNC= 'now SIGNAL do_thr_lock'; +# Skip thr_lock acquisition during the recreate phase of OPTIMIZE TABLE +SET DEBUG_SYNC= 'now WAIT_FOR before_thr_lock'; +SET DEBUG_SYNC= 'now SIGNAL do_thr_lock'; +SET DEBUG_SYNC= 'now WAIT_FOR opti_recreate'; +SET DEBUG_SYNC= 'alter_table_inplace_after_lock_downgrade SIGNAL lock_downgraded +WAIT_FOR finish_alter'; +ALTER TABLE t1 ADD INDEX index1(fld1), ALGORITHM=INPLACE, LOCK=NONE; +#Without the patch, the test case hangs. +connection default; +SET DEBUG_SYNC= 'now WAIT_FOR lock_downgraded'; +SET DEBUG_SYNC= 'now SIGNAL opti_analyze'; +SET DEBUG_SYNC= 'now WAIT_FOR before_thr_lock'; +SET DEBUG_SYNC= 'now SIGNAL finish_alter'; +SET DEBUG_SYNC= 'now SIGNAL do_thr_lock'; +#Reap: OPTIMIZE TABLE t1 +connection con1; +Table Op Msg_type Msg_text +test.t1 optimize note Table does not support optimize, doing recreate + analyze instead +test.t1 optimize status OK +#Reap: ALTER TABLE t1 +connection con2; +#Clean up. +DROP TABLE t1; +SET DEBUG_SYNC= 'RESET'; +# +# Bug#19070633 - POSSIBLE ACCESS TO FREED MEMORY IN IS_FREE_LOCK() AND IS_USED_LOCK(). +# +# Verifying issue for IS_FREE_LOCK() function. +SELECT GET_LOCK("lock_19070633", 600); +GET_LOCK("lock_19070633", 600) +1 +connect con1, localhost, root,,; +# Waiting after getting user level lock info and releasing mutex. +SET DEBUG_SYNC= 'after_getting_user_level_lock_info SIGNAL parked WAIT_FOR go'; +# Sending: SELECT IS_FREE_LOCK("lock_19070633"); +SELECT IS_FREE_LOCK("lock_19070633"); +connection default; +SET DEBUG_SYNC= 'now WAIT_FOR parked'; +SELECT RELEASE_LOCK("lock_19070633"); +RELEASE_LOCK("lock_19070633") +1 +# Signaling connection con1 after releasing the lock. +# Without fix, accessing user level lock info in con1 would result in +# crash or valgrind issue invalid read is reported. +SET DEBUG_SYNC= 'now SIGNAL go'; +connection con1; +# Reaping: SELECT IS_FREE_LOCK("lock_19070633"); +IS_FREE_LOCK("lock_19070633") +0 +connection default; +# Verifying issue for IS_USED_LOCK() function. +SELECT GET_LOCK("lock_19070633", 600); +GET_LOCK("lock_19070633", 600) +1 +connection con1; +# Waiting after getting user level lock info and releasing mutex. +SET DEBUG_SYNC= 'after_getting_user_level_lock_info SIGNAL parked WAIT_FOR go'; +# Sending: SELECT IS_USED_LOCK("lock_19070633"); +SELECT IS_USED_LOCK("lock_19070633"); +connection default; +SET DEBUG_SYNC= 'now WAIT_FOR parked'; +SELECT RELEASE_LOCK("lock_19070633"); +RELEASE_LOCK("lock_19070633") +1 +# Signaling connection con1 after releasing the lock. +# Without fix, accessing user level lock info in con1 would result in +# crash or valgrind issue invalid read is reported. +SET DEBUG_SYNC= 'now SIGNAL go'; +connection con1; +# Reaping: SELECT IS_USED_LOCK("lock_19070633"); +IS_USED_LOCK("lock_19070633") +# +connection default; +SET DEBUG_SYNC= 'RESET'; +disconnect con1; diff --git a/mysql-wsrep-5.6/mysql-test/r/log_errchk.result b/mysql-wsrep-5.6/mysql-test/r/log_errchk.result new file mode 100644 index 00000000..be5e14cf --- /dev/null +++ b/mysql-wsrep-5.6/mysql-test/r/log_errchk.result @@ -0,0 +1,10 @@ +call mtr.add_suppression("Could not open"); +# Case 1: Setting fife file to general_log_file and slow_query_log_file +# system variable. +SET GLOBAL general_log_file="MYSQLTEST_VARDIR/tmp/general_log.fifo";; +ERROR 42000: Variable 'general_log_file' can't be set to the value of 'MYSQLTEST_VARDIR/tmp/general_log.fifo' +SET GLOBAL slow_query_log_file="MYSQLTEST_VARDIR/tmp/slow_log.fifo";; +ERROR 42000: Variable 'slow_query_log_file' can't be set to the value of 'MYSQLTEST_VARDIR/tmp/slow_log.fifo' +# Case 2: Starting server with fifo file as general log file +# and slow query log file. +Setting fifo file as general log file and slow query log failed. diff --git a/mysql-wsrep-5.6/mysql-test/r/lowercase_table4.result b/mysql-wsrep-5.6/mysql-test/r/lowercase_table4.result old mode 100755 new mode 100644 diff --git a/mysql-wsrep-5.6/mysql-test/r/myisam.result b/mysql-wsrep-5.6/mysql-test/r/myisam.result index 33c2265b..56814e2b 100644 --- a/mysql-wsrep-5.6/mysql-test/r/myisam.result +++ b/mysql-wsrep-5.6/mysql-test/r/myisam.result @@ -2537,3 +2537,82 @@ f1 Warnings: Warning 1292 Truncated incorrect DOUBLE value: 'lhsi' DROP TABLE t1; +# +# Bug 17156940 THE UPDATE AND SELECT BEHAVE DIFFERENTLY +# UNDER THE SAME CONDITIONS. +# +CREATE TABLE t1 ( +col1 VARCHAR(255) DEFAULT NULL, +col1_id INT(11) DEFAULT NULL, +KEY col1 (col1), +KEY col1_id (col1_id) +) ENGINE=MyISAM; +INSERT INTO t1 (col1, col1_id) VALUES +('5cm', 10000), ('people', 10000), ('king', 10000), ('queen', 10000), +('minister', 10000), ('servent', 13000); +INSERT INTO t1 (col1, col1_id) +SELECT col1, col1_id FROM t1 WHERE col1 <> '5cm'; +INSERT INTO t1 (col1, col1_id) +SELECT col1, col1_id FROM t1 WHERE col1 <> '5cm'; +INSERT INTO t1 (col1, col1_id) +SELECT col1, col1_id FROM t1 WHERE col1 <> '5cm'; +INSERT INTO t1 (col1, col1_id) VALUES +('5cm ', 10000), ('5cm ', 10000); +SELECT col1, hex(col1), col1_id, count(*) from t1 +WHERE col1= '5cm' GROUP BY hex(col1), col1_id; +col1 hex(col1) col1_id count(*) +5cm 35636D 10000 1 +5cm 35636D20 10000 2 +UPDATE t1 SET col1_id= 1414 WHERE col1= '5cm'; +SELECT count(*) FROM t1 WHERE col1= '5cm'; +count(*) +3 +SELECT count(*) FROM t1 WHERE col1_id= 1414; +count(*) +3 +DELETE FROM t1 WHERE col1= '5cm'; +SELECT count(*) FROM t1 WHERE col1= '5cm'; +count(*) +0 +DROP TABLE t1; +# Test for multi column key. +CREATE TABLE t1 ( +col1 VARCHAR(255) DEFAULT NULL, +col1_dummy VARCHAR(25) DEFAULT NULL, +col1_id INT(11) DEFAULT NULL, +col1_id_dummy INT(10) DEFAULT NULL, +KEY col1 (col1, col1_dummy), +KEY col1_id (col1, col1_id_dummy) +) ENGINE=MyISAM; +INSERT INTO t1 (col1, col1_dummy, col1_id, col1_id_dummy) VALUES +('5cm', '5cm' , 10000, 100), ('people', 'people', 10000, 100), +('king', 'king' , 10000, 100), ('queen', 'queen', 10000, 100), +('minister', 'minister', 10000, 100), ('servent', 'servent', 13000, 100); +INSERT INTO t1 (col1, col1_dummy, col1_id, col1_id_dummy) +SELECT col1, col1_dummy, col1_id, col1_id_dummy FROM t1 +WHERE col1 <> '5cm'; +INSERT INTO t1 (col1, col1_dummy, col1_id, col1_id_dummy) +SELECT col1, col1_dummy, col1_id, col1_id_dummy FROM t1 +WHERE col1 <> '5cm'; +INSERT INTO t1 (col1, col1_dummy, col1_id, col1_id_dummy) +SELECT col1, col1_dummy, col1_id, col1_id_dummy FROM t1 +WHERE col1 <> '5cm'; +INSERT INTO t1 (col1, col1_dummy, col1_id, col1_id_dummy) VALUES +('5cm ', '5cm ', 10000, 100), ('5cm ', '5cm ', 10000, 100); +SELECT col1, hex(col1), col1_id, count(*) from t1 WHERE col1= '5cm' + GROUP BY hex(col1), col1_id; +col1 hex(col1) col1_id count(*) +5cm 35636D 10000 1 +5cm 35636D20 10000 2 +UPDATE t1 SET col1_id= 1414 WHERE col1= '5cm' AND col1_dummy= '5cm'; +SELECT count(*) FROM t1 WHERE col1= '5cm'; +count(*) +3 +SELECT count(*) FROM t1 WHERE col1_id= 1414; +count(*) +3 +DELETE FROM t1 WHERE col1= '5cm' AND col1_dummy= '5cm'; +SELECT count(*) FROM t1 WHERE col1= '5cm'; +count(*) +0 +DROP TABLE t1; diff --git a/mysql-wsrep-5.6/mysql-test/r/mysql_config_editor.result b/mysql-wsrep-5.6/mysql-test/r/mysql_config_editor.result index 2869a91b..a84fa308 100644 --- a/mysql-wsrep-5.6/mysql-test/r/mysql_config_editor.result +++ b/mysql-wsrep-5.6/mysql-test/r/mysql_config_editor.result @@ -100,7 +100,7 @@ user = test_user4 ############################################## # Tests for mysql_config_editor's help command ############################################## -Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. +Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective diff --git a/mysql-wsrep-5.6/mysql-test/r/mysql_upgrade.result b/mysql-wsrep-5.6/mysql-test/r/mysql_upgrade.result index d8b72d7b..627f359a 100644 --- a/mysql-wsrep-5.6/mysql-test/r/mysql_upgrade.result +++ b/mysql-wsrep-5.6/mysql-test/r/mysql_upgrade.result @@ -117,6 +117,8 @@ Warning: Using a password on the command line interface can be insecure. mysqlcheck: Got error: 2005: Unknown MySQL server host 'not_existing_host' (errno) when trying to connect FATAL ERROR: Upgrade failed set GLOBAL sql_mode='STRICT_ALL_TABLES,ANSI_QUOTES,NO_ZERO_DATE'; +Warnings: +Warning 1681 'NO_ZERO_DATE' is deprecated and will be removed in a future release. Warning: Using a password on the command line interface can be insecure. Warning: Using a password on the command line interface can be insecure. mysql.columns_priv OK @@ -363,6 +365,7 @@ mtr.test_suppressions OK CREATE USER 'bug13586336'@'localhost' IDENTIFIED WITH 'mysql_old_password'; SET PASSWORD FOR 'bug13586336'@'localhost' = OLD_PASSWORD('a'); Warnings: +Warning 1287 'OLD_PASSWORD' is deprecated and will be removed in a future release. Please use PASSWORD instead Warning 1287 'pre-4.1 password hash' is deprecated and will be removed in a future release. Please use post-4.1 password hash instead Run mysql_upgrade with all privileges on a user Warning: Using a password on the command line interface can be insecure. @@ -402,5 +405,102 @@ Warning: Using a password on the command line interface can be insecure. mtr.global_suppressions OK mtr.test_suppressions OK DROP USER 'bug13586336'@'localhost'; +# +# Bug #20023823 BACKPORT THE FIX FOR MYSQL_INSTALL_DB/MYSQL_UPGRADE +# ON NON-EMPTY PLUGIN COLUMN +# +# Creating user with empty plugin and empty password +# plugin should be changed to mysql_native_password after the update +CREATE USER B20023823_empty@localhost; +GRANT ALL PRIVILEGES on *.* TO B20023823_empty@localhost; +update mysql.user set plugin='' WHERE user='B20023823_empty' + and host='localhost'; +flush privileges; +# Creating user with default plugin, i.e. mysql_native_password +# this plugin should not be changed during the upgrade +CREATE USER B20023823_def@localhost IDENTIFIED BY 'test'; +# Creating user with 41 bytes hash pass (default) and setting its plugin +# to empty string. Plugin should be set to mysql_native_password +# after the upgrade is finished +CREATE USER B20023823_41hash@localhost IDENTIFIED WITH mysql_native_password; +set session old_passwords=0; +set password for B20023823_41hash@localhost = password('test'); +update mysql.user set plugin='' WHERE user='B20023823_41hash' + and host='localhost'; +flush privileges; +# Creating user with 16 bytes hash pass and setting its plugin +# to empty string. Plugin should be set to mysql_old_password +# after the upgrade is finished +CREATE USER B20023823_16hash@localhost identified with mysql_old_password; +set session old_passwords=1; +set password for B20023823_16hash@localhost = password('test'); +Warnings: +Warning 1287 'pre-4.1 password hash' is deprecated and will be removed in a future release. Please use post-4.1 password hash instead +update mysql.user set plugin='' WHERE user='B20023823_16hash' + and host='localhost'; +flush privileges; +SELECT user, plugin from mysql.user; +user plugin +root mysql_native_password +root mysql_native_password +root mysql_native_password +root mysql_native_password +B20023823_empty +B20023823_def mysql_native_password +B20023823_41hash +B20023823_16hash +# repair the user's plugin +Warning: Using a password on the command line interface can be insecure. +Warning: Using a password on the command line interface can be insecure. +mysql.columns_priv OK +mysql.db OK +mysql.event OK +mysql.func OK +mysql.general_log OK +mysql.help_category OK +mysql.help_keyword OK +mysql.help_relation OK +mysql.help_topic OK +mysql.innodb_index_stats OK +mysql.innodb_table_stats OK +mysql.ndb_binlog_index OK +mysql.plugin OK +mysql.proc OK +mysql.procs_priv OK +mysql.proxies_priv OK +mysql.servers OK +mysql.slave_master_info OK +mysql.slave_relay_log_info OK +mysql.slave_worker_info OK +mysql.slow_log OK +mysql.tables_priv OK +mysql.time_zone OK +mysql.time_zone_leap_second OK +mysql.time_zone_name OK +mysql.time_zone_transition OK +mysql.time_zone_transition_type OK +mysql.user OK +Warning: Using a password on the command line interface can be insecure. +Warning 1642 Pre-4.1 password hash found. It is deprecated and will be removed in a future release. Please upgrade it to a new format. +Warning: Using a password on the command line interface can be insecure. +Warning: Using a password on the command line interface can be insecure. +mtr.global_suppressions OK +mtr.test_suppressions OK +# expect non-empty +SELECT user, plugin from mysql.user; +user plugin +root mysql_native_password +root mysql_native_password +root mysql_native_password +root mysql_native_password +B20023823_empty mysql_native_password +B20023823_def mysql_native_password +B20023823_41hash mysql_native_password +B20023823_16hash mysql_old_password +# cleanup +DROP USER B20023823_empty@localhost; +DROP USER B20023823_def@localhost; +DROP USER B20023823_41hash@localhost; +DROP USER B20023823_16hash@localhost; End of tests diff --git a/mysql-wsrep-5.6/mysql-test/r/mysqlbinlog_debug.result b/mysql-wsrep-5.6/mysql-test/r/mysqlbinlog_debug.result new file mode 100644 index 00000000..0e27778c --- /dev/null +++ b/mysql-wsrep-5.6/mysql-test/r/mysqlbinlog_debug.result @@ -0,0 +1,7 @@ +# +# Bug#18742916 : MYSQLBINLOG --RAW DOES NOT CHECK FOR ERRORS +# +ERROR: Could not write into log file 'MYSQLTEST_VARDIR/tmp/master-bin.000001' +ERROR: Could not write into log file 'MYSQLTEST_VARDIR/tmp/master-bin.000001' + +End of tests diff --git a/mysql-wsrep-5.6/mysql-test/r/mysqlbinlog_mixed_or_statment.result b/mysql-wsrep-5.6/mysql-test/r/mysqlbinlog_mixed_or_statment.result new file mode 100644 index 00000000..4a08c4d3 --- /dev/null +++ b/mysql-wsrep-5.6/mysql-test/r/mysqlbinlog_mixed_or_statment.result @@ -0,0 +1,26 @@ +# +# Bug#18913551 - LOCK TABLES USES INCORRECT LOCK FOR IMPLICITLY USED +# TABLES. +# +SET @org_concurrent_insert= @@global.concurrent_insert; +SET @@global.concurrent_insert=1; +CREATE TABLE t1(a INT) ENGINE=MyISAM; +CREATE FUNCTION f1() RETURNS INT RETURN (SELECT MIN(a) FROM t1); +CREATE VIEW v1 AS (SELECT 1 FROM dual WHERE f1() = 1); +LOCK TABLE v1 READ; +connect con1, localhost, root; +SET lock_wait_timeout=1; +# With fix, con1 does not get lock on table "t1" so following insert +# operation fails after waiting for "lock_wait_timeout" duration. +INSERT INTO t1 VALUES (1); +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +connection default; +UNLOCK TABLES; +# V1 should be empty here. +SELECT * FROM v1; +1 +disconnect con1; +SET @@global.concurrent_insert= @org_concurrent_insert; +DROP TABLE t1; +DROP VIEW v1; +DROP FUNCTION f1; diff --git a/mysql-wsrep-5.6/mysql-test/r/mysqlcheck.result b/mysql-wsrep-5.6/mysql-test/r/mysqlcheck.result index f210aed3..5bc31ae8 100644 --- a/mysql-wsrep-5.6/mysql-test/r/mysqlcheck.result +++ b/mysql-wsrep-5.6/mysql-test/r/mysqlcheck.result @@ -314,10 +314,7 @@ CHECK TABLE bug47205 FOR UPGRADE; Table Op Msg_type Msg_text test.bug47205 check error Table rebuild required. Please do "ALTER TABLE `bug47205` FORCE" or dump/reload to fix it! # ALTER TABLE ... FORCE should rebuild the table -# and therefore output "affected rows: 1" ALTER TABLE bug47205 FORCE; -affected rows: 1 -info: Records: 1 Duplicates: 0 Warnings: 0 # Table should now be ok CHECK TABLE bug47205 FOR UPGRADE; Table Op Msg_type Msg_text diff --git a/mysql-wsrep-5.6/mysql-test/r/mysqld--help-notwin.result b/mysql-wsrep-5.6/mysql-test/r/mysqld--help-notwin.result index aa4b3ebf..18b21ffd 100644 --- a/mysql-wsrep-5.6/mysql-test/r/mysqld--help-notwin.result +++ b/mysql-wsrep-5.6/mysql-test/r/mysqld--help-notwin.result @@ -56,6 +56,10 @@ The following options may be given as the first argument: --binlog-do-db=name Tells the master it should log updates for the specified database, and exclude all others not explicitly mentioned. + --binlog-error-action=name + When statements cannot be written to the binary log due + to a fatal error, the server can either ignore the error + and let the master continue, or abort. --binlog-format=name What form of binary logging the master will use: either ROW for row-based binary logging, STATEMENT for @@ -68,6 +72,19 @@ The following options may be given as the first argument: binlog-format is MIXED, the format switches to row-based and back implicitly per each query accessing an NDBCLUSTER table + --binlog-gtid-simple-recovery + If this option is enabled, the server does not scan more + than one binary log for every iteration when initializing + GTID sets on server restart. Enabling this option is very + useful when restarting a server which has already + generated lots of binary logs without GTID events. Note: + If this option is enabled, GLOBAL.GTID_EXECUTED and + GLOBAL.GTID_PURGED cannot be initialized correctly if + binary log(s) with GTID events were generated before + binary log(s) without GTID events, for example if + gtid_mode is disabled when the server has already + generated binary log(s) with GTID events and not purged + them. --binlog-ignore-db=name Tells the master that updates to the given database should not be logged to the binary log. @@ -103,6 +120,14 @@ The following options may be given as the first argument: non-transactional engines for the binary log. If you often use statements updating a great number of rows, you can increase this to get more performance + --binlogging-impossible-mode=name + On a fatal error when statements cannot be binlogged the + behaviour can be ignore the error and let the master + continue or abort the server. This variable is deprecated + and will be removed in a future release. Please use + binlog_error_action instead. + --block-encryption-mode=name + mode for AES_ENCRYPT/AES_DECRYPT --bootstrap Used by mysql installation scripts. --bulk-insert-buffer-size=# Size of tree cache used in bulk insert optimisation. Note @@ -809,6 +834,8 @@ The following options may be given as the first argument: --show-slave-auth-info Show user and password in SHOW SLAVE HOSTS on this master. + --simplified-binlog-gtid-recovery + Alias for @@binlog_gtid_simple_recovery. Deprecated --skip-grant-tables Start without grant tables. This gives all users FULL ACCESS to all tables. --skip-host-cache Don't cache host names. @@ -948,8 +975,8 @@ The following options may be given as the first argument: one-thread-per-connection, no-threads, loaded-dynamically --thread-stack=# The stack size for each thread --time-format=name The TIME format (ignored) - --timed-mutexes Specify whether to time mutexes (only InnoDB mutexes are - currently supported) + --timed-mutexes Specify whether to time mutexes. Deprecated, has no + effect. --tmp-table-size=# If an internal in-memory temporary table exceeds this size, MySQL will automatically convert it to an on-disk MyISAM table @@ -997,13 +1024,17 @@ bind-address * binlog-cache-size 32768 binlog-checksum CRC32 binlog-direct-non-transactional-updates FALSE +binlog-error-action IGNORE_ERROR binlog-format STATEMENT +binlog-gtid-simple-recovery FALSE binlog-max-flush-queue-time 0 binlog-order-commits TRUE binlog-row-event-max-size 8192 binlog-row-image FULL binlog-rows-query-log-events FALSE binlog-stmt-cache-size 32768 +binlogging-impossible-mode IGNORE_ERROR +block-encryption-mode aes-128-ecb bulk-insert-buffer-size 8388608 character-set-client-handshake TRUE character-set-filesystem binary @@ -1219,6 +1250,7 @@ secure-file-priv (No default value) server-id 0 server-id-bits 32 show-slave-auth-info FALSE +simplified-binlog-gtid-recovery FALSE skip-grant-tables TRUE skip-name-resolve FALSE skip-networking FALSE diff --git a/mysql-wsrep-5.6/mysql-test/r/mysqld--help-win.result b/mysql-wsrep-5.6/mysql-test/r/mysqld--help-win.result index cdc8f509..7e5e2596 100644 --- a/mysql-wsrep-5.6/mysql-test/r/mysqld--help-win.result +++ b/mysql-wsrep-5.6/mysql-test/r/mysqld--help-win.result @@ -56,6 +56,10 @@ The following options may be given as the first argument: --binlog-do-db=name Tells the master it should log updates for the specified database, and exclude all others not explicitly mentioned. + --binlog-error-action=name + When statements cannot be written to the binary log due + to a fatal error, the server can either ignore the error + and let the master continue, or abort. --binlog-format=name What form of binary logging the master will use: either ROW for row-based binary logging, STATEMENT for @@ -68,6 +72,19 @@ The following options may be given as the first argument: binlog-format is MIXED, the format switches to row-based and back implicitly per each query accessing an NDBCLUSTER table + --binlog-gtid-simple-recovery + If this option is enabled, the server does not scan more + than one binary log for every iteration when initializing + GTID sets on server restart. Enabling this option is very + useful when restarting a server which has already + generated lots of binary logs without GTID events. Note: + If this option is enabled, GLOBAL.GTID_EXECUTED and + GLOBAL.GTID_PURGED cannot be initialized correctly if + binary log(s) with GTID events were generated before + binary log(s) without GTID events, for example if + gtid_mode is disabled when the server has already + generated binary log(s) with GTID events and not purged + them. --binlog-ignore-db=name Tells the master that updates to the given database should not be logged to the binary log. @@ -103,6 +120,14 @@ The following options may be given as the first argument: non-transactional engines for the binary log. If you often use statements updating a great number of rows, you can increase this to get more performance + --binlogging-impossible-mode=name + On a fatal error when statements cannot be binlogged the + behaviour can be ignore the error and let the master + continue or abort the server. This variable is deprecated + and will be removed in a future release. Please use + binlog_error_action instead. + --block-encryption-mode=name + mode for AES_ENCRYPT/AES_DECRYPT --bootstrap Used by mysql installation scripts. --bulk-insert-buffer-size=# Size of tree cache used in bulk insert optimisation. Note @@ -812,6 +837,8 @@ The following options may be given as the first argument: --show-slave-auth-info Show user and password in SHOW SLAVE HOSTS on this master. + --simplified-binlog-gtid-recovery + Alias for @@binlog_gtid_simple_recovery. Deprecated --skip-grant-tables Start without grant tables. This gives all users FULL ACCESS to all tables. --skip-host-cache Don't cache host names. @@ -956,8 +983,8 @@ The following options may be given as the first argument: one-thread-per-connection, no-threads, loaded-dynamically --thread-stack=# The stack size for each thread --time-format=name The TIME format (ignored) - --timed-mutexes Specify whether to time mutexes (only InnoDB mutexes are - currently supported) + --timed-mutexes Specify whether to time mutexes. Deprecated, has no + effect. --tmp-table-size=# If an internal in-memory temporary table exceeds this size, MySQL will automatically convert it to an on-disk MyISAM table @@ -1005,13 +1032,17 @@ bind-address * binlog-cache-size 32768 binlog-checksum CRC32 binlog-direct-non-transactional-updates FALSE +binlog-error-action IGNORE_ERROR binlog-format STATEMENT +binlog-gtid-simple-recovery FALSE binlog-max-flush-queue-time 0 binlog-order-commits TRUE binlog-row-event-max-size 8192 binlog-row-image FULL binlog-rows-query-log-events FALSE binlog-stmt-cache-size 32768 +binlogging-impossible-mode IGNORE_ERROR +block-encryption-mode aes-128-ecb bulk-insert-buffer-size 8388608 character-set-client-handshake TRUE character-set-filesystem binary @@ -1229,6 +1260,7 @@ server-id-bits 32 shared-memory FALSE shared-memory-base-name MYSQL show-slave-auth-info FALSE +simplified-binlog-gtid-recovery FALSE skip-grant-tables TRUE skip-name-resolve FALSE skip-networking FALSE diff --git a/mysql-wsrep-5.6/mysql-test/r/mysqldump.result b/mysql-wsrep-5.6/mysql-test/r/mysqldump.result index 784a3f15..c1299119 100644 --- a/mysql-wsrep-5.6/mysql-test/r/mysqldump.result +++ b/mysql-wsrep-5.6/mysql-test/r/mysqldump.result @@ -1987,11 +1987,9 @@ DROP TABLE IF EXISTS `v2`; /*!50001 DROP VIEW IF EXISTS `v2`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `v2` ( - `a` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `v2` AS SELECT + 1 AS `a`*/; SET character_set_client = @saved_cs_client; -/*!50001 DROP TABLE IF EXISTS `v2`*/; /*!50001 DROP VIEW IF EXISTS `v2`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -2081,11 +2079,9 @@ DROP TABLE IF EXISTS `v1`; /*!50001 DROP VIEW IF EXISTS `v1`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `v1` ( - `a` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `v1` AS SELECT + 1 AS `a`*/; SET character_set_client = @saved_cs_client; -/*!50001 DROP TABLE IF EXISTS `v1`*/; /*!50001 DROP VIEW IF EXISTS `v1`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -2155,11 +2151,9 @@ DROP TABLE IF EXISTS `v2`; /*!50001 DROP VIEW IF EXISTS `v2`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `v2` ( - `a` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `v2` AS SELECT + 1 AS `a`*/; SET character_set_client = @saved_cs_client; -/*!50001 DROP TABLE IF EXISTS `v2`*/; /*!50001 DROP VIEW IF EXISTS `v2`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -2269,31 +2263,27 @@ DROP TABLE IF EXISTS `v1`; /*!50001 DROP VIEW IF EXISTS `v1`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `v1` ( - `a` tinyint NOT NULL, - `b` tinyint NOT NULL, - `c` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `v1` AS SELECT + 1 AS `a`, + 1 AS `b`, + 1 AS `c`*/; SET character_set_client = @saved_cs_client; DROP TABLE IF EXISTS `v2`; /*!50001 DROP VIEW IF EXISTS `v2`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `v2` ( - `a` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `v2` AS SELECT + 1 AS `a`*/; SET character_set_client = @saved_cs_client; DROP TABLE IF EXISTS `v3`; /*!50001 DROP VIEW IF EXISTS `v3`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `v3` ( - `a` tinyint NOT NULL, - `b` tinyint NOT NULL, - `c` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `v3` AS SELECT + 1 AS `a`, + 1 AS `b`, + 1 AS `c`*/; SET character_set_client = @saved_cs_client; -/*!50001 DROP TABLE IF EXISTS `v1`*/; /*!50001 DROP VIEW IF EXISTS `v1`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -2307,7 +2297,6 @@ SET character_set_client = @saved_cs_client; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; -/*!50001 DROP TABLE IF EXISTS `v2`*/; /*!50001 DROP VIEW IF EXISTS `v2`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -2321,7 +2310,6 @@ SET character_set_client = @saved_cs_client; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; -/*!50001 DROP TABLE IF EXISTS `v3`*/; /*!50001 DROP VIEW IF EXISTS `v3`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -3026,35 +3014,31 @@ DROP TABLE IF EXISTS `v0`; /*!50001 DROP VIEW IF EXISTS `v0`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `v0` ( - `a` tinyint NOT NULL, - `b` tinyint NOT NULL, - `c` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `v0` AS SELECT + 1 AS `a`, + 1 AS `b`, + 1 AS `c`*/; SET character_set_client = @saved_cs_client; DROP TABLE IF EXISTS `v1`; /*!50001 DROP VIEW IF EXISTS `v1`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `v1` ( - `a` tinyint NOT NULL, - `b` tinyint NOT NULL, - `c` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `v1` AS SELECT + 1 AS `a`, + 1 AS `b`, + 1 AS `c`*/; SET character_set_client = @saved_cs_client; DROP TABLE IF EXISTS `v2`; /*!50001 DROP VIEW IF EXISTS `v2`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `v2` ( - `a` tinyint NOT NULL, - `b` tinyint NOT NULL, - `c` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `v2` AS SELECT + 1 AS `a`, + 1 AS `b`, + 1 AS `c`*/; SET character_set_client = @saved_cs_client; USE `test`; -/*!50001 DROP TABLE IF EXISTS `v0`*/; /*!50001 DROP VIEW IF EXISTS `v0`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -3068,7 +3052,6 @@ USE `test`; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; -/*!50001 DROP TABLE IF EXISTS `v1`*/; /*!50001 DROP VIEW IF EXISTS `v1`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -3082,7 +3065,6 @@ USE `test`; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; -/*!50001 DROP TABLE IF EXISTS `v2`*/; /*!50001 DROP VIEW IF EXISTS `v2`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -3320,7 +3302,7 @@ insert into t values(5, 51); create view v1 as select qty, price, qty*price as value from t; create view v2 as select qty from v1; mysqldump { -/*!50001 DROP TABLE IF EXISTS `v1`*/; +/*!50001 DROP VIEW IF EXISTS `v1`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; /*!50001 SET @saved_col_connection = @@collation_connection */; @@ -3335,7 +3317,7 @@ mysqldump { /*!50001 SET collation_connection = @saved_col_connection */; } mysqldump { -/*!50001 DROP TABLE IF EXISTS `v2`*/; +/*!50001 DROP VIEW IF EXISTS `v2`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; /*!50001 SET @saved_col_connection = @@collation_connection */; @@ -3428,13 +3410,11 @@ DROP TABLE IF EXISTS `v1`; /*!50001 DROP VIEW IF EXISTS `v1`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `v1` ( - `id` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `v1` AS SELECT + 1 AS `id`*/; SET character_set_client = @saved_cs_client; USE `mysqldump_test_db`; -/*!50001 DROP TABLE IF EXISTS `v1`*/; /*!50001 DROP VIEW IF EXISTS `v1`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -3488,15 +3468,14 @@ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqldump_views` /*!40100 DEFAULT CHAR USE `mysqldump_views`; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `nasishnasifu` ( - `id` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `nasishnasifu` AS SELECT + 1 AS `id`*/; SET character_set_client = @saved_cs_client; USE `mysqldump_tables`; USE `mysqldump_views`; -/*!50001 DROP TABLE IF EXISTS `nasishnasifu`*/; +/*!50001 DROP VIEW IF EXISTS `nasishnasifu`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; /*!50001 SET @saved_col_connection = @@collation_connection */; @@ -3881,11 +3860,9 @@ DROP TABLE IF EXISTS `v2`; /*!50001 DROP VIEW IF EXISTS `v2`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `v2` ( - `c` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `v2` AS SELECT + 1 AS `c`*/; SET character_set_client = @saved_cs_client; -/*!50001 DROP TABLE IF EXISTS `v2`*/; /*!50001 DROP VIEW IF EXISTS `v2`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -4298,13 +4275,11 @@ DROP TABLE IF EXISTS `v1`; /*!50001 DROP VIEW IF EXISTS `v1`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE TABLE `v1` ( - `id` tinyint NOT NULL -) ENGINE=MyISAM */; +/*!50001 CREATE VIEW `v1` AS SELECT + 1 AS `id`*/; SET character_set_client = @saved_cs_client; USE `mysqldump_test_db`; -/*!50001 DROP TABLE IF EXISTS `v1`*/; /*!50001 DROP VIEW IF EXISTS `v1`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -5409,3 +5384,23 @@ SET @@global.general_log= @old_general_log_state; # # End of 5.1 tests # +# +#BUG#17477959 - VIEW COLUMNS EXCEED TABLE LIMITS +# +CREATE VIEW v1 AS SELECT 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit1, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit2, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit3, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit4, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit5, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit6, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit7, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit8, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit9, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit10, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit11, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit12, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit13, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit14, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit15, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit16, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit17, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit18, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit19, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit20, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit21, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit22, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit23, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit24, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit25, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit26, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit27, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit28, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit29, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit30, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit31, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit32, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit33, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit34, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit35, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit36, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit37, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit38, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit39, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit40, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit41, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit42, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit43, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit44, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit45, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit46, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit47, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit48, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit49, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit50, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit51, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit52, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit53, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit54, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit55, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit56, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit57, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit58, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit59, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit60, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit61, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit62, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit63, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit64, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit65, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit66, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit67, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit68, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit69, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit70, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit71, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit72, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit73, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit74, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit75, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit76, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit77, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit78, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit79, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit80, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit81, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit82, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit83, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit84, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit85, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit86, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit87, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit88, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit89, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit90, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit91, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit92, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit93, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit94, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit95, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit96, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit97, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit98, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit99, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit100, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit101, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit102, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit103, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit104, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit105, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit106, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit107, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit108, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit109, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit110, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit111, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit112, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit113, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit114, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit115, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit116, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit117, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit118, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit119, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit120, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit121, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit122, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit123, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit124, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit125, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit126, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit127, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit128, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit129, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit130, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit131, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit132, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit133, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit134, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit135, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit136, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit137, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit138, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit139, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit140, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit141, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit142, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit143, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit144, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit145, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit146, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit147, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit148, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit149, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit150, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit151, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit152, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit153, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit154, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit155, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit156, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit157, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit158, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit159, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit160, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit161, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit162, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit163, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit164, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit165, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit166, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit167, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit168, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit169, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit170, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit171, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit172, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit173, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit174, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit175, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit176, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit177, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit178, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit179, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit180, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit181, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit182, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit183, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit184, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit185, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit186, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit187, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit188, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit189, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit190, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit191, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit192, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit193, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit194, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit195, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit196, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit197, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit198, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit199, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit200, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit201, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit202, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit203, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit204, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit205, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit206, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit207, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit208, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit209, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit210, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit211, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit212, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit213, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit214, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit215, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit216, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit217, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit218, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit219, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit220, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit221, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit222, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit223, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit224, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit225, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit226, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit227, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit228, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit229, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit230, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit231, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit232, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit233, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit234, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit235, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit236, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit237, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit238, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit239, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit240, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit241, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit242, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit243, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit244, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit245, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit246, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit247, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit248, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit249, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit250, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit251, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit252, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit253, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit254, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit255, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit256, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit257, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit258, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit259, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit260, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit261, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit262, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit263, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit264, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit265, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit266, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit267, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit268, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit269, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit270, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit271, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit272, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit273, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit274, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit275, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit276, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit277, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit278, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit279, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit280, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit281, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit282, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit283, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit284, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit285, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit286, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit287, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit288, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit289, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit290, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit291, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit292, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit293, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit294, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit295, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit296, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit297, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit298, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit299, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit300, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit301, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit302, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit303, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit304, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit305, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit306, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit307, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit308, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit309, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit310, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit311, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit312, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit313, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit314, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit315, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit316, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit317, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit318, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit319, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit320, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit321, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit322, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit323, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit324, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit325, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit326, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit327, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit328, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit329, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit330, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit331, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit332, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit333, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit334, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit335, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit336, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit337, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit338, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit339, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit340, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit341, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit342, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit343, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit344, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit345, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit346, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit347, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit348, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit349, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit350, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit351, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit352, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit353, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit354, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit355, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit356, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit357, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit358, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit359, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit360, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit361, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit362, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit363, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit364, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit365, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit366, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit367, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit368, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit369, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit370, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit371, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit372, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit373, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit374, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit375, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit376, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit377, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit378, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit379, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit380, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit381, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit382, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit383, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit384, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit385, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit386, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit387, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit388, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit389, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit390, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit391, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit392, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit393, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit394, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit395, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit396, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit397, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit398, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit399, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit400, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit401, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit402, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit403, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit404, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit405, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit406, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit407, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit408, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit409, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit410, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit411, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit412, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit413, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit414, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit415, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit416, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit417, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit418, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit419, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit420, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit421, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit422, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit423, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit424, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit425, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit426, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit427, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit428, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit429, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit430, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit431, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit432, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit433, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit434, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit435, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit436, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit437, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit438, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit439, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit440, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit441, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit442, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit443, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit444, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit445, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit446, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit447, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit448, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit449, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit450, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit451, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit452, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit453, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit454, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit455, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit456, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit457, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit458, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit459, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit460, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit461, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit462, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit463, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit464, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit465, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit466, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit467, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit468, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit469, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit470, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit471, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit472, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit473, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit474, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit475, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit476, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit477, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit478, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit479, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit480, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit481, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit482, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit483, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit484, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit485, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit486, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit487, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit488, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit489, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit490, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit491, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit492, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit493, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit494, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit495, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit496, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit497, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit498, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit499, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit500, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit501, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit502, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit503, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit504, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit505, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit506, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit507, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit508, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit509, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit510, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit511, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit512, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit513, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit514, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit515, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit516, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit517, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit518, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit519, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit520, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit521, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit522, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit523, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit524, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit525, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit526, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit527, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit528, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit529, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit530, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit531, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit532, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit533, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit534, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit535, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit536, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit537, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit538, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit539, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit540, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit541, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit542, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit543, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit544, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit545, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit546, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit547, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit548, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit549, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit550, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit551, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit552, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit553, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit554, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit555, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit556, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit557, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit558, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit559, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit560, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit561, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit562, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit563, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit564, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit565, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit566, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit567, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit568, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit569, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit570, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit571, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit572, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit573, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit574, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit575, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit576, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit577, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit578, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit579, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit580, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit581, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit582, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit583, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit584, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit585, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit586, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit587, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit588, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit589, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit590, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit591, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit592, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit593, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit594, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit595, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit596, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit597, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit598, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit599, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit600, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit601, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit602, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit603, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit604, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit605, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit606, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit607, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit608, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit609, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit610, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit611, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit612, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit613, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit614, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit615, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit616, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit617, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit618, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit619, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit620, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit621, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit622, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit623, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit624, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit625, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit626, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit627, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit628, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit629, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit630, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit631, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit632, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit633, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit634, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit635, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit636, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit637, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit638, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit639, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit640, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit641, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit642, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit643, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit644, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit645, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit646, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit647, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit648, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit649, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit650, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit651, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit652, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit653, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit654, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit655, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit656, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit657, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit658, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit659, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit660, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit661, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit662, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit663, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit664, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit665, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit666, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit667, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit668, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit669, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit670, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit671, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit672, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit673, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit674, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit675, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit676, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit677, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit678, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit679, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit680, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit681, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit682, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit683, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit684, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit685, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit686, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit687, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit688, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit689, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit690, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit691, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit692, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit693, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit694, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit695, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit696, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit697, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit698, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit699, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit700, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit701, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit702, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit703, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit704, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit705, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit706, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit707, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit708, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit709, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit710, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit711, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit712, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit713, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit714, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit715, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit716, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit717, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit718, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit719, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit720, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit721, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit722, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit723, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit724, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit725, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit726, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit727, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit728, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit729, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit730, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit731, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit732, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit733, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit734, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit735, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit736, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit737, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit738, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit739, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit740, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit741, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit742, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit743, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit744, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit745, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit746, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit747, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit748, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit749, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit750, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit751, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit752, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit753, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit754, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit755, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit756, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit757, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit758, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit759, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit760, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit761, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit762, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit763, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit764, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit765, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit766, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit767, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit768, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit769, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit770, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit771, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit772, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit773, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit774, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit775, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit776, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit777, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit778, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit779, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit780, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit781, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit782, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit783, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit784, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit785, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit786, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit787, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit788, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit789, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit790, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit791, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit792, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit793, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit794, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit795, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit796, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit797, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit798, 1 AS thisColumnContainsAVeryLongNameThatNearsThe64CharacterLimit; +DROP VIEW v1; +# +# End of 5.6 tests +# +# +# Bug #11752369 : MYSQLDUMP SHOULD CONVERT GEOMETRY COLUMNS TO HEX WITH +# --HEX-BLOB OPTION +CREATE DATABASE dump_gis; +USE dump_gis; +CREATE TABLE t1 (a GEOMETRY); +INSERT INTO t1 VALUES(GeomFromText('LineString(1 1, 2 1, 2 2, 1 2, 1 1)')); +SELECT HEX(a) FROM t1; +HEX(a) +00000000010200000005000000000000000000F03F000000000000F03F0000000000000040000000000000F03F00000000000000400000000000000040000000000000F03F0000000000000040000000000000F03F000000000000F03F +INSERT INTO `t1` (`a`) VALUES (0x00000000010200000005000000000000000000F03F000000000000F03F0000000000000040000000000000F03F00000000000000400000000000000040000000000000F03F0000000000000040000000000000F03F000000000000F03F); +DROP DATABASE dump_gis; diff --git a/mysql-wsrep-5.6/mysql-test/r/named_pipe.result b/mysql-wsrep-5.6/mysql-test/r/named_pipe.result old mode 100755 new mode 100644 diff --git a/mysql-wsrep-5.6/mysql-test/r/openssl_1.result b/mysql-wsrep-5.6/mysql-test/r/openssl_1.result index 2a3eeaca..a60c536c 100644 --- a/mysql-wsrep-5.6/mysql-test/r/openssl_1.result +++ b/mysql-wsrep-5.6/mysql-test/r/openssl_1.result @@ -3,8 +3,8 @@ create table t1(f1 int); insert into t1 values (5); grant select on test.* to ssl_user1@localhost require SSL; grant select on test.* to ssl_user2@localhost require cipher "DHE-RSA-AES256-SHA"; -grant select on test.* to ssl_user3@localhost require cipher "DHE-RSA-AES256-SHA" AND SUBJECT "/C=SE/ST=Uppsala/O=MySQL AB"; -grant select on test.* to ssl_user4@localhost require cipher "DHE-RSA-AES256-SHA" AND SUBJECT "/C=SE/ST=Uppsala/O=MySQL AB" ISSUER "/C=SE/ST=Uppsala/L=Uppsala/O=MySQL AB"; +grant select on test.* to ssl_user3@localhost require cipher "DHE-RSA-AES256-SHA" AND SUBJECT "/C=SE/ST=Stockholm/L=Stockholm/O=Oracle/OU=MySQL/CN=Client"; +grant select on test.* to ssl_user4@localhost require cipher "DHE-RSA-AES256-SHA" AND SUBJECT "/C=SE/ST=Stockholm/L=Stockholm/O=Oracle/OU=MySQL/CN=Client" ISSUER "/C=SE/ST=Stockholm/L=Stockholm/O=Oracle/OU=MySQL/CN=CA"; grant select on test.* to ssl_user5@localhost require cipher "DHE-RSA-AES256-SHA" AND SUBJECT "xxx"; flush privileges; connect(localhost,ssl_user5,,test,MASTER_PORT,MASTER_SOCKET); @@ -196,7 +196,7 @@ Ssl_cipher DHE-RSA-AES256-SHA Variable_name Value Ssl_cipher EDH-RSA-DES-CBC3-SHA Variable_name Value -Ssl_cipher EDH-RSA-DES-CBC-SHA +Ssl_cipher AES256-SHA Variable_name Value Ssl_cipher RC4-SHA select 'is still running; no cipher request crashed the server' as result from dual; diff --git a/mysql-wsrep-5.6/mysql-test/r/outfile_loaddata.result b/mysql-wsrep-5.6/mysql-test/r/outfile_loaddata.result index 36a72fd8..ca3a42c0 100644 --- a/mysql-wsrep-5.6/mysql-test/r/outfile_loaddata.result +++ b/mysql-wsrep-5.6/mysql-test/r/outfile_loaddata.result @@ -143,15 +143,16 @@ TRUNCATE t2; LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' INTO TABLE t2 CHARACTER SET binary FIELDS TERMINATED BY 'ъ'; Warnings: Warning 1638 Non-ASCII separator arguments are not fully supported -Warning 1265 Data truncated for column 'a' at row 1 -Warning 1261 Row 1 doesn't contain data for all columns -Warning 1261 Row 1 doesn't contain data for all columns -Warning 1265 Data truncated for column 'a' at row 2 -Warning 1261 Row 2 doesn't contain data for all columns -Warning 1261 Row 2 doesn't contain data for all columns SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c; a b c -1 NULL NULL +1 ABC-АБВ DEF-ÂÃÄ +2 NULL NULL +SELECT * FROM t1; +a b c +1 ABC-АБВ DEF-ÂÃÄ +2 NULL NULL +SELECT * FROM t2; +a b c 1 ABC-АБВ DEF-ÂÃÄ 2 NULL NULL SELECT * FROM t1 INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' LINES STARTING BY 'ъ'; @@ -181,7 +182,14 @@ Warning 1638 Non-ASCII separator arguments are not fully supported SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c; a b c 1 ABC-АБВ DEF-ÂÃÄ -1 ABC-АБВ DEF-ÂÃÄÑŠ2 +2 NULL NULL +SELECT * FROM t1; +a b c +1 ABC-АБВ DEF-ÂÃÄ +2 NULL NULL +SELECT * FROM t2; +a b c +1 ABC-АБВ DEF-ÂÃÄ 2 NULL NULL # Default (binary) charset: SELECT * INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' FROM t1; diff --git a/mysql-wsrep-5.6/mysql-test/r/parser.result b/mysql-wsrep-5.6/mysql-test/r/parser.result index 266122b6..dc35a146 100644 --- a/mysql-wsrep-5.6/mysql-test/r/parser.result +++ b/mysql-wsrep-5.6/mysql-test/r/parser.result @@ -669,3 +669,28 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp # START TRANSACTION ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, ; ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ',,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,' at line 1 +# +# Bug#17075846 : unquoted file names for variable values are +# accepted but parsed incorrectly +# +SET default_storage_engine=a.myisam; +ERROR 42000: Incorrect argument type to variable 'default_storage_engine' +SET default_storage_engine = .a.MyISAM; +ERROR 42000: Incorrect argument type to variable 'default_storage_engine' +SET default_storage_engine = a.b.MyISAM; +ERROR 42000: Incorrect argument type to variable 'default_storage_engine' +SET default_storage_engine = `a`.MyISAM; +ERROR 42000: Incorrect argument type to variable 'default_storage_engine' +SET default_storage_engine = `a`.`MyISAM`; +ERROR 42000: Incorrect argument type to variable 'default_storage_engine' +set default_storage_engine = "a.MYISAM"; +ERROR 42000: Unknown storage engine 'a.MYISAM' +set default_storage_engine = 'a.MYISAM'; +ERROR 42000: Unknown storage engine 'a.MYISAM' +set default_storage_engine = `a.MYISAM`; +ERROR 42000: Unknown storage engine 'a.MYISAM' +CREATE TABLE t1 (s VARCHAR(100)); +CREATE TRIGGER trigger1 BEFORE INSERT ON t1 FOR EACH ROW +SET default_storage_engine = NEW.INNODB; +ERROR 42S22: Unknown column 'INNODB' in 'NEW' +DROP TABLE t1; diff --git a/mysql-wsrep-5.6/mysql-test/r/partition.result b/mysql-wsrep-5.6/mysql-test/r/partition.result index 9992ff86..46ffb0da 100644 --- a/mysql-wsrep-5.6/mysql-test/r/partition.result +++ b/mysql-wsrep-5.6/mysql-test/r/partition.result @@ -2185,6 +2185,8 @@ count(*) drop table t1, t2; SET @orig_sql_mode = @@SQL_MODE; SET SQL_MODE='STRICT_ALL_TABLES,ERROR_FOR_DIVISION_BY_ZERO'; +Warnings: +Warning 1681 'ERROR_FOR_DIVISION_BY_ZERO' is deprecated and will be removed in a future release. CREATE TABLE t1 (c1 INT) PARTITION BY LIST(1 DIV c1) ( PARTITION p0 VALUES IN (NULL), diff --git a/mysql-wsrep-5.6/mysql-test/r/partition_archive.result b/mysql-wsrep-5.6/mysql-test/r/partition_archive.result index 186a7930..cbe74c3b 100644 --- a/mysql-wsrep-5.6/mysql-test/r/partition_archive.result +++ b/mysql-wsrep-5.6/mysql-test/r/partition_archive.result @@ -126,3 +126,29 @@ select count(*) from t1; count(*) 100 drop table t1; +# +#BUG 18618561: FAILED ALTER TABLE ENGINE CHANGE WITH PARTITIONS +# CORRUPTS FRM +CREATE TABLE t1 (fld1 INT PRIMARY KEY) ENGINE= MYISAM PARTITION BY HASH(fld1) +PARTITIONS 5; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `fld1` int(11) NOT NULL, + PRIMARY KEY (`fld1`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY HASH (fld1) +PARTITIONS 5 */ +ALTER TABLE t1 ENGINE= ARCHIVE; +ERROR HY000: Got error -1 from storage engine +#After the patch, the ENGINE is correctly displayed as MyISAM +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `fld1` int(11) NOT NULL, + PRIMARY KEY (`fld1`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY HASH (fld1) +PARTITIONS 5 */ +#Cleanup. +DROP TABLE t1; diff --git a/mysql-wsrep-5.6/mysql-test/r/partition_index_innodb.result b/mysql-wsrep-5.6/mysql-test/r/partition_index_innodb.result new file mode 100644 index 00000000..fae6f629 --- /dev/null +++ b/mysql-wsrep-5.6/mysql-test/r/partition_index_innodb.result @@ -0,0 +1,116 @@ +# +# Bug#18167648: WRONG RESULTS WITH PARTITIONING, INDEX_MERGE AND NO PK +# +CREATE TABLE t1 +(a smallint, +b smallint, +c smallint, +KEY a (a), +KEY b (b) +) ENGINE=InnoDB +PARTITION BY HASH(c) PARTITIONS 3; +# c will simulate DB_ROW_ID + force to chosen partition. +# c is unique so we can identify rows in the test. +# Fillers to make the optimizer choose index_merge_intersect/union: +INSERT INTO t1 VALUES (1,1,1), (1,1,1+3), (1,1,1+6), (1,1,1+9); +# row N..N+3 +INSERT INTO t1 VALUES (1,2,1+12), (2,2,2+15), (2,2,2+18), (1,2,3+21); +# More index matching rows for index_merge_intersect: N+4, N+5 +INSERT INTO t1 VALUES (2,2,1+24); +INSERT INTO t1 VALUES (2,1,1+27); +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +SET @old_opt_switch = @@session.optimizer_switch; +SET SESSION optimizer_switch="index_merge=on"; +SET SESSION optimizer_switch="index_merge_intersection=on"; +SET SESSION optimizer_switch="index_merge_sort_union=off"; +SET SESSION optimizer_switch="index_merge_union=off"; +EXPLAIN SELECT a,b,c FROM t1 WHERE b = 2 AND a = 2 AND c > 0 AND c < 100; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index_merge a,b a,b 3,3 NULL 1 Using intersect(a,b); Using where +SELECT a,b,c FROM t1 WHERE b = 2 AND a = 2 AND c > 0 AND c < 100; +a b c +2 2 17 +2 2 20 +2 2 25 +EXPLAIN PARTITIONS SELECT a,b,c FROM t1 WHERE a = 2 AND b = 2 AND c IN (13,25,28); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p1 index_merge a,b a,b 3,3 NULL 1 Using intersect(a,b); Using where +SELECT a,b,c FROM t1 WHERE a = 2 AND b = 2 AND c IN (13,25,28); +a b c +2 2 25 +SET SESSION optimizer_switch="index_merge_intersection=off"; +SELECT a,b,c FROM t1 WHERE b = 2 AND a = 2 AND c > 0 AND c < 100; +a b c +2 2 25 +2 2 17 +2 2 20 +EXPLAIN SELECT a,b,c FROM t1 WHERE b = 2 AND a = 2 AND c > 0 AND c < 100; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref a,b a 3 const 2 Using where +# Adding more fillers to get index_merge_union +INSERT INTO t1 VALUES (1,1,1+30), (1,1,1+33), (1,1,1+36), (1,1,1+39), +(1,1,1+42), (1,1,1+45), (1,1,1+48), (1,1,1+51), (1,1,1+54), (1,1,1+57), +(1,1,1+60), (1,1,1+63), (1,1,1+66), (1,1,1+69), (1,1,1+72), (1,1,1+75), +(1,1,1+78); +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +SET SESSION optimizer_switch="index_merge_union=on"; +EXPLAIN SELECT a,b,c FROM t1 WHERE (b = 2 OR a = 2) AND c > 0 AND c < 100; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index_merge a,b b,a 3,3 NULL 4 Using union(b,a); Using where +SELECT a,b,c FROM t1 WHERE (b = 2 OR a = 2) AND c > 0 AND c < 100; +a b c +1 2 13 +2 2 17 +2 2 20 +1 2 24 +2 2 25 +2 1 28 +SET SESSION optimizer_switch="index_merge_union=off"; +SELECT a,b,c FROM t1 WHERE (b = 2 OR a = 2) AND c > 0 AND c < 100; +a b c +1 2 24 +1 2 13 +2 2 25 +2 1 28 +2 2 17 +2 2 20 +EXPLAIN SELECT a,b,c FROM t1 WHERE (b = 2 OR a = 2) AND c > 0 AND c < 100; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL a,b NULL NULL NULL 27 Using where +Insert a few more rows to trigger sort_union +INSERT INTO t1 VALUES (1,1,1+81), (1,1,1+84), (1,1,1+87), (1,1,1+90), +(1,1,1+93); +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +SET SESSION optimizer_switch="index_merge_sort_union=on"; +EXPLAIN SELECT a,b,c FROM t1 WHERE (b >= 2 OR a >= 2) AND c > 0 AND c < 100; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index_merge a,b b,a 3,3 NULL 4 Using sort_union(b,a); Using where +# Not affected, added for completeness... +SELECT a,b,c FROM t1 WHERE (b >= 2 OR a >= 2) AND c > 0 AND c < 100; +a b c +1 2 13 +2 2 17 +2 2 20 +1 2 24 +2 2 25 +2 1 28 +SET SESSION optimizer_switch="index_merge_sort_union=off"; +SELECT a,b,c FROM t1 WHERE (b >= 2 OR a >= 2) AND c > 0 AND c < 100; +a b c +1 2 24 +1 2 13 +2 2 25 +2 1 28 +2 2 17 +2 2 20 +EXPLAIN SELECT a,b,c FROM t1 WHERE (b >= 2 OR a >= 2) AND c > 0 AND c < 100; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL a,b NULL NULL NULL 32 Using where +SET @@session.optimizer_switch = @old_opt_switch; +DROP TABLE t1; diff --git a/mysql-wsrep-5.6/mysql-test/r/partition_index_myisam.result b/mysql-wsrep-5.6/mysql-test/r/partition_index_myisam.result new file mode 100644 index 00000000..775d3ef1 --- /dev/null +++ b/mysql-wsrep-5.6/mysql-test/r/partition_index_myisam.result @@ -0,0 +1,86 @@ +# +# Bug#18167648: WRONG RESULTS WITH PARTITIONING, INDEX_MERGE AND NO PK +# +CREATE TABLE t1 ( +a smallint, +b smallint, +c smallint, +KEY a (a), +KEY b (b) +) ENGINE = MyISAM +PARTITION BY HASH (c) PARTITIONS 3; +CREATE TABLE t2 (a tinyint) ENGINE = MyISAM; +INSERT INTO t2 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13), +(14),(15),(16); +SET SESSION optimizer_switch="index_merge=on"; +SET SESSION optimizer_switch="index_merge_intersection=on"; +SET SESSION optimizer_switch="index_merge_union=off"; +SET SESSION optimizer_switch="index_merge_sort_union=off"; +INSERT INTO t1 VALUES (1,1,0), (1,1,0), (2,1,0), (2,2,1), (1,1,1), (2,2,4); +# Add some rows to make the index_merge_intersect possible +INSERT INTO t1 SELECT 1,1,0 FROM t2 A, t2 B; +INSERT INTO t1 SELECT 1,1,1 FROM t2 A, t2 B; +INSERT INTO t1 SELECT 1,1,2 FROM t2 A, t2 B LIMIT 68; +SELECT COUNT(*) FROM t1; +COUNT(*) +586 +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +EXPLAIN SELECT a,b,c FROM t1 WHERE b = 2 AND a = 2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index_merge a,b b,a 3,3 NULL 1 Using intersect(b,a); Using where +# Before fix: +# (p0 - partition 0, R3 - 3rd record in that partition = offset) +# Make 'a' read p0-R3, p1-R1, p1-R3 +# Make 'b' read p1-R1, p1-R3 +# 'b' will skip p1-R1 since R3 is bigger than R1. +SELECT a,b,c FROM t1 WHERE b = 2 AND a = 2; +a b c +2 2 1 +2 2 4 +SET @old_opt_switch = @@session.optimizer_switch; +SET SESSION optimizer_switch="index_merge_intersection=off"; +# Without index_merge_intersection +SELECT a,b,c FROM t1 WHERE b = 2 AND a = 2; +a b c +2 2 1 +2 2 4 +EXPLAIN SELECT a,b,c FROM t1 WHERE b = 2 AND a = 2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref a,b b 3 const 2 Using where +SET SESSION optimizer_switch="index_merge_union=on"; +EXPLAIN SELECT a,b,c FROM t1 WHERE (b = 2 OR a = 2) AND c > 0 AND c < 100; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index_merge a,b b,a 3,3 NULL 5 Using union(b,a); Using where +SELECT a,b,c FROM t1 WHERE (b = 2 OR a = 2) AND c > 0 AND c < 100; +a b c +2 2 1 +2 2 4 +SET SESSION optimizer_switch="index_merge_union=off"; +SELECT a,b,c FROM t1 WHERE (b = 2 OR a = 2) AND c > 0 AND c < 100; +a b c +2 2 1 +2 2 4 +EXPLAIN SELECT a,b,c FROM t1 WHERE (b = 2 OR a = 2) AND c > 0 AND c < 100; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL a,b NULL NULL NULL 586 Using where +SET SESSION optimizer_switch="index_merge_sort_union=on"; +EXPLAIN SELECT a,b,c FROM t1 WHERE (b >= 2 OR a >= 2) AND c > 0 AND c < 100; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index_merge a,b b,a 3,3 NULL 10 Using sort_union(b,a); Using where +# Not affected, added for completeness... +SELECT a,b,c FROM t1 WHERE (b >= 2 OR a >= 2) AND c > 0 AND c < 100; +a b c +2 2 1 +2 2 4 +SET SESSION optimizer_switch="index_merge_sort_union=off"; +SELECT a,b,c FROM t1 WHERE (b >= 2 OR a >= 2) AND c > 0 AND c < 100; +a b c +2 2 1 +2 2 4 +EXPLAIN SELECT a,b,c FROM t1 WHERE (b >= 2 OR a >= 2) AND c > 0 AND c < 100; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL a,b NULL NULL NULL 586 Using where +SET @@session.optimizer_switch = @old_opt_switch; +DROP TABLE t1, t2; diff --git a/mysql-wsrep-5.6/mysql-test/r/partition_innodb.result b/mysql-wsrep-5.6/mysql-test/r/partition_innodb.result index fba4d054..02fe9a47 100644 --- a/mysql-wsrep-5.6/mysql-test/r/partition_innodb.result +++ b/mysql-wsrep-5.6/mysql-test/r/partition_innodb.result @@ -549,6 +549,8 @@ CREATE TABLE t1 (a INT, b TIMESTAMP DEFAULT '0000-00-00 00:00:00') ENGINE=INNODB PARTITION BY LINEAR HASH (a) PARTITIONS 1; SET @old_mode = @@sql_mode; SET SESSION sql_mode = 'NO_ZERO_DATE'; +Warnings: +Warning 1681 'NO_ZERO_DATE' is deprecated and will be removed in a future release. OPTIMIZE TABLE t1; Table Op Msg_type Msg_text test.t1 optimize note Table does not support optimize, doing recreate + analyze instead @@ -585,3 +587,174 @@ a b 1 2 0 1 DROP TABLE t1; +# +# Bug#16943907: FLUSH TABLES FOR EXPORT: ASSERTION IN HA_PARTITION::EXTRA +# +CREATE TABLE t1 (a int, PRIMARY KEY (a)) ENGINE=InnoDB +PARTITION BY HASH (a) PARTITIONS 2; +FLUSH TABLES t1 FOR EXPORT; +# List of files after EXPORT (should include a .cfg file for each part). +t1#P#p0.cfg +t1#P#p0.ibd +t1#P#p1.cfg +t1#P#p1.ibd +t1.frm +t1.par +UNLOCK TABLES; +# List of files after UNLOCK (no .cfg files). +t1#P#p0.ibd +t1#P#p1.ibd +t1.frm +t1.par +ALTER TABLE t1 DISCARD TABLESPACE; +ERROR HY000: Table storage engine for 't1' doesn't have this option +ALTER TABLE t1 IMPORT TABLESPACE; +ERROR HY000: Table storage engine for 't1' doesn't have this option +DROP TABLE t1; +USE test; +# +# Bug#13737949: CRASH IN HA_PARTITION::INDEX_INIT +# Bug#18694052: SERVER CRASH IN HA_PARTITION::INIT_RECORD_PRIORITY_QUEUE +# +CREATE TABLE t1 +(a INT, +b INT, +PRIMARY KEY (a)) +ENGINE = InnoDB +PARTITION BY HASH (a) PARTITIONS 3; +START TRANSACTION WITH CONSISTENT SNAPSHOT; +# con1 +ALTER TABLE t1 ADD INDEX idx1 (b); +# con default +SELECT b FROM t1 WHERE b = 0; +ERROR HY000: Table definition has changed, please retry transaction +SELECT b FROM t1 WHERE b = 0; +ERROR HY000: Table definition has changed, please retry transaction +DROP TABLE t1; +# Same test without partitioning +CREATE TABLE t1 +(a INT, +b INT, +PRIMARY KEY (a)) +ENGINE = InnoDB; +START TRANSACTION WITH CONSISTENT SNAPSHOT; +# con1 +ALTER TABLE t1 ADD INDEX idx1 (b); +# con default +SELECT b FROM t1 WHERE b = 0; +ERROR HY000: Table definition has changed, please retry transaction +SELECT b FROM t1 WHERE b = 0; +ERROR HY000: Table definition has changed, please retry transaction +DROP TABLE t1; +Bug 17896265 PARTITIONED TABLE HAS MISPLACED ROWS, AFTER INPLACE ALTER +CREATE TABLE t1 ( +f1 INT(11) NOT NULL, +f2 INT(11) NOT NULL +) +ENGINE=InnoDB +PARTITION BY KEY (f1,f2) PARTITIONS 2; +INSERT INTO t1 VALUES (9585,5); +ALTER TABLE t1 CHANGE f1 f1 INT AFTER f2, ALGORITHM=INPLACE; +ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY. +CREATE TABLE t2 ( +f1 INT(11) NOT NULL, +f2 INT(11) NOT NULL, +f3 INT(11) NOT NULL, +f4 INT(11) NOT NULL +) +ENGINE=InnoDB +PARTITION BY KEY (f2,f3) PARTITIONS 2; +INSERT INTO t2 VALUES (10,9585,5,20); +ALTER TABLE t2 CHANGE f3 f3 INT AFTER f4, ALGORITHM=INPLACE; +CHECK TABLE t2; +Table Op Msg_type Msg_text +test.t2 check status OK +ALTER TABLE t2 CHANGE f3 f3 INT AFTER f1, ALGORITHM=INPLACE; +ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY. +ALTER TABLE t2 CHANGE f4 f4 INT AFTER f3, ALGORITHM=INPLACE; +CHECK TABLE t2; +Table Op Msg_type Msg_text +test.t2 check status OK +ALTER TABLE t2 CHANGE f1 f1 INT AFTER f4, ALGORITHM=INPLACE; +CHECK TABLE t2; +Table Op Msg_type Msg_text +test.t2 check status OK +ALTER TABLE t2 CHANGE f1 f1 INT AFTER f2, ALGORITHM=INPLACE; +CHECK TABLE t2; +Table Op Msg_type Msg_text +test.t2 check status OK +ALTER TABLE t2 CHANGE f2 f2 INT AFTER f4, ALGORITHM=INPLACE; +ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY. +CREATE TABLE t3 (f1 INT,f2 INT) ENGINE=INNODB +PARTITION BY RANGE(f1) ( +PARTITION p0 VALUES LESS THAN (100), +PARTITION p1 VALUES LESS THAN (200), +PARTITION p2 VALUES LESS THAN (600), +PARTITION p3 VALUES LESS THAN MAXVALUE +); +insert into t3 values (90,120); +insert into t3 values (120,300); +ALTER TABLE t3 CHANGE f1 f1 int AFTER f2, ALGORITHM=INPLACE; +CHECK TABLE t3; +Table Op Msg_type Msg_text +test.t3 check status OK +CREATE TABLE t4 ( +f1 INT(11) NOT NULL, +f2 INT(11) NOT NULL +) +ENGINE=InnoDB +PARTITION BY HASH (MOD(f1,f2)) PARTITIONS 2; +INSERT INTO t4 VALUES (9585,5); +ALTER TABLE t4 CHANGE f1 f1 INT AFTER f2, ALGORITHM=INPLACE; +CHECK TABLE t4; +Table Op Msg_type Msg_text +test.t4 check status OK +CREATE TABLE t5 ( +f1 INT, +f2 INT +) +ENGINE=InnoDB +PARTITION BY RANGE COLUMNS(f1,f2) ( +PARTITION p0 VALUES LESS THAN (10000,12), +PARTITION p1 VALUES LESS THAN (MAXVALUE, MAXVALUE) +); +INSERT INTO t5 VALUES (1,20000); +ALTER TABLE t5 CHANGE f1 f1 INT AFTER f2, ALGORITHM=INPLACE; +CHECK TABLE t5; +Table Op Msg_type Msg_text +test.t5 check status OK +CREATE TABLE t6 ( +a INT, +b INT +) +ENGINE=InnoDB +PARTITION BY RANGE COLUMNS(a,b) +SUBPARTITION BY KEY(a,b) +SUBPARTITIONS 2 ( +PARTITION p0 VALUES LESS THAN (10000,12), +PARTITION p1 VALUES LESS THAN (MAXVALUE, MAXVALUE) +); +INSERT INTO t6 VALUES (9585,5); +ALTER TABLE t6 CHANGE a a INT AFTER b, ALGORITHM=INPLACE; +ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY. +CREATE TABLE t7 ( +f1 INT(11) NOT NULL, +f2 INT(11) NOT NULL, +f3 INT(11) NOT NULL, +f4 INT(11) NOT NULL, +f5 INT(11) NOT NULL +) +ENGINE=InnoDB +PARTITION BY KEY (f1,f5) PARTITIONS 2; +INSERT INTO t7 VALUES (9585,10,20,10,5); +ALTER TABLE t7 CHANGE f5 f5 INT AFTER f3, ALGORITHM=INPLACE; +CHECK TABLE t7; +Table Op Msg_type Msg_text +test.t7 check status OK +ALTER TABLE t7 CHANGE f5 f5 INT AFTER f2, ALGORITHM=INPLACE; +CHECK TABLE t7; +Table Op Msg_type Msg_text +test.t7 check status OK +ALTER TABLE t7 CHANGE f1 f1 INT AFTER f4, ALGORITHM=INPLACE; +ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY. +DROP TABLE t1,t2,t3,t4,t5,t6,t7; diff --git a/mysql-wsrep-5.6/mysql-test/r/partition_pruning.result b/mysql-wsrep-5.6/mysql-test/r/partition_pruning.result index 49f7ad12..63bb6439 100644 --- a/mysql-wsrep-5.6/mysql-test/r/partition_pruning.result +++ b/mysql-wsrep-5.6/mysql-test/r/partition_pruning.result @@ -3534,3 +3534,117 @@ explain partitions select * from t1 where a between 10 and 10+33; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 p0,p1,p2 ALL NULL NULL NULL NULL 100 Using where drop table t0, t1; +# +# Bug#71095: Wrong results with PARTITION BY LIST COLUMNS() +# +CREATE TABLE t1 +(c1 int, +c2 int, +c3 int, +c4 int, +PRIMARY KEY (c1,c2)) +PARTITION BY LIST COLUMNS (c2) +(PARTITION p1 VALUES IN (1,2), +PARTITION p2 VALUES IN (3,4)); +INSERT INTO t1 VALUES (1, 1, 1, 1), (2, 3, 1, 1); +INSERT INTO t1 VALUES (1, 2, 1, 1), (2, 4, 1, 1); +SELECT * FROM t1 WHERE c1 = 1 AND c2 < 1; +c1 c2 c3 c4 +SELECT * FROM t1 WHERE c1 = 1 AND c2 <= 1; +c1 c2 c3 c4 +1 1 1 1 +SELECT * FROM t1 WHERE c1 = 1 AND c2 = 1; +c1 c2 c3 c4 +1 1 1 1 +SELECT * FROM t1 WHERE c1 = 1 AND c2 >= 1; +c1 c2 c3 c4 +1 1 1 1 +1 2 1 1 +SELECT * FROM t1 WHERE c1 = 1 AND c2 > 1; +c1 c2 c3 c4 +1 2 1 1 +SELECT * FROM t1 WHERE c1 = 1 AND c2 < 3; +c1 c2 c3 c4 +1 1 1 1 +1 2 1 1 +SELECT * FROM t1 WHERE c1 = 1 AND c2 <= 3; +c1 c2 c3 c4 +1 1 1 1 +1 2 1 1 +SELECT * FROM t1 WHERE c1 = 2 AND c2 <= 3; +c1 c2 c3 c4 +2 3 1 1 +SELECT * FROM t1 WHERE c1 = 2 AND c2 = 3; +c1 c2 c3 c4 +2 3 1 1 +SELECT * FROM t1 WHERE c1 = 2 AND c2 >= 3; +c1 c2 c3 c4 +2 3 1 1 +2 4 1 1 +SELECT * FROM t1 WHERE c1 = 2 AND c2 > 3; +c1 c2 c3 c4 +2 4 1 1 +SELECT * FROM t1 WHERE c1 = 2 AND c2 < 4; +c1 c2 c3 c4 +2 3 1 1 +SELECT * FROM t1 WHERE c1 = 2 AND c2 <= 4; +c1 c2 c3 c4 +2 3 1 1 +2 4 1 1 +SELECT * FROM t1 WHERE c1 = 2 AND c2 = 4; +c1 c2 c3 c4 +2 4 1 1 +SELECT * FROM t1 WHERE c1 = 2 AND c2 >= 4; +c1 c2 c3 c4 +2 4 1 1 +SELECT * FROM t1 WHERE c1 = 2 AND c2 > 4; +c1 c2 c3 c4 +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE c1 = 1 AND c2 < 1; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE c1 = 1 AND c2 <= 1; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p1 range PRIMARY PRIMARY 8 NULL 1 Using where +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE c1 = 1 AND c2 = 1; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p1 const PRIMARY PRIMARY 8 const,const 1 NULL +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE c1 = 1 AND c2 >= 1; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p1,p2 range PRIMARY PRIMARY 8 NULL 2 Using where +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE c1 = 1 AND c2 > 1; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p1,p2 range PRIMARY PRIMARY 8 NULL 2 Using where +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE c1 = 1 AND c2 < 3; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p1 range PRIMARY PRIMARY 8 NULL 1 Using where +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE c1 = 1 AND c2 <= 3; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p1,p2 range PRIMARY PRIMARY 8 NULL 2 Using where +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE c1 = 2 AND c2 <= 3; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p1,p2 range PRIMARY PRIMARY 8 NULL 2 Using where +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE c1 = 2 AND c2 = 3; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p2 const PRIMARY PRIMARY 8 const,const 1 NULL +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE c1 = 2 AND c2 >= 3; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p2 range PRIMARY PRIMARY 8 NULL 1 Using where +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE c1 = 2 AND c2 > 3; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p2 range PRIMARY PRIMARY 8 NULL 1 Using where +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE c1 = 2 AND c2 < 4; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p1,p2 range PRIMARY PRIMARY 8 NULL 2 Using where +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE c1 = 2 AND c2 <= 4; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p1,p2 range PRIMARY PRIMARY 8 NULL 2 Using where +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE c1 = 2 AND c2 = 4; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p2 const PRIMARY PRIMARY 8 const,const 1 NULL +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE c1 = 2 AND c2 >= 4; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p2 range PRIMARY PRIMARY 8 NULL 1 Using where +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE c1 = 2 AND c2 > 4; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +DROP TABLE t1; diff --git a/mysql-wsrep-5.6/mysql-test/r/plugin.result b/mysql-wsrep-5.6/mysql-test/r/plugin.result index 4e65fddb..a3d74375 100644 --- a/mysql-wsrep-5.6/mysql-test/r/plugin.result +++ b/mysql-wsrep-5.6/mysql-test/r/plugin.result @@ -162,3 +162,73 @@ SELECT @@SESSION.example_double_thdvar; @@SESSION.example_double_thdvar 1000.500000 UNINSTALL PLUGIN example; +# +# BUG#18008907 - DEADLOCK BETWEEN MYSQL_CHANGE_USER(), SHOW VARIABLES AND INSTALL PLUGIN +# +CREATE PROCEDURE p_install() +BEGIN +INSTALL PLUGIN no_such_plugin SONAME 'no_such_object'; +END +| +CREATE PROCEDURE p_show_vars() +BEGIN +SELECT COUNT(*) FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES; +END| +connect con1, localhost, root,,; +# Case 18008907_1: Deadlock situation cause by +# con1: has LOCK_system_variables_hash and waits on LOCK_plugin AND +# default: has LOCK_plugin and waits on LOCK_system_variables_hash. +# +SET DEBUG_SYNC='acquired_LOCK_system_variables_hash SIGNAL install_plugin WAIT_FOR cont_show_vars'; +call p_show_vars();; +connection default; +SET DEBUG_SYNC='now WAIT_FOR install_plugin'; +SET DEBUG_SYNC='acquired_LOCK_plugin SIGNAL cont_show_vars'; +call p_install();; +connection con1; +COUNT(*) +# +SET DEBUG_SYNC='RESET'; +connection default; +ERROR HY000: Can't open shared library +SET DEBUG_SYNC='RESET'; +# Case 18008907_2: Deadlock situation caused by +# default: has LOCK_system_variables_hash and waits on LOCK_global_system_variables, +# con1: has LOCK_plugin and waits on LOCK_system_variables_hash AND +# con2: has LOCK_global_system_variables and waits on LOCK_plugin. +SET DEBUG_SYNC='acquired_LOCK_system_variables_hash SIGNAL install_plugin WAIT_FOR nothing TIMEOUT 10'; +call p_show_vars();; +connection con1; +SET DEBUG_SYNC='now WAIT_FOR install_plugin'; +SET DEBUG_SYNC='acquired_LOCK_plugin SIGNAL create_connection WAIT_FOR nothing TIMEOUT 10'; +call p_install();; +connect con2, localhost, root,,; +SET DEBUG_SYNC='now WAIT_FOR create_connection'; +connection con1; +ERROR HY000: Can't open shared library +connection default; +COUNT(*) +# +Warnings: +# 1639 debug sync point wait timed out +disconnect con2; +# Case 18008907_3: Testing Concurrent "Show Variables" and "Plugin Uninstall" operations. +INSTALL PLUGIN example SONAME 'ha_example.so'; +connection con1; +SET DEBUG_SYNC='acquired_LOCK_system_variables_hash SIGNAL uninstall_plugin WAIT_FOR go'; +call p_show_vars();; +connect con2, localhost, root,,; +SET DEBUG_SYNC='now WAIT_FOR uninstall_plugin'; +UNINSTALL PLUGIN example;; +connection default; +SET DEBUG_SYNC='now SIGNAL go'; +connection con1; +COUNT(*) +# +connection con2; +connection default; +DROP PROCEDURE p_show_vars; +DROP PROCEDURE p_install; +SET DEBUG_SYNC='RESET'; +disconnect con1; +disconnect con2; diff --git a/mysql-wsrep-5.6/mysql-test/r/plugin_auth.result b/mysql-wsrep-5.6/mysql-test/r/plugin_auth.result index 27b305e5..cf3eb43a 100644 --- a/mysql-wsrep-5.6/mysql-test/r/plugin_auth.result +++ b/mysql-wsrep-5.6/mysql-test/r/plugin_auth.result @@ -549,3 +549,25 @@ bug12818542@localhost bug12818542_dest@localhost DROP USER bug12818542@localhost; DROP USER bug12818542_dest@localhost; End of 5.5 tests +# +# Bug #18057562: PROXY USERS LOCKED OUT WHEN UNDERLYING PROXIED USER +# PASSWORD IS EXPIRED +# +# Restart server with disconnect_on_expired_password OFF; +CREATE USER 'empl_external'@'localhost' IDENTIFIED WITH test_plugin_server AS 'employee'; +CREATE USER 'employee'@'localhost' IDENTIFIED BY 'passkey'; +GRANT PROXY ON 'employee'@'localhost' TO 'empl_external'@'localhost'; +# Expiring the proxied user's password +ALTER USER employee@localhost PASSWORD EXPIRE; +# Connecting with the proxied user and executing a query after the +# proxied user's password is expired +Warning: Using a password on the command line interface can be insecure. +ERROR 1820 (HY000) at line 1: You must SET PASSWORD before executing this statement +# Connecting with the proxy user and executing a query after the proxied +# user's password is expired. Here we are not supposed to get error. +Warning: Using a password on the command line interface can be insecure. +current_user() +employee@localhost +user() +empl_external@localhost +DROP USER 'empl_external'@'localhost', 'employee'@'localhost'; diff --git a/mysql-wsrep-5.6/mysql-test/r/plugin_auth_qa_3.result b/mysql-wsrep-5.6/mysql-test/r/plugin_auth_qa_3.result index 8e7b9050..14e45fef 100644 --- a/mysql-wsrep-5.6/mysql-test/r/plugin_auth_qa_3.result +++ b/mysql-wsrep-5.6/mysql-test/r/plugin_auth_qa_3.result @@ -8,6 +8,6 @@ current_user() user() @@local.proxy_user @@local.external_user qa_test_11_dest@% qa_test_11_user@localhost 'qa_test_11_user'@'%' 'qa_test_11_user'@'%' exec MYSQL PLUGIN_AUTH_OPT --default_auth=qa_auth_client -h localhost -P MASTER_MYPORT -u qa_test_2_user --password=qa_test_11_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1 Warning: Using a password on the command line interface can be insecure. -ERROR 1045 (28000): Access denied for user 'qa_test_2_user'@'localhost' (using password: NO) +ERROR 1045 (28000): Access denied for user 'qa_test_2_user'@'localhost' (using password: YES) DROP USER qa_test_11_user, qa_test_11_dest; DROP DATABASE test_user_db; diff --git a/mysql-wsrep-5.6/mysql-test/r/plugin_auth_sha256.result b/mysql-wsrep-5.6/mysql-test/r/plugin_auth_sha256.result index 34d32ed5..3ba4c1c3 100644 --- a/mysql-wsrep-5.6/mysql-test/r/plugin_auth_sha256.result +++ b/mysql-wsrep-5.6/mysql-test/r/plugin_auth_sha256.result @@ -4,10 +4,10 @@ SET SESSION old_passwords= 2; SET PASSWORD FOR 'kristofer'=PASSWORD('secret'); SELECT user, plugin FROM mysql.user; user plugin -root -root -root -root +root mysql_native_password +root mysql_native_password +root mysql_native_password +root mysql_native_password kristofer sha256_password SELECT USER(),CURRENT_USER(); USER() CURRENT_USER() @@ -79,10 +79,10 @@ SET SESSION old_passwords= 2; SET PASSWORD FOR 'kristofer'=PASSWORD('secret'); SELECT user, plugin FROM mysql.user; user plugin -root -root -root -root +root mysql_native_password +root mysql_native_password +root mysql_native_password +root mysql_native_password kristofer sha256_password SELECT USER(),CURRENT_USER(); USER() CURRENT_USER() diff --git a/mysql-wsrep-5.6/mysql-test/r/plugin_auth_sha256_2.result b/mysql-wsrep-5.6/mysql-test/r/plugin_auth_sha256_2.result index 924fad9d..38c537d2 100644 --- a/mysql-wsrep-5.6/mysql-test/r/plugin_auth_sha256_2.result +++ b/mysql-wsrep-5.6/mysql-test/r/plugin_auth_sha256_2.result @@ -1,10 +1,10 @@ CREATE USER 'kristofer' IDENTIFIED BY 'secret'; SELECT user, plugin FROM mysql.user; user plugin -root -root -root -root +root mysql_native_password +root mysql_native_password +root mysql_native_password +root mysql_native_password kristofer sha256_password user() current_user() kristofer@localhost kristofer@% diff --git a/mysql-wsrep-5.6/mysql-test/r/plugin_auth_sha256_server_default.result b/mysql-wsrep-5.6/mysql-test/r/plugin_auth_sha256_server_default.result index 495ca3ea..6f1aa20b 100644 --- a/mysql-wsrep-5.6/mysql-test/r/plugin_auth_sha256_server_default.result +++ b/mysql-wsrep-5.6/mysql-test/r/plugin_auth_sha256_server_default.result @@ -3,10 +3,10 @@ SET old_passwords=2; SET PASSWORD FOR 'kristofer'=PASSWORD('secret'); SELECT user, plugin FROM mysql.user; user plugin -root -root -root -root +root mysql_native_password +root mysql_native_password +root mysql_native_password +root mysql_native_password kristofer sha256_password SELECT USER(),CURRENT_USER(); USER() CURRENT_USER() diff --git a/mysql-wsrep-5.6/mysql-test/r/plugin_auth_sha256_server_default_tls.result b/mysql-wsrep-5.6/mysql-test/r/plugin_auth_sha256_server_default_tls.result index 4762e807..76ec29a1 100644 --- a/mysql-wsrep-5.6/mysql-test/r/plugin_auth_sha256_server_default_tls.result +++ b/mysql-wsrep-5.6/mysql-test/r/plugin_auth_sha256_server_default_tls.result @@ -3,10 +3,10 @@ SET old_passwords=2; SET PASSWORD FOR 'kristofer'=PASSWORD('secret'); SELECT user, plugin FROM mysql.user; user plugin -root -root -root -root +root mysql_native_password +root mysql_native_password +root mysql_native_password +root mysql_native_password kristofer sha256_password SELECT USER(),CURRENT_USER(); USER() CURRENT_USER() diff --git a/mysql-wsrep-5.6/mysql-test/r/query_cache.result b/mysql-wsrep-5.6/mysql-test/r/query_cache.result index 0f7067a8..495e87a2 100644 --- a/mysql-wsrep-5.6/mysql-test/r/query_cache.result +++ b/mysql-wsrep-5.6/mysql-test/r/query_cache.result @@ -1810,3 +1810,59 @@ COUNT(*) DROP TABLE t1; SET GLOBAL query_cache_size= @qc; # +#BUG 18710853: QUERY CACHE NOT INVALIDATED ON CASCADE DELETE IF DB NAME HAS +# SPECIAL SYMBOLS +SET @query_cache_size.saved = @@query_cache_size; +SET GLOBAL query_cache_size = 1024*1024; +CREATE DATABASE `db-db`; +CREATE TABLE `db-db`.`t$1` (fld1 INT PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE `db-db`.`t$2` (fld1 INT PRIMARY KEY, fld2 INT, +CONSTRAINT t2_fk FOREIGN KEY (fld2) REFERENCES `db-db`.`t$1` (fld1) ON +DELETE CASCADE) ENGINE=InnoDB; +CREATE TABLE `db-db`.`t$3` (fld1 INT PRIMARY KEY, fld2 INT, +CONSTRAINT t3_fk FOREIGN KEY (fld2) REFERENCES `db-db`.`t$1` (fld1) ON +UPDATE CASCADE) ENGINE=InnoDB; +INSERT INTO `db-db`.`t$1` VALUES (100); +INSERT INTO `db-db`.`t$1` VALUES (300); +INSERT INTO `db-db`.`t$2` VALUES (1, 100); +INSERT INTO `db-db`.`t$3` VALUES (2, 300); +SELECT * FROM `db-db`.`t$2`; +fld1 fld2 +1 100 +SELECT * FROM `db-db`.`t$3`; +fld1 fld2 +2 300 +DELETE FROM `db-db`.`t$1` WHERE fld1= 100; +UPDATE `db-db`.`t$1` SET fld1= 200 WHERE fld1= 300; +#After fix the number of the records returned with the +#query cache and without the query cache are the same. +SELECT * FROM `db-db`.`t$2`; +fld1 fld2 +SELECT SQL_NO_CACHE * FROM `db-db`.`t$2`; +fld1 fld2 +SELECT * FROM `db-db`.`t$3`; +fld1 fld2 +2 200 +SELECT SQL_NO_CACHE * FROM `db-db`.`t$3`; +fld1 fld2 +2 200 +#Test case added for code coverage, invalidation +#triggered at the SQL layer. +CREATE TABLE `db-db`.`t$4` (fld1 INT PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO `db-db`.`t$4` VALUES (100); +SELECT * FROM `db-db`.`t$4`; +fld1 +100 +INSERT INTO `db-db`.`t$4` VALUES (200); +SELECT * FROM `db-db`.`t$4`; +fld1 +100 +200 +SELECT SQL_NO_CACHE * FROM `db-db`.`t$4`; +fld1 +100 +200 +#cleanup +DROP DATABASE `db-db`; +SET GLOBAL query_cache_size = @query_cache_size.saved; +# diff --git a/mysql-wsrep-5.6/mysql-test/r/shm.result b/mysql-wsrep-5.6/mysql-test/r/shm.result old mode 100755 new mode 100644 diff --git a/mysql-wsrep-5.6/mysql-test/r/show_processlist.result b/mysql-wsrep-5.6/mysql-test/r/show_processlist.result new file mode 100644 index 00000000..5e0a8fa8 --- /dev/null +++ b/mysql-wsrep-5.6/mysql-test/r/show_processlist.result @@ -0,0 +1,47 @@ +Bug#17283409 4-WAY DEADLOCK: ZOMBIES, PURGING BINLOGS, SHOW PROCESSLIST, +SHOW BINLOGS +connect connection1,localhost,root,,test,$MASTER_MYPORT,; +connection default; +SET DEBUG_SYNC='before_copying_threads SIGNAL parked1 WAIT_FOR go'; +SHOW PROCESSLIST; +connection connection1; +"Wait_for parked1" +SET DEBUG_SYNC='now WAIT_FOR parked1'; +connect connection2,localhost,root,,test,$MASTER_MYPORT,; +connect connection3,localhost,root,,test,$MASTER_MYPORT,; +SET DEBUG_SYNC='now SIGNAL go'; +connection default; +Id User Host db Command Time State Info + root test