summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2014-09-25 23:00:45 +0200
committerSergei Golubchik <serg@mariadb.org>2014-10-01 23:38:27 +0200
commit3620910eeac8f118c9a6cb8a1c0ec23e56fb5d98 (patch)
treed08462d84d10324bd05836c968288d8ab1739e11
parentb04f848176b0d8af41eb3627ba1b6ed4dd3327e3 (diff)
downloadmariadb-git-3620910eeac8f118c9a6cb8a1c0ec23e56fb5d98.tar.gz
cleanup: galera merge, simple changes
-rw-r--r--.gitignore7
-rw-r--r--CMakeLists.txt7
-rw-r--r--client/client_priv.h1
-rw-r--r--client/mysqldump.c2
-rw-r--r--cmake/cpack_rpm.cmake7
-rw-r--r--cmake/plugin.cmake17
-rw-r--r--cmake/wsrep.cmake51
-rw-r--r--config.h.cmake6
-rw-r--r--debian/dist/Debian/control6
-rw-r--r--debian/dist/Ubuntu/control6
-rw-r--r--include/wsrep.h4
-rw-r--r--mysql-test/include/have_wsrep_enabled.inc8
-rw-r--r--mysql-test/include/write_result_to_file.inc3
-rw-r--r--mysql-test/lib/My/ConfigFactory.pm3
-rw-r--r--mysql-test/r/have_wsrep.require2
-rw-r--r--mysql-test/suite/galera/galera_2nodes.cnf4
-rw-r--r--mysql-test/suite/roles/set_default_role_for.result12
-rw-r--r--mysql-test/suite/roles/set_default_role_for.test12
-rw-r--r--mysql-test/t/mysql_tzinfo_to_sql_symlink.test5
-rw-r--r--mysys/CMakeLists.txt4
-rw-r--r--sql/CMakeLists.txt1
-rw-r--r--sql/event_data_objects.cc10
-rw-r--r--sql/ha_partition.cc9
-rw-r--r--sql/ha_partition.h3
-rw-r--r--sql/handler.cc28
-rw-r--r--sql/handler.h10
-rw-r--r--sql/item_func.cc9
-rw-r--r--sql/log.cc35
-rw-r--r--sql/log_event.cc2
-rw-r--r--sql/mdl.cc6
-rw-r--r--sql/mdl.h2
-rw-r--r--sql/mysqld.cc196
-rw-r--r--sql/mysqld.h12
-rw-r--r--sql/protocol.cc2
-rw-r--r--sql/rpl_record.cc2
-rw-r--r--sql/set_var.cc4
-rw-r--r--sql/set_var.h6
-rw-r--r--sql/slave.cc2
-rw-r--r--sql/sp.cc21
-rw-r--r--sql/sp.h2
-rw-r--r--sql/sql_acl.cc4
-rw-r--r--sql/sql_base.cc2
-rw-r--r--sql/sql_builtin.cc.in4
-rw-r--r--sql/sql_class.cc37
-rw-r--r--sql/sql_class.h4
-rw-r--r--sql/sql_delete.cc9
-rw-r--r--sql/sql_insert.cc20
-rw-r--r--sql/sql_parse.cc194
-rw-r--r--sql/sql_prepare.cc2
-rw-r--r--sql/sql_reload.cc2
-rw-r--r--sql/sql_table.cc3
-rw-r--r--sql/sql_trigger.cc4
-rw-r--r--sql/sql_truncate.cc7
-rw-r--r--sql/sql_update.cc9
-rw-r--r--sql/sql_yacc.yy4
-rw-r--r--sql/sys_vars.cc57
-rw-r--r--sql/table.cc1
-rw-r--r--sql/transaction.cc28
-rw-r--r--sql/wsrep_mysqld.cc110
-rw-r--r--sql/wsrep_mysqld.h42
-rw-r--r--sql/wsrep_sst.h13
-rw-r--r--sql/wsrep_thd.h13
-rw-r--r--sql/wsrep_var.cc49
-rw-r--r--sql/wsrep_var.h19
-rw-r--r--storage/innobase/wsrep/md5.cc5
-rw-r--r--storage/perfschema/CMakeLists.txt4
-rw-r--r--storage/xtradb/wsrep/md5.cc5
-rw-r--r--support-files/mysql.server.sh10
-rw-r--r--wsrep/CMakeLists.txt3
69 files changed, 493 insertions, 700 deletions
diff --git a/.gitignore b/.gitignore
index 24d82cb758c..2ed53e5365d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -106,6 +106,11 @@ scripts/mysqld_safe
scripts/mysqldumpslow
scripts/mysqlhotcopy
scripts/mytop
+scripts/wsrep_sst_common
+scripts/wsrep_sst_mysqldump
+scripts/wsrep_sst_rsync
+scripts/wsrep_sst_xtrabackup
+scripts/wsrep_sst_xtrabackup-v2
sql-bench/bench-count-distinct
sql-bench/bench-init.pl
sql-bench/compare-results
@@ -200,6 +205,8 @@ support-files/mysql.server
support-files/mysql.spec
support-files/mysqld_multi.server
support-files/ndb-config-2-node.ini
+support-files/wsrep.cnf
+support-files/wsrep_notify
tags
tests/async_queries
tests/bug25714
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 68f3b01eb28..0c54152420f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -376,9 +376,6 @@ ADD_SUBDIRECTORY(vio)
ADD_SUBDIRECTORY(mysys)
ADD_SUBDIRECTORY(mysys_ssl)
ADD_SUBDIRECTORY(libmysql)
-IF(WITH_WSREP)
- ADD_SUBDIRECTORY(wsrep)
-ENDIF()
ADD_SUBDIRECTORY(client)
ADD_SUBDIRECTORY(extra)
ADD_SUBDIRECTORY(libservices)
@@ -395,6 +392,10 @@ IF(NOT WITHOUT_SERVER)
ADD_SUBDIRECTORY(libmysqld/examples)
ENDIF(WITH_EMBEDDED_SERVER)
+ IF(WITH_WSREP)
+ ADD_SUBDIRECTORY(wsrep)
+ ENDIF()
+
ADD_SUBDIRECTORY(mysql-test)
ADD_SUBDIRECTORY(mysql-test/lib/My/SafeProcess)
ADD_SUBDIRECTORY(sql-bench)
diff --git a/client/client_priv.h b/client/client_priv.h
index ef93818829e..656c8fcf32a 100644
--- a/client/client_priv.h
+++ b/client/client_priv.h
@@ -92,7 +92,6 @@ enum options_client
OPT_REPORT_PROGRESS,
OPT_SKIP_ANNOTATE_ROWS_EVENTS,
OPT_SSL_CRL, OPT_SSL_CRLPATH,
- OPT_GALERA_SST_MODE,
OPT_MAX_CLIENT_OPTION /* should be always the last */
};
diff --git a/client/mysqldump.c b/client/mysqldump.c
index b8d04014552..98f6f15b46e 100644
--- a/client/mysqldump.c
+++ b/client/mysqldump.c
@@ -347,7 +347,7 @@ static struct my_option my_long_options[] =
{"force", 'f', "Continue even if we get an SQL error.",
&ignore_errors, &ignore_errors, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
- {"galera-sst-mode", OPT_GALERA_SST_MODE,
+ {"galera-sst-mode", 0,
"This mode should normally be used in mysqldump snapshot state transfer "
"(SST) in a Galera cluster. If enabled, mysqldump additionally dumps "
"commands to turn off binary logging and SET global gtid_binlog_state "
diff --git a/cmake/cpack_rpm.cmake b/cmake/cpack_rpm.cmake
index d8f659ec5ea..738f0a2ecd1 100644
--- a/cmake/cpack_rpm.cmake
+++ b/cmake/cpack_rpm.cmake
@@ -149,8 +149,13 @@ SETA(CPACK_RPM_test_PACKAGE_PROVIDES
SETA(CPACK_RPM_server_PACKAGE_REQUIRES
"${CPACK_RPM_PACKAGE_REQUIRES}"
- "MariaDB-client" "galera" "rsync" "lsof" "socat" "grep" "gawk" "iproute"
+ "MariaDB-client")
+
+IF(WITH_WSREP)
+SETA(CPACK_RPM_server_PACKAGE_REQUIRES
+ "galera" "rsync" "lsof" "socat" "grep" "gawk" "iproute"
"coreutils" "findutils")
+ENDIF()
SET(CPACK_RPM_server_PRE_INSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/server-prein.sh)
SET(CPACK_RPM_server_PRE_UNINSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/server-preun.sh)
diff --git a/cmake/plugin.cmake b/cmake/plugin.cmake
index ad309c51066..632c4cfe442 100644
--- a/cmake/plugin.cmake
+++ b/cmake/plugin.cmake
@@ -155,14 +155,6 @@ MACRO(MYSQL_ADD_PLUGIN)
ENDIF()
ENDIF()
- IF (WITH_WSREP)
- # Set compile definitions for non-embedded plugins
- LIST(APPEND wsrep_definitions "WITH_WSREP")
- LIST(APPEND wsrep_definitions "WSREP_PROC_INFO")
- SET_TARGET_PROPERTIES(${target} PROPERTIES
- COMPILE_DEFINITIONS "${wsrep_definitions}")
- ENDIF()
-
IF(ARG_STATIC_OUTPUT_NAME)
SET_TARGET_PROPERTIES(${target} PROPERTIES
OUTPUT_NAME ${ARG_STATIC_OUTPUT_NAME})
@@ -195,15 +187,8 @@ MACRO(MYSQL_ADD_PLUGIN)
ADD_LIBRARY(${target} MODULE ${SOURCES})
DTRACE_INSTRUMENT(${target})
- LIST(APPEND dyn_compile_definitions "MYSQL_DYNAMIC_PLUGIN")
-
- IF (WITH_WSREP)
- LIST(APPEND dyn_compile_definitions "WITH_WSREP")
- LIST(APPEND dyn_compile_definitions "WSREP_PROC_INFO")
- ENDIF()
-
SET_TARGET_PROPERTIES (${target} PROPERTIES PREFIX ""
- COMPILE_DEFINITIONS "${dyn_compile_definitions}")
+ COMPILE_DEFINITIONS "MYSQL_DYNAMIC_PLUGIN")
TARGET_LINK_LIBRARIES (${target} mysqlservices ${ARG_LINK_LIBRARIES})
diff --git a/cmake/wsrep.cmake b/cmake/wsrep.cmake
index d3c8da6a72a..211ed30ff4c 100644
--- a/cmake/wsrep.cmake
+++ b/cmake/wsrep.cmake
@@ -14,6 +14,17 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+# Galera library does not compile with windows
+#
+IF(UNIX)
+ SET(with_wsrep_default ON)
+ELSE()
+ SET(with_wsrep_default OFF)
+ENDIF()
+
+OPTION(WITH_WSREP "WSREP replication API (to use, e.g. Galera Replication library)" ${with_wsrep_default})
+
# Set the patch version
SET(WSREP_PATCH_VERSION "10")
@@ -32,42 +43,14 @@ IF (DEFINED ENV{WSREP_REV})
SET(WSREP_PATCH_REVNO $ENV{WSREP_REV})
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_INTERFACE_VERSION 25)
-IF(NOT WSREP_PATCH_REVNO)
- MESSAGE(WARNING "Could not determine bzr revision number, WSREP_VERSION will "
- "not contain the revision number.")
- SET(WSREP_VERSION
- "${WSREP_API_VERSION}.${WSREP_PATCH_VERSION}"
- )
-ELSE()
- SET(WSREP_VERSION
- "${WSREP_API_VERSION}.${WSREP_PATCH_VERSION}.r${WSREP_PATCH_REVNO}"
- )
-ENDIF()
+SET(WSREP_VERSION
+ "${WSREP_INTERFACE_VERSION}.${WSREP_PATCH_VERSION}.r${WSREP_PATCH_REVNO}")
-#
-# Galera library does not compile with windows and solaris
-#
-IF(UNIX)
-OPTION(WITH_WSREP "WSREP replication API (to use, e.g. Galera Replication library)" ON)
-ELSE()
-OPTION(WITH_WSREP "WSREP replication API (to use, e.g. Galera Replication library)" OFF)
-ENDIF()
+SET(WSREP_PROC_INFO ${WITH_WSREP})
-MACRO (BUILD_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}")
+IF(WITH_WSREP)
SET(COMPILATION_COMMENT "${COMPILATION_COMMENT}, wsrep_${WSREP_VERSION}")
- #SET(WITH_EMBEDDED_SERVER OFF CACHE INTERNAL "" FORCE)
-ENDMACRO()
+ENDIF()
-#
diff --git a/config.h.cmake b/config.h.cmake
index f7a5451c9a8..57d53975ac7 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -642,6 +642,12 @@
#cmakedefine SIZEOF_TIME_T @SIZEOF_TIME_T@
#cmakedefine TIME_T_UNSIGNED @TIME_T_UNSIGNED@
+#ifndef EMBEDDED_LIBRARY
+#cmakedefine WSREP_INTERFACE_VERSION "@WSREP_INTERFACE_VERSION@"
+#cmakedefine WITH_WSREP 1
+#cmakedefine WSREP_PROC_INFO 1
+#endif
+
#ifdef _AIX
/*
AIX includes inttypes.h from sys/types.h
diff --git a/debian/dist/Debian/control b/debian/dist/Debian/control
index 5fd6b1eac16..4468917ca34 100644
--- a/debian/dist/Debian/control
+++ b/debian/dist/Debian/control
@@ -192,7 +192,11 @@ Architecture: any
Suggests: tinyca, mailx, mariadb-test
Recommends: libhtml-template-perl
Pre-Depends: mariadb-common, adduser (>= 3.40), debconf
-Depends: mariadb-client-10.1 (>= ${source:Version}), libdbi-perl, perl (>= 5.6), ${shlibs:Depends}, ${misc:Depends}, psmisc, passwd, lsb-base (>= 3.0-10), mariadb-server-core-10.1 (>= ${binary:Version}), galera (>=25.2), rsync, lsof, socat, grep, gawk, iproute, coreutils, findutils
+Depends: mariadb-client-10.1 (>= ${source:Version}), libdbi-perl,
+ perl (>= 5.6), ${shlibs:Depends}, ${misc:Depends}, psmisc, passwd,
+ lsb-base (>= 3.0-10), mariadb-server-core-10.1 (>= ${binary:Version}),
+ galera (>=25.2), rsync, lsof, socat | netcat, grep, gawk, iproute,
+ coreutils, findutils
Provides: mariadb-server, mysql-server, virtual-mysql-server
Conflicts: mariadb-server (<< ${source:Version}), mysql-server (<< ${source:Version}),
mysql-server-4.1, mysql-server-5.0, mysql-server-5.1, mysql-server-5.5,
diff --git a/debian/dist/Ubuntu/control b/debian/dist/Ubuntu/control
index c5f417d121b..698b81eae00 100644
--- a/debian/dist/Ubuntu/control
+++ b/debian/dist/Ubuntu/control
@@ -186,7 +186,11 @@ Architecture: any
Suggests: tinyca, mailx, mariadb-test
Recommends: libhtml-template-perl
Pre-Depends: mariadb-common, adduser (>= 3.40), debconf
-Depends: mariadb-client-10.1 (>= ${source:Version}), libdbi-perl, perl (>= 5.6), ${shlibs:Depends}, ${misc:Depends}, psmisc, passwd, lsb-base (>= 3.0-10), mariadb-server-core-10.1 (>= ${binary:Version}), galera (>=25.2), rsync, lsof, socat, grep, gawk, iproute, coreutils, findutils
+Depends: mariadb-client-10.1 (>= ${source:Version}), libdbi-perl,
+ perl (>= 5.6), ${shlibs:Depends}, ${misc:Depends}, psmisc, passwd,
+ lsb-base (>= 3.0-10), mariadb-server-core-10.1 (>= ${binary:Version}),
+ galera (>=25.2), rsync, lsof, socat | netcat, grep, gawk, iproute,
+ coreutils, findutils
Provides: mariadb-server, mysql-server, virtual-mysql-server
Conflicts: mariadb-server (<< ${source:Version}), mysql-server (<< ${source:Version}),
mysql-server-4.1, mysql-server-5.0, mysql-server-5.1, mysql-server-5.5,
diff --git a/include/wsrep.h b/include/wsrep.h
index 9e0f052b340..443806e4c64 100644
--- a/include/wsrep.h
+++ b/include/wsrep.h
@@ -13,8 +13,10 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+#include <my_config.h>
+
#ifndef WSREP_INCLUDED
-#define WSERP_INCLUDED
+#define WSREP_INCLUDED
#ifdef WITH_WSREP
#define IF_WSREP(A,B) A
diff --git a/mysql-test/include/have_wsrep_enabled.inc b/mysql-test/include/have_wsrep_enabled.inc
index edb919fd852..439e13e1eb9 100644
--- a/mysql-test/include/have_wsrep_enabled.inc
+++ b/mysql-test/include/have_wsrep_enabled.inc
@@ -3,7 +3,7 @@
--source include/have_wsrep.inc
---require r/have_wsrep.require
-disable_query_log;
-SHOW VARIABLES LIKE 'wsrep_on';
-enable_query_log;
+if (`SELECT COUNT(*)=0 FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME = 'wsrep_on' AND VARIABLE_VALUE='ON'`)
+{
+ --skip Test requires wsrep_on=ON
+}
diff --git a/mysql-test/include/write_result_to_file.inc b/mysql-test/include/write_result_to_file.inc
index db5d546750c..3e2ddf48957 100644
--- a/mysql-test/include/write_result_to_file.inc
+++ b/mysql-test/include/write_result_to_file.inc
@@ -33,8 +33,7 @@
--let _WRTF_SERVER_NUMBER= $server_number
if (!$server_number)
{
- # Note: 2 extra ports are reserved per server for galera use.
- --let _WRTF_SERVER_NUMBER= `SELECT 1 + FLOOR((@@PORT - $MASTER_MYPORT) / 3)`
+ --let _WRTF_SERVER_NUMBER= `SELECT 1 + @@PORT - $MASTER_MYPORT`
}
--let $_write_result_msg= [server=$_WRTF_SERVER_NUMBER]
diff --git a/mysql-test/lib/My/ConfigFactory.pm b/mysql-test/lib/My/ConfigFactory.pm
index 488b0823763..4e8507a5c4a 100644
--- a/mysql-test/lib/My/ConfigFactory.pm
+++ b/mysql-test/lib/My/ConfigFactory.pm
@@ -238,9 +238,6 @@ 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 },
- { '#sst_port' => \&fix_port },
{ 'socket' => \&fix_socket },
{ '#log-error' => \&fix_log_error },
{ 'general-log' => 1 },
diff --git a/mysql-test/r/have_wsrep.require b/mysql-test/r/have_wsrep.require
deleted file mode 100644
index af32ac7dca7..00000000000
--- a/mysql-test/r/have_wsrep.require
+++ /dev/null
@@ -1,2 +0,0 @@
-Variable_name Value
-wsrep_on ON
diff --git a/mysql-test/suite/galera/galera_2nodes.cnf b/mysql-test/suite/galera/galera_2nodes.cnf
index c0d5b3add3f..024ced1d20b 100644
--- a/mysql-test/suite/galera/galera_2nodes.cnf
+++ b/mysql-test/suite/galera/galera_2nodes.cnf
@@ -3,6 +3,8 @@
[mysqld.1]
binlog-format=row
+#galera_port=OPT.port
+#sst_port=OPT.port
wsrep_provider=@ENV.WSREP_PROVIDER
wsrep_cluster_address='gcomm://'
wsrep_provider_options='base_port=@mysqld.1.#galera_port'
@@ -12,6 +14,8 @@ wsrep_causal_reads=ON
[mysqld.2]
binlog-format=row
+#galera_port=OPT.port
+#sst_port=OPT.port
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'
diff --git a/mysql-test/suite/roles/set_default_role_for.result b/mysql-test/suite/roles/set_default_role_for.result
index 3e444a5f537..7289319a428 100644
--- a/mysql-test/suite/roles/set_default_role_for.result
+++ b/mysql-test/suite/roles/set_default_role_for.result
@@ -21,17 +21,17 @@ Grants for user_a@localhost
GRANT role_a TO 'user_a'@'localhost'
GRANT USAGE ON *.* TO 'user_a'@'localhost'
GRANT SELECT ON *.* TO 'role_a'
-select user, host, default_role from mysql.user where user like 'user_%' order by user;
+select user, host, default_role from mysql.user where user like 'user_%';
user host default_role
user_a localhost role_a
user_b localhost role_b
set default role NONE for current_user;
-select user, host, default_role from mysql.user where user like 'user_%' order by user;
+select user, host, default_role from mysql.user where user like 'user_%';
user host default_role
user_a localhost
user_b localhost role_b
set default role current_role for current_user;
-select user, host, default_role from mysql.user where user like 'user_%' order by user;
+select user, host, default_role from mysql.user where user like 'user_%';
user host default_role
user_a localhost role_a
user_b localhost role_b
@@ -42,7 +42,7 @@ Grants for user_b@localhost
GRANT role_b TO 'user_b'@'localhost'
GRANT USAGE ON *.* TO 'user_b'@'localhost'
GRANT INSERT, UPDATE ON *.* TO 'role_b'
-select user, host, default_role from mysql.user where user like 'user_%' order by user;
+select user, host, default_role from mysql.user where user like 'user_%';
ERROR 42000: SELECT command denied to user 'user_b'@'localhost' for table 'user'
insert into mysql.user (user, host) values ('someuser', 'somehost');
Warnings:
@@ -56,10 +56,10 @@ Grants for user_a@localhost
GRANT role_a TO 'user_a'@'localhost'
GRANT USAGE ON *.* TO 'user_a'@'localhost'
GRANT INSERT, UPDATE ON *.* TO 'role_b'
-select user, host, default_role from mysql.user where user like 'user_%' order by user;
+select user, host, default_role from mysql.user where user like 'user_%';
ERROR 42000: SELECT command denied to user 'user_a'@'localhost' for table 'user'
drop role role_a;
drop role role_b;
-delete from mysql.user where user = 'someuser' && host = 'somehost' order by user;
+delete from mysql.user where user = 'someuser' && host = 'somehost';
drop user user_a@localhost;
drop user user_b@localhost;
diff --git a/mysql-test/suite/roles/set_default_role_for.test b/mysql-test/suite/roles/set_default_role_for.test
index 2e798b49733..d7a3372ae23 100644
--- a/mysql-test/suite/roles/set_default_role_for.test
+++ b/mysql-test/suite/roles/set_default_role_for.test
@@ -44,13 +44,13 @@ set default role role_b for user_b@localhost;
change_user 'user_a';
show grants;
-select user, host, default_role from mysql.user where user like 'user_%' order by user;
+select user, host, default_role from mysql.user where user like 'user_%';
set default role NONE for current_user;
-select user, host, default_role from mysql.user where user like 'user_%' order by user;
+select user, host, default_role from mysql.user where user like 'user_%';
set default role current_role for current_user;
-select user, host, default_role from mysql.user where user like 'user_%' order by user;
+select user, host, default_role from mysql.user where user like 'user_%';
# Make sure we can't set a default role not granted to us, using current_user
--error ER_INVALID_ROLE
@@ -60,7 +60,7 @@ change_user 'user_b';
show grants;
--error ER_TABLEACCESS_DENIED_ERROR
-select user, host, default_role from mysql.user where user like 'user_%' order by user;
+select user, host, default_role from mysql.user where user like 'user_%';
# Make sure the default role setting worked from root.
insert into mysql.user (user, host) values ('someuser', 'somehost');
@@ -73,12 +73,12 @@ change_user 'user_a';
# There is no default role set any more.
show grants;
--error ER_TABLEACCESS_DENIED_ERROR
-select user, host, default_role from mysql.user where user like 'user_%' order by user;
+select user, host, default_role from mysql.user where user like 'user_%';
change_user 'root';
drop role role_a;
drop role role_b;
-delete from mysql.user where user = 'someuser' && host = 'somehost' order by user;
+delete from mysql.user where user = 'someuser' && host = 'somehost';
drop user user_a@localhost;
drop user user_b@localhost;
diff --git a/mysql-test/t/mysql_tzinfo_to_sql_symlink.test b/mysql-test/t/mysql_tzinfo_to_sql_symlink.test
index 0c70315c93b..13a4eaaf605 100644
--- a/mysql-test/t/mysql_tzinfo_to_sql_symlink.test
+++ b/mysql-test/t/mysql_tzinfo_to_sql_symlink.test
@@ -7,11 +7,6 @@
# the updated result. (lp:1161432)
--source include/not_wsrep.inc
-# Note: The output of mysql_tzinfo_to_sql is different if server is compiled
-# with wsrep. Hence a copy of this test has been placed under wsrep suite with
-# the updated result. (lp:1161432)
---source include/not_wsrep.inc
-
--echo #
--echo # MDEV-5226 mysql_tzinfo_to_sql errors with tzdata 2013f and above
--echo #
diff --git a/mysys/CMakeLists.txt b/mysys/CMakeLists.txt
index e342427c737..f0d25dae6b9 100644
--- a/mysys/CMakeLists.txt
+++ b/mysys/CMakeLists.txt
@@ -15,10 +15,6 @@
INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR} ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/mysys)
-IF(WITH_WSREP)
- BUILD_WITH_WSREP()
-ENDIF()
-
SET(MYSYS_SOURCES array.c charset-def.c charset.c checksum.c my_default.c
errors.c hash.c list.c
mf_cache.c mf_dirname.c mf_fn_ext.c
diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt
index 803e14988d2..b02389ccc17 100644
--- a/sql/CMakeLists.txt
+++ b/sql/CMakeLists.txt
@@ -15,7 +15,6 @@
IF(WITH_WSREP AND NOT EMBEDDED_LIBRARY)
- BUILD_WITH_WSREP()
SET(WSREP_INCLUDES ${CMAKE_SOURCE_DIR}/wsrep)
SET(WSREP_SOURCES
wsrep_check_opts.cc
diff --git a/sql/event_data_objects.cc b/sql/event_data_objects.cc
index 26d2e1ef985..bf824a98310 100644
--- a/sql/event_data_objects.cc
+++ b/sql/event_data_objects.cc
@@ -1472,19 +1472,11 @@ 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;
+ thd->lex->sql_command = SQLCOM_DROP_EVENT;
WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL);
- thd->lex = saved;
}
-#endif
ret= Events::drop_event(thd, dbname, name, FALSE);
diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc
index 15cbb03978e..da7f3aeff89 100644
--- a/sql/ha_partition.cc
+++ b/sql/ha_partition.cc
@@ -388,15 +388,6 @@ const char *ha_partition::table_type() const
}
-#if defined(WITH_WSREP) && !defined(EMBEDDED_LIBRARY)
-int ha_partition::wsrep_db_type() const
-{
- // we can do this since we only support a single engine type
- return partition_ht()->db_type;
-}
-#endif /* WITH_WSREP && !EMBEDDED_LIBRARY */
-
-
/*
Destructor method
diff --git a/sql/ha_partition.h b/sql/ha_partition.h
index c3c72394374..07a0b0de145 100644
--- a/sql/ha_partition.h
+++ b/sql/ha_partition.h
@@ -1282,9 +1282,6 @@ public:
DBUG_ASSERT(h == m_file[i]->ht);
return h;
}
-#if defined(WITH_WSREP) && !defined(EMBEDDED_LIBRARY)
- virtual int wsrep_db_type() const;
-#endif /* WITH_WSREP && !EMBEDDED_LIBRARY */
friend int cmp_key_rowid_part_id(void *ptr, uchar *ref1, uchar *ref2);
};
diff --git a/sql/handler.cc b/sql/handler.cc
index 253883cc114..68762061053 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -1384,7 +1384,7 @@ int ha_commit_trans(THD *thd, bool all)
mdl_request.init(MDL_key::COMMIT, "", "", MDL_INTENTION_EXCLUSIVE,
MDL_EXPLICIT);
- if (IF_WSREP(!WSREP(thd),1) &&
+ if (!WSREP(thd) &&
thd->mdl_context.acquire_lock(&mdl_request,
thd->variables.lock_wait_timeout))
{
@@ -1462,13 +1462,11 @@ int ha_commit_trans(THD *thd, bool all)
DEBUG_SYNC(thd, "ha_commit_trans_after_prepare");
DBUG_EXECUTE_IF("crash_commit_after_prepare", DBUG_SUICIDE(););
-#ifdef WITH_WSREP
if (!error && WSREP_ON && wsrep_is_wsrep_xid(&thd->transaction.xid_state.xid))
{
// xid was rewritten by wsrep
xid= wsrep_xid_seqno(&thd->transaction.xid_state.xid);
}
-#endif // WITH_WSREP
if (!is_real_trans)
{
@@ -1846,10 +1844,9 @@ static my_bool xarecover_handlerton(THD *unused, plugin_ref plugin,
got, hton_name(hton)->str);
for (int i=0; i < got; i ++)
{
- my_xid x= IF_WSREP(WSREP_ON && wsrep_is_wsrep_xid(&info->list[i]) ?
+ my_xid x= WSREP_ON && wsrep_is_wsrep_xid(&info->list[i]) ?
wsrep_xid_seqno(&info->list[i]) :
- info->list[i].get_my_xid(),
- info->list[i].get_my_xid());
+ info->list[i].get_my_xid();
if (!x) // not "mine" - that is generated by external TM
{
#ifndef DBUG_OFF
@@ -3134,7 +3131,7 @@ int handler::update_auto_increment()
variables->auto_increment_increment);
auto_inc_intervals_count++;
/* Row-based replication does not need to store intervals in binlog */
- if (IF_WSREP(((WSREP(thd) && wsrep_emulate_bin_log ) || mysql_bin_log.is_open()), mysql_bin_log.is_open())
+ if (((WSREP(thd) && wsrep_emulate_bin_log ) || mysql_bin_log.is_open())
&& !thd->is_current_stmt_binlog_format_row())
thd->auto_inc_intervals_in_cur_stmt_for_binlog.
append(auto_inc_interval_for_cur_row.minimum(),
@@ -5754,13 +5751,13 @@ static bool check_table_binlog_row_based(THD *thd, TABLE *table)
DBUG_ASSERT(table->s->cached_row_logging_check == 0 ||
table->s->cached_row_logging_check == 1);
- return (thd->is_current_stmt_binlog_format_row() &&
+ return thd->is_current_stmt_binlog_format_row() &&
table->s->cached_row_logging_check &&
(thd->variables.option_bits & OPTION_BIN_LOG) &&
/* applier and replayer should not binlog */
- (IF_WSREP((WSREP_EMULATE_BINLOG(thd) &&
- (thd->wsrep_exec_mode != REPL_RECV)) ||
- mysql_bin_log.is_open(), mysql_bin_log.is_open())));
+ ((IF_WSREP(WSREP_EMULATE_BINLOG(thd) &&
+ thd->wsrep_exec_mode != REPL_RECV, 0)) ||
+ mysql_bin_log.is_open());
}
@@ -5860,12 +5857,11 @@ static 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->partition_ht()->db_type != DB_TYPE_INNODB)
return 0;
-#endif /* WITH_WSREP */
+
if (check_table_binlog_row_based(thd, table))
{
MY_BITMAP cols;
@@ -6226,11 +6222,9 @@ int ha_abort_transaction(THD *bf_thd, THD *victim_thd, my_bool signal)
{
handlerton *hton= ha_info->ht();
if (!hton->abort_transaction)
- {
- WSREP_WARN("cannot abort transaction");
- }
+ WSREP_WARN("cannot abort transaction");
else
- hton->abort_transaction(hton, bf_thd, victim_thd, signal);
+ hton->abort_transaction(hton, bf_thd, victim_thd, signal);
ha_info_next= ha_info->next();
ha_info->reset(); /* keep it conveniently zero-filled */
}
diff --git a/sql/handler.h b/sql/handler.h
index 169ed209403..703d1c615b3 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -3967,9 +3967,6 @@ bool key_uses_partial_cols(TABLE_SHARE *table, uint keyno);
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;
@@ -4091,7 +4088,9 @@ int ha_release_savepoint(THD *thd, SAVEPOINT *sv);
#ifdef WITH_WSREP
int ha_abort_transaction(THD *bf_thd, THD *victim_thd, my_bool signal);
void ha_fake_trx_id(THD *thd);
-#endif /* WITH_WSREP */
+#else
+inline void ha_fake_trx_id(THD *thd) { }
+#endif
/* these are called by storage engines */
void trans_register_ha(THD *thd, bool all, handlerton *ht);
@@ -4122,9 +4121,6 @@ int ha_binlog_end(THD *thd);
#define ha_binlog_wait(a) do {} while (0)
#define ha_binlog_end(a) do {} while (0)
#endif
-#ifdef WITH_WSREP
-void wsrep_brute_force_aborts();
-#endif
const char *get_canonical_filename(handler *file, const char *path,
char *tmp_path);
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 13803cff2d6..2b89aa04295 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -2771,12 +2771,13 @@ void Item_func_rand::seed_random(Item *arg)
*/
uint32 tmp;
#ifdef WITH_WSREP
- if (WSREP(current_thd))
+ THD *thd= current_thd;
+ if (WSREP(thd))
{
- if (current_thd->wsrep_exec_mode==REPL_RECV)
- tmp= current_thd->wsrep_rand;
+ if (thd->wsrep_exec_mode==REPL_RECV)
+ tmp= thd->wsrep_rand;
else
- tmp= current_thd->wsrep_rand= (uint32) arg->val_int();
+ tmp= thd->wsrep_rand= (uint32) arg->val_int();
}
else
#endif /* WITH_WSREP */
diff --git a/sql/log.cc b/sql/log.cc
index 4f80b38e497..9c6de086a13 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -52,7 +52,6 @@
#include "sql_plugin.h"
#include "rpl_handler.h"
-#include "wsrep_mysqld.h"
#include "debug_sync.h"
#include "sql_show.h"
#include "my_pthread.h"
@@ -1577,8 +1576,7 @@ 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->binlog_setup_trx_data();
- DBUG_ASSERT_IF_WSREP(((WSREP(thd) && wsrep_emulate_bin_log)) || mysql_bin_log.is_open());
- DBUG_ASSERT(IF_WSREP(1, mysql_bin_log.is_open()));
+ DBUG_ASSERT((WSREP(thd) && wsrep_emulate_bin_log) || mysql_bin_log.is_open());
*pos= cache_mngr->trx_cache.get_byte_position();
DBUG_PRINT("return", ("*pos: %lu", (ulong) *pos));
DBUG_VOID_RETURN;
@@ -1626,8 +1624,8 @@ binlog_trans_log_truncate(THD *thd, my_off_t pos)
int binlog_init(void *p)
{
binlog_hton= (handlerton *)p;
- binlog_hton->state=IF_WSREP(WSREP_ON || opt_bin_log, opt_bin_log) ?
- SHOW_OPTION_YES : SHOW_OPTION_NO;
+ binlog_hton->state= (WSREP_ON || opt_bin_log) ? SHOW_OPTION_YES
+ : SHOW_OPTION_NO;
binlog_hton->db_type=DB_TYPE_BINLOG;
binlog_hton->savepoint_offset= sizeof(my_off_t);
binlog_hton->close_connection= binlog_close_connection;
@@ -1939,13 +1937,12 @@ static int binlog_commit(handlerton *hton, THD *thd, bool all)
DBUG_ENTER("binlog_commit");
binlog_cache_mngr *const cache_mngr=
(binlog_cache_mngr*) thd_get_ha_data(thd, binlog_hton);
-#ifdef WITH_WSREP
+
if (!cache_mngr)
{
DBUG_ASSERT(WSREP(thd));
DBUG_RETURN(0);
}
-#endif /* WITH_WSREP */
DBUG_PRINT("debug",
("all: %d, in_transaction: %s, all.modified_non_trans_table: %s, stmt.modified_non_trans_table: %s",
@@ -2002,15 +1999,13 @@ static int binlog_rollback(handlerton *hton, THD *thd, bool all)
int error= 0;
binlog_cache_mngr *const cache_mngr=
(binlog_cache_mngr*) thd_get_ha_data(thd, binlog_hton);
-#ifdef WITH_WSREP
+
if (!cache_mngr)
{
DBUG_ASSERT(WSREP(thd));
DBUG_RETURN(0);
}
-#endif /* WITH_WSREP */
-
DBUG_PRINT("debug", ("all: %s, all.modified_non_trans_table: %s, stmt.modified_non_trans_table: %s",
YESNO(all),
YESNO(thd->transaction.all.modified_non_trans_table),
@@ -2038,8 +2033,7 @@ static int binlog_rollback(handlerton *hton, THD *thd, bool all)
cache_mngr->reset(false, true);
DBUG_RETURN(error);
}
- if (IF_WSREP(!wsrep_emulate_bin_log,1) &&
- mysql_bin_log.check_write_error(thd))
+ if (!wsrep_emulate_bin_log && mysql_bin_log.check_write_error(thd))
{
/*
"all == true" means that a "rollback statement" triggered the error and
@@ -2180,10 +2174,8 @@ static int binlog_savepoint_set(handlerton *hton, THD *thd, void *sv)
int error= 1;
DBUG_ENTER("binlog_savepoint_set");
-#ifdef WITH_WSREP
if (wsrep_emulate_bin_log)
DBUG_RETURN(0);
-#endif /* WITH_WSREP */
char buf[1024];
String log_query(buf, sizeof(buf), &my_charset_bin);
@@ -2222,7 +2214,7 @@ static int binlog_savepoint_rollback(handlerton *hton, THD *thd, void *sv)
non-transactional table. Otherwise, truncate the binlog cache starting
from the SAVEPOINT command.
*/
- if (IF_WSREP(!wsrep_emulate_bin_log, 1) &&
+ if (!wsrep_emulate_bin_log &&
unlikely(trans_has_updated_non_trans_table(thd) ||
(thd->variables.option_bits & OPTION_KEEP_LOG)))
{
@@ -2238,7 +2230,7 @@ static int binlog_savepoint_rollback(handlerton *hton, THD *thd, void *sv)
DBUG_RETURN(mysql_bin_log.write(&qinfo));
}
- if (IF_WSREP(!wsrep_emulate_bin_log, 1))
+ if (!wsrep_emulate_bin_log)
binlog_trans_log_truncate(thd, *(my_off_t*)sv);
DBUG_RETURN(0);
@@ -5369,7 +5361,7 @@ int THD::binlog_write_table_map(TABLE *table, bool is_transactional,
/* Pre-conditions */
DBUG_ASSERT(is_current_stmt_binlog_format_row());
- DBUG_ASSERT(IF_WSREP(WSREP_EMULATE_BINLOG(this), 0) || mysql_bin_log.is_open());
+ DBUG_ASSERT(WSREP_EMULATE_BINLOG(this) || mysql_bin_log.is_open());
DBUG_ASSERT(table->s->table_map_id != ULONG_MAX);
Table_map_log_event
@@ -5502,7 +5494,7 @@ 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)");
- DBUG_ASSERT(IF_WSREP(WSREP_EMULATE_BINLOG(thd),0) || mysql_bin_log.is_open());
+ DBUG_ASSERT(WSREP_EMULATE_BINLOG(thd) || mysql_bin_log.is_open());
DBUG_PRINT("enter", ("event: 0x%lx", (long) event));
int error= 0;
@@ -5829,7 +5821,8 @@ bool MYSQL_BIN_LOG::write(Log_event *event_info, my_bool *with_annotate)
could have changed since.
*/
/* applier and replayer can skip writing binlog events */
- if (IF_WSREP((WSREP_EMULATE_BINLOG(thd) && (thd->wsrep_exec_mode != REPL_RECV)) || is_open(), likely(is_open())))
+ if ((WSREP_EMULATE_BINLOG(thd) &&
+ IF_WSREP(thd->wsrep_exec_mode != REPL_RECV, 0)) || is_open())
{
my_off_t UNINIT_VAR(my_org_b_tell);
#ifdef HAVE_REPLICATION
@@ -6168,7 +6161,6 @@ 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_to_isolation)
{
DBUG_ASSERT(WSREP_ON);
@@ -6177,7 +6169,6 @@ int MYSQL_BIN_LOG::rotate(bool force_rotate, bool* check_purge)
wsrep_to_isolation);
DBUG_RETURN(0);
}
-#endif
//todo: fix the macro def and restore safe_mutex_assert_owner(&LOCK_log);
*check_purge= false;
@@ -6724,10 +6715,8 @@ MYSQL_BIN_LOG::write_transaction_to_binlog(THD *thd,
Ha_trx_info *ha_info;
DBUG_ENTER("MYSQL_BIN_LOG::write_transaction_to_binlog");
-#ifdef WITH_WSREP
if (wsrep_emulate_bin_log)
DBUG_RETURN(0);
-#endif /* WITH_WSREP */
entry.thd= thd;
entry.cache_mngr= cache_mngr;
diff --git a/sql/log_event.cc b/sql/log_event.cc
index c19faf21647..ee35acadd9b 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -10812,7 +10812,7 @@ check_table_map(rpl_group_info *rgi, RPL_TABLE_LIST *table_list)
DBUG_ENTER("check_table_map");
enum_tbl_map_status res= OK_TO_PROCESS;
Relay_log_info *rli= rgi->rli;
- if ((rgi->thd->slave_thread /* filtering is for slave only */ ||
+ if ((rgi->thd->slave_thread /* filtering is for slave only */ ||
IF_WSREP((WSREP(rgi->thd) && rgi->thd->wsrep_applier), 0)) &&
(!rli->mi->rpl_filter->db_ok(table_list->db) ||
(rli->mi->rpl_filter->is_on() && !rli->mi->rpl_filter->tables_ok("", table_list))))
diff --git a/sql/mdl.cc b/sql/mdl.cc
index 07130b4d002..15428c96d73 100644
--- a/sql/mdl.cc
+++ b/sql/mdl.cc
@@ -1939,11 +1939,10 @@ MDL_lock::can_grant_lock(enum_mdl_type type_arg,
#endif /* WITH_WSREP */
}
}
- if ((ticket == NULL) && IF_WSREP(wsrep_can_grant, 1))
+ if ((ticket == NULL) && wsrep_can_grant)
can_grant= TRUE; /* Incompatible locks are our own. */
}
}
-#ifdef WITH_WSREP
else
{
if (wsrep_thd_is_BF((void *)(requestor_ctx->get_thd()), false) &&
@@ -1955,7 +1954,6 @@ MDL_lock::can_grant_lock(enum_mdl_type type_arg,
can_grant = true;
}
}
-#endif /* WITH_WSREP */
return can_grant;
}
@@ -3310,7 +3308,6 @@ void MDL_context::set_transaction_duration_for_all_locks()
}
-#ifdef WITH_WSREP
void MDL_context::release_explicit_locks()
{
@@ -3318,6 +3315,7 @@ void MDL_context::release_explicit_locks()
}
+#ifdef WITH_WSREP
void MDL_ticket::wsrep_report(bool debug)
{
if (debug)
diff --git a/sql/mdl.h b/sql/mdl.h
index 231f95d7419..27289e621ef 100644
--- a/sql/mdl.h
+++ b/sql/mdl.h
@@ -793,9 +793,7 @@ 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; }
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 0794d7fee61..f842c835f24 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -738,27 +738,6 @@ mysql_cond_t COND_server_started;
int mysqld_server_started=0, mysqld_server_initialized= 0;
File_parser_dummy_hook file_parser_dummy_hook;
-#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;
-ulong wsrep_running_threads = 0; // # of currently running wsrep threads
-ulong my_bind_addr;
-const char *wsrep_binlog_format_names[]=
- {"MIXED", "STATEMENT", "ROW", "NONE", NullS};
-#endif /* WITH_WSREP */
-
/* replication parameters, if master_host is not NULL, we are a slave */
uint report_port= 0;
ulong master_retry_count=0;
@@ -896,12 +875,6 @@ PSI_mutex_key key_BINLOG_LOCK_index, key_BINLOG_LOCK_xid_list,
key_LOCK_error_messages, key_LOG_INFO_lock,
key_LOCK_thread_count, key_LOCK_thread_cache,
key_PARTITION_LOCK_auto_inc;
-#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_index;
PSI_mutex_key key_LOCK_slave_state, key_LOCK_binlog_state,
key_LOCK_rpl_thread, key_LOCK_rpl_thread_pool, key_LOCK_parallel_entry;
@@ -976,18 +949,6 @@ static PSI_mutex_info all_server_mutexes[]=
{ &key_LOCK_prepare_ordered, "LOCK_prepare_ordered", PSI_FLAG_GLOBAL},
{ &key_LOCK_commit_ordered, "LOCK_commit_ordered", PSI_FLAG_GLOBAL},
{ &key_LOG_INFO_lock, "LOG_INFO::lock", 0},
-#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_thread_count, "LOCK_thread_count", PSI_FLAG_GLOBAL},
{ &key_LOCK_thread_cache, "LOCK_thread_cache", PSI_FLAG_GLOBAL},
{ &key_PARTITION_LOCK_auto_inc, "HA_DATA_PARTITION::LOCK_auto_inc", 0},
@@ -1034,11 +995,6 @@ PSI_cond_key key_BINLOG_COND_xid_list, key_BINLOG_update_cond,
key_TABLE_SHARE_cond, key_user_level_lock_cond,
key_COND_thread_count, key_COND_thread_cache, key_COND_flush_thread_cache,
key_BINLOG_COND_queue_busy;
-#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, key_COND_wakeup_ready,
key_COND_wait_commit;
PSI_cond_key key_RELAYLOG_COND_queue_busy;
@@ -1088,15 +1044,6 @@ 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_COND_rpl_thread, "COND_rpl_thread", 0},
{ &key_COND_rpl_thread_queue, "COND_rpl_thread_queue", 0},
@@ -1945,17 +1892,13 @@ 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_inited == 1)
wsrep_deinit(true);
-#endif
if (sig != MYSQL_KILL_SIGNAL &&
sig != 0)
@@ -2062,10 +2005,9 @@ extern "C" void unireg_abort(int exit_code)
*/
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 */
+ wsrep_close_threads(NULL); /* 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.");
@@ -2294,20 +2236,6 @@ static void clean_up_mutexes()
mysql_cond_destroy(&COND_thread_count);
mysql_cond_destroy(&COND_thread_cache);
mysql_cond_destroy(&COND_flush_thread_cache);
-#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
mysql_mutex_destroy(&LOCK_server_started);
mysql_cond_destroy(&COND_server_started);
mysql_mutex_destroy(&LOCK_prepare_ordered);
@@ -2321,7 +2249,12 @@ static void clean_up_mutexes()
** Init IP and UNIX socket
****************************************************************************/
-#ifndef EMBEDDED_LIBRARY
+#ifdef EMBEDDED_LIBRARY
+static void set_ports()
+{
+}
+
+#else
static void set_ports()
{
char *env;
@@ -2623,10 +2556,10 @@ static MYSQL_SOCKET activate_tcp_port(uint port)
socket_errno);
unireg_abort(1);
}
-#if defined(WITH_WSREP) && defined(HAVE_FCNTL) && defined(FD_CLOEXEC)
- if (WSREP_ON)
- (void) fcntl(mysql_socket_getfd(ip_sock), F_SETFD, FD_CLOEXEC);
-#endif /* WITH_WSREP */
+
+#ifdef FD_CLOEXEC
+ (void) fcntl(mysql_socket_getfd(ip_sock), F_SETFD, FD_CLOEXEC);
+#endif
DBUG_RETURN(ip_sock);
}
@@ -2754,10 +2687,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)
- if (WSREP_ON)
- (void) fcntl(mysql_socket_getfd(unix_sock), F_SETFD, FD_CLOEXEC);
-#endif /* WITH_WSREP */
+#ifdef FD_CLOEXEC
+ (void) fcntl(mysql_socket_getfd(unix_sock), F_SETFD, FD_CLOEXEC);
+#endif
}
#endif
DBUG_PRINT("info",("server started"));
@@ -3012,15 +2944,13 @@ static bool cache_thread()
bool one_thread_per_connection_end(THD *thd, bool put_in_cache)
{
DBUG_ENTER("one_thread_per_connection_end");
-#ifdef WITH_WSREP
- const bool wsrep_applier(thd->wsrep_applier);
-#endif
+ const bool wsrep_applier= IF_WSREP(thd->wsrep_applier, false);
unlink_thd(thd);
/* Mark that current_thd is not valid anymore */
set_current_thd(0);
- if (put_in_cache && cache_thread() && IF_WSREP(!wsrep_applier, 1))
+ if (put_in_cache && cache_thread() && !wsrep_applier)
DBUG_RETURN(0); // Thread is reused
/*
@@ -4145,7 +4075,7 @@ static int init_common_variables()
opt_log_basename= glob_hostname;
#ifdef WITH_WSREP
- if (0 == wsrep_node_name || 0 == wsrep_node_name[0])
+ if (wsrep_node_name == 0 || wsrep_node_name[0] == 0)
{
my_free((void *)wsrep_node_name);
wsrep_node_name= my_strdup(glob_hostname, MYF(MY_WME));
@@ -4616,28 +4546,6 @@ static int init_thread_environment()
rpl_init_gtid_waiting();
#endif
-#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
-
DBUG_RETURN(0);
}
@@ -4935,10 +4843,10 @@ static int init_server_components()
/* need to configure logging before initializing storage engines */
if (!opt_bin_log_used)
{
- if (IF_WSREP(!WSREP_ON,1) && opt_log_slave_updates)
+ if (!WSREP_ON && opt_log_slave_updates)
sql_print_warning("You need to use --log-bin to make "
"--log-slave-updates work.");
- if (IF_WSREP(!WSREP_ON, 1) && binlog_format_used)
+ if (!WSREP_ON && binlog_format_used)
sql_print_warning("You need to use --log-bin to make "
"--binlog-format work.");
}
@@ -5010,10 +4918,9 @@ a file name for --log-bin-index option", opt_binlog_index_name);
opt_log_basename, ln);
}
if (ln == buf)
- {
opt_bin_logname= my_once_strdup(buf, MYF(MY_WME));
- }
-#ifdef WITH_WSREP /* WSREP BEFORE SE */
+ }
+
/*
Wsrep initialization must happen at this point, because:
- opt_bin_logname must be known when starting replication
@@ -5021,19 +4928,19 @@ a file name for --log-bin-index option", opt_binlog_index_name);
- SST may modify binlog index file, so it must be opened
after SST has happened
*/
- }
- if (WSREP_ON && !wsrep_recovery)
+ if (WSREP_ON && !wsrep_recovery) /* WSREP BEFORE SE */
{
if (opt_bootstrap) // bootsrap option given - disable wsrep functionality
{
wsrep_provider_init(WSREP_NONE);
- if (wsrep_init()) unireg_abort(1);
+ 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));
+ char* const tmp_path= (char*)my_alloca(strlen(mysql_home) +
+ strlen("/bin") + 1);
if (tmp_path)
{
strcpy(tmp_path, mysql_home);
@@ -5044,6 +4951,7 @@ a file name for --log-bin-index option", opt_binlog_index_name);
{
WSREP_ERROR("Could not append %s/bin to PATH", mysql_home);
}
+ my_afree(tmp_path);
if (wsrep_before_SE())
{
@@ -5053,27 +4961,14 @@ a file name for --log-bin-index option", opt_binlog_index_name);
}
}
}
+
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 */
}
/* call ha_init_key_cache() on all key caches to init them */
@@ -5206,7 +5101,6 @@ a file name for --log-bin-index option", opt_binlog_index_name);
tc_log= get_tc_log_implementation();
-#ifdef WITH_WSREP
if (WSREP_ON && tc_log == &tc_log_mmap)
tc_log= &tc_log_dummy;
@@ -5215,7 +5109,6 @@ a file name for --log-bin-index option", opt_binlog_index_name);
(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))
{
@@ -5474,10 +5367,9 @@ int mysqld_main(int argc, char **argv)
return 1;
}
#endif
-#ifdef WITH_WSREP
+
if (WSREP_ON)
wsrep_filter_new_cluster (&argc, argv);
-#endif /* WITH_WSREP */
orig_argc= argc;
orig_argv= argv;
@@ -5694,14 +5586,12 @@ int mysqld_main(int argc, char **argv)
}
#endif
-#ifdef WITH_WSREP /* WSREP AFTER SE */
if (WSREP_ON && wsrep_recovery)
{
select_thread_in_use= 0;
wsrep_recover();
unireg_abort(0);
}
-#endif /* WITH_WSREP */
/*
init signals & alarm
@@ -5751,7 +5641,6 @@ int mysqld_main(int argc, char **argv)
if (Events::init(opt_noacl || opt_bootstrap))
unireg_abort(1);
-#ifdef WITH_WSREP /* WSREP AFTER SE */
if (WSREP_ON)
{
if (opt_bootstrap)
@@ -5778,7 +5667,7 @@ int mysqld_main(int argc, char **argv)
wsrep_create_appliers(wsrep_slave_threads - 1);
}
}
-#endif /* WITH_WSREP */
+
if (opt_bootstrap)
{
select_thread_in_use= 0; // Allow 'kill' to work
@@ -6517,9 +6406,9 @@ void handle_connections_sockets()
sleep(1); // Give other threads some time
continue;
}
-#if defined(WITH_WSREP) && defined(HAVE_FCNTL) && defined(FD_CLOEXEC)
+#ifdef FD_CLOEXEC
(void) fcntl(mysql_socket_getfd(new_sock), F_SETFD, FD_CLOEXEC);
-#endif /* WITH_WSREP */
+#endif
#ifdef HAVE_LIBWRAP
{
@@ -8293,21 +8182,6 @@ SHOW_VAR status_vars[]= {
#ifdef ENABLED_PROFILING
{"Uptime_since_flush_status",(char*) &show_flushstatustime, SHOW_SIMPLE_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_SIMPLE_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_thread_count", (char*) &wsrep_running_threads, SHOW_LONG_NOFLUSH},
- {"wsrep", (char*) &wsrep_show_status, SHOW_FUNC},
-#endif
{NullS, NullS, SHOW_LONG}
};
@@ -8651,10 +8525,10 @@ static int mysql_init_variables(void)
tmpenv = DEFAULT_MYSQL_HOME;
strmake_buf(mysql_home, tmpenv);
#endif
-#ifdef WITH_WSREP
+
if (WSREP_ON && wsrep_init_vars())
return 1;
-#endif
+
return 0;
}
@@ -8902,14 +8776,12 @@ 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:
/*
diff --git a/sql/mysqld.h b/sql/mysqld.h
index 39b77b441bb..1f7a48050f4 100644
--- a/sql/mysqld.h
+++ b/sql/mysqld.h
@@ -242,11 +242,6 @@ extern PSI_mutex_key key_PAGE_lock, key_LOCK_sync, key_LOCK_active,
key_LOCK_pool, key_LOCK_pending_checkpoint;
#endif /* HAVE_MMAP */
-#ifdef WITH_WSREP
-extern PSI_mutex_key key_LOCK_wsrep_thd;
-extern PSI_cond_key key_COND_wsrep_thd;
-#endif /* WITH_WSREP */
-
#ifdef HAVE_OPENSSL
extern PSI_mutex_key key_LOCK_des_key_file;
#endif
@@ -604,15 +599,8 @@ enum options_mysqld
OPT_WANT_CORE,
OPT_MYSQL_COMPATIBILITY,
OPT_MYSQL_TO_BE_IMPLEMENTED,
-#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_which_is_always_the_last
};
#endif
diff --git a/sql/protocol.cc b/sql/protocol.cc
index caa00dd80e3..fde90102e61 100644
--- a/sql/protocol.cc
+++ b/sql/protocol.cc
@@ -489,7 +489,7 @@ static uchar *net_store_length_fast(uchar *packet, uint length)
void Protocol::end_statement()
{
/* sanity check*/
- DBUG_ASSERT_IF_WSREP(!(WSREP_ON && WSREP(thd) && thd->wsrep_conflict_state == REPLAYING));
+ DBUG_ASSERT_IF_WSREP(!(WSREP(thd) && thd->wsrep_conflict_state == REPLAYING));
DBUG_ENTER("Protocol::end_statement");
DBUG_ASSERT(! thd->get_stmt_da()->is_sent());
bool error= FALSE;
diff --git a/sql/rpl_record.cc b/sql/rpl_record.cc
index 29a1b9728e5..b1cca04d947 100644
--- a/sql/rpl_record.cc
+++ b/sql/rpl_record.cc
@@ -315,7 +315,6 @@ unpack_row(rpl_group_info *rgi,
(int) (pack_ptr - old_pack_ptr)));
if (!pack_ptr)
{
-#ifdef WITH_WSREP
if (WSREP_ON)
{
/*
@@ -331,7 +330,6 @@ unpack_row(rpl_group_info *rgi,
(table_found) ? "found" : "not found", (ulong)row_end
);
}
-#endif /* WITH_WSREP */
rgi->rli->report(ERROR_LEVEL, ER_SLAVE_CORRUPT_EVENT,
"Could not read field '%s' of table '%s.%s'",
diff --git a/sql/set_var.cc b/sql/set_var.cc
index 7ad5dc31f6e..5c1e00af33e 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -556,11 +556,7 @@ int mysql_del_sys_var_chain(sys_var *first)
static int show_cmp(SHOW_VAR *a, SHOW_VAR *b)
{
-#ifdef WITH_WSREP
- return my_strcasecmp(system_charset_info, a->name, b->name);
-#else
return strcmp(a->name, b->name);
-#endif /* WITH_WSREP */
}
diff --git a/sql/set_var.h b/sql/set_var.h
index e72a8af6210..bb92e555aa7 100644
--- a/sql/set_var.h
+++ b/sql/set_var.h
@@ -249,9 +249,6 @@ public:
int check(THD *thd);
int update(THD *thd);
int light_check(THD *thd);
-#ifdef WITH_WSREP
- int wsrep_store_variable(THD *thd);
-#endif
};
@@ -358,9 +355,6 @@ extern sys_var *Sys_autocommit_ptr;
CHARSET_INFO *get_old_charset_by_name(const char *old_name);
-#ifdef WITH_WSREP
-int sql_set_wsrep_variables(THD *thd, List<set_var_base> *var_list);
-#endif
int sys_var_init();
int sys_var_add_options(DYNAMIC_ARRAY *long_options, int parse_flags);
void sys_var_end(void);
diff --git a/sql/slave.cc b/sql/slave.cc
index 44107c02724..110283ce4b4 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -4621,12 +4621,10 @@ log '%s' at position %s, relay log '%s' position: %s%s", RPL_LOG_NAME,
if (!sql_slave_killed(serial_rgi))
{
slave_output_error_info(rli, thd);
-#ifdef WITH_WSREP
if (WSREP_ON && rli->last_error().number == ER_UNKNOWN_COM_ERROR)
{
wsrep_node_dropped= TRUE;
}
-#endif /* WITH_WSREP */
}
goto err;
}
diff --git a/sql/sp.cc b/sql/sp.cc
index 261299464c5..b25117019c0 100644
--- a/sql/sp.cc
+++ b/sql/sp.cc
@@ -32,19 +32,6 @@
#include <my_user.h>
-bool
-create_string(THD *thd, String *buf,
- stored_procedure_type sp_type,
- const char *db, ulong dblen,
- const char *name, ulong namelen,
- const char *params, ulong paramslen,
- const char *returns, ulong returnslen,
- const char *body, ulong bodylen,
- st_sp_chistics *chistics,
- const LEX_STRING *definer_user,
- const LEX_STRING *definer_host,
- ulonglong sql_mode);
-
static int
db_load_routine(THD *thd, stored_procedure_type type, sp_name *name,
sp_head **sphp,
@@ -844,7 +831,7 @@ db_load_routine(THD *thd, stored_procedure_type type,
definition for SHOW CREATE PROCEDURE later.
*/
- if (!create_string(thd, &defstr,
+ if (!show_create_sp(thd, &defstr,
type,
NULL, 0,
name->m_name.str, name->m_name.length,
@@ -1186,7 +1173,7 @@ sp_create_routine(THD *thd, stored_procedure_type type, sp_head *sp)
String log_query;
log_query.set_charset(system_charset_info);
- if (!create_string(thd, &log_query,
+ if (!show_create_sp(thd, &log_query,
sp->m_type,
(sp->m_explicit_name ? sp->m_db.str : NULL),
(sp->m_explicit_name ? sp->m_db.length : 0),
@@ -2127,7 +2114,7 @@ int sp_cache_routine(THD *thd, enum stored_procedure_type type, sp_name *name,
Returns TRUE on success, FALSE on (alloc) failure.
*/
bool
-create_string(THD *thd, String *buf,
+show_create_sp(THD *thd, String *buf,
stored_procedure_type type,
const char *db, ulong dblen,
const char *name, ulong namelen,
@@ -2253,7 +2240,7 @@ sp_load_for_information_schema(THD *thd, TABLE *proc_table, String *db,
sp_body= (type == TYPE_ENUM_FUNCTION ? "RETURN NULL" : "BEGIN END");
bzero((char*) &sp_chistics, sizeof(sp_chistics));
defstr.set_charset(creation_ctx->get_client_cs());
- if (!create_string(thd, &defstr, type,
+ if (!show_create_sp(thd, &defstr, type,
sp_db_str.str, sp_db_str.length,
sp_name_obj.m_name.str, sp_name_obj.m_name.length,
params, strlen(params),
diff --git a/sql/sp.h b/sql/sp.h
index de32b5454f8..eb3291fb1a9 100644
--- a/sql/sp.h
+++ b/sql/sp.h
@@ -218,7 +218,7 @@ void sp_returns_type(THD *thd,
String &result,
sp_head *sp);
-bool create_string(THD *thd, String *buf,
+bool show_create_sp(THD *thd, String *buf,
stored_procedure_type type,
const char *db, ulong dblen,
const char *name, ulong namelen,
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index bae2d15ba20..5e30b148ad7 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -2657,9 +2657,7 @@ bool change_password(THD *thd, const char *host, const char *user,
if (WSREP(thd) && !thd->wsrep_applier)
{
query_length= sprintf(buff, "SET PASSWORD FOR '%-.120s'@'%-.120s'='%-.120s'",
- user ? user : "",
- host ? host : "",
- new_password);
+ safe_str(user), safe_str(host), new_password);
thd->set_query_inner(buff, query_length, system_charset_info);
WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, (char*)"user", NULL);
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 68f325e20ab..00689aad1f3 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -9019,14 +9019,12 @@ bool mysql_notify_thread_having_shared_lock(THD *thd, THD *in_use,
if (!thd_table->needs_reopen())
{
signalled|= mysql_lock_abort_for_thread(thd, thd_table);
-#ifdef WITH_WSREP
if (thd && WSREP(thd) && wsrep_thd_is_BF((void *)thd, true))
{
WSREP_DEBUG("remove_table_from_cache: %llu",
(unsigned long long) thd->real_id);
wsrep_abort_thd((void *)thd, (void *)in_use, FALSE);
}
-#endif
}
}
mysql_mutex_unlock(&in_use->LOCK_thd_data);
diff --git a/sql/sql_builtin.cc.in b/sql/sql_builtin.cc.in
index 2de475b0a76..5bf0a682369 100644
--- a/sql/sql_builtin.cc.in
+++ b/sql/sql_builtin.cc.in
@@ -27,7 +27,7 @@ builtin_maria_plugin
@mysql_mandatory_plugins@ @mysql_optional_plugins@
builtin_maria_binlog_plugin,
#ifdef WITH_WSREP
- builtin_wsrep_plugin@mysql_plugin_defs@,
+ builtin_wsrep_plugin,
#endif /* WITH_WSREP */
builtin_maria_mysql_password_plugin;
@@ -40,7 +40,7 @@ struct st_maria_plugin *mysql_mandatory_plugins[]=
{
builtin_maria_binlog_plugin, builtin_maria_mysql_password_plugin,
#ifdef WITH_WSREP
- builtin_wsrep_plugin@mysql_plugin_defs@,
+ builtin_wsrep_plugin,
#endif /* WITH_WSREP */
@mysql_mandatory_plugins@ 0
};
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index 919361b4b30..82e4f99eed0 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -861,7 +861,7 @@ bool Drop_table_error_handler::handle_condition(THD *thd,
}
-THD::THD(bool is_applier)
+THD::THD(bool is_wsrep_applier)
:Statement(&main_lex, &main_mem_root, STMT_CONVENTIONAL_EXECUTION,
/* statement id */ 0),
rli_fake(0), rgi_fake(0), rgi_slave(NULL),
@@ -892,13 +892,12 @@ THD::THD(bool is_applier)
derived_tables_processing(FALSE),
spcont(NULL),
#ifdef WITH_WSREP
- wsrep_applier(is_applier),
+ wsrep_applier(is_wsrep_applier),
wsrep_applier_closing(false),
wsrep_client_thread(false),
wsrep_apply_toi(false),
wsrep_po_handle(WSREP_PO_INITIALIZER),
wsrep_po_cnt(0),
-// wsrep_po_in_trans(false),
wsrep_apply_format(0),
#endif
m_parser_state(NULL),
@@ -1435,15 +1434,8 @@ void THD::init(void)
wsrep_TOI_pre_query = NULL;
wsrep_TOI_pre_query_len = 0;
-
- /*
- @@wsrep_causal_reads is now being handled via wsrep_sync_wait, update it
- appropriately.
- */
- if (variables.wsrep_causal_reads)
- variables.wsrep_sync_wait|= WSREP_SYNC_WAIT_BEFORE_READ;
-
#endif
+
if (variables.sql_log_bin)
variables.option_bits|= OPTION_BIN_LOG;
else
@@ -1958,14 +1950,12 @@ bool THD::notify_shared_lock(MDL_context_owner *ctx_in_use,
if (!thd_table->needs_reopen())
{
signalled|= mysql_lock_abort_for_thread(this, thd_table);
-#if WITH_WSREP
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);
}
-#endif /* WITH_WSREP */
}
}
mysql_mutex_unlock(&in_use->LOCK_thd_data);
@@ -4328,8 +4318,7 @@ extern "C" int thd_non_transactional_update(const MYSQL_THD thd)
extern "C" int thd_binlog_format(const MYSQL_THD thd)
{
- if (IF_WSREP(((WSREP(thd) && wsrep_emulate_bin_log) || mysql_bin_log.is_open()),
- mysql_bin_log.is_open()) &&
+ if (((WSREP(thd) && wsrep_emulate_bin_log) || mysql_bin_log.is_open()) &&
thd->variables.option_bits & OPTION_BIN_LOG)
return (int) WSREP_FORMAT(thd->variables.binlog_format);
else
@@ -5671,8 +5660,7 @@ int THD::binlog_write_row(TABLE* table, bool is_trans,
{
DBUG_ASSERT(is_current_stmt_binlog_format_row() &&
- IF_WSREP(((WSREP(this) && wsrep_emulate_bin_log) || mysql_bin_log.is_open()),
- mysql_bin_log.is_open()));
+ ((WSREP(this) && wsrep_emulate_bin_log) || mysql_bin_log.is_open()));
/*
Pack records into format for transfer. We are allocating more
memory than needed, but that doesn't matter.
@@ -5706,8 +5694,7 @@ int THD::binlog_update_row(TABLE* table, bool is_trans,
const uchar *after_record)
{
DBUG_ASSERT(is_current_stmt_binlog_format_row() &&
- IF_WSREP(((WSREP(this) && wsrep_emulate_bin_log) || mysql_bin_log.is_open()),
- mysql_bin_log.is_open()));
+ ((WSREP(this) && wsrep_emulate_bin_log) || mysql_bin_log.is_open()));
size_t const before_maxlen = max_row_length(table, before_record);
size_t const after_maxlen = max_row_length(table, after_record);
@@ -5757,8 +5744,7 @@ int THD::binlog_delete_row(TABLE* table, bool is_trans,
uchar const *record)
{
DBUG_ASSERT(is_current_stmt_binlog_format_row() &&
- IF_WSREP(((WSREP(this) && wsrep_emulate_bin_log) || mysql_bin_log.is_open()),
- mysql_bin_log.is_open()));
+ ((WSREP(this) && wsrep_emulate_bin_log) || mysql_bin_log.is_open()));
/*
Pack records into format for transfer. We are allocating more
@@ -5793,8 +5779,7 @@ int THD::binlog_remove_pending_rows_event(bool clear_maps,
{
DBUG_ENTER("THD::binlog_remove_pending_rows_event");
- if(IF_WSREP(!(WSREP_EMULATE_BINLOG(this) || mysql_bin_log.is_open()),
- !mysql_bin_log.is_open()))
+ if(!WSREP_EMULATE_BINLOG(this) && !mysql_bin_log.is_open())
DBUG_RETURN(0);
/* Ensure that all events in a GTID group are in the same cache */
@@ -5817,8 +5802,7 @@ 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(IF_WSREP(!(WSREP_EMULATE_BINLOG(this) || mysql_bin_log.is_open()),
- !mysql_bin_log.is_open()))
+ if(!WSREP_EMULATE_BINLOG(this) && !mysql_bin_log.is_open())
DBUG_RETURN(0);
/* Ensure that all events in a GTID group are in the same cache */
@@ -6072,8 +6056,7 @@ int THD::binlog_query(THD::enum_binlog_query_type qtype, char const *query_arg,
show_query_type(qtype), (int) query_len, query_arg));
DBUG_ASSERT(query_arg &&
- IF_WSREP((WSREP_EMULATE_BINLOG(this) || mysql_bin_log.is_open()),
- mysql_bin_log.is_open()));
+ (WSREP_EMULATE_BINLOG(this) || mysql_bin_log.is_open()));
/* If this is withing a BEGIN ... COMMIT group, don't log it */
if (variables.option_bits & OPTION_GTID_BEGIN)
diff --git a/sql/sql_class.h b/sql/sql_class.h
index 1154f0ac486..ed447d9fc8f 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -2084,7 +2084,7 @@ 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 (WSREP_FORMAT((ulong)current_stmt_binlog_format) == BINLOG_FORMAT_ROW);
+ return WSREP_FORMAT(current_stmt_binlog_format) == BINLOG_FORMAT_ROW;
}
enum binlog_filter_state
@@ -2807,7 +2807,7 @@ public:
/* Debug Sync facility. See debug_sync.cc. */
struct st_debug_sync_control *debug_sync_control;
#endif /* defined(ENABLED_DEBUG_SYNC) */
- THD(bool is_applier= false);
+ THD(bool is_wsrep_applier= false);
~THD();
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc
index 5eb4c405c4b..418c1db9b21 100644
--- a/sql/sql_delete.cc
+++ b/sql/sql_delete.cc
@@ -646,8 +646,7 @@ cleanup:
/* See similar binlogging code in sql_update.cc, for comments */
if ((error < 0) || thd->transaction.stmt.modified_non_trans_table)
{
- if(IF_WSREP((WSREP_EMULATE_BINLOG(thd) || mysql_bin_log.is_open()),
- mysql_bin_log.is_open()))
+ if (WSREP_EMULATE_BINLOG(thd) || mysql_bin_log.is_open())
{
int errcode= 0;
if (error < 0)
@@ -1114,8 +1113,7 @@ void multi_delete::abort_result_set()
/*
there is only side effects; to binlog with the error
*/
- if (IF_WSREP((WSREP_EMULATE_BINLOG(thd) || mysql_bin_log.is_open()),
- mysql_bin_log.is_open()))
+ if (WSREP_EMULATE_BINLOG(thd) || mysql_bin_log.is_open())
{
int errcode= query_error_code(thd, thd->killed == NOT_KILLED);
/* possible error of writing binary log is ignored deliberately */
@@ -1291,8 +1289,7 @@ bool multi_delete::send_eof()
}
if ((local_error == 0) || thd->transaction.stmt.modified_non_trans_table)
{
- if(IF_WSREP((WSREP_EMULATE_BINLOG(thd) || mysql_bin_log.is_open()),
- mysql_bin_log.is_open()))
+ if(WSREP_EMULATE_BINLOG(thd) || mysql_bin_log.is_open())
{
int errcode= 0;
if (local_error == 0)
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index f90e9cd2439..8b01acb2a87 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -1014,8 +1014,7 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
thd->transaction.stmt.modified_non_trans_table ||
was_insert_delayed)
{
- if(IF_WSREP((WSREP_EMULATE_BINLOG(thd) || mysql_bin_log.is_open()),
- mysql_bin_log.is_open()))
+ if(WSREP_EMULATE_BINLOG(thd) || mysql_bin_log.is_open())
{
int errcode= 0;
if (error <= 0)
@@ -3197,12 +3196,10 @@ bool Delayed_insert::handle_inserts(void)
}
}
-#ifdef WITH_WSREP
if (WSREP((&thd)))
thd_proc_info(&thd, "insert done");
else
-#endif /* WITH_WSREP */
- thd_proc_info(&thd, 0);
+ thd_proc_info(&thd, 0);
mysql_mutex_unlock(&mutex);
/*
@@ -3687,9 +3684,8 @@ bool select_insert::send_eof()
events are in the transaction cache and will be written when
ha_autocommit_or_rollback() is issued below.
*/
- if(IF_WSREP((WSREP_EMULATE_BINLOG(thd) || mysql_bin_log.is_open()),
- mysql_bin_log.is_open()) &&
- (!error || thd->transaction.stmt.modified_non_trans_table))
+ if ((WSREP_EMULATE_BINLOG(thd) || mysql_bin_log.is_open()) &&
+ (!error || thd->transaction.stmt.modified_non_trans_table))
{
int errcode= 0;
if (!error)
@@ -3773,8 +3769,7 @@ void select_insert::abort_result_set() {
if (!can_rollback_data())
thd->transaction.all.modified_non_trans_table= TRUE;
- if(IF_WSREP((WSREP_EMULATE_BINLOG(thd) || mysql_bin_log.is_open()),
- mysql_bin_log.is_open()))
+ if(WSREP_EMULATE_BINLOG(thd) || mysql_bin_log.is_open())
{
int errcode= query_error_code(thd, thd->killed == NOT_KILLED);
/* error of writing binary log is ignored */
@@ -4182,8 +4177,7 @@ select_create::binlog_show_create_table(TABLE **tables, uint count)
create_info->table_was_deleted);
DBUG_ASSERT(result == 0); /* store_create_info() always return 0 */
- if(IF_WSREP((WSREP_EMULATE_BINLOG(thd) || mysql_bin_log.is_open()),
- mysql_bin_log.is_open()))
+ if (WSREP_EMULATE_BINLOG(thd) || mysql_bin_log.is_open())
{
int errcode= query_error_code(thd, thd->killed == NOT_KILLED);
result= thd->binlog_query(THD::STMT_QUERY_TYPE,
@@ -4194,7 +4188,7 @@ select_create::binlog_show_create_table(TABLE **tables, uint count)
errcode);
}
- IF_WSREP(ha_fake_trx_id(thd), );
+ ha_fake_trx_id(thd);
return result;
}
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 4d6becff599..cdafeccd392 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -106,10 +106,8 @@
#include "wsrep_mysqld.h"
#include "wsrep_thd.h"
-#ifdef WITH_WSREP
static void wsrep_mysql_parse(THD *thd, char *rawbuf, uint length,
Parser_state *parser_state);
-#endif /* WITH_WSREP */
/**
@defgroup Runtime_Environment Runtime Environment
@@ -875,6 +873,22 @@ void cleanup_items(Item *item)
DBUG_VOID_RETURN;
}
+
+#ifdef WITH_WSREP
+static bool wsrep_node_is_ready(THD *thd)
+{
+ if (thd->variables.wsrep_on && !thd->wsrep_applier && !wsrep_ready)
+ {
+ my_message(ER_UNKNOWN_COM_ERROR,
+ "WSREP has not yet prepared node for application use",
+ MYF(0));
+ return false;
+ }
+ return true;
+}
+#endif
+
+
#ifndef EMBEDDED_LIBRARY
/**
@@ -1055,15 +1069,13 @@ 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 &&
+ if (command != COM_QUERY &&
command != COM_PING &&
command != COM_QUIT &&
command != COM_PROCESS_INFO &&
@@ -1073,17 +1085,14 @@ bool do_command(THD *thd)
command != COM_SLEEP &&
command != COM_STATISTICS &&
command != COM_TIME &&
- command != COM_END
- ) {
- my_message(ER_UNKNOWN_COM_ERROR,
- "WSREP has not yet prepared node for application use",
- MYF(0));
+ command != COM_END &&
+ !wsrep_node_is_ready(thd))
+ {
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);
@@ -1143,7 +1152,7 @@ out:
@retval FALSE The statement isn't updating any relevant tables.
*/
-my_bool deny_updates_if_read_only_option(THD *thd,
+static my_bool deny_updates_if_read_only_option(THD *thd,
TABLE_LIST *all_tables)
{
DBUG_ENTER("deny_updates_if_read_only_option");
@@ -1224,9 +1233,12 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
{
NET *net= &thd->net;
bool error= 0;
+ bool do_end_of_statement= true;
DBUG_ENTER("dispatch_command");
DBUG_PRINT("info", ("command: %d", command));
+ inc_thread_running();
+
#ifdef WITH_WSREP
if (WSREP(thd))
{
@@ -1254,11 +1266,6 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
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);
@@ -1302,7 +1309,6 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
*/
thd->set_query_id(get_query_id());
}
- inc_thread_running();
if (!(server_command_flags[command] & CF_SKIP_QUESTIONS))
statistic_increment(thd->status_var.questions, &LOCK_status);
@@ -1460,11 +1466,9 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
if (parser_state.init(thd, thd->query(), thd->query_length()))
break;
-#ifdef WITH_WSREP
if (WSREP_ON)
wsrep_mysql_parse(thd, thd->query(), thd->query_length(), &parser_state);
else
-#endif /* WITH_WSREP */
mysql_parse(thd, thd->query(), thd->query_length(), &parser_state);
while (!thd->killed && (parser_state.m_lip.found_semicolon != NULL) &&
@@ -1540,17 +1544,15 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
*/
statistic_increment(thd->status_var.questions, &LOCK_status);
- if(IF_WSREP(!WSREP(thd), 1))
+ if(!WSREP(thd))
thd->set_time(); /* Reset the query start time. */
parser_state.reset(beginning_of_next_stmt, length);
/* TODO: set thd->lex->sql_command to SQLCOM_END here */
-#ifdef WITH_WSREP
if (WSREP_ON)
wsrep_mysql_parse(thd, beginning_of_next_stmt, length, &parser_state);
else
-#endif /* WITH_WSREP */
mysql_parse(thd, beginning_of_next_stmt, length, &parser_state);
}
@@ -1889,6 +1891,7 @@ 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:
@@ -1896,21 +1899,16 @@ bool dispatch_command(enum enum_server_command command, THD *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);
- }
+ do_end_of_statement= thd->wsrep_conflict_state != REPLAYING &&
+ thd->wsrep_conflict_state != RETRY_AUTOCOMMIT;
+ mysql_mutex_unlock(&thd->LOCK_wsrep_thd);
}
else
+ do_end_of_statement= true;
+
#endif /* WITH_WSREP */
+
+ if (do_end_of_statement)
{
DBUG_ASSERT(thd->derived_tables == NULL &&
(thd->open_tables == NULL ||
@@ -2601,15 +2599,10 @@ mysql_execute_command(THD *thd)
* 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_message(ER_UNKNOWN_COM_ERROR,
- "WSREP has not yet prepared node for application use",
- MYF(0));
+ if (lex->sql_command != SQLCOM_SET_OPTION &&
+ !wsrep_is_show_query(lex->sql_command) &&
+ !wsrep_node_is_ready(thd))
goto error;
- }
}
#endif /* WITH_WSREP */
status_var_increment(thd->status_var.com_stat[lex->sql_command]);
@@ -2652,14 +2645,14 @@ mysql_execute_command(THD *thd)
if (!(thd->variables.option_bits & OPTION_GTID_BEGIN))
{
/* Commit the normal transaction if one is active. */
- if (trans_commit_implicit(thd))
+ bool commit_failed= trans_commit_implicit(thd);
+ /* Release metadata locks acquired in this transaction. */
+ thd->mdl_context.release_transactional_locks();
+ if (commit_failed)
{
- thd->mdl_context.release_transactional_locks();
WSREP_DEBUG("implicit commit failed, MDL released: %lu", thd->thread_id);
goto error;
}
- /* Release metadata locks acquired in this transaction. */
- thd->mdl_context.release_transactional_locks();
}
}
@@ -2715,10 +2708,8 @@ mysql_execute_command(THD *thd)
#endif
case SQLCOM_SHOW_STATUS:
{
-#ifdef WITH_WSREP
if (WSREP_CLIENT(thd) && wsrep_sync_wait(thd))
goto error;
-#endif /* WITH_WSREP */
execute_show_status(thd, all_tables);
break;
}
@@ -2751,11 +2742,6 @@ mysql_execute_command(THD *thd)
}
case SQLCOM_SHOW_STATUS_PROC:
case SQLCOM_SHOW_STATUS_FUNC:
-#ifdef WITH_WSREP
- if (WSREP_CLIENT(thd) && wsrep_sync_wait(thd))
- goto error;
-#endif /* WITH_WSREP */
-
case SQLCOM_SHOW_DATABASES:
case SQLCOM_SHOW_TABLES:
case SQLCOM_SHOW_TRIGGERS:
@@ -2764,27 +2750,19 @@ 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_SHOW_CLIENT_STATS:
case SQLCOM_SHOW_USER_STATS:
case SQLCOM_SHOW_TABLE_STATS:
case SQLCOM_SHOW_INDEX_STATS:
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;
@@ -3271,7 +3249,6 @@ mysql_execute_command(THD *thd)
}
else
{
-#ifdef WITH_WSREP
/* in STATEMENT format, we probably have to replicate also temporary
tables, like mysql replication does
*/
@@ -3280,7 +3257,6 @@ mysql_execute_command(THD *thd)
{
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);
@@ -3466,10 +3442,8 @@ 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:
@@ -3533,10 +3507,8 @@ 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))
@@ -3549,11 +3521,9 @@ end_with_restore_list:
{
ha_rows found= 0, updated= 0;
DBUG_ASSERT(first_table == all_tables && first_table != 0);
-#ifdef WITH_WSREP
if (WSREP_CLIENT(thd) &&
wsrep_sync_wait(thd, WSREP_SYNC_WAIT_BEFORE_UPDATE_DELETE))
goto error;
-#endif /* WITH_WSREP */
if (update_precheck(thd, all_tables))
break;
@@ -3591,11 +3561,9 @@ 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;
}
@@ -3666,11 +3634,9 @@ end_with_restore_list:
}
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())
{
@@ -3710,11 +3676,9 @@ end_with_restore_list:
{
DBUG_ASSERT(first_table == all_tables && first_table != 0);
-#ifdef WITH_WSREP
if (WSREP_CLIENT(thd) &&
wsrep_sync_wait(thd, WSREP_SYNC_WAIT_BEFORE_INSERT_REPLACE))
goto error;
-#endif /* WITH_WSREP */
/*
Since INSERT DELAYED doesn't support temporary tables, we could
@@ -3770,11 +3734,9 @@ end_with_restore_list:
select_result *sel_result;
bool explain= MY_TEST(lex->describe);
DBUG_ASSERT(first_table == all_tables && first_table != 0);
-#ifdef WITH_WSREP
if (WSREP_CLIENT(thd) &&
wsrep_sync_wait(thd, WSREP_SYNC_WAIT_BEFORE_INSERT_REPLACE))
goto error;
-#endif /* WITH_WSREP */
if ((res= insert_precheck(thd, all_tables)))
break;
@@ -3876,11 +3838,9 @@ end_with_restore_list:
{
select_result *sel_result=lex->result;
DBUG_ASSERT(first_table == all_tables && first_table != 0);
-#ifdef WITH_WSREP
if (WSREP_CLIENT(thd) &&
wsrep_sync_wait(thd, WSREP_SYNC_WAIT_BEFORE_UPDATE_DELETE))
goto error;
-#endif /* WITH_WSREP */
if ((res= delete_precheck(thd, all_tables)))
break;
@@ -3938,11 +3898,9 @@ end_with_restore_list:
DBUG_ASSERT(first_table == all_tables && first_table != 0);
TABLE_LIST *aux_tables= thd->lex->auxiliary_table_list.first;
multi_delete *result;
-#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_delete_precheck(thd, all_tables)))
break;
@@ -4013,7 +3971,6 @@ end_with_restore_list:
/* So that DROP TEMPORARY TABLE gets to binlog at commit/rollback */
thd->variables.option_bits|= OPTION_KEEP_LOG;
}
-#ifdef WITH_WSREP
if (WSREP(thd))
{
for (TABLE_LIST *table= all_tables; table; table= table->next_global)
@@ -4027,7 +3984,6 @@ end_with_restore_list:
}
}
}
-#endif /* WITH_WSREP */
/*
If we are a slave, we should add IF EXISTS if the query executed
on the master without an error. This will help a slave to
@@ -4783,13 +4739,13 @@ end_with_restore_list:
bool tx_release= (lex->tx_release == TVL_YES ||
(thd->variables.completion_type == 2 &&
lex->tx_release != TVL_NO));
- if (trans_commit(thd))
+ bool commit_failed= trans_commit(thd);
+ thd->mdl_context.release_transactional_locks();
+ if (commit_failed)
{
- thd->mdl_context.release_transactional_locks();
WSREP_DEBUG("COMMIT failed, MDL released: %lu", thd->thread_id);
goto error;
}
- thd->mdl_context.release_transactional_locks();
/* Begin transaction with the same isolation level. */
if (tx_chain)
{
@@ -4831,14 +4787,14 @@ end_with_restore_list:
bool tx_release= (lex->tx_release == TVL_YES ||
(thd->variables.completion_type == 2 &&
lex->tx_release != TVL_NO));
+ bool rollback_failed= trans_rollback(thd);
+ thd->mdl_context.release_transactional_locks();
- if (trans_rollback(thd))
+ if (rollback_failed)
{
- thd->mdl_context.release_transactional_locks();
WSREP_DEBUG("rollback failed, MDL released: %lu", thd->thread_id);
goto error;
}
- thd->mdl_context.release_transactional_locks();
/* Begin transaction with the same isolation level. */
if (tx_chain)
{
@@ -5376,13 +5332,14 @@ create_sp_error:
my_ok(thd);
break;
case SQLCOM_XA_COMMIT:
- if (trans_xa_commit(thd))
+ {
+ bool commit_failed= trans_xa_commit(thd);
+ thd->mdl_context.release_transactional_locks();
+ if (commit_failed)
{
- thd->mdl_context.release_transactional_locks();
WSREP_DEBUG("XA commit failed, MDL released: %lu", thd->thread_id);
goto error;
}
- thd->mdl_context.release_transactional_locks();
/*
We've just done a commit, reset transaction
isolation level and access mode to the session default.
@@ -5391,14 +5348,16 @@ create_sp_error:
thd->tx_read_only= thd->variables.tx_read_only;
my_ok(thd);
break;
+ }
case SQLCOM_XA_ROLLBACK:
- if (trans_xa_rollback(thd))
+ {
+ bool rollback_failed= trans_xa_rollback(thd);
+ thd->mdl_context.release_transactional_locks();
+ if (rollback_failed)
{
- thd->mdl_context.release_transactional_locks();
WSREP_DEBUG("XA rollback failed, MDL released: %lu", thd->thread_id);
goto error;
}
- thd->mdl_context.release_transactional_locks();
/*
We've just done a rollback, reset transaction
isolation level and access mode to the session default.
@@ -5407,6 +5366,7 @@ create_sp_error:
thd->tx_read_only= thd->variables.tx_read_only;
my_ok(thd);
break;
+ }
case SQLCOM_XA_RECOVER:
res= mysql_xa_recover(thd);
break;
@@ -5744,10 +5704,15 @@ static bool execute_sqlcom_select(THD *thd, TABLE_LIST *all_tables)
status_var_increment(thd->status_var.empty_queries);
else
status_var_add(thd->status_var.rows_sent, thd->get_sent_row_count());
+
#ifdef WITH_WSREP
- if (WSREP_ON && lex->sql_command == SQLCOM_SHOW_STATUS)
- wsrep_free_status(thd);
-#endif /* WITH_WSREP */
+ if (thd->wsrep_status_vars)
+ {
+ wsrep->stats_free (wsrep, thd->wsrep_status_vars);
+ thd->wsrep_status_vars = 0;
+ }
+#endif
+
return res;
}
@@ -6592,19 +6557,13 @@ void THD::reset_for_next_command()
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(thd) && thd->wsrep_exec_mode == LOCAL_STATE &&
+ wsrep_auto_increment_control)
{
- 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;
- }
+ thd->variables.auto_increment_offset=
+ global_system_variables.auto_increment_offset;
+ thd->variables.auto_increment_increment=
+ global_system_variables.auto_increment_increment;
}
#endif /* WITH_WSREP */
thd->query_start_used= 0;
@@ -6810,15 +6769,14 @@ 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)
+ Parser_state *parser_state)
{
+#ifdef WITH_WSREP
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);
+ !thd->wsrep_applier;
do
{
@@ -6911,8 +6869,8 @@ static void wsrep_mysql_parse(THD *thd, char *rawbuf, uint length,
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
@@ -7944,7 +7902,7 @@ kill_one_thread(THD *thd, longlong id, killed_state kill_signal, killed_type typ
if (((thd->security_ctx->master_access & SUPER_ACL) ||
thd->security_ctx->user_matches(tmp->security_ctx)) &&
- IF_WSREP(!wsrep_thd_is_BF((void *)tmp, true), 1))
+ !wsrep_thd_is_BF(tmp, true))
{
tmp->awake(kill_signal);
error=0;
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc
index e0d1cec6a0a..86936700c7d 100644
--- a/sql/sql_prepare.cc
+++ b/sql/sql_prepare.cc
@@ -3659,6 +3659,8 @@ reexecute:
case MUST_REPLAY:
(void)wsrep_replay_transaction(thd);
+ break;
+
default:
break;
}
diff --git a/sql/sql_reload.cc b/sql/sql_reload.cc
index 797c9779994..91d412a0c39 100644
--- a/sql/sql_reload.cc
+++ b/sql/sql_reload.cc
@@ -253,7 +253,6 @@ bool reload_acl_and_cache(THD *thd, unsigned long long options,
}
if (options & REFRESH_CHECKPOINT)
disable_checkpoints(thd);
-#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
@@ -263,7 +262,6 @@ bool reload_acl_and_cache(THD *thd, unsigned long long options,
close_cached_tables(thd, tables, (options & REFRESH_FAST) ?
FALSE : TRUE, TRUE))
result= 1;
-#endif /* WITH_WSREP */
}
else
{
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index b86de2f6cc1..19914f31c97 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -5267,7 +5267,7 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table,
#ifdef WITH_WSREP
if (WSREP_ON && !thd->wsrep_applier &&
wsrep_create_like_table(thd, table, src_table, create_info))
- goto end;
+ DBUG_RETURN(res);
#endif
/*
@@ -5532,7 +5532,6 @@ err:
res= 1;
}
-end:
DBUG_RETURN(res);
}
diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc
index 268fad5d90e..443a82a9df2 100644
--- a/sql/sql_trigger.cc
+++ b/sql/sql_trigger.cc
@@ -434,8 +434,8 @@ 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.
*/
- if (!trust_function_creators &&
- IF_WSREP((WSREP_EMULATE_BINLOG(thd) || mysql_bin_log.is_open()), mysql_bin_log.is_open()) &&
+ if (!trust_function_creators &&
+ (WSREP_EMULATE_BINLOG(thd) || mysql_bin_log.is_open()) &&
!(thd->security_ctx->master_access & SUPER_ACL))
{
my_error(ER_BINLOG_CREATE_ROUTINE_NEED_SUPER, MYF(0));
diff --git a/sql/sql_truncate.cc b/sql/sql_truncate.cc
index 5e23c6ee32b..bac691e35ea 100644
--- a/sql/sql_truncate.cc
+++ b/sql/sql_truncate.cc
@@ -412,12 +412,9 @@ 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))
+ if (WSREP(thd) &&
+ wsrep_to_isolation_begin(thd, table_ref->db, table_ref->table_name, 0))
DBUG_RETURN(TRUE);
-#endif /* WITH_WSREP */
if (lock_table(thd, table_ref, &hton_can_recreate))
DBUG_RETURN(TRUE);
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index c458f01303d..88b6c53b00e 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -976,8 +976,7 @@ int mysql_update(THD *thd,
*/
if ((error < 0) || thd->transaction.stmt.modified_non_trans_table)
{
- if (IF_WSREP((WSREP_EMULATE_BINLOG(thd) || mysql_bin_log.is_open()),
- mysql_bin_log.is_open()))
+ if (WSREP_EMULATE_BINLOG(thd) || mysql_bin_log.is_open())
{
int errcode= 0;
if (error < 0)
@@ -2220,8 +2219,7 @@ 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
*/
- if (IF_WSREP((WSREP_EMULATE_BINLOG(thd) || mysql_bin_log.is_open()),
- mysql_bin_log.is_open()))
+ if (WSREP_EMULATE_BINLOG(thd) || mysql_bin_log.is_open())
{
/*
THD::killed status might not have been set ON at time of an error
@@ -2490,8 +2488,7 @@ bool multi_update::send_eof()
if (local_error == 0 || thd->transaction.stmt.modified_non_trans_table)
{
- if (IF_WSREP((WSREP_EMULATE_BINLOG(thd) || mysql_bin_log.is_open()),
- mysql_bin_log.is_open()))
+ if (WSREP_EMULATE_BINLOG(thd) || mysql_bin_log.is_open())
{
int errcode= 0;
if (local_error == 0)
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index a06d702f620..78a0eff935a 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -7171,9 +7171,7 @@ alter:
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
@@ -7191,9 +7189,7 @@ 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 e40dfbe8675..046f68e574e 100644
--- a/sql/sys_vars.cc
+++ b/sql/sys_vars.cc
@@ -3714,7 +3714,7 @@ static char *glob_hostname_ptr;
static Sys_var_charptr Sys_hostname(
"hostname", "Server host name",
READ_ONLY GLOBAL_VAR(glob_hostname_ptr), NO_CMD_LINE,
- IN_FS_CHARSET, DEFAULT(glob_hostname));
+ IN_SYSTEM_CHARSET, DEFAULT(glob_hostname));
#ifndef EMBEDDED_LIBRARY
static Sys_var_charptr Sys_repl_report_host(
@@ -3727,21 +3727,21 @@ static Sys_var_charptr Sys_repl_report_host(
"NAT and other routing issues, that IP may not be valid for connecting "
"to the slave from the master or other hosts",
READ_ONLY GLOBAL_VAR(report_host), CMD_LINE(REQUIRED_ARG),
- IN_FS_CHARSET, DEFAULT(0));
+ IN_SYSTEM_CHARSET, DEFAULT(0));
static Sys_var_charptr Sys_repl_report_user(
"report_user",
"The account user name of the slave to be reported to the master "
"during slave registration",
READ_ONLY GLOBAL_VAR(report_user), CMD_LINE(REQUIRED_ARG),
- IN_FS_CHARSET, DEFAULT(0));
+ IN_SYSTEM_CHARSET, DEFAULT(0));
static Sys_var_charptr Sys_repl_report_password(
"report_password",
"The account password of the slave to be reported to the master "
"during slave registration",
READ_ONLY GLOBAL_VAR(report_password), CMD_LINE(REQUIRED_ARG),
- IN_FS_CHARSET, DEFAULT(0));
+ IN_SYSTEM_CHARSET, DEFAULT(0));
static Sys_var_uint Sys_repl_report_port(
"report_port",
@@ -4439,7 +4439,7 @@ static Sys_var_tz Sys_time_zone(
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),
+ PREALLOCATED GLOBAL_VAR(wsrep_provider), CMD_LINE(REQUIRED_ARG),
IN_FS_CHARSET, DEFAULT(WSREP_NONE),
NO_MUTEX_GUARD, NOT_IN_BINLOG,
ON_CHECK(wsrep_provider_check), ON_UPDATE(wsrep_provider_update));
@@ -4447,8 +4447,8 @@ static Sys_var_charptr Sys_wsrep_provider(
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(""), NO_MUTEX_GUARD, NOT_IN_BINLOG,
+ CMD_LINE(REQUIRED_ARG),
+ IN_SYSTEM_CHARSET, DEFAULT(""), NO_MUTEX_GUARD, NOT_IN_BINLOG,
ON_CHECK(wsrep_provider_options_check),
ON_UPDATE(wsrep_provider_options_update));
@@ -4460,7 +4460,7 @@ static Sys_var_charptr Sys_wsrep_data_home_dir(
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),
+ IN_SYSTEM_CHARSET, DEFAULT(WSREP_CLUSTER_NAME),
NO_MUTEX_GUARD, NOT_IN_BINLOG,
ON_CHECK(wsrep_cluster_name_check),
ON_UPDATE(wsrep_cluster_name_update));
@@ -4469,8 +4469,8 @@ 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(""),
+ CMD_LINE(REQUIRED_ARG),
+ IN_SYSTEM_CHARSET, DEFAULT(""),
&PLock_wsrep_slave_threads, NOT_IN_BINLOG,
ON_CHECK(wsrep_cluster_address_check),
ON_UPDATE(wsrep_cluster_address_update));
@@ -4478,13 +4478,13 @@ static Sys_var_charptr Sys_wsrep_cluster_address (
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(""), NO_MUTEX_GUARD, NOT_IN_BINLOG,
+ IN_SYSTEM_CHARSET, DEFAULT(""), NO_MUTEX_GUARD, NOT_IN_BINLOG,
wsrep_node_name_check, wsrep_node_name_update);
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(""),
+ IN_SYSTEM_CHARSET, DEFAULT(""),
NO_MUTEX_GUARD, NOT_IN_BINLOG,
ON_CHECK(wsrep_node_address_check),
ON_UPDATE(wsrep_node_address_update));
@@ -4492,7 +4492,7 @@ static Sys_var_charptr Sys_wsrep_node_address (
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_AUTO));
+ IN_SYSTEM_CHARSET, DEFAULT(WSREP_NODE_INCOMING_AUTO));
static Sys_var_ulong Sys_wsrep_slave_threads(
"wsrep_slave_threads", "Number of slave appliers to launch",
@@ -4505,7 +4505,7 @@ static Sys_var_ulong Sys_wsrep_slave_threads(
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(""));
+ IN_SYSTEM_CHARSET, DEFAULT(""));
static Sys_var_mybool Sys_wsrep_debug(
"wsrep_debug", "To enable debug level logging",
@@ -4538,7 +4538,7 @@ static Sys_var_mybool Sys_wsrep_drupal_282555_workaround(
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_DEFAULT), NO_MUTEX_GUARD, NOT_IN_BINLOG,
+ IN_SYSTEM_CHARSET, DEFAULT(WSREP_SST_DEFAULT), NO_MUTEX_GUARD, NOT_IN_BINLOG,
ON_CHECK(wsrep_sst_method_check),
ON_UPDATE(wsrep_sst_method_update));
@@ -4546,7 +4546,7 @@ 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_ADDRESS_AUTO), NO_MUTEX_GUARD,
+ IN_SYSTEM_CHARSET, DEFAULT(WSREP_SST_ADDRESS_AUTO), NO_MUTEX_GUARD,
NOT_IN_BINLOG,
ON_CHECK(wsrep_sst_receive_address_check),
ON_UPDATE(wsrep_sst_receive_address_update));
@@ -4554,7 +4554,7 @@ static Sys_var_charptr Sys_wsrep_sst_receive_address(
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(NULL), NO_MUTEX_GUARD,
+ IN_SYSTEM_CHARSET, DEFAULT(NULL), NO_MUTEX_GUARD,
NOT_IN_BINLOG,
ON_CHECK(wsrep_sst_auth_check),
ON_UPDATE(wsrep_sst_auth_update));
@@ -4562,7 +4562,7 @@ static Sys_var_charptr Sys_wsrep_sst_auth(
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,
+ IN_SYSTEM_CHARSET, DEFAULT(""), NO_MUTEX_GUARD, NOT_IN_BINLOG,
ON_CHECK(wsrep_sst_donor_check),
ON_UPDATE(wsrep_sst_donor_update));
@@ -4583,7 +4583,7 @@ 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_ZERO),
+ IN_SYSTEM_CHARSET, DEFAULT(WSREP_START_POSITION_ZERO),
NO_MUTEX_GUARD, NOT_IN_BINLOG,
ON_CHECK(wsrep_start_position_check),
ON_UPDATE(wsrep_start_position_update));
@@ -4602,19 +4602,27 @@ static Sys_var_ulong Sys_wsrep_max_ws_rows (
static Sys_var_charptr Sys_wsrep_notify_cmd(
"wsrep_notify_cmd", "",
GLOBAL_VAR(wsrep_notify_cmd),CMD_LINE(REQUIRED_ARG),
- IN_FS_CHARSET, DEFAULT(""));
+ IN_SYSTEM_CHARSET, DEFAULT(""));
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 bool fix_wsrep_causal_reads(sys_var *self, THD* thd, enum_var_type var_type)
+{
+ if (var_type == OPT_GLOBAL)
+ wsrep_causal_reads_update(&global_system_variables);
+ else
+ wsrep_causal_reads_update(&thd->variables);
+ return false;
+}
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));
+ ON_UPDATE(fix_wsrep_causal_reads));
static Sys_var_uint Sys_wsrep_sync_wait(
"wsrep_sync_wait", "Ensure \"synchronous\" read view before executing "
@@ -4642,16 +4650,17 @@ static Sys_var_mybool Sys_wsrep_desync (
ON_CHECK(wsrep_desync_check),
ON_UPDATE(wsrep_desync_update));
+static const char *wsrep_binlog_format_names[]=
+ {"MIXED", "STATEMENT", "ROW", "NONE", NullS};
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),
+ GLOBAL_VAR(wsrep_forced_binlog_format), CMD_LINE(REQUIRED_ARG),
wsrep_binlog_format_names, DEFAULT(BINLOG_FORMAT_UNSPEC));
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));
+ CMD_LINE(OPT_ARG), DEFAULT(FALSE));
static Sys_var_mybool Sys_wsrep_replicate_myisam(
"wsrep_replicate_myisam", "To enable myisam replication",
diff --git a/sql/table.cc b/sql/table.cc
index 735dbf6eedd..d720a16f6e5 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -40,7 +40,6 @@
#include "sql_statistics.h"
#include "discover.h"
#include "mdl.h" // MDL_wait_for_graph_visitor
-#include "ha_partition.h"
/* INFORMATION_SCHEMA name */
LEX_STRING INFORMATION_SCHEMA_NAME= {C_STRING_WITH_LEN("information_schema")};
diff --git a/sql/transaction.cc b/sql/transaction.cc
index 9b3507de2eb..223d507a799 100644
--- a/sql/transaction.cc
+++ b/sql/transaction.cc
@@ -97,10 +97,8 @@ static bool xa_trans_force_rollback(THD *thd)
by ha_rollback()/THD::transaction::cleanup().
*/
thd->transaction.xid_state.rm_error= 0;
-#ifdef WITH_WSREP
if (WSREP_ON)
wsrep_register_hton(thd, TRUE);
-#endif /* WITH_WSREP */
if (ha_rollback_trans(thd, true))
{
my_error(ER_XAER_RMERR, MYF(0));
@@ -139,18 +137,14 @@ bool trans_begin(THD *thd, uint flags)
(thd->variables.option_bits & OPTION_TABLE_LOCK))
{
thd->variables.option_bits&= ~OPTION_TABLE_LOCK;
-#ifdef WITH_WSREP
if (WSREP_ON)
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
if (WSREP_ON)
wsrep_post_commit(thd, TRUE);
-#endif /* WITH_WSREP */
}
thd->variables.option_bits&= ~(OPTION_BEGIN | OPTION_KEEP_LOG);
@@ -230,18 +224,14 @@ bool trans_commit(THD *thd)
if (trans_check(thd))
DBUG_RETURN(TRUE);
-#ifdef WITH_WSREP
if (WSREP_ON)
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);
-#ifdef WITH_WSREP
if (WSREP_ON)
wsrep_post_commit(thd, TRUE);
-#endif /* WITH_WSREP */
/*
if res is non-zero, then ha_commit_trans has rolled back the
transaction, so the hooks for rollback will be called.
@@ -287,18 +277,14 @@ 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;
-#ifdef WITH_WSREP
if (WSREP_ON)
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
if (WSREP_ON)
wsrep_post_commit(thd, TRUE);
-#endif /* WITH_WSREP */
}
thd->variables.option_bits&= ~(OPTION_BEGIN | OPTION_KEEP_LOG);
@@ -337,10 +323,8 @@ bool trans_rollback(THD *thd)
if (trans_check(thd))
DBUG_RETURN(TRUE);
-#ifdef WITH_WSREP
if (WSREP_ON)
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,19 +415,15 @@ bool trans_commit_stmt(THD *thd)
if (thd->transaction.stmt.ha_list)
{
-#ifdef WITH_WSREP
if (WSREP_ON)
wsrep_register_hton(thd, FALSE);
-#endif /* WITH_WSREP */
res= ha_commit_trans(thd, FALSE);
if (! thd->in_active_multi_stmt_transaction())
{
thd->tx_isolation= (enum_tx_isolation) thd->variables.tx_isolation;
thd->tx_read_only= thd->variables.tx_read_only;
-#ifdef WITH_WSREP
if (WSREP_ON)
wsrep_post_commit(thd, FALSE);
-#endif /* WITH_WSREP */
}
}
@@ -484,10 +464,8 @@ bool trans_rollback_stmt(THD *thd)
if (thd->transaction.stmt.ha_list)
{
-#ifdef WITH_WSREP
if (WSREP_ON)
wsrep_register_hton(thd, FALSE);
-#endif /* WITH_WSREP */
ha_rollback_trans(thd, FALSE);
if (! thd->in_active_multi_stmt_transaction())
{
@@ -865,17 +843,13 @@ bool trans_xa_commit(THD *thd)
}
else if (xa_state == XA_IDLE && thd->lex->xa_opt == XA_ONE_PHASE)
{
-#ifdef WITH_WSREP
if (WSREP_ON)
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
if (WSREP_ON)
wsrep_post_commit(thd, TRUE);
-#endif /* WITH_WSREP */
}
else if (xa_state == XA_PREPARED && thd->lex->xa_opt == XA_NONE)
{
@@ -894,10 +868,8 @@ bool trans_xa_commit(THD *thd)
if (thd->mdl_context.acquire_lock(&mdl_request,
thd->variables.lock_wait_timeout))
{
-#ifdef WITH_WSREP
if (WSREP_ON)
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_mysqld.cc b/sql/wsrep_mysqld.cc
index c74bb528ebd..f47310ba49f 100644
--- a/sql/wsrep_mysqld.cc
+++ b/sql/wsrep_mysqld.cc
@@ -47,9 +47,6 @@ my_bool wsrep_preordered_opt= FALSE;
* Begin configuration options and their default values
*/
-extern int wsrep_replaying;
-extern ulong wsrep_running_threads;
-extern ulong my_bind_addr;
extern my_bool plugins_are_initialized;
extern uint kill_cached_threads;
extern mysql_cond_t COND_thread_cache;
@@ -91,6 +88,63 @@ my_bool wsrep_slave_FK_checks = 0; // slave thread does FK checks
/*
* Other wsrep global variables.
*/
+
+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;
+ulong wsrep_running_threads = 0; // # of currently running wsrep threads
+ulong my_bind_addr;
+
+#ifdef HAVE_PSI_INTERFACE
+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;
+
+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;
+
+static PSI_mutex_info wsrep_mutexes[]=
+{
+ { &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}
+};
+
+static PSI_cond_info wsrep_conds[]=
+{
+ { &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}
+};
+#else
+#define mysql_mutex_register(X,Y,Z)
+#define mysql_cond_register(X,Y,Z)
+#endif
+
my_bool wsrep_inited = 0; // initialized ?
static const wsrep_uuid_t cluster_uuid = WSREP_UUID_UNDEFINED;
@@ -517,6 +571,24 @@ int wsrep_init()
int rcode= -1;
DBUG_ASSERT(wsrep_inited == 0);
+ wsrep_causal_reads_update(&global_system_variables);
+
+ mysql_mutex_register("sql", wsrep_mutexes, array_elements(wsrep_mutexes));
+ mysql_cond_register("sql", wsrep_conds, array_elements(wsrep_conds));
+
+ 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);
+
wsrep_ready_set(FALSE);
assert(wsrep_provider);
@@ -747,6 +819,19 @@ void wsrep_deinit(bool free_options)
{
wsrep_sst_auth_free();
}
+
+ mysql_mutex_destroy(&LOCK_wsrep_ready);
+ mysql_cond_destroy(&COND_wsrep_ready);
+ mysql_mutex_destroy(&LOCK_wsrep_sst);
+ mysql_cond_destroy(&COND_wsrep_sst);
+ mysql_mutex_destroy(&LOCK_wsrep_sst_init);
+ mysql_cond_destroy(&COND_wsrep_sst_init);
+ mysql_mutex_destroy(&LOCK_wsrep_rollback);
+ mysql_cond_destroy(&COND_wsrep_rollback);
+ mysql_mutex_destroy(&LOCK_wsrep_replaying);
+ mysql_cond_destroy(&COND_wsrep_replaying);
+ mysql_mutex_destroy(&LOCK_wsrep_slave_threads);
+ mysql_mutex_destroy(&LOCK_wsrep_desync);
}
void wsrep_recover()
@@ -2007,7 +2092,7 @@ int wsrep_create_sp(THD *thd, uchar** buf, size_t* buf_len)
sp_returns_type(thd, retstr, sp);
}
- if (!create_string(thd, &log_query,
+ if (!show_create_sp(thd, &log_query,
sp->m_type,
(sp->m_explicit_name ? sp->m_db.str : NULL),
(sp->m_explicit_name ? sp->m_db.length : 0),
@@ -2238,23 +2323,6 @@ wsrep_trx_is_aborting(void *thd_ptr)
}
-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;
-}
-
-
void wsrep_copy_query(THD *thd)
{
thd->wsrep_retry_command = thd->get_command();
diff --git a/sql/wsrep_mysqld.h b/sql/wsrep_mysqld.h
index 2150ac85bf0..c81ed794659 100644
--- a/sql/wsrep_mysqld.h
+++ b/sql/wsrep_mysqld.h
@@ -15,9 +15,11 @@
#include <wsrep.h>
-#if !defined(WSREP_MYSQLD_H) && defined(WITH_WSREP)
+#ifndef WSREP_MYSQLD_H
#define WSREP_MYSQLD_H
+#ifdef WITH_WSREP
+
typedef struct st_mysql_show_var SHOW_VAR;
#include <sql_priv.h>
//#include "rpl_gtid.h"
@@ -138,7 +140,6 @@ 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() */
@@ -219,11 +220,11 @@ extern wsrep_seqno_t wsrep_locked_seqno;
// 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, ...) \
- { \
+ do { \
char msg[1024] = {'\0'}; \
snprintf(msg, sizeof(msg) - 1, ## __VA_ARGS__); \
fun("WSREP: %s", msg); \
- }
+ } while(0)
#define WSREP_LOG_CONFLICT_THD(thd, role) \
WSREP_LOG(sql_print_information, \
@@ -298,6 +299,8 @@ extern my_bool wsrep_preordered_opt;
extern handlerton *wsrep_hton;
#ifdef HAVE_PSI_INTERFACE
+extern PSI_mutex_key key_LOCK_wsrep_thd;
+extern PSI_cond_key key_COND_wsrep_thd;
extern PSI_mutex_key key_LOCK_wsrep_ready;
extern PSI_mutex_key key_COND_wsrep_ready;
extern PSI_mutex_key key_LOCK_wsrep_sst;
@@ -356,7 +359,6 @@ void wsrep_wait_appliers_close(THD *thd);
void wsrep_kill_mysql(THD *thd);
void wsrep_close_threads(THD *thd);
int wsrep_create_sp(THD *thd, uchar** buf, size_t* buf_len);
-my_bool wsrep_read_only_option(THD *thd, TABLE_LIST *all_tables);
void wsrep_copy_query(THD *thd);
bool wsrep_is_show_query(enum enum_sql_command command);
void wsrep_replay_transaction(THD *thd);
@@ -365,6 +367,32 @@ bool wsrep_create_like_table(THD* thd, TABLE_LIST* table,
HA_CREATE_INFO *create_info);
int wsrep_create_trigger_query(THD *thd, uchar** buf, size_t* buf_len);
-extern my_bool deny_updates_if_read_only_option(THD *thd,
- TABLE_LIST *all_tables);
+#else /* WITH_WSREP */
+
+#define WSREP(T) (0)
+#define WSREP_ON (0)
+#define WSREP_EMULATE_BINLOG(thd) (0)
+#define WSREP_CLIENT(thd) (0)
+#define wsrep_emulate_bin_log (0)
+#define wsrep_xid_seqno(X) (0)
+#define wsrep_is_wsrep_xid(X) (0)
+#define wsrep_to_isolation (0)
+#define wsrep_recovery (0)
+#define wsrep_init() (1)
+#define wsrep_prepend_PATH(X)
+#define wsrep_before_SE() (0)
+#define wsrep_init_startup(X)
+#define wsrep_sync_wait(...) (0)
+#define wsrep_to_isolation_begin(...) (0)
+#define wsrep_register_hton(...) do { } while(0)
+#define wsrep_post_commit(...) do { } while(0)
+#define wsrep_check_opts() (0)
+#define wsrep_stop_replication(X) do { } while(0)
+#define wsrep_inited (0)
+#define wsrep_deinit(X) do { } while(0)
+#define wsrep_filter_new_cluster(X,Y) do { } while(0)
+#define wsrep_recover() do { } while(0)
+#define wsrep_slave_threads (1)
+
+#endif /* WITH_WSREP */
#endif /* WSREP_MYSQLD_H */
diff --git a/sql/wsrep_sst.h b/sql/wsrep_sst.h
index d85fed97fca..be1dfcfa582 100644
--- a/sql/wsrep_sst.h
+++ b/sql/wsrep_sst.h
@@ -13,9 +13,13 @@
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
-#if !defined(WSREP_SST_H) && defined(WITH_WSREP)
+#include <my_config.h>
+
+#ifndef WSREP_SST_H
#define WSREP_SST_H
+#ifdef WITH_WSREP
+
#include <mysql.h> // my_bool
#define WSREP_SST_OPT_ROLE "--role"
@@ -65,4 +69,11 @@ 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 */
+#else
+#define wsrep_SE_initialized() do { } while(0)
+#define wsrep_SE_init_grab() do { } while(0)
+#define wsrep_SE_init_done() do { } while(0)
+#define wsrep_sst_continue() do { } while(0)
+
+#endif /* WITH_WSREP */
#endif /* WSREP_SST_H */
diff --git a/sql/wsrep_thd.h b/sql/wsrep_thd.h
index c5a497bb428..cc3a7c7b9d1 100644
--- a/sql/wsrep_thd.h
+++ b/sql/wsrep_thd.h
@@ -13,9 +13,13 @@
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
-#if !defined(WSREP_THD_H) && defined(WITH_WSREP)
+#include <my_config.h>
+
+#ifndef WSREP_THD_H
#define WSREP_THD_H
+#ifdef WITH_WSREP
+
#include "sql_class.h"
int wsrep_show_bf_aborts (THD *thd, SHOW_VAR *var, char *buff);
@@ -37,4 +41,11 @@ 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);
extern "C" int wsrep_thd_in_locking_session(void *thd_ptr);
+#else /* WITH_WSREP */
+
+#define wsrep_thd_is_BF(T, S) (0)
+#define wsrep_abort_thd(X,Y,Z) do { } while(0)
+#define wsrep_create_appliers(T) (0)
+
+#endif
#endif /* WSREP_THD_H */
diff --git a/sql/wsrep_var.cc b/sql/wsrep_var.cc
index 2272945535d..3f4b163281b 100644
--- a/sql/wsrep_var.cc
+++ b/sql/wsrep_var.cc
@@ -60,28 +60,24 @@ bool wsrep_on_update (sys_var *self, THD* thd, enum_var_type var_type)
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;
+bool wsrep_causal_reads_update (SV *sv)
+{
+ if (sv->wsrep_causal_reads) {
+ sv->wsrep_sync_wait |= WSREP_SYNC_WAIT_BEFORE_READ;
} else {
- thd->variables.wsrep_sync_wait &= ~WSREP_SYNC_WAIT_BEFORE_READ;
+ sv->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;
+ if (var_type == OPT_GLOBAL)
+ global_system_variables.wsrep_causal_reads =
+ MY_TEST(global_system_variables.wsrep_sync_wait & WSREP_SYNC_WAIT_BEFORE_READ);
+ else
+ thd->variables.wsrep_causal_reads =
+ MY_TEST(thd->variables.wsrep_sync_wait & WSREP_SYNC_WAIT_BEFORE_READ);
return false;
}
@@ -589,14 +585,21 @@ 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;
+#if 0
+ {"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_SIMPLE_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_thread_count", (char*) &wsrep_running_threads, SHOW_LONG_NOFLUSH},
+ {"wsrep", (char*) &wsrep_show_status, SHOW_FUNC},
+#endif
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
index 58d0374baa5..654b76be617 100644
--- a/sql/wsrep_var.h
+++ b/sql/wsrep_var.h
@@ -13,9 +13,13 @@
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
-#if !defined (WSREP_VAR_H) && defined(WITH_WSREP)
+#include <my_config.h>
+
+#ifndef WSREP_VAR_H
#define WSREP_VAR_H
+#ifdef WITH_WSREP
+
#define WSREP_CLUSTER_NAME "my_wsrep_cluster"
#define WSREP_NODE_INCOMING_AUTO "AUTO"
#define WSREP_START_POSITION_ZERO "00000000-0000-0000-0000-000000000000:-1"
@@ -34,8 +38,10 @@ int wsrep_init_vars();
#define DEFAULT_ARGS (THD* thd, enum_var_type var_type)
#define INIT_ARGS (const char* opt)
+struct system_variables;
+bool wsrep_causal_reads_update(struct system_variables *sv);
+
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;
@@ -83,4 +89,13 @@ extern bool wsrep_slave_threads_update UPDATE_ARGS;
extern bool wsrep_desync_check CHECK_ARGS;
extern bool wsrep_desync_update UPDATE_ARGS;
+#else /* WITH_WSREP */
+
+#define WSREP_NONE
+#define wsrep_provider_init(X)
+#define wsrep_init_vars() (1)
+#define wsrep_start_position_init(X)
+#define wsrep_sst_auth_init(X)
+
+#endif /* WITH_WSREP */
#endif /* WSREP_VAR_H */
diff --git a/storage/innobase/wsrep/md5.cc b/storage/innobase/wsrep/md5.cc
index 30be6ab7dd3..d3d83c65301 100644
--- a/storage/innobase/wsrep/md5.cc
+++ b/storage/innobase/wsrep/md5.cc
@@ -15,15 +15,16 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#ifdef WITH_WSREP
+#include "my_config.h"
#if defined(HAVE_YASSL)
-#include "my_config.h"
#include "md5.hpp"
#elif defined(HAVE_OPENSSL)
#include <openssl/md5.h>
#endif /* HAVE_YASSL */
+#ifdef WITH_WSREP
+
/* Initialize md5 object. */
void *wsrep_md5_init()
{
diff --git a/storage/perfschema/CMakeLists.txt b/storage/perfschema/CMakeLists.txt
index 870702afb48..b77cae6d018 100644
--- a/storage/perfschema/CMakeLists.txt
+++ b/storage/perfschema/CMakeLists.txt
@@ -13,10 +13,6 @@
# along with this program; if not, write to the Free Software Foundation,
# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
-IF (WITH_WSREP)
- BUILD_WITH_WSREP()
-ENDIF()
-
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}
${CMAKE_SOURCE_DIR}/include
${CMAKE_SOURCE_DIR}/sql
diff --git a/storage/xtradb/wsrep/md5.cc b/storage/xtradb/wsrep/md5.cc
index 30be6ab7dd3..d3d83c65301 100644
--- a/storage/xtradb/wsrep/md5.cc
+++ b/storage/xtradb/wsrep/md5.cc
@@ -15,15 +15,16 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#ifdef WITH_WSREP
+#include "my_config.h"
#if defined(HAVE_YASSL)
-#include "my_config.h"
#include "md5.hpp"
#elif defined(HAVE_OPENSSL)
#include <openssl/md5.h>
#endif /* HAVE_YASSL */
+#ifdef WITH_WSREP
+
/* Initialize md5 object. */
void *wsrep_md5_init()
{
diff --git a/support-files/mysql.server.sh b/support-files/mysql.server.sh
index bdc481d39c2..caeec3f610f 100644
--- a/support-files/mysql.server.sh
+++ b/support-files/mysql.server.sh
@@ -52,7 +52,6 @@ datadir=
# 0 means don't wait at all
# Negative numbers mean to wait indefinitely
service_startup_timeout=900
-startup_sleep=1
# Lock directory for RedHat / SuSE.
lockdir='/var/lock/subsys'
@@ -254,8 +253,6 @@ wait_for_gone () {
wait_for_ready () {
- sst_progress_file=$datadir/sst_in_progress
-
i=0
while test $i -ne $service_startup_timeout ; do
@@ -264,14 +261,9 @@ wait_for_ready () {
return 0
fi
- if test -e $sst_progress_file && [ $startup_sleep -ne 10 ];then
- echo $echo_n "SST in progress, setting sleep intervals to 10 seconds"
- startup_sleep=10
- fi
-
echo $echo_n ".$echo_c"
i=`expr $i + 1`
- sleep $startup_sleep
+ sleep 1
done
diff --git a/wsrep/CMakeLists.txt b/wsrep/CMakeLists.txt
index d9e66739fcc..53c8e853078 100644
--- a/wsrep/CMakeLists.txt
+++ b/wsrep/CMakeLists.txt
@@ -13,9 +13,6 @@
# 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( "." )
-BUILD_WITH_WSREP()
-
SET(WSREP_SOURCES wsrep_gtid.c wsrep_uuid.c wsrep_loader.c wsrep_dummy.c)
ADD_CONVENIENCE_LIBRARY(wsrep ${WSREP_SOURCES})