~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_repl.cc

  • Committer: Monty
  • Date: 2008-10-02 14:34:18 UTC
  • Revision ID: mordred@scylla.inaugust.com-20081002143418-2mju17v3297i1h2p
Made including stdint.h work.

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
 
16
16
#include <drizzled/server_includes.h>
17
17
 
 
18
#ifdef HAVE_REPLICATION
18
19
#include "rpl_mi.h"
19
20
#include "sql_repl.h"
20
21
#include "log_event.h"
52
53
  header[EVENT_TYPE_OFFSET] = ROTATE_EVENT;
53
54
 
54
55
  char* p = log_file_name+dirname_length(log_file_name);
55
 
  uint32_t ident_len = (uint32_t) strlen(p);
 
56
  uint ident_len = (uint) strlen(p);
56
57
  uint32_t event_len = ident_len + LOG_EVENT_HEADER_LEN + ROTATE_HEADER_LEN;
57
58
  int4store(header + SERVER_ID_OFFSET, server_id);
58
59
  int4store(header + EVENT_LEN_OFFSET, event_len);
65
66
  int8store(buf+R_POS_OFFSET,position);
66
67
  packet->append(buf, ROTATE_HEADER_LEN);
67
68
  packet->append(p,ident_len);
68
 
  if (my_net_write(net, (unsigned char*) packet->ptr(), packet->length()))
 
69
  if (my_net_write(net, (uchar*) packet->ptr(), packet->length()))
69
70
  {
70
71
    *errmsg = "failed on my_net_write()";
71
72
    return(-1);
82
83
  const char *errmsg = 0;
83
84
  int old_timeout;
84
85
  unsigned long packet_len;
85
 
  unsigned char buf[IO_SIZE];                           // It's safe to alloc this
 
86
  uchar buf[IO_SIZE];                           // It's safe to alloc this
86
87
 
87
88
  /*
88
89
    The client might be slow loading the data, give him wait_timeout to do
124
125
  }
125
126
 
126
127
 end:
127
 
  if (my_net_write(net, (unsigned char*) "", 0) || net_flush(net) ||
 
128
  if (my_net_write(net, (uchar*) "", 0) || net_flush(net) ||
128
129
      (my_net_read(net) == packet_error))
129
130
  {
130
131
    errmsg = _("Failed in send_file() while negotiating file transfer close");
222
223
 
223
224
bool purge_error_message(THD* thd, int res)
224
225
{
225
 
  uint32_t errmsg= 0;
 
226
  uint errmsg= 0;
226
227
 
227
228
  switch (res)  {
228
229
  case 0: break;
318
319
  bool null_value;
319
320
  LEX_STRING name=  { C_STRING_WITH_LEN("master_heartbeat_period")};
320
321
  user_var_entry *entry= 
321
 
    (user_var_entry*) hash_search(&thd->user_vars, (unsigned char*) name.str,
 
322
    (user_var_entry*) hash_search(&thd->user_vars, (uchar*) name.str,
322
323
                                  name.length);
323
324
  return entry? entry->val_int(&null_value) : 0;
324
325
}
351
352
 
352
353
  char* p= coord->file_name + dirname_length(coord->file_name);
353
354
 
354
 
  uint32_t ident_len = strlen(p);
 
355
  uint ident_len = strlen(p);
355
356
  uint32_t event_len = ident_len + LOG_EVENT_HEADER_LEN;
356
357
  int4store(header + SERVER_ID_OFFSET, server_id);
357
358
  int4store(header + EVENT_LEN_OFFSET, event_len);
362
363
  packet->append(header, sizeof(header));
363
364
  packet->append(p, ident_len);             // log_file_name
364
365
 
365
 
  if (my_net_write(net, (unsigned char*) packet->ptr(), packet->length()) ||
 
366
  if (my_net_write(net, (uchar*) packet->ptr(), packet->length()) ||
366
367
      net_flush(net))
367
368
  {
368
369
    return(-1);
376
377
*/
377
378
 
378
379
void mysql_binlog_send(THD* thd, char* log_ident, my_off_t pos,
379
 
                       uint16_t flags)
 
380
                       ushort flags)
380
381
{
381
382
  LOG_INFO linfo;
382
383
  char *log_file_name = linfo.log_file_name;
541
542
         int4store((char*) packet->ptr()+LOG_EVENT_MINIMAL_HEADER_LEN+
542
543
                   ST_CREATED_OFFSET+1, (uint32_t) 0);
543
544
         /* send it */
544
 
         if (my_net_write(net, (unsigned char*) packet->ptr(), packet->length()))
 
545
         if (my_net_write(net, (uchar*) packet->ptr(), packet->length()))
545
546
         {
546
547
           errmsg = "Failed on my_net_write()";
547
548
           my_errno= ER_UNKNOWN_ERROR;
595
596
      else if ((*packet)[EVENT_TYPE_OFFSET+1] == STOP_EVENT)
596
597
        binlog_can_be_corrupted= false;
597
598
 
598
 
      if (my_net_write(net, (unsigned char*) packet->ptr(), packet->length()))
 
599
      if (my_net_write(net, (uchar*) packet->ptr(), packet->length()))
599
600
      {
600
601
        errmsg = "Failed on my_net_write()";
601
602
        my_errno= ER_UNKNOWN_ERROR;
718
719
 
719
720
        if (read_packet)
720
721
        {
721
 
          thd->set_proc_info("Sending binlog event to slave");
722
 
          if (my_net_write(net, (unsigned char*) packet->ptr(), packet->length()) )
 
722
          thd_proc_info(thd, "Sending binlog event to slave");
 
723
          if (my_net_write(net, (uchar*) packet->ptr(), packet->length()) )
723
724
          {
724
725
            errmsg = "Failed on my_net_write()";
725
726
            my_errno= ER_UNKNOWN_ERROR;
756
757
      bool loop_breaker = 0;
757
758
      /* need this to break out of the for loop from switch */
758
759
 
759
 
      thd->set_proc_info("Finished reading one binlog; switching to next binlog");
 
760
      thd_proc_info(thd, "Finished reading one binlog; switching to next binlog");
760
761
      switch (mysql_bin_log.find_next_log(&linfo, 1)) {
761
762
      case LOG_INFO_EOF:
762
763
        loop_breaker = (flags & BINLOG_DUMP_NON_BLOCK);
804
805
  (void)my_close(file, MYF(MY_WME));
805
806
 
806
807
  my_eof(thd);
807
 
  thd->set_proc_info("Waiting to finalize termination");
 
808
  thd_proc_info(thd, "Waiting to finalize termination");
808
809
  pthread_mutex_lock(&LOCK_thread_count);
809
810
  thd->current_linfo = 0;
810
811
  pthread_mutex_unlock(&LOCK_thread_count);
811
812
  return;
812
813
 
813
814
err:
814
 
  thd->set_proc_info("Waiting to finalize termination");
 
815
  thd_proc_info(thd, "Waiting to finalize termination");
815
816
  end_io_cache(&log);
816
817
  /*
817
818
    Exclude  iteration through thread list
848
849
    thread_mask&= thd->lex->slave_thd_opt;
849
850
  if (thread_mask) //some threads are stopped, start them
850
851
  {
851
 
    if (mi->init_master_info(master_info_file, relay_log_info_file, thread_mask))
 
852
    if (init_master_info(mi,master_info_file,relay_log_info_file, 0,
 
853
                         thread_mask))
852
854
      slave_errno=ER_MASTER_INFO;
853
 
    else if (server_id_supplied && *mi->getHostname())
 
855
    else if (server_id_supplied && *mi->host)
854
856
    {
855
857
      /*
856
858
        If we will start SQL thread we will care about UNTIL options If
957
959
  if (!thd)
958
960
    thd = current_thd;
959
961
 
960
 
  thd->set_proc_info("Killing slave");
 
962
  thd_proc_info(thd, "Killing slave");
961
963
  int thread_mask;
962
964
  lock_slave_threads(mi);
963
965
  // Get a mask of _running_ threads
984
986
                 ER(ER_SLAVE_WAS_NOT_RUNNING));
985
987
  }
986
988
  unlock_slave_threads(mi);
987
 
  thd->set_proc_info(0);
 
989
  thd_proc_info(thd, 0);
988
990
 
989
991
  if (slave_errno)
990
992
  {
1018
1020
  struct stat stat_area;
1019
1021
  char fname[FN_REFLEN];
1020
1022
  int thread_mask= 0, error= 0;
1021
 
  uint32_t sql_errno=0;
 
1023
  uint sql_errno=0;
1022
1024
  const char* errmsg=0;
1023
1025
 
1024
1026
  lock_slave_threads(mi);
1030
1032
    goto err;
1031
1033
  }
1032
1034
 
 
1035
  ha_reset_slave(thd);
 
1036
 
1033
1037
  // delete relay logs, clear relay log coordinates
1034
1038
  if ((error= purge_relay_logs(&mi->rli, thd,
1035
1039
                               1 /* just reset */,
1037
1041
    goto err;
1038
1042
 
1039
1043
  /* Clear master's log coordinates */
1040
 
  mi->reset();
 
1044
  init_master_log_pos(mi);
1041
1045
  /*
1042
1046
     Reset errors (the idea is that we forget about the
1043
1047
     old master).
1046
1050
  mi->rli.clear_until_condition();
1047
1051
 
1048
1052
  // close master_info_file, relay_log_info_file, set mi->inited=rli->inited=0
1049
 
  mi->end_master_info();
 
1053
  end_master_info(mi);
1050
1054
  // and delete these two files
1051
1055
  fn_format(fname, master_info_file, mysql_data_home, "", 4+32);
1052
1056
  if (!stat(fname, &stat_area) && my_delete(fname, MYF(MY_WME)))
1133
1137
    return(true);
1134
1138
  }
1135
1139
 
1136
 
  thd->set_proc_info("Changing master");
 
1140
  thd_proc_info(thd, "Changing master");
1137
1141
  LEX_MASTER_INFO* lex_mi= &thd->lex->mi;
1138
1142
  // TODO: see if needs re-write
1139
 
  if (mi->init_master_info(master_info_file, relay_log_info_file, thread_mask))
 
1143
  if (init_master_info(mi, master_info_file, relay_log_info_file, 0,
 
1144
                       thread_mask))
1140
1145
  {
1141
1146
    my_message(ER_MASTER_INFO, ER(ER_MASTER_INFO), MYF(0));
1142
1147
    unlock_slave_threads(mi);
1155
1160
  */
1156
1161
 
1157
1162
  if ((lex_mi->host || lex_mi->port) && !lex_mi->log_file_name && !lex_mi->pos)
1158
 
    mi->reset();
 
1163
  {
 
1164
    mi->master_log_name[0] = 0;
 
1165
    mi->master_log_pos= BIN_LOG_HEADER_SIZE;
 
1166
  }
1159
1167
 
1160
1168
  if (lex_mi->log_file_name)
1161
 
    mi->setLogName(lex_mi->log_file_name);
 
1169
    strmake(mi->master_log_name, lex_mi->log_file_name,
 
1170
            sizeof(mi->master_log_name)-1);
1162
1171
  if (lex_mi->pos)
1163
1172
  {
1164
 
    mi->setLogPosition(lex_mi->pos);
 
1173
    mi->master_log_pos= lex_mi->pos;
1165
1174
  }
1166
1175
 
1167
1176
  if (lex_mi->host)
1168
 
    mi->setHost(lex_mi->host, lex_mi->port);
 
1177
    strmake(mi->host, lex_mi->host, sizeof(mi->host)-1);
1169
1178
  if (lex_mi->user)
1170
 
    mi->setUsername(lex_mi->user);
 
1179
    strmake(mi->user, lex_mi->user, sizeof(mi->user)-1);
1171
1180
  if (lex_mi->password)
1172
 
    mi->setPassword(lex_mi->password);
 
1181
    strmake(mi->password, lex_mi->password, sizeof(mi->password)-1);
 
1182
  if (lex_mi->port)
 
1183
    mi->port = lex_mi->port;
1173
1184
  if (lex_mi->connect_retry)
1174
1185
    mi->connect_retry = lex_mi->connect_retry;
1175
1186
  if (lex_mi->heartbeat_opt != LEX_MASTER_INFO::LEX_MI_UNCHANGED)
1178
1189
    mi->heartbeat_period= (float) cmin((double)SLAVE_MAX_HEARTBEAT_PERIOD,
1179
1190
                                      (slave_net_timeout/2.0));
1180
1191
  mi->received_heartbeats= 0L; // counter lives until master is CHANGEd
 
1192
  if (lex_mi->ssl != LEX_MASTER_INFO::LEX_MI_UNCHANGED)
 
1193
    mi->ssl= (lex_mi->ssl == LEX_MASTER_INFO::LEX_MI_ENABLE);
 
1194
 
 
1195
  if (lex_mi->ssl_verify_server_cert != LEX_MASTER_INFO::LEX_MI_UNCHANGED)
 
1196
    mi->ssl_verify_server_cert=
 
1197
      (lex_mi->ssl_verify_server_cert == LEX_MASTER_INFO::LEX_MI_ENABLE);
 
1198
 
 
1199
  if (lex_mi->ssl_ca)
 
1200
    strmake(mi->ssl_ca, lex_mi->ssl_ca, sizeof(mi->ssl_ca)-1);
 
1201
  if (lex_mi->ssl_capath)
 
1202
    strmake(mi->ssl_capath, lex_mi->ssl_capath, sizeof(mi->ssl_capath)-1);
 
1203
  if (lex_mi->ssl_cert)
 
1204
    strmake(mi->ssl_cert, lex_mi->ssl_cert, sizeof(mi->ssl_cert)-1);
 
1205
  if (lex_mi->ssl_cipher)
 
1206
    strmake(mi->ssl_cipher, lex_mi->ssl_cipher, sizeof(mi->ssl_cipher)-1);
 
1207
  if (lex_mi->ssl_key)
 
1208
    strmake(mi->ssl_key, lex_mi->ssl_key, sizeof(mi->ssl_key)-1);
 
1209
  if (lex_mi->ssl || lex_mi->ssl_ca || lex_mi->ssl_capath ||
 
1210
      lex_mi->ssl_cert || lex_mi->ssl_cipher || lex_mi->ssl_key ||
 
1211
      lex_mi->ssl_verify_server_cert )
 
1212
    push_warning(thd, DRIZZLE_ERROR::WARN_LEVEL_NOTE,
 
1213
                 ER_SLAVE_IGNORED_SSL_PARAMS, ER(ER_SLAVE_IGNORED_SSL_PARAMS));
1181
1214
 
1182
1215
  if (lex_mi->relay_log_name)
1183
1216
  {
1184
1217
    need_relay_log_purge= 0;
1185
 
    mi->rli.event_relay_log_name.assign(lex_mi->relay_log_name);
 
1218
    strmake(mi->rli.group_relay_log_name,lex_mi->relay_log_name,
 
1219
            sizeof(mi->rli.group_relay_log_name)-1);
 
1220
    strmake(mi->rli.event_relay_log_name,lex_mi->relay_log_name,
 
1221
            sizeof(mi->rli.event_relay_log_name)-1);
1186
1222
  }
1187
1223
 
1188
1224
  if (lex_mi->relay_log_pos)
1216
1252
       of replication is not 100% clear, so we guard against problems using
1217
1253
       cmax().
1218
1254
      */
1219
 
     mi->setLogPosition(((BIN_LOG_HEADER_SIZE > mi->rli.group_master_log_pos)
1220
 
                         ? BIN_LOG_HEADER_SIZE
1221
 
                         : mi->rli.group_master_log_pos));
1222
 
     mi->setLogName(mi->rli.group_master_log_name.c_str());
 
1255
     mi->master_log_pos = ((BIN_LOG_HEADER_SIZE > mi->rli.group_master_log_pos)
 
1256
                           ? BIN_LOG_HEADER_SIZE
 
1257
                           : mi->rli.group_master_log_pos);
 
1258
     strmake(mi->master_log_name, mi->rli.group_master_log_name,
 
1259
             sizeof(mi->master_log_name)-1);
1223
1260
  }
1224
1261
  /*
1225
1262
    Relay log's IO_CACHE may not be inited, if rli->inited==0 (server was never
1226
1263
    a slave before).
1227
1264
  */
1228
 
  if (mi->flush())
 
1265
  if (flush_master_info(mi, 0))
1229
1266
  {
1230
1267
    my_error(ER_RELAY_LOG_INIT, MYF(0), "Failed to flush master info file");
1231
1268
    unlock_slave_threads(mi);
1234
1271
  if (need_relay_log_purge)
1235
1272
  {
1236
1273
    relay_log_purge= 1;
1237
 
    thd->set_proc_info("Purging old relay logs");
 
1274
    thd_proc_info(thd, "Purging old relay logs");
1238
1275
    if (purge_relay_logs(&mi->rli, thd,
1239
1276
                         0 /* not only reset, but also reinit */,
1240
1277
                         &errmsg))
1250
1287
    relay_log_purge= 0;
1251
1288
    /* Relay log is already initialized */
1252
1289
    if (init_relay_log_pos(&mi->rli,
1253
 
                           mi->rli.group_relay_log_name.c_str(),
 
1290
                           mi->rli.group_relay_log_name,
1254
1291
                           mi->rli.group_relay_log_pos,
1255
1292
                           0 /*no data lock*/,
1256
1293
                           &msg, 0))
1270
1307
    ''/0: we have lost all copies of the original good coordinates.
1271
1308
    That's why we always save good coords in rli.
1272
1309
  */
1273
 
  mi->rli.group_master_log_pos= mi->getLogPosition();
1274
 
  mi->rli.group_master_log_name.assign(mi->getLogName());
 
1310
  mi->rli.group_master_log_pos= mi->master_log_pos;
 
1311
  strmake(mi->rli.group_master_log_name,mi->master_log_name,
 
1312
          sizeof(mi->rli.group_master_log_name)-1);
1275
1313
 
1276
 
  if (mi->rli.group_master_log_name.size() == 0) // uninitialized case
1277
 
    mi->rli.group_master_log_pos= 0;
 
1314
  if (!mi->rli.group_master_log_name[0]) // uninitialized case
 
1315
    mi->rli.group_master_log_pos=0;
1278
1316
 
1279
1317
  pthread_mutex_lock(&mi->rli.data_lock);
1280
1318
  mi->rli.abort_pos_wait++; /* for MASTER_POS_WAIT() to abort */
1293
1331
  pthread_mutex_unlock(&mi->rli.data_lock);
1294
1332
 
1295
1333
  unlock_slave_threads(mi);
1296
 
  thd->set_proc_info(0);
 
1334
  thd_proc_info(thd, 0);
1297
1335
  my_ok(thd);
1298
1336
  return(false);
1299
1337
}
1313
1351
                   const char* log_file_name2, uint64_t log_pos2)
1314
1352
{
1315
1353
  int res;
1316
 
  uint32_t log_file_name1_len=  strlen(log_file_name1);
1317
 
  uint32_t log_file_name2_len=  strlen(log_file_name2);
 
1354
  uint log_file_name1_len=  strlen(log_file_name1);
 
1355
  uint log_file_name2_len=  strlen(log_file_name2);
1318
1356
 
1319
1357
  //  We assume that both log names match up to '.'
1320
1358
  if (log_file_name1_len == log_file_name2_len)
1327
1365
}
1328
1366
 
1329
1367
 
 
1368
bool mysql_show_binlog_events(THD* thd)
 
1369
{
 
1370
  Protocol *protocol= thd->protocol;
 
1371
  List<Item> field_list;
 
1372
  const char *errmsg= 0;
 
1373
  bool ret= true;
 
1374
  IO_CACHE log;
 
1375
  File file= -1;
 
1376
 
 
1377
  Log_event::init_show_field_list(&field_list);
 
1378
  if (protocol->send_fields(&field_list,
 
1379
                            Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
 
1380
    return(true);
 
1381
 
 
1382
  Format_description_log_event *description_event= new
 
1383
    Format_description_log_event(3); /* MySQL 4.0 by default */
 
1384
 
 
1385
  /*
 
1386
    Wait for handlers to insert any pending information
 
1387
    into the binlog.  For e.g. ndb which updates the binlog asynchronously
 
1388
    this is needed so that the uses sees all its own commands in the binlog
 
1389
  */
 
1390
  ha_binlog_wait(thd);
 
1391
 
 
1392
  if (mysql_bin_log.is_open())
 
1393
  {
 
1394
    LEX_MASTER_INFO *lex_mi= &thd->lex->mi;
 
1395
    SELECT_LEX_UNIT *unit= &thd->lex->unit;
 
1396
    ha_rows event_count, limit_start, limit_end;
 
1397
    my_off_t pos = cmax((uint64_t)BIN_LOG_HEADER_SIZE, lex_mi->pos); // user-friendly
 
1398
    char search_file_name[FN_REFLEN], *name;
 
1399
    const char *log_file_name = lex_mi->log_file_name;
 
1400
    pthread_mutex_t *log_lock = mysql_bin_log.get_log_lock();
 
1401
    LOG_INFO linfo;
 
1402
    Log_event* ev;
 
1403
 
 
1404
    unit->set_limit(thd->lex->current_select);
 
1405
    limit_start= unit->offset_limit_cnt;
 
1406
    limit_end= unit->select_limit_cnt;
 
1407
 
 
1408
    name= search_file_name;
 
1409
    if (log_file_name)
 
1410
      mysql_bin_log.make_log_name(search_file_name, log_file_name);
 
1411
    else
 
1412
      name=0;                                   // Find first log
 
1413
 
 
1414
    linfo.index_file_offset = 0;
 
1415
 
 
1416
    if (mysql_bin_log.find_log_pos(&linfo, name, 1))
 
1417
    {
 
1418
      errmsg = "Could not find target log";
 
1419
      goto err;
 
1420
    }
 
1421
 
 
1422
    pthread_mutex_lock(&LOCK_thread_count);
 
1423
    thd->current_linfo = &linfo;
 
1424
    pthread_mutex_unlock(&LOCK_thread_count);
 
1425
 
 
1426
    if ((file=open_binlog(&log, linfo.log_file_name, &errmsg)) < 0)
 
1427
      goto err;
 
1428
 
 
1429
    /*
 
1430
      to account binlog event header size
 
1431
    */
 
1432
    thd->variables.max_allowed_packet += MAX_LOG_EVENT_HEADER;
 
1433
 
 
1434
    pthread_mutex_lock(log_lock);
 
1435
 
 
1436
    /*
 
1437
      open_binlog() sought to position 4.
 
1438
      Read the first event in case it's a Format_description_log_event, to
 
1439
      know the format. If there's no such event, we are 3.23 or 4.x. This
 
1440
      code, like before, can't read 3.23 binlogs.
 
1441
      This code will fail on a mixed relay log (one which has Format_desc then
 
1442
      Rotate then Format_desc).
 
1443
    */
 
1444
    ev = Log_event::read_log_event(&log,(pthread_mutex_t*)0,description_event);
 
1445
    if (ev)
 
1446
    {
 
1447
      if (ev->get_type_code() == FORMAT_DESCRIPTION_EVENT)
 
1448
      {
 
1449
        delete description_event;
 
1450
        description_event= (Format_description_log_event*) ev;
 
1451
      }
 
1452
      else
 
1453
        delete ev;
 
1454
    }
 
1455
 
 
1456
    my_b_seek(&log, pos);
 
1457
 
 
1458
    if (!description_event->is_valid())
 
1459
    {
 
1460
      errmsg="Invalid Format_description event; could be out of memory";
 
1461
      goto err;
 
1462
    }
 
1463
 
 
1464
    for (event_count = 0;
 
1465
         (ev = Log_event::read_log_event(&log,(pthread_mutex_t*) 0,
 
1466
                                         description_event)); )
 
1467
    {
 
1468
      if (event_count >= limit_start &&
 
1469
          ev->net_send(protocol, linfo.log_file_name, pos))
 
1470
      {
 
1471
        errmsg = "Net error";
 
1472
        delete ev;
 
1473
        pthread_mutex_unlock(log_lock);
 
1474
        goto err;
 
1475
      }
 
1476
 
 
1477
      pos = my_b_tell(&log);
 
1478
      delete ev;
 
1479
 
 
1480
      if (++event_count >= limit_end)
 
1481
        break;
 
1482
    }
 
1483
 
 
1484
    if (event_count < limit_end && log.error)
 
1485
    {
 
1486
      errmsg = "Wrong offset or I/O error";
 
1487
      pthread_mutex_unlock(log_lock);
 
1488
      goto err;
 
1489
    }
 
1490
 
 
1491
    pthread_mutex_unlock(log_lock);
 
1492
  }
 
1493
 
 
1494
  ret= false;
 
1495
 
 
1496
err:
 
1497
  delete description_event;
 
1498
  if (file >= 0)
 
1499
  {
 
1500
    end_io_cache(&log);
 
1501
    (void) my_close(file, MYF(MY_WME));
 
1502
  }
 
1503
 
 
1504
  if (errmsg)
 
1505
    my_error(ER_ERROR_WHEN_EXECUTING_COMMAND, MYF(0),
 
1506
             "SHOW BINLOG EVENTS", errmsg);
 
1507
  else
 
1508
    my_eof(thd);
 
1509
 
 
1510
  pthread_mutex_lock(&LOCK_thread_count);
 
1511
  thd->current_linfo = 0;
 
1512
  pthread_mutex_unlock(&LOCK_thread_count);
 
1513
  return(ret);
 
1514
}
 
1515
 
 
1516
 
1330
1517
bool show_binlog_info(THD* thd)
1331
1518
{
1332
1519
  Protocol *protocol= thd->protocol;
1378
1565
  File file;
1379
1566
  char fname[FN_REFLEN];
1380
1567
  List<Item> field_list;
1381
 
  uint32_t length;
 
1568
  uint length;
1382
1569
  int cur_dir_len;
1383
1570
  Protocol *protocol= thd->protocol;
1384
1571
 
1455
1642
int log_loaded_block(IO_CACHE* file)
1456
1643
{
1457
1644
  LOAD_FILE_INFO *lf_info;
1458
 
  uint32_t block_len;
 
1645
  uint block_len;
1459
1646
  /* buffer contains position where we started last read */
1460
 
  unsigned char* buffer= (unsigned char*) my_b_get_buffer_start(file);
1461
 
  uint32_t max_event_size= current_thd->variables.max_allowed_packet;
 
1647
  uchar* buffer= (uchar*) my_b_get_buffer_start(file);
 
1648
  uint max_event_size= current_thd->variables.max_allowed_packet;
1462
1649
  lf_info= (LOAD_FILE_INFO*) file->arg;
1463
1650
  if (lf_info->thd->current_stmt_binlog_row_based)
1464
1651
    return(0);
1522
1709
static void fix_slave_net_timeout(THD *thd,
1523
1710
                                  enum_var_type type __attribute__((unused)))
1524
1711
{
 
1712
#ifdef HAVE_REPLICATION
1525
1713
  pthread_mutex_lock(&LOCK_active_mi);
1526
1714
  if (active_mi && slave_net_timeout < active_mi->heartbeat_period)
1527
1715
    push_warning_printf(thd, DRIZZLE_ERROR::WARN_LEVEL_WARN,
1531
1719
                        " A sensible value for the period should be"
1532
1720
                        " less than the timeout.");
1533
1721
  pthread_mutex_unlock(&LOCK_active_mi);
 
1722
#endif
1534
1723
  return;
1535
1724
}
1536
1725
 
1660
1849
  }
1661
1850
  return 0;
1662
1851
}
 
1852
 
 
1853
#endif /* HAVE_REPLICATION */