summaryrefslogtreecommitdiff
path: root/storage
diff options
context:
space:
mode:
authorSven Sandberg <sven.sandberg@sun.com>2009-09-30 18:00:22 +0200
committerSven Sandberg <sven.sandberg@sun.com>2009-09-30 18:00:22 +0200
commit3d467f04a1caa994f165c0c4aae2ecfc3d1c9a1c (patch)
tree9294c1869671b21c13da2117df804e3a5b9a56a4 /storage
parentc7d32876f345785580a7cf286542ccf390b4e1fa (diff)
parentbfb1de9c065b6e9fd6b9fecb1c2db2b4475d3135 (diff)
downloadmariadb-git-3d467f04a1caa994f165c0c4aae2ecfc3d1c9a1c.tar.gz
merged fixes for BUG#39934 to 5.1-rpl+3
Also renamed current_stmt_binlog_row_based to current_stmt_binlog_format_row for consistency
Diffstat (limited to 'storage')
-rw-r--r--storage/example/ha_example.cc8
-rw-r--r--storage/example/ha_example.h8
-rw-r--r--storage/innobase/handler/ha_innodb.cc29
-rw-r--r--storage/innodb_plugin/handler/ha_innodb.cc24
4 files changed, 35 insertions, 34 deletions
diff --git a/storage/example/ha_example.cc b/storage/example/ha_example.cc
index 604722c3c8c..2c7512afda5 100644
--- a/storage/example/ha_example.cc
+++ b/storage/example/ha_example.cc
@@ -355,7 +355,13 @@ int ha_example::close(void)
int ha_example::write_row(uchar *buf)
{
DBUG_ENTER("ha_example::write_row");
- DBUG_RETURN(HA_ERR_WRONG_COMMAND);
+ /*
+ Example of a successful write_row. We don't store the data
+ anywhere; they are thrown away. A real implementation will
+ probably need to do something with 'buf'. We report a success
+ here, to pretend that the insert was successful.
+ */
+ DBUG_RETURN(0);
}
diff --git a/storage/example/ha_example.h b/storage/example/ha_example.h
index ec3987ced5d..e565bd5ffba 100644
--- a/storage/example/ha_example.h
+++ b/storage/example/ha_example.h
@@ -83,11 +83,11 @@ public:
ulonglong table_flags() const
{
/*
- We are saying that this engine is just row capable to have an
- engine that can only handle row-based logging. This is used in
- testing.
+ We are saying that this engine is just statement capable to have
+ an engine that can only handle statement-based logging. This is
+ used in testing.
*/
- return HA_BINLOG_ROW_CAPABLE;
+ return HA_BINLOG_STMT_CAPABLE;
}
/** @brief
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index b35f83cce58..3895a3072ef 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -6939,21 +6939,20 @@ ha_innobase::external_lock(
/* 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_binlog_format(thd);
- ulong const tx_isolation = thd_tx_isolation(current_thd);
- if (tx_isolation <= ISO_READ_COMMITTED &&
- 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);
+ informative error message and return with an error.
+ Note: decide_logging_format would give the same error message,
+ except it cannot give the extra details.
+ */
+ if (lock_type == F_WRLCK &&
+ !(table_flags() & HA_BINLOG_STMT_CAPABLE) &&
+ thd_binlog_format(thd) == BINLOG_FORMAT_STMT) {
+ /* The error may be suppressed by test cases, by setting
+ the no_innodb_binlog_errors debug symbol. */
+ if (DBUG_EVALUATE_IF("no_innodb_binlog_errors", 0, 1)) {
+ my_error(ER_BINLOG_STMT_MODE_AND_ROW_ENGINE, MYF(0),
+ " InnoDB is limited to row-logging when "
+ "transaction isolation level is "
+ "READ COMMITTED or READ UNCOMMITTED.");
DBUG_RETURN(HA_ERR_LOGGING_IMPOSSIBLE);
}
}
diff --git a/storage/innodb_plugin/handler/ha_innodb.cc b/storage/innodb_plugin/handler/ha_innodb.cc
index 682004407c7..c1858118827 100644
--- a/storage/innodb_plugin/handler/ha_innodb.cc
+++ b/storage/innodb_plugin/handler/ha_innodb.cc
@@ -7793,20 +7793,16 @@ ha_innobase::external_lock(
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_binlog_format(thd);
- ulong const tx_isolation = thd_tx_isolation(ha_thd());
- if (tx_isolation <= ISO_READ_COMMITTED &&
- 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);
+ if (lock_type == F_WRLCK &&
+ !(table_flags() & HA_BINLOG_STMT_CAPABLE) &&
+ thd_binlog_format(thd) == BINLOG_FORMAT_STMT) {
+ /* The error may be suppressed by test cases, by setting
+ the no_innodb_binlog_errors debug symbol. */
+ if (DBUG_EVALUATE_IF("no_innodb_binlog_errors", 0, 1)) {
+ my_error(ER_BINLOG_STMT_MODE_AND_ROW_ENGINE, MYF(0),
+ " InnoDB is limited to row-logging when "
+ "transaction isolation level is "
+ "READ COMMITTED or READ UNCOMMITTED.");
DBUG_RETURN(HA_ERR_LOGGING_IMPOSSIBLE);
}
}