List:Commits« Previous MessageNext Message »
From:Joerg Bruehe Date:November 10 2008 8:46pm
Subject:bzr push into mysql-5.0 branch (joerg:2660 to 2661)
View as plain text  
 2661 Joerg Bruehe	2008-11-10 [merge]
      Merge main 5.0 -> 5.0-build
modified:
  mysql-test/r/group_by.result
  mysql-test/r/rpl_flush_log_loop.result
  mysql-test/r/sp.result
  mysql-test/r/status2.result
  mysql-test/r/view.result
  mysql-test/t/group_by.test
  mysql-test/t/rpl_flush_log_loop.test
  mysql-test/t/sp.test
  mysql-test/t/status2.test
  mysql-test/t/view.test
  sql/sql_base.cc
  sql/sql_select.cc
  sql/sql_select.h
  sql/sql_view.cc
  support-files/mysql.spec.sh

 2660 Joerg Bruehe	2008-10-27 [merge]
      Merge a correction for the 38098 bug into 5.0-build,
      it will also be used in the 5.0.72 release.
modified:
  configure.in

=== modified file 'mysql-test/r/group_by.result'
--- a/mysql-test/r/group_by.result	2008-03-27 16:49:32 +0000
+++ b/mysql-test/r/group_by.result	2008-10-24 02:16:22 +0000
@@ -1359,4 +1359,34 @@ tt
 41
 SET sql_mode=@save_sql_mode;
 DROP TABLE t1, t2;
+# 
+# BUG#38072: Wrong result: HAVING not observed in a query with aggregate
+# 
+CREATE TABLE t1 (
+pk int(11) NOT NULL AUTO_INCREMENT,
+int_nokey int(11) NOT NULL,
+int_key int(11) NOT NULL,
+varchar_key varchar(1) NOT NULL,
+varchar_nokey varchar(1) NOT NULL,
+PRIMARY KEY (pk),
+KEY int_key (int_key),
+KEY varchar_key (varchar_key)
+);
+INSERT INTO t1 VALUES 
+(1,5,5, 'h','h'),
+(2,1,1, '{','{'),
+(3,1,1, 'z','z'),
+(4,8,8, 'x','x'),
+(5,7,7, 'o','o'),
+(6,3,3, 'p','p'),
+(7,9,9, 'c','c'),
+(8,0,0, 'k','k'),
+(9,6,6, 't','t'),
+(10,0,0,'c','c');
+explain SELECT COUNT(varchar_key) AS X FROM t1 WHERE pk = 8 having 'foo'='bar';
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Impossible HAVING
+SELECT COUNT(varchar_key) AS X FROM t1 WHERE pk = 8 having 'foo'='bar';
+X
+drop table t1;
 End of 5.0 tests

=== modified file 'mysql-test/r/rpl_flush_log_loop.result'
--- a/mysql-test/r/rpl_flush_log_loop.result	2007-10-10 07:21:11 +0000
+++ b/mysql-test/r/rpl_flush_log_loop.result	2008-10-26 19:34:24 +0000
@@ -20,5 +20,36 @@ master_password='',master_port=SLAVE_POR
 start slave;
 flush logs;
 show slave status;
-Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master
-#	127.0.0.1	root	SLAVE_PORT	60	slave-bin.000001	208	#	#	slave-bin.000001	Yes	Yes							0		0	208	#	None		0	No						#
+Slave_IO_State	#
+Master_Host	127.0.0.1
+Master_User	root
+Master_Port	MASTER_PORT
+Connect_Retry	1
+Master_Log_File	master-bin.000001
+Read_Master_Log_Pos	98
+Relay_Log_File	#
+Relay_Log_Pos	#
+Relay_Master_Log_File	master-bin.000001
+Slave_IO_Running	Yes
+Slave_SQL_Running	Yes
+Replicate_Do_DB	
+Replicate_Ignore_DB	
+Replicate_Do_Table	
+Replicate_Ignore_Table	#
+Replicate_Wild_Do_Table	
+Replicate_Wild_Ignore_Table	
+Last_Errno	0
+Last_Error	
+Skip_Counter	0
+Exec_Master_Log_Pos	98
+Relay_Log_Space	#
+Until_Condition	None
+Until_Log_File	
+Until_Log_Pos	0
+Master_SSL_Allowed	No
+Master_SSL_CA_File	
+Master_SSL_CA_Path	
+Master_SSL_Cert	
+Master_SSL_Cipher	
+Master_SSL_Key	
+Seconds_Behind_Master	#

=== modified file 'mysql-test/r/sp.result'
--- a/mysql-test/r/sp.result	2008-10-14 14:04:36 +0000
+++ b/mysql-test/r/sp.result	2008-10-17 14:55:06 +0000
@@ -6646,6 +6646,24 @@ ttt
 2
 drop function func30787;
 drop table t1;
+CREATE TABLE t1 (id INT);
+INSERT INTO t1 VALUES (1),(2),(3),(4);
+CREATE PROCEDURE test_sp()
+SELECT t1.* FROM t1 RIGHT JOIN t1 t2 ON t1.id=t2.id;
+CALL test_sp();
+id
+1
+2
+3
+4
+CALL test_sp();
+id
+1
+2
+3
+4
+DROP PROCEDURE test_sp;
+DROP TABLE t1;
 create table t1(c1 INT);
 create function f1(p1 int) returns varchar(32)
 return 'aaa';

=== modified file 'mysql-test/r/status2.result'
--- a/mysql-test/r/status2.result	2008-10-09 07:26:42 +0000
+++ b/mysql-test/r/status2.result	2008-10-31 09:25:03 +0000
@@ -53,11 +53,11 @@ Assert Questions == 16
 SHOW STATUS LIKE 'Questions';
 Variable_name	Value
 Questions	16
-Global status updated; Assert diff == 5
+Global status updated; Assert diff == 4
 FLUSH STATUS;
-SELECT 5;
-5
-5
+SELECT 4;
+4
+4
 DROP TABLE t1,t2;
 DROP PROCEDURE p1;
 DROP FUNCTION f1;

=== modified file 'mysql-test/r/view.result'
--- a/mysql-test/r/view.result	2008-03-26 18:43:12 +0000
+++ b/mysql-test/r/view.result	2008-10-27 10:22:38 +0000
@@ -3677,6 +3677,8 @@ DROP VIEW v1;
 
 # -- End of test case for Bug#35193.
 
+CREATE VIEW v1 AS SELECT 1;
+DROP VIEW v1;
 # -----------------------------------------------------------------
 # -- End of 5.0 tests.
 # -----------------------------------------------------------------

=== modified file 'mysql-test/t/group_by.test'
--- a/mysql-test/t/group_by.test	2008-03-27 16:49:32 +0000
+++ b/mysql-test/t/group_by.test	2008-10-24 02:16:22 +0000
@@ -1010,4 +1010,33 @@ select (select sum(outr.a + t1.a) from t
 SET sql_mode=@save_sql_mode;
 DROP TABLE t1, t2;
 
+--echo # 
+--echo # BUG#38072: Wrong result: HAVING not observed in a query with aggregate
+--echo # 
+CREATE TABLE t1 (
+  pk int(11) NOT NULL AUTO_INCREMENT,
+  int_nokey int(11) NOT NULL,
+  int_key int(11) NOT NULL,
+  varchar_key varchar(1) NOT NULL,
+  varchar_nokey varchar(1) NOT NULL,
+  PRIMARY KEY (pk),
+  KEY int_key (int_key),
+  KEY varchar_key (varchar_key)
+);
+INSERT INTO t1 VALUES 
+(1,5,5, 'h','h'),
+(2,1,1, '{','{'),
+(3,1,1, 'z','z'),
+(4,8,8, 'x','x'),
+(5,7,7, 'o','o'),
+(6,3,3, 'p','p'),
+(7,9,9, 'c','c'),
+(8,0,0, 'k','k'),
+(9,6,6, 't','t'),
+(10,0,0,'c','c');
+
+explain SELECT COUNT(varchar_key) AS X FROM t1 WHERE pk = 8 having 'foo'='bar';
+SELECT COUNT(varchar_key) AS X FROM t1 WHERE pk = 8 having 'foo'='bar';
+drop table t1;
+  
 --echo End of 5.0 tests

=== modified file 'mysql-test/t/rpl_flush_log_loop.test'
--- a/mysql-test/t/rpl_flush_log_loop.test	2007-10-10 07:21:11 +0000
+++ b/mysql-test/t/rpl_flush_log_loop.test	2008-10-26 19:34:24 +0000
@@ -12,16 +12,27 @@ stop slave;
 eval change master to master_host='127.0.0.1',master_user='root',
  master_password='',master_port=$MASTER_MYPORT;
 start slave;
+
 connection master;
 --replace_result $SLAVE_MYPORT SLAVE_PORT
 eval change master to master_host='127.0.0.1',master_user='root',
  master_password='',master_port=$SLAVE_MYPORT;
 start slave;
-sleep 5;
+--source include/wait_for_slave_to_start.inc
+
+# Calculate file name of relay log after flush logs 
+let $relay_file= query_get_value(show slave status, Relay_Log_File,1);
+let $relay_name= `select substring_index('$relay_file','.',1);`;
+let $relay_index= `select substring_index('$relay_file','.',-1);`;
+let $relay_index_len= `select length(substring_index('$relay_file','.',-1));`;
+let $relay_index_next=`select $relay_index+1`;
+let $relay_file=`select
concat('$relay_name','.',repeat('0',($relay_index_len-length($relay_index_next))),$relay_index_next);`;
 flush logs;
-sleep 5;
---replace_result $SLAVE_MYPORT SLAVE_PORT
---replace_column 1 # 8 # 9 # 23 # 33 #
-show slave status;
+let $slave_param= Relay_Log_File;
+let $slave_param_value= $relay_file;
+source include/wait_for_slave_param.inc;
+--replace_result $SLAVE_MYPORT SLAVE_PORT $MASTER_MYPORT MASTER_PORT
+--replace_column 1 # 8 # 9 # 16 # 23 # 33 # 34 # 35 #
+--query_vertical show slave status
 
 # End of 4.1 tests

=== modified file 'mysql-test/t/sp.test'
--- a/mysql-test/t/sp.test	2008-10-14 14:04:36 +0000
+++ b/mysql-test/t/sp.test	2008-10-17 14:55:06 +0000
@@ -7793,6 +7793,21 @@ select (select func30787(f1)) as ttt fro
 drop function func30787;
 drop table t1;
 
+#
+# Bug #33811: Call to stored procedure with SELECT * / RIGHT JOIN fails
+# after the first time
+#
+CREATE TABLE t1 (id INT);
+INSERT INTO t1 VALUES (1),(2),(3),(4);
+
+CREATE PROCEDURE test_sp()
+  SELECT t1.* FROM t1 RIGHT JOIN t1 t2 ON t1.id=t2.id;
+
+CALL test_sp();
+CALL test_sp();
+
+DROP PROCEDURE test_sp;
+DROP TABLE t1;
 
 #
 # Bug#38291 memory corruption and server crash with view/sp/function

=== modified file 'mysql-test/t/status2.test'
--- a/mysql-test/t/status2.test	2008-10-09 07:26:42 +0000
+++ b/mysql-test/t/status2.test	2008-10-31 09:25:03 +0000
@@ -47,16 +47,16 @@ FLUSH STATUS;
 let $org_questions= `SHOW GLOBAL STATUS LIKE 'questions'`;
 SELECT 1;
 connection default;
-disconnect con1;
 --echo Assert Questions == 16
 SHOW STATUS LIKE 'Questions';
---echo Global status updated; Assert diff == 5
+--echo Global status updated; Assert diff == 4
 FLUSH STATUS;
 let $new_questions= `SHOW GLOBAL STATUS LIKE 'questions'`;
 --disable_log
 let $diff= `SELECT SUBSTRING('$new_questions',10)-SUBSTRING('$org_questions',10)`;
 --enable_log
 eval SELECT $diff;
+disconnect con1;
 DROP TABLE t1,t2;
 DROP PROCEDURE p1;
 DROP FUNCTION f1;

=== modified file 'mysql-test/t/view.test'
--- a/mysql-test/t/view.test	2008-03-26 18:43:12 +0000
+++ b/mysql-test/t/view.test	2008-10-27 10:22:38 +0000
@@ -3560,6 +3560,15 @@ DROP VIEW v1;
 
 ###########################################################################
 
+#
+# Bug#39040: valgrind errors/crash when creating views with binlog logging 
+# enabled
+#
+# Bug is visible only when running in valgrind with binary logging.
+CREATE VIEW v1 AS SELECT 1;
+DROP VIEW v1;
+
+
 --echo # -----------------------------------------------------------------
 --echo # -- End of 5.0 tests.
 --echo # -----------------------------------------------------------------

=== modified file 'sql/sql_base.cc'
--- a/sql/sql_base.cc	2008-10-07 21:34:00 +0000
+++ b/sql/sql_base.cc	2008-10-17 14:55:06 +0000
@@ -5508,6 +5508,10 @@ insert_fields(THD *thd, Name_resolution_
 
       if (!(item= field_iterator.create_item(thd)))
         DBUG_RETURN(TRUE);
+      DBUG_ASSERT(item->fixed);
+      /* cache the table for the Item_fields inserted by expanding stars */
+      if (item->type() == Item::FIELD_ITEM && tables->cacheable_table)
+        ((Item_field *)item)->cached_table= tables;
 
       if (!found)
       {

=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc	2008-10-16 16:37:17 +0000
+++ b/sql/sql_select.cc	2008-11-03 09:50:32 +0000
@@ -8269,6 +8269,8 @@ simplify_joins(JOIN *join, List<TABLE_LI
   }
     
   /* Flatten nested joins that can be flattened. */
+  TABLE_LIST *right_neighbor= NULL;
+  bool fix_name_res= FALSE;
   li.rewind();
   while ((table= li++))
   {
@@ -8281,9 +8283,17 @@ simplify_joins(JOIN *join, List<TABLE_LI
       {
         tbl->embedding= table->embedding;
         tbl->join_list= table->join_list;
-      }      
+      }
       li.replace(nested_join->join_list);
-    }
+      /* Need to update the name resolution table chain when flattening joins */
+      fix_name_res= TRUE;
+      table= *li.ref();
+    }
+    if (fix_name_res)
+      table->next_name_resolution_table= right_neighbor ?
+        right_neighbor->first_leaf_for_name_resolution() :
+        NULL;
+    right_neighbor= table;
   }
   DBUG_RETURN(conds); 
 }

=== modified file 'sql/sql_select.h'
--- a/sql/sql_select.h	2007-11-07 16:02:12 +0000
+++ b/sql/sql_select.h	2008-10-24 02:16:22 +0000
@@ -464,7 +464,7 @@ public:
   bool send_row_on_empty_set()
   {
     return (do_send_rows && tmp_table_param.sum_func_count != 0 &&
-	    !group_list);
+	    !group_list && having_value != Item::COND_FALSE);
   }
   bool change_result(select_result *result);
   bool is_top_level_join() const

=== modified file 'sql/sql_view.cc'
--- a/sql/sql_view.cc	2008-09-30 12:50:28 +0000
+++ b/sql/sql_view.cc	2008-10-27 10:22:38 +0000
@@ -774,8 +774,13 @@ static int mysql_register_view(THD *thd,
   DBUG_PRINT("info", ("View: %s", str.ptr()));
 
   /* fill structure */
-  view->query.str= str.c_ptr_safe();
-  view->query.length= str.length();
+  if (!make_lex_string(thd, &view->query, str.ptr(), str.length(), false))
+  {
+    my_error(ER_OUT_OF_RESOURCES, MYF(0));
+    error= -1;
+    goto err;   
+  }
+
   view->source.str= thd->query + thd->lex->create_view_select_start;
   view->source.length= (char *)skip_rear_comments(thd->charset(),
                                                   (char *)view->source.str,
@@ -784,7 +789,12 @@ static int mysql_register_view(THD *thd,
                         view->source.str;
   view->file_version= 1;
   view->calc_md5(md5);
-  view->md5.str= md5;
+  if (!(view->md5.str= thd->memdup(md5, 32)))
+  {
+    my_error(ER_OUT_OF_RESOURCES, MYF(0));
+    error= -1;
+    goto err;   
+  }
   view->md5.length= 32;
   can_be_merged= lex->can_be_merged();
   if (lex->create_view_algorithm == VIEW_ALGORITHM_MERGE &&

=== modified file 'support-files/mysql.spec.sh'
--- a/support-files/mysql.spec.sh	2008-08-25 19:07:41 +0000
+++ b/support-files/mysql.spec.sh	2008-11-06 15:24:58 +0000
@@ -240,10 +240,8 @@ BuildMySQL() {
 sh -c  "PATH=\"${MYSQL_BUILD_PATH:-$PATH}\" \
 	CC=\"${CC:-$MYSQL_BUILD_CC}\" \
 	CXX=\"${CXX:-$MYSQL_BUILD_CXX}\" \
-	CFLAGS=\"${MYSQL_BUILD_CFLAGS:-$RPM_OPT_FLAGS}\" \
-	CXXFLAGS=\"${MYSQL_BUILD_CXXFLAGS:-$RPM_OPT_FLAGS \
-	          -felide-constructors -fno-exceptions -fno-rtti \
-		  }\" \
+	CFLAGS=\"$CFLAGS\" \
+	CXXFLAGS=\"$CXXFLAGS\" \
 	LDFLAGS=\"$MYSQL_BUILD_LDFLAGS\" \
 	./configure \
  	    $* \
@@ -307,6 +305,10 @@ then
 	export CXX="gcc"
 fi
 
+# Prepare compiler flags
+CFLAGS=${MYSQL_BUILD_CFLAGS:-$RPM_OPT_FLAGS}
+CXXFLAGS=${MYSQL_BUILD_CXXFLAGS:-$RPM_OPT_FLAGS -felide-constructors -fno-exceptions
-fno-rtti }
+
 #
 # Only link statically on our i386 build host (which has a specially
 # patched static glibc installed) - ia64 and x86_64 run glibc-2.3 (unpatched)
@@ -314,6 +316,14 @@ fi
 #
 for servertype in '--with-debug=full' ' '
 do
+  (
+  # We are in a subshell, so we can modify variables just for one run.
+  if test "$servertype" != ' '
+  then
+	CFLAGS=`echo $CFLAGS | sed -e 's/-O[0-9]* //' -e 's/-unroll2 //' -e 's/-ip //'`
+	CXXFLAGS=`echo $CXXFLAGS | sed -e 's/-O[0-9]* //' -e 's/-unroll2 //' -e 's/-ip //'`
+  fi
+
   BuildMySQL "\
 %if %{STATIC_BUILD}
 		--disable-shared \
@@ -335,6 +345,7 @@ do
 		--with-blackhole-storage-engine \
 		--with-federated-storage-engine \
 		--with-big-tables $servertype"
+
   if test "$servertype" != ' '
   then
     # if this is not the regular build, we save the server binary
@@ -344,6 +355,7 @@ do
     make test-bt-debug
     make clean
   fi
+  )
 done
 
 ./libtool --mode=execute nm --numeric-sort sql/mysqld > sql/mysqld.sym
@@ -795,6 +807,11 @@ fi
 # itself - note that they must be ordered by date (important when
 # merging BK trees)
 %changelog
+* Thu Nov 06 2008 Joerg Bruehe <joerg@stripped>
+
+- Modify CFLAGS and CXXFLAGS such that a debug build is not optimized.
+  This should cover both gcc and icc flags.  Fixes bug#40546.
+
 * Mon Aug 18 2008 Joerg Bruehe <joerg@stripped>
 
 - Get rid of the "warning: Installed (but unpackaged) file(s) found:"

Thread
bzr push into mysql-5.0 branch (joerg:2660 to 2661) Joerg Bruehe10 Nov