summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOleksandr Byelkin <sanja@mariadb.com>2020-03-06 23:28:26 +0100
committerOleksandr Byelkin <sanja@mariadb.com>2020-03-06 23:28:26 +0100
commit440452628d95476674922c6c097825509a002d8d (patch)
treec6bceadee16d4286de4d3f37eec43bb250077502
parentf8ab5ca374243977f331cdf6e569386230a7fddb (diff)
parent75d286c2cc46092148f13b6b9026f52a54926a84 (diff)
downloadmariadb-git-440452628d95476674922c6c097825509a002d8d.tar.gz
Merge branch '10.2' into 10.3
-rw-r--r--cmake/os/WindowsCache.cmake1
-rw-r--r--cmake/ssl.cmake1
-rw-r--r--config.h.cmake1
-rw-r--r--configure.cmake1
-rw-r--r--debian/libmariadb-dev.install2
-rw-r--r--mysql-test/main/alter_user.result2
-rw-r--r--mysql-test/main/alter_user.test2
-rw-r--r--mysql-test/main/mdev375.test2
-rw-r--r--mysql-test/main/mysqld--defaults-file.result10
-rw-r--r--mysql-test/main/mysqld--defaults-file.test16
-rw-r--r--mysql-test/suite/galera/disabled.def4
-rw-r--r--mysql-test/suite/galera/r/galera_as_slave_gtid_myisam.result3
-rw-r--r--mysql-test/suite/galera/r/galera_rsu_add_pk.result24
-rw-r--r--mysql-test/suite/galera/r/galera_slave_replay.result95
-rw-r--r--mysql-test/suite/galera/r/galera_var_notify_cmd.result16
-rw-r--r--mysql-test/suite/galera/r/galera_wsrep_new_cluster.result2
-rw-r--r--mysql-test/suite/galera/t/galera_as_slave_gtid_myisam.test1
-rw-r--r--mysql-test/suite/galera/t/galera_rsu_add_pk.test14
-rw-r--r--mysql-test/suite/galera/t/galera_slave_replay.cnf1
-rw-r--r--mysql-test/suite/galera/t/galera_slave_replay.test198
-rw-r--r--mysql-test/suite/galera/t/galera_var_notify_cmd-master.opt1
-rw-r--r--mysql-test/suite/galera/t/galera_var_notify_cmd.cnf13
-rw-r--r--mysql-test/suite/galera/t/galera_var_notify_cmd.test14
-rw-r--r--mysql-test/suite/galera/t/galera_wsrep_new_cluster-master.opt1
-rw-r--r--mysql-test/suite/galera/t/galera_wsrep_new_cluster.cnf10
-rw-r--r--mysql-test/suite/galera/t/galera_wsrep_new_cluster.test26
-rw-r--r--mysql-test/suite/galera/t/lp1376747-4.test17
-rw-r--r--mysql-test/suite/innodb_fts/r/misc_debug2.result3
-rw-r--r--mysql-test/suite/innodb_fts/t/misc_debug2.test3
-rw-r--r--mysys/my_addr_resolve.c12
-rw-r--r--mysys/my_default.c10
-rw-r--r--mysys/my_getncpus.c31
-rw-r--r--plugin/auth_pam/CMakeLists.txt14
-rw-r--r--plugin/auth_pam/mapper/pam_user_map.c30
-rw-r--r--sql/log_event.cc8
-rw-r--r--sql/slave.cc24
-rw-r--r--sql/sql_yacc.yy4
-rw-r--r--sql/wsrep_thd.cc8
-rw-r--r--support-files/CMakeLists.txt2
-rw-r--r--support-files/mariadb.pc.in2
-rw-r--r--support-files/mariadb.service.in2
-rw-r--r--support-files/mariadb@.service.in2
42 files changed, 545 insertions, 88 deletions
diff --git a/cmake/os/WindowsCache.cmake b/cmake/os/WindowsCache.cmake
index 939a52d0655..1e946c93cdf 100644
--- a/cmake/os/WindowsCache.cmake
+++ b/cmake/os/WindowsCache.cmake
@@ -124,6 +124,7 @@ SET(HAVE_PTHREAD_ATTR_GETSTACKSIZE CACHE INTERNAL "")
SET(HAVE_PTHREAD_ATTR_SETSCOPE CACHE INTERNAL "")
SET(HAVE_PTHREAD_ATTR_SETSTACKSIZE CACHE INTERNAL "")
SET(HAVE_PTHREAD_CONDATTR_CREATE CACHE INTERNAL "")
+SET(HAVE_PTHREAD_GETAFFINITY_NP CACHE INTERNAL "")
SET(HAVE_PTHREAD_INIT CACHE INTERNAL "")
SET(HAVE_PTHREAD_KEY_DELETE CACHE INTERNAL "")
SET(HAVE_PTHREAD_RWLOCK_RDLOCK CACHE INTERNAL "")
diff --git a/cmake/ssl.cmake b/cmake/ssl.cmake
index 2ec370404df..cc4f0d2daa0 100644
--- a/cmake/ssl.cmake
+++ b/cmake/ssl.cmake
@@ -149,6 +149,7 @@ MACRO (MYSQL_CHECK_SSL)
SET(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR})
SET(CMAKE_REQUIRED_LIBRARIES ${SSL_LIBRARIES})
+ SET(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR})
CHECK_SYMBOL_EXISTS(ERR_remove_thread_state "openssl/err.h"
HAVE_ERR_remove_thread_state)
CHECK_SYMBOL_EXISTS(EVP_aes_128_ctr "openssl/evp.h"
diff --git a/config.h.cmake b/config.h.cmake
index 765d75dfb23..e89fbc7b95c 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -195,6 +195,7 @@
#cmakedefine HAVE_PTHREAD_ATTR_SETSCOPE 1
#cmakedefine HAVE_PTHREAD_ATTR_SETSTACKSIZE 1
#cmakedefine HAVE_PTHREAD_CONDATTR_CREATE 1
+#cmakedefine HAVE_PTHREAD_GETAFFINITY_NP 1
#cmakedefine HAVE_PTHREAD_KEY_DELETE 1
#cmakedefine HAVE_PTHREAD_KILL 1
#cmakedefine HAVE_PTHREAD_RWLOCK_RDLOCK 1
diff --git a/configure.cmake b/configure.cmake
index e75810f8150..a9aa1778ba8 100644
--- a/configure.cmake
+++ b/configure.cmake
@@ -385,6 +385,7 @@ CHECK_FUNCTION_EXISTS (pthread_attr_setscope HAVE_PTHREAD_ATTR_SETSCOPE)
CHECK_FUNCTION_EXISTS (pthread_attr_getguardsize HAVE_PTHREAD_ATTR_GETGUARDSIZE)
CHECK_FUNCTION_EXISTS (pthread_attr_setstacksize HAVE_PTHREAD_ATTR_SETSTACKSIZE)
CHECK_FUNCTION_EXISTS (pthread_condattr_create HAVE_PTHREAD_CONDATTR_CREATE)
+CHECK_FUNCTION_EXISTS (pthread_getaffinity_np HAVE_PTHREAD_GETAFFINITY_NP)
CHECK_FUNCTION_EXISTS (pthread_key_delete HAVE_PTHREAD_KEY_DELETE)
CHECK_FUNCTION_EXISTS (pthread_rwlock_rdlock HAVE_PTHREAD_RWLOCK_RDLOCK)
CHECK_FUNCTION_EXISTS (pthread_sigmask HAVE_PTHREAD_SIGMASK)
diff --git a/debian/libmariadb-dev.install b/debian/libmariadb-dev.install
index 72798dec379..0625dec7a9e 100644
--- a/debian/libmariadb-dev.install
+++ b/debian/libmariadb-dev.install
@@ -4,6 +4,6 @@ usr/lib/*/libmariadb.so
usr/lib/*/libmariadbclient.a
usr/lib/*/libmariadbclient.so
usr/lib/*/libmysqlservices.a
+usr/lib/*/pkgconfig/mariadb.pc
usr/share/aclocal/mysql.m4
usr/share/man/man1/mysql_config.1
-usr/share/pkgconfig/mariadb.pc
diff --git a/mysql-test/main/alter_user.result b/mysql-test/main/alter_user.result
index 76f811f18c7..7ba9549e73c 100644
--- a/mysql-test/main/alter_user.result
+++ b/mysql-test/main/alter_user.result
@@ -43,7 +43,7 @@ SET GLOBAL read_only = @start_read_only;
alter user boo;
ERROR HY000: Operation ALTER USER failed for 'boo'
#--warning ER_CANNOT_USER
-alter if exists user boo;
+alter user if exists boo;
Warnings:
Error 1133 Can't find any matching row in the user table
Note 1396 Operation ALTER USER failed for 'boo'
diff --git a/mysql-test/main/alter_user.test b/mysql-test/main/alter_user.test
index ca444f70a70..3a1052a98f6 100644
--- a/mysql-test/main/alter_user.test
+++ b/mysql-test/main/alter_user.test
@@ -41,7 +41,7 @@ SET GLOBAL read_only = @start_read_only;
--error ER_CANNOT_USER
alter user boo;
--echo #--warning ER_CANNOT_USER
-alter if exists user boo;
+alter user if exists boo;
--echo # Test password related altering.
alter user foo identified by 'something';
diff --git a/mysql-test/main/mdev375.test b/mysql-test/main/mdev375.test
index 9e35190b927..6fdb35016ca 100644
--- a/mysql-test/main/mdev375.test
+++ b/mysql-test/main/mdev375.test
@@ -27,6 +27,8 @@ SELECT 2;
--connection default
SELECT 0;
+let $count_sessions=11;
+--source include/wait_until_count_sessions.inc
show status like "Threads_connected";
SET GLOBAL log_warnings=@save_log_warnings;
diff --git a/mysql-test/main/mysqld--defaults-file.result b/mysql-test/main/mysqld--defaults-file.result
index 5fd5ca8d95a..ccad1d119fc 100644
--- a/mysql-test/main/mysqld--defaults-file.result
+++ b/mysql-test/main/mysqld--defaults-file.result
@@ -10,3 +10,13 @@ Could not open required defaults file: MYSQL_TEST_DIR/with.ext
Fatal error in defaults handling. Program aborted
Could not open required defaults file: MYSQL_TEST_DIR/no_extension
Fatal error in defaults handling. Program aborted
+#
+# MDEV-21374: When "--help --verbose" prints out configuration file paths,
+# the --defaults-file option is not considered
+#
+# Test on `defaults-file`
+Default options are read from the following files in the given order:
+MYSQLTEST_VARDIR/my.cnf
+# Test on `defaults-extra-file`
+Default options are read from the following files in the given order:
+<first-defaults> MYSQLTEST_VARDIR/my_test.cnf ~/.my.cnf
diff --git a/mysql-test/main/mysqld--defaults-file.test b/mysql-test/main/mysqld--defaults-file.test
index 3bfe0aa891f..91d30eb1617 100644
--- a/mysql-test/main/mysqld--defaults-file.test
+++ b/mysql-test/main/mysqld--defaults-file.test
@@ -29,3 +29,19 @@ exec $MYSQLD --defaults-file=with.ext --print-defaults 2>&1;
--error 1
exec $MYSQLD --defaults-file=no_extension --print-defaults 2>&1;
+--echo #
+--echo # MDEV-21374: When "--help --verbose" prints out configuration file paths,
+--echo # the --defaults-file option is not considered
+--echo #
+
+--echo # Test on `defaults-file`
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+exec $MYSQLD --defaults-file=$MYSQLTEST_VARDIR/my.cnf --help --verbose | grep -A 1 'Default options are read';
+
+--echo # Test on `defaults-extra-file`
+# <first-defaults> = `/etc/my.cnf /etc/mysql/my.cnf`
+# Using sysconfdir configuration, we don't always have `/etc/mysql/my.cnf`, so replace them with a regex as well.
+copy_file $MYSQLTEST_VARDIR/my.cnf $MYSQLTEST_VARDIR/my_test.cnf;
+--replace_regex /.*my_test.cnf/<first-defaults> MYSQLTEST_VARDIR\/my_test.cnf/
+exec $MYSQLD --defaults-extra-file=$MYSQLTEST_VARDIR/my_test.cnf --help --verbose | grep -A 1 'Default options are read';
+remove_file $MYSQLTEST_VARDIR/my_test.cnf;
diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def
index cf0120afb92..4179a556841 100644
--- a/mysql-test/suite/galera/disabled.def
+++ b/mysql-test/suite/galera/disabled.def
@@ -15,12 +15,10 @@ MW-328A : MDEV-21483 galera.MW-328A galera.MW-328B
MW-328B : MDEV-21483 galera.MW-328A galera.MW-328B
MW-329 : MDEV-19962 Galera test failure on MW-329
galera.galera_defaults : MDEV-21494 Galera test sporadic failure on galera.galera_defaults
-galera_as_slave_gtid_myisam : MDEV-21421 galera.galera_as_slave_gtid_myisam
galera_as_slave_replication_bundle : MDEV-15785 OPTION_GTID_BEGIN is set in Gtid_log_event::do_apply_event()
galera_autoinc_sst_mariabackup : Known issue, may require porting MDEV-17458 from later versions
galera_binlog_stmt_autoinc : MDEV-19959 Galera test failure on galera_binlog_stmt_autoinc
galera_gcache_recover_manytrx : MDEV-18834 Galera test failure
-galera_ist_mariabackup : MDEV-18829 test leaves port open
galera_ist_progress : MDEV-15236 fails when trying to read transfer status
galera_load_data : MDEV-19968 galera.galera_load_data
galera_parallel_autoinc_largetrx : MDEV-20916 galera.galera_parallel_autoinc_largetrx
@@ -31,9 +29,7 @@ galera_sst_mariabackup_encrypt_with_key : MDEV-21484 galera_sst_mariabackup_encr
galera_sst_mariabackup_table_options: MDEV-19741 Galera test failure on galera.galera_sst_mariabackup_table_options
galera_var_innodb_disallow_writes : MDEV-20928 galera.galera_var_innodb_disallow_writes
galera_var_node_address : MDEV-20485 Galera test failure
-galera_var_notify_cmd : MDEV-21488 galera.galera_var_notify_cmd
galera_wan : MDEV-17259 Test failure on galera.galera_wan
-mysql-wsrep#33 : MDEV-21420 galera.mysql-wsrep#33
partition : MDEV-19958 Galera test failure on galera.partition
query_cache: MDEV-15805 Test failure on galera.query_cache
sql_log_bin : MDEV-21491 galera.sql_log_bin
diff --git a/mysql-test/suite/galera/r/galera_as_slave_gtid_myisam.result b/mysql-test/suite/galera/r/galera_as_slave_gtid_myisam.result
index 0e5c6425d6a..d8a9f0d6f57 100644
--- a/mysql-test/suite/galera/r/galera_as_slave_gtid_myisam.result
+++ b/mysql-test/suite/galera/r/galera_as_slave_gtid_myisam.result
@@ -1,4 +1,7 @@
connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
+SELECT @@WSREP_ON;
+@@WSREP_ON
+0
connection node_2;
ALTER TABLE mysql.gtid_slave_pos engine = InnoDB;
START SLAVE;
diff --git a/mysql-test/suite/galera/r/galera_rsu_add_pk.result b/mysql-test/suite/galera/r/galera_rsu_add_pk.result
index 4c79da154e2..2df08c3e4ff 100644
--- a/mysql-test/suite/galera/r/galera_rsu_add_pk.result
+++ b/mysql-test/suite/galera/r/galera_rsu_add_pk.result
@@ -9,19 +9,19 @@ SET SESSION wsrep_OSU_method = "RSU";
ALTER TABLE t1 ADD PRIMARY KEY (f1);
SET SESSION wsrep_OSU_method = "TOI";
INSERT INTO t1 (f1) SELECT 200000 + (10000 * a1.f1) + (1000 * a2.f1) + (100 * a3.f1) + (10 * a4.f1) + a5.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5;
-SELECT COUNT(*) = 300000 FROM t1;
-COUNT(*) = 300000
-1
-SELECT MAX(f1) = 299999 FROM t1;
-MAX(f1) = 299999
-1
+SELECT COUNT(*) AS EXPECT_300000 FROM t1;
+EXPECT_300000
+300000
+SELECT MAX(f1) AS EXPECT_299999 FROM t1;
+EXPECT_299999
+299999
connection node_1;
-SELECT COUNT(*) = 300000 FROM t1;
-COUNT(*) = 300000
-1
-SELECT MAX(f1) = 299999 FROM t1;
-MAX(f1) = 299999
-1
+SELECT COUNT(*) AS EXPECT_300000 FROM t1;
+EXPECT_300000
+300000
+SELECT MAX(f1) AS EXPECT_299999 FROM t1;
+EXPECT_299999
+299999
SET SESSION wsrep_OSU_method = "RSU";
ALTER TABLE t1 ADD PRIMARY KEY (f1);
SET SESSION wsrep_OSU_method = "TOI";
diff --git a/mysql-test/suite/galera/r/galera_slave_replay.result b/mysql-test/suite/galera/r/galera_slave_replay.result
new file mode 100644
index 00000000000..760617be5f7
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_slave_replay.result
@@ -0,0 +1,95 @@
+connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
+connection node_2a;
+connection node_1;
+RESET MASTER;
+connection node_2a;
+START SLAVE;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1)) engine=innodb;
+INSERT INTO t1 VALUES (1, 'a');
+INSERT INTO t1 VALUES (3, 'a');
+set binlog_format=STATEMENT;
+SET AUTOCOMMIT=ON;
+START TRANSACTION;
+SELECT * FROM t1 FOR UPDATE;
+f1 f2
+1 a
+3 a
+UPDATE t1 SET f2 = 'c' WHERE f1 > 1;
+connection node_2a;
+SET SESSION wsrep_sync_wait = 0;
+connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
+connection node_3;
+SET SESSION wsrep_sync_wait = 0;
+connection node_2a;
+SET GLOBAL wsrep_provider_options = 'dbug=d,commit_monitor_enter_sync';
+SET GLOBAL debug_dbug = "d,sync.wsrep_apply_cb";
+connection node_3;
+INSERT INTO test.t1 VALUES (2, 'b');
+connection node_1;
+COMMIT;
+connection node_2a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL debug_dbug = "";
+SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
+connection node_2a;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=commit_monitor_enter_sync';
+connection node_1;
+SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'a';
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'c';
+COUNT(*) = 1
+1
+SELECT * FROM t1;
+f1 f2
+1 a
+3 c
+connection node_2a;
+set session wsrep_sync_wait=15;
+set session wsrep_sync_wait=0;
+wsrep_local_replays
+1
+SELECT * FROM t1;
+f1 f2
+1 a
+2 b
+3 c
+SET DEBUG_SYNC = "RESET";
+#
+# test phase with real abort
+#
+connection node_1;
+set binlog_format=ROW;
+insert into t1 values (4, 'd');
+SET AUTOCOMMIT=ON;
+START TRANSACTION;
+UPDATE t1 SET f2 = 'd' WHERE f1 = 3;
+connection node_2a;
+SET GLOBAL wsrep_provider_options = 'dbug=d,commit_monitor_enter_sync';
+SET GLOBAL debug_dbug = "d,sync.wsrep_apply_cb";
+connection node_3;
+UPDATE test.t1 SET f2 = 'e' WHERE f1 = 3;
+connection node_1;
+COMMIT;
+connection node_2a;
+SET GLOBAL debug_dbug = "";
+SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
+connection node_2a;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=commit_monitor_enter_sync';
+SET DEBUG_SYNC = "RESET";
+connection node_2a;
+set session wsrep_sync_wait=15;
+SELECT COUNT(*) = 1 FROM test.t1 WHERE f2 = 'e';
+COUNT(*) = 1
+1
+set session wsrep_sync_wait=0;
+STOP SLAVE;
+RESET SLAVE;
+DROP TABLE t1;
+connection node_1;
+DROP TABLE t1;
+RESET MASTER;
diff --git a/mysql-test/suite/galera/r/galera_var_notify_cmd.result b/mysql-test/suite/galera/r/galera_var_notify_cmd.result
index 2b390d0db8d..823407fbba7 100644
--- a/mysql-test/suite/galera/r/galera_var_notify_cmd.result
+++ b/mysql-test/suite/galera/r/galera_var_notify_cmd.result
@@ -1,11 +1,11 @@
connection node_1;
-SET SESSION wsrep_sync_wait=15;
-SELECT COUNT(DISTINCT uuid) FROM mtr_wsrep_notify.membership;
-COUNT(DISTINCT uuid)
+SELECT COUNT(DISTINCT uuid) AS EXPECT_2 FROM mtr_wsrep_notify.membership;
+EXPECT_2
2
-SELECT MAX(size) FROM mtr_wsrep_notify.status;
-MAX(size)
+SELECT MAX(size) AS EXPECT_2 FROM mtr_wsrep_notify.status;
+EXPECT_2
2
-SELECT COUNT(DISTINCT idx) FROM mtr_wsrep_notify.status;
-COUNT(DISTINCT idx)
-1
+SELECT COUNT(DISTINCT idx) AS EXPECT_2 FROM mtr_wsrep_notify.status;
+EXPECT_2
+2
+DROP SCHEMA mtr_wsrep_notify;
diff --git a/mysql-test/suite/galera/r/galera_wsrep_new_cluster.result b/mysql-test/suite/galera/r/galera_wsrep_new_cluster.result
index 24484fb66d2..ca388496794 100644
--- a/mysql-test/suite/galera/r/galera_wsrep_new_cluster.result
+++ b/mysql-test/suite/galera/r/galera_wsrep_new_cluster.result
@@ -25,7 +25,7 @@ VARIABLE_VALUE = 'ON'
1
SELECT VARIABLE_VALUE = 0 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_index';
VARIABLE_VALUE = 0
-0
+1
SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready';
VARIABLE_VALUE = 'ON'
1
diff --git a/mysql-test/suite/galera/t/galera_as_slave_gtid_myisam.test b/mysql-test/suite/galera/t/galera_as_slave_gtid_myisam.test
index faa9ddfd5c8..33668da11be 100644
--- a/mysql-test/suite/galera/t/galera_as_slave_gtid_myisam.test
+++ b/mysql-test/suite/galera/t/galera_as_slave_gtid_myisam.test
@@ -16,6 +16,7 @@
# As node #1 is not a Galera node, we connect to node #2 in order to run include/galera_cluster.inc
--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2
--source include/galera_cluster.inc
+SELECT @@WSREP_ON;
--connection node_2
# make sure gtid_slave_pos is of innodb engine, mtr does not currently provide that
diff --git a/mysql-test/suite/galera/t/galera_rsu_add_pk.test b/mysql-test/suite/galera/t/galera_rsu_add_pk.test
index 7db990d7be1..094048f6caa 100644
--- a/mysql-test/suite/galera/t/galera_rsu_add_pk.test
+++ b/mysql-test/suite/galera/t/galera_rsu_add_pk.test
@@ -26,14 +26,20 @@ SET SESSION wsrep_OSU_method = "TOI";
# Insert values after the ALTER
INSERT INTO t1 (f1) SELECT 200000 + (10000 * a1.f1) + (1000 * a2.f1) + (100 * a3.f1) + (10 * a4.f1) + a5.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5;
+--let $wait_condition = SELECT COUNT(*) = 300000 FROM t1;
+--source include/wait_condition.inc
-SELECT COUNT(*) = 300000 FROM t1;
-SELECT MAX(f1) = 299999 FROM t1;
+SELECT COUNT(*) AS EXPECT_300000 FROM t1;
+SELECT MAX(f1) AS EXPECT_299999 FROM t1;
--connection node_1
--reap
-SELECT COUNT(*) = 300000 FROM t1;
-SELECT MAX(f1) = 299999 FROM t1;
+
+--let $wait_condition = SELECT COUNT(*) = 300000 FROM t1;
+--source include/wait_condition.inc
+
+SELECT COUNT(*) AS EXPECT_300000 FROM t1;
+SELECT MAX(f1) AS EXPECT_299999 FROM t1;
SET SESSION wsrep_OSU_method = "RSU";
ALTER TABLE t1 ADD PRIMARY KEY (f1);
diff --git a/mysql-test/suite/galera/t/galera_slave_replay.cnf b/mysql-test/suite/galera/t/galera_slave_replay.cnf
new file mode 100644
index 00000000000..9449ec9cf40
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_slave_replay.cnf
@@ -0,0 +1 @@
+!include ../galera_2nodes_as_slave.cnf
diff --git a/mysql-test/suite/galera/t/galera_slave_replay.test b/mysql-test/suite/galera/t/galera_slave_replay.test
new file mode 100644
index 00000000000..1d133e90e88
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_slave_replay.test
@@ -0,0 +1,198 @@
+#
+# This test tests the operation of transaction replay for async replication slave.
+# If a potentially conflicting galera transaction arrives at
+# just the right time during the commit and has lock conflict with async replication transaction
+# applied by slave SQL thread, then the async replication transaction should either abort
+# or rollback and replay (depending on the nature of lock conflict).
+#
+
+--source include/have_innodb.inc
+--source include/have_debug_sync.inc
+
+--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2
+
+--connection node_2a
+--source include/galera_cluster.inc
+#--source suite/galera/include/galera_have_debug_sync.inc
+
+#
+# node 1 is native MariaDB server operating as async replication master
+#
+--connection node_1
+RESET MASTER;
+
+--connection node_2a
+#
+# count the number of wsrep replay's done in the node
+#
+--let $wsrep_local_replays_old = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_replays'`
+
+
+#
+# nodes 2 and 3 form a galera cluster, node 2 operates as slave for native MariaDB naster in node 1
+#
+--disable_query_log
+--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root', MASTER_PORT=$NODE_MYPORT_1;
+--enable_query_log
+START SLAVE;
+
+--connection node_1
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1)) engine=innodb;
+INSERT INTO t1 VALUES (1, 'a');
+INSERT INTO t1 VALUES (3, 'a');
+
+#
+# use statement format replication to cause a false positive conflict with async replication transaction
+# and galera replication. The conflict will be on GAP lock, and slave SQL thread should rollback
+# and replay
+#
+set binlog_format=STATEMENT;
+
+SET AUTOCOMMIT=ON;
+START TRANSACTION;
+
+SELECT * FROM t1 FOR UPDATE;
+UPDATE t1 SET f2 = 'c' WHERE f1 > 1;
+
+--connection node_2a
+# wait for create table and inserts to be replicated from master
+SET SESSION wsrep_sync_wait = 0;
+--let $wait_condition = SELECT COUNT(*) = 2 FROM test.t1;
+--source include/wait_condition.inc
+
+# wait for create table and inserts to be replicated in cluster
+--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
+--connection node_3
+SET SESSION wsrep_sync_wait = 0;
+--let $wait_condition = SELECT COUNT(*) = 2 FROM test.t1;
+--source include/wait_condition.inc
+
+--connection node_2a
+# Block the future commit of async replication
+--let $galera_sync_point = commit_monitor_enter_sync
+--source include/galera_set_sync_point.inc
+
+# block also the applier before applying begins
+SET GLOBAL debug_dbug = "d,sync.wsrep_apply_cb";
+
+#
+# now inject a conflicting insert from node 3, it will replicate with
+# earlier seqno (than async transaction) and pause before applying in node 2
+#
+--connection node_3
+INSERT INTO test.t1 VALUES (2, 'b');
+
+#
+# send the update from master, this will succeed here, beceuase of async replication.
+# async replication will apply this in node 2 and pause before commit phase,
+--connection node_1
+--error 0
+COMMIT;
+
+# Wait until async slave commit is blocked in node_2
+--connection node_2a
+--source include/galera_wait_sync_point.inc
+
+#
+# release the applier
+# note: have to clear wsrep_apply_cb sync point first, as async replication will go for replay
+# and as this sync point, after BF applier is released to progress
+#
+SET GLOBAL debug_dbug = "";
+SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
+
+# Unblock the async slave commit
+--connection node_2a
+--source include/galera_clear_sync_point.inc
+--source include/galera_signal_sync_point.inc
+
+--connection node_1
+
+SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'a';
+SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'c';
+SELECT * FROM t1;
+
+--connection node_2a
+
+# wsrep_local_replays has increased by 1
+set session wsrep_sync_wait=15;
+--let $wsrep_local_replays_new = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_replays'`
+set session wsrep_sync_wait=0;
+
+--disable_query_log
+--eval SELECT $wsrep_local_replays_new - $wsrep_local_replays_old = 1 AS wsrep_local_replays;
+--enable_query_log
+
+#
+# replaying of async transaction should be effective, and row 3 having 'c' in f2
+#
+SELECT * FROM t1;
+SET DEBUG_SYNC = "RESET";
+
+#********************************************************************************
+# test phase 2
+#********************************************************************************
+
+--echo #
+--echo # test phase with real abort
+--echo #
+
+--connection node_1
+
+set binlog_format=ROW;
+
+insert into t1 values (4, 'd');
+
+SET AUTOCOMMIT=ON;
+START TRANSACTION;
+
+UPDATE t1 SET f2 = 'd' WHERE f1 = 3;
+
+--connection node_2a
+# wait for the last insert to be replicated from master
+--let $wait_condition = SELECT COUNT(*) = 4 FROM test.t1;
+--source include/wait_condition.inc
+
+# Block the commit
+--let $galera_sync_point = commit_monitor_enter_sync
+--source include/galera_set_sync_point.inc
+
+# block applier
+SET GLOBAL debug_dbug = "d,sync.wsrep_apply_cb";
+
+# Inject a conflicting update from node 3
+--connection node_3
+UPDATE test.t1 SET f2 = 'e' WHERE f1 = 3;
+
+# send the update from master
+--connection node_1
+--error 0
+COMMIT;
+
+--connection node_2a
+
+# release the applier
+SET GLOBAL debug_dbug = "";
+SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
+
+
+# Unblock the async slave commit
+--connection node_2a
+--source include/galera_clear_sync_point.inc
+--source include/galera_signal_sync_point.inc
+SET DEBUG_SYNC = "RESET";
+
+--connection node_2a
+
+set session wsrep_sync_wait=15;
+SELECT COUNT(*) = 1 FROM test.t1 WHERE f2 = 'e';
+set session wsrep_sync_wait=0;
+
+STOP SLAVE;
+RESET SLAVE;
+
+DROP TABLE t1;
+
+--connection node_1
+DROP TABLE t1;
+RESET MASTER;
diff --git a/mysql-test/suite/galera/t/galera_var_notify_cmd-master.opt b/mysql-test/suite/galera/t/galera_var_notify_cmd-master.opt
new file mode 100644
index 00000000000..70dfc98736b
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_var_notify_cmd-master.opt
@@ -0,0 +1 @@
+--wsrep_notify_cmd=$MYSQL_TEST_DIR/std_data/wsrep_notify.sh --wsrep-sync-wait=0
diff --git a/mysql-test/suite/galera/t/galera_var_notify_cmd.cnf b/mysql-test/suite/galera/t/galera_var_notify_cmd.cnf
deleted file mode 100644
index 69df4f0e7e0..00000000000
--- a/mysql-test/suite/galera/t/galera_var_notify_cmd.cnf
+++ /dev/null
@@ -1,13 +0,0 @@
-!include ../galera_2nodes.cnf
-
-[mysqld.1]
-wsrep_notify_cmd=$MYSQL_TEST_DIR/std_data/wsrep_notify.sh
-wsrep-sync-wait=0
-
-[mysqld.2]
-
-
-
-
-
-
diff --git a/mysql-test/suite/galera/t/galera_var_notify_cmd.test b/mysql-test/suite/galera/t/galera_var_notify_cmd.test
index 2b0852b4870..fda61bf2914 100644
--- a/mysql-test/suite/galera/t/galera_var_notify_cmd.test
+++ b/mysql-test/suite/galera/t/galera_var_notify_cmd.test
@@ -4,9 +4,15 @@
#
--source include/galera_cluster.inc
+--source include/force_restart.inc
--connection node_1
-SET SESSION wsrep_sync_wait=15;
-SELECT COUNT(DISTINCT uuid) FROM mtr_wsrep_notify.membership;
-SELECT MAX(size) FROM mtr_wsrep_notify.status;
-SELECT COUNT(DISTINCT idx) FROM mtr_wsrep_notify.status;
+--let $wait_condition = SELECT COUNT(DISTINCT uuid) = 2 FROM mtr_wsrep_notify.membership;
+--source include/wait_condition.inc
+
+SELECT COUNT(DISTINCT uuid) AS EXPECT_2 FROM mtr_wsrep_notify.membership;
+SELECT MAX(size) AS EXPECT_2 FROM mtr_wsrep_notify.status;
+SELECT COUNT(DISTINCT idx) AS EXPECT_2 FROM mtr_wsrep_notify.status;
+
+# CLEANUP
+DROP SCHEMA mtr_wsrep_notify;
diff --git a/mysql-test/suite/galera/t/galera_wsrep_new_cluster-master.opt b/mysql-test/suite/galera/t/galera_wsrep_new_cluster-master.opt
new file mode 100644
index 00000000000..c31150c46af
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_wsrep_new_cluster-master.opt
@@ -0,0 +1 @@
+--wsrep-new-cluster
diff --git a/mysql-test/suite/galera/t/galera_wsrep_new_cluster.cnf b/mysql-test/suite/galera/t/galera_wsrep_new_cluster.cnf
deleted file mode 100644
index 0acbcfb7843..00000000000
--- a/mysql-test/suite/galera/t/galera_wsrep_new_cluster.cnf
+++ /dev/null
@@ -1,10 +0,0 @@
-!include ../galera_2nodes.cnf
-
-[mysqld.1]
-wsrep-new-cluster
-
-[mysqld.2]
-
-
-
-
diff --git a/mysql-test/suite/galera/t/galera_wsrep_new_cluster.test b/mysql-test/suite/galera/t/galera_wsrep_new_cluster.test
index 6ba8ce786c8..59350222a4c 100644
--- a/mysql-test/suite/galera/t/galera_wsrep_new_cluster.test
+++ b/mysql-test/suite/galera/t/galera_wsrep_new_cluster.test
@@ -7,6 +7,19 @@
--source include/galera_cluster.inc
--source include/have_innodb.inc
+--let $wait_condition = SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+--source include/wait_condition.inc
+--let $wait_condition = SELECT VARIABLE_VALUE = 'on' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_connected';
+--source include/wait_condition.inc
+--let $wait_condition = SELECT VARIABLE_VALUE = 0 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_index';
+--source include/wait_condition.inc
+--let $wait_condition = SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready';
+--source include/wait_condition.inc
+--let $wait_condition = SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state';
+--source include/wait_condition.inc
+--let $wait_condition = SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
+--source include/wait_condition.inc
+
SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_connected';
SELECT VARIABLE_VALUE = 0 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_index';
@@ -16,6 +29,19 @@ SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VAR
--connection node_2
+--let $wait_condition = SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+--source include/wait_condition.inc
+--let $wait_condition = SELECT VARIABLE_VALUE = 'on' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_connected';
+--source include/wait_condition.inc
+--let $wait_condition = SELECT VARIABLE_VALUE = 0 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_index';
+--source include/wait_condition.inc
+--let $wait_condition = SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready';
+--source include/wait_condition.inc
+--let $wait_condition = SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state';
+--source include/wait_condition.inc
+--let $wait_condition = SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
+--source include/wait_condition.inc
+
SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_connected';
SELECT VARIABLE_VALUE = 0 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_index';
diff --git a/mysql-test/suite/galera/t/lp1376747-4.test b/mysql-test/suite/galera/t/lp1376747-4.test
index 0c707d6d681..6ae89fe9df4 100644
--- a/mysql-test/suite/galera/t/lp1376747-4.test
+++ b/mysql-test/suite/galera/t/lp1376747-4.test
@@ -27,25 +27,24 @@ INSERT INTO t1 VALUES (2,3);
--connection node_2a
SET session wsrep_sync_wait=0;
SET session wsrep_causal_reads=OFF;
+
SHOW CREATE TABLE t1;
---sleep 1
--send FLUSH TABLES t1 WITH READ LOCK;
--connection node_2
-# let the flush table wait in pause state before we unlock
-# table otherwise there is window where-in flush table is
-# yet to wait in pause and unlock allows alter table to proceed.
-# this is because send in asynchronous.
---sleep 3
-# this will release existing lock but will not resume
-# the cluster as there is new FTRL that is still pausing it.
+--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE 'committed%';
+--source include/wait_condition.inc
+
UNLOCK TABLES;
SHOW CREATE TABLE t1;
--connection node_2a
--reap
UNLOCK TABLES;
---sleep 2
+
+--let $wait_condition = SELECT COUNT(*) = 2 FROM t1;
+--source include/wait_condition.inc
+
SHOW CREATE TABLE t1;
SELECT * from t1;
diff --git a/mysql-test/suite/innodb_fts/r/misc_debug2.result b/mysql-test/suite/innodb_fts/r/misc_debug2.result
index 85fba6427f7..b3bc12f92cc 100644
--- a/mysql-test/suite/innodb_fts/r/misc_debug2.result
+++ b/mysql-test/suite/innodb_fts/r/misc_debug2.result
@@ -1,4 +1,5 @@
-call mtr.add_suppression("InnoDB: Tablespace for table .* is set as discarded");
+call mtr.add_suppression("InnoDB: Table '.*' tablespace is set as discarded.");
+call mtr.add_suppression("InnoDB: Tablespace for table .* is set as discarded.");
CREATE TABLE mdev21563(f1 VARCHAR(100), FULLTEXT idx(f1))ENGINE=InnoDB;
set debug_dbug="+d,fts_instrument_sync_request";
INSERT INTO mdev21563 VALUES('This is a test');
diff --git a/mysql-test/suite/innodb_fts/t/misc_debug2.test b/mysql-test/suite/innodb_fts/t/misc_debug2.test
index 5b0184e5cca..0a9e137dd80 100644
--- a/mysql-test/suite/innodb_fts/t/misc_debug2.test
+++ b/mysql-test/suite/innodb_fts/t/misc_debug2.test
@@ -1,7 +1,8 @@
--source include/have_innodb.inc
--source include/have_debug.inc
--source include/not_embedded.inc
-call mtr.add_suppression("InnoDB: Tablespace for table .* is set as discarded");
+call mtr.add_suppression("InnoDB: Table '.*' tablespace is set as discarded.");
+call mtr.add_suppression("InnoDB: Tablespace for table .* is set as discarded.");
CREATE TABLE mdev21563(f1 VARCHAR(100), FULLTEXT idx(f1))ENGINE=InnoDB;
set debug_dbug="+d,fts_instrument_sync_request";
diff --git a/mysys/my_addr_resolve.c b/mysys/my_addr_resolve.c
index 7590d576a7c..3f20f535d37 100644
--- a/mysys/my_addr_resolve.c
+++ b/mysys/my_addr_resolve.c
@@ -56,6 +56,18 @@ static ElfW(Addr) offset= 0;
#define offset 0
#endif
+#ifndef bfd_get_section_flags
+#define bfd_get_section_flags(H, S) bfd_section_flags(S)
+#endif /* bfd_get_section_flags */
+
+#ifndef bfd_get_section_size
+#define bfd_get_section_size(S) bfd_section_size(S)
+#endif /* bfd_get_section_size */
+
+#ifndef bfd_get_section_vma
+#define bfd_get_section_vma(H, S) bfd_section_vma(S)
+#endif /* bfd_get_section_vma */
+
/**
finds a file name, a line number, and a function name corresponding to addr.
diff --git a/mysys/my_default.c b/mysys/my_default.c
index deeb9b4a5b8..7c6ef8fffa0 100644
--- a/mysys/my_default.c
+++ b/mysys/my_default.c
@@ -1035,6 +1035,11 @@ void my_print_default_files(const char *conf_file)
char name[FN_REFLEN], **ext;
puts("\nDefault options are read from the following files in the given order:");
+ if (my_defaults_file)
+ {
+ puts(my_defaults_file);
+ return;
+ }
if (dirname_length(conf_file))
fputs(conf_file,stdout);
@@ -1059,7 +1064,12 @@ void my_print_default_files(const char *conf_file)
if (**dirs)
pos= *dirs;
else if (my_defaults_extra_file)
+ {
pos= my_defaults_extra_file;
+ fputs(pos, stdout);
+ fputs(" ", stdout);
+ continue;
+ }
else
continue;
end= convert_dirname(name, pos, NullS);
diff --git a/mysys/my_getncpus.c b/mysys/my_getncpus.c
index 38585161c22..0ee03631da8 100644
--- a/mysys/my_getncpus.c
+++ b/mysys/my_getncpus.c
@@ -21,10 +21,36 @@
#include <unistd.h>
#endif
+#if defined(__FreeBSD__) && defined(HAVE_PTHREAD_GETAFFINITY_NP)
+#include <pthread_np.h>
+#include <sys/cpuset.h>
+#endif
+
static int ncpus=0;
-int my_getncpus()
+int my_getncpus(void)
{
+#if (defined(__linux__) || defined(__FreeBSD__)) && defined(HAVE_PTHREAD_GETAFFINITY_NP)
+ cpu_set_t set;
+
+ if (!ncpus)
+ {
+ if (pthread_getaffinity_np(pthread_self(), sizeof(set), &set) == 0)
+ {
+ ncpus= CPU_COUNT(&set);
+ }
+ else
+ {
+#ifdef _SC_NPROCESSORS_ONLN
+ ncpus= sysconf(_SC_NPROCESSORS_ONLN);
+#else
+ ncpus= 2;
+#endif
+ }
+ }
+
+#else /* __linux__ || FreeBSD && HAVE_PTHREAD_GETAFFINITY_NP */
+
if (!ncpus)
{
#ifdef _SC_NPROCESSORS_ONLN
@@ -46,5 +72,8 @@ int my_getncpus()
ncpus= 2;
#endif
}
+
+#endif /* __linux__ || FreeBSD && HAVE_PTHREAD_GETAFFINITY_NP */
+
return ncpus;
}
diff --git a/plugin/auth_pam/CMakeLists.txt b/plugin/auth_pam/CMakeLists.txt
index 0efb0b07feb..c826b422240 100644
--- a/plugin/auth_pam/CMakeLists.txt
+++ b/plugin/auth_pam/CMakeLists.txt
@@ -1,10 +1,24 @@
INCLUDE (CheckIncludeFiles)
INCLUDE (CheckFunctionExists)
+CHECK_INCLUDE_FILES (security/pam_ext.h HAVE_PAM_EXT_H)
CHECK_INCLUDE_FILES (security/pam_appl.h HAVE_PAM_APPL_H)
CHECK_FUNCTION_EXISTS (strndup HAVE_STRNDUP)
+SET(CMAKE_REQUIRED_LIBRARIES pam)
+CHECK_FUNCTION_EXISTS(pam_syslog HAVE_PAM_SYSLOG)
+SET(CMAKE_REQUIRED_LIBRARIES)
+
+IF(HAVE_PAM_SYSLOG)
+ ADD_DEFINITIONS(-DHAVE_PAM_SYSLOG)
+ENDIF()
+
+IF(HAVE_PAM_EXT_H)
+ ADD_DEFINITIONS(-DHAVE_PAM_EXT_H)
+ENDIF()
+
IF(HAVE_PAM_APPL_H)
+ ADD_DEFINITIONS(-DHAVE_PAM_APPL_H)
IF(HAVE_STRNDUP)
ADD_DEFINITIONS(-DHAVE_STRNDUP)
ENDIF(HAVE_STRNDUP)
diff --git a/plugin/auth_pam/mapper/pam_user_map.c b/plugin/auth_pam/mapper/pam_user_map.c
index e1d11acabb9..9d7ed53f8b1 100644
--- a/plugin/auth_pam/mapper/pam_user_map.c
+++ b/plugin/auth_pam/mapper/pam_user_map.c
@@ -2,7 +2,7 @@
Pam module to change user names arbitrarily in the pam stack.
Compile as
-
+
gcc pam_user_map.c -shared -lpam -fPIC -o pam_user_map.so
Install as appropriate (for example, in /lib/security/).
@@ -39,14 +39,36 @@ and usually end up in /var/log/secure file.
#include <grp.h>
#include <pwd.h>
+#ifdef HAVE_PAM_EXT_H
#include <security/pam_ext.h>
+#endif
+
+#ifdef HAVE_PAM_APPL_H
+#include <unistd.h>
+#include <security/pam_appl.h>
+#endif
+
#include <security/pam_modules.h>
+#ifndef HAVE_PAM_SYSLOG
+#include <stdarg.h>
+static void
+pam_syslog (const pam_handle_t *pamh, int priority,
+ const char *fmt, ...)
+{
+ va_list args;
+ va_start (args, fmt);
+ vsyslog (priority, fmt, args);
+ va_end (args);
+}
+#endif
+
#define FILENAME "/etc/security/user_map.conf"
#define skip(what) while (*s && (what)) s++
+#define SYSLOG_DEBUG if (mode_debug) pam_syslog
#define GROUP_BUFFER_SIZE 100
-
+static const char debug_keyword[]= "debug";
static int populate_user_groups(const char *user, gid_t **groups)
{
@@ -128,10 +150,6 @@ static void print_groups(pam_handle_t *pamh, const gid_t *user_groups, int ng)
ng, (ng == 1) ? "group" : "groups", buf+1);
}
-
-static const char debug_keyword[]= "debug";
-#define SYSLOG_DEBUG if (mode_debug) pam_syslog
-
int pam_sm_authenticate(pam_handle_t *pamh, int flags,
int argc, const char *argv[])
{
diff --git a/sql/log_event.cc b/sql/log_event.cc
index 838a084de42..d7113b12743 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -9020,8 +9020,16 @@ int Xid_log_event::do_apply_event(rpl_group_info *rgi)
res= trans_commit(thd); /* Automatically rolls back on error. */
thd->mdl_context.release_transactional_locks();
+#ifdef WITH_WSREP
+ if (WSREP(thd)) mysql_mutex_lock(&thd->LOCK_thd_data);
+ if ((!res || (WSREP(thd) && thd->wsrep_conflict_state == MUST_REPLAY)) && sub_id)
+#else
if (likely(!res) && sub_id)
+#endif /* WITH_WSREP */
rpl_global_gtid_slave_state->update_state_hash(sub_id, &gtid, hton, rgi);
+#ifdef WITH_WSREP
+ if (WSREP(thd)) mysql_mutex_unlock(&thd->LOCK_thd_data);
+#endif /* WITH_WSREP */
/*
Increment the global status commit count variable
diff --git a/sql/slave.cc b/sql/slave.cc
index 08b8b990837..709834df06c 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -3914,14 +3914,34 @@ apply_event_and_update_pos_apply(Log_event* ev, THD* thd, rpl_group_info *rgi,
exec_res= ev->apply_event(rgi);
#ifdef WITH_WSREP
- if (exec_res && thd->wsrep_conflict_state != NO_CONFLICT)
- {
+ if (exec_res)
+ {
+ switch (thd->wsrep_conflict_state) {
+ case NO_CONFLICT: break;
+ case MUST_REPLAY:
+ WSREP_DEBUG("SQL apply failed for MUST_REPLAY, res %d", exec_res);
+ mysql_mutex_lock(&thd->LOCK_thd_data);
+ wsrep_replay_transaction(thd);
+ switch (thd->wsrep_conflict_state) {
+ case NO_CONFLICT:
+ exec_res = 0; /* replaying succeeded, and slave may continue */
+ break;
+ case ABORTED: break; /* replaying has failed, trx is rolled back */
+ default:
+ WSREP_WARN("unexpected result of slave transaction replaying: %lld, %d",
+ thd->thread_id, thd->wsrep_conflict_state);
+ }
+ mysql_mutex_unlock(&thd->LOCK_thd_data);
+ break;
+ default:
WSREP_DEBUG("SQL apply failed, res %d conflict state: %d",
exec_res, thd->wsrep_conflict_state);
rli->abort_slave= 1;
rli->report(ERROR_LEVEL, ER_UNKNOWN_COM_ERROR, rgi->gtid_info(),
"Node has dropped from cluster");
+ break;
}
+ }
#endif
#ifndef DBUG_OFF
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index bddbec26d67..2a382dc7666 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -8033,10 +8033,10 @@ alter:
lex->server_options.reset($3);
} OPTIONS_SYM '(' server_options_list ')' { }
/* ALTER USER foo is allowed for MySQL compatibility. */
- | ALTER opt_if_exists USER_SYM clear_privileges grant_list
+ | ALTER USER_SYM opt_if_exists clear_privileges grant_list
opt_require_clause opt_resource_options
{
- Lex->create_info.set($2);
+ Lex->create_info.set($3);
Lex->sql_command= SQLCOM_ALTER_USER;
}
| ALTER SEQUENCE_SYM opt_if_exists
diff --git a/sql/wsrep_thd.cc b/sql/wsrep_thd.cc
index 8674366a71f..6f7dd002a1a 100644
--- a/sql/wsrep_thd.cc
+++ b/sql/wsrep_thd.cc
@@ -153,8 +153,9 @@ static void wsrep_prepare_bf_thd(THD *thd, struct wsrep_thd_shadow* shadow)
if (!thd->wsrep_rgi) thd->wsrep_rgi= wsrep_relay_group_init("wsrep_relay");
/* thd->system_thread_info.rpl_sql_info isn't initialized. */
- thd->system_thread_info.rpl_sql_info=
- new rpl_sql_thread_info(thd->wsrep_rgi->rli->mi->rpl_filter);
+ if (!thd->slave_thread)
+ thd->system_thread_info.rpl_sql_info=
+ new rpl_sql_thread_info(thd->wsrep_rgi->rli->mi->rpl_filter);
thd->wsrep_exec_mode= REPL_RECV;
thd->net.vio= 0;
@@ -182,7 +183,8 @@ static void wsrep_return_from_bf_mode(THD *thd, struct wsrep_thd_shadow* shadow)
thd->user_time = shadow->user_time;
thd->reset_db(&db);
- delete thd->system_thread_info.rpl_sql_info;
+ if (!thd->slave_thread)
+ delete thd->system_thread_info.rpl_sql_info;
delete thd->wsrep_rgi->rli->mi;
delete thd->wsrep_rgi->rli;
diff --git a/support-files/CMakeLists.txt b/support-files/CMakeLists.txt
index 6e1bbdee610..7ceccfbbf12 100644
--- a/support-files/CMakeLists.txt
+++ b/support-files/CMakeLists.txt
@@ -91,7 +91,7 @@ IF(UNIX)
ENDIF()
CONFIGURE_FILE(mariadb.pc.in ${CMAKE_CURRENT_BINARY_DIR}/mariadb.pc @ONLY)
- INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/mariadb.pc DESTINATION ${INSTALL_SHAREDIR}/pkgconfig COMPONENT Development)
+ INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/mariadb.pc DESTINATION ${INSTALL_LIBDIR}/pkgconfig COMPONENT Development)
INSTALL(FILES mysql.m4 DESTINATION ${INSTALL_SHAREDIR}/aclocal COMPONENT Development)
diff --git a/support-files/mariadb.pc.in b/support-files/mariadb.pc.in
index bc84a5c5c4c..7d321f28491 100644
--- a/support-files/mariadb.pc.in
+++ b/support-files/mariadb.pc.in
@@ -20,4 +20,4 @@ Description: @CPACK_PACKAGE_DESCRIPTION_SUMMARY@
URL: @CPACK_PACKAGE_URL@
Version: @VERSION@
Libs: -L${libdir} @LIBS_FOR_CLIENTS@
-Cflags: -I${includedir} -I${includedir}/.. @CFLAGS_FOR_CLIENTS@
+Cflags: -I${includedir} @CFLAGS_FOR_CLIENTS@
diff --git a/support-files/mariadb.service.in b/support-files/mariadb.service.in
index 509412c7623..5a8f346c31f 100644
--- a/support-files/mariadb.service.in
+++ b/support-files/mariadb.service.in
@@ -139,7 +139,7 @@ TimeoutStopSec=900
## isn't executed.
##
-# Number of files limit. previously [mysqld_safe] open-file-limit
+# Number of files limit. previously [mysqld_safe] open-files-limit
LimitNOFILE=16364
# Maximium core size. previously [mysqld_safe] core-file-size
diff --git a/support-files/mariadb@.service.in b/support-files/mariadb@.service.in
index fce35409db6..2ecf417fcf4 100644
--- a/support-files/mariadb@.service.in
+++ b/support-files/mariadb@.service.in
@@ -164,7 +164,7 @@ TimeoutStopSec=900
## isn't executed.
##
-# Number of files limit. previously [mysqld_safe] open-file-limit
+# Number of files limit. previously [mysqld_safe] open-files-limit
LimitNOFILE=16364
# Maximium core size. previously [mysqld_safe] core-file-size