Commit 5a4b5869 authored by Michael Widenius's avatar Michael Widenius

Fixed issues found by QA (Elena)

- Added parameter to reset_logs() so that one can specify if new logs should be created.

mysql-test/include/setup_fake_relay_log.inc:
  There is no orphan relay log files anymore
mysql-test/mysql-test-run.pl:
  Added multi_source to test suite
mysql-test/suite/multi_source/info_logs.result:
  New test
mysql-test/suite/multi_source/info_logs.test:
  New test
mysql-test/suite/multi_source/my.cnf:
  Added log-warnings to get more information to the log files
mysql-test/suite/multi_source/relaylog_events.result:
  Added cleanup
mysql-test/suite/multi_source/relaylog_events.test:
  Added cleanup
mysql-test/suite/multi_source/reset_slave.result:
  Updated results after improved RESET SLAVE
mysql-test/suite/multi_source/simple.result:
  Updated results after improved RESET SLAVE
mysql-test/suite/multi_source/simple.test:
  Syncronize positions before show full slave status
mysql-test/suite/rpl/r/rpl_row_show_relaylog_events.result:
  Updated results after improved RESET SLAVE (we now use less relay log files)
mysql-test/suite/rpl/r/rpl_stm_mix_show_relaylog_events.result:
  Updated results after improved RESET SLAVE (we now use less relay log files)
sql/log.cc:
  Added parameter to reset_logs() so that one can specify if new logs should be created.
sql/log.h:
  Added parameter to reset_logs()
sql/rpl_mi.cc:
  Create Master_info_index::index_file_names once at init
  More DBUG_PRINT
  Give error if Master_info_index::check_duplicate_master_info fails
sql/rpl_rli.cc:
  If we do a full reset, don't create any new relay log files.
sql/share/errmsg-utf8.txt:
  Improved error message if connection exists
sql/sql_parse.cc:
  Fixed memory leak
sql/sql_repl.cc:
  check_duplicate_master_info() now generates an error
  Added parameter to reset_logs()
parent 9b03041b
...@@ -74,7 +74,6 @@ let $_fake_relay_index= $_fake_datadir/$_fake_filename.index; ...@@ -74,7 +74,6 @@ let $_fake_relay_index= $_fake_datadir/$_fake_filename.index;
let $_fake_relay_log_purge= `SELECT @@global.relay_log_purge`; let $_fake_relay_log_purge= `SELECT @@global.relay_log_purge`;
RESET SLAVE; RESET SLAVE;
let $_orphan_relay_file= query_get_value(SHOW SLAVE STATUS, Relay_Log_File, 1);
# Create relay log file. # Create relay log file.
--copy_file $fake_relay_log $_fake_relay_log --copy_file $fake_relay_log $_fake_relay_log
...@@ -103,8 +102,5 @@ let $_orphan_relay_file= query_get_value(SHOW SLAVE STATUS, Relay_Log_File, 1); ...@@ -103,8 +102,5 @@ let $_orphan_relay_file= query_get_value(SHOW SLAVE STATUS, Relay_Log_File, 1);
# Setup replication from existing relay log. # Setup replication from existing relay log.
eval CHANGE MASTER TO MASTER_HOST='dummy.localdomain', RELAY_LOG_FILE='$_fake_filename-fake.000001', RELAY_LOG_POS=4; eval CHANGE MASTER TO MASTER_HOST='dummy.localdomain', RELAY_LOG_FILE='$_fake_filename-fake.000001', RELAY_LOG_POS=4;
# remove the orphan log file (became spurious)
-- remove_file $_fake_datadir/$_orphan_relay_file
--let $include_filename= setup_fake_relay_log.inc --let $include_filename= setup_fake_relay_log.inc
--source include/end_include_file.inc --source include/end_include_file.inc
...@@ -174,6 +174,7 @@ my $DEFAULT_SUITES= join(',', map { "$_-" } qw( ...@@ -174,6 +174,7 @@ my $DEFAULT_SUITES= join(',', map { "$_-" } qw(
heap heap
innodb innodb
maria maria
multi_source
optimizer_unfixed_bugs optimizer_unfixed_bugs
oqgraph oqgraph
parts parts
......
#
# List of files matching '*info*' pattern before starting any slaves
multi-master.info
# End of list
#
# Contents of multi-master.info
# EOF
#
change master 'master1' to
master_port=MYPORT_1,
master_host='127.0.0.1',
master_user='root';
start slave 'master1';
set default_master_connection = 'master1';
include/wait_for_slave_to_start.inc
#
# List of files matching '*info*' pattern while 'master1' is running
master.info.master1
multi-master.info
relay-log.info.master1
# End of list
#
# Contents of multi-master.info
master1
# EOF
#
change master 'master2' to
master_port=MYPORT_2,
master_host='127.0.0.1',
master_user='root';
start slave 'master2';
set default_master_connection = 'master2';
include/wait_for_slave_to_start.inc
#
# List of files matching '*info*' pattern
# while 'master1' and 'master2' are running
master.info.master1
master.info.master2
multi-master.info
relay-log.info.master1
relay-log.info.master2
# End of list
#
# Contents of multi-master.info
master1
master2
# EOF
#
stop slave 'master1';
set default_master_connection = 'master1';
include/wait_for_slave_to_stop.inc
reset slave 'master1' all;
#
# List of files matching '*info*' pattern
# after 'master1' was completely reset, 'master2' still running
master.info.master2
multi-master.info
relay-log.info.master2
# End of list
#
# Contents of multi-master.info
master2
# EOF
#
set default_master_connection = '';
change master to
master_port=MYPORT_1,
master_host='127.0.0.1',
master_user='root';
start slave;
include/wait_for_slave_to_start.inc
#
# List of files matching '*info*' pattern
# while 'master2' and '' are running
master.info
master.info.master2
multi-master.info
relay-log.info
relay-log.info.master2
# End of list
#
# Contents of multi-master.info
master2
# EOF
#
show full slave status;
Connection_name 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 Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id
Waiting for master to send event 127.0.0.1 root MYPORT_1 60 master-bin.000001 286 mysqld-relay-bin.000002 572 master-bin.000001 Yes Yes 0 0 286 868 None 0 No 0 No 0 0 1
master2 Waiting for master to send event 127.0.0.1 root MYPORT_2 60 master-bin.000001 286 mysqld-relay-bin-master2.000002 572 master-bin.000001 Yes Yes 0 0 286 876 None 0 No 0 No 0 0 2
show full slave status;
Connection_name 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 Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id
Waiting for master to send event 127.0.0.1 root MYPORT_1 60 master-bin.000001 286 mysqld-relay-bin.000004 532 master-bin.000001 Yes Yes 0 0 286 828 None 0 No 0 No 0 0 1
master2 Waiting for master to send event 127.0.0.1 root MYPORT_2 60 master-bin.000001 286 mysqld-relay-bin-master2.000004 532 master-bin.000001 Yes Yes 0 0 286 836 None 0 No 0 No 0 0 2
#
# List of files matching '*info*' pattern
# after slave server restart
# while 'master2' and '' are running
master.info
master.info.master2
multi-master.info
relay-log.info
relay-log.info.master2
# End of list
#
# Contents of multi-master.info
master2
# EOF
#
stop slave;
include/wait_for_slave_to_stop.inc
set default_master_connection = 'master2';
stop slave;
include/wait_for_slave_to_stop.inc
reset slave all;
reset slave '' all;
#
# Check log files with multi-source
#
--connect (slave,127.0.0.1,root,,,$SERVER_MYPORT_3)
--let $datadir = `SELECT @@datadir`
#
# Check creation and updating of multi-source *info* logs
#
--echo #
--echo # List of files matching '*info*' pattern before starting any slaves
--list_files $datadir *info*
--echo # End of list
--echo #
--echo # Contents of multi-master.info
--cat_file $datadir/multi-master.info
--echo # EOF
--echo #
# Start replication from the first master
--replace_result $SERVER_MYPORT_1 MYPORT_1
eval change master 'master1' to
master_port=$SERVER_MYPORT_1,
master_host='127.0.0.1',
master_user='root';
start slave 'master1';
set default_master_connection = 'master1';
--source include/wait_for_slave_to_start.inc
# Check the files
--echo #
--echo # List of files matching '*info*' pattern while 'master1' is running
--list_files $datadir *info*
--echo # End of list
--echo #
--echo # Contents of multi-master.info
--cat_file $datadir/multi-master.info
--echo # EOF
--echo #
# Start replication from the second master
--replace_result $SERVER_MYPORT_2 MYPORT_2
eval change master 'master2' to
master_port=$SERVER_MYPORT_2,
master_host='127.0.0.1',
master_user='root';
start slave 'master2';
set default_master_connection = 'master2';
--source include/wait_for_slave_to_start.inc
# Check the files
--echo #
--echo # List of files matching '*info*' pattern
--echo # while 'master1' and 'master2' are running
--list_files $datadir *info*
--echo # End of list
--echo #
--echo # Contents of multi-master.info
--cat_file $datadir/multi-master.info
--echo # EOF
--echo #
# Remove master1 configuration
stop slave 'master1';
set default_master_connection = 'master1';
--source include/wait_for_slave_to_stop.inc
reset slave 'master1' all;
# Check the files
--echo #
--echo # List of files matching '*info*' pattern
--echo # after 'master1' was completely reset, 'master2' still running
--list_files $datadir *info*
--echo # End of list
--echo #
--echo # Contents of multi-master.info
--cat_file $datadir/multi-master.info
--echo # EOF
--echo #
# Start replication from the first master,
# now with the default empty name
set default_master_connection = '';
--replace_result $SERVER_MYPORT_1 MYPORT_1
eval change master to
master_port=$SERVER_MYPORT_1,
master_host='127.0.0.1',
master_user='root';
start slave;
--source include/wait_for_slave_to_start.inc
# Check the files
--echo #
--echo # List of files matching '*info*' pattern
--echo # while 'master2' and '' are running
--list_files $datadir *info*
--echo # End of list
--echo #
--echo # Contents of multi-master.info
--cat_file $datadir/multi-master.info
--echo # EOF
--echo #
--sleep 5
--replace_result $SERVER_MYPORT_1 MYPORT_1 $SERVER_MYPORT_2 MYPORT_2
show full slave status;
# Restart the slave server
--enable_reconnect
--append_file $MYSQLTEST_VARDIR/tmp/mysqld.3.expect
restart
EOF
--shutdown_server 60
--source include/wait_until_connected_again.inc
--replace_result $SERVER_MYPORT_1 MYPORT_1 $SERVER_MYPORT_2 MYPORT_2
show full slave status;
# Check the files
--echo #
--echo # List of files matching '*info*' pattern
--echo # after slave server restart
--echo # while 'master2' and '' are running
--list_files $datadir *info*
--echo # End of list
--echo #
--echo # Contents of multi-master.info
--cat_file $datadir/multi-master.info
--echo # EOF
--echo #
# Cleanup
stop slave;
--source include/wait_for_slave_to_stop.inc
set default_master_connection = 'master2';
stop slave;
--source include/wait_for_slave_to_stop.inc
reset slave all;
reset slave '' all;
--disconnect slave
...@@ -5,13 +5,16 @@ ...@@ -5,13 +5,16 @@
[mysqld.1] [mysqld.1]
server-id=1 server-id=1
log-bin=master-bin log-bin=master-bin
log-warnings=2
[mysqld.2] [mysqld.2]
server-id=2 server-id=2
log-bin=master-bin log-bin=master-bin
log-warnings=2
[mysqld.3] [mysqld.3]
server-id=3 server-id=3
log-warnings=2
[ENV] [ENV]
SERVER_MYPORT_1= @mysqld.1.port SERVER_MYPORT_1= @mysqld.1.port
......
...@@ -24,4 +24,5 @@ mysqld-relay-bin-master1.000001 246 Rotate 3 304 mysqld-relay-bin-master1.000002 ...@@ -24,4 +24,5 @@ mysqld-relay-bin-master1.000001 246 Rotate 3 304 mysqld-relay-bin-master1.000002
drop table t1; drop table t1;
stop slave; stop slave;
include/wait_for_slave_to_stop.inc include/wait_for_slave_to_stop.inc
reset slave 'master1' all;
reset master; reset master;
...@@ -42,6 +42,8 @@ drop table t1; ...@@ -42,6 +42,8 @@ drop table t1;
stop slave; stop slave;
--source include/wait_for_slave_to_stop.inc --source include/wait_for_slave_to_stop.inc
reset slave 'master1' all;
--disconnect slave --disconnect slave
--connection master1 --connection master1
......
...@@ -18,14 +18,10 @@ mysqld-relay-bin.index-master1 ...@@ -18,14 +18,10 @@ mysqld-relay-bin.index-master1
reset slave 'master1'; reset slave 'master1';
show slave 'master1' status; show slave 'master1' 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 Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id 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 Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id
127.0.0.1 root MYPORT_1 60 4 mysqld-relay-bin-master1.000001 4 No No 0 0 0 265 None 0 No NULL No 0 0 1 127.0.0.1 root MYPORT_1 60 4 1015 No No 0 0 0 1319 None 0 No NULL No 0 0 1
mysqld-relay-bin-master1.000001
mysqld-relay-bin.index-master1
reset slave 'master1' all; reset slave 'master1' all;
show slave 'master1' status; show slave 'master1' status;
ERROR HY000: There is no master connection 'master1' ERROR HY000: There is no master connection 'master1'
mysqld-relay-bin-master1.000001
mysqld-relay-bin.index-master1
drop table t1; drop table t1;
drop table t1; drop table t1;
reset master; reset master;
...@@ -56,7 +56,7 @@ Master_Server_Id 1 ...@@ -56,7 +56,7 @@ Master_Server_Id 1
reset slave 'slave1'; reset slave 'slave1';
show full slave status; show full slave status;
Connection_name 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 Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Connection_name 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 Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id
slave1 127.0.0.1 root MYPORT_1 60 4 mysqld-relay-bin-slave1.000001 4 No No 0 0 0 265 None 0 No NULL No 0 0 1 slave1 127.0.0.1 root MYPORT_1 60 4 572 No No 0 0 0 875 None 0 No NULL No 0 0 1
slave2 Waiting for master to send event 127.0.0.1 root MYPORT_2 60 master-bin.000001 286 mysqld-relay-bin-slave2.000002 572 master-bin.000001 Yes Yes 0 0 286 875 None 0 No 0 No 0 0 2 slave2 Waiting for master to send event 127.0.0.1 root MYPORT_2 60 master-bin.000001 286 mysqld-relay-bin-slave2.000002 572 master-bin.000001 Yes Yes 0 0 286 875 None 0 No 0 No 0 0 2
reset slave 'slave1' all; reset slave 'slave1' all;
show full slave status; show full slave status;
......
...@@ -3,6 +3,9 @@ ...@@ -3,6 +3,9 @@
# #
--connect (slave,127.0.0.1,root,,,$SERVER_MYPORT_3) --connect (slave,127.0.0.1,root,,,$SERVER_MYPORT_3)
--connect (master1,127.0.0.1,root,,,$SERVER_MYPORT_1)
--connect (master2,127.0.0.1,root,,,$SERVER_MYPORT_2)
--connection slave
--replace_result $SERVER_MYPORT_1 MYPORT_1 --replace_result $SERVER_MYPORT_1 MYPORT_1
eval change master 'slave1' to master_port=$SERVER_MYPORT_1, master_host='127.0.0.1', master_user='root'; eval change master 'slave1' to master_port=$SERVER_MYPORT_1, master_host='127.0.0.1', master_user='root';
...@@ -16,6 +19,16 @@ start slave 'slave2'; ...@@ -16,6 +19,16 @@ start slave 'slave2';
--source include/wait_for_slave_to_start.inc --source include/wait_for_slave_to_start.inc
set default_master_connection = ''; set default_master_connection = '';
# Ensure that all data is in the relay log
--connection master1
--save_master_pos
--connection slave
--sync_with_master 0,'slave1'
--connection master2
--save_master_pos
--connection slave
--sync_with_master 0,'slave2'
--replace_result $SERVER_MYPORT_1 MYPORT_1 $SERVER_MYPORT_2 MYPORT_2 --replace_result $SERVER_MYPORT_1 MYPORT_1 $SERVER_MYPORT_2 MYPORT_2
show full slave status; show full slave status;
......
...@@ -90,38 +90,38 @@ slave-bin.000001 # Table_map # # table_id: # (test.t1) ...@@ -90,38 +90,38 @@ slave-bin.000001 # Table_map # # table_id: # (test.t1)
slave-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F slave-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
slave-bin.000001 # Query # # COMMIT slave-bin.000001 # Query # # COMMIT
******** [slave] SHOW RELAYLOG EVENTS IN <FILE> ******** ******** [slave] SHOW RELAYLOG EVENTS IN <FILE> ********
show relaylog events in 'slave-relay-bin.000003' from <binlog_start>; show relaylog events in 'slave-relay-bin.000002' from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
slave-relay-bin.000003 # Rotate # # master-bin.000001;pos=4 slave-relay-bin.000002 # Rotate # # master-bin.000001;pos=4
slave-relay-bin.000003 # Format_desc # # SERVER_VERSION, BINLOG_VERSION slave-relay-bin.000002 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
slave-relay-bin.000003 # Binlog_checkpoint # # master-bin.000001 slave-relay-bin.000002 # Binlog_checkpoint # # master-bin.000001
slave-relay-bin.000003 # Query # # use `test`; CREATE TABLE t1 (a INT) slave-relay-bin.000002 # Query # # use `test`; CREATE TABLE t1 (a INT)
slave-relay-bin.000003 # Query # # BEGIN slave-relay-bin.000002 # Query # # BEGIN
slave-relay-bin.000003 # Table_map # # table_id: # (test.t1) slave-relay-bin.000002 # Table_map # # table_id: # (test.t1)
slave-relay-bin.000003 # Write_rows # # table_id: # flags: STMT_END_F slave-relay-bin.000002 # Write_rows # # table_id: # flags: STMT_END_F
slave-relay-bin.000003 # Query # # COMMIT slave-relay-bin.000002 # Query # # COMMIT
slave-relay-bin.000003 # Query # # BEGIN slave-relay-bin.000002 # Query # # BEGIN
slave-relay-bin.000003 # Table_map # # table_id: # (test.t1) slave-relay-bin.000002 # Table_map # # table_id: # (test.t1)
slave-relay-bin.000003 # Write_rows # # table_id: # flags: STMT_END_F slave-relay-bin.000002 # Write_rows # # table_id: # flags: STMT_END_F
slave-relay-bin.000003 # Query # # COMMIT slave-relay-bin.000002 # Query # # COMMIT
slave-relay-bin.000003 # Query # # BEGIN slave-relay-bin.000002 # Query # # BEGIN
slave-relay-bin.000003 # Table_map # # table_id: # (test.t1) slave-relay-bin.000002 # Table_map # # table_id: # (test.t1)
slave-relay-bin.000003 # Write_rows # # table_id: # flags: STMT_END_F slave-relay-bin.000002 # Write_rows # # table_id: # flags: STMT_END_F
slave-relay-bin.000003 # Query # # COMMIT slave-relay-bin.000002 # Query # # COMMIT
******** [slave] SHOW RELAYLOG EVENTS IN <FILE> LIMIT 1 ******** ******** [slave] SHOW RELAYLOG EVENTS IN <FILE> LIMIT 1 ********
show relaylog events in 'slave-relay-bin.000003' from <binlog_start> limit 1; show relaylog events in 'slave-relay-bin.000002' from <binlog_start> limit 1;
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
slave-relay-bin.000003 # Rotate # # master-bin.000001;pos=4 slave-relay-bin.000002 # Rotate # # master-bin.000001;pos=4
******** [slave] SHOW RELAYLOG EVENTS IN <FILE> LIMIT 1,3 ******** ******** [slave] SHOW RELAYLOG EVENTS IN <FILE> LIMIT 1,3 ********
show relaylog events in 'slave-relay-bin.000003' from <binlog_start> limit 1,3; show relaylog events in 'slave-relay-bin.000002' from <binlog_start> limit 1,3;
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
slave-relay-bin.000003 # Format_desc # # SERVER_VERSION, BINLOG_VERSION slave-relay-bin.000002 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
slave-relay-bin.000003 # Binlog_checkpoint # # master-bin.000001 slave-relay-bin.000002 # Binlog_checkpoint # # master-bin.000001
slave-relay-bin.000003 # Query # # use `test`; CREATE TABLE t1 (a INT) slave-relay-bin.000002 # Query # # use `test`; CREATE TABLE t1 (a INT)
******** [slave] SHOW RELAYLOG EVENTS ******** ******** [slave] SHOW RELAYLOG EVENTS ********
show relaylog events from <binlog_start>; show relaylog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
slave-relay-bin.000002 # Rotate # # slave-relay-bin.000003;pos=4 slave-relay-bin.000001 # Rotate # # slave-relay-bin.000002;pos=4
FLUSH LOGS; FLUSH LOGS;
FLUSH LOGS; FLUSH LOGS;
DROP TABLE t1; DROP TABLE t1;
...@@ -186,26 +186,26 @@ slave-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F ...@@ -186,26 +186,26 @@ slave-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
slave-bin.000001 # Query # # COMMIT slave-bin.000001 # Query # # COMMIT
slave-bin.000001 # Rotate # # slave-bin.000002;pos=4 slave-bin.000001 # Rotate # # slave-bin.000002;pos=4
******** [slave] SHOW RELAYLOG EVENTS IN <FILE> ******** ******** [slave] SHOW RELAYLOG EVENTS IN <FILE> ********
show relaylog events in 'slave-relay-bin.000006' from <binlog_start>; show relaylog events in 'slave-relay-bin.000005' from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
slave-relay-bin.000006 # Rotate # # master-bin.000002;pos=4 slave-relay-bin.000005 # Rotate # # master-bin.000002;pos=4
slave-relay-bin.000006 # Format_desc # # SERVER_VERSION, BINLOG_VERSION slave-relay-bin.000005 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
slave-relay-bin.000006 # Binlog_checkpoint # # master-bin.000001 slave-relay-bin.000005 # Binlog_checkpoint # # master-bin.000001
slave-relay-bin.000006 # Binlog_checkpoint # # master-bin.000002 slave-relay-bin.000005 # Binlog_checkpoint # # master-bin.000002
slave-relay-bin.000006 # Query # # use `test`; DROP TABLE `t1` /* generated by server */ slave-relay-bin.000005 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
******** [slave] SHOW RELAYLOG EVENTS IN <FILE> LIMIT 1 ******** ******** [slave] SHOW RELAYLOG EVENTS IN <FILE> LIMIT 1 ********
show relaylog events in 'slave-relay-bin.000006' from <binlog_start> limit 1; show relaylog events in 'slave-relay-bin.000005' from <binlog_start> limit 1;
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
slave-relay-bin.000006 # Rotate # # master-bin.000002;pos=4 slave-relay-bin.000005 # Rotate # # master-bin.000002;pos=4
******** [slave] SHOW RELAYLOG EVENTS IN <FILE> LIMIT 1,3 ******** ******** [slave] SHOW RELAYLOG EVENTS IN <FILE> LIMIT 1,3 ********
show relaylog events in 'slave-relay-bin.000006' from <binlog_start> limit 1,3; show relaylog events in 'slave-relay-bin.000005' from <binlog_start> limit 1,3;
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
slave-relay-bin.000006 # Format_desc # # SERVER_VERSION, BINLOG_VERSION slave-relay-bin.000005 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
slave-relay-bin.000006 # Binlog_checkpoint # # master-bin.000001 slave-relay-bin.000005 # Binlog_checkpoint # # master-bin.000001
slave-relay-bin.000006 # Binlog_checkpoint # # master-bin.000002 slave-relay-bin.000005 # Binlog_checkpoint # # master-bin.000002
******** [slave] SHOW RELAYLOG EVENTS ******** ******** [slave] SHOW RELAYLOG EVENTS ********
show relaylog events from <binlog_start>; show relaylog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
slave-relay-bin.000005 # Rotate # # master-bin.000002;pos=4 slave-relay-bin.000004 # Rotate # # master-bin.000002;pos=4
slave-relay-bin.000005 # Rotate # # slave-relay-bin.000006;pos=4 slave-relay-bin.000004 # Rotate # # slave-relay-bin.000005;pos=4
include/rpl_end.inc include/rpl_end.inc
...@@ -78,35 +78,35 @@ slave-bin.000001 # Query # # BEGIN ...@@ -78,35 +78,35 @@ slave-bin.000001 # Query # # BEGIN
slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (3) slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (3)
slave-bin.000001 # Query # # COMMIT slave-bin.000001 # Query # # COMMIT
******** [slave] SHOW RELAYLOG EVENTS IN <FILE> ******** ******** [slave] SHOW RELAYLOG EVENTS IN <FILE> ********
show relaylog events in 'slave-relay-bin.000003' from <binlog_start>; show relaylog events in 'slave-relay-bin.000002' from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
slave-relay-bin.000003 # Rotate # # master-bin.000001;pos=4 slave-relay-bin.000002 # Rotate # # master-bin.000001;pos=4
slave-relay-bin.000003 # Format_desc # # SERVER_VERSION, BINLOG_VERSION slave-relay-bin.000002 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
slave-relay-bin.000003 # Binlog_checkpoint # # master-bin.000001 slave-relay-bin.000002 # Binlog_checkpoint # # master-bin.000001
slave-relay-bin.000003 # Query # # use `test`; CREATE TABLE t1 (a INT) slave-relay-bin.000002 # Query # # use `test`; CREATE TABLE t1 (a INT)
slave-relay-bin.000003 # Query # # BEGIN slave-relay-bin.000002 # Query # # BEGIN
slave-relay-bin.000003 # Query # # use `test`; INSERT INTO t1 VALUES (1) slave-relay-bin.000002 # Query # # use `test`; INSERT INTO t1 VALUES (1)
slave-relay-bin.000003 # Query # # COMMIT slave-relay-bin.000002 # Query # # COMMIT
slave-relay-bin.000003 # Query # # BEGIN slave-relay-bin.000002 # Query # # BEGIN
slave-relay-bin.000003 # Query # # use `test`; INSERT INTO t1 VALUES (2) slave-relay-bin.000002 # Query # # use `test`; INSERT INTO t1 VALUES (2)
slave-relay-bin.000003 # Query # # COMMIT slave-relay-bin.000002 # Query # # COMMIT
slave-relay-bin.000003 # Query # # BEGIN slave-relay-bin.000002 # Query # # BEGIN
slave-relay-bin.000003 # Query # # use `test`; INSERT INTO t1 VALUES (3) slave-relay-bin.000002 # Query # # use `test`; INSERT INTO t1 VALUES (3)
slave-relay-bin.000003 # Query # # COMMIT slave-relay-bin.000002 # Query # # COMMIT
******** [slave] SHOW RELAYLOG EVENTS IN <FILE> LIMIT 1 ******** ******** [slave] SHOW RELAYLOG EVENTS IN <FILE> LIMIT 1 ********
show relaylog events in 'slave-relay-bin.000003' from <binlog_start> limit 1; show relaylog events in 'slave-relay-bin.000002' from <binlog_start> limit 1;
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
slave-relay-bin.000003 # Rotate # # master-bin.000001;pos=4 slave-relay-bin.000002 # Rotate # # master-bin.000001;pos=4
******** [slave] SHOW RELAYLOG EVENTS IN <FILE> LIMIT 1,3 ******** ******** [slave] SHOW RELAYLOG EVENTS IN <FILE> LIMIT 1,3 ********
show relaylog events in 'slave-relay-bin.000003' from <binlog_start> limit 1,3; show relaylog events in 'slave-relay-bin.000002' from <binlog_start> limit 1,3;
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
slave-relay-bin.000003 # Format_desc # # SERVER_VERSION, BINLOG_VERSION slave-relay-bin.000002 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
slave-relay-bin.000003 # Binlog_checkpoint # # master-bin.000001 slave-relay-bin.000002 # Binlog_checkpoint # # master-bin.000001
slave-relay-bin.000003 # Query # # use `test`; CREATE TABLE t1 (a INT) slave-relay-bin.000002 # Query # # use `test`; CREATE TABLE t1 (a INT)
******** [slave] SHOW RELAYLOG EVENTS ******** ******** [slave] SHOW RELAYLOG EVENTS ********
show relaylog events from <binlog_start>; show relaylog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
slave-relay-bin.000002 # Rotate # # slave-relay-bin.000003;pos=4 slave-relay-bin.000001 # Rotate # # slave-relay-bin.000002;pos=4
FLUSH LOGS; FLUSH LOGS;
FLUSH LOGS; FLUSH LOGS;
DROP TABLE t1; DROP TABLE t1;
...@@ -165,26 +165,26 @@ slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (3) ...@@ -165,26 +165,26 @@ slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (3)
slave-bin.000001 # Query # # COMMIT slave-bin.000001 # Query # # COMMIT
slave-bin.000001 # Rotate # # slave-bin.000002;pos=4 slave-bin.000001 # Rotate # # slave-bin.000002;pos=4
******** [slave] SHOW RELAYLOG EVENTS IN <FILE> ******** ******** [slave] SHOW RELAYLOG EVENTS IN <FILE> ********
show relaylog events in 'slave-relay-bin.000006' from <binlog_start>; show relaylog events in 'slave-relay-bin.000005' from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
slave-relay-bin.000006 # Rotate # # master-bin.000002;pos=4 slave-relay-bin.000005 # Rotate # # master-bin.000002;pos=4
slave-relay-bin.000006 # Format_desc # # SERVER_VERSION, BINLOG_VERSION slave-relay-bin.000005 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
slave-relay-bin.000006 # Binlog_checkpoint # # master-bin.000001 slave-relay-bin.000005 # Binlog_checkpoint # # master-bin.000001
slave-relay-bin.000006 # Binlog_checkpoint # # master-bin.000002 slave-relay-bin.000005 # Binlog_checkpoint # # master-bin.000002
slave-relay-bin.000006 # Query # # use `test`; DROP TABLE `t1` /* generated by server */ slave-relay-bin.000005 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
******** [slave] SHOW RELAYLOG EVENTS IN <FILE> LIMIT 1 ******** ******** [slave] SHOW RELAYLOG EVENTS IN <FILE> LIMIT 1 ********
show relaylog events in 'slave-relay-bin.000006' from <binlog_start> limit 1; show relaylog events in 'slave-relay-bin.000005' from <binlog_start> limit 1;
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
slave-relay-bin.000006 # Rotate # # master-bin.000002;pos=4 slave-relay-bin.000005 # Rotate # # master-bin.000002;pos=4
******** [slave] SHOW RELAYLOG EVENTS IN <FILE> LIMIT 1,3 ******** ******** [slave] SHOW RELAYLOG EVENTS IN <FILE> LIMIT 1,3 ********
show relaylog events in 'slave-relay-bin.000006' from <binlog_start> limit 1,3; show relaylog events in 'slave-relay-bin.000005' from <binlog_start> limit 1,3;
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
slave-relay-bin.000006 # Format_desc # # SERVER_VERSION, BINLOG_VERSION slave-relay-bin.000005 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
slave-relay-bin.000006 # Binlog_checkpoint # # master-bin.000001 slave-relay-bin.000005 # Binlog_checkpoint # # master-bin.000001
slave-relay-bin.000006 # Binlog_checkpoint # # master-bin.000002 slave-relay-bin.000005 # Binlog_checkpoint # # master-bin.000002
******** [slave] SHOW RELAYLOG EVENTS ******** ******** [slave] SHOW RELAYLOG EVENTS ********
show relaylog events from <binlog_start>; show relaylog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
slave-relay-bin.000005 # Rotate # # master-bin.000002;pos=4 slave-relay-bin.000004 # Rotate # # master-bin.000002;pos=4
slave-relay-bin.000005 # Rotate # # slave-relay-bin.000006;pos=4 slave-relay-bin.000004 # Rotate # # slave-relay-bin.000005;pos=4
include/rpl_end.inc include/rpl_end.inc
...@@ -3598,11 +3598,11 @@ int MYSQL_BIN_LOG::find_next_log(LOG_INFO* linfo, bool need_lock) ...@@ -3598,11 +3598,11 @@ int MYSQL_BIN_LOG::find_next_log(LOG_INFO* linfo, bool need_lock)
/** /**
Delete all logs refered to in the index file. Delete all logs refered to in the index file.
Start writing to a new log file.
The new index file will only contain this file. The new index file will only contain this file.
@param thd Thread @param thd Thread
@param create_new_log 1 if we should start writing to a new log file
@note @note
If not called from slave thread, write start event to new log If not called from slave thread, write start event to new log
...@@ -3613,7 +3613,7 @@ int MYSQL_BIN_LOG::find_next_log(LOG_INFO* linfo, bool need_lock) ...@@ -3613,7 +3613,7 @@ int MYSQL_BIN_LOG::find_next_log(LOG_INFO* linfo, bool need_lock)
1 error 1 error
*/ */
bool MYSQL_BIN_LOG::reset_logs(THD* thd) bool MYSQL_BIN_LOG::reset_logs(THD* thd, bool create_new_log)
{ {
LOG_INFO linfo; LOG_INFO linfo;
bool error=0; bool error=0;
...@@ -3780,7 +3780,7 @@ bool MYSQL_BIN_LOG::reset_logs(THD* thd) ...@@ -3780,7 +3780,7 @@ bool MYSQL_BIN_LOG::reset_logs(THD* thd)
goto err; goto err;
} }
} }
if (!open_index_file(index_file_name, 0, FALSE)) if (create_new_log && !open_index_file(index_file_name, 0, FALSE))
if ((error= open(save_name, log_type, 0, io_cache_type, max_size, 0, FALSE))) if ((error= open(save_name, log_type, 0, io_cache_type, max_size, 0, FALSE)))
goto err; goto err;
my_free((void *) save_name); my_free((void *) save_name);
......
...@@ -748,7 +748,7 @@ class MYSQL_BIN_LOG: public TC_LOG, private MYSQL_LOG ...@@ -748,7 +748,7 @@ class MYSQL_BIN_LOG: public TC_LOG, private MYSQL_LOG
int register_create_index_entry(const char* entry); int register_create_index_entry(const char* entry);
int purge_index_entry(THD *thd, ulonglong *decrease_log_space, int purge_index_entry(THD *thd, ulonglong *decrease_log_space,
bool need_mutex); bool need_mutex);
bool reset_logs(THD* thd); bool reset_logs(THD* thd, bool create_new_log);
void close(uint exiting); void close(uint exiting);
void clear_inuse_flag_when_closing(File file); void clear_inuse_flag_when_closing(File file);
......
...@@ -657,7 +657,20 @@ void create_signed_file_name(char *res_file_name, uint length, ...@@ -657,7 +657,20 @@ void create_signed_file_name(char *res_file_name, uint length,
Master_info_index::Master_info_index() Master_info_index::Master_info_index()
{ {
index_file_name[0] = 0; size_t filename_length, dir_length;
/*
Create the Master_info index file by prepending 'multi-' before
the master_info_file file name.
*/
fn_format(index_file_name, master_info_file, mysql_data_home,
"", MY_UNPACK_FILENAME);
filename_length= strlen(index_file_name) + 1; /* Count 0 byte */
dir_length= dirname_length(index_file_name);
bmove_upp((uchar*) index_file_name + filename_length + 6,
(uchar*) index_file_name + filename_length,
filename_length - dir_length);
memcpy(index_file_name + dir_length, "multi-", 6);
bzero((char*) &index_file, sizeof(index_file)); bzero((char*) &index_file, sizeof(index_file));
} }
...@@ -684,22 +697,8 @@ bool Master_info_index::init_all_master_info() ...@@ -684,22 +697,8 @@ bool Master_info_index::init_all_master_info()
int err_num= 0, succ_num= 0; // The number of success read Master_info int err_num= 0, succ_num= 0; // The number of success read Master_info
char sign[MAX_CONNECTION_NAME]; char sign[MAX_CONNECTION_NAME];
File index_file_nr; File index_file_nr;
size_t filename_length, dir_length;
DBUG_ENTER("init_all_master_info"); DBUG_ENTER("init_all_master_info");
/*
Create the Master_info index file by prepending 'multi-' before
the master_info_file file name.
*/
fn_format(index_file_name, master_info_file, mysql_data_home,
"", MY_UNPACK_FILENAME);
filename_length= strlen(index_file_name) + 1; /* Count 0 byte */
dir_length= dirname_length(index_file_name);
bmove_upp((uchar*) index_file_name + filename_length + 6,
(uchar*) index_file_name + filename_length,
filename_length - dir_length);
memcpy(index_file_name + dir_length, "multi-", 6);
if ((index_file_nr= my_open(index_file_name, if ((index_file_nr= my_open(index_file_name,
O_RDWR | O_CREAT | O_BINARY , O_RDWR | O_CREAT | O_BINARY ,
MYF(MY_WME | ME_NOREFRESH))) < 0 || MYF(MY_WME | ME_NOREFRESH))) < 0 ||
...@@ -891,6 +890,10 @@ Master_info_index::get_master_info(LEX_STRING *connection_name, ...@@ -891,6 +890,10 @@ Master_info_index::get_master_info(LEX_STRING *connection_name,
Master_info *mi; Master_info *mi;
char buff[MAX_CONNECTION_NAME+1], *res; char buff[MAX_CONNECTION_NAME+1], *res;
uint buff_length; uint buff_length;
DBUG_ENTER("get_master_info");
DBUG_PRINT("enter",
("connection_name: '%.*s'", (int) connection_name->length,
connection_name->str));
/* Make name lower case for comparison */ /* Make name lower case for comparison */
res= strmake(buff, connection_name->str, connection_name->length); res= strmake(buff, connection_name->str, connection_name->length);
...@@ -907,7 +910,7 @@ Master_info_index::get_master_info(LEX_STRING *connection_name, ...@@ -907,7 +910,7 @@ Master_info_index::get_master_info(LEX_STRING *connection_name,
(int) connection_name->length, (int) connection_name->length,
connection_name->str); connection_name->str);
} }
return mi; DBUG_RETURN(mi);
} }
...@@ -917,6 +920,7 @@ bool Master_info_index::check_duplicate_master_info(LEX_STRING *name_arg, ...@@ -917,6 +920,7 @@ bool Master_info_index::check_duplicate_master_info(LEX_STRING *name_arg,
uint port) uint port)
{ {
Master_info *mi; Master_info *mi;
DBUG_ENTER("check_duplicate_master_info");
/* Get full host and port name */ /* Get full host and port name */
if ((mi= master_info_index->get_master_info(name_arg, if ((mi= master_info_index->get_master_info(name_arg,
...@@ -928,7 +932,7 @@ bool Master_info_index::check_duplicate_master_info(LEX_STRING *name_arg, ...@@ -928,7 +932,7 @@ bool Master_info_index::check_duplicate_master_info(LEX_STRING *name_arg,
port= mi->port; port= mi->port;
} }
if (!host || !port) if (!host || !port)
return FALSE; // Not comparable yet DBUG_RETURN(FALSE); // Not comparable yet
for (uint i= 0; i < master_info_hash.records; ++i) for (uint i= 0; i < master_info_hash.records; ++i)
{ {
...@@ -938,13 +942,15 @@ bool Master_info_index::check_duplicate_master_info(LEX_STRING *name_arg, ...@@ -938,13 +942,15 @@ bool Master_info_index::check_duplicate_master_info(LEX_STRING *name_arg,
continue; // Current connection continue; // Current connection
if (!strcasecmp(host, tmp_mi->host) && port == tmp_mi->port) if (!strcasecmp(host, tmp_mi->host) && port == tmp_mi->port)
{ {
sql_print_error(ER(ER_CONNECTION_ALREADY_EXISTS), my_error(ER_CONNECTION_ALREADY_EXISTS, MYF(0),
(int) name_arg->length,
name_arg->str,
(int) tmp_mi->connection_name.length, (int) tmp_mi->connection_name.length,
tmp_mi->connection_name.str); tmp_mi->connection_name.str);
return TRUE; DBUG_RETURN(TRUE);
} }
} }
return FALSE; DBUG_RETURN(FALSE);
} }
...@@ -994,9 +1000,6 @@ bool Master_info_index::remove_master_info(LEX_STRING *name) ...@@ -994,9 +1000,6 @@ bool Master_info_index::remove_master_info(LEX_STRING *name)
my_close(index_file.file, MYF(MY_WME)); my_close(index_file.file, MYF(MY_WME));
// Reopen File and truncate it // Reopen File and truncate it
fn_format(index_file_name, master_info_file, mysql_data_home,
".index", MY_UNPACK_FILENAME | MY_APPEND_EXT);
if ((index_file_nr= my_open(index_file_name, if ((index_file_nr= my_open(index_file_name,
O_RDWR | O_CREAT | O_TRUNC | O_BINARY , O_RDWR | O_CREAT | O_TRUNC | O_BINARY ,
MYF(MY_WME))) < 0 || MYF(MY_WME))) < 0 ||
......
...@@ -1015,28 +1015,37 @@ int purge_relay_logs(Relay_log_info* rli, THD *thd, bool just_reset, ...@@ -1015,28 +1015,37 @@ int purge_relay_logs(Relay_log_info* rli, THD *thd, bool just_reset,
rli->cur_log_fd= -1; rli->cur_log_fd= -1;
} }
if (rli->relay_log.reset_logs(thd)) if (rli->relay_log.reset_logs(thd, !just_reset))
{ {
*errmsg = "Failed during log reset"; *errmsg = "Failed during log reset";
error=1; error=1;
goto err; goto err;
} }
if (!just_reset)
{
/* Save name of used relay log file */ /* Save name of used relay log file */
strmake(rli->group_relay_log_name, rli->relay_log.get_log_fname(), strmake(rli->group_relay_log_name, rli->relay_log.get_log_fname(),
sizeof(rli->group_relay_log_name)-1); sizeof(rli->group_relay_log_name)-1);
strmake(rli->event_relay_log_name, rli->relay_log.get_log_fname(), strmake(rli->event_relay_log_name, rli->relay_log.get_log_fname(),
sizeof(rli->event_relay_log_name)-1); sizeof(rli->event_relay_log_name)-1);
rli->group_relay_log_pos= rli->event_relay_log_pos= BIN_LOG_HEADER_SIZE; rli->group_relay_log_pos= rli->event_relay_log_pos= BIN_LOG_HEADER_SIZE;
rli->log_space_total= 0;
if (count_relay_log_space(rli)) if (count_relay_log_space(rli))
{ {
*errmsg= "Error counting relay log space"; *errmsg= "Error counting relay log space";
error=1; error=1;
goto err; goto err;
} }
if (!just_reset)
error= init_relay_log_pos(rli, rli->group_relay_log_name, error= init_relay_log_pos(rli, rli->group_relay_log_name,
rli->group_relay_log_pos, rli->group_relay_log_pos,
0 /* do not need data lock */, errmsg, 0); 0 /* do not need data lock */, errmsg, 0);
}
else
{
/* Ensure relay log names are not used */
rli->group_relay_log_name[0]= rli->event_relay_log_name[0]= 0;
}
err: err:
#ifndef DBUG_OFF #ifndef DBUG_OFF
......
...@@ -6589,7 +6589,6 @@ ER_NO_SUCH_TABLE_IN_ENGINE 42S02 ...@@ -6589,7 +6589,6 @@ ER_NO_SUCH_TABLE_IN_ENGINE 42S02
eng "Table '%-.192s.%-.192s' doesn't exist in engine" eng "Table '%-.192s.%-.192s' doesn't exist in engine"
swe "Det finns ingen tabell som heter '%-.192s.%-.192s' i handlern" swe "Det finns ingen tabell som heter '%-.192s.%-.192s' i handlern"
ER_CONNECTION_ALREADY_EXISTS ER_CONNECTION_ALREADY_EXISTS
eng "Connection '%.*s' already exists" eng "Connection '%.*s' conflicts with existing connection '%.*s'"
ER_MASTER_LOG_PREFIX ER_MASTER_LOG_PREFIX
eng "Master '%.*s': " eng "Master '%.*s': "
...@@ -2377,6 +2377,7 @@ case SQLCOM_PREPARE: ...@@ -2377,6 +2377,7 @@ case SQLCOM_PREPARE:
work. work.
*/ */
master_info_index->remove_master_info(&lex_mi->connection_name); master_info_index->remove_master_info(&lex_mi->connection_name);
delete mi;
} }
mysql_mutex_unlock(&LOCK_active_mi); mysql_mutex_unlock(&LOCK_active_mi);
......
...@@ -1682,12 +1682,7 @@ bool change_master(THD* thd, Master_info* mi) ...@@ -1682,12 +1682,7 @@ bool change_master(THD* thd, Master_info* mi)
if (master_info_index->check_duplicate_master_info(&lex_mi->connection_name, if (master_info_index->check_duplicate_master_info(&lex_mi->connection_name,
lex_mi->host, lex_mi->host,
lex_mi->port)) lex_mi->port))
{
my_error(ER_MASTER_INFO, MYF(0),
(int) lex_mi->connection_name.length,
lex_mi->connection_name.str);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
}
lock_slave_threads(mi); lock_slave_threads(mi);
init_thread_mask(&thread_mask,mi,0 /*not inverse*/); init_thread_mask(&thread_mask,mi,0 /*not inverse*/);
...@@ -1996,7 +1991,7 @@ int reset_master(THD* thd) ...@@ -1996,7 +1991,7 @@ int reset_master(THD* thd)
return 1; return 1;
} }
if (mysql_bin_log.reset_logs(thd)) if (mysql_bin_log.reset_logs(thd, 1))
return 1; return 1;
RUN_HOOK(binlog_transmit, after_reset_master, (thd, 0 /* flags */)); RUN_HOOK(binlog_transmit, after_reset_master, (thd, 0 /* flags */));
return 0; return 0;
......
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