Why GTID on Master is different from GTID on Slave while both are synced (MariaDB 10.5)?

832 views Asked by At

I have noticed that the Gtid_IO_Pos value is 0-1-557278 and gtid_current_pos on Master is 0-1-557279.

On Slave:

MariaDB [(none)]> show slave status\G
*************************** 1. row ***************************
                Slave_IO_State: Waiting for master to send event
                   Master_Host: 10.32.0.22
                   Master_User: maxscale
                   Master_Port: 3306
                 Connect_Retry: 60
               Master_Log_File: ON.000052
           Read_Master_Log_Pos: 949077
                Relay_Log_File: db-backup-relay-bin.000002
                 Relay_Log_Pos: 31221
         Relay_Master_Log_File: ON.000052
              Slave_IO_Running: Yes
             Slave_SQL_Running: Yes
               Replicate_Do_DB:
           Replicate_Ignore_DB:
            Replicate_Do_Table:
        Replicate_Ignore_Table:
       Replicate_Wild_Do_Table:
   Replicate_Wild_Ignore_Table:
                    Last_Errno: 0
                    Last_Error:
                  Skip_Counter: 0
           Exec_Master_Log_Pos: 949077
               Relay_Log_Space: 31534
               Until_Condition: None
                Until_Log_File:
                 Until_Log_Pos: 0
            Master_SSL_Allowed: No
            Master_SSL_CA_File:
            Master_SSL_CA_Path:
               Master_SSL_Cert:
             Master_SSL_Cipher:
                Master_SSL_Key:
         Seconds_Behind_Master: 0
 Master_SSL_Verify_Server_Cert: No
                 Last_IO_Errno: 0
                 Last_IO_Error:
                Last_SQL_Errno: 0
                Last_SQL_Error:
   Replicate_Ignore_Server_Ids:
              Master_Server_Id: 1
                Master_SSL_Crl:
            Master_SSL_Crlpath:
                    Using_Gtid: Slave_Pos
                   Gtid_IO_Pos: 0-1-557278
       Replicate_Do_Domain_Ids:
   Replicate_Ignore_Domain_Ids:
                 Parallel_Mode: conservative
                     SQL_Delay: 0
           SQL_Remaining_Delay: NULL
       Slave_SQL_Running_State: Slave has read all relay log; waiting for the slave I/O thread to update it
              Slave_DDL_Groups: 0
Slave_Non_Transactional_Groups: 0
    Slave_Transactional_Groups: 1415
1 row in set (0.001 sec)

MariaDB [(none)]>

On Master:

MariaDB [(none)]> show variables like '%pos%';
+-----------------------+---------------------------------------------+
| Variable_name         | Value                                       |
+-----------------------+---------------------------------------------+
| gtid_binlog_pos       | 0-1-557279                                  |
| gtid_current_pos      | 0-1-557279                                  |
| gtid_pos_auto_engines |                                             |
| gtid_slave_pos        |                                             |
| wsrep_start_position  | 7d28ce25-9a5a-11ea-9040-42d6a88cb619:721703 |
+-----------------------+---------------------------------------------+
5 rows in set (0.003 sec)

MariaDB [(none)]>

I checked the binlogs, events order is correct but the content

On Slave:

*************************** 7924. row ***************************
   Log_name: ON.000005
        Pos: 822231
 Event_type: Gtid
  Server_id: 1
End_log_pos: 822273
       Info: BEGIN GTID 0-1-557278
*************************** 7925. row ***************************
   Log_name: ON.000005
        Pos: 822273
 Event_type: Annotate_rows
  Server_id: 1
End_log_pos: 822471
       Info: INSERT INTO `ci_sessions` (`id`, `ip_address`, `timestamp`, `data`) VALUES ('s95eu66r81b64gg9glcf7495141kj5hs', '10.32.0.52', 1621415267, '__ci_last_regenerate|i:1621415267;')
*************************** 7926. row ***************************
   Log_name: ON.000005
        Pos: 822471
 Event_type: Table_map
  Server_id: 1
End_log_pos: 822544
       Info: table_id: 602 (prod_db.ci_sessions)
*************************** 7927. row ***************************
   Log_name: ON.000005
        Pos: 822544
 Event_type: Write_rows_v1
  Server_id: 1
End_log_pos: 822663
       Info: table_id: 602 flags: STMT_END_F
*************************** 7928. row ***************************
   Log_name: ON.000005
        Pos: 822663
 Event_type: Xid
  Server_id: 1
End_log_pos: 822694
       Info: COMMIT /* xid=6071 */

On Master:

*************************** 9169. row ***************************
   Log_name: ON.000052
        Pos: 945936
 Event_type: Gtid
  Server_id: 1
End_log_pos: 945978
       Info: BEGIN GTID 0-1-557279
*************************** 9170. row ***************************
   Log_name: ON.000052
        Pos: 945978
 Event_type: Annotate_rows
  Server_id: 1
End_log_pos: 946176
       Info: INSERT INTO `ci_sessions` (`id`, `ip_address`, `timestamp`, `data`) VALUES ('s95eu66r81b64gg9glcf7495141kj5hs', '10.32.0.52', 1621415267, '__ci_last_regenerate|i:1621415267;')
*************************** 9171. row ***************************
   Log_name: ON.000052
        Pos: 946176
 Event_type: Table_map
  Server_id: 1
End_log_pos: 946249
       Info: table_id: 21 (prod_db.ci_sessions)
*************************** 9172. row ***************************
   Log_name: ON.000052
        Pos: 946249
 Event_type: Write_rows_v1
  Server_id: 1
End_log_pos: 946368
       Info: table_id: 21 flags: STMT_END_F
*************************** 9173. row ***************************
   Log_name: ON.000052
        Pos: 946368
 Event_type: Xid
  Server_id: 1
End_log_pos: 946399
       Info: COMMIT /* xid=723331 */

I suspect this might confuse CHANGE MASTER TO statement.

I'd like to know if this is normal, if it's normal, how this GTID difference doesn't affect replication?

0

There are 0 answers