Loading mysql-test/r/binlog.result +416 −0 File changed.Preview size limit exceeded, changes collapsed. Show changes mysql-test/t/binlog.test +30 −1 Original line number Diff line number Diff line Loading @@ -4,7 +4,6 @@ -- source include/have_log_bin.inc -- source include/not_embedded.inc -- source include/have_innodb.inc -- source include/have_log_bin.inc --disable_warnings drop table if exists t1, t2; Loading Loading @@ -137,4 +136,34 @@ show binlog events from 0; set session autocommit = @ac; # now show that nothing breaks if we need to read from the cache more # than once, resulting in split event-headers set @bcs = @@binlog_cache_size; set @ac = @@autocommit; set global binlog_cache_size=4096; set autocommit= 0; reset master; create table t1 (a int) engine=innodb; let $1=400; disable_query_log; begin; while ($1) { eval insert into t1 values( $1 ); dec $1; } commit; enable_query_log; show binlog events from 0; drop table t1; set global binlog_cache_size=@bcs; set session autocommit = @ac; --echo End of 5.0 tests sql/log.cc +38 −35 Original line number Diff line number Diff line Loading @@ -1918,8 +1918,7 @@ bool MYSQL_LOG::write(THD *thd, IO_CACHE *cache, Log_event *commit_event) memcpy((char *)cache->read_pos, &header[carry], LOG_EVENT_HEADER_LEN - carry); /* next event header at ... */ hdr_offs = LOG_EVENT_HEADER_LEN - carry + uint4korr(&header[EVENT_LEN_OFFSET]); hdr_offs = uint4korr(&header[EVENT_LEN_OFFSET]) - carry; carry= 0; } Loading @@ -1929,19 +1928,14 @@ bool MYSQL_LOG::write(THD *thd, IO_CACHE *cache, Log_event *commit_event) if (likely(length > 0)) { /* next header beyond current read-buffer? we'll get it later (though not necessarily in the very next iteration). process all event-headers in this (partial) cache. if next header is beyond current read-buffer, we'll get it later (though not necessarily in the very next iteration, just "eventually"). */ if (hdr_offs >= length) hdr_offs -= length; else while (hdr_offs < length) { /* process all event-headers in this (partial) cache. */ do { /* partial header only? save what we can get, process once we get the rest. Loading @@ -1968,8 +1962,17 @@ bool MYSQL_LOG::write(THD *thd, IO_CACHE *cache, Log_event *commit_event) hdr_offs += uint4korr(log_pos); } } while (hdr_offs < length); } /* Adjust hdr_offs. Note that this doesn't mean it will necessarily be valid in the next iteration; if the current event is very long, it may take a couple of read-iterations (and subsequent fixings of hdr_offs) for it to become valid again. if we had a split header, hdr_offs was already fixed above. */ if (carry == 0) hdr_offs -= length; } /* Write data to the binary log file */ Loading Loading
mysql-test/r/binlog.result +416 −0 File changed.Preview size limit exceeded, changes collapsed. Show changes
mysql-test/t/binlog.test +30 −1 Original line number Diff line number Diff line Loading @@ -4,7 +4,6 @@ -- source include/have_log_bin.inc -- source include/not_embedded.inc -- source include/have_innodb.inc -- source include/have_log_bin.inc --disable_warnings drop table if exists t1, t2; Loading Loading @@ -137,4 +136,34 @@ show binlog events from 0; set session autocommit = @ac; # now show that nothing breaks if we need to read from the cache more # than once, resulting in split event-headers set @bcs = @@binlog_cache_size; set @ac = @@autocommit; set global binlog_cache_size=4096; set autocommit= 0; reset master; create table t1 (a int) engine=innodb; let $1=400; disable_query_log; begin; while ($1) { eval insert into t1 values( $1 ); dec $1; } commit; enable_query_log; show binlog events from 0; drop table t1; set global binlog_cache_size=@bcs; set session autocommit = @ac; --echo End of 5.0 tests
sql/log.cc +38 −35 Original line number Diff line number Diff line Loading @@ -1918,8 +1918,7 @@ bool MYSQL_LOG::write(THD *thd, IO_CACHE *cache, Log_event *commit_event) memcpy((char *)cache->read_pos, &header[carry], LOG_EVENT_HEADER_LEN - carry); /* next event header at ... */ hdr_offs = LOG_EVENT_HEADER_LEN - carry + uint4korr(&header[EVENT_LEN_OFFSET]); hdr_offs = uint4korr(&header[EVENT_LEN_OFFSET]) - carry; carry= 0; } Loading @@ -1929,19 +1928,14 @@ bool MYSQL_LOG::write(THD *thd, IO_CACHE *cache, Log_event *commit_event) if (likely(length > 0)) { /* next header beyond current read-buffer? we'll get it later (though not necessarily in the very next iteration). process all event-headers in this (partial) cache. if next header is beyond current read-buffer, we'll get it later (though not necessarily in the very next iteration, just "eventually"). */ if (hdr_offs >= length) hdr_offs -= length; else while (hdr_offs < length) { /* process all event-headers in this (partial) cache. */ do { /* partial header only? save what we can get, process once we get the rest. Loading @@ -1968,8 +1962,17 @@ bool MYSQL_LOG::write(THD *thd, IO_CACHE *cache, Log_event *commit_event) hdr_offs += uint4korr(log_pos); } } while (hdr_offs < length); } /* Adjust hdr_offs. Note that this doesn't mean it will necessarily be valid in the next iteration; if the current event is very long, it may take a couple of read-iterations (and subsequent fixings of hdr_offs) for it to become valid again. if we had a split header, hdr_offs was already fixed above. */ if (carry == 0) hdr_offs -= length; } /* Write data to the binary log file */ Loading