Skip to content

Commit e972125

Browse files
andrelkinmontywi
authored andcommitted
MDEV-13073 This part merges the Ali semisync related changes
and specifically the ack receiving functionality. Semisync is turned to be static instead of plugin so its functions are invoked at the same points as RUN_HOOKS. The RUN_HOOKS and the observer interface remain to be removed by later patch. Todo: React on killed status by repl_semisync_master.wait_after_sync(). Currently Repl_semi_sync_master::commit_trx does not check the killed status. There were few bugfixes found that are present in mysql and its unclear whether/how they are covered. Those include: Bug#15985893: GTID SKIPPED EVENTS ON MASTER CAUSE SEMI SYNC TIME-OUTS Bug#17932935 CALLING IS_SEMI_SYNC_SLAVE() IN EACH FUNCTION CALL HAS BAD PERFORMANCE Bug#20574628: SEMI-SYNC REPLICATION PERFORMANCE DEGRADES WITH A HIGH NUMBER OF THREADS
1 parent abceaa7 commit e972125

32 files changed

+1193
-691
lines changed

mysql-test/extra/rpl_tests/rpl_semi_sync.inc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ connection master;
1616
call mtr.add_suppression("Timeout waiting for reply of binlog");
1717
call mtr.add_suppression("Read semi-sync reply");
1818
call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.");
19+
call mtr.add_suppression("mysqld: Got an error reading communication packets");
1920
connection slave;
2021
call mtr.add_suppression("Master server does not support semi-sync");
2122
call mtr.add_suppression("Semi-sync slave .* reply");

mysql-test/suite/binlog_encryption/rpl_semi_sync.result

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ connection master;
44
call mtr.add_suppression("Timeout waiting for reply of binlog");
55
call mtr.add_suppression("Read semi-sync reply");
66
call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.");
7+
call mtr.add_suppression("mysqld: Got an error reading communication packets");
78
connection slave;
89
call mtr.add_suppression("Master server does not support semi-sync");
910
call mtr.add_suppression("Semi-sync slave .* reply");
@@ -176,7 +177,7 @@ Variable_name Value
176177
Rpl_semi_sync_master_yes_tx 14
177178
show status like 'Rpl_semi_sync_master_clients';
178179
Variable_name Value
179-
Rpl_semi_sync_master_clients 1
180+
Rpl_semi_sync_master_clients 0
180181
[ semi-sync replication of these transactions will fail ]
181182
insert into t1 values (500);
182183
[ master status should be OFF ]
@@ -321,7 +322,6 @@ connection slave;
321322
include/stop_slave.inc
322323
reset slave;
323324
connection master;
324-
kill query _tid;
325325
connection slave;
326326
include/start_slave.inc
327327
connection master;
@@ -353,7 +353,6 @@ include/stop_slave.inc
353353
reset slave;
354354
connection master;
355355
reset master;
356-
kill query _tid;
357356
set sql_log_bin=0;
358357
grant replication slave on *.* to rpl@127.0.0.1 identified by 'rpl_password';
359358
flush privileges;
@@ -404,7 +403,6 @@ SHOW STATUS LIKE 'Rpl_semi_sync_slave_status';
404403
Variable_name Value
405404
Rpl_semi_sync_slave_status OFF
406405
connection master;
407-
kill query _tid;
408406
[ Semi-sync status on master should be ON ]
409407
show status like 'Rpl_semi_sync_master_clients';
410408
Variable_name Value

mysql-test/suite/perfschema/r/dml_setup_instruments.result

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ where name like 'Wait/Synch/Mutex/sql/%'
44
and name not in ('wait/synch/mutex/sql/DEBUG_SYNC::mutex')
55
order by name limit 10;
66
NAME ENABLED TIMED
7+
wait/synch/mutex/sql/Ack_receiver::m_mutex YES YES
78
wait/synch/mutex/sql/Cversion_lock YES YES
89
wait/synch/mutex/sql/Delayed_insert::mutex YES YES
910
wait/synch/mutex/sql/Event_scheduler::LOCK_scheduler_state YES YES
@@ -13,7 +14,6 @@ wait/synch/mutex/sql/HA_DATA_PARTITION::LOCK_auto_inc YES YES
1314
wait/synch/mutex/sql/LOCK_active_mi YES YES
1415
wait/synch/mutex/sql/LOCK_after_binlog_sync YES YES
1516
wait/synch/mutex/sql/LOCK_audit_mask YES YES
16-
wait/synch/mutex/sql/LOCK_binlog YES YES
1717
select * from performance_schema.setup_instruments
1818
where name like 'Wait/Synch/Rwlock/sql/%'
1919
and name not in ('wait/synch/rwlock/sql/CRYPTO_dynlock_value::lock')
@@ -36,6 +36,7 @@ where name like 'Wait/Synch/Cond/sql/%'
3636
'wait/synch/cond/sql/DEBUG_SYNC::cond')
3737
order by name limit 10;
3838
NAME ENABLED TIMED
39+
wait/synch/cond/sql/Ack_receiver::m_cond YES YES
3940
wait/synch/cond/sql/COND_binlog_send YES YES
4041
wait/synch/cond/sql/COND_flush_thread_cache YES YES
4142
wait/synch/cond/sql/COND_group_commit_orderer YES YES
@@ -45,7 +46,6 @@ wait/synch/cond/sql/COND_parallel_entry YES YES
4546
wait/synch/cond/sql/COND_prepare_ordered YES YES
4647
wait/synch/cond/sql/COND_queue_state YES YES
4748
wait/synch/cond/sql/COND_rpl_thread YES YES
48-
wait/synch/cond/sql/COND_rpl_thread_pool YES YES
4949
select * from performance_schema.setup_instruments
5050
where name='Wait';
5151
select * from performance_schema.setup_instruments

mysql-test/suite/perfschema/r/relaylog.result

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ EVENT_NAME COUNT_STAR SUM_TIMER_WAIT MIN_TIMER_WAIT AVG_TIMER_WAIT MAX_TIMER_WAI
8686
wait/synch/cond/sql/MYSQL_RELAY_LOG::COND_bin_log_updated 0 0 0 0 0
8787
wait/synch/cond/sql/MYSQL_RELAY_LOG::COND_queue_busy 0 0 0 0 0
8888
wait/synch/cond/sql/MYSQL_RELAY_LOG::COND_relay_log_updated 0 0 0 0 0
89+
wait/synch/mutex/sql/MYSQL_RELAY_LOG::LOCK_binlog_end_pos 0 0 0 0 0
8990
wait/synch/mutex/sql/MYSQL_RELAY_LOG::LOCK_index 0 0 0 0 0
9091
connection slave;
9192
"============ Performance schema on slave ============"
@@ -193,5 +194,6 @@ EVENT_NAME COUNT_STAR
193194
wait/synch/cond/sql/MYSQL_RELAY_LOG::COND_bin_log_updated NONE
194195
wait/synch/cond/sql/MYSQL_RELAY_LOG::COND_queue_busy NONE
195196
wait/synch/cond/sql/MYSQL_RELAY_LOG::COND_relay_log_updated MANY
197+
wait/synch/mutex/sql/MYSQL_RELAY_LOG::LOCK_binlog_end_pos NONE
196198
wait/synch/mutex/sql/MYSQL_RELAY_LOG::LOCK_index MANY
197199
include/stop_slave.inc

mysql-test/suite/rpl/r/rpl_semi_sync.result

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ connection master;
44
call mtr.add_suppression("Timeout waiting for reply of binlog");
55
call mtr.add_suppression("Read semi-sync reply");
66
call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.");
7+
call mtr.add_suppression("mysqld: Got an error reading communication packets");
78
connection slave;
89
call mtr.add_suppression("Master server does not support semi-sync");
910
call mtr.add_suppression("Semi-sync slave .* reply");
@@ -176,7 +177,7 @@ Variable_name Value
176177
Rpl_semi_sync_master_yes_tx 14
177178
show status like 'Rpl_semi_sync_master_clients';
178179
Variable_name Value
179-
Rpl_semi_sync_master_clients 1
180+
Rpl_semi_sync_master_clients 0
180181
[ semi-sync replication of these transactions will fail ]
181182
insert into t1 values (500);
182183
[ master status should be OFF ]
@@ -321,7 +322,6 @@ connection slave;
321322
include/stop_slave.inc
322323
reset slave;
323324
connection master;
324-
kill query _tid;
325325
connection slave;
326326
include/start_slave.inc
327327
connection master;
@@ -353,7 +353,6 @@ include/stop_slave.inc
353353
reset slave;
354354
connection master;
355355
reset master;
356-
kill query _tid;
357356
set sql_log_bin=0;
358357
grant replication slave on *.* to rpl@127.0.0.1 identified by 'rpl_password';
359358
flush privileges;
@@ -404,7 +403,6 @@ SHOW STATUS LIKE 'Rpl_semi_sync_slave_status';
404403
Variable_name Value
405404
Rpl_semi_sync_slave_status OFF
406405
connection master;
407-
kill query _tid;
408406
[ Semi-sync status on master should be ON ]
409407
show status like 'Rpl_semi_sync_master_clients';
410408
Variable_name Value

mysql-test/suite/rpl/r/rpl_semi_sync_event.result

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ call mtr.add_suppression("Timeout waiting for reply of binlog");
55
call mtr.add_suppression("Semi-sync master .* waiting for slave reply");
66
call mtr.add_suppression("Read semi-sync reply");
77
call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.");
8+
call mtr.add_suppression("mysqld: Got an error reading communication packets");
89
connection slave;
910
call mtr.add_suppression("Master server does not support semi-sync");
1011
call mtr.add_suppression("Semi-sync slave .* reply");

mysql-test/suite/rpl/r/rpl_semi_sync_event_after_sync.result

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ call mtr.add_suppression("Timeout waiting for reply of binlog");
66
call mtr.add_suppression("Semi-sync master .* waiting for slave reply");
77
call mtr.add_suppression("Read semi-sync reply");
88
call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.");
9+
call mtr.add_suppression("mysqld: Got an error reading communication packets");
910
connection slave;
1011
call mtr.add_suppression("Master server does not support semi-sync");
1112
call mtr.add_suppression("Semi-sync slave .* reply");

mysql-test/suite/rpl/t/rpl_semi_sync_event.test

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ call mtr.add_suppression("Timeout waiting for reply of binlog");
1010
call mtr.add_suppression("Semi-sync master .* waiting for slave reply");
1111
call mtr.add_suppression("Read semi-sync reply");
1212
call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.");
13+
call mtr.add_suppression("mysqld: Got an error reading communication packets");
14+
1315
connection slave;
1416
call mtr.add_suppression("Master server does not support semi-sync");
1517
call mtr.add_suppression("Semi-sync slave .* reply");

mysql-test/suite/sys_vars/r/rpl_semi_sync_master_enabled_basic.result

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,12 @@ set global rpl_semi_sync_master_enabled=1e1;
6565
ERROR 42000: Incorrect argument type to variable 'rpl_semi_sync_master_enabled'
6666
set global rpl_semi_sync_master_enabled="some text";
6767
ERROR 42000: Variable 'rpl_semi_sync_master_enabled' can't be set to the value of 'some text'
68+
connect con1,localhost,root,,;
69+
connect con2,localhost,root,,;
70+
disconnect con1;
71+
disconnect con2;
72+
connection default;
73+
SET @@global.rpl_semi_sync_master_enabled = 1;
6874
SET @@global.rpl_semi_sync_master_enabled = @start_global_value;
6975
select @@global.rpl_semi_sync_master_enabled;
7076
@@global.rpl_semi_sync_master_enabled

mysql-test/suite/sys_vars/t/rpl_semi_sync_master_enabled_basic.test

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,35 @@ set global rpl_semi_sync_master_enabled=1e1;
5151
--error ER_WRONG_VALUE_FOR_VAR
5252
set global rpl_semi_sync_master_enabled="some text";
5353

54+
#
55+
# Test conflicting concurrent setting
56+
#
57+
--let $val_saved= `SELECT @@global.rpl_semi_sync_master_enabled`
58+
connect (con1,localhost,root,,);
59+
connect (con2,localhost,root,,);
60+
--let $iter=100
61+
--disable_query_log
62+
while ($iter)
63+
{
64+
--connection con1
65+
--send_eval SET @@global.rpl_semi_sync_master_enabled = $iter % 2
66+
67+
--connection con2
68+
--send_eval SET @@global.rpl_semi_sync_master_enabled = ($iter + 1) % 2
69+
70+
--connection con1
71+
reap;
72+
--connection con2
73+
reap;
74+
75+
--dec $iter
76+
}
77+
--enable_query_log
78+
disconnect con1;
79+
disconnect con2;
80+
81+
--connection default
82+
--eval SET @@global.rpl_semi_sync_master_enabled = $val_saved
5483

5584
#
5685
# Cleanup

0 commit comments

Comments
 (0)