2004-09-09 03:26:19 +02:00
|
|
|
/* 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 */
|
|
|
|
|
2003-01-15 09:11:44 +01:00
|
|
|
#ifdef HAVE_REPLICATION
|
2000-11-11 22:50:39 +01:00
|
|
|
#include "slave.h"
|
|
|
|
|
2001-05-31 02:50:56 +02:00
|
|
|
typedef struct st_slave_info
|
|
|
|
{
|
|
|
|
uint32 server_id;
|
2001-10-23 21:28:03 +02:00
|
|
|
uint32 rpl_recovery_rank, master_id;
|
2001-05-31 02:50:56 +02:00
|
|
|
char host[HOSTNAME_LENGTH+1];
|
|
|
|
char user[USERNAME_LENGTH+1];
|
2003-07-04 02:18:15 +02:00
|
|
|
char password[MAX_PASSWORD_LENGTH+1];
|
2001-05-31 02:50:56 +02:00
|
|
|
uint16 port;
|
2001-10-12 17:37:25 +02:00
|
|
|
THD* thd;
|
2001-05-31 02:50:56 +02:00
|
|
|
} SLAVE_INFO;
|
|
|
|
|
2004-01-18 17:51:20 +01:00
|
|
|
extern my_bool opt_show_slave_auth_info;
|
2002-09-05 15:17:08 +02:00
|
|
|
extern char *master_host, *master_info_file;
|
2000-12-08 20:50:57 +01:00
|
|
|
extern bool server_id_supplied;
|
2000-10-02 05:28:21 +02:00
|
|
|
extern I_List<i_string> binlog_do_db, binlog_ignore_db;
|
|
|
|
|
2001-06-29 02:22:29 +02:00
|
|
|
extern int max_binlog_dump_events;
|
2002-08-22 15:50:58 +02:00
|
|
|
extern my_bool opt_sporadic_binlog_dump_fail;
|
2001-06-29 02:22:29 +02:00
|
|
|
|
2003-03-31 10:39:46 +02:00
|
|
|
#define KICK_SLAVE(thd) { pthread_mutex_lock(&(thd)->LOCK_delete); (thd)->awake(THD::NOT_KILLED); pthread_mutex_unlock(&(thd)->LOCK_delete); }
|
2001-11-11 06:24:12 +01:00
|
|
|
|
2001-04-25 01:39:26 +02:00
|
|
|
File open_binlog(IO_CACHE *log, const char *log_file_name,
|
2002-06-11 10:20:31 +02:00
|
|
|
const char **errmsg);
|
2001-04-25 01:39:26 +02:00
|
|
|
|
2002-01-20 03:16:52 +01:00
|
|
|
int start_slave(THD* thd, MASTER_INFO* mi, bool net_report);
|
|
|
|
int stop_slave(THD* thd, MASTER_INFO* mi, bool net_report);
|
2004-10-20 03:04:37 +02:00
|
|
|
bool change_master(THD* thd, MASTER_INFO* mi);
|
|
|
|
bool show_binlog_events(THD* thd);
|
2001-07-05 01:14:31 +02:00
|
|
|
int cmp_master_pos(const char* log_file_name1, ulonglong log_pos1,
|
|
|
|
const char* log_file_name2, ulonglong log_pos2);
|
2002-08-08 02:12:02 +02:00
|
|
|
int reset_slave(THD *thd, MASTER_INFO* mi);
|
2002-01-20 03:16:52 +01:00
|
|
|
int reset_master(THD* thd);
|
2004-10-20 03:04:37 +02:00
|
|
|
bool purge_master_logs(THD* thd, const char* to_log);
|
|
|
|
bool purge_master_logs_before_date(THD* thd, time_t purge_time);
|
2000-10-27 06:11:55 +02:00
|
|
|
bool log_in_use(const char* log_name);
|
|
|
|
void adjust_linfo_offsets(my_off_t purge_offset);
|
2004-10-20 03:04:37 +02:00
|
|
|
bool show_binlogs(THD* thd);
|
2000-10-02 05:28:21 +02:00
|
|
|
extern int init_master_info(MASTER_INFO* mi);
|
|
|
|
void kill_zombie_dump_threads(uint32 slave_server_id);
|
2002-01-20 03:16:52 +01:00
|
|
|
int check_binlog_magic(IO_CACHE* log, const char** errmsg);
|
2000-10-02 05:28:21 +02:00
|
|
|
|
2001-08-03 23:57:53 +02:00
|
|
|
typedef struct st_load_file_info
|
|
|
|
{
|
|
|
|
THD* thd;
|
2002-11-07 03:02:37 +01:00
|
|
|
my_off_t last_pos_in_file;
|
2001-08-03 23:57:53 +02:00
|
|
|
sql_exchange* ex;
|
|
|
|
List <Item> *fields;
|
|
|
|
enum enum_duplicates handle_dup;
|
|
|
|
char* db;
|
|
|
|
char* table_name;
|
2004-12-31 11:04:35 +01:00
|
|
|
bool wrote_create_file, log_delayed, ignore;
|
2001-08-03 23:57:53 +02:00
|
|
|
} LOAD_FILE_INFO;
|
|
|
|
|
|
|
|
int log_loaded_block(IO_CACHE* file);
|
2002-12-16 14:33:29 +01:00
|
|
|
|
2003-01-15 09:11:44 +01:00
|
|
|
#endif /* HAVE_REPLICATION */
|
2002-12-16 14:33:29 +01:00
|
|
|
|