Commit 72d56253 authored by unknown's avatar unknown

Merge mysql.com:/space/bkroot/mysql-4.1

into mysql.com:/space/bk/b6391-mysql-4.1


sql/handler.cc:
  Auto merged
sql/item_func.cc:
  Auto merged
sql/sql_acl.cc:
  Auto merged
sql/sql_parse.cc:
  Auto merged
sql/sql_table.cc:
  Auto merged
parents 5fc09be9 220acb32
...@@ -11,8 +11,8 @@ get_lock("a",10) ...@@ -11,8 +11,8 @@ get_lock("a",10)
show binlog events; show binlog events;
Log_name Pos Event_type Server_id Orig_log_pos Info 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 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 79 Query 1 79 create database `drop-temp+table-test`
master-bin.000001 152 Query 1 152 use `drop-temp+table-test`; create temporary table `table:name` (a int) master-bin.000001 168 Query 1 168 use `drop-temp+table-test`; create temporary table `table:name` (a int)
master-bin.000001 246 Query 1 246 use `drop-temp+table-test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `drop-temp+table-test`.`table:name` master-bin.000001 262 Query 1 262 use `drop-temp+table-test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `drop-temp+table-test`.`table:name`
master-bin.000001 375 Query 1 375 use `drop-temp+table-test`; DO RELEASE_LOCK("a") master-bin.000001 391 Query 1 391 use `drop-temp+table-test`; DO RELEASE_LOCK("a")
drop database `drop-temp+table-test`; drop database `drop-temp+table-test`;
...@@ -105,62 +105,62 @@ drop database mysqltest2; ...@@ -105,62 +105,62 @@ drop database mysqltest2;
drop database mysqltest3; drop database mysqltest3;
show binlog events from 79; show binlog events from 79;
Log_name Pos Event_type Server_id Orig_log_pos Info Log_name Pos Event_type Server_id Orig_log_pos Info
master-bin.000001 79 Query 1 79 use `test`; drop database if exists mysqltest2 master-bin.000001 79 Query 1 79 drop database if exists mysqltest2
master-bin.000001 148 Query 1 148 use `test`; drop database if exists mysqltest3 master-bin.000001 154 Query 1 154 drop database if exists mysqltest3
master-bin.000001 217 Query 1 217 use `test`; create database mysqltest2 character set latin2 master-bin.000001 229 Query 1 229 create database mysqltest2 character set latin2
master-bin.000001 299 Query 1 299 use `test`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=8,COLLATION_DATABASE=8,COLLATION_SERVER=30 master-bin.000001 317 Query 1 317 use `test`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=8,COLLATION_DATABASE=8,COLLATION_SERVER=30
master-bin.000001 433 Query 1 433 use `test`; create database mysqltest3 master-bin.000001 451 Query 1 451 create database mysqltest3
master-bin.000001 494 Query 1 494 use `test`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=8,COLLATION_DATABASE=8,COLLATION_SERVER=64 master-bin.000001 518 Query 1 518 use `test`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=8,COLLATION_DATABASE=8,COLLATION_SERVER=64
master-bin.000001 628 Query 1 628 use `test`; drop database mysqltest3 master-bin.000001 652 Query 1 652 drop database mysqltest3
master-bin.000001 687 Query 1 687 use `test`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=8,COLLATION_DATABASE=8,COLLATION_SERVER=64 master-bin.000001 717 Query 1 717 use `test`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=8,COLLATION_DATABASE=8,COLLATION_SERVER=64
master-bin.000001 821 Query 1 821 use `test`; create database mysqltest3 master-bin.000001 851 Query 1 851 create database mysqltest3
master-bin.000001 882 Query 1 882 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=8,COLLATION_DATABASE=9,COLLATION_SERVER=64 master-bin.000001 918 Query 1 918 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=8,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 1022 Query 1 1022 use `mysqltest2`; create table t1 (a int auto_increment primary key, b varchar(100)) master-bin.000001 1058 Query 1 1058 use `mysqltest2`; create table t1 (a int auto_increment primary key, b varchar(100))
master-bin.000001 1129 Query 1 1129 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=4,COLLATION_CONNECTION=27,COLLATION_DATABASE=9,COLLATION_SERVER=64 master-bin.000001 1165 Query 1 1165 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=4,COLLATION_CONNECTION=27,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 1270 Intvar 1 1270 INSERT_ID=1 master-bin.000001 1306 Intvar 1 1306 INSERT_ID=1
master-bin.000001 1298 Query 1 1298 use `mysqltest2`; insert into t1 (b) values(@@character_set_server) master-bin.000001 1334 Query 1 1334 use `mysqltest2`; insert into t1 (b) values(@@character_set_server)
master-bin.000001 1388 Query 1 1388 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=4,COLLATION_CONNECTION=27,COLLATION_DATABASE=9,COLLATION_SERVER=64 master-bin.000001 1424 Query 1 1424 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=4,COLLATION_CONNECTION=27,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 1529 Intvar 1 1529 INSERT_ID=2 master-bin.000001 1565 Intvar 1 1565 INSERT_ID=2
master-bin.000001 1557 Query 1 1557 use `mysqltest2`; insert into t1 (b) values(@@collation_server) master-bin.000001 1593 Query 1 1593 use `mysqltest2`; insert into t1 (b) values(@@collation_server)
master-bin.000001 1643 Query 1 1643 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=4,COLLATION_CONNECTION=27,COLLATION_DATABASE=9,COLLATION_SERVER=64 master-bin.000001 1679 Query 1 1679 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=4,COLLATION_CONNECTION=27,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 1784 Intvar 1 1784 INSERT_ID=3 master-bin.000001 1820 Intvar 1 1820 INSERT_ID=3
master-bin.000001 1812 Query 1 1812 use `mysqltest2`; insert into t1 (b) values(@@character_set_client) master-bin.000001 1848 Query 1 1848 use `mysqltest2`; insert into t1 (b) values(@@character_set_client)
master-bin.000001 1902 Query 1 1902 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=4,COLLATION_CONNECTION=27,COLLATION_DATABASE=9,COLLATION_SERVER=64 master-bin.000001 1938 Query 1 1938 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=4,COLLATION_CONNECTION=27,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 2043 Intvar 1 2043 INSERT_ID=4 master-bin.000001 2079 Intvar 1 2079 INSERT_ID=4
master-bin.000001 2071 Query 1 2071 use `mysqltest2`; insert into t1 (b) values(@@character_set_connection) master-bin.000001 2107 Query 1 2107 use `mysqltest2`; insert into t1 (b) values(@@character_set_connection)
master-bin.000001 2165 Query 1 2165 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=4,COLLATION_CONNECTION=27,COLLATION_DATABASE=9,COLLATION_SERVER=64 master-bin.000001 2201 Query 1 2201 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=4,COLLATION_CONNECTION=27,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 2306 Intvar 1 2306 INSERT_ID=5 master-bin.000001 2342 Intvar 1 2342 INSERT_ID=5
master-bin.000001 2334 Query 1 2334 use `mysqltest2`; insert into t1 (b) values(@@collation_connection) master-bin.000001 2370 Query 1 2370 use `mysqltest2`; insert into t1 (b) values(@@collation_connection)
master-bin.000001 2424 Query 1 2424 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=5,COLLATION_DATABASE=9,COLLATION_SERVER=64 master-bin.000001 2460 Query 1 2460 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=5,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 2564 Query 1 2564 use `mysqltest2`; truncate table t1 master-bin.000001 2600 Query 1 2600 use `mysqltest2`; truncate table t1
master-bin.000001 2622 Query 1 2622 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=5,COLLATION_DATABASE=9,COLLATION_SERVER=64 master-bin.000001 2658 Query 1 2658 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=5,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 2762 Intvar 1 2762 INSERT_ID=1 master-bin.000001 2798 Intvar 1 2798 INSERT_ID=1
master-bin.000001 2790 Query 1 2790 use `mysqltest2`; insert into t1 (b) values(@@collation_connection) master-bin.000001 2826 Query 1 2826 use `mysqltest2`; insert into t1 (b) values(@@collation_connection)
master-bin.000001 2880 Query 1 2880 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=5,COLLATION_DATABASE=9,COLLATION_SERVER=64 master-bin.000001 2916 Query 1 2916 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=5,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 3020 Intvar 1 3020 INSERT_ID=2 master-bin.000001 3056 Intvar 1 3056 INSERT_ID=2
master-bin.000001 3048 Query 1 3048 use `mysqltest2`; insert into t1 (b) values(LEAST("Müller","Muffler")) master-bin.000001 3084 Query 1 3084 use `mysqltest2`; insert into t1 (b) values(LEAST("Müller","Muffler"))
master-bin.000001 3141 Query 1 3141 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64 master-bin.000001 3177 Query 1 3177 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 3282 Intvar 1 3282 INSERT_ID=3 master-bin.000001 3318 Intvar 1 3318 INSERT_ID=3
master-bin.000001 3310 Query 1 3310 use `mysqltest2`; insert into t1 (b) values(@@collation_connection) master-bin.000001 3346 Query 1 3346 use `mysqltest2`; insert into t1 (b) values(@@collation_connection)
master-bin.000001 3400 Query 1 3400 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64 master-bin.000001 3436 Query 1 3436 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 3541 Intvar 1 3541 INSERT_ID=4 master-bin.000001 3577 Intvar 1 3577 INSERT_ID=4
master-bin.000001 3569 Query 1 3569 use `mysqltest2`; insert into t1 (b) values(LEAST("Müller","Muffler")) master-bin.000001 3605 Query 1 3605 use `mysqltest2`; insert into t1 (b) values(LEAST("Müller","Muffler"))
master-bin.000001 3662 Query 1 3662 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64 master-bin.000001 3698 Query 1 3698 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 3803 Intvar 1 3803 INSERT_ID=74 master-bin.000001 3839 Intvar 1 3839 INSERT_ID=74
master-bin.000001 3831 Create_file 1 3831 db=mysqltest2;table=t1;file_id=1;block_len=581 master-bin.000001 3867 Create_file 1 3867 db=mysqltest2;table=t1;file_id=1;block_len=581
master-bin.000001 4504 Query 1 4504 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64 master-bin.000001 4540 Query 1 4540 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 4645 Intvar 1 4645 INSERT_ID=5 master-bin.000001 4681 Intvar 1 4681 INSERT_ID=5
master-bin.000001 4673 Exec_load 1 4673 ;file_id=1 master-bin.000001 4709 Exec_load 1 4709 ;file_id=1
master-bin.000001 4696 Query 1 4696 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64 master-bin.000001 4732 Query 1 4732 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 4837 Query 1 4837 use `mysqltest2`; truncate table t1 master-bin.000001 4873 Query 1 4873 use `mysqltest2`; truncate table t1
master-bin.000001 4895 Query 1 4895 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64 master-bin.000001 4931 Query 1 4931 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 5036 Intvar 1 5036 INSERT_ID=1 master-bin.000001 5072 Intvar 1 5072 INSERT_ID=1
master-bin.000001 5064 User var 1 5064 @`a`=_cp850 0x4DFC6C6C6572 COLLATE cp850_general_ci master-bin.000001 5100 User var 1 5100 @`a`=_cp850 0x4DFC6C6C6572 COLLATE cp850_general_ci
master-bin.000001 5104 Query 1 5104 use `mysqltest2`; insert into t1 (b) values(collation(@a)) master-bin.000001 5140 Query 1 5140 use `mysqltest2`; insert into t1 (b) values(collation(@a))
master-bin.000001 5185 Query 1 5185 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64 master-bin.000001 5221 Query 1 5221 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 5326 Query 1 5326 use `mysqltest2`; drop database mysqltest2 master-bin.000001 5362 Query 1 5362 drop database mysqltest2
master-bin.000001 5391 Query 1 5391 SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64 master-bin.000001 5427 Query 1 5427 SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 5522 Query 1 5522 drop database mysqltest3 master-bin.000001 5558 Query 1 5558 drop database mysqltest3
set global character_set_server=latin2; set global character_set_server=latin2;
ERROR HY000: Binary logging and replication forbid changing the global server character set or collation ERROR HY000: Binary logging and replication forbid changing the global server character set or collation
set global character_set_server=latin2; set global character_set_server=latin2;
...@@ -200,8 +200,8 @@ hex(c1) hex(c2) ...@@ -200,8 +200,8 @@ hex(c1) hex(c2)
CDF32C20E7E020F0FBE1E0EBEAF3 CDF32C20E7E020F0FBE1E0EBEAF3 CDF32C20E7E020F0FBE1E0EBEAF3 CDF32C20E7E020F0FBE1E0EBEAF3
stop slave; stop slave;
delete from t1; delete from t1;
change master to master_log_pos=5801; change master to master_log_pos=5847;
start slave until master_log_file='master-bin.000001', master_log_pos=5937; start slave until master_log_file='master-bin.000001', master_log_pos=5983;
start slave; start slave;
select hex(c1), hex(c2) from t1; select hex(c1), hex(c2) from t1;
hex(c1) hex(c2) hex(c1) hex(c2)
......
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;
...@@ -12,4 +12,6 @@ use mysqltest; ...@@ -12,4 +12,6 @@ use mysqltest;
load data infile '../../std_data/rpl_loaddata.dat' into table test.t1; load data infile '../../std_data/rpl_loaddata.dat' into table test.t1;
show binlog events from 79; show binlog events from 79;
Log_name Pos Event_type Server_id Orig_log_pos Info 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; drop database mysqltest;
...@@ -154,9 +154,9 @@ select hex(c1), hex(c2) from t1; ...@@ -154,9 +154,9 @@ select hex(c1), hex(c2) from t1;
stop slave; stop slave;
delete from t1; delete from t1;
change master to master_log_pos=5801; change master to master_log_pos=5847;
start slave until master_log_file='master-bin.000001', master_log_pos=5937; start slave until master_log_file='master-bin.000001', master_log_pos=5983;
# Slave is supposed to stop _after_ the INSERT, even though 5937 is # Slave is supposed to stop _after_ the INSERT, even though 5983 is
# the position of the beginning of the INSERT; after SET slave is not # the position of the beginning of the INSERT; after SET slave is not
# supposed to increment position. # supposed to increment position.
wait_for_slave_to_stop; wait_for_slave_to_stop;
......
--binlog-do-db=mysqltest_sisyfos --binlog-do-db=mysqltest_prometheus
--replicate-do-db=mysqltest_sisyfos --replicate-do-db=mysqltest_prometheus
#
# 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;
...@@ -43,7 +43,7 @@ show slave status; ...@@ -43,7 +43,7 @@ show slave status;
# try replicate all until second insert to t2; # try replicate all until second insert to t2;
start slave until relay_log_file='slave-relay-bin.000002', relay_log_pos=537; start slave until relay_log_file='slave-relay-bin.000002', relay_log_pos=537;
sleep 2; sleep 4;
select * from t2; select * from t2;
--replace_result $MASTER_MYPORT MASTER_MYPORT --replace_result $MASTER_MYPORT MASTER_MYPORT
--replace_column 1 # 9 # 23 # 33 # --replace_column 1 # 9 # 23 # 33 #
......
...@@ -723,7 +723,7 @@ int ha_rollback_to_savepoint(THD *thd, char *savepoint_name) ...@@ -723,7 +723,7 @@ int ha_rollback_to_savepoint(THD *thd, char *savepoint_name)
if (unlikely((thd->options & OPTION_STATUS_NO_TRANS_UPDATE) && if (unlikely((thd->options & OPTION_STATUS_NO_TRANS_UPDATE) &&
my_b_tell(&thd->transaction.trans_log))) 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)) if (mysql_bin_log.write(&qinfo))
error= 1; error= 1;
} }
...@@ -761,7 +761,7 @@ int ha_savepoint(THD *thd, char *savepoint_name) ...@@ -761,7 +761,7 @@ int ha_savepoint(THD *thd, char *savepoint_name)
innobase_savepoint(thd,savepoint_name, innobase_savepoint(thd,savepoint_name,
my_b_tell(&thd->transaction.trans_log)); my_b_tell(&thd->transaction.trans_log));
#endif #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)) if (mysql_bin_log.write(&qinfo))
error= 1; error= 1;
} }
......
...@@ -2010,7 +2010,7 @@ void item_user_lock_release(User_level_lock *ull) ...@@ -2010,7 +2010,7 @@ void item_user_lock_release(User_level_lock *ull)
tmp.copy(command, strlen(command), tmp.charset()); tmp.copy(command, strlen(command), tmp.charset());
tmp.append(ull->key,ull->key_length); tmp.append(ull->key,ull->key_length);
tmp.append("\")", 2); 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 qev.error_code=0; // this query is always safe to run on slave
mysql_bin_log.write(&qev); mysql_bin_log.write(&qev);
} }
......
...@@ -1274,7 +1274,7 @@ bool MYSQL_LOG::write(Log_event* event_info) ...@@ -1274,7 +1274,7 @@ bool MYSQL_LOG::write(Log_event* event_info)
(local_db && !db_ok(local_db, binlog_do_db, binlog_ignore_db))) (local_db && !db_ok(local_db, binlog_do_db, binlog_ignore_db)))
{ {
VOID(pthread_mutex_unlock(&LOCK_log)); VOID(pthread_mutex_unlock(&LOCK_log));
DBUG_PRINT("error",("!db_ok")); DBUG_PRINT("error",("!db_ok('%s')", local_db));
DBUG_RETURN(0); DBUG_RETURN(0);
} }
#endif /* HAVE_REPLICATION */ #endif /* HAVE_REPLICATION */
...@@ -1317,7 +1317,7 @@ COLLATION_CONNECTION=%u,COLLATION_DATABASE=%u,COLLATION_SERVER=%u", ...@@ -1317,7 +1317,7 @@ COLLATION_CONNECTION=%u,COLLATION_DATABASE=%u,COLLATION_SERVER=%u",
(uint) thd->variables.collation_connection->number, (uint) thd->variables.collation_connection->number,
(uint) thd->variables.collation_database->number, (uint) thd->variables.collation_database->number,
(uint) thd->variables.collation_server->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); e.set_log_pos(this);
if (e.write(file)) if (e.write(file))
goto err; goto err;
...@@ -1333,7 +1333,7 @@ COLLATION_CONNECTION=%u,COLLATION_DATABASE=%u,COLLATION_SERVER=%u", ...@@ -1333,7 +1333,7 @@ COLLATION_CONNECTION=%u,COLLATION_DATABASE=%u,COLLATION_SERVER=%u",
char *buf_end= strxmov(buf, "SET ONE_SHOT TIME_ZONE='", char *buf_end= strxmov(buf, "SET ONE_SHOT TIME_ZONE='",
thd->variables.time_zone->get_name()->ptr(), thd->variables.time_zone->get_name()->ptr(),
"'", NullS); "'", 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); e.set_log_pos(this);
if (e.write(file)) if (e.write(file))
goto err; goto err;
...@@ -1402,7 +1402,7 @@ COLLATION_CONNECTION=%u,COLLATION_DATABASE=%u,COLLATION_SERVER=%u", ...@@ -1402,7 +1402,7 @@ COLLATION_CONNECTION=%u,COLLATION_DATABASE=%u,COLLATION_SERVER=%u",
if (thd->options & OPTION_NO_FOREIGN_KEY_CHECKS) 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); e.set_log_pos(this);
if (e.write(file)) if (e.write(file))
goto err; goto err;
...@@ -1421,7 +1421,7 @@ COLLATION_CONNECTION=%u,COLLATION_DATABASE=%u,COLLATION_SERVER=%u", ...@@ -1421,7 +1421,7 @@ COLLATION_CONNECTION=%u,COLLATION_DATABASE=%u,COLLATION_SERVER=%u",
{ {
if (thd->options & OPTION_NO_FOREIGN_KEY_CHECKS) 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); e.set_log_pos(this);
if (e.write(file)) if (e.write(file))
goto err; goto err;
...@@ -1597,7 +1597,7 @@ bool MYSQL_LOG::write(THD *thd, IO_CACHE *cache, bool commit_or_rollback) ...@@ -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. 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 Imagine this is rollback due to net timeout, after all statements of
the transaction succeeded. Then we want a zero-error code in BEGIN. 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) ...@@ -1638,7 +1638,7 @@ bool MYSQL_LOG::write(THD *thd, IO_CACHE *cache, bool commit_or_rollback)
Query_log_event qinfo(thd, Query_log_event qinfo(thd,
commit_or_rollback ? "COMMIT" : "ROLLBACK", commit_or_rollback ? "COMMIT" : "ROLLBACK",
commit_or_rollback ? 6 : 8, commit_or_rollback ? 6 : 8,
TRUE); TRUE, FALSE);
qinfo.error_code= 0; qinfo.error_code= 0;
qinfo.set_log_pos(this); qinfo.set_log_pos(this);
if (qinfo.write(&log_file) || flush_io_cache(&log_file) || if (qinfo.write(&log_file) || flush_io_cache(&log_file) ||
......
...@@ -780,7 +780,8 @@ void Query_log_event::pack_info(Protocol *protocol) ...@@ -780,7 +780,8 @@ void Query_log_event::pack_info(Protocol *protocol)
if (!(buf= my_malloc(9 + db_len + q_len, MYF(MY_WME)))) if (!(buf= my_malloc(9 + db_len + q_len, MYF(MY_WME))))
return; return;
pos= buf; pos= buf;
if (db && db_len) if (!(flags & LOG_EVENT_SUPPRESS_USE_F)
&& db && db_len)
{ {
pos= strmov(buf, "use `"); pos= strmov(buf, "use `");
memcpy(pos, db, db_len); memcpy(pos, db, db_len);
...@@ -872,9 +873,12 @@ int Query_log_event::write_data(IO_CACHE* file) ...@@ -872,9 +873,12 @@ int Query_log_event::write_data(IO_CACHE* file)
#ifndef MYSQL_CLIENT #ifndef MYSQL_CLIENT
Query_log_event::Query_log_event(THD* thd_arg, const char* query_arg, Query_log_event::Query_log_event(THD* thd_arg, const char* query_arg,
ulong query_length, bool using_trans) ulong query_length, bool using_trans,
:Log_event(thd_arg, !thd_arg->tmp_table_used ? bool suppress_use)
0 : LOG_EVENT_THREAD_SPECIFIC_F, using_trans), :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), data_buf(0), query(query_arg),
db(thd_arg->db), q_len((uint32) query_length), db(thd_arg->db), q_len((uint32) query_length),
error_code(thd_arg->killed ? error_code(thd_arg->killed ?
...@@ -949,6 +953,8 @@ void Query_log_event::print(FILE* file, bool short_form, char* last_db) ...@@ -949,6 +953,8 @@ void Query_log_event::print(FILE* file, bool short_form, char* last_db)
bool different_db= 1; bool different_db= 1;
if (!(flags & LOG_EVENT_SUPPRESS_USE_F))
{
if (db && last_db) if (db && last_db)
{ {
if (different_db= memcmp(last_db, db, db_len + 1)) if (different_db= memcmp(last_db, db, db_len + 1))
...@@ -956,7 +962,11 @@ void Query_log_event::print(FILE* file, bool short_form, char* last_db) ...@@ -956,7 +962,11 @@ void Query_log_event::print(FILE* file, bool short_form, char* last_db)
} }
if (db && db[0] && different_db) if (db && db[0] && different_db)
{
fprintf(file, "use %s;\n", db); fprintf(file, "use %s;\n", db);
}
}
end=int10_to_str((long) when, strmov(buff,"SET TIMESTAMP="),10); end=int10_to_str((long) when, strmov(buff,"SET TIMESTAMP="),10);
*end++=';'; *end++=';';
*end++='\n'; *end++='\n';
......
...@@ -264,6 +264,19 @@ struct sql_ex_info ...@@ -264,6 +264,19 @@ struct sql_ex_info
*/ */
#define LOG_EVENT_THREAD_SPECIFIC_F 0x4 #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 enum Log_event_type
{ {
UNKNOWN_EVENT= 0, START_EVENT= 1, QUERY_EVENT= 2, STOP_EVENT= 3, UNKNOWN_EVENT= 0, START_EVENT= 1, QUERY_EVENT= 2, STOP_EVENT= 3,
...@@ -331,8 +344,9 @@ class Log_event ...@@ -331,8 +344,9 @@ class Log_event
/* /*
Some 16 flags. Only one is really used now; look above for 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 LOG_EVENT_TIME_F, LOG_EVENT_FORCED_ROTATE_F,
for notes. LOG_EVENT_THREAD_SPECIFIC_F, and LOG_EVENT_SUPPRESS_USE_F for
notes.
*/ */
uint16 flags; uint16 flags;
...@@ -465,7 +479,7 @@ class Query_log_event: public Log_event ...@@ -465,7 +479,7 @@ class Query_log_event: public Log_event
#ifndef MYSQL_CLIENT #ifndef MYSQL_CLIENT
Query_log_event(THD* thd_arg, const char* query_arg, ulong query_length, 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; } const char* get_db() { return db; }
#ifdef HAVE_REPLICATION #ifdef HAVE_REPLICATION
void pack_info(Protocol* protocol); void pack_info(Protocol* protocol);
......
...@@ -1230,7 +1230,7 @@ bool change_password(THD *thd, const char *host, const char *user, ...@@ -1230,7 +1230,7 @@ bool change_password(THD *thd, const char *host, const char *user,
new_password)); new_password));
thd->clear_error(); thd->clear_error();
mysql_update_log.write(thd, buff, query_length); 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); mysql_bin_log.write(&qinfo);
DBUG_RETURN(0); DBUG_RETURN(0);
} }
......
...@@ -524,7 +524,7 @@ void close_temporary_tables(THD *thd) ...@@ -524,7 +524,7 @@ void close_temporary_tables(THD *thd)
{ {
/* The -1 is to remove last ',' */ /* The -1 is to remove last ',' */
thd->clear_error(); 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 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 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, ...@@ -1441,7 +1441,7 @@ static int open_unireg_entry(THD *thd, TABLE *entry, const char *db,
{ {
end = strxmov(strmov(query, "DELETE FROM `"), end = strxmov(strmov(query, "DELETE FROM `"),
db,"`.`",name,"`", NullS); 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); mysql_bin_log.write(&qinfo);
my_free(query, MYF(0)); my_free(query, MYF(0));
} }
......
...@@ -467,7 +467,29 @@ int mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create_info, ...@@ -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); mysql_update_log.write(thd, query, query_length);
if (mysql_bin_log.is_open()) 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); mysql_bin_log.write(&qinfo);
} }
send_ok(thd, result); send_ok(thd, result);
...@@ -517,7 +539,15 @@ int mysql_alter_db(THD *thd, const char *db, HA_CREATE_INFO *create_info) ...@@ -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); mysql_update_log.write(thd,thd->query, thd->query_length);
if (mysql_bin_log.is_open()) 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(); thd->clear_error();
mysql_bin_log.write(&qinfo); mysql_bin_log.write(&qinfo);
} }
...@@ -625,7 +655,15 @@ int mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent) ...@@ -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); mysql_update_log.write(thd, query, query_length);
if (mysql_bin_log.is_open()) 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(); thd->clear_error();
mysql_bin_log.write(&qinfo); mysql_bin_log.write(&qinfo);
} }
......
...@@ -216,7 +216,7 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, SQL_LIST *order, ...@@ -216,7 +216,7 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, SQL_LIST *order,
if (error <= 0) if (error <= 0)
thd->clear_error(); thd->clear_error();
Query_log_event qinfo(thd, thd->query, thd->query_length, Query_log_event qinfo(thd, thd->query, thd->query_length,
log_delayed); log_delayed, FALSE);
if (mysql_bin_log.write(&qinfo) && transactional_table) if (mysql_bin_log.write(&qinfo) && transactional_table)
error=1; error=1;
} }
...@@ -565,7 +565,7 @@ bool multi_delete::send_eof() ...@@ -565,7 +565,7 @@ bool multi_delete::send_eof()
if (error <= 0) if (error <= 0)
thd->clear_error(); thd->clear_error();
Query_log_event qinfo(thd, thd->query, thd->query_length, Query_log_event qinfo(thd, thd->query, thd->query_length,
log_delayed); log_delayed, FALSE);
if (mysql_bin_log.write(&qinfo) && !normal_tables) if (mysql_bin_log.write(&qinfo) && !normal_tables)
local_error=1; // Log write failed: roll back the SQL statement local_error=1; // Log write failed: roll back the SQL statement
} }
...@@ -674,7 +674,7 @@ int mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok) ...@@ -674,7 +674,7 @@ int mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok)
{ {
thd->clear_error(); thd->clear_error();
Query_log_event qinfo(thd, thd->query, thd->query_length, Query_log_event qinfo(thd, thd->query, thd->query_length,
thd->tmp_table); thd->tmp_table, FALSE);
mysql_bin_log.write(&qinfo); mysql_bin_log.write(&qinfo);
} }
send_ok(thd); // This should return record count send_ok(thd); // This should return record count
......
...@@ -368,7 +368,7 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list, ...@@ -368,7 +368,7 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list,
if (error <= 0) if (error <= 0)
thd->clear_error(); thd->clear_error();
Query_log_event qinfo(thd, thd->query, thd->query_length, Query_log_event qinfo(thd, thd->query, thd->query_length,
log_delayed); log_delayed, FALSE);
if (mysql_bin_log.write(&qinfo) && transactional_table) if (mysql_bin_log.write(&qinfo) && transactional_table)
error=1; error=1;
} }
...@@ -1364,7 +1364,7 @@ bool delayed_insert::handle_inserts(void) ...@@ -1364,7 +1364,7 @@ bool delayed_insert::handle_inserts(void)
mysql_update_log.write(&thd,row->query, row->query_length); mysql_update_log.write(&thd,row->query, row->query_length);
if (row->log_query & DELAYED_LOG_BIN && using_bin_log) 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); mysql_bin_log.write(&qinfo);
} }
} }
...@@ -1539,7 +1539,7 @@ void select_insert::send_error(uint errcode,const char *err) ...@@ -1539,7 +1539,7 @@ void select_insert::send_error(uint errcode,const char *err)
if (mysql_bin_log.is_open()) if (mysql_bin_log.is_open())
{ {
Query_log_event qinfo(thd, thd->query, thd->query_length, Query_log_event qinfo(thd, thd->query, thd->query_length,
table->file->has_transactions()); table->file->has_transactions(), FALSE);
mysql_bin_log.write(&qinfo); mysql_bin_log.write(&qinfo);
} }
if (!table->tmp_table) if (!table->tmp_table)
...@@ -1581,7 +1581,7 @@ bool select_insert::send_eof() ...@@ -1581,7 +1581,7 @@ bool select_insert::send_eof()
if (!error) if (!error)
thd->clear_error(); thd->clear_error();
Query_log_event qinfo(thd, thd->query, thd->query_length, Query_log_event qinfo(thd, thd->query, thd->query_length,
table->file->has_transactions()); table->file->has_transactions(), FALSE);
mysql_bin_log.write(&qinfo); mysql_bin_log.write(&qinfo);
} }
if ((error2=ha_autocommit_or_rollback(thd,error)) && ! error) if ((error2=ha_autocommit_or_rollback(thd,error)) && ! error)
......
...@@ -2614,7 +2614,7 @@ mysql_execute_command(THD *thd) ...@@ -2614,7 +2614,7 @@ mysql_execute_command(THD *thd)
if (mysql_bin_log.is_open()) if (mysql_bin_log.is_open())
{ {
thd->clear_error(); // No binlog error generated 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); mysql_bin_log.write(&qinfo);
} }
} }
...@@ -2643,7 +2643,7 @@ mysql_execute_command(THD *thd) ...@@ -2643,7 +2643,7 @@ mysql_execute_command(THD *thd)
if (mysql_bin_log.is_open()) if (mysql_bin_log.is_open())
{ {
thd->clear_error(); // No binlog error generated 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); mysql_bin_log.write(&qinfo);
} }
} }
...@@ -2666,7 +2666,7 @@ mysql_execute_command(THD *thd) ...@@ -2666,7 +2666,7 @@ mysql_execute_command(THD *thd)
if (mysql_bin_log.is_open()) if (mysql_bin_log.is_open())
{ {
thd->clear_error(); // No binlog error generated 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); mysql_bin_log.write(&qinfo);
} }
} }
...@@ -3262,7 +3262,7 @@ purposes internal to the MySQL server", MYF(0)); ...@@ -3262,7 +3262,7 @@ purposes internal to the MySQL server", MYF(0));
mysql_update_log.write(thd, thd->query, thd->query_length); mysql_update_log.write(thd, thd->query, thd->query_length);
if (mysql_bin_log.is_open()) 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); mysql_bin_log.write(&qinfo);
} }
send_ok(thd); send_ok(thd);
...@@ -3278,7 +3278,7 @@ purposes internal to the MySQL server", MYF(0)); ...@@ -3278,7 +3278,7 @@ purposes internal to the MySQL server", MYF(0));
mysql_update_log.write(thd, thd->query, thd->query_length); mysql_update_log.write(thd, thd->query, thd->query_length);
if (mysql_bin_log.is_open()) 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); mysql_bin_log.write(&qinfo);
} }
send_ok(thd); send_ok(thd);
...@@ -3345,7 +3345,7 @@ purposes internal to the MySQL server", MYF(0)); ...@@ -3345,7 +3345,7 @@ purposes internal to the MySQL server", MYF(0));
if (mysql_bin_log.is_open()) if (mysql_bin_log.is_open())
{ {
thd->clear_error(); 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); mysql_bin_log.write(&qinfo);
} }
} }
...@@ -3366,7 +3366,7 @@ purposes internal to the MySQL server", MYF(0)); ...@@ -3366,7 +3366,7 @@ purposes internal to the MySQL server", MYF(0));
if (mysql_bin_log.is_open()) if (mysql_bin_log.is_open())
{ {
thd->clear_error(); 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); mysql_bin_log.write(&qinfo);
} }
if (mqh_used && lex->sql_command == SQLCOM_GRANT) if (mqh_used && lex->sql_command == SQLCOM_GRANT)
...@@ -3409,7 +3409,7 @@ purposes internal to the MySQL server", MYF(0)); ...@@ -3409,7 +3409,7 @@ purposes internal to the MySQL server", MYF(0));
mysql_update_log.write(thd, thd->query, thd->query_length); mysql_update_log.write(thd, thd->query, thd->query_length);
if (mysql_bin_log.is_open()) 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); mysql_bin_log.write(&qinfo);
} }
} }
......
...@@ -84,7 +84,7 @@ bool mysql_rename_tables(THD *thd, TABLE_LIST *table_list) ...@@ -84,7 +84,7 @@ bool mysql_rename_tables(THD *thd, TABLE_LIST *table_list)
if (mysql_bin_log.is_open()) if (mysql_bin_log.is_open())
{ {
thd->clear_error(); 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); mysql_bin_log.write(&qinfo);
} }
send_ok(thd); send_ok(thd);
......
...@@ -282,7 +282,8 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists, ...@@ -282,7 +282,8 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
if (!error) if (!error)
thd->clear_error(); thd->clear_error();
Query_log_event qinfo(thd, thd->query, thd->query_length, 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); mysql_bin_log.write(&qinfo);
} }
} }
...@@ -1419,7 +1420,8 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name, ...@@ -1419,7 +1420,8 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
thd->clear_error(); thd->clear_error();
Query_log_event qinfo(thd, thd->query, thd->query_length, Query_log_event qinfo(thd, thd->query, thd->query_length,
test(create_info->options & test(create_info->options &
HA_LEX_CREATE_TMP_TABLE)); HA_LEX_CREATE_TMP_TABLE),
FALSE);
mysql_bin_log.write(&qinfo); mysql_bin_log.write(&qinfo);
} }
} }
...@@ -2344,7 +2346,8 @@ int mysql_create_like_table(THD* thd, TABLE_LIST* table, ...@@ -2344,7 +2346,8 @@ int mysql_create_like_table(THD* thd, TABLE_LIST* table,
thd->clear_error(); thd->clear_error();
Query_log_event qinfo(thd, thd->query, thd->query_length, Query_log_event qinfo(thd, thd->query, thd->query_length,
test(create_info->options & test(create_info->options &
HA_LEX_CREATE_TMP_TABLE)); HA_LEX_CREATE_TMP_TABLE),
FALSE);
mysql_bin_log.write(&qinfo); mysql_bin_log.write(&qinfo);
} }
res= 0; res= 0;
...@@ -2455,7 +2458,7 @@ mysql_discard_or_import_tablespace(THD *thd, ...@@ -2455,7 +2458,7 @@ mysql_discard_or_import_tablespace(THD *thd,
mysql_update_log.write(thd, thd->query,thd->query_length); mysql_update_log.write(thd, thd->query,thd->query_length);
if (mysql_bin_log.is_open()) 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); mysql_bin_log.write(&qinfo);
} }
err: err:
...@@ -2842,7 +2845,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name, ...@@ -2842,7 +2845,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
if (mysql_bin_log.is_open()) if (mysql_bin_log.is_open())
{ {
thd->clear_error(); 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); mysql_bin_log.write(&qinfo);
} }
if (do_send_ok) if (do_send_ok)
...@@ -3237,7 +3240,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name, ...@@ -3237,7 +3240,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
if (mysql_bin_log.is_open()) if (mysql_bin_log.is_open())
{ {
thd->clear_error(); 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); mysql_bin_log.write(&qinfo);
} }
goto end_temporary; goto end_temporary;
...@@ -3372,7 +3375,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name, ...@@ -3372,7 +3375,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
if (mysql_bin_log.is_open()) if (mysql_bin_log.is_open())
{ {
thd->clear_error(); 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); mysql_bin_log.write(&qinfo);
} }
VOID(pthread_cond_broadcast(&COND_refresh)); VOID(pthread_cond_broadcast(&COND_refresh));
......
...@@ -344,7 +344,7 @@ int mysql_update(THD *thd, ...@@ -344,7 +344,7 @@ int mysql_update(THD *thd,
if (error <= 0) if (error <= 0)
thd->clear_error(); thd->clear_error();
Query_log_event qinfo(thd, thd->query, thd->query_length, Query_log_event qinfo(thd, thd->query, thd->query_length,
log_delayed); log_delayed, FALSE);
if (mysql_bin_log.write(&qinfo) && transactional_table) if (mysql_bin_log.write(&qinfo) && transactional_table)
error=1; // Rollback update error=1; // Rollback update
} }
...@@ -1221,7 +1221,7 @@ bool multi_update::send_eof() ...@@ -1221,7 +1221,7 @@ bool multi_update::send_eof()
if (local_error <= 0) if (local_error <= 0)
thd->clear_error(); thd->clear_error();
Query_log_event qinfo(thd, thd->query, thd->query_length, Query_log_event qinfo(thd, thd->query, thd->query_length,
log_delayed); log_delayed, FALSE);
if (mysql_bin_log.write(&qinfo) && trans_safe) if (mysql_bin_log.write(&qinfo) && trans_safe)
local_error= 1; // Rollback update local_error= 1; // Rollback update
} }
......
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