Commit dc97402c authored by Mikael Ronstrom's avatar Mikael Ronstrom

Changed all no_ to num_ to avoid strange names like no_list_values which is...

Changed all no_ to num_ to avoid strange names like no_list_values which is not expected to be number of list values, rather a boolea indicating no list values
parent 3b29941f
drop table if exists t1;
create table t1 (a int)
partition by list (a)
( partition p0 values in (1),
partition p1 values in (1));
ERROR HY000: Multiple definition of same constant in list partitioning
create table t1 (a int)
partition by list (a)
( partition p0 values in (2, 1),
partition p1 values in (4, NULL, 3));
insert into t1 values (1);
insert into t1 values (2);
insert into t1 values (3);
insert into t1 values (4);
insert into t1 values (NULL);
insert into t1 values (5);
ERROR HY000: Table has no partition for value 5
drop table t1;
create table t1 (a int)
partition by list column_list(a)
( partition p0 values in (column_list(2), column_list(1)),
partition p1 values in (column_list(4), column_list(NULL), column_list(3)));
insert into t1 values (1);
insert into t1 values (2);
insert into t1 values (3);
insert into t1 values (4);
insert into t1 values (NULL);
insert into t1 values (5);
ERROR HY000: Table has no partition for value from column_list
drop table t1;
create table t1 (a int, b char(10), c varchar(25), d datetime)
partition by range column_list(a,b,c,d)
subpartition by hash (to_seconds(d))
......
......@@ -8,6 +8,38 @@
drop table if exists t1;
--enable_warnings
--error ER_MULTIPLE_DEF_CONST_IN_LIST_PART_ERROR
create table t1 (a int)
partition by list (a)
( partition p0 values in (1),
partition p1 values in (1));
create table t1 (a int)
partition by list (a)
( partition p0 values in (2, 1),
partition p1 values in (4, NULL, 3));
insert into t1 values (1);
insert into t1 values (2);
insert into t1 values (3);
insert into t1 values (4);
insert into t1 values (NULL);
--error ER_NO_PARTITION_FOR_GIVEN_VALUE
insert into t1 values (5);
drop table t1;
create table t1 (a int)
partition by list column_list(a)
( partition p0 values in (column_list(2), column_list(1)),
partition p1 values in (column_list(4), column_list(NULL), column_list(3)));
insert into t1 values (1);
insert into t1 values (2);
insert into t1 values (3);
insert into t1 values (4);
insert into t1 values (NULL);
--error ER_NO_PARTITION_FOR_GIVEN_VALUE
insert into t1 values (5);
drop table t1;
create table t1 (a int, b char(10), c varchar(25), d datetime)
partition by range column_list(a,b,c,d)
subpartition by hash (to_seconds(d))
......
This diff is collapsed.
......@@ -112,7 +112,7 @@ class ha_partition :public handler
uint m_reorged_parts; // Number of reorganised parts
uint m_tot_parts; // Total number of partitions;
uint m_no_locks; // For engines like ha_blackhole, which needs no locks
uint m_num_locks; // For engines like ha_blackhole, which needs no locks
uint m_last_part; // Last file that we update,write,read
int m_lock_type; // Remembers type of last
// external_lock
......@@ -239,10 +239,10 @@ class ha_partition :public handler
size_t pack_frm_len);
virtual int drop_partitions(const char *path);
virtual int rename_partitions(const char *path);
bool get_no_parts(const char *name, uint *no_parts)
bool get_no_parts(const char *name, uint *num_parts)
{
DBUG_ENTER("ha_partition::get_no_parts");
*no_parts= m_tot_parts;
*num_parts= m_tot_parts;
DBUG_RETURN(0);
}
virtual void change_table_ptr(TABLE *table_arg, TABLE_SHARE *share);
......
......@@ -2638,7 +2638,7 @@ typedef struct st_part_prune_param
/* Iterator to be used to obtain the "current" set of used partitions */
PARTITION_ITERATOR part_iter;
/* Initialized bitmap of no_subparts size */
/* Initialized bitmap of num_subparts size */
MY_BITMAP subparts_bitmap;
uchar *cur_min_key;
......@@ -2904,8 +2904,8 @@ static void mark_full_partition_used_no_parts(partition_info* part_info,
static void mark_full_partition_used_with_parts(partition_info *part_info,
uint32 part_id)
{
uint32 start= part_id * part_info->no_subparts;
uint32 end= start + part_info->no_subparts;
uint32 start= part_id * part_info->num_subparts;
uint32 end= start + part_info->num_subparts;
DBUG_ENTER("mark_full_partition_used_with_parts");
for (; start != end; start++)
......@@ -3328,10 +3328,10 @@ int find_used_partitions(PART_PRUNE_PARAM *ppar, SEL_ARG *key_tree)
while ((part_id= ppar->part_iter.get_next(&ppar->part_iter)) !=
NOT_A_PARTITION_ID)
{
for (uint i= 0; i < ppar->part_info->no_subparts; i++)
for (uint i= 0; i < ppar->part_info->num_subparts; i++)
if (bitmap_is_set(&ppar->subparts_bitmap, i))
bitmap_set_bit(&ppar->part_info->used_partitions,
part_id * ppar->part_info->no_subparts + i);
part_id * ppar->part_info->num_subparts + i);
}
goto pop_and_go_right;
}
......@@ -3393,7 +3393,7 @@ int find_used_partitions(PART_PRUNE_PARAM *ppar, SEL_ARG *key_tree)
NOT_A_PARTITION_ID)
{
bitmap_set_bit(&part_info->used_partitions,
part_id * part_info->no_subparts + subpart_id);
part_id * part_info->num_subparts + subpart_id);
}
res= 1; /* Some partitions were marked as used */
goto pop_and_go_right;
......@@ -3541,10 +3541,10 @@ static bool create_partition_index_description(PART_PRUNE_PARAM *ppar)
uint used_part_fields, used_subpart_fields;
used_part_fields= fields_ok_for_partition_index(part_info->part_field_array) ?
part_info->no_part_fields : 0;
part_info->num_part_fields : 0;
used_subpart_fields=
fields_ok_for_partition_index(part_info->subpart_field_array)?
part_info->no_subpart_fields : 0;
part_info->num_subpart_fields : 0;
uint total_parts= used_part_fields + used_subpart_fields;
......@@ -3583,10 +3583,10 @@ static bool create_partition_index_description(PART_PRUNE_PARAM *ppar)
if (ppar->subpart_fields)
{
my_bitmap_map *buf;
uint32 bufsize= bitmap_buffer_size(ppar->part_info->no_subparts);
uint32 bufsize= bitmap_buffer_size(ppar->part_info->num_subparts);
if (!(buf= (my_bitmap_map*) alloc_root(alloc, bufsize)))
return TRUE;
bitmap_init(&ppar->subparts_bitmap, buf, ppar->part_info->no_subparts,
bitmap_init(&ppar->subparts_bitmap, buf, ppar->part_info->num_subparts,
FALSE);
}
range_par->key_parts= key_part;
......
This diff is collapsed.
......@@ -176,17 +176,17 @@ class partition_info : public Sql_alloc
uint part_func_len;
uint subpart_func_len;
uint no_parts;
uint no_subparts;
uint num_parts;
uint num_subparts;
uint count_curr_subparts;
uint part_error_code;
uint no_list_values;
uint num_list_values;
uint no_part_fields;
uint no_subpart_fields;
uint no_full_part_fields;
uint num_part_fields;
uint num_subpart_fields;
uint num_full_part_fields;
uint has_null_part_id;
/*
......@@ -197,9 +197,9 @@ class partition_info : public Sql_alloc
uint16 linear_hash_mask;
bool use_default_partitions;
bool use_default_no_partitions;
bool use_default_num_partitions;
bool use_default_subpartitions;
bool use_default_no_subpartitions;
bool use_default_num_subpartitions;
bool default_partitions_setup;
bool defined_max_value;
bool list_of_part_fields;
......@@ -233,12 +233,12 @@ class partition_info : public Sql_alloc
part_type(NOT_A_PARTITION), subpart_type(NOT_A_PARTITION),
part_info_len(0), part_state_len(0),
part_func_len(0), subpart_func_len(0),
no_parts(0), no_subparts(0),
num_parts(0), num_subparts(0),
count_curr_subparts(0), part_error_code(0),
no_list_values(0), no_part_fields(0), no_subpart_fields(0),
no_full_part_fields(0), has_null_part_id(0), linear_hash_mask(0),
use_default_partitions(TRUE), use_default_no_partitions(TRUE),
use_default_subpartitions(TRUE), use_default_no_subpartitions(TRUE),
num_list_values(0), num_part_fields(0), num_subpart_fields(0),
num_full_part_fields(0), has_null_part_id(0), linear_hash_mask(0),
use_default_partitions(TRUE), use_default_num_partitions(TRUE),
use_default_subpartitions(TRUE), use_default_num_subpartitions(TRUE),
default_partitions_setup(FALSE), defined_max_value(FALSE),
list_of_part_fields(FALSE), list_of_subpart_fields(FALSE),
linear_hash_ind(FALSE), fixed(FALSE),
......@@ -266,7 +266,7 @@ class partition_info : public Sql_alloc
/* Returns the total number of partitions on the leaf level */
uint get_tot_partitions()
{
return no_parts * (is_sub_partitioned() ? no_subparts : 1);
return num_parts * (is_sub_partitioned() ? num_subparts : 1);
}
bool set_up_defaults_for_partitioning(handler *file, HA_CREATE_INFO *info,
......@@ -289,7 +289,7 @@ class partition_info : public Sql_alloc
bool set_up_default_partitions(handler *file, HA_CREATE_INFO *info,
uint start_no);
bool set_up_default_subpartitions(handler *file, HA_CREATE_INFO *info);
char *create_default_partition_names(uint part_no, uint no_parts,
char *create_default_partition_names(uint part_no, uint num_parts,
uint start_no);
char *create_subpartition_name(uint subpart_no, const char *part_name);
bool has_unique_name(partition_element *element);
......@@ -317,6 +317,6 @@ void init_all_partitions_iterator(partition_info *part_info,
PARTITION_ITERATOR *part_iter)
{
part_iter->part_nums.start= part_iter->part_nums.cur= 0;
part_iter->part_nums.end= part_info->no_parts;
part_iter->part_nums.end= part_info->num_parts;
part_iter->get_next= get_next_partition_id_range;
}
......@@ -1498,7 +1498,7 @@ Alter_info::Alter_info(const Alter_info &rhs, MEM_ROOT *mem_root)
keys_onoff(rhs.keys_onoff),
tablespace_op(rhs.tablespace_op),
partition_names(rhs.partition_names, mem_root),
no_parts(rhs.no_parts),
num_parts(rhs.num_parts),
change_level(rhs.change_level),
datetime_field(rhs.datetime_field),
error_if_not_empty(rhs.error_if_not_empty)
......
......@@ -893,7 +893,7 @@ class Alter_info
enum enum_enable_or_disable keys_onoff;
enum tablespace_op_type tablespace_op;
List<char> partition_names;
uint no_parts;
uint num_parts;
enum_alter_table_change_level change_level;
Create_field *datetime_field;
bool error_if_not_empty;
......@@ -903,7 +903,7 @@ class Alter_info
flags(0),
keys_onoff(LEAVE_AS_IS),
tablespace_op(NO_TABLESPACE_OP),
no_parts(0),
num_parts(0),
change_level(ALTER_TABLE_METADATA_ONLY),
datetime_field(NULL),
error_if_not_empty(FALSE)
......@@ -918,7 +918,7 @@ class Alter_info
flags= 0;
keys_onoff= LEAVE_AS_IS;
tablespace_op= NO_TABLESPACE_OP;
no_parts= 0;
num_parts= 0;
partition_names.empty();
change_level= ALTER_TABLE_METADATA_ONLY;
datetime_field= 0;
......
This diff is collapsed.
......@@ -65,7 +65,7 @@ int get_part_for_delete(const uchar *buf, const uchar *rec0,
void prune_partition_set(const TABLE *table, part_id_range *part_spec);
bool check_partition_info(partition_info *part_info,handlerton **eng_type,
TABLE *table, handler *file, HA_CREATE_INFO *info);
void set_linear_hash_mask(partition_info *part_info, uint no_parts);
void set_linear_hash_mask(partition_info *part_info, uint num_parts);
bool fix_partition_func(THD *thd, TABLE *table, bool create_table_ind);
char *generate_partition_syntax(partition_info *part_info,
uint *buf_length, bool use_sql_alloc,
......
......@@ -3700,9 +3700,9 @@ bool mysql_create_table_no_lock(THD *thd,
creates a proper .par file. The current part_info object is
only used to create the frm-file and .par-file.
*/
if (part_info->use_default_no_partitions &&
part_info->no_parts &&
(int)part_info->no_parts !=
if (part_info->use_default_num_partitions &&
part_info->num_parts &&
(int)part_info->num_parts !=
file->get_default_no_partitions(create_info))
{
uint i;
......@@ -3713,13 +3713,13 @@ bool mysql_create_table_no_lock(THD *thd,
(part_it++)->part_state= PART_TO_BE_DROPPED;
}
else if (part_info->is_sub_partitioned() &&
part_info->use_default_no_subpartitions &&
part_info->no_subparts &&
(int)part_info->no_subparts !=
part_info->use_default_num_subpartitions &&
part_info->num_subparts &&
(int)part_info->num_subparts !=
file->get_default_no_partitions(create_info))
{
DBUG_ASSERT(thd->lex->sql_command != SQLCOM_CREATE_TABLE);
part_info->no_subparts= file->get_default_no_partitions(create_info);
part_info->num_subparts= file->get_default_no_partitions(create_info);
}
}
else if (create_info->db_type != engine_type)
......@@ -4531,11 +4531,11 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
my_error(ER_PARTITION_MGMT_ON_NONPARTITIONED, MYF(0));
DBUG_RETURN(TRUE);
}
uint no_parts_found;
uint no_parts_opt= alter_info->partition_names.elements;
no_parts_found= set_part_state(alter_info, table->table->part_info,
uint num_parts_found;
uint num_parts_opt= alter_info->partition_names.elements;
num_parts_found= set_part_state(alter_info, table->table->part_info,
PART_CHANGED);
if (no_parts_found != no_parts_opt &&
if (num_parts_found != num_parts_opt &&
(!(alter_info->flags & ALTER_ALL_PARTITION)))
{
char buff[FN_REFLEN + MYSQL_ERRMSG_SIZE];
......
......@@ -3810,7 +3810,7 @@ partition_entry:
;
partition:
BY part_type_def opt_no_parts opt_sub_part part_defs
BY part_type_def opt_num_parts opt_sub_part part_defs
;
part_type_def:
......@@ -3895,20 +3895,20 @@ sub_part_func:
;
opt_no_parts:
opt_num_parts:
/* empty */ {}
| PARTITIONS_SYM real_ulong_num
{
uint no_parts= $2;
uint num_parts= $2;
partition_info *part_info= Lex->part_info;
if (no_parts == 0)
if (num_parts == 0)
{
my_error(ER_NO_PARTS_ERROR, MYF(0), "partitions");
MYSQL_YYABORT;
}
part_info->no_parts= no_parts;
part_info->use_default_no_partitions= FALSE;
part_info->num_parts= num_parts;
part_info->use_default_num_partitions= FALSE;
}
;
......@@ -3916,7 +3916,7 @@ opt_sub_part:
/* empty */ {}
| SUBPARTITION_SYM BY opt_linear HASH_SYM sub_part_func
{ Lex->part_info->subpart_type= HASH_PARTITION; }
opt_no_subparts {}
opt_num_subparts {}
| SUBPARTITION_SYM BY opt_linear KEY_SYM
'(' sub_part_field_list ')'
{
......@@ -3924,7 +3924,7 @@ opt_sub_part:
part_info->subpart_type= HASH_PARTITION;
part_info->list_of_subpart_fields= TRUE;
}
opt_no_subparts {}
opt_num_subparts {}
;
sub_part_field_list:
......@@ -3966,19 +3966,19 @@ part_func_expr:
}
;
opt_no_subparts:
opt_num_subparts:
/* empty */ {}
| SUBPARTITIONS_SYM real_ulong_num
{
uint no_parts= $2;
uint num_parts= $2;
LEX *lex= Lex;
if (no_parts == 0)
if (num_parts == 0)
{
my_error(ER_NO_PARTS_ERROR, MYF(0), "subpartitions");
MYSQL_YYABORT;
}
lex->part_info->no_subparts= no_parts;
lex->part_info->use_default_no_subpartitions= FALSE;
lex->part_info->num_subparts= num_parts;
lex->part_info->use_default_num_subpartitions= FALSE;
}
;
......@@ -3989,9 +3989,9 @@ part_defs:
{
partition_info *part_info= Lex->part_info;
uint count_curr_parts= part_info->partitions.elements;
if (part_info->no_parts != 0)
if (part_info->num_parts != 0)
{
if (part_info->no_parts !=
if (part_info->num_parts !=
count_curr_parts)
{
my_parse_error(ER(ER_PARTITION_WRONG_NO_PART_ERROR));
......@@ -4000,7 +4000,7 @@ part_defs:
}
else if (count_curr_parts > 0)
{
part_info->no_parts= count_curr_parts;
part_info->num_parts= count_curr_parts;
}
part_info->count_curr_subparts= 0;
}
......@@ -4026,7 +4026,7 @@ part_definition:
part_info->curr_part_elem= p_elem;
part_info->current_partition= p_elem;
part_info->use_default_partitions= FALSE;
part_info->use_default_no_partitions= FALSE;
part_info->use_default_num_partitions= FALSE;
}
part_name
opt_part_values
......@@ -4338,7 +4338,7 @@ opt_sub_partition:
/* empty */
{
partition_info *part_info= Lex->part_info;
if (part_info->no_subparts != 0 &&
if (part_info->num_subparts != 0 &&
!part_info->use_default_subpartitions)
{
/*
......@@ -4352,9 +4352,9 @@ opt_sub_partition:
| '(' sub_part_list ')'
{
partition_info *part_info= Lex->part_info;
if (part_info->no_subparts != 0)
if (part_info->num_subparts != 0)
{
if (part_info->no_subparts !=
if (part_info->num_subparts !=
part_info->count_curr_subparts)
{
my_parse_error(ER(ER_PARTITION_WRONG_NO_SUBPART_ERROR));
......@@ -4368,7 +4368,7 @@ opt_sub_partition:
my_parse_error(ER(ER_PARTITION_WRONG_NO_SUBPART_ERROR));
MYSQL_YYABORT;
}
part_info->no_subparts= part_info->count_curr_subparts;
part_info->num_subparts= part_info->count_curr_subparts;
}
part_info->count_curr_subparts= 0;
}
......@@ -4410,7 +4410,7 @@ sub_part_definition:
}
part_info->curr_part_elem= sub_p_elem;
part_info->use_default_subpartitions= FALSE;
part_info->use_default_no_subpartitions= FALSE;
part_info->use_default_num_subpartitions= FALSE;
part_info->count_curr_subparts++;
}
sub_name opt_part_options {}
......@@ -5850,7 +5850,7 @@ alter_commands:
LEX *lex= Lex;
lex->alter_info.flags|= ALTER_COALESCE_PARTITION;
lex->no_write_to_binlog= $3;
lex->alter_info.no_parts= $4;
lex->alter_info.num_parts= $4;
}
| reorg_partition_rule
;
......@@ -5892,12 +5892,11 @@ add_part_extra:
| '(' part_def_list ')'
{
LEX *lex= Lex;
lex->part_info->no_parts= lex->part_info->partitions.elements;
lex->part_info->num_parts= lex->part_info->partitions.elements;
}
| PARTITIONS_SYM real_ulong_num
{
LEX *lex= Lex;
lex->part_info->no_parts= $2;
Lex->part_info->num_parts= $2;
}
;
......@@ -5928,7 +5927,7 @@ reorg_parts_rule:
INTO '(' part_def_list ')'
{
partition_info *part_info= Lex->part_info;
part_info->no_parts= part_info->partitions.elements;
part_info->num_parts= part_info->partitions.elements;
}
;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment