GTID_SUBSET . If this statement returns nonzero (true), all the identified GTIDs from source2  (the first set input) are also in the replica’s gtid_executed  set (the second set input), meaning that the replica has replicated all the transactions that originated from source2 . 

## 17.1.4 Changing GTID Mode on Online Servers 

This section describes how to change the mode of replication from and to GTID mode without having to take the server offline. 

## 17.1.4.1 Replication Mode Concepts 

To be able to safely configure the replication mode of an online server it is important to understand some key concepts of replication. This section explains these concepts and is essential reading before attempting to modify the replication mode of an online server. 

The modes of replication available in MySQL rely on different techniques for identifying transactions which are logged. The types of transactions used by replication are as follows: 

•GTID transactions are identified by a global transaction identifier (GTID) in the form UUID:NUMBER . Every GTID transaction in a log is always preceded by a Gtid_log_event . GTID transactions can be addressed using either the GTID or using the file name and position. 

•Anonymous transactions do not have a GTID assigned, and MySQL ensures that every anonymous transaction in a log is preceded by an Anonymous_gtid_log_event . In previous versions, anonymous transactions were not preceded by any particular event. Anonymous transactions can only be addressed using file name and position. 

When using GTIDs you can take advantage of GTID auto-positioning and automatic fail-over, as well as use WAIT_FOR_EXECUTED_GTID_SET() , session_track_gtids , and monitor replicated transactions using Performance Schema tables. 

Transactions in a relay log that was received from a source running a previous version of MySQL may not be preceded by any particular event at all, but after being replayed and logged in the replica’s binary log, they are preceded with an Anonymous_gtid_log_event . 

The ability to configure the replication mode online means that the gtid_mode  and enforce_gtid_consistency  variables are now both dynamic and can be set from a top-level statement by an account that has privileges sufficient to set global system variables. See Section 5.1.9.1, “System Variable Privileges” . In MySQL 5.6 and earlier, both of these variables could only be configured using the appropriate option at server start, meaning that changes to the replication mode required a server restart. In all versions gtid_mode  could be set to ON  or OFF , which corresponded to whether GTIDs were used to identify transactions or not. When gtid_mode=ON  it is not possible to replicate anonymous transactions, and when gtid_mode=OFF  only anonymous transactions can be replicated. When gtid_mode=OFF_PERMISSIVE  then new  transactions are anonymous while permitting replicated transactions to be either GTID or anonymous transactions. When gtid_mode=ON_PERMISSIVE  then new  transactions use GTIDs while permitting replicated transactions to be either GTID or anonymous transactions. This means it is possible to have a replication topology that has servers using both anonymous and GTID transactions. For example a source with gtid_mode=ON  could be replicating to a replica with gtid_mode=ON_PERMISSIVE . The valid values for gtid_mode  are as follows and in this order: 

• OFF 

• OFF_PERMISSIVE 

• ON_PERMISSIVE 

