Below is the list of changes that have just been committed into a local
5.1 repository of mats. When mats 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
1.1875 05/04/15 10:26:58 mats@stripped +4 -0
WL#1012: Refactor db_ok() check from MYSQL_LOG to Log_event to allow
event overriding check.
sql/slave.cc
1.244 05/04/15 10:26:38 mats@stripped +3 -0
Added check method to avoid extreneous exporting and reduce dependencies.
sql/log_event.h
1.113 05/04/15 10:26:37 mats@stripped +22 -11
Factored out db_ok() check into event.
Configuration needed some change.
sql/log_event.cc
1.175 05/04/15 10:26:36 mats@stripped +21 -5
Factored out db_ok() check into event.
Moved assertions to get sensible messages.
sql/log.cc
1.161 05/04/15 10:26:36 mats@stripped +7 -4
Moved db test out of protected region.
# 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: mats
# Host: romeo.kindahl.net
# Root: /home/bk/w2325-mysql-5.1
--- 1.160/sql/log.cc 2005-04-04 10:50:29 +02:00
+++ 1.161/sql/log.cc 2005-04-15 10:26:36 +02:00
@@ -1555,11 +1555,15 @@
bool error= 1;
DBUG_ENTER("MYSQL_LOG::write(Log_event*)");
+#ifdef HAVE_REPLICATION
/*
Let the event decide if it want to go to the binlog.
*/
- if (!event_info->write_to_binlog())
+ if (!event_info->write_to_binlog()) {
+ DBUG_PRINT("info",("!write_to_binlog()"));
DBUG_RETURN(0); // Silently succeed
+ }
+#endif
pthread_mutex_lock(&LOCK_log);
@@ -1578,11 +1582,10 @@
"do the involved tables match (to be implemented)
binlog_[wild_]{do|ignore}_table?" (WL#1049)"
*/
- if ((thd && !(thd->options & OPTION_BIN_LOG)) ||
- (!db_ok(local_db, binlog_do_db, binlog_ignore_db)))
+ if (thd && !(thd->options & OPTION_BIN_LOG))
{
VOID(pthread_mutex_unlock(&LOCK_log));
- DBUG_PRINT("error",("!db_ok('%s')", local_db));
+ DBUG_PRINT("info",("!OPTION_BIN_LOG"));
DBUG_RETURN(0);
}
#endif /* HAVE_REPLICATION */
--- 1.174/sql/log_event.cc 2005-04-13 19:46:17 +02:00
+++ 1.175/sql/log_event.cc 2005-04-15 10:26:36 +02:00
@@ -456,6 +456,13 @@
DBUG_RETURN(0);
}
+bool Log_event::
+do_write_to_binlog() const
+{
+ extern bool check_binlog_db(const char*);
+ const char* the_db = const_cast<Log_event*>(this)->get_db();
+ return check_binlog_db(the_db);
+}
/*
Log_event::pack_info()
@@ -4799,6 +4806,13 @@
{
my_free(m_rows_buf, MYF(MY_WME));
m_rows_buf = m_rows_cur = m_rows_end = NULL;
+ m_dbnam = m_tblnam = NULL;
+}
+
+const char* Rows_log_event::
+get_db()
+{
+ return m_dbnam;
}
void Rows_log_event::
@@ -5137,15 +5151,17 @@
write_data_body(IO_CACHE* file)
{
DBUG_ENTER("Table_map_log_event::write_data_body(IO_CACHE*)");
- // To ensure that we can use VLE in the future.
- DBUG_ASSERT(m_dblen < 128);
- DBUG_ASSERT(m_tbllen < 128);
- DBUG_ASSERT(m_colcnt < 128);
-
DBUG_PRINT("info", ("m_dblen = %d; m_dbnam = %s",
m_dblen, m_dbnam));
DBUG_PRINT("info", ("m_tbllen = %d; m_tblnam = %s",
m_tbllen, m_tblnam));
+
+ // To ensure that we can use VLE in the future.
+ DBUG_ASSERT(m_dblen < 128);
+ DBUG_ASSERT(m_tbllen < 128);
+ DBUG_ASSERT(m_colcnt < 128);
+ DBUG_ASSERT(m_dbnam != NULL);
+ DBUG_ASSERT(m_tblnam != NULL);
byte const dbuf[] = { m_dblen };
byte const tbuf[] = { m_tbllen };
--- 1.112/sql/log_event.h 2005-04-13 19:46:17 +02:00
+++ 1.113/sql/log_event.h 2005-04-15 10:26:37 +02:00
@@ -642,6 +642,7 @@
const char* get_type_str();
#ifndef MYSQL_CLIENT
+#ifdef HAVE_REPLICATION
/*
Predicate to check if this event should be written to the binary
log. This function is called by MYSQL_LOG to decide if this event
@@ -669,21 +670,24 @@
bool can_be_cached() const {
return do_can_be_cached();
}
-#endif
-private:
-#ifndef MYSQL_CLIENT
+protected:
/*
Primitive for testing if the event should be written to the binary log.
The subclasses should override this if they do not want to be written to
- the binary log. By default, everything goes to the binary log.
+ the binary log.
+
+ By default, the event goes to the binary log if the database is OK given
+ the binlog-do-db and binlog-ignore-db options.
+
+ This member function is protected so that subclasses can use it in
+ implementing the checks, for example: some subclass might decide that this
+ test should not be made.
Return 'true' if the event should be written to the binary log, 'false'
otherwise.
*/
- virtual bool do_write_to_binlog() const {
- return true;
- }
+ virtual bool do_write_to_binlog() const;
/*
Primitive for testing if the event can be cached at all.
@@ -692,6 +696,7 @@
return true;
}
#endif
+#endif
};
/*
@@ -1665,10 +1670,12 @@
private:
#ifndef MYSQL_CLIENT
+#ifdef HAVE_REPLICATION
virtual bool do_write_to_binlog() const {
- return opt_binlog_row_level;
+ return opt_binlog_row_level && Log_event::do_write_to_binlog();
}
#endif
+#endif
};
@@ -1734,7 +1741,7 @@
virtual bool write_data_header(IO_CACHE* file);
virtual bool write_data_body(IO_CACHE* file);
- virtual const char* get_db() { return m_dbnam; }
+ virtual const char* get_db();
protected:
// The constructors are protected since you're supposed to inherit
@@ -1770,16 +1777,20 @@
bool m_is_transactional; // The table handler is transactional
private:
+
#ifndef MYSQL_CLIENT
+#ifdef HAVE_REPLICATION
+
virtual bool do_write_to_binlog() const {
- return opt_binlog_row_level;
+ // We deliberately do not check the databases here; see
+ // Log_event::do_write_to_binlog(). (Not there yet!!!)
+ return opt_binlog_row_level && Log_event::do_write_to_binlog();
}
virtual bool do_can_be_cached() const {
return opt_binlog_row_level && m_is_transactional;
}
-#ifdef HAVE_REPLICATION
/*
Primitive to prepare for a sequence of row executions.
--- 1.243/sql/slave.cc 2005-04-01 13:32:30 +02:00
+++ 1.244/sql/slave.cc 2005-04-15 10:26:38 +02:00
@@ -1237,6 +1237,9 @@
}
}
+bool check_binlog_db(const char* local_db) {
+ return db_ok(local_db, binlog_do_db, binlog_ignore_db);
+}
static int init_strvar_from_file(char *var, int max_size, IO_CACHE *f,
const char *default_val)
| Thread |
|---|
| • bk commit into 5.1 tree (mats:1.1875) | Mats Kindahl | 15 Apr |