Do MySQL GTIDs get created for all transactions or just those that occur after enabling GTIDs?

dba.stackexchange https://dba.stackexchange.com/questions/187935

  •  09-10-2020
  •  | 
  •  

Question

I have a MySQL database that I'm going to start replicating, and I plan on using GTIDs to do so. The slave will be a brand new virtualized server located overseas.

My question is 2-fold:

  1. When I enable GTIDs on the existing master, will GTIDs be created for all previous transactions? Or will they only be created for transactions posted after enabling GTIDs?
  2. If yes, can I simply let the slave replay all of the GTIDs at its own pace?(meaning I don't have to sync the slave before enabling replication)
    • I don't care how long it takes the slave to sync (within reason, of course. 2 weeks is probably the max).

I'll be testing this out on some dummy dev servers come Monday or Tuesday, but I figured I'd ask here first.

Version and DB Info:

  • Master: MySQL 5.6.19 on Windows Server 2008R2 (EoL, I know...), but will be upgraded to 5.6.37 before starting replication and will then be upgraded to 5.7.x sometime thereafter.
    • log_bin for this server is currently OFF.
  • Slave: MySQL 5.7.19 on Ubuntu Server 16.04 LTS (verified compatible)
  • Size: It's probably considered a small database, totalling only about 330GB and something like 2.5 billion rows.

Previous Research

I couldn't find anything answering this question in the GTID docs nor in the entire replication docs.

So far, I've gone through and enabled both binary-log based replication GTID-based replication on various dev servers, but they 1) are very small/empty; 2) had log_bin enabled from the start; or 3) were synced before replication was enabled.

Was it helpful?

Solution

As I expected, GTIDs will not be created for pre-existing data.

This makes sense because, especially without the binlogs, how would the server know what transactions were used to generate the data?

Licensed under: CC-BY-SA with attribution
Not affiliated with dba.stackexchange
scroll top