List:Commits« Previous MessageNext Message »
From:Martin Hansson Date:November 25 2009 12:34pm
Subject:bzr push into mysql-pe branch (martin.hansson:3711 to 3712) Bug#48459
View as plain text  
 3712 Martin Hansson	2009-11-25 [merge]
      Merge of 
      - fix for Bug#48459
      - auto-merge by Tatiana A. Nurnberg
      - Post-merge fix for bug 41728 by Davi Arnaut 

    modified:
      include/mysql.h
      include/mysql.h.pp
      libmysql/libmysql.c
      libmysql/libmysql.def
      libmysqld/libmysqld.def
      mysql-test/r/range.result
      mysql-test/t/range.test
      sql/opt_range.cc
 3711 Tatiana A. Nurnberg	2009-11-24 [merge]
      le merge auto

=== modified file 'include/mysql.h'
--- a/include/mysql.h	2009-11-09 10:27:46 +0000
+++ b/include/mysql.h	2009-11-25 12:33:29 +0000
@@ -459,16 +459,6 @@ unsigned long STDCALL mysql_real_escape_
 					       char *to,const char *from,
 					       unsigned long length);
 void		STDCALL mysql_debug(const char *debug);
-char *		STDCALL mysql_odbc_escape_string(MYSQL *mysql,
-						 char *to,
-						 unsigned long to_length,
-						 const char *from,
-						 unsigned long from_length,
-						 void *param,
-						 char *
-						 (*extend_buffer)
-						 (void *, char *to,
-						  unsigned long *length));
 void 		STDCALL myodbc_remove_escape(MYSQL *mysql,char *name);
 unsigned int	STDCALL mysql_thread_safe(void);
 my_bool		STDCALL mysql_embedded(void);

=== modified file 'include/mysql.h.pp'
--- a/include/mysql.h.pp	2009-11-09 10:27:46 +0000
+++ b/include/mysql.h.pp	2009-11-25 12:33:29 +0000
@@ -472,16 +472,6 @@ unsigned long mysql_real_escape_string(M
             char *to,const char *from,
             unsigned long length);
 void mysql_debug(const char *debug);
-char * mysql_odbc_escape_string(MYSQL *mysql,
-       char *to,
-       unsigned long to_length,
-       const char *from,
-       unsigned long from_length,
-       void *param,
-       char *
-       (*extend_buffer)
-       (void *, char *to,
-        unsigned long *length));
 void myodbc_remove_escape(MYSQL *mysql,char *name);
 unsigned int mysql_thread_safe(void);
 my_bool mysql_embedded(void);

=== modified file 'libmysql/libmysql.c'
--- a/libmysql/libmysql.c	2009-11-20 13:50:24 +0000
+++ b/libmysql/libmysql.c	2009-11-25 12:33:29 +0000
@@ -1258,20 +1258,6 @@ mysql_real_escape_string(MYSQL *mysql, c
   return escape_string_for_mysql(mysql->charset, to, 0, from, length);
 }
 
-
-char * STDCALL
-mysql_odbc_escape_string(MYSQL *mysql __attribute__((unused)),
-                         char *to __attribute__((unused)),
-                         ulong to_length __attribute__((unused)),
-                         const char *from __attribute__((unused)),
-                         ulong from_length __attribute__((unused)),
-                         void *param __attribute__((unused)),
-                         char * (*extend_buffer)(void *, char *, ulong *)
-                         __attribute__((unused)))
-{
-  return NULL;
-}
-
 void STDCALL
 myodbc_remove_escape(MYSQL *mysql,char *name)
 {

=== modified file 'libmysql/libmysql.def'
--- a/libmysql/libmysql.def	2009-11-09 10:27:46 +0000
+++ b/libmysql/libmysql.def	2009-11-25 12:33:29 +0000
@@ -52,7 +52,6 @@ EXPORTS
 	mysql_next_result
 	mysql_num_fields
 	mysql_num_rows
-	mysql_odbc_escape_string
 	mysql_options
 	mysql_stmt_param_count
 	mysql_stmt_param_metadata

=== modified file 'libmysqld/libmysqld.def'
--- a/libmysqld/libmysqld.def	2009-11-09 10:27:46 +0000
+++ b/libmysqld/libmysqld.def	2009-11-25 12:33:29 +0000
@@ -47,7 +47,6 @@ EXPORTS
 	mysql_next_result
 	mysql_num_fields
 	mysql_num_rows
-	mysql_odbc_escape_string
 	mysql_options
 	mysql_ping
 	mysql_query

=== modified file 'mysql-test/r/range.result'
--- a/mysql-test/r/range.result	2009-11-20 13:50:24 +0000
+++ b/mysql-test/r/range.result	2009-11-25 12:33:29 +0000
@@ -1604,6 +1604,39 @@ str_to_date('', '%Y-%m-%d')
 0000-00-00
 DROP TABLE t1, t2;
 #
+# Bug#48459: valgrind errors with query using 'Range checked for each 
+# record'
+#
+CREATE TABLE t1 (
+a INT,
+b CHAR(2),
+c INT,
+d INT,
+KEY ( c ),
+KEY ( d, a, b ( 2 ) ),
+KEY ( b ( 1 ) )
+);
+INSERT INTO t1 VALUES ( NULL, 'a', 1, 2 ), ( NULL, 'a', 1, 2 ),
+( 1,    'a', 1, 2 ), ( 1,    'a', 1, 2 );
+CREATE TABLE t2 (
+a INT,
+c INT,
+e INT,
+KEY ( e )
+);
+INSERT INTO t2 VALUES ( 1, 1, NULL ), ( 1, 1, NULL );
+# Should not give Valgrind warnings
+SELECT 1
+FROM t1, t2
+WHERE t1.d <> '1' AND t1.b > '1'
+AND t1.a = t2.a AND t1.c = t2.c;
+1
+1
+1
+1
+1
+DROP TABLE t1, t2;
+#
 # Bug #48665: sql-bench's insert test fails due to wrong result
 #
 CREATE TABLE t1 (a INT, b INT, PRIMARY KEY (a));

=== modified file 'mysql-test/t/range.test'
--- a/mysql-test/t/range.test	2009-11-20 13:18:12 +0000
+++ b/mysql-test/t/range.test	2009-11-25 12:33:29 +0000
@@ -1261,6 +1261,39 @@ SELECT str_to_date('', '%Y-%m-%d');
 
 DROP TABLE t1, t2;
 
+--echo #
+--echo # Bug#48459: valgrind errors with query using 'Range checked for each 
+--echo # record'
+--echo #
+CREATE TABLE t1 (
+  a INT,
+  b CHAR(2),
+  c INT,
+  d INT,
+  KEY ( c ),
+  KEY ( d, a, b ( 2 ) ),
+  KEY ( b ( 1 ) )
+);
+
+INSERT INTO t1 VALUES ( NULL, 'a', 1, 2 ), ( NULL, 'a', 1, 2 ),
+                      ( 1,    'a', 1, 2 ), ( 1,    'a', 1, 2 );
+
+CREATE TABLE t2 (
+  a INT,
+  c INT,
+  e INT,
+  KEY ( e )
+);
+
+INSERT INTO t2 VALUES ( 1, 1, NULL ), ( 1, 1, NULL );
+
+--echo # Should not give Valgrind warnings
+SELECT 1
+FROM t1, t2
+WHERE t1.d <> '1' AND t1.b > '1'
+AND t1.a = t2.a AND t1.c = t2.c;
+
+DROP TABLE t1, t2;
 
 --echo #
 --echo # Bug #48665: sql-bench's insert test fails due to wrong result
@@ -1281,7 +1314,6 @@ SELECT * FROM t1 FORCE INDEX (PRIMARY) 
 
 DROP TABLE t1;
 
-
 --echo End of 5.1 tests
 
 #

=== modified file 'sql/opt_range.cc'
--- a/sql/opt_range.cc	2009-11-23 10:10:11 +0000
+++ b/sql/opt_range.cc	2009-11-25 12:33:29 +0000
@@ -502,9 +502,9 @@ public:
     
     if (key_tree->next_key_part &&
         key_tree->part != last_part &&
+	key_tree->next_key_part->type == SEL_ARG::KEY_RANGE &&
 	key_tree->next_key_part->part == key_tree->part+1 &&
-	!(*range_key_flag & (NO_MIN_RANGE | NEAR_MIN)) &&
-	key_tree->next_key_part->type == SEL_ARG::KEY_RANGE)
+	!(*range_key_flag & (NO_MIN_RANGE | NEAR_MIN)))
       res+= key_tree->next_key_part->store_min_key(key,
                                                    range_key,
                                                    range_key_flag,
@@ -524,9 +524,9 @@ public:
     (*range_key_flag)|= key_tree->max_flag;
     if (key_tree->next_key_part &&
         key_tree->part != last_part &&
+        key_tree->next_key_part->type == SEL_ARG::KEY_RANGE &&
         key_tree->next_key_part->part == key_tree->part+1 &&
-        !(*range_key_flag & (NO_MAX_RANGE | NEAR_MAX)) &&
-        key_tree->next_key_part->type == SEL_ARG::KEY_RANGE)
+        !(*range_key_flag & (NO_MAX_RANGE | NEAR_MAX)))
       res+= key_tree->next_key_part->store_max_key(key,
                                                    range_key,
                                                    range_key_flag,
@@ -1788,6 +1788,7 @@ SEL_ARG *SEL_ARG::clone(RANGE_OPT_PARAM 
     tmp->prev= *next_arg;			// Link into next/prev chain
     (*next_arg)->next=tmp;
     (*next_arg)= tmp;
+    tmp->part= this->part;
   }
   else
   {
@@ -7442,27 +7443,25 @@ int test_rb_tree(SEL_ARG *element,SEL_AR
 }
 
 
-/*
-  Count how many times SEL_ARG graph "root" refers to its part "key"
+/**
+  Count how many times SEL_ARG graph "root" refers to its part "key" via
+  transitive closure.
   
-  SYNOPSIS
-    count_key_part_usage()
-      root  An RB-Root node in a SEL_ARG graph.
-      key   Another RB-Root node in that SEL_ARG graph.
+  @param root  An RB-Root node in a SEL_ARG graph.
+  @param key   Another RB-Root node in that SEL_ARG graph.
 
-  DESCRIPTION
-    The passed "root" node may refer to "key" node via root->next_key_part,
-    root->next->n
+  The passed "root" node may refer to "key" node via root->next_key_part,
+  root->next->n
 
-    This function counts how many times the node "key" is referred (via
-    SEL_ARG::next_key_part) by 
-     - intervals of RB-tree pointed by "root", 
-     - intervals of RB-trees that are pointed by SEL_ARG::next_key_part from 
-       intervals of RB-tree pointed by "root",
-     - and so on.
+  This function counts how many times the node "key" is referred (via
+  SEL_ARG::next_key_part) by 
+  - intervals of RB-tree pointed by "root", 
+  - intervals of RB-trees that are pointed by SEL_ARG::next_key_part from 
+  intervals of RB-tree pointed by "root",
+  - and so on.
     
-    Here is an example (horizontal links represent next_key_part pointers, 
-    vertical links - next/prev prev pointers):  
+  Here is an example (horizontal links represent next_key_part pointers, 
+  vertical links - next/prev prev pointers):  
     
          +----+               $
          |root|-----------------+
@@ -7482,8 +7481,8 @@ int test_rb_tree(SEL_ARG *element,SEL_AR
           ...     +---+       $    |
                   |   |------------+
                   +---+       $
-  RETURN 
-    Number of links to "key" from nodes reachable from "root".
+  @return 
+  Number of links to "key" from nodes reachable from "root".
 */
 
 static ulong count_key_part_usage(SEL_ARG *root, SEL_ARG *key)
@@ -8116,8 +8115,8 @@ get_quick_keys(PARAM *param,QUICK_RANGE_
                                  &tmp_max_key,max_key_flag);
 
   if (key_tree->next_key_part &&
-      key_tree->next_key_part->part == key_tree->part+1 &&
-      key_tree->next_key_part->type == SEL_ARG::KEY_RANGE)
+      key_tree->next_key_part->type == SEL_ARG::KEY_RANGE &&
+      key_tree->next_key_part->part == key_tree->part+1)
   {						  // const key as prefix
     if ((tmp_min_key - min_key) == (tmp_max_key - max_key) &&
          memcmp(min_key, max_key, (uint)(tmp_max_key - max_key))==0 &&


Attachment: [text/bzr-bundle] bzr/martin.hansson@sun.com-20091125123329-fcn743bydy4ueje0.bundle
Thread
bzr push into mysql-pe branch (martin.hansson:3711 to 3712) Bug#48459Martin Hansson25 Nov