~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_repl.cc

  • Committer: Brian Aker
  • Date: 2008-10-20 03:40:03 UTC
  • mto: (492.3.21 drizzle-clean-code)
  • mto: This revision was merged to the branch mainline in revision 530.
  • Revision ID: brian@tangent.org-20081020034003-t2dcnl0ayr2ymm8k
THD -> Session rename

Show diffs side-by-side

added added

removed removed

Lines of Context:
73
73
  return(0);
74
74
}
75
75
 
76
 
static int send_file(THD *thd)
 
76
static int send_file(Session *thd)
77
77
{
78
78
  NET* net = &thd->net;
79
79
  int fd = -1, error = 1;
167
167
 
168
168
void adjust_linfo_offsets(my_off_t purge_offset)
169
169
{
170
 
  THD *tmp;
 
170
  Session *tmp;
171
171
 
172
172
  pthread_mutex_lock(&LOCK_thread_count);
173
 
  I_List_iterator<THD> it(threads);
 
173
  I_List_iterator<Session> it(threads);
174
174
 
175
175
  while ((tmp=it++))
176
176
  {
197
197
bool log_in_use(const char* log_name)
198
198
{
199
199
  int log_name_len = strlen(log_name) + 1;
200
 
  THD *tmp;
 
200
  Session *tmp;
201
201
  bool result = 0;
202
202
 
203
203
  pthread_mutex_lock(&LOCK_thread_count);
204
 
  I_List_iterator<THD> it(threads);
 
204
  I_List_iterator<Session> it(threads);
205
205
 
206
206
  while ((tmp=it++))
207
207
  {
220
220
  return result;
221
221
}
222
222
 
223
 
bool purge_error_message(THD* thd, int res)
 
223
bool purge_error_message(Session* thd, int res)
224
224
{
225
225
  uint32_t errmsg= 0;
226
226
 
247
247
}
248
248
 
249
249
 
250
 
bool purge_master_logs(THD* thd, const char* to_log)
 
250
bool purge_master_logs(Session* thd, const char* to_log)
251
251
{
252
252
  char search_file_name[FN_REFLEN];
253
253
  if (!mysql_bin_log.is_open())
263
263
}
264
264
 
265
265
 
266
 
bool purge_master_logs_before_date(THD* thd, time_t purge_time)
 
266
bool purge_master_logs_before_date(Session* thd, time_t purge_time)
267
267
{
268
268
  if (!mysql_bin_log.is_open())
269
269
  {
308
308
  An auxiliary function for calling in mysql_binlog_send
309
309
  to initialize the heartbeat timeout in waiting for a binlogged event.
310
310
 
311
 
  @param[in]    thd  THD to access a user variable
 
311
  @param[in]    thd  Session to access a user variable
312
312
 
313
313
  @return        heartbeat period an uint64_t of nanoseconds
314
314
                 or zero if heartbeat was not demanded by slave
315
315
*/ 
316
 
static uint64_t get_heartbeat_period(THD * thd)
 
316
static uint64_t get_heartbeat_period(Session * thd)
317
317
{
318
318
  bool null_value;
319
319
  LEX_STRING name=  { C_STRING_WITH_LEN("master_heartbeat_period")};
326
326
/*
327
327
  Function prepares and sends repliation heartbeat event.
328
328
 
329
 
  @param net                net object of THD
 
329
  @param net                net object of Session
330
330
  @param packet             buffer to store the heartbeat instance
331
331
  @param event_coordinates  binlog file name and position of the last
332
332
                            real event master sent from binlog
375
375
  TODO: Clean up loop to only have one call to send_file()
376
376
*/
377
377
 
378
 
void mysql_binlog_send(THD* thd, char* log_ident, my_off_t pos,
 
378
void mysql_binlog_send(Session* thd, char* log_ident, my_off_t pos,
379
379
                       uint16_t flags)
380
380
{
381
381
  LOG_INFO linfo;
830
830
  return;
831
831
}
832
832
 
833
 
int start_slave(THD* thd , Master_info* mi,  bool net_report)
 
833
int start_slave(Session* thd , Master_info* mi,  bool net_report)
834
834
{
835
835
  int slave_errno= 0;
836
836
  int thread_mask;
951
951
}
952
952
 
953
953
 
954
 
int stop_slave(THD* thd, Master_info* mi, bool net_report )
 
954
int stop_slave(Session* thd, Master_info* mi, bool net_report )
955
955
{
956
956
  int slave_errno;
957
957
  if (!thd)
1013
1013
*/
1014
1014
 
1015
1015
 
1016
 
int reset_slave(THD *thd, Master_info* mi)
 
1016
int reset_slave(Session *thd, Master_info* mi)
1017
1017
{
1018
1018
  struct stat stat_area;
1019
1019
  char fname[FN_REFLEN];
1092
1092
void kill_zombie_dump_threads(uint32_t slave_server_id)
1093
1093
{
1094
1094
  pthread_mutex_lock(&LOCK_thread_count);
1095
 
  I_List_iterator<THD> it(threads);
1096
 
  THD *tmp;
 
1095
  I_List_iterator<Session> it(threads);
 
1096
  Session *tmp;
1097
1097
 
1098
1098
  while ((tmp=it++))
1099
1099
  {
1112
1112
      it will be slow because it will iterate through the list
1113
1113
      again. We just to do kill the thread ourselves.
1114
1114
    */
1115
 
    tmp->awake(THD::KILL_QUERY);
 
1115
    tmp->awake(Session::KILL_QUERY);
1116
1116
    pthread_mutex_unlock(&tmp->LOCK_delete);
1117
1117
  }
1118
1118
}
1119
1119
 
1120
1120
 
1121
 
bool change_master(THD* thd, Master_info* mi)
 
1121
bool change_master(Session* thd, Master_info* mi)
1122
1122
{
1123
1123
  int thread_mask;
1124
1124
  const char* errmsg= 0;
1298
1298
  return(false);
1299
1299
}
1300
1300
 
1301
 
int reset_master(THD* thd)
 
1301
int reset_master(Session* thd)
1302
1302
{
1303
1303
  if (!mysql_bin_log.is_open())
1304
1304
  {
1327
1327
}
1328
1328
 
1329
1329
 
1330
 
bool show_binlog_info(THD* thd)
 
1330
bool show_binlog_info(Session* thd)
1331
1331
{
1332
1332
  Protocol *protocol= thd->protocol;
1333
1333
  List<Item> field_list;
1371
1371
    true  error
1372
1372
*/
1373
1373
 
1374
 
bool show_binlogs(THD* thd)
 
1374
bool show_binlogs(Session* thd)
1375
1375
{
1376
1376
  IO_CACHE *index_file;
1377
1377
  LOG_INFO cur;
1501
1501
  sys_var_slave_skip_counter(sys_var_chain *chain, const char *name_arg)
1502
1502
    :sys_var(name_arg)
1503
1503
  { chain_sys_var(chain); }
1504
 
  bool check(THD *thd, set_var *var);
1505
 
  bool update(THD *thd, set_var *var);
 
1504
  bool check(Session *thd, set_var *var);
 
1505
  bool update(Session *thd, set_var *var);
1506
1506
  bool check_type(enum_var_type type) { return type != OPT_GLOBAL; }
1507
1507
  /*
1508
1508
    We can't retrieve the value of this, so we don't have to define
1516
1516
  sys_var_sync_binlog_period(sys_var_chain *chain, const char *name_arg,
1517
1517
                             ulong *value_ptr)
1518
1518
    :sys_var_long_ptr(chain, name_arg,value_ptr) {}
1519
 
  bool update(THD *thd, set_var *var);
 
1519
  bool update(Session *thd, set_var *var);
1520
1520
};
1521
1521
 
1522
 
static void fix_slave_net_timeout(THD *thd,
 
1522
static void fix_slave_net_timeout(Session *thd,
1523
1523
                                  enum_var_type type __attribute__((unused)))
1524
1524
{
1525
1525
  pthread_mutex_lock(&LOCK_active_mi);
1546
1546
static sys_var_sync_binlog_period sys_sync_binlog_period(&vars, "sync_binlog", &sync_binlog_period);
1547
1547
static sys_var_slave_skip_counter sys_slave_skip_counter(&vars, "sql_slave_skip_counter");
1548
1548
 
1549
 
static int show_slave_skip_errors(THD *thd, SHOW_VAR *var, char *buff);
1550
 
 
1551
 
 
1552
 
static int show_slave_skip_errors(THD *thd __attribute__((unused)),
 
1549
static int show_slave_skip_errors(Session *thd, SHOW_VAR *var, char *buff);
 
1550
 
 
1551
 
 
1552
static int show_slave_skip_errors(Session *thd __attribute__((unused)),
1553
1553
                                  SHOW_VAR *var, char *buff)
1554
1554
{
1555
1555
  var->type=SHOW_CHAR;
1601
1601
  {"slave_skip_errors",       (char*) &show_slave_skip_errors_cont,      SHOW_FUNC},
1602
1602
};
1603
1603
 
1604
 
bool sys_var_slave_skip_counter::check(THD *thd __attribute__((unused)),
 
1604
bool sys_var_slave_skip_counter::check(Session *thd __attribute__((unused)),
1605
1605
                                       set_var *var)
1606
1606
{
1607
1607
  int result= 0;
1619
1619
}
1620
1620
 
1621
1621
 
1622
 
bool sys_var_slave_skip_counter::update(THD *thd __attribute__((unused)),
 
1622
bool sys_var_slave_skip_counter::update(Session *thd __attribute__((unused)),
1623
1623
                                        set_var *var)
1624
1624
{
1625
1625
  pthread_mutex_lock(&LOCK_active_mi);
1641
1641
}
1642
1642
 
1643
1643
 
1644
 
bool sys_var_sync_binlog_period::update(THD *thd __attribute__((unused)),
 
1644
bool sys_var_sync_binlog_period::update(Session *thd __attribute__((unused)),
1645
1645
                                        set_var *var)
1646
1646
{
1647
1647
  sync_binlog_period= (uint32_t) var->save_result.uint64_t_value;