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@stripped, 2007-06-21 14:02:46+02:00, mats@stripped +2 -0
BUG#23051 (READ COMMITTED breaks mixed and statement-based replication):
Moving error generating code from table_flags() to external_lock().
include/my_base.h@stripped, 2007-06-21 14:02:38+02:00, mats@stripped +3 -1
Adding handler error code HA_ERR_LOGGING_IMPOSSIBLE
storage/innobase/handler/ha_innodb.cc@stripped, 2007-06-21 14:02:38+02:00, mats@stripped +27 -27
Moving error generating code from table_flags() to external_lock().
# 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: kindahl-laptop.dnsalias.net
# Root: /home/bk/b23051-mysql-5.1-rpl
--- 1.101/include/my_base.h 2007-06-21 14:03:05 +02:00
+++ 1.102/include/my_base.h 2007-06-21 14:03:05 +02:00
@@ -396,7 +396,9 @@
#define HA_ERR_AUTOINC_READ_FAILED 166 /* Failed to get next autoinc value */
#define HA_ERR_AUTOINC_ERANGE 167 /* Failed to set row autoinc value */
#define HA_ERR_GENERIC 168 /* Generic error */
-#define HA_ERR_LAST 168 /*Copy last error nr.*/
+#define HA_ERR_LOGGING_IMPOSSIBLE 169 /* It is not possible to log this
+ statement */
+#define HA_ERR_LAST 169 /*Copy last error nr.*/
/* Add error numbers before HA_ERR_LAST and change it accordingly. */
#define HA_ERR_ERRORS (HA_ERR_LAST - HA_ERR_FIRST + 1)
--- 1.341/storage/innobase/handler/ha_innodb.cc 2007-06-21 14:03:06 +02:00
+++ 1.342/storage/innobase/handler/ha_innodb.cc 2007-06-21 14:03:06 +02:00
@@ -2276,35 +2276,11 @@
handler::Table_flags
ha_innobase::table_flags() const
{
- THD *const thd= current_thd;
- /* We are using thd->variables.tx_isolation here instead of
- trx->isolation_level since store_lock() has not been called
- yet.
-
- The trx->isolation_level is set inside store_lock() (which
- is called from mysql_lock_tables()) until after this
- function has been called (which is called in lock_tables()
- before that function calls mysql_lock_tables()). */
- ulong const tx_isolation= thd_tx_isolation(thd);
+ /* Need to use tx_isolation here since table flags is (also)
+ called before prebuilt is inited. */
+ ulong const tx_isolation = thd_tx_isolation(current_thd);
if (tx_isolation <= ISO_READ_COMMITTED)
- {
- ulong const binlog_format= thd->variables.binlog_format;
- /* Statement based binlogging does not work in these
- isolation levels since the necessary locks cannot
- be taken */
- if (binlog_format == BINLOG_FORMAT_STMT)
- {
- char buf[256];
- my_snprintf(buf, sizeof(buf),
- "Transaction level '%s' in InnoDB is"
- " not safe for binlog mode '%s'",
- tx_isolation_names[tx_isolation],
- binlog_format_names[binlog_format]);
- my_error(ER_BINLOG_LOGGING_IMPOSSIBLE, MYF(0), buf);
- }
return int_table_flags;
- }
-
return int_table_flags | HA_BINLOG_STMT_CAPABLE;
}
@@ -6283,6 +6259,30 @@
DBUG_PRINT("enter",("lock_type: %d", lock_type));
update_thd(thd);
+
+ /* Statement based binlogging does not work in isolation level
+ READ UNCOMMITTED and READ COMMITTED since the necessary
+ locks cannot be taken. In this case, we print an
+ informative error message and return with an error. */
+ if (lock_type == F_WRLCK)
+ {
+ ulong const binlog_format= thd->variables.binlog_format;
+ if (trx->isolation_level <= TRX_ISO_READ_COMMITTED &&
+ binlog_format == BINLOG_FORMAT_STMT)
+ {
+ char buf[256];
+ bool const read_uncommitted =
+ trx->isolation_level == TRX_ISO_READ_UNCOMMITTED;
+ my_snprintf(buf, sizeof(buf),
+ "Transaction level 'READ %sCOMMITTED' in"
+ " InnoDB is not safe for binlog mode '%s'",
+ read_uncommitted ? "UN" : "",
+ binlog_format_names[binlog_format]);
+ my_error(ER_BINLOG_LOGGING_IMPOSSIBLE, MYF(0), buf);
+ return HA_ERR_LOGGING_IMPOSSIBLE;
+ }
+ }
+
trx = prebuilt->trx;