~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to sql/log.cc

  • Committer: Stewart Smith
  • Date: 2008-06-30 05:33:25 UTC
  • mfrom: (12.2.8 drizzle)
  • mto: This revision was merged to the branch mainline in revision 19.
  • Revision ID: stewart@flamingspork.com-20080630053325-mwrv6bjaufcpvj8n
merge my work

Show diffs side-by-side

added added

removed removed

Lines of Context:
2458
2458
    LOG_INFO_EOF                to_log not found
2459
2459
    LOG_INFO_EMFILE             too many files opened
2460
2460
    LOG_INFO_FATAL              if any other than ENOENT error from
2461
 
                                my_stat() or my_delete()
 
2461
                                stat() or my_delete()
2462
2462
*/
2463
2463
 
2464
2464
int MYSQL_BIN_LOG::purge_logs(const char *to_log, 
2488
2488
  while ((strcmp(to_log,log_info.log_file_name) || (exit_loop=included)) &&
2489
2489
         !log_in_use(log_info.log_file_name))
2490
2490
  {
2491
 
    MY_STAT s;
2492
 
    if (!my_stat(log_info.log_file_name, &s, MYF(0)))
 
2491
    struct stat s;
 
2492
    if (stat(log_info.log_file_name, &s))
2493
2493
    {
2494
 
      if (my_errno == ENOENT) 
 
2494
      if (errno == ENOENT) 
2495
2495
      {
2496
2496
        /*
2497
2497
          It's not fatal if we can't stat a log file that does not exist;
2500
2500
        push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
2501
2501
                            ER_LOG_PURGE_NO_FILE, ER(ER_LOG_PURGE_NO_FILE),
2502
2502
                            log_info.log_file_name);
2503
 
        sql_print_information("Failed to execute my_stat on file '%s'",
 
2503
        sql_print_information("Failed to execute stat on file '%s'",
2504
2504
                              log_info.log_file_name);
2505
2505
        my_errno= 0;
2506
2506
      }
2597
2597
  @retval
2598
2598
    LOG_INFO_PURGE_NO_ROTATE    Binary file that can't be rotated
2599
2599
    LOG_INFO_FATAL              if any other than ENOENT error from
2600
 
                                my_stat() or my_delete()
 
2600
                                stat() or my_delete()
2601
2601
*/
2602
2602
 
2603
2603
int MYSQL_BIN_LOG::purge_logs_before_date(time_t purge_time)
2604
2604
{
2605
2605
  int error;
2606
2606
  LOG_INFO log_info;
2607
 
  MY_STAT stat_area;
 
2607
  struct stat stat_area;
2608
2608
 
2609
2609
  DBUG_ENTER("purge_logs_before_date");
2610
2610
 
2621
2621
  while (strcmp(log_file_name, log_info.log_file_name) &&
2622
2622
         !log_in_use(log_info.log_file_name))
2623
2623
  {
2624
 
    if (!my_stat(log_info.log_file_name, &stat_area, MYF(0)))
 
2624
    if (stat(log_info.log_file_name, &stat_area))
2625
2625
    {
2626
 
      if (my_errno == ENOENT) 
 
2626
      if (errno == ENOENT) 
2627
2627
      {
2628
2628
        /*
2629
2629
          It's not fatal if we can't stat a log file that does not exist.
2631
2631
        push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
2632
2632
                            ER_LOG_PURGE_NO_FILE, ER(ER_LOG_PURGE_NO_FILE),
2633
2633
                            log_info.log_file_name);
2634
 
        sql_print_information("Failed to execute my_stat on file '%s'",
 
2634
        sql_print_information("Failed to execute stat on file '%s'",
2635
2635
                              log_info.log_file_name);
2636
2636
        my_errno= 0;
2637
2637
      }
4246
4246
 
4247
4247
  memcpy(data, tc_log_magic, sizeof(tc_log_magic));
4248
4248
  data[sizeof(tc_log_magic)]= (uchar)total_ha_2pc;
4249
 
  my_msync(fd, data, tc_log_page_size, MS_SYNC);
 
4249
  msync(data, tc_log_page_size, MS_SYNC);
 
4250
  my_sync(fd, MYF(0));
4250
4251
  inited=5;
4251
4252
 
4252
4253
  pthread_mutex_init(&LOCK_sync,    MY_MUTEX_INIT_FAST);
4451
4452
    sit down and relax - this can take a while...
4452
4453
    note - no locks are held at this point
4453
4454
  */
4454
 
  err= my_msync(fd, syncing->start, 1, MS_SYNC);
 
4455
  err= msync(syncing->start, 1, MS_SYNC);
 
4456
  if(err==0)
 
4457
    err= my_sync(fd, MYF(0));
4455
4458
 
4456
4459
  /* page is synced. let's move it to the pool */
4457
4460
  pthread_mutex_lock(&LOCK_pool);