Skip to content

Commit

Permalink
[Performance] Issue #40 Optimize performance of semisync
Browse files Browse the repository at this point in the history
Description:
------------
This diff includes:
    1. Make semisync buidin to completely remove overhead of plugin lock.
    2. Remove LOCK_log requirement from dump thread
    3. Now user threads can wait for ACK before innodb commit.
        add rpl_semi_sync_master_wait_point to control this behavior(AFTER_COMMIT/AFTER_SYNC)
    4. Add a new ACK thread to handle ACK from slave.
    5. The IO thread flushs master info only when ACK is needed
        add rpl_semi_sync_slave_delay_master to control this behavior
    6. Fix bug#70669, if sync_binlog = 1 ,then notify dump thread after fsync of binlog file.
  • Loading branch information
AliSQL authored and AliSQL committed Feb 14, 2017
1 parent 830187b commit 3487832
Show file tree
Hide file tree
Showing 44 changed files with 2,510 additions and 1,509 deletions.
1 change: 0 additions & 1 deletion mysql-test/include/install_semisync.inc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
--source include/begin_include_file.inc

--source include/not_embedded.inc
--source include/have_semisync_plugin.inc

--connection master

Expand Down
34 changes: 34 additions & 0 deletions mysql-test/r/mysqld--help-notwin.result
Original file line number Diff line number Diff line change
Expand Up @@ -859,6 +859,31 @@ The following options may be given as the first argument:
not sure, leave this option unset
--report-user=name The account user name of the slave to be reported to the
master during slave registration
--rpl-semi-sync-master-enabled
enble semi-synchronous replication master (disabled by
default).
--rpl-semi-sync-master-timeout=#
he timeout value (in ms) for semi-synchronous replication
in the master
--rpl-semi-sync-master-trace-level=#
The tracing level for semi-sync replication.
--rpl-semi-sync-master-wait-no-slave
Wait until timeout when no semi-synchronous replication
slave available (enabled by default).
(Defaults to on; use --skip-rpl-semi-sync-master-wait-no-slave to disable.)
--rpl-semi-sync-master-wait-point=name
watting for slave ack before/after commit trx
--rpl-semi-sync-slave-delay-master
Only write master info file when ack is needed.
--rpl-semi-sync-slave-enabled
enble semi-synchronous replication slave (disabled by
default).
--rpl-semi-sync-slave-kill-conn-timeout[=#]
Timeout for the mysql connection used to kill the slave
io_thread's connection on master. This timeout comes into
play when stop slave is executed.
--rpl-semi-sync-slave-trace-level=#
The tracing level for semi-sync replication.
--rpl-stop-slave-timeout=#
Timeout in seconds to wait for slave to stop before
returning a warning.
Expand Down Expand Up @@ -1435,6 +1460,15 @@ report-host (No default value)
report-password (No default value)
report-port 0
report-user (No default value)
rpl-semi-sync-master-enabled FALSE
rpl-semi-sync-master-timeout 10000
rpl-semi-sync-master-trace-level 32
rpl-semi-sync-master-wait-no-slave TRUE
rpl-semi-sync-master-wait-point after_commit
rpl-semi-sync-slave-delay-master FALSE
rpl-semi-sync-slave-enabled FALSE
rpl-semi-sync-slave-kill-conn-timeout 5
rpl-semi-sync-slave-trace-level 32
rpl-stop-slave-timeout 31536000
safe-user-create FALSE
secure-auth TRUE
Expand Down
8 changes: 4 additions & 4 deletions mysql-test/suite/perfschema/r/dml_setup_instruments.result
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ where name like 'Wait/Synch/Mutex/sql/%'
and name not in ('wait/synch/mutex/sql/DEBUG_SYNC::mutex')
order by name limit 10;
NAME ENABLED TIMED
wait/synch/mutex/sql/Ack_receiver::m_mutex YES YES
wait/synch/mutex/sql/Cversion_lock YES YES
wait/synch/mutex/sql/Delayed_insert::mutex YES YES
wait/synch/mutex/sql/Event_scheduler::LOCK_scheduler_state YES YES
wait/synch/mutex/sql/Gtid_state YES YES
wait/synch/mutex/sql/hash_filo::lock YES YES
wait/synch/mutex/sql/LOCK_active_mi YES YES
wait/synch/mutex/sql/LOCK_audit_mask YES YES
wait/synch/mutex/sql/LOCK_binlog_ YES YES
wait/synch/mutex/sql/LOCK_connection_count YES YES
wait/synch/mutex/sql/LOCK_crypt YES YES
wait/synch/mutex/sql/LOCK_delayed_create YES YES
select * from performance_schema.setup_instruments
where name like 'Wait/Synch/Rwlock/sql/%'
and name not in ('wait/synch/rwlock/sql/CRYPTO_dynlock_value::lock')
Expand All @@ -36,6 +36,8 @@ where name like 'Wait/Synch/Cond/sql/%'
'wait/synch/cond/sql/DEBUG_SYNC::cond')
order by name limit 10;
NAME ENABLED TIMED
wait/synch/cond/sql/Ack_receiver::m_cond YES YES
wait/synch/cond/sql/COND_binlog_send_ YES YES
wait/synch/cond/sql/COND_connection_count YES YES
wait/synch/cond/sql/COND_flush_thread_cache YES YES
wait/synch/cond/sql/COND_manager YES YES
Expand All @@ -44,8 +46,6 @@ wait/synch/cond/sql/COND_server_started YES YES
wait/synch/cond/sql/COND_thread_cache YES YES
wait/synch/cond/sql/COND_thread_count YES YES
wait/synch/cond/sql/Delayed_insert::cond YES YES
wait/synch/cond/sql/Delayed_insert::cond_client YES YES
wait/synch/cond/sql/Event_scheduler::COND_state YES YES
select * from performance_schema.setup_instruments
where name='Wait';
select * from performance_schema.setup_instruments
Expand Down
8 changes: 8 additions & 0 deletions mysql-test/suite/perfschema/r/relaylog.result
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,15 @@ where event_name like "%MYSQL_BIN_LOG%"
EVENT_NAME COUNT_STAR
wait/synch/cond/sql/MYSQL_BIN_LOG::COND_done NONE
wait/synch/cond/sql/MYSQL_BIN_LOG::prep_xids_cond NONE
wait/synch/mutex/sql/MYSQL_BIN_LOG::LOCK_binlog_end_pos MANY
wait/synch/mutex/sql/MYSQL_BIN_LOG::LOCK_commit MANY
wait/synch/mutex/sql/MYSQL_BIN_LOG::LOCK_commit_queue MANY
wait/synch/mutex/sql/MYSQL_BIN_LOG::LOCK_done MANY
wait/synch/mutex/sql/MYSQL_BIN_LOG::LOCK_flush_queue MANY
wait/synch/mutex/sql/MYSQL_BIN_LOG::LOCK_index MANY
wait/synch/mutex/sql/MYSQL_BIN_LOG::LOCK_log MANY
wait/synch/mutex/sql/MYSQL_BIN_LOG::LOCK_semisync NONE
wait/synch/mutex/sql/MYSQL_BIN_LOG::LOCK_semisync_queue NONE
wait/synch/mutex/sql/MYSQL_BIN_LOG::LOCK_sync MANY
wait/synch/mutex/sql/MYSQL_BIN_LOG::LOCK_sync_queue MANY
wait/synch/mutex/sql/MYSQL_BIN_LOG::LOCK_xids NONE
Expand All @@ -86,6 +89,7 @@ where event_name like "%MYSQL_RELAY_LOG%"
EVENT_NAME COUNT_STAR SUM_TIMER_WAIT MIN_TIMER_WAIT AVG_TIMER_WAIT MAX_TIMER_WAIT
wait/synch/cond/sql/MYSQL_RELAY_LOG::COND_done 0 0 0 0 0
wait/synch/cond/sql/MYSQL_RELAY_LOG::prep_xids_cond 0 0 0 0 0
wait/synch/mutex/sql/MYSQL_RELAY_LOG::LOCK_binlog_end_pos 0 0 0 0 0
wait/synch/mutex/sql/MYSQL_RELAY_LOG::LOCK_commit 0 0 0 0 0
wait/synch/mutex/sql/MYSQL_RELAY_LOG::LOCK_commit_queue 0 0 0 0 0
wait/synch/mutex/sql/MYSQL_RELAY_LOG::LOCK_done 0 0 0 0 0
Expand Down Expand Up @@ -153,12 +157,15 @@ where event_name like "%MYSQL_BIN_LOG%"
EVENT_NAME COUNT_STAR
wait/synch/cond/sql/MYSQL_BIN_LOG::COND_done NONE
wait/synch/cond/sql/MYSQL_BIN_LOG::prep_xids_cond NONE
wait/synch/mutex/sql/MYSQL_BIN_LOG::LOCK_binlog_end_pos MANY
wait/synch/mutex/sql/MYSQL_BIN_LOG::LOCK_commit MANY
wait/synch/mutex/sql/MYSQL_BIN_LOG::LOCK_commit_queue MANY
wait/synch/mutex/sql/MYSQL_BIN_LOG::LOCK_done MANY
wait/synch/mutex/sql/MYSQL_BIN_LOG::LOCK_flush_queue MANY
wait/synch/mutex/sql/MYSQL_BIN_LOG::LOCK_index MANY
wait/synch/mutex/sql/MYSQL_BIN_LOG::LOCK_log MANY
wait/synch/mutex/sql/MYSQL_BIN_LOG::LOCK_semisync NONE
wait/synch/mutex/sql/MYSQL_BIN_LOG::LOCK_semisync_queue NONE
wait/synch/mutex/sql/MYSQL_BIN_LOG::LOCK_sync MANY
wait/synch/mutex/sql/MYSQL_BIN_LOG::LOCK_sync_queue MANY
wait/synch/mutex/sql/MYSQL_BIN_LOG::LOCK_xids NONE
Expand Down Expand Up @@ -200,6 +207,7 @@ where event_name like "%MYSQL_RELAY_LOG%"
EVENT_NAME COUNT_STAR
wait/synch/cond/sql/MYSQL_RELAY_LOG::COND_done NONE
wait/synch/cond/sql/MYSQL_RELAY_LOG::prep_xids_cond NONE
wait/synch/mutex/sql/MYSQL_RELAY_LOG::LOCK_binlog_end_pos NONE
wait/synch/mutex/sql/MYSQL_RELAY_LOG::LOCK_commit NONE
wait/synch/mutex/sql/MYSQL_RELAY_LOG::LOCK_commit_queue NONE
wait/synch/mutex/sql/MYSQL_RELAY_LOG::LOCK_done NONE
Expand Down
Loading

0 comments on commit 3487832

Please sign in to comment.