summaryrefslogtreecommitdiff
path: root/storage/innobase
diff options
context:
space:
mode:
authorunknown <mats@kindahl-laptop.dnsalias.net>2007-06-21 21:35:26 +0200
committerunknown <mats@kindahl-laptop.dnsalias.net>2007-06-21 21:35:26 +0200
commit09815b3943fff8f151837a59e28b593c0bad0b48 (patch)
tree998154c14117b7fb39699d7aed7e099fe437e2f9 /storage/innobase
parent3840be2f751bfa27ab5051fb5c02e4a6c4faf9b6 (diff)
parente463a4a3d65cbc76baa9844e03d889deb21c19dd (diff)
downloadmariadb-git-09815b3943fff8f151837a59e28b593c0bad0b48.tar.gz
Merge kindahl-laptop.dnsalias.net:/home/bkroot/mysql-5.1-rpl
into kindahl-laptop.dnsalias.net:/home/bk/b23051-mysql-5.1-rpl
Diffstat (limited to 'storage/innobase')
-rw-r--r--storage/innobase/handler/ha_innodb.cc54
1 files changed, 27 insertions, 27 deletions
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index e2c16ca193a..d23f4d6fe4a 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -2276,35 +2276,11 @@ Get the table flags to use for the statement. */
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;
}
@@ -6284,6 +6260,30 @@ ha_innobase::external_lock(
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;
prebuilt->sql_stat_start = TRUE;