Commit 0d25ee4f authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-4254 Semisync plugins to link statically into MariaDB

fix semisync plugins and tests to work with both with static and dynamic linking
parent c50ee6c2
...@@ -171,12 +171,12 @@ MACRO(MYSQL_ADD_PLUGIN) ...@@ -171,12 +171,12 @@ MACRO(MYSQL_ADD_PLUGIN)
IF(ARG_MANDATORY) IF(ARG_MANDATORY)
SET (mysql_mandatory_plugins SET (mysql_mandatory_plugins
"${mysql_mandatory_plugins} builtin_maria_${target}_plugin," "${mysql_mandatory_plugins} builtin_maria_${target}_plugin,")
PARENT_SCOPE) SET (mysql_mandatory_plugins ${mysql_mandatory_plugins} PARENT_SCOPE)
ELSE() ELSE()
SET (mysql_optional_plugins SET (mysql_optional_plugins
"${mysql_optional_plugins} builtin_maria_${target}_plugin," "${mysql_optional_plugins} builtin_maria_${target}_plugin,")
PARENT_SCOPE) SET (mysql_optional_plugins ${mysql_optional_plugins} PARENT_SCOPE)
ENDIF() ENDIF()
ELSEIF(NOT WITHOUT_${plugin} AND NOT ARG_STATIC_ONLY AND NOT WITHOUT_DYNAMIC_PLUGINS) ELSEIF(NOT WITHOUT_${plugin} AND NOT ARG_STATIC_ONLY AND NOT WITHOUT_DYNAMIC_PLUGINS)
......
if (`select count(*) < 2 from information_schema.plugins where plugin_name like 'rpl_semi_sync_%'`)
{
--skip Test requires semisync plugins
}
--plugin-load=$SEMISYNC_MASTER_SO
--plugin-load=$SEMISYNC_SLAVE_SO
--loose-rpl-semi-sync-master
--loose-rpl-semi-sync-slave
#
# Check if server has support for loading plugins
#
if (`SELECT @@have_dynamic_loading != 'YES'`) {
--skip Requires dynamic loading
}
#
# Check if the variable SEMISYNC_MASTER_SO is set
#
if (!$SEMISYNC_MASTER_SO)
{
skip Need semisync plugins;
}
include/master-slave.inc include/master-slave.inc
[connection master] [connection master]
CREATE TABLE t1 (a INT) ENGINE=MyISAM; CREATE TABLE t1 (a INT) ENGINE=MyISAM;
INSTALL PLUGIN rpl_semi_sync_master SONAME 'semisync_master';
SET GLOBAL rpl_semi_sync_master_enabled = ON; SET GLOBAL rpl_semi_sync_master_enabled = ON;
SET DEBUG_SYNC = "rpl_semisync_master_commit_trx_before_lock SIGNAL m1_ready WAIT_FOR m1_cont"; SET DEBUG_SYNC = "rpl_semisync_master_commit_trx_before_lock SIGNAL m1_ready WAIT_FOR m1_cont";
INSERT INTO t1 SELECT * FROM t1; INSERT INTO t1 SELECT * FROM t1;
...@@ -9,5 +8,4 @@ SET DEBUG_SYNC= "now WAIT_FOR m1_ready"; ...@@ -9,5 +8,4 @@ SET DEBUG_SYNC= "now WAIT_FOR m1_ready";
SET GLOBAL rpl_semi_sync_master_enabled = OFF; SET GLOBAL rpl_semi_sync_master_enabled = OFF;
SET DEBUG_SYNC= "now SIGNAL m1_cont"; SET DEBUG_SYNC= "now SIGNAL m1_cont";
DROP TABLE t1; DROP TABLE t1;
UNINSTALL PLUGIN rpl_semi_sync_master;
include/rpl_end.inc include/rpl_end.inc
include/master-slave.inc include/master-slave.inc
[connection master] [connection master]
call mtr.add_suppression("Timeout waiting for reply of binlog");
call mtr.add_suppression("Read semi-sync reply");
call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.");
call mtr.add_suppression("Master server does not support semi-sync");
call mtr.add_suppression("Semi-sync slave .* reply");
call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group");
# #
# Uninstall semi-sync plugins on master and slave # Uninstall semi-sync plugins on master and slave
# #
include/stop_slave.inc include/stop_slave.inc
reset slave;
set global rpl_semi_sync_master_enabled= 0;
set global rpl_semi_sync_slave_enabled= 0;
reset master;
set global rpl_semi_sync_master_enabled= 0;
set global rpl_semi_sync_slave_enabled= 0;
# #
# Main test of semi-sync replication start here # Main test of semi-sync replication start here
# #
[ on master ] [ on master ]
set global rpl_semi_sync_master_timeout= 60000;
[ default state of semi-sync on master should be OFF ] [ default state of semi-sync on master should be OFF ]
show variables like 'rpl_semi_sync_master_enabled'; show variables like 'rpl_semi_sync_master_enabled';
Variable_name Value Variable_name Value
...@@ -41,9 +54,7 @@ Rpl_semi_sync_master_status OFF ...@@ -41,9 +54,7 @@ Rpl_semi_sync_master_status OFF
show status like 'Rpl_semi_sync_master_yes_tx'; show status like 'Rpl_semi_sync_master_yes_tx';
Variable_name Value Variable_name Value
Rpl_semi_sync_master_yes_tx 0 Rpl_semi_sync_master_yes_tx 0
# reset master;
# INSTALL PLUGIN semi-sync on slave
#
[ on slave ] [ on slave ]
[ default state of semi-sync on slave should be OFF ] [ default state of semi-sync on slave should be OFF ]
show variables like 'rpl_semi_sync_slave_enabled'; show variables like 'rpl_semi_sync_slave_enabled';
...@@ -84,6 +95,16 @@ select CONNECTIONS_NORMAL_SLAVE - CONNECTIONS_NORMAL_SLAVE as 'Should be 0'; ...@@ -84,6 +95,16 @@ select CONNECTIONS_NORMAL_SLAVE - CONNECTIONS_NORMAL_SLAVE as 'Should be 0';
Should be 0 Should be 0
0 0
[ insert records to table ] [ insert records to table ]
insert t1 values (10);
insert t1 values (9);
insert t1 values (8);
insert t1 values (7);
insert t1 values (6);
insert t1 values (5);
insert t1 values (4);
insert t1 values (3);
insert t1 values (2);
insert t1 values (1);
[ master status after inserts ] [ master status after inserts ]
show status like 'Rpl_semi_sync_master_status'; show status like 'Rpl_semi_sync_master_status';
Variable_name Value Variable_name Value
...@@ -159,6 +180,16 @@ Rpl_semi_sync_master_no_tx 1 ...@@ -159,6 +180,16 @@ Rpl_semi_sync_master_no_tx 1
show status like 'Rpl_semi_sync_master_yes_tx'; show status like 'Rpl_semi_sync_master_yes_tx';
Variable_name Value Variable_name Value
Rpl_semi_sync_master_yes_tx 14 Rpl_semi_sync_master_yes_tx 14
delete from t1 where a=10;
delete from t1 where a=9;
delete from t1 where a=8;
delete from t1 where a=7;
delete from t1 where a=6;
delete from t1 where a=5;
delete from t1 where a=4;
delete from t1 where a=3;
delete from t1 where a=2;
delete from t1 where a=1;
insert into t1 values (100); insert into t1 values (100);
[ master status should be OFF ] [ master status should be OFF ]
show status like 'Rpl_semi_sync_master_status'; show status like 'Rpl_semi_sync_master_status';
...@@ -278,6 +309,7 @@ Rpl_semi_sync_master_yes_tx 0 ...@@ -278,6 +309,7 @@ Rpl_semi_sync_master_yes_tx 0
[ on slave ] [ on slave ]
include/stop_slave.inc include/stop_slave.inc
reset slave; reset slave;
kill query _tid;
include/start_slave.inc include/start_slave.inc
[ on master ] [ on master ]
create table t1 (a int) engine = ENGINE_TYPE; create table t1 (a int) engine = ENGINE_TYPE;
...@@ -307,6 +339,7 @@ include/stop_slave.inc ...@@ -307,6 +339,7 @@ include/stop_slave.inc
reset slave; reset slave;
[ on master ] [ on master ]
reset master; reset master;
kill query _tid;
set sql_log_bin=0; set sql_log_bin=0;
grant replication slave on *.* to rpl@127.0.0.1 identified by 'rpl_password'; grant replication slave on *.* to rpl@127.0.0.1 identified by 'rpl_password';
flush privileges; flush privileges;
...@@ -357,6 +390,7 @@ SHOW STATUS LIKE 'Rpl_semi_sync_slave_status'; ...@@ -357,6 +390,7 @@ SHOW STATUS LIKE 'Rpl_semi_sync_slave_status';
Variable_name Value Variable_name Value
Rpl_semi_sync_slave_status OFF Rpl_semi_sync_slave_status OFF
[ on master ] [ on master ]
kill query _tid;
[ Semi-sync status on master should be ON ] [ Semi-sync status on master should be ON ]
show status like 'Rpl_semi_sync_master_clients'; show status like 'Rpl_semi_sync_master_clients';
Variable_name Value Variable_name Value
...@@ -385,11 +419,7 @@ Variable_name Value ...@@ -385,11 +419,7 @@ Variable_name Value
Rpl_semi_sync_slave_status ON Rpl_semi_sync_slave_status ON
include/stop_slave.inc include/stop_slave.inc
[ on master ] [ on master ]
set sql_log_bin=0; set global rpl_semi_sync_master_enabled= 0;
UNINSTALL PLUGIN rpl_semi_sync_master;
set sql_log_bin=1;
SHOW VARIABLES LIKE 'rpl_semi_sync_master_enabled';
Variable_name Value
[ on slave ] [ on slave ]
SHOW VARIABLES LIKE 'rpl_semi_sync_slave_enabled'; SHOW VARIABLES LIKE 'rpl_semi_sync_slave_enabled';
Variable_name Value Variable_name Value
...@@ -397,18 +427,10 @@ rpl_semi_sync_slave_enabled ON ...@@ -397,18 +427,10 @@ rpl_semi_sync_slave_enabled ON
include/start_slave.inc include/start_slave.inc
[ on master ] [ on master ]
insert into t1 values (10); insert into t1 values (10);
[ on slave ]
SHOW STATUS LIKE 'Rpl_semi_sync_slave_status';
Variable_name Value
Rpl_semi_sync_slave_status OFF
# #
# Test non-semi-sync slave connect to semi-sync master # Test non-semi-sync slave connect to semi-sync master
# #
set sql_log_bin=0;
INSTALL PLUGIN rpl_semi_sync_master SONAME 'SEMISYNC_MASTER_SO';
set global rpl_semi_sync_master_timeout= 5000; set global rpl_semi_sync_master_timeout= 5000;
/* 5s */
set sql_log_bin=1;
set global rpl_semi_sync_master_enabled= 1; set global rpl_semi_sync_master_enabled= 1;
[ on slave ] [ on slave ]
include/stop_slave.inc include/stop_slave.inc
...@@ -416,16 +438,8 @@ SHOW STATUS LIKE 'Rpl_semi_sync_slave_status'; ...@@ -416,16 +438,8 @@ SHOW STATUS LIKE 'Rpl_semi_sync_slave_status';
Variable_name Value Variable_name Value
Rpl_semi_sync_slave_status OFF Rpl_semi_sync_slave_status OFF
[ uninstall semi-sync slave plugin ] [ uninstall semi-sync slave plugin ]
UNINSTALL PLUGIN rpl_semi_sync_slave;
SHOW VARIABLES LIKE 'rpl_semi_sync_slave_enabled';
Variable_name Value
include/start_slave.inc
SHOW STATUS LIKE 'Rpl_semi_sync_slave_status';
Variable_name Value
include/stop_slave.inc
[ reinstall semi-sync slave plugin and disable semi-sync ]
INSTALL PLUGIN rpl_semi_sync_slave SONAME 'SEMISYNC_SLAVE_SO';
set global rpl_semi_sync_slave_enabled= 0; set global rpl_semi_sync_slave_enabled= 0;
[ reinstall semi-sync slave plugin and disable semi-sync ]
SHOW VARIABLES LIKE 'rpl_semi_sync_slave_enabled'; SHOW VARIABLES LIKE 'rpl_semi_sync_slave_enabled';
Variable_name Value Variable_name Value
rpl_semi_sync_slave_enabled OFF rpl_semi_sync_slave_enabled OFF
...@@ -440,11 +454,12 @@ Rpl_semi_sync_slave_status OFF ...@@ -440,11 +454,12 @@ Rpl_semi_sync_slave_status OFF
# Clean up # Clean up
# #
include/stop_slave.inc include/stop_slave.inc
UNINSTALL PLUGIN rpl_semi_sync_slave; set global rpl_semi_sync_slave_enabled= 0;
UNINSTALL PLUGIN rpl_semi_sync_master; set global rpl_semi_sync_master_enabled= 0;
change master to master_user='root',master_password=''; change master to master_user='root',master_password='';
include/start_slave.inc include/start_slave.inc
drop table t1; drop table t1;
drop user rpl@127.0.0.1; drop user rpl@127.0.0.1;
flush privileges; flush privileges;
set global rpl_semi_sync_master_timeout= default;
include/rpl_end.inc include/rpl_end.inc
include/master-slave.inc include/master-slave.inc
[connection master] [connection master]
call mtr.add_suppression("Timeout waiting for reply of binlog");
call mtr.add_suppression("Semi-sync master .* waiting for slave reply");
call mtr.add_suppression("Read semi-sync reply");
call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.");
call mtr.add_suppression("Master server does not support semi-sync");
call mtr.add_suppression("Semi-sync slave .* reply");
call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group");
set global rpl_semi_sync_master_enabled = 1;
include/stop_slave.inc include/stop_slave.inc
set global rpl_semi_sync_slave_enabled = 1;
include/start_slave.inc include/start_slave.inc
SET GLOBAL event_scheduler = ON; SET GLOBAL event_scheduler = ON;
CREATE TABLE t1 (i INT NOT NULL AUTO_INCREMENT PRIMARY KEY, f varchar(8)) ENGINE=ENGINE_TYPE; CREATE TABLE t1 (i INT NOT NULL AUTO_INCREMENT PRIMARY KEY, f varchar(8)) ENGINE=ENGINE_TYPE;
...@@ -34,8 +43,8 @@ UPDATE t1 SET f = CONCAT('up_',CONNECTION_ID()) WHERE i = 2; ...@@ -34,8 +43,8 @@ UPDATE t1 SET f = CONCAT('up_',CONNECTION_ID()) WHERE i = 2;
UPDATE t1 SET f = CONCAT('up_',CONNECTION_ID()) WHERE i = 1; UPDATE t1 SET f = CONCAT('up_',CONNECTION_ID()) WHERE i = 1;
SET GLOBAL event_scheduler = OFF; SET GLOBAL event_scheduler = OFF;
include/stop_slave.inc include/stop_slave.inc
UNINSTALL PLUGIN rpl_semi_sync_slave; set global rpl_semi_sync_slave_enabled = 0;
UNINSTALL PLUGIN rpl_semi_sync_master; set global rpl_semi_sync_master_enabled = 0;
include/start_slave.inc include/start_slave.inc
DROP EVENT ev1; DROP EVENT ev1;
DROP EVENT ev2; DROP EVENT ev2;
......
include/master-slave.inc include/master-slave.inc
[connection master] [connection master]
INSTALL PLUGIN rpl_semi_sync_master SONAME 'semisync_master.so';
CREATE TEMPORARY TABLE tmp (i INT); CREATE TEMPORARY TABLE tmp (i INT);
include/rpl_end.inc include/rpl_end.inc
uninstall plugin rpl_semi_sync_master;
--source include/have_semisync_plugin.inc --source include/have_semisync.inc
--source include/not_embedded.inc --source include/not_embedded.inc
--source include/have_debug_sync.inc --source include/have_debug_sync.inc
--source include/have_binlog_format_mixed_or_statement.inc --source include/have_binlog_format_mixed_or_statement.inc
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
# the code, disable the semisync, and then continue the paused thread. # the code, disable the semisync, and then continue the paused thread.
CREATE TABLE t1 (a INT) ENGINE=MyISAM; CREATE TABLE t1 (a INT) ENGINE=MyISAM;
INSTALL PLUGIN rpl_semi_sync_master SONAME 'semisync_master';
SET GLOBAL rpl_semi_sync_master_enabled = ON; SET GLOBAL rpl_semi_sync_master_enabled = ON;
--connection master1 --connection master1
SET DEBUG_SYNC = "rpl_semisync_master_commit_trx_before_lock SIGNAL m1_ready WAIT_FOR m1_cont"; SET DEBUG_SYNC = "rpl_semisync_master_commit_trx_before_lock SIGNAL m1_ready WAIT_FOR m1_cont";
...@@ -29,8 +28,4 @@ SET DEBUG_SYNC= "now SIGNAL m1_cont"; ...@@ -29,8 +28,4 @@ SET DEBUG_SYNC= "now SIGNAL m1_cont";
connection master; connection master;
DROP TABLE t1; DROP TABLE t1;
disable_warnings;
UNINSTALL PLUGIN rpl_semi_sync_master;
enable_warnings;
--source include/rpl_end.inc --source include/rpl_end.inc
source include/have_semisync_plugin.inc; source include/have_semisync.inc;
source include/not_embedded.inc; source include/not_embedded.inc;
source include/have_innodb.inc; source include/have_innodb.inc;
source include/master-slave.inc; source include/master-slave.inc;
...@@ -7,7 +7,6 @@ let $engine_type= InnoDB; ...@@ -7,7 +7,6 @@ let $engine_type= InnoDB;
#let $engine_type= MyISAM; #let $engine_type= MyISAM;
# Suppress warnings that might be generated during the test # Suppress warnings that might be generated during the test
disable_query_log;
connection master; connection master;
call mtr.add_suppression("Timeout waiting for reply of binlog"); call mtr.add_suppression("Timeout waiting for reply of binlog");
call mtr.add_suppression("Read semi-sync reply"); call mtr.add_suppression("Read semi-sync reply");
...@@ -16,7 +15,6 @@ connection slave; ...@@ -16,7 +15,6 @@ connection slave;
call mtr.add_suppression("Master server does not support semi-sync"); call mtr.add_suppression("Master server does not support semi-sync");
call mtr.add_suppression("Semi-sync slave .* reply"); call mtr.add_suppression("Semi-sync slave .* reply");
call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group"); call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group");
enable_query_log;
connection master; connection master;
# wait for dying connections (if any) to disappear # wait for dying connections (if any) to disappear
...@@ -32,27 +30,15 @@ let $_connections_normal_slave= query_get_value(SHOW STATUS LIKE 'Threads_connec ...@@ -32,27 +30,15 @@ let $_connections_normal_slave= query_get_value(SHOW STATUS LIKE 'Threads_connec
--echo # Uninstall semi-sync plugins on master and slave --echo # Uninstall semi-sync plugins on master and slave
--echo # --echo #
connection slave; connection slave;
disable_query_log;
source include/stop_slave.inc; source include/stop_slave.inc;
reset slave; reset slave;
disable_warnings; set global rpl_semi_sync_master_enabled= 0;
error 0,1305; set global rpl_semi_sync_slave_enabled= 0;
UNINSTALL PLUGIN rpl_semi_sync_slave;
error 0,1305;
UNINSTALL PLUGIN rpl_semi_sync_master;
enable_warnings;
connection master; connection master;
reset master; reset master;
set sql_log_bin=0; set global rpl_semi_sync_master_enabled= 0;
disable_warnings; set global rpl_semi_sync_slave_enabled= 0;
error 0,1305;
UNINSTALL PLUGIN rpl_semi_sync_slave;
error 0,1305;
UNINSTALL PLUGIN rpl_semi_sync_master;
enable_warnings;
set sql_log_bin=1;
enable_query_log;
--echo # --echo #
--echo # Main test of semi-sync replication start here --echo # Main test of semi-sync replication start here
...@@ -61,16 +47,7 @@ enable_query_log; ...@@ -61,16 +47,7 @@ enable_query_log;
connection master; connection master;
echo [ on master ]; echo [ on master ];
disable_query_log; set global rpl_semi_sync_master_timeout= 60000; # 60s
let $value = query_get_value(show variables like 'rpl_semi_sync_master_enabled', Value, 1);
if ($value == No such row)
{
set sql_log_bin=0;
eval INSTALL PLUGIN rpl_semi_sync_master SONAME '$SEMISYNC_MASTER_SO';
set global rpl_semi_sync_master_timeout= 60000; /* 60s */
set sql_log_bin=1;
}
enable_query_log;
echo [ default state of semi-sync on master should be OFF ]; echo [ default state of semi-sync on master should be OFF ];
show variables like 'rpl_semi_sync_master_enabled'; show variables like 'rpl_semi_sync_master_enabled';
...@@ -116,28 +93,12 @@ show status like 'Rpl_semi_sync_master_status'; ...@@ -116,28 +93,12 @@ show status like 'Rpl_semi_sync_master_status';
--replace_result 305 304 --replace_result 305 304
show status like 'Rpl_semi_sync_master_yes_tx'; show status like 'Rpl_semi_sync_master_yes_tx';
disable_query_log;
# reset master to make sure the following test will start with a clean environment # reset master to make sure the following test will start with a clean environment
reset master; reset master;
enable_query_log;
--echo #
--echo # INSTALL PLUGIN semi-sync on slave
--echo #
connection slave; connection slave;
echo [ on slave ]; echo [ on slave ];
disable_query_log;
let $value= query_get_value(show variables like 'rpl_semi_sync_slave_enabled', Value, 1);
if ($value == No such row)
{
set sql_log_bin=0;
eval INSTALL PLUGIN rpl_semi_sync_slave SONAME '$SEMISYNC_SLAVE_SO';
set sql_log_bin=1;
}
enable_query_log;
echo [ default state of semi-sync on slave should be OFF ]; echo [ default state of semi-sync on slave should be OFF ];
show variables like 'rpl_semi_sync_slave_enabled'; show variables like 'rpl_semi_sync_slave_enabled';
...@@ -177,15 +138,17 @@ let $_connections_semisync_slave= query_get_value(SHOW STATUS LIKE 'Threads_conn ...@@ -177,15 +138,17 @@ let $_connections_semisync_slave= query_get_value(SHOW STATUS LIKE 'Threads_conn
replace_result $_connections_normal_slave CONNECTIONS_NORMAL_SLAVE $_connections_semisync_slave CONNECTIONS_SEMISYNC_SLAVE; replace_result $_connections_normal_slave CONNECTIONS_NORMAL_SLAVE $_connections_semisync_slave CONNECTIONS_SEMISYNC_SLAVE;
eval select $_connections_semisync_slave - $_connections_normal_slave as 'Should be 0'; eval select $_connections_semisync_slave - $_connections_normal_slave as 'Should be 0';
let $i=10;
echo [ insert records to table ]; echo [ insert records to table ];
disable_query_log; insert t1 values (10);
while ($i) insert t1 values (9);
{ insert t1 values (8);
eval insert into t1 values ($i); insert t1 values (7);
dec $i; insert t1 values (6);
} insert t1 values (5);
enable_query_log; insert t1 values (4);
insert t1 values (3);
insert t1 values (2);
insert t1 values (1);
echo [ master status after inserts ]; echo [ master status after inserts ];
show status like 'Rpl_semi_sync_master_status'; show status like 'Rpl_semi_sync_master_status';
...@@ -271,14 +234,16 @@ show status like 'Rpl_semi_sync_master_yes_tx'; ...@@ -271,14 +234,16 @@ show status like 'Rpl_semi_sync_master_yes_tx';
# Semi-sync status on master is now OFF, so all these transactions # Semi-sync status on master is now OFF, so all these transactions
# will be replicated asynchronously. # will be replicated asynchronously.
let $i=10; delete from t1 where a=10;
disable_query_log; delete from t1 where a=9;
while ($i) delete from t1 where a=8;
{ delete from t1 where a=7;
eval delete from t1 where a=$i; delete from t1 where a=6;
dec $i; delete from t1 where a=5;
} delete from t1 where a=4;
enable_query_log; delete from t1 where a=3;
delete from t1 where a=2;
delete from t1 where a=1;
insert into t1 values (100); insert into t1 values (100);
...@@ -408,9 +373,8 @@ connection master; ...@@ -408,9 +373,8 @@ connection master;
let $_tid= `select id from information_schema.processlist where command = 'Binlog Dump' limit 1`; let $_tid= `select id from information_schema.processlist where command = 'Binlog Dump' limit 1`;
if ($_tid) if ($_tid)
{ {
disable_query_log; --replace_result $_tid _tid
eval kill query $_tid; eval kill query $_tid;
enable_query_log;
# After dump thread exit, Rpl_semi_sync_master_clients will be 0 # After dump thread exit, Rpl_semi_sync_master_clients will be 0
let $status_var= Rpl_semi_sync_master_clients; let $status_var= Rpl_semi_sync_master_clients;
...@@ -463,9 +427,8 @@ reset master; ...@@ -463,9 +427,8 @@ reset master;
let $_tid= `select id from information_schema.processlist where command = 'Binlog Dump' limit 1`; let $_tid= `select id from information_schema.processlist where command = 'Binlog Dump' limit 1`;
if ($_tid) if ($_tid)
{ {
disable_query_log; --replace_result $_tid _tid
eval kill query $_tid; eval kill query $_tid;
enable_query_log;
# After dump thread exit, Rpl_semi_sync_master_clients will be 0 # After dump thread exit, Rpl_semi_sync_master_clients will be 0
let $status_var= Rpl_semi_sync_master_clients; let $status_var= Rpl_semi_sync_master_clients;
...@@ -525,9 +488,8 @@ echo [ on master ]; ...@@ -525,9 +488,8 @@ echo [ on master ];
let $_tid= `select id from information_schema.processlist where command = 'Binlog Dump' limit 1`; let $_tid= `select id from information_schema.processlist where command = 'Binlog Dump' limit 1`;
if ($_tid) if ($_tid)
{ {
disable_query_log; --replace_result $_tid _tid
eval kill query $_tid; eval kill query $_tid;
enable_query_log;
# After dump thread exit, Rpl_semi_sync_master_clients will be 0 # After dump thread exit, Rpl_semi_sync_master_clients will be 0
let $status_var= Rpl_semi_sync_master_clients; let $status_var= Rpl_semi_sync_master_clients;
...@@ -562,11 +524,7 @@ connection slave; ...@@ -562,11 +524,7 @@ connection slave;
source include/stop_slave.inc; source include/stop_slave.inc;
connection master; connection master;
echo [ on master ]; echo [ on master ];
set sql_log_bin=0; set global rpl_semi_sync_master_enabled= 0;
UNINSTALL PLUGIN rpl_semi_sync_master;
set sql_log_bin=1;
enable_query_log;
SHOW VARIABLES LIKE 'rpl_semi_sync_master_enabled';
connection slave; connection slave;
echo [ on slave ]; echo [ on slave ];
...@@ -577,19 +535,13 @@ connection master; ...@@ -577,19 +535,13 @@ connection master;
echo [ on master ]; echo [ on master ];
insert into t1 values (10); insert into t1 values (10);
sync_slave_with_master; sync_slave_with_master;
echo [ on slave ];
SHOW STATUS LIKE 'Rpl_semi_sync_slave_status';
--echo # --echo #
--echo # Test non-semi-sync slave connect to semi-sync master --echo # Test non-semi-sync slave connect to semi-sync master
--echo # --echo #
connection master; connection master;
set sql_log_bin=0; set global rpl_semi_sync_master_timeout= 5000; # 5s
replace_result $SEMISYNC_MASTER_SO SEMISYNC_MASTER_SO;
eval INSTALL PLUGIN rpl_semi_sync_master SONAME '$SEMISYNC_MASTER_SO';
set global rpl_semi_sync_master_timeout= 5000; /* 5s */
set sql_log_bin=1;
set global rpl_semi_sync_master_enabled= 1; set global rpl_semi_sync_master_enabled= 1;
connection slave; connection slave;
...@@ -598,16 +550,9 @@ source include/stop_slave.inc; ...@@ -598,16 +550,9 @@ source include/stop_slave.inc;
SHOW STATUS LIKE 'Rpl_semi_sync_slave_status'; SHOW STATUS LIKE 'Rpl_semi_sync_slave_status';
echo [ uninstall semi-sync slave plugin ]; echo [ uninstall semi-sync slave plugin ];
UNINSTALL PLUGIN rpl_semi_sync_slave; set global rpl_semi_sync_slave_enabled= 0;
SHOW VARIABLES LIKE 'rpl_semi_sync_slave_enabled';
source include/start_slave.inc;
SHOW STATUS LIKE 'Rpl_semi_sync_slave_status';
source include/stop_slave.inc;
echo [ reinstall semi-sync slave plugin and disable semi-sync ]; echo [ reinstall semi-sync slave plugin and disable semi-sync ];
replace_result $SEMISYNC_SLAVE_SO SEMISYNC_SLAVE_SO;
eval INSTALL PLUGIN rpl_semi_sync_slave SONAME '$SEMISYNC_SLAVE_SO';
set global rpl_semi_sync_slave_enabled= 0;
SHOW VARIABLES LIKE 'rpl_semi_sync_slave_enabled'; SHOW VARIABLES LIKE 'rpl_semi_sync_slave_enabled';
SHOW STATUS LIKE 'Rpl_semi_sync_slave_status'; SHOW STATUS LIKE 'Rpl_semi_sync_slave_status';
source include/start_slave.inc; source include/start_slave.inc;
...@@ -619,14 +564,10 @@ SHOW STATUS LIKE 'Rpl_semi_sync_slave_status'; ...@@ -619,14 +564,10 @@ SHOW STATUS LIKE 'Rpl_semi_sync_slave_status';
connection slave; connection slave;
source include/stop_slave.inc; source include/stop_slave.inc;
UNINSTALL PLUGIN rpl_semi_sync_slave; set global rpl_semi_sync_slave_enabled= 0;
connection master; connection master;
# The dump thread may still be running on the master, and so the following set global rpl_semi_sync_master_enabled= 0;
# UNINSTALL could generate a warning about the plugin is busy.
disable_warnings;
UNINSTALL PLUGIN rpl_semi_sync_master;
enable_warnings;
connection slave; connection slave;
change master to master_user='root',master_password=''; change master to master_user='root',master_password='';
...@@ -639,4 +580,5 @@ sync_slave_with_master; ...@@ -639,4 +580,5 @@ sync_slave_with_master;
connection master; connection master;
drop user rpl@127.0.0.1; drop user rpl@127.0.0.1;
flush privileges; flush privileges;
set global rpl_semi_sync_master_timeout= default;
--source include/rpl_end.inc --source include/rpl_end.inc
source include/have_semisync_plugin.inc; source include/have_semisync.inc;
source include/not_embedded.inc; source include/not_embedded.inc;
source include/master-slave.inc;
source include/have_innodb.inc; source include/have_innodb.inc;
source include/master-slave.inc;
let $engine_type= InnoDB; let $engine_type= InnoDB;
# Suppress warnings that might be generated during the test # Suppress warnings that might be generated during the test
disable_query_log;
connection master; connection master;
call mtr.add_suppression("Timeout waiting for reply of binlog"); call mtr.add_suppression("Timeout waiting for reply of binlog");
call mtr.add_suppression("Semi-sync master .* waiting for slave reply"); call mtr.add_suppression("Semi-sync master .* waiting for slave reply");
...@@ -16,33 +15,13 @@ connection slave; ...@@ -16,33 +15,13 @@ connection slave;
call mtr.add_suppression("Master server does not support semi-sync"); call mtr.add_suppression("Master server does not support semi-sync");
call mtr.add_suppression("Semi-sync slave .* reply"); call mtr.add_suppression("Semi-sync slave .* reply");
call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group"); call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group");
enable_query_log;
connection master; connection master;
disable_query_log; set global rpl_semi_sync_master_enabled = 1;
let $value = query_get_value(show variables like 'rpl_semi_sync_master_enabled', Value, 1);
if ($value == No such row)
{
set sql_log_bin=0;
eval INSTALL PLUGIN rpl_semi_sync_master SONAME '$SEMISYNC_MASTER_SO';
SET GLOBAL rpl_semi_sync_master_enabled = 1;
set sql_log_bin=1;
}
enable_query_log;
connection slave; connection slave;
source include/stop_slave.inc; source include/stop_slave.inc;
set global rpl_semi_sync_slave_enabled = 1;
disable_query_log;
let $value= query_get_value(show variables like 'rpl_semi_sync_slave_enabled', Value, 1);
if ($value == No such row)
{
set sql_log_bin=0;
eval INSTALL PLUGIN rpl_semi_sync_slave SONAME '$SEMISYNC_SLAVE_SO';
SET GLOBAL rpl_semi_sync_slave_enabled = 1;
set sql_log_bin=1;
}
enable_query_log;
source include/start_slave.inc; source include/start_slave.inc;
...@@ -93,18 +72,16 @@ while ($run) ...@@ -93,18 +72,16 @@ while ($run)
# #
connection slave; connection slave;
source include/stop_slave.inc; source include/stop_slave.inc;
set global rpl_semi_sync_slave_enabled = 0;
disable_warnings;
UNINSTALL PLUGIN rpl_semi_sync_slave;
connection master; connection master;
UNINSTALL PLUGIN rpl_semi_sync_master; set global rpl_semi_sync_master_enabled = 0;
enable_warnings;
connection slave; connection slave;
source include/start_slave.inc; source include/start_slave.inc;
connection master; connection master;
DROP EVENT ev1; DROP EVENT ev1;
DROP EVENT ev2; DROP EVENT ev2;
DROP TABLE t1; DROP TABLE t1;
......
# #
# MDEV-4066 semisync_master + temporary tables causes memory leaks # MDEV-4066 semisync_master + temporary tables causes memory leaks
# #
source include/have_semisync_plugin.inc; source include/have_semisync.inc;
source include/have_binlog_format_row.inc; source include/have_binlog_format_row.inc;
source include/master-slave.inc; source include/master-slave.inc;
connection master; connection master;
--replace_result .dll .so
eval INSTALL PLUGIN rpl_semi_sync_master SONAME '$SEMISYNC_MASTER_SO';
--connect (con1,localhost,root,,) --connect (con1,localhost,root,,)
CREATE TEMPORARY TABLE tmp (i INT); CREATE TEMPORARY TABLE tmp (i INT);
--disconnect con1 --disconnect con1
source include/rpl_end.inc; source include/rpl_end.inc;
uninstall plugin rpl_semi_sync_master;
INSTALL PLUGIN rpl_semi_sync_master SONAME 'semisync_master.so';
select @@global.rpl_semi_sync_master_enabled; select @@global.rpl_semi_sync_master_enabled;
@@global.rpl_semi_sync_master_enabled @@global.rpl_semi_sync_master_enabled
0 0
...@@ -70,4 +69,3 @@ SET @@global.rpl_semi_sync_master_enabled = @start_global_value; ...@@ -70,4 +69,3 @@ SET @@global.rpl_semi_sync_master_enabled = @start_global_value;
select @@global.rpl_semi_sync_master_enabled; select @@global.rpl_semi_sync_master_enabled;
@@global.rpl_semi_sync_master_enabled @@global.rpl_semi_sync_master_enabled
0 0
UNINSTALL PLUGIN rpl_semi_sync_master;
INSTALL PLUGIN rpl_semi_sync_master SONAME 'semisync_master.so';
select @@global.rpl_semi_sync_master_timeout; select @@global.rpl_semi_sync_master_timeout;
@@global.rpl_semi_sync_master_timeout @@global.rpl_semi_sync_master_timeout
10000 10000
...@@ -51,4 +50,3 @@ SET @@global.rpl_semi_sync_master_timeout = @start_global_value; ...@@ -51,4 +50,3 @@ SET @@global.rpl_semi_sync_master_timeout = @start_global_value;
select @@global.rpl_semi_sync_master_timeout; select @@global.rpl_semi_sync_master_timeout;
@@global.rpl_semi_sync_master_timeout @@global.rpl_semi_sync_master_timeout
10000 10000
UNINSTALL PLUGIN rpl_semi_sync_master;
INSTALL PLUGIN rpl_semi_sync_master SONAME 'semisync_master.so';
select @@global.rpl_semi_sync_master_trace_level; select @@global.rpl_semi_sync_master_trace_level;
@@global.rpl_semi_sync_master_trace_level @@global.rpl_semi_sync_master_trace_level
32 32
...@@ -69,4 +68,3 @@ SET @@global.rpl_semi_sync_master_trace_level = @start_global_value; ...@@ -69,4 +68,3 @@ SET @@global.rpl_semi_sync_master_trace_level = @start_global_value;
select @@global.rpl_semi_sync_master_trace_level; select @@global.rpl_semi_sync_master_trace_level;
@@global.rpl_semi_sync_master_trace_level @@global.rpl_semi_sync_master_trace_level
32 32
UNINSTALL PLUGIN rpl_semi_sync_master;
INSTALL PLUGIN rpl_semi_sync_master SONAME 'semisync_master.so';
select @@global.rpl_semi_sync_master_wait_no_slave; select @@global.rpl_semi_sync_master_wait_no_slave;
@@global.rpl_semi_sync_master_wait_no_slave @@global.rpl_semi_sync_master_wait_no_slave
1 1
...@@ -70,4 +69,3 @@ SET @@global.rpl_semi_sync_master_wait_no_slave = @start_global_value; ...@@ -70,4 +69,3 @@ SET @@global.rpl_semi_sync_master_wait_no_slave = @start_global_value;
select @@global.rpl_semi_sync_master_wait_no_slave; select @@global.rpl_semi_sync_master_wait_no_slave;
@@global.rpl_semi_sync_master_wait_no_slave @@global.rpl_semi_sync_master_wait_no_slave
1 1
UNINSTALL PLUGIN rpl_semi_sync_master;
INSTALL PLUGIN rpl_semi_sync_slave SONAME 'semisync_slave.so';
select @@global.rpl_semi_sync_slave_enabled; select @@global.rpl_semi_sync_slave_enabled;
@@global.rpl_semi_sync_slave_enabled @@global.rpl_semi_sync_slave_enabled
0 0
...@@ -70,4 +69,3 @@ SET @@global.rpl_semi_sync_slave_enabled = @start_global_value; ...@@ -70,4 +69,3 @@ SET @@global.rpl_semi_sync_slave_enabled = @start_global_value;
select @@global.rpl_semi_sync_slave_enabled; select @@global.rpl_semi_sync_slave_enabled;
@@global.rpl_semi_sync_slave_enabled @@global.rpl_semi_sync_slave_enabled
0 0
UNINSTALL PLUGIN rpl_semi_sync_slave;
INSTALL PLUGIN rpl_semi_sync_slave SONAME 'semisync_slave.so';
select @@global.rpl_semi_sync_slave_trace_level; select @@global.rpl_semi_sync_slave_trace_level;
@@global.rpl_semi_sync_slave_trace_level @@global.rpl_semi_sync_slave_trace_level
32 32
...@@ -69,4 +68,3 @@ SET @@global.rpl_semi_sync_slave_trace_level = @start_global_value; ...@@ -69,4 +68,3 @@ SET @@global.rpl_semi_sync_slave_trace_level = @start_global_value;
select @@global.rpl_semi_sync_slave_trace_level; select @@global.rpl_semi_sync_slave_trace_level;
@@global.rpl_semi_sync_slave_trace_level @@global.rpl_semi_sync_slave_trace_level
32 32
UNINSTALL PLUGIN rpl_semi_sync_slave;
...@@ -6,10 +6,7 @@ ...@@ -6,10 +6,7 @@
# #
# #
source include/not_embedded.inc; source include/not_embedded.inc;
source include/have_semisync_plugin.inc; source include/have_semisync.inc;
# The following is to prevent a mis-match on windows that has the name of of the lib ending with 'dll'
--replace_regex /\.dll/.so/
eval INSTALL PLUGIN rpl_semi_sync_master SONAME '$SEMISYNC_MASTER_SO';
select @@global.rpl_semi_sync_master_enabled; select @@global.rpl_semi_sync_master_enabled;
SET @start_global_value = @@global.rpl_semi_sync_master_enabled; SET @start_global_value = @@global.rpl_semi_sync_master_enabled;
...@@ -61,5 +58,3 @@ set global rpl_semi_sync_master_enabled="some text"; ...@@ -61,5 +58,3 @@ set global rpl_semi_sync_master_enabled="some text";
# #
SET @@global.rpl_semi_sync_master_enabled = @start_global_value; SET @@global.rpl_semi_sync_master_enabled = @start_global_value;
select @@global.rpl_semi_sync_master_enabled; select @@global.rpl_semi_sync_master_enabled;
UNINSTALL PLUGIN rpl_semi_sync_master;
...@@ -5,10 +5,7 @@ ...@@ -5,10 +5,7 @@
# 2010-01-21 OBN - Added # 2010-01-21 OBN - Added
# #
source include/not_embedded.inc; source include/not_embedded.inc;
source include/have_semisync_plugin.inc; source include/have_semisync.inc;
# The following is to prevent a mis-match on windows that has the name of of the lib ending with 'dll'
--replace_regex /\.dll/.so/
eval INSTALL PLUGIN rpl_semi_sync_master SONAME '$SEMISYNC_MASTER_SO';
select @@global.rpl_semi_sync_master_timeout; select @@global.rpl_semi_sync_master_timeout;
SET @start_global_value = @@global.rpl_semi_sync_master_timeout; SET @start_global_value = @@global.rpl_semi_sync_master_timeout;
...@@ -51,5 +48,3 @@ set global rpl_semi_sync_master_timeout="some text"; ...@@ -51,5 +48,3 @@ set global rpl_semi_sync_master_timeout="some text";
# #
SET @@global.rpl_semi_sync_master_timeout = @start_global_value; SET @@global.rpl_semi_sync_master_timeout = @start_global_value;
select @@global.rpl_semi_sync_master_timeout; select @@global.rpl_semi_sync_master_timeout;
UNINSTALL PLUGIN rpl_semi_sync_master;
...@@ -5,10 +5,7 @@ ...@@ -5,10 +5,7 @@
# 2010-01-21 OBN - Added # 2010-01-21 OBN - Added
# #
source include/not_embedded.inc; source include/not_embedded.inc;
source include/have_semisync_plugin.inc; source include/have_semisync.inc;
# The following is to prevent a mis-match on windows that has the name of of the lib ending with 'dll'
--replace_regex /\.dll/.so/
eval INSTALL PLUGIN rpl_semi_sync_master SONAME '$SEMISYNC_MASTER_SO';
select @@global.rpl_semi_sync_master_trace_level; select @@global.rpl_semi_sync_master_trace_level;
SET @start_global_value = @@global.rpl_semi_sync_master_trace_level; SET @start_global_value = @@global.rpl_semi_sync_master_trace_level;
...@@ -59,5 +56,3 @@ set global rpl_semi_sync_master_trace_level="some text"; ...@@ -59,5 +56,3 @@ set global rpl_semi_sync_master_trace_level="some text";
# #
SET @@global.rpl_semi_sync_master_trace_level = @start_global_value; SET @@global.rpl_semi_sync_master_trace_level = @start_global_value;
select @@global.rpl_semi_sync_master_trace_level; select @@global.rpl_semi_sync_master_trace_level;
UNINSTALL PLUGIN rpl_semi_sync_master;
...@@ -6,10 +6,7 @@ ...@@ -6,10 +6,7 @@
# #
# #
source include/not_embedded.inc; source include/not_embedded.inc;
source include/have_semisync_plugin.inc; source include/have_semisync.inc;
# The following is to prevent a mis-match on windows that has the name of of the lib ending with 'dll'
--replace_regex /\.dll/.so/
eval INSTALL PLUGIN rpl_semi_sync_master SONAME '$SEMISYNC_MASTER_SO';
select @@global.rpl_semi_sync_master_wait_no_slave; select @@global.rpl_semi_sync_master_wait_no_slave;
SET @start_global_value = @@global.rpl_semi_sync_master_wait_no_slave; SET @start_global_value = @@global.rpl_semi_sync_master_wait_no_slave;
...@@ -61,5 +58,4 @@ set global rpl_semi_sync_master_wait_no_slave="some text"; ...@@ -61,5 +58,4 @@ set global rpl_semi_sync_master_wait_no_slave="some text";
# #
SET @@global.rpl_semi_sync_master_wait_no_slave = @start_global_value; SET @@global.rpl_semi_sync_master_wait_no_slave = @start_global_value;
select @@global.rpl_semi_sync_master_wait_no_slave; select @@global.rpl_semi_sync_master_wait_no_slave;
UNINSTALL PLUGIN rpl_semi_sync_master;
...@@ -6,10 +6,7 @@ ...@@ -6,10 +6,7 @@
# #
# #
source include/not_embedded.inc; source include/not_embedded.inc;
source include/have_semisync_plugin.inc; source include/have_semisync.inc;
# The following is to prevent a mis-match on windows that has the name of of the lib ending with 'dll'
--replace_regex /\.dll/.so/
eval INSTALL PLUGIN rpl_semi_sync_slave SONAME '$SEMISYNC_SLAVE_SO';
select @@global.rpl_semi_sync_slave_enabled; select @@global.rpl_semi_sync_slave_enabled;
SET @start_global_value = @@global.rpl_semi_sync_slave_enabled; SET @start_global_value = @@global.rpl_semi_sync_slave_enabled;
...@@ -62,5 +59,3 @@ set global rpl_semi_sync_slave_enabled="some text"; ...@@ -62,5 +59,3 @@ set global rpl_semi_sync_slave_enabled="some text";
# #
SET @@global.rpl_semi_sync_slave_enabled = @start_global_value; SET @@global.rpl_semi_sync_slave_enabled = @start_global_value;
select @@global.rpl_semi_sync_slave_enabled; select @@global.rpl_semi_sync_slave_enabled;
UNINSTALL PLUGIN rpl_semi_sync_slave;
...@@ -5,10 +5,7 @@ ...@@ -5,10 +5,7 @@
# 2010-01-21 OBN - Added # 2010-01-21 OBN - Added
# #
source include/not_embedded.inc; source include/not_embedded.inc;
source include/have_semisync_plugin.inc; source include/have_semisync.inc;
# The following is to prevent a mis-match on windows that has the name of of the lib ending with 'dll'
--replace_regex /\.dll/.so/
eval INSTALL PLUGIN rpl_semi_sync_slave SONAME '$SEMISYNC_SLAVE_SO';
select @@global.rpl_semi_sync_slave_trace_level; select @@global.rpl_semi_sync_slave_trace_level;
SET @start_global_value = @@global.rpl_semi_sync_slave_trace_level; SET @start_global_value = @@global.rpl_semi_sync_slave_trace_level;
...@@ -59,5 +56,3 @@ set global rpl_semi_sync_slave_trace_level="some text"; ...@@ -59,5 +56,3 @@ set global rpl_semi_sync_slave_trace_level="some text";
# #
SET @@global.rpl_semi_sync_slave_trace_level = @start_global_value; SET @@global.rpl_semi_sync_slave_trace_level = @start_global_value;
select @@global.rpl_semi_sync_slave_trace_level; select @@global.rpl_semi_sync_slave_trace_level;
UNINSTALL PLUGIN rpl_semi_sync_slave;
...@@ -27,7 +27,7 @@ perl; ...@@ -27,7 +27,7 @@ perl;
feedback debug temp-pool ssl des-key-file xtradb sequence feedback debug temp-pool ssl des-key-file xtradb sequence
thread-concurrency super-large-pages mutex-deadlock-detector thread-concurrency super-large-pages mutex-deadlock-detector
null-audit aria pbxt oqgraph sphinx thread-handling null-audit aria pbxt oqgraph sphinx thread-handling
test-sql-discovery query-cache-info/; test-sql-discovery rpl-semi-sync query-cache-info/;
# And substitute the content some environment variables with their # And substitute the content some environment variables with their
# names: # names:
......
...@@ -17,11 +17,10 @@ SET(SEMISYNC_MASTER_SOURCES ...@@ -17,11 +17,10 @@ SET(SEMISYNC_MASTER_SOURCES
semisync.cc semisync_master.cc semisync_master_plugin.cc semisync.cc semisync_master.cc semisync_master_plugin.cc
semisync.h semisync_master.h) semisync.h semisync_master.h)
MYSQL_ADD_PLUGIN(semisync_master ${SEMISYNC_MASTER_SOURCES} MYSQL_ADD_PLUGIN(semisync_master ${SEMISYNC_MASTER_SOURCES})
MODULE_ONLY MODULE_OUTPUT_NAME "semisync_master")
SET(SEMISYNC_SLAVE_SOURCES semisync.cc semisync_slave.cc SET(SEMISYNC_SLAVE_SOURCES semisync.cc semisync_slave.cc
semisync_slave_plugin.cc semisync.h semisync_slave.h ) semisync_slave_plugin.cc semisync.h semisync_slave.h )
MYSQL_ADD_PLUGIN(semisync_slave ${SEMISYNC_SLAVE_SOURCES}
MODULE_ONLY MODULE_OUTPUT_NAME "semisync_slave") MYSQL_ADD_PLUGIN(semisync_slave ${SEMISYNC_SLAVE_SOURCES})
...@@ -429,12 +429,13 @@ int ReplSemiSyncMaster::disableMaster() ...@@ -429,12 +429,13 @@ int ReplSemiSyncMaster::disableMaster()
return 0; return 0;
} }
ReplSemiSyncMaster::~ReplSemiSyncMaster() void ReplSemiSyncMaster::cleanup()
{ {
if (init_done_) if (init_done_)
{ {
mysql_mutex_destroy(&LOCK_binlog_); mysql_mutex_destroy(&LOCK_binlog_);
mysql_cond_destroy(&COND_binlog_send_); mysql_cond_destroy(&COND_binlog_send_);
init_done_= 0;
} }
delete active_tranxs_; delete active_tranxs_;
......
...@@ -453,7 +453,9 @@ class ReplSemiSyncMaster ...@@ -453,7 +453,9 @@ class ReplSemiSyncMaster
public: public:
ReplSemiSyncMaster(); ReplSemiSyncMaster();
~ReplSemiSyncMaster(); ~ReplSemiSyncMaster() {}
void cleanup();
bool getMasterEnabled() { bool getMasterEnabled() {
return master_enabled_; return master_enabled_;
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
#include "semisync_master.h" #include "semisync_master.h"
#include "sql_class.h" // THD #include "sql_class.h" // THD
ReplSemiSyncMaster repl_semisync; static ReplSemiSyncMaster repl_semisync;
C_MODE_START C_MODE_START
...@@ -405,6 +405,7 @@ static int semi_sync_master_plugin_deinit(void *p) ...@@ -405,6 +405,7 @@ static int semi_sync_master_plugin_deinit(void *p)
sql_print_error("unregister_binlog_transmit_observer failed"); sql_print_error("unregister_binlog_transmit_observer failed");
return 1; return 1;
} }
repl_semisync.cleanup();
sql_print_information("unregister_replicator OK"); sql_print_information("unregister_replicator OK");
return 0; return 0;
} }
...@@ -416,7 +417,7 @@ struct Mysql_replication semi_sync_master_plugin= { ...@@ -416,7 +417,7 @@ struct Mysql_replication semi_sync_master_plugin= {
/* /*
Plugin library descriptor Plugin library descriptor
*/ */
mysql_declare_plugin(semi_sync_master) maria_declare_plugin(semisync_master)
{ {
MYSQL_REPLICATION_PLUGIN, MYSQL_REPLICATION_PLUGIN,
&semi_sync_master_plugin, &semi_sync_master_plugin,
...@@ -429,7 +430,8 @@ mysql_declare_plugin(semi_sync_master) ...@@ -429,7 +430,8 @@ mysql_declare_plugin(semi_sync_master)
0x0100 /* 1.0 */, 0x0100 /* 1.0 */,
semi_sync_master_status_vars, /* status variables */ semi_sync_master_status_vars, /* status variables */
semi_sync_master_system_vars, /* system variables */ semi_sync_master_system_vars, /* system variables */
NULL, /* config options */ "1.0",
0, /* flags */ MariaDB_PLUGIN_MATURITY_UNKNOWN
} }
mysql_declare_plugin_end; maria_declare_plugin_end;
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
#include "semisync_slave.h" #include "semisync_slave.h"
#include <mysql.h> #include <mysql.h>
ReplSemiSyncSlave repl_semisync; static ReplSemiSyncSlave repl_semisync;
/* /*
indicate whether or not the slave should send a reply to the master. indicate whether or not the slave should send a reply to the master.
...@@ -212,7 +212,7 @@ struct Mysql_replication semi_sync_slave_plugin= { ...@@ -212,7 +212,7 @@ struct Mysql_replication semi_sync_slave_plugin= {
/* /*
Plugin library descriptor Plugin library descriptor
*/ */
mysql_declare_plugin(semi_sync_slave) maria_declare_plugin(semisync_slave)
{ {
MYSQL_REPLICATION_PLUGIN, MYSQL_REPLICATION_PLUGIN,
&semi_sync_slave_plugin, &semi_sync_slave_plugin,
...@@ -225,7 +225,8 @@ mysql_declare_plugin(semi_sync_slave) ...@@ -225,7 +225,8 @@ mysql_declare_plugin(semi_sync_slave)
0x0100 /* 1.0 */, 0x0100 /* 1.0 */,
semi_sync_slave_status_vars, /* status variables */ semi_sync_slave_status_vars, /* status variables */
semi_sync_slave_system_vars, /* system variables */ semi_sync_slave_system_vars, /* system variables */
NULL, /* config options */ "1.0",
0, /* flags */ MariaDB_PLUGIN_MATURITY_UNKNOWN
} }
mysql_declare_plugin_end; maria_declare_plugin_end;
...@@ -555,4 +555,24 @@ int unregister_binlog_relay_io_observer(Binlog_relay_IO_observer *observer, void ...@@ -555,4 +555,24 @@ int unregister_binlog_relay_io_observer(Binlog_relay_IO_observer *observer, void
{ {
return binlog_relay_io_delegate->remove_observer(observer, (st_plugin_int *)p); return binlog_relay_io_delegate->remove_observer(observer, (st_plugin_int *)p);
} }
#else
int register_binlog_transmit_observer(Binlog_transmit_observer *observer, void *p)
{
return 0;
}
int unregister_binlog_transmit_observer(Binlog_transmit_observer *observer, void *p)
{
return 0;
}
int register_binlog_relay_io_observer(Binlog_relay_IO_observer *observer, void *p)
{
return 0;
}
int unregister_binlog_relay_io_observer(Binlog_relay_IO_observer *observer, void *p)
{
return 0;
}
#endif /* HAVE_REPLICATION */ #endif /* HAVE_REPLICATION */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment