~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to server/rpl_mi.cc

  • Committer: Brian Aker
  • Date: 2008-07-14 04:46:28 UTC
  • Revision ID: brian@tangent.org-20080714044628-mk3nt2rbaeqt8oe9
Removed oddball types in my_global.h

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
   along with this program; if not, write to the Free Software
14
14
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
15
15
 
16
 
#include <drizzled/server_includes.h>
 
16
#include <my_global.h> // For HAVE_REPLICATION
 
17
#include "mysql_priv.h"
 
18
#include <my_dir.h>
 
19
 
17
20
#include "rpl_mi.h"
18
21
 
19
22
#ifdef HAVE_REPLICATION
37
40
  ssl_ca[0]= 0; ssl_capath[0]= 0; ssl_cert[0]= 0;
38
41
  ssl_cipher[0]= 0; ssl_key[0]= 0;
39
42
 
40
 
  memset(&file, 0, sizeof(file));
 
43
  bzero((char*) &file, sizeof(file));
41
44
  pthread_mutex_init(&run_lock, MY_MUTEX_INIT_FAST);
42
45
  pthread_mutex_init(&data_lock, MY_MUTEX_INIT_FAST);
43
46
  pthread_cond_init(&data_cond, NULL);
116
119
    return(0);
117
120
  }
118
121
 
119
 
  mi->drizzle=0;
 
122
  mi->mysql=0;
120
123
  mi->file_id=1;
121
124
  fn_format(fname, master_info_fname, mysql_data_home, "", 4+32);
122
125
 
145
148
      my_close(fd, MYF(MY_WME));
146
149
    if ((fd = my_open(fname, O_CREAT|O_RDWR|O_BINARY, MYF(MY_WME))) < 0 )
147
150
    {
148
 
      sql_print_error(_("Failed to create a new master info file (file '%s', errno %d)"), fname, my_errno);
 
151
      sql_print_error("Failed to create a new master info file (file '%s', errno %d)", fname, my_errno);
149
152
      goto err;
150
153
    }
151
154
    if (init_io_cache(&mi->file, fd, IO_SIZE*2, READ_CACHE, 0L,0,
152
155
                      MYF(MY_WME)))
153
156
    {
154
 
      sql_print_error(_("Failed to create a cache on master info file (file '%s')"), fname);
 
157
      sql_print_error("Failed to create a cache on master info file (file '%s')", fname);
155
158
      goto err;
156
159
    }
157
160
 
167
170
    {
168
171
      if ((fd = my_open(fname, O_RDWR|O_BINARY, MYF(MY_WME))) < 0 )
169
172
      {
170
 
        sql_print_error(_("Failed to open the existing master info file (file '%s', errno %d)"), fname, my_errno);
 
173
        sql_print_error("Failed to open the existing master info file (file '%s', errno %d)", fname, my_errno);
171
174
        goto err;
172
175
      }
173
176
      if (init_io_cache(&mi->file, fd, IO_SIZE*2, READ_CACHE, 0L,
174
177
                        0, MYF(MY_WME)))
175
178
      {
176
 
        sql_print_error(_("Failed to create a cache on master info file (file '%s')"), fname);
 
179
        sql_print_error("Failed to create a cache on master info file (file '%s')", fname);
177
180
        goto err;
178
181
      }
179
182
    }
273
276
    }
274
277
 
275
278
    if (ssl)
276
 
      sql_print_warning(_("SSL information in the master info file "
277
 
                          "('%s') are ignored because this MySQL slave was "
278
 
                          "compiled without SSL support."), fname);
 
279
      sql_print_warning("SSL information in the master info file "
 
280
                      "('%s') are ignored because this MySQL slave was "
 
281
                      "compiled without SSL support.", fname);
279
282
 
280
283
    /*
281
284
      This has to be handled here as init_intvar_from_file can't handle
297
300
  // now change cache READ -> WRITE - must do this before flush_master_info
298
301
  reinit_io_cache(&mi->file, WRITE_CACHE, 0L, 0, 1);
299
302
  if ((error=test(flush_master_info(mi, 1))))
300
 
    sql_print_error(_("Failed to flush master info file"));
 
303
    sql_print_error("Failed to flush master info file");
301
304
  pthread_mutex_unlock(&mi->data_lock);
302
305
  return(error);
303
306
 
304
307
errwithmsg:
305
 
  sql_print_error(_("Error reading master configuration"));
 
308
  sql_print_error("Error reading master configuration");
306
309
 
307
310
err:
308
311
  if (fd >= 0)
360
363
     of file we don't care about this garbage.
361
364
  */
362
365
  char heartbeat_buf[sizeof(mi->heartbeat_period) * 4]; // buffer to suffice always
363
 
  sprintf(heartbeat_buf, "%.3f", mi->heartbeat_period);
 
366
  my_sprintf(heartbeat_buf, (heartbeat_buf, "%.3f", mi->heartbeat_period));
364
367
  my_b_seek(file, 0L);
365
368
  my_b_printf(file,
366
369
              "%u\n%s\n%s\n%s\n%s\n%s\n%d\n%d\n%d\n%s\n%s\n%s\n%s\n%s\n%d\n%s\n",