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. 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.
This commit is contained in:
parent
4bf849c23c
commit
c9dffa993a
@ -107,7 +107,7 @@ primary key(a,b))
|
|||||||
partition by hash (rand(a))
|
partition by hash (rand(a))
|
||||||
partitions 2
|
partitions 2
|
||||||
(partition x1, partition x2);
|
(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
|
partitions 2
|
||||||
(partition x1, partition x2)' at line 6
|
(partition x1, partition x2)' at line 6
|
||||||
CREATE TABLE t1 (
|
CREATE TABLE t1 (
|
||||||
@ -118,7 +118,7 @@ primary key(a,b))
|
|||||||
partition by range (rand(a))
|
partition by range (rand(a))
|
||||||
partitions 2
|
partitions 2
|
||||||
(partition x1 values less than (0), partition x2 values less than (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
|
partitions 2
|
||||||
(partition x1 values less than (0), partition x2 values less than' at line 6
|
(partition x1 values less than (0), partition x2 values less than' at line 6
|
||||||
CREATE TABLE t1 (
|
CREATE TABLE t1 (
|
||||||
@ -129,7 +129,7 @@ primary key(a,b))
|
|||||||
partition by list (rand(a))
|
partition by list (rand(a))
|
||||||
partitions 2
|
partitions 2
|
||||||
(partition x1 values in (1), partition x2 values in (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
|
partitions 2
|
||||||
(partition x1 values in (1), partition x2 values in (2))' at line 6
|
(partition x1 values in (1), partition x2 values in (2))' at line 6
|
||||||
CREATE TABLE t1 (
|
CREATE TABLE t1 (
|
||||||
@ -244,7 +244,7 @@ c int not null,
|
|||||||
primary key (a,b))
|
primary key (a,b))
|
||||||
partition by key (a)
|
partition by key (a)
|
||||||
subpartition by hash (rand(a+b));
|
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 (
|
CREATE TABLE t1 (
|
||||||
a int not null,
|
a int not null,
|
||||||
b int not null,
|
b int not null,
|
||||||
@ -341,7 +341,7 @@ partition by range (3+4)
|
|||||||
partitions 2
|
partitions 2
|
||||||
(partition x1 values less than (4) tablespace ts1,
|
(partition x1 values less than (4) tablespace ts1,
|
||||||
partition x2 values less than (8) tablespace ts2);
|
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 (
|
CREATE TABLE t1 (
|
||||||
a int not null,
|
a int not null,
|
||||||
b int not null,
|
b int not null,
|
||||||
@ -511,7 +511,7 @@ partition by list (3+4)
|
|||||||
partitions 2
|
partitions 2
|
||||||
(partition x1 values in (4) tablespace ts1,
|
(partition x1 values in (4) tablespace ts1,
|
||||||
partition x2 values in (8) tablespace ts2);
|
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 (
|
CREATE TABLE t1 (
|
||||||
a int not null,
|
a int not null,
|
||||||
b int not null,
|
b int not null,
|
||||||
@ -603,13 +603,13 @@ partition by range (ascii(v))
|
|||||||
ERROR HY000: This partition function is not allowed
|
ERROR HY000: This partition function is not allowed
|
||||||
create table t1 (a int)
|
create table t1 (a int)
|
||||||
partition by hash (rand(a));
|
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)
|
create table t1 (a int)
|
||||||
partition by hash(CURTIME() + a);
|
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)
|
create table t1 (a int)
|
||||||
partition by hash (NOW()+a);
|
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)
|
create table t1 (a int)
|
||||||
partition by hash (extract(hour from convert_tz(a, '+00:00', '+00:00')));
|
partition by hash (extract(hour from convert_tz(a, '+00:00', '+00:00')));
|
||||||
ERROR HY000: This partition function is not allowed
|
ERROR HY000: This partition function is not allowed
|
||||||
|
@ -527,7 +527,7 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
|
|||||||
1 SIMPLE t2 p0,p4 ALL NULL NULL NULL NULL 910 Using where
|
1 SIMPLE t2 p0,p4 ALL NULL NULL NULL NULL 910 Using where
|
||||||
explain partitions select * from t2 where (a > 100 AND a < 600);
|
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
|
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;
|
analyze table t2;
|
||||||
Table Op Msg_type Msg_text
|
Table Op Msg_type Msg_text
|
||||||
test.t2 analyze status OK
|
test.t2 analyze status OK
|
||||||
|
@ -421,7 +421,7 @@ partitions 2
|
|||||||
#
|
#
|
||||||
# Partition by range, constant partition function not allowed
|
# 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 (
|
CREATE TABLE t1 (
|
||||||
a int not null,
|
a int not null,
|
||||||
b int not null,
|
b int not null,
|
||||||
@ -636,7 +636,7 @@ partition by list (a);
|
|||||||
#
|
#
|
||||||
# Partition by list, constant partition function not allowed
|
# 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 (
|
CREATE TABLE t1 (
|
||||||
a int not null,
|
a int not null,
|
||||||
b int not null,
|
b int not null,
|
||||||
|
@ -39,7 +39,8 @@ inline Item * and_items(Item* cond, Item *item)
|
|||||||
Item_subselect::Item_subselect():
|
Item_subselect::Item_subselect():
|
||||||
Item_result_field(), value_assigned(0), thd(0), substitution(0),
|
Item_result_field(), value_assigned(0), thd(0), substitution(0),
|
||||||
engine(0), old_engine(0), used_tables_cache(0), have_to_be_excluded(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;
|
with_subselect= 1;
|
||||||
reset();
|
reset();
|
||||||
@ -431,6 +432,7 @@ void Item_maxmin_subselect::print(String *str, enum_query_type query_type)
|
|||||||
|
|
||||||
void Item_singlerow_subselect::reset()
|
void Item_singlerow_subselect::reset()
|
||||||
{
|
{
|
||||||
|
eliminated= FALSE;
|
||||||
null_value= 1;
|
null_value= 1;
|
||||||
if (value)
|
if (value)
|
||||||
value->null_value= 1;
|
value->null_value= 1;
|
||||||
|
@ -90,6 +90,7 @@ public:
|
|||||||
void cleanup();
|
void cleanup();
|
||||||
virtual void reset()
|
virtual void reset()
|
||||||
{
|
{
|
||||||
|
eliminated= FALSE;
|
||||||
null_value= 1;
|
null_value= 1;
|
||||||
}
|
}
|
||||||
virtual trans_res select_transformer(JOIN *join);
|
virtual trans_res select_transformer(JOIN *join);
|
||||||
@ -235,6 +236,7 @@ public:
|
|||||||
subs_type substype() { return EXISTS_SUBS; }
|
subs_type substype() { return EXISTS_SUBS; }
|
||||||
void reset()
|
void reset()
|
||||||
{
|
{
|
||||||
|
eliminated= FALSE;
|
||||||
value= 0;
|
value= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -306,6 +308,7 @@ public:
|
|||||||
subs_type substype() { return IN_SUBS; }
|
subs_type substype() { return IN_SUBS; }
|
||||||
void reset()
|
void reset()
|
||||||
{
|
{
|
||||||
|
eliminated= FALSE;
|
||||||
value= 0;
|
value= 0;
|
||||||
null_value= 0;
|
null_value= 0;
|
||||||
was_null= 0;
|
was_null= 0;
|
||||||
|
@ -3019,8 +3019,9 @@ uint32 get_partition_id_range_for_endpoint(partition_info *part_info,
|
|||||||
In case of PARTITION p VALUES LESS THAN MAXVALUE
|
In case of PARTITION p VALUES LESS THAN MAXVALUE
|
||||||
the maximum value is in the current partition.
|
the maximum value is in the current partition.
|
||||||
*/
|
*/
|
||||||
if (part_func_value == part_end_val &&
|
if (part_func_value > part_end_val ||
|
||||||
(loc_part_id < max_partition || !part_info->defined_max_value))
|
(part_func_value == part_end_val &&
|
||||||
|
(loc_part_id < max_partition || !part_info->defined_max_value)))
|
||||||
loc_part_id++;
|
loc_part_id++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1847,8 +1847,8 @@ int open_table_from_share(THD *thd, TABLE_SHARE *share, const char *alias,
|
|||||||
{
|
{
|
||||||
if (work_part_info_used)
|
if (work_part_info_used)
|
||||||
tmp= fix_partition_func(thd, outparam, is_create_table);
|
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:
|
partititon_err:
|
||||||
if (tmp)
|
if (tmp)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user