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文件會(huì)使用一個(gè)4字節(jié)的魔術(shù)數(shù)字去標(biāo)識(shí)該文件
在v4版本中.他叫做format description event
以下事件圖包含使用以下約定編寫(xiě)的字段說(shuō)明:
字段行具有描述字段內(nèi)容的名稱售睹。
名稱后跟兩個(gè)數(shù)字,以 offset:length 格式可训,其中offset是事件中字段的基于0的偏移量(位置)昌妹,length是字段的長(zhǎng)度。兩個(gè)值都以字節(jié)表示握截。
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 |
+=====================================+