Commit 406485ba authored by mats@kindahl-laptop.dnsalias.net's avatar mats@kindahl-laptop.dnsalias.net

Merge mkindahl@bk-internal.mysql.com:/home/bk/mysql-5.1-new-rpl

into  kindahl-laptop.dnsalias.net:/home/bkroot/mysql-5.1-rpl
parents 6e2ef9a6 7672a815
......@@ -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)
......
......@@ -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
......
......@@ -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 */;
......
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment