In this tenth post of our series, we decode the ROTATE_EVENT — the event that closes a binary log file and tells every reader, replica or local, where to look next.
Introduction
The ROTATE_EVENT (event type
4, 0x04) is the bookmark MySQL leaves at the
end of a binary log file. It carries two pieces of information:
- The name of the binary log file to read next.
- The starting position within that
next file (always
4, the byte right after the 4-byte magic number from Part 2).
Together those two fields are enough for any reader — a replica's
I/O thread, a mysqlbinlog invocation, a
CDC tool — to seamlessly continue from one file into the next. …