1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Changed SHOW_FUNC variabels that don't return SHOW_ARRAY to SHOW_SIMPLE_FUNC.

This allows us to avoid calculating variables (including those involving mutex) that doesn't match the given
wildcard in SHOW STATUS LIKE '...'
Removed all references to active_mi that could cause problems for multi-source replication.

Added START|STOP ALL SLAVES
Added SHOW ALL SLAVES STATUS


include/mysql/plugin.h:
  Added SHOW_SIMPLE_FUNC
include/mysql/plugin_audit.h.pp:
  Updated .pp file
include/mysql/plugin_auth.h.pp:
  Updated .pp file
include/mysql/plugin_ftparser.h.pp:
  Updated .pp file
mysql-test/suite/multi_source/info_logs.result:
  New columns in SHOW ALL SLAVES STATUS
mysql-test/suite/multi_source/info_logs.test:
  Test new syntax
mysql-test/suite/multi_source/simple.result:
  New columns in SHOW ALL SLAVES STATUS
mysql-test/suite/multi_source/simple.test:
  test new syntax
mysql-test/suite/multi_source/syntax.result:
  Updated result
mysql-test/suite/multi_source/syntax.test:
  Test new syntax
mysql-test/suite/rpl/r/rpl_skip_replication.result:
  Updated result
plugin/semisync/semisync_master_plugin.cc:
  SHOW_FUNC -> SHOW_SIMPLE_FUNC
sql/item_create.cc:
  Simplify code
sql/lex.h:
  Added SLAVES keyword
sql/log.cc:
  Constant -> define
sql/log_event.cc:
  Added comment
sql/mysqld.cc:
  SHOW_FUNC -> SHOW_SIMPLE_FUNC
  Made slave_retried_trans, slave_received_heartbeats and heartbeat_period multi-source safe
  Clear variable denied_connections and slave_retried_transactions on startup
sql/mysqld.h:
  Added slave_retried_transactions
sql/rpl_mi.cc:
  create_signed_file_name -> create_logfile_name_with_suffix
  Added start_all_slaves() and stop_all_slaves()
sql/rpl_mi.h:
  Added prototypes
sql/rpl_rli.cc:
  create_signed_file_name -> create_logfile_name_with_suffix
  added executed_entries
sql/rpl_rli.h:
  Added executed_entries
sql/share/errmsg-utf8.txt:
  More and better error messages
sql/slave.cc:
  Added more fields to SHOW ALL SLAVES STATUS
  Added slave_retried_transactions
  Changed constants -> defines
sql/sql_class.h:
  Added comment
sql/sql_insert.cc:
  active_mi.rli -> thd->rli_slave
sql/sql_lex.h:
  Added SQLCOM_SLAVE_ALL_START & SQLCOM_SLAVE_ALL_STOP
sql/sql_load.cc:
  active_mi.rli -> thd->rli_slave
sql/sql_parse.cc:
  Added START|STOP ALL SLAVES
sql/sql_prepare.cc:
  Added SQLCOM_SLAVE_ALL_START & SQLCOM_SLAVE_ALL_STOP
sql/sql_reload.cc:
  Made REFRESH RELAY LOG multi-source safe
sql/sql_repl.cc:
  create_signed_file_name -> create_logfile_name_with_suffix
  Don't send my_ok() from start_slave() or stop_slave() so that we can call it for all master connections
sql/sql_show.cc:
  Compare wild cards early for all variables
sql/sql_yacc.yy:
  Added START|STOP ALL SLAVES
  Added SHOW ALL SLAVES STATUS
sql/sys_vars.cc:
  Made replicate_events_marked_for_skip,slave_net_timeout and rpl_filter multi-source safe.
sql/sys_vars.h:
  Simplify Sys_var_rpl_filter
This commit is contained in:
Michael Widenius
2012-10-03 01:44:54 +03:00
parent 8ac1b41cf3
commit 572560f38c
49 changed files with 532 additions and 469 deletions

View File

@ -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);