binlog
A binary log file begins with a 4-byte magic number followed by an initial descriptor event that identifies the format of the file.
- In v1 and v3, this event is called a "start event."
- In v4, it is called a "format description event."
binlog文件会使用一个4字节的魔术数字去标识该文件
在v4版本中.他叫做format description event
以下事件图包含使用以下约定编写的字段说明:
字段行具有描述字段内容的名称。
名称后跟两个数字,以 offset:length 格式,其中offset是事件中字段的基于0的偏移量(位置),length是字段的长度。两个值都以字节表示。
v4 format description event (size ≥ 91 bytes; the size is 76 + the number of event types):
+=====================================+
| event | timestamp 0 : 4 |
| header +----------------------------+
| | type_code 4 : 1 | = FORMAT_DESCRIPTION_EVENT = 15
| +----------------------------+
| | server_id 5 : 4 |
| +----------------------------+
| | event_length 9 : 4 | >= 91
| +----------------------------+
| | next_position 13 : 4 |
| +----------------------------+
| | flags 17 : 2 |
+=====================================+
| event | binlog_version 19 : 2 | = 4
| data +----------------------------+
| | server_version 21 : 50 |
| +----------------------------+
| | create_timestamp 71 : 4 |
| +----------------------------+
| | header_length 75 : 1 |
| +----------------------------+
| | post-header 76 : n | = array of n bytes, one byte per event
| | lengths for all | type that the server knows about
| | event types |
+=====================================+