A ROWS_EVENT_V1 is written for row based replication if data is inserted, deleted or updated:

Event types

WRITE_ROWS_EVENT_V1Insert new row
UPDATE_ROWS_EVENT_V1Update existing row
DELETE_ROWS_EVENT_V1Delete existing row
  • WRITE_ROWS_EVENT_V1: Event Type is 23 (0x17)
  • UPDATE_ROWS_EVENT_V1: Event Type is 24 (0x18)
  • DELETE_ROWS_EVENT_V1: Event Type is 25 (0x19)

Fields

  • uint<6> The table id
  • uint<2> Flags
  • uint<lenenc> Number of columns
  • byte<n>Columns used. n = (number_of_columns + 7)/8
  • if (event_type == UPDATE_ROWS_EVENT_v1
    • byte<n> Columns used (Update). n = (number_of_columns + 7)/8
  • byte<n> Null Bitmap (n = (number_of_columns + 7)/8)
  • string<len> Column data. The length needs to be calculated by checking the column types from referring TABLE_MAP_EVENT.
  • if (event_type == UPDATE_ROWS_EVENT_v1
    • byte<n> Null Bitmap_Update. n = (number_of_columns + 7)/8
    • string<len> Update Column data. The length needs to be calculated by checking the used colums bitmap and column types from referring TABLE_MAP_EVENT.

Flags

0x0001End of statement
0x0002No foreign key checks
0x0004No unique key checks

Example From mysqlbinlog Utility, CRC32

# at 1680
#180611  9:50:51 server id 1  end_log_pos 1754 CRC32 0x5415a8fb 	Write_rows: table id 23 flags: STMT_END_F

BINLOG '
2ykeWxMBAAAAPgAAAJAGAAAAABcAAAAAAAEABHRlc3QACWJ1bGtfbnVsbAAFDwMFE/YGFAAIAAMB
H1bULg8=
2ykeWxcBAAAASgAAANoGAAAAABcAAAAAAAEABf/gATMDAAAAAAAAAAAACECAAACDAP/gATMDAAAA
AAAAAAAACECAAACDAPuoFVQ=
'/*!*/;

Example Event As It's Written In The Binlog File

               db 29 1e 5b 17 01 00 00 00 4a 00       .).[.....J.
00 00 da 06 00 00 00 00 17 00 00 00 00 00 01 00  ................
05 ff e0 01 33 03 00 00 00 00 00 00 00 00 00 08  ....3...........
40 80 00 00 83 00 ff e0 01 33 03 00 00 00 00 00  @........3......
00 00 00 00 08 40 80 00 00 83 00 fb a8 15 54     .....@........T                                   ....

Comments

Comments loading...