List:Internals« Previous MessageNext Message »
From:Osku Salerma Date:August 12 2005 10:40am
Subject:bk commit into 5.0 tree (osku:1.1980)
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of osku. When osku 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.1980 05/08/12 11:40:02 osku@127.(none) +2 -0
  Merge osalerma@stripped:/home/bk/mysql-5.0
  into  127.(none):/home/osku/mysql-5.0

  sql/ha_innodb.cc
    1.243 05/08/12 11:39:58 osku@127.(none) +0 -0
    Auto merged

  innobase/srv/srv0srv.c
    1.93 05/08/12 11:39:58 osku@127.(none) +0 -0
    Auto merged

# 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:	osku
# Host:	127.(none)
# Root:	/home/osku/mysql-5.0/RESYNC

--- 1.92/innobase/srv/srv0srv.c	2005-08-11 19:01:35 +03:00
+++ 1.93/innobase/srv/srv0srv.c	2005-08-12 11:39:58 +03:00
@@ -1000,7 +1000,7 @@
 		fputs(
 "  InnoDB: Error: trying to declare trx to enter InnoDB, but\n"
 "InnoDB: it already is declared.\n", stderr);
-		trx_print(stderr, trx);
+		trx_print(stderr, trx, 0);
 		putc('\n', stderr);
 		os_fast_mutex_unlock(&srv_conc_mutex);
 

--- 1.242/sql/ha_innodb.cc	2005-08-11 21:19:25 +03:00
+++ 1.243/sql/ha_innodb.cc	2005-08-12 11:39:58 +03:00
@@ -554,19 +554,20 @@
 }
 
 /*****************************************************************
-Prints info of a THD object (== user session thread) to the
-standard output. NOTE that /mysql/innobase/trx/trx0trx.c must contain
-the prototype for this function! */
+Prints info of a THD object (== user session thread) to the given file.
+NOTE that /mysql/innobase/trx/trx0trx.c must contain the prototype for
+this function! */
 extern "C"
 void
 innobase_mysql_print_thd(
 /*=====================*/
-	FILE*   f,	/* in: output stream */
-        void*   input_thd)/* in: pointer to a MySQL THD object */
+	FILE*   f,		/* in: output stream */
+	void*   input_thd,	/* in: pointer to a MySQL THD object */
+	uint	max_query_len)	/* in: max query length to print, or 0 to
+				   use the default max length */
 {
 	const THD*	thd;
 	const char*	s;
-	char		buf[301];
 
         thd = (const THD*) input_thd;
 
@@ -593,25 +594,47 @@
 	}
 
 	if ((s = thd->query)) {
-		/* determine the length of the query string */
-		uint32 i, len;
+		/* 3100 is chosen because currently 3000 is the maximum
+		   max_query_len we ever give this. */
+		char	buf[3100];
+		uint	len;
+
+		/* If buf is too small, we dynamically allocate storage
+		   in this. */
+		char*	dyn_str = NULL;
+
+		/* Points to buf or dyn_str. */
+		char*	str = buf;
+		
+		if (max_query_len == 0)
+		{
+			/* ADDITIONAL SAFETY: the default is to print at
+			   most 300 chars to reduce the probability of a
+			   seg fault if there is a race in
+			   thd->query_length in MySQL; after May 14, 2004
+			   probably no race any more, but better be
+			   safe */
+			max_query_len = 300;
+		}
 		
-		len = thd->query_length;
+		len = min(thd->query_length, max_query_len);
 
-		if (len > 300) {
-			len = 300;	/* ADDITIONAL SAFETY: print at most
-					300 chars to reduce the probability of
-					a seg fault if there is a race in
-					thd->query_length in MySQL; after
-					May 14, 2004 probably no race any more,
-					but better be safe */
+		if (len > (sizeof(buf) - 1))
+		{
+			dyn_str = my_malloc(len + 1, MYF(0));
+			str = dyn_str;
 		}
 
-                /* Use strmake to reduce the timeframe
-                   for a race, compared to fwrite() */
-		i= (uint) (strmake(buf, s, len) - buf);
+                /* Use strmake to reduce the timeframe for a race,
+                   compared to fwrite() */
+		len = (uint) (strmake(str, s, len) - str);
 		putc('\n', f);
-		fwrite(buf, 1, i, f);
+		fwrite(str, 1, len, f);
+
+		if (dyn_str)
+		{
+			my_free(dyn_str, MYF(0));
+		}
 	}
 
 	putc('\n', f);
Thread
bk commit into 5.0 tree (osku:1.1980)Osku Salerma12 Aug