summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mysql-test/r/rpl_flush_log_loop.result2
-rw-r--r--sql/handler.cc4
-rw-r--r--sql/item_func.cc2
-rw-r--r--sql/log.cc73
-rw-r--r--sql/log_event.cc10
-rw-r--r--sql/repl_failsafe.cc2
-rw-r--r--sql/sql_base.cc2
-rw-r--r--sql/sql_class.h14
-rw-r--r--sql/sql_db.cc4
-rw-r--r--sql/sql_delete.cc6
-rw-r--r--sql/sql_insert.cc8
-rw-r--r--sql/sql_load.cc8
-rw-r--r--sql/sql_parse.cc4
-rw-r--r--sql/sql_rename.cc2
-rw-r--r--sql/sql_repl.cc12
-rw-r--r--sql/sql_table.cc10
-rw-r--r--sql/sql_update.cc4
17 files changed, 78 insertions, 89 deletions
diff --git a/mysql-test/r/rpl_flush_log_loop.result b/mysql-test/r/rpl_flush_log_loop.result
index 3273ce43a17..18786b1931b 100644
--- a/mysql-test/r/rpl_flush_log_loop.result
+++ b/mysql-test/r/rpl_flush_log_loop.result
@@ -14,4 +14,4 @@ slave start;
flush logs;
show slave status;
Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
-127.0.0.1 root SLAVE_PORT 60 slave-bin.001 79 relay-log.002 119 slave-bin.001 Yes Yes 0 0 79 119
+127.0.0.1 root SLAVE_PORT 60 slave-bin.001 79 relay-log.002 4 slave-bin.001 Yes Yes 0 0 79 4
diff --git a/sql/handler.cc b/sql/handler.cc
index 0c95dbc4b31..4ea5bc0e9f5 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -346,7 +346,7 @@ int ha_commit_trans(THD *thd, THD_TRANS* trans)
bool transaction_commited= 0;
/* Update the binary log if we have cached some queries */
- if (trans == &thd->transaction.all && mysql_bin_log.is_open(1) &&
+ if (trans == &thd->transaction.all && mysql_bin_log.is_open() &&
my_b_tell(&thd->transaction.trans_log))
{
mysql_bin_log.write(thd, &thd->transaction.trans_log);
@@ -385,7 +385,7 @@ int ha_commit_trans(THD *thd, THD_TRANS* trans)
if (transaction_commited && thd->transaction.changed_tables)
query_cache.invalidate(thd->transaction.changed_tables);
#endif /*HAVE_QUERY_CACHE*/
- if (error && trans == &thd->transaction.all && mysql_bin_log.is_open(1))
+ if (error && trans == &thd->transaction.all && mysql_bin_log.is_open())
sql_print_error("Error: Got error during commit; Binlog is not up to date!");
thd->variables.tx_isolation=thd->session_tx_isolation;
if (operation_done)
diff --git a/sql/item_func.cc b/sql/item_func.cc
index f7b47736f33..8e9677cc459 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -1504,7 +1504,7 @@ void item_user_lock_free(void)
void item_user_lock_release(ULL *ull)
{
ull->locked=0;
- if (mysql_bin_log.is_open(1))
+ if (mysql_bin_log.is_open())
{
char buf[256];
String tmp(buf,sizeof(buf));
diff --git a/sql/log.cc b/sql/log.cc
index 96e1f1a2e01..1960c7d7cde 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
+/* Copyright (C) 2000-2003 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -82,14 +82,14 @@ static int find_uniq_filename(char *name)
MYSQL_LOG::MYSQL_LOG()
:bytes_written(0), last_time(0), query_start(0), name(0),
- file_id(1), open_count(1), log_type(LOG_CLOSED), write_error(0),
+ file_id(1), open_count(1), log_type(LOG_CLOSED), write_error(0), inited(0),
need_start_event(1)
{
/*
We don't want to initialize LOCK_Log here as such initialization depends on
safe_mutex (when using safe_mutex) which depends on MY_INIT(), which is
- called only in main(). Doing initialization here would make it happen before
- main().
+ called only in main(). Doing initialization here would make it happen
+ before main().
*/
index_file_name[0] = 0;
bzero((char*) &log_file,sizeof(log_file));
@@ -102,36 +102,21 @@ MYSQL_LOG::~MYSQL_LOG()
cleanup();
}
-void MYSQL_LOG::cleanup() /* this is called only once */
-{
- close(1);
- (void) pthread_mutex_destroy(&LOCK_log);
- (void) pthread_mutex_destroy(&LOCK_index);
- (void) pthread_cond_destroy(&update_cond);
-}
+/* this is called only once */
-bool MYSQL_LOG::is_open(bool need_mutex)
+void MYSQL_LOG::cleanup()
{
- /*
- Since MySQL 4.0.14, LOCK_log is always inited:
- * for log/update_log/slow_log/bin_log which are global objects, this is done in
- main(), even if the server does not use these logs.
- * for relay_log which belongs to rli which belongs to active_mi, this is
- done in the constructor of rli.
- In older versions, we were never 100% sure that LOCK_log was inited, which
- was a problem.
- */
- if (need_mutex)
+ if (inited)
{
- pthread_mutex_lock(&LOCK_log);
- bool res= (log_type != LOG_CLOSED);
- pthread_mutex_unlock(&LOCK_log);
- return res;
+ inited= 0;
+ close(1);
+ (void) pthread_mutex_destroy(&LOCK_log);
+ (void) pthread_mutex_destroy(&LOCK_index);
+ (void) pthread_cond_destroy(&update_cond);
}
- else
- return (log_type != LOG_CLOSED);
}
+
int MYSQL_LOG::generate_new_name(char *new_name, const char *log_name)
{
fn_format(new_name,log_name,mysql_data_home,"",4);
@@ -164,13 +149,17 @@ void MYSQL_LOG::init(enum_log_type log_type_arg,
DBUG_VOID_RETURN;
}
+
void MYSQL_LOG::init_pthread_objects()
{
+ DBUG_ASSERT(inited == 0);
+ inited= 1;
(void) pthread_mutex_init(&LOCK_log,MY_MUTEX_INIT_SLOW);
(void) pthread_mutex_init(&LOCK_index, MY_MUTEX_INIT_SLOW);
(void) pthread_cond_init(&update_cond, 0);
}
+
/*
Open a (new) log file.
@@ -647,7 +636,7 @@ int MYSQL_LOG::purge_first_log(struct st_relay_log_info* rli)
Assume that we have previously read the first log and
stored it in rli->relay_log_name
*/
- DBUG_ASSERT(is_open(1));
+ DBUG_ASSERT(is_open());
DBUG_ASSERT(rli->slave_running == 1);
DBUG_ASSERT(!strcmp(rli->linfo.log_file_name,rli->relay_log_name));
DBUG_ASSERT(rli->linfo.index_file_offset ==
@@ -818,7 +807,7 @@ void MYSQL_LOG::new_file(bool need_lock)
enum_log_type save_log_type;
DBUG_ENTER("MYSQL_LOG::new_file");
- if (!is_open(need_lock))
+ if (!is_open())
{
DBUG_PRINT("info",("log is closed"));
DBUG_VOID_RETURN;
@@ -832,7 +821,7 @@ void MYSQL_LOG::new_file(bool need_lock)
safe_mutex_assert_owner(&LOCK_log);
safe_mutex_assert_owner(&LOCK_index);
- // Reuse old name if not binlog and not update log
+ /* Reuse old name if not binlog and not update log */
new_name_ptr= name;
/*
@@ -971,11 +960,12 @@ err:
bool MYSQL_LOG::write(THD *thd,enum enum_server_command command,
const char *format,...)
{
- if (what_to_log & (1L << (uint) command))
+ if (is_open() && (what_to_log & (1L << (uint) command)))
{
int error=0;
VOID(pthread_mutex_lock(&LOCK_log));
+ /* Test if someone closed between the is_open test and lock */
if (is_open())
{
time_t skr;
@@ -1076,16 +1066,14 @@ bool MYSQL_LOG::write(Log_event* event_info)
#else
IO_CACHE *file = &log_file;
#endif
+ /*
+ In the future we need to add to the following if tests like
+ "do the involved tables match (to be implemented)
+ binlog_[wild_]{do|ignore}_table?" (WL#1049)"
+ */
if ((thd && !(thd->options & OPTION_BIN_LOG) &&
(thd->master_access & SUPER_ACL)) ||
- (local_db && !db_ok(local_db, binlog_do_db, binlog_ignore_db))
- /*
- This is the place for future tests like "do the involved tables match
- (to be implemented) binlog_[wild_]{do|ignore}_table?" (WL#1049):
- we will add a
- && ... to the if().
- */
- )
+ (local_db && !db_ok(local_db, binlog_do_db, binlog_ignore_db)))
{
VOID(pthread_mutex_unlock(&LOCK_log));
DBUG_PRINT("error",("!db_ok"));
@@ -1390,6 +1378,8 @@ bool MYSQL_LOG::write(THD *thd,const char *query, uint query_length,
{
bool error=0;
time_t current_time;
+ if (!is_open())
+ return 0;
VOID(pthread_mutex_lock(&LOCK_log));
if (is_open())
{ // Safety agains reopen
@@ -1503,6 +1493,7 @@ bool MYSQL_LOG::write(THD *thd,const char *query, uint query_length,
return error;
}
+
/*
Wait until we get a signal that the binary log has been updated
@@ -1588,6 +1579,7 @@ void MYSQL_LOG::close(bool exiting)
DBUG_VOID_RETURN;
}
+
void MYSQL_LOG::set_max_size(ulong max_size_arg)
{
/*
@@ -1605,6 +1597,7 @@ void MYSQL_LOG::set_max_size(ulong max_size_arg)
DBUG_VOID_RETURN;
}
+
/*
Check if a string is a valid number
diff --git a/sql/log_event.cc b/sql/log_event.cc
index 5a0a243c57b..a6d2abbf894 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -2167,7 +2167,7 @@ int Rand_log_event::exec_event(struct st_relay_log_info* rli)
int Slave_log_event::exec_event(struct st_relay_log_info* rli)
{
- if (mysql_bin_log.is_open(1))
+ if (mysql_bin_log.is_open())
mysql_bin_log.write(this);
return Log_event::exec_event(rli);
}
@@ -2217,7 +2217,7 @@ int Create_file_log_event::exec_event(struct st_relay_log_info* rli)
slave_print_error(rli,my_errno, "Write to '%s' failed", fname_buf);
goto err;
}
- if (mysql_bin_log.is_open(1))
+ if (mysql_bin_log.is_open())
mysql_bin_log.write(this);
error=0; // Everything is ok
@@ -2237,7 +2237,7 @@ int Delete_file_log_event::exec_event(struct st_relay_log_info* rli)
(void) my_delete(fname, MYF(MY_WME));
memcpy(p, ".info", 6);
(void) my_delete(fname, MYF(MY_WME));
- if (mysql_bin_log.is_open(1))
+ if (mysql_bin_log.is_open())
mysql_bin_log.write(this);
return Log_event::exec_event(rli);
}
@@ -2260,7 +2260,7 @@ int Append_block_log_event::exec_event(struct st_relay_log_info* rli)
slave_print_error(rli,my_errno, "Write to '%s' failed", fname);
goto err;
}
- if (mysql_bin_log.is_open(1))
+ if (mysql_bin_log.is_open())
mysql_bin_log.write(this);
error=0;
@@ -2319,7 +2319,7 @@ int Execute_load_log_event::exec_event(struct st_relay_log_info* rli)
(void) my_delete(fname, MYF(MY_WME));
memcpy(p, ".data", 6);
(void) my_delete(fname, MYF(MY_WME));
- if (mysql_bin_log.is_open(1))
+ if (mysql_bin_log.is_open())
mysql_bin_log.write(this);
error = 0;
diff --git a/sql/repl_failsafe.cc b/sql/repl_failsafe.cc
index 6f404d4b958..1552b3994e9 100644
--- a/sql/repl_failsafe.cc
+++ b/sql/repl_failsafe.cc
@@ -265,7 +265,7 @@ int translate_master(THD* thd, LEX_MASTER_INFO* mi, char* errmsg)
LINT_INIT(cmp_res);
DBUG_ENTER("translate_master");
- if (!mysql_bin_log.is_open(1))
+ if (!mysql_bin_log.is_open())
{
strmov(errmsg,"Binary log is not open");
DBUG_RETURN(1);
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 217597ccda5..43718e5d93b 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -574,7 +574,7 @@ void close_temporary_tables(THD *thd)
next=table->next;
close_temporary(table);
}
- if (query && found_user_tables && mysql_bin_log.is_open(1))
+ if (query && found_user_tables && mysql_bin_log.is_open())
{
/* The -1 is to remove last ',' */
Query_log_event qinfo(thd, query, (ulong)(end-query)-1, 0);
diff --git a/sql/sql_class.h b/sql/sql_class.h
index 24bbf9a6796..9908f034d7b 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -58,13 +58,10 @@ typedef struct st_log_info
class Log_event;
-class MYSQL_LOG {
+class MYSQL_LOG
+ {
private:
- /*
- LOCK_log is inited by MYSQL_LOG::init(), so one should try to lock it only
- if he is sure MYSQL_LOG::init() has been called (i.e. if 'inited' is true).
- Same for LOCK_index.
- */
+ /* LOCK_log and LOCK_index are inited by init_pthread_objects() */
pthread_mutex_t LOCK_log, LOCK_index;
pthread_cond_t update_cond;
ulonglong bytes_written;
@@ -84,7 +81,7 @@ class MYSQL_LOG {
*/
volatile enum_log_type log_type;
enum cache_type io_cache_type;
- bool write_error;
+ bool write_error, inited;
bool need_start_event;
bool no_auto_events; // for relay binlog
/*
@@ -162,8 +159,7 @@ public:
int find_next_log(LOG_INFO* linfo, bool need_mutex);
int get_current_log(LOG_INFO* linfo);
uint next_file_id();
- bool is_open(bool need_mutex=0);
-
+ inline bool is_open() { return log_type != LOG_CLOSED; }
inline char* get_index_fname() { return index_file_name;}
inline char* get_log_fname() { return log_file_name; }
inline pthread_mutex_t* get_log_lock() { return &LOCK_log; }
diff --git a/sql/sql_db.cc b/sql/sql_db.cc
index 6045955334c..6251b1ec624 100644
--- a/sql/sql_db.cc
+++ b/sql/sql_db.cc
@@ -84,7 +84,7 @@ int mysql_create_db(THD *thd, char *db, uint create_options, bool silent)
}
{
mysql_update_log.write(thd,thd->query, thd->query_length);
- if (mysql_bin_log.is_open(1))
+ if (mysql_bin_log.is_open())
{
Query_log_event qinfo(thd, thd->query, thd->query_length, 0);
mysql_bin_log.write(&qinfo);
@@ -174,7 +174,7 @@ int mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent)
thd->query= path;
}
mysql_update_log.write(thd, thd->query, thd->query_length);
- if (mysql_bin_log.is_open(1))
+ if (mysql_bin_log.is_open())
{
Query_log_event qinfo(thd, thd->query, thd->query_length, 0);
mysql_bin_log.write(&qinfo);
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc
index 8b81e57d419..45acbaaa7ef 100644
--- a/sql/sql_delete.cc
+++ b/sql/sql_delete.cc
@@ -172,7 +172,7 @@ cleanup:
if (deleted && (error <= 0 || !transactional_table))
{
mysql_update_log.write(thd,thd->query, thd->query_length);
- if (mysql_bin_log.is_open(1))
+ if (mysql_bin_log.is_open())
{
Query_log_event qinfo(thd, thd->query, thd->query_length,
log_delayed);
@@ -476,7 +476,7 @@ bool multi_delete::send_eof()
if (deleted && (error <= 0 || normal_tables))
{
mysql_update_log.write(thd,thd->query,thd->query_length);
- if (mysql_bin_log.is_open(1))
+ if (mysql_bin_log.is_open())
{
Query_log_event qinfo(thd, thd->query, thd->query_length,
log_delayed);
@@ -588,7 +588,7 @@ end:
if (!error)
{
mysql_update_log.write(thd,thd->query,thd->query_length);
- if (mysql_bin_log.is_open(1))
+ if (mysql_bin_log.is_open())
{
Query_log_event qinfo(thd, thd->query, thd->query_length,
thd->tmp_table);
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index f94963f2570..167ccf974c7 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -308,7 +308,7 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list, List<Item> &fields,
if ((info.copied || info.deleted) && (error <= 0 || !transactional_table))
{
mysql_update_log.write(thd, thd->query, thd->query_length);
- if (mysql_bin_log.is_open(1))
+ if (mysql_bin_log.is_open())
{
Query_log_event qinfo(thd, thd->query, thd->query_length,
log_delayed);
@@ -1143,7 +1143,7 @@ bool delayed_insert::handle_inserts(void)
{
int error;
uint max_rows;
- bool using_ignore=0, using_bin_log=mysql_bin_log.is_open(1);
+ bool using_ignore=0, using_bin_log=mysql_bin_log.is_open();
delayed_row *row;
DBUG_ENTER("handle_inserts");
@@ -1361,7 +1361,7 @@ void select_insert::send_error(uint errcode,const char *err)
if (last_insert_id)
thd->insert_id(last_insert_id); // For binary log
mysql_update_log.write(thd,thd->query,thd->query_length);
- if (mysql_bin_log.is_open(1))
+ if (mysql_bin_log.is_open())
{
Query_log_event qinfo(thd, thd->query, thd->query_length,
table->file->has_transactions());
@@ -1387,7 +1387,7 @@ bool select_insert::send_eof()
thd->insert_id(last_insert_id); // For binary log
/* Write to binlog before commiting transaction */
mysql_update_log.write(thd,thd->query,thd->query_length);
- if (mysql_bin_log.is_open(1))
+ if (mysql_bin_log.is_open())
{
Query_log_event qinfo(thd, thd->query, thd->query_length,
table->file->has_transactions());
diff --git a/sql/sql_load.cc b/sql/sql_load.cc
index 7a20fbfd928..ee573672c35 100644
--- a/sql/sql_load.cc
+++ b/sql/sql_load.cc
@@ -219,7 +219,7 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
DBUG_RETURN(-1); // Can't allocate buffers
}
- if (!opt_old_rpl_compat && mysql_bin_log.is_open(1))
+ if (!opt_old_rpl_compat && mysql_bin_log.is_open())
{
lf_info.thd = thd;
lf_info.ex = ex;
@@ -281,7 +281,7 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
{
if (transactional_table)
ha_autocommit_or_rollback(thd,error);
- if (!opt_old_rpl_compat && mysql_bin_log.is_open(1))
+ if (!opt_old_rpl_compat && mysql_bin_log.is_open())
{
if (lf_info.wrote_create_file)
{
@@ -315,7 +315,7 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
if (!log_delayed)
thd->options|=OPTION_STATUS_NO_TRANS_UPDATE;
- if (mysql_bin_log.is_open(1))
+ if (mysql_bin_log.is_open())
{
if (opt_old_rpl_compat)
{
@@ -607,7 +607,7 @@ READ_INFO::READ_INFO(File file_par, uint tot_length, String &field_term,
cache.read_function = _my_b_net_read;
need_end_io_cache = 1;
- if (!opt_old_rpl_compat && mysql_bin_log.is_open(1))
+ if (!opt_old_rpl_compat && mysql_bin_log.is_open())
cache.pre_read = cache.pre_close =
(IO_CACHE_CALLBACK) log_loaded_block;
}
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index a32dce4d704..70c0f772d7d 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -2432,7 +2432,7 @@ mysql_execute_command(void)
lex->sql_command == SQLCOM_REVOKE)))
{
mysql_update_log.write(thd, thd->query, thd->query_length);
- if (mysql_bin_log.is_open(1))
+ if (mysql_bin_log.is_open())
{
Query_log_event qinfo(thd, thd->query, thd->query_length, 0);
mysql_bin_log.write(&qinfo);
@@ -2452,7 +2452,7 @@ mysql_execute_command(void)
if (!res)
{
mysql_update_log.write(thd, thd->query, thd->query_length);
- if (mysql_bin_log.is_open(1))
+ if (mysql_bin_log.is_open())
{
Query_log_event qinfo(thd, thd->query, thd->query_length, 0);
mysql_bin_log.write(&qinfo);
diff --git a/sql/sql_rename.cc b/sql/sql_rename.cc
index cfc6e5b0721..d7e998264f3 100644
--- a/sql/sql_rename.cc
+++ b/sql/sql_rename.cc
@@ -80,7 +80,7 @@ bool mysql_rename_tables(THD *thd, TABLE_LIST *table_list)
if (!error)
{
mysql_update_log.write(thd,thd->query,thd->query_length);
- if (mysql_bin_log.is_open(1))
+ if (mysql_bin_log.is_open())
{
Query_log_event qinfo(thd, thd->query, thd->query_length, 0);
mysql_bin_log.write(&qinfo);
diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc
index 6f0ee69413d..13b22d6a221 100644
--- a/sql/sql_repl.cc
+++ b/sql/sql_repl.cc
@@ -269,7 +269,7 @@ int purge_master_logs(THD* thd, const char* to_log)
const char* errmsg = 0;
int res;
- if (!mysql_bin_log.is_open(1))
+ if (!mysql_bin_log.is_open())
goto end;
mysql_bin_log.make_log_name(search_file_name, to_log);
@@ -333,7 +333,7 @@ void mysql_binlog_send(THD* thd, char* log_ident, my_off_t pos,
}
#endif
- if (!mysql_bin_log.is_open(1))
+ if (!mysql_bin_log.is_open())
{
errmsg = "Binary log is not open";
my_errno= ER_MASTER_FATAL_ERROR_READING_BINLOG;
@@ -970,7 +970,7 @@ int change_master(THD* thd, MASTER_INFO* mi)
int reset_master(THD* thd)
{
- if (!mysql_bin_log.is_open(1))
+ if (!mysql_bin_log.is_open())
{
my_error(ER_FLUSH_MASTER_BINLOG_CLOSED, MYF(ME_BELL+ME_WAITTANG));
return 1;
@@ -1008,7 +1008,7 @@ int show_binlog_events(THD* thd)
if (send_fields(thd, field_list, 1))
DBUG_RETURN(-1);
- if (mysql_bin_log.is_open(1))
+ if (mysql_bin_log.is_open())
{
LEX_MASTER_INFO *lex_mi = &thd->lex.mi;
ha_rows event_count, limit_start, limit_end;
@@ -1108,7 +1108,7 @@ int show_binlog_info(THD* thd)
String* packet = &thd->packet;
packet->length(0);
- if (mysql_bin_log.is_open(1))
+ if (mysql_bin_log.is_open())
{
LOG_INFO li;
mysql_bin_log.get_current_log(&li);
@@ -1146,7 +1146,7 @@ int show_binlogs(THD* thd)
String *packet = &thd->packet;
uint length;
- if (!mysql_bin_log.is_open(1))
+ if (!mysql_bin_log.is_open())
{
//TODO: Replace with ER() error message
send_error(net, 0, "You are not using binary logging");
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 2d024ded5db..cf430aec35d 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -235,7 +235,7 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
if (!dont_log_query)
{
mysql_update_log.write(thd, thd->query,thd->query_length);
- if (mysql_bin_log.is_open(1))
+ if (mysql_bin_log.is_open())
{
Query_log_event qinfo(thd, thd->query, thd->query_length,
tmp_table_deleted && !some_tables_deleted);
@@ -766,7 +766,7 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
{
// Must be written before unlock
mysql_update_log.write(thd,thd->query, thd->query_length);
- if (mysql_bin_log.is_open(1))
+ if (mysql_bin_log.is_open())
{
Query_log_event qinfo(thd, thd->query, thd->query_length,
test(create_info->options &
@@ -1548,7 +1548,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
if (!error)
{
mysql_update_log.write(thd, thd->query, thd->query_length);
- if (mysql_bin_log.is_open(1))
+ if (mysql_bin_log.is_open())
{
Query_log_event qinfo(thd, thd->query, thd->query_length, 0);
mysql_bin_log.write(&qinfo);
@@ -1918,7 +1918,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
goto err;
}
mysql_update_log.write(thd, thd->query,thd->query_length);
- if (mysql_bin_log.is_open(1))
+ if (mysql_bin_log.is_open())
{
Query_log_event qinfo(thd, thd->query, thd->query_length, 0);
mysql_bin_log.write(&qinfo);
@@ -2050,7 +2050,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
}
thd->proc_info="end";
mysql_update_log.write(thd, thd->query,thd->query_length);
- if (mysql_bin_log.is_open(1))
+ if (mysql_bin_log.is_open())
{
Query_log_event qinfo(thd, thd->query, thd->query_length, 0);
mysql_bin_log.write(&qinfo);
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index 42ba00d3ad5..3179c8e0f24 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -317,7 +317,7 @@ int mysql_update(THD *thd,
if (updated && (error <= 0 || !transactional_table))
{
mysql_update_log.write(thd,thd->query,thd->query_length);
- if (mysql_bin_log.is_open(1))
+ if (mysql_bin_log.is_open())
{
Query_log_event qinfo(thd, thd->query, thd->query_length,
log_delayed);
@@ -933,7 +933,7 @@ bool multi_update::send_eof()
if (updated && (local_error <= 0 || !trans_safe))
{
mysql_update_log.write(thd,thd->query,thd->query_length);
- if (mysql_bin_log.is_open(1))
+ if (mysql_bin_log.is_open())
{
Query_log_event qinfo(thd, thd->query, thd->query_length,
log_delayed);