mirror of
https://github.com/MariaDB/server.git
synced 2025-01-30 10:31:54 +01:00
Merge mysqldev@production.mysql.com:my/mysql-5.1-release
into mysql.com:/home/bk/w3023-mysql-5.1-new
This commit is contained in:
commit
13a61982a9
69 changed files with 1248 additions and 990 deletions
|
@ -21,6 +21,7 @@ insert t2 values (5);
|
||||||
commit;
|
commit;
|
||||||
# first COMMIT must be Query_log_event, second - Xid_log_event
|
# first COMMIT must be Query_log_event, second - Xid_log_event
|
||||||
--replace_column 2 # 5 #
|
--replace_column 2 # 5 #
|
||||||
|
--replace_regex /table_id: [0-9]+/table_id: #/
|
||||||
show binlog events from 102;
|
show binlog events from 102;
|
||||||
drop table t1,t2;
|
drop table t1,t2;
|
||||||
|
|
||||||
|
@ -42,6 +43,8 @@ while ($1)
|
||||||
commit;
|
commit;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
--replace_column 2 # 5 #
|
--replace_column 2 # 5 #
|
||||||
|
--replace_regex /table_id: [0-9]+/table_id: #/
|
||||||
show binlog events in 'master-bin.000001' from 102;
|
show binlog events in 'master-bin.000001' from 102;
|
||||||
--replace_column 2 # 5 #
|
--replace_column 2 # 5 #
|
||||||
|
--replace_regex /table_id: [0-9]+/table_id: #/
|
||||||
show binlog events in 'master-bin.000002' from 102;
|
show binlog events in 'master-bin.000002' from 102;
|
||||||
|
|
|
@ -122,6 +122,7 @@ select * from t3;
|
||||||
let $VERSION=`select version()`;
|
let $VERSION=`select version()`;
|
||||||
--replace_result $VERSION VERSION
|
--replace_result $VERSION VERSION
|
||||||
--replace_column 2 # 5 #
|
--replace_column 2 # 5 #
|
||||||
|
--replace_regex /table_id: [0-9]+/table_id: #/
|
||||||
show binlog events;
|
show binlog events;
|
||||||
|
|
||||||
drop table t1,t2,t3;
|
drop table t1,t2,t3;
|
||||||
|
@ -143,4 +144,5 @@ rollback;
|
||||||
set autocommit=1;
|
set autocommit=1;
|
||||||
--replace_result $VERSION VERSION
|
--replace_result $VERSION VERSION
|
||||||
--replace_column 2 # 5 #
|
--replace_column 2 # 5 #
|
||||||
|
--replace_regex /table_id: [0-9]+/table_id: #/
|
||||||
show binlog events;
|
show binlog events;
|
||||||
|
|
|
@ -415,6 +415,7 @@ SET @var1= x'8300';
|
||||||
# code (and I have used it to test the fix) until there is some way to
|
# code (and I have used it to test the fix) until there is some way to
|
||||||
# exercise this code from mysql-test-run.
|
# exercise this code from mysql-test-run.
|
||||||
EXECUTE stmt1 USING @var1;
|
EXECUTE stmt1 USING @var1;
|
||||||
|
--replace_regex /table_id: [0-9]+/table_id: #/
|
||||||
SHOW BINLOG EVENTS FROM 102;
|
SHOW BINLOG EVENTS FROM 102;
|
||||||
SELECT HEX(f1) FROM t1;
|
SELECT HEX(f1) FROM t1;
|
||||||
DROP table t1;
|
DROP table t1;
|
||||||
|
@ -434,4 +435,8 @@ insert into t1 values ('ab');
|
||||||
select * from t1;
|
select * from t1;
|
||||||
insert into t1 values ('abc');
|
insert into t1 values ('abc');
|
||||||
select * from t1;
|
select * from t1;
|
||||||
|
--disable_query_log
|
||||||
|
--disable_warnings
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
--enable_warnings
|
||||||
|
--enable_query_log
|
||||||
|
|
|
@ -27,6 +27,7 @@ SET @var1= x'8300';
|
||||||
# exercise this code from mysql-test-run.
|
# exercise this code from mysql-test-run.
|
||||||
EXECUTE stmt1 USING @var1;
|
EXECUTE stmt1 USING @var1;
|
||||||
--replace_column 2 # 5 #
|
--replace_column 2 # 5 #
|
||||||
|
--replace_regex /table_id: [0-9]+/table_id: #/
|
||||||
SHOW BINLOG EVENTS FROM 102;
|
SHOW BINLOG EVENTS FROM 102;
|
||||||
SELECT HEX(f1) FROM t1;
|
SELECT HEX(f1) FROM t1;
|
||||||
DROP table t1;
|
DROP table t1;
|
||||||
|
|
|
@ -9,6 +9,7 @@ create table t2 (c char(30)) charset=ucs2;
|
||||||
set @v=convert('abc' using ucs2);
|
set @v=convert('abc' using ucs2);
|
||||||
reset master;
|
reset master;
|
||||||
insert into t2 values (@v);
|
insert into t2 values (@v);
|
||||||
|
--replace_regex /table_id: [0-9]+/table_id: #/
|
||||||
show binlog events from 102;
|
show binlog events from 102;
|
||||||
# more important than SHOW BINLOG EVENTS, mysqlbinlog (where we
|
# more important than SHOW BINLOG EVENTS, mysqlbinlog (where we
|
||||||
# absolutely need variables names to be quoted and strings to be
|
# absolutely need variables names to be quoted and strings to be
|
||||||
|
|
|
@ -25,6 +25,7 @@ select get_lock("a",10);
|
||||||
let $VERSION=`select version()`;
|
let $VERSION=`select version()`;
|
||||||
--replace_result $VERSION VERSION
|
--replace_result $VERSION VERSION
|
||||||
--replace_column 2 # 5 #
|
--replace_column 2 # 5 #
|
||||||
|
--replace_regex /table_id: [0-9]+/table_id: #/
|
||||||
show binlog events;
|
show binlog events;
|
||||||
drop database `drop-temp+table-test`;
|
drop database `drop-temp+table-test`;
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,7 @@ insert into t1 select * from t2;
|
||||||
# verify the binlog :
|
# verify the binlog :
|
||||||
let $VERSION=`select version()`;
|
let $VERSION=`select version()`;
|
||||||
--replace_result $VERSION VERSION
|
--replace_result $VERSION VERSION
|
||||||
|
--replace_regex /table_id: [0-9]+/table_id: #/
|
||||||
show binlog events;
|
show binlog events;
|
||||||
select * from t1;
|
select * from t1;
|
||||||
drop table t1, t2;
|
drop table t1, t2;
|
||||||
|
@ -29,6 +30,7 @@ create table t2(unique(a)) select a from t1;
|
||||||
# The above should produce an error, *and* not appear in the binlog
|
# The above should produce an error, *and* not appear in the binlog
|
||||||
let $VERSION=`select version()`;
|
let $VERSION=`select version()`;
|
||||||
--replace_result $VERSION VERSION
|
--replace_result $VERSION VERSION
|
||||||
|
--replace_regex /table_id: [0-9]+/table_id: #/
|
||||||
show binlog events;
|
show binlog events;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,7 @@ insert into t2 select * from t1;
|
||||||
commit;
|
commit;
|
||||||
|
|
||||||
--replace_column 5 #
|
--replace_column 5 #
|
||||||
|
--replace_regex /table_id: [0-9]+/table_id: #/
|
||||||
show binlog events from 102;
|
show binlog events from 102;
|
||||||
|
|
||||||
delete from t1;
|
delete from t1;
|
||||||
|
@ -43,6 +44,7 @@ insert into t2 select * from t1;
|
||||||
rollback;
|
rollback;
|
||||||
|
|
||||||
--replace_column 5 #
|
--replace_column 5 #
|
||||||
|
--replace_regex /table_id: [0-9]+/table_id: #/
|
||||||
show binlog events from 102;
|
show binlog events from 102;
|
||||||
|
|
||||||
delete from t1;
|
delete from t1;
|
||||||
|
@ -58,6 +60,7 @@ rollback to savepoint my_savepoint;
|
||||||
commit;
|
commit;
|
||||||
|
|
||||||
--replace_column 5 #
|
--replace_column 5 #
|
||||||
|
--replace_regex /table_id: [0-9]+/table_id: #/
|
||||||
show binlog events from 102;
|
show binlog events from 102;
|
||||||
|
|
||||||
delete from t1;
|
delete from t1;
|
||||||
|
@ -75,6 +78,7 @@ commit;
|
||||||
select a from t1 order by a; # check that savepoints work :)
|
select a from t1 order by a; # check that savepoints work :)
|
||||||
|
|
||||||
--replace_column 5 #
|
--replace_column 5 #
|
||||||
|
--replace_regex /table_id: [0-9]+/table_id: #/
|
||||||
show binlog events from 102;
|
show binlog events from 102;
|
||||||
|
|
||||||
# and when ROLLBACK is not explicit?
|
# and when ROLLBACK is not explicit?
|
||||||
|
@ -96,6 +100,7 @@ connection con2;
|
||||||
# logging has been done, we use a user lock.
|
# logging has been done, we use a user lock.
|
||||||
select get_lock("a",10);
|
select get_lock("a",10);
|
||||||
--replace_column 5 #
|
--replace_column 5 #
|
||||||
|
--replace_regex /table_id: [0-9]+/table_id: #/
|
||||||
show binlog events from 102;
|
show binlog events from 102;
|
||||||
|
|
||||||
# and when not in a transact1on?
|
# and when not in a transact1on?
|
||||||
|
@ -107,6 +112,7 @@ insert into t1 values(9);
|
||||||
insert into t2 select * from t1;
|
insert into t2 select * from t1;
|
||||||
|
|
||||||
--replace_column 5 #
|
--replace_column 5 #
|
||||||
|
--replace_regex /table_id: [0-9]+/table_id: #/
|
||||||
show binlog events from 102;
|
show binlog events from 102;
|
||||||
|
|
||||||
# Check that when the query updat1ng the MyISAM table is the first in the
|
# Check that when the query updat1ng the MyISAM table is the first in the
|
||||||
|
@ -119,11 +125,13 @@ insert into t1 values(10); # first make t1 non-empty
|
||||||
begin;
|
begin;
|
||||||
insert into t2 select * from t1;
|
insert into t2 select * from t1;
|
||||||
--replace_column 5 #
|
--replace_column 5 #
|
||||||
|
--replace_regex /table_id: [0-9]+/table_id: #/
|
||||||
show binlog events from 102;
|
show binlog events from 102;
|
||||||
insert into t1 values(11);
|
insert into t1 values(11);
|
||||||
commit;
|
commit;
|
||||||
|
|
||||||
--replace_column 5 #
|
--replace_column 5 #
|
||||||
|
--replace_regex /table_id: [0-9]+/table_id: #/
|
||||||
show binlog events from 102;
|
show binlog events from 102;
|
||||||
|
|
||||||
|
|
||||||
|
@ -142,6 +150,7 @@ insert into t2 select * from t1;
|
||||||
commit;
|
commit;
|
||||||
|
|
||||||
--replace_column 5 #
|
--replace_column 5 #
|
||||||
|
--replace_regex /table_id: [0-9]+/table_id: #/
|
||||||
show binlog events from 102;
|
show binlog events from 102;
|
||||||
|
|
||||||
delete from t1;
|
delete from t1;
|
||||||
|
@ -154,6 +163,7 @@ insert into t2 select * from t1;
|
||||||
rollback;
|
rollback;
|
||||||
|
|
||||||
--replace_column 5 #
|
--replace_column 5 #
|
||||||
|
--replace_regex /table_id: [0-9]+/table_id: #/
|
||||||
show binlog events from 102;
|
show binlog events from 102;
|
||||||
|
|
||||||
delete from t1;
|
delete from t1;
|
||||||
|
@ -169,6 +179,7 @@ rollback to savepoint my_savepoint;
|
||||||
commit;
|
commit;
|
||||||
|
|
||||||
--replace_column 5 #
|
--replace_column 5 #
|
||||||
|
--replace_regex /table_id: [0-9]+/table_id: #/
|
||||||
show binlog events from 102;
|
show binlog events from 102;
|
||||||
|
|
||||||
delete from t1;
|
delete from t1;
|
||||||
|
@ -186,6 +197,7 @@ commit;
|
||||||
select a from t1 order by a; # check that savepoints work :)
|
select a from t1 order by a; # check that savepoints work :)
|
||||||
|
|
||||||
--replace_column 5 #
|
--replace_column 5 #
|
||||||
|
--replace_regex /table_id: [0-9]+/table_id: #/
|
||||||
show binlog events from 102;
|
show binlog events from 102;
|
||||||
|
|
||||||
# Test for BUG#5714, where a MyISAM update in the transaction used to
|
# Test for BUG#5714, where a MyISAM update in the transaction used to
|
||||||
|
@ -246,6 +258,7 @@ disconnect con2;
|
||||||
connection con3;
|
connection con3;
|
||||||
select get_lock("lock1",60);
|
select get_lock("lock1",60);
|
||||||
--replace_column 5 #
|
--replace_column 5 #
|
||||||
|
--replace_regex /table_id: [0-9]+/table_id: #/
|
||||||
show binlog events from 102;
|
show binlog events from 102;
|
||||||
do release_lock("lock1");
|
do release_lock("lock1");
|
||||||
drop table t0,t2;
|
drop table t0,t2;
|
||||||
|
|
|
@ -19,6 +19,7 @@ flush no_write_to_binlog tables;
|
||||||
# Check that it's not in the binlog.
|
# Check that it's not in the binlog.
|
||||||
--replace_result $SERVER_VERSION SERVER_VERSION
|
--replace_result $SERVER_VERSION SERVER_VERSION
|
||||||
--replace_column 2 # 5 #
|
--replace_column 2 # 5 #
|
||||||
|
--replace_regex /table_id: [0-9]+/table_id: #/
|
||||||
eval SHOW BINLOG EVENTS FROM $rename_event_pos ;
|
eval SHOW BINLOG EVENTS FROM $rename_event_pos ;
|
||||||
# Check that the master is not confused.
|
# Check that the master is not confused.
|
||||||
select * from t3;
|
select * from t3;
|
||||||
|
@ -27,6 +28,7 @@ flush tables;
|
||||||
# Check that it's in the binlog.
|
# Check that it's in the binlog.
|
||||||
--replace_result $SERVER_VERSION SERVER_VERSION
|
--replace_result $SERVER_VERSION SERVER_VERSION
|
||||||
--replace_column 2 # 5 #
|
--replace_column 2 # 5 #
|
||||||
|
--replace_regex /table_id: [0-9]+/table_id: #/
|
||||||
eval SHOW BINLOG EVENTS FROM $rename_event_pos ;
|
eval SHOW BINLOG EVENTS FROM $rename_event_pos ;
|
||||||
save_master_pos;
|
save_master_pos;
|
||||||
connection slave;
|
connection slave;
|
||||||
|
|
|
@ -38,16 +38,16 @@ load data infile '../std_data_ln/words.dat' into table t1 ignore 1 lines;
|
||||||
select count(*) from t1;
|
select count(*) from t1;
|
||||||
--replace_result $VERSION VERSION
|
--replace_result $VERSION VERSION
|
||||||
--replace_column 2 # 5 #
|
--replace_column 2 # 5 #
|
||||||
--replace_regex /\/\* xid=.* \*\//\/* XID *\//
|
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
|
||||||
show binlog events;
|
show binlog events;
|
||||||
--replace_column 2 # 5 #
|
--replace_column 2 # 5 #
|
||||||
--replace_regex /\/\* xid=.* \*\//\/* XID *\//
|
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
|
||||||
show binlog events from 102 limit 1;
|
show binlog events from 102 limit 1;
|
||||||
--replace_column 2 # 5 #
|
--replace_column 2 # 5 #
|
||||||
--replace_regex /\/\* xid=.* \*\//\/* XID *\//
|
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
|
||||||
show binlog events from 102 limit 2;
|
show binlog events from 102 limit 2;
|
||||||
--replace_column 2 # 5 #
|
--replace_column 2 # 5 #
|
||||||
--replace_regex /\/\* xid=.* \*\//\/* XID *\//
|
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
|
||||||
show binlog events from 102 limit 2,1;
|
show binlog events from 102 limit 2,1;
|
||||||
flush logs;
|
flush logs;
|
||||||
|
|
||||||
|
@ -88,11 +88,11 @@ eval create table t2 (n int)ENGINE=$engine_type;
|
||||||
insert into t2 values (1);
|
insert into t2 values (1);
|
||||||
--replace_result $VERSION VERSION
|
--replace_result $VERSION VERSION
|
||||||
--replace_column 2 # 5 #
|
--replace_column 2 # 5 #
|
||||||
--replace_regex /\/\* xid=.* \*\//\/* XID *\//
|
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
|
||||||
show binlog events;
|
show binlog events;
|
||||||
--replace_result $VERSION VERSION
|
--replace_result $VERSION VERSION
|
||||||
--replace_column 2 # 5 #
|
--replace_column 2 # 5 #
|
||||||
--replace_regex /\/\* xid=.* \*\//\/* XID *\//
|
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
|
||||||
show binlog events in 'master-bin.000002';
|
show binlog events in 'master-bin.000002';
|
||||||
show binary logs;
|
show binary logs;
|
||||||
save_master_pos;
|
save_master_pos;
|
||||||
|
@ -102,11 +102,11 @@ sync_with_master;
|
||||||
show binary logs;
|
show binary logs;
|
||||||
--replace_result $MASTER_MYPORT MASTER_PORT $VERSION VERSION
|
--replace_result $MASTER_MYPORT MASTER_PORT $VERSION VERSION
|
||||||
--replace_column 2 # 5 #
|
--replace_column 2 # 5 #
|
||||||
--replace_regex /\/\* xid=.* \*\//\/* XID *\//
|
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
|
||||||
show binlog events in 'slave-bin.000001' from 4;
|
show binlog events in 'slave-bin.000001' from 4;
|
||||||
--replace_result $MASTER_MYPORT MASTER_PORT $VERSION VERSION
|
--replace_result $MASTER_MYPORT MASTER_PORT $VERSION VERSION
|
||||||
--replace_column 2 # 5 #
|
--replace_column 2 # 5 #
|
||||||
--replace_regex /\/\* xid=.* \*\//\/* XID *\//
|
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
|
||||||
show binlog events in 'slave-bin.000002' from 4;
|
show binlog events in 'slave-bin.000002' from 4;
|
||||||
--replace_result $MASTER_MYPORT MASTER_PORT
|
--replace_result $MASTER_MYPORT MASTER_PORT
|
||||||
--replace_column 1 # 8 # 9 # 16 # 23 # 33 #
|
--replace_column 1 # 8 # 9 # 16 # 23 # 33 #
|
||||||
|
|
|
@ -24,6 +24,7 @@ sync_slave_with_master;
|
||||||
select * from mysqltest.t1;
|
select * from mysqltest.t1;
|
||||||
connection master;
|
connection master;
|
||||||
--replace_column 2 # 5 #
|
--replace_column 2 # 5 #
|
||||||
|
--replace_regex /table_id: [0-9]+/table_id: #/
|
||||||
show binlog events from 102;
|
show binlog events from 102;
|
||||||
drop database mysqltest;
|
drop database mysqltest;
|
||||||
sync_slave_with_master;
|
sync_slave_with_master;
|
||||||
|
|
|
@ -114,6 +114,7 @@ connection master;
|
||||||
drop database mysqltest2;
|
drop database mysqltest2;
|
||||||
drop database mysqltest3;
|
drop database mysqltest3;
|
||||||
--replace_column 2 # 5 #
|
--replace_column 2 # 5 #
|
||||||
|
--replace_regex /table_id: [0-9]+/table_id: #/
|
||||||
show binlog events from 102;
|
show binlog events from 102;
|
||||||
sync_slave_with_master;
|
sync_slave_with_master;
|
||||||
|
|
||||||
|
@ -162,7 +163,7 @@ select hex(c1), hex(c2) from t1;
|
||||||
|
|
||||||
connection master;
|
connection master;
|
||||||
# Let's have a look at generated SETs.
|
# Let's have a look at generated SETs.
|
||||||
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
|
#--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
|
||||||
#--exec $MYSQL_BINLOG --short-form $MYSQL_TEST_DIR/var/log/master-bin.000001
|
#--exec $MYSQL_BINLOG --short-form $MYSQL_TEST_DIR/var/log/master-bin.000001
|
||||||
drop table t1;
|
drop table t1;
|
||||||
sync_slave_with_master;
|
sync_slave_with_master;
|
||||||
|
|
|
@ -14,6 +14,7 @@ sync_slave_with_master;
|
||||||
|
|
||||||
connection master;
|
connection master;
|
||||||
--replace_result $VERSION VERSION
|
--replace_result $VERSION VERSION
|
||||||
|
--replace_regex /table_id: [0-9]+/table_id: #/
|
||||||
show binlog events;
|
show binlog events;
|
||||||
sync_slave_with_master;
|
sync_slave_with_master;
|
||||||
SELECT * FROM t1 ORDER BY a;
|
SELECT * FROM t1 ORDER BY a;
|
||||||
|
|
|
@ -110,6 +110,7 @@ connection master;
|
||||||
drop database mysqltest2;
|
drop database mysqltest2;
|
||||||
drop database mysqltest3;
|
drop database mysqltest3;
|
||||||
--replace_column 2 # 5 #
|
--replace_column 2 # 5 #
|
||||||
|
--replace_regex /table_id: [0-9]+/table_id: #/
|
||||||
show binlog events from 102;
|
show binlog events from 102;
|
||||||
sync_slave_with_master;
|
sync_slave_with_master;
|
||||||
|
|
||||||
|
|
|
@ -174,22 +174,16 @@ SELECT C1,HEX(B1),HEX(B2) FROM t4 ORDER BY C1;
|
||||||
connection master;
|
connection master;
|
||||||
eval CREATE TABLE t7 (C1 INT PRIMARY KEY, C2 INT) ENGINE = $type ;
|
eval CREATE TABLE t7 (C1 INT PRIMARY KEY, C2 INT) ENGINE = $type ;
|
||||||
sync_slave_with_master;
|
sync_slave_with_master;
|
||||||
--disable_query_log
|
--echo --- on slave: original values ---
|
||||||
SELECT "--- on slave: original values ---" AS "";
|
|
||||||
--enable_query_log
|
|
||||||
INSERT INTO t7 VALUES (1,3), (2,6), (3,9);
|
INSERT INTO t7 VALUES (1,3), (2,6), (3,9);
|
||||||
SELECT * FROM t7 ORDER BY C1;
|
SELECT * FROM t7 ORDER BY C1;
|
||||||
|
|
||||||
connection master;
|
connection master;
|
||||||
--disable_query_log
|
--echo --- on master: new values inserted ---
|
||||||
SELECT "--- on master: new values inserted ---" AS "";
|
|
||||||
--enable_query_log
|
|
||||||
INSERT INTO t7 VALUES (1,2), (2,4), (3,6);
|
INSERT INTO t7 VALUES (1,2), (2,4), (3,6);
|
||||||
SELECT * FROM t7 ORDER BY C1;
|
SELECT * FROM t7 ORDER BY C1;
|
||||||
sync_slave_with_master;
|
sync_slave_with_master;
|
||||||
--disable_query_log
|
--echo --- on slave: old values should be overwritten by replicated values ---
|
||||||
SELECT "--- on slave: old values should be overwritten by replicated values ---" AS "";
|
|
||||||
--enable_query_log
|
|
||||||
SELECT * FROM t7 ORDER BY C1;
|
SELECT * FROM t7 ORDER BY C1;
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -197,42 +191,33 @@ SELECT * FROM t7 ORDER BY C1;
|
||||||
# causing a conflict for a key that is not "last".
|
# causing a conflict for a key that is not "last".
|
||||||
#
|
#
|
||||||
connection master;
|
connection master;
|
||||||
--disable_query_log
|
--echo --- on master ---
|
||||||
SELECT "--- on master ---" AS "";
|
eval CREATE TABLE t8 (a INT PRIMARY KEY, b INT UNIQUE, c INT UNIQUE) ENGINE = $type ;
|
||||||
--enable_query_log
|
|
||||||
DROP TABLE t7;
|
|
||||||
eval CREATE TABLE t7 (a INT PRIMARY KEY, b INT UNIQUE, c INT UNIQUE) ENGINE = $type ;
|
|
||||||
|
|
||||||
# First we make sure that the constraints are correctly set.
|
# First we make sure that the constraints are correctly set.
|
||||||
INSERT INTO t7 VALUES (99,99,99);
|
INSERT INTO t8 VALUES (99,99,99);
|
||||||
--error 1062
|
--error 1062
|
||||||
INSERT INTO t7 VALUES (99,22,33);
|
INSERT INTO t8 VALUES (99,22,33);
|
||||||
--error 1062
|
--error 1062
|
||||||
INSERT INTO t7 VALUES (11,99,33);
|
INSERT INTO t8 VALUES (11,99,33);
|
||||||
--error 1062
|
--error 1062
|
||||||
INSERT INTO t7 VALUES (11,22,99);
|
INSERT INTO t8 VALUES (11,22,99);
|
||||||
SELECT * FROM t7 ORDER BY a;
|
SELECT * FROM t8 ORDER BY a;
|
||||||
|
|
||||||
sync_slave_with_master;
|
sync_slave_with_master;
|
||||||
--disable_query_log
|
--echo --- on slave ---
|
||||||
SELECT "--- on slave ---" AS "";
|
SELECT * FROM t8 ORDER BY a;
|
||||||
--enable_query_log
|
INSERT INTO t8 VALUES (1,2,3), (2,4,6), (3,6,9);
|
||||||
SELECT * FROM t7 ORDER BY a;
|
SELECT * FROM t8 ORDER BY a;
|
||||||
INSERT INTO t7 VALUES (1,2,3), (2,4,6), (3,6,9);
|
|
||||||
SELECT * FROM t7 ORDER BY a;
|
|
||||||
|
|
||||||
connection master;
|
connection master;
|
||||||
--disable_query_log
|
--echo --- on master ---
|
||||||
SELECT "--- on master ---" AS "";
|
|
||||||
--enable_query_log
|
|
||||||
# We insert a row that will cause conflict on the primary key but not
|
# We insert a row that will cause conflict on the primary key but not
|
||||||
# on the other keys.
|
# on the other keys.
|
||||||
INSERT INTO t7 VALUES (2,4,8);
|
INSERT INTO t8 VALUES (2,4,8);
|
||||||
sync_slave_with_master;
|
sync_slave_with_master;
|
||||||
--disable_query_log
|
--echo --- on slave ---
|
||||||
SELECT "--- on slave ---" AS "";
|
SELECT * FROM t8 ORDER BY a;
|
||||||
--enable_query_log
|
|
||||||
SELECT * FROM t7 ORDER BY a;
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Test conflicting operations when changing in a table referenced by a
|
# Test conflicting operations when changing in a table referenced by a
|
||||||
|
@ -245,5 +230,4 @@ SELECT * FROM t7 ORDER BY a;
|
||||||
#
|
#
|
||||||
|
|
||||||
connection master;
|
connection master;
|
||||||
DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7;
|
DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8;
|
||||||
sync_slave_with_master;
|
|
||||||
|
|
|
@ -13,12 +13,12 @@ Log_name Pos Event_type Server_id End_log_pos Info
|
||||||
master-bin.000001 # Query 1 # use `test`; create table t1 (a int) engine=bdb
|
master-bin.000001 # Query 1 # use `test`; create table t1 (a int) engine=bdb
|
||||||
master-bin.000001 # Query 1 # use `test`; create table t2 (a int) engine=innodb
|
master-bin.000001 # Query 1 # use `test`; create table t2 (a int) engine=innodb
|
||||||
master-bin.000001 # Query 1 # use `test`; BEGIN
|
master-bin.000001 # Query 1 # use `test`; BEGIN
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Query 1 # use `test`; COMMIT
|
master-bin.000001 # Query 1 # use `test`; COMMIT
|
||||||
master-bin.000001 # Query 1 # use `test`; BEGIN
|
master-bin.000001 # Query 1 # use `test`; BEGIN
|
||||||
master-bin.000001 # Table_map 1 # test.t2
|
master-bin.000001 # Table_map 1 # table_id: # (test.t2)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Xid 1 # COMMIT /* xid= */
|
master-bin.000001 # Xid 1 # COMMIT /* xid= */
|
||||||
drop table t1,t2;
|
drop table t1,t2;
|
||||||
reset master;
|
reset master;
|
||||||
|
@ -30,206 +30,206 @@ show binlog events in 'master-bin.000001' from 102;
|
||||||
Log_name Pos Event_type Server_id End_log_pos Info
|
Log_name Pos Event_type Server_id End_log_pos Info
|
||||||
master-bin.000001 # Query 1 # use `test`; create table t1 (n int) engine=innodb
|
master-bin.000001 # Query 1 # use `test`; create table t1 (n int) engine=innodb
|
||||||
master-bin.000001 # Query 1 # use `test`; BEGIN
|
master-bin.000001 # Query 1 # use `test`; BEGIN
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Xid 1 # COMMIT /* xid= */
|
master-bin.000001 # Xid 1 # COMMIT /* xid= */
|
||||||
master-bin.000001 # Rotate 1 # master-bin.000002;pos=4
|
master-bin.000001 # Rotate 1 # master-bin.000002;pos=4
|
||||||
show binlog events in 'master-bin.000002' from 102;
|
show binlog events in 'master-bin.000002' from 102;
|
||||||
|
|
|
@ -109,22 +109,34 @@ Log_name Pos Event_type Server_id End_log_pos Info
|
||||||
master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4
|
master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4
|
||||||
master-bin.000001 # Query 1 # use `test`; drop table t1,t2
|
master-bin.000001 # Query 1 # use `test`; drop table t1,t2
|
||||||
master-bin.000001 # Query 1 # use `test`; create table t1 (a int) engine=blackhole
|
master-bin.000001 # Query 1 # use `test`; create table t1 (a int) engine=blackhole
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Query 1 # use `test`; COMMIT
|
master-bin.000001 # Query 1 # use `test`; COMMIT
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Query 1 # use `test`; COMMIT
|
master-bin.000001 # Query 1 # use `test`; COMMIT
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Query 1 # use `test`; COMMIT
|
||||||
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Query 1 # use `test`; COMMIT
|
||||||
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Query 1 # use `test`; COMMIT
|
master-bin.000001 # Query 1 # use `test`; COMMIT
|
||||||
master-bin.000001 # Query 1 # use `test`; create table t2 (a varchar(200)) engine=blackhole
|
master-bin.000001 # Query 1 # use `test`; create table t2 (a varchar(200)) engine=blackhole
|
||||||
master-bin.000001 # Table_map 1 # test.t2
|
master-bin.000001 # Table_map 1 # table_id: # (test.t2)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Query 1 # use `test`; COMMIT
|
master-bin.000001 # Query 1 # use `test`; COMMIT
|
||||||
master-bin.000001 # Query 1 # use `test`; alter table t1 add b int
|
master-bin.000001 # Query 1 # use `test`; alter table t1 add b int
|
||||||
master-bin.000001 # Query 1 # use `test`; alter table t1 drop b
|
master-bin.000001 # Query 1 # use `test`; alter table t1 drop b
|
||||||
master-bin.000001 # Query 1 # use `test`; create table t3 like t1
|
master-bin.000001 # Query 1 # use `test`; create table t3 like t1
|
||||||
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Query 1 # use `test`; COMMIT
|
||||||
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Query 1 # use `test`; COMMIT
|
||||||
drop table t1,t2,t3;
|
drop table t1,t2,t3;
|
||||||
reset master;
|
reset master;
|
||||||
create table t1 (a int) engine=blackhole;
|
create table t1 (a int) engine=blackhole;
|
||||||
|
@ -141,6 +153,6 @@ Log_name Pos Event_type Server_id End_log_pos Info
|
||||||
master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4
|
master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4
|
||||||
master-bin.000001 # Query 1 # use `test`; create table t1 (a int) engine=blackhole
|
master-bin.000001 # Query 1 # use `test`; create table t1 (a int) engine=blackhole
|
||||||
master-bin.000001 # Query 1 # use `test`; BEGIN
|
master-bin.000001 # Query 1 # use `test`; BEGIN
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Query 1 # use `test`; COMMIT
|
master-bin.000001 # Query 1 # use `test`; COMMIT
|
||||||
|
|
|
@ -11323,8 +11323,8 @@ EXECUTE stmt1 USING @var1;
|
||||||
SHOW BINLOG EVENTS FROM 102;
|
SHOW BINLOG EVENTS FROM 102;
|
||||||
Log_name Pos Event_type Server_id End_log_pos Info
|
Log_name Pos Event_type Server_id End_log_pos Info
|
||||||
master-bin.000001 102 Query 1 189 use `test`; CREATE TABLE t1(f1 blob)
|
master-bin.000001 102 Query 1 189 use `test`; CREATE TABLE t1(f1 blob)
|
||||||
master-bin.000001 189 Table_map 1 228 test.t1
|
master-bin.000001 189 Table_map 1 228 table_id: # (test.t1)
|
||||||
master-bin.000001 228 Write_rows 1 262
|
master-bin.000001 228 Write_rows 1 262 table_id: # flags: STMT_END_F
|
||||||
SELECT HEX(f1) FROM t1;
|
SELECT HEX(f1) FROM t1;
|
||||||
HEX(f1)
|
HEX(f1)
|
||||||
8300
|
8300
|
||||||
|
@ -11366,4 +11366,3 @@ col1
|
||||||
a
|
a
|
||||||
a
|
a
|
||||||
a
|
a
|
||||||
drop table t1;
|
|
||||||
|
|
|
@ -5,8 +5,8 @@ reset master;
|
||||||
insert into t2 values (@v);
|
insert into t2 values (@v);
|
||||||
show binlog events from 102;
|
show binlog events from 102;
|
||||||
Log_name Pos Event_type Server_id End_log_pos Info
|
Log_name Pos Event_type Server_id End_log_pos Info
|
||||||
master-bin.000001 102 Table_map 1 141 test.t2
|
master-bin.000001 102 Table_map 1 141 table_id: # (test.t2)
|
||||||
master-bin.000001 141 Write_rows 1 231
|
master-bin.000001 141 Write_rows 1 231 table_id: # flags: STMT_END_F
|
||||||
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
|
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
|
||||||
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
|
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
|
||||||
ROLLBACK;
|
ROLLBACK;
|
||||||
|
|
|
@ -8,8 +8,8 @@ ERROR 23000: Duplicate entry '2' for key 'a'
|
||||||
show binlog events;
|
show binlog events;
|
||||||
Log_name Pos Event_type Server_id End_log_pos Info
|
Log_name Pos Event_type Server_id End_log_pos Info
|
||||||
master-bin.000001 4 Format_desc 1 102 Server ver: VERSION, Binlog ver: 4
|
master-bin.000001 4 Format_desc 1 102 Server ver: VERSION, Binlog ver: 4
|
||||||
master-bin.000001 102 Table_map 1 141 test.t1
|
master-bin.000001 102 Table_map 1 141 table_id: # (test.t1)
|
||||||
master-bin.000001 141 Write_rows 1 175
|
master-bin.000001 141 Write_rows 1 175 table_id: # flags: STMT_END_F
|
||||||
select * from t1;
|
select * from t1;
|
||||||
a
|
a
|
||||||
1
|
1
|
||||||
|
|
|
@ -9,10 +9,10 @@ commit;
|
||||||
show binlog events from 102;
|
show binlog events from 102;
|
||||||
Log_name Pos Event_type Server_id End_log_pos Info
|
Log_name Pos Event_type Server_id End_log_pos Info
|
||||||
master-bin.000001 102 Query 1 # use `test`; BEGIN
|
master-bin.000001 102 Query 1 # use `test`; BEGIN
|
||||||
master-bin.000001 170 Table_map 1 # test.t1
|
master-bin.000001 170 Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 209 Write_rows 1 #
|
master-bin.000001 209 Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 243 Table_map 1 # test.t2
|
master-bin.000001 243 Table_map 1 # table_id: # (test.t2)
|
||||||
master-bin.000001 282 Write_rows 1 #
|
master-bin.000001 282 Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 316 Xid 1 # COMMIT /* xid= */
|
master-bin.000001 316 Xid 1 # COMMIT /* xid= */
|
||||||
delete from t1;
|
delete from t1;
|
||||||
delete from t2;
|
delete from t2;
|
||||||
|
@ -26,10 +26,10 @@ Warning 1196 Some non-transactional changed tables couldn't be rolled back
|
||||||
show binlog events from 102;
|
show binlog events from 102;
|
||||||
Log_name Pos Event_type Server_id End_log_pos Info
|
Log_name Pos Event_type Server_id End_log_pos Info
|
||||||
master-bin.000001 102 Query 1 # use `test`; BEGIN
|
master-bin.000001 102 Query 1 # use `test`; BEGIN
|
||||||
master-bin.000001 170 Table_map 1 # test.t1
|
master-bin.000001 170 Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 209 Write_rows 1 #
|
master-bin.000001 209 Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 243 Table_map 1 # test.t2
|
master-bin.000001 243 Table_map 1 # table_id: # (test.t2)
|
||||||
master-bin.000001 282 Write_rows 1 #
|
master-bin.000001 282 Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 316 Query 1 # use `test`; ROLLBACK
|
master-bin.000001 316 Query 1 # use `test`; ROLLBACK
|
||||||
delete from t1;
|
delete from t1;
|
||||||
delete from t2;
|
delete from t2;
|
||||||
|
@ -46,13 +46,13 @@ commit;
|
||||||
show binlog events from 102;
|
show binlog events from 102;
|
||||||
Log_name Pos Event_type Server_id End_log_pos Info
|
Log_name Pos Event_type Server_id End_log_pos Info
|
||||||
master-bin.000001 102 Query 1 # use `test`; BEGIN
|
master-bin.000001 102 Query 1 # use `test`; BEGIN
|
||||||
master-bin.000001 170 Table_map 1 # test.t1
|
master-bin.000001 170 Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 209 Write_rows 1 #
|
master-bin.000001 209 Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 243 Query 1 # use `test`; savepoint my_savepoint
|
master-bin.000001 243 Query 1 # use `test`; savepoint my_savepoint
|
||||||
master-bin.000001 328 Table_map 1 # test.t1
|
master-bin.000001 328 Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 367 Write_rows 1 #
|
master-bin.000001 367 Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 401 Table_map 1 # test.t2
|
master-bin.000001 401 Table_map 1 # table_id: # (test.t2)
|
||||||
master-bin.000001 440 Write_rows 1 #
|
master-bin.000001 440 Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 479 Query 1 # use `test`; rollback to savepoint my_savepoint
|
master-bin.000001 479 Query 1 # use `test`; rollback to savepoint my_savepoint
|
||||||
master-bin.000001 576 Xid 1 # COMMIT /* xid= */
|
master-bin.000001 576 Xid 1 # COMMIT /* xid= */
|
||||||
delete from t1;
|
delete from t1;
|
||||||
|
@ -75,16 +75,16 @@ a
|
||||||
show binlog events from 102;
|
show binlog events from 102;
|
||||||
Log_name Pos Event_type Server_id End_log_pos Info
|
Log_name Pos Event_type Server_id End_log_pos Info
|
||||||
master-bin.000001 102 Query 1 # use `test`; BEGIN
|
master-bin.000001 102 Query 1 # use `test`; BEGIN
|
||||||
master-bin.000001 170 Table_map 1 # test.t1
|
master-bin.000001 170 Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 209 Write_rows 1 #
|
master-bin.000001 209 Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 243 Query 1 # use `test`; savepoint my_savepoint
|
master-bin.000001 243 Query 1 # use `test`; savepoint my_savepoint
|
||||||
master-bin.000001 328 Table_map 1 # test.t1
|
master-bin.000001 328 Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 367 Write_rows 1 #
|
master-bin.000001 367 Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 401 Table_map 1 # test.t2
|
master-bin.000001 401 Table_map 1 # table_id: # (test.t2)
|
||||||
master-bin.000001 440 Write_rows 1 #
|
master-bin.000001 440 Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 479 Query 1 # use `test`; rollback to savepoint my_savepoint
|
master-bin.000001 479 Query 1 # use `test`; rollback to savepoint my_savepoint
|
||||||
master-bin.000001 576 Table_map 1 # test.t1
|
master-bin.000001 576 Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 615 Write_rows 1 #
|
master-bin.000001 615 Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 649 Xid 1 # COMMIT /* xid= */
|
master-bin.000001 649 Xid 1 # COMMIT /* xid= */
|
||||||
delete from t1;
|
delete from t1;
|
||||||
delete from t2;
|
delete from t2;
|
||||||
|
@ -101,10 +101,10 @@ get_lock("a",10)
|
||||||
show binlog events from 102;
|
show binlog events from 102;
|
||||||
Log_name Pos Event_type Server_id End_log_pos Info
|
Log_name Pos Event_type Server_id End_log_pos Info
|
||||||
master-bin.000001 102 Query 1 # use `test`; BEGIN
|
master-bin.000001 102 Query 1 # use `test`; BEGIN
|
||||||
master-bin.000001 170 Table_map 1 # test.t1
|
master-bin.000001 170 Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 209 Write_rows 1 #
|
master-bin.000001 209 Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 243 Table_map 1 # test.t2
|
master-bin.000001 243 Table_map 1 # table_id: # (test.t2)
|
||||||
master-bin.000001 282 Write_rows 1 #
|
master-bin.000001 282 Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 316 Query 1 # use `test`; ROLLBACK
|
master-bin.000001 316 Query 1 # use `test`; ROLLBACK
|
||||||
delete from t1;
|
delete from t1;
|
||||||
delete from t2;
|
delete from t2;
|
||||||
|
@ -113,11 +113,11 @@ insert into t1 values(9);
|
||||||
insert into t2 select * from t1;
|
insert into t2 select * from t1;
|
||||||
show binlog events from 102;
|
show binlog events from 102;
|
||||||
Log_name Pos Event_type Server_id End_log_pos Info
|
Log_name Pos Event_type Server_id End_log_pos Info
|
||||||
master-bin.000001 102 Table_map 1 # test.t1
|
master-bin.000001 102 Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 141 Write_rows 1 #
|
master-bin.000001 141 Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 175 Xid 1 # COMMIT /* xid= */
|
master-bin.000001 175 Xid 1 # COMMIT /* xid= */
|
||||||
master-bin.000001 202 Table_map 1 # test.t2
|
master-bin.000001 202 Table_map 1 # table_id: # (test.t2)
|
||||||
master-bin.000001 241 Write_rows 1 #
|
master-bin.000001 241 Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
delete from t1;
|
delete from t1;
|
||||||
delete from t2;
|
delete from t2;
|
||||||
reset master;
|
reset master;
|
||||||
|
@ -126,23 +126,23 @@ begin;
|
||||||
insert into t2 select * from t1;
|
insert into t2 select * from t1;
|
||||||
show binlog events from 102;
|
show binlog events from 102;
|
||||||
Log_name Pos Event_type Server_id End_log_pos Info
|
Log_name Pos Event_type Server_id End_log_pos Info
|
||||||
master-bin.000001 102 Table_map 1 # test.t1
|
master-bin.000001 102 Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 141 Write_rows 1 #
|
master-bin.000001 141 Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 175 Xid 1 # COMMIT /* xid= */
|
master-bin.000001 175 Xid 1 # COMMIT /* xid= */
|
||||||
master-bin.000001 202 Table_map 1 # test.t2
|
master-bin.000001 202 Table_map 1 # table_id: # (test.t2)
|
||||||
master-bin.000001 241 Write_rows 1 #
|
master-bin.000001 241 Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
insert into t1 values(11);
|
insert into t1 values(11);
|
||||||
commit;
|
commit;
|
||||||
show binlog events from 102;
|
show binlog events from 102;
|
||||||
Log_name Pos Event_type Server_id End_log_pos Info
|
Log_name Pos Event_type Server_id End_log_pos Info
|
||||||
master-bin.000001 102 Table_map 1 # test.t1
|
master-bin.000001 102 Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 141 Write_rows 1 #
|
master-bin.000001 141 Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 175 Xid 1 # COMMIT /* xid= */
|
master-bin.000001 175 Xid 1 # COMMIT /* xid= */
|
||||||
master-bin.000001 202 Table_map 1 # test.t2
|
master-bin.000001 202 Table_map 1 # table_id: # (test.t2)
|
||||||
master-bin.000001 241 Write_rows 1 #
|
master-bin.000001 241 Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 275 Query 1 # use `test`; BEGIN
|
master-bin.000001 275 Query 1 # use `test`; BEGIN
|
||||||
master-bin.000001 343 Table_map 1 # test.t1
|
master-bin.000001 343 Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 382 Write_rows 1 #
|
master-bin.000001 382 Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 416 Xid 1 # COMMIT /* xid= */
|
master-bin.000001 416 Xid 1 # COMMIT /* xid= */
|
||||||
alter table t2 engine=INNODB;
|
alter table t2 engine=INNODB;
|
||||||
delete from t1;
|
delete from t1;
|
||||||
|
@ -155,10 +155,10 @@ commit;
|
||||||
show binlog events from 102;
|
show binlog events from 102;
|
||||||
Log_name Pos Event_type Server_id End_log_pos Info
|
Log_name Pos Event_type Server_id End_log_pos Info
|
||||||
master-bin.000001 102 Query 1 # use `test`; BEGIN
|
master-bin.000001 102 Query 1 # use `test`; BEGIN
|
||||||
master-bin.000001 170 Table_map 1 # test.t1
|
master-bin.000001 170 Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 209 Write_rows 1 #
|
master-bin.000001 209 Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 243 Table_map 1 # test.t2
|
master-bin.000001 243 Table_map 1 # table_id: # (test.t2)
|
||||||
master-bin.000001 282 Write_rows 1 #
|
master-bin.000001 282 Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 316 Xid 1 # COMMIT /* xid= */
|
master-bin.000001 316 Xid 1 # COMMIT /* xid= */
|
||||||
delete from t1;
|
delete from t1;
|
||||||
delete from t2;
|
delete from t2;
|
||||||
|
@ -182,8 +182,8 @@ commit;
|
||||||
show binlog events from 102;
|
show binlog events from 102;
|
||||||
Log_name Pos Event_type Server_id End_log_pos Info
|
Log_name Pos Event_type Server_id End_log_pos Info
|
||||||
master-bin.000001 102 Query 1 # use `test`; BEGIN
|
master-bin.000001 102 Query 1 # use `test`; BEGIN
|
||||||
master-bin.000001 170 Table_map 1 # test.t1
|
master-bin.000001 170 Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 209 Write_rows 1 #
|
master-bin.000001 209 Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 243 Xid 1 # COMMIT /* xid= */
|
master-bin.000001 243 Xid 1 # COMMIT /* xid= */
|
||||||
delete from t1;
|
delete from t1;
|
||||||
delete from t2;
|
delete from t2;
|
||||||
|
@ -203,10 +203,10 @@ a
|
||||||
show binlog events from 102;
|
show binlog events from 102;
|
||||||
Log_name Pos Event_type Server_id End_log_pos Info
|
Log_name Pos Event_type Server_id End_log_pos Info
|
||||||
master-bin.000001 102 Query 1 # use `test`; BEGIN
|
master-bin.000001 102 Query 1 # use `test`; BEGIN
|
||||||
master-bin.000001 170 Table_map 1 # test.t1
|
master-bin.000001 170 Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 209 Write_rows 1 #
|
master-bin.000001 209 Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 243 Table_map 1 # test.t1
|
master-bin.000001 243 Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 282 Write_rows 1 #
|
master-bin.000001 282 Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 316 Xid 1 # COMMIT /* xid= */
|
master-bin.000001 316 Xid 1 # COMMIT /* xid= */
|
||||||
delete from t1;
|
delete from t1;
|
||||||
delete from t2;
|
delete from t2;
|
||||||
|
@ -257,51 +257,31 @@ get_lock("lock1",60)
|
||||||
show binlog events from 102;
|
show binlog events from 102;
|
||||||
Log_name Pos Event_type Server_id End_log_pos Info
|
Log_name Pos Event_type Server_id End_log_pos Info
|
||||||
master-bin.000001 102 Query 1 # use `test`; BEGIN
|
master-bin.000001 102 Query 1 # use `test`; BEGIN
|
||||||
master-bin.000001 170 Table_map 1 # test.t1
|
master-bin.000001 170 Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 209 Write_rows 1 #
|
master-bin.000001 209 Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 243 Table_map 1 # test.t1
|
master-bin.000001 243 Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 282 Write_rows 1 #
|
master-bin.000001 282 Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 316 Xid 1 # COMMIT /* xid= */
|
master-bin.000001 316 Xid 1 # COMMIT /* xid= */
|
||||||
master-bin.000001 343 Query 1 # use `test`; delete from t1
|
master-bin.000001 343 Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 420 Xid 1 # COMMIT /* xid= */
|
master-bin.000001 382 Query 1 # use `test`; delete from t1
|
||||||
master-bin.000001 447 Query 1 # use `test`; delete from t2
|
master-bin.000001 459 Xid 1 # COMMIT /* xid= */
|
||||||
master-bin.000001 524 Xid 1 # COMMIT /* xid= */
|
master-bin.000001 486 Table_map 1 # table_id: # (test.t2)
|
||||||
master-bin.000001 551 Query 1 # use `test`; alter table t2 engine=MyISAM
|
master-bin.000001 525 Query 1 # use `test`; delete from t2
|
||||||
master-bin.000001 642 Table_map 1 # test.t1
|
master-bin.000001 602 Xid 1 # COMMIT /* xid= */
|
||||||
master-bin.000001 681 Write_rows 1 #
|
master-bin.000001 629 Query 1 # use `test`; alter table t2 engine=MyISAM
|
||||||
master-bin.000001 715 Xid 1 # COMMIT /* xid= */
|
master-bin.000001 720 Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 742 Table_map 1 # test.t2
|
master-bin.000001 759 Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 781 Write_rows 1 #
|
master-bin.000001 793 Xid 1 # COMMIT /* xid= */
|
||||||
master-bin.000001 815 Query 1 # use `test`; drop table t1,t2
|
master-bin.000001 820 Query 1 # use `test`; BEGIN
|
||||||
master-bin.000001 894 Query 1 # use `test`; create table t0 (n int)
|
master-bin.000001 888 Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 980 Table_map 1 # test.t0
|
master-bin.000001 927 Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 1019 Write_rows 1 #
|
master-bin.000001 956 Xid 1 # COMMIT /* xid= */
|
||||||
master-bin.000001 1053 Table_map 1 # test.t0
|
master-bin.000001 983 Query 1 # use `test`; drop table t1,t2
|
||||||
master-bin.000001 1092 Write_rows 1 #
|
master-bin.000001 1062 Query 1 # use `test`; create table t0 (n int)
|
||||||
master-bin.000001 1126 Query 1 # use `test`; create table t2 (n int) engine=innodb
|
master-bin.000001 1148 Table_map 1 # table_id: # (test.t0)
|
||||||
|
master-bin.000001 1187 Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 1221 Table_map 1 # table_id: # (test.t0)
|
||||||
|
master-bin.000001 1260 Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 1294 Query 1 # use `test`; create table t2 (n int) engine=innodb
|
||||||
do release_lock("lock1");
|
do release_lock("lock1");
|
||||||
drop table t0,t2;
|
drop table t0,t2;
|
||||||
reset master;
|
|
||||||
create table t1 (a int) engine=innodb;
|
|
||||||
create table t2 (a int) engine=myisam;
|
|
||||||
select get_lock("a",10);
|
|
||||||
get_lock("a",10)
|
|
||||||
1
|
|
||||||
begin;
|
|
||||||
insert into t1 values(8);
|
|
||||||
insert into t2 select * from t1;
|
|
||||||
select get_lock("a",10);
|
|
||||||
get_lock("a",10)
|
|
||||||
1
|
|
||||||
select
|
|
||||||
(@a:=load_file("MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output"))
|
|
||||||
is not null;
|
|
||||||
(@a:=load_file("MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output"))
|
|
||||||
is not null
|
|
||||||
1
|
|
||||||
select
|
|
||||||
@a like "%#%error_code=0%ROLLBACK;%ROLLBACK /* added by mysqlbinlog */;%",
|
|
||||||
@a not like "%#%error_code=%error_code=%";
|
|
||||||
@a like "%#%error_code=0%ROLLBACK;%ROLLBACK /* added by mysqlbinlog */;%" @a not like "%#%error_code=%error_code=%"
|
|
||||||
1 1
|
|
||||||
drop table t1, t2;
|
|
||||||
|
|
|
@ -11366,4 +11366,3 @@ col1
|
||||||
a
|
a
|
||||||
a
|
a
|
||||||
a
|
a
|
||||||
drop table t1;
|
|
||||||
|
|
|
@ -9,8 +9,8 @@ EXECUTE stmt1 USING @var1;
|
||||||
SHOW BINLOG EVENTS FROM 102;
|
SHOW BINLOG EVENTS FROM 102;
|
||||||
Log_name Pos Event_type Server_id End_log_pos Info
|
Log_name Pos Event_type Server_id End_log_pos Info
|
||||||
master-bin.000001 # Query 1 # use `test`; CREATE TABLE t1(f1 blob)
|
master-bin.000001 # Query 1 # use `test`; CREATE TABLE t1(f1 blob)
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
SELECT HEX(f1) FROM t1;
|
SELECT HEX(f1) FROM t1;
|
||||||
HEX(f1)
|
HEX(f1)
|
||||||
8300
|
8300
|
||||||
|
|
|
@ -25,6 +25,11 @@ SHOW TABLES;
|
||||||
Tables_in_test_ignore
|
Tables_in_test_ignore
|
||||||
t2
|
t2
|
||||||
INSERT INTO t2 VALUES (3,3), (4,4);
|
INSERT INTO t2 VALUES (3,3), (4,4);
|
||||||
|
SHOW BINLOG EVENTS FROM 102;
|
||||||
|
Log_name Pos Event_type Server_id End_log_pos Info
|
||||||
|
master-bin.000001 102 Query 1 195 use `test`; CREATE TABLE t1 (a INT, b INT)
|
||||||
|
master-bin.000001 195 Table_map 1 235 table_id: # (test.t1)
|
||||||
|
master-bin.000001 235 Write_rows 1 282 table_id: # flags: STMT_END_F
|
||||||
**** On Slave ****
|
**** On Slave ****
|
||||||
SHOW DATABASES;
|
SHOW DATABASES;
|
||||||
Database
|
Database
|
||||||
|
|
|
@ -363,7 +363,6 @@ SELECT C1,HEX(B1),HEX(B2) FROM t4 ORDER BY C1;
|
||||||
C1 HEX(B1) HEX(B2)
|
C1 HEX(B1) HEX(B2)
|
||||||
1 NULL 0
|
1 NULL 0
|
||||||
CREATE TABLE t7 (C1 INT PRIMARY KEY, C2 INT) ENGINE = 'MYISAM' ;
|
CREATE TABLE t7 (C1 INT PRIMARY KEY, C2 INT) ENGINE = 'MYISAM' ;
|
||||||
|
|
||||||
--- on slave: original values ---
|
--- on slave: original values ---
|
||||||
INSERT INTO t7 VALUES (1,3), (2,6), (3,9);
|
INSERT INTO t7 VALUES (1,3), (2,6), (3,9);
|
||||||
SELECT * FROM t7 ORDER BY C1;
|
SELECT * FROM t7 ORDER BY C1;
|
||||||
|
@ -371,7 +370,6 @@ C1 C2
|
||||||
1 3
|
1 3
|
||||||
2 6
|
2 6
|
||||||
3 9
|
3 9
|
||||||
|
|
||||||
--- on master: new values inserted ---
|
--- on master: new values inserted ---
|
||||||
INSERT INTO t7 VALUES (1,2), (2,4), (3,6);
|
INSERT INTO t7 VALUES (1,2), (2,4), (3,6);
|
||||||
SELECT * FROM t7 ORDER BY C1;
|
SELECT * FROM t7 ORDER BY C1;
|
||||||
|
@ -379,48 +377,42 @@ C1 C2
|
||||||
1 2
|
1 2
|
||||||
2 4
|
2 4
|
||||||
3 6
|
3 6
|
||||||
|
|
||||||
--- on slave: old values should be overwritten by replicated values ---
|
--- on slave: old values should be overwritten by replicated values ---
|
||||||
SELECT * FROM t7 ORDER BY C1;
|
SELECT * FROM t7 ORDER BY C1;
|
||||||
C1 C2
|
C1 C2
|
||||||
1 2
|
1 2
|
||||||
2 4
|
2 4
|
||||||
3 6
|
3 6
|
||||||
|
|
||||||
--- on master ---
|
--- on master ---
|
||||||
DROP TABLE t7;
|
CREATE TABLE t8 (a INT PRIMARY KEY, b INT UNIQUE, c INT UNIQUE) ENGINE = 'MYISAM' ;
|
||||||
CREATE TABLE t7 (a INT PRIMARY KEY, b INT UNIQUE, c INT UNIQUE) ENGINE = 'MYISAM' ;
|
INSERT INTO t8 VALUES (99,99,99);
|
||||||
INSERT INTO t7 VALUES (99,99,99);
|
INSERT INTO t8 VALUES (99,22,33);
|
||||||
INSERT INTO t7 VALUES (99,22,33);
|
|
||||||
ERROR 23000: Duplicate entry '99' for key 'PRIMARY'
|
ERROR 23000: Duplicate entry '99' for key 'PRIMARY'
|
||||||
INSERT INTO t7 VALUES (11,99,33);
|
INSERT INTO t8 VALUES (11,99,33);
|
||||||
ERROR 23000: Duplicate entry '99' for key 'b'
|
ERROR 23000: Duplicate entry '99' for key 'b'
|
||||||
INSERT INTO t7 VALUES (11,22,99);
|
INSERT INTO t8 VALUES (11,22,99);
|
||||||
ERROR 23000: Duplicate entry '99' for key 'c'
|
ERROR 23000: Duplicate entry '99' for key 'c'
|
||||||
SELECT * FROM t7 ORDER BY a;
|
SELECT * FROM t8 ORDER BY a;
|
||||||
a b c
|
a b c
|
||||||
99 99 99
|
99 99 99
|
||||||
|
|
||||||
--- on slave ---
|
--- on slave ---
|
||||||
SELECT * FROM t7 ORDER BY a;
|
SELECT * FROM t8 ORDER BY a;
|
||||||
a b c
|
a b c
|
||||||
99 99 99
|
99 99 99
|
||||||
INSERT INTO t7 VALUES (1,2,3), (2,4,6), (3,6,9);
|
INSERT INTO t8 VALUES (1,2,3), (2,4,6), (3,6,9);
|
||||||
SELECT * FROM t7 ORDER BY a;
|
SELECT * FROM t8 ORDER BY a;
|
||||||
a b c
|
a b c
|
||||||
1 2 3
|
1 2 3
|
||||||
2 4 6
|
2 4 6
|
||||||
3 6 9
|
3 6 9
|
||||||
99 99 99
|
99 99 99
|
||||||
|
|
||||||
--- on master ---
|
--- on master ---
|
||||||
INSERT INTO t7 VALUES (2,4,8);
|
INSERT INTO t8 VALUES (2,4,8);
|
||||||
|
|
||||||
--- on slave ---
|
--- on slave ---
|
||||||
SELECT * FROM t7 ORDER BY a;
|
SELECT * FROM t8 ORDER BY a;
|
||||||
a b c
|
a b c
|
||||||
1 2 3
|
1 2 3
|
||||||
2 4 8
|
2 4 8
|
||||||
3 6 9
|
3 6 9
|
||||||
99 99 99
|
99 99 99
|
||||||
DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7;
|
DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8;
|
||||||
|
|
|
@ -363,7 +363,6 @@ SELECT C1,HEX(B1),HEX(B2) FROM t4 ORDER BY C1;
|
||||||
C1 HEX(B1) HEX(B2)
|
C1 HEX(B1) HEX(B2)
|
||||||
1 NULL 0
|
1 NULL 0
|
||||||
CREATE TABLE t7 (C1 INT PRIMARY KEY, C2 INT) ENGINE = 'INNODB' ;
|
CREATE TABLE t7 (C1 INT PRIMARY KEY, C2 INT) ENGINE = 'INNODB' ;
|
||||||
|
|
||||||
--- on slave: original values ---
|
--- on slave: original values ---
|
||||||
INSERT INTO t7 VALUES (1,3), (2,6), (3,9);
|
INSERT INTO t7 VALUES (1,3), (2,6), (3,9);
|
||||||
SELECT * FROM t7 ORDER BY C1;
|
SELECT * FROM t7 ORDER BY C1;
|
||||||
|
@ -371,7 +370,6 @@ C1 C2
|
||||||
1 3
|
1 3
|
||||||
2 6
|
2 6
|
||||||
3 9
|
3 9
|
||||||
|
|
||||||
--- on master: new values inserted ---
|
--- on master: new values inserted ---
|
||||||
INSERT INTO t7 VALUES (1,2), (2,4), (3,6);
|
INSERT INTO t7 VALUES (1,2), (2,4), (3,6);
|
||||||
SELECT * FROM t7 ORDER BY C1;
|
SELECT * FROM t7 ORDER BY C1;
|
||||||
|
@ -379,48 +377,42 @@ C1 C2
|
||||||
1 2
|
1 2
|
||||||
2 4
|
2 4
|
||||||
3 6
|
3 6
|
||||||
|
|
||||||
--- on slave: old values should be overwritten by replicated values ---
|
--- on slave: old values should be overwritten by replicated values ---
|
||||||
SELECT * FROM t7 ORDER BY C1;
|
SELECT * FROM t7 ORDER BY C1;
|
||||||
C1 C2
|
C1 C2
|
||||||
1 2
|
1 2
|
||||||
2 4
|
2 4
|
||||||
3 6
|
3 6
|
||||||
|
|
||||||
--- on master ---
|
--- on master ---
|
||||||
DROP TABLE t7;
|
CREATE TABLE t8 (a INT PRIMARY KEY, b INT UNIQUE, c INT UNIQUE) ENGINE = 'INNODB' ;
|
||||||
CREATE TABLE t7 (a INT PRIMARY KEY, b INT UNIQUE, c INT UNIQUE) ENGINE = 'INNODB' ;
|
INSERT INTO t8 VALUES (99,99,99);
|
||||||
INSERT INTO t7 VALUES (99,99,99);
|
INSERT INTO t8 VALUES (99,22,33);
|
||||||
INSERT INTO t7 VALUES (99,22,33);
|
|
||||||
ERROR 23000: Duplicate entry '99' for key 'PRIMARY'
|
ERROR 23000: Duplicate entry '99' for key 'PRIMARY'
|
||||||
INSERT INTO t7 VALUES (11,99,33);
|
INSERT INTO t8 VALUES (11,99,33);
|
||||||
ERROR 23000: Duplicate entry '99' for key 'b'
|
ERROR 23000: Duplicate entry '99' for key 'b'
|
||||||
INSERT INTO t7 VALUES (11,22,99);
|
INSERT INTO t8 VALUES (11,22,99);
|
||||||
ERROR 23000: Duplicate entry '99' for key 'c'
|
ERROR 23000: Duplicate entry '99' for key 'c'
|
||||||
SELECT * FROM t7 ORDER BY a;
|
SELECT * FROM t8 ORDER BY a;
|
||||||
a b c
|
a b c
|
||||||
99 99 99
|
99 99 99
|
||||||
|
|
||||||
--- on slave ---
|
--- on slave ---
|
||||||
SELECT * FROM t7 ORDER BY a;
|
SELECT * FROM t8 ORDER BY a;
|
||||||
a b c
|
a b c
|
||||||
99 99 99
|
99 99 99
|
||||||
INSERT INTO t7 VALUES (1,2,3), (2,4,6), (3,6,9);
|
INSERT INTO t8 VALUES (1,2,3), (2,4,6), (3,6,9);
|
||||||
SELECT * FROM t7 ORDER BY a;
|
SELECT * FROM t8 ORDER BY a;
|
||||||
a b c
|
a b c
|
||||||
1 2 3
|
1 2 3
|
||||||
2 4 6
|
2 4 6
|
||||||
3 6 9
|
3 6 9
|
||||||
99 99 99
|
99 99 99
|
||||||
|
|
||||||
--- on master ---
|
--- on master ---
|
||||||
INSERT INTO t7 VALUES (2,4,8);
|
INSERT INTO t8 VALUES (2,4,8);
|
||||||
|
|
||||||
--- on slave ---
|
--- on slave ---
|
||||||
SELECT * FROM t7 ORDER BY a;
|
SELECT * FROM t8 ORDER BY a;
|
||||||
a b c
|
a b c
|
||||||
1 2 3
|
1 2 3
|
||||||
2 4 8
|
2 4 8
|
||||||
3 6 9
|
3 6 9
|
||||||
99 99 99
|
99 99 99
|
||||||
DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7;
|
DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8;
|
||||||
|
|
|
@ -112,36 +112,56 @@ drop database mysqltest3;
|
||||||
show binlog events from 102;
|
show binlog events from 102;
|
||||||
Log_name Pos Event_type Server_id End_log_pos Info
|
Log_name Pos Event_type Server_id End_log_pos Info
|
||||||
master-bin.000001 # Query 1 # drop database if exists mysqltest2
|
master-bin.000001 # Query 1 # drop database if exists mysqltest2
|
||||||
|
master-bin.000001 # Table_map 1 # table_id: # (mysql.proc)
|
||||||
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Table_map 1 # table_id: # (mysql.event)
|
||||||
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Query 1 # drop database if exists mysqltest3
|
master-bin.000001 # Query 1 # drop database if exists mysqltest3
|
||||||
|
master-bin.000001 # Table_map 1 # table_id: # (mysql.proc)
|
||||||
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Table_map 1 # table_id: # (mysql.event)
|
||||||
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Query 1 # create database mysqltest2 character set latin2
|
master-bin.000001 # Query 1 # create database mysqltest2 character set latin2
|
||||||
master-bin.000001 # Query 1 # create database mysqltest3
|
master-bin.000001 # Query 1 # create database mysqltest3
|
||||||
master-bin.000001 # Query 1 # drop database mysqltest3
|
master-bin.000001 # Query 1 # drop database mysqltest3
|
||||||
|
master-bin.000001 # Table_map 1 # table_id: # (mysql.proc)
|
||||||
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Table_map 1 # table_id: # (mysql.event)
|
||||||
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Query 1 # create database mysqltest3
|
master-bin.000001 # Query 1 # create database mysqltest3
|
||||||
master-bin.000001 # Query 1 # use `mysqltest2`; create table t1 (a int auto_increment primary key, b varchar(100))
|
master-bin.000001 # Query 1 # use `mysqltest2`; create table t1 (a int auto_increment primary key, b varchar(100))
|
||||||
master-bin.000001 # Table_map 1 # mysqltest2.t1
|
master-bin.000001 # Table_map 1 # table_id: # (mysqltest2.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # mysqltest2.t1
|
master-bin.000001 # Table_map 1 # table_id: # (mysqltest2.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # mysqltest2.t1
|
master-bin.000001 # Table_map 1 # table_id: # (mysqltest2.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # mysqltest2.t1
|
master-bin.000001 # Table_map 1 # table_id: # (mysqltest2.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # mysqltest2.t1
|
master-bin.000001 # Table_map 1 # table_id: # (mysqltest2.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Query 1 # use `mysqltest2`; truncate table t1
|
master-bin.000001 # Query 1 # use `mysqltest2`; truncate table t1
|
||||||
master-bin.000001 # Table_map 1 # mysqltest2.t1
|
master-bin.000001 # Table_map 1 # table_id: # (mysqltest2.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # mysqltest2.t1
|
master-bin.000001 # Table_map 1 # table_id: # (mysqltest2.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # mysqltest2.t1
|
master-bin.000001 # Table_map 1 # table_id: # (mysqltest2.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Table_map 1 # mysqltest2.t1
|
master-bin.000001 # Table_map 1 # table_id: # (mysqltest2.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Query 1 # use `mysqltest2`; truncate table t1
|
master-bin.000001 # Query 1 # use `mysqltest2`; truncate table t1
|
||||||
master-bin.000001 # Table_map 1 # mysqltest2.t1
|
master-bin.000001 # Table_map 1 # table_id: # (mysqltest2.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Query 1 # drop database mysqltest2
|
master-bin.000001 # Query 1 # drop database mysqltest2
|
||||||
|
master-bin.000001 # Table_map 1 # table_id: # (mysql.proc)
|
||||||
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Table_map 1 # table_id: # (mysql.event)
|
||||||
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Query 1 # drop database mysqltest3
|
master-bin.000001 # Query 1 # drop database mysqltest3
|
||||||
|
master-bin.000001 # Table_map 1 # table_id: # (mysql.proc)
|
||||||
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Table_map 1 # table_id: # (mysql.event)
|
||||||
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
select "--- --global--" as "";
|
select "--- --global--" as "";
|
||||||
|
|
||||||
--- --global--
|
--- --global--
|
||||||
|
|
|
@ -127,7 +127,7 @@ NULL 5 10
|
||||||
NULL 6 12
|
NULL 6 12
|
||||||
CREATE TABLE t7 (UNIQUE(b)) SELECT a,b FROM tt3;
|
CREATE TABLE t7 (UNIQUE(b)) SELECT a,b FROM tt3;
|
||||||
ERROR 23000: Duplicate entry '2' for key 'b'
|
ERROR 23000: Duplicate entry '2' for key 'b'
|
||||||
SHOW BINLOG EVENTS FROM 1256;
|
SHOW BINLOG EVENTS FROM 1326;
|
||||||
Log_name Pos Event_type Server_id End_log_pos Info
|
Log_name Pos Event_type Server_id End_log_pos Info
|
||||||
CREATE TABLE t7 (a INT, b INT UNIQUE);
|
CREATE TABLE t7 (a INT, b INT UNIQUE);
|
||||||
INSERT INTO t7 SELECT a,b FROM tt3;
|
INSERT INTO t7 SELECT a,b FROM tt3;
|
||||||
|
@ -137,11 +137,11 @@ a b
|
||||||
1 2
|
1 2
|
||||||
2 4
|
2 4
|
||||||
3 6
|
3 6
|
||||||
SHOW BINLOG EVENTS FROM 1256;
|
SHOW BINLOG EVENTS FROM 1326;
|
||||||
Log_name Pos Event_type Server_id End_log_pos Info
|
Log_name Pos Event_type Server_id End_log_pos Info
|
||||||
master-bin.000001 1256 Query 1 1356 use `test`; CREATE TABLE t7 (a INT, b INT UNIQUE)
|
master-bin.000001 1326 Query 1 1426 use `test`; CREATE TABLE t7 (a INT, b INT UNIQUE)
|
||||||
master-bin.000001 1356 Table_map 1 1396 test.t7
|
master-bin.000001 1426 Table_map 1 1466 table_id: # (test.t7)
|
||||||
master-bin.000001 1396 Write_rows 1 1452
|
master-bin.000001 1466 Write_rows 1 1522 table_id: # flags: STMT_END_F
|
||||||
SELECT * FROM t7 ORDER BY a,b;
|
SELECT * FROM t7 ORDER BY a,b;
|
||||||
a b
|
a b
|
||||||
1 2
|
1 2
|
||||||
|
@ -154,10 +154,10 @@ INSERT INTO t7 SELECT a,b FROM tt4;
|
||||||
ROLLBACK;
|
ROLLBACK;
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1196 Some non-transactional changed tables couldn't be rolled back
|
Warning 1196 Some non-transactional changed tables couldn't be rolled back
|
||||||
SHOW BINLOG EVENTS FROM 1452;
|
SHOW BINLOG EVENTS FROM 1522;
|
||||||
Log_name Pos Event_type Server_id End_log_pos Info
|
Log_name Pos Event_type Server_id End_log_pos Info
|
||||||
master-bin.000001 1452 Table_map 1 1492 test.t7
|
master-bin.000001 1522 Table_map 1 1562 table_id: # (test.t7)
|
||||||
master-bin.000001 1492 Write_rows 1 1548
|
master-bin.000001 1562 Write_rows 1 1618 table_id: # flags: STMT_END_F
|
||||||
SELECT * FROM t7 ORDER BY a,b;
|
SELECT * FROM t7 ORDER BY a,b;
|
||||||
a b
|
a b
|
||||||
1 2
|
1 2
|
||||||
|
@ -191,10 +191,10 @@ Create Table CREATE TABLE `t9` (
|
||||||
`a` int(11) default NULL,
|
`a` int(11) default NULL,
|
||||||
`b` int(11) default NULL
|
`b` int(11) default NULL
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||||
SHOW BINLOG EVENTS FROM 1548;
|
SHOW BINLOG EVENTS FROM 1618;
|
||||||
Log_name Pos Event_type Server_id End_log_pos Info
|
Log_name Pos Event_type Server_id End_log_pos Info
|
||||||
master-bin.000001 1548 Query 1 1634 use `test`; CREATE TABLE t8 LIKE t4
|
master-bin.000001 1618 Query 1 1704 use `test`; CREATE TABLE t8 LIKE t4
|
||||||
master-bin.000001 1634 Query 1 1773 use `test`; CREATE TABLE `t9` (
|
master-bin.000001 1704 Query 1 1843 use `test`; CREATE TABLE `t9` (
|
||||||
`a` int(11) default NULL,
|
`a` int(11) default NULL,
|
||||||
`b` int(11) default NULL
|
`b` int(11) default NULL
|
||||||
)
|
)
|
||||||
|
|
|
@ -16,8 +16,8 @@ show binlog events;
|
||||||
Log_name Pos Event_type Server_id End_log_pos Info
|
Log_name Pos Event_type Server_id End_log_pos Info
|
||||||
master-bin.000001 4 Format_desc 1 102 Server ver: VERSION, Binlog ver: 4
|
master-bin.000001 4 Format_desc 1 102 Server ver: VERSION, Binlog ver: 4
|
||||||
master-bin.000001 102 Query 1 222 use `test`; create table t1(a int not null primary key) engine=myisam
|
master-bin.000001 102 Query 1 222 use `test`; create table t1(a int not null primary key) engine=myisam
|
||||||
master-bin.000001 222 Table_map 1 261 test.t1
|
master-bin.000001 222 Table_map 1 261 table_id: # (test.t1)
|
||||||
master-bin.000001 261 Write_rows 1 305
|
master-bin.000001 261 Write_rows 1 305 table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 305 Query 1 380 use `test`; flush tables
|
master-bin.000001 305 Query 1 380 use `test`; flush tables
|
||||||
SELECT * FROM t1 ORDER BY a;
|
SELECT * FROM t1 ORDER BY a;
|
||||||
a
|
a
|
||||||
|
|
|
@ -16,83 +16,94 @@ load data infile '../std_data_ln/words.dat' into table t1 ignore 1 lines;
|
||||||
select count(*) from t1;
|
select count(*) from t1;
|
||||||
count(*)
|
count(*)
|
||||||
69
|
69
|
||||||
|
drop table t1;
|
||||||
show binlog events;
|
show binlog events;
|
||||||
Log_name Pos Event_type Server_id End_log_pos Info
|
Log_name Pos Event_type Server_id End_log_pos Info
|
||||||
master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4
|
master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4
|
||||||
master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
|
master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Query 1 # use `test`; drop table t1
|
master-bin.000001 # Query 1 # use `test`; drop table t1
|
||||||
master-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM
|
master-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Query 1 # use `test`; drop table t1
|
||||||
show binlog events from 102 limit 1;
|
show binlog events from 102 limit 1;
|
||||||
Log_name Pos Event_type Server_id End_log_pos Info
|
Log_name Pos Event_type Server_id End_log_pos Info
|
||||||
master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
|
master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
|
||||||
show binlog events from 102 limit 2;
|
show binlog events from 102 limit 2;
|
||||||
Log_name Pos Event_type Server_id End_log_pos Info
|
Log_name Pos Event_type Server_id End_log_pos Info
|
||||||
master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
|
master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
show binlog events from 102 limit 2,1;
|
show binlog events from 102 limit 2,1;
|
||||||
Log_name Pos Event_type Server_id End_log_pos Info
|
Log_name Pos Event_type Server_id End_log_pos Info
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
flush logs;
|
flush logs;
|
||||||
create table t3 (a int)ENGINE=MyISAM;
|
create table t5 (a int)ENGINE=MyISAM;
|
||||||
|
drop table t5;
|
||||||
start slave;
|
start slave;
|
||||||
flush logs;
|
flush logs;
|
||||||
stop slave;
|
stop slave;
|
||||||
create table t2 (n int)ENGINE=MyISAM;
|
create table t1 (n int)ENGINE=MyISAM;
|
||||||
insert into t2 values (1);
|
insert into t1 values (1);
|
||||||
|
drop table t1;
|
||||||
show binlog events;
|
show binlog events;
|
||||||
Log_name Pos Event_type Server_id End_log_pos Info
|
Log_name Pos Event_type Server_id End_log_pos Info
|
||||||
master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4
|
master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4
|
||||||
master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
|
master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Query 1 # use `test`; drop table t1
|
master-bin.000001 # Query 1 # use `test`; drop table t1
|
||||||
master-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM
|
master-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 # Query 1 # use `test`; drop table t1
|
||||||
master-bin.000001 # Rotate 1 # master-bin.000002;pos=4
|
master-bin.000001 # Rotate 1 # master-bin.000002;pos=4
|
||||||
show binlog events in 'master-bin.000002';
|
show binlog events in 'master-bin.000002';
|
||||||
Log_name Pos Event_type Server_id End_log_pos Info
|
Log_name Pos Event_type Server_id End_log_pos Info
|
||||||
master-bin.000002 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4
|
master-bin.000002 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4
|
||||||
master-bin.000002 # Query 1 # use `test`; create table t3 (a int)ENGINE=MyISAM
|
master-bin.000002 # Table_map 1 # table_id: # (mysql.slow_log)
|
||||||
master-bin.000002 # Query 1 # use `test`; create table t2 (n int)ENGINE=MyISAM
|
master-bin.000002 # Table_map 1 # table_id: # (mysql.general_log)
|
||||||
master-bin.000002 # Table_map 1 # test.t2
|
master-bin.000002 # Query 1 # use `test`; create table t5 (a int)ENGINE=MyISAM
|
||||||
master-bin.000002 # Write_rows 1 #
|
master-bin.000002 # Query 1 # use `test`; drop table t5
|
||||||
|
master-bin.000002 # Query 1 # use `test`; create table t1 (n int)ENGINE=MyISAM
|
||||||
|
master-bin.000002 # Table_map 1 # table_id: # (test.t1)
|
||||||
|
master-bin.000002 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000002 # Query 1 # use `test`; drop table t1
|
||||||
show binary logs;
|
show binary logs;
|
||||||
Log_name File_size
|
Log_name File_size
|
||||||
master-bin.000001 1256
|
master-bin.000001 1332
|
||||||
master-bin.000002 373
|
master-bin.000002 635
|
||||||
start slave;
|
start slave;
|
||||||
show binary logs;
|
show binary logs;
|
||||||
Log_name File_size
|
Log_name File_size
|
||||||
slave-bin.000001 1354
|
slave-bin.000001 1506
|
||||||
slave-bin.000002 274
|
slave-bin.000002 460
|
||||||
show binlog events in 'slave-bin.000001' from 4;
|
show binlog events in 'slave-bin.000001' from 4;
|
||||||
Log_name Pos Event_type Server_id End_log_pos Info
|
Log_name Pos Event_type Server_id End_log_pos Info
|
||||||
slave-bin.000001 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4
|
slave-bin.000001 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4
|
||||||
slave-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
|
slave-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
|
||||||
slave-bin.000001 # Table_map 1 # test.t1
|
slave-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
slave-bin.000001 # Write_rows 1 #
|
slave-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
slave-bin.000001 # Query 1 # use `test`; drop table t1
|
slave-bin.000001 # Query 1 # use `test`; drop table t1
|
||||||
slave-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM
|
slave-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM
|
||||||
slave-bin.000001 # Table_map 1 # test.t1
|
slave-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
slave-bin.000001 # Write_rows 1 #
|
slave-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
slave-bin.000001 # Query 1 # use `test`; create table t3 (a int)ENGINE=MyISAM
|
slave-bin.000001 # Query 1 # use `test`; drop table t1
|
||||||
|
slave-bin.000001 # Query 1 # use `test`; create table t5 (a int)ENGINE=MyISAM
|
||||||
|
slave-bin.000001 # Query 1 # use `test`; drop table t5
|
||||||
slave-bin.000001 # Rotate 2 # slave-bin.000002;pos=4
|
slave-bin.000001 # Rotate 2 # slave-bin.000002;pos=4
|
||||||
show binlog events in 'slave-bin.000002' from 4;
|
show binlog events in 'slave-bin.000002' from 4;
|
||||||
Log_name Pos Event_type Server_id End_log_pos Info
|
Log_name Pos Event_type Server_id End_log_pos Info
|
||||||
slave-bin.000002 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4
|
slave-bin.000002 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4
|
||||||
slave-bin.000002 # Query 1 # use `test`; create table t2 (n int)ENGINE=MyISAM
|
slave-bin.000002 # Table_map 2 # table_id: # (mysql.slow_log)
|
||||||
slave-bin.000002 # Table_map 1 # test.t2
|
slave-bin.000002 # Table_map 2 # table_id: # (mysql.general_log)
|
||||||
slave-bin.000002 # Write_rows 1 #
|
slave-bin.000002 # Query 1 # use `test`; create table t1 (n int)ENGINE=MyISAM
|
||||||
|
slave-bin.000002 # Table_map 1 # table_id: # (test.t1)
|
||||||
|
slave-bin.000002 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
|
slave-bin.000002 # Query 1 # use `test`; drop table t1
|
||||||
show slave status;
|
show slave status;
|
||||||
Slave_IO_State 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 Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
|
Slave_IO_State 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 Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
|
||||||
# 127.0.0.1 root MASTER_PORT 1 master-bin.000002 373 # # master-bin.000002 Yes Yes # 0 0 373 # None 0 No #
|
# 127.0.0.1 root MASTER_PORT 1 master-bin.000002 635 # # master-bin.000002 Yes Yes # 0 0 635 # None 0 No #
|
||||||
show binlog events in 'slave-bin.000005' from 4;
|
show binlog events in 'slave-bin.000005' from 4;
|
||||||
ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log
|
ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log
|
||||||
DROP TABLE t1;
|
|
||||||
DROP TABLE t2;
|
|
||||||
DROP TABLE t3;
|
|
||||||
|
|
|
@ -16,91 +16,102 @@ load data infile '../std_data_ln/words.dat' into table t1 ignore 1 lines;
|
||||||
select count(*) from t1;
|
select count(*) from t1;
|
||||||
count(*)
|
count(*)
|
||||||
69
|
69
|
||||||
|
drop table t1;
|
||||||
show binlog events;
|
show binlog events;
|
||||||
Log_name Pos Event_type Server_id End_log_pos Info
|
Log_name Pos Event_type Server_id End_log_pos Info
|
||||||
master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4
|
master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4
|
||||||
master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=InnoDB
|
master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=InnoDB
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Xid 1 # COMMIT /* XID */
|
master-bin.000001 # Xid 1 # COMMIT /* XID */
|
||||||
master-bin.000001 # Query 1 # use `test`; drop table t1
|
master-bin.000001 # Query 1 # use `test`; drop table t1
|
||||||
master-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=InnoDB
|
master-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=InnoDB
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Xid 1 # COMMIT /* XID */
|
master-bin.000001 # Xid 1 # COMMIT /* XID */
|
||||||
|
master-bin.000001 # Query 1 # use `test`; drop table t1
|
||||||
show binlog events from 102 limit 1;
|
show binlog events from 102 limit 1;
|
||||||
Log_name Pos Event_type Server_id End_log_pos Info
|
Log_name Pos Event_type Server_id End_log_pos Info
|
||||||
master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=InnoDB
|
master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=InnoDB
|
||||||
show binlog events from 102 limit 2;
|
show binlog events from 102 limit 2;
|
||||||
Log_name Pos Event_type Server_id End_log_pos Info
|
Log_name Pos Event_type Server_id End_log_pos Info
|
||||||
master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=InnoDB
|
master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=InnoDB
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
show binlog events from 102 limit 2,1;
|
show binlog events from 102 limit 2,1;
|
||||||
Log_name Pos Event_type Server_id End_log_pos Info
|
Log_name Pos Event_type Server_id End_log_pos Info
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
flush logs;
|
flush logs;
|
||||||
create table t3 (a int)ENGINE=InnoDB;
|
create table t5 (a int)ENGINE=InnoDB;
|
||||||
|
drop table t5;
|
||||||
start slave;
|
start slave;
|
||||||
flush logs;
|
flush logs;
|
||||||
stop slave;
|
stop slave;
|
||||||
create table t2 (n int)ENGINE=InnoDB;
|
create table t1 (n int)ENGINE=InnoDB;
|
||||||
insert into t2 values (1);
|
insert into t1 values (1);
|
||||||
|
drop table t1;
|
||||||
show binlog events;
|
show binlog events;
|
||||||
Log_name Pos Event_type Server_id End_log_pos Info
|
Log_name Pos Event_type Server_id End_log_pos Info
|
||||||
master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4
|
master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4
|
||||||
master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=InnoDB
|
master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=InnoDB
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Xid 1 # COMMIT /* XID */
|
master-bin.000001 # Xid 1 # COMMIT /* XID */
|
||||||
master-bin.000001 # Query 1 # use `test`; drop table t1
|
master-bin.000001 # Query 1 # use `test`; drop table t1
|
||||||
master-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=InnoDB
|
master-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=InnoDB
|
||||||
master-bin.000001 # Table_map 1 # test.t1
|
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
master-bin.000001 # Write_rows 1 #
|
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000001 # Xid 1 # COMMIT /* XID */
|
master-bin.000001 # Xid 1 # COMMIT /* XID */
|
||||||
|
master-bin.000001 # Query 1 # use `test`; drop table t1
|
||||||
master-bin.000001 # Rotate 1 # master-bin.000002;pos=4
|
master-bin.000001 # Rotate 1 # master-bin.000002;pos=4
|
||||||
show binlog events in 'master-bin.000002';
|
show binlog events in 'master-bin.000002';
|
||||||
Log_name Pos Event_type Server_id End_log_pos Info
|
Log_name Pos Event_type Server_id End_log_pos Info
|
||||||
master-bin.000002 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4
|
master-bin.000002 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4
|
||||||
master-bin.000002 # Query 1 # use `test`; create table t3 (a int)ENGINE=InnoDB
|
master-bin.000002 # Table_map 1 # table_id: # (mysql.slow_log)
|
||||||
master-bin.000002 # Query 1 # use `test`; create table t2 (n int)ENGINE=InnoDB
|
master-bin.000002 # Table_map 1 # table_id: # (mysql.general_log)
|
||||||
master-bin.000002 # Table_map 1 # test.t2
|
master-bin.000002 # Query 1 # use `test`; create table t5 (a int)ENGINE=InnoDB
|
||||||
master-bin.000002 # Write_rows 1 #
|
master-bin.000002 # Query 1 # use `test`; drop table t5
|
||||||
|
master-bin.000002 # Query 1 # use `test`; create table t1 (n int)ENGINE=InnoDB
|
||||||
|
master-bin.000002 # Table_map 1 # table_id: # (test.t1)
|
||||||
|
master-bin.000002 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
master-bin.000002 # Xid 1 # COMMIT /* XID */
|
master-bin.000002 # Xid 1 # COMMIT /* XID */
|
||||||
|
master-bin.000002 # Query 1 # use `test`; drop table t1
|
||||||
show binary logs;
|
show binary logs;
|
||||||
Log_name File_size
|
Log_name File_size
|
||||||
master-bin.000001 1310
|
master-bin.000001 1386
|
||||||
master-bin.000002 400
|
master-bin.000002 662
|
||||||
start slave;
|
start slave;
|
||||||
show binary logs;
|
show binary logs;
|
||||||
Log_name File_size
|
Log_name File_size
|
||||||
slave-bin.000001 1408
|
slave-bin.000001 1560
|
||||||
slave-bin.000002 301
|
slave-bin.000002 487
|
||||||
show binlog events in 'slave-bin.000001' from 4;
|
show binlog events in 'slave-bin.000001' from 4;
|
||||||
Log_name Pos Event_type Server_id End_log_pos Info
|
Log_name Pos Event_type Server_id End_log_pos Info
|
||||||
slave-bin.000001 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4
|
slave-bin.000001 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4
|
||||||
slave-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=InnoDB
|
slave-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=InnoDB
|
||||||
slave-bin.000001 # Table_map 1 # test.t1
|
slave-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
slave-bin.000001 # Write_rows 1 #
|
slave-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
slave-bin.000001 # Xid 1 # COMMIT /* XID */
|
slave-bin.000001 # Xid 1 # COMMIT /* XID */
|
||||||
slave-bin.000001 # Query 1 # use `test`; drop table t1
|
slave-bin.000001 # Query 1 # use `test`; drop table t1
|
||||||
slave-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=InnoDB
|
slave-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=InnoDB
|
||||||
slave-bin.000001 # Table_map 1 # test.t1
|
slave-bin.000001 # Table_map 1 # table_id: # (test.t1)
|
||||||
slave-bin.000001 # Write_rows 1 #
|
slave-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
slave-bin.000001 # Xid 1 # COMMIT /* XID */
|
slave-bin.000001 # Xid 1 # COMMIT /* XID */
|
||||||
slave-bin.000001 # Query 1 # use `test`; create table t3 (a int)ENGINE=InnoDB
|
slave-bin.000001 # Query 1 # use `test`; drop table t1
|
||||||
|
slave-bin.000001 # Query 1 # use `test`; create table t5 (a int)ENGINE=InnoDB
|
||||||
|
slave-bin.000001 # Query 1 # use `test`; drop table t5
|
||||||
slave-bin.000001 # Rotate 2 # slave-bin.000002;pos=4
|
slave-bin.000001 # Rotate 2 # slave-bin.000002;pos=4
|
||||||
show binlog events in 'slave-bin.000002' from 4;
|
show binlog events in 'slave-bin.000002' from 4;
|
||||||
Log_name Pos Event_type Server_id End_log_pos Info
|
Log_name Pos Event_type Server_id End_log_pos Info
|
||||||
slave-bin.000002 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4
|
slave-bin.000002 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4
|
||||||
slave-bin.000002 # Query 1 # use `test`; create table t2 (n int)ENGINE=InnoDB
|
slave-bin.000002 # Table_map 2 # table_id: # (mysql.slow_log)
|
||||||
slave-bin.000002 # Table_map 1 # test.t2
|
slave-bin.000002 # Table_map 2 # table_id: # (mysql.general_log)
|
||||||
slave-bin.000002 # Write_rows 1 #
|
slave-bin.000002 # Query 1 # use `test`; create table t1 (n int)ENGINE=InnoDB
|
||||||
|
slave-bin.000002 # Table_map 1 # table_id: # (test.t1)
|
||||||
|
slave-bin.000002 # Write_rows 1 # table_id: # flags: STMT_END_F
|
||||||
slave-bin.000002 # Xid 1 # COMMIT /* XID */
|
slave-bin.000002 # Xid 1 # COMMIT /* XID */
|
||||||
|
slave-bin.000002 # Query 1 # use `test`; drop table t1
|
||||||
show slave status;
|
show slave status;
|
||||||
Slave_IO_State 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 Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
|
Slave_IO_State 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 Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
|
||||||
# 127.0.0.1 root MASTER_PORT 1 master-bin.000002 400 # # master-bin.000002 Yes Yes # 0 0 400 # None 0 No #
|
# 127.0.0.1 root MASTER_PORT 1 master-bin.000002 662 # # master-bin.000002 Yes Yes # 0 0 662 # None 0 No #
|
||||||
show binlog events in 'slave-bin.000005' from 4;
|
show binlog events in 'slave-bin.000005' from 4;
|
||||||
ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log
|
ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log
|
||||||
DROP TABLE t1;
|
|
||||||
DROP TABLE t2;
|
|
||||||
DROP TABLE t3;
|
|
||||||
|
|
|
@ -58,4 +58,4 @@ Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File
|
||||||
flush logs;
|
flush logs;
|
||||||
show master status;
|
show master status;
|
||||||
File Position Binlog_Do_DB Binlog_Ignore_DB
|
File Position Binlog_Do_DB Binlog_Ignore_DB
|
||||||
master-bin.000002 102 <Binlog_Ignore_DB>
|
master-bin.000002 212 <Binlog_Ignore_DB>
|
||||||
|
|
|
@ -29,5 +29,17 @@ a
|
||||||
SELECT * FROM test.t2;
|
SELECT * FROM test.t2;
|
||||||
a
|
a
|
||||||
2
|
2
|
||||||
|
show binlog events;
|
||||||
|
Log_name Pos Event_type Server_id End_log_pos Info
|
||||||
|
master-bin.000001 4 Format_desc 1 102 Server ver: VERSION, Binlog ver: 4
|
||||||
|
master-bin.000001 102 Query 1 193 use `test`; DROP TABLE IF EXISTS test.t2
|
||||||
|
master-bin.000001 193 Query 1 299 use `test`; CREATE TABLE test.t1 (a INT,PRIMARY KEY(a))
|
||||||
|
master-bin.000001 299 Query 1 405 use `test`; CREATE TABLE test.t2 (a INT,PRIMARY KEY(a))
|
||||||
|
master-bin.000001 405 Table_map 1 444 table_id: # (test.t1)
|
||||||
|
master-bin.000001 444 Write_rows 1 483 table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 483 Table_map 1 540 table_id: # (mysql.proc)
|
||||||
|
master-bin.000001 540 Write_rows 1 723 table_id: # flags: STMT_END_F
|
||||||
|
master-bin.000001 723 Table_map 1 762 table_id: # (test.t2)
|
||||||
|
master-bin.000001 762 Write_rows 1 796 table_id: # flags: STMT_END_F
|
||||||
DROP PROCEDURE IF EXISTS test.p1;
|
DROP PROCEDURE IF EXISTS test.p1;
|
||||||
DROP TABLE IF EXISTS test.t1;
|
DROP TABLE IF EXISTS test.t1;
|
||||||
|
|
|
@ -5,7 +5,7 @@ create table t1 (a int, b int) engine=innodb;
|
||||||
begin;
|
begin;
|
||||||
insert into t1 values (1,2);
|
insert into t1 values (1,2);
|
||||||
commit;
|
commit;
|
||||||
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /Server ver: .*, Binlog ver: .*/Server ver: #, Binlog ver: #/
|
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /Server ver: .*, Binlog ver: .*/Server ver: #, Binlog ver: #/ /table_id: [0-9]+/table_id: #/
|
||||||
show binlog events;
|
show binlog events;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
|
|
|
@ -35,11 +35,13 @@ create table t1 (a int primary key) engine=ndb;
|
||||||
create table t2 (a int primary key) engine=ndb;
|
create table t2 (a int primary key) engine=ndb;
|
||||||
--replace_result $binlog_start <binlog_start>
|
--replace_result $binlog_start <binlog_start>
|
||||||
--replace_column 2 # 4 # 5 #
|
--replace_column 2 # 4 # 5 #
|
||||||
|
--replace_regex /table_id: [0-9]+/table_id: #/
|
||||||
--eval show binlog events from $binlog_start
|
--eval show binlog events from $binlog_start
|
||||||
|
|
||||||
--connection server1
|
--connection server1
|
||||||
--replace_result $binlog_start <binlog_start>
|
--replace_result $binlog_start <binlog_start>
|
||||||
--replace_column 2 # 4 # 5 #
|
--replace_column 2 # 4 # 5 #
|
||||||
|
--replace_regex /table_id: [0-9]+/table_id: #/
|
||||||
--eval show binlog events from $binlog_start
|
--eval show binlog events from $binlog_start
|
||||||
|
|
||||||
|
|
||||||
|
@ -55,6 +57,7 @@ alter table t2 add column (b int);
|
||||||
--connections server1
|
--connections server1
|
||||||
--replace_result $binlog_start <binlog_start>
|
--replace_result $binlog_start <binlog_start>
|
||||||
--replace_column 2 # 4 # 5 #
|
--replace_column 2 # 4 # 5 #
|
||||||
|
--replace_regex /table_id: [0-9]+/table_id: #/
|
||||||
--eval show binlog events from $binlog_start
|
--eval show binlog events from $binlog_start
|
||||||
|
|
||||||
|
|
||||||
|
@ -75,6 +78,7 @@ drop table mysqltest.t1;
|
||||||
--connection server1
|
--connection server1
|
||||||
--replace_result $binlog_start <binlog_start>
|
--replace_result $binlog_start <binlog_start>
|
||||||
--replace_column 2 # 4 # 5 #
|
--replace_column 2 # 4 # 5 #
|
||||||
|
--replace_regex /table_id: [0-9]+/table_id: #/
|
||||||
--eval show binlog events from $binlog_start
|
--eval show binlog events from $binlog_start
|
||||||
|
|
||||||
|
|
||||||
|
@ -93,6 +97,7 @@ create table t1 (a int primary key) engine=ndb;
|
||||||
--connection server2
|
--connection server2
|
||||||
--replace_result $binlog_start <binlog_start>
|
--replace_result $binlog_start <binlog_start>
|
||||||
--replace_column 2 # 4 # 5 #
|
--replace_column 2 # 4 # 5 #
|
||||||
|
--replace_regex /table_id: [0-9]+/table_id: #/
|
||||||
--eval show binlog events from $binlog_start
|
--eval show binlog events from $binlog_start
|
||||||
|
|
||||||
--connection server2
|
--connection server2
|
||||||
|
@ -146,4 +151,5 @@ drop table t1;
|
||||||
--connection server2
|
--connection server2
|
||||||
--replace_result $binlog_start <binlog_start>
|
--replace_result $binlog_start <binlog_start>
|
||||||
--replace_column 2 # 4 # 5 #
|
--replace_column 2 # 4 # 5 #
|
||||||
|
--replace_regex /table_id: [0-9]+/table_id: #/
|
||||||
--eval show binlog events from $binlog_start
|
--eval show binlog events from $binlog_start
|
||||||
|
|
|
@ -14,6 +14,7 @@ create table t1 (a int primary key, b int) engine=ndb;
|
||||||
insert into t1 values (1, 1);
|
insert into t1 values (1, 1);
|
||||||
--replace_result $binlog_start <binlog_start>
|
--replace_result $binlog_start <binlog_start>
|
||||||
--replace_column 2 # 4 # 5 #
|
--replace_column 2 # 4 # 5 #
|
||||||
|
--replace_regex /table_id: [0-9]+/table_id: #/
|
||||||
--eval show binlog events from $binlog_start
|
--eval show binlog events from $binlog_start
|
||||||
|
|
||||||
drop database mysqltest;
|
drop database mysqltest;
|
||||||
|
|
|
@ -22,6 +22,7 @@ create table t1 engine=HEAP select 10 as a;
|
||||||
insert into t1 values(11);
|
insert into t1 values(11);
|
||||||
save_master_pos;
|
save_master_pos;
|
||||||
--replace_column 2 # 5 #
|
--replace_column 2 # 5 #
|
||||||
|
--replace_regex /table_id: [0-9]+/table_id: #/
|
||||||
show binlog events from 79;
|
show binlog events from 79;
|
||||||
connection slave;
|
connection slave;
|
||||||
reset slave;
|
reset slave;
|
||||||
|
@ -40,6 +41,7 @@ select * from t1;
|
||||||
select * from t1 limit 10;
|
select * from t1 limit 10;
|
||||||
save_master_pos;
|
save_master_pos;
|
||||||
--replace_column 2 # 5 #
|
--replace_column 2 # 5 #
|
||||||
|
--replace_regex /table_id: [0-9]+/table_id: #/
|
||||||
show binlog events in 'master-bin.002' from 79;
|
show binlog events in 'master-bin.002' from 79;
|
||||||
|
|
||||||
connection slave;
|
connection slave;
|
||||||
|
|
|
@ -21,6 +21,7 @@ connection slave;
|
||||||
sync_with_master;
|
sync_with_master;
|
||||||
select count(*) from test.t1; # check that LOAD was replicated
|
select count(*) from test.t1; # check that LOAD was replicated
|
||||||
--replace_column 2 # 5 #
|
--replace_column 2 # 5 #
|
||||||
|
--replace_regex /table_id: [0-9]+/table_id: #/
|
||||||
show binlog events from 102; # should be nothing
|
show binlog events from 102; # should be nothing
|
||||||
|
|
||||||
# Cleanup
|
# Cleanup
|
||||||
|
|
|
@ -90,4 +90,5 @@ drop table t1;
|
||||||
--connection master
|
--connection master
|
||||||
let $VERSION=`select version()`;
|
let $VERSION=`select version()`;
|
||||||
--replace_result $VERSION VERSION
|
--replace_result $VERSION VERSION
|
||||||
|
--replace_regex /table_id: [0-9]+/table_id: #/
|
||||||
show binlog events;
|
show binlog events;
|
||||||
|
|
|
@ -69,6 +69,7 @@ select * from t1 order by pk1;
|
||||||
--connection master
|
--connection master
|
||||||
let $VERSION=`select version()`;
|
let $VERSION=`select version()`;
|
||||||
--replace_result $VERSION VERSION
|
--replace_result $VERSION VERSION
|
||||||
|
--replace_regex /table_id: [0-9]+/table_id: #/
|
||||||
show binlog events;
|
show binlog events;
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|
|
@ -17,7 +17,8 @@ USE test_ignore;
|
||||||
CREATE TABLE t2 (a INT, b INT);
|
CREATE TABLE t2 (a INT, b INT);
|
||||||
SHOW TABLES;
|
SHOW TABLES;
|
||||||
INSERT INTO t2 VALUES (3,3), (4,4);
|
INSERT INTO t2 VALUES (3,3), (4,4);
|
||||||
#SHOW BINLOG EVENTS FROM 102;
|
--replace_regex /table_id: [0-9]+/table_id: #/
|
||||||
|
SHOW BINLOG EVENTS FROM 102;
|
||||||
sync_slave_with_master;
|
sync_slave_with_master;
|
||||||
--echo **** On Slave ****
|
--echo **** On Slave ****
|
||||||
SHOW DATABASES;
|
SHOW DATABASES;
|
||||||
|
|
|
@ -26,6 +26,7 @@ CREATE TABLE t2 (a INT, b INT) ENGINE=Merge;
|
||||||
CREATE TABLE t3 (a INT, b INT) CHARSET=utf8;
|
CREATE TABLE t3 (a INT, b INT) CHARSET=utf8;
|
||||||
CREATE TABLE t4 (a INT, b INT) ENGINE=Merge CHARSET=utf8;
|
CREATE TABLE t4 (a INT, b INT) ENGINE=Merge CHARSET=utf8;
|
||||||
--replace_column 1 # 4 # 5 #
|
--replace_column 1 # 4 # 5 #
|
||||||
|
--replace_regex /table_id: [0-9]+/table_id: #/
|
||||||
--query_vertical SHOW BINLOG EVENTS FROM 212
|
--query_vertical SHOW BINLOG EVENTS FROM 212
|
||||||
--echo **** On Master ****
|
--echo **** On Master ****
|
||||||
--query_vertical SHOW CREATE TABLE t1
|
--query_vertical SHOW CREATE TABLE t1
|
||||||
|
@ -60,7 +61,8 @@ connection master;
|
||||||
--error 1062
|
--error 1062
|
||||||
CREATE TABLE t7 (UNIQUE(b)) SELECT a,b FROM tt3;
|
CREATE TABLE t7 (UNIQUE(b)) SELECT a,b FROM tt3;
|
||||||
# Shouldn't be written to the binary log
|
# Shouldn't be written to the binary log
|
||||||
SHOW BINLOG EVENTS FROM 1256;
|
--replace_regex /table_id: [0-9]+/table_id: #/
|
||||||
|
SHOW BINLOG EVENTS FROM 1326;
|
||||||
|
|
||||||
# Test that INSERT-SELECT works the same way as for SBR.
|
# Test that INSERT-SELECT works the same way as for SBR.
|
||||||
CREATE TABLE t7 (a INT, b INT UNIQUE);
|
CREATE TABLE t7 (a INT, b INT UNIQUE);
|
||||||
|
@ -68,7 +70,8 @@ CREATE TABLE t7 (a INT, b INT UNIQUE);
|
||||||
INSERT INTO t7 SELECT a,b FROM tt3;
|
INSERT INTO t7 SELECT a,b FROM tt3;
|
||||||
SELECT * FROM t7 ORDER BY a,b;
|
SELECT * FROM t7 ORDER BY a,b;
|
||||||
# Should be written to the binary log
|
# Should be written to the binary log
|
||||||
SHOW BINLOG EVENTS FROM 1256;
|
--replace_regex /table_id: [0-9]+/table_id: #/
|
||||||
|
SHOW BINLOG EVENTS FROM 1326;
|
||||||
sync_slave_with_master;
|
sync_slave_with_master;
|
||||||
SELECT * FROM t7 ORDER BY a,b;
|
SELECT * FROM t7 ORDER BY a,b;
|
||||||
|
|
||||||
|
@ -78,7 +81,8 @@ INSERT INTO tt4 VALUES (4,8), (5,10), (6,12);
|
||||||
BEGIN;
|
BEGIN;
|
||||||
INSERT INTO t7 SELECT a,b FROM tt4;
|
INSERT INTO t7 SELECT a,b FROM tt4;
|
||||||
ROLLBACK;
|
ROLLBACK;
|
||||||
SHOW BINLOG EVENTS FROM 1452;
|
--replace_regex /table_id: [0-9]+/table_id: #/
|
||||||
|
SHOW BINLOG EVENTS FROM 1522;
|
||||||
SELECT * FROM t7 ORDER BY a,b;
|
SELECT * FROM t7 ORDER BY a,b;
|
||||||
sync_slave_with_master;
|
sync_slave_with_master;
|
||||||
SELECT * FROM t7 ORDER BY a,b;
|
SELECT * FROM t7 ORDER BY a,b;
|
||||||
|
@ -91,7 +95,8 @@ CREATE TEMPORARY TABLE tt6 LIKE tt4;
|
||||||
--echo **** On Master ****
|
--echo **** On Master ****
|
||||||
--query_vertical SHOW CREATE TABLE t8
|
--query_vertical SHOW CREATE TABLE t8
|
||||||
--query_vertical SHOW CREATE TABLE t9
|
--query_vertical SHOW CREATE TABLE t9
|
||||||
SHOW BINLOG EVENTS FROM 1548;
|
--replace_regex /table_id: [0-9]+/table_id: #/
|
||||||
|
SHOW BINLOG EVENTS FROM 1618;
|
||||||
sync_slave_with_master;
|
sync_slave_with_master;
|
||||||
--echo **** On Slave ****
|
--echo **** On Slave ****
|
||||||
--query_vertical SHOW CREATE TABLE t8
|
--query_vertical SHOW CREATE TABLE t8
|
||||||
|
|
|
@ -32,6 +32,7 @@ connection master;
|
||||||
DROP TABLE t1,t2;
|
DROP TABLE t1,t2;
|
||||||
let $VERSION=`select version()`;
|
let $VERSION=`select version()`;
|
||||||
--replace_result $VERSION VERSION
|
--replace_result $VERSION VERSION
|
||||||
|
--replace_regex /table_id: [0-9]+/table_id: #/
|
||||||
SHOW BINLOG EVENTS;
|
SHOW BINLOG EVENTS;
|
||||||
SHOW TABLES;
|
SHOW TABLES;
|
||||||
sync_slave_with_master;
|
sync_slave_with_master;
|
||||||
|
|
|
@ -341,6 +341,7 @@ drop trigger trg;
|
||||||
insert into t1 values (1);
|
insert into t1 values (1);
|
||||||
select * from t1;
|
select * from t1;
|
||||||
--replace_column 2 # 5 #
|
--replace_column 2 # 5 #
|
||||||
|
--replace_regex /table_id: [0-9]+/table_id: #/
|
||||||
show binlog events in 'master-bin.000001' from 102;
|
show binlog events in 'master-bin.000001' from 102;
|
||||||
sync_slave_with_master;
|
sync_slave_with_master;
|
||||||
select * from t1;
|
select * from t1;
|
||||||
|
|
|
@ -2583,6 +2583,7 @@ begin
|
||||||
show warnings;
|
show warnings;
|
||||||
end|
|
end|
|
||||||
--disable_parsing
|
--disable_parsing
|
||||||
|
--replace_regex /table_id: [0-9]+/table_id: #/
|
||||||
show binlog events;
|
show binlog events;
|
||||||
show storage engines;
|
show storage engines;
|
||||||
show master status;
|
show master status;
|
||||||
|
|
|
@ -15,6 +15,7 @@ begin
|
||||||
show grants for 'root'@'localhost';
|
show grants for 'root'@'localhost';
|
||||||
end|
|
end|
|
||||||
--disable_parsing
|
--disable_parsing
|
||||||
|
--replace_regex /table_id: [0-9]+/table_id: #/
|
||||||
show binlog events;
|
show binlog events;
|
||||||
show storage engines;
|
show storage engines;
|
||||||
show master status;
|
show master status;
|
||||||
|
|
|
@ -14,6 +14,7 @@ set @var1= "';aaa";
|
||||||
SET @var2=char(ascii('a'));
|
SET @var2=char(ascii('a'));
|
||||||
insert into t1 values (@var1),(@var2);
|
insert into t1 values (@var1),(@var2);
|
||||||
--replace_column 2 # 5 #
|
--replace_column 2 # 5 #
|
||||||
|
--replace_regex /table_id: [0-9]+/table_id: #/
|
||||||
show binlog events from 102;
|
show binlog events from 102;
|
||||||
# more important than SHOW BINLOG EVENTS, mysqlbinlog (where we
|
# more important than SHOW BINLOG EVENTS, mysqlbinlog (where we
|
||||||
# absolutely need variables names to be quoted and strings to be
|
# absolutely need variables names to be quoted and strings to be
|
||||||
|
|
|
@ -1620,15 +1620,20 @@ static int open_binlog_index(THD *thd, TABLE_LIST *tables,
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Insert one row in the cluster_replication.binlog_index
|
Insert one row in the cluster_replication.binlog_index
|
||||||
|
|
||||||
declared friend in handler.h to be able to call write_row directly
|
|
||||||
so that this insert is not replicated
|
|
||||||
*/
|
*/
|
||||||
int ndb_add_binlog_index(THD *thd, void *_row)
|
int ndb_add_binlog_index(THD *thd, void *_row)
|
||||||
{
|
{
|
||||||
Binlog_index_row &row= *(Binlog_index_row *) _row;
|
Binlog_index_row &row= *(Binlog_index_row *) _row;
|
||||||
int error= 0;
|
int error= 0;
|
||||||
bool need_reopen;
|
bool need_reopen;
|
||||||
|
|
||||||
|
/*
|
||||||
|
Turn of binlogging to prevent the table changes to be written to
|
||||||
|
the binary log.
|
||||||
|
*/
|
||||||
|
ulong saved_options= thd->options;
|
||||||
|
thd->options&= ~(OPTION_BIN_LOG);
|
||||||
|
|
||||||
for ( ; ; ) /* loop for need_reopen */
|
for ( ; ; ) /* loop for need_reopen */
|
||||||
{
|
{
|
||||||
if (!binlog_index && open_binlog_index(thd, &binlog_tables, &binlog_index))
|
if (!binlog_index && open_binlog_index(thd, &binlog_tables, &binlog_index))
|
||||||
|
@ -1663,7 +1668,7 @@ int ndb_add_binlog_index(THD *thd, void *_row)
|
||||||
binlog_index->field[6]->store(row.n_schemaops);
|
binlog_index->field[6]->store(row.n_schemaops);
|
||||||
|
|
||||||
int r;
|
int r;
|
||||||
if ((r= binlog_index->file->write_row(binlog_index->record[0])))
|
if ((r= binlog_index->file->ha_write_row(binlog_index->record[0])))
|
||||||
{
|
{
|
||||||
sql_print_error("NDB Binlog: Writing row to binlog_index: %d", r);
|
sql_print_error("NDB Binlog: Writing row to binlog_index: %d", r);
|
||||||
error= -1;
|
error= -1;
|
||||||
|
@ -1672,10 +1677,12 @@ int ndb_add_binlog_index(THD *thd, void *_row)
|
||||||
|
|
||||||
mysql_unlock_tables(thd, thd->lock);
|
mysql_unlock_tables(thd, thd->lock);
|
||||||
thd->lock= 0;
|
thd->lock= 0;
|
||||||
|
thd->options= saved_options;
|
||||||
return 0;
|
return 0;
|
||||||
add_binlog_index_err:
|
add_binlog_index_err:
|
||||||
close_thread_tables(thd);
|
close_thread_tables(thd);
|
||||||
binlog_index= 0;
|
binlog_index= 0;
|
||||||
|
thd->options= saved_options;
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3200,40 +3200,81 @@ template int binlog_log_row<Update_rows_log_event>(TABLE *, const byte *, const
|
||||||
|
|
||||||
#endif /* HAVE_ROW_BASED_REPLICATION */
|
#endif /* HAVE_ROW_BASED_REPLICATION */
|
||||||
|
|
||||||
|
int handler::ha_external_lock(THD *thd, int lock_type)
|
||||||
|
{
|
||||||
|
DBUG_ENTER("handler::ha_external_lock");
|
||||||
|
int error;
|
||||||
|
if (unlikely(error= external_lock(thd, lock_type)))
|
||||||
|
DBUG_RETURN(error);
|
||||||
|
#ifdef HAVE_ROW_BASED_REPLICATION
|
||||||
|
if (table->file->is_injective())
|
||||||
|
DBUG_RETURN(0);
|
||||||
|
|
||||||
|
/*
|
||||||
|
There is a number of statements that are logged statement-based
|
||||||
|
but call external lock. For these, we do not need to generate a
|
||||||
|
table map.
|
||||||
|
|
||||||
|
TODO: The need for this switch is an indication that the model for
|
||||||
|
locking combined with row-based replication needs to be looked
|
||||||
|
over. Ideally, no such special handling should be needed.
|
||||||
|
*/
|
||||||
|
switch (thd->lex->sql_command)
|
||||||
|
{
|
||||||
|
case SQLCOM_TRUNCATE:
|
||||||
|
case SQLCOM_ALTER_TABLE:
|
||||||
|
DBUG_RETURN(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
If we are locking a table for writing, we generate a table map.
|
||||||
|
For all other kinds of locks, we don't do anything.
|
||||||
|
*/
|
||||||
|
if (lock_type == F_WRLCK && check_table_binlog_row_based(thd, table))
|
||||||
|
{
|
||||||
|
int const has_trans= table->file->has_transactions();
|
||||||
|
error= thd->binlog_write_table_map(table, has_trans);
|
||||||
|
if (unlikely(error))
|
||||||
|
DBUG_RETURN(error);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
DBUG_RETURN(0);
|
||||||
|
}
|
||||||
|
|
||||||
int handler::ha_write_row(byte *buf)
|
int handler::ha_write_row(byte *buf)
|
||||||
{
|
{
|
||||||
int error;
|
int error;
|
||||||
if (likely(!(error= write_row(buf))))
|
if (unlikely(error= write_row(buf)))
|
||||||
{
|
return error;
|
||||||
#ifdef HAVE_ROW_BASED_REPLICATION
|
#ifdef HAVE_ROW_BASED_REPLICATION
|
||||||
error= binlog_log_row<Write_rows_log_event>(table, 0, buf);
|
if (unlikely(error= binlog_log_row<Write_rows_log_event>(table, 0, buf)))
|
||||||
|
return error;
|
||||||
#endif
|
#endif
|
||||||
}
|
return 0;
|
||||||
return error;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int handler::ha_update_row(const byte *old_data, byte *new_data)
|
int handler::ha_update_row(const byte *old_data, byte *new_data)
|
||||||
{
|
{
|
||||||
int error;
|
int error;
|
||||||
if (likely(!(error= update_row(old_data, new_data))))
|
if (unlikely(error= update_row(old_data, new_data)))
|
||||||
{
|
return error;
|
||||||
#ifdef HAVE_ROW_BASED_REPLICATION
|
#ifdef HAVE_ROW_BASED_REPLICATION
|
||||||
error= binlog_log_row<Update_rows_log_event>(table, old_data, new_data);
|
if (unlikely(error= binlog_log_row<Update_rows_log_event>(table, old_data, new_data)))
|
||||||
|
return error;
|
||||||
#endif
|
#endif
|
||||||
}
|
return 0;
|
||||||
return error;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int handler::ha_delete_row(const byte *buf)
|
int handler::ha_delete_row(const byte *buf)
|
||||||
{
|
{
|
||||||
int error;
|
int error;
|
||||||
if (likely(!(error= delete_row(buf))))
|
if (unlikely(error= delete_row(buf)))
|
||||||
{
|
return error;
|
||||||
#ifdef HAVE_ROW_BASED_REPLICATION
|
#ifdef HAVE_ROW_BASED_REPLICATION
|
||||||
error= binlog_log_row<Delete_rows_log_event>(table, buf, 0);
|
if (unlikely(error= binlog_log_row<Delete_rows_log_event>(table, buf, 0)))
|
||||||
|
return error;
|
||||||
#endif
|
#endif
|
||||||
}
|
return 0;
|
||||||
return error;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1086,7 +1086,35 @@ typedef struct st_ha_create_information
|
||||||
bool store_on_disk; /* 1 if table stored on disk */
|
bool store_on_disk; /* 1 if table stored on disk */
|
||||||
} HA_CREATE_INFO;
|
} HA_CREATE_INFO;
|
||||||
|
|
||||||
|
/*
|
||||||
|
Class for maintaining hooks used inside operations on tables such
|
||||||
|
as: create table functions, delete table functions, and alter table
|
||||||
|
functions.
|
||||||
|
|
||||||
|
Class is using the Template Method pattern to separate the public
|
||||||
|
usage interface from the private inheritance interface. This
|
||||||
|
imposes no overhead, since the public non-virtual function is small
|
||||||
|
enough to be inlined.
|
||||||
|
|
||||||
|
The hooks are usually used for functions that does several things,
|
||||||
|
e.g., create_table_from_items(), which both create a table and lock
|
||||||
|
it.
|
||||||
|
*/
|
||||||
|
class TABLEOP_HOOKS
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
inline void prelock(TABLE **tables, uint count)
|
||||||
|
{
|
||||||
|
do_prelock(tables, count);
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
/* Function primitive that is called prior to locking tables */
|
||||||
|
virtual void do_prelock(TABLE **tables, uint count)
|
||||||
|
{
|
||||||
|
/* Default is to do nothing */
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
typedef struct st_savepoint SAVEPOINT;
|
typedef struct st_savepoint SAVEPOINT;
|
||||||
extern ulong savepoint_alloc_size;
|
extern ulong savepoint_alloc_size;
|
||||||
|
@ -1480,15 +1508,24 @@ public:
|
||||||
uint get_index(void) const { return active_index; }
|
uint get_index(void) const { return active_index; }
|
||||||
virtual int open(const char *name, int mode, uint test_if_locked)=0;
|
virtual int open(const char *name, int mode, uint test_if_locked)=0;
|
||||||
virtual int close(void)=0;
|
virtual int close(void)=0;
|
||||||
virtual int ha_write_row(byte * buf);
|
|
||||||
virtual int ha_update_row(const byte * old_data, byte * new_data);
|
/*
|
||||||
virtual int ha_delete_row(const byte * buf);
|
These functions represent the public interface to *users* of the
|
||||||
|
handler class, hence they are *not* virtual. For the inheritance
|
||||||
|
interface, see the (private) functions write_row(), update_row(),
|
||||||
|
and delete_row() below.
|
||||||
|
*/
|
||||||
|
int ha_external_lock(THD *thd, int lock_type);
|
||||||
|
int ha_write_row(byte * buf);
|
||||||
|
int ha_update_row(const byte * old_data, byte * new_data);
|
||||||
|
int ha_delete_row(const byte * buf);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
If the handler does it's own injection of the rows, this member function
|
If the handler does it's own injection of the rows, this member function
|
||||||
should return 'true'.
|
should return 'true'.
|
||||||
*/
|
*/
|
||||||
virtual bool is_injective() const { return false; }
|
virtual bool is_injective() const { return false; }
|
||||||
|
|
||||||
/*
|
/*
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
start_bulk_update()
|
start_bulk_update()
|
||||||
|
@ -1620,7 +1657,6 @@ public:
|
||||||
{ return 0; }
|
{ return 0; }
|
||||||
virtual int extra_opt(enum ha_extra_function operation, ulong cache_size)
|
virtual int extra_opt(enum ha_extra_function operation, ulong cache_size)
|
||||||
{ return extra(operation); }
|
{ return extra(operation); }
|
||||||
virtual int external_lock(THD *thd, int lock_type) { return 0; }
|
|
||||||
/*
|
/*
|
||||||
In an UPDATE or DELETE, if the row under the cursor was locked by another
|
In an UPDATE or DELETE, if the row under the cursor was locked by another
|
||||||
transaction, and the engine used an optimistic read of the last
|
transaction, and the engine used an optimistic read of the last
|
||||||
|
@ -1894,28 +1930,31 @@ public:
|
||||||
{ return COMPATIBLE_DATA_NO; }
|
{ return COMPATIBLE_DATA_NO; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Row-level primitives for storage engines.
|
Row-level primitives for storage engines. These should be
|
||||||
These should be overridden by the storage engine class. To call
|
overridden by the storage engine class. To call these methods, use
|
||||||
these methods, use the corresponding 'ha_*' method above.
|
the corresponding 'ha_*' method above.
|
||||||
*/
|
*/
|
||||||
friend int ndb_add_binlog_index(THD *, void *);
|
virtual int external_lock(THD *thd __attribute__((unused)),
|
||||||
|
int lock_type __attribute__((unused)))
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
virtual int write_row(byte *buf __attribute__((unused)))
|
virtual int write_row(byte *buf __attribute__((unused)))
|
||||||
{
|
{
|
||||||
return HA_ERR_WRONG_COMMAND;
|
return HA_ERR_WRONG_COMMAND;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual int update_row(const byte *old_data __attribute__((unused)),
|
virtual int update_row(const byte *old_data __attribute__((unused)),
|
||||||
byte *new_data __attribute__((unused)))
|
byte *new_data __attribute__((unused)))
|
||||||
{
|
{
|
||||||
return HA_ERR_WRONG_COMMAND;
|
return HA_ERR_WRONG_COMMAND;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual int delete_row(const byte *buf __attribute__((unused)))
|
virtual int delete_row(const byte *buf __attribute__((unused)))
|
||||||
{
|
{
|
||||||
return HA_ERR_WRONG_COMMAND;
|
return HA_ERR_WRONG_COMMAND;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -229,12 +229,12 @@ static int lock_external(THD *thd, TABLE **tables, uint count)
|
||||||
((*tables)->reginfo.lock_type >= TL_READ &&
|
((*tables)->reginfo.lock_type >= TL_READ &&
|
||||||
(*tables)->reginfo.lock_type <= TL_READ_NO_INSERT))
|
(*tables)->reginfo.lock_type <= TL_READ_NO_INSERT))
|
||||||
lock_type=F_RDLCK;
|
lock_type=F_RDLCK;
|
||||||
if ((error=(*tables)->file->external_lock(thd,lock_type)))
|
if ((error=(*tables)->file->ha_external_lock(thd,lock_type)))
|
||||||
{
|
{
|
||||||
print_lock_error(error, (*tables)->file->table_type());
|
print_lock_error(error, (*tables)->file->table_type());
|
||||||
for (; i-- ; tables--)
|
for (; i-- ; tables--)
|
||||||
{
|
{
|
||||||
(*tables)->file->external_lock(thd, F_UNLCK);
|
(*tables)->file->ha_external_lock(thd, F_UNLCK);
|
||||||
(*tables)->current_lock=F_UNLCK;
|
(*tables)->current_lock=F_UNLCK;
|
||||||
}
|
}
|
||||||
DBUG_RETURN(error);
|
DBUG_RETURN(error);
|
||||||
|
@ -578,7 +578,7 @@ static int unlock_external(THD *thd, TABLE **table,uint count)
|
||||||
if ((*table)->current_lock != F_UNLCK)
|
if ((*table)->current_lock != F_UNLCK)
|
||||||
{
|
{
|
||||||
(*table)->current_lock = F_UNLCK;
|
(*table)->current_lock = F_UNLCK;
|
||||||
if ((error=(*table)->file->external_lock(thd, F_UNLCK)))
|
if ((error=(*table)->file->ha_external_lock(thd, F_UNLCK)))
|
||||||
{
|
{
|
||||||
error_code=error;
|
error_code=error;
|
||||||
print_lock_error(error_code, (*table)->file->table_type());
|
print_lock_error(error_code, (*table)->file->table_type());
|
||||||
|
|
130
sql/log.cc
130
sql/log.cc
|
@ -1041,6 +1041,12 @@ binlog_end_trans(THD *thd, binlog_trx_data *trx_data, Log_event *end_ev)
|
||||||
|
|
||||||
if (end_ev)
|
if (end_ev)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
We can always end the statement when ending a transaction since
|
||||||
|
transactions are not allowed inside stored functions. If they
|
||||||
|
were, we would have to ensure that we're not ending a statement
|
||||||
|
inside a stored function.
|
||||||
|
*/
|
||||||
thd->binlog_flush_pending_rows_event(true);
|
thd->binlog_flush_pending_rows_event(true);
|
||||||
error= mysql_bin_log.write(thd, trans_log, end_ev);
|
error= mysql_bin_log.write(thd, trans_log, end_ev);
|
||||||
}
|
}
|
||||||
|
@ -1060,7 +1066,7 @@ binlog_end_trans(THD *thd, binlog_trx_data *trx_data, Log_event *end_ev)
|
||||||
generated instead of the one that was written to the thrown-away
|
generated instead of the one that was written to the thrown-away
|
||||||
transaction cache.
|
transaction cache.
|
||||||
*/
|
*/
|
||||||
++mysql_bin_log.m_table_map_version;
|
mysql_bin_log.update_table_map_version();
|
||||||
|
|
||||||
statistic_increment(binlog_cache_use, &LOCK_status);
|
statistic_increment(binlog_cache_use, &LOCK_status);
|
||||||
if (trans_log->disk_writes != 0)
|
if (trans_log->disk_writes != 0)
|
||||||
|
@ -2598,6 +2604,38 @@ int THD::binlog_setup_trx_data()
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int THD::binlog_write_table_map(TABLE *table, bool is_trans)
|
||||||
|
{
|
||||||
|
DBUG_ENTER("THD::binlog_write_table_map");
|
||||||
|
DBUG_PRINT("enter", ("table=%p (%s: #%u)",
|
||||||
|
table, table->s->table_name, table->s->table_map_id));
|
||||||
|
|
||||||
|
/* Pre-conditions */
|
||||||
|
DBUG_ASSERT(binlog_row_based && mysql_bin_log.is_open());
|
||||||
|
DBUG_ASSERT(table->s->table_map_id != ULONG_MAX);
|
||||||
|
|
||||||
|
Table_map_log_event::flag_set const
|
||||||
|
flags= Table_map_log_event::TM_NO_FLAGS;
|
||||||
|
|
||||||
|
Table_map_log_event
|
||||||
|
the_event(this, table, table->s->table_map_id, is_trans, flags);
|
||||||
|
|
||||||
|
/*
|
||||||
|
This function is called from ha_external_lock() after the storage
|
||||||
|
engine has registered for the transaction.
|
||||||
|
*/
|
||||||
|
if (is_trans)
|
||||||
|
trans_register_ha(this, options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN),
|
||||||
|
&binlog_hton);
|
||||||
|
|
||||||
|
if (int error= mysql_bin_log.write(&the_event))
|
||||||
|
DBUG_RETURN(error);
|
||||||
|
|
||||||
|
++binlog_table_maps;
|
||||||
|
table->s->table_map_version= mysql_bin_log.table_map_version();
|
||||||
|
DBUG_RETURN(0);
|
||||||
|
}
|
||||||
|
|
||||||
Rows_log_event*
|
Rows_log_event*
|
||||||
THD::binlog_get_pending_rows_event() const
|
THD::binlog_get_pending_rows_event() const
|
||||||
{
|
{
|
||||||
|
@ -2615,8 +2653,12 @@ THD::binlog_get_pending_rows_event() const
|
||||||
void
|
void
|
||||||
THD::binlog_set_pending_rows_event(Rows_log_event* ev)
|
THD::binlog_set_pending_rows_event(Rows_log_event* ev)
|
||||||
{
|
{
|
||||||
|
if (ha_data[binlog_hton.slot] == NULL)
|
||||||
|
binlog_setup_trx_data();
|
||||||
|
|
||||||
binlog_trx_data *const trx_data=
|
binlog_trx_data *const trx_data=
|
||||||
(binlog_trx_data*) ha_data[binlog_hton.slot];
|
(binlog_trx_data*) ha_data[binlog_hton.slot];
|
||||||
|
|
||||||
DBUG_ASSERT(trx_data);
|
DBUG_ASSERT(trx_data);
|
||||||
trx_data->pending= ev;
|
trx_data->pending= ev;
|
||||||
}
|
}
|
||||||
|
@ -2640,6 +2682,8 @@ int MYSQL_LOG::flush_and_set_pending_rows_event(THD *thd, Rows_log_event* event)
|
||||||
|
|
||||||
DBUG_ASSERT(trx_data);
|
DBUG_ASSERT(trx_data);
|
||||||
|
|
||||||
|
DBUG_PRINT("info", ("trx_data->pending=%p", trx_data->pending));
|
||||||
|
|
||||||
if (Rows_log_event* pending= trx_data->pending)
|
if (Rows_log_event* pending= trx_data->pending)
|
||||||
{
|
{
|
||||||
IO_CACHE *file= &log_file;
|
IO_CACHE *file= &log_file;
|
||||||
|
@ -2659,15 +2703,6 @@ int MYSQL_LOG::flush_and_set_pending_rows_event(THD *thd, Rows_log_event* event)
|
||||||
*/
|
*/
|
||||||
pthread_mutex_lock(&LOCK_log);
|
pthread_mutex_lock(&LOCK_log);
|
||||||
|
|
||||||
/*
|
|
||||||
Write a table map if necessary
|
|
||||||
*/
|
|
||||||
if (pending->maybe_write_table_map(thd, file, this))
|
|
||||||
{
|
|
||||||
pthread_mutex_unlock(&LOCK_log);
|
|
||||||
DBUG_RETURN(2);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Write pending event to log file or transaction cache
|
Write pending event to log file or transaction cache
|
||||||
*/
|
*/
|
||||||
|
@ -2709,18 +2744,8 @@ int MYSQL_LOG::flush_and_set_pending_rows_event(THD *thd, Rows_log_event* event)
|
||||||
|
|
||||||
pthread_mutex_unlock(&LOCK_log);
|
pthread_mutex_unlock(&LOCK_log);
|
||||||
}
|
}
|
||||||
else if (event && event->get_cache_stmt()) /* && pending == 0 */
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
If we are setting a non-null event for a table that is
|
|
||||||
transactional, we start a transaction here as well.
|
|
||||||
*/
|
|
||||||
trans_register_ha(thd,
|
|
||||||
thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN),
|
|
||||||
&binlog_hton);
|
|
||||||
}
|
|
||||||
|
|
||||||
trx_data->pending= event;
|
thd->binlog_set_pending_rows_event(event);
|
||||||
|
|
||||||
DBUG_RETURN(error);
|
DBUG_RETURN(error);
|
||||||
}
|
}
|
||||||
|
@ -2752,21 +2777,13 @@ bool MYSQL_LOG::write(Log_event *event_info)
|
||||||
mutex, we do this before aquiring the LOCK_log mutex in this
|
mutex, we do this before aquiring the LOCK_log mutex in this
|
||||||
function.
|
function.
|
||||||
|
|
||||||
This is not optimal, but necessary in the current implementation
|
We only end the statement if we are in a top-level statement. If
|
||||||
since there is code that writes rows to system tables without
|
we are inside a stored function, we do not end the statement since
|
||||||
using some way to flush the pending event (e.g., binlog_query()).
|
this will close all tables on the slave.
|
||||||
|
|
||||||
TODO: There shall be no writes to any system table after calling
|
|
||||||
binlog_query(), so these writes has to be moved to before the call
|
|
||||||
of binlog_query() for correct functioning.
|
|
||||||
|
|
||||||
This is necessesary not only for RBR, but the master might crash
|
|
||||||
after binlogging the query but before changing the system tables.
|
|
||||||
This means that the slave and the master are not in the same state
|
|
||||||
(after the master has restarted), so therefore we have to
|
|
||||||
eliminate this problem.
|
|
||||||
*/
|
*/
|
||||||
thd->binlog_flush_pending_rows_event(true);
|
bool const end_stmt=
|
||||||
|
thd->prelocked_mode && thd->lex->requires_prelocking();
|
||||||
|
thd->binlog_flush_pending_rows_event(end_stmt);
|
||||||
|
|
||||||
pthread_mutex_lock(&LOCK_log);
|
pthread_mutex_lock(&LOCK_log);
|
||||||
|
|
||||||
|
@ -2789,8 +2806,9 @@ bool MYSQL_LOG::write(Log_event *event_info)
|
||||||
(!binlog_filter->db_ok(local_db)))
|
(!binlog_filter->db_ok(local_db)))
|
||||||
{
|
{
|
||||||
VOID(pthread_mutex_unlock(&LOCK_log));
|
VOID(pthread_mutex_unlock(&LOCK_log));
|
||||||
DBUG_PRINT("info",("db_ok('%s')==%d", local_db,
|
DBUG_PRINT("info",("OPTION_BIN_LOG is %s, db_ok('%s') == %d",
|
||||||
binlog_filter->db_ok(local_db)));
|
(thd->options & OPTION_BIN_LOG) ? "set" : "clear",
|
||||||
|
local_db, binlog_filter->db_ok(local_db)));
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
#endif /* HAVE_REPLICATION */
|
#endif /* HAVE_REPLICATION */
|
||||||
|
@ -3508,44 +3526,6 @@ void MYSQL_LOG::signal_update()
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef MYSQL_CLIENT
|
|
||||||
bool MYSQL_LOG::write_table_map(THD *thd, IO_CACHE *file, TABLE* table,
|
|
||||||
bool is_transactional)
|
|
||||||
{
|
|
||||||
DBUG_ENTER("MYSQL_LOG::write_table_map()");
|
|
||||||
DBUG_PRINT("enter", ("table=%p (%s: %u)",
|
|
||||||
table, table->s->table_name, table->s->table_map_id));
|
|
||||||
|
|
||||||
/* Pre-conditions */
|
|
||||||
DBUG_ASSERT(binlog_row_based && is_open());
|
|
||||||
DBUG_ASSERT(table->s->table_map_id != ULONG_MAX);
|
|
||||||
|
|
||||||
#ifndef DBUG_OFF
|
|
||||||
/*
|
|
||||||
We only need to execute under the LOCK_log mutex if we are writing
|
|
||||||
to the log file; otherwise, we are writing to a thread-specific
|
|
||||||
transaction cache and there is no need to serialize this event
|
|
||||||
with events in other threads.
|
|
||||||
*/
|
|
||||||
if (file == &log_file)
|
|
||||||
safe_mutex_assert_owner(&LOCK_log);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
Table_map_log_event::flag_set const
|
|
||||||
flags= Table_map_log_event::TM_NO_FLAGS;
|
|
||||||
|
|
||||||
Table_map_log_event
|
|
||||||
the_event(thd, table, table->s->table_map_id, is_transactional, flags);
|
|
||||||
|
|
||||||
if (the_event.write(file))
|
|
||||||
DBUG_RETURN(1);
|
|
||||||
|
|
||||||
table->s->table_map_version= m_table_map_version;
|
|
||||||
DBUG_RETURN(0);
|
|
||||||
}
|
|
||||||
#endif /* !defined(MYSQL_CLIENT) */
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __NT__
|
#ifdef __NT__
|
||||||
void print_buffer_to_nt_eventlog(enum loglevel level, char *buff,
|
void print_buffer_to_nt_eventlog(enum loglevel level, char *buff,
|
||||||
uint length, int buffLen)
|
uint length, int buffLen)
|
||||||
|
|
11
sql/log.h
11
sql/log.h
|
@ -203,9 +203,11 @@ class MYSQL_LOG: public TC_LOG
|
||||||
bool no_auto_events;
|
bool no_auto_events;
|
||||||
friend class Log_event;
|
friend class Log_event;
|
||||||
|
|
||||||
public:
|
|
||||||
ulonglong m_table_map_version;
|
ulonglong m_table_map_version;
|
||||||
|
|
||||||
|
int write_to_file(IO_CACHE *cache);
|
||||||
|
|
||||||
|
public:
|
||||||
/*
|
/*
|
||||||
These describe the log's format. This is used only for relay logs.
|
These describe the log's format. This is used only for relay logs.
|
||||||
_for_exec is used by the SQL thread, _for_queue by the I/O thread. It's
|
_for_exec is used by the SQL thread, _for_queue by the I/O thread. It's
|
||||||
|
@ -232,9 +234,12 @@ public:
|
||||||
#if !defined(MYSQL_CLIENT)
|
#if !defined(MYSQL_CLIENT)
|
||||||
bool is_table_mapped(TABLE *table) const
|
bool is_table_mapped(TABLE *table) const
|
||||||
{
|
{
|
||||||
return table->s->table_map_version == m_table_map_version;
|
return table->s->table_map_version == table_map_version();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ulonglong table_map_version() const { return m_table_map_version; }
|
||||||
|
void update_table_map_version() { ++m_table_map_version; }
|
||||||
|
|
||||||
int flush_and_set_pending_rows_event(THD *thd, Rows_log_event* event);
|
int flush_and_set_pending_rows_event(THD *thd, Rows_log_event* event);
|
||||||
|
|
||||||
#endif /* !defined(MYSQL_CLIENT) */
|
#endif /* !defined(MYSQL_CLIENT) */
|
||||||
|
@ -302,8 +307,6 @@ public:
|
||||||
bool write(Log_event* event_info); // binary log write
|
bool write(Log_event* event_info); // binary log write
|
||||||
bool write(THD *thd, IO_CACHE *cache, Log_event *commit_event);
|
bool write(THD *thd, IO_CACHE *cache, Log_event *commit_event);
|
||||||
|
|
||||||
bool write_table_map(THD *thd, IO_CACHE *cache, TABLE *table, bool is_trans);
|
|
||||||
|
|
||||||
void start_union_events(THD *thd);
|
void start_union_events(THD *thd);
|
||||||
void stop_union_events(THD *thd);
|
void stop_union_events(THD *thd);
|
||||||
bool is_query_in_union(THD *thd, query_id_t query_id_param);
|
bool is_query_in_union(THD *thd, query_id_t query_id_param);
|
||||||
|
|
429
sql/log_event.cc
429
sql/log_event.cc
|
@ -1685,6 +1685,7 @@ int Query_log_event::exec_event(struct st_relay_log_info* rli, const char *query
|
||||||
DBUG_PRINT("info", ("log_pos: %lu", (ulong) log_pos));
|
DBUG_PRINT("info", ("log_pos: %lu", (ulong) log_pos));
|
||||||
|
|
||||||
clear_all_errors(thd, rli);
|
clear_all_errors(thd, rli);
|
||||||
|
rli->clear_tables_to_lock();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Note: We do not need to execute reset_one_shot_variables() if this
|
Note: We do not need to execute reset_one_shot_variables() if this
|
||||||
|
@ -5063,17 +5064,19 @@ char* sql_ex_info::init(char* buf,char* buf_end,bool use_new_format)
|
||||||
Rows_log_event::Rows_log_event(THD *thd_arg, TABLE *tbl_arg, ulong tid,
|
Rows_log_event::Rows_log_event(THD *thd_arg, TABLE *tbl_arg, ulong tid,
|
||||||
MY_BITMAP const *cols, bool is_transactional)
|
MY_BITMAP const *cols, bool is_transactional)
|
||||||
: Log_event(thd_arg, 0, is_transactional),
|
: Log_event(thd_arg, 0, is_transactional),
|
||||||
|
m_row_count(0),
|
||||||
m_table(tbl_arg),
|
m_table(tbl_arg),
|
||||||
m_table_id(tid),
|
m_table_id(tid),
|
||||||
m_width(tbl_arg->s->fields),
|
m_width(tbl_arg ? tbl_arg->s->fields : 1),
|
||||||
m_rows_buf((byte*)my_malloc(opt_binlog_rows_event_max_size *
|
m_rows_buf(0), m_rows_cur(0), m_rows_end(0),
|
||||||
sizeof(*m_rows_buf), MYF(MY_WME))),
|
|
||||||
m_rows_cur(m_rows_buf),
|
|
||||||
m_rows_end(m_rows_buf + opt_binlog_rows_event_max_size),
|
|
||||||
m_flags(0)
|
m_flags(0)
|
||||||
{
|
{
|
||||||
DBUG_ASSERT(m_table && m_table->s);
|
/*
|
||||||
DBUG_ASSERT(m_table_id != ULONG_MAX);
|
We allow a special form of dummy event when the table, and cols
|
||||||
|
are null and the table id is ULONG_MAX.
|
||||||
|
*/
|
||||||
|
DBUG_ASSERT(tbl_arg && tbl_arg->s && tid != ULONG_MAX ||
|
||||||
|
!tbl_arg && !cols && tid == ULONG_MAX);
|
||||||
|
|
||||||
if (thd_arg->options & OPTION_NO_FOREIGN_KEY_CHECKS)
|
if (thd_arg->options & OPTION_NO_FOREIGN_KEY_CHECKS)
|
||||||
set_flags(NO_FOREIGN_KEY_CHECKS_F);
|
set_flags(NO_FOREIGN_KEY_CHECKS_F);
|
||||||
|
@ -5084,7 +5087,11 @@ Rows_log_event::Rows_log_event(THD *thd_arg, TABLE *tbl_arg, ulong tid,
|
||||||
m_width <= sizeof(m_bitbuf)*8 ? m_bitbuf : NULL,
|
m_width <= sizeof(m_bitbuf)*8 ? m_bitbuf : NULL,
|
||||||
(m_width + 7) & ~7UL,
|
(m_width + 7) & ~7UL,
|
||||||
false)))
|
false)))
|
||||||
memcpy(m_cols.bitmap, cols->bitmap, no_bytes_in_map(cols));
|
{
|
||||||
|
/* Cols can be zero if this is a dummy binrows event */
|
||||||
|
if (likely(cols != NULL))
|
||||||
|
memcpy(m_cols.bitmap, cols->bitmap, no_bytes_in_map(cols));
|
||||||
|
}
|
||||||
else
|
else
|
||||||
m_cols.bitmap= 0; // to not free it
|
m_cols.bitmap= 0; // to not free it
|
||||||
}
|
}
|
||||||
|
@ -5095,6 +5102,7 @@ Rows_log_event::Rows_log_event(const char *buf, uint event_len,
|
||||||
const Format_description_log_event
|
const Format_description_log_event
|
||||||
*description_event)
|
*description_event)
|
||||||
: Log_event(buf, description_event),
|
: Log_event(buf, description_event),
|
||||||
|
m_row_count(0),
|
||||||
m_rows_buf(0), m_rows_cur(0), m_rows_end(0)
|
m_rows_buf(0), m_rows_cur(0), m_rows_end(0)
|
||||||
{
|
{
|
||||||
DBUG_ENTER("Rows_log_event::Rows_log_event(const char*,...)");
|
DBUG_ENTER("Rows_log_event::Rows_log_event(const char*,...)");
|
||||||
|
@ -5120,8 +5128,6 @@ Rows_log_event::Rows_log_event(const char *buf, uint event_len,
|
||||||
post_start+= RW_FLAGS_OFFSET;
|
post_start+= RW_FLAGS_OFFSET;
|
||||||
}
|
}
|
||||||
|
|
||||||
DBUG_ASSERT(m_table_id != ULONG_MAX);
|
|
||||||
|
|
||||||
m_flags= uint2korr(post_start);
|
m_flags= uint2korr(post_start);
|
||||||
|
|
||||||
byte const *const var_start= (const byte *)buf + common_header_len +
|
byte const *const var_start= (const byte *)buf + common_header_len +
|
||||||
|
@ -5178,7 +5184,7 @@ int Rows_log_event::do_add_row_data(byte *const row_data,
|
||||||
DBUG_DUMP("row_data", (const char*)row_data, min(length, 32));
|
DBUG_DUMP("row_data", (const char*)row_data, min(length, 32));
|
||||||
|
|
||||||
DBUG_ASSERT(m_rows_buf <= m_rows_cur);
|
DBUG_ASSERT(m_rows_buf <= m_rows_cur);
|
||||||
DBUG_ASSERT(m_rows_buf < m_rows_end);
|
DBUG_ASSERT(!m_rows_buf || m_rows_end && m_rows_buf < m_rows_end);
|
||||||
DBUG_ASSERT(m_rows_cur <= m_rows_end);
|
DBUG_ASSERT(m_rows_cur <= m_rows_end);
|
||||||
|
|
||||||
/* The cast will always work since m_rows_cur <= m_rows_end */
|
/* The cast will always work since m_rows_cur <= m_rows_end */
|
||||||
|
@ -5186,12 +5192,12 @@ int Rows_log_event::do_add_row_data(byte *const row_data,
|
||||||
{
|
{
|
||||||
my_size_t const block_size= 1024;
|
my_size_t const block_size= 1024;
|
||||||
my_ptrdiff_t const old_alloc= m_rows_end - m_rows_buf;
|
my_ptrdiff_t const old_alloc= m_rows_end - m_rows_buf;
|
||||||
my_ptrdiff_t const new_alloc=
|
|
||||||
old_alloc + block_size * (length / block_size + block_size - 1);
|
|
||||||
my_ptrdiff_t const cur_size= m_rows_cur - m_rows_buf;
|
my_ptrdiff_t const cur_size= m_rows_cur - m_rows_buf;
|
||||||
|
my_ptrdiff_t const new_alloc=
|
||||||
|
block_size * ((cur_size + length) / block_size + block_size - 1);
|
||||||
|
|
||||||
byte* const new_buf=
|
byte* const new_buf= (byte*)my_realloc((gptr)m_rows_buf, new_alloc,
|
||||||
(byte*)my_realloc((gptr)m_rows_buf, new_alloc, MYF(MY_WME));
|
MYF(MY_ALLOW_ZERO_PTR|MY_WME));
|
||||||
if (unlikely(!new_buf))
|
if (unlikely(!new_buf))
|
||||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||||
|
|
||||||
|
@ -5212,6 +5218,7 @@ int Rows_log_event::do_add_row_data(byte *const row_data,
|
||||||
DBUG_ASSERT(m_rows_cur + length < m_rows_end);
|
DBUG_ASSERT(m_rows_cur + length < m_rows_end);
|
||||||
memcpy(m_rows_cur, row_data, length);
|
memcpy(m_rows_cur, row_data, length);
|
||||||
m_rows_cur+= length;
|
m_rows_cur+= length;
|
||||||
|
m_row_count++;
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -5255,10 +5262,29 @@ static char const *unpack_row(TABLE *table,
|
||||||
int Rows_log_event::exec_event(st_relay_log_info *rli)
|
int Rows_log_event::exec_event(st_relay_log_info *rli)
|
||||||
{
|
{
|
||||||
DBUG_ENTER("Rows_log_event::exec_event(st_relay_log_info*)");
|
DBUG_ENTER("Rows_log_event::exec_event(st_relay_log_info*)");
|
||||||
DBUG_ASSERT(m_table_id != ULONG_MAX);
|
|
||||||
int error= 0;
|
int error= 0;
|
||||||
char const *row_start= (char const *)m_rows_buf;
|
char const *row_start= (char const *)m_rows_buf;
|
||||||
TABLE* table= rli->m_table_map.get_table(m_table_id);
|
|
||||||
|
/*
|
||||||
|
If m_table_id == ULONG_MAX, then we have a dummy event that does
|
||||||
|
not contain any data. In that case, we just remove all tables in
|
||||||
|
the tables_to_lock list, close the thread tables, step the relay
|
||||||
|
log position, and return with success.
|
||||||
|
*/
|
||||||
|
if (m_table_id == ULONG_MAX)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
This one is supposed to be set: just an extra check so that
|
||||||
|
nothing strange has happened.
|
||||||
|
*/
|
||||||
|
DBUG_ASSERT(get_flags(STMT_END_F));
|
||||||
|
|
||||||
|
rli->clear_tables_to_lock();
|
||||||
|
close_thread_tables(thd);
|
||||||
|
thd->clear_error();
|
||||||
|
rli->inc_event_relay_log_pos();
|
||||||
|
DBUG_RETURN(0);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
'thd' has been set by exec_relay_log_event(), just before calling
|
'thd' has been set by exec_relay_log_event(), just before calling
|
||||||
|
@ -5267,85 +5293,51 @@ int Rows_log_event::exec_event(st_relay_log_info *rli)
|
||||||
DBUG_ASSERT(rli->sql_thd == thd);
|
DBUG_ASSERT(rli->sql_thd == thd);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
lock_tables() reads the contents of thd->lex, so they must be
|
If there is no locks taken, this is the first binrow event seen
|
||||||
initialized, so we should call lex_start(); to be even safer, we call
|
after the table map events. We should then lock all the tables
|
||||||
mysql_init_query() which does a more complete set of inits.
|
used in the transaction and proceed with execution of the actual
|
||||||
|
event.
|
||||||
*/
|
*/
|
||||||
mysql_init_query(thd, NULL, 0);
|
if (!thd->lock)
|
||||||
|
|
||||||
if (table)
|
|
||||||
{
|
{
|
||||||
|
bool need_reopen= 1; /* To execute the first lap of the loop below */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
table == NULL means that this table should not be
|
lock_tables() reads the contents of thd->lex, so they must be
|
||||||
replicated (this was set up by Table_map_log_event::exec_event() which
|
initialized, so we should call lex_start(); to be even safer, we
|
||||||
tested replicate-* rules).
|
call mysql_init_query() which does a more complete set of inits.
|
||||||
*/
|
*/
|
||||||
TABLE_LIST table_list;
|
mysql_init_query(thd, NULL, 0);
|
||||||
bool need_reopen;
|
|
||||||
uint count= 1;
|
|
||||||
bzero(&table_list, sizeof(table_list));
|
|
||||||
table_list.lock_type= TL_WRITE;
|
|
||||||
table_list.next_global= table_list.next_local= 0;
|
|
||||||
table_list.table= table;
|
|
||||||
|
|
||||||
for ( ; ; )
|
while ((error= lock_tables(thd, rli->tables_to_lock,
|
||||||
|
rli->tables_to_lock_count, &need_reopen)))
|
||||||
{
|
{
|
||||||
table_list.db= const_cast<char*>(table->s->db.str);
|
|
||||||
table_list.alias= table_list.table_name=
|
|
||||||
const_cast<char*>(table->s->table_name.str);
|
|
||||||
|
|
||||||
if ((error= lock_tables(thd, &table_list, count, &need_reopen)) == 0)
|
|
||||||
break;
|
|
||||||
if (!need_reopen)
|
if (!need_reopen)
|
||||||
{
|
{
|
||||||
slave_print_msg(ERROR_LEVEL, rli, error,
|
slave_print_msg(ERROR_LEVEL, rli, error,
|
||||||
"Error in %s event: error during table %s.%s lock",
|
"Error in %s event: when locking tables",
|
||||||
get_type_str(), table->s->db.str,
|
get_type_str());
|
||||||
table->s->table_name.str);
|
|
||||||
DBUG_RETURN(error);
|
DBUG_RETURN(error);
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
we need to store a local copy of the table names since the table object
|
|
||||||
will become invalid after close_tables_for_reopen
|
|
||||||
*/
|
|
||||||
char *db= my_strdup(table->s->db.str, MYF(MY_WME));
|
|
||||||
char *table_name= my_strdup(table->s->table_name.str, MYF(MY_WME));
|
|
||||||
|
|
||||||
if (db == 0 || table_name == 0)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
Since the lock_tables() failed, the table is not locked, so
|
|
||||||
we don't need to unlock them.
|
|
||||||
*/
|
|
||||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
We also needs to flush the pending RBR event, since it keeps a
|
So we need to reopen the tables.
|
||||||
pointer to an open table.
|
|
||||||
|
|
||||||
ALTERNATIVE SOLUTION: Extract a pointer to the pending RBR
|
We need to flush the pending RBR event, since it keeps a
|
||||||
event and reset the table pointer after the tables has been
|
pointer to an open table.
|
||||||
reopened.
|
|
||||||
|
ALTERNATIVE SOLUTION (not implemented): Extract a pointer to
|
||||||
|
the pending RBR event and reset the table pointer after the
|
||||||
|
tables has been reopened.
|
||||||
|
|
||||||
|
NOTE: For this new scheme there should be no pending event:
|
||||||
|
need to add code to assert that is the case.
|
||||||
*/
|
*/
|
||||||
thd->binlog_flush_pending_rows_event(false);
|
thd->binlog_flush_pending_rows_event(false);
|
||||||
|
close_tables_for_reopen(thd, rli->tables_to_lock);
|
||||||
|
|
||||||
close_tables_for_reopen(thd, &table_list);
|
if ((error= open_tables(thd, &rli->tables_to_lock,
|
||||||
|
&rli->tables_to_lock_count, 0)))
|
||||||
/* open the table again, same as in Table_map_event::exec_event */
|
|
||||||
table_list.db= const_cast<char*>(db);
|
|
||||||
table_list.alias= table_list.table_name= const_cast<char*>(table_name);
|
|
||||||
table_list.updating= 1;
|
|
||||||
TABLE_LIST *tables= &table_list;
|
|
||||||
if ((error= open_tables(thd, &tables, &count, 0)) == 0)
|
|
||||||
{
|
|
||||||
/* reset some variables for the table list*/
|
|
||||||
table_list.updating= 0;
|
|
||||||
/* retrieve the new table reference and update the table map */
|
|
||||||
table= table_list.table;
|
|
||||||
error= rli->m_table_map.set_table(m_table_id, table);
|
|
||||||
}
|
|
||||||
else /* error in open_tables */
|
|
||||||
{
|
{
|
||||||
if (thd->query_error || thd->is_fatal_error)
|
if (thd->query_error || thd->is_fatal_error)
|
||||||
{
|
{
|
||||||
|
@ -5355,19 +5347,41 @@ int Rows_log_event::exec_event(st_relay_log_info *rli)
|
||||||
*/
|
*/
|
||||||
uint actual_error= thd->net.last_errno;
|
uint actual_error= thd->net.last_errno;
|
||||||
slave_print_msg(ERROR_LEVEL, rli, actual_error,
|
slave_print_msg(ERROR_LEVEL, rli, actual_error,
|
||||||
"Error '%s' on reopening table `%s`.`%s`",
|
"Error '%s' on reopening tables",
|
||||||
(actual_error ? thd->net.last_error :
|
(actual_error ? thd->net.last_error :
|
||||||
"unexpected success or fatal error"),
|
"unexpected success or fatal error"));
|
||||||
db, table_name);
|
|
||||||
thd->query_error= 1;
|
thd->query_error= 1;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
my_free((char*) db, MYF(MY_ALLOW_ZERO_PTR));
|
|
||||||
my_free((char*) table_name, MYF(MY_ALLOW_ZERO_PTR));
|
|
||||||
|
|
||||||
if (error)
|
|
||||||
DBUG_RETURN(error);
|
DBUG_RETURN(error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
When the open and locking succeeded, we add all the tables to
|
||||||
|
the table map and remove them from tables to lock.
|
||||||
|
*/
|
||||||
|
|
||||||
|
TABLE_LIST *ptr= rli->tables_to_lock;
|
||||||
|
while (ptr)
|
||||||
|
{
|
||||||
|
rli->m_table_map.set_table(ptr->table_id, ptr->table);
|
||||||
|
rli->touching_table(ptr->db, ptr->table_name, ptr->table_id);
|
||||||
|
char *to_free= reinterpret_cast<char*>(ptr);
|
||||||
|
ptr= ptr->next_global;
|
||||||
|
my_free(to_free, MYF(MY_WME));
|
||||||
|
}
|
||||||
|
rli->tables_to_lock= 0;
|
||||||
|
rli->tables_to_lock_count= 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
TABLE* table= rli->m_table_map.get_table(m_table_id);
|
||||||
|
|
||||||
|
if (table)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
table == NULL means that this table should not be replicated
|
||||||
|
(this was set up by Table_map_log_event::exec_event() which
|
||||||
|
tested replicate-* rules).
|
||||||
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
It's not needed to set_time() but
|
It's not needed to set_time() but
|
||||||
|
@ -5401,12 +5415,16 @@ int Rows_log_event::exec_event(st_relay_log_info *rli)
|
||||||
DBUG_ASSERT(row_end != NULL); // cannot happen
|
DBUG_ASSERT(row_end != NULL); // cannot happen
|
||||||
DBUG_ASSERT(row_end <= (const char*)m_rows_end);
|
DBUG_ASSERT(row_end <= (const char*)m_rows_end);
|
||||||
|
|
||||||
|
#if 0
|
||||||
/* in_use can have been set to NULL in close_tables_for_reopen */
|
/* in_use can have been set to NULL in close_tables_for_reopen */
|
||||||
THD* old_thd= table->in_use;
|
THD* old_thd= table->in_use;
|
||||||
if (!table->in_use)
|
if (!table->in_use)
|
||||||
table->in_use= thd;
|
table->in_use= thd;
|
||||||
|
#endif
|
||||||
error= do_exec_row(table);
|
error= do_exec_row(table);
|
||||||
|
#if 0
|
||||||
table->in_use = old_thd;
|
table->in_use = old_thd;
|
||||||
|
#endif
|
||||||
switch (error)
|
switch (error)
|
||||||
{
|
{
|
||||||
/* Some recoverable errors */
|
/* Some recoverable errors */
|
||||||
|
@ -5520,52 +5538,25 @@ int Rows_log_event::exec_event(st_relay_log_info *rli)
|
||||||
DBUG_RETURN(error);
|
DBUG_RETURN(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (table)
|
if (table && (table->s->primary_key == MAX_KEY) && !cache_stmt)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
As "table" is not NULL, we did a successful lock_tables(), without any
|
------------ Temporary fix until WL#2975 is implemented ---------
|
||||||
prior LOCK TABLES and are not in prelocked mode, so this assertion should
|
|
||||||
be true.
|
This event is not the last one (no STMT_END_F). If we stop now
|
||||||
|
(in case of terminate_slave_thread()), how will we restart? We
|
||||||
|
have to restart from Table_map_log_event, but as this table is
|
||||||
|
not transactional, the rows already inserted will still be
|
||||||
|
present, and idempotency is not guaranteed (no PK) so we risk
|
||||||
|
that repeating leads to double insert. So we desperately try to
|
||||||
|
continue, hope we'll eventually leave this buggy situation (by
|
||||||
|
executing the final Rows_log_event). If we are in a hopeless
|
||||||
|
wait (reached end of last relay log and nothing gets appended
|
||||||
|
there), we timeout after one minute, and notify DBA about the
|
||||||
|
problem. When WL#2975 is implemented, just remove the member
|
||||||
|
st_relay_log_info::unsafe_to_stop_at and all its occurences.
|
||||||
*/
|
*/
|
||||||
DBUG_ASSERT(thd->lock);
|
rli->unsafe_to_stop_at= time(0);
|
||||||
/*
|
|
||||||
If we are here, there are more events to come which may use our mappings
|
|
||||||
and our table. So don't clear mappings or close tables, just unlock
|
|
||||||
tables.
|
|
||||||
Why don't we lock the table once for all in
|
|
||||||
Table_map_log_event::exec_event() ? Because we could have in binlog:
|
|
||||||
BEGIN;
|
|
||||||
Table_map t1 -> 1
|
|
||||||
Write_rows to id 1
|
|
||||||
Table_map t2 -> 2
|
|
||||||
Write_rows to id 2
|
|
||||||
Xid_log_event
|
|
||||||
So we cannot lock t1 when executing the first Table_map, because at that
|
|
||||||
moment we don't know we'll also have to lock t2, and all tables must be
|
|
||||||
locked at once in MySQL.
|
|
||||||
*/
|
|
||||||
mysql_unlock_tables(thd, thd->lock);
|
|
||||||
thd->lock= 0;
|
|
||||||
if ((table->s->primary_key == MAX_KEY) &&
|
|
||||||
!cache_stmt)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
------------ Temporary fix until WL#2975 is implemented ---------
|
|
||||||
This event is not the last one (no STMT_END_F). If we stop now (in
|
|
||||||
case of terminate_slave_thread()), how will we restart? We have to
|
|
||||||
restart from Table_map_log_event, but as this table is not
|
|
||||||
transactional, the rows already inserted will still be present, and
|
|
||||||
idempotency is not guaranteed (no PK) so we risk that repeating leads
|
|
||||||
to double insert. So we desperately try to continue, hope we'll
|
|
||||||
eventually leave this buggy situation (by executing the final
|
|
||||||
Rows_log_event). If we are in a hopeless wait (reached end of last
|
|
||||||
relay log and nothing gets appended there), we timeout after one
|
|
||||||
minute, and notify DBA about the problem.
|
|
||||||
When WL#2975 is implemented, just remove the member
|
|
||||||
st_relay_log_info::unsafe_to_stop_at and all its occurences.
|
|
||||||
*/
|
|
||||||
rli->unsafe_to_stop_at= time(0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DBUG_ASSERT(error == 0);
|
DBUG_ASSERT(error == 0);
|
||||||
|
@ -5579,7 +5570,6 @@ int Rows_log_event::exec_event(st_relay_log_info *rli)
|
||||||
#ifndef MYSQL_CLIENT
|
#ifndef MYSQL_CLIENT
|
||||||
bool Rows_log_event::write_data_header(IO_CACHE *file)
|
bool Rows_log_event::write_data_header(IO_CACHE *file)
|
||||||
{
|
{
|
||||||
DBUG_ASSERT(m_table_id != ULONG_MAX);
|
|
||||||
byte buf[ROWS_HEADER_LEN]; // No need to init the buffer
|
byte buf[ROWS_HEADER_LEN]; // No need to init the buffer
|
||||||
DBUG_EXECUTE_IF("old_row_based_repl_4_byte_map_id_master",
|
DBUG_EXECUTE_IF("old_row_based_repl_4_byte_map_id_master",
|
||||||
{
|
{
|
||||||
|
@ -5611,16 +5601,15 @@ bool Rows_log_event::write_data_body(IO_CACHE*file)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT) && defined(DBUG_RBR)
|
#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
|
||||||
void Rows_log_event::pack_info(Protocol *protocol)
|
void Rows_log_event::pack_info(Protocol *protocol)
|
||||||
{
|
{
|
||||||
char buf[256];
|
char buf[256];
|
||||||
char const *const flagstr= get_flags(STMT_END_F) ? "STMT_END_F" : "";
|
char const *const flagstr=
|
||||||
char const *const dbnam= m_table->s->db.str;
|
get_flags(STMT_END_F) ? " flags: STMT_END_F" : "";
|
||||||
char const *const tblnam= m_table->s->table_name.str;
|
my_size_t bytes= snprintf(buf, sizeof(buf),
|
||||||
my_size_t bytes= snprintf(buf, sizeof(buf),
|
"table_id: %lu%s", m_table_id, flagstr);
|
||||||
"%s.%s - %s", dbnam, tblnam, flagstr);
|
protocol->store(buf, bytes, &my_charset_bin);
|
||||||
protocol->store(buf, bytes, &my_charset_bin);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -5763,59 +5752,6 @@ Table_map_log_event::~Table_map_log_event()
|
||||||
my_free(m_memory, MYF(MY_ALLOW_ZERO_PTR));
|
my_free(m_memory, MYF(MY_ALLOW_ZERO_PTR));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
Find a table based on database name and table name.
|
|
||||||
|
|
||||||
DESCRIPTION
|
|
||||||
|
|
||||||
Currently, only the first table of the 'table_list' is located. If the
|
|
||||||
table is found in the list of open tables for the thread, the 'table'
|
|
||||||
field of 'table_list' is filled in.
|
|
||||||
|
|
||||||
PARAMETERS
|
|
||||||
|
|
||||||
thd Thread structure
|
|
||||||
table_list List of tables to locate in the thd->open_tables list.
|
|
||||||
count Pointer to a variable that will be set to the number of
|
|
||||||
tables found. If the pointer is NULL, nothing will be stored.
|
|
||||||
|
|
||||||
RETURN VALUE
|
|
||||||
|
|
||||||
The number of tables found.
|
|
||||||
|
|
||||||
TO DO
|
|
||||||
|
|
||||||
Replace the list of table searches with a hash based on the combined
|
|
||||||
database and table name. The handler_tables_hash is inappropriate since
|
|
||||||
it hashes on the table alias. At the same time, the function can be
|
|
||||||
extended to handle a full list of table names, in the same spirit as
|
|
||||||
open_tables() and lock_tables().
|
|
||||||
*/
|
|
||||||
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
|
|
||||||
static uint find_tables(THD *thd, TABLE_LIST *table_list, uint *count)
|
|
||||||
{
|
|
||||||
uint result= 0;
|
|
||||||
|
|
||||||
/* we verify that the caller knows our limitation */
|
|
||||||
DBUG_ASSERT(table_list->next_global == 0);
|
|
||||||
for (TABLE *table= thd->open_tables; table ; table= table->next)
|
|
||||||
{
|
|
||||||
if (strcmp(table->s->db.str, table_list->db) == 0
|
|
||||||
&& strcmp(table->s->table_name.str, table_list->table_name) == 0)
|
|
||||||
{
|
|
||||||
/* Copy the table pointer into the table list. */
|
|
||||||
table_list->table= table;
|
|
||||||
result= 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (count)
|
|
||||||
*count= result;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Return value is an error code, one of:
|
Return value is an error code, one of:
|
||||||
|
|
||||||
|
@ -5839,20 +5775,37 @@ int Table_map_log_event::exec_event(st_relay_log_info *rli)
|
||||||
thd->query_id= next_query_id();
|
thd->query_id= next_query_id();
|
||||||
pthread_mutex_unlock(&LOCK_thread_count);
|
pthread_mutex_unlock(&LOCK_thread_count);
|
||||||
|
|
||||||
TABLE_LIST table_list;
|
TABLE_LIST *table_list;
|
||||||
|
char *db_mem, *tname_mem;
|
||||||
|
void *const memory=
|
||||||
|
my_multi_malloc(MYF(MY_WME),
|
||||||
|
&table_list, sizeof(TABLE_LIST),
|
||||||
|
&db_mem, NAME_LEN + 1,
|
||||||
|
&tname_mem, NAME_LEN + 1,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
/*
|
||||||
|
If memory is allocated, it the pointer to it should be stored in
|
||||||
|
table_list. If this is not true, the memory will not be correctly
|
||||||
|
free:ed later.
|
||||||
|
*/
|
||||||
|
DBUG_ASSERT(memory == NULL || memory == table_list);
|
||||||
|
|
||||||
uint32 dummy_len;
|
uint32 dummy_len;
|
||||||
bzero(&table_list, sizeof(table_list));
|
bzero(table_list, sizeof(*table_list));
|
||||||
table_list.db= const_cast<char *>
|
table_list->db = db_mem;
|
||||||
(rpl_filter->get_rewrite_db(m_dbnam, &dummy_len));
|
table_list->alias= table_list->table_name = tname_mem;
|
||||||
table_list.alias= table_list.table_name= const_cast<char*>(m_tblnam);
|
table_list->lock_type= TL_WRITE;
|
||||||
table_list.lock_type= TL_WRITE;
|
table_list->next_global= table_list->next_local= 0;
|
||||||
table_list.next_global= table_list.next_local= 0;
|
table_list->table_id= m_table_id;
|
||||||
table_list.updating= 1;
|
table_list->updating= 1;
|
||||||
|
strmov(table_list->db, rpl_filter->get_rewrite_db(m_dbnam, &dummy_len));
|
||||||
|
strmov(table_list->table_name, m_tblnam);
|
||||||
|
|
||||||
int error= 0;
|
int error= 0;
|
||||||
|
|
||||||
if (rpl_filter->db_ok(table_list.db) &&
|
if (rpl_filter->db_ok(table_list->db) &&
|
||||||
(!rpl_filter->is_on() || rpl_filter->tables_ok("", &table_list)))
|
(!rpl_filter->is_on() || rpl_filter->tables_ok("", table_list)))
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
Check if the slave is set to use SBR. If so, the slave should
|
Check if the slave is set to use SBR. If so, the slave should
|
||||||
|
@ -5878,36 +5831,32 @@ int Table_map_log_event::exec_event(st_relay_log_info *rli)
|
||||||
be a no-op.
|
be a no-op.
|
||||||
*/
|
*/
|
||||||
uint count;
|
uint count;
|
||||||
if (find_tables(thd, &table_list, &count) == 0)
|
/*
|
||||||
|
open_tables() reads the contents of thd->lex, so they must be
|
||||||
|
initialized, so we should call lex_start(); to be even safer, we
|
||||||
|
call mysql_init_query() which does a more complete set of inits.
|
||||||
|
*/
|
||||||
|
mysql_init_query(thd, NULL, 0);
|
||||||
|
if ((error= open_tables(thd, &table_list, &count, 0)))
|
||||||
{
|
{
|
||||||
/*
|
if (thd->query_error || thd->is_fatal_error)
|
||||||
open_tables() reads the contents of thd->lex, so they must be
|
|
||||||
initialized, so we should call lex_start(); to be even safer, we call
|
|
||||||
mysql_init_query() which does a more complete set of inits.
|
|
||||||
*/
|
|
||||||
mysql_init_query(thd, NULL, 0);
|
|
||||||
TABLE_LIST *tables= &table_list;
|
|
||||||
if ((error= open_tables(thd, &tables, &count, 0)))
|
|
||||||
{
|
{
|
||||||
if (thd->query_error || thd->is_fatal_error)
|
/*
|
||||||
{
|
Error reporting borrowed from Query_log_event with many excessive
|
||||||
/*
|
simplifications (we don't honour --slave-skip-errors)
|
||||||
Error reporting borrowed from Query_log_event with many excessive
|
*/
|
||||||
simplifications (we don't honour --slave-skip-errors)
|
uint actual_error= thd->net.last_errno;
|
||||||
*/
|
slave_print_msg(ERROR_LEVEL, rli, actual_error,
|
||||||
uint actual_error= thd->net.last_errno;
|
"Error '%s' on opening table `%s`.`%s`",
|
||||||
slave_print_msg(ERROR_LEVEL, rli, actual_error,
|
(actual_error ? thd->net.last_error :
|
||||||
"Error '%s' on opening table `%s`.`%s`",
|
"unexpected success or fatal error"),
|
||||||
(actual_error ? thd->net.last_error :
|
table_list->db, table_list->table_name);
|
||||||
"unexpected success or fatal error"),
|
thd->query_error= 1;
|
||||||
table_list.db, table_list.table_name);
|
|
||||||
thd->query_error= 1;
|
|
||||||
}
|
|
||||||
DBUG_RETURN(error);
|
|
||||||
}
|
}
|
||||||
|
DBUG_RETURN(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_table= table_list.table;
|
m_table= table_list->table;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
This will fail later otherwise, the 'in_use' field should be
|
This will fail later otherwise, the 'in_use' field should be
|
||||||
|
@ -5985,19 +5934,16 @@ int Table_map_log_event::exec_event(st_relay_log_info *rli)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
We record in the slave's information that the number m_table_id is
|
We record in the slave's information that the table should be
|
||||||
mapped to the m_table object
|
locked by linking the table into the list of tables to lock, and
|
||||||
|
tell the RLI that we are touching a table.
|
||||||
*/
|
*/
|
||||||
if (!error)
|
if (!error)
|
||||||
error= rli->m_table_map.set_table(m_table_id, m_table);
|
{
|
||||||
|
table_list->next_global= table_list->next_local= rli->tables_to_lock;
|
||||||
/*
|
rli->tables_to_lock= table_list;
|
||||||
Tell the RLI that we are touching a table.
|
rli->tables_to_lock_count++;
|
||||||
|
}
|
||||||
TODO: Maybe we can combine this with the previous operation?
|
|
||||||
*/
|
|
||||||
if (!error)
|
|
||||||
rli->touching_table(m_dbnam, m_tblnam, m_table_id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -6064,12 +6010,17 @@ bool Table_map_log_event::write_data_body(IO_CACHE *file)
|
||||||
field.
|
field.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
|
||||||
void Table_map_log_event::pack_info(Protocol *protocol)
|
void Table_map_log_event::pack_info(Protocol *protocol)
|
||||||
{
|
{
|
||||||
char buf[256];
|
char buf[256];
|
||||||
my_size_t bytes= my_snprintf(buf, sizeof(buf), "%s.%s", m_dbnam, m_tblnam);
|
my_size_t bytes= snprintf(buf, sizeof(buf),
|
||||||
|
"table_id: %lu (%s.%s)",
|
||||||
|
m_table_id, m_dbnam, m_tblnam);
|
||||||
protocol->store(buf, bytes, &my_charset_bin);
|
protocol->store(buf, bytes, &my_charset_bin);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -657,11 +657,16 @@ public:
|
||||||
{
|
{
|
||||||
return (void*) my_malloc((uint)size, MYF(MY_WME|MY_FAE));
|
return (void*) my_malloc((uint)size, MYF(MY_WME|MY_FAE));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void operator delete(void *ptr, size_t size)
|
static void operator delete(void *ptr, size_t size)
|
||||||
{
|
{
|
||||||
my_free((gptr) ptr, MYF(MY_WME|MY_ALLOW_ZERO_PTR));
|
my_free((gptr) ptr, MYF(MY_WME|MY_ALLOW_ZERO_PTR));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Placement version of the above operators */
|
||||||
|
static void *operator new(size_t, void* ptr) { return ptr; }
|
||||||
|
static void operator delete(void*, void*) { }
|
||||||
|
|
||||||
#ifndef MYSQL_CLIENT
|
#ifndef MYSQL_CLIENT
|
||||||
bool write_header(IO_CACHE* file, ulong data_length);
|
bool write_header(IO_CACHE* file, ulong data_length);
|
||||||
virtual bool write(IO_CACHE* file)
|
virtual bool write(IO_CACHE* file)
|
||||||
|
@ -1795,10 +1800,8 @@ public:
|
||||||
|
|
||||||
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
|
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
|
||||||
virtual int exec_event(struct st_relay_log_info *rli);
|
virtual int exec_event(struct st_relay_log_info *rli);
|
||||||
#ifdef DBUG_RBR
|
|
||||||
virtual void pack_info(Protocol *protocol);
|
virtual void pack_info(Protocol *protocol);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef MYSQL_CLIENT
|
#ifdef MYSQL_CLIENT
|
||||||
/* not for direct call, each derived has its own ::print() */
|
/* not for direct call, each derived has its own ::print() */
|
||||||
|
@ -1850,6 +1853,7 @@ public:
|
||||||
Error code, or zero if write succeeded.
|
Error code, or zero if write succeeded.
|
||||||
*/
|
*/
|
||||||
#if !defined(MYSQL_CLIENT) && defined(HAVE_ROW_BASED_REPLICATION)
|
#if !defined(MYSQL_CLIENT) && defined(HAVE_ROW_BASED_REPLICATION)
|
||||||
|
#if 0
|
||||||
int maybe_write_table_map(THD *thd, IO_CACHE *file, MYSQL_LOG *log) const
|
int maybe_write_table_map(THD *thd, IO_CACHE *file, MYSQL_LOG *log) const
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
|
@ -1864,6 +1868,9 @@ public:
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
uint m_row_count; /* The number of rows added to the event */
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -758,7 +758,8 @@ TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info,
|
||||||
List<create_field> *extra_fields,
|
List<create_field> *extra_fields,
|
||||||
List<Key> *keys,
|
List<Key> *keys,
|
||||||
List<Item> *items,
|
List<Item> *items,
|
||||||
MYSQL_LOCK **lock);
|
MYSQL_LOCK **lock,
|
||||||
|
TABLEOP_HOOKS *hooks);
|
||||||
bool mysql_alter_table(THD *thd, char *new_db, char *new_name,
|
bool mysql_alter_table(THD *thd, char *new_db, char *new_name,
|
||||||
HA_CREATE_INFO *create_info,
|
HA_CREATE_INFO *create_info,
|
||||||
TABLE_LIST *table_list,
|
TABLE_LIST *table_list,
|
||||||
|
|
|
@ -878,7 +878,7 @@ QUICK_RANGE_SELECT::~QUICK_RANGE_SELECT()
|
||||||
DBUG_PRINT("info", ("Freeing separate handler %p (free=%d)", file,
|
DBUG_PRINT("info", ("Freeing separate handler %p (free=%d)", file,
|
||||||
free_file));
|
free_file));
|
||||||
file->ha_reset();
|
file->ha_reset();
|
||||||
file->external_lock(current_thd, F_UNLCK);
|
file->ha_external_lock(current_thd, F_UNLCK);
|
||||||
file->close();
|
file->close();
|
||||||
delete file;
|
delete file;
|
||||||
}
|
}
|
||||||
|
@ -1042,14 +1042,14 @@ int QUICK_RANGE_SELECT::init_ror_merged_scan(bool reuse_handler)
|
||||||
/* Caller will free the memory */
|
/* Caller will free the memory */
|
||||||
goto failure;
|
goto failure;
|
||||||
}
|
}
|
||||||
if (file->external_lock(thd, F_RDLCK))
|
if (file->ha_external_lock(thd, F_RDLCK))
|
||||||
goto failure;
|
goto failure;
|
||||||
|
|
||||||
if (file->extra(HA_EXTRA_KEYREAD) ||
|
if (file->extra(HA_EXTRA_KEYREAD) ||
|
||||||
file->ha_retrieve_all_pk() ||
|
file->ha_retrieve_all_pk() ||
|
||||||
init() || reset())
|
init() || reset())
|
||||||
{
|
{
|
||||||
file->external_lock(thd, F_UNLCK);
|
file->ha_external_lock(thd, F_UNLCK);
|
||||||
file->close();
|
file->close();
|
||||||
goto failure;
|
goto failure;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
/* inline since it's called below */
|
/* inline since it's called below */
|
||||||
inline
|
inline
|
||||||
injector::transaction::transaction(MYSQL_LOG *log, THD *thd)
|
injector::transaction::transaction(MYSQL_LOG *log, THD *thd)
|
||||||
: m_thd(thd)
|
: m_state(START_STATE), m_thd(thd)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
Default initialization of m_start_pos (which initializes it to garbage).
|
Default initialization of m_start_pos (which initializes it to garbage).
|
||||||
|
@ -64,12 +64,31 @@ int injector::transaction::commit()
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int injector::transaction::use_table(server_id_type sid, table tbl)
|
||||||
|
{
|
||||||
|
DBUG_ENTER("injector::transaction::use_table");
|
||||||
|
|
||||||
|
int error;
|
||||||
|
|
||||||
|
if ((error= check_state(TABLE_STATE)))
|
||||||
|
DBUG_RETURN(error);
|
||||||
|
|
||||||
|
m_thd->set_server_id(sid);
|
||||||
|
error= m_thd->binlog_write_table_map(tbl.get_table(),
|
||||||
|
tbl.is_transactional());
|
||||||
|
DBUG_RETURN(error);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int injector::transaction::write_row (server_id_type sid, table tbl,
|
int injector::transaction::write_row (server_id_type sid, table tbl,
|
||||||
MY_BITMAP const* cols, size_t colcnt,
|
MY_BITMAP const* cols, size_t colcnt,
|
||||||
record_type record)
|
record_type record)
|
||||||
{
|
{
|
||||||
DBUG_ENTER("injector::transaction::write_row(...)");
|
DBUG_ENTER("injector::transaction::write_row(...)");
|
||||||
|
|
||||||
|
if (int error= check_state(ROW_STATE))
|
||||||
|
DBUG_RETURN(error);
|
||||||
|
|
||||||
m_thd->set_server_id(sid);
|
m_thd->set_server_id(sid);
|
||||||
m_thd->binlog_write_row(tbl.get_table(), tbl.is_transactional(),
|
m_thd->binlog_write_row(tbl.get_table(), tbl.is_transactional(),
|
||||||
cols, colcnt, record);
|
cols, colcnt, record);
|
||||||
|
@ -82,6 +101,10 @@ int injector::transaction::delete_row(server_id_type sid, table tbl,
|
||||||
record_type record)
|
record_type record)
|
||||||
{
|
{
|
||||||
DBUG_ENTER("injector::transaction::delete_row(...)");
|
DBUG_ENTER("injector::transaction::delete_row(...)");
|
||||||
|
|
||||||
|
if (int error= check_state(ROW_STATE))
|
||||||
|
DBUG_RETURN(error);
|
||||||
|
|
||||||
m_thd->set_server_id(sid);
|
m_thd->set_server_id(sid);
|
||||||
m_thd->binlog_delete_row(tbl.get_table(), tbl.is_transactional(),
|
m_thd->binlog_delete_row(tbl.get_table(), tbl.is_transactional(),
|
||||||
cols, colcnt, record);
|
cols, colcnt, record);
|
||||||
|
@ -94,6 +117,10 @@ int injector::transaction::update_row(server_id_type sid, table tbl,
|
||||||
record_type before, record_type after)
|
record_type before, record_type after)
|
||||||
{
|
{
|
||||||
DBUG_ENTER("injector::transaction::update_row(...)");
|
DBUG_ENTER("injector::transaction::update_row(...)");
|
||||||
|
|
||||||
|
if (int error= check_state(ROW_STATE))
|
||||||
|
DBUG_RETURN(error);
|
||||||
|
|
||||||
m_thd->set_server_id(sid);
|
m_thd->set_server_id(sid);
|
||||||
m_thd->binlog_update_row(tbl.get_table(), tbl.is_transactional(),
|
m_thd->binlog_update_row(tbl.get_table(), tbl.is_transactional(),
|
||||||
cols, colcnt, before, after);
|
cols, colcnt, before, after);
|
||||||
|
|
|
@ -159,6 +159,24 @@ public:
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
DESCRIPTION
|
||||||
|
|
||||||
|
Register table for use within the transaction. All tables
|
||||||
|
that are going to be used need to be registered before being
|
||||||
|
used below. The member function will fail with an error if
|
||||||
|
use_table() is called after any *_row() function has been
|
||||||
|
called for the transaction.
|
||||||
|
|
||||||
|
RETURN VALUE
|
||||||
|
|
||||||
|
0 All OK
|
||||||
|
>0 Failure
|
||||||
|
|
||||||
|
*/
|
||||||
|
int use_table(server_id_type sid, table tbl);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Add a 'write row' entry to the transaction.
|
Add a 'write row' entry to the transaction.
|
||||||
*/
|
*/
|
||||||
|
@ -219,6 +237,62 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum enum_state
|
||||||
|
{
|
||||||
|
START_STATE, /* Start state */
|
||||||
|
TABLE_STATE, /* At least one table has been registered */
|
||||||
|
ROW_STATE, /* At least one row has been registered */
|
||||||
|
STATE_COUNT /* State count and sink state */
|
||||||
|
} m_state;
|
||||||
|
|
||||||
|
/*
|
||||||
|
Check and update the state.
|
||||||
|
|
||||||
|
PARAMETER(S)
|
||||||
|
|
||||||
|
target_state
|
||||||
|
The state we are moving to: TABLE_STATE if we are
|
||||||
|
writing a table and ROW_STATE if we are writing a row.
|
||||||
|
|
||||||
|
DESCRIPTION
|
||||||
|
|
||||||
|
The internal state will be updated to the target state if
|
||||||
|
and only if it is a legal move. The only legal moves are:
|
||||||
|
|
||||||
|
START_STATE -> START_STATE
|
||||||
|
START_STATE -> TABLE_STATE
|
||||||
|
TABLE_STATE -> TABLE_STATE
|
||||||
|
TABLE_STATE -> ROW_STATE
|
||||||
|
|
||||||
|
That is:
|
||||||
|
- It is not possible to write any row before having written at
|
||||||
|
least one table
|
||||||
|
- It is not possible to write a table after at least one row
|
||||||
|
has been written
|
||||||
|
|
||||||
|
RETURN VALUE
|
||||||
|
|
||||||
|
0 All OK
|
||||||
|
-1 Incorrect call sequence
|
||||||
|
*/
|
||||||
|
int check_state(enum_state const target_state)
|
||||||
|
{
|
||||||
|
static char const *state_name[] = {
|
||||||
|
"START_STATE", "TABLE_STATE", "ROW_STATE", "STATE_COUNT"
|
||||||
|
};
|
||||||
|
|
||||||
|
DBUG_ASSERT(0 <= target_state && target_state <= STATE_COUNT);
|
||||||
|
DBUG_PRINT("info", ("In state %s", state_name[m_state]));
|
||||||
|
|
||||||
|
if (m_state <= target_state && target_state <= m_state + 1 &&
|
||||||
|
m_state < STATE_COUNT)
|
||||||
|
m_state= target_state;
|
||||||
|
else
|
||||||
|
m_state= STATE_COUNT;
|
||||||
|
return m_state == STATE_COUNT ? 1 : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
binlog_pos m_start_pos;
|
binlog_pos m_start_pos;
|
||||||
THD *m_thd;
|
THD *m_thd;
|
||||||
};
|
};
|
||||||
|
|
|
@ -276,7 +276,9 @@ typedef struct st_relay_log_info
|
||||||
group_relay_log_pos);
|
group_relay_log_pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
table_mapping m_table_map;
|
TABLE_LIST *tables_to_lock; /* RBR: Tables to lock */
|
||||||
|
uint tables_to_lock_count; /* RBR: Count of tables to lock */
|
||||||
|
table_mapping m_table_map; /* RBR: Mapping table-id to table */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Last charset (6 bytes) seen by slave SQL thread is cached here; it helps
|
Last charset (6 bytes) seen by slave SQL thread is cached here; it helps
|
||||||
|
@ -306,6 +308,18 @@ typedef struct st_relay_log_info
|
||||||
void transaction_end(THD*);
|
void transaction_end(THD*);
|
||||||
|
|
||||||
void cleanup_context(THD *, bool);
|
void cleanup_context(THD *, bool);
|
||||||
|
void clear_tables_to_lock() {
|
||||||
|
TABLE_LIST *ptr= tables_to_lock;
|
||||||
|
while (ptr)
|
||||||
|
{
|
||||||
|
char *to_free= reinterpret_cast<char*>(ptr);
|
||||||
|
ptr= ptr->next_global;
|
||||||
|
my_free(to_free, MYF(MY_WME));
|
||||||
|
}
|
||||||
|
tables_to_lock= 0;
|
||||||
|
tables_to_lock_count= 0;
|
||||||
|
}
|
||||||
|
|
||||||
time_t unsafe_to_stop_at;
|
time_t unsafe_to_stop_at;
|
||||||
} RELAY_LOG_INFO;
|
} RELAY_LOG_INFO;
|
||||||
|
|
||||||
|
|
|
@ -1444,6 +1444,8 @@ static int init_relay_log_info(RELAY_LOG_INFO* rli,
|
||||||
rli->abort_pos_wait=0;
|
rli->abort_pos_wait=0;
|
||||||
rli->log_space_limit= relay_log_space_limit;
|
rli->log_space_limit= relay_log_space_limit;
|
||||||
rli->log_space_total= 0;
|
rli->log_space_total= 0;
|
||||||
|
rli->tables_to_lock= 0;
|
||||||
|
rli->tables_to_lock_count= 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
The relay log will now be opened, as a SEQ_READ_APPEND IO_CACHE.
|
The relay log will now be opened, as a SEQ_READ_APPEND IO_CACHE.
|
||||||
|
@ -2307,6 +2309,7 @@ st_relay_log_info::st_relay_log_info()
|
||||||
abort_pos_wait(0), slave_run_id(0), sql_thd(0), last_slave_errno(0),
|
abort_pos_wait(0), slave_run_id(0), sql_thd(0), last_slave_errno(0),
|
||||||
inited(0), abort_slave(0), slave_running(0), until_condition(UNTIL_NONE),
|
inited(0), abort_slave(0), slave_running(0), until_condition(UNTIL_NONE),
|
||||||
until_log_pos(0), retried_trans(0), m_reload_flags(RELOAD_NONE_F),
|
until_log_pos(0), retried_trans(0), m_reload_flags(RELOAD_NONE_F),
|
||||||
|
tables_to_lock(0), tables_to_lock_count(0),
|
||||||
unsafe_to_stop_at(0)
|
unsafe_to_stop_at(0)
|
||||||
{
|
{
|
||||||
group_relay_log_name[0]= event_relay_log_name[0]=
|
group_relay_log_name[0]= event_relay_log_name[0]=
|
||||||
|
@ -4960,6 +4963,7 @@ void st_relay_log_info::cleanup_context(THD *thd, bool error)
|
||||||
}
|
}
|
||||||
m_table_map.clear_tables();
|
m_table_map.clear_tables();
|
||||||
close_thread_tables(thd);
|
close_thread_tables(thd);
|
||||||
|
clear_tables_to_lock();
|
||||||
unsafe_to_stop_at= 0;
|
unsafe_to_stop_at= 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -3266,16 +3266,6 @@ bool mysql_routine_grant(THD *thd, TABLE_LIST *table_list, bool is_proc,
|
||||||
}
|
}
|
||||||
grant_option=TRUE;
|
grant_option=TRUE;
|
||||||
thd->mem_root= old_root;
|
thd->mem_root= old_root;
|
||||||
/*
|
|
||||||
This flush is here only becuase there is code that writes rows to
|
|
||||||
system tables after executing a binlog_query().
|
|
||||||
|
|
||||||
TODO: Ensure that no writes are executed after a binlog_query() by
|
|
||||||
moving the writes to before calling binlog_query(). Then remove
|
|
||||||
this line (and add an assert inside send_ok() that checks that
|
|
||||||
everything is in a consistent state).
|
|
||||||
*/
|
|
||||||
thd->binlog_flush_pending_rows_event(true);
|
|
||||||
rw_unlock(&LOCK_grant);
|
rw_unlock(&LOCK_grant);
|
||||||
if (!result && !no_error)
|
if (!result && !no_error)
|
||||||
send_ok(thd);
|
send_ok(thd);
|
||||||
|
|
|
@ -1049,21 +1049,18 @@ void close_thread_tables(THD *thd, bool lock_in_use, bool skip_derived)
|
||||||
/* Fallthrough */
|
/* Fallthrough */
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
For RBR: before calling close_thread_tables(), storage engines
|
|
||||||
should autocommit. Hence if there is a a pending event, it belongs
|
|
||||||
to a non-transactional engine, which writes directly to the table,
|
|
||||||
and should therefore be flushed before unlocking and closing the
|
|
||||||
tables. The test above for locked tables will not be triggered
|
|
||||||
since RBR locks and unlocks tables on a per-event basis.
|
|
||||||
|
|
||||||
TODO (WL#3023): Change the semantics so that RBR does not lock and
|
|
||||||
unlock tables on a per-event basis.
|
|
||||||
*/
|
|
||||||
thd->binlog_flush_pending_rows_event(true);
|
|
||||||
|
|
||||||
if (thd->lock)
|
if (thd->lock)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
For RBR we flush the pending event just before we unlock all the
|
||||||
|
tables. This means that we are at the end of a topmost
|
||||||
|
statement, so we ensure that the STMT_END_F flag is set on the
|
||||||
|
pending event. For statements that are *inside* stored
|
||||||
|
functions, the pending event will not be flushed: that will be
|
||||||
|
handled either before writing a query log event (inside
|
||||||
|
binlog_query()) or when preparing a pending event.
|
||||||
|
*/
|
||||||
|
thd->binlog_flush_pending_rows_event(true);
|
||||||
mysql_unlock_tables(thd, thd->lock);
|
mysql_unlock_tables(thd, thd->lock);
|
||||||
thd->lock=0;
|
thd->lock=0;
|
||||||
}
|
}
|
||||||
|
@ -1075,7 +1072,8 @@ void close_thread_tables(THD *thd, bool lock_in_use, bool skip_derived)
|
||||||
saves some work in 2pc too)
|
saves some work in 2pc too)
|
||||||
see also sql_parse.cc - dispatch_command()
|
see also sql_parse.cc - dispatch_command()
|
||||||
*/
|
*/
|
||||||
bzero(&thd->transaction.stmt, sizeof(thd->transaction.stmt));
|
if (!(thd->state_flags & Open_tables_state::BACKUPS_AVAIL))
|
||||||
|
bzero(&thd->transaction.stmt, sizeof(thd->transaction.stmt));
|
||||||
if (!thd->active_transaction())
|
if (!thd->active_transaction())
|
||||||
thd->transaction.xid_state.xid.null();
|
thd->transaction.xid_state.xid.null();
|
||||||
|
|
||||||
|
|
116
sql/sql_class.cc
116
sql/sql_class.cc
|
@ -162,7 +162,7 @@ bool foreign_key_prefix(Key *a, Key *b)
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
Open_tables_state::Open_tables_state(ulong version_arg)
|
Open_tables_state::Open_tables_state(ulong version_arg)
|
||||||
:version(version_arg)
|
:version(version_arg), state_flags(0U)
|
||||||
{
|
{
|
||||||
reset_open_tables_state();
|
reset_open_tables_state();
|
||||||
}
|
}
|
||||||
|
@ -197,7 +197,8 @@ THD::THD()
|
||||||
:Statement(CONVENTIONAL_EXECUTION, 0, ALLOC_ROOT_MIN_BLOCK_SIZE, 0),
|
:Statement(CONVENTIONAL_EXECUTION, 0, ALLOC_ROOT_MIN_BLOCK_SIZE, 0),
|
||||||
Open_tables_state(refresh_version), rli_fake(0),
|
Open_tables_state(refresh_version), rli_fake(0),
|
||||||
lock_id(&main_lock_id),
|
lock_id(&main_lock_id),
|
||||||
user_time(0), in_sub_stmt(0), global_read_lock(0), is_fatal_error(0),
|
user_time(0), in_sub_stmt(0), binlog_table_maps(0),
|
||||||
|
global_read_lock(0), is_fatal_error(0),
|
||||||
rand_used(0), time_zone_used(0),
|
rand_used(0), time_zone_used(0),
|
||||||
last_insert_id_used(0), insert_id_used(0), clear_next_insert_id(0),
|
last_insert_id_used(0), insert_id_used(0), clear_next_insert_id(0),
|
||||||
in_lock_tables(0), bootstrap(0), derived_tables_processing(FALSE),
|
in_lock_tables(0), bootstrap(0), derived_tables_processing(FALSE),
|
||||||
|
@ -1945,6 +1946,7 @@ void THD::reset_n_backup_open_tables_state(Open_tables_state *backup)
|
||||||
DBUG_ENTER("reset_n_backup_open_tables_state");
|
DBUG_ENTER("reset_n_backup_open_tables_state");
|
||||||
backup->set_open_tables_state(this);
|
backup->set_open_tables_state(this);
|
||||||
reset_open_tables_state();
|
reset_open_tables_state();
|
||||||
|
state_flags|= Open_tables_state::BACKUPS_AVAIL;
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2011,25 +2013,6 @@ void THD::reset_sub_statement_state(Sub_statement_state *backup,
|
||||||
backup->client_capabilities= client_capabilities;
|
backup->client_capabilities= client_capabilities;
|
||||||
backup->savepoints= transaction.savepoints;
|
backup->savepoints= transaction.savepoints;
|
||||||
|
|
||||||
#ifdef HAVE_ROW_BASED_REPLICATION
|
|
||||||
/*
|
|
||||||
For row-based replication and before executing a function/trigger,
|
|
||||||
the pending rows event has to be flushed. The function/trigger
|
|
||||||
might execute statement that require the pending event to be
|
|
||||||
flushed. A simple example:
|
|
||||||
|
|
||||||
CREATE FUNCTION foo() RETURNS INT
|
|
||||||
BEGIN
|
|
||||||
SAVEPOINT x;
|
|
||||||
RETURN 0;
|
|
||||||
END
|
|
||||||
|
|
||||||
INSERT INTO t1 VALUES (1), (foo()), (2);
|
|
||||||
*/
|
|
||||||
if (binlog_row_based)
|
|
||||||
binlog_flush_pending_rows_event(false);
|
|
||||||
#endif /* HAVE_ROW_BASED_REPLICATION */
|
|
||||||
|
|
||||||
if ((!lex->requires_prelocking() || is_update_query(lex->sql_command)) &&
|
if ((!lex->requires_prelocking() || is_update_query(lex->sql_command)) &&
|
||||||
!binlog_row_based)
|
!binlog_row_based)
|
||||||
options&= ~OPTION_BIN_LOG;
|
options&= ~OPTION_BIN_LOG;
|
||||||
|
@ -2209,6 +2192,7 @@ THD::binlog_prepare_pending_rows_event(TABLE* table, uint32 serv_id,
|
||||||
bool is_transactional,
|
bool is_transactional,
|
||||||
RowsEventT *hint __attribute__((unused)))
|
RowsEventT *hint __attribute__((unused)))
|
||||||
{
|
{
|
||||||
|
DBUG_ENTER("binlog_prepare_pending_rows_event");
|
||||||
/* Pre-conditions */
|
/* Pre-conditions */
|
||||||
DBUG_ASSERT(table->s->table_map_id != ULONG_MAX);
|
DBUG_ASSERT(table->s->table_map_id != ULONG_MAX);
|
||||||
|
|
||||||
|
@ -2220,12 +2204,12 @@ THD::binlog_prepare_pending_rows_event(TABLE* table, uint32 serv_id,
|
||||||
have to do it here.
|
have to do it here.
|
||||||
*/
|
*/
|
||||||
if (binlog_setup_trx_data())
|
if (binlog_setup_trx_data())
|
||||||
return NULL;
|
DBUG_RETURN(NULL);
|
||||||
|
|
||||||
Rows_log_event* pending= binlog_get_pending_rows_event();
|
Rows_log_event* pending= binlog_get_pending_rows_event();
|
||||||
|
|
||||||
if (unlikely(pending && !pending->is_valid()))
|
if (unlikely(pending && !pending->is_valid()))
|
||||||
return NULL;
|
DBUG_RETURN(NULL);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Check if the current event is non-NULL and a write-rows
|
Check if the current event is non-NULL and a write-rows
|
||||||
|
@ -2250,7 +2234,7 @@ THD::binlog_prepare_pending_rows_event(TABLE* table, uint32 serv_id,
|
||||||
ev= new RowsEventT(this, table, table->s->table_map_id, cols,
|
ev= new RowsEventT(this, table, table->s->table_map_id, cols,
|
||||||
is_transactional);
|
is_transactional);
|
||||||
if (unlikely(!ev))
|
if (unlikely(!ev))
|
||||||
return NULL;
|
DBUG_RETURN(NULL);
|
||||||
ev->server_id= serv_id; // I don't like this, it's too easy to forget.
|
ev->server_id= serv_id; // I don't like this, it's too easy to forget.
|
||||||
/*
|
/*
|
||||||
flush the pending event and replace it with the newly created
|
flush the pending event and replace it with the newly created
|
||||||
|
@ -2259,17 +2243,17 @@ THD::binlog_prepare_pending_rows_event(TABLE* table, uint32 serv_id,
|
||||||
if (unlikely(mysql_bin_log.flush_and_set_pending_rows_event(this, ev)))
|
if (unlikely(mysql_bin_log.flush_and_set_pending_rows_event(this, ev)))
|
||||||
{
|
{
|
||||||
delete ev;
|
delete ev;
|
||||||
return NULL;
|
DBUG_RETURN(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ev; /* This is the new pending event */
|
DBUG_RETURN(ev); /* This is the new pending event */
|
||||||
}
|
}
|
||||||
return pending; /* This is the current pending event */
|
DBUG_RETURN(pending); /* This is the current pending event */
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION
|
#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION
|
||||||
/*
|
/*
|
||||||
Instansiate the versions we need, we have -fno-implicit-template as
|
Instantiate the versions we need, we have -fno-implicit-template as
|
||||||
compiling option.
|
compiling option.
|
||||||
*/
|
*/
|
||||||
template Rows_log_event*
|
template Rows_log_event*
|
||||||
|
@ -2534,15 +2518,34 @@ int THD::binlog_flush_pending_rows_event(bool stmt_end)
|
||||||
{
|
{
|
||||||
pending->set_flags(Rows_log_event::STMT_END_F);
|
pending->set_flags(Rows_log_event::STMT_END_F);
|
||||||
pending->flags|= LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F;
|
pending->flags|= LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F;
|
||||||
|
binlog_table_maps= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
We only bother to set the pending event if it is non-NULL. This
|
|
||||||
is essential for correctness, since there is not necessarily a
|
|
||||||
trx_data created for the thread if the pending event is NULL.
|
|
||||||
*/
|
|
||||||
error= mysql_bin_log.flush_and_set_pending_rows_event(this, 0);
|
error= mysql_bin_log.flush_and_set_pending_rows_event(this, 0);
|
||||||
}
|
}
|
||||||
|
else if (stmt_end && binlog_table_maps > 0)
|
||||||
|
{ /* there is no pending event at this point */
|
||||||
|
/*
|
||||||
|
If pending is null and we are going to end the statement, we
|
||||||
|
have to write an extra, empty, binrow event so that the slave
|
||||||
|
knows to discard the tables it has received. Otherwise, the
|
||||||
|
table maps written this far will be included in the table maps
|
||||||
|
for the following statement.
|
||||||
|
|
||||||
|
See if we can replace this with a dummy, maybe constant, event.
|
||||||
|
*/
|
||||||
|
#if 0
|
||||||
|
static unsigned char memory[sizeof(Write_rows_log_event)];
|
||||||
|
void *const ptr= &memory;
|
||||||
|
#endif
|
||||||
|
Rows_log_event *ev=
|
||||||
|
new Write_rows_log_event(this, 0, ULONG_MAX, 0, FALSE);
|
||||||
|
ev->set_flags(Rows_log_event::STMT_END_F);
|
||||||
|
binlog_set_pending_rows_event(ev);
|
||||||
|
|
||||||
|
error= mysql_bin_log.flush_and_set_pending_rows_event(this, 0);
|
||||||
|
binlog_table_maps= 0;
|
||||||
|
}
|
||||||
|
|
||||||
DBUG_RETURN(error);
|
DBUG_RETURN(error);
|
||||||
}
|
}
|
||||||
|
@ -2568,6 +2571,17 @@ void THD::binlog_delete_pending_rows_event()
|
||||||
functions have been issued, but before tables are unlocked and
|
functions have been issued, but before tables are unlocked and
|
||||||
closed.
|
closed.
|
||||||
|
|
||||||
|
OBSERVE
|
||||||
|
There shall be no writes to any system table after calling
|
||||||
|
binlog_query(), so these writes has to be moved to before the call
|
||||||
|
of binlog_query() for correct functioning.
|
||||||
|
|
||||||
|
This is necessesary not only for RBR, but the master might crash
|
||||||
|
after binlogging the query but before changing the system tables.
|
||||||
|
This means that the slave and the master are not in the same state
|
||||||
|
(after the master has restarted), so therefore we have to
|
||||||
|
eliminate this problem.
|
||||||
|
|
||||||
RETURN VALUE
|
RETURN VALUE
|
||||||
Error code, or 0 if no error.
|
Error code, or 0 if no error.
|
||||||
*/
|
*/
|
||||||
|
@ -2577,7 +2591,7 @@ int THD::binlog_query(THD::enum_binlog_query_type qtype,
|
||||||
{
|
{
|
||||||
DBUG_ENTER("THD::binlog_query");
|
DBUG_ENTER("THD::binlog_query");
|
||||||
DBUG_ASSERT(query && mysql_bin_log.is_open());
|
DBUG_ASSERT(query && mysql_bin_log.is_open());
|
||||||
int error= binlog_flush_pending_rows_event(true);
|
|
||||||
switch (qtype)
|
switch (qtype)
|
||||||
{
|
{
|
||||||
case THD::MYSQL_QUERY_TYPE:
|
case THD::MYSQL_QUERY_TYPE:
|
||||||
|
@ -2591,19 +2605,41 @@ int THD::binlog_query(THD::enum_binlog_query_type qtype,
|
||||||
*/
|
*/
|
||||||
case THD::ROW_QUERY_TYPE:
|
case THD::ROW_QUERY_TYPE:
|
||||||
if (binlog_row_based)
|
if (binlog_row_based)
|
||||||
DBUG_RETURN(binlog_flush_pending_rows_event(true));
|
{
|
||||||
|
/*
|
||||||
|
If thd->lock is set, then we are not inside a stored function.
|
||||||
|
In that case, mysql_unlock_tables() will be called after this
|
||||||
|
binlog_query(), so we have to flush the pending rows event
|
||||||
|
with the STMT_END_F set to unlock all tables at the slave side
|
||||||
|
as well.
|
||||||
|
|
||||||
|
We will not flush the pending event, if thd->lock is NULL.
|
||||||
|
This means that we are inside a stored function or trigger, so
|
||||||
|
the flushing will be done inside the top-most
|
||||||
|
close_thread_tables().
|
||||||
|
*/
|
||||||
|
if (this->lock)
|
||||||
|
DBUG_RETURN(binlog_flush_pending_rows_event(TRUE));
|
||||||
|
DBUG_RETURN(0);
|
||||||
|
}
|
||||||
/* Otherwise, we fall through */
|
/* Otherwise, we fall through */
|
||||||
case THD::STMT_QUERY_TYPE:
|
case THD::STMT_QUERY_TYPE:
|
||||||
/*
|
/*
|
||||||
Most callers of binlog_query() ignore the error code, assuming
|
The MYSQL_LOG::write() function will set the STMT_END_F flag and
|
||||||
that the statement will always be written to the binlog. In
|
flush the pending rows event if necessary.
|
||||||
case of error above, we therefore just continue and write the
|
|
||||||
statement to the binary log.
|
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
Query_log_event qinfo(this, query, query_len, is_trans, suppress_use);
|
Query_log_event qinfo(this, query, query_len, is_trans, suppress_use);
|
||||||
qinfo.flags|= LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F;
|
qinfo.flags|= LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F;
|
||||||
DBUG_RETURN(mysql_bin_log.write(&qinfo));
|
/*
|
||||||
|
Binlog table maps will be irrelevant after a Query_log_event
|
||||||
|
(they are just removed on the slave side) so after the query
|
||||||
|
log event is written to the binary log, we pretend that no
|
||||||
|
table maps were written.
|
||||||
|
*/
|
||||||
|
int error= mysql_bin_log.write(&qinfo);
|
||||||
|
binlog_table_maps= 0;
|
||||||
|
DBUG_RETURN(error);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -738,11 +738,20 @@ public:
|
||||||
ulong version;
|
ulong version;
|
||||||
uint current_tablenr;
|
uint current_tablenr;
|
||||||
|
|
||||||
|
enum enum_flags {
|
||||||
|
BACKUPS_AVAIL = (1U << 0) /* There are backups available */
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
Flags with information about the open tables state.
|
||||||
|
*/
|
||||||
|
uint state_flags;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
This constructor serves for creation of Open_tables_state instances
|
This constructor serves for creation of Open_tables_state instances
|
||||||
which are used as backup storage.
|
which are used as backup storage.
|
||||||
*/
|
*/
|
||||||
Open_tables_state() {};
|
Open_tables_state() : state_flags(0U) { }
|
||||||
|
|
||||||
Open_tables_state(ulong version_arg);
|
Open_tables_state(ulong version_arg);
|
||||||
|
|
||||||
|
@ -756,6 +765,7 @@ public:
|
||||||
open_tables= temporary_tables= handler_tables= derived_tables= 0;
|
open_tables= temporary_tables= handler_tables= derived_tables= 0;
|
||||||
lock= locked_tables= 0;
|
lock= locked_tables= 0;
|
||||||
prelocked_mode= NON_PRELOCKED;
|
prelocked_mode= NON_PRELOCKED;
|
||||||
|
state_flags= 0U;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -906,8 +916,9 @@ public:
|
||||||
#ifndef MYSQL_CLIENT
|
#ifndef MYSQL_CLIENT
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Public interface to write rows to the binlog
|
Public interface to write RBR events to the binlog
|
||||||
*/
|
*/
|
||||||
|
int binlog_write_table_map(TABLE *table, bool is_transactional);
|
||||||
int binlog_write_row(TABLE* table, bool is_transactional,
|
int binlog_write_row(TABLE* table, bool is_transactional,
|
||||||
MY_BITMAP const* cols, my_size_t colcnt,
|
MY_BITMAP const* cols, my_size_t colcnt,
|
||||||
const byte *buf);
|
const byte *buf);
|
||||||
|
@ -951,6 +962,11 @@ public:
|
||||||
int binlog_flush_pending_rows_event(bool stmt_end);
|
int binlog_flush_pending_rows_event(bool stmt_end);
|
||||||
void binlog_delete_pending_rows_event();
|
void binlog_delete_pending_rows_event();
|
||||||
|
|
||||||
|
private:
|
||||||
|
uint binlog_table_maps; // Number of table maps currently in the binlog
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#endif /* HAVE_ROW_BASED_REPLICATION */
|
#endif /* HAVE_ROW_BASED_REPLICATION */
|
||||||
#ifndef MYSQL_CLIENT
|
#ifndef MYSQL_CLIENT
|
||||||
|
@ -1555,7 +1571,6 @@ class select_create: public select_insert {
|
||||||
HA_CREATE_INFO *create_info;
|
HA_CREATE_INFO *create_info;
|
||||||
MYSQL_LOCK *lock;
|
MYSQL_LOCK *lock;
|
||||||
Field **field;
|
Field **field;
|
||||||
bool create_table_written;
|
|
||||||
public:
|
public:
|
||||||
select_create (TABLE_LIST *table,
|
select_create (TABLE_LIST *table,
|
||||||
HA_CREATE_INFO *create_info_par,
|
HA_CREATE_INFO *create_info_par,
|
||||||
|
@ -1564,11 +1579,11 @@ public:
|
||||||
List<Item> &select_fields,enum_duplicates duplic, bool ignore)
|
List<Item> &select_fields,enum_duplicates duplic, bool ignore)
|
||||||
:select_insert (NULL, NULL, &select_fields, 0, 0, duplic, ignore), create_table(table),
|
:select_insert (NULL, NULL, &select_fields, 0, 0, duplic, ignore), create_table(table),
|
||||||
extra_fields(&fields_par),keys(&keys_par), create_info(create_info_par),
|
extra_fields(&fields_par),keys(&keys_par), create_info(create_info_par),
|
||||||
lock(0), create_table_written(FALSE)
|
lock(0)
|
||||||
{}
|
{}
|
||||||
int prepare(List<Item> &list, SELECT_LEX_UNIT *u);
|
int prepare(List<Item> &list, SELECT_LEX_UNIT *u);
|
||||||
|
|
||||||
void binlog_show_create_table();
|
void binlog_show_create_table(TABLE **tables, uint count);
|
||||||
void store_values(List<Item> &values);
|
void store_values(List<Item> &values);
|
||||||
void send_error(uint errcode,const char *err);
|
void send_error(uint errcode,const char *err);
|
||||||
bool send_eof();
|
bool send_eof();
|
||||||
|
|
|
@ -1711,7 +1711,7 @@ pthread_handler_t handle_delayed_insert(void *arg)
|
||||||
{
|
{
|
||||||
thd->fatal_error();
|
thd->fatal_error();
|
||||||
strmov(thd->net.last_error,ER(thd->net.last_errno=ER_OUT_OF_RESOURCES));
|
strmov(thd->net.last_error,ER(thd->net.last_errno=ER_OUT_OF_RESOURCES));
|
||||||
goto end;
|
goto err;
|
||||||
}
|
}
|
||||||
#if !defined(__WIN__) && !defined(OS2) && !defined(__NETWARE__)
|
#if !defined(__WIN__) && !defined(OS2) && !defined(__NETWARE__)
|
||||||
sigset_t set;
|
sigset_t set;
|
||||||
|
@ -1724,13 +1724,13 @@ pthread_handler_t handle_delayed_insert(void *arg)
|
||||||
if (!(di->table=open_ltable(thd,&di->table_list,TL_WRITE_DELAYED)))
|
if (!(di->table=open_ltable(thd,&di->table_list,TL_WRITE_DELAYED)))
|
||||||
{
|
{
|
||||||
thd->fatal_error(); // Abort waiting inserts
|
thd->fatal_error(); // Abort waiting inserts
|
||||||
goto end;
|
goto err;
|
||||||
}
|
}
|
||||||
if (!(di->table->file->table_flags() & HA_CAN_INSERT_DELAYED))
|
if (!(di->table->file->table_flags() & HA_CAN_INSERT_DELAYED))
|
||||||
{
|
{
|
||||||
thd->fatal_error();
|
thd->fatal_error();
|
||||||
my_error(ER_ILLEGAL_HA, MYF(0), di->table_list.table_name);
|
my_error(ER_ILLEGAL_HA, MYF(0), di->table_list.table_name);
|
||||||
goto end;
|
goto err;
|
||||||
}
|
}
|
||||||
di->table->copy_blobs=1;
|
di->table->copy_blobs=1;
|
||||||
|
|
||||||
|
@ -1859,6 +1859,16 @@ pthread_handler_t handle_delayed_insert(void *arg)
|
||||||
pthread_cond_broadcast(&di->cond_client); // If waiting clients
|
pthread_cond_broadcast(&di->cond_client); // If waiting clients
|
||||||
}
|
}
|
||||||
|
|
||||||
|
err:
|
||||||
|
/*
|
||||||
|
mysql_lock_tables() can potentially start a transaction and write
|
||||||
|
a table map. In the event of an error, that transaction has to be
|
||||||
|
rolled back. We only need to roll back a potential statement
|
||||||
|
transaction, since real transactions are rolled back in
|
||||||
|
close_thread_tables().
|
||||||
|
*/
|
||||||
|
ha_rollback_stmt(thd);
|
||||||
|
|
||||||
end:
|
end:
|
||||||
/*
|
/*
|
||||||
di should be unlinked from the thread handler list and have no active
|
di should be unlinked from the thread handler list and have no active
|
||||||
|
@ -2493,9 +2503,25 @@ select_create::prepare(List<Item> &values, SELECT_LEX_UNIT *u)
|
||||||
{
|
{
|
||||||
DBUG_ENTER("select_create::prepare");
|
DBUG_ENTER("select_create::prepare");
|
||||||
|
|
||||||
|
class MY_HOOKS : public TABLEOP_HOOKS {
|
||||||
|
public:
|
||||||
|
MY_HOOKS(select_create *x) : ptr(x) { }
|
||||||
|
virtual void do_prelock(TABLE **tables, uint count)
|
||||||
|
{
|
||||||
|
if (binlog_row_based)
|
||||||
|
ptr->binlog_show_create_table(tables, count);
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
select_create *ptr;
|
||||||
|
};
|
||||||
|
|
||||||
|
MY_HOOKS hooks(this);
|
||||||
|
|
||||||
unit= u;
|
unit= u;
|
||||||
table= create_table_from_items(thd, create_info, create_table,
|
table= create_table_from_items(thd, create_info, create_table,
|
||||||
extra_fields, keys, &values, &lock);
|
extra_fields, keys, &values, &lock,
|
||||||
|
&hooks);
|
||||||
if (!table)
|
if (!table)
|
||||||
DBUG_RETURN(-1); // abort() deletes table
|
DBUG_RETURN(-1); // abort() deletes table
|
||||||
|
|
||||||
|
@ -2533,7 +2559,7 @@ select_create::prepare(List<Item> &values, SELECT_LEX_UNIT *u)
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
select_create::binlog_show_create_table()
|
select_create::binlog_show_create_table(TABLE **tables, uint count)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
Note 1: In RBR mode, we generate a CREATE TABLE statement for the
|
Note 1: In RBR mode, we generate a CREATE TABLE statement for the
|
||||||
|
@ -2556,18 +2582,19 @@ select_create::binlog_show_create_table()
|
||||||
on rollback, we clear the OPTION_STATUS_NO_TRANS_UPDATE bit of
|
on rollback, we clear the OPTION_STATUS_NO_TRANS_UPDATE bit of
|
||||||
thd->options.
|
thd->options.
|
||||||
*/
|
*/
|
||||||
DBUG_ASSERT(binlog_row_based && !create_table_written);
|
DBUG_ASSERT(binlog_row_based);
|
||||||
|
DBUG_ASSERT(tables && *tables && count > 0);
|
||||||
|
|
||||||
thd->options&= ~OPTION_STATUS_NO_TRANS_UPDATE;
|
thd->options&= ~OPTION_STATUS_NO_TRANS_UPDATE;
|
||||||
char buf[2048];
|
char buf[2048];
|
||||||
String query(buf, sizeof(buf), system_charset_info);
|
String query(buf, sizeof(buf), system_charset_info);
|
||||||
query.length(0); // Have to zero it since constructor doesn't
|
query.length(0); // Have to zero it since constructor doesn't
|
||||||
|
|
||||||
TABLE_LIST tables;
|
TABLE_LIST table_list;
|
||||||
memset(&tables, 0, sizeof(tables));
|
memset(&table_list, 0, sizeof(table_list));
|
||||||
tables.table = table;
|
table_list.table = *tables;
|
||||||
|
|
||||||
int result= store_create_info(thd, &tables, &query, create_info);
|
int result= store_create_info(thd, &table_list, &query, create_info);
|
||||||
DBUG_ASSERT(result == 0); /* store_create_info() always return 0 */
|
DBUG_ASSERT(result == 0); /* store_create_info() always return 0 */
|
||||||
thd->binlog_query(THD::STMT_QUERY_TYPE,
|
thd->binlog_query(THD::STMT_QUERY_TYPE,
|
||||||
query.ptr(), query.length(),
|
query.ptr(), query.length(),
|
||||||
|
@ -2578,16 +2605,6 @@ select_create::binlog_show_create_table()
|
||||||
|
|
||||||
void select_create::store_values(List<Item> &values)
|
void select_create::store_values(List<Item> &values)
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
Before writing the first row, we write the CREATE TABLE statement
|
|
||||||
to the binlog.
|
|
||||||
*/
|
|
||||||
if (binlog_row_based && !create_table_written)
|
|
||||||
{
|
|
||||||
binlog_show_create_table();
|
|
||||||
create_table_written= TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
fill_record_n_invoke_before_triggers(thd, field, values, 1,
|
fill_record_n_invoke_before_triggers(thd, field, values, 1,
|
||||||
table->triggers, TRG_EVENT_INSERT);
|
table->triggers, TRG_EVENT_INSERT);
|
||||||
}
|
}
|
||||||
|
@ -2607,16 +2624,6 @@ void select_create::send_error(uint errcode,const char *err)
|
||||||
|
|
||||||
bool select_create::send_eof()
|
bool select_create::send_eof()
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
If no rows where written to the binary log, we write the CREATE
|
|
||||||
TABLE statement to the binlog.
|
|
||||||
*/
|
|
||||||
if (binlog_row_based && !create_table_written)
|
|
||||||
{
|
|
||||||
binlog_show_create_table();
|
|
||||||
create_table_written= TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool tmp=select_insert::send_eof();
|
bool tmp=select_insert::send_eof();
|
||||||
if (tmp)
|
if (tmp)
|
||||||
abort();
|
abort();
|
||||||
|
|
|
@ -417,19 +417,6 @@ bool mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
|
||||||
#ifndef EMBEDDED_LIBRARY
|
#ifndef EMBEDDED_LIBRARY
|
||||||
if (mysql_bin_log.is_open())
|
if (mysql_bin_log.is_open())
|
||||||
{
|
{
|
||||||
#ifdef HAVE_ROW_BASED_REPLICATION
|
|
||||||
/*
|
|
||||||
We need to do the job that is normally done inside
|
|
||||||
binlog_query() here, which is to ensure that the pending event
|
|
||||||
is written before tables are unlocked and before any other
|
|
||||||
events are written. We also need to update the table map
|
|
||||||
version for the binary log to mark that table maps are invalid
|
|
||||||
after this point.
|
|
||||||
*/
|
|
||||||
if (binlog_row_based)
|
|
||||||
thd->binlog_flush_pending_rows_event(true);
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
Make sure last block (the one which caused the error) gets
|
Make sure last block (the one which caused the error) gets
|
||||||
|
|
|
@ -2362,7 +2362,8 @@ TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info,
|
||||||
List<create_field> *extra_fields,
|
List<create_field> *extra_fields,
|
||||||
List<Key> *keys,
|
List<Key> *keys,
|
||||||
List<Item> *items,
|
List<Item> *items,
|
||||||
MYSQL_LOCK **lock)
|
MYSQL_LOCK **lock,
|
||||||
|
TABLEOP_HOOKS *hooks)
|
||||||
{
|
{
|
||||||
TABLE tmp_table; // Used during 'create_field()'
|
TABLE tmp_table; // Used during 'create_field()'
|
||||||
TABLE_SHARE share;
|
TABLE_SHARE share;
|
||||||
|
@ -2441,6 +2442,7 @@ TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info,
|
||||||
save us from that ?
|
save us from that ?
|
||||||
*/
|
*/
|
||||||
table->reginfo.lock_type=TL_WRITE;
|
table->reginfo.lock_type=TL_WRITE;
|
||||||
|
hooks->prelock(&table, 1); // Call prelock hooks
|
||||||
if (! ((*lock)= mysql_lock_tables(thd, &table, 1,
|
if (! ((*lock)= mysql_lock_tables(thd, &table, 1,
|
||||||
MYSQL_LOCK_IGNORE_FLUSH, ¬_used)))
|
MYSQL_LOCK_IGNORE_FLUSH, ¬_used)))
|
||||||
{
|
{
|
||||||
|
@ -5112,7 +5114,7 @@ copy_data_between_tables(TABLE *from,TABLE *to,
|
||||||
if (!(copy= new Copy_field[to->s->fields]))
|
if (!(copy= new Copy_field[to->s->fields]))
|
||||||
DBUG_RETURN(-1); /* purecov: inspected */
|
DBUG_RETURN(-1); /* purecov: inspected */
|
||||||
|
|
||||||
if (to->file->external_lock(thd, F_WRLCK))
|
if (to->file->ha_external_lock(thd, F_WRLCK))
|
||||||
DBUG_RETURN(-1);
|
DBUG_RETURN(-1);
|
||||||
|
|
||||||
/* We can abort alter table for any table type */
|
/* We can abort alter table for any table type */
|
||||||
|
@ -5252,7 +5254,7 @@ copy_data_between_tables(TABLE *from,TABLE *to,
|
||||||
free_io_cache(from);
|
free_io_cache(from);
|
||||||
*copied= found_count;
|
*copied= found_count;
|
||||||
*deleted=delete_count;
|
*deleted=delete_count;
|
||||||
if (to->file->external_lock(thd,F_UNLCK))
|
if (to->file->ha_external_lock(thd,F_UNLCK))
|
||||||
error=1;
|
error=1;
|
||||||
DBUG_RETURN(error > 0 ? -1 : 0);
|
DBUG_RETURN(error > 0 ? -1 : 0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -544,7 +544,8 @@ typedef struct st_table_list
|
||||||
struct st_table_list *next_name_resolution_table;
|
struct st_table_list *next_name_resolution_table;
|
||||||
/* Index names in a "... JOIN ... USE/IGNORE INDEX ..." clause. */
|
/* Index names in a "... JOIN ... USE/IGNORE INDEX ..." clause. */
|
||||||
List<String> *use_index, *ignore_index;
|
List<String> *use_index, *ignore_index;
|
||||||
TABLE *table; /* opened table */
|
TABLE *table; /* opened table */
|
||||||
|
uint table_id; /* table id (from binlog) for opened table */
|
||||||
/*
|
/*
|
||||||
select_result for derived table to pass it from table creation to table
|
select_result for derived table to pass it from table creation to table
|
||||||
filling procedure
|
filling procedure
|
||||||
|
|
Loading…
Add table
Reference in a new issue