mirror of
https://github.com/MariaDB/server.git
synced 2025-01-19 13:32:33 +01:00
ed1696f6b9
we store 7 bytes (1 + 2*3) in every Query_log_event. In the future if users want binlog optimized for small size and less safe, we could add --binlog-no-charset (and binlog-no-sql-mode etc): charset info is something by design optional (even if for now we don't offer possibility to disable it): it's not a binlog format change. We try to reduce the number of get_charset() calls in the slave SQL thread to a minimum by caching the charset read from the previous event (which will often be equal to the one of the current event). We don't use SET ONE_SHOT for charset-aware repl (we still do for timezones, will be fixed later). No more errors if one changes the global value of charset vars on master or slave (as we log charset info in all Query_log_event). Not fixing Load_log_event as it will be rewritten soon by Dmitri. Testing how mysqlbinlog behaves in rpl_charset.test. mysqlbinlog needs to know where charset file is (to be able to convert a charset number found in binlog (e.g. in User_var_log_event) to a charset name); mysql-test-run needs to pass the correct value for this option to mysqlbinlog. Many result udpates (adding charset info into every event shifts log_pos in SHOW BINLOG EVENTS). Roughly the same job is to be done for timezones :)
204 lines
6.5 KiB
Text
204 lines
6.5 KiB
Text
drop table if exists t1, t2;
|
|
create table t1 (a int) engine=innodb;
|
|
create table t2 (a int) engine=myisam;
|
|
reset master;
|
|
begin;
|
|
insert into t1 values(1);
|
|
insert into t2 select * from t1;
|
|
commit;
|
|
show binlog events from 95;
|
|
Log_name Pos Event_type Server_id End_log_pos Info
|
|
master-bin.000001 95 Query 1 # use `test`; BEGIN
|
|
master-bin.000001 164 Query 1 # use `test`; insert into t1 values(1)
|
|
master-bin.000001 252 Query 1 # use `test`; insert into t2 select * from t1
|
|
master-bin.000001 347 Query 1 # use `test`; COMMIT
|
|
delete from t1;
|
|
delete from t2;
|
|
reset master;
|
|
begin;
|
|
insert into t1 values(2);
|
|
insert into t2 select * from t1;
|
|
rollback;
|
|
Warnings:
|
|
Warning 1196 Some non-transactional changed tables couldn't be rolled back
|
|
show binlog events from 95;
|
|
Log_name Pos Event_type Server_id End_log_pos Info
|
|
master-bin.000001 95 Query 1 # use `test`; BEGIN
|
|
master-bin.000001 164 Query 1 # use `test`; insert into t1 values(2)
|
|
master-bin.000001 252 Query 1 # use `test`; insert into t2 select * from t1
|
|
master-bin.000001 347 Query 1 # use `test`; ROLLBACK
|
|
delete from t1;
|
|
delete from t2;
|
|
reset master;
|
|
begin;
|
|
insert into t1 values(3);
|
|
savepoint my_savepoint;
|
|
insert into t1 values(4);
|
|
insert into t2 select * from t1;
|
|
rollback to savepoint my_savepoint;
|
|
Warnings:
|
|
Warning 1196 Some non-transactional changed tables couldn't be rolled back
|
|
commit;
|
|
show binlog events from 95;
|
|
Log_name Pos Event_type Server_id End_log_pos Info
|
|
master-bin.000001 95 Query 1 # use `test`; BEGIN
|
|
master-bin.000001 164 Query 1 # use `test`; insert into t1 values(3)
|
|
master-bin.000001 252 Query 1 # use `test`; savepoint my_savepoint
|
|
master-bin.000001 338 Query 1 # use `test`; insert into t1 values(4)
|
|
master-bin.000001 426 Query 1 # use `test`; insert into t2 select * from t1
|
|
master-bin.000001 521 Query 1 # use `test`; rollback to savepoint my_savepoint
|
|
master-bin.000001 619 Query 1 # use `test`; COMMIT
|
|
delete from t1;
|
|
delete from t2;
|
|
reset master;
|
|
begin;
|
|
insert into t1 values(5);
|
|
savepoint my_savepoint;
|
|
insert into t1 values(6);
|
|
insert into t2 select * from t1;
|
|
rollback to savepoint my_savepoint;
|
|
Warnings:
|
|
Warning 1196 Some non-transactional changed tables couldn't be rolled back
|
|
insert into t1 values(7);
|
|
commit;
|
|
select a from t1 order by a;
|
|
a
|
|
5
|
|
7
|
|
show binlog events from 95;
|
|
Log_name Pos Event_type Server_id End_log_pos Info
|
|
master-bin.000001 95 Query 1 # use `test`; BEGIN
|
|
master-bin.000001 164 Query 1 # use `test`; insert into t1 values(5)
|
|
master-bin.000001 252 Query 1 # use `test`; savepoint my_savepoint
|
|
master-bin.000001 338 Query 1 # use `test`; insert into t1 values(6)
|
|
master-bin.000001 426 Query 1 # use `test`; insert into t2 select * from t1
|
|
master-bin.000001 521 Query 1 # use `test`; rollback to savepoint my_savepoint
|
|
master-bin.000001 619 Query 1 # use `test`; insert into t1 values(7)
|
|
master-bin.000001 707 Query 1 # use `test`; COMMIT
|
|
delete from t1;
|
|
delete from t2;
|
|
reset master;
|
|
select get_lock("a",10);
|
|
get_lock("a",10)
|
|
1
|
|
begin;
|
|
insert into t1 values(8);
|
|
insert into t2 select * from t1;
|
|
select get_lock("a",10);
|
|
get_lock("a",10)
|
|
1
|
|
show binlog events from 95;
|
|
Log_name Pos Event_type Server_id End_log_pos Info
|
|
master-bin.000001 95 Query 1 # use `test`; BEGIN
|
|
master-bin.000001 164 Query 1 # use `test`; insert into t1 values(8)
|
|
master-bin.000001 252 Query 1 # use `test`; insert into t2 select * from t1
|
|
master-bin.000001 347 Query 1 # use `test`; ROLLBACK
|
|
delete from t1;
|
|
delete from t2;
|
|
reset master;
|
|
insert into t1 values(9);
|
|
insert into t2 select * from t1;
|
|
show binlog events from 95;
|
|
Log_name Pos Event_type Server_id End_log_pos Info
|
|
master-bin.000001 95 Query 1 # use `test`; insert into t1 values(9)
|
|
master-bin.000001 183 Query 1 # use `test`; insert into t2 select * from t1
|
|
delete from t1;
|
|
delete from t2;
|
|
reset master;
|
|
insert into t1 values(10);
|
|
begin;
|
|
insert into t2 select * from t1;
|
|
show binlog events from 95;
|
|
Log_name Pos Event_type Server_id End_log_pos Info
|
|
master-bin.000001 95 Query 1 # use `test`; insert into t1 values(10)
|
|
master-bin.000001 184 Query 1 # use `test`; insert into t2 select * from t1
|
|
insert into t1 values(11);
|
|
commit;
|
|
show binlog events from 95;
|
|
Log_name Pos Event_type Server_id End_log_pos Info
|
|
master-bin.000001 95 Query 1 # use `test`; insert into t1 values(10)
|
|
master-bin.000001 184 Query 1 # use `test`; insert into t2 select * from t1
|
|
master-bin.000001 279 Query 1 # use `test`; BEGIN
|
|
master-bin.000001 348 Query 1 # use `test`; insert into t1 values(11)
|
|
master-bin.000001 437 Query 1 # use `test`; COMMIT
|
|
alter table t2 engine=INNODB;
|
|
delete from t1;
|
|
delete from t2;
|
|
reset master;
|
|
begin;
|
|
insert into t1 values(12);
|
|
insert into t2 select * from t1;
|
|
commit;
|
|
show binlog events from 95;
|
|
Log_name Pos Event_type Server_id End_log_pos Info
|
|
master-bin.000001 95 Query 1 # use `test`; BEGIN
|
|
master-bin.000001 164 Query 1 # use `test`; insert into t1 values(12)
|
|
master-bin.000001 253 Query 1 # use `test`; insert into t2 select * from t1
|
|
master-bin.000001 348 Query 1 # use `test`; COMMIT
|
|
delete from t1;
|
|
delete from t2;
|
|
reset master;
|
|
begin;
|
|
insert into t1 values(13);
|
|
insert into t2 select * from t1;
|
|
rollback;
|
|
show binlog events from 95;
|
|
Log_name Pos Event_type Server_id End_log_pos Info
|
|
delete from t1;
|
|
delete from t2;
|
|
reset master;
|
|
begin;
|
|
insert into t1 values(14);
|
|
savepoint my_savepoint;
|
|
insert into t1 values(15);
|
|
insert into t2 select * from t1;
|
|
rollback to savepoint my_savepoint;
|
|
commit;
|
|
show binlog events from 95;
|
|
Log_name Pos Event_type Server_id End_log_pos Info
|
|
master-bin.000001 95 Query 1 # use `test`; BEGIN
|
|
master-bin.000001 164 Query 1 # use `test`; insert into t1 values(14)
|
|
master-bin.000001 253 Query 1 # use `test`; COMMIT
|
|
delete from t1;
|
|
delete from t2;
|
|
reset master;
|
|
begin;
|
|
insert into t1 values(16);
|
|
savepoint my_savepoint;
|
|
insert into t1 values(17);
|
|
insert into t2 select * from t1;
|
|
rollback to savepoint my_savepoint;
|
|
insert into t1 values(18);
|
|
commit;
|
|
select a from t1 order by a;
|
|
a
|
|
16
|
|
18
|
|
show binlog events from 95;
|
|
Log_name Pos Event_type Server_id End_log_pos Info
|
|
master-bin.000001 95 Query 1 # use `test`; BEGIN
|
|
master-bin.000001 164 Query 1 # use `test`; insert into t1 values(16)
|
|
master-bin.000001 253 Query 1 # use `test`; insert into t1 values(18)
|
|
master-bin.000001 342 Query 1 # use `test`; COMMIT
|
|
delete from t1;
|
|
delete from t2;
|
|
alter table t2 type=MyISAM;
|
|
insert into t1 values (1);
|
|
begin;
|
|
select * from t1 for update;
|
|
a
|
|
1
|
|
select (@before:=unix_timestamp())*0;
|
|
(@before:=unix_timestamp())*0
|
|
0
|
|
begin;
|
|
select * from t1 for update;
|
|
insert into t2 values (20);
|
|
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
|
select (@after:=unix_timestamp())*0;
|
|
(@after:=unix_timestamp())*0
|
|
0
|
|
select (@after-@before) >= 2;
|
|
(@after-@before) >= 2
|
|
1
|
|
drop table t1,t2;
|