Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mysqlbinarylog - uniqueness of table_id in TABLE_MAP_EVENT

I am trying to manually decode the mysql binary log ROW format. Every update/insert/delete event is preceeded by an TABLE_MAP_EVENT.

This event contains a table_id. I am using this id to build up an cache for the column definition of this table.

From time to time I am having errors in said cache, because mismatch of column information. I am currently not able to reproduce these problems in short living connections, only in log connections where binary log file rotation occurs.

I am suspecting that the table_id is only unique for one binary log file. Does anyone knows if this assumption holds true? Does anyone know where to find the documentation which declares what I can expect from the table_id?

Thanks in advance Björn

like image 859
bjoernhaeuser Avatar asked Nov 12 '22 00:11

bjoernhaeuser


1 Answers

No, there aren't any lookup tables for binary log table id values.

You have to process WRITE/UPDATE/DELETE binlog events with respect to their previous TABLE_MAP events.

Actually there is a TABLE_ID column inside INFORMATION_SCHEMA.INNODB_SYS_TABLES but those numbers are different than the table ids that occur in TABLE_MAP binary log events.

like image 54
az3 Avatar answered Nov 15 '22 06:11

az3