List:Commits« Previous MessageNext Message »
From:Ingo Struewing Date:November 18 2007 7:54pm
Subject:bk commit into 5.1 tree (istruewing:1.2621)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of istruewing. When istruewing 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, 2007-11-18 20:54:34+01:00, istruewing@stripped +7 -0
  Debug functions for unified trace of TABLE values.
  
  Defined functions and macros to trace table values.
  Replaced individual trace messages by the new macros.

  sql/handler.h@stripped, 2007-11-18 20:54:32+01:00, istruewing@stripped +10 -0
    Debug functions for unified trace of TABLE values.
    Defined handler::dbug_print_table_file() for trace of handler
    values of an open table.

  sql/mysql_priv.h@stripped, 2007-11-18 20:54:32+01:00, istruewing@stripped +10 -0
    Debug functions for unified trace of TABLE values.
    Declared macros to disable tracing in non-debug builds.

  sql/sql_base.cc@stripped, 2007-11-18 20:54:32+01:00, istruewing@stripped +46 -38
    Debug functions for unified trace of TABLE values.
    Replaced individual trace messages by the new macros.
    Defined functions to trace table values.

  sql/table.cc@stripped, 2007-11-18 20:54:32+01:00, istruewing@stripped +1 -1
    Debug functions for unified trace of TABLE values.
    Replaced individual trace messages by the new macros.

  storage/myisam/ha_myisam.cc@stripped, 2007-11-18 20:54:32+01:00, istruewing@stripped +27 -8
    Debug functions for unified trace of TABLE values.
    Added ENTER/RETURN tracing.
    Defined ha_myisam::dbug_print_table_file() for trace of myisam
    values of an open table.

  storage/myisam/ha_myisam.h@stripped, 2007-11-18 20:54:32+01:00, istruewing@stripped +6 -0
    Debug functions for unified trace of TABLE values.
    Declared ha_myisam::dbug_print_table_file() for trace of myisam
    values of an open table.

  storage/myisammrg/ha_myisammrg.h@stripped, 2007-11-18 20:54:32+01:00, istruewing@stripped +10 -0
    Debug functions for unified trace of TABLE values.
    Defined ha_myisammrg::dbug_print_table_file() for trace of MERGE
    values of an open table.

diff -Nrup a/sql/handler.h b/sql/handler.h
--- a/sql/handler.h	2007-09-07 15:41:46 +02:00
+++ b/sql/handler.h	2007-11-18 20:54:32 +01:00
@@ -1801,6 +1801,16 @@ private:
   {
     return 0;
   }
+
+#ifdef EXTRA_DEBUG
+ public:
+  virtual void dbug_print_table_file(const char *keyword)
+  {
+    DBUG_PRINT(keyword, ("       file-tbl: 0x%lx  file-tbl-s: 0x%lx",
+                         (long) table, (long) table_share));
+  }
+#endif
+
 };
 
 	/* Some extern variables used with handlers */
diff -Nrup a/sql/mysql_priv.h b/sql/mysql_priv.h
--- a/sql/mysql_priv.h	2007-11-15 20:25:41 +01:00
+++ b/sql/mysql_priv.h	2007-11-18 20:54:32 +01:00
@@ -105,6 +105,16 @@ char* query_table_status(THD *thd,const 
                         "in MySQL %s. Please use %s instead.", (Old), (Ver), (New)); \
   } while(0)
 
+#ifdef EXTRA_DEBUG
+void dbug_print_st_table(const char *keyword, struct st_table *table);
+void dbug_print_open_tables(const char *keyword, struct st_table *open_tables);
+#define DBUG_PRINT_TABLE(_k_, _t_)         dbug_print_st_table(_k_, _t_)
+#define DBUG_PRINT_OPEN_TABLES(_k_, _t_)   dbug_print_open_tables(_k_, _t_)
+#else
+#define DBUG_PRINT_TABLE(_kwd_, _tbl_)  do{}while(0)
+#define DBUG_PRINT_OPEN_TABLES(_kwd_)   do{}while(0)
+#endif
+
 extern CHARSET_INFO *system_charset_info, *files_charset_info ;
 extern CHARSET_INFO *national_charset_info, *table_alias_charset;
 
diff -Nrup a/sql/sql_base.cc b/sql/sql_base.cc
--- a/sql/sql_base.cc	2007-11-15 20:25:41 +01:00
+++ b/sql/sql_base.cc	2007-11-18 20:54:32 +01:00
@@ -696,6 +696,7 @@ void close_handle_and_leave_table_as_loc
   char *key_buff;
   MEM_ROOT *mem_root= &table->mem_root;
   DBUG_ENTER("close_handle_and_leave_table_as_lock");
+  DBUG_PRINT_TABLE("tcache_open", table);
 
   DBUG_ASSERT(table->db_stat);
 
@@ -821,10 +822,7 @@ OPEN_TABLE_LIST *list_open_tables(THD *t
 void intern_close_table(TABLE *table)
 {						// Free all structures
   DBUG_ENTER("intern_close_table");
-  DBUG_PRINT("tcache", ("table: '%s'.'%s' 0x%lx",
-                        table->s ? table->s->db.str : "?",
-                        table->s ? table->s->table_name.str : "?",
-                        (long) table));
+  DBUG_PRINT_TABLE("tcache", table);
 
   free_io_cache(table);
   delete table->triggers;
@@ -1245,13 +1243,7 @@ void close_thread_tables(THD *thd)
   TABLE *table;
   prelocked_mode_type prelocked_mode= thd->prelocked_mode;
   DBUG_ENTER("close_thread_tables");
-
-#ifdef EXTRA_DEBUG
-  DBUG_PRINT("tcache", ("open tables:"));
-  for (table= thd->open_tables; table; table= table->next)
-    DBUG_PRINT("tcache", ("table: '%s'.'%s' 0x%lx", table->s->db.str,
-                          table->s->table_name.str, (long) table));
-#endif
+  DBUG_PRINT_OPEN_TABLES("tcache_open", thd->open_tables);
 
   /*
     We are assuming here that thd->derived_tables contains ONLY derived
@@ -1379,8 +1371,7 @@ bool close_thread_table(THD *thd, TABLE 
   DBUG_ENTER("close_thread_table");
   DBUG_ASSERT(table->key_read == 0);
   DBUG_ASSERT(!table->file || table->file->inited == handler::NONE);
-  DBUG_PRINT("tcache", ("table: '%s'.'%s' 0x%lx", table->s->db.str,
-                        table->s->table_name.str, (long) table));
+  DBUG_PRINT_TABLE("tcache", table);
 
   *table_ptr=table->next;
   /*
@@ -1858,9 +1849,7 @@ void close_temporary_table(THD *thd, TAB
                            bool free_share, bool delete_table)
 {
   DBUG_ENTER("close_temporary_table");
-  DBUG_PRINT("tmptable", ("closing table: '%s'.'%s' 0x%lx  alias: '%s'",
-                          table->s->db.str, table->s->table_name.str,
-                          (long) table, table->alias));
+  DBUG_PRINT_TABLE("tmptable", table);
 
   /*
     When closing a MERGE parent or child table, detach the children
@@ -1917,8 +1906,7 @@ void close_temporary(TABLE *table, bool 
 {
   handlerton *table_type= table->s->db_type();
   DBUG_ENTER("close_temporary");
-  DBUG_PRINT("tmptable", ("closing table: '%s'.'%s'",
-                          table->s->db.str, table->s->table_name.str));
+  DBUG_PRINT_TABLE("tmptable", table);
 
   free_io_cache(table);
   closefrm(table, 0);
@@ -2549,7 +2537,7 @@ TABLE *open_table(THD *thd, TABLE_LIST *
 	}
 	table->query_id= thd->query_id;
 	thd->thread_specific_used= TRUE;
-        DBUG_PRINT("info",("Using temporary table"));
+        DBUG_PRINT_TABLE("tcache_temp", table);
         goto reset;
       }
     }
@@ -2639,7 +2627,7 @@ TABLE *open_table(THD *thd, TABLE_LIST *
     {
       table= best_table;
       table->query_id= thd->query_id;
-      DBUG_PRINT("info",("Using locked table"));
+      DBUG_PRINT_TABLE("tcache_locked", table);
       goto reset;
     }
     /*
@@ -2749,8 +2737,7 @@ TABLE *open_table(THD *thd, TABLE_LIST *
        table= (TABLE*) hash_next(&open_cache, (uchar*) key, key_length,
                                  &state))
   {
-    DBUG_PRINT("tcache", ("in_use table: '%s'.'%s' 0x%lx", table->s->db.str,
-                          table->s->table_name.str, (long) table));
+    DBUG_PRINT_TABLE("tcache_in_use", table);
     /*
       Here we flush tables marked for flush.
       Normally, table->s->version contains the value of
@@ -2839,8 +2826,7 @@ TABLE *open_table(THD *thd, TABLE_LIST *
   }
   if (table)
   {
-    DBUG_PRINT("tcache", ("unused table: '%s'.'%s' 0x%lx", table->s->db.str,
-                          table->s->table_name.str, (long) table));
+    DBUG_PRINT_TABLE("tcache_unused", table);
     /* Unlink the table from "unused_tables" list. */
     if (table == unused_tables)
     {						// First unused
@@ -2923,9 +2909,7 @@ TABLE *open_table(THD *thd, TABLE_LIST *
       VOID(pthread_mutex_unlock(&LOCK_open));
       DBUG_RETURN(0); // VIEW
     }
-    DBUG_PRINT("info", ("inserting table '%s'.'%s' 0x%lx into the cache",
-                        table->s->db.str, table->s->table_name.str,
-                        (long) table));
+    DBUG_PRINT_TABLE("tache_new", table);
     VOID(my_hash_insert(&open_cache,(uchar*) table));
   }
 
@@ -3015,8 +2999,7 @@ bool reopen_table(TABLE *table)
   TABLE_LIST table_list;
   THD *thd= table->in_use;
   DBUG_ENTER("reopen_table");
-  DBUG_PRINT("tcache", ("table: '%s'.'%s' 0x%lx", table->s->db.str,
-                        table->s->table_name.str, (long) table));
+  DBUG_PRINT_TABLE("tcache_old", table);
 
   DBUG_ASSERT(table->s->ref_count == 0);
   DBUG_ASSERT(!table->sort.io_cache);
@@ -3099,6 +3082,7 @@ bool reopen_table(TABLE *table)
     require reopen. See for example reopen_tables().
   */
 
+  DBUG_PRINT_TABLE("tcache_new", table);
   broadcast_refresh();
   error=0;
 
@@ -3285,10 +3269,7 @@ bool reopen_tables(THD *thd,bool get_loc
   {
     uint db_stat=table->db_stat;
     next=table->next;
-    DBUG_PRINT("tcache", ("open table: '%s'.'%s' 0x%lx  "
-                          "parent: 0x%lx  db_stat: %u",
-                          table->s->db.str, table->s->table_name.str,
-                          (long) table, (long) table->parent, db_stat));
+    DBUG_PRINT_TABLE("tcache", table);
     if (table->child_l && !db_stat)
       merge_table_found= TRUE;
     if (!tables || (!db_stat && reopen_table(table)))
@@ -3396,9 +3377,7 @@ void close_old_data_files(THD *thd, TABL
 
   for (; table ; table=table->next)
   {
-    DBUG_PRINT("tcache", ("checking table: '%s'.'%s' 0x%lx",
-                          table->s->db.str, table->s->table_name.str,
-                          (long) table));
+    DBUG_PRINT_TABLE("tcache", table);
     DBUG_PRINT("tcache", ("needs refresh: %d  is open: %u",
                           table->needs_reopen_or_name_lock(), table->db_stat));
     /*
@@ -8096,8 +8075,7 @@ bool remove_table_from_cache(THD *thd, c
                                    &state))
     {
       THD *in_use;
-      DBUG_PRINT("tcache", ("found table: '%s'.'%s' 0x%lx", table->s->db.str,
-                            table->s->table_name.str, (long) table));
+      DBUG_PRINT_TABLE("tcache_found", table);
 
       table->s->version=0L;		/* Free when thread is ready */
       if (!(in_use=table->in_use))
@@ -8756,3 +8734,33 @@ void close_performance_schema_table(THD 
 /**
   @} (end of group Data_Dictionary)
 */
+
+
+#ifdef EXTRA_DEBUG
+void dbug_print_st_table(const char *keyword, struct st_table *table)
+{
+  DBUG_PRINT(keyword, ("table: '%s'.'%s' 0x%lx  s: 0x%lx  file: 0x%lx",
+                       table->s ? table->s->db.str         : "?",
+                       table->s ? table->s->table_name.str : "?",
+                       (long) table, (long) table->s, (long) table->file));
+
+#ifdef EXTRA_EXTRA_DEBUG
+  DBUG_PRINT(keyword, ("       ref: %u  stat: %u  mem: 0x%lx",
+                       table->s->ref_count, table->db_stat,
+                       (long) &table->mem_root));
+
+  if (table->file)
+    table->file->dbug_print_table_file(keyword);
+#endif
+}
+
+
+void dbug_print_open_tables(const char *keyword, struct st_table *open_tables)
+{
+  DBUG_PRINT(keyword, ("open tables:"));
+
+  for (struct st_table *table= open_tables; table; table= table->next)
+    dbug_print_st_table(keyword, table);
+}
+#endif
+
diff -Nrup a/sql/table.cc b/sql/table.cc
--- a/sql/table.cc	2007-11-15 20:25:41 +01:00
+++ b/sql/table.cc	2007-11-18 20:54:32 +01:00
@@ -1932,7 +1932,7 @@ int closefrm(register TABLE *table, bool
   uint idx;
   KEY *key_info;
   DBUG_ENTER("closefrm");
-  DBUG_PRINT("enter", ("table: 0x%lx", (long) table));
+  DBUG_PRINT_TABLE("table", table);
 
   if (table->db_stat)
     error=table->file->close();
diff -Nrup a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc
--- a/storage/myisam/ha_myisam.cc	2007-11-15 20:25:41 +01:00
+++ b/storage/myisam/ha_myisam.cc	2007-11-18 20:54:32 +01:00
@@ -618,6 +618,7 @@ int ha_myisam::open(const char *name, in
   MI_COLUMNDEF *recinfo= 0;
   uint recs;
   uint i;
+  DBUG_ENTER("ha_myisam::open");
 
   /*
     If the user wants to have memory mapped data files, add an
@@ -638,7 +639,7 @@ int ha_myisam::open(const char *name, in
     test_if_locked|= HA_OPEN_MMAP;
 
   if (!(file=mi_open(name, mode, test_if_locked | HA_OPEN_FROM_SQL_LAYER)))
-    return (my_errno ? my_errno : -1);
+    DBUG_RETURN(my_errno ? my_errno : -1);
   if (!table->s->tmp_table) /* No need to perform a check for tmp table */
   {
     if ((my_errno= table2myisam(table, &keyinfo, &recinfo, &recs)))
@@ -690,14 +691,15 @@ int ha_myisam::open(const char *name, in
   */
   if (recinfo)
     my_free((uchar*) recinfo, MYF(0));
-  return my_errno;
+  DBUG_RETURN(my_errno);
 }
 
 int ha_myisam::close(void)
 {
   MI_INFO *tmp=file;
+  DBUG_ENTER("ha_myisam::close");
   file=0;
-  return mi_close(tmp);
+  DBUG_RETURN(mi_close(tmp));
 }
 
 int ha_myisam::write_row(uchar *buf)
@@ -723,11 +725,14 @@ int ha_myisam::write_row(uchar *buf)
 
 int ha_myisam::check(THD* thd, HA_CHECK_OPT* check_opt)
 {
-  if (!file) return HA_ADMIN_INTERNAL_ERROR;
   int error;
   MI_CHECK param;
   MYISAM_SHARE* share = file->s;
   const char *old_proc_info=thd->proc_info;
+  DBUG_ENTER("ha_myisam::check");
+
+  if (!file)
+    DBUG_RETURN(HA_ADMIN_INTERNAL_ERROR);
 
   thd->proc_info="Checking table";
   myisamchk_init(&param);
@@ -749,7 +754,7 @@ int ha_myisam::check(THD* thd, HA_CHECK_
 	share->state.open_count == 0) ||
        ((param.testflag & T_FAST) && (share->state.open_count ==
 				      (uint) (share->global_changed ? 1 : 0)))))
-    return HA_ADMIN_ALREADY_DONE;
+    DBUG_RETURN(HA_ADMIN_ALREADY_DONE);
 
   error = chk_status(&param, file);		// Not fatal
   error = chk_size(&param, file);
@@ -804,7 +809,7 @@ int ha_myisam::check(THD* thd, HA_CHECK_
   }
 
   thd->proc_info=old_proc_info;
-  return error ? HA_ADMIN_CORRUPT : HA_ADMIN_OK;
+  DBUG_RETURN(error ? HA_ADMIN_CORRUPT : HA_ADMIN_OK);
 }
 
 
@@ -958,8 +963,10 @@ int ha_myisam::repair(THD* thd, HA_CHECK
   int error;
   MI_CHECK param;
   ha_rows start_records;
+  DBUG_ENTER("ha_myisam::repair-thd-opt");
 
-  if (!file) return HA_ADMIN_INTERNAL_ERROR;
+  if (!file)
+    DBUG_RETURN(HA_ADMIN_INTERNAL_ERROR);
 
   myisamchk_init(&param);
   param.thd = thd;
@@ -999,7 +1006,7 @@ int ha_myisam::repair(THD* thd, HA_CHECK
                           llstr(start_records, llbuff2),
                           table->s->path.str);
   }
-  return error;
+  DBUG_RETURN(error);
 }
 
 int ha_myisam::optimize(THD* thd, HA_CHECK_OPT *check_opt)
@@ -2123,3 +2130,15 @@ my_bool ha_myisam::register_query_cache_
   return TRUE;
 }
 #endif
+
+#ifdef EXTRA_DEBUG
+void ha_myisam::dbug_print_table_file(const char *keyword)
+{
+  DBUG_PRINT(keyword, ("       filetbl: 0x%lx  mii: 0x%lx  mis: 0x%lx"
+                       "  state: 0x%lx",
+                       (long) table, (long) file,
+                       file ? (long) file->s : 0,
+                       file ? (long) file->state : 0));
+}
+#endif
+
diff -Nrup a/storage/myisam/ha_myisam.h b/storage/myisam/ha_myisam.h
--- a/storage/myisam/ha_myisam.h	2007-11-15 20:25:41 +01:00
+++ b/storage/myisam/ha_myisam.h	2007-11-18 20:54:32 +01:00
@@ -144,4 +144,10 @@ class ha_myisam: public handler
   {
     return file;
   }
+
+#ifdef EXTRA_DEBUG
+ public:
+  void dbug_print_table_file(const char *keyword);
+#endif
+
 };
diff -Nrup a/storage/myisammrg/ha_myisammrg.h b/storage/myisammrg/ha_myisammrg.h
--- a/storage/myisammrg/ha_myisammrg.h	2007-11-15 20:25:41 +01:00
+++ b/storage/myisammrg/ha_myisammrg.h	2007-11-18 20:54:32 +01:00
@@ -94,4 +94,14 @@ class ha_myisammrg: public handler
   TABLE *table_ptr() { return table; }
   bool check_if_incompatible_data(HA_CREATE_INFO *info, uint table_changes);
   int check(THD* thd, HA_CHECK_OPT* check_opt);
+
+#ifdef EXTRA_DEBUG
+ public:
+  void dbug_print_table_file(const char *keyword)
+  {
+    DBUG_PRINT(keyword, ("       filetbl: 0x%lx  myrg: 0x%lx",
+                         (long) table, (long) file));
+  }
+#endif
+
 };
Thread
bk commit into 5.1 tree (istruewing:1.2621)Ingo Struewing18 Nov