Commit f07e4850 authored by unknown's avatar unknown

WWe now store the catalog in Query_log_event in binlog WITHOUT its end zero.

This saves one byte per Query_log_event on disk compared to 5.0.[0..3]. Compatibility problems with 5.0.x where x<4
are explained in the comments in log_event.cc. Putting back s/my_open(O_TRUNC)/(my_delete+my_create) change which had
been wiped away by somebody doing a wrong 4.1->5.0 merge (which happened just
before 5.0.3 :( ). Applying it to new events for LOAD DATA INFILE.
If slave fails in Execute_load_query_log_event::exec_event(),
don't delete the file (so that it's re-usable at next START SLAVE).
And (youpi!) fix for BUG#3247 "a partially completed LOAD DATA INFILE is not
executed at all on the slave" (storing an Execute_load_query_log_event
to binlog, with its error code, instead of Delete_file_log_event).


mysql-test/r/mix_innodb_myisam_binlog.result:
  we now use one less byte when storing the catalog in binlog so positions change
mysql-test/r/rpl_change_master.result:
  we now use one less byte when storing the catalog in binlog so positions change
mysql-test/r/rpl_deadlock.result:
  we now use one less byte when storing the catalog in binlog so positions change
mysql-test/r/rpl_error_ignored_table.result:
  we now use one less byte when storing the catalog in binlog so positions change
mysql-test/r/rpl_flush_log_loop.result:
  we now use one less byte when storing the catalog in binlog so positions change
mysql-test/r/rpl_loaddata.result:
  we now use one less byte when storing the catalog in binlog so positions change.
  Plus testing replication of LOAD DATA INFILE if duplicate key and non-transactional table.
mysql-test/r/rpl_log.result:
  we now use one less byte when storing the catalog in binlog so positions change
mysql-test/r/rpl_max_relay_size.result:
  we now use one less byte when storing the catalog in binlog so positions change
mysql-test/r/rpl_relayrotate.result:
  we now use one less byte when storing the catalog in binlog so positions change
mysql-test/r/rpl_replicate_do.result:
  we now use one less byte when storing the catalog in binlog so positions change
mysql-test/r/rpl_rotate_logs.result:
  we now use one less byte when storing the catalog in binlog so positions change
mysql-test/r/rpl_until.result:
  we now use one less byte when storing the catalog in binlog so positions change
mysql-test/t/mysqlbinlog.test:
  we now use one less byte when storing the catalog in binlog so positions change
mysql-test/t/mysqlbinlog2.test:
  we now use one less byte when storing the catalog in binlog so positions change
mysql-test/t/rpl_deadlock.test:
  we now use one less byte when storing the catalog in binlog so positions change
mysql-test/t/rpl_loaddata.test:
  we now use one less byte when storing the catalog in binlog so positions change.
  Plus testing replication of LOAD DATA INFILE if duplicate key and non-transactional table.
mysql-test/t/rpl_until.test:
  we now use one less byte when storing the catalog in binlog so positions change
sql/log_event.cc:
  a) We now store the catalog in Query_log_event in binlog WITHOUT its end zero.
  This saves one byte per Query_log_event on disk. Compatibility problems with 5.0.x where x<4
  are explained in the comments in this file.
  b) putting back s/my_open(O_TRUNC)/(my_delete+my_create) change which had
  been wiped away by somebody doing a wrong 4.1->5.0 merge (which happened just
  before 5.0.3 :( ). Applying it to new events for LOAD DATA INFILE.
  c) if slave fails in Execute_load_query_log_event::exec_event(),
  don't delete the file (so that it's re-usable at next START SLAVE).
sql/log_event.h:
  We now store the catalog in Query_log_event in binlog WITHOUT its end zero.
  This saves one byte per Query_log_event on disk. This new storage for
  the catalog is denoted by Q_CATALOG_NZ_CODE (couldn't re-use Q_CATALOG_CODE
  as 5.0.3 slaves of this 5.0.4 master would segfault because it would
  expect a 0 when there is none.
  Renaming get_open_mode() to get_create_or_append() (see log_event.cc)
sql/sql_load.cc:
  Fix for BUG#3247: if LOAD DATA INFILE fails but has permanently updated a table
  (i.e. has deleted/added/modified some rows in a non-transactional table),
  we must write an Execute_load_query_log_event to binlog (with the error code,
  as this class beautifully inherits from Query_log_event, it can store
  the error code - thanks Dmitri) and not a Delete_file_log_event (we use
  to write a Delete_file_log_event: no update happened on slave, bug).
parent fa4a075b
...@@ -9,9 +9,9 @@ commit; ...@@ -9,9 +9,9 @@ commit;
show binlog events from 98; show binlog events from 98;
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 98 Query 1 # use `test`; BEGIN master-bin.000001 98 Query 1 # use `test`; BEGIN
master-bin.000001 167 Query 1 # use `test`; insert into t1 values(1) master-bin.000001 166 Query 1 # use `test`; insert into t1 values(1)
master-bin.000001 255 Query 1 # use `test`; insert into t2 select * from t1 master-bin.000001 253 Query 1 # use `test`; insert into t2 select * from t1
master-bin.000001 350 Xid 1 # COMMIT /* xid=7 */ master-bin.000001 347 Xid 1 # COMMIT /* xid=7 */
delete from t1; delete from t1;
delete from t2; delete from t2;
reset master; reset master;
...@@ -24,9 +24,9 @@ Warning 1196 Some non-transactional changed tables couldn't be rolled back ...@@ -24,9 +24,9 @@ Warning 1196 Some non-transactional changed tables couldn't be rolled back
show binlog events from 98; show binlog events from 98;
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 98 Query 1 # use `test`; BEGIN master-bin.000001 98 Query 1 # use `test`; BEGIN
master-bin.000001 167 Query 1 # use `test`; insert into t1 values(2) master-bin.000001 166 Query 1 # use `test`; insert into t1 values(2)
master-bin.000001 255 Query 1 # use `test`; insert into t2 select * from t1 master-bin.000001 253 Query 1 # use `test`; insert into t2 select * from t1
master-bin.000001 350 Query 1 # use `test`; ROLLBACK master-bin.000001 347 Query 1 # use `test`; ROLLBACK
delete from t1; delete from t1;
delete from t2; delete from t2;
reset master; reset master;
...@@ -42,12 +42,12 @@ commit; ...@@ -42,12 +42,12 @@ commit;
show binlog events from 98; show binlog events from 98;
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 98 Query 1 # use `test`; BEGIN master-bin.000001 98 Query 1 # use `test`; BEGIN
master-bin.000001 167 Query 1 # use `test`; insert into t1 values(3) master-bin.000001 166 Query 1 # use `test`; insert into t1 values(3)
master-bin.000001 255 Query 1 # use `test`; savepoint my_savepoint master-bin.000001 253 Query 1 # use `test`; savepoint my_savepoint
master-bin.000001 341 Query 1 # use `test`; insert into t1 values(4) master-bin.000001 338 Query 1 # use `test`; insert into t1 values(4)
master-bin.000001 429 Query 1 # use `test`; insert into t2 select * from t1 master-bin.000001 425 Query 1 # use `test`; insert into t2 select * from t1
master-bin.000001 524 Query 1 # use `test`; rollback to savepoint my_savepoint master-bin.000001 519 Query 1 # use `test`; rollback to savepoint my_savepoint
master-bin.000001 622 Xid 1 # COMMIT /* xid=24 */ master-bin.000001 616 Xid 1 # COMMIT /* xid=24 */
delete from t1; delete from t1;
delete from t2; delete from t2;
reset master; reset master;
...@@ -68,13 +68,13 @@ a ...@@ -68,13 +68,13 @@ a
show binlog events from 98; show binlog events from 98;
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 98 Query 1 # use `test`; BEGIN master-bin.000001 98 Query 1 # use `test`; BEGIN
master-bin.000001 167 Query 1 # use `test`; insert into t1 values(5) master-bin.000001 166 Query 1 # use `test`; insert into t1 values(5)
master-bin.000001 255 Query 1 # use `test`; savepoint my_savepoint master-bin.000001 253 Query 1 # use `test`; savepoint my_savepoint
master-bin.000001 341 Query 1 # use `test`; insert into t1 values(6) master-bin.000001 338 Query 1 # use `test`; insert into t1 values(6)
master-bin.000001 429 Query 1 # use `test`; insert into t2 select * from t1 master-bin.000001 425 Query 1 # use `test`; insert into t2 select * from t1
master-bin.000001 524 Query 1 # use `test`; rollback to savepoint my_savepoint master-bin.000001 519 Query 1 # use `test`; rollback to savepoint my_savepoint
master-bin.000001 622 Query 1 # use `test`; insert into t1 values(7) master-bin.000001 616 Query 1 # use `test`; insert into t1 values(7)
master-bin.000001 710 Xid 1 # COMMIT /* xid=36 */ master-bin.000001 703 Xid 1 # COMMIT /* xid=36 */
delete from t1; delete from t1;
delete from t2; delete from t2;
reset master; reset master;
...@@ -90,9 +90,9 @@ get_lock("a",10) ...@@ -90,9 +90,9 @@ get_lock("a",10)
show binlog events from 98; show binlog events from 98;
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 98 Query 1 # use `test`; BEGIN master-bin.000001 98 Query 1 # use `test`; BEGIN
master-bin.000001 167 Query 1 # use `test`; insert into t1 values(8) master-bin.000001 166 Query 1 # use `test`; insert into t1 values(8)
master-bin.000001 255 Query 1 # use `test`; insert into t2 select * from t1 master-bin.000001 253 Query 1 # use `test`; insert into t2 select * from t1
master-bin.000001 350 Query 1 # use `test`; ROLLBACK master-bin.000001 347 Query 1 # use `test`; ROLLBACK
delete from t1; delete from t1;
delete from t2; delete from t2;
reset master; reset master;
...@@ -101,8 +101,8 @@ insert into t2 select * from t1; ...@@ -101,8 +101,8 @@ insert into t2 select * from t1;
show binlog events from 98; show binlog events from 98;
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 98 Query 1 # use `test`; insert into t1 values(9) master-bin.000001 98 Query 1 # use `test`; insert into t1 values(9)
master-bin.000001 186 Xid 1 # COMMIT /* xid=59 */ master-bin.000001 185 Xid 1 # COMMIT /* xid=59 */
master-bin.000001 213 Query 1 # use `test`; insert into t2 select * from t1 master-bin.000001 212 Query 1 # use `test`; insert into t2 select * from t1
delete from t1; delete from t1;
delete from t2; delete from t2;
reset master; reset master;
...@@ -112,18 +112,18 @@ insert into t2 select * from t1; ...@@ -112,18 +112,18 @@ insert into t2 select * from t1;
show binlog events from 98; show binlog events from 98;
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 98 Query 1 # use `test`; insert into t1 values(10) master-bin.000001 98 Query 1 # use `test`; insert into t1 values(10)
master-bin.000001 187 Xid 1 # COMMIT /* xid=65 */ master-bin.000001 186 Xid 1 # COMMIT /* xid=65 */
master-bin.000001 214 Query 1 # use `test`; insert into t2 select * from t1 master-bin.000001 213 Query 1 # use `test`; insert into t2 select * from t1
insert into t1 values(11); insert into t1 values(11);
commit; commit;
show binlog events from 98; show binlog events from 98;
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 98 Query 1 # use `test`; insert into t1 values(10) master-bin.000001 98 Query 1 # use `test`; insert into t1 values(10)
master-bin.000001 187 Xid 1 # COMMIT /* xid=65 */ master-bin.000001 186 Xid 1 # COMMIT /* xid=65 */
master-bin.000001 214 Query 1 # use `test`; insert into t2 select * from t1 master-bin.000001 213 Query 1 # use `test`; insert into t2 select * from t1
master-bin.000001 309 Query 1 # use `test`; BEGIN master-bin.000001 307 Query 1 # use `test`; BEGIN
master-bin.000001 378 Query 1 # use `test`; insert into t1 values(11) master-bin.000001 375 Query 1 # use `test`; insert into t1 values(11)
master-bin.000001 467 Xid 1 # COMMIT /* xid=67 */ master-bin.000001 463 Xid 1 # COMMIT /* xid=67 */
alter table t2 engine=INNODB; alter table t2 engine=INNODB;
delete from t1; delete from t1;
delete from t2; delete from t2;
...@@ -135,9 +135,9 @@ commit; ...@@ -135,9 +135,9 @@ commit;
show binlog events from 98; show binlog events from 98;
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 98 Query 1 # use `test`; BEGIN master-bin.000001 98 Query 1 # use `test`; BEGIN
master-bin.000001 167 Query 1 # use `test`; insert into t1 values(12) master-bin.000001 166 Query 1 # use `test`; insert into t1 values(12)
master-bin.000001 256 Query 1 # use `test`; insert into t2 select * from t1 master-bin.000001 254 Query 1 # use `test`; insert into t2 select * from t1
master-bin.000001 351 Xid 1 # COMMIT /* xid=77 */ master-bin.000001 348 Xid 1 # COMMIT /* xid=77 */
delete from t1; delete from t1;
delete from t2; delete from t2;
reset master; reset master;
...@@ -160,8 +160,8 @@ commit; ...@@ -160,8 +160,8 @@ commit;
show binlog events from 98; show binlog events from 98;
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 98 Query 1 # use `test`; BEGIN master-bin.000001 98 Query 1 # use `test`; BEGIN
master-bin.000001 167 Query 1 # use `test`; insert into t1 values(14) master-bin.000001 166 Query 1 # use `test`; insert into t1 values(14)
master-bin.000001 256 Xid 1 # COMMIT /* xid=93 */ master-bin.000001 254 Xid 1 # COMMIT /* xid=93 */
delete from t1; delete from t1;
delete from t2; delete from t2;
reset master; reset master;
...@@ -180,9 +180,9 @@ a ...@@ -180,9 +180,9 @@ a
show binlog events from 98; show binlog events from 98;
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 98 Query 1 # use `test`; BEGIN master-bin.000001 98 Query 1 # use `test`; BEGIN
master-bin.000001 167 Query 1 # use `test`; insert into t1 values(16) master-bin.000001 166 Query 1 # use `test`; insert into t1 values(16)
master-bin.000001 256 Query 1 # use `test`; insert into t1 values(18) master-bin.000001 254 Query 1 # use `test`; insert into t1 values(18)
master-bin.000001 345 Xid 1 # COMMIT /* xid=104 */ master-bin.000001 342 Xid 1 # COMMIT /* xid=104 */
delete from t1; delete from t1;
delete from t2; delete from t2;
alter table t2 type=MyISAM; alter table t2 type=MyISAM;
......
...@@ -13,11 +13,11 @@ insert into t1 values(2); ...@@ -13,11 +13,11 @@ insert into t1 values(2);
stop slave; stop slave;
show slave status; show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 360 # # master-bin.000001 No No 0 0 184 # None 0 No # # 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 357 # # master-bin.000001 No No 0 0 183 # None 0 No #
change master to master_user='root'; change master to master_user='root';
show slave status; show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 184 # # master-bin.000001 No No 0 0 184 # None 0 No # # 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 183 # # master-bin.000001 No No 0 0 183 # None 0 No #
start slave; start slave;
select * from t1; select * from t1;
n n
......
...@@ -45,9 +45,9 @@ a ...@@ -45,9 +45,9 @@ a
22 22
show slave status; show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 19118 # # master-bin.000001 Yes Yes 0 0 19118 # None 0 No # # 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 18911 # # master-bin.000001 Yes Yes 0 0 18911 # None 0 No #
stop slave; stop slave;
change master to master_log_pos=536; change master to master_log_pos=532;
begin; begin;
select * from t2 for update; select * from t2 for update;
a a
...@@ -63,10 +63,10 @@ a ...@@ -63,10 +63,10 @@ a
22 22
show slave status; show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 19118 # # master-bin.000001 Yes Yes 0 0 19118 # None 0 No # # 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 18911 # # master-bin.000001 Yes Yes 0 0 18911 # None 0 No #
set global max_relay_log_size=0; set global max_relay_log_size=0;
stop slave; stop slave;
change master to master_log_pos=536; change master to master_log_pos=532;
begin; begin;
select * from t2 for update; select * from t2 for update;
a a
...@@ -83,5 +83,5 @@ a ...@@ -83,5 +83,5 @@ a
22 22
show slave status; show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 19118 # # master-bin.000001 Yes Yes 0 0 19118 # None 0 No # # 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 18911 # # master-bin.000001 Yes Yes 0 0 18911 # None 0 No #
drop table t1,t2; drop table t1,t2;
...@@ -9,7 +9,7 @@ insert into t1 values (1),(1); ...@@ -9,7 +9,7 @@ insert into t1 values (1),(1);
ERROR 23000: Duplicate entry '1' for key 1 ERROR 23000: Duplicate entry '1' for key 1
show slave status; show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 290 # # master-bin.000001 Yes Yes test.t3,test.t1,test.t2 0 0 290 # None 0 No # # 127.0.0.1 root MASTER_PORT 1 master-bin.000001 288 # # master-bin.000001 Yes Yes test.t3,test.t1,test.t2 0 0 288 # None 0 No #
show tables like 't1'; show tables like 't1';
Tables_in_test (t1) Tables_in_test (t1)
drop table t1; drop table t1;
......
...@@ -14,4 +14,4 @@ start slave; ...@@ -14,4 +14,4 @@ start slave;
flush logs; flush logs;
show slave status; show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
# 127.0.0.1 root SLAVE_PORT 60 slave-bin.000001 209 # # slave-bin.000001 Yes Yes 0 0 209 # None 0 No # # 127.0.0.1 root SLAVE_PORT 60 slave-bin.000001 208 # # slave-bin.000001 Yes Yes 0 0 208 # None 0 No #
...@@ -22,7 +22,7 @@ day id category name ...@@ -22,7 +22,7 @@ day id category name
2003-03-22 2416 a bbbbb 2003-03-22 2416 a bbbbb
show master status; show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB File Position Binlog_Do_DB Binlog_Ignore_DB
slave-bin.000001 1292 slave-bin.000001 1286
drop table t1; drop table t1;
drop table t2; drop table t2;
drop table t3; drop table t3;
...@@ -33,7 +33,7 @@ set global sql_slave_skip_counter=1; ...@@ -33,7 +33,7 @@ set global sql_slave_skip_counter=1;
start slave; start slave;
show slave status; show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 1800 # # master-bin.000001 Yes Yes 0 0 1800 # None 0 No # # 127.0.0.1 root MASTER_PORT 1 master-bin.000001 1789 # # master-bin.000001 Yes Yes 0 0 1789 # None 0 No #
set sql_log_bin=0; set sql_log_bin=0;
delete from t1; delete from t1;
set sql_log_bin=1; set sql_log_bin=1;
...@@ -43,7 +43,7 @@ change master to master_user='test'; ...@@ -43,7 +43,7 @@ change master to master_user='test';
change master to master_user='root'; change master to master_user='root';
show slave status; show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 1835 # # master-bin.000001 No No 0 0 1835 # None 0 No # # 127.0.0.1 root MASTER_PORT 1 master-bin.000001 1824 # # master-bin.000001 No No 0 0 1824 # None 0 No #
set global sql_slave_skip_counter=1; set global sql_slave_skip_counter=1;
start slave; start slave;
set sql_log_bin=0; set sql_log_bin=0;
...@@ -57,12 +57,25 @@ Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File ...@@ -57,12 +57,25 @@ Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File
# 127.0.0.1 root MASTER_PORT 1 4 # # No No 0 0 0 # None 0 No # # 127.0.0.1 root MASTER_PORT 1 4 # # No No 0 0 0 # None 0 No #
reset master; reset master;
create table t2 (day date,id int(9),category enum('a','b','c'),name varchar(60), create table t2 (day date,id int(9),category enum('a','b','c'),name varchar(60),
unique(day)); unique(day)) engine=MyISAM;
load data infile '../../std_data/rpl_loaddata2.dat' into table t2 fields load data infile '../../std_data/rpl_loaddata2.dat' into table t2 fields
terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by
'\n##\n' starting by '>' ignore 1 lines; '\n##\n' starting by '>' ignore 1 lines;
ERROR 23000: Duplicate entry '2003-03-22' for key 1 ERROR 23000: Duplicate entry '2003-03-22' for key 1
show master status; select * from t2;
File Position Binlog_Do_DB Binlog_Ignore_DB day id category name
master-bin.000001 441 2003-02-22 2461 b a a a @ %  ' " a
2003-03-22 2161 c asdf
start slave;
select * from t2;
day id category name
2003-02-22 2461 b a a a @ %  ' " a
2003-03-22 2161 c asdf
alter table t2 drop key day;
delete from t2;
load data infile '../../std_data/rpl_loaddata2.dat' into table t2 fields
terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by
'\n##\n' starting by '>' ignore 1 lines;
ERROR 23000: Duplicate entry '2003-03-22' for key 1
drop table t2;
drop table t2; drop table t2;
...@@ -20,24 +20,24 @@ drop table t1; ...@@ -20,24 +20,24 @@ drop table t1;
show binlog events; show binlog events;
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 4 Format_desc 1 98 Server ver: VERSION, Binlog ver: 4 master-bin.000001 4 Format_desc 1 98 Server ver: VERSION, Binlog ver: 4
master-bin.000001 98 Query 1 220 use `test`; create table t1(n int not null auto_increment primary key) master-bin.000001 98 Query 1 219 use `test`; create table t1(n int not null auto_increment primary key)
master-bin.000001 220 Intvar 1 248 INSERT_ID=1 master-bin.000001 219 Intvar 1 247 INSERT_ID=1
master-bin.000001 248 Query 1 340 use `test`; insert into t1 values (NULL) master-bin.000001 247 Query 1 338 use `test`; insert into t1 values (NULL)
master-bin.000001 340 Query 1 417 use `test`; drop table t1 master-bin.000001 338 Query 1 414 use `test`; drop table t1
master-bin.000001 417 Query 1 521 use `test`; create table t1 (word char(20) not null) master-bin.000001 414 Query 1 517 use `test`; create table t1 (word char(20) not null)
master-bin.000001 521 Begin_load_query 1 1125 ;file_id=1;block_len=581 master-bin.000001 517 Begin_load_query 1 1121 ;file_id=1;block_len=581
master-bin.000001 1125 Execute_load_query 1 1274 use `test`; load data infile '../../std_data/words.dat' into table t1 ignore 1 lines ;file_id=1 master-bin.000001 1121 Execute_load_query 1 1269 use `test`; load data infile '../../std_data/words.dat' into table t1 ignore 1 lines ;file_id=1
master-bin.000001 1274 Query 1 1351 use `test`; drop table t1 master-bin.000001 1269 Query 1 1345 use `test`; drop table t1
show binlog events from 98 limit 1; show binlog events from 98 limit 1;
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 98 Query 1 220 use `test`; create table t1(n int not null auto_increment primary key) master-bin.000001 98 Query 1 219 use `test`; create table t1(n int not null auto_increment primary key)
show binlog events from 98 limit 2; show binlog events from 98 limit 2;
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 98 Query 1 220 use `test`; create table t1(n int not null auto_increment primary key) master-bin.000001 98 Query 1 219 use `test`; create table t1(n int not null auto_increment primary key)
master-bin.000001 220 Intvar 1 248 INSERT_ID=1 master-bin.000001 219 Intvar 1 247 INSERT_ID=1
show binlog events from 98 limit 2,1; show binlog events from 98 limit 2,1;
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 248 Query 1 340 use `test`; insert into t1 values (NULL) master-bin.000001 247 Query 1 338 use `test`; insert into t1 values (NULL)
flush logs; flush logs;
create table t5 (a int); create table t5 (a int);
drop table t5; drop table t5;
...@@ -50,23 +50,23 @@ drop table t1; ...@@ -50,23 +50,23 @@ drop table t1;
show binlog events; show binlog events;
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 4 Format_desc 1 98 Server ver: VERSION, Binlog ver: 4 master-bin.000001 4 Format_desc 1 98 Server ver: VERSION, Binlog ver: 4
master-bin.000001 98 Query 1 220 use `test`; create table t1(n int not null auto_increment primary key) master-bin.000001 98 Query 1 219 use `test`; create table t1(n int not null auto_increment primary key)
master-bin.000001 220 Intvar 1 248 INSERT_ID=1 master-bin.000001 219 Intvar 1 247 INSERT_ID=1
master-bin.000001 248 Query 1 340 use `test`; insert into t1 values (NULL) master-bin.000001 247 Query 1 338 use `test`; insert into t1 values (NULL)
master-bin.000001 340 Query 1 417 use `test`; drop table t1 master-bin.000001 338 Query 1 414 use `test`; drop table t1
master-bin.000001 417 Query 1 521 use `test`; create table t1 (word char(20) not null) master-bin.000001 414 Query 1 517 use `test`; create table t1 (word char(20) not null)
master-bin.000001 521 Begin_load_query 1 1125 ;file_id=1;block_len=581 master-bin.000001 517 Begin_load_query 1 1121 ;file_id=1;block_len=581
master-bin.000001 1125 Execute_load_query 1 1274 use `test`; load data infile '../../std_data/words.dat' into table t1 ignore 1 lines ;file_id=1 master-bin.000001 1121 Execute_load_query 1 1269 use `test`; load data infile '../../std_data/words.dat' into table t1 ignore 1 lines ;file_id=1
master-bin.000001 1274 Query 1 1351 use `test`; drop table t1 master-bin.000001 1269 Query 1 1345 use `test`; drop table t1
master-bin.000001 1351 Rotate 1 1395 master-bin.000002;pos=4 master-bin.000001 1345 Rotate 1 1389 master-bin.000002;pos=4
show binlog events in 'master-bin.000002'; show binlog events in 'master-bin.000002';
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000002 4 Format_desc 1 98 Server ver: VERSION, Binlog ver: 4 master-bin.000002 4 Format_desc 1 98 Server ver: VERSION, Binlog ver: 4
master-bin.000002 98 Query 1 185 use `test`; create table t5 (a int) master-bin.000002 98 Query 1 184 use `test`; create table t5 (a int)
master-bin.000002 185 Query 1 262 use `test`; drop table t5 master-bin.000002 184 Query 1 260 use `test`; drop table t5
master-bin.000002 262 Query 1 349 use `test`; create table t1 (n int) master-bin.000002 260 Query 1 346 use `test`; create table t1 (n int)
master-bin.000002 349 Query 1 438 use `test`; insert into t1 values (1) master-bin.000002 346 Query 1 434 use `test`; insert into t1 values (1)
master-bin.000002 438 Query 1 515 use `test`; drop table t1 master-bin.000002 434 Query 1 510 use `test`; drop table t1
show binary logs; show binary logs;
Log_name Log_name
master-bin.000001 master-bin.000001
...@@ -79,25 +79,25 @@ slave-bin.000002 ...@@ -79,25 +79,25 @@ slave-bin.000002
show binlog events in 'slave-bin.000001' from 4; show binlog events in 'slave-bin.000001' from 4;
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
slave-bin.000001 4 Format_desc 2 98 Server ver: VERSION, Binlog ver: 4 slave-bin.000001 4 Format_desc 2 98 Server ver: VERSION, Binlog ver: 4
slave-bin.000001 98 Query 1 220 use `test`; create table t1(n int not null auto_increment primary key) slave-bin.000001 98 Query 1 219 use `test`; create table t1(n int not null auto_increment primary key)
slave-bin.000001 220 Intvar 1 248 INSERT_ID=1 slave-bin.000001 219 Intvar 1 247 INSERT_ID=1
slave-bin.000001 248 Query 1 340 use `test`; insert into t1 values (NULL) slave-bin.000001 247 Query 1 338 use `test`; insert into t1 values (NULL)
slave-bin.000001 340 Query 1 417 use `test`; drop table t1 slave-bin.000001 338 Query 1 414 use `test`; drop table t1
slave-bin.000001 417 Query 1 521 use `test`; create table t1 (word char(20) not null) slave-bin.000001 414 Query 1 517 use `test`; create table t1 (word char(20) not null)
slave-bin.000001 521 Begin_load_query 1 1125 ;file_id=1;block_len=581 slave-bin.000001 517 Begin_load_query 1 1121 ;file_id=1;block_len=581
slave-bin.000001 1125 Execute_load_query 1 1283 use `test`; load data INFILE '../../var/tmp/SQL_LOAD-2-1-1.data' INTO table t1 ignore 1 lines ;file_id=1 slave-bin.000001 1121 Execute_load_query 1 1278 use `test`; load data INFILE '../../var/tmp/SQL_LOAD-2-1-1.data' INTO table t1 ignore 1 lines ;file_id=1
slave-bin.000001 1283 Query 1 1360 use `test`; drop table t1 slave-bin.000001 1278 Query 1 1354 use `test`; drop table t1
slave-bin.000001 1360 Query 1 1447 use `test`; create table t5 (a int) slave-bin.000001 1354 Query 1 1440 use `test`; create table t5 (a int)
slave-bin.000001 1447 Query 1 1524 use `test`; drop table t5 slave-bin.000001 1440 Query 1 1516 use `test`; drop table t5
slave-bin.000001 1524 Rotate 2 1567 slave-bin.000002;pos=4 slave-bin.000001 1516 Rotate 2 1559 slave-bin.000002;pos=4
show binlog events in 'slave-bin.000002' from 4; show binlog events in 'slave-bin.000002' from 4;
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
slave-bin.000002 4 Format_desc 2 98 Server ver: VERSION, Binlog ver: 4 slave-bin.000002 4 Format_desc 2 98 Server ver: VERSION, Binlog ver: 4
slave-bin.000002 98 Query 1 185 use `test`; create table t1 (n int) slave-bin.000002 98 Query 1 184 use `test`; create table t1 (n int)
slave-bin.000002 185 Query 1 274 use `test`; insert into t1 values (1) slave-bin.000002 184 Query 1 272 use `test`; insert into t1 values (1)
slave-bin.000002 274 Query 1 351 use `test`; drop table t1 slave-bin.000002 272 Query 1 348 use `test`; drop table t1
show slave status; show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
# 127.0.0.1 root MASTER_PORT 1 master-bin.000002 515 # # master-bin.000002 Yes Yes 0 0 515 # None 0 No # # 127.0.0.1 root MASTER_PORT 1 master-bin.000002 510 # # master-bin.000002 Yes Yes 0 0 510 # None 0 No #
show binlog events in 'slave-bin.000005' from 4; show binlog events in 'slave-bin.000005' from 4;
ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log
...@@ -16,7 +16,7 @@ select @@global.max_relay_log_size; ...@@ -16,7 +16,7 @@ select @@global.max_relay_log_size;
start slave; start slave;
show slave status; show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 73754 # # master-bin.000001 Yes Yes 0 0 73754 # None 0 No # # 127.0.0.1 root MASTER_PORT 1 master-bin.000001 72952 # # master-bin.000001 Yes Yes 0 0 72952 # None 0 No #
stop slave; stop slave;
reset slave; reset slave;
set global max_relay_log_size=(5*4096); set global max_relay_log_size=(5*4096);
...@@ -26,7 +26,7 @@ select @@global.max_relay_log_size; ...@@ -26,7 +26,7 @@ select @@global.max_relay_log_size;
start slave; start slave;
show slave status; show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 73754 # # master-bin.000001 Yes Yes 0 0 73754 # None 0 No # # 127.0.0.1 root MASTER_PORT 1 master-bin.000001 72952 # # master-bin.000001 Yes Yes 0 0 72952 # None 0 No #
stop slave; stop slave;
reset slave; reset slave;
set global max_relay_log_size=0; set global max_relay_log_size=0;
...@@ -36,7 +36,7 @@ select @@global.max_relay_log_size; ...@@ -36,7 +36,7 @@ select @@global.max_relay_log_size;
start slave; start slave;
show slave status; show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 73754 # # master-bin.000001 Yes Yes 0 0 73754 # None 0 No # # 127.0.0.1 root MASTER_PORT 1 master-bin.000001 72952 # # master-bin.000001 Yes Yes 0 0 72952 # None 0 No #
stop slave; stop slave;
reset slave; reset slave;
flush logs; flush logs;
...@@ -49,12 +49,12 @@ flush logs; ...@@ -49,12 +49,12 @@ flush logs;
create table t1 (a int); create table t1 (a int);
show slave status; show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 73841 # # master-bin.000001 Yes Yes 0 0 73841 # None 0 No # # 127.0.0.1 root MASTER_PORT 1 master-bin.000001 73038 # # master-bin.000001 Yes Yes 0 0 73038 # None 0 No #
flush logs; flush logs;
drop table t1; drop table t1;
show slave status; show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 73918 # # master-bin.000001 Yes Yes 0 0 73918 # None 0 No # # 127.0.0.1 root MASTER_PORT 1 master-bin.000001 73114 # # master-bin.000001 Yes Yes 0 0 73114 # None 0 No #
flush logs; flush logs;
show master status; show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB File Position Binlog_Do_DB Binlog_Ignore_DB
......
...@@ -18,5 +18,5 @@ max(a) ...@@ -18,5 +18,5 @@ max(a)
8000 8000
show slave status; show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 743188 # # master-bin.000001 Yes Yes 0 0 743188 # None 0 No # # 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 735186 # # master-bin.000001 Yes Yes 0 0 735186 # None 0 No #
drop table t1; drop table t1;
...@@ -28,4 +28,4 @@ ERROR 42S02: Table 'test.t11' doesn't exist ...@@ -28,4 +28,4 @@ ERROR 42S02: Table 'test.t11' doesn't exist
drop table if exists t1,t2,t11; drop table if exists t1,t2,t11;
show slave status; show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 1668 # # master-bin.000001 Yes Yes test.t1 0 0 1668 # None 0 No # # 127.0.0.1 root MASTER_PORT 1 master-bin.000001 1658 # # master-bin.000001 Yes Yes test.t1 0 0 1658 # None 0 No #
...@@ -16,7 +16,7 @@ create table t1 (s text); ...@@ -16,7 +16,7 @@ create table t1 (s text);
insert into t1 values('Could not break slave'),('Tried hard'); insert into t1 values('Could not break slave'),('Tried hard');
show slave status; show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
# 127.0.0.1 root MASTER_PORT 60 master-bin.000001 552 # # master-bin.000001 Yes Yes 0 0 552 # None 0 No # # 127.0.0.1 root MASTER_PORT 60 master-bin.000001 548 # # master-bin.000001 Yes Yes 0 0 548 # None 0 No #
select * from t1; select * from t1;
s s
Could not break slave Could not break slave
...@@ -57,7 +57,7 @@ master-bin.000003 ...@@ -57,7 +57,7 @@ master-bin.000003
insert into t2 values (65); insert into t2 values (65);
show slave status; show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
# 127.0.0.1 root MASTER_PORT 60 master-bin.000003 500 # # master-bin.000003 Yes Yes 0 0 500 # None 0 No # # 127.0.0.1 root MASTER_PORT 60 master-bin.000003 496 # # master-bin.000003 Yes Yes 0 0 496 # None 0 No #
select * from t2; select * from t2;
m m
34 34
...@@ -79,13 +79,13 @@ master-bin.000004 ...@@ -79,13 +79,13 @@ master-bin.000004
master-bin.000005 master-bin.000005
show master status; show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000005 2146 master-bin.000005 2032
select * from t4; select * from t4;
a a
testing temporary tables part 2 testing temporary tables part 2
show slave status; show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
# 127.0.0.1 root MASTER_PORT 60 master-bin.000005 2146 # # master-bin.000005 Yes Yes 0 0 2146 # None 0 No # # 127.0.0.1 root MASTER_PORT 60 master-bin.000005 2032 # # master-bin.000005 Yes Yes 0 0 2032 # None 0 No #
lock tables t3 read; lock tables t3 read;
select count(*) from t3 where n >= 4; select count(*) from t3 where n >= 4;
count(*) count(*)
......
...@@ -15,14 +15,14 @@ drop table t2; ...@@ -15,14 +15,14 @@ drop table t2;
show binlog events; show binlog events;
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 4 Format_desc 1 98 Server ver: VERSION, Binlog ver: 4 master-bin.000001 4 Format_desc 1 98 Server ver: VERSION, Binlog ver: 4
master-bin.000001 98 Query 1 220 use `test`; create table t1(n int not null auto_increment primary key) master-bin.000001 98 Query 1 219 use `test`; create table t1(n int not null auto_increment primary key)
master-bin.000001 220 Query 1 321 use `test`; insert into t1 values (1),(2),(3),(4) master-bin.000001 219 Query 1 319 use `test`; insert into t1 values (1),(2),(3),(4)
master-bin.000001 321 Query 1 398 use `test`; drop table t1 master-bin.000001 319 Query 1 395 use `test`; drop table t1
master-bin.000001 398 Query 1 520 use `test`; create table t2(n int not null auto_increment primary key) master-bin.000001 395 Query 1 516 use `test`; create table t2(n int not null auto_increment primary key)
master-bin.000001 520 Query 1 613 use `test`; insert into t2 values (1),(2) master-bin.000001 516 Query 1 608 use `test`; insert into t2 values (1),(2)
master-bin.000001 613 Query 1 706 use `test`; insert into t2 values (3),(4) master-bin.000001 608 Query 1 700 use `test`; insert into t2 values (3),(4)
master-bin.000001 706 Query 1 783 use `test`; drop table t2 master-bin.000001 700 Query 1 776 use `test`; drop table t2
start slave until master_log_file='master-bin.000001', master_log_pos=321; start slave until master_log_file='master-bin.000001', master_log_pos=319;
select * from t1; select * from t1;
n n
1 1
...@@ -31,7 +31,7 @@ n ...@@ -31,7 +31,7 @@ n
4 4
show slave status; show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 783 slave-relay-bin.000004 # master-bin.000001 Yes No 0 0 321 # Master master-bin.000001 321 No # # 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 776 slave-relay-bin.000004 # master-bin.000001 Yes No 0 0 319 # Master master-bin.000001 319 No #
start slave until master_log_file='master-no-such-bin.000001', master_log_pos=291; start slave until master_log_file='master-no-such-bin.000001', master_log_pos=291;
select * from t1; select * from t1;
n n
...@@ -41,21 +41,21 @@ n ...@@ -41,21 +41,21 @@ n
4 4
show slave status; show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 783 slave-relay-bin.000004 # master-bin.000001 Yes No 0 0 321 # Master master-no-such-bin.000001 291 No # # 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 776 slave-relay-bin.000004 # master-bin.000001 Yes No 0 0 319 # Master master-no-such-bin.000001 291 No #
start slave until relay_log_file='slave-relay-bin.000004', relay_log_pos=751; start slave until relay_log_file='slave-relay-bin.000004', relay_log_pos=746;
select * from t2; select * from t2;
n n
1 1
2 2
show slave status; show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 783 slave-relay-bin.000004 # master-bin.000001 Yes No 0 0 613 # Relay slave-relay-bin.000004 751 No # # 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 776 slave-relay-bin.000004 # master-bin.000001 Yes No 0 0 608 # Relay slave-relay-bin.000004 746 No #
start slave; start slave;
stop slave; stop slave;
start slave until master_log_file='master-bin.000001', master_log_pos=783; start slave until master_log_file='master-bin.000001', master_log_pos=776;
show slave status; show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 783 slave-relay-bin.000004 # master-bin.000001 Yes No 0 0 783 # Master master-bin.000001 783 No # # 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 776 slave-relay-bin.000004 # master-bin.000001 Yes No 0 0 776 # Master master-bin.000001 776 No #
start slave until master_log_file='master-bin', master_log_pos=561; start slave until master_log_file='master-bin', master_log_pos=561;
ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
start slave until master_log_file='master-bin.000001', master_log_pos=561, relay_log_pos=12; start slave until master_log_file='master-bin.000001', master_log_pos=561, relay_log_pos=12;
...@@ -67,6 +67,6 @@ ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UN ...@@ -67,6 +67,6 @@ ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UN
start slave until relay_log_file='slave-relay-bin.000002', master_log_pos=561; start slave until relay_log_file='slave-relay-bin.000002', master_log_pos=561;
ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
start slave sql_thread; start slave sql_thread;
start slave until master_log_file='master-bin.000001', master_log_pos=783; start slave until master_log_file='master-bin.000001', master_log_pos=776;
Warnings: Warnings:
Note 1254 Slave is already running Note 1254 Slave is already running
...@@ -60,7 +60,7 @@ select "--- --database --" as ""; ...@@ -60,7 +60,7 @@ select "--- --database --" as "";
select "--- --position --" as ""; select "--- --position --" as "";
--enable_query_log --enable_query_log
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
--exec $MYSQL_BINLOG --short-form --local-load=$MYSQL_TEST_DIR/var/tmp/ --position=232 $MYSQL_TEST_DIR/var/log/master-bin.000002 --exec $MYSQL_BINLOG --short-form --local-load=$MYSQL_TEST_DIR/var/tmp/ --position=231 $MYSQL_TEST_DIR/var/log/master-bin.000002
# These are tests for remote binlog. # These are tests for remote binlog.
# They should return the same as previous test. # They should return the same as previous test.
...@@ -92,7 +92,7 @@ select "--- --database --" as ""; ...@@ -92,7 +92,7 @@ select "--- --database --" as "";
select "--- --position --" as ""; select "--- --position --" as "";
--enable_query_log --enable_query_log
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
--exec $MYSQL_BINLOG --short-form --local-load=$MYSQL_TEST_DIR/var/tmp/ --read-from-remote-server --position=232 --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002 --exec $MYSQL_BINLOG --short-form --local-load=$MYSQL_TEST_DIR/var/tmp/ --read-from-remote-server --position=231 --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002
# Bug#7853 (mysqlbinlog does not accept input from stdin) # Bug#7853 (mysqlbinlog does not accept input from stdin)
--disable_query_log --disable_query_log
......
...@@ -46,11 +46,11 @@ select "--- offset --" as ""; ...@@ -46,11 +46,11 @@ select "--- offset --" as "";
--disable_query_log --disable_query_log
select "--- start-position --" as ""; select "--- start-position --" as "";
--enable_query_log --enable_query_log
--exec $MYSQL_BINLOG --short-form --start-position=604 $MYSQL_TEST_DIR/var/log/master-bin.000001 --exec $MYSQL_BINLOG --short-form --start-position=600 $MYSQL_TEST_DIR/var/log/master-bin.000001
--disable_query_log --disable_query_log
select "--- stop-position --" as ""; select "--- stop-position --" as "";
--enable_query_log --enable_query_log
--exec $MYSQL_BINLOG --short-form --stop-position=604 $MYSQL_TEST_DIR/var/log/master-bin.000001 --exec $MYSQL_BINLOG --short-form --stop-position=600 $MYSQL_TEST_DIR/var/log/master-bin.000001
--disable_query_log --disable_query_log
select "--- start-datetime --" as ""; select "--- start-datetime --" as "";
--enable_query_log --enable_query_log
...@@ -75,7 +75,7 @@ select "--- offset --" as ""; ...@@ -75,7 +75,7 @@ select "--- offset --" as "";
--disable_query_log --disable_query_log
select "--- start-position --" as ""; select "--- start-position --" as "";
--enable_query_log --enable_query_log
--exec $MYSQL_BINLOG --short-form --start-position=604 $MYSQL_TEST_DIR/var/log/master-bin.000001 $MYSQL_TEST_DIR/var/log/master-bin.000002 --exec $MYSQL_BINLOG --short-form --start-position=600 $MYSQL_TEST_DIR/var/log/master-bin.000001 $MYSQL_TEST_DIR/var/log/master-bin.000002
--disable_query_log --disable_query_log
select "--- stop-position --" as ""; select "--- stop-position --" as "";
--enable_query_log --enable_query_log
...@@ -102,11 +102,11 @@ select "--- offset --" as ""; ...@@ -102,11 +102,11 @@ select "--- offset --" as "";
--disable_query_log --disable_query_log
select "--- start-position --" as ""; select "--- start-position --" as "";
--enable_query_log --enable_query_log
--exec $MYSQL_BINLOG --short-form --start-position=604 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 --exec $MYSQL_BINLOG --short-form --start-position=600 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
--disable_query_log --disable_query_log
select "--- stop-position --" as ""; select "--- stop-position --" as "";
--enable_query_log --enable_query_log
--exec $MYSQL_BINLOG --short-form --stop-position=604 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 --exec $MYSQL_BINLOG --short-form --stop-position=600 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
--disable_query_log --disable_query_log
select "--- start-datetime --" as ""; select "--- start-datetime --" as "";
--enable_query_log --enable_query_log
...@@ -129,7 +129,7 @@ select "--- offset --" as ""; ...@@ -129,7 +129,7 @@ select "--- offset --" as "";
--disable_query_log --disable_query_log
select "--- start-position --" as ""; select "--- start-position --" as "";
--enable_query_log --enable_query_log
--exec $MYSQL_BINLOG --short-form --start-position=604 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002 --exec $MYSQL_BINLOG --short-form --start-position=600 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002
--disable_query_log --disable_query_log
select "--- stop-position --" as ""; select "--- stop-position --" as "";
--enable_query_log --enable_query_log
......
...@@ -72,7 +72,7 @@ show slave status; ...@@ -72,7 +72,7 @@ show slave status;
# 2) Test lock wait timeout # 2) Test lock wait timeout
stop slave; stop slave;
change master to master_log_pos=536; # the BEGIN log event change master to master_log_pos=532; # the BEGIN log event
begin; begin;
select * from t2 for update; # hold lock select * from t2 for update; # hold lock
start slave; start slave;
...@@ -93,7 +93,7 @@ set global max_relay_log_size=0; ...@@ -93,7 +93,7 @@ set global max_relay_log_size=0;
# This is really copy-paste of 2) of above # This is really copy-paste of 2) of above
stop slave; stop slave;
change master to master_log_pos=536; change master to master_log_pos=532;
begin; begin;
select * from t2 for update; select * from t2 for update;
start slave; start slave;
......
...@@ -123,12 +123,29 @@ show slave status; ...@@ -123,12 +123,29 @@ show slave status;
connection master; connection master;
reset master; reset master;
create table t2 (day date,id int(9),category enum('a','b','c'),name varchar(60), create table t2 (day date,id int(9),category enum('a','b','c'),name varchar(60),
unique(day)); unique(day)) engine=MyISAM; # no transactions
--error 1062; --error 1062;
load data infile '../../std_data/rpl_loaddata2.dat' into table t2 fields load data infile '../../std_data/rpl_loaddata2.dat' into table t2 fields
terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by
'\n##\n' starting by '>' ignore 1 lines; '\n##\n' starting by '>' ignore 1 lines;
# To test that there is Create_file & Delete_file, we test if the binlog is as select * from t2;
# long as expected (can't do SHOW BINLOG EVENTS because of varying file_id). save_master_pos;
show master status; connection slave;
start slave;
sync_with_master;
select * from t2;
# verify that if no error on slave, this is an error
alter table t2 drop key day;
connection master;
delete from t2;
--error 1062;
load data infile '../../std_data/rpl_loaddata2.dat' into table t2 fields
terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by
'\n##\n' starting by '>' ignore 1 lines;
connection slave;
wait_for_slave_to_stop;
drop table t2;
connection master;
drop table t2; drop table t2;
...@@ -24,7 +24,7 @@ show binlog events; ...@@ -24,7 +24,7 @@ show binlog events;
# try to replicate all queries until drop of t1 # try to replicate all queries until drop of t1
connection slave; connection slave;
start slave until master_log_file='master-bin.000001', master_log_pos=321; start slave until master_log_file='master-bin.000001', master_log_pos=319;
sleep 2; sleep 2;
# here table should be still not deleted # here table should be still not deleted
select * from t1; select * from t1;
...@@ -42,7 +42,7 @@ sleep 2; ...@@ -42,7 +42,7 @@ sleep 2;
show slave status; show slave status;
# try replicate all until second insert to t2; # try replicate all until second insert to t2;
start slave until relay_log_file='slave-relay-bin.000004', relay_log_pos=751; start slave until relay_log_file='slave-relay-bin.000004', relay_log_pos=746;
sleep 4; sleep 4;
select * from t2; select * from t2;
--replace_result $MASTER_MYPORT MASTER_MYPORT --replace_result $MASTER_MYPORT MASTER_MYPORT
...@@ -58,7 +58,7 @@ sync_with_master; ...@@ -58,7 +58,7 @@ sync_with_master;
stop slave; stop slave;
# this should stop immediately as we are already there # this should stop immediately as we are already there
start slave until master_log_file='master-bin.000001', master_log_pos=783; start slave until master_log_file='master-bin.000001', master_log_pos=776;
# 2 is not enough when running with valgrind # 2 is not enough when running with valgrind
real_sleep 4 real_sleep 4
# here the sql slave thread should be stopped # here the sql slave thread should be stopped
...@@ -79,4 +79,4 @@ start slave until relay_log_file='slave-relay-bin.000002'; ...@@ -79,4 +79,4 @@ start slave until relay_log_file='slave-relay-bin.000002';
start slave until relay_log_file='slave-relay-bin.000002', master_log_pos=561; start slave until relay_log_file='slave-relay-bin.000002', master_log_pos=561;
# Warning should be given for second command # Warning should be given for second command
start slave sql_thread; start slave sql_thread;
start slave until master_log_file='master-bin.000001', master_log_pos=783; start slave until master_log_file='master-bin.000001', master_log_pos=776;
...@@ -1041,25 +1041,28 @@ bool Query_log_event::write(IO_CACHE* file) ...@@ -1041,25 +1041,28 @@ bool Query_log_event::write(IO_CACHE* file)
} }
if (catalog_len) // i.e. "catalog inited" (false for 4.0 events) if (catalog_len) // i.e. "catalog inited" (false for 4.0 events)
{ {
*start++= Q_CATALOG_CODE; *start++= Q_CATALOG_NZ_CODE;
*start++= (uchar) catalog_len; *start++= (uchar) catalog_len;
bmove(start, catalog, catalog_len); bmove(start, catalog, catalog_len);
start+= catalog_len; start+= catalog_len;
/* /*
We write a \0 at the end. As we also have written the length, it's In 5.0.x where x<4 masters we used to store the end zero here. This was
apparently useless; but in fact it enables us to just do a waste of one byte so we don't do it in x>=4 masters. We change code to
catalog= a_pointer_to_the_buffer_of_the_read_event Q_CATALOG_NZ_CODE, because re-using the old code would make x<4 slaves
later in the slave SQL thread. of this x>=4 master segfault (expecting a zero when there is
If we didn't have the \0, we would need to memdup to build the catalog in none). Remaining compatibility problems are: the older slave will not
the slave SQL thread. find the catalog; but it is will not crash, and it's not an issue
And still the interest of having the length too is that in the slave SQL that it does not find the catalog as catalogs were not used in these older
thread we immediately know at which position the catalog ends (no need to MySQL versions (we store it in binlog and read it from relay log but do
search for '\0'. In other words: length saves search, \0 saves mem alloc, nothing useful with it). What is an issue is that the older slave will
at the cost of 1 redundant byte on the disk. stop processing the Q_* blocks (and jumps to the db/query) as soon as it
Note that this is only a fix until we change 'catalog' to LEX_STRING sees unknown Q_CATALOG_NZ_CODE; so it will not be able to read
(then we won't need the \0). Q_AUTO_INCREMENT*, Q_CHARSET and so replication will fail silently in
various ways. Documented that you should not mix alpha/beta versions if
they are not exactly the same version, with example of 5.0.2<->5.0.3 and
5.0.3<->5.0.4. If replication is from older to new, the new won't find
the catalog and will have the same problems.
*/ */
*(start++)= '\0';
} }
if (auto_increment_increment != 1) if (auto_increment_increment != 1)
{ {
...@@ -1259,10 +1262,10 @@ Query_log_event::Query_log_event(const char* buf, uint event_len, ...@@ -1259,10 +1262,10 @@ Query_log_event::Query_log_event(const char* buf, uint event_len,
pos+= 8; pos+= 8;
break; break;
} }
case Q_CATALOG_CODE: case Q_CATALOG_NZ_CODE:
if ((catalog_len= *pos)) if ((catalog_len= *pos))
catalog= (char*) pos+1; // Will be copied later catalog= (char*) pos+1; // Will be copied later
pos+= catalog_len+2; pos+= catalog_len+1;
break; break;
case Q_AUTO_INCREMENT: case Q_AUTO_INCREMENT:
auto_increment_increment= uint2korr(pos); auto_increment_increment= uint2korr(pos);
...@@ -1297,9 +1300,10 @@ Query_log_event::Query_log_event(const char* buf, uint event_len, ...@@ -1297,9 +1300,10 @@ Query_log_event::Query_log_event(const char* buf, uint event_len,
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
if (catalog_len) // If catalog is given if (catalog_len) // If catalog is given
{ {
memcpy(start, catalog, catalog_len+1); // Copy name and end \0 memcpy(start, catalog, catalog_len);
catalog= start; catalog= start;
start+= catalog_len+1; start+= catalog_len;
*start++= 0;
} }
if (time_zone_len) if (time_zone_len)
{ {
...@@ -4006,7 +4010,9 @@ int Create_file_log_event::exec_event(struct st_relay_log_info* rli) ...@@ -4006,7 +4010,9 @@ int Create_file_log_event::exec_event(struct st_relay_log_info* rli)
strmov(p, ".info"); // strmov takes less code than memcpy strmov(p, ".info"); // strmov takes less code than memcpy
strnmov(proc_info, "Making temp file ", 17); // no end 0 strnmov(proc_info, "Making temp file ", 17); // no end 0
thd->proc_info= proc_info; thd->proc_info= proc_info;
if ((fd = my_open(fname_buf, O_WRONLY|O_CREAT|O_BINARY|O_TRUNC, my_delete(fname_buf, MYF(0)); // old copy may exist already
if ((fd= my_create(fname_buf, CREATE_MODE,
O_WRONLY | O_BINARY | O_EXCL | O_NOFOLLOW,
MYF(MY_WME))) < 0 || MYF(MY_WME))) < 0 ||
init_io_cache(&file, fd, IO_SIZE, WRITE_CACHE, (my_off_t)0, 0, init_io_cache(&file, fd, IO_SIZE, WRITE_CACHE, (my_off_t)0, 0,
MYF(MY_WME|MY_NABP))) MYF(MY_WME|MY_NABP)))
...@@ -4031,7 +4037,9 @@ int Create_file_log_event::exec_event(struct st_relay_log_info* rli) ...@@ -4031,7 +4037,9 @@ int Create_file_log_event::exec_event(struct st_relay_log_info* rli)
my_close(fd, MYF(0)); my_close(fd, MYF(0));
// fname_buf now already has .data, not .info, because we did our trick // fname_buf now already has .data, not .info, because we did our trick
if ((fd = my_open(fname_buf, O_WRONLY|O_CREAT|O_BINARY|O_TRUNC, my_delete(fname_buf, MYF(0)); // old copy may exist already
if ((fd= my_create(fname_buf, CREATE_MODE,
O_WRONLY | O_BINARY | O_EXCL | O_NOFOLLOW,
MYF(MY_WME))) < 0) MYF(MY_WME))) < 0)
{ {
slave_print_error(rli,my_errno, "Error in Create_file event: could not open file '%s'", fname_buf); slave_print_error(rli,my_errno, "Error in Create_file event: could not open file '%s'", fname_buf);
...@@ -4148,12 +4156,12 @@ void Append_block_log_event::pack_info(Protocol *protocol) ...@@ -4148,12 +4156,12 @@ void Append_block_log_event::pack_info(Protocol *protocol)
/* /*
Append_block_log_event::get_open_mode() Append_block_log_event::get_create_or_append()
*/ */
int Append_block_log_event::get_open_mode() const int Append_block_log_event::get_create_or_append() const
{ {
return O_WRONLY | O_APPEND | O_BINARY; return 0; /* append to the file, fail if not exists */
} }
/* /*
...@@ -4171,7 +4179,20 @@ int Append_block_log_event::exec_event(struct st_relay_log_info* rli) ...@@ -4171,7 +4179,20 @@ int Append_block_log_event::exec_event(struct st_relay_log_info* rli)
memcpy(p, ".data", 6); memcpy(p, ".data", 6);
strnmov(proc_info, "Making temp file ", 17); // no end 0 strnmov(proc_info, "Making temp file ", 17); // no end 0
thd->proc_info= proc_info; thd->proc_info= proc_info;
if ((fd = my_open(fname, get_open_mode(), MYF(MY_WME))) < 0) if (get_create_or_append())
{
my_delete(fname, MYF(0)); // old copy may exist already
if ((fd= my_create(fname, CREATE_MODE,
O_WRONLY | O_BINARY | O_EXCL | O_NOFOLLOW,
MYF(MY_WME))) < 0)
{
slave_print_error(rli, my_errno,
"Error in %s event: could not create file '%s'",
get_type_str(), fname);
goto err;
}
}
else if ((fd = my_open(fname, O_WRONLY|O_APPEND|O_BINARY|O_NOFOLLOW, MYF(MY_WME))) < 0)
{ {
slave_print_error(rli, my_errno, slave_print_error(rli, my_errno,
"Error in %s event: could not open file '%s'", "Error in %s event: could not open file '%s'",
...@@ -4384,7 +4405,7 @@ int Execute_load_log_event::exec_event(struct st_relay_log_info* rli) ...@@ -4384,7 +4405,7 @@ int Execute_load_log_event::exec_event(struct st_relay_log_info* rli)
Load_log_event* lev = 0; Load_log_event* lev = 0;
memcpy(p, ".info", 6); memcpy(p, ".info", 6);
if ((fd = my_open(fname, O_RDONLY|O_BINARY, MYF(MY_WME))) < 0 || if ((fd = my_open(fname, O_RDONLY|O_BINARY|O_NOFOLLOW, MYF(MY_WME))) < 0 ||
init_io_cache(&file, fd, IO_SIZE, READ_CACHE, (my_off_t)0, 0, init_io_cache(&file, fd, IO_SIZE, READ_CACHE, (my_off_t)0, 0,
MYF(MY_WME|MY_NABP))) MYF(MY_WME|MY_NABP)))
{ {
...@@ -4483,9 +4504,9 @@ Begin_load_query_log_event(const char* buf, uint len, ...@@ -4483,9 +4504,9 @@ Begin_load_query_log_event(const char* buf, uint len,
#if defined( HAVE_REPLICATION) && !defined(MYSQL_CLIENT) #if defined( HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
int Begin_load_query_log_event::get_open_mode() const int Begin_load_query_log_event::get_create_or_append() const
{ {
return O_CREAT | O_WRONLY | O_BINARY | O_TRUNC; return 1; /* create the file */
} }
#endif /* defined( HAVE_REPLICATION) && !defined(MYSQL_CLIENT) */ #endif /* defined( HAVE_REPLICATION) && !defined(MYSQL_CLIENT) */
...@@ -4662,6 +4683,11 @@ Execute_load_query_log_event::exec_event(struct st_relay_log_info* rli) ...@@ -4662,6 +4683,11 @@ Execute_load_query_log_event::exec_event(struct st_relay_log_info* rli)
/* Forging file name for deletion in same buffer */ /* Forging file name for deletion in same buffer */
*fname_end= 0; *fname_end= 0;
/*
If there was an error the slave is going to stop, leave the
file so that we can re-execute this event at START SLAVE.
*/
if (!error)
(void) my_delete(fname, MYF(MY_WME)); (void) my_delete(fname, MYF(MY_WME));
my_free(buf, MYF(MY_ALLOW_ZERO_PTR)); my_free(buf, MYF(MY_ALLOW_ZERO_PTR));
......
...@@ -234,10 +234,22 @@ struct sql_ex_info ...@@ -234,10 +234,22 @@ struct sql_ex_info
/* these are codes, not offsets; not more than 256 values (1 byte). */ /* these are codes, not offsets; not more than 256 values (1 byte). */
#define Q_FLAGS2_CODE 0 #define Q_FLAGS2_CODE 0
#define Q_SQL_MODE_CODE 1 #define Q_SQL_MODE_CODE 1
/*
Q_CATALOG_CODE is catalog with end zero stored; it is used only by MySQL
5.0.x where 0<=x<=3.
*/
#define Q_CATALOG_CODE 2 #define Q_CATALOG_CODE 2
#define Q_AUTO_INCREMENT 3 #define Q_AUTO_INCREMENT 3
#define Q_CHARSET_CODE 4 #define Q_CHARSET_CODE 4
#define Q_TIME_ZONE_CODE 5 #define Q_TIME_ZONE_CODE 5
/*
Q_CATALOG_NZ_CODE is catalog withOUT end zero stored; it is used by MySQL
5.0.x where x>=4. Saves one byte in every Query_log_event in binlog,
compared to Q_CATALOG_CODE. The reason we didn't simply re-use
Q_CATALOG_CODE is that then a 5.0.3 slave of this 5.0.x (x>=4) master would
crash (segfault etc) because it would expect a 0 when there is none.
*/
#define Q_CATALOG_NZ_CODE 6
/* Intvar event post-header */ /* Intvar event post-header */
...@@ -1367,7 +1379,7 @@ public: ...@@ -1367,7 +1379,7 @@ public:
#ifdef HAVE_REPLICATION #ifdef HAVE_REPLICATION
int exec_event(struct st_relay_log_info* rli); int exec_event(struct st_relay_log_info* rli);
void pack_info(Protocol* protocol); void pack_info(Protocol* protocol);
virtual int get_open_mode() const; virtual int get_create_or_append() const;
#endif /* HAVE_REPLICATION */ #endif /* HAVE_REPLICATION */
#else #else
void print(FILE* file, bool short_form = 0, LAST_EVENT_INFO* last_event_info= 0); void print(FILE* file, bool short_form = 0, LAST_EVENT_INFO* last_event_info= 0);
...@@ -1475,7 +1487,7 @@ public: ...@@ -1475,7 +1487,7 @@ public:
bool using_trans); bool using_trans);
#ifdef HAVE_REPLICATION #ifdef HAVE_REPLICATION
Begin_load_query_log_event(THD* thd); Begin_load_query_log_event(THD* thd);
int get_open_mode() const; int get_create_or_append() const;
#endif /* HAVE_REPLICATION */ #endif /* HAVE_REPLICATION */
#endif #endif
Begin_load_query_log_event(const char* buf, uint event_len, Begin_load_query_log_event(const char* buf, uint event_len,
......
...@@ -81,6 +81,9 @@ static int read_sep_field(THD *thd, COPY_INFO &info, TABLE_LIST *table_list, ...@@ -81,6 +81,9 @@ static int read_sep_field(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
List<Item> &set_values, READ_INFO &read_info, List<Item> &set_values, READ_INFO &read_info,
String &enclosed, ulong skip_lines, String &enclosed, ulong skip_lines,
bool ignore_check_option_errors); bool ignore_check_option_errors);
static bool write_execute_load_query_log_event(THD *thd,
bool duplicates, bool ignore,
bool transactional_table);
/* /*
...@@ -412,11 +415,17 @@ bool mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list, ...@@ -412,11 +415,17 @@ bool mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
read_info.end_io_cache(); read_info.end_io_cache();
/* If the file was not empty, wrote_create_file is true */ /* If the file was not empty, wrote_create_file is true */
if (lf_info.wrote_create_file) if (lf_info.wrote_create_file)
{
if ((info.copied || info.deleted) && !transactional_table)
write_execute_load_query_log_event(thd, handle_duplicates,
ignore, transactional_table);
else
{ {
Delete_file_log_event d(thd, db, transactional_table); Delete_file_log_event d(thd, db, transactional_table);
mysql_bin_log.write(&d); mysql_bin_log.write(&d);
} }
} }
}
#endif /*!EMBEDDED_LIBRARY*/ #endif /*!EMBEDDED_LIBRARY*/
error= -1; // Error on read error= -1; // Error on read
goto err; goto err;
...@@ -437,16 +446,8 @@ bool mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list, ...@@ -437,16 +446,8 @@ bool mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
*/ */
read_info.end_io_cache(); read_info.end_io_cache();
if (lf_info.wrote_create_file) if (lf_info.wrote_create_file)
{ write_execute_load_query_log_event(thd, handle_duplicates,
Execute_load_query_log_event e(thd, thd->query, thd->query_length, ignore, transactional_table);
(char*)thd->lex->fname_start - (char*)thd->query,
(char*)thd->lex->fname_end - (char*)thd->query,
(handle_duplicates == DUP_REPLACE) ? LOAD_DUP_REPLACE :
(ignore ? LOAD_DUP_IGNORE :
LOAD_DUP_ERROR),
transactional_table, FALSE);
mysql_bin_log.write(&e);
}
} }
#endif /*!EMBEDDED_LIBRARY*/ #endif /*!EMBEDDED_LIBRARY*/
if (transactional_table) if (transactional_table)
...@@ -462,6 +463,23 @@ err: ...@@ -462,6 +463,23 @@ err:
DBUG_RETURN(error); DBUG_RETURN(error);
} }
/* Not a very useful function; just to avoid duplication of code */
static bool write_execute_load_query_log_event(THD *thd,
bool duplicates, bool ignore,
bool transactional_table)
{
Execute_load_query_log_event
e(thd, thd->query, thd->query_length,
(char*)thd->lex->fname_start - (char*)thd->query,
(char*)thd->lex->fname_end - (char*)thd->query,
(duplicates == DUP_REPLACE) ? LOAD_DUP_REPLACE :
(ignore ? LOAD_DUP_IGNORE : LOAD_DUP_ERROR),
transactional_table, FALSE);
return mysql_bin_log.write(&e);
}
/**************************************************************************** /****************************************************************************
** Read of rows of fixed size + optional garage + optonal newline ** Read of rows of fixed size + optional garage + optonal newline
****************************************************************************/ ****************************************************************************/
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment