Below is the list of changes that have just been committed into a local
5.1 repository of mkindahl. When mkindahl does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet@stripped, 2006-09-04 14:09:29+02:00, mkindahl@stripped +5 -0
WL#3464 (Add replication event to denote gap in replication):
Added new event Gap_log_event.
sql/log_event.cc@stripped, 2006-09-04 14:09:18+02:00, mkindahl@stripped +48 -0
Adding new log event to denote a gap in the replication stream.
sql/log_event.h@stripped, 2006-09-04 14:09:18+02:00, mkindahl@stripped +34 -0
Adding new log event to denote a gap in the replication stream.
sql/rpl_injector.cc@stripped, 2006-09-04 14:09:19+02:00, mkindahl@stripped +7 -0
Adding member function to add a replication gap to the binary log.
sql/rpl_injector.h@stripped, 2006-09-04 14:09:19+02:00, mkindahl@stripped +13 -0
Adding member function to add a replication gap to the binary log.
sql/share/errmsg.txt@stripped, 2006-09-04 14:09:19+02:00, mkindahl@stripped +3 -0
New error message ER_BINLOG_MISSING_EVENTS
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: mkindahl
# Host: dl145k.mysql.com
# Root: /users/mkindahl/b21494-mysql-5.1-new-rpl
--- 1.237/sql/log_event.cc 2006-09-04 14:09:46 +02:00
+++ 1.238/sql/log_event.cc 2006-09-04 14:09:46 +02:00
@@ -918,6 +918,9 @@
case EXECUTE_LOAD_QUERY_EVENT:
ev = new Execute_load_query_log_event(buf, event_len, description_event);
break;
+ case GAP_EVENT:
+ ev = new Gap_log_event(buf, description_event);
+ break;
default:
DBUG_PRINT("error",("Unknown evernt code: %d",(int) buf[EVENT_TYPE_OFFSET]));
ev= NULL;
@@ -6857,3 +6860,48 @@
#endif
#endif /* defined(HAVE_ROW_BASED_REPLICATION) */
+
+
+
+/**************************************************************************
+ Gap_log_event member functions
+ **************************************************************************/
+
+Gap_log_event::Gap_log_event()
+: Log_event()
+{
+}
+
+Gap_log_event::Gap_log_event(const char* buf,
+ const Format_description_log_event* descr_event)
+: Log_event(buf, descr_event)
+{
+}
+
+Gap_log_event::~Gap_log_event()
+{
+}
+
+#ifdef MYSQL_CLIENT
+void
+Gap_log_event::print(FILE* file,
+ PRINT_EVENT_INFO* print_event_info)
+{
+ if (print_event_info->short_form)
+ return;
+ print_header(file, print_event_info);
+ fputc('\n', file);
+ fprintf(file, "#Gap in binary log\n");
+}
+#endif
+
+#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
+int
+Gap_log_event::exec_event(st_relay_log_info *rli)
+{
+ slave_print_msg(ERROR_LEVEL, rli, ER_BINLOG_MISSING_EVENTS,
+ "Stopping slave");
+ return 1;
+}
+#endif
+
--- 1.136/sql/log_event.h 2006-09-04 14:09:46 +02:00
+++ 1.137/sql/log_event.h 2006-09-04 14:09:46 +02:00
@@ -446,6 +446,7 @@
WRITE_ROWS_EVENT = 20,
UPDATE_ROWS_EVENT = 21,
DELETE_ROWS_EVENT = 22,
+ GAP_EVENT = 23,
/*
Add new events here - right above this comment!
@@ -2142,5 +2143,38 @@
};
#endif /* HAVE_ROW_BASED_REPLICATION */
+
+/*
+ Class representing a replication gap in the binary log.
+
+ The event is added to the binary log when it is known or suspected
+ that the binary log is missing some events (containing a
+ *replication gap*) to be a truthful representation of the changes
+ done at the master server.
+ */
+
+class Gap_log_event
+: public Log_event
+{
+public:
+ Gap_log_event();
+ Gap_log_event(const char* buf,
+ const Format_description_log_event*);
+
+ virtual ~Gap_log_event();
+
+#ifdef MYSQL_CLIENT
+ virtual void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
+#endif
+
+#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
+ virtual int exec_event(struct st_relay_log_info* rli);
+#endif
+
+ virtual Log_event_type get_type_code() { return GAP_EVENT; }
+
+ virtual bool is_valid() const { return 1; }
+};
+
#endif /* _log_event_h */
--- 1.113/sql/share/errmsg.txt 2006-09-04 14:09:46 +02:00
+++ 1.114/sql/share/errmsg.txt 2006-09-04 14:09:46 +02:00
@@ -5841,3 +5841,6 @@
eng "The server was not built with row-based replication"
ER_NO_TRIGGERS_ON_SYSTEM_SCHEMA
eng "Triggers can not be created on system tables"
+ER_BINLOG_MISSING_EVENTS
+ eng "The binary log could be missing some events: please resynchronize master and slave"
--- 1.5/sql/rpl_injector.cc 2006-09-04 14:09:46 +02:00
+++ 1.6/sql/rpl_injector.cc 2006-09-04 14:09:46 +02:00
@@ -17,6 +17,7 @@
#include "mysql_priv.h"
#include "rpl_injector.h"
+#include "log_event.h"
#ifdef HAVE_ROW_BASED_REPLICATION
/*
@@ -190,4 +191,10 @@
DBUG_VOID_RETURN;
}
+
+int injector::add_gap()
+{
+ Gap_log_event ev;
+ return mysql_bin_log.write(&ev);
+}
#endif
--- 1.5/sql/rpl_injector.h 2006-09-04 14:09:46 +02:00
+++ 1.6/sql/rpl_injector.h 2006-09-04 14:09:46 +02:00
@@ -323,6 +323,19 @@
transaction new_trans(THD *);
void new_trans(THD *, transaction *);
+ /*
+ Add replication gap event into binary log.
+
+ SYNOPSIS
+ add_gap()
+
+ DESCRIPTION
+ Calling this member function will add a replication gap event
+ to the binary log. Calling this function with an open
+ transaction will not work, and will cause an error.
+ */
+ int add_gap();
+
private:
explicit injector();
~injector() { } /* Nothing needs to be done */
| Thread |
|---|
| • bk commit into 5.1 tree (mkindahl:1.2257) | Mats Kindahl | 4 Sep |