Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
3611f70a
Commit
3611f70a
authored
Jul 14, 2003
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge bk-internal.mysql.com:/home/bk/mysql-4.0
into mashka.mysql.fi:/home/my/mysql-4.0
parents
c4381bb0
e1a30696
Changes
17
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
78 additions
and
89 deletions
+78
-89
mysql-test/r/rpl_flush_log_loop.result
mysql-test/r/rpl_flush_log_loop.result
+1
-1
sql/handler.cc
sql/handler.cc
+2
-2
sql/item_func.cc
sql/item_func.cc
+1
-1
sql/log.cc
sql/log.cc
+33
-40
sql/log_event.cc
sql/log_event.cc
+5
-5
sql/repl_failsafe.cc
sql/repl_failsafe.cc
+1
-1
sql/sql_base.cc
sql/sql_base.cc
+1
-1
sql/sql_class.h
sql/sql_class.h
+5
-9
sql/sql_db.cc
sql/sql_db.cc
+2
-2
sql/sql_delete.cc
sql/sql_delete.cc
+3
-3
sql/sql_insert.cc
sql/sql_insert.cc
+4
-4
sql/sql_load.cc
sql/sql_load.cc
+4
-4
sql/sql_parse.cc
sql/sql_parse.cc
+2
-2
sql/sql_rename.cc
sql/sql_rename.cc
+1
-1
sql/sql_repl.cc
sql/sql_repl.cc
+6
-6
sql/sql_table.cc
sql/sql_table.cc
+5
-5
sql/sql_update.cc
sql/sql_update.cc
+2
-2
No files found.
mysql-test/r/rpl_flush_log_loop.result
View file @
3611f70a
...
...
@@ -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
sql/handler.cc
View file @
3611f70a
...
...
@@ -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
)
...
...
sql/item_func.cc
View file @
3611f70a
...
...
@@ -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
));
...
...
sql/log.cc
View file @
3611f70a
/* 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
...
...
sql/log_event.cc
View file @
3611f70a
...
...
@@ -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
;
...
...
sql/repl_failsafe.cc
View file @
3611f70a
...
...
@@ -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
);
...
...
sql/sql_base.cc
View file @
3611f70a
...
...
@@ -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
);
...
...
sql/sql_class.h
View file @
3611f70a
...
...
@@ -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
;
}
...
...
sql/sql_db.cc
View file @
3611f70a
...
...
@@ -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
);
...
...
sql/sql_delete.cc
View file @
3611f70a
...
...
@@ -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
);
...
...
sql/sql_insert.cc
View file @
3611f70a
...
...
@@ -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
());
...
...
sql/sql_load.cc
View file @
3611f70a
...
...
@@ -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
;
}
...
...
sql/sql_parse.cc
View file @
3611f70a
...
...
@@ -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
);
...
...
sql/sql_rename.cc
View file @
3611f70a
...
...
@@ -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
);
...
...
sql/sql_repl.cc
View file @
3611f70a
...
...
@@ -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"
);
...
...
sql/sql_table.cc
View file @
3611f70a
...
...
@@ -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
);
...
...
sql/sql_update.cc
View file @
3611f70a
...
...
@@ -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
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment