~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/rpl_mi.h

  • Committer: Brian Aker
  • Date: 2008-11-04 15:39:09 UTC
  • mfrom: (575.1.2 devel)
  • Revision ID: brian@tangent.org-20081104153909-c72hn65udxs1ccal
Merge of Monty's work

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright (C) 2000-2003 MySQL AB
2
 
 
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.
6
 
 
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.
11
 
 
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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
15
 
 
16
 
#ifndef RPL_MI_H
17
 
#define RPL_MI_H
18
 
 
19
 
#ifdef HAVE_REPLICATION
 
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
 */
 
19
 
 
20
#ifndef DRIZZLED_RPL_MI_H
 
21
#define DRIZZLED_RPL_MI_H
20
22
 
21
23
#include "rpl_rli.h"
22
24
#include "rpl_reporting.h"
23
 
 
 
25
#include <drizzled/serialize/serialize.h>
 
26
#include <string>
 
27
 
 
28
 
 
29
typedef struct st_drizzle DRIZZLE;
24
30
 
25
31
/*****************************************************************************
26
32
 
57
63
 
58
64
class Master_info : public Slave_reporting_capability
59
65
{
60
 
 public:
 
66
private:
 
67
  drizzle::MasterList list;
 
68
  std::string info_filename;
 
69
  std::string log_name;
 
70
  uint16_t port;
 
71
  uint64_t log_pos;
 
72
 
 
73
public:
 
74
 
 
75
  /* the variables below are needed because we can change masters on the fly */
 
76
  std::string host;
 
77
  std::string user;
 
78
  std::string password;
 
79
  uint32_t connect_retry;
 
80
  Session *io_session;
61
81
  Master_info();
62
82
  ~Master_info();
63
83
 
64
 
  /* the variables below are needed because we can change masters on the fly */
65
 
  char master_log_name[FN_REFLEN];
66
 
  char host[HOSTNAME_LENGTH+1];
67
 
  char user[USERNAME_LENGTH+1];
68
 
  char password[MAX_PASSWORD_LENGTH+1];
69
 
  bool ssl; // enables use of SSL connection if true
70
 
  char ssl_ca[FN_REFLEN], ssl_capath[FN_REFLEN], ssl_cert[FN_REFLEN];
71
 
  char ssl_cipher[FN_REFLEN], ssl_key[FN_REFLEN];
72
 
  bool ssl_verify_server_cert;
73
 
 
74
 
  my_off_t master_log_pos;
75
 
  File fd; // we keep the file open, so we need to remember the file pointer
76
 
  IO_CACHE file;
77
 
 
78
 
  pthread_mutex_t data_lock,run_lock;
79
 
  pthread_cond_t data_cond,start_cond,stop_cond;
80
 
  THD *io_thd;
 
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;
81
89
  DRIZZLE *drizzle;
82
90
  uint32_t file_id;                             /* for 3.23 load data infile */
83
91
  Relay_log_info rli;
84
 
  uint port;
85
 
  uint connect_retry;
86
92
  float heartbeat_period;         // interface with CHANGE MASTER or master.info
87
93
  uint64_t received_heartbeats;  // counter of received heartbeat events
88
94
  int events_till_disconnect;
89
95
  bool inited;
90
96
  volatile bool abort_slave;
91
 
  volatile uint slave_running;
 
97
  volatile uint32_t slave_running;
92
98
  volatile uint32_t slave_run_id;
93
99
  /*
94
100
     The difference in seconds between the clock of the master and the clock of
99
105
     clock_of_slave - last_timestamp_executed_by_SQL_thread - clock_diff_with_master
100
106
 
101
107
  */
102
 
  long clock_diff_with_master;
 
108
  time_t clock_diff_with_master;
 
109
  int flush();
 
110
  void end_master_info();
 
111
  void reset();
 
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);
 
129
  void incrementLogPosition(off_t position);
 
130
 
 
131
  const char *getLogName();
 
132
  bool setLogName(const char *name);
 
133
 
 
134
  uint32_t getConnectionRetry();
 
135
  bool setConnectionRetry(uint32_t log_position);
 
136
 
103
137
};
104
138
 
105
 
void init_master_log_pos(Master_info* mi);
106
 
int init_master_info(Master_info* mi, const char* master_info_fname,
107
 
                     const char* slave_info_fname,
108
 
                     bool abort_if_no_master_info_file,
109
 
                     int thread_mask);
110
 
void end_master_info(Master_info* mi);
111
 
int flush_master_info(Master_info* mi, bool flush_relay_log_cache);
112
 
 
113
 
#endif /* HAVE_REPLICATION */
114
 
#endif /* RPL_MI_H */
 
139
#endif /* DRIZZLED_RPL_MI_H */