~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/log.cc

  • Committer: Eric Herman
  • Date: 2008-12-06 19:42:46 UTC
  • mto: (656.1.6 devel)
  • mto: This revision was merged to the branch mainline in revision 665.
  • Revision ID: eric@mysql.com-20081206194246-5cdexuu81i366eek
removed trailing whitespace with simple script:

for file in $(find . -name "*.c") $(find . -name "*.cc") $(find . -name "*.h"); do ruby -pe 'gsub(/\s+$/, $/)' < $file > $file.out; mv $file.out $file; done;

Show diffs side-by-side

added added

removed removed

Lines of Context:
590
590
    non-transactional table. Otherwise, truncate the binlog cache starting
591
591
    from the SAVEPOINT command.
592
592
  */
593
 
  if (unlikely(session->transaction.all.modified_non_trans_table || 
 
593
  if (unlikely(session->transaction.all.modified_non_trans_table ||
594
594
               (session->options & OPTION_KEEP_LOG)))
595
595
  {
596
596
    int error=
629
629
{
630
630
  File file;
631
631
 
632
 
  if ((file = my_open(log_file_name, O_RDONLY, 
 
632
  if ((file = my_open(log_file_name, O_RDONLY,
633
633
                      MYF(MY_WME))) < 0)
634
634
  {
635
635
    sql_print_error(_("Failed to open log (file '%s', errno %d)"),
1422
1422
  {
1423
1423
    if ((error= my_delete_allow_opened(linfo.log_file_name, MYF(0))) != 0)
1424
1424
    {
1425
 
      if (my_errno == ENOENT) 
 
1425
      if (my_errno == ENOENT)
1426
1426
      {
1427
1427
        push_warning_printf(current_session, DRIZZLE_ERROR::WARN_LEVEL_WARN,
1428
1428
                            ER_LOG_PURGE_NO_FILE, ER(ER_LOG_PURGE_NO_FILE),
1453
1453
  close(LOG_CLOSE_INDEX);
1454
1454
  if ((error= my_delete_allow_opened(index_file_name, MYF(0)))) // Reset (open will update)
1455
1455
  {
1456
 
    if (my_errno == ENOENT) 
 
1456
    if (my_errno == ENOENT)
1457
1457
    {
1458
1458
      push_warning_printf(current_session, DRIZZLE_ERROR::WARN_LEVEL_WARN,
1459
1459
                          ER_LOG_PURGE_NO_FILE, ER(ER_LOG_PURGE_NO_FILE),
1550
1550
    context switches
1551
1551
  */
1552
1552
  pthread_cond_broadcast(&rli->log_space_cond);
1553
 
  
 
1553
 
1554
1554
  /*
1555
1555
    Read the next log file name from the index file and pass it back to
1556
1556
    the caller
1636
1636
                                stat() or my_delete()
1637
1637
*/
1638
1638
 
1639
 
int DRIZZLE_BIN_LOG::purge_logs(const char *to_log, 
 
1639
int DRIZZLE_BIN_LOG::purge_logs(const char *to_log,
1640
1640
                          bool included,
1641
 
                          bool need_mutex, 
1642
 
                          bool need_update_threads, 
 
1641
                          bool need_mutex,
 
1642
                          bool need_update_threads,
1643
1643
                          uint64_t *decrease_log_space)
1644
1644
{
1645
1645
  int error;
1664
1664
    struct stat s;
1665
1665
    if (stat(log_info.log_file_name, &s))
1666
1666
    {
1667
 
      if (errno == ENOENT) 
 
1667
      if (errno == ENOENT)
1668
1668
      {
1669
1669
        /*
1670
1670
          It's not fatal if we can't stat a log file that does not exist;
1671
1671
          If we could not stat, we won't delete.
1672
 
        */     
 
1672
        */
1673
1673
        push_warning_printf(current_session, DRIZZLE_ERROR::WARN_LEVEL_WARN,
1674
1674
                            ER_LOG_PURGE_NO_FILE, ER(ER_LOG_PURGE_NO_FILE),
1675
1675
                            log_info.log_file_name);
1702
1702
      }
1703
1703
      else
1704
1704
      {
1705
 
        if (my_errno == ENOENT) 
 
1705
        if (my_errno == ENOENT)
1706
1706
        {
1707
1707
          push_warning_printf(current_session, DRIZZLE_ERROR::WARN_LEVEL_WARN,
1708
1708
                              ER_LOG_PURGE_NO_FILE, ER(ER_LOG_PURGE_NO_FILE),
1733
1733
    if (find_next_log(&log_info, 0) || exit_loop)
1734
1734
      break;
1735
1735
  }
1736
 
  
 
1736
 
1737
1737
  /*
1738
1738
    If we get killed -9 here, the sysadmin would have to edit
1739
1739
    the log index file after restart - otherwise, this should be safe
1789
1789
  {
1790
1790
    if (stat(log_info.log_file_name, &stat_area))
1791
1791
    {
1792
 
      if (errno == ENOENT) 
 
1792
      if (errno == ENOENT)
1793
1793
      {
1794
1794
        /*
1795
1795
          It's not fatal if we can't stat a log file that does not exist.
1796
 
        */     
 
1796
        */
1797
1797
        push_warning_printf(current_session, DRIZZLE_ERROR::WARN_LEVEL_WARN,
1798
1798
                            ER_LOG_PURGE_NO_FILE, ER(ER_LOG_PURGE_NO_FILE),
1799
1799
                            log_info.log_file_name);
1823
1823
        break;
1824
1824
      if (my_delete(log_info.log_file_name, MYF(0)))
1825
1825
      {
1826
 
        if (my_errno == ENOENT) 
 
1826
        if (my_errno == ENOENT)
1827
1827
        {
1828
1828
          /* It's not fatal even if we can't delete a log file */
1829
1829
          push_warning_printf(current_session, DRIZZLE_ERROR::WARN_LEVEL_WARN,
1874
1874
 
1875
1875
void DRIZZLE_BIN_LOG::make_log_name(char* buf, const char* log_ident)
1876
1876
{
1877
 
  uint32_t dir_len = dirname_length(log_file_name); 
 
1877
  uint32_t dir_len = dirname_length(log_file_name);
1878
1878
  if (dir_len >= FN_REFLEN)
1879
1879
    dir_len=FN_REFLEN-1;
1880
1880
  my_stpncpy(buf, log_file_name, dir_len);
2103
2103
 
2104
2104
bool DRIZZLE_BIN_LOG::is_query_in_union(Session *session, query_id_t query_id_param)
2105
2105
{
2106
 
  return (session->binlog_evt_union.do_union && 
 
2106
  return (session->binlog_evt_union.do_union &&
2107
2107
          query_id_param >= session->binlog_evt_union.first_query_id);
2108
2108
}
2109
2109
 
2765
2765
{
2766
2766
  const char *old_msg;
2767
2767
  old_msg= session->enter_cond(&update_cond, &LOCK_log,
2768
 
                           "Slave has read all relay log; " 
 
2768
                           "Slave has read all relay log; "
2769
2769
                           "waiting for the slave I/O "
2770
2770
                           "thread to update it" );
2771
2771
  pthread_cond_wait(&update_cond, &LOCK_log);
2777
2777
/**
2778
2778
  Wait until we get a signal that the binary log has been updated.
2779
2779
  Applies to master only.
2780
 
     
 
2780
 
2781
2781
  NOTES
2782
2782
  @param[in] session        a Session struct
2783
2783
  @param[in] timeout    a pointer to a timespec;
2910
2910
  register int flag;
2911
2911
  const char *start;
2912
2912
 
2913
 
  flag= 0; 
 
2913
  flag= 0;
2914
2914
  start= str;
2915
2915
  while (*str++ == ' ') ;
2916
2916
  if (*--str == '-' || *str == '+')
2963
2963
  return;
2964
2964
}
2965
2965
 
2966
 
void sql_print_error(const char *format, ...) 
 
2966
void sql_print_error(const char *format, ...)
2967
2967
{
2968
2968
  va_list args;
2969
2969
 
2975
2975
}
2976
2976
 
2977
2977
 
2978
 
void sql_print_warning(const char *format, ...) 
 
2978
void sql_print_warning(const char *format, ...)
2979
2979
{
2980
2980
  va_list args;
2981
2981
 
2987
2987
}
2988
2988
 
2989
2989
 
2990
 
void sql_print_information(const char *format, ...) 
 
2990
void sql_print_information(const char *format, ...)
2991
2991
{
2992
2992
  va_list args;
2993
2993
 
3131
3131
  memcpy(data, tc_log_magic, sizeof(tc_log_magic));
3132
3132
  data[sizeof(tc_log_magic)]= (unsigned char)total_ha_2pc;
3133
3133
  // must cast data to (char *) for solaris. Arg1 is (void *) on linux
3134
 
  //   so the cast should be fine. 
 
3134
  //   so the cast should be fine.
3135
3135
  msync((char *)data, tc_log_page_size, MS_SYNC);
3136
3136
  my_sync(fd, MYF(0));
3137
3137
  inited=5;
3339
3339
    note - no locks are held at this point
3340
3340
  */
3341
3341
  // must cast data to (char *) for solaris. Arg1 is (void *) on linux
3342
 
  //   so the cast should be fine. 
 
3342
  //   so the cast should be fine.
3343
3343
  err= msync((char *)syncing->start, 1, MS_SYNC);
3344
3344
  if(err==0)
3345
3345
    err= my_sync(fd, MYF(0));