Commit 2d445bb4 authored by vasil's avatar vasil

branches/zip:

Revert our temporary fix for "Bug#40360 Binlog related errors with binlog off"
(r2935, r2936) and deploy MySQL's one, but put the function
mysql_bin_log_is_engaged() inside mysql_addons.cc instead of in mysql's log.cc
and use a different name for it so there is no collision when MySQL adds this
function in log.cc.

[note from the future: the windows part of this patch went into r2947]

Approved by:	Marko (https://svn.innodb.com/rb/r/41/)
parent cb290201
...@@ -70,6 +70,7 @@ extern "C" { ...@@ -70,6 +70,7 @@ extern "C" {
#include "ha_innodb.h" #include "ha_innodb.h"
#include "i_s.h" #include "i_s.h"
#include "handler0vars.h" #include "handler0vars.h"
#include "mysql_addons.h"
#ifndef MYSQL_SERVER #ifndef MYSQL_SERVER
/* This is needed because of Bug #3596. Let us hope that pthread_mutex_t /* This is needed because of Bug #3596. Let us hope that pthread_mutex_t
...@@ -81,11 +82,6 @@ extern pthread_mutex_t LOCK_thread_count; ...@@ -81,11 +82,6 @@ extern pthread_mutex_t LOCK_thread_count;
but we need it here */ but we need it here */
bool check_global_access(THD *thd, ulong want_access); bool check_global_access(THD *thd, ulong want_access);
#endif /* MYSQL_VERSION_ID < 50124 */ #endif /* MYSQL_VERSION_ID < 50124 */
/* we need to check if binary logging is enabled in
ha_innobase::external_lock(), see http://bugs.mysql.com/40360.
The variable opt_bin_log is defined in mysqld.cc inside #ifdef MYSQL_SERVER */
extern bool opt_bin_log;
#endif /* MYSQL_SERVER */ #endif /* MYSQL_SERVER */
/** to protect innobase_open_files */ /** to protect innobase_open_files */
...@@ -7698,12 +7694,11 @@ ha_innobase::external_lock( ...@@ -7698,12 +7694,11 @@ ha_innobase::external_lock(
READ UNCOMMITTED and READ COMMITTED since the necessary READ UNCOMMITTED and READ COMMITTED since the necessary
locks cannot be taken. In this case, we print an locks cannot be taken. In this case, we print an
informative error message and return with an error. */ informative error message and return with an error. */
if (lock_type == F_WRLCK) if (lock_type == F_WRLCK && ib_bin_log_is_engaged(thd))
{ {
ulong const binlog_format= thd_binlog_format(thd); ulong const binlog_format= thd_binlog_format(thd);
ulong const tx_isolation = thd_tx_isolation(ha_thd()); ulong const tx_isolation = thd_tx_isolation(ha_thd());
if (opt_bin_log if (tx_isolation <= ISO_READ_COMMITTED
&& tx_isolation <= ISO_READ_COMMITTED
&& binlog_format == BINLOG_FORMAT_STMT) && binlog_format == BINLOG_FORMAT_STMT)
{ {
char buf[256]; char buf[256];
......
...@@ -27,7 +27,6 @@ extern bool* wdl_mysqld_embedded; ...@@ -27,7 +27,6 @@ extern bool* wdl_mysqld_embedded;
extern uint* wdl_lower_case_table_names; extern uint* wdl_lower_case_table_names;
extern ulong* wdl_specialflag; extern ulong* wdl_specialflag;
extern int* wdl_my_umask; extern int* wdl_my_umask;
extern bool* wdl_opt_bin_log;
#define my_charset_bin (*wdl_my_charset_bin) #define my_charset_bin (*wdl_my_charset_bin)
#define my_charset_latin1 (*wdl_my_charset_latin1) #define my_charset_latin1 (*wdl_my_charset_latin1)
...@@ -48,6 +47,5 @@ extern bool* wdl_opt_bin_log; ...@@ -48,6 +47,5 @@ extern bool* wdl_opt_bin_log;
#define lower_case_table_names (*wdl_lower_case_table_names) #define lower_case_table_names (*wdl_lower_case_table_names)
#define specialflag (*wdl_specialflag) #define specialflag (*wdl_specialflag)
#define my_umask (*wdl_my_umask) #define my_umask (*wdl_my_umask)
#define opt_bin_log (*wdl_opt_bin_log)
#endif #endif
...@@ -36,3 +36,16 @@ ib_thd_get_thread_id( ...@@ -36,3 +36,16 @@ ib_thd_get_thread_id(
{ {
return((unsigned long) ((THD*) thd)->thread_id); return((unsigned long) ((THD*) thd)->thread_id);
} }
/* http://bugs.mysql.com/40360 */
/* http://lists.mysql.com/commits/57450 */
/**
See if the binary log is engaged for a thread, i.e., open and
LOG_BIN is set.
@return @c true if the binlog is active, @c false otherwise.
*/
my_bool ib_bin_log_is_engaged(const MYSQL_THD thd)
{
return mysql_bin_log.is_open() && (thd->options & OPTION_BIN_LOG);
}
...@@ -55,7 +55,6 @@ bool* wdl_mysqld_embedded; ...@@ -55,7 +55,6 @@ bool* wdl_mysqld_embedded;
uint* wdl_lower_case_table_names; uint* wdl_lower_case_table_names;
ulong* wdl_specialflag; ulong* wdl_specialflag;
int* wdl_my_umask; int* wdl_my_umask;
bool* wdl_opt_bin_log;
/*********************************************************************** /***********************************************************************
The following is defined in ha_innodb.cc. It is used for copying the The following is defined in ha_innodb.cc. It is used for copying the
...@@ -608,8 +607,6 @@ wdl_get_external_variables(void) ...@@ -608,8 +607,6 @@ wdl_get_external_variables(void)
GET_SYM("?specialflag@@3KA", wdl_specialflag, ulong); GET_SYM("?specialflag@@3KA", wdl_specialflag, ulong);
GET_SYM("?builtin_innobase_plugin@@3PAUst_mysql_plugin@@A", GET_SYM("?builtin_innobase_plugin@@3PAUst_mysql_plugin@@A",
builtin_innobase_plugin_ptr, struct st_mysql_plugin); builtin_innobase_plugin_ptr, struct st_mysql_plugin);
GET_SYM("?opt_bin_log@@3_NA",
wdl_opt_bin_log, bool);
GET_SYM2("?system_charset_info@@3PEAUcharset_info_st@@EA", GET_SYM2("?system_charset_info@@3PEAUcharset_info_st@@EA",
"?system_charset_info@@3PAUcharset_info_st@@A", "?system_charset_info@@3PAUcharset_info_st@@A",
......
...@@ -15,6 +15,9 @@ here. In a perfect world this file exists but is empty. ...@@ -15,6 +15,9 @@ here. In a perfect world this file exists but is empty.
Created November 07, 2007 Vasil Dimov Created November 07, 2007 Vasil Dimov
*******************************************************/ *******************************************************/
#include <my_global.h> /* for my_bool */
#include <mysql/plugin.h> /* for MYSQL_THD */
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif /* __cplusplus */ #endif /* __cplusplus */
...@@ -32,3 +35,13 @@ ib_thd_get_thread_id( ...@@ -32,3 +35,13 @@ ib_thd_get_thread_id(
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif /* __cplusplus */ #endif /* __cplusplus */
/* http://bugs.mysql.com/40360 */
/* http://lists.mysql.com/commits/57450 */
/**
See if the binary log is engaged for a thread, i.e., open and
LOG_BIN is set.
@return @c true if the binlog is active, @c false otherwise.
*/
my_bool ib_bin_log_is_engaged(const MYSQL_THD thd);
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