summaryrefslogtreecommitdiff
path: root/sql/log_event.h
diff options
context:
space:
mode:
authorAndrei Elkin <aelkin@mysql.com>2010-01-25 17:46:48 +0200
committerAndrei Elkin <aelkin@mysql.com>2010-01-25 17:46:48 +0200
commitcfa7e83d6deee0acb2c003e94617be115e07814e (patch)
treefcea4c5374abb9164d112aa9bdc9e46da35220b2 /sql/log_event.h
parent4519d5e4f1ce1c9081f711d88d7508f58453d219 (diff)
downloadmariadb-git-cfa7e83d6deee0acb2c003e94617be115e07814e.tar.gz
Bug #47142 "slave start until" stops 1 event too late in 4.1 to 5.0 replication
When replicating from 4.1 master to 5.0 slave START SLAVE UNTIL can stop too late. The necessary in calculating of the beginning of an event the event's length did not correspond to the master's genuine information at the event's execution time. That piece of info was changed at the event's relay-logging due to binlog_version<4 event conversion by IO thread. Fixed with storing the master genuine Query_log_event size into a new status variable at relay-logging of the event. The stored info is extacted at the event execution and participate further to caclulate the correct start position of the event in the until-pos stopping routine. The new status variable's algorithm will be only active when the event comes from the master of version < 5.0 (binlog_version < 4). mysql-test/r/rpl_until.result: results changed. mysql-test/std_data/bug47142_master-bin.000001: a binlog from 4.1 master to replace one of the running 5.x master is added as part of Bug #47142 regression test. mysql-test/t/rpl_until.test: Regression test for Bug #47142 is added. sql/log_event.cc: Storing and extracting the master's genuine size of the event from the status var of the event packet header. The binlog_version<4 query-log-event is a. converted into the modern binlog_version==4 to store the original size of the event into a new status var; the converted representation goes into the relay log. b. the converted event is read out and the stored size is engaged in the start pos calculation. The new status is active only for events that IO thread instantiates for the sake of the conversion. sql/log_event.h: Incrementing the max szie of MAX_SIZE_LOG_EVENT_STATUS because of the new status var; Defining the new status variable to hold the master's genuine event size; Augmenting the Query_log_event with a new member to hold a value to store/extact from the status var of the event packet header.
Diffstat (limited to 'sql/log_event.h')
-rw-r--r--sql/log_event.h15
1 files changed, 14 insertions, 1 deletions
diff --git a/sql/log_event.h b/sql/log_event.h
index 45e3d11b48c..10b374199de 100644
--- a/sql/log_event.h
+++ b/sql/log_event.h
@@ -212,7 +212,8 @@ struct sql_ex_info
1 + 1 + 255 /* type, length, time_zone */ + \
1 + 2 /* type, lc_time_names_number */ + \
1 + 2 /* type, charset_database_number */ + \
- 1 + 8 /* type, table_map_for_update */)
+ 1 + 8 /* type, table_map_for_update */ + \
+ 1 + 4 /* type, master_data_written */)
#define MAX_LOG_EVENT_HEADER ( /* in order of Query_log_event::write */ \
LOG_EVENT_HEADER_LEN + /* write_header */ \
QUERY_HEADER_LEN + /* write_data */ \
@@ -278,6 +279,9 @@ struct sql_ex_info
#define Q_CHARSET_DATABASE_CODE 8
#define Q_TABLE_MAP_FOR_UPDATE_CODE 9
+
+#define Q_MASTER_DATA_WRITTEN_CODE 10
+
/* Intvar event post-header */
#define I_TYPE_OFFSET 0
@@ -810,6 +814,15 @@ public:
statement, for other query statements, this will be zero.
*/
ulonglong table_map_for_update;
+ /*
+ Holds the original length of a Query_log_event that comes from a
+ master of version < 5.0 (i.e., binlog_version < 4). When the IO
+ thread writes the relay log, it augments the Query_log_event with a
+ Q_MASTER_DATA_WRITTEN_CODE status_var that holds the original event
+ length. This field is initialized to non-zero in the SQL thread when
+ it reads this augmented event.
+ */
+ uint32 master_data_written;
#ifndef MYSQL_CLIENT