In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
1. Introduction
row format binlog file, each ROW_EVENT is preceded by a TABLE_MAP_EVENT, used to describe the table's internal ID and structure definition.
mysql> show binlog events in "mysql-bin.000002";+------------------+-----+-------------+-----------+-------------+---------------------------------------------+| Log_name | Pos | Event_type | Server_id | End_log_pos | Info |+------------------+-----+-------------+-----------+-------------+---------------------------------------------+| mysql-bin.000002 | 4 | Format_desc | 11 | 120 | Server ver: 5.6.26-debug-log, Binlog ver: 4 || mysql-bin.000002 | 120 | Query | 11 | 191 | BEGIN || mysql-bin.000002 | 191 | Table_map | 11 | 236 | table_id: 70 (yzs.t1) || mysql-bin.000002 | 236 | Write_rows | 11 | 280 | table_id: 70 flags: STMT_END_F || mysql-bin.000002 | 280 | Xid | 11 | 311 | COMMIT /* xid=9 */ || mysql-bin.000002 | 311 | Query | 11 | 382 | BEGIN || mysql-bin.000002 | 382 | Table_map | 11 | 427 | table_id: 70 (yzs.t1) || mysql-bin.000002 | 427 | Write_rows | 11 | 471 | table_id: 70 flags: STMT_END_F || mysql-bin.000002 | 471 | Xid | 11 | 502 | COMMIT /* xid=37 */ |+------------------+-----+-------------+-----------+-------------+---------------------------------------------+9 rows in set (0.00 sec)
Table_MAP_EVENT format definition
3. Combined with case description
-------Public Event Header-------
1) timestamp: 62 ca a4 5a: 4 bytes
2) event_type: 13:1 byte,TABLE_MAP_EVENT = 19
3) server-id: 0b 00 00 00,4 bytes, i.e. 11
4) event_size: 2d 00 00 00,4 bytes, i.e. the total event size is 45 bytes
5) next-log ps: ec 00 00 00,4 bytes, i.e. 236
6)flag:00 00
---------Private Event Header-------
7) Table ID: 46 00 00 00 00, i.e. table ID is 70
8) flag: 01 00, temporarily unused
-----------------------------------------
9) schema name length: 03, i.e. schema name size is 3 bytes
10)schema name:79 7a 73,yzs
11)00
12) table name length: 02, i.e. table name size is 2 bytes
Table name: 74 31, i.e. table name is t1
14)00
col count: 02, i.e. the number of columns is 2
16)col type:03 03
enum enum_field_types { MYSQL_TYPE_DECIMAL, MYSQL_TYPE_TINY, MYSQL_TYPE_SHORT, MYSQL_TYPE_LONG, MYSQL_TYPE_FLOAT, MYSQL_TYPE_DOUBLE, MYSQL_TYPE_NULL, MYSQL_TYPE_TIMESTAMP, MYSQL_TYPE_LONGLONG,MYSQL_TYPE_INT24, MYSQL_TYPE_DATE, MYSQL_TYPE_TIME, MYSQL_TYPE_DATETIME, MYSQL_TYPE_YEAR, MYSQL_TYPE_NEWDATE, MYSQL_TYPE_VARCHAR, MYSQL_TYPE_BIT, MYSQL_TYPE_TIMESTAMP2, MYSQL_TYPE_DATETIME2, MYSQL_TYPE_TIME2, MYSQL_TYPE_NEWDECIMAL=246, MYSQL_TYPE_ENUM=247, MYSQL_TYPE_SET=248, MYSQL_TYPE_TINY_BLOB=249, MYSQL_TYPE_MEDIUM_BLOB=250, MYSQL_TYPE_LONG_BLOB=251, MYSQL_TYPE_BLOB=252, MYSQL_TYPE_VAR_STRING=253, MYSQL_TYPE_STRING=254, MYSQL_TYPE_GEOMETRY=255 };
17) col meta length: 00, 1 byte
18) col meta: None
19) null bitmap: 02, the number of columns is 2, one byte is enough: 0000010, that is, the primary key column cannot be NULL
20) checksum, not in the event body. d8 b9 92 2b
The write_footer function finally calculates checksum and places it after the event body.
virtual bool write(IO_CACHE* file) { return(write_header(file, get_data_size()) || write_data_header(file) || write_data_body(file) || write_footer(file)); } # at 191 #180310 21:53:38 server id 11 end_log_pos 236 CRC32 0x2b92b9d8 Table_map: `yzs`.` t1` mapped to number 70
You can see the consistency with the binlog file.
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.