mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
MDEV-26: Global transaction ID. First alpha release.
Merge of 10.0-mdev26 feature tree into 10.0-base. Global transaction ID is prepended to each event group in the binlog. Slave connect can request to start from GTID position instead of specifying file name/offset of master binlog. This facilitates easy switch to a new master. Slave GTID state is stored in a table mysql.rpl_slave_state, which can be InnoDB to get crash-safe slave state. GTID includes a replication domain ID, allowing to keep track of distinct positions for each of multiple masters.
This commit is contained in:
@ -55,13 +55,16 @@ wait/synch/mutex/sql/LOCK_global_index_stats
|
||||
wait/synch/mutex/sql/LOCK_global_system_variables
|
||||
wait/synch/mutex/sql/LOCK_global_table_stats
|
||||
wait/synch/mutex/sql/LOCK_global_user_client_stats
|
||||
wait/synch/mutex/sql/LOCK_gtid_counter
|
||||
wait/synch/mutex/sql/LOCK_open
|
||||
wait/synch/mutex/sql/LOCK_plugin
|
||||
wait/synch/mutex/sql/LOCK_prepared_stmt_count
|
||||
wait/synch/mutex/sql/LOCK_prepare_ordered
|
||||
wait/synch/mutex/sql/LOCK_rpl_gtid_state
|
||||
wait/synch/mutex/sql/LOCK_rpl_status
|
||||
wait/synch/mutex/sql/LOCK_server_started
|
||||
wait/synch/mutex/sql/LOCK_slave_list
|
||||
wait/synch/mutex/sql/LOCK_slave_state
|
||||
wait/synch/mutex/sql/LOCK_stats
|
||||
wait/synch/mutex/sql/LOCK_status
|
||||
wait/synch/mutex/sql/LOCK_thread_cache
|
||||
|
@ -26,17 +26,23 @@ update performance_schema.setup_instruments set enabled='YES'
|
||||
and name not in ("wait/synch/rwlock/sql/CRYPTO_dynlock_value::lock");
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Gtid # # GTID #-#-#
|
||||
master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated by server */
|
||||
master-bin.000001 # Gtid # # GTID #-#-#
|
||||
master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `t2` /* generated by server */
|
||||
master-bin.000001 # Gtid # # GTID #-#-#
|
||||
master-bin.000001 # Query # # use `test`; create table test.t1 (thread_id integer)
|
||||
master-bin.000001 # Gtid # # GTID #-#-#
|
||||
master-bin.000001 # Query # # use `test`; create table test.t2 (name varchar(128))
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
|
||||
master-bin.000001 # Table_map # # table_id: # (test.t1)
|
||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
|
||||
master-bin.000001 # Table_map # # table_id: # (test.t2)
|
||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Gtid # # GTID #-#-#
|
||||
master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
|
||||
master-bin.000001 # Gtid # # GTID #-#-#
|
||||
master-bin.000001 # Query # # use `test`; DROP TABLE `t2` /* generated by server */
|
||||
|
@ -26,17 +26,23 @@ update performance_schema.setup_instruments set enabled='YES'
|
||||
and name not in ("wait/synch/rwlock/sql/CRYPTO_dynlock_value::lock");
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Gtid # # GTID #-#-#
|
||||
master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated by server */
|
||||
master-bin.000001 # Gtid # # GTID #-#-#
|
||||
master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `t2` /* generated by server */
|
||||
master-bin.000001 # Gtid # # GTID #-#-#
|
||||
master-bin.000001 # Query # # use `test`; create table test.t1 (thread_id integer)
|
||||
master-bin.000001 # Gtid # # GTID #-#-#
|
||||
master-bin.000001 # Query # # use `test`; create table test.t2 (name varchar(128))
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
|
||||
master-bin.000001 # Table_map # # table_id: # (test.t1)
|
||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
|
||||
master-bin.000001 # Table_map # # table_id: # (test.t2)
|
||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Gtid # # GTID #-#-#
|
||||
master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
|
||||
master-bin.000001 # Gtid # # GTID #-#-#
|
||||
master-bin.000001 # Query # # use `test`; DROP TABLE `t2` /* generated by server */
|
||||
|
@ -37,28 +37,34 @@ Warnings:
|
||||
Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
|
||||
master-bin.000001 # Query # # use `test`; update performance_schema.setup_instruments set enabled='NO'
|
||||
where name like "wait/synch/rwlock/sql/%"
|
||||
and name not in ("wait/synch/rwlock/sql/CRYPTO_dynlock_value::lock")
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Gtid # # GTID #-#-#
|
||||
master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated by server */
|
||||
master-bin.000001 # Gtid # # GTID #-#-#
|
||||
master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `t2` /* generated by server */
|
||||
master-bin.000001 # Gtid # # GTID #-#-#
|
||||
master-bin.000001 # Query # # use `test`; create table test.t1 (thread_id integer)
|
||||
master-bin.000001 # Gtid # # GTID #-#-#
|
||||
master-bin.000001 # Query # # use `test`; create table test.t2 (name varchar(128))
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
|
||||
master-bin.000001 # Query # # use `test`; insert into test.t1
|
||||
select thread_id from performance_schema.events_waits_current
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
|
||||
master-bin.000001 # Query # # use `test`; insert into test.t2
|
||||
select name from performance_schema.setup_instruments
|
||||
where name like "wait/synch/rwlock/sql/%"
|
||||
and name not in ("wait/synch/rwlock/sql/CRYPTO_dynlock_value::lock")
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Gtid # # GTID #-#-#
|
||||
master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
|
||||
master-bin.000001 # Gtid # # GTID #-#-#
|
||||
master-bin.000001 # Query # # use `test`; DROP TABLE `t2` /* generated by server */
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
|
||||
master-bin.000001 # Query # # use `test`; update performance_schema.setup_instruments set enabled='YES'
|
||||
where name like "wait/synch/rwlock/sql/%"
|
||||
and name not in ("wait/synch/rwlock/sql/CRYPTO_dynlock_value::lock")
|
||||
|
@ -11,9 +11,9 @@ wait/synch/mutex/sql/hash_filo::lock YES YES
|
||||
wait/synch/mutex/sql/HA_DATA_PARTITION::LOCK_auto_inc 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_state YES YES
|
||||
wait/synch/mutex/sql/LOCK_commit_ordered YES YES
|
||||
wait/synch/mutex/sql/LOCK_connection_count YES YES
|
||||
wait/synch/mutex/sql/LOCK_crypt 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')
|
||||
|
@ -6,7 +6,9 @@ create table test.t1(a int);
|
||||
drop table test.t1;
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
slave-bin.000001 # Gtid # # GTID #-#-#
|
||||
slave-bin.000001 # Query # # use `test`; create table test.t1(a int)
|
||||
slave-bin.000001 # Gtid # # GTID #-#-#
|
||||
slave-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
|
||||
"============ Performance schema on master ============"
|
||||
select
|
||||
@ -21,6 +23,7 @@ where file_name like "%master-%" order by file_name;
|
||||
FILE_NAME EVENT_NAME COUNT_READ COUNT_WRITE SUM_NUMBER_OF_BYTES_READ SUM_NUMBER_OF_BYTES_WRITE
|
||||
master-bin.000001 wait/io/file/sql/binlog MANY MANY MANY MANY
|
||||
master-bin.index wait/io/file/sql/binlog_index NONE MANY NONE MANY
|
||||
master-bin.state wait/io/file/sql/binlog_state NONE NONE NONE NONE
|
||||
select * from performance_schema.file_summary_by_instance
|
||||
where file_name like "%slave-%" order by file_name;
|
||||
FILE_NAME EVENT_NAME COUNT_READ COUNT_WRITE SUM_NUMBER_OF_BYTES_READ SUM_NUMBER_OF_BYTES_WRITE
|
||||
@ -37,6 +40,7 @@ where event_name like "%binlog%" order by file_name;
|
||||
FILE_NAME EVENT_NAME COUNT_READ COUNT_WRITE SUM_NUMBER_OF_BYTES_READ SUM_NUMBER_OF_BYTES_WRITE
|
||||
master-bin.000001 wait/io/file/sql/binlog MANY MANY MANY MANY
|
||||
master-bin.index wait/io/file/sql/binlog_index NONE MANY NONE MANY
|
||||
master-bin.state wait/io/file/sql/binlog_state NONE NONE NONE NONE
|
||||
select
|
||||
EVENT_NAME,
|
||||
if (count_read > 0, "MANY", "NONE") as COUNT_READ,
|
||||
@ -48,18 +52,18 @@ where event_name like "%binlog%" order by event_name;
|
||||
EVENT_NAME COUNT_READ COUNT_WRITE SUM_NUMBER_OF_BYTES_READ SUM_NUMBER_OF_BYTES_WRITE
|
||||
wait/io/file/sql/binlog MANY MANY MANY MANY
|
||||
wait/io/file/sql/binlog_index NONE MANY NONE MANY
|
||||
wait/io/file/sql/binlog_state NONE NONE NONE NONE
|
||||
select
|
||||
EVENT_NAME,
|
||||
if (count_star > 0, "MANY", "NONE") as COUNT_STAR
|
||||
from performance_schema.events_waits_summary_global_by_event_name
|
||||
where event_name like "%MYSQL_BIN_LOG%"
|
||||
and event_name not like "%MYSQL_BIN_LOG::update_cond"
|
||||
and event_name not like "%MYSQL_BIN_LOG::COND_binlog_background_thread%"
|
||||
and event_name not like "%MYSQL_BIN_LOG::COND_xid_list"
|
||||
order by event_name;
|
||||
EVENT_NAME COUNT_STAR
|
||||
wait/synch/cond/sql/MYSQL_BIN_LOG::COND_binlog_background_thread NONE
|
||||
wait/synch/cond/sql/MYSQL_BIN_LOG::COND_binlog_background_thread_end NONE
|
||||
wait/synch/cond/sql/MYSQL_BIN_LOG::COND_queue_busy NONE
|
||||
wait/synch/cond/sql/MYSQL_BIN_LOG::COND_xid_list NONE
|
||||
wait/synch/mutex/sql/MYSQL_BIN_LOG::LOCK_binlog_background_thread MANY
|
||||
wait/synch/mutex/sql/MYSQL_BIN_LOG::LOCK_index MANY
|
||||
wait/synch/mutex/sql/MYSQL_BIN_LOG::LOCK_xid_list MANY
|
||||
@ -99,6 +103,7 @@ order by file_name;
|
||||
FILE_NAME EVENT_NAME COUNT_READ COUNT_WRITE SUM_NUMBER_OF_BYTES_READ SUM_NUMBER_OF_BYTES_WRITE
|
||||
slave-bin.000001 wait/io/file/sql/binlog MANY MANY MANY MANY
|
||||
slave-bin.index wait/io/file/sql/binlog_index NONE MANY NONE MANY
|
||||
slave-bin.state wait/io/file/sql/binlog_state NONE NONE NONE NONE
|
||||
slave-relay-bin.000001 wait/io/file/sql/relaylog MANY MANY MANY MANY
|
||||
slave-relay-bin.000002 wait/io/file/sql/relaylog MANY MANY MANY MANY
|
||||
slave-relay-bin.index wait/io/file/sql/relaylog_index MANY MANY MANY MANY
|
||||
@ -115,6 +120,7 @@ where event_name like "%binlog%" order by file_name;
|
||||
FILE_NAME EVENT_NAME COUNT_READ COUNT_WRITE SUM_NUMBER_OF_BYTES_READ SUM_NUMBER_OF_BYTES_WRITE
|
||||
slave-bin.000001 wait/io/file/sql/binlog MANY MANY MANY MANY
|
||||
slave-bin.index wait/io/file/sql/binlog_index NONE MANY NONE MANY
|
||||
slave-bin.state wait/io/file/sql/binlog_state NONE NONE NONE NONE
|
||||
select
|
||||
EVENT_NAME,
|
||||
if (count_read > 0, "MANY", "NONE") as COUNT_READ,
|
||||
@ -126,18 +132,18 @@ where event_name like "%binlog%" order by event_name;
|
||||
EVENT_NAME COUNT_READ COUNT_WRITE SUM_NUMBER_OF_BYTES_READ SUM_NUMBER_OF_BYTES_WRITE
|
||||
wait/io/file/sql/binlog MANY MANY MANY MANY
|
||||
wait/io/file/sql/binlog_index NONE MANY NONE MANY
|
||||
wait/io/file/sql/binlog_state NONE NONE NONE NONE
|
||||
select
|
||||
EVENT_NAME,
|
||||
if (count_star > 0, "MANY", "NONE") as COUNT_STAR
|
||||
from performance_schema.events_waits_summary_global_by_event_name
|
||||
where event_name like "%MYSQL_BIN_LOG%"
|
||||
and event_name not like "%MYSQL_BIN_LOG::update_cond"
|
||||
and event_name not like "%MYSQL_BIN_LOG::COND_binlog_background_thread%"
|
||||
and event_name not like "%MYSQL_BIN_LOG::COND_xid_list"
|
||||
order by event_name;
|
||||
EVENT_NAME COUNT_STAR
|
||||
wait/synch/cond/sql/MYSQL_BIN_LOG::COND_binlog_background_thread MANY
|
||||
wait/synch/cond/sql/MYSQL_BIN_LOG::COND_binlog_background_thread_end NONE
|
||||
wait/synch/cond/sql/MYSQL_BIN_LOG::COND_queue_busy NONE
|
||||
wait/synch/cond/sql/MYSQL_BIN_LOG::COND_xid_list MANY
|
||||
wait/synch/mutex/sql/MYSQL_BIN_LOG::LOCK_binlog_background_thread MANY
|
||||
wait/synch/mutex/sql/MYSQL_BIN_LOG::LOCK_index MANY
|
||||
wait/synch/mutex/sql/MYSQL_BIN_LOG::LOCK_xid_list MANY
|
||||
|
@ -28,6 +28,9 @@ drop table test.t1;
|
||||
# - statistics are normalized to "NONE" or "MANY"
|
||||
# - statistics on ::update_cond conditions are not collected,
|
||||
# since this is too much dependent on execution.
|
||||
# - statistics on COND_binlog_background_thread and COND_xid_list are not
|
||||
# collected, as they depend on exact timing for background binlog
|
||||
# checkpointing operations.
|
||||
#
|
||||
|
||||
connection master;
|
||||
@ -73,6 +76,8 @@ select
|
||||
from performance_schema.events_waits_summary_global_by_event_name
|
||||
where event_name like "%MYSQL_BIN_LOG%"
|
||||
and event_name not like "%MYSQL_BIN_LOG::update_cond"
|
||||
and event_name not like "%MYSQL_BIN_LOG::COND_binlog_background_thread%"
|
||||
and event_name not like "%MYSQL_BIN_LOG::COND_xid_list"
|
||||
order by event_name;
|
||||
|
||||
-- echo "Expect no slave relay log"
|
||||
@ -135,6 +140,8 @@ select
|
||||
from performance_schema.events_waits_summary_global_by_event_name
|
||||
where event_name like "%MYSQL_BIN_LOG%"
|
||||
and event_name not like "%MYSQL_BIN_LOG::update_cond"
|
||||
and event_name not like "%MYSQL_BIN_LOG::COND_binlog_background_thread%"
|
||||
and event_name not like "%MYSQL_BIN_LOG::COND_xid_list"
|
||||
order by event_name;
|
||||
|
||||
-- echo "Expect a slave relay log"
|
||||
|
Reference in New Issue
Block a user