List:Commits« Previous MessageNext Message »
From:David Li Date:October 13 2006 4:48am
Subject:bk commit into 5.1 tree (dli:1.2310) BUG#15021
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of dli. When dli does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2006-10-13 12:48:05+08:00, dli@stripped +6 -0
  ndb - fixed for BUG#15021, binlog_index table become inconsistent if errors during purge of binlogs.
  if EMFILE error occured while purging binary logs, stop purging logs and report error message to user.

  mysys/my_open.c@stripped, 2006-10-13 12:48:01+08:00, dli@stripped +10 -2
    report EMFILE error when opening file failed.

  sql/log.cc@stripped, 2006-10-13 12:48:01+08:00, dli@stripped +12 -0
    report EMFILE error when purging logs, and stop purging logs when EMFILE error occured.

  sql/log.h@stripped, 2006-10-13 12:48:01+08:00, dli@stripped +2 -0
    added LOG_INFO_EMFILE error number.

  sql/share/errmsg.txt@stripped, 2006-10-13 12:48:02+08:00, dli@stripped +2 -1
    added EMFILE error message for purging binary logs.

  sql/sql_repl.cc@stripped, 2006-10-13 12:48:02+08:00, dli@stripped +1 -0
    added EMFILE error message.

  sql/table.cc@stripped, 2006-10-13 12:48:02+08:00, dli@stripped +11 -0
    report EMFILE error.

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	dli
# Host:	dev3-76.dev.cn.tlan
# Root:	/home/dli/mysql/mysql-5.1/mysql-5.1-bug-15021

--- 1.29/mysys/my_open.c	2006-10-13 12:48:13 +08:00
+++ 1.30/mysys/my_open.c	2006-10-13 12:48:13 +08:00
@@ -167,9 +167,17 @@
   else
     my_errno=errno;
   DBUG_PRINT("error",("Got error %d on open",my_errno));
-  if (MyFlags & (MY_FFNF | MY_FAE | MY_WME))
-    my_error(error_message_number, MYF(ME_BELL+ME_WAITTANG),
+  if (MyFlags & (MY_FFNF | MY_FAE | MY_WME)) {
+    if (my_errno == EMFILE) {
+      DBUG_PRINT("error",("print err: %d",EE_OUT_OF_FILERESOURCES));
+      my_error(EE_OUT_OF_FILERESOURCES, MYF(ME_BELL+ME_WAITTANG),
 	     FileName, my_errno);
+    } else {
+      DBUG_PRINT("error",("print err: %d",error_message_number));
+      my_error(error_message_number, MYF(ME_BELL+ME_WAITTANG),
+	     FileName, my_errno);
+    }
+  }
   return(fd);
 }
 

--- 1.237/sql/log.cc	2006-10-13 12:48:14 +08:00
+++ 1.238/sql/log.cc	2006-10-13 12:48:14 +08:00
@@ -2687,6 +2687,7 @@
                           ulonglong *decrease_log_space)
 {
   int error;
+  int ret = 0;
   bool exit_loop= 0;
   LOG_INFO log_info;
   DBUG_ENTER("purge_logs");
@@ -2731,6 +2732,14 @@
       *decrease_log_space-= file_size;
 
     ha_binlog_index_purge_file(current_thd, log_info.log_file_name);
+    if (current_thd->query_error) {
+      DBUG_PRINT("info",("query error: %d", current_thd->query_error));
+      if (my_errno == EMFILE) {
+        DBUG_PRINT("info",("my_errno: %d, set ret = LOG_INFO_EMFILE", my_errno));
+        ret = LOG_INFO_EMFILE;
+        break;
+      }
+    }
 
     if (find_next_log(&log_info, 0) || exit_loop)
       break;
@@ -2741,6 +2750,9 @@
     the log index file after restart - otherwise, this should be safe
   */
   error= update_log_index(&log_info, need_update_threads);
+  if (error == 0) {
+    error = ret;
+  }
 
 err:
   if (need_mutex)

--- 1.243/sql/table.cc	2006-10-13 12:48:14 +08:00
+++ 1.244/sql/table.cc	2006-10-13 12:48:14 +08:00
@@ -1562,6 +1562,17 @@
 	error= 1;
 	my_errno= ENOENT;
       }
+      else if (ha_err == EMFILE)
+      {
+	/*
+          Too many files opened, use same error message as if the .frm
+           file can't open
+         */
+        DBUG_PRINT("error", ("open file: %s failed, too many files opened (errno: %d)", 
+		share->normalized_path.str, ha_err));
+	error= 1;
+	my_errno= EMFILE;
+      }
       else
       {
         outparam->file->print_error(ha_err, MYF(0));

--- 1.130/sql/share/errmsg.txt	2006-10-13 12:48:14 +08:00
+++ 1.131/sql/share/errmsg.txt	2006-10-13 12:48:14 +08:00
@@ -6001,4 +6001,5 @@
 ER_NON_INSERTABLE_TABLE  
         eng "The target table %-.100s of the %s is not insertable-into"
-
+ER_BINLOG_PURGE_EMFILE
+        eng "Too many files opened, please execute the command again"

--- 1.16/sql/log.h	2006-10-13 12:48:14 +08:00
+++ 1.17/sql/log.h	2006-10-13 12:48:14 +08:00
@@ -114,6 +114,8 @@
 #define LOG_INFO_MEM -6
 #define LOG_INFO_FATAL -7
 #define LOG_INFO_IN_USE -8
+#define LOG_INFO_EMFILE -9
+
 
 /* bitmap to SQL_LOG::close() */
 #define LOG_CLOSE_INDEX		1

--- 1.155/sql/sql_repl.cc	2006-10-13 12:48:14 +08:00
+++ 1.156/sql/sql_repl.cc	2006-10-13 12:48:14 +08:00
@@ -239,6 +239,7 @@
   case LOG_INFO_MEM:	errmsg= ER_OUT_OF_RESOURCES; break;
   case LOG_INFO_FATAL:	errmsg= ER_BINLOG_PURGE_FATAL_ERR; break;
   case LOG_INFO_IN_USE: errmsg= ER_LOG_IN_USE; break;
+  case LOG_INFO_EMFILE: errmsg= ER_BINLOG_PURGE_EMFILE; break;
   default:		errmsg= ER_LOG_PURGE_UNKNOWN_ERR; break;
   }
 
Thread
bk commit into 5.1 tree (dli:1.2310) BUG#15021David Li13 Oct