Merge mronstrom@bk-internal.mysql.com:/home/bk/bugs/bug19067
into c-870ae253.1238-1-64736c10.cust.bredbandsbolaget.se:/home/pappa/bug19067
This commit is contained in:
commit
10f571384d
@ -1,4 +1,21 @@
|
|||||||
drop table if exists t1;
|
drop table if exists t1;
|
||||||
|
create table t1 (a int)
|
||||||
|
partition by range (a)
|
||||||
|
subpartition by key (a)
|
||||||
|
(partition p0 values less than (1));
|
||||||
|
alter table t1 add partition (partition p1 values less than (2));
|
||||||
|
show create table t1;
|
||||||
|
Table Create Table
|
||||||
|
t1 CREATE TABLE `t1` (
|
||||||
|
`a` int(11) DEFAULT NULL
|
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY RANGE (a) SUBPARTITION BY KEY (a) (PARTITION p0 VALUES LESS THAN (1) ENGINE = MyISAM, PARTITION p1 VALUES LESS THAN (2) ENGINE = MyISAM)
|
||||||
|
alter table t1 reorganize partition p1 into (partition p1 values less than (3));
|
||||||
|
show create table t1;
|
||||||
|
Table Create Table
|
||||||
|
t1 CREATE TABLE `t1` (
|
||||||
|
`a` int(11) DEFAULT NULL
|
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY RANGE (a) SUBPARTITION BY KEY (a) (PARTITION p0 VALUES LESS THAN (1) ENGINE = MyISAM, PARTITION p1 VALUES LESS THAN (3) ENGINE = MyISAM)
|
||||||
|
drop table t1;
|
||||||
CREATE TABLE t1 (
|
CREATE TABLE t1 (
|
||||||
a int not null,
|
a int not null,
|
||||||
b int not null,
|
b int not null,
|
||||||
@ -570,7 +587,7 @@ show create table t1;
|
|||||||
Table Create Table
|
Table Create Table
|
||||||
t1 CREATE TABLE `t1` (
|
t1 CREATE TABLE `t1` (
|
||||||
`a` int(11) DEFAULT NULL
|
`a` int(11) DEFAULT NULL
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY RANGE (a) SUBPARTITION BY HASH (a) (PARTITION p0 VALUES LESS THAN (100) )
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY RANGE (a) SUBPARTITION BY HASH (a) (PARTITION p0 VALUES LESS THAN (100) ENGINE = MyISAM)
|
||||||
alter table t1 add partition (partition p1 values less than (200)
|
alter table t1 add partition (partition p1 values less than (200)
|
||||||
(subpartition subpart21));
|
(subpartition subpart21));
|
||||||
show create table t1;
|
show create table t1;
|
||||||
|
@ -996,7 +996,7 @@ Table Create Table
|
|||||||
t1 CREATE TABLE `t1` (
|
t1 CREATE TABLE `t1` (
|
||||||
`f1` int(11) DEFAULT NULL,
|
`f1` int(11) DEFAULT NULL,
|
||||||
`f2` char(20) DEFAULT NULL
|
`f2` char(20) DEFAULT NULL
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY RANGE (f1) SUBPARTITION BY HASH (f1) SUBPARTITIONS 2 (PARTITION part1 VALUES LESS THAN (100) , PARTITION part2 VALUES LESS THAN (2147483647) )
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY RANGE (f1) SUBPARTITION BY HASH (f1) SUBPARTITIONS 2 (PARTITION part1 VALUES LESS THAN (100) ENGINE = MyISAM, PARTITION part2 VALUES LESS THAN (2147483647) ENGINE = MyISAM)
|
||||||
SELECT COUNT(*) = 0 AS my_value FROM t1;
|
SELECT COUNT(*) = 0 AS my_value FROM t1;
|
||||||
my_value
|
my_value
|
||||||
1
|
1
|
||||||
@ -1098,7 +1098,7 @@ Table Create Table
|
|||||||
t1 CREATE TABLE `t1` (
|
t1 CREATE TABLE `t1` (
|
||||||
`f1` int(11) DEFAULT NULL,
|
`f1` int(11) DEFAULT NULL,
|
||||||
`f2` char(20) DEFAULT NULL
|
`f2` char(20) DEFAULT NULL
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY RANGE (f1) SUBPARTITION BY HASH (f1) SUBPARTITIONS 1 (PARTITION part1 VALUES LESS THAN (100) , PARTITION part2 VALUES LESS THAN (2147483647) )
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY RANGE (f1) SUBPARTITION BY HASH (f1) SUBPARTITIONS 1 (PARTITION part1 VALUES LESS THAN (100) ENGINE = MyISAM, PARTITION part2 VALUES LESS THAN (2147483647) ENGINE = MyISAM)
|
||||||
SELECT COUNT(*) = 0 AS my_value FROM t1;
|
SELECT COUNT(*) = 0 AS my_value FROM t1;
|
||||||
my_value
|
my_value
|
||||||
1
|
1
|
||||||
|
@ -596,7 +596,7 @@ f_int1
|
|||||||
NULL
|
NULL
|
||||||
explain partitions select * from t1 where f_int1 is null;
|
explain partitions select * from t1 where f_int1 is null;
|
||||||
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 t1 part4_p2sp0 system NULL NULL NULL NULL 1
|
1 SIMPLE t1 part4_part4sp0 system NULL NULL NULL NULL 1
|
||||||
drop table t1;
|
drop table t1;
|
||||||
create table t1 (a int not null, b int not null)
|
create table t1 (a int not null, b int not null)
|
||||||
partition by list(a)
|
partition by list(a)
|
||||||
@ -625,16 +625,16 @@ insert into t1 values (1,1),(1,2),(1,3),(1,4),
|
|||||||
(2,1),(2,2),(2,3),(2,4), (NULL,1);
|
(2,1),(2,2),(2,3),(2,4), (NULL,1);
|
||||||
explain partitions select * from t1 where a IS NULL AND (b=1 OR b=2);
|
explain partitions select * from t1 where a IS NULL AND (b=1 OR b=2);
|
||||||
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 t1 pn_p3sp0,pn_p3sp1 system NULL NULL NULL NULL 1
|
1 SIMPLE t1 pn_pnsp0,pn_pnsp1 system NULL NULL NULL NULL 1
|
||||||
explain partitions select * from t1 where (a IS NULL or a < 1) AND (b=1 OR b=2);
|
explain partitions select * from t1 where (a IS NULL or a < 1) AND (b=1 OR b=2);
|
||||||
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 t1 pn_p3sp0,pn_p3sp1 system NULL NULL NULL NULL 1
|
1 SIMPLE t1 pn_pnsp0,pn_pnsp1 system NULL NULL NULL NULL 1
|
||||||
explain partitions select * from t1 where (a IS NULL or a < 2) AND (b=1 OR b=2);
|
explain partitions select * from t1 where (a IS NULL or a < 2) AND (b=1 OR b=2);
|
||||||
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 t1 p0_p0sp0,p0_p0sp1,pn_p3sp0,pn_p3sp1 ALL NULL NULL NULL NULL 5 Using where
|
1 SIMPLE t1 p0_p0sp0,p0_p0sp1,pn_pnsp0,pn_pnsp1 ALL NULL NULL NULL NULL 5 Using where
|
||||||
explain partitions select * from t1 where (a IS NULL or a <= 1) AND (b=1 OR b=2);
|
explain partitions select * from t1 where (a IS NULL or a <= 1) AND (b=1 OR b=2);
|
||||||
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 t1 p0_p0sp0,p0_p0sp1,pn_p3sp0,pn_p3sp1 ALL NULL NULL NULL NULL 5 Using where
|
1 SIMPLE t1 p0_p0sp0,p0_p0sp1,pn_pnsp0,pn_pnsp1 ALL NULL NULL NULL NULL 5 Using where
|
||||||
drop table t1;
|
drop table t1;
|
||||||
create table t1 ( a int) partition by list (MOD(a, 10))
|
create table t1 ( a int) partition by list (MOD(a, 10))
|
||||||
( partition p0 values in (0), partition p1 values in (1),
|
( partition p0 values in (0), partition p1 values in (1),
|
||||||
|
@ -363,3 +363,27 @@ SELECT COUNT(*) FROM t1 WHERE c3 < '2000-12-31';
|
|||||||
COUNT(*)
|
COUNT(*)
|
||||||
10
|
10
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
create table t1 (a int)
|
||||||
|
partition by range (MOD(a,3))
|
||||||
|
subpartition by hash(a)
|
||||||
|
subpartitions 2
|
||||||
|
(partition p0 values less than (1),
|
||||||
|
partition p1 values less than (2),
|
||||||
|
partition p2 values less than (3),
|
||||||
|
partition p3 values less than (4));
|
||||||
|
ALTER TABLE t1 DROP PARTITION p3;
|
||||||
|
ALTER TABLE t1 DROP PARTITION p1;
|
||||||
|
ALTER TABLE t1 DROP PARTITION p2;
|
||||||
|
drop table t1;
|
||||||
|
create table t1 (a int)
|
||||||
|
partition by range (MOD(a,3))
|
||||||
|
subpartition by hash(a)
|
||||||
|
subpartitions 2
|
||||||
|
(partition p0 values less than (1),
|
||||||
|
partition p1 values less than (2),
|
||||||
|
partition p2 values less than (3),
|
||||||
|
partition p3 values less than (4));
|
||||||
|
ALTER TABLE t1 DROP PARTITION p0;
|
||||||
|
ALTER TABLE t1 DROP PARTITION p1;
|
||||||
|
ALTER TABLE t1 DROP PARTITION p2;
|
||||||
|
drop table t1;
|
||||||
|
@ -9,6 +9,19 @@
|
|||||||
drop table if exists t1;
|
drop table if exists t1;
|
||||||
--enable_warnings
|
--enable_warnings
|
||||||
|
|
||||||
|
#
|
||||||
|
# BUG 19067 ALTER TABLE .. ADD PARTITION for subpartitioned table crashes
|
||||||
|
#
|
||||||
|
create table t1 (a int)
|
||||||
|
partition by range (a)
|
||||||
|
subpartition by key (a)
|
||||||
|
(partition p0 values less than (1));
|
||||||
|
alter table t1 add partition (partition p1 values less than (2));
|
||||||
|
show create table t1;
|
||||||
|
alter table t1 reorganize partition p1 into (partition p1 values less than (3));
|
||||||
|
show create table t1;
|
||||||
|
drop table t1;
|
||||||
|
|
||||||
#
|
#
|
||||||
# Partition by key no partition defined => OK
|
# Partition by key no partition defined => OK
|
||||||
#
|
#
|
||||||
@ -1009,4 +1022,5 @@ select auto_increment from information_schema.tables where table_name='t1';
|
|||||||
select * from t1;
|
select * from t1;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
|
|
||||||
--echo End of 5.1 tests
|
--echo End of 5.1 tests
|
||||||
|
@ -388,3 +388,31 @@ SELECT COUNT(*) FROM t1 WHERE c3 BETWEEN '1996-12-31' AND '2000-12-31';
|
|||||||
SELECT COUNT(*) FROM t1 WHERE c3 < '2000-12-31';
|
SELECT COUNT(*) FROM t1 WHERE c3 < '2000-12-31';
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
#
|
||||||
|
# BUG 18962 Errors in DROP PARTITION
|
||||||
|
#
|
||||||
|
create table t1 (a int)
|
||||||
|
partition by range (MOD(a,3))
|
||||||
|
subpartition by hash(a)
|
||||||
|
subpartitions 2
|
||||||
|
(partition p0 values less than (1),
|
||||||
|
partition p1 values less than (2),
|
||||||
|
partition p2 values less than (3),
|
||||||
|
partition p3 values less than (4));
|
||||||
|
ALTER TABLE t1 DROP PARTITION p3;
|
||||||
|
ALTER TABLE t1 DROP PARTITION p1;
|
||||||
|
ALTER TABLE t1 DROP PARTITION p2;
|
||||||
|
drop table t1;
|
||||||
|
|
||||||
|
create table t1 (a int)
|
||||||
|
partition by range (MOD(a,3))
|
||||||
|
subpartition by hash(a)
|
||||||
|
subpartitions 2
|
||||||
|
(partition p0 values less than (1),
|
||||||
|
partition p1 values less than (2),
|
||||||
|
partition p2 values less than (3),
|
||||||
|
partition p3 values less than (4));
|
||||||
|
ALTER TABLE t1 DROP PARTITION p0;
|
||||||
|
ALTER TABLE t1 DROP PARTITION p1;
|
||||||
|
ALTER TABLE t1 DROP PARTITION p2;
|
||||||
|
drop table t1;
|
||||||
|
@ -63,5 +63,21 @@ public:
|
|||||||
subpartitions.empty();
|
subpartitions.empty();
|
||||||
list_val_list.empty();
|
list_val_list.empty();
|
||||||
}
|
}
|
||||||
|
partition_element(partition_element *part_elem)
|
||||||
|
: partition_name(NULL), range_value(0), has_null_value(FALSE)
|
||||||
|
{
|
||||||
|
subpartitions.empty();
|
||||||
|
list_val_list.empty();
|
||||||
|
|
||||||
|
part_max_rows= part_elem->part_max_rows;
|
||||||
|
part_min_rows= part_elem->part_min_rows;
|
||||||
|
tablespace_name= part_elem->tablespace_name;
|
||||||
|
part_comment= part_elem->part_comment;
|
||||||
|
data_file_name= part_elem->data_file_name;
|
||||||
|
index_file_name= part_elem->index_file_name;
|
||||||
|
engine_type= part_elem->engine_type;
|
||||||
|
part_state= part_elem->part_state;
|
||||||
|
nodegroup_id= part_elem->nodegroup_id;
|
||||||
|
}
|
||||||
~partition_element() {}
|
~partition_element() {}
|
||||||
};
|
};
|
||||||
|
@ -91,7 +91,7 @@ partition_info *partition_info::get_clone()
|
|||||||
#define MAX_PART_NAME_SIZE 16
|
#define MAX_PART_NAME_SIZE 16
|
||||||
|
|
||||||
char *partition_info::create_default_partition_names(uint part_no, uint no_parts,
|
char *partition_info::create_default_partition_names(uint part_no, uint no_parts,
|
||||||
uint start_no, bool is_subpart)
|
uint start_no)
|
||||||
{
|
{
|
||||||
char *ptr= sql_calloc(no_parts*MAX_PART_NAME_SIZE);
|
char *ptr= sql_calloc(no_parts*MAX_PART_NAME_SIZE);
|
||||||
char *move_ptr= ptr;
|
char *move_ptr= ptr;
|
||||||
@ -102,10 +102,7 @@ char *partition_info::create_default_partition_names(uint part_no, uint no_parts
|
|||||||
{
|
{
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if (is_subpart)
|
my_sprintf(move_ptr, (move_ptr,"p%u", (start_no + i)));
|
||||||
my_sprintf(move_ptr, (move_ptr,"p%usp%u", part_no, (start_no + i)));
|
|
||||||
else
|
|
||||||
my_sprintf(move_ptr, (move_ptr,"p%u", (start_no + i)));
|
|
||||||
move_ptr+=MAX_PART_NAME_SIZE;
|
move_ptr+=MAX_PART_NAME_SIZE;
|
||||||
} while (++i < no_parts);
|
} while (++i < no_parts);
|
||||||
}
|
}
|
||||||
@ -117,6 +114,35 @@ char *partition_info::create_default_partition_names(uint part_no, uint no_parts
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
Create a unique name for the subpartition as part_name'sp''subpart_no'
|
||||||
|
SYNOPSIS
|
||||||
|
create_subpartition_name()
|
||||||
|
subpart_no Number of subpartition
|
||||||
|
part_name Name of partition
|
||||||
|
RETURN VALUES
|
||||||
|
>0 A reference to the created name string
|
||||||
|
0 Memory allocation error
|
||||||
|
*/
|
||||||
|
|
||||||
|
char *create_subpartition_name(uint subpart_no, const char *part_name)
|
||||||
|
{
|
||||||
|
uint size_alloc= strlen(part_name) + MAX_PART_NAME_SIZE;
|
||||||
|
char *ptr= sql_calloc(size_alloc);
|
||||||
|
DBUG_ENTER("create_subpartition_name");
|
||||||
|
|
||||||
|
if (likely(ptr != NULL))
|
||||||
|
{
|
||||||
|
my_sprintf(ptr, (ptr, "%ssp%u", part_name, subpart_no));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mem_alloc_error(size_alloc);
|
||||||
|
}
|
||||||
|
DBUG_RETURN(ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Set up all the default partitions not set-up by the user in the SQL
|
Set up all the default partitions not set-up by the user in the SQL
|
||||||
statement. Also perform a number of checks that the user hasn't tried
|
statement. Also perform a number of checks that the user hasn't tried
|
||||||
@ -167,8 +193,7 @@ bool partition_info::set_up_default_partitions(handler *file, ulonglong max_rows
|
|||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
if (unlikely((!(default_name= create_default_partition_names(0, no_parts,
|
if (unlikely((!(default_name= create_default_partition_names(0, no_parts,
|
||||||
start_no,
|
start_no)))))
|
||||||
FALSE)))))
|
|
||||||
goto end;
|
goto end;
|
||||||
i= 0;
|
i= 0;
|
||||||
do
|
do
|
||||||
@ -238,18 +263,17 @@ bool partition_info::set_up_default_subpartitions(handler *file,
|
|||||||
{
|
{
|
||||||
part_elem= part_it++;
|
part_elem= part_it++;
|
||||||
j= 0;
|
j= 0;
|
||||||
name_ptr= create_default_partition_names(i, no_subparts, (uint)0, TRUE);
|
|
||||||
if (unlikely(!name_ptr))
|
|
||||||
goto end;
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
partition_element *subpart_elem= new partition_element();
|
partition_element *subpart_elem= new partition_element(part_elem);
|
||||||
if (likely(subpart_elem != 0 &&
|
if (likely(subpart_elem != 0 &&
|
||||||
(!part_elem->subpartitions.push_back(subpart_elem))))
|
(!part_elem->subpartitions.push_back(subpart_elem))))
|
||||||
{
|
{
|
||||||
|
char *ptr= create_subpartition_name(j, part_elem->partition_name);
|
||||||
|
if (!ptr)
|
||||||
|
goto end;
|
||||||
subpart_elem->engine_type= default_engine_type;
|
subpart_elem->engine_type= default_engine_type;
|
||||||
subpart_elem->partition_name= name_ptr;
|
subpart_elem->partition_name= ptr;
|
||||||
name_ptr+= MAX_PART_NAME_SIZE;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -694,6 +718,8 @@ bool partition_info::check_partition_info(handlerton **eng_type,
|
|||||||
do
|
do
|
||||||
{
|
{
|
||||||
partition_element *part_elem= part_it++;
|
partition_element *part_elem= part_it++;
|
||||||
|
if (part_elem->engine_type == NULL)
|
||||||
|
part_elem->engine_type= default_engine_type;
|
||||||
if (!is_sub_partitioned())
|
if (!is_sub_partitioned())
|
||||||
{
|
{
|
||||||
if (check_table_name(part_elem->partition_name,
|
if (check_table_name(part_elem->partition_name,
|
||||||
@ -702,8 +728,6 @@ bool partition_info::check_partition_info(handlerton **eng_type,
|
|||||||
my_error(ER_WRONG_PARTITION_NAME, MYF(0));
|
my_error(ER_WRONG_PARTITION_NAME, MYF(0));
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
if (part_elem->engine_type == NULL)
|
|
||||||
part_elem->engine_type= default_engine_type;
|
|
||||||
DBUG_PRINT("info", ("engine = %d",
|
DBUG_PRINT("info", ("engine = %d",
|
||||||
ha_legacy_type(part_elem->engine_type)));
|
ha_legacy_type(part_elem->engine_type)));
|
||||||
engine_array[part_count++]= part_elem->engine_type;
|
engine_array[part_count++]= part_elem->engine_type;
|
||||||
@ -714,18 +738,18 @@ bool partition_info::check_partition_info(handlerton **eng_type,
|
|||||||
List_iterator<partition_element> sub_it(part_elem->subpartitions);
|
List_iterator<partition_element> sub_it(part_elem->subpartitions);
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
part_elem= sub_it++;
|
partition_element *sub_elem= sub_it++;
|
||||||
if (check_table_name(part_elem->partition_name,
|
if (check_table_name(sub_elem->partition_name,
|
||||||
strlen(part_elem->partition_name)))
|
strlen(sub_elem->partition_name)))
|
||||||
{
|
{
|
||||||
my_error(ER_WRONG_PARTITION_NAME, MYF(0));
|
my_error(ER_WRONG_PARTITION_NAME, MYF(0));
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
if (part_elem->engine_type == NULL)
|
if (sub_elem->engine_type == NULL)
|
||||||
part_elem->engine_type= default_engine_type;
|
sub_elem->engine_type= default_engine_type;
|
||||||
DBUG_PRINT("info", ("engine = %u",
|
DBUG_PRINT("info", ("engine = %u",
|
||||||
ha_legacy_type(part_elem->engine_type)));
|
ha_legacy_type(sub_elem->engine_type)));
|
||||||
engine_array[part_count++]= part_elem->engine_type;
|
engine_array[part_count++]= sub_elem->engine_type;
|
||||||
} while (++j < no_subparts);
|
} while (++j < no_subparts);
|
||||||
}
|
}
|
||||||
} while (++i < no_parts);
|
} while (++i < no_parts);
|
||||||
|
@ -256,7 +256,7 @@ private:
|
|||||||
uint start_no);
|
uint start_no);
|
||||||
bool set_up_default_subpartitions(handler *file, ulonglong max_rows);
|
bool set_up_default_subpartitions(handler *file, ulonglong max_rows);
|
||||||
char *create_default_partition_names(uint part_no, uint no_parts,
|
char *create_default_partition_names(uint part_no, uint no_parts,
|
||||||
uint start_no, bool is_subpart);
|
uint start_no);
|
||||||
bool has_unique_name(partition_element *element);
|
bool has_unique_name(partition_element *element);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1754,7 +1754,6 @@ end:
|
|||||||
buf_length A pointer to the returned buffer length
|
buf_length A pointer to the returned buffer length
|
||||||
use_sql_alloc Allocate buffer from sql_alloc if true
|
use_sql_alloc Allocate buffer from sql_alloc if true
|
||||||
otherwise use my_malloc
|
otherwise use my_malloc
|
||||||
write_all Write everything, also default values
|
|
||||||
|
|
||||||
RETURN VALUES
|
RETURN VALUES
|
||||||
NULL error
|
NULL error
|
||||||
@ -1782,8 +1781,7 @@ end:
|
|||||||
|
|
||||||
char *generate_partition_syntax(partition_info *part_info,
|
char *generate_partition_syntax(partition_info *part_info,
|
||||||
uint *buf_length,
|
uint *buf_length,
|
||||||
bool use_sql_alloc,
|
bool use_sql_alloc)
|
||||||
bool write_all)
|
|
||||||
{
|
{
|
||||||
uint i,j, tot_no_parts, no_subparts, no_parts;
|
uint i,j, tot_no_parts, no_subparts, no_parts;
|
||||||
partition_element *part_elem;
|
partition_element *part_elem;
|
||||||
@ -1869,7 +1867,7 @@ char *generate_partition_syntax(partition_info *part_info,
|
|||||||
tot_no_parts= no_parts + no_temp_parts;
|
tot_no_parts= no_parts + no_temp_parts;
|
||||||
no_subparts= part_info->no_subparts;
|
no_subparts= part_info->no_subparts;
|
||||||
|
|
||||||
if (write_all || (!part_info->use_default_partitions))
|
if (!part_info->use_default_partitions)
|
||||||
{
|
{
|
||||||
err+= add_begin_parenthesis(fptr);
|
err+= add_begin_parenthesis(fptr);
|
||||||
i= 0;
|
i= 0;
|
||||||
@ -1930,10 +1928,11 @@ char *generate_partition_syntax(partition_info *part_info,
|
|||||||
err+= add_name_string(fptr, part_elem->partition_name);
|
err+= add_name_string(fptr, part_elem->partition_name);
|
||||||
err+= add_space(fptr);
|
err+= add_space(fptr);
|
||||||
err+= add_partition_values(fptr, part_info, part_elem);
|
err+= add_partition_values(fptr, part_info, part_elem);
|
||||||
if (!part_info->is_sub_partitioned())
|
if (!part_info->is_sub_partitioned() ||
|
||||||
|
part_info->use_default_subpartitions)
|
||||||
err+= add_partition_options(fptr, part_elem);
|
err+= add_partition_options(fptr, part_elem);
|
||||||
if (part_info->is_sub_partitioned() &&
|
if (part_info->is_sub_partitioned() &&
|
||||||
(write_all || (!part_info->use_default_subpartitions)))
|
(!part_info->use_default_subpartitions))
|
||||||
{
|
{
|
||||||
err+= add_space(fptr);
|
err+= add_space(fptr);
|
||||||
err+= add_begin_parenthesis(fptr);
|
err+= add_begin_parenthesis(fptr);
|
||||||
@ -3949,6 +3948,7 @@ uint prep_alter_part_table(THD *thd, TABLE *table, ALTER_INFO *alter_info,
|
|||||||
DBUG_RETURN(TRUE);
|
DBUG_RETURN(TRUE);
|
||||||
}
|
}
|
||||||
alt_part_info->part_type= tab_part_info->part_type;
|
alt_part_info->part_type= tab_part_info->part_type;
|
||||||
|
alt_part_info->subpart_type= tab_part_info->subpart_type;
|
||||||
if (alt_part_info->set_up_defaults_for_partitioning(table->file,
|
if (alt_part_info->set_up_defaults_for_partitioning(table->file,
|
||||||
ULL(0),
|
ULL(0),
|
||||||
tab_part_info->no_parts))
|
tab_part_info->no_parts))
|
||||||
@ -4377,6 +4377,15 @@ state of p1.
|
|||||||
my_error(ER_TOO_MANY_PARTITIONS_ERROR, MYF(0));
|
my_error(ER_TOO_MANY_PARTITIONS_ERROR, MYF(0));
|
||||||
DBUG_RETURN(TRUE);
|
DBUG_RETURN(TRUE);
|
||||||
}
|
}
|
||||||
|
alt_part_info->part_type= tab_part_info->part_type;
|
||||||
|
alt_part_info->subpart_type= tab_part_info->subpart_type;
|
||||||
|
DBUG_ASSERT(!alt_part_info->use_default_partitions);
|
||||||
|
if (alt_part_info->set_up_defaults_for_partitioning(table->file,
|
||||||
|
ULL(0),
|
||||||
|
0))
|
||||||
|
{
|
||||||
|
DBUG_RETURN(TRUE);
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
Online handling:
|
Online handling:
|
||||||
REORGANIZE PARTITION:
|
REORGANIZE PARTITION:
|
||||||
@ -4513,7 +4522,7 @@ the generated partition syntax in a correct manner.
|
|||||||
tab_part_info->use_default_no_subpartitions= FALSE;
|
tab_part_info->use_default_no_subpartitions= FALSE;
|
||||||
}
|
}
|
||||||
if (tab_part_info->check_partition_info((handlerton**)NULL,
|
if (tab_part_info->check_partition_info((handlerton**)NULL,
|
||||||
table->file, ULL(0)))
|
table->file, ULL(0)))
|
||||||
{
|
{
|
||||||
DBUG_RETURN(TRUE);
|
DBUG_RETURN(TRUE);
|
||||||
}
|
}
|
||||||
|
@ -69,8 +69,7 @@ bool check_partition_info(partition_info *part_info,handlerton **eng_type,
|
|||||||
bool fix_partition_func(THD *thd, const char *name, TABLE *table,
|
bool fix_partition_func(THD *thd, const char *name, TABLE *table,
|
||||||
bool create_table_ind);
|
bool create_table_ind);
|
||||||
char *generate_partition_syntax(partition_info *part_info,
|
char *generate_partition_syntax(partition_info *part_info,
|
||||||
uint *buf_length, bool use_sql_alloc,
|
uint *buf_length, bool use_sql_alloc);
|
||||||
bool write_all);
|
|
||||||
bool partition_key_modified(TABLE *table, List<Item> &fields);
|
bool partition_key_modified(TABLE *table, List<Item> &fields);
|
||||||
void get_partition_set(const TABLE *table, byte *buf, const uint index,
|
void get_partition_set(const TABLE *table, byte *buf, const uint index,
|
||||||
const key_range *key_spec,
|
const key_range *key_spec,
|
||||||
|
@ -1276,7 +1276,7 @@ store_create_info(THD *thd, TABLE_LIST *table_list, String *packet,
|
|||||||
if (table->part_info &&
|
if (table->part_info &&
|
||||||
((part_syntax= generate_partition_syntax(table->part_info,
|
((part_syntax= generate_partition_syntax(table->part_info,
|
||||||
&part_syntax_len,
|
&part_syntax_len,
|
||||||
FALSE,FALSE))))
|
FALSE))))
|
||||||
{
|
{
|
||||||
packet->append(part_syntax, part_syntax_len);
|
packet->append(part_syntax, part_syntax_len);
|
||||||
my_free(part_syntax, MYF(0));
|
my_free(part_syntax, MYF(0));
|
||||||
|
@ -323,7 +323,7 @@ bool mysql_write_frm(ALTER_PARTITION_PARAM_TYPE *lpt, uint flags)
|
|||||||
part_info->part_state_len= 0;
|
part_info->part_state_len= 0;
|
||||||
if (!(part_syntax_buf= generate_partition_syntax(part_info,
|
if (!(part_syntax_buf= generate_partition_syntax(part_info,
|
||||||
&syntax_len,
|
&syntax_len,
|
||||||
TRUE, FALSE)))
|
TRUE)))
|
||||||
{
|
{
|
||||||
DBUG_RETURN(TRUE);
|
DBUG_RETURN(TRUE);
|
||||||
}
|
}
|
||||||
@ -2159,7 +2159,7 @@ bool mysql_create_table_internal(THD *thd,
|
|||||||
*/
|
*/
|
||||||
if (!(part_syntax_buf= generate_partition_syntax(part_info,
|
if (!(part_syntax_buf= generate_partition_syntax(part_info,
|
||||||
&syntax_len,
|
&syntax_len,
|
||||||
TRUE, FALSE)))
|
TRUE)))
|
||||||
goto err;
|
goto err;
|
||||||
part_info->part_info_string= part_syntax_buf;
|
part_info->part_info_string= part_syntax_buf;
|
||||||
part_info->part_info_len= syntax_len;
|
part_info->part_info_len= syntax_len;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user