mirror of
https://github.com/MariaDB/server.git
synced 2025-07-27 18:02:13 +03:00
Added rpl_status. This is a midway commit to be able to pull so I can save
myself a run of compile-pentium-debug. I have not even tried to compile the new code
This commit is contained in:
@ -82,7 +82,7 @@ mysqld_SOURCES = sql_lex.cc sql_handler.cc \
|
|||||||
sql_udf.cc sql_analyse.cc sql_analyse.h sql_cache.cc \
|
sql_udf.cc sql_analyse.cc sql_analyse.h sql_cache.cc \
|
||||||
slave.cc sql_repl.cc sql_union.cc \
|
slave.cc sql_repl.cc sql_union.cc \
|
||||||
mini_client.cc mini_client_errors.c \
|
mini_client.cc mini_client_errors.c \
|
||||||
stacktrace.c
|
stacktrace.c repl_failsafe.h repl_failsafe.cc
|
||||||
gen_lex_hash_SOURCES = gen_lex_hash.cc
|
gen_lex_hash_SOURCES = gen_lex_hash.cc
|
||||||
gen_lex_hash_LDADD = $(LDADD) $(CXXLDFLAGS)
|
gen_lex_hash_LDADD = $(LDADD) $(CXXLDFLAGS)
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include "sql_acl.h"
|
#include "sql_acl.h"
|
||||||
#include "slave.h"
|
#include "slave.h"
|
||||||
#include "sql_repl.h"
|
#include "sql_repl.h"
|
||||||
|
#include "repl_failsafe.h"
|
||||||
#include "stacktrace.h"
|
#include "stacktrace.h"
|
||||||
#ifdef HAVE_BERKELEY_DB
|
#ifdef HAVE_BERKELEY_DB
|
||||||
#include "ha_berkeley.h"
|
#include "ha_berkeley.h"
|
||||||
@ -1698,6 +1699,7 @@ int main(int argc, char **argv)
|
|||||||
(void) pthread_mutex_init(&LOCK_slave, MY_MUTEX_INIT_FAST);
|
(void) pthread_mutex_init(&LOCK_slave, MY_MUTEX_INIT_FAST);
|
||||||
(void) pthread_mutex_init(&LOCK_server_id, MY_MUTEX_INIT_FAST);
|
(void) pthread_mutex_init(&LOCK_server_id, MY_MUTEX_INIT_FAST);
|
||||||
(void) pthread_mutex_init(&LOCK_user_conn, MY_MUTEX_INIT_FAST);
|
(void) pthread_mutex_init(&LOCK_user_conn, MY_MUTEX_INIT_FAST);
|
||||||
|
(void) pthread_mutex_init(&LOCK_rpl_status, MY_MUTEX_INIT_FAST);
|
||||||
(void) pthread_cond_init(&COND_thread_count,NULL);
|
(void) pthread_cond_init(&COND_thread_count,NULL);
|
||||||
(void) pthread_cond_init(&COND_refresh,NULL);
|
(void) pthread_cond_init(&COND_refresh,NULL);
|
||||||
(void) pthread_cond_init(&COND_thread_cache,NULL);
|
(void) pthread_cond_init(&COND_thread_cache,NULL);
|
||||||
@ -1706,6 +1708,7 @@ int main(int argc, char **argv)
|
|||||||
(void) pthread_cond_init(&COND_binlog_update, NULL);
|
(void) pthread_cond_init(&COND_binlog_update, NULL);
|
||||||
(void) pthread_cond_init(&COND_slave_stopped, NULL);
|
(void) pthread_cond_init(&COND_slave_stopped, NULL);
|
||||||
(void) pthread_cond_init(&COND_slave_start, NULL);
|
(void) pthread_cond_init(&COND_slave_start, NULL);
|
||||||
|
(void) pthread_cond_init(&COND_rpl_status, NULL);
|
||||||
init_signals();
|
init_signals();
|
||||||
|
|
||||||
if (set_default_charset_by_name(default_charset, MYF(MY_WME)))
|
if (set_default_charset_by_name(default_charset, MYF(MY_WME)))
|
||||||
@ -2652,6 +2655,7 @@ static struct option long_options[] = {
|
|||||||
{"gemini-recovery", required_argument, 0, (int) OPT_GEMINI_RECOVER},
|
{"gemini-recovery", required_argument, 0, (int) OPT_GEMINI_RECOVER},
|
||||||
{"gemini-unbuffered-io", no_argument, 0, (int) OPT_GEMINI_UNBUFFERED_IO},
|
{"gemini-unbuffered-io", no_argument, 0, (int) OPT_GEMINI_UNBUFFERED_IO},
|
||||||
#endif
|
#endif
|
||||||
|
{"init-rpl-role", required_argument, 0, (int) OPT_INIT_RPL_ROLE},
|
||||||
/* We must always support this option to make scripts like mysqltest easier
|
/* We must always support this option to make scripts like mysqltest easier
|
||||||
to do */
|
to do */
|
||||||
{"innodb_data_file_path", required_argument, 0,
|
{"innodb_data_file_path", required_argument, 0,
|
||||||
@ -3101,6 +3105,8 @@ struct show_var_st status_vars[]= {
|
|||||||
{"Open_streams", (char*) &my_stream_opened, SHOW_INT_CONST},
|
{"Open_streams", (char*) &my_stream_opened, SHOW_INT_CONST},
|
||||||
{"Opened_tables", (char*) &opened_tables, SHOW_LONG},
|
{"Opened_tables", (char*) &opened_tables, SHOW_LONG},
|
||||||
{"Questions", (char*) 0, SHOW_QUESTION},
|
{"Questions", (char*) 0, SHOW_QUESTION},
|
||||||
|
{"Rpl_status", (char*) 0,
|
||||||
|
SHOW_RPL_STATUS},
|
||||||
{"Select_full_join", (char*) &select_full_join_count, SHOW_LONG},
|
{"Select_full_join", (char*) &select_full_join_count, SHOW_LONG},
|
||||||
{"Select_full_range_join", (char*) &select_full_range_join_count, SHOW_LONG},
|
{"Select_full_range_join", (char*) &select_full_range_join_count, SHOW_LONG},
|
||||||
{"Select_range", (char*) &select_range_count, SHOW_LONG},
|
{"Select_range", (char*) &select_range_count, SHOW_LONG},
|
||||||
@ -3548,6 +3554,17 @@ static void get_options(int argc,char **argv)
|
|||||||
opt_log_slave_updates = 1;
|
opt_log_slave_updates = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case (int) OPT_INIT_RPL_ROLE:
|
||||||
|
{
|
||||||
|
int role;
|
||||||
|
if ((role=find_type(optarg, &rpl_role_typelib, 2)) <= 0)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "Unknown replication role: %s\n", optarg);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
rpl_status = (rpl_role == 1) ? RPL_AUTH_MASTER : RPL_IDLE_SLAVE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
case (int)OPT_REPLICATE_IGNORE_DB:
|
case (int)OPT_REPLICATE_IGNORE_DB:
|
||||||
{
|
{
|
||||||
i_string *db = new i_string(optarg);
|
i_string *db = new i_string(optarg);
|
||||||
|
36
sql/repl_failsafe.cc
Normal file
36
sql/repl_failsafe.cc
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB & Sasha
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||||
|
|
||||||
|
// Sasha Pachev <sasha@mysql.com> is currently in charge of this file
|
||||||
|
|
||||||
|
#include "mysql_priv.h"
|
||||||
|
#include "repl_failsafe.h"
|
||||||
|
|
||||||
|
RPL_STATUS rpl_status=RPL_NULL;
|
||||||
|
pthread_mutex_t LOCK_rpl_status;
|
||||||
|
pthread_cond_t COND_rpl_status;
|
||||||
|
|
||||||
|
const char *rpl_role_type[] = {"","MASTER","SLAVE",NullS};
|
||||||
|
TYPELIB rpl_role_typelib = {array_elements(rpl_role_type)-4,"",
|
||||||
|
rpl_role_type+1};
|
||||||
|
|
||||||
|
const char* rpl_status_type[] = {"AUTH_MASTER","ACTIVE_SLAVE","IDLE_SLAVE",
|
||||||
|
"LOST_SOLDIER","TROOP_SOLDIER",
|
||||||
|
"RECOVERY_CAPTAIN","NULL",NullS};
|
||||||
|
TYPELIB rpl_status_typelib= {array_elements(rpl_status_type)-1,"",
|
||||||
|
rpl_status_type};
|
||||||
|
|
||||||
|
|
13
sql/repl_failsafe.h
Normal file
13
sql/repl_failsafe.h
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
#ifndef REPL_FAILSAFE_H
|
||||||
|
#define REPL_FAILSAFE_H
|
||||||
|
|
||||||
|
typedef enum {RPL_AUTH_MASTER=0,RPL_ACTIVE_SLAVE,RPL_IDLE_SLAVE,
|
||||||
|
RPL_LOST_SOLDIER,RPL_TROOP_SOLDIER,
|
||||||
|
RPL_RECOVERY_CAPTAIN,RPL_NULL} RPL_STATUS;
|
||||||
|
extern RPL_STATUS rpl_status;
|
||||||
|
|
||||||
|
extern pthread_mutex_t LOCK_rpl_status;
|
||||||
|
extern pthread_cond_t COND_rpl_status;
|
||||||
|
extern TYPELIB rpl_role_typelib, rpl_status_typelib;
|
||||||
|
extern char* rpl_role_type[], *rpl_status_type;
|
||||||
|
#endif
|
@ -1164,6 +1164,9 @@ int mysqld_show(THD *thd, const char *wild, show_var_st *variables)
|
|||||||
case SHOW_QUESTION:
|
case SHOW_QUESTION:
|
||||||
net_store_data(&packet2,(uint32) thd->query_id);
|
net_store_data(&packet2,(uint32) thd->query_id);
|
||||||
break;
|
break;
|
||||||
|
case SHOW_RPL_STATUS:
|
||||||
|
net_store_data(&packet2, rpl_status_type[(int)rpl_status]);
|
||||||
|
break;
|
||||||
case SHOW_OPENTABLES:
|
case SHOW_OPENTABLES:
|
||||||
net_store_data(&packet2,(uint32) cached_tables());
|
net_store_data(&packet2,(uint32) cached_tables());
|
||||||
break;
|
break;
|
||||||
|
@ -140,6 +140,7 @@ enum SHOW_TYPE { SHOW_LONG,SHOW_CHAR,SHOW_INT,SHOW_CHAR_PTR,SHOW_BOOL,
|
|||||||
,SHOW_SSL_CTX_SESS_TIMEOUTS, SHOW_SSL_CTX_SESS_CACHE_FULL
|
,SHOW_SSL_CTX_SESS_TIMEOUTS, SHOW_SSL_CTX_SESS_CACHE_FULL
|
||||||
,SHOW_SSL_GET_CIPHER_LIST
|
,SHOW_SSL_GET_CIPHER_LIST
|
||||||
#endif /* HAVE_OPENSSL */
|
#endif /* HAVE_OPENSSL */
|
||||||
|
,SHOW_RPL_STATUS
|
||||||
};
|
};
|
||||||
|
|
||||||
enum SHOW_COMP_OPTION { SHOW_OPTION_YES, SHOW_OPTION_NO, SHOW_OPTION_DISABLED};
|
enum SHOW_COMP_OPTION { SHOW_OPTION_YES, SHOW_OPTION_NO, SHOW_OPTION_DISABLED};
|
||||||
|
Reference in New Issue
Block a user