List:Commits« Previous MessageNext Message »
From:Guilhem Bichot Date:May 9 2011 9:12am
Subject:bzr commit into mysql-trunk branch (guilhem.bichot:3303)
View as plain text  
#At file:///home/mysql_src/bzrrepos_new/mysql-next-mr-opt-backporting-wl4800/ based on revid:guilhem.bichot@stripped

 3303 Guilhem Bichot	2011-05-09
      Fix for bug in TRASH_MEM(), occurring on valgrind pb2 machine. This bug had
      been introduced by me when I changed TRASH_MEM to ease debugging of an optimizer trace bug,
      in guilhem.bichot@stripped .
      Fix for unrelated test failure.
     @ include/my_sys.h
        Cache B, or MEM_UNDEFINED makes a stupid number of bytes undefined (this
        caused test failures!).
        Check addressability _before_ trashing, so that Valgrind has first chance to spot
        adressability errors.
        Remove TRASH_SUB, integrate it in TRASH() instead.
     @ mysql-test/suite/funcs_1/r/is_columns_is_embedded.result
        some new columns in I_S impact this test

    modified:
      include/my_sys.h
      mysql-test/suite/funcs_1/r/is_columns_is_embedded.result
=== modified file 'include/my_sys.h'
--- a/include/my_sys.h	2011-04-05 07:34:13 +0000
+++ b/include/my_sys.h	2011-05-09 09:12:03 +0000
@@ -158,15 +158,22 @@ extern void *my_memdup(const void *from,
 extern char *my_strdup(const char *from,myf MyFlags);
 extern char *my_strndup(const char *from, size_t length,
 				   myf MyFlags);
-#ifndef DBUG_OFF
-/* Put bad content in memory to be sure it will segfault if dereferenced */
-#define TRASH_SUB(A,B) do{memset(A,0x8F,B);} while (0);
-#else
-#define TRASH_SUB(A,B)
-#endif
+#if !defined(DBUG_OFF) || defined(HAVE_VALGRIND)
+/**
+  Put bad content in memory to be sure it will segfault if dereferenced.
+  With Valgrind, verify that memory is addressable, and mark it undefined.
+  We cache value of B because if B is expression which depends on A, memset()
+  trashes value of B.
+*/
 #define TRASH(A,B) do {                                                 \
-    TRASH_SUB(A,B); MEM_CHECK_ADDRESSABLE(A,B); MEM_UNDEFINED(A,B);     \
+    const size_t l= (B);                                                \
+    MEM_CHECK_ADDRESSABLE(A, l);                                        \
+    memset(A, 0x8F, l);                                                 \
+    MEM_UNDEFINED(A, l);                                                \
   } while (0)
+#else
+#define TRASH(A,B) do {} while(0)
+#endif
 #if defined(ENABLED_DEBUG_SYNC)
 extern void (*debug_sync_C_callback_ptr)(const char *, size_t);
 #define DEBUG_SYNC_C(_sync_point_name_) do {                            \

=== modified file 'mysql-test/suite/funcs_1/r/is_columns_is_embedded.result'
--- a/mysql-test/suite/funcs_1/r/is_columns_is_embedded.result	2011-03-18 11:20:23 +0000
+++ b/mysql-test/suite/funcs_1/r/is_columns_is_embedded.result	2011-05-09 09:12:03 +0000
@@ -125,6 +125,10 @@ def	information_schema	KEY_COLUMN_USAGE	
 def	information_schema	KEY_COLUMN_USAGE	TABLE_CATALOG	4		NO	varchar	512	1536	NULL	NULL	utf8	utf8_general_ci	varchar(512)				
 def	information_schema	KEY_COLUMN_USAGE	TABLE_NAME	6		NO	varchar	64	192	NULL	NULL	utf8	utf8_general_ci	varchar(64)				
 def	information_schema	KEY_COLUMN_USAGE	TABLE_SCHEMA	5		NO	varchar	64	192	NULL	NULL	utf8	utf8_general_ci	varchar(64)				
+def	information_schema	OPTIMIZER_TRACE	INSUFFICIENT_PRIVILEGES	4	0	NO	tinyint	NULL	NULL	3	0	NULL	NULL	tinyint(1)				
+def	information_schema	OPTIMIZER_TRACE	MISSING_BYTES_BEYOND_MAX_MEM_SIZE	3	0	NO	int	NULL	NULL	10	0	NULL	NULL	int(20)				
+def	information_schema	OPTIMIZER_TRACE	QUERY	1	NULL	NO	longtext	4294967295	4294967295	NULL	NULL	utf8	utf8_general_ci	longtext				
+def	information_schema	OPTIMIZER_TRACE	TRACE	2	NULL	NO	longtext	4294967295	4294967295	NULL	NULL	utf8	utf8_general_ci	longtext				
 def	information_schema	PARAMETERS	CHARACTER_MAXIMUM_LENGTH	8	NULL	YES	int	NULL	NULL	10	0	NULL	NULL	int(21)				
 def	information_schema	PARAMETERS	CHARACTER_OCTET_LENGTH	9	NULL	YES	int	NULL	NULL	10	0	NULL	NULL	int(21)				
 def	information_schema	PARAMETERS	CHARACTER_SET_NAME	12	NULL	YES	varchar	64	192	NULL	NULL	utf8	utf8_general_ci	varchar(64)				
@@ -374,6 +378,7 @@ COL_CML	DATA_TYPE	CHARACTER_SET_NAME	COL
 NULL	bigint	NULL	NULL
 NULL	datetime	NULL	NULL
 NULL	int	NULL	NULL
+NULL	tinyint	NULL	NULL
 --> CHAR(0) is allowed (see manual), and here both CHARACHTER_* values
 --> are 0, which is intended behavior, and the result of 0 / 0 IS NULL
 SELECT CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML,
@@ -513,6 +518,10 @@ NULL	information_schema	KEY_COLUMN_USAGE
 3.0000	information_schema	KEY_COLUMN_USAGE	REFERENCED_TABLE_SCHEMA	varchar	64	192	utf8	utf8_general_ci	varchar(64)
 3.0000	information_schema	KEY_COLUMN_USAGE	REFERENCED_TABLE_NAME	varchar	64	192	utf8	utf8_general_ci	varchar(64)
 3.0000	information_schema	KEY_COLUMN_USAGE	REFERENCED_COLUMN_NAME	varchar	64	192	utf8	utf8_general_ci	varchar(64)
+1.0000	information_schema	OPTIMIZER_TRACE	QUERY	longtext	4294967295	4294967295	utf8	utf8_general_ci	longtext
+1.0000	information_schema	OPTIMIZER_TRACE	TRACE	longtext	4294967295	4294967295	utf8	utf8_general_ci	longtext
+NULL	information_schema	OPTIMIZER_TRACE	MISSING_BYTES_BEYOND_MAX_MEM_SIZE	int	NULL	NULL	NULL	NULL	int(20)
+NULL	information_schema	OPTIMIZER_TRACE	INSUFFICIENT_PRIVILEGES	tinyint	NULL	NULL	NULL	NULL	tinyint(1)
 3.0000	information_schema	PARAMETERS	SPECIFIC_CATALOG	varchar	512	1536	utf8	utf8_general_ci	varchar(512)
 3.0000	information_schema	PARAMETERS	SPECIFIC_SCHEMA	varchar	64	192	utf8	utf8_general_ci	varchar(64)
 3.0000	information_schema	PARAMETERS	SPECIFIC_NAME	varchar	64	192	utf8	utf8_general_ci	varchar(64)


Attachment: [text/bzr-bundle] bzr/guilhem.bichot@oracle.com-20110509091203-kvq55t5gregotc9b.bundle
Thread
bzr commit into mysql-trunk branch (guilhem.bichot:3303) Guilhem Bichot9 May