mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Merge tnurnberg@bk-internal.mysql.com:/home/bk/mysql-5.1-maint
into mysql.com:/home/tnurnberg/22540/51-22540 sql/log.cc: Auto merged
This commit is contained in:
@ -80,72 +80,11 @@ drop table t1;
|
|||||||
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ /Server ver: [^,]*,/Server version,/
|
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ /Server ver: [^,]*,/Server version,/
|
||||||
show binlog events from 0;
|
show binlog events from 0;
|
||||||
|
|
||||||
set autocommit= 1;
|
|
||||||
reset master;
|
|
||||||
create table t1(n int) engine=innodb;
|
|
||||||
insert into t1 values (1);
|
|
||||||
insert into t1 values (2);
|
|
||||||
insert into t1 values (3);
|
|
||||||
commit;
|
|
||||||
drop table t1;
|
|
||||||
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ /Server ver: [^,]*,/Server version,/
|
|
||||||
show binlog events from 0;
|
|
||||||
|
|
||||||
reset master;
|
|
||||||
create table t1(n int) engine=myisam;
|
|
||||||
begin;
|
|
||||||
insert into t1 values (4);
|
|
||||||
insert into t1 values (5);
|
|
||||||
insert into t1 values (6);
|
|
||||||
commit;
|
|
||||||
drop table t1;
|
|
||||||
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ /Server ver: [^,]*,/Server version,/
|
|
||||||
show binlog events from 0;
|
|
||||||
|
|
||||||
# now show this also works for SHOW MASTER STATUS
|
|
||||||
# as this is what "mysqldump --master-data=1" uses.
|
|
||||||
|
|
||||||
set autocommit= 1;
|
|
||||||
reset master;
|
|
||||||
create table t1(n int) engine=innodb;
|
|
||||||
show master status;
|
|
||||||
insert into t1 values (1);
|
|
||||||
show master status;
|
|
||||||
insert into t1 values (2);
|
|
||||||
insert into t1 values (3);
|
|
||||||
show master status;
|
|
||||||
commit;
|
|
||||||
show master status;
|
|
||||||
drop table t1;
|
|
||||||
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ /Server ver: [^,]*,/Server version,/
|
|
||||||
show binlog events from 0;
|
|
||||||
|
|
||||||
set autocommit= 0;
|
|
||||||
reset master;
|
|
||||||
create table t1(n int) engine=myisam;
|
|
||||||
show master status;
|
|
||||||
insert into t1 values (4);
|
|
||||||
show master status;
|
|
||||||
insert into t1 values (5);
|
|
||||||
insert into t1 values (6);
|
|
||||||
|
|
||||||
show master status;
|
|
||||||
commit;
|
|
||||||
show master status;
|
|
||||||
drop table t1;
|
|
||||||
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ /Server ver: [^,]*,/Server version,/
|
|
||||||
show binlog events from 0;
|
|
||||||
|
|
||||||
set session autocommit = @ac;
|
|
||||||
|
|
||||||
# now show that nothing breaks if we need to read from the cache more
|
# now show that nothing breaks if we need to read from the cache more
|
||||||
# than once, resulting in split event-headers
|
# than once, resulting in split event-headers
|
||||||
|
|
||||||
set @bcs = @@binlog_cache_size;
|
set @bcs = @@binlog_cache_size;
|
||||||
set @ac = @@autocommit;
|
|
||||||
|
|
||||||
set global binlog_cache_size=4096;
|
set global binlog_cache_size=4096;
|
||||||
set autocommit= 0;
|
|
||||||
reset master;
|
reset master;
|
||||||
|
|
||||||
create table t1 (a int) engine=innodb;
|
create table t1 (a int) engine=innodb;
|
||||||
|
@ -165,105 +165,8 @@ master-bin.000001 361 Query 1 449 use `test`; insert into t1 values (2)
|
|||||||
master-bin.000001 449 Query 1 537 use `test`; insert into t1 values (3)
|
master-bin.000001 449 Query 1 537 use `test`; insert into t1 values (3)
|
||||||
master-bin.000001 537 Xid 1 564 COMMIT /* XID */
|
master-bin.000001 537 Xid 1 564 COMMIT /* XID */
|
||||||
master-bin.000001 564 Query 1 640 use `test`; drop table t1
|
master-bin.000001 564 Query 1 640 use `test`; drop table t1
|
||||||
set autocommit= 1;
|
|
||||||
reset master;
|
|
||||||
create table t1(n int) engine=innodb;
|
|
||||||
insert into t1 values (1);
|
|
||||||
insert into t1 values (2);
|
|
||||||
insert into t1 values (3);
|
|
||||||
commit;
|
|
||||||
drop table t1;
|
|
||||||
show binlog events from 0;
|
|
||||||
Log_name Pos Event_type Server_id End_log_pos Info
|
|
||||||
master-bin.000001 4 Format_desc 1 106 Server version, Binlog ver: 4
|
|
||||||
master-bin.000001 106 Query 1 205 use `test`; create table t1(n int) engine=innodb
|
|
||||||
master-bin.000001 205 Query 1 293 use `test`; insert into t1 values (1)
|
|
||||||
master-bin.000001 293 Xid 1 320 COMMIT /* XID */
|
|
||||||
master-bin.000001 320 Query 1 408 use `test`; insert into t1 values (2)
|
|
||||||
master-bin.000001 408 Xid 1 435 COMMIT /* XID */
|
|
||||||
master-bin.000001 435 Query 1 523 use `test`; insert into t1 values (3)
|
|
||||||
master-bin.000001 523 Xid 1 550 COMMIT /* XID */
|
|
||||||
master-bin.000001 550 Query 1 626 use `test`; drop table t1
|
|
||||||
reset master;
|
|
||||||
create table t1(n int) engine=myisam;
|
|
||||||
begin;
|
|
||||||
insert into t1 values (4);
|
|
||||||
insert into t1 values (5);
|
|
||||||
insert into t1 values (6);
|
|
||||||
commit;
|
|
||||||
drop table t1;
|
|
||||||
show binlog events from 0;
|
|
||||||
Log_name Pos Event_type Server_id End_log_pos Info
|
|
||||||
master-bin.000001 4 Format_desc 1 106 Server version, Binlog ver: 4
|
|
||||||
master-bin.000001 106 Query 1 205 use `test`; create table t1(n int) engine=myisam
|
|
||||||
master-bin.000001 205 Query 1 293 use `test`; insert into t1 values (4)
|
|
||||||
master-bin.000001 293 Query 1 381 use `test`; insert into t1 values (5)
|
|
||||||
master-bin.000001 381 Query 1 469 use `test`; insert into t1 values (6)
|
|
||||||
master-bin.000001 469 Query 1 545 use `test`; drop table t1
|
|
||||||
set autocommit= 1;
|
|
||||||
reset master;
|
|
||||||
create table t1(n int) engine=innodb;
|
|
||||||
show master status;
|
|
||||||
File Position Binlog_Do_DB Binlog_Ignore_DB
|
|
||||||
master-bin.000001 205
|
|
||||||
insert into t1 values (1);
|
|
||||||
show master status;
|
|
||||||
File Position Binlog_Do_DB Binlog_Ignore_DB
|
|
||||||
master-bin.000001 320
|
|
||||||
insert into t1 values (2);
|
|
||||||
insert into t1 values (3);
|
|
||||||
show master status;
|
|
||||||
File Position Binlog_Do_DB Binlog_Ignore_DB
|
|
||||||
master-bin.000001 550
|
|
||||||
commit;
|
|
||||||
show master status;
|
|
||||||
File Position Binlog_Do_DB Binlog_Ignore_DB
|
|
||||||
master-bin.000001 550
|
|
||||||
drop table t1;
|
|
||||||
show binlog events from 0;
|
|
||||||
Log_name Pos Event_type Server_id End_log_pos Info
|
|
||||||
master-bin.000001 4 Format_desc 1 106 Server version, Binlog ver: 4
|
|
||||||
master-bin.000001 106 Query 1 205 use `test`; create table t1(n int) engine=innodb
|
|
||||||
master-bin.000001 205 Query 1 293 use `test`; insert into t1 values (1)
|
|
||||||
master-bin.000001 293 Xid 1 320 COMMIT /* XID */
|
|
||||||
master-bin.000001 320 Query 1 408 use `test`; insert into t1 values (2)
|
|
||||||
master-bin.000001 408 Xid 1 435 COMMIT /* XID */
|
|
||||||
master-bin.000001 435 Query 1 523 use `test`; insert into t1 values (3)
|
|
||||||
master-bin.000001 523 Xid 1 550 COMMIT /* XID */
|
|
||||||
master-bin.000001 550 Query 1 626 use `test`; drop table t1
|
|
||||||
set autocommit= 0;
|
|
||||||
reset master;
|
|
||||||
create table t1(n int) engine=myisam;
|
|
||||||
show master status;
|
|
||||||
File Position Binlog_Do_DB Binlog_Ignore_DB
|
|
||||||
master-bin.000001 205
|
|
||||||
insert into t1 values (4);
|
|
||||||
show master status;
|
|
||||||
File Position Binlog_Do_DB Binlog_Ignore_DB
|
|
||||||
master-bin.000001 293
|
|
||||||
insert into t1 values (5);
|
|
||||||
insert into t1 values (6);
|
|
||||||
show master status;
|
|
||||||
File Position Binlog_Do_DB Binlog_Ignore_DB
|
|
||||||
master-bin.000001 469
|
|
||||||
commit;
|
|
||||||
show master status;
|
|
||||||
File Position Binlog_Do_DB Binlog_Ignore_DB
|
|
||||||
master-bin.000001 469
|
|
||||||
drop table t1;
|
|
||||||
show binlog events from 0;
|
|
||||||
Log_name Pos Event_type Server_id End_log_pos Info
|
|
||||||
master-bin.000001 4 Format_desc 1 106 Server version, Binlog ver: 4
|
|
||||||
master-bin.000001 106 Query 1 205 use `test`; create table t1(n int) engine=myisam
|
|
||||||
master-bin.000001 205 Query 1 293 use `test`; insert into t1 values (4)
|
|
||||||
master-bin.000001 293 Query 1 381 use `test`; insert into t1 values (5)
|
|
||||||
master-bin.000001 381 Query 1 469 use `test`; insert into t1 values (6)
|
|
||||||
master-bin.000001 469 Query 1 545 use `test`; drop table t1
|
|
||||||
set session autocommit = @ac;
|
|
||||||
set @bcs = @@binlog_cache_size;
|
set @bcs = @@binlog_cache_size;
|
||||||
set @ac = @@autocommit;
|
|
||||||
set global binlog_cache_size=4096;
|
set global binlog_cache_size=4096;
|
||||||
set autocommit= 0;
|
|
||||||
reset master;
|
reset master;
|
||||||
create table t1 (a int) engine=innodb;
|
create table t1 (a int) engine=innodb;
|
||||||
show binlog events from 0;
|
show binlog events from 0;
|
||||||
|
32
sql/log.cc
32
sql/log.cc
@ -3942,7 +3942,7 @@ int MYSQL_BIN_LOG::write_cache(IO_CACHE *cache, bool lock_log, bool sync_log)
|
|||||||
|
|
||||||
if (reinit_io_cache(cache, READ_CACHE, 0, 0, 0))
|
if (reinit_io_cache(cache, READ_CACHE, 0, 0, 0))
|
||||||
return ER_ERROR_ON_WRITE;
|
return ER_ERROR_ON_WRITE;
|
||||||
uint bytes= my_b_bytes_in_cache(cache), group, carry, hdr_offs;
|
uint length= my_b_bytes_in_cache(cache), group, carry, hdr_offs;
|
||||||
long val;
|
long val;
|
||||||
uchar header[LOG_EVENT_HEADER_LEN];
|
uchar header[LOG_EVENT_HEADER_LEN];
|
||||||
|
|
||||||
@ -3999,7 +3999,7 @@ int MYSQL_BIN_LOG::write_cache(IO_CACHE *cache, bool lock_log, bool sync_log)
|
|||||||
|
|
||||||
/* if there is anything to write, process it. */
|
/* if there is anything to write, process it. */
|
||||||
|
|
||||||
if (likely(bytes > 0))
|
if (likely(length > 0))
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
process all event-headers in this (partial) cache.
|
process all event-headers in this (partial) cache.
|
||||||
@ -4008,18 +4008,18 @@ int MYSQL_BIN_LOG::write_cache(IO_CACHE *cache, bool lock_log, bool sync_log)
|
|||||||
very next iteration, just "eventually").
|
very next iteration, just "eventually").
|
||||||
*/
|
*/
|
||||||
|
|
||||||
while (hdr_offs < bytes)
|
while (hdr_offs < length)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
partial header only? save what we can get, process once
|
partial header only? save what we can get, process once
|
||||||
we get the rest.
|
we get the rest.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (hdr_offs + LOG_EVENT_HEADER_LEN > bytes)
|
if (hdr_offs + LOG_EVENT_HEADER_LEN > length)
|
||||||
{
|
{
|
||||||
carry= bytes - hdr_offs;
|
carry= length - hdr_offs;
|
||||||
memcpy(header, (char *)cache->read_pos + hdr_offs, carry);
|
memcpy(header, (char *)cache->read_pos + hdr_offs, carry);
|
||||||
bytes= hdr_offs;
|
length= hdr_offs;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -4039,21 +4039,23 @@ int MYSQL_BIN_LOG::write_cache(IO_CACHE *cache, bool lock_log, bool sync_log)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Adjust hdr_offs. Note that this doesn't mean it will necessarily
|
Adjust hdr_offs. Note that it may still point beyond the segment
|
||||||
be valid in the next iteration; if the current event is very long,
|
read in the next iteration; if the current event is very long,
|
||||||
it may take a couple of read-iterations (and subsequent fixings
|
it may take a couple of read-iterations (and subsequent adjustments
|
||||||
of hdr_offs) for it to become valid again.
|
of hdr_offs) for it to point into the then-current segment.
|
||||||
if we had a split header, hdr_offs was already fixed above.
|
If we have a split header (!carry), hdr_offs will be set at the
|
||||||
|
beginning of the next iteration, overwriting the value we set here:
|
||||||
*/
|
*/
|
||||||
if (carry == 0)
|
hdr_offs -= length;
|
||||||
hdr_offs -= bytes;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Write data to the binary log file */
|
/* Write data to the binary log file */
|
||||||
if (my_b_write(&log_file, cache->read_pos, bytes))
|
if (my_b_write(&log_file, cache->read_pos, length))
|
||||||
return ER_ERROR_ON_WRITE;
|
return ER_ERROR_ON_WRITE;
|
||||||
cache->read_pos=cache->read_end; // Mark buffer used up
|
cache->read_pos=cache->read_end; // Mark buffer used up
|
||||||
} while ((bytes=my_b_fill(cache)));
|
} while ((length= my_b_fill(cache)));
|
||||||
|
|
||||||
|
DBUG_ASSERT(carry == 0);
|
||||||
|
|
||||||
if (sync_log)
|
if (sync_log)
|
||||||
flush_and_sync();
|
flush_and_sync();
|
||||||
|
Reference in New Issue
Block a user