MySQL GTIDエラー処理要約


MySQL GTIDは、従来のmysqlマスターがレプリケーションに基づいて進化したものであり、UUIDにトランザクションIDを付けることで物事の一意性を確保している.このような操作により、いわゆるlogに関心を持つ必要がなくなりました.fileとlog_Posは、ライブラリから、どのサーバからメインライブラリを探せばいいかを簡単に教えるだけでOKです.主従の構築とfailoverのプロセスを簡素化し、従来のレプリケーションよりも安全で信頼性が高い.GTIDは連続して空洞がないため,マスタスレーブがデータ衝突した場合,空のものを注入することでスキップすることができる.本文は主にGTID主従アーキテクチャのエラー処理方式について述べる.
一、GTIDの関連特性
MySQL GTIDマスターコピーmysqldumpに基づくgtidマスターの構成
二、GTIDはどのように事務の衝突をスキップするか
               mysql        ,          ,       
      GTID         ,               
    GTID         sql_slave_skip_counter       
      :              ,        (set global sql_slave_skip_counter = 1)
      :
            stop slave;
            set gtid_next='xxxxxxx:N'; --            ,      GTID
            begin;
            commit;  --       
            set gtid_next='AUTOMATIC' --     GTID  。
            start slave; --    

三、GTID事務の衝突のいくつかのよくあるタイプ
    1、      ,        
    2、       ,           
    3、       ,           
    4、                
    5、     purged   

四、例示的なプレゼンテーション
          
# mysqlrplshow --master=root:[email protected]:3306 --discover-slaves-login=root:pass --verbose
WARNING: Using a password on the command line interface can be insecure.
# master on 192.168.1.233: ... connected.
# Finding slaves for master: 192.168.1.233:3306

# Replication Topology Graph
192.168.1.233:3306 (MASTER)
   |
   +--- 192.168.1.245:3306 [IO: Yes, SQL: Yes] - (SLAVE)
   |
   +--- 192.168.1.247:3306 [IO: Yes, SQL: Yes] - (SLAVE)

([email protected])[tempdb]>show slave hosts;
+-----------+---------------+------+-----------+--------------------------------------+
| Server_id | Host          | Port | Master_id | Slave_UUID                           |
+-----------+---------------+------+-----------+--------------------------------------+
|       245 | 192.168.1.245 | 3306 |       233 | 78336cdc-8cfb-11e6-ba9f-000c29328504 |
|       247 | 192.168.1.247 | 3306 |       233 | 13a26fc1-555a-11e6-b5e0-000c292e1642 |
+-----------+---------------+------+-----------+--------------------------------------+

--   mysql  
([email protected])[tempdb]>show variables like 'version';
+---------------+------------+
| Variable_name | Value      |
+---------------+------------+
| version       | 5.7.12-log |
+---------------+------------+

--  gtid    
([email protected])[tempdb]>show variables like '%gtid_mode%';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| gtid_mode     | ON    |
+---------------+-------+

--          gtid dump  ,  
([email protected])[tempdb]>show processlist;
+----+------+-----------------------+--------+------------------+------+
| Id | User | Host                  | db     | Command          | Time |
+----+------+-----------------------+--------+------------------+------+
| 17 | repl | node245.edq.com:52685 | NULL   | Binlog Dump GTID | 2738 |
| 18 | repl | node247.edq.com:33516 | NULL   | Binlog Dump GTID | 2690 |
| 24 | root | localhost             | tempdb | Query            |    0 |
+----+------+-----------------------+--------+------------------+------+

1.ライブラリからプライマリ・キーを繰り返す(Errno:1062)
(root@Master)[tempdb]>create table t1 (
            -> id tinyint not null primary key,ename varchar(20),blog varchar(50));

(root@Master)[tempdb]>insert into t1 
            -> values(1,'leshami','http://blog.csdn.net/leshami');

(root@Master)[tempdb]>insert into t1 
            -> values(2,'robin','http://blog.csdn.net/robinson_0612');

(root@Master)[tempdb]>set sql_log_bin=off;

(root@Master)[tempdb]>delete from t1 where ename='robin';

(root@Master)[tempdb]>set sql_log_bin=on;

(root@Master)[tempdb]>insert into t1 
            -> values(2,'robin','http://blog.csdn.net/robinson_0612');

--       ,     primary key
(root@Slave)[tempdb]>show slave status \G
*************************** 1. row ***************************
Last_Errno: 1062
Last_Error: Could not execute Write_rows event on table tempdb.t1; Duplicate entry '2' for key 'PRIMARY', 
                        Error_code: 1062; handler error HA_ERR_FOUND_DUPP_KEY; 
                        the event's master log node233-binlog.000004, end_log_pos 4426
Retrieved_Gtid_Set: 1b64c25d-8d2b-11e6-9ac0-000c29b82d0d:76-90
 Executed_Gtid_Set: 1b64c25d-8d2b-11e6-9ac0-000c29b82d0d:1-89
     Auto_Position: 1

--       ,             
(root@Slave)[tempdb]>stop slave;

(root@Slave)[tempdb]>delete from t1 where ename='robin';

(root@Slave)[tempdb]>start slave;

(root@Slave)[tempdb]>show slave status \G
*************************** 1. row ***************************
           Retrieved_Gtid_Set: 1b64c25d-8d2b-11e6-9ac0-000c29b82d0d:76-90
            Executed_Gtid_Set: 1b64c25d-8d2b-11e6-9ac0-000c29b82d0d:1-90,
 78336cdc-8cfb-11e6-ba9f-000c29328504:1  --      GTID,           ,   UUID IP 245 UUID  
                Auto_Position: 1
         Replicate_Rewrite_DB: 
                 Channel_Name: 
           Master_TLS_Version: 

(root@Slave)[tempdb]>show variables like '%uuid%';
+---------------+--------------------------------------+
| Variable_name | Value                                |
+---------------+--------------------------------------+
| server_uuid   | 78336cdc-8cfb-11e6-ba9f-000c29328504 |
+---------------+--------------------------------------+

2.ライブラリから更新された記録が見つからない(Errno:1032)
--        leshami    
(root@Slave)[tempdb]>delete from t1 where ename='leshami';

--          leshami    
(root@Master)[tempdb]>update t1 set 
            -> blog='http://blog.csdn.net/robinson_0612' where ename='leshami';

Query OK, 1 row affected (0.02 sec)
Rows matched: 1  Changed: 1  Warnings: 0

--       
(root@Slave)[tempdb]>show slave status \G
*************************** 1. row ***************************
Last_SQL_Errno: 1032
Last_SQL_Error: Could not execute Update_rows event on table tempdb.t1; Can't find record in 't1',
                                Error_code: 1032; handler error HA_ERR_KEY_NOT_FOUND;
                            the event's master log node233-binlog.000004, end_log_pos 4769
Retrieved_Gtid_Set: 1b64c25d-8d2b-11e6-9ac0-000c29b82d0d:76-91
Executed_Gtid_Set: 1b64c25d-8d2b-11e6-9ac0-000c29b82d0d:1-90,
        78336cdc-8cfb-11e6-ba9f-000c29328504:1-2

--   mysqlbinlog           binglog       ,     SQL  ,    
-- update  where            ,set         ,                
# mysqlbinlog --no-defaults -v -v --base64-output=DECODE-ROWS /data/node233-binlog.000004|grep -A '10' 4769
#161009 13:46:34 server id 233 end_log_pos 4769 CRC32 0xb60df74e Update_rows: table id 147 flags: STMT_END_F
### UPDATE `tempdb`.`t1`
### WHERE
###   @1=1 /* TINYINT meta=0 nullable=0 is_null=0 */
###   @2='leshami' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
###   @3='http://blog.csdn.net/leshami' /* VARSTRING(50) meta=50 nullable=1 is_null=0 */
### SET
###   @1=1 /* TINYINT meta=0 nullable=0 is_null=0 */
###   @2='leshami' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
###   @3='http://blog.csdn.net/robinson_0612' /* VARSTRING(50) meta=50 nullable=1 is_null=0 */
# at 4769
#161009 13:46:34 server id 233  end_log_pos 4800 CRC32 0xa9669811       Xid = 1749
COMMIT/*!*/;
SET @@SESSION.GTID_NEXT= 'AUTOMATIC' /* added by mysqlbinlog */ /*!*/;
DELIMITER ;
# End of log file
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;   

(root@Slave)[tempdb]>select * from t1;
+----+-------+------------------------------------+
| id | ename | blog                               |
+----+-------+------------------------------------+
|  2 | robin | http://blog.csdn.net/robinson_0612 |
+----+-------+------------------------------------+

(root@Slave)[tempdb]>stop slave sql_thread;

(root@Slave)[tempdb]>insert into t1 values(1,'leshami','http://blog.csdn.net/leshami');

(root@Slave)[tempdb]>start slave sql_thread;

(root@Slave)[tempdb]>show slave status \G
*************************** 1. row ***************************
           Retrieved_Gtid_Set: 1b64c25d-8d2b-11e6-9ac0-000c29b82d0d:76-91
            Executed_Gtid_Set: 1b64c25d-8d2b-11e6-9ac0-000c29b82d0d:1-91,
                               78336cdc-8cfb-11e6-ba9f-000c29328504:1-3
                Auto_Position: 1

3.ライブラリから削除されたレコードが見つからない(Errno:1032)
--            ,            ,          
--                 
(root@Slave)[tempdb]>delete from t1 where ename='robin';

--             
(root@Master)[tempdb]>delete from t1 where ename='robin';

--               
(root@Slave)[tempdb]>show slave status \G
*************************** 1. row ***************************
Last_SQL_Error: Could not execute Delete_rows event on table tempdb.t1; Can't find record in 't1',
                Error_code: 1032; handler error HA_ERR_KEY_NOT_FOUND; 
                the event's master log node233-binlog.000004, end_log_pos 5070
Last_SQL_Error_Timestamp: 161009 15:08:06
    Master_SSL_Crl: 
Master_SSL_Crlpath: 
Retrieved_Gtid_Set: 1b64c25d-8d2b-11e6-9ac0-000c29b82d0d:76-92
 Executed_Gtid_Set: 1b64c25d-8d2b-11e6-9ac0-000c29b82d0d:1-91,
                    78336cdc-8cfb-11e6-ba9f-000c29328504:1-4
     Auto_Position: 1      

--             
(root@Slave)[tempdb]>stop slave sql_thread;

(root@Slave)[tempdb]>set gtid_next='1b64c25d-8d2b-11e6-9ac0-000c29b82d0d:92';

(root@Slave)[tempdb]>begin;commit;

(root@Slave)[tempdb]>set gtid_next='AUTOMATIC';

(root@Slave)[tempdb]>start slave sql_thread;

(root@Slave)[tempdb]>show slave status \G
*************************** 1. row ***************************
           Retrieved_Gtid_Set: 1b64c25d-8d2b-11e6-9ac0-000c29b82d0d:76-92
            Executed_Gtid_Set: 1b64c25d-8d2b-11e6-9ac0-000c29b82d0d:1-92,
                               78336cdc-8cfb-11e6-ba9f-000c29328504:1-4
                Auto_Position: 1
         Replicate_Rewrite_DB: 
                 Channel_Name: 
           Master_TLS_Version: 

4、遅延修復マスターからの予期せぬtruncate
--                        
(root@Master)[tempdb]>create table t2 (id tinyint not null primary key, 
        -> ename varchar(20),blog varchar(50));

(root@Master)[tempdb]>insert into t2  
            -> values(1,'leshami','http://blog.csdn.net/leshami');

(root@Master)[tempdb]>insert into t2  
            -> values(2,'robin','http://blog.csdn.net/robinson_0612');

(root@Master)[tempdb]>select * from t2;
+----+---------+------------------------------------+
| id | ename   | blog                               |
+----+---------+------------------------------------+
|  1 | leshami | http://blog.csdn.net/leshami       |
|  2 | robin   | http://blog.csdn.net/robinson_0612 |
+----+---------+------------------------------------+

--          
(root@Slave)[tempdb]>stop slave sql_thread;
Query OK, 0 rows affected (0.01 sec)

(root@Slave)[tempdb]>CHANGE MASTER TO MASTER_DELAY = 300;
Query OK, 0 rows affected (0.00 sec)

(root@Slave)[tempdb]>start slave sql_thread;
Query OK, 0 rows affected (0.02 sec)

(root@Slave)[tempdb]>show slave status \G
*************************** 1. row ***************************
             Slave_IO_Running: Yes
            Slave_SQL_Running: Yes
                    SQL_Delay: 300  

root@Slave)[tempdb]>show slave status \G
*************************** 1. row ***************************
           Retrieved_Gtid_Set: 1b64c25d-8d2b-11e6-9ac0-000c29b82d0d:76-99
            Executed_Gtid_Set: 1b64c25d-8d2b-11e6-9ac0-000c29b82d0d:1-99,
                               78336cdc-8cfb-11e6-ba9f-000c29328504:1-4
                Auto_Position: 1

--      binglog gtid
(root@Master)[tempdb]>show master status\G
*************************** 1. row ***************************
             File: node233-binlog.000004
         Position: 6970
     Binlog_Do_DB: 
 Binlog_Ignore_DB: 
Executed_Gtid_Set: 1b64c25d-8d2b-11e6-9ac0-000c29b82d0d:1-99
1 row in set (0.00 sec)

--    truncate t2
(root@Master)[tempdb]>truncate table t2;
Query OK, 0 rows affected (0.03 sec)

--        binglog gtid, 99   100,  100         ID
(root@Master)[tempdb]>show master status\G
*************************** 1. row ***************************
             File: node233-binlog.000004
         Position: 7121
     Binlog_Do_DB: 
 Binlog_Ignore_DB: 
Executed_Gtid_Set: 1b64c25d-8d2b-11e6-9ac0-000c29b82d0d:1-100
1 row in set (0.00 sec)

--        truncate   
(root@Slave)[tempdb]>stop slave sql_thread;
Query OK, 0 rows affected (0.01 sec)

(root@Slave)[tempdb]>set gtid_next='1b64c25d-8d2b-11e6-9ac0-000c29b82d0d:100';
Query OK, 0 rows affected (0.00 sec)

(root@Slave)[tempdb]>begin;commit;
Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.01 sec)

(root@Slave)[tempdb]>set gtid_next='AUTOMATIC';
Query OK, 0 rows affected (0.00 sec)

(root@Slave)[tempdb]>start slave sql_thread;
Query OK, 0 rows affected (0.02 sec)

(root@Slave)[tempdb]>show slave status \G
*************************** 1. row ***************************
               Slave_IO_State: Waiting for master to send event
                  Master_Host: Master
                  Master_User: repl
                  Master_Port: 3306
                Connect_Retry: 60
              Master_Log_File: node233-binlog.000004
          Read_Master_Log_Pos: 7121
               Relay_Log_File: node245-relay-bin.000003
                Relay_Log_Pos: 2982
        Relay_Master_Log_File: node233-binlog.000004
             Slave_IO_Running: Yes
            Slave_SQL_Running: Yes
             ...........................         
           Retrieved_Gtid_Set: 1b64c25d-8d2b-11e6-9ac0-000c29b82d0d:76-100
            Executed_Gtid_Set: 1b64c25d-8d2b-11e6-9ac0-000c29b82d0d:1-100,
                                                             78336cdc-8cfb-11e6-ba9f-000c29328504:1-4
                Auto_Position: 1

--               truncate,     binlog     gtid
--     ,       SET @@SESSION.GTID_NEXT= '1b64c25d-8d2b-11e6-9ac0-000c29b82d0d:100'
-- 100    truncate   gtid    
# mysqlbinlog --no-defaults -v -v --base64-output=DECODE-ROWS /data/node233-binlog.000004|grep -i \
> "truncate table t2" -A3 -B10  
###   @3='http://blog.csdn.net/robinson_0612' /* VARSTRING(50) meta=50 nullable=1 is_null=0 */
# at 6939
#161009 18:04:58 server id 233  end_log_pos 6970 CRC32 0x71c5121c     Xid = 1775
COMMIT/*!*/;
# at 6970
#161009 18:08:42 server id 233 end_log_pos 7035 CRC32 0x00ba9437 GTID last_committed=26 sequence_number=27
SET @@SESSION.GTID_NEXT= '1b64c25d-8d2b-11e6-9ac0-000c29b82d0d:100'/*!*/;
# at 7035
#161009 18:08:42 server id 233 end_log_pos 7121 CRC32 0x5a8b9723 Query thread_id=26 exec_time=0 error_code=0
SET TIMESTAMP=1476007722/*!*/;
truncate table t2
/*!*/;
SET @@SESSION.GTID_NEXT= 'AUTOMATIC' /* added by mysqlbinlog */ /*!*/;
DELIMITER ;

5.メインライブラリbinlogがpurgeされた場合(Errno:1236)
--       ,         
(root@Slave)[tempdb]>stop slave;
Query OK, 0 rows affected (0.08 sec)

--           
--      gtid_purged  
(root@Master)[tempdb]>show variables like '%gtid_purged%';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| gtid_purged   |       |
+---------------+-------+

--    binlog
(root@Master)[tempdb]>show binary logs;
+-----------------------+-----------+
| Log_name              | File_size |
+-----------------------+-----------+
| node233-binlog.000001 |   1362104 |
| node233-binlog.000002 |      1331 |
| node233-binlog.000003 |       217 |
| node233-binlog.000004 |      7121 |
+-----------------------+-----------+

(root@Master)[tempdb]>select * from t1;
+----+---------+------------------------------------+
| id | ename   | blog                               |
+----+---------+------------------------------------+
|  1 | leshami | http://blog.csdn.net/robinson_0612 |
|  2 | robin   | http://blog.csdn.net/leshami       |
+----+---------+------------------------------------+

--       
(root@Master)[tempdb]>delete from t1;

--    
(root@Master)[tempdb]>flush logs;

--    
(root@Master)[tempdb]>insert into t1 values(1,
    -> 'xuputi','http://blog.csdn.net/leshami');

(root@Master)[tempdb]>show binary logs;
+-----------------------+-----------+
| Log_name              | File_size |
+-----------------------+-----------+
| node233-binlog.000001 |   1362104 |
| node233-binlog.000002 |      1331 |
| node233-binlog.000003 |       217 |
| node233-binlog.000004 |      7513 |
| node233-binlog.000005 |       490 |
+-----------------------+-----------+

--  binlog
(root@Master)[tempdb]>purge binary logs to 'node233-binlog.000005';
Query OK, 0 rows affected (0.01 sec)

(root@Master)[tempdb]>show binary logs;
+-----------------------+-----------+
| Log_name              | File_size |
+-----------------------+-----------+
| node233-binlog.000005 |       490 |
+-----------------------+-----------+

--         gtid_purged 
(root@Master)[tempdb]>show variables like '%gtid_purged%';
+---------------+--------------------------------------------+
| Variable_name | Value                                      |
+---------------+--------------------------------------------+
| gtid_purged   | 1b64c25d-8d2b-11e6-9ac0-000c29b82d0d:1-101 |
+---------------+--------------------------------------------+

--      
(root@Slave)[tempdb]>start slave;
Query OK, 0 rows affected (0.00 sec)

--          purged
(root@Slave)[tempdb]>show slave status\G
*************************** 1. row ***************************
               Slave_IO_State: 
                  Master_Host: Master
                  Master_User: repl
                  Master_Port: 3306
                Connect_Retry: 60
              Master_Log_File: node233-binlog.000004
          Read_Master_Log_Pos: 7121
               Relay_Log_File: node245-relay-bin.000003
                Relay_Log_Pos: 3133
        Relay_Master_Log_File: node233-binlog.000004
             Slave_IO_Running: No
            Slave_SQL_Running: Yes
                    ...............
                Last_IO_Errno: 1236
                Last_IO_Error: Got fatal error 1236 from master when reading data from binary log:
                'The slave is connecting using CHANGE MASTER TO MASTER_AUTO_POSITION = 1, 
                 but the master has purged binary logs containing GTIDs that the slave requires.'
                       ..................
           Retrieved_Gtid_Set: 1b64c25d-8d2b-11e6-9ac0-000c29b82d0d:76-100
            Executed_Gtid_Set: 1b64c25d-8d2b-11e6-9ac0-000c29b82d0d:1-100,
                               78336cdc-8cfb-11e6-ba9f-000c29328504:1-4
                Auto_Position: 1

--    gtid_purged  ,   75
(root@Slave)[tempdb]>show variables like '%gtid_purged%';
+---------------+-------------------------------------------+
| Variable_name | Value                                     |
+---------------+-------------------------------------------+
| gtid_purged   | 1b64c25d-8d2b-11e6-9ac0-000c29b82d0d:1-75 |
+---------------+-------------------------------------------+                

--    
(root@Slave)[tempdb]>stop slave;
Query OK, 0 rows affected (0.01 sec)

--      gtid_purged      ,,  ,     GLOBAL.GTID_EXECUTED       
(root@Slave)[tempdb]>set global gtid_purged = '1b64c25d-8d2b-11e6-9ac0-000c29b82d0d:1-101';
ERROR 1840 (HY000): @@GLOBAL.GTID_PURGED can only be set when @@GLOBAL.GTID_EXECUTED is empty.

--    ,        gtid, gtid_executed      ,   gtid      binary log 
(root@Slave)[tempdb]>show global variables like '%gtid_executed%'\G
*************************** 1. row ***************************
Variable_name: gtid_executed
        Value: 1b64c25d-8d2b-11e6-9ac0-000c29b82d0d:1-100,
               78336cdc-8cfb-11e6-ba9f-000c29328504:1-4
*************************** 2. row ***************************
Variable_name: gtid_executed_compression_period
        Value: 1000

--        reset master,     binlog
(root@Slave)[tempdb]>reset master;
Query OK, 0 rows affected (0.05 sec)

--    gtid_executed     
(root@Slave)[tempdb]>show global variables like '%gtid_executed%'\G
*************************** 1. row ***************************
Variable_name: gtid_executed
        Value: 
*************************** 2. row ***************************
Variable_name: gtid_executed_compression_period
        Value: 1000

--      gtid_purged  
(root@Slave)[tempdb]>set global gtid_purged = '1b64c25d-8d2b-11e6-9ac0-000c29b82d0d:1-101';
Query OK, 0 rows affected (0.01 sec)

--    
(root@Slave)[tempdb]>start slave;
Query OK, 0 rows affected (0.03 sec)

--       ,    
--            delete          relay log   
--     binlog  purged,       ,   gtid_purged,                    
(root@Slave)[tempdb]>show slave status \G
*************************** 1. row ***************************
               Slave_IO_State: Waiting for master to send event
                  Master_Host: Master
                  Master_User: repl
                  Master_Port: 3306
                Connect_Retry: 60
              Master_Log_File: node233-binlog.000005
          Read_Master_Log_Pos: 490
               Relay_Log_File: node245-relay-bin.000004
                Relay_Log_Pos: 417
        Relay_Master_Log_File: node233-binlog.000005
             Slave_IO_Running: Yes
            Slave_SQL_Running: No
                ................
               Last_SQL_Error: Could not execute Write_rows event on table tempdb.t1; 
 Duplicate entry '1' for key 'PRIMARY', Error_code: 1062;
 handler error HA_ERR_FOUND_DUPP_KEY; the event's master log node233-binlog.000005, end_log_pos 459
           Retrieved_Gtid_Set: 1b64c25d-8d2b-11e6-9ac0-000c29b82d0d:76-100:102
            Executed_Gtid_Set: 1b64c25d-8d2b-11e6-9ac0-000c29b82d0d:1-101
                Auto_Position: 1

--      id 1   
(root@Slave)[tempdb]>delete from t1 where id=1;
Query OK, 1 row affected (0.05 sec)

--     sql_thread  
(root@Slave)[tempdb]>start slave sql_thread;
Query OK, 0 rows affected (0.02 sec)

--      
(root@Slave)[tempdb]>show slave status \G
*************************** 1. row ***************************
               Slave_IO_State: Waiting for master to send event
                  Master_Host: Master
                  Master_User: repl
                  Master_Port: 3306
                Connect_Retry: 60
              Master_Log_File: node233-binlog.000005
          Read_Master_Log_Pos: 490
               Relay_Log_File: node245-relay-bin.000004
                Relay_Log_Pos: 713
        Relay_Master_Log_File: node233-binlog.000005
             Slave_IO_Running: Yes
            Slave_SQL_Running: Yes

--       ,         gtid_purged            
--   ,           ,                   

五、まとめ
1、GTIDはグローバルトランザクションIDであり、主従アーキテクチャの配置を簡略化し、ライブラリからlogに関心を持たなくなった.fileとlog_pos 2、トランザクションIDの一意性により、他のスレーブライブラリのGTIDを他のスレーブライブラリに適用することが可能となる.すなわち、利便性を提供したfailover 3、GTIDは連続的で非空洞的であるため、衝突の場合、空のトランザクションを注入する必要がある4、マスターライブラリ上の予期せぬ削除対象による人為的なエラーを回避するための構成遅延