1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
4
* Copyright (C) 2008 Sun Microsystems
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; version 2 of the License.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20
#ifndef DRIZZLED_RPL_MI_H
21
#define DRIZZLED_RPL_MI_H
24
#include "rpl_reporting.h"
25
#include <drizzled/serialize/serialize.h>
29
/*****************************************************************************
34
- information about how to connect to a master
35
- current master log name
36
- current master log offset
37
- misc control variables
39
Master_info is initialized once from the master.info file if such
40
exists. Otherwise, data members corresponding to master.info fields
41
are initialized with defaults specified by master-* options. The
42
initialization is done through init_master_info() call.
44
The format of master.info file:
54
To write out the contents of master.info file to disk ( needed every
55
time we read and queue data from the master ), a call to
56
flush_master_info() is required.
58
To clean up, call end_master_info()
60
*****************************************************************************/
62
class Master_info : public Slave_reporting_capability
65
drizzle::MasterList list;
66
std::string info_filename;
73
/* the variables below are needed because we can change masters on the fly */
77
uint32_t connect_retry;
82
pthread_mutex_t data_lock;
83
pthread_mutex_t run_lock;
84
pthread_cond_t data_cond;
85
pthread_cond_t start_cond;
86
pthread_cond_t stop_cond;
88
uint32_t file_id; /* for 3.23 load data infile */
90
float heartbeat_period; // interface with CHANGE MASTER or master.info
91
uint64_t received_heartbeats; // counter of received heartbeat events
92
int events_till_disconnect;
94
volatile bool abort_slave;
95
volatile uint32_t slave_running;
96
volatile uint32_t slave_run_id;
98
The difference in seconds between the clock of the master and the clock of
99
the slave (second - first). It must be signed as it may be <0 or >0.
100
clock_diff_with_master is computed when the I/O thread starts; for this the
101
I/O thread does a SELECT UNIX_TIMESTAMP() on the master.
102
"how late the slave is compared to the master" is computed like this:
103
clock_of_slave - last_timestamp_executed_by_SQL_thread - clock_diff_with_master
106
time_t clock_diff_with_master;
108
void end_master_info();
111
int init_master_info(const char* master_info_fname,
112
const char* slave_info_fname,
115
bool setUsername(const char *username);
116
const char *getUsername();
118
bool setPassword(const char *pword);
119
const char *getPassword();
121
bool setHost(const char *host, uint16_t new_port);
122
const char *getHostname();
125
off_t getLogPosition();
126
bool setLogPosition(off_t position);
127
void incrementLogPosition(off_t position);
129
const char *getLogName();
130
bool setLogName(const char *name);
132
uint32_t getConnectionRetry();
133
bool setConnectionRetry(uint32_t log_position);
137
#endif /* DRIZZLED_RPL_MI_H */