summaryrefslogtreecommitdiff
path: root/sql/log_event.h
diff options
context:
space:
mode:
authorunknown <mats@kindahl-laptop.dnsalias.net>2007-10-19 14:18:41 +0200
committerunknown <mats@kindahl-laptop.dnsalias.net>2007-10-19 14:18:41 +0200
commit74ef292dc2480e617a6fde4feea7e6595ddbc837 (patch)
tree1aeb2d68ea22e59e80ed1701a1b9cf1bfcf21927 /sql/log_event.h
parent9b7512af5cb9696275d1a9283e02a263efedc028 (diff)
downloadmariadb-git-74ef292dc2480e617a6fde4feea7e6595ddbc837.tar.gz
BUG#28618 (Skipping into the middle of a group with SQL_SLAVE_SKIP_COUNTER
is possible): When skipping the beginning of a transaction starting with BEGIN, the OPTION_BEGIN flag was not set correctly, which caused the slave to not recognize that it was inside a group. This patch sets the OPTION_BEGIN flag for BEGIN, COMMIT, ROLLBACK, and XID events. It also adds checks if inside a group before decreasing the slave skip counter to zero. Begin_query_log_event was not marked that it could not end a group, which is now corrected. mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test: Correcting slave skip counter to get the correct behaviour. mysql-test/suite/rpl/r/rpl_slave_skip.result: Result change. mysql-test/suite/rpl/t/rpl_slave_skip.test: Adding tests to check that skipping works for transactions: - Skipping one group with BEGIN first - Skipping two groups with BEGIN first - Skipping one group without BEGIN first but with AUTOCOMMIT=0 - LOAD DATA INFILE under statement-based replication mysql-test/suite/rpl_ndb/r/rpl_ndb_extraCol.result: Result change. sql/log_event.cc: Adding checks if we're in a group when the slave skip counter is 1. In that case, we should keep going. Adding helping member function Log_event::continue_group() denoting that this event cannot end a group, and if the skip counter indicates that the group ends after this event, it should not decrease the skip counter. Query_log_event will change the OPTION_BEGIN flag for BEGIN, COMMIT, and ROLLBACK, even when skipping because of a positive skip count, and Xid_log_event will also affect the OPTION_BEGIN flag, even when being skipped. Begin_load_query_log_event cannot end a group, so it is marked to continue the group. sql/log_event.h: Adding helper function Log_event::continue_group(). sql/rpl_rli.h: Adding Relay_log_info::get_flag() to get the value of a replication flag. sql/slave.cc: Adding debug output and changing debug message. mysql-test/suite/rpl/data/rpl_bug28618.dat: New BitKeeper file ``mysql-test/suite/rpl/data/rpl_bug28618.dat'' mysql-test/suite/rpl/t/rpl_slave_skip-slave.opt: New BitKeeper file ``mysql-test/suite/rpl/t/rpl_slave_skip-slave.opt''
Diffstat (limited to 'sql/log_event.h')
-rw-r--r--sql/log_event.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/sql/log_event.h b/sql/log_event.h
index 05d4c70042f..9321860a062 100644
--- a/sql/log_event.h
+++ b/sql/log_event.h
@@ -871,6 +871,25 @@ public:
protected:
/**
+ Helper function to ignore an event w.r.t. the slave skip counter.
+
+ This function can be used inside do_shall_skip() for functions
+ that cannot end a group. If the slave skip counter is 1 when
+ seeing such an event, the event shall be ignored, the counter
+ left intact, and processing continue with the next event.
+
+ A typical usage is:
+ @code
+ enum_skip_reason do_shall_skip(Relay_log_info *rli) {
+ return continue_group(rli);
+ }
+ @endcode
+
+ @return Skip reason
+ */
+ enum_skip_reason continue_group(Relay_log_info *rli);
+
+ /**
Primitive to apply an event to the database.
This is where the change to the database is made.
@@ -1086,6 +1105,7 @@ public:
public: /* !!! Public in this patch to allow old usage */
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
+ virtual enum_skip_reason do_shall_skip(Relay_log_info *rli);
virtual int do_apply_event(Relay_log_info const *rli);
virtual int do_update_pos(Relay_log_info *rli);
@@ -1559,6 +1579,7 @@ class Xid_log_event: public Log_event
private:
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
virtual int do_apply_event(Relay_log_info const *rli);
+ enum_skip_reason do_shall_skip(Relay_log_info *rli);
#endif
};
@@ -1937,6 +1958,10 @@ public:
*description_event);
~Begin_load_query_log_event() {}
Log_event_type get_type_code() { return BEGIN_LOAD_QUERY_EVENT; }
+private:
+#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
+ virtual enum_skip_reason do_shall_skip(Relay_log_info *rli);
+#endif
};