390.1.2
by Monty Taylor
Fixed copyright headers in drizzled/ |
1 |
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
|
2 |
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
|
|
3 |
*
|
|
4 |
* Copyright (C) 2008 Sun Microsystems
|
|
5 |
*
|
|
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.
|
|
9 |
*
|
|
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.
|
|
14 |
*
|
|
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
|
|
18 |
*/
|
|
1
by brian
clean slate |
19 |
|
438.1.11
by Brian Aker
Removed dead HAVE_REPL needs for embedded server. |
20 |
#ifndef DRIZZLED_RPL_MI_H
|
21 |
#define DRIZZLED_RPL_MI_H
|
|
1
by brian
clean slate |
22 |
|
575.4.6
by Monty Taylor
Removed my_getwd. |
23 |
#include <drizzled/replication/rli.h> |
24 |
#include <drizzled/replication/reporting.h> |
|
490
by Brian Aker
More effort around master.info (and relay.info) |
25 |
#include <drizzled/serialize/serialize.h> |
26 |
#include <string> |
|
1
by brian
clean slate |
27 |
|
28 |
||
520.6.7
by Monty Taylor
Moved a bunch of crap out of common_includes. |
29 |
typedef struct st_drizzle DRIZZLE; |
30 |
||
1
by brian
clean slate |
31 |
/*****************************************************************************
|
32 |
||
33 |
Replication IO Thread
|
|
34 |
||
35 |
Master_info contains:
|
|
36 |
- information about how to connect to a master
|
|
37 |
- current master log name
|
|
38 |
- current master log offset
|
|
39 |
- misc control variables
|
|
40 |
||
41 |
Master_info is initialized once from the master.info file if such
|
|
42 |
exists. Otherwise, data members corresponding to master.info fields
|
|
43 |
are initialized with defaults specified by master-* options. The
|
|
44 |
initialization is done through init_master_info() call.
|
|
45 |
||
46 |
The format of master.info file:
|
|
47 |
||
48 |
log_name
|
|
49 |
log_pos
|
|
50 |
master_host
|
|
51 |
master_user
|
|
52 |
master_pass
|
|
53 |
master_port
|
|
54 |
master_connect_retry
|
|
55 |
||
56 |
To write out the contents of master.info file to disk ( needed every
|
|
57 |
time we read and queue data from the master ), a call to
|
|
58 |
flush_master_info() is required.
|
|
59 |
||
60 |
To clean up, call end_master_info()
|
|
61 |
||
62 |
*****************************************************************************/
|
|
63 |
||
64 |
class Master_info : public Slave_reporting_capability |
|
65 |
{
|
|
490
by Brian Aker
More effort around master.info (and relay.info) |
66 |
private: |
67 |
drizzle::MasterList list; |
|
509.1.1
by Monty Taylor
Merged in first pass of sql_bitmap removal. (and some other cleanups.) |
68 |
std::string info_filename; |
69 |
std::string log_name; |
|
494
by Brian Aker
Wrote out master.info (more of it). Add to this more private'izing of |
70 |
uint16_t port; |
496
by Brian Aker
Removed dead code around SHOW commands (I_S exist for collations/charsets) |
71 |
uint64_t log_pos; |
490
by Brian Aker
More effort around master.info (and relay.info) |
72 |
|
73 |
public: |
|
74 |
||
75 |
/* the variables below are needed because we can change masters on the fly */
|
|
509.1.1
by Monty Taylor
Merged in first pass of sql_bitmap removal. (and some other cleanups.) |
76 |
std::string host; |
77 |
std::string user; |
|
78 |
std::string password; |
|
490
by Brian Aker
More effort around master.info (and relay.info) |
79 |
uint32_t connect_retry; |
520.1.22
by Brian Aker
Second pass of thd cleanup |
80 |
Session *io_session; |
1
by brian
clean slate |
81 |
Master_info(); |
82 |
~Master_info(); |
|
83 |
||
494
by Brian Aker
Wrote out master.info (more of it). Add to this more private'izing of |
84 |
pthread_mutex_t data_lock; |
85 |
pthread_mutex_t run_lock; |
|
86 |
pthread_cond_t data_cond; |
|
87 |
pthread_cond_t start_cond; |
|
88 |
pthread_cond_t stop_cond; |
|
206.3.1
by Patrick Galbraith
Most everything working with client rename |
89 |
DRIZZLE *drizzle; |
205
by Brian Aker
uint32 -> uin32_t |
90 |
uint32_t file_id; /* for 3.23 load data infile */ |
1
by brian
clean slate |
91 |
Relay_log_info rli; |
92 |
float heartbeat_period; // interface with CHANGE MASTER or master.info |
|
151
by Brian Aker
Ulonglong to uint64_t |
93 |
uint64_t received_heartbeats; // counter of received heartbeat events |
1
by brian
clean slate |
94 |
int events_till_disconnect; |
95 |
bool inited; |
|
96 |
volatile bool abort_slave; |
|
482
by Brian Aker
Remove uint. |
97 |
volatile uint32_t slave_running; |
130
by Brian Aker
ulong cleanup |
98 |
volatile uint32_t slave_run_id; |
1
by brian
clean slate |
99 |
/*
|
100 |
The difference in seconds between the clock of the master and the clock of
|
|
101 |
the slave (second - first). It must be signed as it may be <0 or >0.
|
|
102 |
clock_diff_with_master is computed when the I/O thread starts; for this the
|
|
103 |
I/O thread does a SELECT UNIX_TIMESTAMP() on the master.
|
|
104 |
"how late the slave is compared to the master" is computed like this:
|
|
105 |
clock_of_slave - last_timestamp_executed_by_SQL_thread - clock_diff_with_master
|
|
106 |
||
107 |
*/
|
|
494
by Brian Aker
Wrote out master.info (more of it). Add to this more private'izing of |
108 |
time_t clock_diff_with_master; |
109 |
int flush(); |
|
490
by Brian Aker
More effort around master.info (and relay.info) |
110 |
void end_master_info(); |
493
by Brian Aker
Simple update to what is written to the master.info file. |
111 |
void reset(); |
490
by Brian Aker
More effort around master.info (and relay.info) |
112 |
|
113 |
int init_master_info(const char* master_info_fname, |
|
114 |
const char* slave_info_fname, |
|
115 |
int thread_mask); |
|
116 |
||
117 |
bool setUsername(const char *username); |
|
118 |
const char *getUsername(); |
|
119 |
||
120 |
bool setPassword(const char *pword); |
|
121 |
const char *getPassword(); |
|
122 |
||
123 |
bool setHost(const char *host, uint16_t new_port); |
|
124 |
const char *getHostname(); |
|
125 |
uint16_t getPort(); |
|
126 |
||
127 |
off_t getLogPosition(); |
|
128 |
bool setLogPosition(off_t position); |
|
494
by Brian Aker
Wrote out master.info (more of it). Add to this more private'izing of |
129 |
void incrementLogPosition(off_t position); |
490
by Brian Aker
More effort around master.info (and relay.info) |
130 |
|
131 |
const char *getLogName(); |
|
132 |
bool setLogName(const char *name); |
|
133 |
||
134 |
uint32_t getConnectionRetry(); |
|
135 |
bool setConnectionRetry(uint32_t log_position); |
|
136 |
||
1
by brian
clean slate |
137 |
};
|
138 |
||
438.1.11
by Brian Aker
Removed dead HAVE_REPL needs for embedded server. |
139 |
#endif /* DRIZZLED_RPL_MI_H */ |