MySQL Lists are EOL. Please join:

List:Internals« Previous MessageNext Message »
From:shawn l.green Date:July 14 2015 5:43pm
Subject:Re: The Order or events TABLE_MAP_EVENT and WRITE_ROW_EVENT
View as plain text  
Hello Mansour,

Sorry for the delay. Tracking these mailing lists is a deep secondary 
task to my primary support duties.

On 6/8/2015 4:10 PM, Mansour Al Akeel wrote:
> Shawn,
> Awesome. I really appreciate this. so to be on the same page, this is
> a single transaction:
>
> SET TIMESTAMP=1433759876/*!*/;
> BEGIN
> /*!*/;
> # at 24592
> #150608 14:37:56 server id 1  end_log_pos 24648 CRC32 0x11bdc8ef
>   Table_map: `drupal`.`users` mapped to number 101
> # at 24648
> #150608 14:37:56 server id 1  end_log_pos 24719 CRC32 0xb900e1ef
>   Table_map: `drupal`.`audits` mapped to number 70
> # at 24719
> #150608 14:37:56 server id 1  end_log_pos 24793 CRC32 0x2a2bfa39
>   Write_rows: table id 101
> # at 24793
> #150608 14:37:56 server id 1  end_log_pos 24897 CRC32 0x36d45fd1
>   Write_rows: table id 70 flags: STMT_END_F
> # at 24897
> #150608 14:37:56 server id 1  end_log_pos 24928 CRC32 0x88350518
>   Xid = 484
> COMMIT/*!*/;
>
>
> Now, my question is can we rely on the order widthin the same commit.
> For example,
>
> begin
>   table map for users and audits
>   insert row for users and audits
> commit
>
> do the insert row events happen in same order as the table_map_events ?
> For example, can it be
>   WRITE_ROW_EVENT for audits, then users ??
>
> Can we rely on the order to match TABLE_MAP_EVENT with WRITE_ROW_EVENT ??
>

Yes. There will always be a TABLE_MAP_EVENT before a WRITE_ROW_EVENT. It 
is required to be there because the WRITE_ROW_EVENT refers to the target 
table by a number, not name. That number is established through a 
TABLE_MAP_EVENT.

A row event can reference any earlier table map within the Binary log. I 
would have to check the code to determine if every transaction always 
writes out a table map or if it is only emitted to the log if this is 
for a different table than the previous transaction or event.

-- 
Shawn Green
MySQL Senior Principal Technical Support Engineer
Oracle USA, Inc. - Integrated Cloud Applications & Platform Services
Office: Blountville, TN

Become certified in MySQL! Visit https://www.mysql.com/certification/ 
for details.
Thread
The Order or events TABLE_MAP_EVENT and WRITE_ROW_EVENTMansour Al Akeel8 Jun
  • Re: The Order or events TABLE_MAP_EVENT and WRITE_ROW_EVENTshawn l.green8 Jun
    • Re: The Order or events TABLE_MAP_EVENT and WRITE_ROW_EVENTMansour Al Akeel8 Jun
      • Re: The Order or events TABLE_MAP_EVENT and WRITE_ROW_EVENTshawn l.green14 Jul