To enable any future binary log formats to be correctly understood, the following conventions must hold:
a) The binary log file must start with a descriptor event
b) The descriptor event must start with a v3 header (19 bytes)
c) The 2 bytes following the header (at position 19) must contain the binary log format version number
With respect to the current formats, only a) holds for v1.
However, as indicated earlier, v1-format files can be recognized
from the initial event in the file, by a type code of
START_EVENT_V3 and an event length less than
The v4 format description event is designed so that it can handle future format updates. A new format with the same layout of event packets as in v4 but with additional fields in the header and post-headers can use this format description event to correctly describe itself. Actually, it is (theoretically) possible to have different "flavors" of v4 format that have different (larger) header lengths and even a different number of events.
The current code is written to handle this possibility. That is, any code that parses a binary log and discovers that it is v4 uses the header lengths as given by the format description event (thus potentially different lengths from the values hard-wired in the server code).
Note: Although headers of events in v4 format can be longer than
19 bytes, the format description event is an exception. Its
header is always 19 bytes long to meet the preceding backward
compatibility requirements. That is, the
FORMAT_DESCRIPTION_EVENT does not include an
Copyright © 1997, 2014, Oracle and/or its affiliates. All rights reserved. Legal Notices