-
Joao Gramacho authored
This patch added transaction length information to the Gtid_log_event in the binary log. The new information is calculated before writing the Gtid_log_event to the binary log, by consulting the binary log cache length, the amount of events present the cache, the Gtid_log_event length and checksumming flag on the cache. trx_length = cache_length + gtid_length + cache_checksum_active * (cache_events + 1 ) * CRC32_payload Where cache_checksum_active is 1 when binary log checksumming is ON and 0 otherwise. Code changes ------------ @libbinlogevents/*/control_events.{h|cpp}: Introduced the transaction_length parameter into Gtid_event. @rapid/plugin/group_replication/src/handlers/certification_handler.cc: Set the transaction_length for a copy of a Gtid_log_event. @rapid/plugin/group_replication/src/observer_trans.cc: Set the transaction_length for a transaction to be certified. @sql/binlog.cc: Introduced the infrastructure to count the amount of events present in a binary log cache. Introduced a function to state if checksum is enable for the binary log cache. MYSQL_BIN_LOG::write_gtid() now calculates and store the transaction length before writing the Gtid_log_event into the binary log. @sql/log_event.{h|cc}: Updated Gtid_log_event functions to dump event information (used by mysqlbinlog client program) and to write the transaction_length in Gtid_log_event::write_body_to_memory(). Created Gtid_log_event::set_trx_length_by_cache_size() function to calculate and set the transaction length based on binlog cache info. The mysqlbinlog client program will print "transaction_length=" followed by the transaction length information on the Gtid_log_event or 0 when the information is not available. Updated Gtid_log_event::get_data_size() to take into account the transaction_length field. Introduced Gtid_log_event::get_event_length() to answer with the Gtid_log_event length (including event header, but not CRC32). MTR include changes ------------------- @include/assert_transaction_length.inc: Assert all transaction lengths for a given binary/relay log file. @include/assert_transaction_length_all_logs.inc: Assert all transaction lengths for all server binary and relay log files. @include/mysqlbinlog.inc: Mask the transaction length output. @include/rpl_end.inc: Now supporting the optional '$rpl_assert_transaction_length' parameter. When set to 1, the include will call, without displaying output, assert_transaction_length_all_logs.inc for all servers on the test case. New test case ------------- @rpl.rpl_transaction_size Generate some random workload and assert all transactions length. Test cases changed or needed to be recorded again ------------------------------------------------- The test cases below source "include/mysqlbinlog.inc" or dump mysqlbinlog output that required masking the transaction length field: @binlog_gtid.binlog_gtid_mysqlbinlog_row @binlog_gtid.binlog_gtid_mysqlbinlog_row_innodb @binlog_gtid.binlog_gtid_mysqlbinlog_row_myisam @binlog_nogtid.binlog_mysqlbinlog_row @binlog_nogtid.binlog_mysqlbinlog_row_innodb @binlog_nogtid.binlog_mysqlbinlog_row_myisam @binlog_nogtid.binlog_mysqlbinlog_row_trans @rpl.rpl_multi_source_corrupt_repository @rpl_nogtid.rpl_binlog_json @rpl_nogtid.rpl_row_ignorable_event @group_replication.gr_foreign_key_on_unique_key @group_replication.gr_parallel_applier_indexes @group_replication.gr_parallel_applier_sequential_indexes
Joao Gramacho authoredThis patch added transaction length information to the Gtid_log_event in the binary log. The new information is calculated before writing the Gtid_log_event to the binary log, by consulting the binary log cache length, the amount of events present the cache, the Gtid_log_event length and checksumming flag on the cache. trx_length = cache_length + gtid_length + cache_checksum_active * (cache_events + 1 ) * CRC32_payload Where cache_checksum_active is 1 when binary log checksumming is ON and 0 otherwise. Code changes ------------ @libbinlogevents/*/control_events.{h|cpp}: Introduced the transaction_length parameter into Gtid_event. @rapid/plugin/group_replication/src/handlers/certification_handler.cc: Set the transaction_length for a copy of a Gtid_log_event. @rapid/plugin/group_replication/src/observer_trans.cc: Set the transaction_length for a transaction to be certified. @sql/binlog.cc: Introduced the infrastructure to count the amount of events present in a binary log cache. Introduced a function to state if checksum is enable for the binary log cache. MYSQL_BIN_LOG::write_gtid() now calculates and store the transaction length before writing the Gtid_log_event into the binary log. @sql/log_event.{h|cc}: Updated Gtid_log_event functions to dump event information (used by mysqlbinlog client program) and to write the transaction_length in Gtid_log_event::write_body_to_memory(). Created Gtid_log_event::set_trx_length_by_cache_size() function to calculate and set the transaction length based on binlog cache info. The mysqlbinlog client program will print "transaction_length=" followed by the transaction length information on the Gtid_log_event or 0 when the information is not available. Updated Gtid_log_event::get_data_size() to take into account the transaction_length field. Introduced Gtid_log_event::get_event_length() to answer with the Gtid_log_event length (including event header, but not CRC32). MTR include changes ------------------- @include/assert_transaction_length.inc: Assert all transaction lengths for a given binary/relay log file. @include/assert_transaction_length_all_logs.inc: Assert all transaction lengths for all server binary and relay log files. @include/mysqlbinlog.inc: Mask the transaction length output. @include/rpl_end.inc: Now supporting the optional '$rpl_assert_transaction_length' parameter. When set to 1, the include will call, without displaying output, assert_transaction_length_all_logs.inc for all servers on the test case. New test case ------------- @rpl.rpl_transaction_size Generate some random workload and assert all transactions length. Test cases changed or needed to be recorded again ------------------------------------------------- The test cases below source "include/mysqlbinlog.inc" or dump mysqlbinlog output that required masking the transaction length field: @binlog_gtid.binlog_gtid_mysqlbinlog_row @binlog_gtid.binlog_gtid_mysqlbinlog_row_innodb @binlog_gtid.binlog_gtid_mysqlbinlog_row_myisam @binlog_nogtid.binlog_mysqlbinlog_row @binlog_nogtid.binlog_mysqlbinlog_row_innodb @binlog_nogtid.binlog_mysqlbinlog_row_myisam @binlog_nogtid.binlog_mysqlbinlog_row_trans @rpl.rpl_multi_source_corrupt_repository @rpl_nogtid.rpl_binlog_json @rpl_nogtid.rpl_row_ignorable_event @group_replication.gr_foreign_key_on_unique_key @group_replication.gr_parallel_applier_indexes @group_replication.gr_parallel_applier_sequential_indexes
Loading