[Commits] Rev 3020: Added logging of all messages (also system warnings) one gets during a MyISAM recovery or auto-recovery. in lp:maria/5.2

Michael Widenius monty at askmonty.org
Mon Aug 29 20:38:21 EEST 2011


At lp:maria/5.2

------------------------------------------------------------
revno: 3020
revision-id: monty at askmonty.org-20110829173821-7otwpzhurkzovjc3
parent: monty at askmonty.org-20110816160131-4kju8si1nqqnohxg
committer: Michael Widenius <monty at askmonty.org>
branch nick: maria-5.2
timestamp: Mon 2011-08-29 20:38:21 +0300
message:
  Added logging of all messages (also system warnings) one gets during a MyISAM recovery or auto-recovery.
-------------- next part --------------
=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc	2011-06-24 09:08:45 +0000
+++ b/sql/mysqld.cc	2011-08-29 17:38:21 +0000
@@ -3155,7 +3155,7 @@ int my_message_sql(uint error, const cha
   /* When simulating OOM, skip writing to error log to avoid mtr errors */
   DBUG_EXECUTE_IF("simulate_out_of_memory", DBUG_RETURN(0););
 
-  if (!thd || (MyFlags & ME_NOREFRESH))
+  if (!thd || thd->log_all_errors || (MyFlags & ME_NOREFRESH))
     (*func)("%s: %s", my_progname_short, str); /* purecov: inspected */
   DBUG_RETURN(0);
 }

=== modified file 'sql/sql_class.cc'
--- a/sql/sql_class.cc	2011-08-16 09:32:06 +0000
+++ b/sql/sql_class.cc	2011-08-29 17:38:21 +0000
@@ -662,7 +662,7 @@ THD::THD()
    Open_tables_state(refresh_version), rli_fake(0),
    lock_id(&main_lock_id),
    user_time(0), in_sub_stmt(0),
-   sql_log_bin_toplevel(false),
+   sql_log_bin_toplevel(false), log_all_errors(0),
    binlog_table_maps(0), binlog_flags(0UL),
    table_map_for_update(0),
    arg_of_last_insert_id_function(FALSE),

=== modified file 'sql/sql_class.h'
--- a/sql/sql_class.h	2011-05-04 12:47:27 +0000
+++ b/sql/sql_class.h	2011-08-29 17:38:21 +0000
@@ -1467,6 +1467,8 @@ class THD :public Statement,
   bool sql_log_bin_toplevel;
   /* True when opt_userstat_running is set at start of query */
   bool userstat_running;
+  /* True if we want to log all errors */
+  bool log_all_errors;
 
   /* container for handler's private per-connection data */
   Ha_data ha_data[MAX_HA];

=== modified file 'storage/myisam/ha_myisam.cc'
--- a/storage/myisam/ha_myisam.cc	2011-08-16 10:06:07 +0000
+++ b/storage/myisam/ha_myisam.cc	2011-08-29 17:38:21 +0000
@@ -91,14 +91,16 @@ static void mi_check_print_msg(HA_CHECK
 
   if (!thd->vio_ok())
   {
-    sql_print_error("%s", msgbuf);
+    sql_print_error("%s.%s: %s", param->db_name, param->table_name, msgbuf);
     return;
   }
 
   if (param->testflag & (T_CREATE_MISSING_KEYS | T_SAFE_REPAIR |
                          T_AUTO_REPAIR))
   {
-    my_message(ER_NOT_KEYFILE,msgbuf,MYF(MY_WME));
+    my_message(ER_NOT_KEYFILE, msgbuf, MYF(MY_WME));
+    if (thd->variables.log_warnings > 2)
+      sql_print_error("%s.%s: %s", param->db_name, param->table_name, msgbuf);
     return;
   }
   length=(uint) (strxmov(name, param->db_name,".",param->table_name,NullS) -
@@ -124,7 +126,7 @@ static void mi_check_print_msg(HA_CHECK
     sql_print_error("Failed on my_net_write, writing to stderr instead: %s\n",
                     msgbuf);
   else if (thd->variables.log_warnings > 2)
-    sql_print_error("%s", msgbuf);
+    sql_print_error("%s.%s: %s", param->db_name, param->table_name, msgbuf);
 
 #ifdef THREAD
   if (param->need_print_msg_lock)
@@ -1668,7 +1670,10 @@ bool ha_myisam::check_and_repair(THD *th
 
   if ((marked_crashed= mi_is_crashed(file)) || check(thd, &check_opt))
   {
+    bool save_log_all_errors;
     sql_print_warning("Recovering table: '%s'",table->s->path.str);
+    save_log_all_errors= thd->log_all_errors;
+    thd->log_all_errors= (thd->variables.log_warnings > 2);
     if (myisam_recover_options & HA_RECOVER_FULL_BACKUP)
     {
       char buff[MY_BACKUP_NAME_EXTRA_LENGTH+1];
@@ -1686,6 +1691,7 @@ bool ha_myisam::check_and_repair(THD *th
        T_AUTO_REPAIR);
     if (repair(thd, &check_opt))
       error=1;
+    thd->log_all_errors= save_log_all_errors;
   }
   thd->set_query(old_query, old_query_length);
   DBUG_RETURN(error);



More information about the commits mailing list