In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Original: reprint please state the origin thank you!
Up connection
Http://blog.itpub.net/7728585/viewspace-2133188/
Reference source:
1. Source code log_event.h log_event.cc
2 、 internals-en.epub
Class:Format_description_log_event
Event:FORMAT_DESCRIPTION_EVENT
All binlog files after mysql 5.0 start with FORMAT_DESCRIPTION_EVENT (FED) event, and their typecode=15
And 0X0F
Its format is:
1 、 fixed data part
In the format version of 2 bytes:binlog, we can see that 5.6 Magi 5.7 must be v4.
50 bytes: this is a fixed 50-byte string showing the version of mysql server, complete with 0X00
That is, the first 0X00 indicates the end.
4 bytes: these 4-byte documents are said to be redundant, but shown in event header, they are all 0X00.
1 bytes: this byte directly indicates the length of our event header, V4 is 19
Var-size: these bytes are defined by the number of defined event 5.6. 5.7 is 40, that is, 40 bytes.
Explain the length of their fixed data (posted header).
2 、 variable data
None
Let's parse an actual binary format file
00000000 fe 62 69 6e bc df 98 58 0f 01 000000 77 0000 | .bin.X.w.. |
00000010 00 7b 000000 0000 04 00 35 2e 37 2e 31 34 2d |. {5.7.14-|
00000020 37 2d 64 65 62 75 67 2d 6c 6f 67 000000 0000 | 7-debug-log. |
00000030 000000 000000 000000 00000000 |. |
00000040 000000 000000 000000 13 |. |
00000050 38 0d 00 08 00 12 00 04 04 04 12 0000 5f 00 | 8.00. |
00000060 04 1a 08 000000 08 08 02 000000 0a 0a 0a |. |
00000070 2a 2a 00 12 34 00 01 55 88 2c 87
The mysqlbinlog output is:
# at 4
# 170207 4:42:36 server id 1 end_log_pos 123 CRC32 0x872c8855 Start: binlog v 4, server v 5.7.14-7-debug-log created 170207 4:42:36
BINLOG'
VN+YWA8BAAAAdwAAAHsAAAAAAAQANS43LjE0LTctZGVidWctbG9nAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAEzgNAAgAEgAEBAQEEgAAXwAEGggAAAAICAgCAAAACgoKKioAEjQA
AVWILIc=
'/ *! * /
Fe 62 69 6e:binlog begins with 4 bytes of magic
Event header
Bc df 98 58:timestamp, small end display, and 0X5898DFBC decimal 1486413756, with command
[root@testmy mysqld.1] # date-dudes 1486413756'
Tue Feb 7 04:42:36 CST 2017
You can see that the time is the same as 4:42:36 parsed by mysqbinlog
0f:event_type is 15
01 000000: service_id, small end shows 0X00000001 and 1
Mysql > show variables like 'server_id'
+-+ +
| | Variable_name | Value |
+-+ +
| | server_id | 1 | |
+-+ +
It is also consistent with server id 1 in mysqlbinlog
77 000000: event length and 0X00000077 and 119,123-4 (number of mana) is the next event.
7b 000000: the next event location 0X0000007b and 123is the same as the end_log_pos 123parsed by mysqlbinlog
00 00:flags. If it is 0X0001, it will report a warning in the MYSQLBINLOG output that this binlog is not closed.
04 00:binlog version, small end display and 0X0004, consistent with parsed Start: binlog v 4 in mysqlbinlog
35 2e 37 2e 31 34 2d 37 2d 64 65 62 75 67 2d 6c
6f 67 00 00 00
00 00 00
00 00:
This part is a 50-byte string whose ASCII value is 5.7.14-parsing in 7-debug-log and mysqlbinlog.
Server v 5.7.14-7-debug-log consistent
00 00 00: redundant timestamp, all 0X00
13 38 0d 00 08 00 12 00 04 04 04 12 00 00 5f
00 04 1a 08 00 00 00 08 08 08 02 00 00 00 0a 0a
0a 2a 2a 00 12 34 00 01:
This part is an array showing the length of the fixed data (posted header) of 40 known event
For example, 0a 0a 0a here happens to be array [30], array [31], array [32] (C language takes [0] as the number.
The beginning of the group) is what we need most.
WRITE_ROWS_EVENT
UPDATE_ROWS_EVENT
DELETE_ROWS_EVENT
The length 0X0A of fixed data (posted header) is 10, which will be explained in detail later.
55 88 2c 87: CRC32 check bit, small end display and CRC32 0x872c8855 consistency in 0X872C8855 and mysqlbinlog
Here, FORMAT_DESCRIPTION_EVENT parsing is complete.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.