← Back to team overview

maria-developers team mailing list archive

bzr commit into MariaDB 5.1, with Maria 1.5:maria branch (knielsen:2823)

 

#At lp:maria

 2823 knielsen@xxxxxxxxxxxxxxx	2010-03-09
      A number of after-merge fixes following merge of MySQL 5.1.44 into MariaDB.
      
      Bug#46949: memory leak with failed alter table to create partitions based on extract()
      
      Bug#51830: Incorrect partition pruning on range partition (regression)
      
      Fixed valgrind failure in select_describe(), read of uninitialized 
        Item_subselect::eliminated.
      
      PBXT test file updates to reflect changes done in MySQL.
      modified:
        mysql-test/suite/pbxt/r/partition_error.result
        mysql-test/suite/pbxt/r/partition_pruning.result
        mysql-test/suite/pbxt/t/partition_error.test
        sql/item_subselect.cc
        sql/item_subselect.h
        sql/sql_partition.cc
        sql/table.cc

per-file messages:
  mysql-test/suite/pbxt/r/partition_error.result
    Result file update following MySQL 5.1.44 changes.
  mysql-test/suite/pbxt/r/partition_pruning.result
    Result file update following MySQL 5.1.44 changes.
  mysql-test/suite/pbxt/t/partition_error.test
    Test file update following MySQL 5.1.44 changes.
  sql/item_subselect.cc
      Fixed valgrind failure in select_describe(), read of uninitialized 
      Item_subselect::eliminated: 
      - it turns out we can call select_describe() without having fixed 
        subquery items for child subselects. These are not the kind of subqueries
        that we could eliminate, so the fix is to ensure that 
        item_subselect->eliminated==FALSE even before fix_fields is called.
        Also added code to reset item_subselect->eliminated back to FALSE in
        Item::reset() call.
  sql/item_subselect.h
      Fixed valgrind failure in select_describe(), read of uninitialized 
      Item_subselect::eliminated: 
      - it turns out we can call select_describe() without having fixed 
        subquery items for child subselects. These are not the kind of subqueries
        that we could eliminate, so the fix is to ensure that 
        item_subselect->eliminated==FALSE even before fix_fields is called.
        Also added code to reset item_subselect->eliminated back to FALSE in
        Item::reset() call.
  sql/sql_partition.cc
    Fix Bug#51830: Revert part of the patch for Bug#49742, which caused the regression.
  sql/table.cc
    Fix Bug#46949: memory leak in failed ALTER TABLE with partitioning.
=== modified file 'mysql-test/suite/pbxt/r/partition_error.result'
--- a/mysql-test/suite/pbxt/r/partition_error.result	2009-04-02 10:03:14 +0000
+++ b/mysql-test/suite/pbxt/r/partition_error.result	2010-03-09 15:03:54 +0000
@@ -107,7 +107,7 @@ primary key(a,b))
 partition by hash (rand(a))
 partitions 2
 (partition x1, partition x2);
-ERROR 42000: Constant/Random expression in (sub)partitioning function is not allowed near ')
+ERROR 42000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed near ')
 partitions 2
 (partition x1, partition x2)' at line 6
 CREATE TABLE t1 (
@@ -118,7 +118,7 @@ primary key(a,b))
 partition by range (rand(a))
 partitions 2
 (partition x1 values less than (0), partition x2 values less than (2));
-ERROR 42000: Constant/Random expression in (sub)partitioning function is not allowed near ')
+ERROR 42000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed near ')
 partitions 2
 (partition x1 values less than (0), partition x2 values less than' at line 6
 CREATE TABLE t1 (
@@ -129,7 +129,7 @@ primary key(a,b))
 partition by list (rand(a))
 partitions 2
 (partition x1 values in (1), partition x2 values in (2));
-ERROR 42000: Constant/Random expression in (sub)partitioning function is not allowed near ')
+ERROR 42000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed near ')
 partitions 2
 (partition x1 values in (1), partition x2 values in (2))' at line 6
 CREATE TABLE t1 (
@@ -244,7 +244,7 @@ c int not null,
 primary key (a,b))
 partition by key (a)
 subpartition by hash (rand(a+b));
-ERROR 42000: Constant/Random expression in (sub)partitioning function is not allowed near ')' at line 7
+ERROR 42000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed near ')' at line 7
 CREATE TABLE t1 (
 a int not null,
 b int not null,
@@ -341,7 +341,7 @@ partition by range (3+4)
 partitions 2
 (partition x1 values less than (4) tablespace ts1,
 partition x2 values less than (8) tablespace ts2);
-ERROR HY000: Constant/Random expression in (sub)partitioning function is not allowed
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
 CREATE TABLE t1 ( 
 a int not null,
 b int not null,
@@ -511,7 +511,7 @@ partition by list (3+4)
 partitions 2 
 (partition x1 values in (4) tablespace ts1,
 partition x2 values in (8) tablespace ts2);
-ERROR HY000: Constant/Random expression in (sub)partitioning function is not allowed
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
 CREATE TABLE t1 (
 a int not null,
 b int not null,
@@ -603,13 +603,13 @@ partition by range (ascii(v))
 ERROR HY000: This partition function is not allowed
 create table t1 (a int)
 partition by hash (rand(a));
-ERROR 42000: Constant/Random expression in (sub)partitioning function is not allowed near ')' at line 2
+ERROR 42000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed near ')' at line 2
 create table t1 (a int)
 partition by hash(CURTIME() + a);
-ERROR 42000: Constant/Random expression in (sub)partitioning function is not allowed near ')' at line 2
+ERROR 42000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed near ')' at line 2
 create table t1 (a int)
 partition by hash (NOW()+a);
-ERROR 42000: Constant/Random expression in (sub)partitioning function is not allowed near ')' at line 2
+ERROR 42000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed near ')' at line 2
 create table t1 (a int)
 partition by hash (extract(hour from convert_tz(a, '+00:00', '+00:00')));
 ERROR HY000: This partition function is not allowed

=== modified file 'mysql-test/suite/pbxt/r/partition_pruning.result'
--- a/mysql-test/suite/pbxt/r/partition_pruning.result	2009-08-17 15:57:58 +0000
+++ b/mysql-test/suite/pbxt/r/partition_pruning.result	2010-03-09 15:03:54 +0000
@@ -527,7 +527,7 @@ id	select_type	table	partitions	type	pos
 1	SIMPLE	t2	p0,p4	ALL	NULL	NULL	NULL	NULL	910	Using where
 explain partitions select * from t2 where (a > 100 AND a < 600);
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t2	p0,p1,p2,p3	ALL	NULL	NULL	NULL	NULL	910	Using where
+1	SIMPLE	t2	p0,p1,p2	ALL	NULL	NULL	NULL	NULL	910	Using where
 analyze table t2;
 Table	Op	Msg_type	Msg_text
 test.t2	analyze	status	OK

=== modified file 'mysql-test/suite/pbxt/t/partition_error.test'
--- a/mysql-test/suite/pbxt/t/partition_error.test	2009-04-02 10:03:14 +0000
+++ b/mysql-test/suite/pbxt/t/partition_error.test	2010-03-09 15:03:54 +0000
@@ -421,7 +421,7 @@ partitions 2
 #
 # Partition by range, constant partition function not allowed
 #
---error ER_CONST_EXPR_IN_PARTITION_FUNC_ERROR
+--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
 CREATE TABLE t1 (
 a int not null,
 b int not null,
@@ -636,7 +636,7 @@ partition by list (a);
 #
 # Partition by list, constant partition function not allowed
 #
---error ER_CONST_EXPR_IN_PARTITION_FUNC_ERROR
+--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
 CREATE TABLE t1 (
 a int not null,
 b int not null,

=== modified file 'sql/item_subselect.cc'
--- a/sql/item_subselect.cc	2010-01-15 15:27:55 +0000
+++ b/sql/item_subselect.cc	2010-03-09 15:03:54 +0000
@@ -39,7 +39,8 @@ inline Item * and_items(Item* cond, Item
 Item_subselect::Item_subselect():
   Item_result_field(), value_assigned(0), thd(0), substitution(0),
   engine(0), old_engine(0), used_tables_cache(0), have_to_be_excluded(0),
-  const_item_cache(1), in_fix_fields(0), engine_changed(0), changed(0), is_correlated(FALSE)
+  const_item_cache(1), in_fix_fields(0), eliminated(FALSE), 
+  engine_changed(0), changed(0), is_correlated(FALSE)
 {
   with_subselect= 1;
   reset();
@@ -431,6 +432,7 @@ void Item_maxmin_subselect::print(String
 
 void Item_singlerow_subselect::reset()
 {
+  eliminated= FALSE;
   null_value= 1;
   if (value)
     value->null_value= 1;

=== modified file 'sql/item_subselect.h'
--- a/sql/item_subselect.h	2010-01-15 15:27:55 +0000
+++ b/sql/item_subselect.h	2010-03-09 15:03:54 +0000
@@ -90,6 +90,7 @@ public:
   void cleanup();
   virtual void reset()
   {
+    eliminated= FALSE;
     null_value= 1;
   }
   virtual trans_res select_transformer(JOIN *join);
@@ -235,6 +236,7 @@ public:
   subs_type substype() { return EXISTS_SUBS; }
   void reset() 
   {
+    eliminated= FALSE;
     value= 0;
   }
 
@@ -306,6 +308,7 @@ public:
   subs_type substype() { return IN_SUBS; }
   void reset() 
   {
+    eliminated= FALSE;
     value= 0;
     null_value= 0;
     was_null= 0;

=== modified file 'sql/sql_partition.cc'
--- a/sql/sql_partition.cc	2010-03-04 08:03:07 +0000
+++ b/sql/sql_partition.cc	2010-03-09 15:03:54 +0000
@@ -3019,8 +3019,9 @@ uint32 get_partition_id_range_for_endpoi
       In case of PARTITION p VALUES LESS THAN MAXVALUE
       the maximum value is in the current partition.
     */
-    if (part_func_value == part_end_val &&
-        (loc_part_id < max_partition || !part_info->defined_max_value))
+    if (part_func_value > part_end_val ||
+        (part_func_value == part_end_val &&
+         (loc_part_id < max_partition || !part_info->defined_max_value)))
       loc_part_id++;
   }
   else 

=== modified file 'sql/table.cc'
--- a/sql/table.cc	2010-03-04 08:03:07 +0000
+++ b/sql/table.cc	2010-03-09 15:03:54 +0000
@@ -1847,8 +1847,8 @@ int open_table_from_share(THD *thd, TABL
     {
       if (work_part_info_used)
         tmp= fix_partition_func(thd, outparam, is_create_table);
-      outparam->part_info->item_free_list= part_func_arena.free_list;
     }
+    outparam->part_info->item_free_list= part_func_arena.free_list;
 partititon_err:
     if (tmp)
     {