List:Internals« Previous MessageNext Message »
From:msvensson Date:November 21 2005 12:58pm
Subject:bk commit into 5.0 tree (msvensson:1.1981)
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of msvensson. When msvensson 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
  1.1981 05/11/21 13:57:57 msvensson@neptunus.(none) +1 -0
  Clean up print of thd->options

  sql/ha_ndbcluster.cc
    1.220 05/11/21 13:57:18 msvensson@neptunus.(none) +30 -21
    Clean up print out of thd->options, made small util function only called in debug mode.

# 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:	msvensson
# Host:	neptunus.(none)
# Root:	/home/msvensson/mysql/bug13228/my50-bug13228

--- 1.219/sql/ha_ndbcluster.cc	2005-11-03 21:42:21 +01:00
+++ 1.220/sql/ha_ndbcluster.cc	2005-11-21 13:57:18 +01:00
@@ -114,9 +114,11 @@
 static int unpackfrm(const void **data, uint *len,
                      const void* pack_data);
 
-static int ndb_get_table_statistics(Ndb*, const char *, 
+static int ndb_get_table_statistics(Ndb*, const char *,
                                     struct Ndb_statistics *);
 
+static void print_options(ulonglong opts);
+
 // Util thread variables
 static pthread_t ndb_util_thread;
 pthread_mutex_t LOCK_ndb_util_thread;
@@ -3169,19 +3171,6 @@
   DBUG_RETURN(to);
 }
 
-#ifndef DBUG_OFF
-#define PRINT_OPTION_FLAGS(t) { \
-      if (t->options & OPTION_NOT_AUTOCOMMIT) \
-        DBUG_PRINT("thd->options", ("OPTION_NOT_AUTOCOMMIT")); \
-      if (t->options & OPTION_BEGIN) \
-        DBUG_PRINT("thd->options", ("OPTION_BEGIN")); \
-      if (t->options & OPTION_TABLE_LOCK) \
-        DBUG_PRINT("thd->options", ("OPTION_TABLE_LOCK")); \
-}
-#else
-#define PRINT_OPTION_FLAGS(t)
-#endif
-
 
 /*
   As MySQL will execute an external lock for every new table it uses
@@ -3220,11 +3209,11 @@
 
   if (lock_type != F_UNLCK)
   {
-    DBUG_PRINT("info", ("lock_type != F_UNLCK"));
+    DBUG_EXECUTE("lock", print_options(thd->options););
+
     if (!thd_ndb->lock_count++)
     {
-      PRINT_OPTION_FLAGS(thd);
-      if (!(thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))) 
+      if (!(thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)))
       {
         // Autocommit transaction
         DBUG_ASSERT(!thd_ndb->stmt);
@@ -3331,7 +3320,7 @@
   }
   else
   {
-    DBUG_PRINT("info", ("lock_type == F_UNLCK"));
+    DBUG_EXECUTE("unlock", print_options(thd->options););
 
     if (ndb_cache_check_time && m_rows_changed)
     {
@@ -3353,8 +3342,6 @@
     if (!--thd_ndb->lock_count)
     {
       DBUG_PRINT("trans", ("Last external_lock"));
-      PRINT_OPTION_FLAGS(thd);
-
       if (thd_ndb->stmt)
       {
         /*
@@ -3409,7 +3396,6 @@
 {
   int error=0;
   DBUG_ENTER("start_stmt");
-  PRINT_OPTION_FLAGS(thd);
 
   Thd_ndb *thd_ndb= get_thd_ndb(thd);
   NdbTransaction *trans= (thd_ndb->stmt)?thd_ndb->stmt:thd_ndb->all;
@@ -7444,5 +7430,28 @@
   
   DBUG_RETURN(FALSE);
 }
+
+#ifndef DBUG_OFF
+
+static void print_options(ulonglong opts)
+{
+  char buff[256];
+  String str(buff,(uint32) sizeof(buff), system_charset_info);
+  str.length(0);
+  if (opts & OPTION_NOT_AUTOCOMMIT)
+    str.append("OPTION_NOT_AUTOCOMMIT ");
+  if (opts & OPTION_BEGIN)
+    str.append("OPTION_BEGIN ");
+  if (opts & OPTION_TABLE_LOCK)
+    str.append("OPTION_TABLE_LOCK ");
+  str.append('\0');
+
+  DBUG_LOCK_FILE;
+  (void) fputs(str.ptr(),DBUG_FILE);
+  (void) fputc('\n',DBUG_FILE);
+  DBUG_UNLOCK_FILE;
+}
+
+#endif
 
 #endif /* HAVE_NDBCLUSTER_DB */
Thread
bk commit into 5.0 tree (msvensson:1.1981)msvensson21 Nov