Parsing MySQL Binlog--(6) Xid_event, rotate_event and stop

Source: Internet
Author: User

1, Xid_event

When a transaction commits, either statement or the row format Binlog adds a xid_event as the end of the transaction. The event records the ID of the transaction. When MySQL is recovering from a crash, it decides whether to commit a transaction in the prepared state of the storage engine based on the conditions submitted in Binlog.

2, Rotate_event

A Binlog event is added to the end of the Rotate_event file currently in use when the Binlog file size reaches the value of the Max_binlog_size parameter setting or executes the flush Logs command, and the binlog switch occurs. Record the name and location of the next Binlog file into the event.

3, Stop_event

When the MySQL service stops, a stop_event event is added at the end of the current Binlog file to indicate that the database is stopped. The event includes only one public event header, no private event header, and no event body. Just the event type of the public event header is required.
4. Code

Xid_log_event::write    Log_event::write_header    wrapper_my_b_safe_write(file, (uchar*) &xid, sizeof(xid))    write_footer(file))//checksumRotate_log_event::write    write_header(file, ROTATE_HEADER_LEN + ident_len)    wrapper_my_b_safe_write(file, (uchar*) buf, ROTATE_HEADER_LEN)    wrapper_my_b_safe_write(file, (uchar*) new_log_ident,(uint) ident_len)    write_footer(file))

Parsing MySQL Binlog--(6) Xid_event, rotate_event and stop

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.