~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to server/rpl_rli.h

  • Committer: Brian Aker
  • Date: 2008-07-13 21:20:24 UTC
  • Revision ID: brian@tangent.org-20080713212024-o6263c1vha7yxdeu
More bool removal. More cow bell!

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
/* Copyright (C) 2005 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 */
19
15
 
20
16
#ifndef RPL_RLI_H
21
17
#define RPL_RLI_H
22
18
 
23
 
#include <string>
24
19
#include "rpl_tblmap.h"
25
20
#include "rpl_reporting.h"
26
21
#include "rpl_utility.h"
27
22
 
28
 
struct RPL_TableList;
 
23
struct RPL_TABLE_LIST;
29
24
class Master_info;
30
25
 
31
26
/****************************************************************************
97
92
    Protected with internal locks.
98
93
    Must get data_lock when resetting the logs.
99
94
  */
100
 
  DRIZZLE_BIN_LOG relay_log;
 
95
  MYSQL_BIN_LOG relay_log;
101
96
  LOG_INFO linfo;
102
97
  IO_CACHE cache_buf,*cur_log;
103
98
 
111
106
    created temporary tables. Modified only on init/end and by the SQL
112
107
    thread, read only by SQL thread.
113
108
  */
114
 
  Table *save_temporary_tables;
 
109
  TABLE *save_temporary_tables;
115
110
 
116
111
  /*
117
112
    standard lock acquistion order to avoid deadlocks:
133
128
    Needed to deal properly with cur_log getting closed and re-opened with
134
129
    a different log under our feet
135
130
  */
136
 
  uint32_t cur_log_old_open_count;
 
131
  uint32 cur_log_old_open_count;
137
132
  
138
133
  /*
139
134
    Let's call a group (of events) :
153
148
    happen when, for example, the relay log gets rotated because of
154
149
    max_binlog_size.
155
150
  */
156
 
  std::string group_relay_log_name;
 
151
  char group_relay_log_name[FN_REFLEN];
157
152
  uint64_t group_relay_log_pos;
158
 
  std::string event_relay_log_name;
 
153
  char event_relay_log_name[FN_REFLEN];
159
154
  uint64_t event_relay_log_pos;
160
155
  uint64_t future_event_relay_log_pos;
161
156
 
170
165
     binlog the log_pos that comes with each event is the position of the
171
166
     beginning of the group.
172
167
  */
173
 
  std::string group_master_log_name;
 
168
  char group_master_log_name[FN_REFLEN];
174
169
  volatile my_off_t group_master_log_pos;
175
170
 
176
171
  /*
199
194
    skipping one or more events in the master log that have caused
200
195
    errors, and have been manually applied by DBA already.
201
196
  */
202
 
  volatile uint32_t slave_skip_counter;
 
197
  volatile uint32 slave_skip_counter;
203
198
  volatile uint32_t abort_pos_wait;     /* Incremented on change master */
204
199
  volatile uint32_t slave_run_id;               /* Incremented on slave start */
205
200
  pthread_mutex_t log_space_lock;
238
233
    UNTIL_LOG_NAMES_CMP_EQUAL= 0, UNTIL_LOG_NAMES_CMP_GREATER= 1
239
234
  } until_log_names_cmp_result;
240
235
 
 
236
  char cached_charset[6];
241
237
  /*
242
238
    trans_retries varies between 0 to slave_transaction_retries and counts how
243
239
    many times the slave has retried the present transaction; gets reset to 0
289
285
  void inc_group_relay_log_pos(uint64_t log_pos,
290
286
                               bool skip_lock=0);
291
287
 
292
 
  int32_t wait_for_pos(THD* thd, String* log_name, int64_t log_pos, 
293
 
                   int64_t timeout);
 
288
  int32_t wait_for_pos(THD* thd, String* log_name, longlong log_pos, 
 
289
                   longlong timeout);
294
290
  void close_temporary_tables();
295
291
 
296
292
  /* Check if UNTIL condition is satisfied. See slave.cc for more. */
301
297
            group_relay_log_pos);
302
298
  }
303
299
 
304
 
  RPL_TableList *tables_to_lock;           /* RBR: Tables to lock  */
 
300
  RPL_TABLE_LIST *tables_to_lock;           /* RBR: Tables to lock  */
305
301
  uint32_t tables_to_lock_count;        /* RBR: Count of tables to lock */
306
302
  table_mapping m_table_map;      /* RBR: Mapping table-id to table */
307
303
 
308
 
  inline table_def *get_tabledef(Table *tbl)
 
304
  inline table_def *get_tabledef(TABLE *tbl)
309
305
  {
310
306
    table_def *td= 0;
311
 
    for (TableList *ptr= tables_to_lock; ptr && !td; ptr= ptr->next_global)
 
307
    for (TABLE_LIST *ptr= tables_to_lock; ptr && !td; ptr= ptr->next_global)
312
308
      if (ptr->table == tbl)
313
 
        td= &((RPL_TableList *)ptr)->m_tabledef;
 
309
        td= &((RPL_TABLE_LIST *)ptr)->m_tabledef;
314
310
    return (td);
315
311
  }
316
312
 
 
313
  /*
 
314
    Last charset (6 bytes) seen by slave SQL thread is cached here; it helps
 
315
    the thread save 3 get_charset() per Query_log_event if the charset is not
 
316
    changing from event to event (common situation).
 
317
    When the 6 bytes are equal to 0 is used to mean "cache is invalidated".
 
318
  */
 
319
  void cached_charset_invalidate();
 
320
  bool cached_charset_compare(char *charset) const;
 
321
 
317
322
  void cleanup_context(THD *, bool);
318
323
  void clear_tables_to_lock();
319
324
 
396
401
  }
397
402
 
398
403
private:
399
 
  uint32_t m_flags;
 
404
  uint32 m_flags;
400
405
};
401
406
 
402
407