Commit f56d77da authored by unknown's avatar unknown

BUG#29020 (Event results not correctly replicated to slave in RBR):

The bug allow multiple executing transactions working with non-transactional
to interfere with each others by interleaving the events of different trans-
actions.

Bug is fixed by writing non-transactional events to the transaction cache and
flushing the cache to the binary log at statement commit. To mimic the behavior
of normal statement-based replication, we flush the transaction cache in row-
based mode when there is no committed statements in the transaction cache,
which means we are committing the first one. This means that it will be written
to the binary log as a "mini-transaction" with just the rows for the statement.

Note that the changes here does not take effect when building the server with
HAVE_TRANSACTIONS set to false, but it is not clear if this was possible before
this patch either.

For row-based logging, we also have that when AUTOCOMMIT=1, the code now always
generates a BEGIN/COMMIT pair for single statements, or BEGIN/ROLLBACK pair in the
case of non-transactional changes in a statement that was rolled back. Note that
for the case where changes to a non-transactional table causes a rollback due
to error, the statement will now be logged with a BEGIN/ROLLBACK pair, even
though some changes has been committed to the non-transactional table.


mysql-test/extra/rpl_tests/rpl_row_delayed_ins.test:
  Removing SHOW BINLOG EVENTS causing test to be non-deterministic.
mysql-test/r/ctype_cp932_binlog_row.result:
  Result change.
mysql-test/suite/binlog/r/binlog_base64_flag.result:
  Result change.
mysql-test/suite/binlog/r/binlog_multi_engine.result:
  Result file change.
mysql-test/suite/binlog/r/binlog_row_binlog.result:
  Result file change.
mysql-test/suite/binlog/r/binlog_row_ctype_ucs.result:
  Result file change.
mysql-test/suite/binlog/r/binlog_row_insert_select.result:
  Result file change.
mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result:
  Result file change.
mysql-test/suite/binlog/r/binlog_stm_binlog.result:
  Result file change.
mysql-test/suite/binlog/t/binlog_base64_flag.test:
  Removing table that will be used in test to prevent failing if preceeding
  tests forgot to drop the table.
mysql-test/suite/rpl/r/rpl_rbr_to_sbr.result:
  Result file change.
mysql-test/suite/rpl/r/rpl_row_basic_11bugs.result:
  Result file change.
mysql-test/suite/rpl/r/rpl_row_create_table.result:
  Result file change.
mysql-test/suite/rpl/r/rpl_row_delayed_ins.result:
  Result file change.
mysql-test/suite/rpl/r/rpl_row_flsh_tbls.result:
  Result file change.
mysql-test/suite/rpl/r/rpl_row_inexist_tbl.result:
  Result file change.
mysql-test/suite/rpl/r/rpl_row_log.result:
  Result file change.
mysql-test/suite/rpl/r/rpl_row_log_innodb.result:
  Result file change.
mysql-test/suite/rpl/r/rpl_row_until.result:
  Result file change.
mysql-test/suite/rpl/r/rpl_slave_skip.result:
  Result file change.
mysql-test/suite/rpl/r/rpl_switch_stm_row_mixed.result:
  Result file change.
mysql-test/suite/rpl/r/rpl_truncate_2myisam.result:
  Result file change.
mysql-test/suite/rpl/t/rpl_row_create_table.test:
  Binlog position change.
mysql-test/suite/rpl/t/rpl_row_flsh_tbls.test:
  Binlog position change.
mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test:
  Binlog position change. Added stop position to mysqlbinlog argments to prevent
  extreneous output.
mysql-test/suite/rpl/t/rpl_row_until.test:
  Binlog position change.
mysql-test/suite/rpl/t/rpl_slave_skip.test:
  Binlog position change.
mysql-test/suite/rpl/t/rpl_switch_stm_row_mixed.test:
  Removing extreneous SHOW BINLOG EVENTS causing test to be non-deterministic.
mysql-test/suite/rpl_ndb/r/rpl_ndb_log.result:
  Result change.
sql/log.cc:
  Adding variable at_least_one_stmt to denote that there is at least one
  statement committed to the transaction cache (but there might be more).
  
  Removing duplicate checks from binlog_end_trans(). The transaction cache
  should always be committed or rolled back when this function is called.
  
  Correcting conditions for binlog_rollback() and binlog_commit() and removing
  the previous "invisible commit" in favor of always using explicit commits
  in the binary log.
sql/log_event.cc:
  Marking table map event to be cached. Removing Muted_query_log_event from code.
sql/log_event.h:
  Removing unused class Muted_query_log_event.
sql/sql_insert.cc:
  Adding missing call to ha_autocommit_or_rollback() for delayed thread. Marking
  CREATE-SELECT statements as transactional, since they don't need to be logged.
parent 41a80039
......@@ -15,7 +15,6 @@ SELECT * FROM t1 ORDER BY a;
sync_slave_with_master;
connection master;
source include/show_binlog_events.inc;
sync_slave_with_master;
SELECT * FROM t1 ORDER BY a;
connection master;
......
......@@ -9,8 +9,10 @@ EXECUTE stmt1 USING @var1;
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; CREATE TABLE t1(f1 blob)
master-bin.000001 # Query # # use `test`; BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # use `test`; COMMIT
SELECT HEX(f1) FROM t1;
HEX(f1)
8300
......
DROP TABLE IF EXISTS t1;
==== Test BUG#32407 ====
select * from t1;
a
......
......@@ -78,8 +78,10 @@ UPDATE t1n, t1b SET e = 2, b = 3 WHERE f = c;
ERROR HY000: Binary logging not possible. Message: Row-based format required for this statement, but not allowed by this combination of engines
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1m)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # use `test`; COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1n)
master-bin.000001 # Table_map # # table_id: # (mysql.ndb_apply_status)
......
......@@ -1085,9 +1085,11 @@ show binlog events from 0;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 4 Format_desc 1 106 Server version, Binlog ver: 4
master-bin.000001 106 Query 1 227 use `test`; create table t1 (a bigint unsigned, b bigint(20) unsigned)
master-bin.000001 227 Table_map 1 269 table_id: # (test.t1)
master-bin.000001 269 Write_rows 1 315 table_id: # flags: STMT_END_F
master-bin.000001 315 Query 1 391 use `test`; drop table t1
master-bin.000001 227 Query 1 295 use `test`; BEGIN
master-bin.000001 295 Table_map 1 337 table_id: # (test.t1)
master-bin.000001 337 Write_rows 1 383 table_id: # flags: STMT_END_F
master-bin.000001 383 Query 1 452 use `test`; COMMIT
master-bin.000001 452 Query 1 528 use `test`; drop table t1
End of 5.0 tests
reset master;
create table t1 (id tinyint auto_increment primary key);
......@@ -1111,8 +1113,10 @@ use test;
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; create table t1 (id tinyint auto_increment primary key)
master-bin.000001 # Query # # use `test`; BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # use `test`; COMMIT
master-bin.000001 # Query # # use `test`; drop table t1
master-bin.000001 # Query # # use `test`; create table t1 (a int)
master-bin.000001 # Query # # use `test`; BEGIN
......@@ -1123,12 +1127,18 @@ master-bin.000001 # Query # # use `test`; COMMIT
master-bin.000001 # Query # # use `test`; CREATE TABLE IF NOT EXISTS `t3` (
`a` int(11) DEFAULT NULL
)
master-bin.000001 # Query # # use `mysql`; BEGIN
master-bin.000001 # Table_map # # table_id: # (mysql.user)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # use `mysql`; COMMIT
master-bin.000001 # Query # # use `mysql`; BEGIN
master-bin.000001 # Table_map # # table_id: # (mysql.user)
master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # use `mysql`; COMMIT
master-bin.000001 # Query # # use `mysql`; BEGIN
master-bin.000001 # Table_map # # table_id: # (mysql.user)
master-bin.000001 # Delete_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # use `mysql`; COMMIT
drop table t1,t2,t3,tt1;
create table t1 (a int not null auto_increment, primary key (a)) engine=myisam;
set @@session.auto_increment_increment=1, @@session.auto_increment_offset=1;
......@@ -1138,8 +1148,10 @@ insert delayed into t1 values (300);
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; create table t1 (id tinyint auto_increment primary key)
master-bin.000001 # Query # # use `test`; BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # use `test`; COMMIT
master-bin.000001 # Query # # use `test`; drop table t1
master-bin.000001 # Query # # use `test`; create table t1 (a int)
master-bin.000001 # Query # # use `test`; BEGIN
......@@ -1150,20 +1162,32 @@ master-bin.000001 # Query # # use `test`; COMMIT
master-bin.000001 # Query # # use `test`; CREATE TABLE IF NOT EXISTS `t3` (
`a` int(11) DEFAULT NULL
)
master-bin.000001 # Query # # use `mysql`; BEGIN
master-bin.000001 # Table_map # # table_id: # (mysql.user)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # use `mysql`; COMMIT
master-bin.000001 # Query # # use `mysql`; BEGIN
master-bin.000001 # Table_map # # table_id: # (mysql.user)
master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # use `mysql`; COMMIT
master-bin.000001 # Query # # use `mysql`; BEGIN
master-bin.000001 # Table_map # # table_id: # (mysql.user)
master-bin.000001 # Delete_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # use `mysql`; COMMIT
master-bin.000001 # Query # # use `test`; DROP TABLE `t1`,`t2`,`t3` /* generated by server */
master-bin.000001 # Query # # use `test`; create table t1 (a int not null auto_increment, primary key (a)) engine=myisam
master-bin.000001 # Query # # use `test`; BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # use `test`; COMMIT
master-bin.000001 # Query # # use `test`; BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # use `test`; COMMIT
master-bin.000001 # Query # # use `test`; BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # use `test`; COMMIT
insert delayed into t1 values (null),(null),(null),(null);
insert delayed into t1 values (null),(null),(400),(null);
11 == 11
......
......@@ -5,13 +5,26 @@ reset master;
insert into t2 values (@v);
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t2)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # use `test`; COMMIT
flush logs;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
ROLLBACK/*!*/;
use test/*!*/;
SET TIMESTAMP=10000/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
SET @@session.sql_mode=0/*!*/;
/*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
BEGIN
/*!*/;
SET TIMESTAMP=10000/*!*/;
COMMIT
/*!*/;
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
......
......@@ -8,8 +8,10 @@ insert into t1 select * from t2;
ERROR 23000: Duplicate entry '2' for key 'a'
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # use `test`; ROLLBACK
select * from t1;
a
1
......
......@@ -117,8 +117,10 @@ master-bin.000001 # Query # # use `test`; BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Query # # use `test`; BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t2)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # use `test`; COMMIT
delete from t1;
delete from t2;
reset master;
......@@ -131,8 +133,10 @@ master-bin.000001 # Query # # use `test`; BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Query # # use `test`; BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t2)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # use `test`; COMMIT
insert into t1 values(11);
commit;
show binlog events from <binlog_start>;
......@@ -141,8 +145,10 @@ master-bin.000001 # Query # # use `test`; BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Query # # use `test`; BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t2)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # use `test`; COMMIT
master-bin.000001 # Query # # use `test`; BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
......@@ -272,14 +278,20 @@ master-bin.000001 # Query # # use `test`; BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Query # # use `test`; BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t2)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # use `test`; COMMIT
master-bin.000001 # Query # # use `test`; drop table t1,t2
master-bin.000001 # Query # # use `test`; create table t0 (n int)
master-bin.000001 # Query # # use `test`; BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t0)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # use `test`; COMMIT
master-bin.000001 # Query # # use `test`; BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t0)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # use `test`; COMMIT
master-bin.000001 # Query # # use `test`; create table t2 (n int) engine=innodb
do release_lock("lock1");
drop table t0,t2;
......@@ -362,38 +374,52 @@ a b
DROP TABLE t1,t2;
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # use `test`; COMMIT
master-bin.000001 # Query # # use `test`; DROP TABLE if exists t2
master-bin.000001 # Query # # use `test`; BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # use `test`; COMMIT
master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS t2
master-bin.000001 # Query # # use `test`; CREATE TABLE t2 (a int, b int, primary key (a)) engine=innodb
master-bin.000001 # Query # # use `test`; BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # use `test`; COMMIT
master-bin.000001 # Query # # use `test`; BEGIN
master-bin.000001 # Query # # use `test`; TRUNCATE table t2
master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # use `test`; BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t2)
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # use `test`; COMMIT
master-bin.000001 # Query # # use `test`; DROP TABLE t2
master-bin.000001 # Query # # use `test`; BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # use `test`; COMMIT
master-bin.000001 # Query # # use `test`; BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # use `test`; COMMIT
master-bin.000001 # Query # # use `test`; BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # use `test`; COMMIT
master-bin.000001 # Query # # use `test`; BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # use `test`; COMMIT
master-bin.000001 # Query # # use `test`; BEGIN
master-bin.000001 # Query # # use `test`; TRUNCATE table t2
master-bin.000001 # Query # # use `test`; COMMIT
master-bin.000001 # Query # # use `test`; BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # use `test`; COMMIT
master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
reset master;
create table t1 (a int) engine=innodb;
......@@ -489,9 +515,11 @@ insert into t2 values (bug27417(2));
ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t2)
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # use `test`; ROLLBACK
/* only (!) with fixes for #23333 will show there is the query */;
select count(*) from t1 /* must be 3 */;
count(*)
......@@ -506,9 +534,11 @@ count(*)
2
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t2)
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # use `test`; COMMIT
/* the query must be in regardless of #23333 */;
select count(*) from t1 /* must be 5 */;
count(*)
......@@ -564,11 +594,13 @@ update t3 set b=b+bug27417(1);
ERROR 23000: Duplicate entry '4' for key 'b'
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t3)
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Update_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # use `test`; ROLLBACK
/* the output must denote there is the query */;
select count(*) from t1 /* must be 2 */;
count(*)
......
......@@ -648,12 +648,18 @@ master-bin.000001 # Query # # use `mysql`; UPDATE user SET password=password('An
master-bin.000001 # Query # # use `mysql`; DELETE FROM user WHERE host='localhost' AND user='@#@'
master-bin.000001 # Query # # use `test`; drop table t1,t2,t3,tt1
master-bin.000001 # Query # # use `test`; create table t1 (a int not null auto_increment, primary key (a)) engine=myisam
master-bin.000001 # Query # # use `test`; BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # use `test`; COMMIT
master-bin.000001 # Query # # use `test`; BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # use `test`; COMMIT
master-bin.000001 # Query # # use `test`; BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # use `test`; COMMIT
insert delayed into t1 values (null),(null),(null),(null);
insert delayed into t1 values (null),(null),(400),(null);
11 == 11
......
......@@ -9,6 +9,9 @@
# BINLOG statement does not work in embedded mode.
source include/not_embedded.inc;
disable_warnings;
DROP TABLE IF EXISTS t1;
enable_warnings;
# Test to show BUG#32407. This reads a binlog created with the
# mysql-5.1-telco-6.1 tree, specifically at the tag
......
......@@ -18,8 +18,10 @@ 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 # Query 1 # use `test`; CREATE TABLE t1 (a INT, b LONG)
master-bin.000001 # Query 1 # use `test`; INSERT INTO t1 VALUES (1,1), (2,2)
master-bin.000001 # Query 1 # use `test`; BEGIN
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
**** On Slave ****
SHOW SLAVE STATUS;
Slave_IO_State #
......@@ -28,7 +30,7 @@ Master_User root
Master_Port MASTER_PORT
Connect_Retry 1
Master_Log_File master-bin.000001
Read_Master_Log_Pos 457
Read_Master_Log_Pos 594
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
......@@ -43,7 +45,7 @@ Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
Exec_Master_Log_Pos 457
Exec_Master_Log_Pos 594
Relay_Log_Space #
Until_Condition None
Until_Log_File
......@@ -66,6 +68,8 @@ slave-bin.000001 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4
slave-bin.000001 # Query 2 # use `test`; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9
slave-bin.000001 # Query 1 # use `test`; CREATE TABLE t1 (a INT, b LONG)
slave-bin.000001 # Query 1 # use `test`; INSERT INTO t1 VALUES (1,1), (2,2)
slave-bin.000001 # Query 1 # use `test`; BEGIN
slave-bin.000001 # Table_map 1 # table_id: # (test.t1)
slave-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
slave-bin.000001 # Query 1 # use `test`; COMMIT
DROP TABLE IF EXISTS t1;
......@@ -27,8 +27,10 @@ INSERT INTO t2 VALUES (3,3), (4,4);
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT, b INT)
master-bin.000001 # Query # # use `test`; BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # use `test`; COMMIT
**** On Slave ****
SHOW DATABASES;
Database
......@@ -56,8 +58,10 @@ SHOW BINLOG EVENTS;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 4 Format_desc 1 106 Server ver: SERVER_VERSION, Binlog ver: 4
master-bin.000001 106 Query 1 192 use `test`; CREATE TABLE t1 (a INT)
master-bin.000001 192 Table_map 1 233 table_id: # (test.t1)
master-bin.000001 233 Write_rows 1 272 table_id: # flags: STMT_END_F
master-bin.000001 192 Query 1 260 use `test`; BEGIN
master-bin.000001 260 Table_map 1 301 table_id: # (test.t1)
master-bin.000001 301 Write_rows 1 340 table_id: # flags: STMT_END_F
master-bin.000001 340 Query 1 409 use `test`; COMMIT
DROP TABLE t1;
================ Test for BUG#17620 ================
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
......
......@@ -140,8 +140,10 @@ a b
SHOW BINLOG EVENTS FROM 1374;
Log_name Pos Event_type Server_id End_log_pos Info
# 1374 Query # 1474 use `test`; CREATE TABLE t7 (a INT, b INT UNIQUE)
# 1474 Table_map # 1516 table_id: # (test.t7)
# 1516 Write_rows # 1572 table_id: # flags: STMT_END_F
# 1474 Query # 1542 use `test`; BEGIN
# 1542 Table_map # 1584 table_id: # (test.t7)
# 1584 Write_rows # 1640 table_id: # flags: STMT_END_F
# 1640 Query # 1711 use `test`; ROLLBACK
SELECT * FROM t7 ORDER BY a,b;
a b
1 2
......@@ -154,10 +156,12 @@ INSERT INTO t7 SELECT a,b FROM tt4;
ROLLBACK;
Warnings:
Warning 1196 Some non-transactional changed tables couldn't be rolled back
SHOW BINLOG EVENTS FROM 1572;
SHOW BINLOG EVENTS FROM 1711;
Log_name Pos Event_type Server_id End_log_pos Info
# 1572 Table_map # 1614 table_id: # (test.t7)
# 1614 Write_rows # 1670 table_id: # flags: STMT_END_F
# 1711 Query # 1779 use `test`; BEGIN
# 1779 Table_map # 1821 table_id: # (test.t7)
# 1821 Write_rows # 1877 table_id: # flags: STMT_END_F
# 1877 Query # 1946 use `test`; COMMIT
SELECT * FROM t7 ORDER BY a,b;
a b
1 2
......@@ -192,10 +196,10 @@ Create Table CREATE TABLE `t9` (
`a` int(11) DEFAULT NULL,
`b` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SHOW BINLOG EVENTS FROM 1670;
SHOW BINLOG EVENTS FROM 1946;
Log_name Pos Event_type Server_id End_log_pos Info
# 1670 Query # 1756 use `test`; CREATE TABLE t8 LIKE t4
# 1756 Query # 1895 use `test`; CREATE TABLE `t9` (
# 1946 Query # 2032 use `test`; CREATE TABLE t8 LIKE t4
# 2032 Query # 2171 use `test`; CREATE TABLE `t9` (
`a` int(11) DEFAULT NULL,
`b` int(11) DEFAULT NULL
)
......@@ -276,31 +280,35 @@ SHOW BINLOG EVENTS;
Log_name Pos Event_type Server_id End_log_pos Info
# 4 Format_desc # 106 Server ver: #, Binlog ver: #
# 106 Query # 192 use `test`; CREATE TABLE t1 (a INT)
# 192 Table_map # 233 table_id: # (test.t1)
# 233 Write_rows # 277 table_id: # flags: STMT_END_F
# 277 Query # 345 use `test`; BEGIN
# 345 Query # 470 use `test`; CREATE TABLE `t2` (
# 192 Query # 260 use `test`; BEGIN
# 260 Table_map # 301 table_id: # (test.t1)
# 301 Write_rows # 345 table_id: # flags: STMT_END_F
# 345 Query # 414 use `test`; COMMIT
# 414 Query # 482 use `test`; BEGIN
# 482 Query # 607 use `test`; CREATE TABLE `t2` (
`a` int(11) DEFAULT NULL
) ENGINE=InnoDB
# 470 Table_map # 511 table_id: # (test.t2)
# 511 Write_rows # 555 table_id: # flags: STMT_END_F
# 555 Xid # 582 COMMIT /* XID */
# 582 Query # 650 use `test`; BEGIN
# 650 Query # 775 use `test`; CREATE TABLE `t3` (
# 607 Table_map # 648 table_id: # (test.t2)
# 648 Write_rows # 692 table_id: # flags: STMT_END_F
# 692 Xid # 719 COMMIT /* XID */
# 719 Query # 787 use `test`; BEGIN
# 787 Query # 912 use `test`; CREATE TABLE `t3` (
`a` int(11) DEFAULT NULL
) ENGINE=InnoDB
# 775 Table_map # 816 table_id: # (test.t3)
# 816 Write_rows # 860 table_id: # flags: STMT_END_F
# 860 Xid # 887 COMMIT /* XID */
# 887 Query # 955 use `test`; BEGIN
# 955 Query # 1080 use `test`; CREATE TABLE `t4` (
# 912 Table_map # 953 table_id: # (test.t3)
# 953 Write_rows # 997 table_id: # flags: STMT_END_F
# 997 Xid # 1024 COMMIT /* XID */
# 1024 Query # 1092 use `test`; BEGIN
# 1092 Query # 1217 use `test`; CREATE TABLE `t4` (
`a` int(11) DEFAULT NULL
) ENGINE=InnoDB
# 1080 Table_map # 1121 table_id: # (test.t4)
# 1121 Write_rows # 1165 table_id: # flags: STMT_END_F
# 1165 Xid # 1192 COMMIT /* XID */
# 1192 Table_map # 1233 table_id: # (test.t1)
# 1233 Write_rows # 1277 table_id: # flags: STMT_END_F
# 1217 Table_map # 1258 table_id: # (test.t4)
# 1258 Write_rows # 1302 table_id: # flags: STMT_END_F
# 1302 Xid # 1329 COMMIT /* XID */
# 1329 Query # 1397 use `test`; BEGIN
# 1397 Table_map # 1438 table_id: # (test.t1)
# 1438 Write_rows # 1482 table_id: # flags: STMT_END_F
# 1482 Query # 1551 use `test`; COMMIT
SHOW TABLES;
Tables_in_test
t1
......@@ -367,15 +375,17 @@ SHOW BINLOG EVENTS;
Log_name Pos Event_type Server_id End_log_pos Info
# 4 Format_desc # 106 Server ver: #, Binlog ver: #
# 106 Query # 192 use `test`; CREATE TABLE t1 (a INT)
# 192 Table_map # 233 table_id: # (test.t1)
# 233 Write_rows # 277 table_id: # flags: STMT_END_F
# 277 Query # 377 use `test`; CREATE TABLE t2 (a INT) ENGINE=INNODB
# 377 Query # 445 use `test`; BEGIN
# 445 Table_map # 486 table_id: # (test.t2)
# 486 Write_rows # 530 table_id: # flags: STMT_END_F
# 530 Table_map # 571 table_id: # (test.t2)
# 571 Write_rows # 610 table_id: # flags: STMT_END_F
# 610 Xid # 637 COMMIT /* XID */
# 192 Query # 260 use `test`; BEGIN
# 260 Table_map # 301 table_id: # (test.t1)
# 301 Write_rows # 345 table_id: # flags: STMT_END_F
# 345 Query # 414 use `test`; COMMIT
# 414 Query # 514 use `test`; CREATE TABLE t2 (a INT) ENGINE=INNODB
# 514 Query # 582 use `test`; BEGIN
# 582 Table_map # 623 table_id: # (test.t2)
# 623 Write_rows # 667 table_id: # flags: STMT_END_F
# 667 Table_map # 708 table_id: # (test.t2)
# 708 Write_rows # 747 table_id: # flags: STMT_END_F
# 747 Xid # 774 COMMIT /* XID */
SELECT * FROM t2 ORDER BY a;
a
1
......@@ -396,17 +406,14 @@ Warnings:
Warning 1196 Some non-transactional changed tables couldn't be rolled back
SELECT * FROM t2 ORDER BY a;
a
SHOW BINLOG EVENTS FROM 637;
SHOW BINLOG EVENTS FROM 949;
Log_name Pos Event_type Server_id End_log_pos Info
# 637 Query # 705 use `test`; BEGIN
# 705 Query # 785 use `test`; TRUNCATE TABLE t2
# 785 Xid # 812 COMMIT /* XID */
# 812 Query # 880 use `test`; BEGIN
# 880 Table_map # 921 table_id: # (test.t2)
# 921 Write_rows # 965 table_id: # flags: STMT_END_F
# 965 Table_map # 1006 table_id: # (test.t2)
# 1006 Write_rows # 1045 table_id: # flags: STMT_END_F
# 1045 Query # 1116 use `test`; ROLLBACK
# 949 Query # 1017 use `test`; BEGIN
# 1017 Table_map # 1058 table_id: # (test.t2)
# 1058 Write_rows # 1102 table_id: # flags: STMT_END_F
# 1102 Table_map # 1143 table_id: # (test.t2)
# 1143 Write_rows # 1182 table_id: # flags: STMT_END_F
# 1182 Query # 1253 use `test`; ROLLBACK
SELECT * FROM t2 ORDER BY a;
a
DROP TABLE t1,t2;
......@@ -14,16 +14,6 @@ a
1
2
3
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; create table t1(a int not null primary key) engine=myisam
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # use `test`; flush tables
SELECT * FROM t1 ORDER BY a;
a
1
......
......@@ -12,13 +12,13 @@ create table t4 (a int);
insert into t4 select * from t3;
rename table t1 to t5, t2 to t1;
flush no_write_to_binlog tables;
SHOW BINLOG EVENTS FROM 623 ;
SHOW BINLOG EVENTS FROM 897 ;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query 1 # use `test`; rename table t1 to t5, t2 to t1
select * from t3;
a
flush tables;
SHOW BINLOG EVENTS FROM 623 ;
SHOW BINLOG EVENTS FROM 897 ;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query 1 # use `test`; rename table t1 to t5, t2 to t1
master-bin.000001 # Query 1 # use `test`; flush tables
......
......@@ -24,7 +24,7 @@ Master_User root
Master_Port MASTER_PORT
Connect_Retry 1
Master_Log_File master-bin.000001
Read_Master_Log_Pos 605
Read_Master_Log_Pos 1153
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
......@@ -39,7 +39,7 @@ Replicate_Wild_Ignore_Table
Last_Errno 1146
Last_Error Error 'Table 'test.t1' doesn't exist' on opening table `test`.`t1`
Skip_Counter 0
Exec_Master_Log_Pos 530
Exec_Master_Log_Pos 941
Relay_Log_Space #
Until_Condition None
Until_Log_File
......
......@@ -20,22 +20,26 @@ show binlog events;
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 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
master-bin.000001 # Query 1 # use `test`; BEGIN
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`; 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`; BEGIN
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
show binlog events from 106 limit 1;
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
show binlog events from 106 limit 2;
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 # Table_map 1 # table_id: # (test.t1)
master-bin.000001 # Query 1 # use `test`; BEGIN
show binlog events from 106 limit 2,1;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map 1 # table_id: # (test.t1)
flush logs;
create table t3 (a int)ENGINE=MyISAM;
select * from t1 order by 1 asc;
......@@ -192,47 +196,59 @@ insert into t2 values (1);
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
master-bin.000001 # Query # # use `test`; BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # use `test`; COMMIT
master-bin.000001 # Query # # use `test`; drop table t1
master-bin.000001 # Query # # use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM
master-bin.000001 # Query # # use `test`; BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # use `test`; COMMIT
master-bin.000001 # Rotate # # master-bin.000002;pos=4
show binlog events in 'master-bin.000002';
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 # Query 1 # use `test`; create table t3 (a int)ENGINE=MyISAM
master-bin.000002 # Query 1 # use `test`; create table t2 (n int)ENGINE=MyISAM
master-bin.000002 # Query 1 # use `test`; BEGIN
master-bin.000002 # Table_map 1 # table_id: # (test.t2)
master-bin.000002 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000002 # Query 1 # use `test`; COMMIT
show binary logs;
Log_name File_size
master-bin.000001 1266
master-bin.000002 379
master-bin.000001 1540
master-bin.000002 516
start slave;
show binary logs;
Log_name File_size
slave-bin.000001 1364
slave-bin.000002 280
slave-bin.000001 1638
slave-bin.000002 417
show binlog events in 'slave-bin.000001' from 4;
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 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
slave-bin.000001 # Query 1 # use `test`; BEGIN
slave-bin.000001 # Table_map 1 # table_id: # (test.t1)
slave-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
slave-bin.000001 # Query 1 # use `test`; COMMIT
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`; BEGIN
slave-bin.000001 # Table_map 1 # table_id: # (test.t1)
slave-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
slave-bin.000001 # Query 1 # use `test`; COMMIT
slave-bin.000001 # Query 1 # use `test`; create table t3 (a int)ENGINE=MyISAM
slave-bin.000001 # Rotate 2 # slave-bin.000002;pos=4
show binlog events in 'slave-bin.000002' from 4;
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 # Query 1 # use `test`; create table t2 (n int)ENGINE=MyISAM
slave-bin.000002 # Query 1 # use `test`; BEGIN
slave-bin.000002 # Table_map 1 # table_id: # (test.t2)
slave-bin.000002 # Write_rows 1 # table_id: # flags: STMT_END_F
slave-bin.000002 # Query 1 # use `test`; COMMIT
SHOW SLAVE STATUS;
Slave_IO_State #
Master_Host 127.0.0.1
......@@ -240,7 +256,7 @@ Master_User root
Master_Port MASTER_PORT
Connect_Retry 1
Master_Log_File master-bin.000002
Read_Master_Log_Pos 379
Read_Master_Log_Pos 516
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000002
......@@ -255,7 +271,7 @@ Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
Exec_Master_Log_Pos 379
Exec_Master_Log_Pos 516
Relay_Log_Space #
Until_Condition None
Until_Log_File
......@@ -284,8 +300,10 @@ set insert_id=5;
insert into t1 values (NULL, last_insert_id()), (NULL, last_insert_id());
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # use `test`; COMMIT
select * from t1;
a b
1 1
......
......@@ -300,8 +300,10 @@ set insert_id=5;
insert into t1 values (NULL, last_insert_id()), (NULL, last_insert_id());
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # use `test`; COMMIT
select * from t1;
a b
1 1
......
......@@ -26,7 +26,7 @@ Master_User root
Master_Port MASTER_PORT
Connect_Retry 1
Master_Log_File master-bin.000001
Read_Master_Log_Pos 750
Read_Master_Log_Pos 1161
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
......@@ -41,7 +41,7 @@ Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
Exec_Master_Log_Pos 317
Exec_Master_Log_Pos 454
Relay_Log_Space #
Until_Condition Master
Until_Log_File master-bin.000001
......@@ -72,7 +72,7 @@ Master_User root
Master_Port MASTER_PORT
Connect_Retry 1
Master_Log_File master-bin.000001
Read_Master_Log_Pos 750
Read_Master_Log_Pos 1161
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
......@@ -87,7 +87,7 @@ Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
Exec_Master_Log_Pos 317
Exec_Master_Log_Pos 454
Relay_Log_Space #
Until_Condition Master
Until_Log_File master-no-such-bin.000001
......@@ -104,7 +104,7 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
start slave until relay_log_file='slave-relay-bin.000004', relay_log_pos=728;
start slave until relay_log_file='slave-relay-bin.000004', relay_log_pos=1014;
select * from t2;
n
1
......@@ -116,7 +116,7 @@ Master_User root
Master_Port MASTER_PORT
Connect_Retry 1
Master_Log_File master-bin.000001
Read_Master_Log_Pos 750
Read_Master_Log_Pos 1161
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
......@@ -131,11 +131,11 @@ Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
Exec_Master_Log_Pos 594
Exec_Master_Log_Pos 868
Relay_Log_Space #
Until_Condition Relay
Until_Log_File slave-relay-bin.000004
Until_Log_Pos 728
Until_Log_Pos 1014
Master_SSL_Allowed No
Master_SSL_CA_File
Master_SSL_CA_Path
......@@ -158,7 +158,7 @@ Master_User root
Master_Port MASTER_PORT
Connect_Retry 1
Master_Log_File master-bin.000001
Read_Master_Log_Pos 750
Read_Master_Log_Pos 1161
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
......@@ -173,7 +173,7 @@ Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
Exec_Master_Log_Pos 750
Exec_Master_Log_Pos 1161
Relay_Log_Space #
Until_Condition Master
Until_Log_File master-bin.000001
......
......@@ -17,14 +17,20 @@ show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT, b INT)
master-bin.000001 # Query # # use `test`; CREATE TABLE t2 (c INT, d INT)
master-bin.000001 # Query # # use `test`; BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # use `test`; COMMIT
master-bin.000001 # Query # # use `test`; BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t2)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # use `test`; COMMIT
master-bin.000001 # Query # # use `test`; BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Table_map # # table_id: # (test.t2)
master-bin.000001 # Update_rows # # table_id: #
master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # use `test`; COMMIT
SELECT * FROM t1;
a b
1 1
......@@ -36,7 +42,7 @@ c d
2 16
3 54
**** On Slave ****
START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=484;
START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=762;
SHOW SLAVE STATUS;
Slave_IO_State #
Master_Host 127.0.0.1
......@@ -44,7 +50,7 @@ Master_User root
Master_Port MASTER_PORT
Connect_Retry 1
Master_Log_File master-bin.000001
Read_Master_Log_Pos 722
Read_Master_Log_Pos 1133
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
......@@ -59,11 +65,11 @@ Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
Exec_Master_Log_Pos 488
Exec_Master_Log_Pos 762
Relay_Log_Space #
Until_Condition Master
Until_Log_File master-bin.000001
Until_Log_Pos 484
Until_Log_Pos 762
Master_SSL_Allowed No
Master_SSL_CA_File
Master_SSL_CA_Path
......
......@@ -114,8 +114,10 @@ show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS t1
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM
master-bin.000001 # Query # # use `test`; BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # use `test`; COMMIT
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1
master-bin.000001 # Query # # use `test`; DROP TABLE t1
RESET MASTER;
......@@ -230,9 +232,13 @@ show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS t1
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM
master-bin.000001 # Query # # use `test`; BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # use `test`; COMMIT
master-bin.000001 # Query # # use `test`; BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Delete_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # use `test`; COMMIT
master-bin.000001 # Query # # use `test`; DROP TABLE t1
RESET MASTER;
......@@ -94,7 +94,7 @@ INSERT INTO t7 SELECT a,b FROM tt4;
ROLLBACK;
--replace_column 1 # 4 #
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
SHOW BINLOG EVENTS FROM 1572;
SHOW BINLOG EVENTS FROM 1711;
SELECT * FROM t7 ORDER BY a,b;
sync_slave_with_master;
SELECT * FROM t7 ORDER BY a,b;
......@@ -110,7 +110,7 @@ CREATE TEMPORARY TABLE tt7 SELECT 1;
--query_vertical SHOW CREATE TABLE t9
--replace_column 1 # 4 #
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
SHOW BINLOG EVENTS FROM 1670;
SHOW BINLOG EVENTS FROM 1946;
sync_slave_with_master;
--echo **** On Slave ****
--query_vertical SHOW CREATE TABLE t8
......@@ -227,7 +227,7 @@ ROLLBACK;
SELECT * FROM t2 ORDER BY a;
--replace_column 1 # 4 #
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /Server ver: .*, Binlog ver: .*/Server ver: #, Binlog ver: #/ /table_id: [0-9]+/table_id: #/
SHOW BINLOG EVENTS FROM 637;
SHOW BINLOG EVENTS FROM 949;
sync_slave_with_master;
SELECT * FROM t2 ORDER BY a;
......
# depends on the binlog output
-- source include/have_binlog_format_row.inc
let $rename_event_pos= 623;
let $rename_event_pos= 897;
# Bug#18326: Do not lock table for writing during prepare of statement
# The use of the ps protocol causes extra table maps in the binlog, so
......
......@@ -164,12 +164,12 @@ connection master;
# this test for position option
# By setting this position to 413, we should only get the create of t3
# By setting this position to 416, we should only get the create of t3
--disable_query_log
select "--- Test 2 position test --" as "";
--enable_query_log
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --position=416 $MYSQLTEST_VARDIR/log/master-bin.000001
--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --position=416 --stop-position=569 $MYSQLTEST_VARDIR/log/master-bin.000001
# These are tests for remote binlog.
# They should return the same as previous test.
......@@ -180,7 +180,7 @@ select "--- Test 3 First Remote test --" as "";
# This is broken now
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --stop-position=569 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
# This part is disabled due to bug #17654
......@@ -246,12 +246,17 @@ connection master;
--exec rm $MYSQLTEST_VARDIR/tmp/remote.sql
################### End Bug 17654 ######################
# What is the point of this test? It seems entirely pointless. It
# might make sense for statement-based replication, but for row-based
# replication the LOAD DATA INFILE is printed just as empty
# transactions. /Matz
# LOAD DATA
--disable_query_log
select "--- Test 5 LOAD DATA --" as "";
--enable_query_log
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002
--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --stop-position=106 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002
# Bug#7853 (mysqlbinlog does not accept input from stdin)
......@@ -259,13 +264,13 @@ select "--- Test 5 LOAD DATA --" as "";
select "--- Test 6 reading stdin --" as "";
--enable_query_log
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
--exec $MYSQL_BINLOG --short-form - < $MYSQLTEST_VARDIR/log/master-bin.000001
--exec $MYSQL_BINLOG --short-form --stop-position=569 - < $MYSQLTEST_VARDIR/log/master-bin.000001
--disable_query_log
select "--- Test 7 reading stdin w/position --" as "";
--enable_query_log
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
--exec $MYSQL_BINLOG --short-form --position=416 - < $MYSQLTEST_VARDIR/log/master-bin.000001
--exec $MYSQL_BINLOG --short-form --position=416 --stop-position=569 - < $MYSQLTEST_VARDIR/log/master-bin.000001
# Bug#16217 (mysql client did not know how not switch its internal charset)
--disable_query_log
......
......@@ -42,7 +42,7 @@ select * from t1;
source include/show_slave_status.inc;
# try replicate all up to and not including the second insert to t2;
start slave until relay_log_file='slave-relay-bin.000004', relay_log_pos=728;
start slave until relay_log_file='slave-relay-bin.000004', relay_log_pos=1014;
--source include/wait_for_slave_sql_to_stop.inc
select * from t2;
source include/show_slave_status.inc;
......
......@@ -26,7 +26,7 @@ save_master_pos;
connection slave;
# Stop when reaching the the first table map event.
START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=484;
START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=762;
wait_for_slave_to_stop;
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 8 # 9 # 23 # 33 # 35 # 36 #
......
......@@ -526,6 +526,7 @@ sync_slave_with_master;
#
connection master;
let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
# Just to get something that is non-trivial, albeit still simple, we
# stuff the result of USER() and CURRENT_USER() into a variable.
......@@ -571,7 +572,6 @@ sync_slave_with_master;
diff_files $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_master.sql $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_slave.sql;
connection master;
source include/show_binlog_events.inc;
# Now test that mysqlbinlog works fine on a binlog generated by the
# mixed mode
......
......@@ -316,8 +316,10 @@ set insert_id=5;
insert into t1 values (NULL, last_insert_id()), (NULL, last_insert_id());
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # use `test`; COMMIT
select * from t1;
a b
1 1
......
This diff is collapsed.
......@@ -2602,21 +2602,6 @@ Query_log_event::do_shall_skip(Relay_log_info *rli)
#endif
/**************************************************************************
Muted_query_log_event methods
**************************************************************************/
#ifndef MYSQL_CLIENT
/*
Muted_query_log_event::Muted_query_log_event()
*/
Muted_query_log_event::Muted_query_log_event()
:Query_log_event()
{
}
#endif
/**************************************************************************
Start_log_event_v3 methods
**************************************************************************/
......@@ -7054,7 +7039,7 @@ int Table_map_log_event::save_field_metadata()
#if !defined(MYSQL_CLIENT)
Table_map_log_event::Table_map_log_event(THD *thd, TABLE *tbl, ulong tid,
bool is_transactional, uint16 flags)
: Log_event(thd, 0, is_transactional),
: Log_event(thd, 0, true),
m_table(tbl),
m_dbnam(tbl->s->db.str),
m_dblen(m_dbnam ? tbl->s->db.length : 0),
......
......@@ -1614,31 +1614,6 @@ class Query_log_event: public Log_event
};
/**
@class Muted_query_log_event
Pretends to log SQL queries, but doesn't actually do so. This is
used internally only and never written to any binlog.
@section Muted_query_log_event_binary_format Binary Format
This log event is not stored, and thus the binary format is 0 bytes
long. Note that not even the Common-Header is stored.
*/
class Muted_query_log_event: public Query_log_event
{
public:
#ifndef MYSQL_CLIENT
Muted_query_log_event();
bool write(IO_CACHE* file) { return(false); };
virtual bool write_post_header_for_derived(IO_CACHE* file) { return FALSE; }
#else
Muted_query_log_event() {}
#endif
};
#ifdef HAVE_REPLICATION
/**
......
......@@ -2426,6 +2426,7 @@ pthread_handler_t handle_delayed_insert(void *arg)
*/
di->table->file->ha_release_auto_increment();
mysql_unlock_tables(thd, lock);
ha_autocommit_or_rollback(thd, 0);
di->group_count=0;
pthread_mutex_lock(&di->mutex);
}
......@@ -3676,14 +3677,11 @@ void select_create::abort()
{
DBUG_ENTER("select_create::abort");
/*
Disable binlog, because we "roll back" partial inserts in ::abort
by removing the table, even for non-transactional tables.
*/
tmp_disable_binlog(thd);
/*
In select_insert::abort() we roll back the statement, including
truncating the transaction cache of the binary log.
truncating the transaction cache of the binary log. To do this, we
pretend that the statement is transactional, even though it might
be the case that it was not.
We roll back the statement prior to deleting the table and prior
to releasing the lock on the table, since there might be potential
......@@ -3694,7 +3692,9 @@ void select_create::abort()
of the table succeeded or not, since we need to reset the binary
log state.
*/
tmp_disable_binlog(thd);
select_insert::abort();
thd->transaction.stmt.modified_non_trans_table= FALSE;
reenable_binlog(thd);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment