1
/* Copyright (C) 2006 MySQL AB
3
This program is free software; you can redistribute it and/or modify
4
it under the terms of the GNU General Public License as published by
5
the Free Software Foundation; version 2 of the License.
7
This program is distributed in the hope that it will be useful,
8
but WITHOUT ANY WARRANTY; without even the implied warranty of
9
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
GNU General Public License for more details.
12
You should have received a copy of the GNU General Public License
13
along with this program; if not, write to the Free Software
14
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
17
#ifndef SEMISYNC_SLAVE_H
18
#define SEMISYNC_SLAVE_H
23
The extension class for the slave of semi-synchronous replication
25
class ReplSemiSyncSlave
26
:public ReplSemiSyncBase {
29
:slave_enabled_(false)
31
~ReplSemiSyncSlave() {}
33
void setTraceLevel(unsigned long trace_level) {
34
trace_level_ = trace_level;
37
/* Initialize this class after MySQL parameters are initialized. this
38
* function should be called once at bootstrap time.
42
bool getSlaveEnabled() {
43
return slave_enabled_;
45
void setSlaveEnabled(bool enabled) {
46
slave_enabled_ = enabled;
49
/* A slave reads the semi-sync packet header and separate the metadata
50
* from the payload data.
53
* header - (IN) packet header pointer
54
* total_len - (IN) total packet length: metadata + payload
55
* need_reply - (IN) whether the master is waiting for the reply
56
* payload - (IN) payload: the replication event
57
* payload_len - (IN) payload length
60
* 0: success; -1 or otherwise: error
62
int slaveReadSyncHeader(const char *header, unsigned long total_len, bool *need_reply,
63
const char **payload, unsigned long *payload_len);
65
/* A slave replies to the master indicating its replication process. It
66
* indicates that the slave has received all events before the specified
70
* mysql - (IN) the mysql network connection
71
* binlog_filename - (IN) the reply point's binlog file name
72
* binlog_filepos - (IN) the reply point's binlog file offset
75
* 0: success; -1 or otherwise: error
77
/* int slaveReply(MYSQL *mysql, const char *binlog_filename, */
78
/* my_off_t binlog_filepos); */
80
int slaveReply(const char *log_name, my_off_t log_pos);
82
int slaveStart(Binlog_relay_IO_param *param);
83
int slaveStop(Binlog_relay_IO_param *param);
86
/* True when initObject has been called */
88
bool slave_enabled_; /* semi-sycn is enabled on the slave */
89
MYSQL *mysql; /* connection to send reply */
93
extern bool semi_sync_need_reply;
95
extern char rpl_semi_sync_slave_enabled;
96
extern unsigned long rpl_semi_sync_slave_trace_level;
97
extern unsigned long rpl_semi_sync_slave_status;
99
#endif /* SEMISYNC_SLAVE_H */