diff options
49 files changed, 530 insertions, 467 deletions
diff --git a/include/mysql/plugin.h b/include/mysql/plugin.h index b73f2d75193..b8e90f764bd 100644 --- a/include/mysql/plugin.h +++ b/include/mysql/plugin.h @@ -167,7 +167,7 @@ enum enum_mysql_show_type SHOW_UNDEF, SHOW_BOOL, SHOW_UINT, SHOW_ULONG, SHOW_ULONGLONG, SHOW_CHAR, SHOW_CHAR_PTR, SHOW_ARRAY, SHOW_FUNC, SHOW_DOUBLE, - SHOW_SINT, SHOW_SLONG, SHOW_SLONGLONG, + SHOW_SINT, SHOW_SLONG, SHOW_SLONGLONG, SHOW_SIMPLE_FUNC, SHOW_always_last }; diff --git a/include/mysql/plugin_audit.h.pp b/include/mysql/plugin_audit.h.pp index b987f690592..dea2446ac9c 100644 --- a/include/mysql/plugin_audit.h.pp +++ b/include/mysql/plugin_audit.h.pp @@ -94,7 +94,7 @@ enum enum_mysql_show_type SHOW_UNDEF, SHOW_BOOL, SHOW_UINT, SHOW_ULONG, SHOW_ULONGLONG, SHOW_CHAR, SHOW_CHAR_PTR, SHOW_ARRAY, SHOW_FUNC, SHOW_DOUBLE, - SHOW_SINT, SHOW_SLONG, SHOW_SLONGLONG, + SHOW_SINT, SHOW_SLONG, SHOW_SLONGLONG, SHOW_SIMPLE_FUNC, SHOW_always_last }; struct st_mysql_show_var { diff --git a/include/mysql/plugin_auth.h.pp b/include/mysql/plugin_auth.h.pp index 113aaf62d19..f1213a73bc6 100644 --- a/include/mysql/plugin_auth.h.pp +++ b/include/mysql/plugin_auth.h.pp @@ -94,7 +94,7 @@ enum enum_mysql_show_type SHOW_UNDEF, SHOW_BOOL, SHOW_UINT, SHOW_ULONG, SHOW_ULONGLONG, SHOW_CHAR, SHOW_CHAR_PTR, SHOW_ARRAY, SHOW_FUNC, SHOW_DOUBLE, - SHOW_SINT, SHOW_SLONG, SHOW_SLONGLONG, + SHOW_SINT, SHOW_SLONG, SHOW_SLONGLONG, SHOW_SIMPLE_FUNC, SHOW_always_last }; struct st_mysql_show_var { diff --git a/include/mysql/plugin_ftparser.h.pp b/include/mysql/plugin_ftparser.h.pp index 6011e7f7519..74b298098dd 100644 --- a/include/mysql/plugin_ftparser.h.pp +++ b/include/mysql/plugin_ftparser.h.pp @@ -94,7 +94,7 @@ enum enum_mysql_show_type SHOW_UNDEF, SHOW_BOOL, SHOW_UINT, SHOW_ULONG, SHOW_ULONGLONG, SHOW_CHAR, SHOW_CHAR_PTR, SHOW_ARRAY, SHOW_FUNC, SHOW_DOUBLE, - SHOW_SINT, SHOW_SLONG, SHOW_SLONGLONG, + SHOW_SINT, SHOW_SLONG, SHOW_SLONGLONG, SHOW_SIMPLE_FUNC, SHOW_always_last }; struct st_mysql_show_var { diff --git a/mysql-test/suite/multi_source/info_logs.result b/mysql-test/suite/multi_source/info_logs.result index 1da44992ec6..2d4c52b936d 100644 --- a/mysql-test/suite/multi_source/info_logs.result +++ b/mysql-test/suite/multi_source/info_logs.result @@ -83,14 +83,14 @@ relay.bin.info MASTER 2.2 # 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 relay.000002 572 master-bin.000001 Yes Yes 0 0 286 857 None 0 No 0 No 0 0 1 -MASTER 2.2 Waiting for master to send event 127.0.0.1 root MYPORT_2 60 master-bin.000001 286 relay-master@00202@002e2.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 relay.000004 532 master-bin.000001 Yes Yes 0 0 286 817 None 0 No 0 No 0 0 1 -MASTER 2.2 Waiting for master to send event 127.0.0.1 root MYPORT_2 60 master-bin.000001 286 relay-master@00202@002e2.000004 532 master-bin.000001 Yes Yes 0 0 286 836 None 0 No 0 No 0 0 2 +show all slaves status; +Connection_name Slave_SQL_State 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 Retried_transactions Max_relay_log_size Executed_log_entries + Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_1 60 master-bin.000001 286 relay.000002 572 master-bin.000001 Yes Yes 0 0 286 857 None 0 No 0 No 0 0 1 0 1073741824 6 +MASTER 2.2 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_2 60 master-bin.000001 286 relay-master@00202@002e2.000002 572 master-bin.000001 Yes Yes 0 0 286 876 None 0 No 0 No 0 0 2 0 1073741824 6 +show all slaves status; +Connection_name Slave_SQL_State 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 Retried_transactions Max_relay_log_size Executed_log_entries + Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_1 60 master-bin.000001 286 relay.000004 532 master-bin.000001 Yes Yes 0 0 286 817 None 0 No 0 No 0 0 1 0 1073741824 6 +MASTER 2.2 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_2 60 master-bin.000001 286 relay-master@00202@002e2.000004 532 master-bin.000001 Yes Yes 0 0 286 836 None 0 No 0 No 0 0 2 0 1073741824 6 # # List of files matching '*info*' pattern # after slave server restart diff --git a/mysql-test/suite/multi_source/info_logs.test b/mysql-test/suite/multi_source/info_logs.test index f06880faca6..6314a94434c 100644 --- a/mysql-test/suite/multi_source/info_logs.test +++ b/mysql-test/suite/multi_source/info_logs.test @@ -117,7 +117,7 @@ start slave; --sleep 5 --replace_result $SERVER_MYPORT_1 MYPORT_1 $SERVER_MYPORT_2 MYPORT_2 -show full slave status; +show all slaves status; # Restart the slave server @@ -129,7 +129,7 @@ EOF --source include/wait_until_connected_again.inc --replace_result $SERVER_MYPORT_1 MYPORT_1 $SERVER_MYPORT_2 MYPORT_2 -show full slave status; +show all slaves status; # Check the files diff --git a/mysql-test/suite/multi_source/simple.result b/mysql-test/suite/multi_source/simple.result index 003622a1b46..302db59c4e4 100644 --- a/mysql-test/suite/multi_source/simple.result +++ b/mysql-test/suite/multi_source/simple.result @@ -4,13 +4,16 @@ start slave 'slave1'; set default_master_connection = 'slave1'; include/wait_for_slave_to_start.inc set default_master_connection = 'slave2'; -start slave 'slave2'; +start all slaves; +Warnings: +Note 1936 SLAVE 'slave2' started include/wait_for_slave_to_start.inc set default_master_connection = ''; -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 -slave1 Waiting for master to send event 127.0.0.1 root MYPORT_1 60 master-bin.000001 286 mysqld-relay-bin-slave1.000002 572 master-bin.000001 Yes Yes 0 0 286 875 None 0 No 0 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 +show all slaves status; +Connection_name Slave_SQL_State 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 Retried_transactions Max_relay_log_size Executed_log_entries +slave1 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_1 60 master-bin.000001 286 mysqld-relay-bin-slave1.000002 572 master-bin.000001 Yes Yes 0 0 286 875 None 0 No 0 No 0 0 1 0 1073741824 6 +slave2 Slave has read all relay log; waiting for the slave I/O thread to update it 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 0 1073741824 6 +start all slaves; stop slave 'slave1'; show slave 'slave1' status; Slave_IO_State @@ -54,16 +57,19 @@ Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id 1 reset slave 'slave1'; -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 -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 +show all slaves status; +Connection_name Slave_SQL_State 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 Retried_transactions Max_relay_log_size Executed_log_entries +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 0 1073741824 6 +slave2 Slave has read all relay log; waiting for the slave I/O thread to update it 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 0 1073741824 6 reset slave 'slave1' all; -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 -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 -stop slave 'slave2'; -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 -slave2 127.0.0.1 root MYPORT_2 60 master-bin.000001 286 mysqld-relay-bin-slave2.000002 572 master-bin.000001 No No 0 0 286 875 None 0 No NULL No 0 0 2 +show all slaves status; +Connection_name Slave_SQL_State 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 Retried_transactions Max_relay_log_size Executed_log_entries +slave2 Slave has read all relay log; waiting for the slave I/O thread to update it 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 0 1073741824 6 +stop all slaves; +Warnings: +Note 1937 SLAVE 'slave2' stopped +show all slaves status; +Connection_name Slave_SQL_State 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 Retried_transactions Max_relay_log_size Executed_log_entries +slave2 127.0.0.1 root MYPORT_2 60 master-bin.000001 286 mysqld-relay-bin-slave2.000002 572 master-bin.000001 No No 0 0 286 875 None 0 No NULL No 0 0 2 0 1073741824 6 +stop all slaves; reset slave 'slave2' all; diff --git a/mysql-test/suite/multi_source/simple.test b/mysql-test/suite/multi_source/simple.test index 2b4f06aa1fe..4b13623785a 100644 --- a/mysql-test/suite/multi_source/simple.test +++ b/mysql-test/suite/multi_source/simple.test @@ -15,7 +15,8 @@ start slave 'slave1'; set default_master_connection = 'slave1'; --source include/wait_for_slave_to_start.inc set default_master_connection = 'slave2'; -start slave 'slave2'; +start all slaves; + --source include/wait_for_slave_to_start.inc set default_master_connection = ''; @@ -30,7 +31,10 @@ set default_master_connection = ''; --sync_with_master 0,'slave2' --replace_result $SERVER_MYPORT_1 MYPORT_1 $SERVER_MYPORT_2 MYPORT_2 -show full slave status; +show all slaves status; + +# Ensure that start all slaves doesn't do anything as all slaves are started +start all slaves; stop slave 'slave1'; @@ -39,15 +43,18 @@ query_vertical show slave 'slave1' status; reset slave 'slave1'; --replace_result $SERVER_MYPORT_1 MYPORT_1 $SERVER_MYPORT_2 MYPORT_2 -show full slave status; +show all slaves status; reset slave 'slave1' all; --replace_result $SERVER_MYPORT_1 MYPORT_1 $SERVER_MYPORT_2 MYPORT_2 -show full slave status; +show all slaves status; -stop slave 'slave2'; +stop all slaves; --replace_result $SERVER_MYPORT_1 MYPORT_1 $SERVER_MYPORT_2 MYPORT_2 -show full slave status; +show all slaves status; + +# Ensure that start all slaves doesn't do anything as all slaves are stopped +stop all slaves; # # clean up diff --git a/mysql-test/suite/multi_source/syntax.result b/mysql-test/suite/multi_source/syntax.result index 23ea4d9fd3d..28003c99040 100644 --- a/mysql-test/suite/multi_source/syntax.result +++ b/mysql-test/suite/multi_source/syntax.result @@ -4,8 +4,8 @@ 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 Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id 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 Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id -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 +show all slaves status; +Connection_name Slave_SQL_State 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 Retried_transactions Max_relay_log_size Executed_log_entries # # Check error handling # @@ -82,8 +82,6 @@ Slave_running ON set @@default_master_connection='qqq'; show status like "Slave_running"; Variable_name Value -Slave_running OFF -Warnings: -Warning 1617 There is no master connection 'qqq' +Slave_running set @@default_master_connection=''; include/rpl_end.inc diff --git a/mysql-test/suite/multi_source/syntax.test b/mysql-test/suite/multi_source/syntax.test index af793fe6100..15e862ab607 100644 --- a/mysql-test/suite/multi_source/syntax.test +++ b/mysql-test/suite/multi_source/syntax.test @@ -5,7 +5,7 @@ source include/master-slave.inc; show slave status; show slave '' status; -show full slave status; +show all slaves status; --echo # --echo # Check error handling diff --git a/mysql-test/suite/rpl/r/rpl_deadlock_innodb.result b/mysql-test/suite/rpl/r/rpl_deadlock_innodb.result index 37d209bbcf6..f2128f8d855 100644 --- a/mysql-test/suite/rpl/r/rpl_deadlock_innodb.result +++ b/mysql-test/suite/rpl/r/rpl_deadlock_innodb.result @@ -76,6 +76,8 @@ include/check_slave_is_running.inc *** Test lock wait timeout and purged relay logs *** SET @my_max_relay_log_size= @@global.max_relay_log_size; SET global max_relay_log_size=0; +Warnings: +Warning 1292 Truncated incorrect max_relay_log_size value: '0' include/stop_slave.inc DELETE FROM t2; CHANGE MASTER TO MASTER_LOG_POS=<master_pos_begin>; diff --git a/mysql-test/suite/rpl/r/rpl_filter_dbs_dynamic.result b/mysql-test/suite/rpl/r/rpl_filter_dbs_dynamic.result index 321b8d912e6..eaa2ed9a61d 100644 --- a/mysql-test/suite/rpl/r/rpl_filter_dbs_dynamic.result +++ b/mysql-test/suite/rpl/r/rpl_filter_dbs_dynamic.result @@ -1,9 +1,9 @@ include/master-slave.inc [connection master] SET @@GLOBAL.replicate_do_db="db1"; -ERROR HY000: This operation cannot be performed with a running slave; run STOP SLAVE first +ERROR HY000: This operation cannot be performed as you have a running slave ''; run STOP SLAVE '' first SET @@GLOBAL.replicate_ignore_db="db2"; -ERROR HY000: This operation cannot be performed with a running slave; run STOP SLAVE first +ERROR HY000: This operation cannot be performed as you have a running slave ''; run STOP SLAVE '' first include/stop_slave.inc SET @@GLOBAL.replicate_do_db="db1"; SET @@GLOBAL.replicate_ignore_db="db2"; diff --git a/mysql-test/suite/rpl/r/rpl_filter_tables_dynamic.result b/mysql-test/suite/rpl/r/rpl_filter_tables_dynamic.result index 9eb803d17ea..3d03d36828a 100644 --- a/mysql-test/suite/rpl/r/rpl_filter_tables_dynamic.result +++ b/mysql-test/suite/rpl/r/rpl_filter_tables_dynamic.result @@ -1,9 +1,9 @@ include/master-slave.inc [connection master] SET @@GLOBAL.replicate_do_table="test.t1,test.t2,test.t3"; -ERROR HY000: This operation cannot be performed with a running slave; run STOP SLAVE first +ERROR HY000: This operation cannot be performed as you have a running slave ''; run STOP SLAVE '' first SET @@GLOBAL.replicate_ignore_table="test.t4,test.t5,test.t6"; -ERROR HY000: This operation cannot be performed with a running slave; run STOP SLAVE first +ERROR HY000: This operation cannot be performed as you have a running slave ''; run STOP SLAVE '' first include/stop_slave.inc SET @@GLOBAL.replicate_do_table="test.t1,test.t2,test.t3"; SET @@GLOBAL.replicate_ignore_table="test.t4,test.t5,test.t6"; diff --git a/mysql-test/suite/rpl/r/rpl_filter_wild_tables_dynamic.result b/mysql-test/suite/rpl/r/rpl_filter_wild_tables_dynamic.result index 6858181234e..19d8e513e6f 100644 --- a/mysql-test/suite/rpl/r/rpl_filter_wild_tables_dynamic.result +++ b/mysql-test/suite/rpl/r/rpl_filter_wild_tables_dynamic.result @@ -1,9 +1,9 @@ include/master-slave.inc [connection master] SET @@GLOBAL.replicate_wild_do_table="test.a%"; -ERROR HY000: This operation cannot be performed with a running slave; run STOP SLAVE first +ERROR HY000: This operation cannot be performed as you have a running slave ''; run STOP SLAVE '' first SET @@GLOBAL.replicate_wild_ignore_table="test.b%"; -ERROR HY000: This operation cannot be performed with a running slave; run STOP SLAVE first +ERROR HY000: This operation cannot be performed as you have a running slave ''; run STOP SLAVE '' first include/stop_slave.inc SET @@GLOBAL.replicate_wild_do_table="test.a%"; SET @@GLOBAL.replicate_wild_ignore_table="test.b%"; diff --git a/mysql-test/suite/rpl/r/rpl_flush_logs.result b/mysql-test/suite/rpl/r/rpl_flush_logs.result index 4fce91a7234..1f543cd9f43 100644 --- a/mysql-test/suite/rpl/r/rpl_flush_logs.result +++ b/mysql-test/suite/rpl/r/rpl_flush_logs.result @@ -8,7 +8,7 @@ flush error logs; # after execute 'flush error logs' statement. # Test if support 'flush relay logs' statement. flush relay logs; -# Check the 'slave-relay-bin.000003' file is created +# Check the 'slave-relay-bin.000003' file is not created # after executed 'flush relay logs' statement. # Make sure binary logs was not be flushed # after execute 'flush relay logs' statement. @@ -30,21 +30,21 @@ flush engine logs; flush binary logs; # Check the 'master-bin.000002' file is created # after executed 'flush binary logs' statement. -# Make sure the 'slave-relay-bin.000006' file does not exist +# Make sure the 'slave-relay-bin.000005' file does not exist # exist before execute 'flush error logs, relay logs' statement. # Test if support to combine all kinds of logs into one statement. flush error logs, relay logs; # Make sure binary logs was not be flushed # after execute 'flush error logs, relay logs' statement. -# Check the 'slave-relay-bin.000006' file is created after +# Check the 'slave-relay-bin.000004' file is created after # execute 'flush error logs, relay logs' statement. -# Make sure the 'slave-relay-bin.000007' and 'slave-relay-bin.000008' +# Make sure the 'slave-relay-bin.000005' and 'slave-relay-bin.000006' # files do not exist before execute 'flush error logs, relay logs' # statement. # Test if 'flush logs' statement works fine and flush all the logs. flush logs; # Check 'master-bin.000003' is created # after execute 'flush logs' statement. -# Check the 'slave-relay-bin.000007' and 'slave-relay-bin.000008' +# Check the 'slave-relay-bin.000005' and 'slave-relay-bin.000006' # files are created after execute 'flush logs' statement. include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_heartbeat.result b/mysql-test/suite/rpl/r/rpl_heartbeat.result index d4bdb77ef0b..b0f36558d10 100644 --- a/mysql-test/suite/rpl/r/rpl_heartbeat.result +++ b/mysql-test/suite/rpl/r/rpl_heartbeat.result @@ -41,8 +41,6 @@ show status like 'Slave_heartbeat_period';; Variable_name Slave_heartbeat_period Value 4.000 set @@global.slave_net_timeout= 3 /* must be a warning */; -Warnings: -Warning 1704 The requested value for the heartbeat period exceeds the value of `slave_net_timeout' seconds. A sensible value for the period should be less than the timeout. reset slave; drop table if exists t1; set @@global.slave_net_timeout= 10; diff --git a/mysql-test/suite/rpl/r/rpl_heartbeat_basic.result b/mysql-test/suite/rpl/r/rpl_heartbeat_basic.result index cc9d1f99f7c..0c274165e1e 100644 --- a/mysql-test/suite/rpl/r/rpl_heartbeat_basic.result +++ b/mysql-test/suite/rpl/r/rpl_heartbeat_basic.result @@ -33,8 +33,6 @@ RESET SLAVE; *** Warning if updated slave_net_timeout < slave_heartbeat_timeout *** SET @@global.slave_net_timeout=FLOOR(SLAVE_HEARTBEAT_TIMEOUT)-1; -Warnings: -Warning 1704 The requested value for the heartbeat period exceeds the value of `slave_net_timeout' seconds. A sensible value for the period should be less than the timeout. SET @@global.slave_net_timeout=@restore_slave_net_timeout; RESET SLAVE; diff --git a/mysql-test/suite/rpl/r/rpl_skip_replication.result b/mysql-test/suite/rpl/r/rpl_skip_replication.result index c19f9009021..92b5fa5f629 100644 --- a/mysql-test/suite/rpl/r/rpl_skip_replication.result +++ b/mysql-test/suite/rpl/r/rpl_skip_replication.result @@ -10,7 +10,7 @@ SELECT @@global.replicate_events_marked_for_skip; @@global.replicate_events_marked_for_skip replicate SET GLOBAL replicate_events_marked_for_skip=FILTER_ON_SLAVE; -ERROR HY000: This operation cannot be performed with a running slave; run STOP SLAVE first +ERROR HY000: This operation cannot be performed as you have a running slave ''; run STOP SLAVE '' first SELECT @@global.replicate_events_marked_for_skip; @@global.replicate_events_marked_for_skip replicate diff --git a/mysql-test/suite/rpl/r/rpl_start_slave_deadlock_sys_vars.result b/mysql-test/suite/rpl/r/rpl_start_slave_deadlock_sys_vars.result deleted file mode 100644 index f69a323f980..00000000000 --- a/mysql-test/suite/rpl/r/rpl_start_slave_deadlock_sys_vars.result +++ /dev/null @@ -1,31 +0,0 @@ -include/master-slave.inc -[connection master] -# connection: slave -SET @save_slave_net_timeout = @@GLOBAL.slave_net_timeout; -STOP SLAVE; -include/wait_for_slave_to_stop.inc -# open an extra connection to the slave -# connection: slave2 -# set debug synchronization point -SET DEBUG_SYNC='fix_slave_net_timeout SIGNAL parked WAIT_FOR go'; -# attempt to set slave_net_timeout, will wait on sync point -SET @@GLOBAL.slave_net_timeout = 100; -# connection: slave -SET DEBUG_SYNC='now WAIT_FOR parked'; -# connection: slave1 -# attempt to start the SQL thread -START SLAVE SQL_THREAD; -# connection: slave -# wait until SQL thread has been started -# sleep a bit so that the SQL thread THD handle is initialized -# signal the set slave_net_timeout to continue -SET DEBUG_SYNC='now SIGNAL go'; -# connection: slave2 -# reap result of set slave_net_timeout -# connection: slave1 -# reap result of starting the SQL thread -# disconnect: slave2 -# connection: slave -# cleanup -SET @@GLOBAL.slave_net_timeout = @save_slave_net_timeout; -include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_flush_logs.test b/mysql-test/suite/rpl/t/rpl_flush_logs.test index 6e9de634157..1d19576d47c 100644 --- a/mysql-test/suite/rpl/t/rpl_flush_logs.test +++ b/mysql-test/suite/rpl/t/rpl_flush_logs.test @@ -31,8 +31,9 @@ connection master; flush relay logs; sync_slave_with_master; ---echo # Check the 'slave-relay-bin.000003' file is created +--echo # Check the 'slave-relay-bin.000003' file is not created --echo # after executed 'flush relay logs' statement. +--error 1 file_exists $MYSQLTEST_VARDIR/mysqld.2/data/slave-relay-bin.000003; connection master; @@ -89,10 +90,10 @@ file_exists $MYSQLTEST_VARDIR/mysqld.1/data/master-bin.000001; # Test 'flush error logs, relay logs' statement sync_slave_with_master; ---echo # Make sure the 'slave-relay-bin.000006' file does not exist +--echo # Make sure the 'slave-relay-bin.000005' file does not exist --echo # exist before execute 'flush error logs, relay logs' statement. --error 1 -file_exists $MYSQLTEST_VARDIR/mysqld.2/data/slave-relay-bin.000006; +file_exists $MYSQLTEST_VARDIR/mysqld.2/data/slave-relay-bin.000005; connection master; @@ -107,19 +108,18 @@ file_exists $MYSQLTEST_VARDIR/tmp/master_log.err; file_exists $MYSQLTEST_VARDIR/mysqld.1/data/master-bin.000003; sync_slave_with_master; ---echo # Check the 'slave-relay-bin.000006' file is created after +--echo # Check the 'slave-relay-bin.000004' file is created after --echo # execute 'flush error logs, relay logs' statement. -file_exists $MYSQLTEST_VARDIR/mysqld.2/data/slave-relay-bin.000006; - +file_exists $MYSQLTEST_VARDIR/mysqld.2/data/slave-relay-bin.000004; # Test 'flush logs' statement ---echo # Make sure the 'slave-relay-bin.000007' and 'slave-relay-bin.000008' +--echo # Make sure the 'slave-relay-bin.000005' and 'slave-relay-bin.000006' --echo # files do not exist before execute 'flush error logs, relay logs' --echo # statement. --error 1 -file_exists $MYSQLTEST_VARDIR/mysqld.2/data/slave-relay-bin.000007; +file_exists $MYSQLTEST_VARDIR/mysqld.2/data/slave-relay-bin.000005; --error 1 -file_exists $MYSQLTEST_VARDIR/mysqld.2/data/slave-relay-bin.000008; +file_exists $MYSQLTEST_VARDIR/mysqld.2/data/slave-relay-bin.000006; connection master; @@ -133,9 +133,9 @@ file_exists $MYSQLTEST_VARDIR/tmp/master_log.err; file_exists $MYSQLTEST_VARDIR/mysqld.1/data/master-bin.000003; sync_slave_with_master; ---echo # Check the 'slave-relay-bin.000007' and 'slave-relay-bin.000008' +--echo # Check the 'slave-relay-bin.000005' and 'slave-relay-bin.000006' --echo # files are created after execute 'flush logs' statement. -file_exists $MYSQLTEST_VARDIR/mysqld.2/data/slave-relay-bin.000007; -file_exists $MYSQLTEST_VARDIR/mysqld.2/data/slave-relay-bin.000008; +file_exists $MYSQLTEST_VARDIR/mysqld.2/data/slave-relay-bin.000005; +file_exists $MYSQLTEST_VARDIR/mysqld.2/data/slave-relay-bin.000006; --source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_start_slave_deadlock_sys_vars.test b/mysql-test/suite/rpl/t/rpl_start_slave_deadlock_sys_vars.test deleted file mode 100644 index 3eaff761108..00000000000 --- a/mysql-test/suite/rpl/t/rpl_start_slave_deadlock_sys_vars.test +++ /dev/null @@ -1,57 +0,0 @@ -source include/have_debug_sync.inc; -source include/master-slave.inc; - ---echo # connection: slave -connection slave; -SET @save_slave_net_timeout = @@GLOBAL.slave_net_timeout; -STOP SLAVE; -source include/wait_for_slave_to_stop.inc; - ---echo # open an extra connection to the slave -connect(slave2,127.0.0.1,root,,test,$SLAVE_MYPORT,); ---echo # connection: slave2 ---echo # set debug synchronization point -SET DEBUG_SYNC='fix_slave_net_timeout SIGNAL parked WAIT_FOR go'; ---echo # attempt to set slave_net_timeout, will wait on sync point ---send SET @@GLOBAL.slave_net_timeout = 100 - ---echo # connection: slave -connection slave; -SET DEBUG_SYNC='now WAIT_FOR parked'; - ---echo # connection: slave1 -connection slave1; ---echo # attempt to start the SQL thread ---send START SLAVE SQL_THREAD - ---echo # connection: slave -connection slave; ---echo # wait until SQL thread has been started -let $wait_condition= - select count(*) = 1 from information_schema.processlist - where state = "Waiting for slave thread to start" and info = "START SLAVE SQL_THREAD"; ---source include/wait_condition.inc ---echo # sleep a bit so that the SQL thread THD handle is initialized -sleep 2; ---echo # signal the set slave_net_timeout to continue -SET DEBUG_SYNC='now SIGNAL go'; - ---echo # connection: slave2 -connection slave2; ---echo # reap result of set slave_net_timeout ---reap - ---echo # connection: slave1 -connection slave1; ---echo # reap result of starting the SQL thread ---reap - ---echo # disconnect: slave2 -disconnect slave2; - ---echo # connection: slave -connection slave; ---echo # cleanup -SET @@GLOBAL.slave_net_timeout = @save_slave_net_timeout; - -source include/rpl_end.inc; diff --git a/plugin/semisync/semisync_master_plugin.cc b/plugin/semisync/semisync_master_plugin.cc index b6ff23cd1ad..c811cb1cc9e 100644 --- a/plugin/semisync/semisync_master_plugin.cc +++ b/plugin/semisync/semisync_master_plugin.cc @@ -297,10 +297,10 @@ DEF_SHOW_FUNC(avg_trx_wait_time, SHOW_LONG) static SHOW_VAR semi_sync_master_status_vars[]= { {"Rpl_semi_sync_master_status", (char*) &SHOW_FNAME(status), - SHOW_FUNC}, + SHOW_SIMPLE_FUNC}, {"Rpl_semi_sync_master_clients", (char*) &SHOW_FNAME(clients), - SHOW_FUNC}, + SHOW_SIMPLE_FUNC}, {"Rpl_semi_sync_master_yes_tx", (char*) &rpl_semi_sync_master_yes_transactions, SHOW_LONG}, @@ -309,7 +309,7 @@ static SHOW_VAR semi_sync_master_status_vars[]= { SHOW_LONG}, {"Rpl_semi_sync_master_wait_sessions", (char*) &SHOW_FNAME(wait_sessions), - SHOW_FUNC}, + SHOW_SIMPLE_FUNC}, {"Rpl_semi_sync_master_no_times", (char*) &rpl_semi_sync_master_off_times, SHOW_LONG}, @@ -321,22 +321,22 @@ static SHOW_VAR semi_sync_master_status_vars[]= { SHOW_LONG}, {"Rpl_semi_sync_master_tx_wait_time", (char*) &SHOW_FNAME(trx_wait_time), - SHOW_FUNC}, + SHOW_SIMPLE_FUNC}, {"Rpl_semi_sync_master_tx_waits", (char*) &SHOW_FNAME(trx_wait_num), - SHOW_FUNC}, + SHOW_SIMPLE_FUNC}, {"Rpl_semi_sync_master_tx_avg_wait_time", (char*) &SHOW_FNAME(avg_trx_wait_time), - SHOW_FUNC}, + SHOW_SIMPLE_FUNC}, {"Rpl_semi_sync_master_net_wait_time", (char*) &SHOW_FNAME(net_wait_time), - SHOW_FUNC}, + SHOW_SIMPLE_FUNC}, {"Rpl_semi_sync_master_net_waits", (char*) &SHOW_FNAME(net_wait_num), - SHOW_FUNC}, + SHOW_SIMPLE_FUNC}, {"Rpl_semi_sync_master_net_avg_wait_time", (char*) &SHOW_FNAME(avg_net_wait_time), - SHOW_FUNC}, + SHOW_SIMPLE_FUNC}, {NULL, NULL, SHOW_LONG}, }; diff --git a/sql/item_create.cc b/sql/item_create.cc index 87e90ed4f8b..07e7f7b7ff9 100644 --- a/sql/item_create.cc +++ b/sql/item_create.cc @@ -4393,7 +4393,7 @@ Create_func_master_pos_wait::create_native(THD *thd, LEX_STRING name, if (item_list != NULL) arg_count= item_list->elements; - if (arg_count < 2 || arg_count >4) + if (arg_count < 2 || arg_count > 4) { my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name.str); return func; @@ -4413,7 +4413,6 @@ Create_func_master_pos_wait::create_native(THD *thd, LEX_STRING name, { Item *param_3= item_list->pop(); func= new (thd->mem_root) Item_master_pos_wait(param_1, param_2, param_3); - thd->lex->safe_to_cache_query= 0; break; } case 4: @@ -4422,7 +4421,6 @@ Create_func_master_pos_wait::create_native(THD *thd, LEX_STRING name, Item *param_4= item_list->pop(); func= new (thd->mem_root) Item_master_pos_wait(param_1, param_2, param_3, param_4); - thd->lex->safe_to_cache_query= 0; break; } } diff --git a/sql/lex.h b/sql/lex.h index 9bf4c439cb6..dab9e2adbc4 100644 --- a/sql/lex.h +++ b/sql/lex.h @@ -514,6 +514,7 @@ static SYMBOL symbols[] = { { "SIGNED", SYM(SIGNED_SYM)}, { "SIMPLE", SYM(SIMPLE_SYM)}, { "SLAVE", SYM(SLAVE)}, + { "SLAVES", SYM(SLAVES)}, { "SLOW", SYM(SLOW)}, { "SNAPSHOT", SYM(SNAPSHOT_SYM)}, { "SMALLINT", SYM(SMALLINT)}, diff --git a/sql/log.cc b/sql/log.cc index 6b0507943c3..e664540f0d6 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -3866,7 +3866,7 @@ int MYSQL_BIN_LOG::purge_first_log(Relay_log_info* rli, bool included) DBUG_ENTER("purge_first_log"); DBUG_ASSERT(is_open()); - DBUG_ASSERT(rli->slave_running == 1); + DBUG_ASSERT(rli->slave_running == MYSQL_SLAVE_RUN_NOT_CONNECT); DBUG_ASSERT(!strcmp(rli->linfo.log_file_name,rli->event_relay_log_name)); mysql_mutex_lock(&LOCK_index); diff --git a/sql/log_event.cc b/sql/log_event.cc index 1d525aa94d8..e802c7db16e 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -11247,6 +11247,9 @@ Heartbeat_log_event::Heartbeat_log_event(const char* buf, uint event_len, There is a dummy replacement for this in the embedded library that returns FALSE; this is used by XtraDB to allow it to access replication stuff while still being able to use the same plugin in both stand-alone and embedded. + + In this function it's ok to use active_mi, as this is only called for + the main replication server. */ bool rpl_get_position_info(const char **log_file_name, ulonglong *log_pos, const char **group_relay_log_name, diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 3a89de32b8a..24408849eed 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -496,6 +496,7 @@ ulong binlog_cache_use= 0, binlog_cache_disk_use= 0; ulong binlog_stmt_cache_use= 0, binlog_stmt_cache_disk_use= 0; ulong max_connections, max_connect_errors; ulong extra_max_connections; +ulong slave_retried_transactions; ulonglong denied_connections; my_decimal decimal_zero; @@ -3379,8 +3380,8 @@ SHOW_VAR com_status_vars[]= { {"show_user_statistics", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_USER_STATS]), SHOW_LONG_STATUS}, {"show_variables", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_VARIABLES]), SHOW_LONG_STATUS}, {"show_warnings", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_WARNS]), SHOW_LONG_STATUS}, - {"slave_start", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SLAVE_START]), SHOW_LONG_STATUS}, - {"slave_stop", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SLAVE_STOP]), SHOW_LONG_STATUS}, + {"start_all_slaves", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SLAVE_ALL_START]), SHOW_LONG_STATUS}, + {"start_slave", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SLAVE_START]), SHOW_LONG_STATUS}, {"stmt_close", (char*) offsetof(STATUS_VAR, com_stmt_close), SHOW_LONG_STATUS}, {"stmt_execute", (char*) offsetof(STATUS_VAR, com_stmt_execute), SHOW_LONG_STATUS}, {"stmt_fetch", (char*) offsetof(STATUS_VAR, com_stmt_fetch), SHOW_LONG_STATUS}, @@ -3388,6 +3389,8 @@ SHOW_VAR com_status_vars[]= { {"stmt_reprepare", (char*) offsetof(STATUS_VAR, com_stmt_reprepare), SHOW_LONG_STATUS}, {"stmt_reset", (char*) offsetof(STATUS_VAR, com_stmt_reset), SHOW_LONG_STATUS}, {"stmt_send_long_data", (char*) offsetof(STATUS_VAR, com_stmt_send_long_data), SHOW_LONG_STATUS}, + {"stop_all_slaves", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SLAVE_ALL_STOP]), SHOW_LONG_STATUS}, + {"stop_slave", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SLAVE_STOP]), SHOW_LONG_STATUS}, {"truncate", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_TRUNCATE]), SHOW_LONG_STATUS}, {"uninstall_plugin", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_UNINSTALL_PLUGIN]), SHOW_LONG_STATUS}, {"unlock_tables", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_UNLOCK_TABLES]), SHOW_LONG_STATUS}, @@ -4911,7 +4914,7 @@ int mysqld_main(int argc, char **argv) /* We must have LOCK_open before LOCK_global_system_variables because - LOCK_open is hold while sql_plugin.c::intern_sys_var_ptr() is called. + LOCK_open is held while sql_plugin.c::intern_sys_var_ptr() is called. */ mysql_mutex_record_order(&LOCK_open, &LOCK_global_system_variables); @@ -6532,66 +6535,51 @@ static int show_slave_running(THD *thd, SHOW_VAR *var, char *buff) { Master_info *mi; var->type= SHOW_MY_BOOL; - mysql_mutex_lock(&LOCK_active_mi); var->value= buff; + mysql_mutex_lock(&LOCK_active_mi); mi= master_info_index-> get_master_info(&thd->variables.default_master_connection, - MYSQL_ERROR::WARN_LEVEL_WARN); - *((my_bool *)buff)= (my_bool) (mi && - mi->slave_running == - MYSQL_SLAVE_RUN_CONNECT && - mi->rli.slave_running); - mysql_mutex_unlock(&LOCK_active_mi); - return 0; -} - -static int show_slave_retried_trans(THD *thd, SHOW_VAR *var, char *buff) -{ - /* - TODO: with multimaster, have one such counter per line in - SHOW SLAVE STATUS, and have the sum over all lines here. - */ - mysql_mutex_lock(&LOCK_active_mi); - if (active_mi) - { - var->type= SHOW_LONG; - var->value= buff; - mysql_mutex_lock(&active_mi->rli.data_lock); - *((long *)buff)= (long)active_mi->rli.retried_trans; - mysql_mutex_unlock(&active_mi->rli.data_lock); - } + MYSQL_ERROR::WARN_LEVEL_NOTE); + if (mi) + *((my_bool *)buff)= (my_bool) (mi->slave_running == + MYSQL_SLAVE_RUN_CONNECT && + mi->rli.slave_running); else var->type= SHOW_UNDEF; mysql_mutex_unlock(&LOCK_active_mi); return 0; } + static int show_slave_received_heartbeats(THD *thd, SHOW_VAR *var, char *buff) { + Master_info *mi; + var->type= SHOW_LONGLONG; + var->value= buff; mysql_mutex_lock(&LOCK_active_mi); - if (active_mi) - { - var->type= SHOW_LONGLONG; - var->value= buff; - mysql_mutex_lock(&active_mi->rli.data_lock); - *((longlong *)buff)= active_mi->received_heartbeats; - mysql_mutex_unlock(&active_mi->rli.data_lock); - } + mi= master_info_index-> + get_master_info(&thd->variables.default_master_connection, + MYSQL_ERROR::WARN_LEVEL_NOTE); + if (mi) + *((longlong *)buff)= mi->received_heartbeats; else var->type= SHOW_UNDEF; mysql_mutex_unlock(&LOCK_active_mi); return 0; } + static int show_heartbeat_period(THD *thd, SHOW_VAR *var, char *buff) { + Master_info *mi; + var->type= SHOW_CHAR; + var->value= buff; mysql_mutex_lock(&LOCK_active_mi); - if (active_mi) - { - var->type= SHOW_CHAR; - var->value= buff; - sprintf(buff, "%.3f", active_mi->heartbeat_period); - } + mi= master_info_index-> + get_master_info(&thd->variables.default_master_connection, + MYSQL_ERROR::WARN_LEVEL_NOTE); + if (mi) + sprintf(buff, "%.3f", mi->heartbeat_period); else var->type= SHOW_UNDEF; mysql_mutex_unlock(&LOCK_active_mi); @@ -6952,7 +6940,7 @@ SHOW_VAR status_vars[]= { {"Bytes_sent", (char*) offsetof(STATUS_VAR, bytes_sent), SHOW_LONGLONG_STATUS}, {"Binlog_bytes_written", (char*) offsetof(STATUS_VAR, binlog_bytes_written), SHOW_LONGLONG_STATUS}, {"Com", (char*) com_status_vars, SHOW_ARRAY}, - {"Compression", (char*) &show_net_compression, SHOW_FUNC}, + {"Compression", (char*) &show_net_compression, SHOW_SIMPLE_FUNC}, {"Connections", (char*) &thread_id, SHOW_LONG_NOFLUSH}, {"Cpu_time", (char*) offsetof(STATUS_VAR, cpu_time), SHOW_DOUBLE_STATUS}, {"Created_tmp_disk_tables", (char*) offsetof(STATUS_VAR, created_tmp_disk_tables), SHOW_LONG_STATUS}, @@ -7006,13 +6994,13 @@ SHOW_VAR status_vars[]= { {"Not_flushed_delayed_rows", (char*) &delayed_rows_in_use, SHOW_LONG_NOFLUSH}, {"Open_files", (char*) &my_file_opened, SHOW_LONG_NOFLUSH}, {"Open_streams", (char*) &my_stream_opened, SHOW_LONG_NOFLUSH}, - {"Open_table_definitions", (char*) &show_table_definitions, SHOW_FUNC}, - {"Open_tables", (char*) &show_open_tables, SHOW_FUNC}, + {"Open_table_definitions", (char*) &show_table_definitions, SHOW_SIMPLE_FUNC}, + {"Open_tables", (char*) &show_open_tables, SHOW_SIMPLE_FUNC}, {"Opened_files", (char*) &my_file_total_opened, SHOW_LONG_NOFLUSH}, {"Opened_tables", (char*) offsetof(STATUS_VAR, opened_tables), SHOW_LONG_STATUS}, {"Opened_table_definitions", (char*) offsetof(STATUS_VAR, opened_shares), SHOW_LONG_STATUS}, {"Opened_views", (char*) offsetof(STATUS_VAR, opened_views), SHOW_LONG_STATUS}, - {"Prepared_stmt_count", (char*) &show_prepared_stmt_count, SHOW_FUNC}, + {"Prepared_stmt_count", (char*) &show_prepared_stmt_count, SHOW_SIMPLE_FUNC}, {"Rows_sent", (char*) offsetof(STATUS_VAR, rows_sent), SHOW_LONGLONG_STATUS}, {"Rows_read", (char*) offsetof(STATUS_VAR, rows_read), SHOW_LONGLONG_STATUS}, {"Rows_tmp_read", (char*) offsetof(STATUS_VAR, rows_tmp_read), SHOW_LONGLONG_STATUS}, @@ -7026,10 +7014,10 @@ SHOW_VAR status_vars[]= { {"Qcache_queries_in_cache", (char*) &query_cache.queries_in_cache, SHOW_LONG_NOFLUSH}, {"Qcache_total_blocks", (char*) &query_cache.total_blocks, SHOW_LONG_NOFLUSH}, #endif /*HAVE_QUERY_CACHE*/ - {"Queries", (char*) &show_queries, SHOW_FUNC}, + {"Queries", (char*) &show_queries, SHOW_SIMPLE_FUNC}, {"Questions", (char*) offsetof(STATUS_VAR, questions), SHOW_LONG_STATUS}, #ifdef HAVE_REPLICATION - {"Rpl_status", (char*) &show_rpl_status, SHOW_FUNC}, + {"Rpl_status", (char*) &show_rpl_status, SHOW_SIMPLE_FUNC}, #endif {"Select_full_join", (char*) offsetof(STATUS_VAR, select_full_join_count), SHOW_LONG_STATUS}, {"Select_full_range_join", (char*) offsetof(STATUS_VAR, select_full_range_join_count), SHOW_LONG_STATUS}, @@ -7038,10 +7026,10 @@ SHOW_VAR status_vars[]= { {"Select_scan", (char*) offsetof(STATUS_VAR, select_scan_count), SHOW_LONG_STATUS}, {"Slave_open_temp_tables", (char*) &slave_open_temp_tables, SHOW_LONG}, #ifdef HAVE_REPLICATION - {"Slave_retried_transactions",(char*) &show_slave_retried_trans, SHOW_FUNC}, - {"Slave_heartbeat_period", (char*) &show_heartbeat_period, SHOW_FUNC}, - {"Slave_received_heartbeats",(char*) &show_slave_received_heartbeats, SHOW_FUNC}, - {"Slave_running", (char*) &show_slave_running, SHOW_FUNC}, + {"Slave_retried_transactions",(char*)&slave_retried_transactions, SHOW_LONG}, + {"Slave_heartbeat_period", (char*) &show_heartbeat_period, SHOW_SIMPLE_FUNC}, + {"Slave_received_heartbeats",(char*) &show_slave_received_heartbeats, SHOW_SIMPLE_FUNC}, + {"Slave_running", (char*) &show_slave_running, SHOW_SIMPLE_FUNC}, #endif {"Slow_launch_threads", (char*) &slow_launch_threads, SHOW_LONG}, {"Slow_queries", (char*) offsetof(STATUS_VAR, long_query_count), SHOW_LONG_STATUS}, @@ -7051,29 +7039,29 @@ SHOW_VAR status_vars[]= { {"Sort_scan", (char*) offsetof(STATUS_VAR, filesort_scan_count), SHOW_LONG_STATUS}, #ifdef HAVE_OPENSSL #ifndef EMBEDDED_LIBRARY - {"Ssl_accept_renegotiates", (char*) &show_ssl_ctx_sess_accept_renegotiate, SHOW_FUNC}, - {"Ssl_accepts", (char*) &show_ssl_ctx_sess_accept, SHOW_FUNC}, - {"Ssl_callback_cache_hits", (char*) &show_ssl_ctx_sess_cb_hits, SHOW_FUNC}, - {"Ssl_cipher", (char*) &show_ssl_get_cipher, SHOW_FUNC}, - {"Ssl_cipher_list", (char*) &show_ssl_get_cipher_list, SHOW_FUNC}, - {"Ssl_client_connects", (char*) &show_ssl_ctx_sess_connect, SHOW_FUNC}, - {"Ssl_connect_renegotiates", (char*) &show_ssl_ctx_sess_connect_renegotiate, SHOW_FUNC}, - {"Ssl_ctx_verify_depth", (char*) &show_ssl_ctx_get_verify_depth, SHOW_FUNC}, - {"Ssl_ctx_verify_mode", (char*) &show_ssl_ctx_get_verify_mode, SHOW_FUNC}, - {"Ssl_default_timeout", (char*) &show_ssl_get_default_timeout, SHOW_FUNC}, - {"Ssl_finished_accepts", (char*) &show_ssl_ctx_sess_accept_good, SHOW_FUNC}, - {"Ssl_finished_connects", (char*) &show_ssl_ctx_sess_connect_good, SHOW_FUNC}, - {"Ssl_session_cache_hits", (char*) &show_ssl_ctx_sess_hits, SHOW_FUNC}, - {"Ssl_session_cache_misses", (char*) &show_ssl_ctx_sess_misses, SHOW_FUNC}, - {"Ssl_session_cache_mode", (char*) &show_ssl_ctx_get_session_cache_mode, SHOW_FUNC}, - {"Ssl_session_cache_overflows", (char*) &show_ssl_ctx_sess_cache_full, SHOW_FUNC}, - {"Ssl_session_cache_size", (char*) &show_ssl_ctx_sess_get_cache_size, SHOW_FUNC}, - {"Ssl_session_cache_timeouts", (char*) &show_ssl_ctx_sess_timeouts, SHOW_FUNC}, - {"Ssl_sessions_reused", (char*) &show_ssl_session_reused, SHOW_FUNC}, - {"Ssl_used_session_cache_entries",(char*) &show_ssl_ctx_sess_number, SHOW_FUNC}, - {"Ssl_verify_depth", (char*) &show_ssl_get_verify_depth, SHOW_FUNC}, - {"Ssl_verify_mode", (char*) &show_ssl_get_verify_mode, SHOW_FUNC}, - {"Ssl_version", (char*) &show_ssl_get_version, SHOW_FUNC}, + {"Ssl_accept_renegotiates", (char*) &show_ssl_ctx_sess_accept_renegotiate, SHOW_SIMPLE_FUNC}, + {"Ssl_accepts", (char*) &show_ssl_ctx_sess_accept, SHOW_SIMPLE_FUNC}, + {"Ssl_callback_cache_hits", (char*) &show_ssl_ctx_sess_cb_hits, SHOW_SIMPLE_FUNC}, + {"Ssl_cipher", (char*) &show_ssl_get_cipher, SHOW_SIMPLE_FUNC}, + {"Ssl_cipher_list", (char*) &show_ssl_get_cipher_list, SHOW_SIMPLE_FUNC}, + {"Ssl_client_connects", (char*) &show_ssl_ctx_sess_connect, SHOW_SIMPLE_FUNC}, + {"Ssl_connect_renegotiates", (char*) &show_ssl_ctx_sess_connect_renegotiate, SHOW_SIMPLE_FUNC}, + {"Ssl_ctx_verify_depth", (char*) &show_ssl_ctx_get_verify_depth, SHOW_SIMPLE_FUNC}, + {"Ssl_ctx_verify_mode", (char*) &show_ssl_ctx_get_verify_mode, SHOW_SIMPLE_FUNC}, + {"Ssl_default_timeout", (char*) &show_ssl_get_default_timeout, SHOW_SIMPLE_FUNC}, + {"Ssl_finished_accepts", (char*) &show_ssl_ctx_sess_accept_good, SHOW_SIMPLE_FUNC}, + {"Ssl_finished_connects", (char*) &show_ssl_ctx_sess_connect_good, SHOW_SIMPLE_FUNC}, + {"Ssl_session_cache_hits", (char*) &show_ssl_ctx_sess_hits, SHOW_SIMPLE_FUNC}, + {"Ssl_session_cache_misses", (char*) &show_ssl_ctx_sess_misses, SHOW_SIMPLE_FUNC}, + {"Ssl_session_cache_mode", (char*) &show_ssl_ctx_get_session_cache_mode, SHOW_SIMPLE_FUNC}, + {"Ssl_session_cache_overflows", (char*) &show_ssl_ctx_sess_cache_full, SHOW_SIMPLE_FUNC}, + {"Ssl_session_cache_size", (char*) &show_ssl_ctx_sess_get_cache_size, SHOW_SIMPLE_FUNC}, + {"Ssl_session_cache_timeouts", (char*) &show_ssl_ctx_sess_timeouts, SHOW_SIMPLE_FUNC}, + {"Ssl_sessions_reused", (char*) &show_ssl_session_reused, SHOW_SIMPLE_FUNC}, + {"Ssl_used_session_cache_entries",(char*) &show_ssl_ctx_sess_number, SHOW_SIMPLE_FUNC}, + {"Ssl_verify_depth", (char*) &show_ssl_get_verify_depth, SHOW_SIMPLE_FUNC}, + {"Ssl_verify_mode", (char*) &show_ssl_get_verify_mode, SHOW_SIMPLE_FUNC}, + {"Ssl_version", (char*) &show_ssl_get_version, SHOW_SIMPLE_FUNC}, #endif #endif /* HAVE_OPENSSL */ {"Syncs", (char*) &my_sync_count, SHOW_LONG_NOFLUSH}, @@ -7091,16 +7079,16 @@ SHOW_VAR status_vars[]= { {"Tc_log_page_waits", (char*) &tc_log_page_waits, SHOW_LONG}, #endif #ifdef HAVE_POOL_OF_THREADS - {"Threadpool_idle_threads", (char *) &show_threadpool_idle_threads, SHOW_FUNC}, + {"Threadpool_idle_threads", (char *) &show_threadpool_idle_threads, SHOW_SIMPLE_FUNC}, {"Threadpool_threads", (char *) &tp_stats.num_worker_threads, SHOW_INT}, #endif {"Threads_cached", (char*) &cached_thread_count, SHOW_LONG_NOFLUSH}, {"Threads_connected", (char*) &connection_count, SHOW_INT}, {"Threads_created", (char*) &thread_created, SHOW_LONG_NOFLUSH}, {"Threads_running", (char*) &thread_running, SHOW_INT}, - {"Uptime", (char*) &show_starttime, SHOW_FUNC}, + {"Uptime", (char*) &show_starttime, SHOW_SIMPLE_FUNC}, #ifdef ENABLED_PROFILING - {"Uptime_since_flush_status",(char*) &show_flushstatustime, SHOW_FUNC}, + {"Uptime_since_flush_status",(char*) &show_flushstatustime, SHOW_SIMPLE_FUNC}, #endif {NullS, NullS, SHOW_LONG} }; @@ -7299,6 +7287,7 @@ static int mysql_init_variables(void) protocol_version= PROTOCOL_VERSION; what_to_log= ~ (1L << (uint) COM_TIME); refresh_version= 1L; /* Increments on each reload */ + denied_connections= 0; executed_events= 0; global_query_id= thread_id= 1L; my_atomic_rwlock_init(&global_query_id_lock); @@ -7326,6 +7315,7 @@ static int mysql_init_variables(void) relay_log_info_file= (char*) "relay-log.info"; report_user= report_password = report_host= 0; /* TO BE DELETED */ opt_relay_logname= opt_relaylog_index_name= 0; + slave_retried_transactions= 0; /* Variables in libraries */ charsets_dir= 0; diff --git a/sql/mysqld.h b/sql/mysqld.h index 4250898cc5b..430811a956c 100644 --- a/sql/mysqld.h +++ b/sql/mysqld.h @@ -95,6 +95,7 @@ extern my_bool opt_safe_user_create; extern my_bool opt_safe_show_db, opt_local_infile, opt_myisam_use_mmap; extern my_bool opt_slave_compressed_protocol, use_temp_pool; extern ulong slave_exec_mode_options; +extern ulong slave_retried_transactions; extern ulonglong slave_type_conversions_options; extern my_bool read_only, opt_readonly; extern my_bool lower_case_file_system; diff --git a/sql/rpl_mi.cc b/sql/rpl_mi.cc index 1491d970472..e004e3495c7 100644 --- a/sql/rpl_mi.cc +++ b/sql/rpl_mi.cc @@ -21,6 +21,7 @@ #include "rpl_mi.h" #include "slave.h" // SLAVE_MAX_HEARTBEAT_PERIOD #include "strfunc.h" +#include "sql_repl.h" #ifdef HAVE_REPLICATION @@ -42,7 +43,10 @@ Master_info::Master_info(LEX_STRING *connection_name_arg, ssl_ca[0]= 0; ssl_capath[0]= 0; ssl_cert[0]= 0; ssl_cipher[0]= 0; ssl_key[0]= 0; - /* Store connection name and lower case connection name */ + /* + Store connection name and lower case connection name + It's safe to ignore any OMM errors as this is checked by error() + */ connection_name.length= cmp_connection_name.length= connection_name_arg->length; if ((connection_name.str= (char*) my_malloc(connection_name_arg->length*2+2, @@ -599,7 +603,7 @@ void free_key_master_info(Master_info *mi) /** Check if connection name for master_info is valid. - It's valid if it's a valid system name, is less than + It's valid if it's a valid system name of length less than MAX_CONNECTION_NAME. @return @@ -616,7 +620,7 @@ bool check_master_connection_name(LEX_STRING *name) /** - Create a log file with a signed suffix. + Create a log file with a given suffix. @param res_file_name Store result here @@ -635,7 +639,7 @@ bool check_master_connection_name(LEX_STRING *name) file names without a prefix. */ -void create_signed_file_name(char *res_file_name, uint length, +void create_logfile_name_with_suffix(char *res_file_name, uint length, const char *info_file, bool append, LEX_STRING *suffix) { @@ -761,9 +765,9 @@ bool Master_info_index::init_all_master_info() lock_slave_threads(mi); init_thread_mask(&thread_mask,mi,0 /*not inverse*/); - create_signed_file_name(buf_master_info_file, sizeof(buf_master_info_file), + create_logfile_name_with_suffix(buf_master_info_file, sizeof(buf_master_info_file), master_info_file, 0, &connection_name); - create_signed_file_name(buf_relay_log_info_file, + create_logfile_name_with_suffix(buf_relay_log_info_file, sizeof(buf_relay_log_info_file), relay_log_info_file, 0, &connection_name); if (global_system_variables.log_warnings > 1) @@ -827,7 +831,7 @@ bool Master_info_index::init_all_master_info() buf_relay_log_info_file, SLAVE_IO | SLAVE_SQL)) { - sql_print_error("Failed to create slave threads for connection %.*s", + sql_print_error("Failed to create slave threads for connection '%.*s'", (int) connection_name.length, connection_name.str); continue; @@ -1033,8 +1037,7 @@ bool Master_info_index::remove_master_info(LEX_STRING *name) } // Rewrite Master_info.index - uint i; - for (i= 0; i< master_info_hash.records; ++i) + for (uint i= 0; i< master_info_hash.records; ++i) { Master_info *tmp_mi; tmp_mi= (Master_info *) my_hash_element(&master_info_hash, i); @@ -1046,4 +1049,127 @@ bool Master_info_index::remove_master_info(LEX_STRING *name) DBUG_RETURN(FALSE); } + +/** + Master_info_index::give_error_if_slave_running() + + @return + TRUE If some slave is running. An error is printed + FALSE No slave is running +*/ + +bool Master_info_index::give_error_if_slave_running() +{ + DBUG_ENTER("warn_if_slave_running"); + mysql_mutex_assert_owner(&LOCK_active_mi); + + for (uint i= 0; i< master_info_hash.records; ++i) + { + Master_info *mi; + mi= (Master_info *) my_hash_element(&master_info_hash, i); + if (mi->rli.slave_running != MYSQL_SLAVE_NOT_RUN) + { + my_error(ER_SLAVE_MUST_STOP, MYF(0), (int) mi->connection_name.length, + mi->connection_name.str); + DBUG_RETURN(TRUE); + } + } + DBUG_RETURN(FALSE); +} + + +/** + Master_info_index::start_all_slaves() + + Start all slaves that was not running. + + @return + TRUE Error + FALSE Everything ok. +*/ + +bool Master_info_index::start_all_slaves(THD *thd) +{ + bool result= FALSE; + DBUG_ENTER("warn_if_slave_running"); + mysql_mutex_assert_owner(&LOCK_active_mi); + + for (uint i= 0; i< master_info_hash.records; ++i) + { + int error; + Master_info *mi; + mi= (Master_info *) my_hash_element(&master_info_hash, i); + + /* + Try to start all slaves that are configured (host is defined) + and are not already running + */ + if ((mi->slave_running != MYSQL_SLAVE_RUN_CONNECT || + !mi->rli.slave_running) && *mi->host) + { + if ((error= start_slave(thd, mi, 1))) + { + my_error(ER_CANT_START_STOP_SLAVE, MYF(0), + "START", + (int) mi->connection_name.length, + mi->connection_name.str); + result= 1; + if (error < 0) // fatal error + break; + } + else + push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE, + ER_SLAVE_STARTED, ER(ER_SLAVE_STARTED), + (int) mi->connection_name.length, + mi->connection_name.str); + } + } + DBUG_RETURN(result); +} + + +/** + Master_info_index::stop_all_slaves() + + Start all slaves that was not running. + + @return + TRUE Error + FALSE Everything ok. +*/ + +bool Master_info_index::stop_all_slaves(THD *thd) +{ + bool result= FALSE; + DBUG_ENTER("warn_if_slave_running"); + mysql_mutex_assert_owner(&LOCK_active_mi); + + for (uint i= 0; i< master_info_hash.records; ++i) + { + int error; + Master_info *mi; + mi= (Master_info *) my_hash_element(&master_info_hash, i); + if ((mi->slave_running != MYSQL_SLAVE_NOT_RUN || + mi->rli.slave_running)) + { + if ((error= stop_slave(thd, mi, 1))) + { + my_error(ER_CANT_START_STOP_SLAVE, MYF(0), + "STOP", + (int) mi->connection_name.length, + mi->connection_name.str); + result= 1; + if (error < 0) // Fatal error + break; + } + else + push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE, + ER_SLAVE_STOPPED, ER(ER_SLAVE_STOPPED), + (int) mi->connection_name.length, + mi->connection_name.str); + } + } + DBUG_RETURN(result); +} + #endif /* HAVE_REPLICATION */ diff --git a/sql/rpl_mi.h b/sql/rpl_mi.h index 6c7bd3a5d28..48fdd3937c5 100644 --- a/sql/rpl_mi.h +++ b/sql/rpl_mi.h @@ -70,7 +70,7 @@ class Master_info : public Slave_reporting_capability } /* the variables below are needed because we can change masters on the fly */ - char master_log_name[FN_REFLEN+6]; /* Place for multi-*/ + char master_log_name[FN_REFLEN+6]; /* Room for multi-*/ char host[HOSTNAME_LENGTH+1]; char user[USERNAME_LENGTH+1]; char password[MAX_PASSWORD_LENGTH+1]; @@ -164,10 +164,13 @@ public: bool remove_master_info(LEX_STRING *connection_name); Master_info *get_master_info(LEX_STRING *connection_name, MYSQL_ERROR::enum_warning_level warning); + bool give_error_if_slave_running(); + bool start_all_slaves(THD *thd); + bool stop_all_slaves(THD *thd); }; bool check_master_connection_name(LEX_STRING *name); -void create_signed_file_name(char *res_file_name, uint length, +void create_logfile_name_with_suffix(char *res_file_name, uint length, const char *info_file, bool append, LEX_STRING *suffix); diff --git a/sql/rpl_rli.cc b/sql/rpl_rli.cc index 362ebab9fa0..e74831464fa 100644 --- a/sql/rpl_rli.cc +++ b/sql/rpl_rli.cc @@ -50,7 +50,7 @@ Relay_log_info::Relay_log_info(bool is_slave_recovery) last_master_timestamp(0), slave_skip_counter(0), abort_pos_wait(0), slave_run_id(0), sql_thd(0), inited(0), abort_slave(0), slave_running(0), until_condition(UNTIL_NONE), - until_log_pos(0), retried_trans(0), + until_log_pos(0), retried_trans(0), executed_entries(0), tables_to_lock(0), tables_to_lock_count(0), last_event_start_time(0), deferred_events(NULL),m_flags(0), row_stmt_start_timestamp(0), long_find_row_note_printed(false), @@ -203,14 +203,14 @@ a file name for --relay-log-index option", opt_relaylog_index_name); char buf_relay_logname[FN_REFLEN], buf_relaylog_index_name_buff[FN_REFLEN]; char *buf_relaylog_index_name= opt_relaylog_index_name; - create_signed_file_name(buf_relay_logname, sizeof(buf_relay_logname), + create_logfile_name_with_suffix(buf_relay_logname, sizeof(buf_relay_logname), ln, 1, &mi->connection_name); ln= buf_relay_logname; if (opt_relaylog_index_name) { buf_relaylog_index_name= buf_relaylog_index_name_buff; - create_signed_file_name(buf_relaylog_index_name_buff, + create_logfile_name_with_suffix(buf_relaylog_index_name_buff, sizeof(buf_relaylog_index_name_buff), opt_relaylog_index_name, 0, &mi->connection_name); diff --git a/sql/rpl_rli.h b/sql/rpl_rli.h index c543b4d3198..6144d37026b 100644 --- a/sql/rpl_rli.h +++ b/sql/rpl_rli.h @@ -228,8 +228,9 @@ public: Needed for problems when slave stops and we want to restart it skipping one or more events in the master log that have caused errors, and have been manually applied by DBA already. + Must be ulong as it's refered to from set_var.cc */ - volatile ulong slave_skip_counter; /* Must be ulong */ + volatile ulong slave_skip_counter; volatile ulong abort_pos_wait; /* Incremented on change master */ volatile ulong slave_run_id; /* Incremented on slave start */ ulong max_relay_log_size; @@ -286,6 +287,7 @@ public: slave started. */ ulong trans_retries, retried_trans; + ulong executed_entries; /* For SLAVE STATUS */ /* If the end of the hot relay log is made of master's events ignored by the diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt index 803575b7ba0..3832ee150e3 100644 --- a/sql/share/errmsg-utf8.txt +++ b/sql/share/errmsg-utf8.txt @@ -4271,18 +4271,18 @@ ER_TRANS_CACHE_FULL swe "Transaktionen krävde mera än 'max_binlog_cache_size' minne. Öka denna mysqld-variabel och försök på nytt" ukr "Транзакція з багатьма виразами вимагає більше ніж 'max_binlog_cache_size' байтів для зберігання. Збільште цю змінну mysqld та спробуйте знову" ER_SLAVE_MUST_STOP - dan "Denne handling kunne ikke udføres med kørende slave, brug først kommandoen STOP SLAVE" - nla "Deze operatie kan niet worden uitgevoerd met een actieve slave, doe eerst STOP SLAVE" - eng "This operation cannot be performed with a running slave; run STOP SLAVE first" - fre "Cette opération ne peut être réalisée avec un esclave actif, faites STOP SLAVE d'abord" - ger "Diese Operation kann bei einem aktiven Slave nicht durchgeführt werden. Bitte zuerst STOP SLAVE ausführen" - ita "Questa operazione non puo' essere eseguita con un database 'slave' che gira, lanciare prima STOP SLAVE" - por "Esta operação não pode ser realizada com um 'slave' em execução. Execute STOP SLAVE primeiro" - rus "Эту операцию невозможно выполнить при работающем потоке подчиненного сервера. Сначала выполните STOP SLAVE" - serbian "Ova operacija ne može biti izvršena dok je aktivan podređeni server. Zadajte prvo komandu 'STOP SLAVE' da zaustavite podređeni server." - spa "Esta operación no puede ser hecha con el esclavo funcionando, primero use STOP SLAVE" - swe "Denna operation kan inte göras under replikering; Gör STOP SLAVE först" - ukr "Операція не може бути виконана з запущеним підлеглим, спочатку виконайте STOP SLAVE" + dan "Denne handling kunne ikke udføres med kørende slave '%2$*1$s', brug først kommandoen STOP SLAVE '%2$*1$s'" + nla "Deze operatie kan niet worden uitgevoerd met een actieve slave '%2$*1$s', doe eerst STOP SLAVE '%2$*1$s'" + eng "This operation cannot be performed as you have a running slave '%2$*1$s'; run STOP SLAVE '%2$*1$s' first" + fre "Cette opération ne peut être réalisée avec un esclave '%2$*1$s' actif, faites STOP SLAVE '%2$*1$s' d'abord" + ger "Diese Operation kann bei einem aktiven Slave '%2$*1$s' nicht durchgeführt werden. Bitte zuerst STOP SLAVE '%2$*1$s' ausführen" + ita "Questa operazione non puo' essere eseguita con un database 'slave' '%2$*1$s' che gira, lanciare prima STOP SLAVE '%2$*1$s'" + por "Esta operação não pode ser realizada com um 'slave' '%2$*1$s' em execução. Execute STOP SLAVE '%2$*1$s' primeiro" + rus "Эту операцию невозможно выполнить при работающем потоке подчиненного сервера %2$*1$s. Сначала выполните STOP SLAVE '%2$*1$s'" + serbian "Ova operacija ne može biti izvršena dok je aktivan podređeni '%2$*1$s' server. Zadajte prvo komandu 'STOP SLAVE '%2$*1$s'' da zaustavite podređeni server." + spa "Esta operación no puede ser hecha con el esclavo '%2$*1$s' funcionando, primero use STOP SLAVE '%2$*1$s'" + swe "Denna operation kan inte göras under replikering; Du har en aktiv förbindelse till '%2$*1$s'. Gör STOP SLAVE '%2$*1$s' först" + ukr "Операція не може бути виконана з запущеним підлеглим '%2$*1$s', спочатку виконайте STOP SLAVE '%2$*1$s'" ER_SLAVE_NOT_RUNNING dan "Denne handling kræver en kørende slave. Konfigurer en slave og brug kommandoen START SLAVE" nla "Deze operatie vereist een actieve slave, configureer slave en doe dan START SLAVE" @@ -6592,3 +6592,9 @@ ER_CONNECTION_ALREADY_EXISTS eng "Connection '%.*s' conflicts with existing connection '%.*s'" ER_MASTER_LOG_PREFIX eng "Master '%.*s': " +ER_CANT_START_STOP_SLAVE + eng "Can't %s SLAVE '%.*s'" +ER_SLAVE_STARTED + eng "SLAVE '%.*s' started" +ER_SLAVE_STOPPED + eng "SLAVE '%.*s' stopped" diff --git a/sql/slave.cc b/sql/slave.cc index 8254e90b369..efaf25b3456 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -162,7 +162,7 @@ static int terminate_slave_thread(THD *thd, volatile uint *slave_running, bool skip_lock); static bool check_io_slave_killed(THD *thd, Master_info *mi, const char *info); -static bool send_show_master_info_header(THD *thd, Master_info *mi, bool full); +static bool send_show_master_info_header(THD *thd, bool full); static bool send_show_master_info_data(THD *thd, Master_info *mi, bool full); /* @@ -1863,9 +1863,9 @@ Waiting for the slave SQL thread to free enough relay log space"); #endif if (rli->sql_force_rotate_relay) { - mysql_mutex_lock(&active_mi->data_lock); + mysql_mutex_lock(&mi->data_lock); rotate_relay_log(rli->mi); - mysql_mutex_unlock(&active_mi->data_lock); + mysql_mutex_unlock(&mi->data_lock); rli->sql_force_rotate_relay= false; } @@ -2024,7 +2024,7 @@ bool show_master_info(THD *thd, Master_info *mi, bool full) { DBUG_ENTER("show_master_info"); - if (send_show_master_info_header(thd, mi, full)) + if (send_show_master_info_header(thd, full)) DBUG_RETURN(TRUE); if (send_show_master_info_data(thd, mi, full)) DBUG_RETURN(TRUE); @@ -2032,18 +2032,23 @@ bool show_master_info(THD *thd, Master_info *mi, bool full) DBUG_RETURN(FALSE); } -static bool send_show_master_info_header(THD *thd, Master_info *mi, bool full) +static bool send_show_master_info_header(THD *thd, bool full) { List<Item> field_list; Protocol *protocol= thd->protocol; + Master_info *mi; DBUG_ENTER("show_master_info_header"); if (full) + { field_list.push_back(new Item_empty_string("Connection_name", MAX_CONNECTION_NAME)); + field_list.push_back(new Item_empty_string("Slave_SQL_State", + 30)); + } field_list.push_back(new Item_empty_string("Slave_IO_State", - 14)); + 30)); field_list.push_back(new Item_empty_string("Master_Host", sizeof(mi->host))); field_list.push_back(new Item_empty_string("Master_User", @@ -2106,7 +2111,15 @@ static bool send_show_master_info_header(THD *thd, Master_info *mi, bool full) FN_REFLEN)); field_list.push_back(new Item_return_int("Master_Server_Id", sizeof(ulong), MYSQL_TYPE_LONG)); - + if (full) + { + field_list.push_back(new Item_return_int("Retried_transactions", + 10, MYSQL_TYPE_LONG)); + field_list.push_back(new Item_return_int("Max_relay_log_size", + 10, MYSQL_TYPE_LONGLONG)); + field_list.push_back(new Item_return_int("Executed_log_entries", + 10, MYSQL_TYPE_LONG)); + } if (protocol->send_result_set_metadata(&field_list, Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF)) DBUG_RETURN(TRUE); @@ -2134,6 +2147,9 @@ static bool send_show_master_info_data(THD *thd, Master_info *mi, bool full) protocol->store(mi->connection_name.str, mi->connection_name.length, &my_charset_bin); mysql_mutex_lock(&mi->run_lock); + if (full) + protocol->store(mi->rli.sql_thd ? mi->rli.sql_thd->proc_info : "", + &my_charset_bin); protocol->store(mi->io_thd ? mi->io_thd->proc_info : "", &my_charset_bin); mysql_mutex_unlock(&mi->run_lock); @@ -2266,6 +2282,12 @@ static bool send_show_master_info_data(THD *thd, Master_info *mi, bool full) } // Master_Server_id protocol->store((uint32) mi->master_id); + if (full) + { + protocol->store((uint32) mi->rli.retried_trans); + protocol->store((ulonglong) mi->rli.max_relay_log_size); + protocol->store((uint32) mi->rli.executed_entries); + } mysql_mutex_unlock(&mi->rli.err_lock); mysql_mutex_unlock(&mi->err_lock); @@ -2299,6 +2321,9 @@ static int cmp_mi_by_name(const Master_info **arg1, @retval FALSE success @retval TRUE failure + + @note + master_info_index is protected by LOCK_active_mi. */ bool show_all_master_info(THD* thd) @@ -2306,8 +2331,9 @@ bool show_all_master_info(THD* thd) uint i, elements; Master_info **tmp; DBUG_ENTER("show_master_info"); + mysql_mutex_assert_owner(&LOCK_active_mi); - if (send_show_master_info_header(thd, active_mi, 1)) + if (send_show_master_info_header(thd, 1)) DBUG_RETURN(TRUE); if (!(elements= master_info_index->master_info_hash.records)) @@ -2973,6 +2999,7 @@ static int exec_relay_log_event(THD* thd, Relay_log_info* rli) mysql_mutex_lock(&rli->data_lock); // because of SHOW STATUS rli->trans_retries++; rli->retried_trans++; + statistic_increment(slave_retried_transactions, LOCK_status); mysql_mutex_unlock(&rli->data_lock); DBUG_PRINT("info", ("Slave retries transaction " "rli->trans_retries: %lu", rli->trans_retries)); @@ -3156,7 +3183,7 @@ pthread_handler_t handle_slave_io(void *arg) mysql_mutex_lock(&LOCK_thread_count); threads.append(thd); mysql_mutex_unlock(&LOCK_thread_count); - mi->slave_running = 1; + mi->slave_running = MYSQL_SLAVE_RUN_NOT_CONNECT; mi->abort_slave = 0; mysql_mutex_unlock(&mi->run_lock); mysql_cond_broadcast(&mi->start_cond); @@ -3468,7 +3495,7 @@ err_during_init: delete thd; mysql_mutex_unlock(&LOCK_thread_count); mi->abort_slave= 0; - mi->slave_running= 0; + mi->slave_running= MYSQL_SLAVE_NOT_RUN; mi->io_thd= 0; /* Note: the order of the two following calls (first broadcast, then unlock) @@ -3573,7 +3600,7 @@ pthread_handler_t handle_slave_sql(void *arg) /* Inform waiting threads that slave has started */ rli->slave_run_id++; - rli->slave_running = 1; + rli->slave_running= MYSQL_SLAVE_RUN_NOT_CONNECT; pthread_detach_this_thread(); if (init_slave_thread(thd, mi, SLAVE_THD_SQL)) @@ -3817,6 +3844,7 @@ the slave SQL thread with \"SLAVE START\". We stopped at log \ } goto err; } + rli->executed_entries++; } /* Thread stopped. Print the current replication position to the log */ @@ -3847,9 +3875,9 @@ the slave SQL thread with \"SLAVE START\". We stopped at log \ err_during_init: /* We need data_lock, at least to wake up any waiting master_pos_wait() */ mysql_mutex_lock(&rli->data_lock); - DBUG_ASSERT(rli->slave_running == 1); // tracking buffer overrun + DBUG_ASSERT(rli->slave_running == MYSQL_SLAVE_RUN_NOT_CONNECT); // tracking buffer overrun /* When master_pos_wait() wakes up it will check this and terminate */ - rli->slave_running= 0; + rli->slave_running= MYSQL_SLAVE_NOT_RUN; /* Forget the relay log's format */ delete rli->relay_log.description_event_for_exec; rli->relay_log.description_event_for_exec= 0; @@ -5635,11 +5663,10 @@ bool rpl_master_has_bug(const Relay_log_info *rli, uint bug_id, bool report, */ bool rpl_master_erroneous_autoinc(THD *thd) { - if (active_mi && active_mi->rli.sql_thd == thd) + if (thd->rli_slave) { - Relay_log_info *rli= &active_mi->rli; DBUG_EXECUTE_IF("simulate_bug33029", return TRUE;); - return rpl_master_has_bug(rli, 33029, FALSE, NULL, NULL); + return rpl_master_has_bug(thd->rli_slave, 33029, FALSE, NULL, NULL); } return FALSE; } diff --git a/sql/sql_class.h b/sql/sql_class.h index 50c99af29d1..dd203af2a1b 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -2201,7 +2201,11 @@ public: /* scramble - random string sent to client on handshake */ char scramble[SCRAMBLE_LENGTH+1]; - LEX_STRING connection_name; /* If slave */ + /* + If this is a slave, the name of the connection stored here. + This is used for taging error messages in the log files. + */ + LEX_STRING connection_name; char default_master_connection_buff[MAX_CONNECTION_NAME+1]; bool slave_thread, one_shot_set; bool extra_port; /* If extra connection */ diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 3c3b9f85727..4372f6dfbfe 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -850,10 +850,10 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list, table->next_number_field=table->found_next_number_field; #ifdef HAVE_REPLICATION - if (thd->slave_thread && + if (thd->rli_slave && (info.handle_duplicates == DUP_UPDATE) && (table->next_number_field != NULL) && - rpl_master_has_bug(&active_mi->rli, 24432, TRUE, NULL, NULL)) + rpl_master_has_bug(thd->rli_slave, 24432, TRUE, NULL, NULL)) goto abort; #endif @@ -3436,10 +3436,10 @@ select_insert::prepare(List<Item> &values, SELECT_LEX_UNIT *u) table->next_number_field=table->found_next_number_field; #ifdef HAVE_REPLICATION - if (thd->slave_thread && + if (thd->rli_slave && (info.handle_duplicates == DUP_UPDATE) && (table->next_number_field != NULL) && - rpl_master_has_bug(&active_mi->rli, 24432, TRUE, NULL, NULL)) + rpl_master_has_bug(thd->rli_slave, 24432, TRUE, NULL, NULL)) DBUG_RETURN(1); #endif diff --git a/sql/sql_lex.h b/sql/sql_lex.h index 7e92fe12dc3..be0c3d8a0df 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -156,7 +156,8 @@ enum enum_sql_command { SQLCOM_FLUSH, SQLCOM_KILL, SQLCOM_ANALYZE, SQLCOM_ROLLBACK, SQLCOM_ROLLBACK_TO_SAVEPOINT, SQLCOM_COMMIT, SQLCOM_SAVEPOINT, SQLCOM_RELEASE_SAVEPOINT, - SQLCOM_SLAVE_START, SQLCOM_SLAVE_STOP, + SQLCOM_SLAVE_START, SQLCOM_SLAVE_ALL_START, + SQLCOM_SLAVE_STOP, SQLCOM_SLAVE_ALL_STOP, SQLCOM_BEGIN, SQLCOM_CHANGE_MASTER, SQLCOM_RENAME_TABLE, SQLCOM_RESET, SQLCOM_PURGE, SQLCOM_PURGE_BEFORE, SQLCOM_SHOW_BINLOGS, diff --git a/sql/sql_load.cc b/sql/sql_load.cc index 98031c96225..e2c744401b9 100644 --- a/sql/sql_load.cc +++ b/sql/sql_load.cc @@ -375,11 +375,11 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list, MY_RETURN_REAL_PATH); } - if (thd->slave_thread) + if (thd->rli_slave) { #if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT) - if (strncmp(active_mi->rli.slave_patternload_file, name, - active_mi->rli.slave_patternload_file_size)) + if (strncmp(thd->rli_slave->slave_patternload_file, name, + thd->rli_slave->slave_patternload_file_size)) { /* LOAD DATA INFILE in the slave SQL Thread can only read from diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 831931e1ef2..60698dde421 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -2708,7 +2708,8 @@ end_with_restore_list: if ((mi= (master_info_index-> get_master_info(&lex_mi->connection_name, MYSQL_ERROR::WARN_LEVEL_ERROR)))) - start_slave(thd, mi, 1 /* net report*/); + if (!start_slave(thd, mi, 1 /* net report*/)) + my_ok(thd); mysql_mutex_unlock(&LOCK_active_mi); break; } @@ -2743,7 +2744,32 @@ end_with_restore_list: if ((mi= (master_info_index-> get_master_info(&lex_mi->connection_name, MYSQL_ERROR::WARN_LEVEL_ERROR)))) - stop_slave(thd, mi, 1/* net report*/); + if (!stop_slave(thd, mi, 1/* net report*/)) + my_ok(thd); + mysql_mutex_unlock(&LOCK_active_mi); + break; + } + case SQLCOM_SLAVE_ALL_START: + { + mysql_mutex_lock(&LOCK_active_mi); + if (!master_info_index->start_all_slaves(thd)) + my_ok(thd); + mysql_mutex_unlock(&LOCK_active_mi); + break; + } + case SQLCOM_SLAVE_ALL_STOP: + { + if (thd->locked_tables_mode || + thd->in_active_multi_stmt_transaction() || + thd->global_read_lock.is_acquired()) + { + my_message(ER_LOCK_OR_ACTIVE_TRANSACTION, + ER(ER_LOCK_OR_ACTIVE_TRANSACTION), MYF(0)); + goto error; + } + mysql_mutex_lock(&LOCK_active_mi); + if (!master_info_index->stop_all_slaves(thd)) + my_ok(thd); mysql_mutex_unlock(&LOCK_active_mi); break; } diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index ed437c498e6..2954e9e1016 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -2151,6 +2151,8 @@ static bool check_prepared_statement(Prepared_statement *stmt) case SQLCOM_FLUSH: case SQLCOM_SLAVE_START: case SQLCOM_SLAVE_STOP: + case SQLCOM_SLAVE_ALL_START: + case SQLCOM_SLAVE_ALL_STOP: case SQLCOM_INSTALL_PLUGIN: case SQLCOM_UNINSTALL_PLUGIN: case SQLCOM_CREATE_DB: diff --git a/sql/sql_reload.cc b/sql/sql_reload.cc index fcb7d15f5ba..21a07a51e49 100644 --- a/sql/sql_reload.cc +++ b/sql/sql_reload.cc @@ -158,10 +158,26 @@ bool reload_acl_and_cache(THD *thd, unsigned long options, if (options & REFRESH_RELAY_LOG) { #ifdef HAVE_REPLICATION + LEX_MASTER_INFO* lex_mi= &thd->lex->mi; + Master_info *mi; + + /* + Writing this command to the binlog may cause problems as the + slave is not likely to have the same connection names. + */ + tmp_write_to_binlog= 0; + mysql_mutex_lock(&LOCK_active_mi); mysql_mutex_lock(&active_mi->data_lock); - if (rotate_relay_log(active_mi)) + if (!(mi= (master_info_index-> + get_master_info(&lex_mi->connection_name, + MYSQL_ERROR::WARN_LEVEL_ERROR)))) + { + result= 1; + } + else if (rotate_relay_log(mi)) *write_to_binlog= -1; mysql_mutex_unlock(&active_mi->data_lock); + mysql_mutex_unlock(&LOCK_active_mi); #endif } #ifdef HAVE_QUERY_CACHE diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index 0238a98f5d0..e18b0cd04c0 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -1297,7 +1297,9 @@ err: @retval 0 success @retval 1 error + @retval -1 fatal error */ + int start_slave(THD* thd , Master_info* mi, bool net_report) { int slave_errno= 0; @@ -1306,15 +1308,17 @@ int start_slave(THD* thd , Master_info* mi, bool net_report) char relay_log_info_file_tmp[FN_REFLEN]; DBUG_ENTER("start_slave"); - create_signed_file_name(master_info_file_tmp, - sizeof(master_info_file_tmp), - master_info_file, 0, &mi->connection_name); - create_signed_file_name(relay_log_info_file_tmp, - sizeof(relay_log_info_file_tmp), - relay_log_info_file, 0, &mi->connection_name); - if (check_access(thd, SUPER_ACL, any_db, NULL, NULL, 0, 0)) - DBUG_RETURN(1); + DBUG_RETURN(-1); + + create_logfile_name_with_suffix(master_info_file_tmp, + sizeof(master_info_file_tmp), + master_info_file, 0, &mi->connection_name); + create_logfile_name_with_suffix(relay_log_info_file_tmp, + sizeof(relay_log_info_file_tmp), + relay_log_info_file, 0, + &mi->connection_name); + lock_slave_threads(mi); // this allows us to cleanly read slave_running // Get a mask of _stopped_ threads init_thread_mask(&thread_mask,mi,1 /* inverse */); @@ -1426,10 +1430,8 @@ int start_slave(THD* thd , Master_info* mi, bool net_report) my_error(slave_errno, MYF(0), (int) mi->connection_name.length, mi->connection_name.str); - DBUG_RETURN(1); + DBUG_RETURN(slave_errno == ER_BAD_SLAVE ? -1 : 1); } - else if (net_report) - my_ok(thd); DBUG_RETURN(0); } @@ -1447,7 +1449,9 @@ int start_slave(THD* thd , Master_info* mi, bool net_report) @retval 0 success @retval 1 error + @retval -1 error */ + int stop_slave(THD* thd, Master_info* mi, bool net_report ) { int slave_errno; @@ -1455,7 +1459,7 @@ int stop_slave(THD* thd, Master_info* mi, bool net_report ) DBUG_PRINT("enter",("Connection: %s", mi->connection_name.str)); if (check_access(thd, SUPER_ACL, any_db, NULL, NULL, 0, 0)) - DBUG_RETURN(1); + DBUG_RETURN(-1); thd_proc_info(thd, "Killing slave"); int thread_mask; lock_slave_threads(mi); @@ -1491,8 +1495,6 @@ int stop_slave(THD* thd, Master_info* mi, bool net_report ) my_message(slave_errno, ER(slave_errno), MYF(0)); DBUG_RETURN(1); } - else if (net_report) - my_ok(thd); DBUG_RETURN(0); } @@ -1524,9 +1526,10 @@ int reset_slave(THD *thd, Master_info* mi) init_thread_mask(&thread_mask,mi,0 /* not inverse */); if (thread_mask) // We refuse if any slave thread is running { - sql_errno= ER_SLAVE_MUST_STOP; - error=1; - goto err; + unlock_slave_threads(mi); + my_error(ER_SLAVE_MUST_STOP, MYF(0), (int) mi->connection_name.length, + mi->connection_name.str); + DBUG_RETURN(ER_SLAVE_MUST_STOP); } ha_reset_slave(thd); @@ -1555,10 +1558,10 @@ int reset_slave(THD *thd, Master_info* mi) end_master_info(mi); // and delete these two files - create_signed_file_name(master_info_file_tmp, + create_logfile_name_with_suffix(master_info_file_tmp, sizeof(master_info_file_tmp), master_info_file, 0, &mi->connection_name); - create_signed_file_name(relay_log_info_file_tmp, + create_logfile_name_with_suffix(relay_log_info_file_tmp, sizeof(relay_log_info_file_tmp), relay_log_info_file, 0, &mi->connection_name); @@ -1688,17 +1691,18 @@ bool change_master(THD* thd, Master_info* mi) init_thread_mask(&thread_mask,mi,0 /*not inverse*/); if (thread_mask) // We refuse if any slave thread is running { - my_message(ER_SLAVE_MUST_STOP, ER(ER_SLAVE_MUST_STOP), MYF(0)); + my_error(ER_SLAVE_MUST_STOP, MYF(0), (int) mi->connection_name.length, + mi->connection_name.str); ret= TRUE; goto err; } thd_proc_info(thd, "Changing master"); - create_signed_file_name(master_info_file_tmp, + create_logfile_name_with_suffix(master_info_file_tmp, sizeof(master_info_file_tmp), master_info_file, 0, &mi->connection_name); - create_signed_file_name(relay_log_info_file_tmp, + create_logfile_name_with_suffix(relay_log_info_file_tmp, sizeof(relay_log_info_file_tmp), relay_log_info_file, 0, &mi->connection_name); diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 8a106b8ec6f..c87538681a2 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -2335,6 +2335,7 @@ static bool show_status_array(THD *thd, const char *wild, for (; variables->name; variables++) { + bool wild_checked; strnmov(prefix_end, variables->name, len); name_buffer[sizeof(name_buffer)-1]=0; /* Safety */ if (ucase_names) @@ -2343,11 +2344,25 @@ static bool show_status_array(THD *thd, const char *wild, restore_record(table, s->default_values); table->field[0]->store(name_buffer, strlen(name_buffer), system_charset_info); + + /* + Compare name for types that can't return arrays. We do this to not + calculate the value for function variables that we will not access + */ + if ((variables->type != SHOW_FUNC && variables->type != SHOW_ARRAY)) + { + if (wild && wild[0] && wild_case_compare(system_charset_info, + name_buffer, wild)) + continue; + wild_checked= 1; // Avoid checking it again + } + /* - if var->type is SHOW_FUNC, call the function. - Repeat as necessary, if new var is again SHOW_FUNC + if var->type is SHOW_FUNC or SHOW_SIMPLE_FUNC, call the function. + Repeat as necessary, if new var is again one of the above */ - for (var=variables; var->type == SHOW_FUNC; var= &tmp) + for (var=variables; var->type == SHOW_FUNC || + var->type == SHOW_SIMPLE_FUNC; var= &tmp) ((mysql_show_var_func)(var->value))(thd, &tmp, buff); SHOW_TYPE show_type=var->type; @@ -2358,8 +2373,9 @@ static bool show_status_array(THD *thd, const char *wild, } else { - if (!(wild && wild[0] && wild_case_compare(system_charset_info, - name_buffer, wild)) && + if ((wild_checked || + (wild && wild[0] && wild_case_compare(system_charset_info, + name_buffer, wild))) && (!partial_cond || partial_cond->val_int())) { char *value=var->value; diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index ab07a2010f0..d7e7695207a 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -1292,6 +1292,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); %token SIGNED_SYM %token SIMPLE_SYM /* SQL-2003-N */ %token SLAVE +%token SLAVES %token SLOW %token SMALLINT /* SQL-2003-R */ %token SNAPSHOT_SYM @@ -7107,6 +7108,13 @@ slave: } slave_until {} + | START_SYM ALL SLAVES slave_thread_opts + { + LEX *lex=Lex; + lex->sql_command = SQLCOM_SLAVE_ALL_START; + lex->type = 0; + } + {} | STOP_SYM SLAVE optional_connection_name slave_thread_opts { LEX *lex=Lex; @@ -7114,6 +7122,13 @@ slave: lex->type = 0; /* If you change this code don't forget to update SLAVE STOP too */ } + | STOP_SYM ALL SLAVES slave_thread_opts + { + LEX *lex=Lex; + lex->sql_command = SQLCOM_SLAVE_ALL_STOP; + lex->type = 0; + /* If you change this code don't forget to update SLAVE STOP too */ + } | SLAVE optional_connection_name START_SYM slave_thread_opts { LEX *lex=Lex; @@ -11582,7 +11597,7 @@ show_param: { Lex->sql_command = SQLCOM_SHOW_MASTER_STAT; } - | FULL SLAVE STATUS_SYM + | ALL SLAVES STATUS_SYM { Lex->sql_command = SQLCOM_SHOW_SLAVE_STAT; Lex->verbose= 1; @@ -11850,7 +11865,7 @@ flush_option: { Lex->type|= REFRESH_SLOW_LOG; } | BINARY LOGS_SYM { Lex->type|= REFRESH_BINARY_LOG; } - | RELAY LOGS_SYM + | RELAY LOGS_SYM optional_connection_name { Lex->type|= REFRESH_RELAY_LOG; } | QUERY_SYM CACHE_SYM { Lex->type|= REFRESH_QUERY_CACHE_FREE; } @@ -13008,6 +13023,7 @@ keyword: | SIGNED_SYM {} | SOCKET_SYM {} | SLAVE {} + | SLAVES {} | SONAME_SYM {} | START_SYM {} | STOP_SYM {} diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index 9421dca5c05..9eacc1c8392 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -2025,50 +2025,22 @@ static Sys_var_mybool Sys_master_verify_checksum( static const char *replicate_events_marked_for_skip_names[]= { "replicate", "filter_on_slave", "filter_on_master", 0 }; -static bool -replicate_events_marked_for_skip_check(sys_var *self, THD *thd, - set_var *var) -{ - int thread_mask; - DBUG_ENTER("sys_var_replicate_events_marked_for_skip_check"); - - /* Slave threads must be stopped to change the variable. */ - mysql_mutex_lock(&LOCK_active_mi); - lock_slave_threads(active_mi); - init_thread_mask(&thread_mask, active_mi, 0 /*not inverse*/); - unlock_slave_threads(active_mi); - mysql_mutex_unlock(&LOCK_active_mi); - if (thread_mask) // We refuse if any slave thread is running - { - my_error(ER_SLAVE_MUST_STOP, MYF(0)); - DBUG_RETURN(true); - } - DBUG_RETURN(false); -} bool Sys_var_replicate_events_marked_for_skip::global_update(THD *thd, set_var *var) { - bool result; - int thread_mask; + bool result= true; // Assume error DBUG_ENTER("Sys_var_replicate_events_marked_for_skip::global_update"); - /* Slave threads must be stopped to change the variable. */ + mysql_mutex_unlock(&LOCK_global_system_variables); mysql_mutex_lock(&LOCK_active_mi); - lock_slave_threads(active_mi); - init_thread_mask(&thread_mask, active_mi, 0 /*not inverse*/); - if (thread_mask) // We refuse if any slave thread is running - { - my_error(ER_SLAVE_MUST_STOP, MYF(0)); - result= true; - } - else + if (!master_info_index->give_error_if_slave_running()) result= Sys_var_enum::global_update(thd, var); - - unlock_slave_threads(active_mi); mysql_mutex_unlock(&LOCK_active_mi); + mysql_mutex_lock(&LOCK_global_system_variables); DBUG_RETURN(result); } + static Sys_var_replicate_events_marked_for_skip Replicate_events_marked_for_skip ("replicate_events_marked_for_skip", "Whether the slave should replicate events that were created with " @@ -2079,8 +2051,7 @@ static Sys_var_replicate_events_marked_for_skip Replicate_events_marked_for_skip "the slave).", GLOBAL_VAR(opt_replicate_events_marked_for_skip), CMD_LINE(REQUIRED_ARG), replicate_events_marked_for_skip_names, DEFAULT(RPL_SKIP_REPLICATE), - NO_MUTEX_GUARD, NOT_IN_BINLOG, - ON_CHECK(replicate_events_marked_for_skip_check)); + NO_MUTEX_GUARD, NOT_IN_BINLOG); #endif @@ -3255,71 +3226,18 @@ static Sys_var_mybool Sys_relay_log_recovery( "processed", GLOBAL_VAR(relay_log_recovery), CMD_LINE(OPT_ARG), DEFAULT(FALSE)); -bool Sys_var_rpl_filter::do_check(THD *thd, set_var *var) -{ - bool status; - - /* - We must not be holding LOCK_global_system_variables here, otherwise we can - deadlock with THD::init() which is invoked from within the slave threads - with opposite locking order. - */ - mysql_mutex_assert_not_owner(&LOCK_global_system_variables); - mysql_mutex_lock(&LOCK_active_mi); - mysql_mutex_lock(&active_mi->rli.run_lock); - - status= active_mi->rli.slave_running; - - mysql_mutex_unlock(&active_mi->rli.run_lock); - mysql_mutex_unlock(&LOCK_active_mi); - - if (status) - my_error(ER_SLAVE_MUST_STOP, MYF(0)); - else - status= Sys_var_charptr::do_string_check(thd, var, charset(thd)); - - return status; -} - -void Sys_var_rpl_filter::lock(void) +bool Sys_var_rpl_filter::global_update(THD *thd, set_var *var) { - /* - Starting a slave thread causes the new thread to attempt to - acquire LOCK_global_system_variables (in THD::init) while - LOCK_active_mi is being held by the thread that initiated - the process. In order to not violate the lock order, unlock - LOCK_global_system_variables before grabbing LOCK_active_mi. - */ - mysql_mutex_unlock(&LOCK_global_system_variables); + bool result= true; // Assume error + mysql_mutex_unlock(&LOCK_global_system_variables); mysql_mutex_lock(&LOCK_active_mi); - mysql_mutex_lock(&active_mi->rli.run_lock); -} - -void Sys_var_rpl_filter::unlock(void) -{ - mysql_mutex_unlock(&active_mi->rli.run_lock); + if (!master_info_index->give_error_if_slave_running()) + result= set_filter_value(var->save_result.string_value.str); mysql_mutex_unlock(&LOCK_active_mi); - mysql_mutex_lock(&LOCK_global_system_variables); -} - -bool Sys_var_rpl_filter::global_update(THD *thd, set_var *var) -{ - bool slave_running, status= false; - - lock(); - - if (! (slave_running= active_mi->rli.slave_running)) - status= set_filter_value(var->save_result.string_value.str); - - if (slave_running) - my_error(ER_SLAVE_MUST_STOP, MYF(0)); - - unlock(); - - return slave_running || status; + return result; } bool Sys_var_rpl_filter::set_filter_value(const char *value) @@ -3357,8 +3275,6 @@ uchar *Sys_var_rpl_filter::global_value_ptr(THD *thd, LEX_STRING *base) tmp.length(0); - lock(); - switch (opt_id) { case OPT_REPLICATE_DO_DB: rpl_filter->get_do_db(&tmp); @@ -3380,8 +3296,6 @@ uchar *Sys_var_rpl_filter::global_value_ptr(THD *thd, LEX_STRING *base) break; } - unlock(); - return (uchar *) thd->strmake(tmp.ptr(), tmp.length()); } @@ -3431,30 +3345,13 @@ static Sys_var_charptr Sys_slave_load_tmpdir( READ_ONLY GLOBAL_VAR(slave_load_tmpdir), CMD_LINE(REQUIRED_ARG), IN_FS_CHARSET, DEFAULT(0)); -static bool fix_slave_net_timeout(sys_var *self, THD *thd, enum_var_type type) -{ - DEBUG_SYNC(thd, "fix_slave_net_timeout"); - - mysql_mutex_unlock(&LOCK_global_system_variables); - mysql_mutex_lock(&LOCK_active_mi); - DBUG_PRINT("info", ("slave_net_timeout: %u mi->heartbeat_period: %.3f", - slave_net_timeout, - (active_mi? active_mi->heartbeat_period : 0.0))); - if (active_mi && slave_net_timeout < active_mi->heartbeat_period) - push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN, - ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE_MAX, - ER(ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE_MAX)); - mysql_mutex_unlock(&LOCK_active_mi); - mysql_mutex_lock(&LOCK_global_system_variables); - return false; -} static Sys_var_uint Sys_slave_net_timeout( "slave_net_timeout", "Number of seconds to wait for more data " - "from a master/slave connection before aborting the read", + "from any master/slave connection before aborting the read", GLOBAL_VAR(slave_net_timeout), CMD_LINE(REQUIRED_ARG), VALID_RANGE(1, LONG_TIMEOUT), DEFAULT(SLAVE_NET_TIMEOUT), BLOCK_SIZE(1), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0), - ON_UPDATE(fix_slave_net_timeout)); + ON_UPDATE(0)); /* @@ -3509,7 +3406,8 @@ static bool update_slave_skip_counter(sys_var *self, THD *thd, Master_info *mi) { if (mi->rli.slave_running) { - my_message(ER_SLAVE_MUST_STOP, ER(ER_SLAVE_MUST_STOP), MYF(0)); + my_error(ER_SLAVE_MUST_STOP, MYF(0), mi->connection_name.length, + mi->connection_name.str); return true; } /* The value was stored temporarly in thd */ diff --git a/sql/sys_vars.h b/sql/sys_vars.h index 8e832e57630..6c46c816105 100644 --- a/sql/sys_vars.h +++ b/sql/sys_vars.h @@ -566,11 +566,13 @@ public: option.var_type= GET_STR; } + bool do_check(THD *thd, set_var *var) + { + return Sys_var_charptr::do_string_check(thd, var, charset(thd)); + } bool check_update_type(Item_result type) { return type != STRING_RESULT; } - bool do_check(THD *thd, set_var *var); - void session_save_default(THD *thd, set_var *var) { DBUG_ASSERT(FALSE); } @@ -588,8 +590,6 @@ public: protected: uchar *global_value_ptr(THD *thd, LEX_STRING *base); bool set_filter_value(const char *value); - void lock(void); - void unlock(void); }; /** @@ -1937,10 +1937,9 @@ public: const char *comment, int flag_args, ptrdiff_t off, size_t size, CMD_LINE getopt, const char *values[], uint def_val, PolyLock *lock, - enum binlog_status_enum binlog_status_arg, - on_check_function on_check_func) + enum binlog_status_enum binlog_status_arg) :Sys_var_enum(name_arg, comment, flag_args, off, size, getopt, - values, def_val, lock, binlog_status_arg, on_check_func) + values, def_val, lock, binlog_status_arg) {} bool global_update(THD *thd, set_var *var); }; diff --git a/storage/example/ha_example.cc b/storage/example/ha_example.cc index 2c65fd657a9..81f6cbe707f 100644 --- a/storage/example/ha_example.cc +++ b/storage/example/ha_example.cc @@ -1097,7 +1097,8 @@ static struct st_mysql_sys_var* example_system_variables[]= { NULL }; -// this is an example of SHOW_FUNC and of my_snprintf() service +// this is an example of SHOW_SIMPLE_FUNC and of my_snprintf() service +// If this function would return an array, one should use SHOW_FUNC static int show_func_example(MYSQL_THD thd, struct st_mysql_show_var *var, char *buf) { @@ -1111,7 +1112,7 @@ static int show_func_example(MYSQL_THD thd, struct st_mysql_show_var *var, static struct st_mysql_show_var func_status[]= { - {"example_func_example", (char *)show_func_example, SHOW_FUNC}, + {"example_func_example", (char *)show_func_example, SHOW_SIMPLE_FUNC}, {0,0,SHOW_UNDEF} }; diff --git a/storage/sphinx/ha_sphinx.cc b/storage/sphinx/ha_sphinx.cc index 27a463bf61f..97e83cd9221 100644 --- a/storage/sphinx/ha_sphinx.cc +++ b/storage/sphinx/ha_sphinx.cc @@ -3591,12 +3591,12 @@ struct st_mysql_storage_engine sphinx_storage_engine = struct st_mysql_show_var sphinx_status_vars[] = { - {"sphinx_total", (char *)sphinx_showfunc_total, SHOW_FUNC}, - {"sphinx_total_found", (char *)sphinx_showfunc_total_found, SHOW_FUNC}, - {"sphinx_time", (char *)sphinx_showfunc_time, SHOW_FUNC}, - {"sphinx_word_count", (char *)sphinx_showfunc_word_count, SHOW_FUNC}, - {"sphinx_words", (char *)sphinx_showfunc_words, SHOW_FUNC}, - {"sphinx_error", (char *)sphinx_showfunc_error, SHOW_FUNC}, + {"sphinx_total", (char *)sphinx_showfunc_total, SHOW_SIMPLE_FUNC}, + {"sphinx_total_found", (char *)sphinx_showfunc_total_found, SHOW_SIMPLE_FUNC}, + {"sphinx_time", (char *)sphinx_showfunc_time, SHOW_SIMPLE_FUNC}, + {"sphinx_word_count", (char *)sphinx_showfunc_word_count, SHOW_SIMPLE_FUNC}, + {"sphinx_words", (char *)sphinx_showfunc_words, SHOW_SIMPLE_FUNC}, + {"sphinx_error", (char *)sphinx_showfunc_error, SHOW_SIMPLE_FUNC}, {0, 0, (enum_mysql_show_type)0} }; diff --git a/storage/xtradb/handler/ha_innodb.cc b/storage/xtradb/handler/ha_innodb.cc index 97a30a81d12..9acda7ed13e 100644 --- a/storage/xtradb/handler/ha_innodb.cc +++ b/storage/xtradb/handler/ha_innodb.cc @@ -3190,7 +3190,9 @@ innobase_commit_low( #ifdef MYSQL_SERVER THD *thd=current_thd; - if (thd && thd_is_replication_slave_thread(thd)) { + if (innobase_overwrite_relay_log_info && + thd && thd_is_replication_slave_thread(thd) && + thd->connection_name.length) { /* Update the replication position info inside InnoDB. In embedded server, does nothing. */ const char *log_file_name, *group_relay_log_name; |