diff options
author | Alfranio Correia <alfranio.correia@sun.com> | 2009-12-17 21:43:35 +0000 |
---|---|---|
committer | Alfranio Correia <alfranio.correia@sun.com> | 2009-12-17 21:43:35 +0000 |
commit | 3476b15af99b626bd21a835eeab22f3c9c9f307d (patch) | |
tree | fb25bfc9b6c669b42e70afadf7790f0f8d7db7e3 /storage | |
parent | 7c2c655ccfb163737ded33559d1942aeddec2970 (diff) | |
parent | 0758893afe391b14016eacb1fb6fa067eea9a548 (diff) | |
download | mariadb-git-3476b15af99b626bd21a835eeab22f3c9c9f307d.tar.gz |
merge mysql-5.1-rep+3 --> mysql-5.1-rep+2-delivery1
Diffstat (limited to 'storage')
-rw-r--r-- | storage/example/ha_example.cc | 8 | ||||
-rw-r--r-- | storage/example/ha_example.h | 8 | ||||
-rw-r--r-- | storage/innobase/handler/ha_innodb.cc | 32 | ||||
-rw-r--r-- | storage/innodb_plugin/handler/ha_innodb.cc | 11 |
4 files changed, 36 insertions, 23 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 30b4fc13012..25d3d1e5634 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -7120,22 +7120,22 @@ 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 - && thd_binlog_filter_ok(thd)) - { - 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 && + thd_binlog_filter_ok(thd)) + { + /* 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 b51e9186fe4..4e9cd777621 100644 --- a/storage/innodb_plugin/handler/ha_innodb.cc +++ b/storage/innodb_plugin/handler/ha_innodb.cc @@ -7914,6 +7914,7 @@ ha_innobase::external_lock( ulong const tx_isolation = thd_tx_isolation(ha_thd()); if (tx_isolation <= ISO_READ_COMMITTED && binlog_format == BINLOG_FORMAT_STMT + && !(table_flags() & HA_BINLOG_STMT_CAPABLE) #if MYSQL_VERSION_ID > 50140 && thd_binlog_filter_ok(thd) #endif /* MYSQL_VERSION_ID > 50140 */ @@ -7925,12 +7926,18 @@ ha_innobase::external_lock( " 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); + /* 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); } } - trx = prebuilt->trx; prebuilt->sql_stat_start = TRUE; |