~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/replication/rli.cc

  • Committer: Brian Aker
  • Date: 2009-01-21 05:53:36 UTC
  • mto: This revision was merged to the branch mainline in revision 801.
  • Revision ID: brian@tangent.org-20090121055336-fxoz6wfzreo8gi9x
Removed purge

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
15
15
 
16
16
#include <drizzled/server_includes.h>
17
 
 
18
 
#include "rpl_mi.h"
19
 
#include "rpl_rli.h"
20
 
#include "sql_repl.h"  // For check_binlog_magic
21
 
#include "rpl_utility.h"
 
17
#include <drizzled/replication/mi.h>
 
18
#include <drizzled/replication/rli.h>
 
19
// For check_binlog_magic
 
20
#include <drizzled/replication/replication.h>
 
21
#include <drizzled/replication/utility.h>
 
22
#include <drizzled/data_home.h>
 
23
#include <drizzled/sql_parse.h>
 
24
#include <drizzled/gettext.h>
 
25
#include <drizzled/log_event.h>
 
26
#include <drizzled/sql_base.h>
 
27
 
 
28
#if TIME_WITH_SYS_TIME
 
29
# include <sys/time.h>
 
30
# include <time.h>
 
31
#else
 
32
# if HAVE_SYS_TIME_H
 
33
#  include <sys/time.h>
 
34
# else
 
35
#  include <time.h>
 
36
# endif
 
37
#endif
 
38
 
 
39
 
22
40
 
23
41
static int32_t count_relay_log_space(Relay_log_info* rli);
24
42
 
25
43
// Defined in slave.cc
26
44
int32_t init_intvar_from_file(int32_t* var, IO_CACHE* f, int32_t default_val);
27
45
int32_t init_strvar_from_file(char *var, int32_t max_size, IO_CACHE *f,
28
 
                          const char *default_val);
 
46
                              const char *default_val);
29
47
 
30
48
 
31
49
Relay_log_info::Relay_log_info()
32
50
  :Slave_reporting_capability("SQL"),
33
51
   no_storage(false), replicate_same_server_id(::replicate_same_server_id),
34
52
   info_fd(-1), cur_log_fd(-1), save_temporary_tables(0),
 
53
   cur_log_old_open_count(0), group_relay_log_pos(0), event_relay_log_pos(0),
35
54
#if defined(HAVE_purify) && HAVE_purify
36
55
   is_fake(false),
37
56
#endif
38
 
   cur_log_old_open_count(0), group_relay_log_pos(0), event_relay_log_pos(0),
39
57
   group_master_log_pos(0), log_space_total(0), ignore_log_space_limit(0),
40
58
   last_master_timestamp(0), slave_skip_counter(0),
41
 
   abort_pos_wait(0), slave_run_id(0), sql_thd(0),
 
59
   abort_pos_wait(0), slave_run_id(0), sql_session(0),
42
60
   inited(0), abort_slave(0), slave_running(0), until_condition(UNTIL_NONE),
43
61
   until_log_pos(0), retried_trans(0),
44
62
   tables_to_lock(0), tables_to_lock_count(0),
49
67
  until_log_name[0]= ign_master_log_name_end[0]= 0;
50
68
  memset(&info_file, 0, sizeof(info_file));
51
69
  memset(&cache_buf, 0, sizeof(cache_buf));
52
 
  cached_charset_invalidate();
53
70
  pthread_mutex_init(&run_lock, MY_MUTEX_INIT_FAST);
54
71
  pthread_mutex_init(&data_lock, MY_MUTEX_INIT_FAST);
55
72
  pthread_mutex_init(&log_space_lock, MY_MUTEX_INIT_FAST);
77
94
 
78
95
 
79
96
int32_t init_relay_log_info(Relay_log_info* rli,
80
 
                        const char* info_fname)
 
97
                            const char* info_fname)
81
98
{
82
99
  char fname[FN_REFLEN+128];
83
100
  int32_t info_fd;
87
104
 
88
105
  if (rli->inited)                       // Set if this function called
89
106
    return(0);
90
 
  fn_format(fname, info_fname, mysql_data_home, "", 4+32);
 
107
  fn_format(fname, info_fname, drizzle_data_home, "", 4+32);
91
108
  pthread_mutex_lock(&rli->data_lock);
92
109
  info_fd = rli->info_fd;
93
110
  rli->cur_log_fd = -1;
111
128
    fix_max_relay_log_size will reconsider the choice (for example
112
129
    if the user changes max_relay_log_size to zero, we have to
113
130
    switch to using max_binlog_size for the relay log) and update
114
 
    rli->relay_log.max_size (and mysql_bin_log.max_size).
 
131
    rli->relay_log.max_size (and drizzle_bin_log.max_size).
115
132
  */
116
133
  {
117
134
    char buf[FN_REFLEN];
129
146
        instead require a name. But as we don't want to break many existing
130
147
        setups, we only give warning, not error.
131
148
      */
132
 
      sql_print_warning("Neither --relay-log nor --relay-log-index were used;"
 
149
      errmsg_printf(ERRMSG_LVL_WARN, _("Neither --relay-log nor --relay-log-index were used;"
133
150
                        " so replication "
134
 
                        "may break when this MySQL server acts as a "
 
151
                        "may break when this Drizzle server acts as a "
135
152
                        "slave and has his hostname changed!! Please "
136
 
                        "use '--relay-log=%s' to avoid this problem.", ln);
 
153
                        "use '--relay-log=%s' to avoid this problem."), ln);
137
154
      name_warning_sent= 1;
138
155
    }
139
156
    /*
146
163
                            max_binlog_size), 1))
147
164
    {
148
165
      pthread_mutex_unlock(&rli->data_lock);
149
 
      sql_print_error("Failed in open_log() called from init_relay_log_info()");
 
166
      errmsg_printf(ERRMSG_LVL_ERROR, _("Failed in open_log() called from "
 
167
                        "init_relay_log_info()"));
150
168
      return(1);
151
169
    }
152
170
  }
154
172
  /* if file does not exist */
155
173
  if (access(fname,F_OK))
156
174
  {
157
 
    /*
158
 
      If someone removed the file from underneath our feet, just close
159
 
      the old descriptor and re-create the old file
160
 
    */
161
 
    if (info_fd >= 0)
162
 
      my_close(info_fd, MYF(MY_WME));
163
 
    if ((info_fd = my_open(fname, O_CREAT|O_RDWR|O_BINARY, MYF(MY_WME))) < 0)
164
 
    {
165
 
      sql_print_error("Failed to create a new relay log info file (\
166
 
file '%s', errno %d)", fname, my_errno);
167
 
      msg= current_thd->main_da.message();
168
 
      goto err;
169
 
    }
170
 
    if (init_io_cache(&rli->info_file, info_fd, IO_SIZE*2, READ_CACHE, 0L,0,
171
 
                      MYF(MY_WME)))
172
 
    {
173
 
      sql_print_error("Failed to create a cache on relay log info file '%s'",
174
 
                      fname);
175
 
      msg= current_thd->main_da.message();
176
 
      goto err;
177
 
    }
178
 
 
179
 
    /* Init relay log with first entry in the relay index file */
180
 
    if (init_relay_log_pos(rli,NullS,BIN_LOG_HEADER_SIZE,0 /* no data lock */,
181
 
                           &msg, 0))
182
 
    {
183
 
      sql_print_error("Failed to open the relay log 'FIRST' (relay_log_pos 4)");
184
 
      goto err;
185
 
    }
186
 
    rli->group_master_log_name[0]= 0;
187
 
    rli->group_master_log_pos= 0;
188
 
    rli->info_fd= info_fd;
 
175
    /* Create a new file */
189
176
  }
190
177
  else // file exists
191
178
  {
192
 
    if (info_fd >= 0)
193
 
      reinit_io_cache(&rli->info_file, READ_CACHE, 0L,0,0);
194
 
    else
195
 
    {
196
 
      int32_t error=0;
197
 
      if ((info_fd = my_open(fname, O_RDWR|O_BINARY, MYF(MY_WME))) < 0)
198
 
      {
199
 
        sql_print_error("\
200
 
Failed to open the existing relay log info file '%s' (errno %d)",
201
 
                        fname, my_errno);
202
 
        error= 1;
203
 
      }
204
 
      else if (init_io_cache(&rli->info_file, info_fd,
205
 
                             IO_SIZE*2, READ_CACHE, 0L, 0, MYF(MY_WME)))
206
 
      {
207
 
        sql_print_error("Failed to create a cache on relay log info file '%s'",
208
 
                        fname);
209
 
        error= 1;
210
 
      }
211
 
      if (error)
212
 
      {
213
 
        if (info_fd >= 0)
214
 
          my_close(info_fd, MYF(0));
215
 
        rli->info_fd= -1;
216
 
        rli->relay_log.close(LOG_CLOSE_INDEX | LOG_CLOSE_STOP_EVENT);
217
 
        pthread_mutex_unlock(&rli->data_lock);
218
 
        return(1);
219
 
      }
220
 
    }
221
 
 
222
 
    rli->info_fd = info_fd;
223
 
    int32_t relay_log_pos, master_log_pos;
224
 
    if (init_strvar_from_file(rli->group_relay_log_name,
225
 
                              sizeof(rli->group_relay_log_name),
226
 
                              &rli->info_file, "") ||
227
 
       init_intvar_from_file(&relay_log_pos,
228
 
                             &rli->info_file, BIN_LOG_HEADER_SIZE) ||
229
 
       init_strvar_from_file(rli->group_master_log_name,
230
 
                             sizeof(rli->group_master_log_name),
231
 
                             &rli->info_file, "") ||
232
 
       init_intvar_from_file(&master_log_pos, &rli->info_file, 0))
233
 
    {
234
 
      msg="Error reading slave log configuration";
235
 
      goto err;
236
 
    }
237
 
    strmake(rli->event_relay_log_name,rli->group_relay_log_name,
238
 
            sizeof(rli->event_relay_log_name)-1);
239
 
    rli->group_relay_log_pos= rli->event_relay_log_pos= relay_log_pos;
240
 
    rli->group_master_log_pos= master_log_pos;
241
 
 
242
 
    if (init_relay_log_pos(rli,
243
 
                           rli->group_relay_log_name,
244
 
                           rli->group_relay_log_pos,
245
 
                           0 /* no data lock*/,
246
 
                           &msg, 0))
247
 
    {
248
 
      char llbuf[22];
249
 
      sql_print_error("Failed to open the relay log '%s' (relay_log_pos %s)",
250
 
                      rli->group_relay_log_name,
251
 
                      llstr(rli->group_relay_log_pos, llbuf));
252
 
      goto err;
253
 
    }
 
179
    /* Open up fname here and pull out the relay.info data */
254
180
  }
255
 
  assert(rli->event_relay_log_pos >= BIN_LOG_HEADER_SIZE);
256
 
  assert(my_b_tell(rli->cur_log) == rli->event_relay_log_pos);
257
181
 
258
182
  /*
259
183
    Now change the cache from READ to WRITE - must do this
261
185
  */
262
186
  reinit_io_cache(&rli->info_file, WRITE_CACHE,0L,0,1);
263
187
  if ((error= flush_relay_log_info(rli)))
264
 
    sql_print_error("Failed to flush relay log info file");
 
188
    errmsg_printf(ERRMSG_LVL_ERROR, _("Failed to flush relay log info file"));
265
189
  if (count_relay_log_space(rli))
266
190
  {
267
 
    msg="Error counting relay log space";
 
191
    msg=_("Error counting relay log space");
268
192
    goto err;
269
193
  }
270
194
  rli->inited= 1;
272
196
  return(error);
273
197
 
274
198
err:
275
 
  sql_print_error(msg);
 
199
  errmsg_printf(ERRMSG_LVL_ERROR, "%s",msg);
276
200
  end_io_cache(&rli->info_file);
277
201
  if (info_fd >= 0)
278
202
    my_close(info_fd, MYF(0));
288
212
  struct stat s;
289
213
  if (stat(linfo->log_file_name,&s))
290
214
  {
291
 
    sql_print_error("log %s listed in the index, but failed to stat",
 
215
    errmsg_printf(ERRMSG_LVL_ERROR, _("log %s listed in the index, but failed to stat"),
292
216
                    linfo->log_file_name);
293
217
    return(1);
294
218
  }
301
225
{
302
226
  LOG_INFO linfo;
303
227
  rli->log_space_total= 0;
304
 
  if (rli->relay_log.find_log_pos(&linfo, NullS, 1))
 
228
  if (rli->relay_log.find_log_pos(&linfo, NULL, 1))
305
229
  {
306
 
    sql_print_error("Could not find first log while counting relay log space");
 
230
    errmsg_printf(ERRMSG_LVL_ERROR, _("Could not find first log while counting relay "
 
231
                      "log space"));
307
232
    return(1);
308
233
  }
309
234
  do
415
340
    Test to see if the previous run was with the skip of purging
416
341
    If yes, we do not purge when we restart
417
342
  */
418
 
  if (rli->relay_log.find_log_pos(&rli->linfo, NullS, 1))
 
343
  if (rli->relay_log.find_log_pos(&rli->linfo, NULL, 1))
419
344
  {
420
345
    *errmsg="Could not find first log during relay log initialization";
421
346
    goto err;
426
351
    *errmsg="Could not find target log during relay log initialization";
427
352
    goto err;
428
353
  }
429
 
  strmake(rli->group_relay_log_name,rli->linfo.log_file_name,
430
 
          sizeof(rli->group_relay_log_name)-1);
431
 
  strmake(rli->event_relay_log_name,rli->linfo.log_file_name,
432
 
          sizeof(rli->event_relay_log_name)-1);
 
354
 
 
355
  rli->group_relay_log_name.assign(rli->linfo.log_file_name);
 
356
  rli->event_relay_log_name.assign(rli->linfo.log_file_name);
 
357
 
433
358
  if (rli->relay_log.is_active(rli->linfo.log_file_name))
434
359
  {
435
360
    /*
488
413
        rli->relay_log.description_event_for_exec= (Format_description_log_event*) ev;
489
414
        /*
490
415
          As ev was returned by read_log_event, it has passed is_valid(), so
491
 
          my_malloc() in ctor worked, no need to check again.
 
416
          malloc() in ctor worked, no need to check again.
492
417
        */
493
418
        /*
494
419
          Ok, we found a Format_description event. But it is not sure that this
543
468
 
544
469
  SYNOPSIS
545
470
    wait_for_pos()
546
 
    thd             client thread that sent SELECT MASTER_POS_WAIT
 
471
    session             client thread that sent SELECT MASTER_POS_WAIT
547
472
    log_name        log name to wait for
548
473
    log_pos         position to wait for
549
474
    timeout         timeout in seconds before giving up waiting
562
487
                before reaching the desired log/position
563
488
 */
564
489
 
565
 
int32_t Relay_log_info::wait_for_pos(THD* thd, String* log_name,
 
490
int32_t Relay_log_info::wait_for_pos(Session* session, String* log_name,
566
491
                                    int64_t log_pos,
567
492
                                    int64_t timeout)
568
493
{
577
502
 
578
503
  set_timespec(abstime,timeout);
579
504
  pthread_mutex_lock(&data_lock);
580
 
  msg= thd->enter_cond(&data_cond, &data_lock,
 
505
  msg= session->enter_cond(&data_cond, &data_lock,
581
506
                       "Waiting for the slave SQL thread to "
582
507
                       "advance position");
583
508
  /*
603
528
  */
604
529
  uint32_t log_name_extension;
605
530
  char log_name_tmp[FN_REFLEN]; //make a char[] from String
606
 
 
607
 
  strmake(log_name_tmp, log_name->ptr(), min(log_name->length(), (uint32_t)FN_REFLEN-1));
 
531
  size_t len= cmin(log_name->length(), (uint32_t)FN_REFLEN-1);
 
532
  strncpy(log_name_tmp, log_name->ptr(), len);
 
533
  log_name_tmp[len]= '\0';
608
534
 
609
535
  char *p= fn_ext(log_name_tmp);
610
536
  char *p_end;
614
540
    goto err;
615
541
  }
616
542
  // Convert 0-3 to 4
617
 
  log_pos= max(log_pos, (int64_t)BIN_LOG_HEADER_SIZE);
 
543
  log_pos= cmax(log_pos, (int64_t)BIN_LOG_HEADER_SIZE);
618
544
  /* p points to '.' */
619
545
  log_name_extension= strtoul(++p, &p_end, 10);
620
546
  /*
629
555
  }
630
556
 
631
557
  /* The "compare and wait" main loop */
632
 
  while (!thd->killed &&
 
558
  while (!session->killed &&
633
559
         init_abort_pos_wait == abort_pos_wait &&
634
560
         slave_running)
635
561
  {
649
575
      configuration which does nothing), then group_master_log_pos
650
576
      will grow and group_master_log_name will stay "".
651
577
    */
652
 
    if (*group_master_log_name)
 
578
    if (group_master_log_name.length())
653
579
    {
654
 
      char *basename= (group_master_log_name +
655
 
                       dirname_length(group_master_log_name));
 
580
      const char *basename= (group_master_log_name.c_str() +
 
581
                             dirname_length(group_master_log_name.c_str()));
656
582
      /*
657
583
        First compare the parts before the extension.
658
584
        Find the dot in the master's log basename,
675
601
 
676
602
      pos_reached= ((!cmp_result && group_master_log_pos >= (uint64_t)log_pos) ||
677
603
                    cmp_result > 0);
678
 
      if (pos_reached || thd->killed)
 
604
      if (pos_reached || session->killed)
679
605
        break;
680
606
    }
681
607
 
712
638
  }
713
639
 
714
640
err:
715
 
  thd->exit_cond(msg);
716
 
  if (thd->killed || init_abort_pos_wait != abort_pos_wait ||
 
641
  session->exit_cond(msg);
 
642
  if (session->killed || init_abort_pos_wait != abort_pos_wait ||
717
643
      !slave_running)
718
644
  {
719
645
    error= -2;
729
655
    pthread_mutex_lock(&data_lock);
730
656
  inc_event_relay_log_pos();
731
657
  group_relay_log_pos= event_relay_log_pos;
732
 
  strmake(group_relay_log_name,event_relay_log_name,
733
 
          sizeof(group_relay_log_name)-1);
 
658
  group_relay_log_name.assign(event_relay_log_name);
734
659
 
735
660
  notify_group_relay_log_name_update();
736
661
 
777
702
 
778
703
void Relay_log_info::close_temporary_tables()
779
704
{
780
 
  TABLE *table,*next;
 
705
  Table *table,*next;
781
706
 
782
707
  for (table=save_temporary_tables ; table ; table=next)
783
708
  {
800
725
    Assumes to have a run lock on rli and that no slave thread are running.
801
726
*/
802
727
 
803
 
int32_t purge_relay_logs(Relay_log_info* rli, THD *thd, bool just_reset,
 
728
int32_t purge_relay_logs(Relay_log_info* rli, Session *session, bool just_reset,
804
729
                     const char** errmsg)
805
730
{
806
731
  int32_t error=0;
850
775
    rli->cur_log_fd= -1;
851
776
  }
852
777
 
853
 
  if (rli->relay_log.reset_logs(thd))
 
778
  if (rli->relay_log.reset_logs(session))
854
779
  {
855
780
    *errmsg = "Failed during log reset";
856
781
    error=1;
857
782
    goto err;
858
783
  }
859
784
  /* Save name of used relay log file */
860
 
  strmake(rli->group_relay_log_name, rli->relay_log.get_log_fname(),
861
 
          sizeof(rli->group_relay_log_name)-1);
862
 
  strmake(rli->event_relay_log_name, rli->relay_log.get_log_fname(),
863
 
          sizeof(rli->event_relay_log_name)-1);
 
785
  rli->group_relay_log_name.assign(rli->relay_log.get_log_fname());
 
786
  rli->event_relay_log_name.assign(rli->relay_log.get_log_fname());
864
787
  rli->group_relay_log_pos= rli->event_relay_log_pos= BIN_LOG_HEADER_SIZE;
865
788
  if (count_relay_log_space(rli))
866
789
  {
868
791
    goto err;
869
792
  }
870
793
  if (!just_reset)
871
 
    error= init_relay_log_pos(rli, rli->group_relay_log_name,
 
794
    error= init_relay_log_pos(rli, rli->group_relay_log_name.c_str(),
872
795
                              rli->group_relay_log_pos,
873
796
                              0 /* do not need data lock */, errmsg, 0);
874
797
 
920
843
 
921
844
  if (until_condition == UNTIL_MASTER_POS)
922
845
  {
923
 
    log_name= group_master_log_name;
 
846
    log_name= group_master_log_name.c_str();
924
847
    log_pos= master_beg_pos;
925
848
  }
926
849
  else
927
850
  { /* until_condition == UNTIL_RELAY_POS */
928
 
    log_name= group_relay_log_name;
 
851
    log_name= group_relay_log_name.c_str();
929
852
    log_pos= group_relay_log_pos;
930
853
  }
931
854
 
959
882
      else
960
883
      {
961
884
        /* Probably error so we aborting */
962
 
        sql_print_error("Slave SQL thread is stopped because UNTIL "
963
 
                        "condition is bad.");
 
885
        errmsg_printf(ERRMSG_LVL_ERROR, _("Slave SQL thread is stopped because UNTIL "
 
886
                          "condition is bad."));
964
887
        return(true);
965
888
      }
966
889
    }
974
897
}
975
898
 
976
899
 
977
 
void Relay_log_info::cached_charset_invalidate()
978
 
{
979
 
  /* Full of zeroes means uninitialized. */
980
 
  memset(cached_charset, 0, sizeof(cached_charset));
981
 
  return;
982
 
}
983
 
 
984
 
 
985
 
bool Relay_log_info::cached_charset_compare(char *charset) const
986
 
{
987
 
  if (memcmp(cached_charset, charset, sizeof(cached_charset)))
988
 
  {
989
 
    memcpy(const_cast<char*>(cached_charset), charset, sizeof(cached_charset));
990
 
    return(1);
991
 
  }
992
 
  return(0);
993
 
}
994
 
 
995
 
 
996
900
void Relay_log_info::stmt_done(my_off_t event_master_log_pos,
997
901
                                  time_t event_creation_time)
998
902
{
1022
926
    middle of the "transaction". START SLAVE will resume at BEGIN
1023
927
    while the MyISAM table has already been updated.
1024
928
  */
1025
 
  if ((sql_thd->options & OPTION_BEGIN) && opt_using_transactions)
 
929
  if ((sql_session->options & OPTION_BEGIN) && opt_using_transactions)
1026
930
    inc_event_relay_log_pos();
1027
931
  else
1028
932
  {
1041
945
  }
1042
946
}
1043
947
 
1044
 
#if !defined(DRIZZLE_CLIENT) && defined(HAVE_REPLICATION)
1045
 
void Relay_log_info::cleanup_context(THD *thd, bool error)
 
948
void Relay_log_info::cleanup_context(Session *session, bool error)
1046
949
{
1047
 
  assert(sql_thd == thd);
 
950
  assert(sql_session == session);
1048
951
  /*
1049
952
    1) Instances of Table_map_log_event, if ::do_apply_event() was called on them,
1050
953
    may have opened tables, which we cannot be sure have been closed (because
1059
962
  */
1060
963
  if (error)
1061
964
  {
1062
 
    ha_autocommit_or_rollback(thd, 1); // if a "statement transaction"
1063
 
    end_trans(thd, ROLLBACK); // if a "real transaction"
 
965
    ha_autocommit_or_rollback(session, 1); // if a "statement transaction"
 
966
    end_trans(session, ROLLBACK); // if a "real transaction"
1064
967
  }
1065
968
  m_table_map.clear_tables();
1066
 
  close_thread_tables(thd);
 
969
  close_thread_tables(session);
1067
970
  clear_tables_to_lock();
1068
971
  clear_flag(IN_STMT);
1069
972
  /*
1070
973
    Cleanup for the flags that have been set at do_apply_event.
1071
974
  */
1072
 
  thd->options&= ~OPTION_NO_FOREIGN_KEY_CHECKS;
1073
 
  thd->options&= ~OPTION_RELAXED_UNIQUE_CHECKS;
 
975
  session->options&= ~OPTION_NO_FOREIGN_KEY_CHECKS;
 
976
  session->options&= ~OPTION_RELAXED_UNIQUE_CHECKS;
1074
977
  last_event_start_time= 0;
1075
978
  return;
1076
979
}
1077
980
 
 
981
 
 
982
bool Relay_log_info::is_in_group() const {
 
983
  return (sql_session->options & OPTION_BEGIN) ||
 
984
      (m_flags & (1UL << IN_STMT));
 
985
}
 
986
 
 
987
 
1078
988
void Relay_log_info::clear_tables_to_lock()
1079
989
{
1080
990
  while (tables_to_lock)
1081
991
  {
1082
 
    uchar* to_free= reinterpret_cast<uchar*>(tables_to_lock);
 
992
    unsigned char* to_free= reinterpret_cast<unsigned char*>(tables_to_lock);
1083
993
    if (tables_to_lock->m_tabledef_valid)
1084
994
    {
1085
995
      tables_to_lock->m_tabledef.table_def::~table_def();
1086
996
      tables_to_lock->m_tabledef_valid= false;
1087
997
    }
1088
998
    tables_to_lock=
1089
 
      static_cast<RPL_TABLE_LIST*>(tables_to_lock->next_global);
 
999
      static_cast<RPL_TableList*>(tables_to_lock->next_global);
1090
1000
    tables_to_lock_count--;
1091
 
    my_free(to_free, MYF(MY_WME));
 
1001
    free(to_free);
1092
1002
  }
1093
1003
  assert(tables_to_lock == NULL && tables_to_lock_count == 0);
1094
1004
}
1095
 
 
1096
 
#endif