3607 Mats Kindahl 2012-01-15
WL#5223: Binary Log Group Commit
Fixing several issues in the tree:
- Splitting rotate and purge so that rotations are done under
lock (to prevent other threads from writing to the old binary
log) and purging is done outside locks.
- Splitting flush_and_sync into separate functions flush() and
do_maybe_sync().
- do_maybe_sync() may now commit multiple events, so logic has
to change to ensure that file is synced when more than N
events have been written to disk.
- Acquiring LOCK_log when rotating since it protects last_complete
and we will update it after the rotation.
- rotate_and_purge() is now only used for forced rotates, so
force_rotate parameter is removed and function logic is fixed
for this.
- Adding missing destroy of LOCK_server_started mutex.
- Adding sp_cache cleanup function, which was missing.
- Moving write_event_to_cache to be a member function of
the cache class instead of a friend function.
Also:
- Adding debug printouts to trace lock and unlock of binlog-
related mutexes.
- Adding (more) trace printouts to semi-sync code.
@ mysql-test/suite/rpl/t/rpl_binlog_errors.test
Fixing some tests that previously was not transactional but which
are now transactional.
@ mysql-test/t/mysqlbinlog.test
Removing hard-coded binlog file names.
@ plugin/semisync/semisync_master.cc
Adding trace printouts.
@ plugin/semisync/semisync_master_plugin.cc
Correcting name of callback function in comment.
modified:
mysql-test/extra/binlog_tests/binlog.test
mysql-test/r/mysqlbinlog.result
mysql-test/suite/binlog/r/binlog_row_binlog.result
mysql-test/suite/binlog/r/binlog_stm_binlog.result
mysql-test/suite/rpl/r/rpl_binlog_errors.result
mysql-test/suite/rpl/r/rpl_rotate_purge_deadlock.result
mysql-test/suite/rpl/t/rpl_binlog_errors.test
mysql-test/t/mysqlbinlog.test
plugin/semisync/semisync_master.cc
plugin/semisync/semisync_master_plugin.cc
sql/binlog.cc
sql/binlog.h
sql/handler.cc
sql/log.cc
sql/log.h
sql/mysqld.cc
sql/mysqld.h
sql/rpl_master.cc
sql/rpl_slave.cc
sql/sp_cache.cc
sql/sp_cache.h
sql/sql_class.h
sql/sql_reload.cc
sql/sys_vars.cc
3606 Mats Kindahl 2011-12-15
WL#5223: Binary Log Group Commit
Temporary commit.
Creating session variables and removing pointless hook.
modified:
mysql-test/suite/sys_vars/r/binlog_sync.result
mysql-test/suite/sys_vars/t/binlog_sync.test
plugin/semisync/semisync_master.cc
plugin/semisync/semisync_master_plugin.cc
sql/binlog.cc
sql/binlog.h
sql/mysqld.cc
sql/mysqld.h
sql/rpl_handler.cc
sql/rpl_injector.cc
sql/rpl_master.cc
sql/rpl_slave.cc
sql/sql_class.h
sql/sys_vars.cc
3605 Mats Kindahl 2011-12-11
WL#5223: Binary Log Group Commit
This patch contain several changes and fixes.
Updating result files and in some cases, tests.
Updating code to freeze and compute cache sizes before writing
it to the binary log. This means that the decision if the cache
fit into the current binary log or if the binary log needs to
be rotated is done before writing the cache.
Extending transaction information with after position, which
contain the position after the transaction is written.
Removing parameter from write_cache that is only used for
error injection.
Propagating error code up from start_reserve and finish_reserve.
Fixing an error that read the format description event from
the wrong position when starting in the middle of a binary log.
Removing a case of constructing a Query event inside sp_head
and using binlog_query instead.
Adding deprecation of sync_binlog in favor of binlog_sync_period.
Updating cache manager and cache classes to be more encapsuled:
- Providing the log to write to with the constructor and
using that internally.
- Creating dedicated statment cache class and subclassing
cache base class.
modified:
mysql-test/r/mysqld--help-notwin.result
mysql-test/suite/binlog/r/binlog_group_commit.result
mysql-test/suite/binlog/t/binlog_group_commit.test
mysql-test/suite/rpl/r/rpl_binlog_errors.result
mysql-test/suite/rpl/r/rpl_rotate_logs.result
mysql-test/suite/rpl/r/rpl_variables.result
mysql-test/suite/rpl/t/rpl_binlog_errors.test
mysql-test/suite/sys_vars/r/all_vars.result
mysql-test/suite/sys_vars/r/binlog_sync.result
mysql-test/suite/sys_vars/r/sync_binlog_basic.result
sql/binlog.cc
sql/binlog.h
sql/handler.cc
sql/log.h
sql/mysqld.cc
sql/rpl_master.cc
sql/rpl_slave.cc
sql/sp_head.cc
sql/sql_class.cc
sql/sql_class.h
sql/sys_vars.cc
=== modified file 'mysql-test/extra/binlog_tests/binlog.test'
--- a/mysql-test/extra/binlog_tests/binlog.test 2011-02-23 20:01:27 +0000
+++ b/mysql-test/extra/binlog_tests/binlog.test 2012-01-15 07:33:56 +0000
@@ -41,7 +41,7 @@ while ($1)
--enable_query_log
commit;
drop table t1;
---source include/show_binlog_events.inc
+--echo # Current file should just contain the DROP TABLE statement
--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
--source include/show_binlog_events.inc
--let $binlog_file=
=== modified file 'mysql-test/r/mysqlbinlog.result'
--- a/mysql-test/r/mysqlbinlog.result 2011-03-25 15:20:25 +0000
+++ b/mysql-test/r/mysqlbinlog.result 2012-01-15 07:33:56 +0000
@@ -82,15 +82,6 @@ LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR
SET TIMESTAMP=1000000000/*!*/;
COMMIT
/*!*/;
-SET TIMESTAMP=1000000000/*!*/;
-BEGIN
-/*!*/;
-SET TIMESTAMP=1000000000/*!*/;
-LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`word`)
-/*!*/;
-SET TIMESTAMP=1000000000/*!*/;
-COMMIT
-/*!*/;
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
@@ -122,6 +113,15 @@ SET TIMESTAMP=1000000000/*!*/;
BEGIN
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
+LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`word`)
+/*!*/;
+SET TIMESTAMP=1000000000/*!*/;
+COMMIT
+/*!*/;
+SET TIMESTAMP=1000000000/*!*/;
+BEGIN
+/*!*/;
+SET TIMESTAMP=1000000000/*!*/;
insert into t1 values ("Alas")
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
@@ -176,12 +176,6 @@ BEGIN
SET TIMESTAMP=1000000000/*!*/;
COMMIT
/*!*/;
-SET TIMESTAMP=1000000000/*!*/;
-BEGIN
-/*!*/;
-SET TIMESTAMP=1000000000/*!*/;
-COMMIT
-/*!*/;
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
@@ -283,15 +277,6 @@ LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR
SET TIMESTAMP=1000000000/*!*/;
COMMIT
/*!*/;
-SET TIMESTAMP=1000000000/*!*/;
-BEGIN
-/*!*/;
-SET TIMESTAMP=1000000000/*!*/;
-LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`word`)
-/*!*/;
-SET TIMESTAMP=1000000000/*!*/;
-COMMIT
-/*!*/;
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
@@ -323,6 +308,15 @@ SET TIMESTAMP=1000000000/*!*/;
BEGIN
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
+LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`word`)
+/*!*/;
+SET TIMESTAMP=1000000000/*!*/;
+COMMIT
+/*!*/;
+SET TIMESTAMP=1000000000/*!*/;
+BEGIN
+/*!*/;
+SET TIMESTAMP=1000000000/*!*/;
insert into t1 values ("Alas")
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
@@ -377,12 +371,6 @@ BEGIN
SET TIMESTAMP=1000000000/*!*/;
COMMIT
/*!*/;
-SET TIMESTAMP=1000000000/*!*/;
-BEGIN
-/*!*/;
-SET TIMESTAMP=1000000000/*!*/;
-COMMIT
-/*!*/;
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
@@ -643,9 +631,9 @@ We expect this value to be 1
The bug being tested was that 'Query' lines were not preceded by '#'
If the line is in the table, it had to have been preceded by a '#'
-SELECT COUNT(*) AS `BUG#28293_expect_3` FROM patch WHERE a LIKE '%Query%';
-BUG#28293_expect_3
-3
+SELECT COUNT(*) AS `BUG#28293_expect_1` FROM patch WHERE a LIKE '%Query%';
+BUG#28293_expect_1
+1
DROP TABLE patch;
FLUSH LOGS;
CREATE TABLE t1(a INT);
@@ -670,7 +658,7 @@ CREATE TABLE t1 (a INT, b CHAR(64));
flush logs;
INSERT INTO t1 VALUES (1,USER());
flush logs;
-mysqlbinlog var/log/master-bin.000018 > var/tmp/bug31611.sql
+mysqlbinlog var/log/PREVIOUS_BINLOG > var/tmp/bug31611.sql
mysql mysqltest1 -uuntrusted < var/tmp/bug31611.sql
INSERT INTO t1 VALUES (1,USER());
ERROR 42000: INSERT command denied to user 'untrusted'@'localhost' for table 't1'
@@ -696,7 +684,7 @@ an_int 1000
a_decimal 907.79
a_string Just a test
DROP TABLE t1;
->> mysqlbinlog var/log/master-bin.000020 > var/tmp/bug32580.sql
+>> mysqlbinlog var/log/PREVIOUS_BINLOG > var/tmp/bug32580.sql
>> mysql test < var/tmp/bug32580.sql
SELECT * FROM t1;
a_real 158.883
=== modified file 'mysql-test/suite/binlog/r/binlog_row_binlog.result'
--- a/mysql-test/suite/binlog/r/binlog_row_binlog.result 2011-02-23 20:01:27 +0000
+++ b/mysql-test/suite/binlog/r/binlog_row_binlog.result 2012-01-15 07:33:56 +0000
@@ -48,215 +48,10 @@ create table t1 (n int) engine=innodb;
begin;
commit;
drop table t1;
-show binlog events from <binlog_start>;
+# Current file should just contain the DROP TABLE statement
+show binlog events in 'master-bin.000003' 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) engine=innodb
-master-bin.000001 # Query # # BEGIN
-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 # 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 # 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 # 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 # 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 # 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 # 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 # 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 # 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 # 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 # 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 # 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 # 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 # 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 # 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 # 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 # 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 # 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 # 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 # 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 # 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 # 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 # 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 # 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 # 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 # 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 # 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 # 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 # 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 # 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 # 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 # 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 # 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 # 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 # Rotate # # master-bin.000002;pos=4
-show binlog events in 'master-bin.000002' from <binlog_start>;
-Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000002 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
+master-bin.000003 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
set @ac = @@autocommit;
set autocommit= 0;
reset master;
@@ -294,208 +89,6 @@ 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 char(255)) engine=innodb
master-bin.000001 # Query # # use `test`; flush status
-master-bin.000001 # Query # # BEGIN
-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 # 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 # 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 # 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 # 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 # 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 # 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 # 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 # 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 # 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 # 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 # 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 # 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 # 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 # 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 # 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 # 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 # 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 # 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 # 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 # 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 # 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 # 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 # 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 # 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 # 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 # 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 # 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 # 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 # 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 # 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 # 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 # 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 # 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 # Rotate # # master-bin.000002;pos=4
drop table t1;
set global binlog_cache_size=@bcs;
=== modified file 'mysql-test/suite/binlog/r/binlog_stm_binlog.result'
--- a/mysql-test/suite/binlog/r/binlog_stm_binlog.result 2011-02-23 20:01:27 +0000
+++ b/mysql-test/suite/binlog/r/binlog_stm_binlog.result 2012-01-15 07:33:56 +0000
@@ -35,115 +35,10 @@ create table t1 (n int) engine=innodb;
begin;
commit;
drop table t1;
-show binlog events from <binlog_start>;
+# Current file should just contain the DROP TABLE statement
+show binlog events in 'master-bin.000003' 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) engine=innodb
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; insert into t1 values(100 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(99 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(98 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(97 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(96 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(95 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(94 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(93 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(92 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(91 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(90 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(89 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(88 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(87 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(86 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(85 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(84 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(83 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(82 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(81 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(80 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(79 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(78 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(77 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(76 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(75 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(74 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(73 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(72 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(71 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(70 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(69 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(68 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(67 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(66 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(65 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(64 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(63 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(62 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(61 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(60 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(59 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(58 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(57 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(56 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(55 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(54 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(53 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(52 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(51 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(50 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(49 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(48 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(47 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(46 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(45 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(44 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(43 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(42 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(41 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(40 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(39 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(38 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(37 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(36 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(35 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(34 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(33 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(32 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(31 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(30 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(29 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(28 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(27 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(26 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(25 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(24 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(23 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(22 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(21 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(20 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(19 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(18 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(17 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(16 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(15 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(14 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(13 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(12 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(11 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(10 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(9 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(8 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(7 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(6 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(5 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(4 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(3 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(2 + 4)
-master-bin.000001 # Query # # use `test`; insert into t1 values(1 + 4)
-master-bin.000001 # Xid # # COMMIT /* XID */
-master-bin.000001 # Rotate # # master-bin.000002;pos=4
-show binlog events in 'master-bin.000002' from <binlog_start>;
-Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000002 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
+master-bin.000003 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
set @ac = @@autocommit;
set autocommit= 0;
reset master;
@@ -178,108 +73,6 @@ 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 char(255)) engine=innodb
master-bin.000001 # Query # # use `test`; flush status
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; insert into t1 values( 100, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 99, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 98, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 97, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 96, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 95, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 94, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 93, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 92, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 91, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 90, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 89, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 88, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 87, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 86, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 85, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 84, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 83, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 82, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 81, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 80, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 79, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 78, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 77, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 76, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 75, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 74, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 73, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 72, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 71, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 70, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 69, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 68, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 67, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 66, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 65, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 64, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 63, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 62, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 61, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 60, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 59, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 58, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 57, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 56, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 55, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 54, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 53, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 52, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 51, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 50, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 49, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 48, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 47, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 46, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 45, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 44, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 43, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 42, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 41, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 40, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 39, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 38, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 37, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 36, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 35, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 34, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 33, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 32, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 31, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 30, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 29, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 28, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 27, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 26, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 25, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 24, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 23, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 22, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 21, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 20, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 19, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 18, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 17, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 16, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 15, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 14, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 13, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 12, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 11, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 10, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 9, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 8, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 7, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 6, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 5, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 4, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 3, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 2, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Query # # use `test`; insert into t1 values( 1, 'just to fill void to make transaction occupying at least two buffers of the trans cache' )
-master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Rotate # # master-bin.000002;pos=4
drop table t1;
set global binlog_cache_size=@bcs;
=== modified file 'mysql-test/suite/rpl/r/rpl_binlog_errors.result'
--- a/mysql-test/suite/rpl/r/rpl_binlog_errors.result 2011-12-11 16:03:12 +0000
+++ b/mysql-test/suite/rpl/r/rpl_binlog_errors.result 2012-01-15 07:33:56 +0000
@@ -7,9 +7,6 @@ Note 1755 Storing MySQL user name or pas
####################### PART 1: MASTER TESTS ##########################
#######################################################################
include/stop_slave.inc
-call mtr.add_suppression("Can't generate a unique log-filename");
-call mtr.add_suppression("Writing one row to the row-based binary log failed.*");
-call mtr.add_suppression("Error writing file .*");
SET @old_debug= @@global.debug;
SELECT repeat('x',8192) INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/bug_46166.data';
SELECT repeat('x',10) INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/bug_46166-2.data';
@@ -36,27 +33,31 @@ RESET MASTER;
###################### TEST #3
CREATE TABLE t1 (a INT);
CREATE TABLE t2 (a VARCHAR(16384)) Engine=InnoDB;
-CREATE TABLE t4 (a VARCHAR(16384));
+CREATE TABLE t4 (a VARCHAR(16384)) Engine=MyISAM;
INSERT INTO t1 VALUES (1);
RESET MASTER;
LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug_46166.data' INTO TABLE t2;
-# assert: must show two binlog
+# assert: must show three binlog
show binary logs;
Log_name File_size
master-bin.000001 #
master-bin.000002 #
+master-bin.000003 #
SET GLOBAL debug="-d,error_unique_log_filename";
DELETE FROM t2;
RESET MASTER;
###################### TEST #4
SET GLOBAL debug="+d,error_unique_log_filename";
+SELECT count(*) FROM t2;
+count(*)
+0
LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug_46166.data' INTO TABLE t2;
ERROR HY000: Can't generate a unique log-filename master-bin.(1-999)
-# assert: must show one entry
+# assert: must still be empty since the LOAD DATA INFILE failed
SELECT count(*) FROM t2;
count(*)
-1
+0
SET GLOBAL debug="-d,error_unique_log_filename";
DELETE FROM t2;
RESET MASTER;
@@ -72,6 +73,10 @@ DELETE FROM t2;
RESET MASTER;
###################### TEST #6
SET GLOBAL debug="+d,error_unique_log_filename";
+# Table should be empty
+SELECT count(*) FROM t2;
+count(*)
+0
SET AUTOCOMMIT=0;
INSERT INTO t2 VALUES ('muse');
LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug_46166.data' INTO TABLE t2;
@@ -79,10 +84,10 @@ INSERT INTO t2 VALUES ('muse');
COMMIT;
ERROR HY000: Can't generate a unique log-filename master-bin.(1-999)
-# assert: must show three entries
+# Table should still be empty since the commit failed.
SELECT count(*) FROM t2;
count(*)
-3
+0
SET AUTOCOMMIT= 1;
SET GLOBAL debug="-d,error_unique_log_filename";
DELETE FROM t2;
@@ -101,13 +106,15 @@ count(*)
1
### check that the incident event is written to the current log
SET GLOBAL debug="-d,error_unique_log_filename";
-show binlog events from <binlog_start> limit 4,1;
+show binlog events from <binlog_start> limit 1;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Incident # # #1 (LOST_EVENTS)
DELETE FROM t4;
RESET MASTER;
###################### TEST #8
-INSERT INTO t2 VALUES ('xx'),('xy');
+SET @xxx = REPEAT('xxx', 1000);
+SET @yyy = REPEAT('yyy', 1000);
+INSERT INTO t2 VALUES (@xxx),(@yyy);
SET GLOBAL debug="+d,error_unique_log_filename";
# must show 0 entries
SELECT count(*) FROM t4;
@@ -123,7 +130,10 @@ ERROR HY000: Can't generate a unique log
LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug_46166.data' INTO TABLE t2;
ERROR HY000: Can't generate a unique log-filename master-bin.(1-999)
-INSERT INTO t2 VALUES ('aaa'), ('bbb'), ('ccc');
+set @aaa = repeat('aaa',1000);
+set @bbb = repeat('bbb',1000);
+set @ccc = repeat('ccc',1000);
+INSERT INTO t2 VALUES (@aaa), (@bbb), (@ccc);
ERROR HY000: Can't generate a unique log-filename master-bin.(1-999)
# INFO: Count(*) Before Offending DELETEs
@@ -137,17 +147,17 @@ count(*)
SELECT count(*) FROM t2;
count(*)
2
-DELETE FROM t4;
+DELETE FROM t4 WHERE a IN (@xxx, @yyy) OR 1;
ERROR HY000: Can't generate a unique log-filename master-bin.(1-999)
-DELETE FROM t2;
+DELETE FROM t2 WHERE a IN (@aaa, @bbb, @ccc) OR 1;
ERROR HY000: Can't generate a unique log-filename master-bin.(1-999)
# INFO: Count(*) After Offending DELETEs
# assert: must show zero entries
SELECT count(*) FROM t4;
count(*)
-1
+0
# assert: must show 2 entries: the original two rows
SELECT count(*) FROM t2;
count(*)
@@ -165,7 +175,7 @@ count(*)
4
SELECT count(*) FROM t4;
count(*)
-5
+4
DELETE FROM t2;
DELETE FROM t4;
# assert: must show zero entries
=== modified file 'mysql-test/suite/rpl/r/rpl_rotate_purge_deadlock.result'
--- a/mysql-test/suite/rpl/r/rpl_rotate_purge_deadlock.result 2011-11-07 16:17:30 +0000
+++ b/mysql-test/suite/rpl/r/rpl_rotate_purge_deadlock.result 2012-01-15 07:33:56 +0000
@@ -21,6 +21,7 @@ Log_name File_size
master-bin.000001 #
master-bin.000002 #
master-bin.000003 #
+master-bin.000004 #
SET DEBUG_SYNC = 'now SIGNAL rotated';
SET DEBUG_SYNC = 'RESET';
SET DEBUG_SYNC = 'RESET';
=== modified file 'mysql-test/suite/rpl/t/rpl_binlog_errors.test'
--- a/mysql-test/suite/rpl/t/rpl_binlog_errors.test 2011-12-11 16:03:12 +0000
+++ b/mysql-test/suite/rpl/t/rpl_binlog_errors.test 2012-01-15 07:33:56 +0000
@@ -30,9 +30,12 @@
-- source include/stop_slave.inc
-- connection master
+--disable_query_log
call mtr.add_suppression("Can't generate a unique log-filename");
call mtr.add_suppression("Writing one row to the row-based binary log failed.*");
+call mtr.add_suppression("Warning: [+-]?\d+ files and [+-]?\d+ streams is left open");
call mtr.add_suppression("Error writing file .*");
+--enable_query_log
SET @old_debug= @@global.debug;
@@ -84,19 +87,19 @@ RESET MASTER;
### table t1
CREATE TABLE t1 (a INT);
CREATE TABLE t2 (a VARCHAR(16384)) Engine=InnoDB;
-CREATE TABLE t4 (a VARCHAR(16384));
+CREATE TABLE t4 (a VARCHAR(16384)) Engine=MyISAM;
INSERT INTO t1 VALUES (1);
RESET MASTER;
### ASSERTION: we force rotation of the binary log because it exceeds
-### the max_binlog_size option (should show two binary
+### the max_binlog_size option (should show three binary
### logs)
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-- eval LOAD DATA INFILE '$load_file' INTO TABLE t2
# shows two binary logs
--- echo # assert: must show two binlog
+-- echo # assert: must show three binlog
-- source include/show_binary_logs.inc
# clean up the table and the binlog to be used in next part of test
@@ -106,18 +109,20 @@ RESET MASTER;
-- echo ###################### TEST #4
-### ASSERTION: load the big file into a transactional table and check
-### that it reports error. The table will contain the
-### changes performed despite the fact that it reported an
-### error.
+# Loading a row using LOAD DATA INFILE causing a binary log error
+# should be rolled back.
SET GLOBAL debug="+d,error_unique_log_filename";
+
+# Table should be empty to start with
+SELECT count(*) FROM t2;
+
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-- error ER_NO_UNIQUE_LOGFILE
-- eval LOAD DATA INFILE '$load_file' INTO TABLE t2
# show table
--- echo # assert: must show one entry
+-- echo # assert: must still be empty since the LOAD DATA INFILE failed
SELECT count(*) FROM t2;
# clean up the table and the binlog to be used in next part of test
@@ -145,12 +150,14 @@ RESET MASTER;
-- echo ###################### TEST #6
-### ASSERTION: check that even if one is using a transactional table
-### and explicit transactions (no autocommit) if rotation
-### fails we get the error. Transaction is not rolledback
-### because rotation happens after the commit.
+# A failing LOAD DATA INFILE inside a transaction cause the commit to
+# fail, rolling back the entire statement.
SET GLOBAL debug="+d,error_unique_log_filename";
+
+-- echo # Table should be empty
+SELECT count(*) FROM t2;
+
SET AUTOCOMMIT=0;
INSERT INTO t2 VALUES ('muse');
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
@@ -160,7 +167,7 @@ INSERT INTO t2 VALUES ('muse');
COMMIT;
### ACTION: Show the contents of the table after the test
--- echo # assert: must show three entries
+-- echo # Table should still be empty since the commit failed.
SELECT count(*) FROM t2;
### ACTION: clean up and move to the next test
@@ -186,7 +193,7 @@ SELECT count(*) FROM t4;
-- echo ### check that the incident event is written to the current log
SET GLOBAL debug="-d,error_unique_log_filename";
--- let $binlog_limit= 4,1
+-- let $binlog_limit= 1
-- source include/show_binlog_events.inc
# clean up and move to next test
@@ -201,7 +208,9 @@ RESET MASTER;
# Insert some rows into t2, we will both try to insert and delete from
# it.
-INSERT INTO t2 VALUES ('xx'),('xy');
+SET @xxx = REPEAT('xxx', 1000);
+SET @yyy = REPEAT('yyy', 1000);
+INSERT INTO t2 VALUES (@xxx),(@yyy);
SET GLOBAL debug="+d,error_unique_log_filename";
-- echo # must show 0 entries
@@ -215,8 +224,11 @@ SELECT count(*) FROM t2;
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-- error ER_NO_UNIQUE_LOGFILE
-- eval LOAD DATA INFILE '$load_file' INTO TABLE t2
+set @aaa = repeat('aaa',1000);
+set @bbb = repeat('bbb',1000);
+set @ccc = repeat('ccc',1000);
-- error ER_NO_UNIQUE_LOGFILE
-INSERT INTO t2 VALUES ('aaa'), ('bbb'), ('ccc');
+INSERT INTO t2 VALUES (@aaa), (@bbb), (@ccc);
-- echo # INFO: Count(*) Before Offending DELETEs
-- echo # assert: must show 1 entry
@@ -227,9 +239,9 @@ SELECT count(*) FROM t4;
SELECT count(*) FROM t2;
-- error ER_NO_UNIQUE_LOGFILE
-DELETE FROM t4;
+DELETE FROM t4 WHERE a IN (@xxx, @yyy) OR 1;
-- error ER_NO_UNIQUE_LOGFILE
-DELETE FROM t2;
+DELETE FROM t2 WHERE a IN (@aaa, @bbb, @ccc) OR 1;
-- echo # INFO: Count(*) After Offending DELETEs
-- echo # assert: must show zero entries
=== modified file 'mysql-test/suite/sys_vars/r/binlog_sync.result'
--- a/mysql-test/suite/sys_vars/r/binlog_sync.result 2011-12-11 16:03:12 +0000
+++ b/mysql-test/suite/sys_vars/r/binlog_sync.result 2011-12-15 12:54:05 +0000
@@ -61,6 +61,8 @@ SET @@global.binlog_sync_period = 0;
SET @@global.binlog_sync_interval = 0;
SET @@global.binlog_trx_committed = DURABLE;
ERROR HY000: Cannot set 'binlog_trx_committed' to 'DURABLE' since both binlog_sync_period and binlog_sync_interval is 0.
+SET @@session.binlog_trx_committed = DURABLE;
+ERROR HY000: Cannot set 'binlog_trx_committed' to 'DURABLE' since both binlog_sync_period and binlog_sync_interval is 0.
SET @@global.binlog_sync_period = 0;
SET @@global.binlog_sync_interval = 10;
SET @@global.binlog_trx_committed = DURABLE;
@@ -80,17 +82,23 @@ SET @@global.binlog_trx_committed = @sav
SET @saved_master_trx_read = @@global.master_trx_read;
SET @saved_binlog_sync_period = @@global.binlog_sync_period;
SET @saved_binlog_sync_interval = @@global.binlog_sync_interval;
-SELECT @@global.master_trx_read/* Default */;
-@@global.master_trx_read
-COMPLETE
+SELECT @@session.master_trx_read, @@global.master_trx_read /* Default */;
+@@session.master_trx_read COMPLETE
+@@global.master_trx_read COMPLETE
+SET @@session.master_trx_read = COMPLETE;
+SELECT @@session.master_trx_read, @@global.master_trx_read;
+@@session.master_trx_read COMPLETE
+@@global.master_trx_read COMPLETE
SET @@global.master_trx_read = COMPLETE;
-SELECT @@global.master_trx_read /* Expect COMPLETE */;
-@@global.master_trx_read
-COMPLETE
+SELECT @@session.master_trx_read, @@global.master_trx_read;
+@@session.master_trx_read COMPLETE
+@@global.master_trx_read COMPLETE
SET @@global.binlog_sync_period = 0;
SET @@global.binlog_sync_interval = 0;
SET @@global.master_trx_read = DURABLE;
ERROR HY000: Cannot set 'master_trx_read' to 'DURABLE' since both binlog_sync_period and binlog_sync_interval is 0.
+SET @@session.master_trx_read = DURABLE;
+ERROR HY000: Cannot set 'master_trx_read' to 'DURABLE' since both binlog_sync_period and binlog_sync_interval is 0.
SET @@global.binlog_sync_period = 0;
SET @@global.binlog_sync_interval = 10;
SET @@global.master_trx_read = DURABLE;
=== modified file 'mysql-test/suite/sys_vars/t/binlog_sync.test'
--- a/mysql-test/suite/sys_vars/t/binlog_sync.test 2011-09-09 11:54:38 +0000
+++ b/mysql-test/suite/sys_vars/t/binlog_sync.test 2011-12-15 12:54:05 +0000
@@ -57,6 +57,8 @@ SET @@global.binlog_sync_period = 0;
SET @@global.binlog_sync_interval = 0;
--error ER_BINLOG_TRX_NEVER_DURABLE
SET @@global.binlog_trx_committed = DURABLE;
+--error ER_BINLOG_TRX_NEVER_DURABLE
+SET @@session.binlog_trx_committed = DURABLE;
SET @@global.binlog_sync_period = 0;
SET @@global.binlog_sync_interval = 10;
@@ -76,10 +78,12 @@ SET @@global.binlog_trx_committed = @sav
SET @saved_master_trx_read = @@global.master_trx_read;
SET @saved_binlog_sync_period = @@global.binlog_sync_period;
SET @saved_binlog_sync_interval = @@global.binlog_sync_interval;
-SELECT @@global.master_trx_read/* Default */;
+--query_vertical SELECT @@session.master_trx_read, @@global.master_trx_read /* Default */
+SET @@session.master_trx_read = COMPLETE;
+--query_vertical SELECT @@session.master_trx_read, @@global.master_trx_read
SET @@global.master_trx_read = COMPLETE;
-SELECT @@global.master_trx_read /* Expect COMPLETE */;
+--query_vertical SELECT @@session.master_trx_read, @@global.master_trx_read
# Check that 'master_trx_read' cannot be set to 'DURABLE' when
# both binlog_sync_period and binlog_sync_interval is zero.
@@ -87,6 +91,8 @@ SET @@global.binlog_sync_period = 0;
SET @@global.binlog_sync_interval = 0;
--error ER_BINLOG_TRX_NEVER_DURABLE
SET @@global.master_trx_read = DURABLE;
+--error ER_BINLOG_TRX_NEVER_DURABLE
+SET @@session.master_trx_read = DURABLE;
SET @@global.binlog_sync_period = 0;
SET @@global.binlog_sync_interval = 10;
=== modified file 'mysql-test/t/mysqlbinlog.test'
--- a/mysql-test/t/mysqlbinlog.test 2011-03-25 15:20:25 +0000
+++ b/mysql-test/t/mysqlbinlog.test 2012-01-15 07:33:56 +0000
@@ -254,17 +254,16 @@ DROP TABLE t1;
--disable_query_log
CREATE TABLE patch (a BLOB);
---exec $MYSQL_BINLOG --hexdump --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLD_DATADIR/master-bin.000012 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_tmp.dat
+--exec $MYSQL_BINLOG --hexdump --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLD_DATADIR/master-bin.000008 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_tmp.dat
eval LOAD DATA LOCAL INFILE '$MYSQLTEST_VARDIR/tmp/mysqlbinlog_tmp.dat'
INTO TABLE patch FIELDS TERMINATED BY '' LINES STARTING BY '#';
---remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_tmp.dat
--enable_query_log
--echo We expect this value to be 1
--echo The bug being tested was that 'Query' lines were not preceded by '#'
--echo If the line is in the table, it had to have been preceded by a '#'
--echo
-SELECT COUNT(*) AS `BUG#28293_expect_3` FROM patch WHERE a LIKE '%Query%';
+SELECT COUNT(*) AS `BUG#28293_expect_1` FROM patch WHERE a LIKE '%Query%';
DROP TABLE patch;
#
@@ -274,9 +273,11 @@ FLUSH LOGS;
CREATE TABLE t1(a INT);
INSERT INTO t1 VALUES(connection_id());
let $a= `SELECT a FROM t1`;
+--let $previous_binlog = query_get_value(SHOW MASTER STATUS, File, 1)
FLUSH LOGS;
let $outfile= $MYSQLTEST_VARDIR/tmp/bug29928.sql;
---exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000015 > $outfile
+--replace_result $previous_binlog PREVIOUS_BINLOG
+--exec $MYSQL_BINLOG $MYSQLD_DATADIR/$previous_binlog > $outfile
DROP TABLE t1;
connect (con1, localhost, root, , test);
connection con1;
@@ -299,9 +300,10 @@ exec $MYSQL_BINLOG $MYSQL_TEST_DIR/std_d
# Test --disable-force-if-open and --force-if-open
#
FLUSH LOGS;
+--let $current_binlog = query_get_value(SHOW MASTER STATUS, File, 1)
--error 1
---exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000017 >/dev/null 2>/dev/null
---exec $MYSQL_BINLOG --force-if-open $MYSQLD_DATADIR/master-bin.000017 >/dev/null 2>/dev/null
+--exec $MYSQL_BINLOG $MYSQLD_DATADIR/$current_binlog >/dev/null 2>/dev/null
+--exec $MYSQL_BINLOG --force-if-open $MYSQLD_DATADIR/$current_binlog >/dev/null 2>/dev/null
--echo Bug#31611 Security risk with BINLOG statement
@@ -315,9 +317,11 @@ USE mysqltest1;
CREATE TABLE t1 (a INT, b CHAR(64));
flush logs;
INSERT INTO t1 VALUES (1,USER());
+--let $previous_binlog = query_get_value(SHOW MASTER STATUS, File, 1)
flush logs;
-echo mysqlbinlog var/log/master-bin.000018 > var/tmp/bug31611.sql;
-exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000018 > $MYSQLTEST_VARDIR/tmp/bug31611.sql;
+echo mysqlbinlog var/log/PREVIOUS_BINLOG > var/tmp/bug31611.sql;
+--replace_result $previous_binlog PREVIOUS_BINLOG
+exec $MYSQL_BINLOG $MYSQLD_DATADIR/$previous_binlog > $MYSQLTEST_VARDIR/tmp/bug31611.sql;
connect (unsecure,localhost,untrusted,,mysqltest1);
echo mysql mysqltest1 -uuntrusted < var/tmp/bug31611.sql;
error 1;
@@ -346,12 +350,14 @@ SET @an_int = 1000;
SET @a_decimal = CAST(rand(19) * 999 AS DECIMAL(5,2));
SET @a_string = 'Just a test';
INSERT INTO t1 VALUES (@a_real, @an_int, @a_decimal, @a_string);
+--let $previous_binlog = query_get_value(SHOW MASTER STATUS, File, 1)
FLUSH LOGS;
query_vertical SELECT * FROM t1;
DROP TABLE t1;
-echo >> mysqlbinlog var/log/master-bin.000020 > var/tmp/bug32580.sql;
-exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000020 > $MYSQLTEST_VARDIR/tmp/bug32580.sql;
+--echo >> mysqlbinlog var/log/PREVIOUS_BINLOG > var/tmp/bug32580.sql
+--replace_result $previous_binlog PREVIOUS_BINLOG
+exec $MYSQL_BINLOG $MYSQLD_DATADIR/$previous_binlog > $MYSQLTEST_VARDIR/tmp/bug32580.sql;
echo >> mysql test < var/tmp/bug32580.sql;
exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/bug32580.sql;
remove_file $MYSQLTEST_VARDIR/tmp/bug32580.sql;
=== modified file 'plugin/semisync/semisync_master.cc'
--- a/plugin/semisync/semisync_master.cc 2011-09-08 10:14:08 +0000
+++ b/plugin/semisync/semisync_master.cc 2012-01-15 07:33:56 +0000
@@ -505,12 +505,15 @@ int ReplSemiSyncMaster::reportReplyBinlo
my_off_t log_file_pos)
{
const char *kWho = "ReplSemiSyncMaster::reportReplyBinlog";
+ DBUG_ENTER("ReplSemiSyncMaster::reportReplyBinlog");
+ DBUG_PRINT("enter", ("log_file_name: %s, log_file_pos: %lu",
+ log_file_name, (ulong) log_file_pos));
int cmp;
bool can_release_threads = false;
bool need_copy_send_pos = true;
if (!(getMasterEnabled()))
- return 0;
+ DBUG_RETURN(0);
function_enter(kWho);
@@ -593,14 +596,16 @@ int ReplSemiSyncMaster::reportReplyBinlo
cond_broadcast();
}
- return function_exit(kWho, 0);
+ DBUG_RETURN(function_exit(kWho, 0));
}
int ReplSemiSyncMaster::commitTrx(const char* trx_wait_binlog_name,
my_off_t trx_wait_binlog_pos)
{
const char *kWho = "ReplSemiSyncMaster::commitTrx";
-
+ DBUG_ENTER("ReplSemiSyncMaster::commitTrx");
+ DBUG_PRINT("enter", ("trx_wait_binlog_name: %s, trx_wait_binlog_pos: %lu",
+ trx_wait_binlog_name, (ulong) trx_wait_binlog_pos));
function_enter(kWho);
if (getMasterEnabled() && trx_wait_binlog_name)
@@ -635,6 +640,11 @@ int ReplSemiSyncMaster::commitTrx(const
{
if (reply_file_name_inited_)
{
+ if (trace_level_ & kTraceDetail)
+ {
+ sql_print_information("%s: reply pos (%s, %lu)\n", kWho,
+ reply_file_name_, (unsigned long) reply_file_pos_);
+ }
int cmp = ActiveTranx::compare(reply_file_name_, reply_file_pos_,
trx_wait_binlog_name, trx_wait_binlog_pos);
if (cmp >= 0)
@@ -767,7 +777,7 @@ int ReplSemiSyncMaster::commitTrx(const
THD_EXIT_COND(NULL, & old_stage);
}
- return function_exit(kWho, 0);
+ DBUG_RETURN(function_exit(kWho, 0));
}
/* Indicate that semi-sync replication is OFF now.
@@ -1012,6 +1022,9 @@ int ReplSemiSyncMaster::writeTranxInBinl
if (cmp > 0)
{
/* This is a larger position, let's update the maximum info. */
+ if (trace_level_ & kTraceDetail)
+ sql_print_information("%s: Updating to larger position (%s, %lu)",
+ kWho, log_file_name, (ulong) log_file_pos);
strncpy(commit_file_name_, log_file_name, FN_REFLEN-1);
commit_file_name_[FN_REFLEN-1] = 0; /* make sure it ends properly */
commit_file_pos_ = log_file_pos;
=== modified file 'plugin/semisync/semisync_master_plugin.cc'
--- a/plugin/semisync/semisync_master_plugin.cc 2011-09-21 11:01:41 +0000
+++ b/plugin/semisync/semisync_master_plugin.cc 2012-01-15 07:33:56 +0000
@@ -50,15 +50,16 @@ int repl_semi_request_commit(Trans_param
int repl_semi_report_commit(Trans_param *param)
{
-
+ DBUG_ENTER("repl_semi_report_commit");
bool is_real_trans= param->flags & TRANS_IS_REAL_TRANS;
if (is_real_trans && param->log_pos)
{
const char *binlog_name= param->log_file;
- return repl_semisync.commitTrx(binlog_name, param->log_pos);
+ int result= repl_semisync.commitTrx(binlog_name, param->log_pos);
+ DBUG_RETURN(result);
}
- return 0;
+ DBUG_RETURN(0);
}
int repl_semi_report_rollback(Trans_param *param)
@@ -255,7 +256,7 @@ Trans_observer trans_observer = {
Binlog_storage_observer storage_observer = {
sizeof(Binlog_storage_observer), // len
- repl_semi_report_binlog_update, // report_update
+ repl_semi_report_binlog_update, // after_flush
};
Binlog_transmit_observer transmit_observer = {
=== modified file 'sql/binlog.cc'
--- a/sql/binlog.cc 2011-12-11 16:03:12 +0000
+++ b/sql/binlog.cc 2012-01-15 07:33:56 +0000
@@ -40,7 +40,7 @@ handlerton *binlog_hton;
const char *log_bin_index= 0;
const char *log_bin_basename= 0;
-MYSQL_BIN_LOG mysql_bin_log(&sync_binlog_period);
+MYSQL_BIN_LOG mysql_bin_log(&opt_binlog_sync_period);
static int binlog_init(void *p);
static void binlog_start_trans_and_stmt(THD *thd, Log_event *start_event);
@@ -110,23 +110,6 @@ pwrite_at_offset(IO_CACHE *cache, const
*/
class binlog_cache_data
{
- /*
- TODO: The Log_event::write writes explicitly to the cache, and
- this function is to replace that call, but since the cache_log is
- already stored in the cache_data, it might not be necessary to
- provide an explicit cache to the call.
- */
- friend int
- write_event_to_cache(Log_event *event, IO_CACHE *file,
- binlog_cache_data *cache_data)
- {
- DBUG_ASSERT(file == &cache_data->cache_log);
- if (int error= event->write(file))
- return error;
- cache_data->events_in_cache++;
- return 0;
- }
-
public:
binlog_cache_data(bool trx_cache_arg, MYSQL_BIN_LOG *log_arg,
@@ -148,6 +131,14 @@ public:
close_cached_file(&cache_log);
}
+ int write_event(Log_event *event)
+ {
+ if (int error= event->write(&cache_log))
+ return error;
+ events_in_cache++;
+ return 0;
+ }
+
bool empty() const
{
return pending() == NULL && my_b_tell(&cache_log) == 0;
@@ -246,7 +237,6 @@ public:
*/
void set_write_offset(my_off_t offset) {
DBUG_ASSERT(pending() == NULL);
- DBUG_PRINT("debug", ("set write_offset: %llu", (ulonglong) offset));
write_offset= offset;
}
@@ -523,6 +513,11 @@ public:
return trx_cache.empty() && stmt_cache.empty();
}
+ void reset() {
+ stmt_cache.reset();
+ trx_cache.reset();
+ }
+
int flush(THD *thd);
/**
@@ -757,7 +752,7 @@ binlog_cache_data::freeze(THD *thd, Log_
if (thd->binlog_flush_pending_rows_event(TRUE, is_trx_cache()))
DBUG_RETURN(1);
- if (end_evt && write_event_to_cache(end_evt, &cache_log, this))
+ if (end_evt && write_event(end_evt))
DBUG_RETURN(1);
}
flags.frozen= true;
@@ -899,17 +894,21 @@ binlog_truncate_trx_cache(THD *thd, binl
*/
int
-MYSQL_BIN_LOG::allocate_space_in_log(THD *thd)
+MYSQL_BIN_LOG::allocate_space_in_log(THD *thd, bool *check_purge)
{
DBUG_ENTER("MYSQL_BIN_LOG::allocate_space_in_log");
mysql_mutex_assert_owner(&LOCK_available);
+#if 0
DBUG_ASSERT(thd->transaction.write_position == 0 && thd->transaction.after_position == 0);
DBUG_ASSERT(next_available != 0);
+#endif
binlog_cache_mngr *cache_mngr=
(binlog_cache_mngr*) thd_get_ha_data(thd, binlog_hton);
size_t bytes= cache_mngr->bytes_to_reserve();
+ DBUG_PRINT("debug", ("next_available: %lu, bytes: %lu, max_size: %lu",
+ (ulong) next_available, (ulong) bytes, (ulong) max_size));
if (next_available + bytes > max_size)
- if (int error= rotate_and_purge(false))
+ if (int error= rotate(true, check_purge))
DBUG_RETURN(error);
cache_mngr->set_write_offset(next_available);
thd->transaction.write_position= next_available;
@@ -939,7 +938,9 @@ MYSQL_BIN_LOG::force_flush_stmt_cache(TH
cache_mngr->stmt_cache.freeze(thd, ltype);
DBUG_PRINT("debug", ("lock LOCK_available"));
mysql_mutex_lock(&LOCK_available);
- if (int err= allocate_space_in_log(thd))
+
+ bool do_purge = false;
+ if (int err= allocate_space_in_log(thd, &do_purge))
error= err;
else
{
@@ -948,9 +949,17 @@ MYSQL_BIN_LOG::force_flush_stmt_cache(TH
last_durable, last_complete, next_available));
queue_thread(thd);
}
+
+ DBUG_PRINT("debug", ("unlock LOCK_available"));
mysql_mutex_unlock(&LOCK_available);
+
+ if (do_purge)
+ purge();
+
if (error == 0)
error= cache_mngr->stmt_cache.flush(thd);
+ else
+ cache_mngr->stmt_cache.reset();
DBUG_RETURN(error);
}
@@ -971,15 +980,19 @@ MYSQL_BIN_LOG::force_flush_trx_cache(THD
cache_mngr->stmt_cache.size(),
cache_mngr->trx_cache.size()));
DBUG_ASSERT(!cache_mngr->trx_cache.empty() && cache_mngr->stmt_cache.empty());
+#if 0
DBUG_ASSERT(thd->transaction.write_position == 0 && thd->transaction.after_position == 0);
- DBUG_PRINT("debug", ("lock LOCK_available"));
+#endif
LEX_CSTRING *endq = commit ? &commit_string : &rollback_string;
Query_log_event end_evt(thd, endq->str, endq->length,
TRUE, FALSE, TRUE, 0, TRUE);
if (!cache_mngr->trx_cache.is_frozen())
cache_mngr->trx_cache.freeze(thd, &end_evt);
+ DBUG_PRINT("debug", ("lock LOCK_available"));
mysql_mutex_lock(&LOCK_available);
- if (int err= allocate_space_in_log(thd))
+
+ bool do_purge = false;
+ if (int err= allocate_space_in_log(thd, &do_purge))
error= err;
else
{
@@ -988,9 +1001,16 @@ MYSQL_BIN_LOG::force_flush_trx_cache(THD
last_durable, last_complete, next_available));
queue_thread(thd);
}
+
+ DBUG_PRINT("debug", ("unlock LOCK_available"));
mysql_mutex_unlock(&LOCK_available);
+
+ if (do_purge)
+ purge();
if (error == 0)
error= cache_mngr->trx_cache.flush(thd);
+ else
+ cache_mngr->trx_cache.reset();
DBUG_RETURN(error);
}
@@ -1020,9 +1040,9 @@ static int binlog_prepare(handlerton *ht
static int binlog_commit(handlerton *hton, THD *thd, bool all)
{
int error= 0;
- bool reset_stmt_cache= false;
- bool reset_trx_cache= false;
DBUG_ENTER("binlog_commit");
+ bool stmt_cache_flushed= false;
+ bool trx_cache_flushed= false;
binlog_cache_mngr *const cache_mngr=
(binlog_cache_mngr*) thd_get_ha_data(thd, binlog_hton);
@@ -1048,8 +1068,8 @@ static int binlog_commit(handlerton *hto
*/
if (!cache_mngr->stmt_cache.empty())
{
- mysql_bin_log.force_flush_stmt_cache(thd, Log_event::EVENT_NORMAL_LOGGING);
- reset_stmt_cache= true;
+ error= mysql_bin_log.force_flush_stmt_cache(thd, Log_event::EVENT_NORMAL_LOGGING);
+ stmt_cache_flushed= true;
}
/*
@@ -1064,26 +1084,17 @@ static int binlog_commit(handlerton *hto
*/
if (!error && ending_trans(thd, all) && !cache_mngr->trx_cache.empty())
{
- mysql_bin_log.force_flush_trx_cache(thd, TRUE);
- reset_trx_cache= true;
+ error= mysql_bin_log.force_flush_trx_cache(thd, TRUE);
+ trx_cache_flushed= true;
}
/*
If one or more of the caches were flushed, we need to wait for
the data to be written.
-
- TODO: Do we need to reset the caches? They are reset in the flush
- commands.
*/
- if (reset_stmt_cache || reset_trx_cache)
- {
- error= mysql_bin_log.wait_until_complete_then_rotate(thd);
-
- if (reset_trx_cache)
- cache_mngr->trx_cache.reset();
- if (reset_stmt_cache)
- cache_mngr->stmt_cache.reset();
- }
+ if ((trx_cache_flushed || stmt_cache_flushed) &&
+ error == 0 && thd->transaction.write_position > 0)
+ mysql_bin_log.wait_until_complete(thd);
/*
This is part of the stmt rollback.
@@ -1132,7 +1143,7 @@ static int binlog_rollback(handlerton *h
*/
if (cache_mngr->stmt_cache.has_incident())
{
- error= mysql_bin_log.write_incident(thd, TRUE);
+ mysql_bin_log.write_incident(thd, TRUE);
cache_mngr->stmt_cache.reset();
}
else if (!cache_mngr->stmt_cache.empty())
@@ -2444,22 +2455,26 @@ err:
DBUG_RETURN(-1);
}
-int MYSQL_BIN_LOG::get_current_log(LOG_INFO* linfo)
+int MYSQL_BIN_LOG::get_current_log(LOG_INFO* linfo, THD* thd)
{
+ DBUG_PRINT("debug", ("lock LOCK_available"));
mysql_mutex_lock(&LOCK_available);
+ DBUG_PRINT("debug", ("lock LOCK_durable"));
mysql_mutex_lock(&LOCK_durable);
- int ret = raw_get_current_log(linfo);
+ int ret = raw_get_current_log(linfo, thd);
+ DBUG_PRINT("debug", ("unlock LOCK_available"));
mysql_mutex_unlock(&LOCK_available);
+ DBUG_PRINT("debug", ("unlock LOCK_durable"));
mysql_mutex_unlock(&LOCK_durable);
return ret;
}
-int MYSQL_BIN_LOG::raw_get_current_log(LOG_INFO* linfo)
+int MYSQL_BIN_LOG::raw_get_current_log(LOG_INFO* linfo, THD *thd)
{
strmake(linfo->log_file_name, log_file_name, sizeof(linfo->log_file_name)-1);
linfo->complete_pos = last_complete;
linfo->durable_pos = last_durable;
- linfo->pos = get_end_pos();
+ linfo->pos = get_end_pos(thd);
return (linfo->pos > 0);
}
@@ -2637,7 +2652,10 @@ int MYSQL_BIN_LOG::find_next_log(LOG_INF
err:
if (need_lock)
+ {
+ DBUG_PRINT("debug", ("unlock LOCK_index"));
mysql_mutex_unlock(&LOCK_index);
+ }
return error;
}
@@ -2784,6 +2802,7 @@ err:
if (error == 1)
name= const_cast<char*>(save_name);
mysql_mutex_unlock(&LOCK_thread_count);
+ DBUG_PRINT("debug", ("unlock LOCK_index"));
mysql_mutex_unlock(&LOCK_index);
DBUG_PRINT("debug", ("unlock LOCK_available"));
mysql_mutex_unlock(&LOCK_available);
@@ -2932,6 +2951,7 @@ int MYSQL_BIN_LOG::purge_first_log(Relay
mysql_mutex_assert_owner(&rli->data_lock);
+ DBUG_PRINT("debug", ("lock LOCK_index"));
mysql_mutex_lock(&LOCK_index);
to_purge_if_included= my_strdup(rli->get_group_relay_log_name(), MYF(0));
@@ -3008,6 +3028,7 @@ int MYSQL_BIN_LOG::purge_first_log(Relay
err:
my_free(to_purge_if_included);
+ DBUG_PRINT("debug", ("unlock LOCK_index"));
mysql_mutex_unlock(&LOCK_index);
DBUG_RETURN(error);
}
@@ -3113,7 +3134,10 @@ int MYSQL_BIN_LOG::purge_logs(const char
DBUG_PRINT("info",("to_log= %s",to_log));
if (need_mutex)
+ {
+ DBUG_PRINT("debug", ("lock LOCK_index"));
mysql_mutex_lock(&LOCK_index);
+ }
if ((error=find_log_pos(&log_info, to_log, 0 /*no mutex*/)))
{
sql_print_error("MYSQL_BIN_LOG::purge_logs was called with file %s not "
@@ -3176,7 +3200,10 @@ err:
DBUG_EXECUTE_IF("crash_purge_non_critical_after_update_index", DBUG_SUICIDE(););
if (need_mutex)
+ {
+ DBUG_PRINT("debug", ("unlock LOCK_index"));
mysql_mutex_unlock(&LOCK_index);
+ }
DBUG_RETURN(error);
}
@@ -3480,6 +3507,7 @@ int MYSQL_BIN_LOG::purge_logs_before_dat
DBUG_ENTER("purge_logs_before_date");
+ DBUG_PRINT("debug", ("lock LOCK_index"));
mysql_mutex_lock(&LOCK_index);
to_log[0]= 0;
@@ -3540,6 +3568,7 @@ int MYSQL_BIN_LOG::purge_logs_before_dat
error= (to_log[0] ? purge_logs(to_log, 1, 0, 1, (ulonglong *) 0) : 0);
err:
+ DBUG_PRINT("debug", ("unlock LOCK_index"));
mysql_mutex_unlock(&LOCK_index);
DBUG_RETURN(error);
}
@@ -3656,11 +3685,11 @@ int MYSQL_BIN_LOG::new_file_impl(bool ne
increased), and waiting on COND_prep_xids for late threads to
catch up.
*/
- if (prepared_xids)
+ if (prepared_xids > 0)
{
tc_log_page_waits++;
mysql_mutex_lock(&LOCK_prep_xids);
- while (prepared_xids) {
+ while (prepared_xids > 0) {
DBUG_PRINT("info", ("prepared_xids=%lu", prepared_xids));
mysql_cond_wait(&COND_prep_xids, &LOCK_prep_xids);
}
@@ -3830,7 +3859,7 @@ bool MYSQL_BIN_LOG::append(Log_event* ev
(ulong) ev->data_written,
(ulong) my_b_append_tell(&log_file)));
DBUG_PRINT("info",("max_size: %lu",max_size));
- if (flush_and_sync(0))
+ if (do_flush() || do_maybe_sync(1))
goto err;
if ((uint) my_b_append_tell(&log_file) >
DBUG_EVALUATE_IF("rotate_slave_debug_group", 500, max_size))
@@ -3846,6 +3875,7 @@ err:
bool MYSQL_BIN_LOG::appendv(const char* buf, uint len,...)
{
bool error= 0;
+ int count = 0;
DBUG_ENTER("MYSQL_BIN_LOG::appendv");
va_list(args);
va_start(args,len);
@@ -3864,9 +3894,10 @@ bool MYSQL_BIN_LOG::appendv(const char*
goto err;
}
bytes_written += len;
+ ++count;
} while ((buf=va_arg(args,const char*)) && (len=va_arg(args,uint)));
DBUG_PRINT("info",("max_size: %lu",max_size));
- if (flush_and_sync(0))
+ if (do_flush() || do_maybe_sync(count))
goto err;
if ((uint) my_b_append_tell(&log_file) >
DBUG_EVALUATE_IF("rotate_slave_debug_group", 500, max_size))
@@ -3877,31 +3908,42 @@ err:
DBUG_RETURN(error);
}
-bool MYSQL_BIN_LOG::flush_and_sync(bool *synced, const bool force)
+int MYSQL_BIN_LOG::do_flush()
{
- int err=0, fd=log_file.file;
- mysql_mutex_assert_not_owner(&LOCK_durable);
- if (synced)
- *synced= 0;
- if (flush_io_cache(&log_file))
- return 1;
+ return flush_io_cache(&log_file);
+}
+
+bool MYSQL_BIN_LOG::do_maybe_sync(int count, const bool force)
+{
+ int err= 0;
+ int fd= log_file.file;
uint sync_period= get_sync_period();
- if (force ||
- (sync_period && ++sync_counter >= sync_period))
+ mysql_mutex_assert_not_owner(&LOCK_durable);
+ if (force ||
+ (sync_period && sync_counter + count >= sync_period))
{
sync_counter= 0;
err= mysql_file_sync(fd, MYF(MY_WME));
if (err == 0)
{
+ DBUG_PRINT("debug", ("lock LOCK_durable"));
mysql_mutex_lock(&LOCK_durable);
- if (synced)
- *synced= 1;
last_durable= last_complete;
mysql_cond_broadcast(&COND_durable);
+ DBUG_PRINT("debug", ("unlock LOCK_durable"));
mysql_mutex_unlock(&LOCK_durable);
}
- DBUG_PRINT("info", ("last_durable: %llu, last_complete: %llu, next_available: %llu",
- last_durable, last_complete, next_available));
+ }
+ else
+ sync_counter += count;
+ DBUG_PRINT("info", ("last_durable: %llu, last_complete: %llu, next_available: %llu",
+ last_durable, last_complete, next_available));
+ if (RUN_HOOK(binlog_storage, after_flush,
+ (current_thd, log_file_name, last_complete,
+ last_complete <= last_durable)))
+ {
+ sql_print_error("Failed to run 'after_flush' hooks");
+ write_error= 1;
}
return err;
}
@@ -3991,12 +4033,10 @@ MYSQL_BIN_LOG::flush_and_set_pending_row
if (Rows_log_event* pending= cache_data->pending())
{
- IO_CACHE *file= &cache_data->cache_log;
-
/*
Write pending event to the cache.
*/
- if (write_event_to_cache(pending, file, cache_data))
+ if (cache_data->write_event(pending))
{
set_write_error(thd, is_transactional);
if (check_write_error(thd) && cache_data &&
@@ -4074,7 +4114,6 @@ bool MYSQL_BIN_LOG::write(Log_event *eve
bool is_trans_cache= event_info->is_using_trans_cache();
binlog_cache_mngr *cache_mngr= (binlog_cache_mngr*) thd_get_ha_data(thd, binlog_hton);
- IO_CACHE *file= cache_mngr->get_binlog_cache_log(is_trans_cache);
binlog_cache_data *cache_data= cache_mngr->get_binlog_cache_data(is_trans_cache);
DBUG_PRINT("info",("event type: %d",event_info->get_type_code()));
@@ -4096,7 +4135,7 @@ bool MYSQL_BIN_LOG::write(Log_event *eve
Intvar_log_event e(thd,(uchar) LAST_INSERT_ID_EVENT,
thd->first_successful_insert_id_in_prev_stmt_for_binlog,
event_info->event_cache_type, event_info->event_logging_type);
- if (write_event_to_cache(&e, file, cache_data))
+ if (cache_data->write_event(&e))
goto err;
}
if (thd->auto_inc_intervals_in_cur_stmt_for_binlog.nb_elements() > 0)
@@ -4108,7 +4147,7 @@ bool MYSQL_BIN_LOG::write(Log_event *eve
thd->auto_inc_intervals_in_cur_stmt_for_binlog.
minimum(), event_info->event_cache_type,
event_info->event_logging_type);
- if (write_event_to_cache(&e, file, cache_data))
+ if (cache_data->write_event(&e))
goto err;
}
if (thd->rand_used)
@@ -4116,7 +4155,7 @@ bool MYSQL_BIN_LOG::write(Log_event *eve
Rand_log_event e(thd,thd->rand_saved_seed1,thd->rand_saved_seed2,
event_info->event_cache_type,
event_info->event_logging_type);
- if (write_event_to_cache(&e, file, cache_data))
+ if (cache_data->write_event(&e))
goto err;
}
if (thd->user_var_events.elements)
@@ -4139,7 +4178,7 @@ bool MYSQL_BIN_LOG::write(Log_event *eve
user_var_event->charset_number, flags,
event_info->event_cache_type,
event_info->event_logging_type);
- if (write_event_to_cache(&e, file, cache_data))
+ if (cache_data->write_event(&e))
goto err;
}
}
@@ -4149,7 +4188,7 @@ bool MYSQL_BIN_LOG::write(Log_event *eve
/*
Write the event.
*/
- if (write_event_to_cache(event_info, file, cache_data) ||
+ if (cache_data->write_event(event_info) ||
DBUG_EVALUATE_IF("injecting_fault_writing", 1, 0))
goto err;
@@ -4227,8 +4266,8 @@ int MYSQL_BIN_LOG::rotate(bool force_rot
{
int error= 0;
DBUG_ENTER("MYSQL_BIN_LOG::rotate");
+ mysql_mutex_assert_owner(&LOCK_available);
- //todo: fix the macro def and restore safe_mutex_assert_not_owner(&LOCK_log);
*check_purge= false;
if (force_rotate || (next_available >= (my_off_t) max_size))
@@ -4237,6 +4276,8 @@ int MYSQL_BIN_LOG::rotate(bool force_rot
Before rotating, we have to wait until all threads have written
their data to the end of the file.
*/
+ DBUG_PRINT("debug", ("lock LOCK_log"));
+ mysql_mutex_lock(&LOCK_log);
wait_until_position(current_thd, next_available);
if ((error= new_file_without_locking()))
{
@@ -4252,7 +4293,10 @@ int MYSQL_BIN_LOG::rotate(bool force_rot
to the current log.
*/
if (!write_incident(current_thd, FALSE))
- flush_and_sync(0);
+ {
+ do_flush();
+ do_maybe_sync(1);
+ }
/*
This can be called from reload_acl_and_cache, in which case, a
@@ -4263,9 +4307,13 @@ int MYSQL_BIN_LOG::rotate(bool force_rot
if (cache_mngr)
cache_mngr->set_incident();
}
+ DBUG_PRINT("debug", ("unlock LOCK_log"));
+ mysql_mutex_unlock(&LOCK_log);
*check_purge= true;
}
+
+ DBUG_PRINT("return", ("error: %d", error));
DBUG_RETURN(error);
}
@@ -4292,31 +4340,40 @@ void MYSQL_BIN_LOG::purge()
/**
The method is a shortcut of @c rotate() and @c purge().
- LOCK_log is acquired prior to rotate and is released after it.
- @param force_rotate caller can request the log rotation
+ This function is only intended to be used to force a rotation, e.g.,
+ when using FLUSH LOGS. Normally, the rotate() function is called
+ with LOCK_available kept (to prevent new threads from allocating
+ space in the current log) and then purge() have to be called after
+ the rotation is done, but without any locks held.
+
+ @see allocate_space_in_log
+ @see force_flush_stmt_cache
+ @see force_flush_trx_cache
@retval
nonzero - error in rotating routine.
*/
-int MYSQL_BIN_LOG::rotate_and_purge(bool force_rotate)
+int MYSQL_BIN_LOG::rotate_and_purge()
{
int error= 0;
DBUG_ENTER("MYSQL_BIN_LOG::rotate_and_purge");
bool check_purge= false;
//todo: fix the macro def and restore safe_mutex_assert_not_owner(&LOCK_log);
- DBUG_PRINT("debug", ("lock LOCK_log"));
- error= rotate(force_rotate, &check_purge);
+ mysql_mutex_assert_not_owner(&LOCK_available);
+ mysql_mutex_lock(&LOCK_available);
+ error= rotate(/* force_rotate */ true, &check_purge);
+ mysql_mutex_unlock(&LOCK_available);
+
/*
NOTE: Run purge_logs wo/ holding LOCK_log because it does not need
the mutex. Otherwise causes various deadlocks.
*/
- DBUG_PRINT("debug", ("unlock LOCK_log"));
-
if (!error && check_purge)
purge();
+ DBUG_PRINT("return", ("error: %d", error));
DBUG_RETURN(error);
}
@@ -4653,19 +4710,22 @@ bool MYSQL_BIN_LOG::write_incident(Incid
if (lock)
{
- if (!error && !(error= flush_and_sync(0)))
+ if (!error && !(error= do_flush()))
{
bool check_purge= false;
+#if 0
+ // Is this needed? There is a signal_update() call above.
signal_update();
+#endif
error= rotate(true, &check_purge);
- DBUG_PRINT("debug", ("unlock LOCK_log"));
+ DBUG_PRINT("debug", ("unlock LOCK_available"));
mysql_mutex_unlock(&LOCK_available);
if (!error && check_purge)
purge();
}
else
{
- DBUG_PRINT("debug", ("unlock LOCK_log"));
+ DBUG_PRINT("debug", ("unlock LOCK_available"));
mysql_mutex_unlock(&LOCK_available);
}
mysql_mutex_assert_not_owner(&LOCK_available);
@@ -4707,7 +4767,10 @@ bool MYSQL_BIN_LOG::write_incident(THD *
int error= write_incident(&ev, FALSE);
if (lock)
+ {
+ DBUG_PRINT("debug", ("unlock LOCK_available"));
mysql_mutex_unlock(&LOCK_available);
+ }
DBUG_RETURN(error);
}
@@ -4719,7 +4782,6 @@ bool MYSQL_BIN_LOG::write_incident(THD *
@param incident Defines if an incident event should be created to
notify that some non-transactional changes did
not get into the binlog.
- @param prepared Defines if a transaction is part of a 2-PC.
@note
We only come here if there is something in the cache.
@@ -4732,7 +4794,7 @@ bool MYSQL_BIN_LOG::write_incident(THD *
bool MYSQL_BIN_LOG::write(THD *thd, IO_CACHE *cache, my_off_t pos,
bool incident)
{
- DBUG_ENTER("MYSQL_BIN_LOG::write(THD*, IO_CACHE*, my_off_t, Log_event*, bool)");
+ DBUG_ENTER("MYSQL_BIN_LOG::write(THD*, IO_CACHE*, my_off_t, int, bool)");
DBUG_PRINT("enter", ("pos: %lld, incident: %s", pos, YESNO(incident)));
mysql_mutex_assert_not_owner(&LOCK_available);
@@ -4751,7 +4813,8 @@ bool MYSQL_BIN_LOG::write(THD *thd, IO_C
{
DBUG_EXECUTE_IF("crash_before_writing_xid",
{
- if ((write_error= write_cache(cache, pos)) || flush_and_sync(0))
+ if ((write_error= write_cache(cache, pos)) ||
+ do_flush() || do_maybe_sync(1))
DBUG_PRINT("info", ("error writing binlog cache: %d",
write_error));
DBUG_PRINT("info", ("crashing before writing xid"));
@@ -4764,9 +4827,8 @@ bool MYSQL_BIN_LOG::write(THD *thd, IO_C
if (incident && write_incident(thd, TRUE))
goto err;
- bool synced= 0;
DBUG_EXECUTE_IF("half_binlogged_transaction", DBUG_SUICIDE(););
- if (flush_and_sync(&synced))
+ if (do_flush())
goto err;
if (cache->error) // Error on read
{
@@ -4774,14 +4836,6 @@ bool MYSQL_BIN_LOG::write(THD *thd, IO_C
write_error=1; // Don't give more errors
goto err;
}
-
- if (RUN_HOOK(binlog_storage, after_flush,
- (thd, log_file_name, log_file.pos_in_file, synced)))
- {
- sql_print_error("Failed to run 'after_flush' hooks");
- write_error=1;
- goto err;
- }
}
}
@@ -4853,15 +4907,22 @@ int MYSQL_BIN_LOG::wait_for_update_bin_l
{
int ret= 0;
DBUG_ENTER("wait_for_update_bin_log");
+ mysql_mutex_assert_owner(&LOCK_log);
DBUG_PRINT("debug", ("last_durable: %llu, last_complete: %llu, next_available: %llu",
last_durable, last_complete, next_available));
- DBUG_PRINT("debug", ("unlock LOCK_log"));
if (!timeout)
+ {
+ DBUG_PRINT("debug", ("unlock LOCK_log [wait]"));
mysql_cond_wait(&update_cond, &LOCK_log);
+ }
else
+ {
+ DBUG_PRINT("debug", ("unlock LOCK_log [timedwait]"));
ret= mysql_cond_timedwait(&update_cond, &LOCK_log,
const_cast<struct timespec *>(timeout));
+ }
+ DBUG_PRINT("debug", ("lock LOCK_log [resume]"));
DBUG_PRINT("debug", ("last_durable: %llu, last_complete: %llu, next_available: %llu",
last_durable, last_complete, next_available));
DBUG_RETURN(ret);
@@ -4879,33 +4940,40 @@ void MYSQL_BIN_LOG::wait_until_complete(
void MYSQL_BIN_LOG::process_completion_queue()
{
- mysql_mutex_assert_owner(get_log_lock());
- if (THD *thd_end= find_complete_prefix())
- {
- THD *old_fiq= first_in_queue;
- first_in_queue= thd_end->transaction.next_to_commit;
- /*
- If first_in_queue was pointing to the last item, it will now be
- NULL, meaning the list is empty.
-
- This means that we have to atomically update the last_in_queue
- pointer *if* it equivalent to the old value of
- first_in_queue. If it is not, we have to get that value and
- store it in first_in_queue since another thread added an item in
- between.
-
- The variable first_in_queue cannot change since it is protected
- by the LOCK_log, however, last_in_queue can.
- */
- if (!my_atomic_casptr((void* volatile*) &last_in_queue, (void**) &old_fiq, NULL))
- first_in_queue= old_fiq;
-
- last_complete= thd_end->transaction.after_position;
-
- DBUG_PRINT("info", ("first_in_queue: %llu, last_in_queue: %llu",
- first_in_queue ? first_in_queue->transaction.write_position : 0,
- last_in_queue ? last_in_queue->transaction.write_position : 0));
- }
+ int count;
+ THD *thd_end;
+ if (find_complete_prefix(&thd_end, &count) == 0)
+ return;
+ THD *old_fiq= first_in_queue;
+ THD *cur_thd= first_in_queue;
+ DBUG_ASSERT(old_fiq != NULL);
+ DBUG_ASSERT(cur_thd != NULL);
+ first_in_queue= thd_end->transaction.next_to_commit;
+ /*
+ If first_in_queue was pointing to the last item, it will now be
+ NULL, meaning the list is empty.
+
+ This means that we have to atomically update the last_in_queue
+ pointer *if* it equivalent to the old value of first_in_queue. If
+ it is not, we have to get that value and store it in
+ first_in_queue since another thread added an item in between.
+
+ The variable first_in_queue cannot change since it is protected by
+ the LOCK_log, however, last_in_queue can.
+ */
+ if (!my_atomic_casptr((void* volatile*) &last_in_queue, (void**) &old_fiq, NULL))
+ first_in_queue= old_fiq;
+
+ last_complete= thd_end->transaction.after_position;
+
+ DBUG_PRINT("info", ("first_in_queue: %llu, last_in_queue: %llu",
+ first_in_queue ? first_in_queue->transaction.write_position : 0,
+ last_in_queue ? last_in_queue->transaction.write_position : 0));
+
+ DBUG_PRINT("debug", ("log_file_name: %s, last_complete: %llu",
+ log_file_name, last_complete));
+ if (do_maybe_sync(count))
+ sql_print_error(ER(ER_ERROR_ON_WRITE), name, errno);
}
@@ -4920,14 +4988,13 @@ void MYSQL_BIN_LOG::wait_until_position(
Start waiting threads to catch up. Once they have, we update the
last_complete position.
*/
- mysql_mutex_assert_owner(get_log_lock());
#ifndef DBUG_OFF
THD *ptr= first_in_queue;
for ( int count= 0 ; ptr && count < 10 ; ++count ) {
- DBUG_PRINT("info", ("position: %llu, complete: %s, next: 0x%llu",
- ptr->transaction.write_position,
- YESNO(ptr->transaction.flags.complete),
- (ulonglong) ptr->transaction.next_to_commit));
+ DBUG_PRINT("queue", ("position: %llu, complete: %s, next: 0x%llu",
+ ptr->transaction.write_position,
+ YESNO(ptr->transaction.flags.complete),
+ (ulonglong) ptr->transaction.next_to_commit));
ptr= ptr->transaction.next_to_commit;
}
if (ptr)
@@ -4940,14 +5007,14 @@ void MYSQL_BIN_LOG::wait_until_position(
procedure to be correct, it might well be that the thread was
queued and is the only outstanding thread. In that case, it needs
to be processed.
+
+ Note that it is not necessary to check the return value for the
+ wait_for_update since it can only return an error if a timeout is
+ provided.
*/
process_completion_queue();
while (last_complete < position)
- {
- DBUG_PRINT("debug", ("last_durable: %llu, last_complete: %llu, next_available: %llu",
- last_durable, last_complete, next_available));
(void) wait_for_update_bin_log(thd, NULL);
- }
process_completion_queue();
@@ -4976,20 +5043,24 @@ void MYSQL_BIN_LOG::wait_until_durable(T
if (opt_binlog_sync_interval == 0)
DBUG_VOID_RETURN;
+ DBUG_PRINT("debug", ("lock LOCK_durable"));
mysql_mutex_lock(&LOCK_durable);
my_off_t tmp_last_durable= last_durable;
while (last_durable < thd->transaction.write_position)
{
struct timespec wait_until;
set_timespec_nsec(wait_until, 1000 * opt_binlog_sync_interval);
+ DBUG_PRINT("debug", ("unlock LOCK_durable [wait]"));
const int result=
mysql_cond_timedwait(&COND_durable, &LOCK_durable, &wait_until);
+ DBUG_PRINT("debug", ("lock LOCK_durable [resume]"));
tmp_last_durable= last_durable;
+ DBUG_PRINT("debug", ("unlock LOCK_durable"));
mysql_mutex_unlock(&LOCK_durable);
if (result && tmp_last_durable < last_complete)
{
DBUG_ASSERT(result == ETIMEDOUT);
- if (int error= flush_and_sync(0, TRUE))
+ if (int error= do_maybe_sync(1, true))
{
/*
This is a fatal error and there is no way we can
@@ -5004,14 +5075,6 @@ void MYSQL_BIN_LOG::wait_until_durable(T
}
}
DBUG_ASSERT(tmp_last_durable >= thd->transaction.write_position);
- // To be able to detect invalid re-use of the write position.
-#ifndef DBUG_OFF
- thd->transaction.write_position= 0;
- thd->transaction.after_position= 0;
- DBUG_PRINT("debug", ("set write_position: %llu, after_position: %llu",
- thd->transaction.write_position,
- thd->transaction.after_position));
-#endif
DBUG_VOID_RETURN;
}
@@ -5037,19 +5100,15 @@ MYSQL_BIN_LOG::wait_until_complete_then_
int error= 0;
if (result == 0)
{
- error= rotate_and_purge(false);
+ bool do_purge = false;
+ error= rotate(false, &do_purge);
DBUG_PRINT("debug", ("unlock LOCK_available"));
mysql_mutex_unlock(&LOCK_available);
+ if (do_purge)
+ purge();
}
else
wait_until_durable(thd);
-#ifndef DBUG_OFF
- thd->transaction.write_position= 0;
- thd->transaction.after_position= 0;
- DBUG_PRINT("debug", ("set write_position: %llu, after_position: %llu",
- thd->transaction.write_position,
- thd->transaction.after_position));
-#endif
DBUG_RETURN(error);
}
@@ -5157,6 +5216,7 @@ void MYSQL_BIN_LOG::set_max_size(ulong m
mysql_mutex_lock(&LOCK_available);
if (is_open())
max_size= max_size_arg;
+ DBUG_PRINT("debug", ("unlock LOCK_available"));
mysql_mutex_unlock(&LOCK_available);
DBUG_VOID_RETURN;
}
@@ -5389,7 +5449,10 @@ int MYSQL_BIN_LOG::unlog(ulong cookie, m
// prepared_xids can be 0 if the transaction had ignorable errors.
DBUG_ASSERT(prepared_xids >= 0);
if (prepared_xids > 0)
+ {
prepared_xids--;
+ DBUG_PRINT("debug", ("dec prepared_xids to %lu", prepared_xids));
+ }
if (prepared_xids == 0) {
DBUG_PRINT("info", ("prepared_xids=%lu", prepared_xids));
mysql_cond_signal(&COND_prep_xids);
@@ -5403,24 +5466,27 @@ int MYSQL_BIN_LOG::unlog(ulong cookie, m
DBUG_ASSERT(result == 0 || result == EBUSY);
if (result == 0)
{
- int error= rotate_and_purge(false);
+ bool do_purge = false;
+ int error= rotate(false, &do_purge);
DBUG_PRINT("info", ("last_durable: %llu, last_complete: %llu, next_available: %llu",
last_durable, last_complete, next_available));
+ DBUG_PRINT("debug", ("unlock LOCK_available"));
mysql_mutex_unlock(&LOCK_available);
+ if (do_purge)
+ purge();
DBUG_RETURN(error);
}
DBUG_RETURN(0);
}
-THD *
-MYSQL_BIN_LOG::find_complete_prefix()
+int
+MYSQL_BIN_LOG::find_complete_prefix(THD **thd_end, int *count)
{
DBUG_ENTER("MYSQL_BIN_LOG::find_complete_prefix");
THD *ptr_end= NULL;
THD *ptr_cur= first_in_queue;
-
- mysql_mutex_assert_owner(get_lock_log());
+ int cnt= 0;
while (ptr_cur && ptr_cur->transaction.flags.complete)
{
@@ -5433,11 +5499,20 @@ MYSQL_BIN_LOG::find_complete_prefix()
YESNO(ptr_end->transaction.flags.complete)));
DBUG_ASSERT(ptr_cur == NULL || ptr_end == NULL ||
ptr_cur->transaction.write_position > ptr_end->transaction.write_position);
+ ++cnt;
}
DBUG_ASSERT(ptr_end == NULL ||
( ptr_end->transaction.flags.complete &&
( ptr_cur == NULL || !ptr_cur->transaction.flags.complete )));
- DBUG_RETURN(ptr_end);
+ if (thd_end)
+ *thd_end = ptr_end;
+ if (count)
+ *count = cnt;
+ DBUG_PRINT("return", ("thd_end: (#%lu,%lu), count: %d",
+ ptr_end ? (ulong) ptr_end->thread_id : 0UL,
+ ptr_end ? (ulong) ptr_end->transaction.write_position : 0UL,
+ cnt));
+ DBUG_RETURN(cnt);
}
@@ -5502,7 +5577,7 @@ MYSQL_BIN_LOG::queue_thread(THD *thd)
int
-MYSQL_BIN_LOG::start_reserve(THD *thd, my_xid xid)
+MYSQL_BIN_LOG::start_reserve(THD *thd, my_xid xid, bool *do_purge)
{
DBUG_ENTER("MYSQL_BIN_LOG::start_reserve");
binlog_cache_mngr *cache_mngr=
@@ -5511,12 +5586,12 @@ MYSQL_BIN_LOG::start_reserve(THD *thd, m
cache_mngr->trx_cache.freeze(thd, xid);
DBUG_PRINT("debug", ("lock LOCK_available"));
mysql_mutex_lock(&LOCK_available);
- int error= allocate_space_in_log(thd);
+ int error= allocate_space_in_log(thd, do_purge);
DBUG_PRINT("info", ("write_position: %llu", thd->transaction.write_position));
DBUG_RETURN(error);
}
-void MYSQL_BIN_LOG::finish_reserve(THD *thd, my_xid xid, int error)
+void MYSQL_BIN_LOG::finish_reserve(THD *thd, my_xid xid, int error, bool do_purge)
{
DBUG_ENTER("MYSQL_BIN_LOG::finish_reserve(THD*, my_xid, int)");
DBUG_PRINT("enter", ("error: %d", error));
@@ -5536,6 +5611,7 @@ void MYSQL_BIN_LOG::finish_reserve(THD *
*/
mysql_mutex_lock(&LOCK_prep_xids);
prepared_xids++;
+ DBUG_PRINT("info", ("inc prepared_xids to %lu", prepared_xids));
mysql_mutex_unlock(&LOCK_prep_xids);
DBUG_PRINT("info", ("stmt_cache.write_offset: %llu, stmt_cache.bytes_to_reserve: %u",
cache_mngr->stmt_cache.get_write_offset(),
@@ -5549,7 +5625,10 @@ void MYSQL_BIN_LOG::finish_reserve(THD *
DBUG_PRINT("info", ("last_durable: %llu, last_complete: %llu, next_available: %llu",
last_durable, last_complete, next_available));
}
+ DBUG_PRINT("debug", ("unlock LOCK_available"));
mysql_mutex_unlock(&LOCK_available);
+ if (do_purge)
+ purge();
DBUG_VOID_RETURN;
}
@@ -5785,11 +5864,9 @@ inline void binlog_start_trans_and_stmt(
*/
if (cache->empty())
{
- IO_CACHE *file=
- cache_mngr->get_binlog_cache_log(is_transactional);
Query_log_event qinfo(thd, STRING_WITH_LEN("BEGIN"),
is_transactional, FALSE, TRUE, 0, TRUE);
- write_event_to_cache(&qinfo, file, cache);
+ cache->write_event(&qinfo);
}
DBUG_VOID_RETURN;
@@ -5836,19 +5913,17 @@ int THD::binlog_write_table_map(TABLE *t
(binlog_cache_mngr*) thd_get_ha_data(this, binlog_hton);
binlog_cache_data *cache_data=
cache_mngr->get_binlog_cache_data(is_transactional);
- IO_CACHE *file=
- cache_mngr->get_binlog_cache_log(is_transactional);
if (binlog_rows_query && this->query())
{
/* Write the Rows_query_log_event into binlog before the table map */
Rows_query_log_event
rows_query_ev(this, this->query(), this->query_length());
- if ((error= write_event_to_cache(&rows_query_ev, file, cache_data)))
+ if ((error= cache_data->write_event(&rows_query_ev)))
DBUG_RETURN(error);
}
- if ((error= write_event_to_cache(&the_event, file, cache_data)))
+ if ((error= cache_data->write_event(&the_event)))
DBUG_RETURN(error);
binlog_table_maps++;
@@ -7039,12 +7114,16 @@ const char* mysql_bin_log_file_name(void
}
/**
Get the current position of the MySQL binlog.
+
+ The offset returned will be dependent on the value of
+ binlog_trx_committed set for the current session.
+
@return byte offset from the beginning of the binlog
*/
extern "C"
ulonglong mysql_bin_log_file_pos(void)
{
- switch (opt_binlog_trx_committed)
+ switch (current_thd->variables.binlog_trx_committed)
{
case BINLOG_TRX_WHEN_COMPLETE:
return mysql_bin_log.last_complete; // Atomic read
=== modified file 'sql/binlog.h'
--- a/sql/binlog.h 2011-12-11 16:03:12 +0000
+++ b/sql/binlog.h 2012-01-15 07:33:56 +0000
@@ -95,7 +95,7 @@ class MYSQL_BIN_LOG: public TC_LOG, priv
bool no_auto_events;
/* pointer to the sync period variable, for binlog this will be
- sync_binlog_period, for relay log this will be
+ opt_binlog_sync_period, for relay log this will be
sync_relay_log_period
*/
uint *sync_period_ptr;
@@ -208,10 +208,17 @@ public:
thread can be in this step at a time and set the transactions
write position to the next available position in the binary log.
+ @note The LOCK_available mutex will be locked by this function,
+ and the binary log can be rotated as a result of this call.
+
@param thd Session to start the reservation step for.
+
+ @param do_purge Pointer to variable set to true if it is
+ necessary to do a purge after releasing the locks.
+
@return Error code, or zero if no error.
*/
- int start_reserve(THD *thd, my_xid xid);
+ int start_reserve(THD *thd, my_xid xid, bool *do_purge);
/**
@@ -236,7 +243,7 @@ public:
@param error Error number of any error that occured between the
start_reserve call and this call.
*/
- void finish_reserve(THD *thd, my_xid xid, int error);
+ void finish_reserve(THD *thd, my_xid xid, int error, bool do_purge);
int recover(IO_CACHE *log, Format_description_log_event *fdle);
#if !defined(MYSQL_CLIENT)
@@ -313,22 +320,33 @@ public:
int remove_logs_from_index(LOG_INFO* linfo, bool need_update_threads);
int rotate(bool force_rotate, bool* check_purge);
void purge();
- int rotate_and_purge(bool force_rotate);
+ int rotate_and_purge(); /* TODO: Remove this from the class */
+
+ /**
+ Flush the IO_CACHE of the binary log.
+
+ This function flushes events in IO_CACHE binary log to binary log
+ file.
+ */
+ int do_flush();
+
/**
- Flush binlog cache and synchronize to disk.
+ Synchronize the binary log to disk if options require it.
- This function flushes events in binlog cache to binary log file,
- it will do synchronizing according to the setting of system
- variable 'sync_binlog'. If file is synchronized, @c synced will
- be set to 1, otherwise 0.
+ Synchronize the binary log file to disk according to the setting
+ of system variable 'binlog_sync_period'.
- @param[out] synced if not NULL, set to 1 if file is synchronized, otherwise 0
- @param[in] force if TRUE, ignores the 'sync_binlog' and synchronizes the file.
+ @note If the file is synchronized, even if forced, the internal
+ counter of outstanding syncs will be reset.
+
+ @param[in] count Number of events this call will synchronize.
+ @param[in] force If true, ignores the 'sync_binlog' and
+ synchronizes the file.
@retval 0 Success
@retval other Failure
*/
- bool flush_and_sync(bool *synced, const bool force=FALSE);
+ bool do_maybe_sync(int count, bool force=false);
int purge_logs(const char *to_log, bool included,
bool need_mutex, bool need_update_threads,
ulonglong *decrease_log_space);
@@ -356,13 +374,14 @@ public:
int find_log_pos(LOG_INFO* linfo, const char* log_name,
bool need_mutex);
int find_next_log(LOG_INFO* linfo, bool need_mutex);
- int get_current_log(LOG_INFO* linfo);
- int raw_get_current_log(LOG_INFO* linfo);
+ int get_current_log(LOG_INFO* linfo, THD *thd);
+ int raw_get_current_log(LOG_INFO* linfo, THD *thd);
uint next_file_id();
inline char* get_index_fname() { return index_file_name;}
inline char* get_log_fname() { return log_file_name; }
- inline my_off_t get_end_pos() const {
- switch (opt_master_trx_read)
+ inline my_off_t get_end_pos(THD *thd) const {
+ system_variables *sysvar= thd ? &thd->variables : &global_system_variables;
+ switch (sysvar->master_trx_read)
{
case BINLOG_TRX_WHEN_COMPLETE:
return last_complete; // Atomic read
@@ -459,9 +478,12 @@ public:
@pre LOCK_available have to be acquired.
+ @param check_purge pointer to variable that will be set to true
+ if it is necessary to call purge
+
@return Error code, or zero if no error.
*/
- int allocate_space_in_log(THD *thd);
+ int allocate_space_in_log(THD *thd, bool *check_purge);
/**
@@ -525,10 +547,11 @@ private:
/**
Find a complete prefix of the queued threads.
- @return Pointer to last complete thread, or NULL if there is no
- prefix.
+ @param thd_end_var Pointer to variable for last thread in prefix.
+ @param count_var Pointer to variable for prefix length.
+ @return Number of complete threads in prefix.
*/
- THD *find_complete_prefix();
+ int find_complete_prefix(THD **thd_end_var, int *count_var);
/**
Process the completion queue.
=== modified file 'sql/handler.cc'
--- a/sql/handler.cc 2011-12-11 16:03:12 +0000
+++ b/sql/handler.cc 2012-01-15 07:33:56 +0000
@@ -1176,6 +1176,8 @@ ha_check_and_coalesce_trx_read_only(THD
int ha_commit_trans(THD *thd, bool all)
{
int error= 0, cookie= 0;
+ bool do_purge = false;
+
/*
'all' means that this is either an explicit commit issued by
user, or an implicit commit issued by a DDL.
@@ -1283,7 +1285,7 @@ int ha_commit_trans(THD *thd, bool all)
if (is_real_trans)
{
int err;
- if ((err= tc_log->start_reserve(thd, xid)))
+ if ((err= tc_log->start_reserve(thd, xid, &do_purge)))
{
my_error(ER_ERROR_DURING_COMMIT, MYF(0), err);
error= 1;
@@ -1315,7 +1317,7 @@ int ha_commit_trans(THD *thd, bool all)
}
if (is_real_trans)
- tc_log->finish_reserve(thd, xid, error);
+ tc_log->finish_reserve(thd, xid, error, do_purge);
/*
Call the persist operation for each storage engine.
@@ -1343,7 +1345,7 @@ int ha_commit_trans(THD *thd, bool all)
goto end;
}
DBUG_EXECUTE_IF("crash_commit_after", DBUG_SUICIDE(););
- (void) RUN_HOOK(transaction, after_commit, (thd, FALSE));
+ (void) RUN_HOOK(transaction, after_commit, (thd, all));
end:
if (rw_trans && mdl_request.ticket)
{
@@ -1359,10 +1361,6 @@ end:
/* Free resources and perform other cleanup even for 'empty' transactions. */
else if (is_real_trans)
thd->transaction.cleanup();
-#ifndef DBUG_OFF
- thd->transaction.write_position= 0;
- thd->transaction.after_position= 0;
-#endif
DBUG_RETURN(error);
}
=== modified file 'sql/log.cc'
--- a/sql/log.cc 2011-11-03 16:03:34 +0000
+++ b/sql/log.cc 2012-01-15 07:33:56 +0000
@@ -1411,6 +1411,7 @@ static int find_uniq_filename(char *name
!(dir_info= my_dir(buff,MYF(MY_DONT_SORT))))))
{ // This shouldn't happen
strmov(end,".1"); // use name+1
+ DBUG_PRINT("debug", ("No unique file name found"));
DBUG_RETURN(1);
}
file_info= dir_info->dir_entry;
@@ -1727,6 +1728,7 @@ void MYSQL_QUERY_LOG::reopen_file()
DBUG_VOID_RETURN;
}
+ DBUG_PRINT("debug", ("lock LOCK_log"));
mysql_mutex_lock(&LOCK_log);
save_name= name;
@@ -1744,6 +1746,7 @@ void MYSQL_QUERY_LOG::reopen_file()
save_name, log_type, 0, io_cache_type);
my_free(save_name);
+ DBUG_PRINT("debug", ("unlock LOCK_log"));
mysql_mutex_unlock(&LOCK_log);
DBUG_VOID_RETURN;
@@ -1786,6 +1789,7 @@ bool MYSQL_QUERY_LOG::write(time_t event
struct tm start;
uint time_buff_len= 0;
+ DBUG_PRINT("debug", ("lock LOCK_log"));
mysql_mutex_lock(&LOCK_log);
/* Test if someone closed between the is_open test and lock */
@@ -1835,6 +1839,7 @@ bool MYSQL_QUERY_LOG::write(time_t event
goto err;
}
+ DBUG_PRINT("debug", ("unlock LOCK_log"));
mysql_mutex_unlock(&LOCK_log);
return FALSE;
err:
@@ -1844,6 +1849,7 @@ err:
write_error= 1;
sql_print_error(ER(ER_ERROR_ON_WRITE), name, errno);
}
+ DBUG_PRINT("debug", ("unlock LOCK_log"));
mysql_mutex_unlock(&LOCK_log);
return TRUE;
}
@@ -1887,10 +1893,12 @@ bool MYSQL_QUERY_LOG::write(THD *thd, ti
bool error= 0;
DBUG_ENTER("MYSQL_QUERY_LOG::write");
+ DBUG_PRINT("debug", ("lock LOCK_log"));
mysql_mutex_lock(&LOCK_log);
if (!is_open())
{
+ DBUG_PRINT("debug", ("unlock LOCK_log"));
mysql_mutex_unlock(&LOCK_log);
DBUG_RETURN(0);
}
@@ -1997,6 +2005,7 @@ bool MYSQL_QUERY_LOG::write(THD *thd, ti
}
}
}
+ DBUG_PRINT("debug", ("unlock LOCK_log"));
mysql_mutex_unlock(&LOCK_log);
DBUG_RETURN(error);
}
=== modified file 'sql/log.h'
--- a/sql/log.h 2011-12-11 16:03:12 +0000
+++ b/sql/log.h 2012-01-15 07:33:56 +0000
@@ -44,8 +44,8 @@ public:
virtual void close()=0;
virtual int log_xid(THD *thd, my_xid xid)=0;
virtual int unlog(ulong cookie, my_xid xid)=0;
- virtual int start_reserve(THD *thd, my_xid xid) = 0;
- virtual void finish_reserve(THD *thd, my_xid xid, int error) = 0;
+ virtual int start_reserve(THD *thd, my_xid xid, bool *do_purge) = 0;
+ virtual void finish_reserve(THD *thd, my_xid xid, int error, bool do_purge) = 0;
};
class TC_LOG_DUMMY: public TC_LOG // use it to disable the logging
@@ -56,8 +56,8 @@ public:
void close() { }
int log_xid(THD *thd, my_xid xid) { return 1; }
int unlog(ulong cookie, my_xid xid) { return 0; }
- int start_reserve(THD *thd, my_xid xid) { return 0; }
- void finish_reserve(THD *thd, my_xid xid, int) { }
+ int start_reserve(THD *thd, my_xid xid, bool *do_purge) { return 0; }
+ void finish_reserve(THD *thd, my_xid xid, int, bool do_purge) { }
};
#ifdef HAVE_MMAP
@@ -104,8 +104,8 @@ class TC_LOG_MMAP: public TC_LOG
int log_xid(THD *thd, my_xid xid);
int unlog(ulong cookie, my_xid xid);
int recover();
- int start_reserve(THD*, my_xid xid) { return 0; }
- void finish_reserve(THD*, my_xid xid, int) { }
+ int start_reserve(THD*, my_xid xid, bool *do_purge) { return 0; }
+ void finish_reserve(THD*, my_xid xid, int, bool do_purge) { }
private:
void get_active_from_pool();
=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc 2011-12-11 16:03:12 +0000
+++ b/sql/mysqld.cc 2012-01-15 07:33:56 +0000
@@ -517,13 +517,12 @@ ulong max_prepared_stmt_count;
ulong prepared_stmt_count=0;
ulong thread_id=1L,current_pid;
ulong slow_launch_threads = 0;
-uint sync_binlog_period= 0, sync_relaylog_period= 0,
+uint sync_relaylog_period= 0,
sync_relayloginfo_period= 0, sync_masterinfo_period= 0,
mts_checkpoint_period= 0, mts_checkpoint_group= 0;
-uint opt_binlog_sync_interval = 0;
+uint opt_binlog_sync_interval= 0;
+uint opt_binlog_sync_period= 0;
ulong expire_logs_days = 0;
-ulong opt_master_trx_read= 0;
-ulong opt_binlog_trx_committed= 0;
const double log_10[] = {
1e000, 1e001, 1e002, 1e003, 1e004, 1e005, 1e006, 1e007, 1e008, 1e009,
@@ -1700,6 +1699,8 @@ static void clean_up_mutexes()
mysql_cond_destroy(&COND_thread_cache);
mysql_cond_destroy(&COND_flush_thread_cache);
mysql_cond_destroy(&COND_manager);
+ mysql_mutex_destroy(&LOCK_server_started);
+ sp_cache_cleanup();
}
#endif /*EMBEDDED_LIBRARY*/
=== modified file 'sql/mysqld.h'
--- a/sql/mysqld.h 2011-11-11 13:30:47 +0000
+++ b/sql/mysqld.h 2012-01-15 07:33:56 +0000
@@ -137,10 +137,11 @@ extern ulong max_long_data_size;
extern ulong current_pid;
extern ulong expire_logs_days;
extern my_bool relay_log_recovery;
-extern uint sync_binlog_period, sync_relaylog_period,
+extern uint sync_relaylog_period,
sync_relayloginfo_period, sync_masterinfo_period,
mts_checkpoint_period, mts_checkpoint_group;
extern uint opt_binlog_sync_interval;
+extern uint opt_binlog_sync_period;
extern ulong opt_tc_log_size, tc_log_max_pages_used, tc_log_page_size;
extern ulong tc_log_page_waits;
extern my_bool relay_log_purge, opt_innodb_safe_binlog, opt_innodb;
@@ -236,8 +237,6 @@ extern char err_shared_dir[];
extern TYPELIB thread_handling_typelib;
extern my_decimal decimal_zero;
extern ulong log_warnings;
-extern ulong opt_master_trx_read;
-extern ulong opt_binlog_trx_committed;
/*
THR_MALLOC is a key which will be used to set/get MEM_ROOT** for a thread,
=== modified file 'sql/rpl_handler.cc'
--- a/sql/rpl_handler.cc 2011-10-02 08:25:38 +0000
+++ b/sql/rpl_handler.cc 2011-12-15 12:54:05 +0000
@@ -227,6 +227,9 @@ void delegates_destroy()
int Trans_delegate::after_commit(THD *thd, bool all)
{
+ DBUG_ENTER("Trans_delegate::after_commit");
+ DBUG_PRINT("enter", ("Thread ID: %lu, all: %s",
+ (ulong) thd->thread_id, YESNO(all)));
Trans_param param;
bool is_real_trans= (all || thd->transaction.all.ha_list == 0);
@@ -250,7 +253,7 @@ int Trans_delegate::after_commit(THD *th
my_pthread_setspecific_ptr(RPL_TRANS_BINLOG_INFO, NULL);
my_free(log_info);
}
- return ret;
+ DBUG_RETURN(ret);
}
int Trans_delegate::after_rollback(THD *thd, bool all)
@@ -286,6 +289,11 @@ int Binlog_storage_delegate::after_flush
my_off_t log_pos,
bool synced)
{
+ DBUG_ENTER("Binlog_storage_delegate::after_flush");
+ DBUG_PRINT("enter",
+ ("Thread ID: %lu, log_file: %s, log_pos: %lu, synced: %s",
+ (ulong) thd->thread_id, log_file,
+ (ulong) log_pos, YESNO(synced)));
Binlog_storage_param param;
uint32 flags=0;
if (synced)
@@ -298,7 +306,7 @@ int Binlog_storage_delegate::after_flush
{
if(!(log_info=
(Trans_binlog_info *)my_malloc(sizeof(Trans_binlog_info), MYF(0))))
- return 1;
+ DBUG_RETURN(1);
my_pthread_setspecific_ptr(RPL_TRANS_BINLOG_INFO, log_info);
}
@@ -308,7 +316,7 @@ int Binlog_storage_delegate::after_flush
int ret= 0;
FOREACH_OBSERVER(ret, after_flush, thd,
(¶m, log_info->log_file, log_info->log_pos, flags));
- return ret;
+ DBUG_RETURN(ret);
}
#ifdef HAVE_REPLICATION
=== modified file 'sql/rpl_injector.cc'
--- a/sql/rpl_injector.cc 2011-11-10 17:36:07 +0000
+++ b/sql/rpl_injector.cc 2011-12-15 12:54:05 +0000
@@ -36,7 +36,7 @@ injector::transaction::transaction(MYSQL
We need to fill it in using the code below.
*/
LOG_INFO log_info;
- log->get_current_log(&log_info);
+ log->get_current_log(&log_info, thd);
/* !!! binlog_pos does not follow RAII !!! */
m_start_pos.m_file_name= my_strdup(log_info.log_file_name, MYF(0));
m_start_pos.m_file_pos= log_info.pos;
=== modified file 'sql/rpl_master.cc'
--- a/sql/rpl_master.cc 2011-12-11 16:03:12 +0000
+++ b/sql/rpl_master.cc 2012-01-15 07:33:56 +0000
@@ -917,11 +917,9 @@ impossible position";
if (reset_transmit_packet(thd, flags, &ev_offset, &errmsg))
goto err;
- my_off_t prev_pos= log_file_pos;
while (!(error = Log_event::read_log_event(&log, packet, log_lock, current_checksum_alg,
log_file_pos, &next_file_pos)))
{
- prev_pos= next_file_pos;
#ifndef DBUG_OFF
if (max_binlog_dump_events && !left_events--)
{
@@ -1118,9 +1116,9 @@ impossible position";
DBUG_PRINT("debug", ("lock LOCK_log"));
mysql_mutex_lock(log_lock);
DBUG_PRINT("debug", ("log_file_pos: %lu, end_pos: %lu",
- (ulong) log_file_pos, (ulong) mysql_bin_log.get_end_pos()));
+ (ulong) log_file_pos, (ulong) mysql_bin_log.get_end_pos(thd)));
if (strcmp(log_file_name, mysql_bin_log.get_log_fname()) != 0 ||
- log_file_pos < mysql_bin_log.get_end_pos())
+ log_file_pos < mysql_bin_log.get_end_pos(thd))
error= Log_event::read_log_event(&log, packet, 0, current_checksum_alg,
log_file_pos, &next_file_pos);
else
@@ -1188,6 +1186,7 @@ impossible position";
/* reset transmit packet for the heartbeat event */
if (reset_transmit_packet(thd, flags, &ev_offset, &errmsg))
{
+ DBUG_PRINT("debug", ("unlock LOCK_log"));
thd->EXIT_COND(&old_stage);
goto err;
}
@@ -1195,6 +1194,7 @@ impossible position";
{
errmsg = "Failed on my_net_write()";
my_errno= ER_UNKNOWN_ERROR;
+ DBUG_PRINT("debug", ("unlock LOCK_log"));
thd->EXIT_COND(&old_stage);
goto err;
}
@@ -1204,6 +1204,7 @@ impossible position";
DBUG_PRINT("wait",("binary log received update or a broadcast signal caught"));
}
} while (signal_cnt == mysql_bin_log.signal_cnt && !thd->killed);
+ DBUG_PRINT("debug", ("unlock LOCK_log"));
thd->EXIT_COND(&old_stage);
}
break;
@@ -1499,7 +1500,7 @@ bool show_binlog_info(THD* thd)
if (mysql_bin_log.is_open())
{
LOG_INFO li;
- mysql_bin_log.get_current_log(&li);
+ mysql_bin_log.get_current_log(&li, thd);
int dir_len = dirname_length(li.log_file_name);
/*
If li.pos is set to zero, which is an impossible binlog
@@ -1568,7 +1569,7 @@ bool show_binlogs(THD* thd)
mysql_bin_log.lock_index();
index_file=mysql_bin_log.get_index_file();
- mysql_bin_log.raw_get_current_log(&cur); // dont take mutex
+ mysql_bin_log.raw_get_current_log(&cur, thd); // dont take mutex
DBUG_PRINT("debug", ("unlock LOCK_log"));
mysql_mutex_unlock(mysql_bin_log.get_log_lock()); // lockdep, OK
=== modified file 'sql/rpl_slave.cc'
--- a/sql/rpl_slave.cc 2011-12-11 16:03:12 +0000
+++ b/sql/rpl_slave.cc 2012-01-15 07:33:56 +0000
@@ -775,7 +775,7 @@ int terminate_slave_threads(Master_info*
THD_STAGE_INFO(current_thd, stage_flushing_relay_log_and_master_info_repository);
/*
- Flushes the master info regardles of the sync_master_info option.
+ Flushes the master info regardless of the sync_master_info option.
*/
if (mi->flush_info(TRUE))
{
@@ -784,10 +784,10 @@ int terminate_slave_threads(Master_info*
}
/*
- Flushes the relay log regardles of the sync_relay_log option.
+ Flushes the relay log regardless of the sync_relay_log option.
*/
if (mi->rli->relay_log.is_open() &&
- mi->rli->relay_log.flush_and_sync(0, TRUE))
+ mi->rli->relay_log.do_maybe_sync(0, true))
{
mysql_mutex_unlock(log_lock);
DBUG_RETURN(ER_ERROR_DURING_FLUSH_LOGS);
@@ -6698,6 +6698,7 @@ int rotate_relay_log(Master_info* mi)
*/
rli->relay_log.harvest_bytes_written(&rli->log_space_total);
unlock_and_exit:
+ DBUG_PRINT("debug", ("unlock LOCK_log"));
mysql_mutex_unlock(rli->relay_log.get_log_lock());
end:
DBUG_RETURN(error);
=== modified file 'sql/sp_cache.cc'
--- a/sql/sp_cache.cc 2011-06-30 15:50:45 +0000
+++ b/sql/sp_cache.cc 2012-01-15 07:33:56 +0000
@@ -92,6 +92,11 @@ void sp_cache_init()
}
+void sp_cache_cleanup()
+{
+ mysql_mutex_destroy(&Cversion_lock);
+}
+
/*
Clear the cache *cp and set *cp to NULL.
=== modified file 'sql/sp_cache.h'
--- a/sql/sp_cache.h 2011-06-30 15:50:45 +0000
+++ b/sql/sp_cache.h 2012-01-15 07:33:56 +0000
@@ -52,6 +52,7 @@ class sp_name;
*/
void sp_cache_init();
+void sp_cache_cleanup();
void sp_cache_clear(sp_cache **cp);
void sp_cache_insert(sp_cache **cp, sp_head *sp);
sp_head *sp_cache_lookup(sp_cache **cp, sp_name *name);
=== modified file 'sql/sql_class.h'
--- a/sql/sql_class.h 2011-12-11 16:03:12 +0000
+++ b/sql/sql_class.h 2012-01-15 07:33:56 +0000
@@ -499,6 +499,11 @@ typedef struct system_variables
ulong group_concat_max_len;
ulong binlog_format; ///< binlog format for this thd (see enum_binlog_format)
+ /** Binlog dump policy for session, see enum_binlog_trx */
+ ulong master_trx_read;
+ /** Binlog commit policy for session, see enum_binlog_trx */
+ ulong binlog_trx_committed;
+
my_bool binlog_direct_non_trans_update;
ulong binlog_row_image;
my_bool sql_log_bin;
@@ -2053,6 +2058,11 @@ public:
{
changed_tables= 0;
savepoints= 0;
+ write_position= 0;
+ after_position= 0;
+ DBUG_PRINT("debug", ("set write_position: %llu, after_position: %llu",
+ write_position, after_position));
+
/*
If rm_error is raised, it means that this piece of a distributed
transaction has failed and must be rolled back. But the user must
=== modified file 'sql/sql_reload.cc'
--- a/sql/sql_reload.cc 2011-10-27 19:28:15 +0000
+++ b/sql/sql_reload.cc 2012-01-15 07:33:56 +0000
@@ -142,7 +142,7 @@ bool reload_acl_and_cache(THD *thd, unsi
tmp_write_to_binlog= 0;
if (mysql_bin_log.is_open())
{
- if (mysql_bin_log.rotate_and_purge(true))
+ if (mysql_bin_log.rotate_and_purge())
*write_to_binlog= -1;
}
}
=== modified file 'sql/sys_vars.cc'
--- a/sql/sys_vars.cc 2011-12-11 16:03:12 +0000
+++ b/sql/sys_vars.cc 2012-01-15 07:33:56 +0000
@@ -2213,17 +2213,13 @@ static Sys_var_mybool Sys_slave_sql_veri
bool Sys_var_enum_binlog_checksum::global_update(THD *thd, set_var *var)
{
- bool check_purge= false;
-
- DBUG_PRINT("debug", ("lock LOCK_log"));
- mysql_mutex_lock(mysql_bin_log.get_log_lock());
if(mysql_bin_log.is_open())
{
bool alg_changed=
(binlog_checksum_options != (uint) var->save_result.ulonglong_value);
if (alg_changed)
mysql_bin_log.checksum_alg_reset= (uint8) var->save_result.ulonglong_value;
- mysql_bin_log.rotate(true, &check_purge);
+ mysql_bin_log.rotate_and_purge();
if (alg_changed)
mysql_bin_log.checksum_alg_reset= BINLOG_CHECKSUM_ALG_UNDEF; // done
}
@@ -2233,12 +2229,6 @@ bool Sys_var_enum_binlog_checksum::globa
}
DBUG_ASSERT((ulong) binlog_checksum_options == var->save_result.ulonglong_value);
DBUG_ASSERT(mysql_bin_log.checksum_alg_reset == BINLOG_CHECKSUM_ALG_UNDEF);
- DBUG_PRINT("debug", ("unlock LOCK_log"));
- mysql_mutex_unlock(mysql_bin_log.get_log_lock());
-
- if (check_purge)
- mysql_bin_log.purge();
-
return 0;
}
@@ -3464,18 +3454,18 @@ static Sys_var_uint Sys_checkpoint_mts_g
static Sys_var_uint Sys_sync_binlog(
"sync_binlog", "Synchronously flush binary log to disk after "
"every #th event. Use 0 (default) to disable synchronous flushing",
- GLOBAL_VAR(sync_binlog_period), CMD_LINE(REQUIRED_ARG),
+ GLOBAL_VAR(opt_binlog_sync_period), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0, UINT_MAX), DEFAULT(0), BLOCK_SIZE(1),
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(NULL),
ON_UPDATE(NULL), DEPRECATED("'@@binlog_sync_period'"));
-static Sys_var_uint Sys_sync_binlog_period(
+static Sys_var_uint Sys_binlog_sync_period(
"binlog_sync_period", "Synchronously flush binary log to disk after "
"every #th event. Use 0 (default) to disable synchronous flushing",
- GLOBAL_VAR(sync_binlog_period), CMD_LINE(REQUIRED_ARG),
+ GLOBAL_VAR(opt_binlog_sync_period), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0, UINT_MAX), DEFAULT(0), BLOCK_SIZE(1));
-static Sys_var_uint Sys_sync_binlog_interval(
+static Sys_var_uint Sys_binlog_sync_interval(
"binlog_sync_interval", "Synchronously flush binary log to disk "
"every # millisecond. Use 0 (default) to disable synchronous flushing",
GLOBAL_VAR(opt_binlog_sync_interval), CMD_LINE(REQUIRED_ARG),
@@ -3485,7 +3475,7 @@ static const char *binlog_trx_committed_
static bool check_binlog_trx(sys_var *self, THD *thd, set_var *var)
{
if (var->save_result.ulonglong_value == BINLOG_TRX_WHEN_DURABLE &&
- sync_binlog_period == 0 && opt_binlog_sync_interval == 0)
+ opt_binlog_sync_period == 0 && opt_binlog_sync_interval == 0)
{
my_error(ER_BINLOG_TRX_NEVER_DURABLE, MYF(0),
self->name.str, "DURABLE");
@@ -3501,7 +3491,7 @@ static Sys_var_enum Sys_binlog_trx_commi
" binlog-sync-interval or binlog-sync-period has to be"
" non-zero. If they are both zero, transactions will not be flushed"
" to disk and hence they will never be considered durable.",
- GLOBAL_VAR(opt_binlog_trx_committed), CMD_LINE(REQUIRED_ARG),
+ SESSION_VAR(binlog_trx_committed), CMD_LINE(REQUIRED_ARG),
binlog_trx_committed_names, DEFAULT(BINLOG_TRX_WHEN_COMPLETE),
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(check_binlog_trx));
@@ -3512,7 +3502,7 @@ static Sys_var_enum Sys_master_trx_read(
" or /binlog-sync-period/ has to be non-zero or an error will be"
" generated. If it was possible for both zero, no transactions"
" will ever be read from the binary log and hence never sent out.",
- GLOBAL_VAR(opt_master_trx_read), CMD_LINE(REQUIRED_ARG),
+ SESSION_VAR(master_trx_read), CMD_LINE(REQUIRED_ARG),
binlog_trx_committed_names, DEFAULT(BINLOG_TRX_WHEN_COMPLETE),
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(check_binlog_trx));
No bundle (reason: useless for push emails).
| Thread |
|---|
| • bzr push into mysql-trunk branch (mats.kindahl:3605 to 3607) WL#5223 | Mats Kindahl | 16 Jan |