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
fe70f8c7
Commit
fe70f8c7
authored
Dec 03, 2004
by
mats@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge mysql.com:/space/bkroot/mysql-4.1
into mysql.com:/space/bk/b6391-mysql-4.1
parents
eb6c38fe
2bbdf240
Changes
23
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
340 additions
and
120 deletions
+340
-120
mysql-test/r/drop_temp_table.result
mysql-test/r/drop_temp_table.result
+4
-4
mysql-test/r/rpl_charset.result
mysql-test/r/rpl_charset.result
+58
-58
mysql-test/r/rpl_create_database.result
mysql-test/r/rpl_create_database.result
+83
-0
mysql-test/r/rpl_loaddata_rule_m.result
mysql-test/r/rpl_loaddata_rule_m.result
+2
-0
mysql-test/t/rpl_charset.test
mysql-test/t/rpl_charset.test
+3
-3
mysql-test/t/rpl_create_database-master.opt
mysql-test/t/rpl_create_database-master.opt
+1
-0
mysql-test/t/rpl_create_database-slave.opt
mysql-test/t/rpl_create_database-slave.opt
+1
-0
mysql-test/t/rpl_create_database.test
mysql-test/t/rpl_create_database.test
+68
-0
mysql-test/t/rpl_until.test
mysql-test/t/rpl_until.test
+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
+7
-7
sql/log_event.cc
sql/log_event.cc
+20
-10
sql/log_event.h
sql/log_event.h
+17
-3
sql/sql_acl.cc
sql/sql_acl.cc
+1
-1
sql/sql_base.cc
sql/sql_base.cc
+2
-2
sql/sql_db.cc
sql/sql_db.cc
+41
-3
sql/sql_delete.cc
sql/sql_delete.cc
+3
-3
sql/sql_insert.cc
sql/sql_insert.cc
+4
-4
sql/sql_parse.cc
sql/sql_parse.cc
+8
-8
sql/sql_rename.cc
sql/sql_rename.cc
+1
-1
sql/sql_table.cc
sql/sql_table.cc
+10
-7
sql/sql_update.cc
sql/sql_update.cc
+2
-2
No files found.
mysql-test/r/drop_temp_table.result
View file @
fe70f8c7
...
...
@@ -11,8 +11,8 @@ get_lock("a",10)
show binlog events;
Log_name Pos Event_type Server_id Orig_log_pos Info
master-bin.000001 4 Start 1 4 Server ver: VERSION, Binlog ver: 3
master-bin.000001 79 Query 1 79
use `test`;
create database `drop-temp+table-test`
master-bin.000001 1
52 Query 1 152
use `drop-temp+table-test`; create temporary table `table:name` (a int)
master-bin.000001 2
46 Query 1 246
use `drop-temp+table-test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `drop-temp+table-test`.`table:name`
master-bin.000001 3
75 Query 1 375
use `drop-temp+table-test`; DO RELEASE_LOCK("a")
master-bin.000001 79 Query 1 79 create database `drop-temp+table-test`
master-bin.000001 1
68 Query 1 168
use `drop-temp+table-test`; create temporary table `table:name` (a int)
master-bin.000001 2
62 Query 1 262
use `drop-temp+table-test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `drop-temp+table-test`.`table:name`
master-bin.000001 3
91 Query 1 391
use `drop-temp+table-test`; DO RELEASE_LOCK("a")
drop database `drop-temp+table-test`;
mysql-test/r/rpl_charset.result
View file @
fe70f8c7
This diff is collapsed.
Click to expand it.
mysql-test/r/rpl_create_database.result
0 → 100644
View file @
fe70f8c7
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
DROP DATABASE IF EXISTS mysqltest_prometheus;
DROP DATABASE IF EXISTS mysqltest_sisyfos;
DROP DATABASE IF EXISTS mysqltest_bob;
DROP DATABASE IF EXISTS mysqltest_bob;
CREATE DATABASE mysqltest_prometheus;
CREATE DATABASE mysqltest_sisyfos;
CREATE DATABASE mysqltest_bob;
USE mysqltest_sisyfos;
CREATE TABLE t1 (b int);
INSERT INTO t1 VALUES(1);
USE mysqltest_bob;
CREATE TABLE t2 (b int);
INSERT INTO t2 VALUES(2);
ALTER DATABASE mysqltest_sisyfos CHARACTER SET latin1;
USE mysqltest_sisyfos;
ALTER DATABASE mysqltest_bob CHARACTER SET latin1;
SHOW DATABASES;
Database
mysql
mysqltest_bob
mysqltest_prometheus
mysqltest_sisyfos
test
SHOW DATABASES;
Database
mysql
mysqltest_prometheus
mysqltest_sisyfos
test
DROP DATABASE IF EXISTS mysqltest_sisyfos;
USE mysqltest_prometheus;
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1);
CREATE DATABASE mysqltest_sisyfos;
USE mysqltest_sisyfos;
CREATE TABLE t2 (a INT);
SHOW BINLOG EVENTS;
Log_name Pos Event_type Server_id Orig_log_pos Info
master-bin.000001 4 Start 1 4 Server ver: 4.1.8-debug-log, Binlog ver: 3
master-bin.000001 79 Query 1 79 DROP DATABASE IF EXISTS mysqltest_prometheus
master-bin.000001 174 Query 1 174 DROP DATABASE IF EXISTS mysqltest_sisyfos
master-bin.000001 263 Query 1 263 CREATE DATABASE mysqltest_prometheus
master-bin.000001 350 Query 1 350 CREATE DATABASE mysqltest_sisyfos
master-bin.000001 431 Query 1 431 use `mysqltest_sisyfos`; CREATE TABLE t1 (b int)
master-bin.000001 502 Query 1 502 use `mysqltest_sisyfos`; INSERT INTO t1 VALUES(1)
master-bin.000001 574 Query 1 574 ALTER DATABASE mysqltest_sisyfos CHARACTER SET latin1
master-bin.000001 675 Query 1 675 DROP DATABASE IF EXISTS mysqltest_sisyfos
master-bin.000001 764 Query 1 764 use `mysqltest_prometheus`; CREATE TABLE t1 (a INT)
master-bin.000001 838 Query 1 838 use `mysqltest_prometheus`; INSERT INTO t1 VALUES (1)
master-bin.000001 914 Query 1 914 CREATE DATABASE mysqltest_sisyfos
master-bin.000001 995 Query 1 995 use `mysqltest_sisyfos`; CREATE TABLE t2 (a INT)
SHOW DATABASES;
Database
mysql
mysqltest_bob
mysqltest_prometheus
mysqltest_sisyfos
test
SHOW DATABASES;
Database
mysql
mysqltest_prometheus
mysqltest_sisyfos
test
SHOW CREATE TABLE mysqltest_prometheus.t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SHOW CREATE TABLE mysqltest_sisyfos.t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP DATABASE IF EXISTS mysqltest_prometheus;
DROP DATABASE IF EXISTS mysqltest_sisyfos;
DROP DATABASE IF EXISTS mysqltest_bob;
mysql-test/r/rpl_loaddata_rule_m.result
View file @
fe70f8c7
...
...
@@ -12,4 +12,6 @@ use mysqltest;
load data infile '../../std_data/rpl_loaddata.dat' into table test.t1;
show binlog events from 79;
Log_name Pos Event_type Server_id Orig_log_pos Info
master-bin.000001 79 Query 1 79 drop database if exists mysqltest
master-bin.000001 152 Query 1 152 create database mysqltest
drop database mysqltest;
mysql-test/t/rpl_charset.test
View file @
fe70f8c7
...
...
@@ -154,9 +154,9 @@ select hex(c1), hex(c2) from t1;
stop
slave
;
delete
from
t1
;
change
master
to
master_log_pos
=
58
01
;
start
slave
until
master_log_file
=
'master-bin.000001'
,
master_log_pos
=
59
37
;
# Slave is supposed to stop _after_ the INSERT, even though 59
37
is
change
master
to
master_log_pos
=
58
47
;
start
slave
until
master_log_file
=
'master-bin.000001'
,
master_log_pos
=
59
83
;
# Slave is supposed to stop _after_ the INSERT, even though 59
83
is
# the position of the beginning of the INSERT; after SET slave is not
# supposed to increment position.
wait_for_slave_to_stop
;
...
...
mysql-test/t/rpl_create_database-master.opt
0 → 100644
View file @
fe70f8c7
--binlog-do-db=mysqltest_sisyfos --binlog-do-db=mysqltest_prometheus
mysql-test/t/rpl_create_database-slave.opt
0 → 100644
View file @
fe70f8c7
--replicate-do-db=mysqltest_sisyfos --replicate-do-db=mysqltest_prometheus
mysql-test/t/rpl_create_database.test
0 → 100644
View file @
fe70f8c7
#
# Tests for replication of statements that manipulate databases.
#
# For this test file, we have a number of databases. All databases
# with "greek" names will be replicated on the slave, while other names
# (e.g., american) will not be replicated.
#
source
include
/
master
-
slave
.
inc
;
# Bug#6391 (binlog-do-db rules ignored)
# In this case, 'mysqltest_bob' should not be replicated to the slave.
--
disable_warnings
DROP
DATABASE
IF
EXISTS
mysqltest_prometheus
;
DROP
DATABASE
IF
EXISTS
mysqltest_sisyfos
;
DROP
DATABASE
IF
EXISTS
mysqltest_bob
;
sync_slave_with_master
;
# This database is not replicated
DROP
DATABASE
IF
EXISTS
mysqltest_bob
;
--
enable_warnings
connection
master
;
CREATE
DATABASE
mysqltest_prometheus
;
CREATE
DATABASE
mysqltest_sisyfos
;
CREATE
DATABASE
mysqltest_bob
;
USE
mysqltest_sisyfos
;
# These should be replicated
CREATE
TABLE
t1
(
b
int
);
INSERT
INTO
t1
VALUES
(
1
);
USE
mysqltest_bob
;
# These should *not* be replicated
CREATE
TABLE
t2
(
b
int
);
INSERT
INTO
t2
VALUES
(
2
);
# Current database is now 'mysqltest_bob'
# The following should be replicated
ALTER
DATABASE
mysqltest_sisyfos
CHARACTER
SET
latin1
;
USE
mysqltest_sisyfos
;
# The following should *not* be replicated
ALTER
DATABASE
mysqltest_bob
CHARACTER
SET
latin1
;
SHOW
DATABASES
;
sync_slave_with_master
;
SHOW
DATABASES
;
connection
master
;
DROP
DATABASE
IF
EXISTS
mysqltest_sisyfos
;
USE
mysqltest_prometheus
;
CREATE
TABLE
t1
(
a
INT
);
INSERT
INTO
t1
VALUES
(
1
);
CREATE
DATABASE
mysqltest_sisyfos
;
USE
mysqltest_sisyfos
;
CREATE
TABLE
t2
(
a
INT
);
SHOW
BINLOG
EVENTS
;
SHOW
DATABASES
;
sync_slave_with_master
;
SHOW
DATABASES
;
SHOW
CREATE
TABLE
mysqltest_prometheus
.
t1
;
SHOW
CREATE
TABLE
mysqltest_sisyfos
.
t2
;
connection
master
;
DROP
DATABASE
IF
EXISTS
mysqltest_prometheus
;
DROP
DATABASE
IF
EXISTS
mysqltest_sisyfos
;
DROP
DATABASE
IF
EXISTS
mysqltest_bob
;
sync_slave_with_master
;
mysql-test/t/rpl_until.test
View file @
fe70f8c7
...
...
@@ -43,7 +43,7 @@ show slave status;
# try replicate all until second insert to t2;
start
slave
until
relay_log_file
=
'slave-relay-bin.000002'
,
relay_log_pos
=
537
;
sleep
2
;
sleep
4
;
select
*
from
t2
;
--
replace_result
$MASTER_MYPORT
MASTER_MYPORT
--
replace_column
1
# 9 # 23 # 33 #
...
...
sql/handler.cc
View file @
fe70f8c7
...
...
@@ -723,7 +723,7 @@ int ha_rollback_to_savepoint(THD *thd, char *savepoint_name)
if
(
unlikely
((
thd
->
options
&
OPTION_STATUS_NO_TRANS_UPDATE
)
&&
my_b_tell
(
&
thd
->
transaction
.
trans_log
)))
{
Query_log_event
qinfo
(
thd
,
thd
->
query
,
thd
->
query_length
,
TRUE
);
Query_log_event
qinfo
(
thd
,
thd
->
query
,
thd
->
query_length
,
TRUE
,
FALSE
);
if
(
mysql_bin_log
.
write
(
&
qinfo
))
error
=
1
;
}
...
...
@@ -761,7 +761,7 @@ int ha_savepoint(THD *thd, char *savepoint_name)
innobase_savepoint
(
thd
,
savepoint_name
,
my_b_tell
(
&
thd
->
transaction
.
trans_log
));
#endif
Query_log_event
qinfo
(
thd
,
thd
->
query
,
thd
->
query_length
,
TRUE
);
Query_log_event
qinfo
(
thd
,
thd
->
query
,
thd
->
query_length
,
TRUE
,
FALSE
);
if
(
mysql_bin_log
.
write
(
&
qinfo
))
error
=
1
;
}
...
...
sql/item_func.cc
View file @
fe70f8c7
...
...
@@ -2010,7 +2010,7 @@ void item_user_lock_release(User_level_lock *ull)
tmp
.
copy
(
command
,
strlen
(
command
),
tmp
.
charset
());
tmp
.
append
(
ull
->
key
,
ull
->
key_length
);
tmp
.
append
(
"
\"
)"
,
2
);
Query_log_event
qev
(
current_thd
,
tmp
.
ptr
(),
tmp
.
length
(),
1
);
Query_log_event
qev
(
current_thd
,
tmp
.
ptr
(),
tmp
.
length
(),
1
,
FALSE
);
qev
.
error_code
=
0
;
// this query is always safe to run on slave
mysql_bin_log
.
write
(
&
qev
);
}
...
...
sql/log.cc
View file @
fe70f8c7
...
...
@@ -1274,7 +1274,7 @@ bool MYSQL_LOG::write(Log_event* event_info)
(
local_db
&&
!
db_ok
(
local_db
,
binlog_do_db
,
binlog_ignore_db
)))
{
VOID
(
pthread_mutex_unlock
(
&
LOCK_log
));
DBUG_PRINT
(
"error"
,(
"!db_ok
"
));
DBUG_PRINT
(
"error"
,(
"!db_ok
('%s')"
,
local_db
));
DBUG_RETURN
(
0
);
}
#endif
/* HAVE_REPLICATION */
...
...
@@ -1317,7 +1317,7 @@ COLLATION_CONNECTION=%u,COLLATION_DATABASE=%u,COLLATION_SERVER=%u",
(
uint
)
thd
->
variables
.
collation_connection
->
number
,
(
uint
)
thd
->
variables
.
collation_database
->
number
,
(
uint
)
thd
->
variables
.
collation_server
->
number
);
Query_log_event
e
(
thd
,
buf
,
written
,
0
);
Query_log_event
e
(
thd
,
buf
,
written
,
0
,
FALSE
);
e
.
set_log_pos
(
this
);
if
(
e
.
write
(
file
))
goto
err
;
...
...
@@ -1333,7 +1333,7 @@ COLLATION_CONNECTION=%u,COLLATION_DATABASE=%u,COLLATION_SERVER=%u",
char
*
buf_end
=
strxmov
(
buf
,
"SET ONE_SHOT TIME_ZONE='"
,
thd
->
variables
.
time_zone
->
get_name
()
->
ptr
(),
"'"
,
NullS
);
Query_log_event
e
(
thd
,
buf
,
buf_end
-
buf
,
0
);
Query_log_event
e
(
thd
,
buf
,
buf_end
-
buf
,
0
,
FALSE
);
e
.
set_log_pos
(
this
);
if
(
e
.
write
(
file
))
goto
err
;
...
...
@@ -1402,7 +1402,7 @@ COLLATION_CONNECTION=%u,COLLATION_DATABASE=%u,COLLATION_SERVER=%u",
if
(
thd
->
options
&
OPTION_NO_FOREIGN_KEY_CHECKS
)
{
Query_log_event
e
(
thd
,
"SET FOREIGN_KEY_CHECKS=0"
,
24
,
0
);
Query_log_event
e
(
thd
,
"SET FOREIGN_KEY_CHECKS=0"
,
24
,
0
,
FALSE
);
e
.
set_log_pos
(
this
);
if
(
e
.
write
(
file
))
goto
err
;
...
...
@@ -1421,7 +1421,7 @@ COLLATION_CONNECTION=%u,COLLATION_DATABASE=%u,COLLATION_SERVER=%u",
{
if
(
thd
->
options
&
OPTION_NO_FOREIGN_KEY_CHECKS
)
{
Query_log_event
e
(
thd
,
"SET FOREIGN_KEY_CHECKS=1"
,
24
,
0
);
Query_log_event
e
(
thd
,
"SET FOREIGN_KEY_CHECKS=1"
,
24
,
0
,
FALSE
);
e
.
set_log_pos
(
this
);
if
(
e
.
write
(
file
))
goto
err
;
...
...
@@ -1597,7 +1597,7 @@ bool MYSQL_LOG::write(THD *thd, IO_CACHE *cache, bool commit_or_rollback)
we will add the "COMMIT mark and write the buffer to the binlog.
*/
{
Query_log_event
qinfo
(
thd
,
"BEGIN"
,
5
,
TRUE
);
Query_log_event
qinfo
(
thd
,
"BEGIN"
,
5
,
TRUE
,
FALSE
);
/*
Imagine this is rollback due to net timeout, after all statements of
the transaction succeeded. Then we want a zero-error code in BEGIN.
...
...
@@ -1638,7 +1638,7 @@ bool MYSQL_LOG::write(THD *thd, IO_CACHE *cache, bool commit_or_rollback)
Query_log_event
qinfo
(
thd
,
commit_or_rollback
?
"COMMIT"
:
"ROLLBACK"
,
commit_or_rollback
?
6
:
8
,
TRUE
);
TRUE
,
FALSE
);
qinfo
.
error_code
=
0
;
qinfo
.
set_log_pos
(
this
);
if
(
qinfo
.
write
(
&
log_file
)
||
flush_io_cache
(
&
log_file
)
||
...
...
sql/log_event.cc
View file @
fe70f8c7
...
...
@@ -780,7 +780,8 @@ void Query_log_event::pack_info(Protocol *protocol)
if
(
!
(
buf
=
my_malloc
(
9
+
db_len
+
q_len
,
MYF
(
MY_WME
))))
return
;
pos
=
buf
;
if
(
db
&&
db_len
)
if
(
!
(
flags
&
LOG_EVENT_SUPPRESS_USE_F
)
&&
db
&&
db_len
)
{
pos
=
strmov
(
buf
,
"use `"
);
memcpy
(
pos
,
db
,
db_len
);
...
...
@@ -872,9 +873,12 @@ int Query_log_event::write_data(IO_CACHE* file)
#ifndef MYSQL_CLIENT
Query_log_event
::
Query_log_event
(
THD
*
thd_arg
,
const
char
*
query_arg
,
ulong
query_length
,
bool
using_trans
)
:
Log_event
(
thd_arg
,
!
thd_arg
->
tmp_table_used
?
0
:
LOG_EVENT_THREAD_SPECIFIC_F
,
using_trans
),
ulong
query_length
,
bool
using_trans
,
bool
suppress_use
)
:
Log_event
(
thd_arg
,
((
thd_arg
->
tmp_table_used
?
LOG_EVENT_THREAD_SPECIFIC_F
:
0
)
|
(
suppress_use
?
LOG_EVENT_SUPPRESS_USE_F
:
0
)),
using_trans
),
data_buf
(
0
),
query
(
query_arg
),
db
(
thd_arg
->
db
),
q_len
((
uint32
)
query_length
),
error_code
(
thd_arg
->
killed
?
...
...
@@ -949,14 +953,20 @@ void Query_log_event::print(FILE* file, bool short_form, char* last_db)
bool
different_db
=
1
;
if
(
db
&&
last_db
)
if
(
!
(
flags
&
LOG_EVENT_SUPPRESS_USE_F
)
)
{
if
(
different_db
=
memcmp
(
last_db
,
db
,
db_len
+
1
))
memcpy
(
last_db
,
db
,
db_len
+
1
);
if
(
db
&&
last_db
)
{
if
(
different_db
=
memcmp
(
last_db
,
db
,
db_len
+
1
))
memcpy
(
last_db
,
db
,
db_len
+
1
);
}
if
(
db
&&
db
[
0
]
&&
different_db
)
{
fprintf
(
file
,
"use %s;
\n
"
,
db
);
}
}
if
(
db
&&
db
[
0
]
&&
different_db
)
fprintf
(
file
,
"use %s;
\n
"
,
db
);
end
=
int10_to_str
((
long
)
when
,
strmov
(
buff
,
"SET TIMESTAMP="
),
10
);
*
end
++=
';'
;
*
end
++=
'\n'
;
...
...
sql/log_event.h
View file @
fe70f8c7
...
...
@@ -264,6 +264,19 @@ struct sql_ex_info
*/
#define LOG_EVENT_THREAD_SPECIFIC_F 0x4
/*
Suppress the generation of 'USE' statements before the actual
statement. This flag should be set for any events that does not need
the current database set to function correctly. Most notable cases
are 'CREATE DATABASE' and 'DROP DATABASE'.
This flags should only be used in exceptional circumstances, since
it introduce a significant change in behaviour regarding the
replication logic together with the flags --binlog-do-db and
--replicated-do-db.
*/
#define LOG_EVENT_SUPPRESS_USE_F 0x8
enum
Log_event_type
{
UNKNOWN_EVENT
=
0
,
START_EVENT
=
1
,
QUERY_EVENT
=
2
,
STOP_EVENT
=
3
,
...
...
@@ -331,8 +344,9 @@ public:
/*
Some 16 flags. Only one is really used now; look above for
LOG_EVENT_TIME_F, LOG_EVENT_FORCED_ROTATE_F, LOG_EVENT_THREAD_SPECIFIC_F
for notes.
LOG_EVENT_TIME_F, LOG_EVENT_FORCED_ROTATE_F,
LOG_EVENT_THREAD_SPECIFIC_F, and LOG_EVENT_SUPPRESS_USE_F for
notes.
*/
uint16
flags
;
...
...
@@ -465,7 +479,7 @@ public:
#ifndef MYSQL_CLIENT
Query_log_event
(
THD
*
thd_arg
,
const
char
*
query_arg
,
ulong
query_length
,
bool
using_trans
);
bool
using_trans
,
bool
suppress_use
);
const
char
*
get_db
()
{
return
db
;
}
#ifdef HAVE_REPLICATION
void
pack_info
(
Protocol
*
protocol
);
...
...
sql/sql_acl.cc
View file @
fe70f8c7
...
...
@@ -1230,7 +1230,7 @@ bool change_password(THD *thd, const char *host, const char *user,
new_password
));
thd
->
clear_error
();
mysql_update_log
.
write
(
thd
,
buff
,
query_length
);
Query_log_event
qinfo
(
thd
,
buff
,
query_length
,
0
);
Query_log_event
qinfo
(
thd
,
buff
,
query_length
,
0
,
FALSE
);
mysql_bin_log
.
write
(
&
qinfo
);
DBUG_RETURN
(
0
);
}
...
...
sql/sql_base.cc
View file @
fe70f8c7
...
...
@@ -524,7 +524,7 @@ void close_temporary_tables(THD *thd)
{
/* The -1 is to remove last ',' */
thd
->
clear_error
();
Query_log_event
qinfo
(
thd
,
query
,
(
ulong
)(
end
-
query
)
-
1
,
0
);
Query_log_event
qinfo
(
thd
,
query
,
(
ulong
)(
end
-
query
)
-
1
,
0
,
FALSE
);
/*
Imagine the thread had created a temp table, then was doing a SELECT, and
the SELECT was killed. Then it's not clever to mark the statement above as
...
...
@@ -1441,7 +1441,7 @@ static int open_unireg_entry(THD *thd, TABLE *entry, const char *db,
{
end
=
strxmov
(
strmov
(
query
,
"DELETE FROM `"
),
db
,
"`.`"
,
name
,
"`"
,
NullS
);
Query_log_event
qinfo
(
thd
,
query
,
(
ulong
)(
end
-
query
),
0
);
Query_log_event
qinfo
(
thd
,
query
,
(
ulong
)(
end
-
query
),
0
,
FALSE
);
mysql_bin_log
.
write
(
&
qinfo
);
my_free
(
query
,
MYF
(
0
));
}
...
...
sql/sql_db.cc
View file @
fe70f8c7
...
...
@@ -467,7 +467,29 @@ int mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create_info,
mysql_update_log
.
write
(
thd
,
query
,
query_length
);
if
(
mysql_bin_log
.
is_open
())
{
Query_log_event
qinfo
(
thd
,
query
,
query_length
,
0
);
Query_log_event
qinfo
(
thd
,
query
,
query_length
,
0
,
/* suppress_use */
TRUE
);
/*
Write should use the database being created as the "current
database" and not the threads current database, which is the
default. If we do not change the "current database" to the
database being created, the CREATE statement will not be
replicated when using --binlog-do-db to select databases to be
replicated.
An example (--binlog-do-db=sisyfos):
CREATE DATABASE bob; # Not replicated
USE bob; # 'bob' is the current database
CREATE DATABASE sisyfos; # Not replicated since 'bob' is
# current database.
USE sisyfos; # Will give error on slave since
# database does not exist.
*/
qinfo
.
db
=
db
;
qinfo
.
db_len
=
strlen
(
db
);
mysql_bin_log
.
write
(
&
qinfo
);
}
send_ok
(
thd
,
result
);
...
...
@@ -517,7 +539,15 @@ int mysql_alter_db(THD *thd, const char *db, HA_CREATE_INFO *create_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
);
Query_log_event
qinfo
(
thd
,
thd
->
query
,
thd
->
query_length
,
0
,
/* suppress_use */
TRUE
);
// Write should use the database being created as the "current
// database" and not the threads current database, which is the
// default.
qinfo
.
db
=
db
;
qinfo
.
db_len
=
strlen
(
db
);
thd
->
clear_error
();
mysql_bin_log
.
write
(
&
qinfo
);
}
...
...
@@ -625,7 +655,15 @@ int mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent)
mysql_update_log
.
write
(
thd
,
query
,
query_length
);
if
(
mysql_bin_log
.
is_open
())
{
Query_log_event
qinfo
(
thd
,
query
,
query_length
,
0
);
Query_log_event
qinfo
(
thd
,
query
,
query_length
,
0
,
/* suppress_use */
TRUE
);
// Write should use the database being created as the "current
// database" and not the threads current database, which is the
// default.
qinfo
.
db
=
db
;
qinfo
.
db_len
=
strlen
(
db
);
thd
->
clear_error
();
mysql_bin_log
.
write
(
&
qinfo
);
}
...
...
sql/sql_delete.cc
View file @
fe70f8c7
...
...
@@ -216,7 +216,7 @@ cleanup:
if
(
error
<=
0
)
thd
->
clear_error
();
Query_log_event
qinfo
(
thd
,
thd
->
query
,
thd
->
query_length
,
log_delayed
);
log_delayed
,
FALSE
);
if
(
mysql_bin_log
.
write
(
&
qinfo
)
&&
transactional_table
)
error
=
1
;
}
...
...
@@ -565,7 +565,7 @@ bool multi_delete::send_eof()
if
(
error
<=
0
)
thd
->
clear_error
();
Query_log_event
qinfo
(
thd
,
thd
->
query
,
thd
->
query_length
,
log_delayed
);
log_delayed
,
FALSE
);
if
(
mysql_bin_log
.
write
(
&
qinfo
)
&&
!
normal_tables
)
local_error
=
1
;
// Log write failed: roll back the SQL statement
}
...
...
@@ -674,7 +674,7 @@ end:
{
thd
->
clear_error
();
Query_log_event
qinfo
(
thd
,
thd
->
query
,
thd
->
query_length
,
thd
->
tmp_table
);
thd
->
tmp_table
,
FALSE
);
mysql_bin_log
.
write
(
&
qinfo
);
}
send_ok
(
thd
);
// This should return record count
...
...
sql/sql_insert.cc
View file @
fe70f8c7
...
...
@@ -368,7 +368,7 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list,
if
(
error
<=
0
)
thd
->
clear_error
();
Query_log_event
qinfo
(
thd
,
thd
->
query
,
thd
->
query_length
,
log_delayed
);
log_delayed
,
FALSE
);
if
(
mysql_bin_log
.
write
(
&
qinfo
)
&&
transactional_table
)
error
=
1
;
}
...
...
@@ -1364,7 +1364,7 @@ bool delayed_insert::handle_inserts(void)
mysql_update_log
.
write
(
&
thd
,
row
->
query
,
row
->
query_length
);
if
(
row
->
log_query
&
DELAYED_LOG_BIN
&&
using_bin_log
)
{
Query_log_event
qinfo
(
&
thd
,
row
->
query
,
row
->
query_length
,
0
);
Query_log_event
qinfo
(
&
thd
,
row
->
query
,
row
->
query_length
,
0
,
FALSE
);
mysql_bin_log
.
write
(
&
qinfo
);
}
}
...
...
@@ -1539,7 +1539,7 @@ void select_insert::send_error(uint errcode,const char *err)
if
(
mysql_bin_log
.
is_open
())
{
Query_log_event
qinfo
(
thd
,
thd
->
query
,
thd
->
query_length
,
table
->
file
->
has_transactions
());
table
->
file
->
has_transactions
()
,
FALSE
);
mysql_bin_log
.
write
(
&
qinfo
);
}
if
(
!
table
->
tmp_table
)
...
...
@@ -1581,7 +1581,7 @@ bool select_insert::send_eof()
if
(
!
error
)
thd
->
clear_error
();
Query_log_event
qinfo
(
thd
,
thd
->
query
,
thd
->
query_length
,
table
->
file
->
has_transactions
());
table
->
file
->
has_transactions
()
,
FALSE
);
mysql_bin_log
.
write
(
&
qinfo
);
}
if
((
error2
=
ha_autocommit_or_rollback
(
thd
,
error
))
&&
!
error
)
...
...
sql/sql_parse.cc
View file @
fe70f8c7
...
...
@@ -2614,7 +2614,7 @@ unsent_create_error:
if
(
mysql_bin_log
.
is_open
())
{
thd
->
clear_error
();
// No binlog error generated
Query_log_event
qinfo
(
thd
,
thd
->
query
,
thd
->
query_length
,
0
);
Query_log_event
qinfo
(
thd
,
thd
->
query
,
thd
->
query_length
,
0
,
FALSE
);
mysql_bin_log
.
write
(
&
qinfo
);
}
}
...
...
@@ -2643,7 +2643,7 @@ unsent_create_error:
if
(
mysql_bin_log
.
is_open
())
{
thd
->
clear_error
();
// No binlog error generated
Query_log_event
qinfo
(
thd
,
thd
->
query
,
thd
->
query_length
,
0
);
Query_log_event
qinfo
(
thd
,
thd
->
query
,
thd
->
query_length
,
0
,
FALSE
);
mysql_bin_log
.
write
(
&
qinfo
);
}
}
...
...
@@ -2666,7 +2666,7 @@ unsent_create_error:
if
(
mysql_bin_log
.
is_open
())
{
thd
->
clear_error
();
// No binlog error generated
Query_log_event
qinfo
(
thd
,
thd
->
query
,
thd
->
query_length
,
0
);
Query_log_event
qinfo
(
thd
,
thd
->
query
,
thd
->
query_length
,
0
,
FALSE
);
mysql_bin_log
.
write
(
&
qinfo
);
}
}
...
...
@@ -3262,7 +3262,7 @@ purposes internal to the MySQL server", MYF(0));
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
);
Query_log_event
qinfo
(
thd
,
thd
->
query
,
thd
->
query_length
,
0
,
FALSE
);
mysql_bin_log
.
write
(
&
qinfo
);
}
send_ok
(
thd
);
...
...
@@ -3278,7 +3278,7 @@ purposes internal to the MySQL server", MYF(0));
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
);
Query_log_event
qinfo
(
thd
,
thd
->
query
,
thd
->
query_length
,
0
,
FALSE
);
mysql_bin_log
.
write
(
&
qinfo
);
}
send_ok
(
thd
);
...
...
@@ -3345,7 +3345,7 @@ purposes internal to the MySQL server", MYF(0));
if
(
mysql_bin_log
.
is_open
())
{
thd
->
clear_error
();
Query_log_event
qinfo
(
thd
,
thd
->
query
,
thd
->
query_length
,
0
);
Query_log_event
qinfo
(
thd
,
thd
->
query
,
thd
->
query_length
,
0
,
FALSE
);
mysql_bin_log
.
write
(
&
qinfo
);
}
}
...
...
@@ -3366,7 +3366,7 @@ purposes internal to the MySQL server", MYF(0));
if
(
mysql_bin_log
.
is_open
())
{
thd
->
clear_error
();
Query_log_event
qinfo
(
thd
,
thd
->
query
,
thd
->
query_length
,
0
);
Query_log_event
qinfo
(
thd
,
thd
->
query
,
thd
->
query_length
,
0
,
FALSE
);
mysql_bin_log
.
write
(
&
qinfo
);
}
if
(
mqh_used
&&
lex
->
sql_command
==
SQLCOM_GRANT
)
...
...
@@ -3409,7 +3409,7 @@ purposes internal to the MySQL server", MYF(0));
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
);
Query_log_event
qinfo
(
thd
,
thd
->
query
,
thd
->
query_length
,
0
,
FALSE
);
mysql_bin_log
.
write
(
&
qinfo
);
}
}
...
...
sql/sql_rename.cc
View file @
fe70f8c7
...
...
@@ -84,7 +84,7 @@ bool mysql_rename_tables(THD *thd, TABLE_LIST *table_list)
if
(
mysql_bin_log
.
is_open
())
{
thd
->
clear_error
();
Query_log_event
qinfo
(
thd
,
thd
->
query
,
thd
->
query_length
,
0
);
Query_log_event
qinfo
(
thd
,
thd
->
query
,
thd
->
query_length
,
0
,
FALSE
);
mysql_bin_log
.
write
(
&
qinfo
);
}
send_ok
(
thd
);
...
...
sql/sql_table.cc
View file @
fe70f8c7
...
...
@@ -282,7 +282,8 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
if
(
!
error
)
thd
->
clear_error
();
Query_log_event
qinfo
(
thd
,
thd
->
query
,
thd
->
query_length
,
tmp_table_deleted
&&
!
some_tables_deleted
);
tmp_table_deleted
&&
!
some_tables_deleted
,
FALSE
);
mysql_bin_log
.
write
(
&
qinfo
);
}
}
...
...
@@ -1419,7 +1420,8 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
thd
->
clear_error
();
Query_log_event
qinfo
(
thd
,
thd
->
query
,
thd
->
query_length
,
test
(
create_info
->
options
&
HA_LEX_CREATE_TMP_TABLE
));
HA_LEX_CREATE_TMP_TABLE
),
FALSE
);
mysql_bin_log
.
write
(
&
qinfo
);
}
}
...
...
@@ -2344,7 +2346,8 @@ int mysql_create_like_table(THD* thd, TABLE_LIST* table,
thd
->
clear_error
();
Query_log_event
qinfo
(
thd
,
thd
->
query
,
thd
->
query_length
,
test
(
create_info
->
options
&
HA_LEX_CREATE_TMP_TABLE
));
HA_LEX_CREATE_TMP_TABLE
),
FALSE
);
mysql_bin_log
.
write
(
&
qinfo
);
}
res
=
0
;
...
...
@@ -2455,7 +2458,7 @@ mysql_discard_or_import_tablespace(THD *thd,
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
);
Query_log_event
qinfo
(
thd
,
thd
->
query
,
thd
->
query_length
,
0
,
FALSE
);
mysql_bin_log
.
write
(
&
qinfo
);
}
err:
...
...
@@ -2842,7 +2845,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
if
(
mysql_bin_log
.
is_open
())
{
thd
->
clear_error
();
Query_log_event
qinfo
(
thd
,
thd
->
query
,
thd
->
query_length
,
0
);
Query_log_event
qinfo
(
thd
,
thd
->
query
,
thd
->
query_length
,
0
,
FALSE
);
mysql_bin_log
.
write
(
&
qinfo
);
}
if
(
do_send_ok
)
...
...
@@ -3237,7 +3240,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
if
(
mysql_bin_log
.
is_open
())
{
thd
->
clear_error
();
Query_log_event
qinfo
(
thd
,
thd
->
query
,
thd
->
query_length
,
0
);
Query_log_event
qinfo
(
thd
,
thd
->
query
,
thd
->
query_length
,
0
,
FALSE
);
mysql_bin_log
.
write
(
&
qinfo
);
}
goto
end_temporary
;
...
...
@@ -3372,7 +3375,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
if
(
mysql_bin_log
.
is_open
())
{
thd
->
clear_error
();
Query_log_event
qinfo
(
thd
,
thd
->
query
,
thd
->
query_length
,
0
);
Query_log_event
qinfo
(
thd
,
thd
->
query
,
thd
->
query_length
,
0
,
FALSE
);
mysql_bin_log
.
write
(
&
qinfo
);
}
VOID
(
pthread_cond_broadcast
(
&
COND_refresh
));
...
...
sql/sql_update.cc
View file @
fe70f8c7
...
...
@@ -344,7 +344,7 @@ int mysql_update(THD *thd,
if
(
error
<=
0
)
thd
->
clear_error
();
Query_log_event
qinfo
(
thd
,
thd
->
query
,
thd
->
query_length
,
log_delayed
);
log_delayed
,
FALSE
);
if
(
mysql_bin_log
.
write
(
&
qinfo
)
&&
transactional_table
)
error
=
1
;
// Rollback update
}
...
...
@@ -1221,7 +1221,7 @@ bool multi_update::send_eof()
if
(
local_error
<=
0
)
thd
->
clear_error
();
Query_log_event
qinfo
(
thd
,
thd
->
query
,
thd
->
query_length
,
log_delayed
);
log_delayed
,
FALSE
);
if
(
mysql_bin_log
.
write
(
&
qinfo
)
&&
trans_safe
)
local_error
=
1
;
// Rollback update
}
...
...
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