List:Commits« Previous MessageNext Message »
From:Tatjana Azundris Nuernberg Date:May 26 2011 11:12am
Subject:bzr commit into mysql-trunk branch (tatjana.nuernberg:3105)
View as plain text  
#At file:///Users/tnurnberg/forest/11745920/56-11745920/ based on revid:tatjana.nuernberg@stripped

 3105 Tatjana Azundris Nuernberg	2011-05-26 [merge]
      auto-merge

    added:
      mysql-test/suite/rpl/t/rpl_typeconv-master.opt
    modified:
      BUILD/SETUP.sh
      cmake/configure.pl
      cmake/os/WindowsCache.cmake
      mysql-test/lib/mtr_misc.pl
      mysql-test/mysql-test-run.pl
      mysql-test/r/func_math.result
      mysql-test/t/func_math.test
      sql/item_func.cc
      sql/item_subselect.cc
      sql/sql_array.h
      sql/sql_base.cc
      sql/sql_select.cc
      sql/sql_select.h
=== modified file 'BUILD/SETUP.sh'
--- a/BUILD/SETUP.sh	2011-05-06 13:21:38 +0000
+++ b/BUILD/SETUP.sh	2011-05-25 10:45:37 +0000
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-# Copyright (C) 2000, 2007 MySQL AB
+# Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
 #
 # This program is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Library General Public
@@ -250,7 +250,7 @@ gcov_compile_flags="$gcov_compile_flags 
 
 gcov_link_flags="-fprofile-arcs -ftest-coverage"
 
-gcov_configs="--disable-shared"
+gcov_configs="--with-gcov"
 
 # gprof
 

=== modified file 'cmake/configure.pl'
--- a/cmake/configure.pl	2010-11-12 01:40:51 +0000
+++ b/cmake/configure.pl	2011-05-25 10:45:37 +0000
@@ -195,6 +195,11 @@ foreach my $option (@ARGV)
     $cmakeargs = $cmakeargs." \"-DWITH_COMMENT=".substr($option,13)."\""; 
     next;
   }
+  if ($option =~ /with-gcov/)
+  {
+      $cmakeargs = $cmakeargs." -DENABLE_GCOV=ON"; 
+      next;
+  }
 
   $option = uc($option);
   $option =~ s/-/_/g;

=== modified file 'cmake/os/WindowsCache.cmake'
--- a/cmake/os/WindowsCache.cmake	2011-04-30 05:36:44 +0000
+++ b/cmake/os/WindowsCache.cmake	2011-05-26 08:14:09 +0000
@@ -347,6 +347,7 @@ SET(SIGNAL_RETURN_TYPE_IS_VOID 1 CACHE I
 SET(C_HAS_inline CACHE INTERNAL "")
 SET(C_HAS___inline 1 CACHE INTERNAL "")
 SET(FIONREAD_IN_SYS_IOCTL CACHE INTERNAL "")
+SET(FIONREAD_IN_SYS_FILIO CACHE INTERNAL "")
 SET(GWINSZ_IN_SYS_IOCTL CACHE INTERNAL "")
 SET(HAVE_CXXABI_H CACHE INTERNAL "")
 SET(HAVE_NDIR_H CACHE INTERNAL "")

=== modified file 'mysql-test/lib/mtr_misc.pl'
--- a/mysql-test/lib/mtr_misc.pl	2011-04-07 08:39:10 +0000
+++ b/mysql-test/lib/mtr_misc.pl	2011-05-25 10:45:37 +0000
@@ -31,6 +31,7 @@ sub mtr_script_exists(@);
 sub mtr_file_exists(@);
 sub mtr_exe_exists(@);
 sub mtr_exe_maybe_exists(@);
+sub mtr_compress_file($);
 sub mtr_milli_sleep($);
 sub start_timer($);
 sub has_expired($);
@@ -199,6 +200,40 @@ sub mtr_exe_exists (@) {
   }
 }
 
+#
+# Try to compress file using tools that might be available.
+# If zip/gzip is not available, just silently ignore.
+#
+
+sub mtr_compress_file ($) {
+  my ($filename)= @_;
+
+  mtr_error ("File to compress not found: $filename") unless -f $filename;
+
+  my $did_compress= 0;
+
+  if (IS_WINDOWS)
+  {
+    # Capture stderr
+    my $ziperr= `zip $filename.zip $filename 2>&1`;
+    if ($?) {
+      print "$ziperr\n" if $ziperr !~ /recognized as an internal or external/;
+    } else {
+      unlink($filename);
+      $did_compress=1;
+    }
+  }
+  else
+  {
+    my $gzres= system("gzip $filename");
+    $did_compress= ! $gzres;
+    if ($gzres && $gzres != -1) {
+      mtr_error ("Error: have gzip but it fails to compress core file");
+    }
+  }
+  mtr_print("Compressed file $filename") if $did_compress;
+}
+
 
 sub mtr_milli_sleep ($) {
   die "usage: mtr_milli_sleep(milliseconds)" unless @_ == 1;

=== modified file 'mysql-test/mysql-test-run.pl'
--- a/mysql-test/mysql-test-run.pl	2011-05-12 13:49:50 +0000
+++ b/mysql-test/mysql-test-run.pl	2011-05-25 14:48:51 +0000
@@ -264,7 +264,6 @@ my $opt_shutdown_timeout= $ENV{MTR_SHUTD
 my $opt_start_timeout   = $ENV{MTR_START_TIMEOUT}    || 180; # seconds
 
 sub suite_timeout { return $opt_suite_timeout * 60; };
-sub check_timeout { return $opt_testcase_timeout * 6; };
 
 my $opt_wait_all;
 my $opt_user_args;
@@ -300,6 +299,8 @@ sub testcase_timeout ($) {
   return $opt_testcase_timeout * 60;
 }
 
+sub check_timeout ($) { return testcase_timeout($_[0]) / 10; }
+
 our $opt_warnings= 1;
 
 our $opt_include_ndbcluster= 0;
@@ -658,6 +659,8 @@ sub run_test_server ($$$) {
 			     mtr_report(" - deleting it, already saved",
 					"$opt_max_save_core");
 			     unlink("$core_file");
+			   } else {
+			     mtr_compress_file($core_file) unless @opt_cases;
 			   }
 			   ++$num_saved_cores;
 			 }
@@ -3415,7 +3418,7 @@ sub check_testcase($$)
   # Return immediately if no check proceess was started
   return 0 unless ( keys %started );
 
-  my $timeout= start_timer(check_timeout());
+  my $timeout= start_timer(check_timeout($tinfo));
 
   while (1){
     my $result;
@@ -3487,7 +3490,7 @@ test case was executed:\n";
     }
     elsif ( $proc->{timeout} ) {
       $tinfo->{comment}.= "Timeout for 'check-testcase' expired after "
-	.check_timeout()." seconds";
+	.check_timeout($tinfo)." seconds";
       $result= 4;
     }
     else {
@@ -3577,7 +3580,7 @@ sub run_on_all($$)
   # Return immediately if no check proceess was started
   return 0 unless ( keys %started );
 
-  my $timeout= start_timer(check_timeout());
+  my $timeout= start_timer(check_timeout($tinfo));
 
   while (1){
     my $result;
@@ -3608,7 +3611,7 @@ sub run_on_all($$)
     }
     elsif ($proc->{timeout}) {
       $tinfo->{comment}.= "Timeout for '$run' expired after "
-	.check_timeout()." seconds";
+	.check_timeout($tinfo)." seconds";
     }
     else {
       # Unknown process returned, most likley a crash, abort everything
@@ -4333,7 +4336,7 @@ sub check_warnings ($) {
   # Return immediately if no check proceess was started
   return 0 unless ( keys %started );
 
-  my $timeout= start_timer(check_timeout());
+  my $timeout= start_timer(check_timeout($tinfo));
 
   while (1){
     my $result= 0;
@@ -4385,7 +4388,7 @@ sub check_warnings ($) {
     }
     elsif ( $proc->{timeout} ) {
       $tinfo->{comment}.= "Timeout for 'check warnings' expired after "
-	.check_timeout()." seconds";
+	.check_timeout($tinfo)." seconds";
       $result= 4;
     }
     else {

=== modified file 'mysql-test/r/func_math.result'
--- a/mysql-test/r/func_math.result	2011-04-20 07:56:57 +0000
+++ b/mysql-test/r/func_math.result	2011-05-26 10:13:07 +0000
@@ -543,6 +543,12 @@ ROUND(LEAST(15, -4939092, 0.2704), STDDE
 -4939092.0000
 Warnings:
 Warning	1292	Truncated incorrect DOUBLE value: 'a'
+#
+# Bug#12392636  ASSERTION FAILED: SCALE >= 0 && PRECISION > 0 && SCALE <= PRECISION
+#
+SELECT SUM(DISTINCT (TRUNCATE((.1), NULL)));
+SUM(DISTINCT (TRUNCATE((.1), NULL)))
+NULL
 End of 5.1 tests
 #
 # Bug #8433: Overflow must be an error

=== added file 'mysql-test/suite/rpl/t/rpl_typeconv-master.opt'
--- a/mysql-test/suite/rpl/t/rpl_typeconv-master.opt	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/t/rpl_typeconv-master.opt	2011-05-25 14:39:39 +0000
@@ -0,0 +1 @@
+--testcase-timeout=40

=== modified file 'mysql-test/t/func_math.test'
--- a/mysql-test/t/func_math.test	2011-04-20 07:56:57 +0000
+++ b/mysql-test/t/func_math.test	2011-05-26 10:13:07 +0000
@@ -370,6 +370,12 @@ DROP TABLE t1;
 
 SELECT ROUND(LEAST(15, -4939092, 0.2704), STDDEV('a'));
 
+--echo #
+--echo # Bug#12392636  ASSERTION FAILED: SCALE >= 0 && PRECISION > 0 && SCALE <= PRECISION
+--echo #
+
+SELECT SUM(DISTINCT (TRUNCATE((.1), NULL)));
+
 --echo End of 5.1 tests
 
 --echo #

=== modified file 'sql/item_func.cc'
--- a/sql/item_func.cc	2011-05-21 09:31:19 +0000
+++ b/sql/item_func.cc	2011-05-26 10:13:07 +0000
@@ -2273,6 +2273,9 @@ void Item_func_round::fix_length_and_dec
   }
 
   val1= args[1]->val_int();
+  if ((null_value= args[1]->is_null()))
+    return;
+
   val1_unsigned= args[1]->unsigned_flag;
   if (val1 < 0)
     decimals_to_set= val1_unsigned ? INT_MAX : 0;

=== modified file 'sql/item_subselect.cc'
--- a/sql/item_subselect.cc	2011-04-06 11:13:33 +0000
+++ b/sql/item_subselect.cc	2011-05-24 09:36:11 +0000
@@ -3181,23 +3181,24 @@ bool subselect_hash_sj_engine::setup(Lis
     - here we initialize only those members that are used by
       subselect_uniquesubquery_engine, so these objects are incomplete.
   */ 
-  if (!(tab= new (thd->mem_root) JOIN_TAB))
+  JOIN_TAB * const tmp_tab= new (thd->mem_root) JOIN_TAB;
+  if (tmp_tab == NULL)
     DBUG_RETURN(TRUE);
-  tab->table= tmp_table;
-  tab->ref.key= 0; /* The only temp table index. */
-  tab->ref.key_length= tmp_key->key_length;
-  if (!(tab->ref.key_buff=
+  tmp_tab->table= tmp_table;
+  tmp_tab->ref.key= 0; /* The only temp table index. */
+  tmp_tab->ref.key_length= tmp_key->key_length;
+  if (!(tmp_tab->ref.key_buff=
         (uchar*) thd->calloc(ALIGN_SIZE(tmp_key->key_length) * 2)) ||
-      !(tab->ref.key_copy=
+      !(tmp_tab->ref.key_copy=
         (store_key**) thd->alloc((sizeof(store_key*) *
                                   (tmp_key_parts + 1)))) ||
-      !(tab->ref.items=
+      !(tmp_tab->ref.items=
         (Item**) thd->alloc(sizeof(Item*) * tmp_key_parts)))
     DBUG_RETURN(TRUE);
 
   KEY_PART_INFO *cur_key_part= tmp_key->key_part;
-  store_key **ref_key= tab->ref.key_copy;
-  uchar *cur_ref_buff= tab->ref.key_buff;
+  store_key **ref_key= tmp_tab->ref.key_copy;
+  uchar *cur_ref_buff= tmp_tab->ref.key_buff;
 
   /*
     Create an artificial condition to post-filter those rows matched by index
@@ -3235,10 +3236,10 @@ bool subselect_hash_sj_engine::setup(Lis
     /* Item for the corresponding field from the materialized temp table. */
     Item_field *right_col_item;
     int null_count= test(cur_key_part->field->real_maybe_null());
-    tab->ref.items[i]= item_in->left_expr->element_index(i);
+    tmp_tab->ref.items[i]= item_in->left_expr->element_index(i);
 
     if (!(right_col_item= new Item_field(thd, context, cur_key_part->field)) ||
-        !(eq_cond= new Item_func_eq(tab->ref.items[i], right_col_item)) ||
+        !(eq_cond= new Item_func_eq(tmp_tab->ref.items[i], right_col_item)) ||
         ((Item_cond_and*)cond)->add(eq_cond))
     {
       delete cond;
@@ -3255,16 +3256,19 @@ bool subselect_hash_sj_engine::setup(Lis
                                  */
                                  cur_ref_buff + null_count,
                                  null_count ? cur_ref_buff : 0,
-                                 cur_key_part->length, tab->ref.items[i]);
+                                 cur_key_part->length, tmp_tab->ref.items[i]);
     cur_ref_buff+= cur_key_part->store_length;
   }
   *ref_key= NULL; /* End marker. */
-  tab->ref.key_err= 1;
-  tab->ref.key_parts= tmp_key_parts;
+  tmp_tab->ref.key_err= 1;
+  tmp_tab->ref.key_parts= tmp_key_parts;
 
   if (cond->fix_fields(thd, &cond))
     DBUG_RETURN(TRUE);
 
+  // Set 'tab' only when function cannot fail, because of assert in destructor
+  tab= tmp_tab;
+
   /*
     Create and optimize the JOIN that will be used to materialize
     the subquery if not yet created.

=== modified file 'sql/sql_array.h'
--- a/sql/sql_array.h	2010-11-05 22:14:29 +0000
+++ b/sql/sql_array.h	2011-05-18 13:12:02 +0000
@@ -79,75 +79,4 @@ public:
   }
 };
 
-
-/* 
-  Array of pointers to Elem that uses memory from MEM_ROOT
-
-  MEM_ROOT has no realloc() so this is supposed to be used for cases when
-  reallocations are rare.
-*/
-
-template <class Elem> class Array
-{
-  enum {alloc_increment = 16};
-  Elem **buffer;
-  uint n_elements, max_element;
-public:
-  Array(MEM_ROOT *mem_root, uint prealloc=16)
-  {
-    buffer= (Elem**)alloc_root(mem_root, prealloc * sizeof(Elem**));
-    max_element = buffer? prealloc : 0;
-    n_elements= 0;
-  }
-
-  Elem& at(int idx)
-  {
-    return *(((Elem*)buffer) + idx);
-  }
-
-  Elem **front()
-  {
-    return buffer;
-  }
-
-  Elem **back()
-  {
-    return buffer + n_elements;
-  }
-
-  bool append(MEM_ROOT *mem_root, Elem *el)
-  {
-    if (n_elements == max_element)
-    {
-      Elem **newbuf;
-      if (!(newbuf= (Elem**)alloc_root(mem_root, (n_elements + alloc_increment)*
-                                                  sizeof(Elem**))))
-      {
-        return FALSE;
-      }
-      memcpy(newbuf, buffer, n_elements*sizeof(Elem*));
-      buffer= newbuf;
-    }
-    buffer[n_elements++]= el;
-    return FALSE;
-  }
-
-  int elements()
-  {
-    return n_elements;
-  }
-
-  void clear()
-  {
-    n_elements= 0;
-  }
-
-  typedef int (*CMP_FUNC)(Elem * const *el1, Elem *const *el2);
-
-  void sort(CMP_FUNC cmp_func)
-  {
-    my_qsort(buffer, n_elements, sizeof(Elem*), (qsort_cmp)cmp_func);
-  }
-};
-
 #endif /* SQL_ARRAY_INCLUDED */

=== modified file 'sql/sql_base.cc'
--- a/sql/sql_base.cc	2011-05-21 08:25:33 +0000
+++ b/sql/sql_base.cc	2011-05-26 08:39:40 +0000
@@ -6876,9 +6876,29 @@ find_field_in_tables(THD *thd, Item_iden
   if (last_table)
     last_table= last_table->next_name_resolution_table;
 
+#ifndef DBUG_OFF
+  uint loop_count= 0;
+  TABLE_LIST *one_node;
+#endif
   for (; cur_table != last_table ;
        cur_table= cur_table->next_name_resolution_table)
   {
+#ifndef DBUG_OFF
+    ++loop_count;
+    if (loop_count == 1000) // not normal, record one node we meet
+      one_node= cur_table;
+    if ((loop_count > 1000) && (one_node == cur_table))
+    {
+      /*
+        Meeting same node again: cycle, infinite loop. Raise an error which
+        doesn't stop RQG, so that Roel can continue working while we fix the
+        bug. We cannot continue the statement though.
+      */
+      my_error(ER_WRONG_FIELD_WITH_GROUP, MYF(0),
+               "HITTING BUG#12567331 INFINITE LOOP DETECTED - ASK GUILHEM AND ROEL");
+      return NULL;
+    }
+#endif
     Field *cur_field= find_field_in_table_ref(thd, cur_table, name, length,
                                               item->name, db, table_name, ref,
                                               (thd->lex->sql_command ==

=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc	2011-05-18 10:43:46 +0000
+++ b/sql/sql_select.cc	2011-05-26 06:03:02 +0000
@@ -978,7 +978,7 @@ bool resolve_subquery(THD *thd, JOIN *jo
 
     /* Register the subquery for further processing in flatten_subqueries() */
     select_lex->outer_select()->join->
-      sj_subselects.append(thd->mem_root, in_exists_predicate);
+      sj_subselects.push_back(in_exists_predicate);
   }
   else
   {
@@ -4170,11 +4170,11 @@ bool JOIN::flatten_subqueries()
   Item_exists_subselect **subq_end;
   DBUG_ENTER("JOIN::flatten_subqueries");
 
-  if (sj_subselects.elements() == 0)
+  if (sj_subselects.empty())
     DBUG_RETURN(FALSE);
 
   /* First, convert child join's subqueries. We proceed bottom-up here */
-  for (subq= sj_subselects.front(), subq_end= sj_subselects.back(); 
+  for (subq= sj_subselects.begin(), subq_end= sj_subselects.end(); 
        subq != subq_end;
        subq++)
   {
@@ -4207,7 +4207,7 @@ bool JOIN::flatten_subqueries()
   {
     if (tbl->on_expr || tbl->in_outer_join_nest())
     {
-      subq= sj_subselects.front();
+      subq= sj_subselects.begin();
       arena= thd->activate_stmt_arena_if_needed(&backup);
       goto skip_conversion;
     }
@@ -4220,11 +4220,14 @@ bool JOIN::flatten_subqueries()
       - prefer correlated subqueries over uncorrelated;
       - prefer subqueries that have greater number of outer tables;
   */
-  sj_subselects.sort(subq_sj_candidate_cmp);
+  my_qsort(sj_subselects.begin(),
+           sj_subselects.size(), sj_subselects.element_size(),
+           reinterpret_cast<qsort_cmp>(subq_sj_candidate_cmp));
+
   // #tables-in-parent-query + #tables-in-subquery < MAX_TABLES
   /* Replace all subqueries to be flattened with Item_int(1) */
   arena= thd->activate_stmt_arena_if_needed(&backup);
-  for (subq= sj_subselects.front(); 
+  for (subq= sj_subselects.begin(); 
        subq != subq_end && 
        tables + (*subq)->unit->first_select()->join->tables < MAX_TABLES;
        subq++)
@@ -4235,7 +4238,7 @@ bool JOIN::flatten_subqueries()
       DBUG_RETURN(TRUE); /* purecov: inspected */
   }
  
-  for (subq= sj_subselects.front(); 
+  for (subq= sj_subselects.begin(); 
        subq != subq_end && 
        tables + (*subq)->unit->first_select()->join->tables < MAX_TABLES;
        subq++)

=== modified file 'sql/sql_select.h'
--- a/sql/sql_select.h	2011-05-18 10:43:46 +0000
+++ b/sql/sql_select.h	2011-05-26 06:03:02 +0000
@@ -1888,7 +1888,8 @@ public:
   bool union_part; ///< this subselect is part of union 
   bool optimized; ///< flag to avoid double optimization in EXPLAIN
   
-  Array<Item_exists_subselect> sj_subselects;
+  // true: No need to run DTORs on pointers.
+  Mem_root_array<Item_exists_subselect*, true> sj_subselects;
 
   /* Temporary tables used to weed-out semi-join duplicates */
   List<TABLE> sj_tmp_tables;
@@ -1913,7 +1914,7 @@ public:
        select_result *result_arg)
     : keyuse(thd_arg->mem_root),
       fields_list(fields_arg),
-      sj_subselects(thd_arg->mem_root, 4)
+      sj_subselects(thd_arg->mem_root)
   {
     init(thd_arg, fields_arg, select_options_arg, result_arg);
   }

No bundle (reason: revision is a merge (you can force generation of a bundle with env var BZR_FORCE_BUNDLE=1)).
Thread
bzr commit into mysql-trunk branch (tatjana.nuernberg:3105) Tatjana Azundris Nuernberg26 May