summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <mats@kindahl-laptop.dnsalias.net>2007-06-22 01:41:24 +0200
committerunknown <mats@kindahl-laptop.dnsalias.net>2007-06-22 01:41:24 +0200
commit292a95c1ff30d28edccbe30d88987fe3a074be60 (patch)
treedd5c2482c8e268e034a15a89a43f80594b49a540
parent274829b48103c140652fd824f07f64329be6b721 (diff)
parent08b43c99977bceb05d82b5a154c68387551310c2 (diff)
downloadmariadb-git-292a95c1ff30d28edccbe30d88987fe3a074be60.tar.gz
Merge mkindahl@bk-internal.mysql.com:/home/bk/mysql-5.1-new-rpl
into kindahl-laptop.dnsalias.net:/home/bkroot/mysql-5.1-rpl mysql-test/t/disabled.def: Auto merged
-rw-r--r--include/my_base.h4
-rw-r--r--mysql-test/t/disabled.def1
-rw-r--r--mysql-test/t/innodb.test8
-rw-r--r--storage/innobase/handler/ha_innodb.cc55
4 files changed, 37 insertions, 31 deletions
diff --git a/include/my_base.h b/include/my_base.h
index 617cdb8c3f0..f8830dc8a25 100644
--- a/include/my_base.h
+++ b/include/my_base.h
@@ -396,7 +396,9 @@ enum ha_base_keytype {
#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)
diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def
index 605a37228e5..1d37a3a7892 100644
--- a/mysql-test/t/disabled.def
+++ b/mysql-test/t/disabled.def
@@ -19,7 +19,6 @@ im_instance_conf : Bug#20294 2007-05-30 alik Instance manager tests
im_life_cycle : BUG#27851 Instance manager dies on ASSERT in ~Thread_registry() or from not being able to close a mysqld instance.
im_instance_conf : BUG#28743 Instance manager generates warnings in test suite
im_utils : BUG#28743 Instance manager generates warnings in test suite
-innodb : Disabling test case awaiting reply from Innobase
concurrent_innodb : BUG#21579 2006-08-11 mleich innodb_concurrent random failures with varying differences
ndb_autodiscover : BUG#18952 2006-02-16 jmiller Needs to be fixed w.r.t binlog
ndb_autodiscover2 : BUG#18952 2006-02-16 jmiller Needs to be fixed w.r.t binlog
diff --git a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test
index 1e07c3c9aff..21a1354381a 100644
--- a/mysql-test/t/innodb.test
+++ b/mysql-test/t/innodb.test
@@ -15,6 +15,10 @@
-- source include/have_innodb.inc
-- source include/have_log_bin.inc
+# Disabling it temporarily for statement-based logging since some
+# tests are not safe while binlog is on.
+-- source include/have_binlog_format_mixed_or_row.inc
+
#
# Small basic test with ignore
#
@@ -775,7 +779,7 @@ CREATE TABLE `t2` (
insert into t1 values (1,1),(2,2);
insert into t2 values (1,1),(4,4);
reset master;
---error ER_DUP_ENTRY_WITH_KEY_NAME
+--error ER_DUP_ENTRY
UPDATE t2,t1 SET t2.a=t1.a+2;
# check
select * from t2 /* must be (3,1), (4,4) */;
@@ -787,7 +791,7 @@ delete from t2;
insert into t1 values (1,2),(3,4),(4,4);
insert into t2 values (1,2),(3,4),(4,4);
reset master;
---error ER_DUP_ENTRY_WITH_KEY_NAME
+--error ER_DUP_ENTRY
UPDATE t2,t1 SET t2.a=t2.b where t2.a=t1.a;
show master status /* there must be no UPDATE query event */;
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index e2c16ca193a..bb16579c498 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,31 @@ 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;
+ ulong const tx_isolation = thd_tx_isolation(current_thd);
+ if (tx_isolation <= 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 '%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 HA_ERR_LOGGING_IMPOSSIBLE;
+ }
+ }
+
+
trx = prebuilt->trx;
prebuilt->sql_stat_start = TRUE;