From: sasha Date: October 10 2001 2:56am Subject: bk commit into 4.0 tree List-Archive: http://lists.mysql.com/internals/1991 Message-Id: <200110100256.f9A2uQ315055@mysql.sashanet.com> Below is the list of changes that have just been committed into a 4.0 repository of sasha. When sasha does a push, they will be propogated to the main repository and within 24 hours after the push to the public repository. For information on how to access the public repository see http://www.mysql.com/doc/I/n/Installing_source_tree.html ChangeSet@stripped, 2001-10-09 20:56:24-06:00, sasha@stripped 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 sql/repl_failsafe.h 1.1 01/10/09 20:56:24 sasha@stripped +13 -0 sql/repl_failsafe.cc 1.1 01/10/09 20:56:23 sasha@stripped +36 -0 sql/repl_failsafe.h 1.0 01/10/09 20:56:24 sasha@stripped +0 -0 BitKeeper file /home/sasha/src/bk/mysql-4.0/sql/repl_failsafe.h sql/Makefile.am 1.60 01/10/09 20:56:23 sasha@stripped +1 -1 added repl_failsafe.* sql/mysqld.cc 1.233 01/10/09 20:56:23 sasha@stripped +17 -0 added Rpl_status sql/repl_failsafe.cc 1.0 01/10/09 20:56:23 sasha@stripped +0 -0 BitKeeper file /home/sasha/src/bk/mysql-4.0/sql/repl_failsafe.cc sql/sql_show.cc 1.70 01/10/09 20:56:23 sasha@stripped +3 -0 added rpl_status sql/structs.h 1.13 01/10/09 20:56:23 sasha@stripped +1 -0 rpl_status # This is a BitKeeper patch. What follows are the unified diffs for the # set of deltas contained in the patch. The rest of the patch, the part # that BitKeeper cares about, is below these diffs. # User: sasha # Host: mysql.sashanet.com # Root: /home/sasha/src/bk/mysql-4.0 --- 1.59/sql/Makefile.am Sun Oct 7 20:00:05 2001 +++ 1.60/sql/Makefile.am Tue Oct 9 20:56:23 2001 @@ -82,7 +82,7 @@ sql_udf.cc sql_analyse.cc sql_analyse.h sql_cache.cc \ slave.cc sql_repl.cc sql_union.cc \ 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_LDADD = $(LDADD) $(CXXLDFLAGS) --- 1.232/sql/mysqld.cc Mon Oct 8 13:49:45 2001 +++ 1.233/sql/mysqld.cc Tue Oct 9 20:56:23 2001 @@ -21,6 +21,7 @@ #include "sql_acl.h" #include "slave.h" #include "sql_repl.h" +#include "repl_failsafe.h" #include "stacktrace.h" #ifdef HAVE_BERKELEY_DB #include "ha_berkeley.h" @@ -1698,6 +1699,7 @@ (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_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_refresh,NULL); (void) pthread_cond_init(&COND_thread_cache,NULL); @@ -1706,6 +1708,7 @@ (void) pthread_cond_init(&COND_binlog_update, NULL); (void) pthread_cond_init(&COND_slave_stopped, NULL); (void) pthread_cond_init(&COND_slave_start, NULL); + (void) pthread_cond_init(&COND_rpl_status, NULL); init_signals(); if (set_default_charset_by_name(default_charset, MYF(MY_WME))) @@ -2652,6 +2655,7 @@ {"gemini-recovery", required_argument, 0, (int) OPT_GEMINI_RECOVER}, {"gemini-unbuffered-io", no_argument, 0, (int) OPT_GEMINI_UNBUFFERED_IO}, #endif + {"init-rpl-role", required_argument, 0, (int) OPT_INIT_RPL_ROLE}, /* We must always support this option to make scripts like mysqltest easier to do */ {"innodb_data_file_path", required_argument, 0, @@ -3101,6 +3105,8 @@ {"Open_streams", (char*) &my_stream_opened, SHOW_INT_CONST}, {"Opened_tables", (char*) &opened_tables, SHOW_LONG}, {"Questions", (char*) 0, SHOW_QUESTION}, + {"Rpl_status", (char*) 0, + SHOW_RPL_STATUS}, {"Select_full_join", (char*) &select_full_join_count, SHOW_LONG}, {"Select_full_range_join", (char*) &select_full_range_join_count, SHOW_LONG}, {"Select_range", (char*) &select_range_count, SHOW_LONG}, @@ -3548,6 +3554,17 @@ opt_log_slave_updates = 1; 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: { i_string *db = new i_string(optarg); --- 1.69/sql/sql_show.cc Mon Oct 8 14:20:18 2001 +++ 1.70/sql/sql_show.cc Tue Oct 9 20:56:23 2001 @@ -1164,6 +1164,9 @@ case SHOW_QUESTION: net_store_data(&packet2,(uint32) thd->query_id); break; + case SHOW_RPL_STATUS: + net_store_data(&packet2, rpl_status_type[(int)rpl_status]); + break; case SHOW_OPENTABLES: net_store_data(&packet2,(uint32) cached_tables()); break; --- 1.12/sql/structs.h Sat Sep 29 20:47:29 2001 +++ 1.13/sql/structs.h Tue Oct 9 20:56:23 2001 @@ -140,6 +140,7 @@ ,SHOW_SSL_CTX_SESS_TIMEOUTS, SHOW_SSL_CTX_SESS_CACHE_FULL ,SHOW_SSL_GET_CIPHER_LIST #endif /* HAVE_OPENSSL */ + ,SHOW_RPL_STATUS }; enum SHOW_COMP_OPTION { SHOW_OPTION_YES, SHOW_OPTION_NO, SHOW_OPTION_DISABLED}; --- New file --- +++ sql/repl_failsafe.cc 01/10/09 20:56:23 /* 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 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}; --- New file --- +++ sql/repl_failsafe.h 01/10/09 20:56:24 #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