Commit 654410a3 authored by guilhem@mysql.com's avatar guilhem@mysql.com

Deprecated the update log (Sprint task #792). Now --log-update

just turns on --log-bin and prints a warning. SQL_LOG_UPDATE
is handled in two ways (see mysqld.cc for comments).
parent 5eaa5954
......@@ -282,4 +282,6 @@
#define ER_SP_BADSELECT 1263
#define ER_SP_BADRETURN 1264
#define ER_SP_BADQUERY 1265
#define ER_ERROR_MESSAGES 266
#define ER_UPDATE_LOG_DEPRECATED_IGNORED 1266
#define ER_UPDATE_LOG_DEPRECATED_TRANSLATED 1267
#define ER_ERROR_MESSAGES 268
......@@ -30,7 +30,7 @@
#include <stdarg.h>
#include <m_ctype.h> // For test_if_number
MYSQL_LOG mysql_log,mysql_update_log,mysql_slow_log,mysql_bin_log;
MYSQL_LOG mysql_log, mysql_slow_log, mysql_bin_log;
extern I_List<i_string> binlog_do_db, binlog_ignore_db;
static bool test_if_number(const char *str,
......@@ -1020,7 +1020,7 @@ err:
/*
Write to normal (not rotable) log
This is the format for the 'normal', 'slow' and 'update' logs.
This is the format for the 'normal' log.
*/
bool MYSQL_LOG::write(THD *thd,enum enum_server_command command,
......@@ -1392,8 +1392,7 @@ err:
/*
Write update log in a format suitable for incremental backup
This is also used by the slow query log.
Write to the slow query log.
*/
bool MYSQL_LOG::write(THD *thd,const char *query, uint query_length,
......@@ -1409,12 +1408,6 @@ bool MYSQL_LOG::write(THD *thd,const char *query, uint query_length,
int tmp_errno=0;
char buff[80],*end;
end=buff;
if (!(thd->options & OPTION_UPDATE_LOG) &&
(thd->master_access & SUPER_ACL))
{
VOID(pthread_mutex_unlock(&LOCK_log));
return 0;
}
if ((specialflag & SPECIAL_LONG_LOG_FORMAT) || query_start_arg)
{
current_time=time(NULL);
......
......@@ -22,6 +22,7 @@
#include "sql_repl.h"
#include "repl_failsafe.h"
#include "stacktrace.h"
#include "mysys_err.h"
#ifdef HAVE_BERKELEY_DB
#include "ha_berkeley.h"
#endif
......@@ -345,7 +346,7 @@ uint mysql_port;
uint test_flags = 0, select_errors=0, dropping_tables=0,ha_open_options=0;
uint volatile thread_count=0, thread_running=0, kill_cached_threads=0,
wake_thread=0;
ulong thd_startup_options=(OPTION_UPDATE_LOG | OPTION_AUTO_IS_NULL |
ulong thd_startup_options=(OPTION_AUTO_IS_NULL |
OPTION_BIN_LOG | OPTION_QUOTE_SHOW_CREATE );
uint protocol_version=PROTOCOL_VERSION;
struct system_variables global_system_variables;
......@@ -911,7 +912,6 @@ void clean_up(bool print_message)
mysql_log.cleanup();
mysql_slow_log.cleanup();
mysql_update_log.cleanup();
mysql_bin_log.cleanup();
#ifdef HAVE_REPLICATION
......@@ -2177,9 +2177,55 @@ static int init_server_components()
LOG_NORMAL);
if (opt_update_log)
{
open_log(&mysql_update_log, glob_hostname, opt_update_logname, "",
NullS, LOG_NEW);
using_update_log=1;
/*
Update log is removed since 5.0. But we still accept the option.
The idea is if the user already uses the binlog and the update log,
we completely ignore any option/variable related to the update log, like
if the update log did not exist. But if the user uses only the update log,
then we translate everything into binlog for him (with warnings).
Implementation of the above :
- If mysqld is started with --log-update and --log-bin,
ignore --log-update (print a warning), push a warning when SQL_LOG_UPDATE
is used, and turn off --sql-bin-update-same.
This will completely ignore SQL_LOG_UPDATE
- If mysqld is started with --log-update only,
change it to --log-bin (with the filename passed to log-update,
plus '-bin') (print a warning), push a warning when SQL_LOG_UPDATE is
used, and turn on --sql-bin-update-same.
This will translate SQL_LOG_UPDATE to SQL_LOG_BIN.
Note that we tell the user that --sql-bin-update-same is deprecated and
does nothing, and we don't take into account if he used this option or
not; but internally we give this variable a value to have the behaviour we
want (i.e. have SQL_LOG_UPDATE influence SQL_LOG_BIN or not).
As sql-bin-update-same, log-update and log-bin cannot be changed by the user
after starting the server (they are not variables), the user will not
later interfere with the settings we do here.
*/
if (opt_bin_log)
{
opt_sql_bin_update= 0;
sql_print_error("The update log is no longer supported by MySQL in \
version 5.0 and above. It is replaced by the binary log.");
}
else
{
opt_sql_bin_update= 1;
opt_bin_log= 1;
if (opt_update_logname)
{
// as opt_bin_log==0, no need to free opt_bin_logname
if (!(opt_bin_logname= my_strdup(opt_update_logname, MYF(MY_WME))))
exit(EXIT_OUT_OF_MEMORY);
sql_print_error("The update log is no longer supported by MySQL in \
version 5.0 and above. It is replaced by the binary log. Now starting MySQL \
with --log-bin='%s' instead.",opt_bin_logname);
}
else
sql_print_error("The update log is no longer supported by MySQL in \
version 5.0 and above. It is replaced by the binary log. Now starting MySQL \
with --log-bin instead.");
}
}
if (opt_slow_log)
open_log(&mysql_slow_log, glob_hostname, opt_slow_logname, "-slow.log",
......@@ -3659,7 +3705,8 @@ struct my_option my_long_options[] =
(gptr*) &myisam_log_filename, (gptr*) &myisam_log_filename, 0, GET_STR,
OPT_ARG, 0, 0, 0, 0, 0, 0},
{"log-update", OPT_UPDATE_LOG,
"Log updates to file.# where # is a unique number if not given.",
"The update log is deprecated since version 5.0, is replaced by the binary \
log and this option justs turns on --log-bin instead.",
(gptr*) &opt_update_logname, (gptr*) &opt_update_logname, 0, GET_STR,
OPT_ARG, 0, 0, 0, 0, 0, 0},
{"log-slow-queries", OPT_SLOW_QUERY_LOG,
......@@ -3910,9 +3957,9 @@ struct my_option my_long_options[] =
(gptr*) &mysql_unix_port, (gptr*) &mysql_unix_port, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"sql-bin-update-same", OPT_SQL_BIN_UPDATE_SAME,
"If set, setting SQL_LOG_BIN to a value will automatically set SQL_LOG_UPDATE to the same value and vice versa.",
(gptr*) &opt_sql_bin_update, (gptr*) &opt_sql_bin_update, 0, GET_BOOL,
NO_ARG, 0, 0, 0, 0, 0, 0},
"The update log is deprecated since version 5.0, is replaced by the binary \
log and this option does nothing anymore.",
0, 0, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"sql-mode", OPT_SQL_MODE,
"Syntax: sql-mode=option[,option[,option...]] where option can be one of: REAL_AS_FLOAT, PIPES_AS_CONCAT, ANSI_QUOTES, IGNORE_SPACE, SERIALIZE, ONLY_FULL_GROUP_BY, NO_UNSIGNED_SUBTRACTION.",
(gptr*) &sql_mode_str, (gptr*) &sql_mode_str, 0, GET_STR, REQUIRED_ARG, 0,
......
......@@ -78,6 +78,7 @@ static void sys_set_default_charset(THD *thd, enum_var_type type);
static bool set_option_bit(THD *thd, set_var *var);
static bool set_option_autocommit(THD *thd, set_var *var);
static bool set_log_update(THD *thd, set_var *var);
static bool set_log_bin(THD *thd, set_var *var);
static void fix_low_priority_updates(THD *thd, enum_var_type type);
static void fix_tx_isolation(THD *thd, enum_var_type type);
static void fix_net_read_timeout(THD *thd, enum_var_type type);
......@@ -265,7 +266,7 @@ static sys_var_thd_bit sys_log_update("sql_log_update",
set_log_update,
OPTION_UPDATE_LOG);
static sys_var_thd_bit sys_log_binlog("sql_log_bin",
set_log_update,
set_log_bin,
OPTION_BIN_LOG);
static sys_var_thd_bit sys_sql_warnings("sql_warnings",
set_option_bit,
......@@ -1363,6 +1364,30 @@ static bool set_option_autocommit(THD *thd, set_var *var)
static bool set_log_update(THD *thd, set_var *var)
{
/*
The update log is not supported anymore since 5.0.
See sql/mysqld.cc/, comments in function init_server_components() for an
explaination of the different warnings we send below
*/
if (opt_sql_bin_update)
{
((sys_var_thd_bit*) var->var)->bit_flag|= (OPTION_BIN_LOG |
OPTION_UPDATE_LOG);
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
ER_UPDATE_LOG_DEPRECATED_TRANSLATED,
ER(ER_UPDATE_LOG_DEPRECATED_TRANSLATED));
}
else
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
ER_UPDATE_LOG_DEPRECATED_IGNORED,
ER(ER_UPDATE_LOG_DEPRECATED_IGNORED));
set_option_bit(thd, var);
return 0;
}
static bool set_log_bin(THD *thd, set_var *var)
{
if (opt_sql_bin_update)
((sys_var_thd_bit*) var->var)->bit_flag|= (OPTION_BIN_LOG |
......@@ -1371,6 +1396,7 @@ static bool set_log_update(THD *thd, set_var *var)
return 0;
}
static byte *get_warning_count(THD *thd)
{
thd->sys_var_tmp.long_value=
......
......@@ -276,3 +276,5 @@ v/*
"SELECT in a stored procedure must have INTO"
"RETURN is only allowed in a FUNCTION"
"Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION"
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been ignored."
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been translated to SET SQL_LOG_BIN."
......@@ -270,3 +270,5 @@
"SELECT in a stored procedure must have INTO"
"RETURN is only allowed in a FUNCTION"
"Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION"
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been ignored."
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been translated to SET SQL_LOG_BIN."
......@@ -278,3 +278,5 @@
"SELECT in a stored procedure must have INTO"
"RETURN is only allowed in a FUNCTION"
"Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION"
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been ignored."
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been translated to SET SQL_LOG_BIN."
......@@ -267,3 +267,5 @@
"SELECT in a stored procedure must have INTO"
"RETURN is only allowed in a FUNCTION"
"Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION"
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been ignored."
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been translated to SET SQL_LOG_BIN."
......@@ -272,3 +272,5 @@
"SELECT in a stored procedure must have INTO"
"RETURN is only allowed in a FUNCTION"
"Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION"
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been ignored."
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been translated to SET SQL_LOG_BIN."
......@@ -267,3 +267,5 @@
"SELECT in a stored procedure must have INTO"
"RETURN is only allowed in a FUNCTION"
"Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION"
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been ignored."
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been translated to SET SQL_LOG_BIN."
......@@ -277,3 +277,5 @@
"SELECT in a stored procedure must have INTO"
"RETURN is only allowed in a FUNCTION"
"Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION"
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been ignored."
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been translated to SET SQL_LOG_BIN."
......@@ -267,3 +267,5 @@
"SELECT in a stored procedure must have INTO"
"RETURN is only allowed in a FUNCTION"
"Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION"
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been ignored."
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been translated to SET SQL_LOG_BIN."
......@@ -269,3 +269,5 @@
"SELECT in a stored procedure must have INTO"
"RETURN is only allowed in a FUNCTION"
"Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION"
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been ignored."
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been translated to SET SQL_LOG_BIN."
......@@ -267,3 +267,5 @@
"SELECT in a stored procedure must have INTO"
"RETURN is only allowed in a FUNCTION"
"Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION"
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been ignored."
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been translated to SET SQL_LOG_BIN."
......@@ -269,3 +269,5 @@
"SELECT in a stored procedure must have INTO"
"RETURN is only allowed in a FUNCTION"
"Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION"
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been ignored."
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been translated to SET SQL_LOG_BIN."
......@@ -267,3 +267,5 @@
"SELECT in a stored procedure must have INTO"
"RETURN is only allowed in a FUNCTION"
"Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION"
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been ignored."
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been translated to SET SQL_LOG_BIN."
......@@ -269,3 +269,5 @@
"SELECT in a stored procedure must have INTO"
"RETURN is only allowed in a FUNCTION"
"Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION"
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been ignored."
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been translated to SET SQL_LOG_BIN."
......@@ -269,3 +269,5 @@
"SELECT in a stored procedure must have INTO"
"RETURN is only allowed in a FUNCTION"
"Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION"
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been ignored."
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been translated to SET SQL_LOG_BIN."
......@@ -271,3 +271,5 @@
"SELECT in a stored procedure must have INTO"
"RETURN is only allowed in a FUNCTION"
"Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION"
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been ignored."
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been translated to SET SQL_LOG_BIN."
......@@ -267,3 +267,5 @@
"SELECT in a stored procedure must have INTO"
"RETURN is only allowed in a FUNCTION"
"Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION"
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been ignored."
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been translated to SET SQL_LOG_BIN."
......@@ -271,3 +271,5 @@
"SELECT in a stored procedure must have INTO"
"RETURN is only allowed in a FUNCTION"
"Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION"
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been ignored."
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been translated to SET SQL_LOG_BIN."
......@@ -269,3 +269,5 @@
"SELECT in a stored procedure must have INTO"
"RETURN is only allowed in a FUNCTION"
"Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION"
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been ignored."
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been translated to SET SQL_LOG_BIN."
......@@ -263,3 +263,5 @@
"SELECT in a stored procedure must have INTO"
"RETURN is only allowed in a FUNCTION"
"Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION"
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been ignored."
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been translated to SET SQL_LOG_BIN."
......@@ -275,3 +275,5 @@
"SELECT in a stored procedure must have INTO"
"RETURN is only allowed in a FUNCTION"
"Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION"
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been ignored."
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been translated to SET SQL_LOG_BIN."
......@@ -268,3 +268,5 @@
"SELECT in a stored procedure must have INTO"
"RETURN is only allowed in a FUNCTION"
"Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION"
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been ignored."
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been translated to SET SQL_LOG_BIN."
......@@ -267,3 +267,5 @@
"SELECT in a stored procedure must have INTO"
"RETURN is only allowed in a FUNCTION"
"Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION"
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been ignored."
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been translated to SET SQL_LOG_BIN."
......@@ -272,3 +272,5 @@
"SELECT in a stored procedure must have INTO"
"RETURN is only allowed in a FUNCTION"
"Queries, like SELECT, INSERT, UPDATE (and others), are not allowed in a FUNCTION"
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been ignored."
"The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been translated to SET SQL_LOG_BIN."
......@@ -1161,7 +1161,6 @@ bool change_password(THD *thd, const char *host, const char *user,
acl_user->user ? acl_user->user : "",
acl_user->host.hostname ? acl_user->host.hostname : "",
new_password));
mysql_update_log.write(thd, buff, query_length);
Query_log_event qinfo(thd, buff, query_length, 0);
mysql_bin_log.write(&qinfo);
DBUG_RETURN(0);
......
......@@ -231,7 +231,6 @@ int mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create_info,
query= thd->query;
query_length= thd->query_length;
}
mysql_update_log.write(thd, query, query_length);
if (mysql_bin_log.is_open())
{
Query_log_event qinfo(thd, query, query_length, 0);
......@@ -283,7 +282,6 @@ int mysql_alter_db(THD *thd, const char *db, HA_CREATE_INFO *create_info)
create_info->table_charset : default_charset_info;
}
mysql_update_log.write(thd,thd->query, thd->query_length);
if (mysql_bin_log.is_open())
{
Query_log_event qinfo(thd, thd->query, thd->query_length, 0);
......@@ -369,7 +367,6 @@ int mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent)
query=thd->query;
query_length=thd->query_length;
}
mysql_update_log.write(thd, query, query_length);
if (mysql_bin_log.is_open())
{
Query_log_event qinfo(thd, query, query_length, 0);
......
......@@ -179,7 +179,6 @@ cleanup:
log_delayed= (transactional_table || table->tmp_table);
if (deleted && (error <= 0 || !transactional_table))
{
mysql_update_log.write(thd,thd->query, thd->query_length);
if (mysql_bin_log.is_open())
{
Query_log_event qinfo(thd, thd->query, thd->query_length,
......@@ -486,7 +485,6 @@ 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())
{
Query_log_event qinfo(thd, thd->query, thd->query_length,
......@@ -601,7 +599,6 @@ end:
{
if (!error)
{
mysql_update_log.write(thd,thd->query,thd->query_length);
if (mysql_bin_log.is_open())
{
Query_log_event qinfo(thd, thd->query, thd->query_length,
......
......@@ -23,7 +23,7 @@
static int check_null_fields(THD *thd,TABLE *entry);
static TABLE *delayed_get_table(THD *thd,TABLE_LIST *table_list);
static int write_delayed(THD *thd,TABLE *table, enum_duplicates dup,
char *query, uint query_length, int log_on);
char *query, uint query_length, bool log_on);
static void end_delayed_insert(THD *thd);
extern "C" pthread_handler_decl(handle_delayed_insert,arg);
static void unlink_blobs(register TABLE *table);
......@@ -38,9 +38,6 @@ static void unlink_blobs(register TABLE *table);
#define my_safe_afree(ptr, size, min_length) if (size > min_length) my_free(ptr,MYF(0))
#endif
#define DELAYED_LOG_UPDATE 1
#define DELAYED_LOG_BIN 2
/*
Check if insert fields are correct
Updates table->time_stamp to point to timestamp field or 0, depending on
......@@ -114,8 +111,7 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list,
By default, both logs are enabled (this won't cause problems if the server
runs without --log-update or --log-bin).
*/
int log_on= DELAYED_LOG_UPDATE | DELAYED_LOG_BIN ;
bool log_on= (!(thd->master_access & SUPER_ACL)) || (thd->options & OPTION_BIN_LOG);
bool transactional_table, log_delayed, bulk_insert;
uint value_count;
ulong counter = 1;
......@@ -130,14 +126,6 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list,
thd->lex.select_lex.table_list.first;
DBUG_ENTER("mysql_insert");
if (thd->master_access & SUPER_ACL)
{
if (!(thd->options & OPTION_UPDATE_LOG))
log_on&= ~(int) DELAYED_LOG_UPDATE;
if (!(thd->options & OPTION_BIN_LOG))
log_on&= ~(int) DELAYED_LOG_BIN;
}
/*
in safe mode or with skip-new change delayed insert to be regular
if we are told to replace duplicates, the insert cannot be concurrent
......@@ -338,7 +326,6 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list,
log_delayed= (transactional_table || table->tmp_table);
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())
{
Query_log_event qinfo(thd, thd->query, thd->query_length,
......@@ -562,13 +549,12 @@ public:
char *record,*query;
enum_duplicates dup;
time_t start_time;
bool query_start_used,last_insert_id_used,insert_id_used;
int log_query;
bool query_start_used,last_insert_id_used,insert_id_used, log_query;
ulonglong last_insert_id;
ulong time_stamp;
uint query_length;
delayed_row(enum_duplicates dup_arg, int log_query_arg)
delayed_row(enum_duplicates dup_arg, bool log_query_arg)
:record(0),query(0),dup(dup_arg),log_query(log_query_arg) {}
~delayed_row()
{
......@@ -871,7 +857,7 @@ TABLE *delayed_insert::get_local_table(THD* client_thd)
/* Put a question in queue */
static int write_delayed(THD *thd,TABLE *table,enum_duplicates duplic,
char *query, uint query_length, int log_on)
char *query, uint query_length, bool log_on)
{
delayed_row *row=0;
delayed_insert *di=thd->di;
......@@ -1258,16 +1244,11 @@ bool delayed_insert::handle_inserts(void)
using_ignore=0;
table->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY);
}
if (row->query)
{
if (row->log_query & DELAYED_LOG_UPDATE)
mysql_update_log.write(&thd,row->query, row->query_length);
if (row->log_query & DELAYED_LOG_BIN && using_bin_log)
if (row->query && row->log_query && using_bin_log)
{
Query_log_event qinfo(&thd, row->query, row->query_length,0);
mysql_bin_log.write(&qinfo);
}
}
if (table->blob_fields)
free_delayed_insert_blobs(table);
thread_safe_sub(delayed_rows_in_use,1,&LOCK_delayed_status);
......@@ -1449,7 +1430,6 @@ bool select_insert::send_eof()
if (last_insert_id)
thd->insert_id(last_insert_id); // For update log
::send_ok(thd,info.copied,last_insert_id,buff);
mysql_update_log.write(thd,thd->query,thd->query_length);
return 0;
}
}
......
......@@ -315,9 +315,6 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
sprintf(name,ER(ER_LOAD_INFO),info.records,info.deleted,
info.records-info.copied,thd->cuted_fields);
send_ok(thd,info.copied+info.deleted,0L,name);
// on the slave thd->query is never initialized
if (!thd->slave_thread)
mysql_update_log.write(thd,thd->query,thd->query_length);
if (!log_delayed)
thd->options|=OPTION_STATUS_NO_TRANS_UPDATE;
......
......@@ -2861,16 +2861,13 @@ mysql_execute_command(THD *thd)
goto error;
if (!(res = mysql_table_grant(thd,tables,lex->users_list, lex->columns,
lex->grant,
lex->sql_command == SQLCOM_REVOKE)))
{
mysql_update_log.write(thd, thd->query, thd->query_length);
if (mysql_bin_log.is_open())
lex->sql_command == SQLCOM_REVOKE)) &&
mysql_bin_log.is_open())
{
Query_log_event qinfo(thd, thd->query, thd->query_length, 0);
mysql_bin_log.write(&qinfo);
}
}
}
else
{
if (lex->columns.elements)
......@@ -2883,7 +2880,6 @@ mysql_execute_command(THD *thd)
lex->sql_command == SQLCOM_REVOKE);
if (!res)
{
mysql_update_log.write(thd, thd->query, thd->query_length);
if (mysql_bin_log.is_open())
{
Query_log_event qinfo(thd, thd->query, thd->query_length, 0);
......@@ -4114,7 +4110,6 @@ bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables)
if (options & REFRESH_LOG)
{
mysql_log.new_file(1);
mysql_update_log.new_file(1);
mysql_bin_log.new_file(1);
#ifdef HAVE_REPLICATION
if (expire_logs_days)
......
......@@ -79,7 +79,6 @@ bool mysql_rename_tables(THD *thd, TABLE_LIST *table_list)
/* Lets hope this doesn't fail as the result will be messy */
if (!error)
{
mysql_update_log.write(thd,thd->query,thd->query_length);
if (mysql_bin_log.is_open())
{
Query_log_event qinfo(thd, thd->query, thd->query_length, 0);
......
......@@ -255,17 +255,13 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
if (some_tables_deleted || tmp_table_deleted)
{
query_cache_invalidate3(thd, tables, 0);
if (!dont_log_query)
{
mysql_update_log.write(thd, thd->query,thd->query_length);
if (mysql_bin_log.is_open())
if (!dont_log_query && mysql_bin_log.is_open())
{
Query_log_event qinfo(thd, thd->query, thd->query_length,
tmp_table_deleted && !some_tables_deleted);
mysql_bin_log.write(&qinfo);
}
}
}
unlock_table_names(thd, tables);
error= 0;
......@@ -908,18 +904,14 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
}
thd->tmp_table_used= 1;
}
if (!tmp_table && !no_log)
{
if (!tmp_table && !no_log && mysql_bin_log.is_open())
// Must be written before unlock
mysql_update_log.write(thd,thd->query, thd->query_length);
if (mysql_bin_log.is_open())
{
Query_log_event qinfo(thd, thd->query, thd->query_length,
test(create_info->options &
HA_LEX_CREATE_TMP_TABLE));
mysql_bin_log.write(&qinfo);
}
}
error=0;
end:
VOID(pthread_mutex_unlock(&LOCK_open));
......@@ -1742,7 +1734,6 @@ 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())
{
Query_log_event qinfo(thd, thd->query, thd->query_length, 0);
......@@ -2123,7 +2114,6 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
my_free((gptr) new_table,MYF(0));
goto err;
}
mysql_update_log.write(thd, thd->query,thd->query_length);
if (mysql_bin_log.is_open())
{
Query_log_event qinfo(thd, thd->query, thd->query_length, 0);
......@@ -2252,7 +2242,6 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
goto err;
}
thd->proc_info="end";
mysql_update_log.write(thd, thd->query,thd->query_length);
if (mysql_bin_log.is_open())
{
Query_log_event qinfo(thd, thd->query, thd->query_length, 0);
......
......@@ -323,7 +323,6 @@ int mysql_update(THD *thd,
log_delayed= (transactional_table || table->tmp_table);
if (updated && (error <= 0 || !transactional_table))
{
mysql_update_log.write(thd,thd->query,thd->query_length);
if (mysql_bin_log.is_open())
{
Query_log_event qinfo(thd, thd->query, thd->query_length,
......@@ -932,7 +931,6 @@ 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())
{
Query_log_event qinfo(thd, thd->query, thd->query_length,
......
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