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; 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) create table t1 (a int, b char(10), c varchar(25), d datetime)
partition by range column_list(a,b,c,d) partition by range column_list(a,b,c,d)
subpartition by hash (to_seconds(d)) subpartition by hash (to_seconds(d))
......
...@@ -8,6 +8,38 @@ ...@@ -8,6 +8,38 @@
drop table if exists t1; drop table if exists t1;
--enable_warnings --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) create table t1 (a int, b char(10), c varchar(25), d datetime)
partition by range column_list(a,b,c,d) partition by range column_list(a,b,c,d)
subpartition by hash (to_seconds(d)) subpartition by hash (to_seconds(d))
......
...@@ -244,7 +244,7 @@ void ha_partition::init_handler_variables() ...@@ -244,7 +244,7 @@ void ha_partition::init_handler_variables()
/* /*
this allows blackhole to work properly this allows blackhole to work properly
*/ */
m_no_locks= 0; m_num_locks= 0;
#ifdef DONT_HAVE_TO_BE_INITALIZED #ifdef DONT_HAVE_TO_BE_INITALIZED
m_start_key.flag= 0; m_start_key.flag= 0;
...@@ -579,8 +579,8 @@ int ha_partition::drop_partitions(const char *path) ...@@ -579,8 +579,8 @@ int ha_partition::drop_partitions(const char *path)
{ {
List_iterator<partition_element> part_it(m_part_info->partitions); List_iterator<partition_element> part_it(m_part_info->partitions);
char part_name_buff[FN_REFLEN]; char part_name_buff[FN_REFLEN];
uint no_parts= m_part_info->partitions.elements; uint num_parts= m_part_info->partitions.elements;
uint no_subparts= m_part_info->no_subparts; uint num_subparts= m_part_info->num_subparts;
uint i= 0; uint i= 0;
uint name_variant; uint name_variant;
int ret_error; int ret_error;
...@@ -610,7 +610,7 @@ int ha_partition::drop_partitions(const char *path) ...@@ -610,7 +610,7 @@ int ha_partition::drop_partitions(const char *path)
do do
{ {
partition_element *sub_elem= sub_it++; partition_element *sub_elem= sub_it++;
part= i * no_subparts + j; part= i * num_subparts + j;
create_subpartition_name(part_name_buff, path, create_subpartition_name(part_name_buff, path,
part_elem->partition_name, part_elem->partition_name,
sub_elem->partition_name, name_variant); sub_elem->partition_name, name_variant);
...@@ -620,7 +620,7 @@ int ha_partition::drop_partitions(const char *path) ...@@ -620,7 +620,7 @@ int ha_partition::drop_partitions(const char *path)
error= ret_error; error= ret_error;
if (deactivate_ddl_log_entry(sub_elem->log_entry->entry_pos)) if (deactivate_ddl_log_entry(sub_elem->log_entry->entry_pos))
error= 1; error= 1;
} while (++j < no_subparts); } while (++j < num_subparts);
} }
else else
{ {
...@@ -639,7 +639,7 @@ int ha_partition::drop_partitions(const char *path) ...@@ -639,7 +639,7 @@ int ha_partition::drop_partitions(const char *path)
else else
part_elem->part_state= PART_IS_DROPPED; part_elem->part_state= PART_IS_DROPPED;
} }
} while (++i < no_parts); } while (++i < num_parts);
VOID(sync_ddl_log()); VOID(sync_ddl_log());
DBUG_RETURN(error); DBUG_RETURN(error);
} }
...@@ -670,9 +670,9 @@ int ha_partition::rename_partitions(const char *path) ...@@ -670,9 +670,9 @@ int ha_partition::rename_partitions(const char *path)
List_iterator<partition_element> temp_it(m_part_info->temp_partitions); List_iterator<partition_element> temp_it(m_part_info->temp_partitions);
char part_name_buff[FN_REFLEN]; char part_name_buff[FN_REFLEN];
char norm_name_buff[FN_REFLEN]; char norm_name_buff[FN_REFLEN];
uint no_parts= m_part_info->partitions.elements; uint num_parts= m_part_info->partitions.elements;
uint part_count= 0; uint part_count= 0;
uint no_subparts= m_part_info->no_subparts; uint num_subparts= m_part_info->num_subparts;
uint i= 0; uint i= 0;
uint j= 0; uint j= 0;
int error= 0; int error= 0;
...@@ -720,7 +720,7 @@ int ha_partition::rename_partitions(const char *path) ...@@ -720,7 +720,7 @@ int ha_partition::rename_partitions(const char *path)
error= 1; error= 1;
else else
sub_elem->log_entry= NULL; /* Indicate success */ sub_elem->log_entry= NULL; /* Indicate success */
} while (++j < no_subparts); } while (++j < num_subparts);
} }
else else
{ {
...@@ -776,7 +776,7 @@ int ha_partition::rename_partitions(const char *path) ...@@ -776,7 +776,7 @@ int ha_partition::rename_partitions(const char *path)
do do
{ {
sub_elem= sub_it++; sub_elem= sub_it++;
part= i * no_subparts + j; part= i * num_subparts + j;
create_subpartition_name(norm_name_buff, path, create_subpartition_name(norm_name_buff, path,
part_elem->partition_name, part_elem->partition_name,
sub_elem->partition_name, sub_elem->partition_name,
...@@ -805,7 +805,7 @@ int ha_partition::rename_partitions(const char *path) ...@@ -805,7 +805,7 @@ int ha_partition::rename_partitions(const char *path)
error= 1; error= 1;
else else
sub_elem->log_entry= NULL; sub_elem->log_entry= NULL;
} while (++j < no_subparts); } while (++j < num_subparts);
} }
else else
{ {
...@@ -837,7 +837,7 @@ int ha_partition::rename_partitions(const char *path) ...@@ -837,7 +837,7 @@ int ha_partition::rename_partitions(const char *path)
part_elem->log_entry= NULL; part_elem->log_entry= NULL;
} }
} }
} while (++i < no_parts); } while (++i < num_parts);
VOID(sync_ddl_log()); VOID(sync_ddl_log());
DBUG_RETURN(error); DBUG_RETURN(error);
} }
...@@ -1047,8 +1047,8 @@ int ha_partition::handle_opt_partitions(THD *thd, HA_CHECK_OPT *check_opt, ...@@ -1047,8 +1047,8 @@ int ha_partition::handle_opt_partitions(THD *thd, HA_CHECK_OPT *check_opt,
uint flag) uint flag)
{ {
List_iterator<partition_element> part_it(m_part_info->partitions); List_iterator<partition_element> part_it(m_part_info->partitions);
uint no_parts= m_part_info->no_parts; uint num_parts= m_part_info->num_parts;
uint no_subparts= m_part_info->no_subparts; uint num_subparts= m_part_info->num_subparts;
uint i= 0; uint i= 0;
int error; int error;
DBUG_ENTER("ha_partition::handle_opt_partitions"); DBUG_ENTER("ha_partition::handle_opt_partitions");
...@@ -1072,7 +1072,7 @@ int ha_partition::handle_opt_partitions(THD *thd, HA_CHECK_OPT *check_opt, ...@@ -1072,7 +1072,7 @@ int ha_partition::handle_opt_partitions(THD *thd, HA_CHECK_OPT *check_opt,
do do
{ {
sub_elem= subpart_it++; sub_elem= subpart_it++;
part= i * no_subparts + j; part= i * num_subparts + j;
DBUG_PRINT("info", ("Optimize subpartition %u (%s)", DBUG_PRINT("info", ("Optimize subpartition %u (%s)",
part, sub_elem->partition_name)); part, sub_elem->partition_name));
#ifdef NOT_USED #ifdef NOT_USED
...@@ -1096,7 +1096,7 @@ int ha_partition::handle_opt_partitions(THD *thd, HA_CHECK_OPT *check_opt, ...@@ -1096,7 +1096,7 @@ int ha_partition::handle_opt_partitions(THD *thd, HA_CHECK_OPT *check_opt,
} }
DBUG_RETURN(error); DBUG_RETURN(error);
} }
} while (++j < no_subparts); } while (++j < num_subparts);
} }
else else
{ {
...@@ -1124,7 +1124,7 @@ int ha_partition::handle_opt_partitions(THD *thd, HA_CHECK_OPT *check_opt, ...@@ -1124,7 +1124,7 @@ int ha_partition::handle_opt_partitions(THD *thd, HA_CHECK_OPT *check_opt,
} }
} }
} }
} while (++i < no_parts); } while (++i < num_parts);
DBUG_RETURN(FALSE); DBUG_RETURN(FALSE);
} }
...@@ -1328,10 +1328,10 @@ int ha_partition::change_partitions(HA_CREATE_INFO *create_info, ...@@ -1328,10 +1328,10 @@ int ha_partition::change_partitions(HA_CREATE_INFO *create_info,
List_iterator<partition_element> part_it(m_part_info->partitions); List_iterator<partition_element> part_it(m_part_info->partitions);
List_iterator <partition_element> t_it(m_part_info->temp_partitions); List_iterator <partition_element> t_it(m_part_info->temp_partitions);
char part_name_buff[FN_REFLEN]; char part_name_buff[FN_REFLEN];
uint no_parts= m_part_info->partitions.elements; uint num_parts= m_part_info->partitions.elements;
uint no_subparts= m_part_info->no_subparts; uint num_subparts= m_part_info->num_subparts;
uint i= 0; uint i= 0;
uint no_remain_partitions, part_count, orig_count; uint num_remain_partitions, part_count, orig_count;
handler **new_file_array; handler **new_file_array;
int error= 1; int error= 1;
bool first; bool first;
...@@ -1347,7 +1347,7 @@ int ha_partition::change_partitions(HA_CREATE_INFO *create_info, ...@@ -1347,7 +1347,7 @@ int ha_partition::change_partitions(HA_CREATE_INFO *create_info,
part_name_buff))); part_name_buff)));
m_reorged_parts= 0; m_reorged_parts= 0;
if (!m_part_info->is_sub_partitioned()) if (!m_part_info->is_sub_partitioned())
no_subparts= 1; num_subparts= 1;
/* /*
Step 1: Step 1:
...@@ -1356,7 +1356,7 @@ int ha_partition::change_partitions(HA_CREATE_INFO *create_info, ...@@ -1356,7 +1356,7 @@ int ha_partition::change_partitions(HA_CREATE_INFO *create_info,
*/ */
if (temp_partitions) if (temp_partitions)
{ {
m_reorged_parts= temp_partitions * no_subparts; m_reorged_parts= temp_partitions * num_subparts;
} }
else else
{ {
...@@ -1366,9 +1366,9 @@ int ha_partition::change_partitions(HA_CREATE_INFO *create_info, ...@@ -1366,9 +1366,9 @@ int ha_partition::change_partitions(HA_CREATE_INFO *create_info,
if (part_elem->part_state == PART_CHANGED || if (part_elem->part_state == PART_CHANGED ||
part_elem->part_state == PART_REORGED_DROPPED) part_elem->part_state == PART_REORGED_DROPPED)
{ {
m_reorged_parts+= no_subparts; m_reorged_parts+= num_subparts;
} }
} while (++i < no_parts); } while (++i < num_parts);
} }
if (m_reorged_parts && if (m_reorged_parts &&
!(m_reorged_file= (handler**)sql_calloc(sizeof(handler*)* !(m_reorged_file= (handler**)sql_calloc(sizeof(handler*)*
...@@ -1383,10 +1383,10 @@ int ha_partition::change_partitions(HA_CREATE_INFO *create_info, ...@@ -1383,10 +1383,10 @@ int ha_partition::change_partitions(HA_CREATE_INFO *create_info,
Calculate number of partitions after change and allocate space for Calculate number of partitions after change and allocate space for
their handler references. their handler references.
*/ */
no_remain_partitions= 0; num_remain_partitions= 0;
if (temp_partitions) if (temp_partitions)
{ {
no_remain_partitions= no_parts * no_subparts; num_remain_partitions= num_parts * num_subparts;
} }
else else
{ {
...@@ -1399,17 +1399,17 @@ int ha_partition::change_partitions(HA_CREATE_INFO *create_info, ...@@ -1399,17 +1399,17 @@ int ha_partition::change_partitions(HA_CREATE_INFO *create_info,
part_elem->part_state == PART_TO_BE_ADDED || part_elem->part_state == PART_TO_BE_ADDED ||
part_elem->part_state == PART_CHANGED) part_elem->part_state == PART_CHANGED)
{ {
no_remain_partitions+= no_subparts; num_remain_partitions+= num_subparts;
} }
} while (++i < no_parts); } while (++i < num_parts);
} }
if (!(new_file_array= (handler**)sql_calloc(sizeof(handler*)* if (!(new_file_array= (handler**)sql_calloc(sizeof(handler*)*
(2*(no_remain_partitions + 1))))) (2*(num_remain_partitions + 1)))))
{ {
mem_alloc_error(sizeof(handler*)*2*(no_remain_partitions+1)); mem_alloc_error(sizeof(handler*)*2*(num_remain_partitions+1));
DBUG_RETURN(ER_OUTOFMEMORY); DBUG_RETURN(ER_OUTOFMEMORY);
} }
m_added_file= &new_file_array[no_remain_partitions + 1]; m_added_file= &new_file_array[num_remain_partitions + 1];
/* /*
Step 3: Step 3:
...@@ -1428,9 +1428,9 @@ int ha_partition::change_partitions(HA_CREATE_INFO *create_info, ...@@ -1428,9 +1428,9 @@ int ha_partition::change_partitions(HA_CREATE_INFO *create_info,
part_elem->part_state == PART_REORGED_DROPPED) part_elem->part_state == PART_REORGED_DROPPED)
{ {
memcpy((void*)&m_reorged_file[part_count], memcpy((void*)&m_reorged_file[part_count],
(void*)&m_file[i*no_subparts], (void*)&m_file[i*num_subparts],
sizeof(handler*)*no_subparts); sizeof(handler*)*num_subparts);
part_count+= no_subparts; part_count+= num_subparts;
} }
else if (first && temp_partitions && else if (first && temp_partitions &&
part_elem->part_state == PART_TO_BE_ADDED) part_elem->part_state == PART_TO_BE_ADDED)
...@@ -1445,11 +1445,11 @@ int ha_partition::change_partitions(HA_CREATE_INFO *create_info, ...@@ -1445,11 +1445,11 @@ int ha_partition::change_partitions(HA_CREATE_INFO *create_info,
ones used to be. ones used to be.
*/ */
first= FALSE; first= FALSE;
DBUG_ASSERT(((i*no_subparts) + m_reorged_parts) <= m_file_tot_parts); DBUG_ASSERT(((i*num_subparts) + m_reorged_parts) <= m_file_tot_parts);
memcpy((void*)m_reorged_file, &m_file[i*no_subparts], memcpy((void*)m_reorged_file, &m_file[i*num_subparts],
sizeof(handler*)*m_reorged_parts); sizeof(handler*)*m_reorged_parts);
} }
} while (++i < no_parts); } while (++i < num_parts);
} }
/* /*
...@@ -1467,11 +1467,11 @@ int ha_partition::change_partitions(HA_CREATE_INFO *create_info, ...@@ -1467,11 +1467,11 @@ int ha_partition::change_partitions(HA_CREATE_INFO *create_info,
partition_element *part_elem= part_it++; partition_element *part_elem= part_it++;
if (part_elem->part_state == PART_NORMAL) if (part_elem->part_state == PART_NORMAL)
{ {
DBUG_ASSERT(orig_count + no_subparts <= m_file_tot_parts); DBUG_ASSERT(orig_count + num_subparts <= m_file_tot_parts);
memcpy((void*)&new_file_array[part_count], (void*)&m_file[orig_count], memcpy((void*)&new_file_array[part_count], (void*)&m_file[orig_count],
sizeof(handler*)*no_subparts); sizeof(handler*)*num_subparts);
part_count+= no_subparts; part_count+= num_subparts;
orig_count+= no_subparts; orig_count+= num_subparts;
} }
else if (part_elem->part_state == PART_CHANGED || else if (part_elem->part_state == PART_CHANGED ||
part_elem->part_state == PART_TO_BE_ADDED) part_elem->part_state == PART_TO_BE_ADDED)
...@@ -1487,16 +1487,16 @@ int ha_partition::change_partitions(HA_CREATE_INFO *create_info, ...@@ -1487,16 +1487,16 @@ int ha_partition::change_partitions(HA_CREATE_INFO *create_info,
mem_alloc_error(sizeof(handler)); mem_alloc_error(sizeof(handler));
DBUG_RETURN(ER_OUTOFMEMORY); DBUG_RETURN(ER_OUTOFMEMORY);
} }
} while (++j < no_subparts); } while (++j < num_subparts);
if (part_elem->part_state == PART_CHANGED) if (part_elem->part_state == PART_CHANGED)
orig_count+= no_subparts; orig_count+= num_subparts;
else if (temp_partitions && first) else if (temp_partitions && first)
{ {
orig_count+= (no_subparts * temp_partitions); orig_count+= (num_subparts * temp_partitions);
first= FALSE; first= FALSE;
} }
} }
} while (++i < no_parts); } while (++i < num_parts);
first= FALSE; first= FALSE;
/* /*
Step 5: Step 5:
...@@ -1533,7 +1533,7 @@ int ha_partition::change_partitions(HA_CREATE_INFO *create_info, ...@@ -1533,7 +1533,7 @@ int ha_partition::change_partitions(HA_CREATE_INFO *create_info,
part_elem->partition_name, part_elem->partition_name,
sub_elem->partition_name, sub_elem->partition_name,
name_variant); name_variant);
part= i * no_subparts + j; part= i * num_subparts + j;
DBUG_PRINT("info", ("Add subpartition %s", part_name_buff)); DBUG_PRINT("info", ("Add subpartition %s", part_name_buff));
if ((error= prepare_new_partition(table, create_info, if ((error= prepare_new_partition(table, create_info,
new_file_array[part], new_file_array[part],
...@@ -1544,7 +1544,7 @@ int ha_partition::change_partitions(HA_CREATE_INFO *create_info, ...@@ -1544,7 +1544,7 @@ int ha_partition::change_partitions(HA_CREATE_INFO *create_info,
DBUG_RETURN(error); DBUG_RETURN(error);
} }
m_added_file[part_count++]= new_file_array[part]; m_added_file[part_count++]= new_file_array[part];
} while (++j < no_subparts); } while (++j < num_subparts);
} }
else else
{ {
...@@ -1563,7 +1563,7 @@ int ha_partition::change_partitions(HA_CREATE_INFO *create_info, ...@@ -1563,7 +1563,7 @@ int ha_partition::change_partitions(HA_CREATE_INFO *create_info,
m_added_file[part_count++]= new_file_array[i]; m_added_file[part_count++]= new_file_array[i];
} }
} }
} while (++i < no_parts); } while (++i < num_parts);
/* /*
Step 6: Step 6:
...@@ -1580,7 +1580,7 @@ int ha_partition::change_partitions(HA_CREATE_INFO *create_info, ...@@ -1580,7 +1580,7 @@ int ha_partition::change_partitions(HA_CREATE_INFO *create_info,
part_elem->part_state= PART_IS_CHANGED; part_elem->part_state= PART_IS_CHANGED;
else if (part_elem->part_state == PART_REORGED_DROPPED) else if (part_elem->part_state == PART_REORGED_DROPPED)
part_elem->part_state= PART_TO_BE_DROPPED; part_elem->part_state= PART_TO_BE_DROPPED;
} while (++i < no_parts); } while (++i < num_parts);
for (i= 0; i < temp_partitions; i++) for (i= 0; i < temp_partitions; i++)
{ {
partition_element *part_elem= t_it++; partition_element *part_elem= t_it++;
...@@ -1621,9 +1621,9 @@ int ha_partition::copy_partitions(ulonglong * const copied, ...@@ -1621,9 +1621,9 @@ int ha_partition::copy_partitions(ulonglong * const copied,
if (m_part_info->linear_hash_ind) if (m_part_info->linear_hash_ind)
{ {
if (m_part_info->part_type == HASH_PARTITION) if (m_part_info->part_type == HASH_PARTITION)
set_linear_hash_mask(m_part_info, m_part_info->no_parts); set_linear_hash_mask(m_part_info, m_part_info->num_parts);
else else
set_linear_hash_mask(m_part_info, m_part_info->no_subparts); set_linear_hash_mask(m_part_info, m_part_info->num_subparts);
} }
while (reorg_part < m_reorged_parts) while (reorg_part < m_reorged_parts)
...@@ -1902,7 +1902,7 @@ partition_element *ha_partition::find_partition_element(uint part_id) ...@@ -1902,7 +1902,7 @@ partition_element *ha_partition::find_partition_element(uint part_id)
uint curr_part_id= 0; uint curr_part_id= 0;
List_iterator_fast <partition_element> part_it(m_part_info->partitions); List_iterator_fast <partition_element> part_it(m_part_info->partitions);
for (i= 0; i < m_part_info->no_parts; i++) for (i= 0; i < m_part_info->num_parts; i++)
{ {
partition_element *part_elem; partition_element *part_elem;
part_elem= part_it++; part_elem= part_it++;
...@@ -1910,7 +1910,7 @@ partition_element *ha_partition::find_partition_element(uint part_id) ...@@ -1910,7 +1910,7 @@ partition_element *ha_partition::find_partition_element(uint part_id)
{ {
uint j; uint j;
List_iterator_fast <partition_element> sub_it(part_elem->subpartitions); List_iterator_fast <partition_element> sub_it(part_elem->subpartitions);
for (j= 0; j < m_part_info->no_subparts; j++) for (j= 0; j < m_part_info->num_subparts; j++)
{ {
part_elem= sub_it++; part_elem= sub_it++;
if (part_id == curr_part_id++) if (part_id == curr_part_id++)
...@@ -2031,7 +2031,7 @@ bool ha_partition::create_handler_file(const char *name) ...@@ -2031,7 +2031,7 @@ bool ha_partition::create_handler_file(const char *name)
{ {
partition_element *part_elem, *subpart_elem; partition_element *part_elem, *subpart_elem;
uint i, j, part_name_len, subpart_name_len; uint i, j, part_name_len, subpart_name_len;
uint tot_partition_words, tot_name_len, no_parts; uint tot_partition_words, tot_name_len, num_parts;
uint tot_parts= 0; uint tot_parts= 0;
uint tot_len_words, tot_len_byte, chksum, tot_name_words; uint tot_len_words, tot_len_byte, chksum, tot_name_words;
char *name_buffer_ptr; char *name_buffer_ptr;
...@@ -2044,11 +2044,11 @@ bool ha_partition::create_handler_file(const char *name) ...@@ -2044,11 +2044,11 @@ bool ha_partition::create_handler_file(const char *name)
List_iterator_fast <partition_element> part_it(m_part_info->partitions); List_iterator_fast <partition_element> part_it(m_part_info->partitions);
DBUG_ENTER("create_handler_file"); DBUG_ENTER("create_handler_file");
no_parts= m_part_info->partitions.elements; num_parts= m_part_info->partitions.elements;
DBUG_PRINT("info", ("table name = %s, no_parts = %u", name, DBUG_PRINT("info", ("table name = %s, num_parts = %u", name,
no_parts)); num_parts));
tot_name_len= 0; tot_name_len= 0;
for (i= 0; i < no_parts; i++) for (i= 0; i < num_parts; i++)
{ {
part_elem= part_it++; part_elem= part_it++;
if (part_elem->part_state != PART_NORMAL && if (part_elem->part_state != PART_NORMAL &&
...@@ -2066,7 +2066,7 @@ bool ha_partition::create_handler_file(const char *name) ...@@ -2066,7 +2066,7 @@ bool ha_partition::create_handler_file(const char *name)
else else
{ {
List_iterator_fast <partition_element> sub_it(part_elem->subpartitions); List_iterator_fast <partition_element> sub_it(part_elem->subpartitions);
for (j= 0; j < m_part_info->no_subparts; j++) for (j= 0; j < m_part_info->num_subparts; j++)
{ {
subpart_elem= sub_it++; subpart_elem= sub_it++;
tablename_to_filename(subpart_elem->partition_name, tablename_to_filename(subpart_elem->partition_name,
...@@ -2100,7 +2100,7 @@ bool ha_partition::create_handler_file(const char *name) ...@@ -2100,7 +2100,7 @@ bool ha_partition::create_handler_file(const char *name)
engine_array= (file_buffer + 12); engine_array= (file_buffer + 12);
name_buffer_ptr= (char*) (file_buffer + ((4 + tot_partition_words) * 4)); name_buffer_ptr= (char*) (file_buffer + ((4 + tot_partition_words) * 4));
part_it.rewind(); part_it.rewind();
for (i= 0; i < no_parts; i++) for (i= 0; i < num_parts; i++)
{ {
part_elem= part_it++; part_elem= part_it++;
if (part_elem->part_state != PART_NORMAL && if (part_elem->part_state != PART_NORMAL &&
...@@ -2118,7 +2118,7 @@ bool ha_partition::create_handler_file(const char *name) ...@@ -2118,7 +2118,7 @@ bool ha_partition::create_handler_file(const char *name)
else else
{ {
List_iterator_fast <partition_element> sub_it(part_elem->subpartitions); List_iterator_fast <partition_element> sub_it(part_elem->subpartitions);
for (j= 0; j < m_part_info->no_subparts; j++) for (j= 0; j < m_part_info->num_subparts; j++)
{ {
subpart_elem= sub_it++; subpart_elem= sub_it++;
tablename_to_filename(part_elem->partition_name, part_name, tablename_to_filename(part_elem->partition_name, part_name,
...@@ -2254,7 +2254,7 @@ bool ha_partition::new_handlers_from_part_info(MEM_ROOT *mem_root) ...@@ -2254,7 +2254,7 @@ bool ha_partition::new_handlers_from_part_info(MEM_ROOT *mem_root)
} }
m_file_tot_parts= m_tot_parts; m_file_tot_parts= m_tot_parts;
bzero((char*) m_file, alloc_len); bzero((char*) m_file, alloc_len);
DBUG_ASSERT(m_part_info->no_parts > 0); DBUG_ASSERT(m_part_info->num_parts > 0);
i= 0; i= 0;
part_count= 0; part_count= 0;
...@@ -2267,7 +2267,7 @@ bool ha_partition::new_handlers_from_part_info(MEM_ROOT *mem_root) ...@@ -2267,7 +2267,7 @@ bool ha_partition::new_handlers_from_part_info(MEM_ROOT *mem_root)
part_elem= part_it++; part_elem= part_it++;
if (m_is_sub_partitioned) if (m_is_sub_partitioned)
{ {
for (j= 0; j < m_part_info->no_subparts; j++) for (j= 0; j < m_part_info->num_subparts; j++)
{ {
if (!(m_file[part_count++]= get_new_handler(table_share, mem_root, if (!(m_file[part_count++]= get_new_handler(table_share, mem_root,
part_elem->engine_type))) part_elem->engine_type)))
...@@ -2284,7 +2284,7 @@ bool ha_partition::new_handlers_from_part_info(MEM_ROOT *mem_root) ...@@ -2284,7 +2284,7 @@ bool ha_partition::new_handlers_from_part_info(MEM_ROOT *mem_root)
DBUG_PRINT("info", ("engine_type: %u", DBUG_PRINT("info", ("engine_type: %u",
(uint) ha_legacy_type(part_elem->engine_type))); (uint) ha_legacy_type(part_elem->engine_type)));
} }
} while (++i < m_part_info->no_parts); } while (++i < m_part_info->num_parts);
if (part_elem->engine_type == myisam_hton) if (part_elem->engine_type == myisam_hton)
{ {
DBUG_PRINT("info", ("MyISAM")); DBUG_PRINT("info", ("MyISAM"));
...@@ -2480,7 +2480,7 @@ int ha_partition::open(const char *name, int mode, uint test_if_locked) ...@@ -2480,7 +2480,7 @@ int ha_partition::open(const char *name, int mode, uint test_if_locked)
if ((error= (*file)->ha_open(table, (const char*) name_buff, mode, if ((error= (*file)->ha_open(table, (const char*) name_buff, mode,
test_if_locked))) test_if_locked)))
goto err_handler; goto err_handler;
m_no_locks+= (*file)->lock_count(); m_num_locks+= (*file)->lock_count();
name_buffer_ptr+= strlen(name_buffer_ptr) + 1; name_buffer_ptr+= strlen(name_buffer_ptr) + 1;
set_if_bigger(ref_length, ((*file)->ref_length)); set_if_bigger(ref_length, ((*file)->ref_length));
/* /*
...@@ -2820,8 +2820,8 @@ int ha_partition::start_stmt(THD *thd, thr_lock_type lock_type) ...@@ -2820,8 +2820,8 @@ int ha_partition::start_stmt(THD *thd, thr_lock_type lock_type)
uint ha_partition::lock_count() const uint ha_partition::lock_count() const
{ {
DBUG_ENTER("ha_partition::lock_count"); DBUG_ENTER("ha_partition::lock_count");
DBUG_PRINT("info", ("m_no_locks %d", m_no_locks)); DBUG_PRINT("info", ("m_num_locks %d", m_num_locks));
DBUG_RETURN(m_no_locks); DBUG_RETURN(m_num_locks);
} }
......
...@@ -112,7 +112,7 @@ private: ...@@ -112,7 +112,7 @@ private:
uint m_reorged_parts; // Number of reorganised parts uint m_reorged_parts; // Number of reorganised parts
uint m_tot_parts; // Total number of partitions; 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 uint m_last_part; // Last file that we update,write,read
int m_lock_type; // Remembers type of last int m_lock_type; // Remembers type of last
// external_lock // external_lock
...@@ -239,10 +239,10 @@ public: ...@@ -239,10 +239,10 @@ public:
size_t pack_frm_len); size_t pack_frm_len);
virtual int drop_partitions(const char *path); virtual int drop_partitions(const char *path);
virtual int rename_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"); DBUG_ENTER("ha_partition::get_no_parts");
*no_parts= m_tot_parts; *num_parts= m_tot_parts;
DBUG_RETURN(0); DBUG_RETURN(0);
} }
virtual void change_table_ptr(TABLE *table_arg, TABLE_SHARE *share); virtual void change_table_ptr(TABLE *table_arg, TABLE_SHARE *share);
......
...@@ -2638,7 +2638,7 @@ typedef struct st_part_prune_param ...@@ -2638,7 +2638,7 @@ typedef struct st_part_prune_param
/* Iterator to be used to obtain the "current" set of used partitions */ /* Iterator to be used to obtain the "current" set of used partitions */
PARTITION_ITERATOR part_iter; PARTITION_ITERATOR part_iter;
/* Initialized bitmap of no_subparts size */ /* Initialized bitmap of num_subparts size */
MY_BITMAP subparts_bitmap; MY_BITMAP subparts_bitmap;
uchar *cur_min_key; uchar *cur_min_key;
...@@ -2904,8 +2904,8 @@ static void mark_full_partition_used_no_parts(partition_info* part_info, ...@@ -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, static void mark_full_partition_used_with_parts(partition_info *part_info,
uint32 part_id) uint32 part_id)
{ {
uint32 start= part_id * part_info->no_subparts; uint32 start= part_id * part_info->num_subparts;
uint32 end= start + part_info->no_subparts; uint32 end= start + part_info->num_subparts;
DBUG_ENTER("mark_full_partition_used_with_parts"); DBUG_ENTER("mark_full_partition_used_with_parts");
for (; start != end; start++) for (; start != end; start++)
...@@ -3328,10 +3328,10 @@ int find_used_partitions(PART_PRUNE_PARAM *ppar, SEL_ARG *key_tree) ...@@ -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)) != while ((part_id= ppar->part_iter.get_next(&ppar->part_iter)) !=
NOT_A_PARTITION_ID) 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)) if (bitmap_is_set(&ppar->subparts_bitmap, i))
bitmap_set_bit(&ppar->part_info->used_partitions, 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; goto pop_and_go_right;
} }
...@@ -3393,7 +3393,7 @@ int find_used_partitions(PART_PRUNE_PARAM *ppar, SEL_ARG *key_tree) ...@@ -3393,7 +3393,7 @@ int find_used_partitions(PART_PRUNE_PARAM *ppar, SEL_ARG *key_tree)
NOT_A_PARTITION_ID) NOT_A_PARTITION_ID)
{ {
bitmap_set_bit(&part_info->used_partitions, 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 */ res= 1; /* Some partitions were marked as used */
goto pop_and_go_right; goto pop_and_go_right;
...@@ -3541,10 +3541,10 @@ static bool create_partition_index_description(PART_PRUNE_PARAM *ppar) ...@@ -3541,10 +3541,10 @@ static bool create_partition_index_description(PART_PRUNE_PARAM *ppar)
uint used_part_fields, used_subpart_fields; uint used_part_fields, used_subpart_fields;
used_part_fields= fields_ok_for_partition_index(part_info->part_field_array) ? 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= used_subpart_fields=
fields_ok_for_partition_index(part_info->subpart_field_array)? 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; uint total_parts= used_part_fields + used_subpart_fields;
...@@ -3583,10 +3583,10 @@ static bool create_partition_index_description(PART_PRUNE_PARAM *ppar) ...@@ -3583,10 +3583,10 @@ static bool create_partition_index_description(PART_PRUNE_PARAM *ppar)
if (ppar->subpart_fields) if (ppar->subpart_fields)
{ {
my_bitmap_map *buf; 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))) if (!(buf= (my_bitmap_map*) alloc_root(alloc, bufsize)))
return TRUE; 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); FALSE);
} }
range_par->key_parts= key_part; range_par->key_parts= key_part;
......
...@@ -75,7 +75,7 @@ partition_info *partition_info::get_clone() ...@@ -75,7 +75,7 @@ partition_info *partition_info::get_clone()
SYNOPSIS SYNOPSIS
create_default_partition_names() create_default_partition_names()
part_no Partition number for subparts part_no Partition number for subparts
no_parts Number of partitions num_parts Number of partitions
start_no Starting partition number start_no Starting partition number
subpart Is it subpartitions subpart Is it subpartitions
...@@ -91,10 +91,10 @@ partition_info *partition_info::get_clone() ...@@ -91,10 +91,10 @@ partition_info *partition_info::get_clone()
#define MAX_PART_NAME_SIZE 8 #define MAX_PART_NAME_SIZE 8
char *partition_info::create_default_partition_names(uint part_no, char *partition_info::create_default_partition_names(uint part_no,
uint no_parts_arg, uint num_parts_arg,
uint start_no) uint start_no)
{ {
char *ptr= (char*) sql_calloc(no_parts_arg*MAX_PART_NAME_SIZE); char *ptr= (char*) sql_calloc(num_parts_arg*MAX_PART_NAME_SIZE);
char *move_ptr= ptr; char *move_ptr= ptr;
uint i= 0; uint i= 0;
DBUG_ENTER("create_default_partition_names"); DBUG_ENTER("create_default_partition_names");
...@@ -105,11 +105,11 @@ char *partition_info::create_default_partition_names(uint part_no, ...@@ -105,11 +105,11 @@ char *partition_info::create_default_partition_names(uint part_no,
{ {
my_sprintf(move_ptr, (move_ptr,"p%u", (start_no + i))); 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_arg); } while (++i < num_parts_arg);
} }
else else
{ {
mem_alloc_error(no_parts_arg*MAX_PART_NAME_SIZE); mem_alloc_error(num_parts_arg*MAX_PART_NAME_SIZE);
} }
DBUG_RETURN(ptr); DBUG_RETURN(ptr);
} }
...@@ -189,19 +189,19 @@ bool partition_info::set_up_default_partitions(handler *file, ...@@ -189,19 +189,19 @@ bool partition_info::set_up_default_partitions(handler *file,
goto end; goto end;
} }
if ((no_parts == 0) && if ((num_parts == 0) &&
((no_parts= file->get_default_no_partitions(info)) == 0)) ((num_parts= file->get_default_no_partitions(info)) == 0))
{ {
my_error(ER_PARTITION_NOT_DEFINED_ERROR, MYF(0), "partitions"); my_error(ER_PARTITION_NOT_DEFINED_ERROR, MYF(0), "partitions");
goto end; goto end;
} }
if (unlikely(no_parts > MAX_PARTITIONS)) if (unlikely(num_parts > MAX_PARTITIONS))
{ {
my_error(ER_TOO_MANY_PARTITIONS_ERROR, MYF(0)); my_error(ER_TOO_MANY_PARTITIONS_ERROR, MYF(0));
goto end; goto end;
} }
if (unlikely((!(default_name= create_default_partition_names(0, no_parts, if (unlikely((!(default_name= create_default_partition_names(0, num_parts,
start_no))))) start_no)))))
goto end; goto end;
i= 0; i= 0;
...@@ -220,7 +220,7 @@ bool partition_info::set_up_default_partitions(handler *file, ...@@ -220,7 +220,7 @@ bool partition_info::set_up_default_partitions(handler *file,
mem_alloc_error(sizeof(partition_element)); mem_alloc_error(sizeof(partition_element));
goto end; goto end;
} }
} while (++i < no_parts); } while (++i < num_parts);
result= FALSE; result= FALSE;
end: end:
DBUG_RETURN(result); DBUG_RETURN(result);
...@@ -259,9 +259,9 @@ bool partition_info::set_up_default_subpartitions(handler *file, ...@@ -259,9 +259,9 @@ bool partition_info::set_up_default_subpartitions(handler *file,
List_iterator<partition_element> part_it(partitions); List_iterator<partition_element> part_it(partitions);
DBUG_ENTER("partition_info::set_up_default_subpartitions"); DBUG_ENTER("partition_info::set_up_default_subpartitions");
if (no_subparts == 0) if (num_subparts == 0)
no_subparts= file->get_default_no_partitions(info); num_subparts= file->get_default_no_partitions(info);
if (unlikely((no_parts * no_subparts) > MAX_PARTITIONS)) if (unlikely((num_parts * num_subparts) > MAX_PARTITIONS))
{ {
my_error(ER_TOO_MANY_PARTITIONS_ERROR, MYF(0)); my_error(ER_TOO_MANY_PARTITIONS_ERROR, MYF(0));
goto end; goto end;
...@@ -288,8 +288,8 @@ bool partition_info::set_up_default_subpartitions(handler *file, ...@@ -288,8 +288,8 @@ bool partition_info::set_up_default_subpartitions(handler *file,
mem_alloc_error(sizeof(partition_element)); mem_alloc_error(sizeof(partition_element));
goto end; goto end;
} }
} while (++j < no_subparts); } while (++j < num_subparts);
} while (++i < no_parts); } while (++i < num_parts);
result= FALSE; result= FALSE;
end: end:
DBUG_RETURN(result); DBUG_RETURN(result);
...@@ -520,12 +520,12 @@ bool partition_info::check_engine_mix(handlerton *engine_type, ...@@ -520,12 +520,12 @@ bool partition_info::check_engine_mix(handlerton *engine_type,
{ {
handlerton *old_engine_type= engine_type; handlerton *old_engine_type= engine_type;
bool first= TRUE; bool first= TRUE;
uint no_parts= partitions.elements; uint num_parts= partitions.elements;
DBUG_ENTER("partition_info::check_engine_mix"); DBUG_ENTER("partition_info::check_engine_mix");
DBUG_PRINT("info", ("in: engine_type = %s, table_engine_set = %u", DBUG_PRINT("info", ("in: engine_type = %s, table_engine_set = %u",
ha_resolve_storage_engine_name(engine_type), ha_resolve_storage_engine_name(engine_type),
table_engine_set)); table_engine_set));
if (no_parts) if (num_parts)
{ {
List_iterator<partition_element> part_it(partitions); List_iterator<partition_element> part_it(partitions);
uint i= 0; uint i= 0;
...@@ -538,7 +538,7 @@ bool partition_info::check_engine_mix(handlerton *engine_type, ...@@ -538,7 +538,7 @@ bool partition_info::check_engine_mix(handlerton *engine_type,
if (is_sub_partitioned() && if (is_sub_partitioned() &&
part_elem->subpartitions.elements) part_elem->subpartitions.elements)
{ {
uint no_subparts= part_elem->subpartitions.elements; uint num_subparts= part_elem->subpartitions.elements;
uint j= 0; uint j= 0;
List_iterator<partition_element> sub_it(part_elem->subpartitions); List_iterator<partition_element> sub_it(part_elem->subpartitions);
do do
...@@ -550,7 +550,7 @@ bool partition_info::check_engine_mix(handlerton *engine_type, ...@@ -550,7 +550,7 @@ bool partition_info::check_engine_mix(handlerton *engine_type,
if (check_engine_condition(sub_elem, table_engine_set, if (check_engine_condition(sub_elem, table_engine_set,
&engine_type, &first)) &engine_type, &first))
goto error; goto error;
} while (++j < no_subparts); } while (++j < num_subparts);
/* ensure that the partition also has correct engine */ /* ensure that the partition also has correct engine */
if (check_engine_condition(part_elem, table_engine_set, if (check_engine_condition(part_elem, table_engine_set,
&engine_type, &first)) &engine_type, &first))
...@@ -559,7 +559,7 @@ bool partition_info::check_engine_mix(handlerton *engine_type, ...@@ -559,7 +559,7 @@ bool partition_info::check_engine_mix(handlerton *engine_type,
else if (check_engine_condition(part_elem, table_engine_set, else if (check_engine_condition(part_elem, table_engine_set,
&engine_type, &first)) &engine_type, &first))
goto error; goto error;
} while (++i < no_parts); } while (++i < num_parts);
} }
DBUG_PRINT("info", ("engine_type = %s", DBUG_PRINT("info", ("engine_type = %s",
ha_resolve_storage_engine_name(engine_type))); ha_resolve_storage_engine_name(engine_type)));
...@@ -612,21 +612,21 @@ bool partition_info::check_range_constants(THD *thd) ...@@ -612,21 +612,21 @@ bool partition_info::check_range_constants(THD *thd)
List_iterator<partition_element> it(partitions); List_iterator<partition_element> it(partitions);
int result= TRUE; int result= TRUE;
DBUG_ENTER("partition_info::check_range_constants"); DBUG_ENTER("partition_info::check_range_constants");
DBUG_PRINT("enter", ("RANGE with %d parts, column_list = %u", no_parts, DBUG_PRINT("enter", ("RANGE with %d parts, column_list = %u", num_parts,
column_list)); column_list));
if (column_list) if (column_list)
{ {
part_column_list_val* loc_range_col_array; part_column_list_val* loc_range_col_array;
part_column_list_val *current_largest_col_val; part_column_list_val *current_largest_col_val;
uint no_column_values= part_field_list.elements; uint num_column_values= part_field_list.elements;
uint size_entries= sizeof(part_column_list_val) * no_column_values; uint size_entries= sizeof(part_column_list_val) * num_column_values;
range_col_array= (part_column_list_val*)sql_calloc(no_parts * range_col_array= (part_column_list_val*)sql_calloc(num_parts *
size_entries); size_entries);
LINT_INIT(current_largest_col_val); LINT_INIT(current_largest_col_val);
if (unlikely(range_col_array == NULL)) if (unlikely(range_col_array == NULL))
{ {
mem_alloc_error(no_parts * sizeof(longlong)); mem_alloc_error(num_parts * sizeof(longlong));
goto end; goto end;
} }
loc_range_col_array= range_col_array; loc_range_col_array= range_col_array;
...@@ -642,7 +642,7 @@ bool partition_info::check_range_constants(THD *thd) ...@@ -642,7 +642,7 @@ bool partition_info::check_range_constants(THD *thd)
if (fix_column_value_functions(thd, col_val, i)) if (fix_column_value_functions(thd, col_val, i))
goto end; goto end;
memcpy(loc_range_col_array, (const void*)col_val, size_entries); memcpy(loc_range_col_array, (const void*)col_val, size_entries);
loc_range_col_array+= no_column_values; loc_range_col_array+= num_column_values;
if (!first) if (!first)
{ {
if (compare_column_values((const void*)current_largest_col_val, if (compare_column_values((const void*)current_largest_col_val,
...@@ -652,7 +652,7 @@ bool partition_info::check_range_constants(THD *thd) ...@@ -652,7 +652,7 @@ bool partition_info::check_range_constants(THD *thd)
current_largest_col_val= col_val; current_largest_col_val= col_val;
} }
first= FALSE; first= FALSE;
} while (++i < no_parts); } while (++i < num_parts);
} }
else else
{ {
...@@ -663,17 +663,17 @@ bool partition_info::check_range_constants(THD *thd) ...@@ -663,17 +663,17 @@ bool partition_info::check_range_constants(THD *thd)
LINT_INIT(current_largest); LINT_INIT(current_largest);
part_result_type= INT_RESULT; part_result_type= INT_RESULT;
range_int_array= (longlong*)sql_alloc(no_parts * sizeof(longlong)); range_int_array= (longlong*)sql_alloc(num_parts * sizeof(longlong));
if (unlikely(range_int_array == NULL)) if (unlikely(range_int_array == NULL))
{ {
mem_alloc_error(no_parts * sizeof(longlong)); mem_alloc_error(num_parts * sizeof(longlong));
goto end; goto end;
} }
i= 0; i= 0;
do do
{ {
part_def= it++; part_def= it++;
if ((i != (no_parts - 1)) || !defined_max_value) if ((i != (num_parts - 1)) || !defined_max_value)
{ {
part_range_value= part_def->range_value; part_range_value= part_def->range_value;
if (!signed_flag) if (!signed_flag)
...@@ -687,14 +687,14 @@ bool partition_info::check_range_constants(THD *thd) ...@@ -687,14 +687,14 @@ bool partition_info::check_range_constants(THD *thd)
if (unlikely(current_largest > part_range_value) || if (unlikely(current_largest > part_range_value) ||
(unlikely(current_largest == part_range_value) && (unlikely(current_largest == part_range_value) &&
(part_range_value < LONGLONG_MAX || (part_range_value < LONGLONG_MAX ||
i != (no_parts - 1) || i != (num_parts - 1) ||
!defined_max_value))) !defined_max_value)))
goto range_not_increasing_error; goto range_not_increasing_error;
} }
range_int_array[i]= part_range_value; range_int_array[i]= part_range_value;
current_largest= part_range_value; current_largest= part_range_value;
first= FALSE; first= FALSE;
} while (++i < no_parts); } while (++i < num_parts);
} }
result= FALSE; result= FALSE;
end: end:
...@@ -801,7 +801,7 @@ bool partition_info::fix_column_value_functions(THD *thd, ...@@ -801,7 +801,7 @@ bool partition_info::fix_column_value_functions(THD *thd,
part_column_list_val *col_val, part_column_list_val *col_val,
uint part_id) uint part_id)
{ {
uint no_columns= part_field_list.elements; uint num_columns= part_field_list.elements;
Name_resolution_context *context= &thd->lex->current_select->context; Name_resolution_context *context= &thd->lex->current_select->context;
TABLE_LIST *save_list= context->table_list; TABLE_LIST *save_list= context->table_list;
bool result= FALSE; bool result= FALSE;
...@@ -814,7 +814,7 @@ bool partition_info::fix_column_value_functions(THD *thd, ...@@ -814,7 +814,7 @@ bool partition_info::fix_column_value_functions(THD *thd,
} }
context->table_list= 0; context->table_list= 0;
thd->where= "partition function"; thd->where= "partition function";
for (i= 0; i < no_columns; col_val++, i++) for (i= 0; i < num_columns; col_val++, i++)
{ {
Item *column_item= col_val->item_expression; Item *column_item= col_val->item_expression;
Field *field= part_field_array[i]; Field *field= part_field_array[i];
...@@ -885,7 +885,7 @@ end: ...@@ -885,7 +885,7 @@ end:
bool partition_info::check_list_constants(THD *thd) bool partition_info::check_list_constants(THD *thd)
{ {
uint i, size_entries, no_column_values; uint i, size_entries, num_column_values;
uint list_index= 0; uint list_index= 0;
part_elem_value *list_value; part_elem_value *list_value;
bool result= TRUE; bool result= TRUE;
...@@ -899,7 +899,7 @@ bool partition_info::check_list_constants(THD *thd) ...@@ -899,7 +899,7 @@ bool partition_info::check_list_constants(THD *thd)
DBUG_ENTER("partition_info::check_list_constants"); DBUG_ENTER("partition_info::check_list_constants");
part_result_type= INT_RESULT; part_result_type= INT_RESULT;
no_list_values= 0; num_list_values= 0;
/* /*
We begin by calculating the number of list values that have been We begin by calculating the number of list values that have been
defined in the first step. defined in the first step.
...@@ -932,17 +932,17 @@ bool partition_info::check_list_constants(THD *thd) ...@@ -932,17 +932,17 @@ bool partition_info::check_list_constants(THD *thd)
} }
List_iterator<part_elem_value> list_val_it1(part_def->list_val_list); List_iterator<part_elem_value> list_val_it1(part_def->list_val_list);
while (list_val_it1++) while (list_val_it1++)
no_list_values++; num_list_values++;
} while (++i < no_parts); } while (++i < num_parts);
list_func_it.rewind(); list_func_it.rewind();
no_column_values= part_field_list.elements; num_column_values= part_field_list.elements;
size_entries= column_list ? size_entries= column_list ?
(no_column_values * sizeof(part_column_list_val)) : (num_column_values * sizeof(part_column_list_val)) :
sizeof(LIST_PART_ENTRY); sizeof(LIST_PART_ENTRY);
ptr= sql_calloc((no_list_values+1) * size_entries); ptr= sql_calloc((num_list_values+1) * size_entries);
if (unlikely(ptr == NULL)) if (unlikely(ptr == NULL))
{ {
mem_alloc_error(no_list_values * size_entries); mem_alloc_error(num_list_values * size_entries);
goto end; goto end;
} }
if (column_list) if (column_list)
...@@ -952,10 +952,6 @@ bool partition_info::check_list_constants(THD *thd) ...@@ -952,10 +952,6 @@ bool partition_info::check_list_constants(THD *thd)
list_col_array= (part_column_list_val*)ptr; list_col_array= (part_column_list_val*)ptr;
compare_func= compare_column_values; compare_func= compare_column_values;
i= 0; i= 0;
/*
Fix to be able to reuse signed sort functions also for unsigned
partition functions.
*/
do do
{ {
part_def= list_func_it++; part_def= list_func_it++;
...@@ -968,9 +964,9 @@ bool partition_info::check_list_constants(THD *thd) ...@@ -968,9 +964,9 @@ bool partition_info::check_list_constants(THD *thd)
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
memcpy(loc_list_col_array, (const void*)col_val, size_entries); memcpy(loc_list_col_array, (const void*)col_val, size_entries);
loc_list_col_array+= no_column_values; loc_list_col_array+= num_column_values;
} }
} while (++i < no_parts); } while (++i < num_parts);
} }
else else
{ {
...@@ -995,24 +991,24 @@ bool partition_info::check_list_constants(THD *thd) ...@@ -995,24 +991,24 @@ bool partition_info::check_list_constants(THD *thd)
list_array[list_index].list_value= calc_value; list_array[list_index].list_value= calc_value;
list_array[list_index++].partition_id= i; list_array[list_index++].partition_id= i;
} }
} while (++i < no_parts); } while (++i < num_parts);
} }
if (fixed && no_list_values) if (fixed && num_list_values)
{ {
bool first= TRUE; bool first= TRUE;
/* /*
list_array and list_col_array are unions, so this works for both list_array and list_col_array are unions, so this works for both
variants of LIST partitioning. variants of LIST partitioning.
*/ */
my_qsort((void*)list_array, no_list_values, sizeof(LIST_PART_ENTRY), my_qsort((void*)list_array, num_list_values, sizeof(LIST_PART_ENTRY),
&list_part_cmp); &list_part_cmp);
i= 0; i= 0;
LINT_INIT(prev_value); LINT_INIT(prev_value);
do do
{ {
DBUG_ASSERT(i < no_list_values); DBUG_ASSERT(i < num_list_values);
curr_value= column_list ? (void*)&list_col_array[no_column_values * i] : curr_value= column_list ? (void*)&list_col_array[num_column_values * i] :
(void*)&list_array[i]; (void*)&list_array[i];
if (likely(first || compare_func(curr_value, prev_value))) if (likely(first || compare_func(curr_value, prev_value)))
{ {
...@@ -1024,7 +1020,7 @@ bool partition_info::check_list_constants(THD *thd) ...@@ -1024,7 +1020,7 @@ bool partition_info::check_list_constants(THD *thd)
my_error(ER_MULTIPLE_DEF_CONST_IN_LIST_PART_ERROR, MYF(0)); my_error(ER_MULTIPLE_DEF_CONST_IN_LIST_PART_ERROR, MYF(0));
goto end; goto end;
} }
} while (++i < no_list_values); } while (++i < num_list_values);
} }
result= FALSE; result= FALSE;
end: end:
...@@ -1088,7 +1084,7 @@ bool partition_info::check_partition_info(THD *thd, handlerton **eng_type, ...@@ -1088,7 +1084,7 @@ bool partition_info::check_partition_info(THD *thd, handlerton **eng_type,
} }
} }
if (unlikely(!is_sub_partitioned() && if (unlikely(!is_sub_partitioned() &&
!(use_default_subpartitions && use_default_no_subpartitions))) !(use_default_subpartitions && use_default_num_subpartitions)))
{ {
my_error(ER_SUBPARTITION_ERROR, MYF(0)); my_error(ER_SUBPARTITION_ERROR, MYF(0));
goto end; goto end;
...@@ -1154,8 +1150,8 @@ bool partition_info::check_partition_info(THD *thd, handlerton **eng_type, ...@@ -1154,8 +1150,8 @@ bool partition_info::check_partition_info(THD *thd, handlerton **eng_type,
i= 0; i= 0;
{ {
List_iterator<partition_element> part_it(partitions); List_iterator<partition_element> part_it(partitions);
uint no_parts_not_set= 0; uint num_parts_not_set= 0;
uint prev_no_subparts_not_set= no_subparts + 1; uint prev_num_subparts_not_set= num_subparts + 1;
do do
{ {
partition_element *part_elem= part_it++; partition_element *part_elem= part_it++;
...@@ -1177,7 +1173,7 @@ bool partition_info::check_partition_info(THD *thd, handlerton **eng_type, ...@@ -1177,7 +1173,7 @@ bool partition_info::check_partition_info(THD *thd, handlerton **eng_type,
{ {
if (part_elem->engine_type == NULL) if (part_elem->engine_type == NULL)
{ {
no_parts_not_set++; num_parts_not_set++;
part_elem->engine_type= default_engine_type; part_elem->engine_type= default_engine_type;
} }
if (check_table_name(part_elem->partition_name, if (check_table_name(part_elem->partition_name,
...@@ -1192,7 +1188,7 @@ bool partition_info::check_partition_info(THD *thd, handlerton **eng_type, ...@@ -1192,7 +1188,7 @@ bool partition_info::check_partition_info(THD *thd, handlerton **eng_type,
else else
{ {
uint j= 0; uint j= 0;
uint no_subparts_not_set= 0; uint num_subparts_not_set= 0;
List_iterator<partition_element> sub_it(part_elem->subpartitions); List_iterator<partition_element> sub_it(part_elem->subpartitions);
partition_element *sub_elem; partition_element *sub_elem;
do do
...@@ -1211,44 +1207,45 @@ bool partition_info::check_partition_info(THD *thd, handlerton **eng_type, ...@@ -1211,44 +1207,45 @@ bool partition_info::check_partition_info(THD *thd, handlerton **eng_type,
else else
{ {
sub_elem->engine_type= default_engine_type; sub_elem->engine_type= default_engine_type;
no_subparts_not_set++; num_subparts_not_set++;
} }
} }
DBUG_PRINT("info", ("part = %d sub = %d engine = %s", i, j, DBUG_PRINT("info", ("part = %d sub = %d engine = %s", i, j,
ha_resolve_storage_engine_name(sub_elem->engine_type))); ha_resolve_storage_engine_name(sub_elem->engine_type)));
} while (++j < no_subparts); } while (++j < num_subparts);
if (prev_no_subparts_not_set == (no_subparts + 1) && if (prev_num_subparts_not_set == (num_subparts + 1) &&
(no_subparts_not_set == 0 || no_subparts_not_set == no_subparts)) (num_subparts_not_set == 0 ||
prev_no_subparts_not_set= no_subparts_not_set; num_subparts_not_set == num_subparts))
prev_num_subparts_not_set= num_subparts_not_set;
if (!table_engine_set && if (!table_engine_set &&
prev_no_subparts_not_set != no_subparts_not_set) prev_num_subparts_not_set != num_subparts_not_set)
{ {
DBUG_PRINT("info", ("no_subparts_not_set = %u no_subparts = %u", DBUG_PRINT("info", ("num_subparts_not_set = %u num_subparts = %u",
no_subparts_not_set, no_subparts)); num_subparts_not_set, num_subparts));
my_error(ER_MIX_HANDLER_ERROR, MYF(0)); my_error(ER_MIX_HANDLER_ERROR, MYF(0));
goto end; goto end;
} }
if (part_elem->engine_type == NULL) if (part_elem->engine_type == NULL)
{ {
if (no_subparts_not_set == 0) if (num_subparts_not_set == 0)
part_elem->engine_type= sub_elem->engine_type; part_elem->engine_type= sub_elem->engine_type;
else else
{ {
no_parts_not_set++; num_parts_not_set++;
part_elem->engine_type= default_engine_type; part_elem->engine_type= default_engine_type;
} }
} }
} }
} while (++i < no_parts); } while (++i < num_parts);
if (!table_engine_set && if (!table_engine_set &&
no_parts_not_set != 0 && num_parts_not_set != 0 &&
no_parts_not_set != no_parts) num_parts_not_set != num_parts)
{ {
DBUG_PRINT("info", ("no_parts_not_set = %u no_parts = %u", DBUG_PRINT("info", ("num_parts_not_set = %u num_parts = %u",
no_parts_not_set, no_subparts)); num_parts_not_set, num_subparts));
my_error(ER_MIX_HANDLER_ERROR, MYF(0)); my_error(ER_MIX_HANDLER_ERROR, MYF(0));
goto end; goto end;
} }
......
...@@ -176,17 +176,17 @@ public: ...@@ -176,17 +176,17 @@ public:
uint part_func_len; uint part_func_len;
uint subpart_func_len; uint subpart_func_len;
uint no_parts; uint num_parts;
uint no_subparts; uint num_subparts;
uint count_curr_subparts; uint count_curr_subparts;
uint part_error_code; uint part_error_code;
uint no_list_values; uint num_list_values;
uint no_part_fields; uint num_part_fields;
uint no_subpart_fields; uint num_subpart_fields;
uint no_full_part_fields; uint num_full_part_fields;
uint has_null_part_id; uint has_null_part_id;
/* /*
...@@ -197,9 +197,9 @@ public: ...@@ -197,9 +197,9 @@ public:
uint16 linear_hash_mask; uint16 linear_hash_mask;
bool use_default_partitions; bool use_default_partitions;
bool use_default_no_partitions; bool use_default_num_partitions;
bool use_default_subpartitions; bool use_default_subpartitions;
bool use_default_no_subpartitions; bool use_default_num_subpartitions;
bool default_partitions_setup; bool default_partitions_setup;
bool defined_max_value; bool defined_max_value;
bool list_of_part_fields; bool list_of_part_fields;
...@@ -233,12 +233,12 @@ public: ...@@ -233,12 +233,12 @@ public:
part_type(NOT_A_PARTITION), subpart_type(NOT_A_PARTITION), part_type(NOT_A_PARTITION), subpart_type(NOT_A_PARTITION),
part_info_len(0), part_state_len(0), part_info_len(0), part_state_len(0),
part_func_len(0), subpart_func_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), count_curr_subparts(0), part_error_code(0),
no_list_values(0), no_part_fields(0), no_subpart_fields(0), num_list_values(0), num_part_fields(0), num_subpart_fields(0),
no_full_part_fields(0), has_null_part_id(0), linear_hash_mask(0), num_full_part_fields(0), has_null_part_id(0), linear_hash_mask(0),
use_default_partitions(TRUE), use_default_no_partitions(TRUE), use_default_partitions(TRUE), use_default_num_partitions(TRUE),
use_default_subpartitions(TRUE), use_default_no_subpartitions(TRUE), use_default_subpartitions(TRUE), use_default_num_subpartitions(TRUE),
default_partitions_setup(FALSE), defined_max_value(FALSE), default_partitions_setup(FALSE), defined_max_value(FALSE),
list_of_part_fields(FALSE), list_of_subpart_fields(FALSE), list_of_part_fields(FALSE), list_of_subpart_fields(FALSE),
linear_hash_ind(FALSE), fixed(FALSE), linear_hash_ind(FALSE), fixed(FALSE),
...@@ -266,7 +266,7 @@ public: ...@@ -266,7 +266,7 @@ public:
/* Returns the total number of partitions on the leaf level */ /* Returns the total number of partitions on the leaf level */
uint get_tot_partitions() 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, bool set_up_defaults_for_partitioning(handler *file, HA_CREATE_INFO *info,
...@@ -289,7 +289,7 @@ private: ...@@ -289,7 +289,7 @@ private:
bool set_up_default_partitions(handler *file, HA_CREATE_INFO *info, bool set_up_default_partitions(handler *file, HA_CREATE_INFO *info,
uint start_no); uint start_no);
bool set_up_default_subpartitions(handler *file, HA_CREATE_INFO *info); 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); uint start_no);
char *create_subpartition_name(uint subpart_no, const char *part_name); char *create_subpartition_name(uint subpart_no, const char *part_name);
bool has_unique_name(partition_element *element); bool has_unique_name(partition_element *element);
...@@ -317,6 +317,6 @@ void init_all_partitions_iterator(partition_info *part_info, ...@@ -317,6 +317,6 @@ void init_all_partitions_iterator(partition_info *part_info,
PARTITION_ITERATOR *part_iter) PARTITION_ITERATOR *part_iter)
{ {
part_iter->part_nums.start= part_iter->part_nums.cur= 0; 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; 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) ...@@ -1498,7 +1498,7 @@ Alter_info::Alter_info(const Alter_info &rhs, MEM_ROOT *mem_root)
keys_onoff(rhs.keys_onoff), keys_onoff(rhs.keys_onoff),
tablespace_op(rhs.tablespace_op), tablespace_op(rhs.tablespace_op),
partition_names(rhs.partition_names, mem_root), partition_names(rhs.partition_names, mem_root),
no_parts(rhs.no_parts), num_parts(rhs.num_parts),
change_level(rhs.change_level), change_level(rhs.change_level),
datetime_field(rhs.datetime_field), datetime_field(rhs.datetime_field),
error_if_not_empty(rhs.error_if_not_empty) error_if_not_empty(rhs.error_if_not_empty)
......
...@@ -893,7 +893,7 @@ public: ...@@ -893,7 +893,7 @@ public:
enum enum_enable_or_disable keys_onoff; enum enum_enable_or_disable keys_onoff;
enum tablespace_op_type tablespace_op; enum tablespace_op_type tablespace_op;
List<char> partition_names; List<char> partition_names;
uint no_parts; uint num_parts;
enum_alter_table_change_level change_level; enum_alter_table_change_level change_level;
Create_field *datetime_field; Create_field *datetime_field;
bool error_if_not_empty; bool error_if_not_empty;
...@@ -903,7 +903,7 @@ public: ...@@ -903,7 +903,7 @@ public:
flags(0), flags(0),
keys_onoff(LEAVE_AS_IS), keys_onoff(LEAVE_AS_IS),
tablespace_op(NO_TABLESPACE_OP), tablespace_op(NO_TABLESPACE_OP),
no_parts(0), num_parts(0),
change_level(ALTER_TABLE_METADATA_ONLY), change_level(ALTER_TABLE_METADATA_ONLY),
datetime_field(NULL), datetime_field(NULL),
error_if_not_empty(FALSE) error_if_not_empty(FALSE)
...@@ -918,7 +918,7 @@ public: ...@@ -918,7 +918,7 @@ public:
flags= 0; flags= 0;
keys_onoff= LEAVE_AS_IS; keys_onoff= LEAVE_AS_IS;
tablespace_op= NO_TABLESPACE_OP; tablespace_op= NO_TABLESPACE_OP;
no_parts= 0; num_parts= 0;
partition_names.empty(); partition_names.empty();
change_level= ALTER_TABLE_METADATA_ONLY; change_level= ALTER_TABLE_METADATA_ONLY;
datetime_field= 0; datetime_field= 0;
......
...@@ -202,26 +202,26 @@ bool partition_default_handling(TABLE *table, partition_info *part_info, ...@@ -202,26 +202,26 @@ bool partition_default_handling(TABLE *table, partition_info *part_info,
{ {
DBUG_ENTER("partition_default_handling"); DBUG_ENTER("partition_default_handling");
if (part_info->use_default_no_partitions) if (part_info->use_default_num_partitions)
{ {
if (!is_create_table_ind && if (!is_create_table_ind &&
table->file->get_no_parts(normalized_path, &part_info->no_parts)) table->file->get_no_parts(normalized_path, &part_info->num_parts))
{ {
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
} }
else if (part_info->is_sub_partitioned() && else if (part_info->is_sub_partitioned() &&
part_info->use_default_no_subpartitions) part_info->use_default_num_subpartitions)
{ {
uint no_parts; uint num_parts;
if (!is_create_table_ind && if (!is_create_table_ind &&
(table->file->get_no_parts(normalized_path, &no_parts))) (table->file->get_no_parts(normalized_path, &num_parts)))
{ {
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
DBUG_ASSERT(part_info->no_parts > 0); DBUG_ASSERT(part_info->num_parts > 0);
part_info->no_subparts= no_parts / part_info->no_parts; part_info->num_subparts= num_parts / part_info->num_parts;
DBUG_ASSERT((no_parts % part_info->no_parts) == 0); DBUG_ASSERT((num_parts % part_info->num_parts) == 0);
} }
part_info->set_up_defaults_for_partitioning(table->file, part_info->set_up_defaults_for_partitioning(table->file,
(ulonglong)0, (uint)0); (ulonglong)0, (uint)0);
...@@ -254,8 +254,8 @@ bool check_reorganise_list(partition_info *new_part_info, ...@@ -254,8 +254,8 @@ bool check_reorganise_list(partition_info *new_part_info,
List<char> list_part_names) List<char> list_part_names)
{ {
uint new_count, old_count; uint new_count, old_count;
uint no_new_parts= new_part_info->partitions.elements; uint num_new_parts= new_part_info->partitions.elements;
uint no_old_parts= old_part_info->partitions.elements; uint num_old_parts= old_part_info->partitions.elements;
List_iterator<partition_element> new_parts_it(new_part_info->partitions); List_iterator<partition_element> new_parts_it(new_part_info->partitions);
bool same_part_info= (new_part_info == old_part_info); bool same_part_info= (new_part_info == old_part_info);
DBUG_ENTER("check_reorganise_list"); DBUG_ENTER("check_reorganise_list");
...@@ -278,8 +278,8 @@ bool check_reorganise_list(partition_info *new_part_info, ...@@ -278,8 +278,8 @@ bool check_reorganise_list(partition_info *new_part_info,
if (!is_name_in_list(old_name, list_part_names)) if (!is_name_in_list(old_name, list_part_names))
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
} while (old_count < no_old_parts); } while (old_count < num_old_parts);
} while (new_count < no_new_parts); } while (new_count < num_new_parts);
DBUG_RETURN(FALSE); DBUG_RETURN(FALSE);
} }
...@@ -454,7 +454,7 @@ static bool set_up_field_array(TABLE *table, ...@@ -454,7 +454,7 @@ static bool set_up_field_array(TABLE *table,
bool is_sub_part) bool is_sub_part)
{ {
Field **ptr, *field, **field_array; Field **ptr, *field, **field_array;
uint no_fields= 0; uint num_fields= 0;
uint size_field_array; uint size_field_array;
uint i= 0; uint i= 0;
uint inx; uint inx;
...@@ -466,9 +466,9 @@ static bool set_up_field_array(TABLE *table, ...@@ -466,9 +466,9 @@ static bool set_up_field_array(TABLE *table,
while ((field= *(ptr++))) while ((field= *(ptr++)))
{ {
if (field->flags & GET_FIXED_FIELDS_FLAG) if (field->flags & GET_FIXED_FIELDS_FLAG)
no_fields++; num_fields++;
} }
if (no_fields > MAX_REF_PARTS) if (num_fields > MAX_REF_PARTS)
{ {
char *ptr; char *ptr;
if (is_sub_part) if (is_sub_part)
...@@ -478,7 +478,7 @@ static bool set_up_field_array(TABLE *table, ...@@ -478,7 +478,7 @@ static bool set_up_field_array(TABLE *table,
my_error(ER_TOO_MANY_PARTITION_FUNC_FIELDS_ERROR, MYF(0), ptr); my_error(ER_TOO_MANY_PARTITION_FUNC_FIELDS_ERROR, MYF(0), ptr);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
if (no_fields == 0) if (num_fields == 0)
{ {
/* /*
We are using hidden key as partitioning field We are using hidden key as partitioning field
...@@ -486,7 +486,7 @@ static bool set_up_field_array(TABLE *table, ...@@ -486,7 +486,7 @@ static bool set_up_field_array(TABLE *table,
DBUG_ASSERT(!is_sub_part); DBUG_ASSERT(!is_sub_part);
DBUG_RETURN(result); DBUG_RETURN(result);
} }
size_field_array= (no_fields+1)*sizeof(Field*); size_field_array= (num_fields+1)*sizeof(Field*);
field_array= (Field**)sql_calloc(size_field_array); field_array= (Field**)sql_calloc(size_field_array);
if (unlikely(!field_array)) if (unlikely(!field_array))
{ {
...@@ -507,15 +507,15 @@ static bool set_up_field_array(TABLE *table, ...@@ -507,15 +507,15 @@ static bool set_up_field_array(TABLE *table,
List_iterator<char> it(part_info->part_field_list); List_iterator<char> it(part_info->part_field_list);
char *field_name; char *field_name;
DBUG_ASSERT(no_fields == part_info->part_field_list.elements); DBUG_ASSERT(num_fields == part_info->part_field_list.elements);
inx= 0; inx= 0;
do do
{ {
field_name= it++; field_name= it++;
if (!strcmp(field_name, field->field_name)) if (!strcmp(field_name, field->field_name))
break; break;
} while (++inx < no_fields); } while (++inx < num_fields);
if (inx == no_fields) if (inx == num_fields)
{ {
mem_alloc_error(1); mem_alloc_error(1);
result= TRUE; result= TRUE;
...@@ -543,16 +543,16 @@ static bool set_up_field_array(TABLE *table, ...@@ -543,16 +543,16 @@ static bool set_up_field_array(TABLE *table,
} }
} }
} }
field_array[no_fields]= 0; field_array[num_fields]= 0;
if (!is_sub_part) if (!is_sub_part)
{ {
part_info->part_field_array= field_array; part_info->part_field_array= field_array;
part_info->no_part_fields= no_fields; part_info->num_part_fields= num_fields;
} }
else else
{ {
part_info->subpart_field_array= field_array; part_info->subpart_field_array= field_array;
part_info->no_subpart_fields= no_fields; part_info->num_subpart_fields= num_fields;
} }
DBUG_RETURN(result); DBUG_RETURN(result);
} }
...@@ -591,19 +591,19 @@ static bool create_full_part_field_array(THD *thd, TABLE *table, ...@@ -591,19 +591,19 @@ static bool create_full_part_field_array(THD *thd, TABLE *table,
if (!part_info->is_sub_partitioned()) if (!part_info->is_sub_partitioned())
{ {
part_info->full_part_field_array= part_info->part_field_array; part_info->full_part_field_array= part_info->part_field_array;
part_info->no_full_part_fields= part_info->no_part_fields; part_info->num_full_part_fields= part_info->num_part_fields;
} }
else else
{ {
Field *field, **field_array; Field *field, **field_array;
uint no_part_fields=0, size_field_array; uint num_part_fields=0, size_field_array;
ptr= table->field; ptr= table->field;
while ((field= *(ptr++))) while ((field= *(ptr++)))
{ {
if (field->flags & FIELD_IN_PART_FUNC_FLAG) if (field->flags & FIELD_IN_PART_FUNC_FLAG)
no_part_fields++; num_part_fields++;
} }
size_field_array= (no_part_fields+1)*sizeof(Field*); size_field_array= (num_part_fields+1)*sizeof(Field*);
field_array= (Field**)sql_calloc(size_field_array); field_array= (Field**)sql_calloc(size_field_array);
if (unlikely(!field_array)) if (unlikely(!field_array))
{ {
...@@ -611,16 +611,16 @@ static bool create_full_part_field_array(THD *thd, TABLE *table, ...@@ -611,16 +611,16 @@ static bool create_full_part_field_array(THD *thd, TABLE *table,
result= TRUE; result= TRUE;
goto end; goto end;
} }
no_part_fields= 0; num_part_fields= 0;
ptr= table->field; ptr= table->field;
while ((field= *(ptr++))) while ((field= *(ptr++)))
{ {
if (field->flags & FIELD_IN_PART_FUNC_FLAG) if (field->flags & FIELD_IN_PART_FUNC_FLAG)
field_array[no_part_fields++]= field; field_array[num_part_fields++]= field;
} }
field_array[no_part_fields]=0; field_array[num_part_fields]=0;
part_info->full_part_field_array= field_array; part_info->full_part_field_array= field_array;
part_info->no_full_part_fields= no_part_fields; part_info->num_full_part_fields= num_part_fields;
} }
/* /*
...@@ -821,11 +821,11 @@ static bool handle_list_of_fields(List_iterator<char> it, ...@@ -821,11 +821,11 @@ static bool handle_list_of_fields(List_iterator<char> it,
uint primary_key= table->s->primary_key; uint primary_key= table->s->primary_key;
if (primary_key != MAX_KEY) if (primary_key != MAX_KEY)
{ {
uint no_key_parts= table->key_info[primary_key].key_parts, i; uint num_key_parts= table->key_info[primary_key].key_parts, i;
/* /*
In the case of an empty list we use primary key as partition key. In the case of an empty list we use primary key as partition key.
*/ */
for (i= 0; i < no_key_parts; i++) for (i= 0; i < num_key_parts; i++)
{ {
Field *field= table->key_info[primary_key].key_part[i].field; Field *field= table->key_info[primary_key].key_part[i].field;
field->flags|= GET_FIXED_FIELDS_FLAG; field->flags|= GET_FIXED_FIELDS_FLAG;
...@@ -889,7 +889,7 @@ int check_signed_flag(partition_info *part_info) ...@@ -889,7 +889,7 @@ int check_signed_flag(partition_info *part_info)
error= ER_PARTITION_CONST_DOMAIN_ERROR; error= ER_PARTITION_CONST_DOMAIN_ERROR;
break; break;
} }
} while (++i < part_info->no_parts); } while (++i < part_info->num_parts);
} }
return error; return error;
} }
...@@ -946,13 +946,6 @@ static bool fix_fields_part_func(THD *thd, Item* func_expr, TABLE *table, ...@@ -946,13 +946,6 @@ static bool fix_fields_part_func(THD *thd, Item* func_expr, TABLE *table,
bool save_use_only_table_context; bool save_use_only_table_context;
DBUG_ENTER("fix_fields_part_func"); DBUG_ENTER("fix_fields_part_func");
if (part_info->fixed)
{
if (!(is_sub_part || (error= check_signed_flag(part_info))))
result= FALSE;
goto end;
}
/* /*
Set-up the TABLE_LIST object to be a list with a single table Set-up the TABLE_LIST object to be a list with a single table
Set the object to zero to create NULL pointers and set alias Set the object to zero to create NULL pointers and set alias
...@@ -1217,9 +1210,9 @@ void check_range_capable_PF(TABLE *table) ...@@ -1217,9 +1210,9 @@ void check_range_capable_PF(TABLE *table)
static bool set_up_partition_bitmap(THD *thd, partition_info *part_info) static bool set_up_partition_bitmap(THD *thd, partition_info *part_info)
{ {
uint32 *bitmap_buf; uint32 *bitmap_buf;
uint bitmap_bits= part_info->no_subparts? uint bitmap_bits= part_info->num_subparts?
(part_info->no_subparts* part_info->no_parts): (part_info->num_subparts* part_info->num_parts):
part_info->no_parts; part_info->num_parts;
uint bitmap_bytes= bitmap_buffer_size(bitmap_bits); uint bitmap_bytes= bitmap_buffer_size(bitmap_bits);
DBUG_ENTER("set_up_partition_bitmap"); DBUG_ENTER("set_up_partition_bitmap");
...@@ -1437,22 +1430,22 @@ static void set_up_partition_func_pointers(partition_info *part_info) ...@@ -1437,22 +1430,22 @@ static void set_up_partition_func_pointers(partition_info *part_info)
/* /*
For linear hashing we need a mask which is on the form 2**n - 1 where For linear hashing we need a mask which is on the form 2**n - 1 where
2**n >= no_parts. Thus if no_parts is 6 then mask is 2**3 - 1 = 8 - 1 = 7. 2**n >= num_parts. Thus if num_parts is 6 then mask is 2**3 - 1 = 8 - 1 = 7.
SYNOPSIS SYNOPSIS
set_linear_hash_mask() set_linear_hash_mask()
part_info Reference to partitioning data structure part_info Reference to partitioning data structure
no_parts Number of parts in linear hash partitioning num_parts Number of parts in linear hash partitioning
RETURN VALUE RETURN VALUE
NONE NONE
*/ */
void set_linear_hash_mask(partition_info *part_info, uint no_parts) void set_linear_hash_mask(partition_info *part_info, uint num_parts)
{ {
uint mask; uint mask;
for (mask= 1; mask < no_parts; mask<<=1) for (mask= 1; mask < num_parts; mask<<=1)
; ;
part_info->linear_hash_mask= mask - 1; part_info->linear_hash_mask= mask - 1;
} }
...@@ -1466,7 +1459,7 @@ void set_linear_hash_mask(partition_info *part_info, uint no_parts) ...@@ -1466,7 +1459,7 @@ void set_linear_hash_mask(partition_info *part_info, uint no_parts)
get_part_id_from_linear_hash() get_part_id_from_linear_hash()
hash_value Hash value calculated by HASH function or KEY function hash_value Hash value calculated by HASH function or KEY function
mask Mask calculated previously by set_linear_hash_mask mask Mask calculated previously by set_linear_hash_mask
no_parts Number of partitions in HASH partitioned part num_parts Number of partitions in HASH partitioned part
RETURN VALUE RETURN VALUE
part_id The calculated partition identity (starting at 0) part_id The calculated partition identity (starting at 0)
...@@ -1479,11 +1472,11 @@ void set_linear_hash_mask(partition_info *part_info, uint no_parts) ...@@ -1479,11 +1472,11 @@ void set_linear_hash_mask(partition_info *part_info, uint no_parts)
*/ */
static uint32 get_part_id_from_linear_hash(longlong hash_value, uint mask, static uint32 get_part_id_from_linear_hash(longlong hash_value, uint mask,
uint no_parts) uint num_parts)
{ {
uint32 part_id= (uint32)(hash_value & mask); uint32 part_id= (uint32)(hash_value & mask);
if (part_id >= no_parts) if (part_id >= num_parts)
{ {
uint new_mask= ((mask + 1) >> 1) - 1; uint new_mask= ((mask + 1) >> 1) - 1;
part_id= (uint32)(hash_value & new_mask); part_id= (uint32)(hash_value & new_mask);
...@@ -1627,7 +1620,7 @@ bool fix_partition_func(THD *thd, TABLE *table, ...@@ -1627,7 +1620,7 @@ bool fix_partition_func(THD *thd, TABLE *table,
function is correct. function is correct.
*/ */
if (part_info->linear_hash_ind) if (part_info->linear_hash_ind)
set_linear_hash_mask(part_info, part_info->no_subparts); set_linear_hash_mask(part_info, part_info->num_subparts);
if (part_info->list_of_subpart_fields) if (part_info->list_of_subpart_fields)
{ {
List_iterator<char> it(part_info->subpart_field_list); List_iterator<char> it(part_info->subpart_field_list);
...@@ -1655,7 +1648,7 @@ bool fix_partition_func(THD *thd, TABLE *table, ...@@ -1655,7 +1648,7 @@ bool fix_partition_func(THD *thd, TABLE *table,
if (part_info->part_type == HASH_PARTITION) if (part_info->part_type == HASH_PARTITION)
{ {
if (part_info->linear_hash_ind) if (part_info->linear_hash_ind)
set_linear_hash_mask(part_info, part_info->no_parts); set_linear_hash_mask(part_info, part_info->num_parts);
if (part_info->list_of_part_fields) if (part_info->list_of_part_fields)
{ {
List_iterator<char> it(part_info->part_field_list); List_iterator<char> it(part_info->part_field_list);
...@@ -1708,7 +1701,7 @@ bool fix_partition_func(THD *thd, TABLE *table, ...@@ -1708,7 +1701,7 @@ bool fix_partition_func(THD *thd, TABLE *table,
my_error(ER_INCONSISTENT_PARTITION_INFO_ERROR, MYF(0)); my_error(ER_INCONSISTENT_PARTITION_INFO_ERROR, MYF(0));
goto end; goto end;
} }
if (unlikely(part_info->no_parts < 1)) if (unlikely(part_info->num_parts < 1))
{ {
my_error(ER_PARTITIONS_MUST_BE_DEFINED_ERROR, MYF(0), error_str); my_error(ER_PARTITIONS_MUST_BE_DEFINED_ERROR, MYF(0), error_str);
goto end; goto end;
...@@ -1852,14 +1845,14 @@ static int add_subpartition_by(File fptr) ...@@ -1852,14 +1845,14 @@ static int add_subpartition_by(File fptr)
static int add_part_field_list(File fptr, List<char> field_list) static int add_part_field_list(File fptr, List<char> field_list)
{ {
uint i, no_fields; uint i, num_fields;
int err= 0; int err= 0;
List_iterator<char> part_it(field_list); List_iterator<char> part_it(field_list);
no_fields= field_list.elements; num_fields= field_list.elements;
i= 0; i= 0;
err+= add_begin_parenthesis(fptr); err+= add_begin_parenthesis(fptr);
while (i < no_fields) while (i < num_fields)
{ {
const char *field_str= part_it++; const char *field_str= part_it++;
String field_string("", 0, system_charset_info); String field_string("", 0, system_charset_info);
...@@ -1870,7 +1863,7 @@ static int add_part_field_list(File fptr, List<char> field_list) ...@@ -1870,7 +1863,7 @@ static int add_part_field_list(File fptr, List<char> field_list)
strlen(field_str)); strlen(field_str));
thd->options= save_options; thd->options= save_options;
err+= add_string_object(fptr, &field_string); err+= add_string_object(fptr, &field_string);
if (i != (no_fields-1)) if (i != (num_fields-1))
err+= add_comma(fptr); err+= add_comma(fptr);
i++; i++;
} }
...@@ -1989,10 +1982,10 @@ static int add_column_list_values(File fptr, partition_info *part_info, ...@@ -1989,10 +1982,10 @@ static int add_column_list_values(File fptr, partition_info *part_info,
{ {
int err= 0; int err= 0;
uint i; uint i;
uint no_elements= part_info->part_field_list.elements; uint num_elements= part_info->part_field_list.elements;
err+= add_string(fptr, partition_keywords[PKW_COLUMNS].str); err+= add_string(fptr, partition_keywords[PKW_COLUMNS].str);
err+= add_begin_parenthesis(fptr); err+= add_begin_parenthesis(fptr);
for (i= 0; i < no_elements; i++) for (i= 0; i < num_elements; i++)
{ {
part_column_list_val *col_val= &list_value->col_val_array[i]; part_column_list_val *col_val= &list_value->col_val_array[i];
if (col_val->max_value) if (col_val->max_value)
...@@ -2029,7 +2022,7 @@ static int add_column_list_values(File fptr, partition_info *part_info, ...@@ -2029,7 +2022,7 @@ static int add_column_list_values(File fptr, partition_info *part_info,
err+= add_string(fptr,"'"); err+= add_string(fptr,"'");
} }
} }
if (i != (no_elements - 1)) if (i != (num_elements - 1))
err+= add_string(fptr, comma_str); err+= add_string(fptr, comma_str);
} }
err+= add_end_parenthesis(fptr); err+= add_end_parenthesis(fptr);
...@@ -2072,13 +2065,13 @@ static int add_partition_values(File fptr, partition_info *part_info, ...@@ -2072,13 +2065,13 @@ static int add_partition_values(File fptr, partition_info *part_info,
uint i; uint i;
List_iterator<part_elem_value> list_val_it(p_elem->list_val_list); List_iterator<part_elem_value> list_val_it(p_elem->list_val_list);
err+= add_string(fptr, " VALUES IN "); err+= add_string(fptr, " VALUES IN ");
uint no_items= p_elem->list_val_list.elements; uint num_items= p_elem->list_val_list.elements;
err+= add_begin_parenthesis(fptr); err+= add_begin_parenthesis(fptr);
if (p_elem->has_null_value) if (p_elem->has_null_value)
{ {
err+= add_string(fptr, "NULL"); err+= add_string(fptr, "NULL");
if (no_items == 0) if (num_items == 0)
{ {
err+= add_end_parenthesis(fptr); err+= add_end_parenthesis(fptr);
goto end; goto end;
...@@ -2099,9 +2092,9 @@ static int add_partition_values(File fptr, partition_info *part_info, ...@@ -2099,9 +2092,9 @@ static int add_partition_values(File fptr, partition_info *part_info,
else else
err+= add_uint(fptr, list_value->value); err+= add_uint(fptr, list_value->value);
} }
if (i != (no_items-1)) if (i != (num_items-1))
err+= add_comma(fptr); err+= add_comma(fptr);
} while (++i < no_items); } while (++i < num_items);
err+= add_end_parenthesis(fptr); err+= add_end_parenthesis(fptr);
} }
end: end:
...@@ -2150,7 +2143,7 @@ char *generate_partition_syntax(partition_info *part_info, ...@@ -2150,7 +2143,7 @@ char *generate_partition_syntax(partition_info *part_info,
bool use_sql_alloc, bool use_sql_alloc,
bool show_partition_options) bool show_partition_options)
{ {
uint i,j, tot_no_parts, no_subparts; uint i,j, tot_num_parts, num_subparts;
partition_element *part_elem; partition_element *part_elem;
ulonglong buffer_length; ulonglong buffer_length;
char path[FN_REFLEN]; char path[FN_REFLEN];
...@@ -2207,12 +2200,12 @@ char *generate_partition_syntax(partition_info *part_info, ...@@ -2207,12 +2200,12 @@ char *generate_partition_syntax(partition_info *part_info,
err+= add_string(fptr, partition_keywords[PKW_COLUMNS].str); err+= add_string(fptr, partition_keywords[PKW_COLUMNS].str);
err+= add_part_field_list(fptr, part_info->part_field_list); err+= add_part_field_list(fptr, part_info->part_field_list);
} }
if ((!part_info->use_default_no_partitions) && if ((!part_info->use_default_num_partitions) &&
part_info->use_default_partitions) part_info->use_default_partitions)
{ {
err+= add_string(fptr, "\n"); err+= add_string(fptr, "\n");
err+= add_string(fptr, "PARTITIONS "); err+= add_string(fptr, "PARTITIONS ");
err+= add_int(fptr, part_info->no_parts); err+= add_int(fptr, part_info->num_parts);
} }
if (part_info->is_sub_partitioned()) if (part_info->is_sub_partitioned())
{ {
...@@ -2235,16 +2228,16 @@ char *generate_partition_syntax(partition_info *part_info, ...@@ -2235,16 +2228,16 @@ char *generate_partition_syntax(partition_info *part_info,
part_info->subpart_func_len); part_info->subpart_func_len);
err+= add_end_parenthesis(fptr); err+= add_end_parenthesis(fptr);
} }
if ((!part_info->use_default_no_subpartitions) && if ((!part_info->use_default_num_subpartitions) &&
part_info->use_default_subpartitions) part_info->use_default_subpartitions)
{ {
err+= add_string(fptr, "\n"); err+= add_string(fptr, "\n");
err+= add_string(fptr, "SUBPARTITIONS "); err+= add_string(fptr, "SUBPARTITIONS ");
err+= add_int(fptr, part_info->no_subparts); err+= add_int(fptr, part_info->num_subparts);
} }
} }
tot_no_parts= part_info->partitions.elements; tot_num_parts= part_info->partitions.elements;
no_subparts= part_info->no_subparts; num_subparts= part_info->num_subparts;
if (!part_info->use_default_partitions) if (!part_info->use_default_partitions)
{ {
...@@ -2288,7 +2281,7 @@ char *generate_partition_syntax(partition_info *part_info, ...@@ -2288,7 +2281,7 @@ 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);
if (show_partition_options) if (show_partition_options)
err+= add_partition_options(fptr, part_elem); err+= add_partition_options(fptr, part_elem);
if (j != (no_subparts-1)) if (j != (num_subparts-1))
{ {
err+= add_comma(fptr); err+= add_comma(fptr);
err+= add_string(fptr, "\n"); err+= add_string(fptr, "\n");
...@@ -2297,12 +2290,12 @@ char *generate_partition_syntax(partition_info *part_info, ...@@ -2297,12 +2290,12 @@ char *generate_partition_syntax(partition_info *part_info,
} }
else else
err+= add_end_parenthesis(fptr); err+= add_end_parenthesis(fptr);
} while (++j < no_subparts); } while (++j < num_subparts);
} }
} }
if (i == (tot_no_parts-1)) if (i == (tot_num_parts-1))
err+= add_end_parenthesis(fptr); err+= add_end_parenthesis(fptr);
} while (++i < tot_no_parts); } while (++i < tot_num_parts);
} }
if (err) if (err)
goto close_file; goto close_file;
...@@ -2449,14 +2442,14 @@ static uint32 calculate_key_value(Field **field_array) ...@@ -2449,14 +2442,14 @@ static uint32 calculate_key_value(Field **field_array)
get_part_id_for_sub() get_part_id_for_sub()
loc_part_id Local partition id loc_part_id Local partition id
sub_part_id Subpartition id sub_part_id Subpartition id
no_subparts Number of subparts num_subparts Number of subparts
*/ */
inline inline
static uint32 get_part_id_for_sub(uint32 loc_part_id, uint32 sub_part_id, static uint32 get_part_id_for_sub(uint32 loc_part_id, uint32 sub_part_id,
uint no_subparts) uint num_subparts)
{ {
return (uint32)((loc_part_id * no_subparts) + sub_part_id); return (uint32)((loc_part_id * num_subparts) + sub_part_id);
} }
...@@ -2465,7 +2458,7 @@ static uint32 get_part_id_for_sub(uint32 loc_part_id, uint32 sub_part_id, ...@@ -2465,7 +2458,7 @@ static uint32 get_part_id_for_sub(uint32 loc_part_id, uint32 sub_part_id,
SYNOPSIS SYNOPSIS
get_part_id_hash() get_part_id_hash()
no_parts Number of hash partitions num_parts Number of hash partitions
part_expr Item tree of hash function part_expr Item tree of hash function
out:part_id The returned partition id out:part_id The returned partition id
out:func_value Value of hash function out:func_value Value of hash function
...@@ -2475,7 +2468,7 @@ static uint32 get_part_id_for_sub(uint32 loc_part_id, uint32 sub_part_id, ...@@ -2475,7 +2468,7 @@ static uint32 get_part_id_for_sub(uint32 loc_part_id, uint32 sub_part_id,
FALSE Success FALSE Success
*/ */
static int get_part_id_hash(uint no_parts, static int get_part_id_hash(uint num_parts,
Item *part_expr, Item *part_expr,
uint32 *part_id, uint32 *part_id,
longlong *func_value) longlong *func_value)
...@@ -2486,7 +2479,7 @@ static int get_part_id_hash(uint no_parts, ...@@ -2486,7 +2479,7 @@ static int get_part_id_hash(uint no_parts,
if (part_val_int(part_expr, func_value)) if (part_val_int(part_expr, func_value))
DBUG_RETURN(HA_ERR_NO_PARTITION_FOUND); DBUG_RETURN(HA_ERR_NO_PARTITION_FOUND);
int_hash_id= *func_value % no_parts; int_hash_id= *func_value % num_parts;
*part_id= int_hash_id < 0 ? (uint32) -int_hash_id : (uint32) int_hash_id; *part_id= int_hash_id < 0 ? (uint32) -int_hash_id : (uint32) int_hash_id;
DBUG_RETURN(FALSE); DBUG_RETURN(FALSE);
...@@ -2500,7 +2493,7 @@ static int get_part_id_hash(uint no_parts, ...@@ -2500,7 +2493,7 @@ static int get_part_id_hash(uint no_parts,
get_part_id_linear_hash() get_part_id_linear_hash()
part_info A reference to the partition_info struct where all the part_info A reference to the partition_info struct where all the
desired information is given desired information is given
no_parts Number of hash partitions num_parts Number of hash partitions
part_expr Item tree of hash function part_expr Item tree of hash function
out:part_id The returned partition id out:part_id The returned partition id
out:func_value Value of hash function out:func_value Value of hash function
...@@ -2511,7 +2504,7 @@ static int get_part_id_hash(uint no_parts, ...@@ -2511,7 +2504,7 @@ static int get_part_id_hash(uint no_parts,
*/ */
static int get_part_id_linear_hash(partition_info *part_info, static int get_part_id_linear_hash(partition_info *part_info,
uint no_parts, uint num_parts,
Item *part_expr, Item *part_expr,
uint32 *part_id, uint32 *part_id,
longlong *func_value) longlong *func_value)
...@@ -2523,7 +2516,7 @@ static int get_part_id_linear_hash(partition_info *part_info, ...@@ -2523,7 +2516,7 @@ static int get_part_id_linear_hash(partition_info *part_info,
*part_id= get_part_id_from_linear_hash(*func_value, *part_id= get_part_id_from_linear_hash(*func_value,
part_info->linear_hash_mask, part_info->linear_hash_mask,
no_parts); num_parts);
DBUG_RETURN(FALSE); DBUG_RETURN(FALSE);
} }
...@@ -2534,7 +2527,7 @@ static int get_part_id_linear_hash(partition_info *part_info, ...@@ -2534,7 +2527,7 @@ static int get_part_id_linear_hash(partition_info *part_info,
SYNOPSIS SYNOPSIS
get_part_id_key() get_part_id_key()
field_array Array of fields for PARTTION KEY field_array Array of fields for PARTTION KEY
no_parts Number of KEY partitions num_parts Number of KEY partitions
RETURN VALUE RETURN VALUE
Calculated partition id Calculated partition id
...@@ -2542,12 +2535,12 @@ static int get_part_id_linear_hash(partition_info *part_info, ...@@ -2542,12 +2535,12 @@ static int get_part_id_linear_hash(partition_info *part_info,
inline inline
static uint32 get_part_id_key(Field **field_array, static uint32 get_part_id_key(Field **field_array,
uint no_parts, uint num_parts,
longlong *func_value) longlong *func_value)
{ {
DBUG_ENTER("get_part_id_key"); DBUG_ENTER("get_part_id_key");
*func_value= calculate_key_value(field_array); *func_value= calculate_key_value(field_array);
DBUG_RETURN((uint32) (*func_value % no_parts)); DBUG_RETURN((uint32) (*func_value % num_parts));
} }
...@@ -2559,7 +2552,7 @@ static uint32 get_part_id_key(Field **field_array, ...@@ -2559,7 +2552,7 @@ static uint32 get_part_id_key(Field **field_array,
part_info A reference to the partition_info struct where all the part_info A reference to the partition_info struct where all the
desired information is given desired information is given
field_array Array of fields for PARTTION KEY field_array Array of fields for PARTTION KEY
no_parts Number of KEY partitions num_parts Number of KEY partitions
RETURN VALUE RETURN VALUE
Calculated partition id Calculated partition id
...@@ -2568,7 +2561,7 @@ static uint32 get_part_id_key(Field **field_array, ...@@ -2568,7 +2561,7 @@ static uint32 get_part_id_key(Field **field_array,
inline inline
static uint32 get_part_id_linear_key(partition_info *part_info, static uint32 get_part_id_linear_key(partition_info *part_info,
Field **field_array, Field **field_array,
uint no_parts, uint num_parts,
longlong *func_value) longlong *func_value)
{ {
DBUG_ENTER("get_part_id_linear_key"); DBUG_ENTER("get_part_id_linear_key");
...@@ -2576,7 +2569,7 @@ static uint32 get_part_id_linear_key(partition_info *part_info, ...@@ -2576,7 +2569,7 @@ static uint32 get_part_id_linear_key(partition_info *part_info,
*func_value= calculate_key_value(field_array); *func_value= calculate_key_value(field_array);
DBUG_RETURN(get_part_id_from_linear_hash(*func_value, DBUG_RETURN(get_part_id_from_linear_hash(*func_value,
part_info->linear_hash_mask, part_info->linear_hash_mask,
no_parts)); num_parts));
} }
/* /*
...@@ -2772,17 +2765,17 @@ int get_partition_id_list_col(partition_info *part_info, ...@@ -2772,17 +2765,17 @@ int get_partition_id_list_col(partition_info *part_info,
longlong *func_value) longlong *func_value)
{ {
part_column_list_val *list_col_array= part_info->list_col_array; part_column_list_val *list_col_array= part_info->list_col_array;
uint no_columns= part_info->part_field_list.elements; uint num_columns= part_info->part_field_list.elements;
int list_index, cmp; int list_index, cmp;
int min_list_index= 0; int min_list_index= 0;
int max_list_index= part_info->no_list_values - 1; int max_list_index= part_info->num_list_values - 1;
DBUG_ENTER("get_partition_id_list_col"); DBUG_ENTER("get_partition_id_list_col");
while (max_list_index >= min_list_index) while (max_list_index >= min_list_index)
{ {
list_index= (max_list_index + min_list_index) >> 1; list_index= (max_list_index + min_list_index) >> 1;
cmp= cmp_rec_and_tuple(list_col_array + list_index*no_columns, cmp= cmp_rec_and_tuple(list_col_array + list_index*num_columns,
no_columns); num_columns);
if (cmp > 0) if (cmp > 0)
min_list_index= list_index + 1; min_list_index= list_index + 1;
else if (cmp < 0) else if (cmp < 0)
...@@ -2810,7 +2803,7 @@ int get_partition_id_list(partition_info *part_info, ...@@ -2810,7 +2803,7 @@ int get_partition_id_list(partition_info *part_info,
LIST_PART_ENTRY *list_array= part_info->list_array; LIST_PART_ENTRY *list_array= part_info->list_array;
int list_index; int list_index;
int min_list_index= 0; int min_list_index= 0;
int max_list_index= part_info->no_list_values - 1; int max_list_index= part_info->num_list_values - 1;
longlong part_func_value; longlong part_func_value;
int error= part_val_int(part_info->part_expr, &part_func_value); int error= part_val_int(part_info->part_expr, &part_func_value);
longlong list_value; longlong list_value;
...@@ -2880,7 +2873,7 @@ notfound: ...@@ -2880,7 +2873,7 @@ notfound:
index idx. index idx.
The function returns first number idx, such that The function returns first number idx, such that
list_array[idx].list_value is NOT contained within the passed interval. list_array[idx].list_value is NOT contained within the passed interval.
If all array elements are contained, part_info->no_list_values is If all array elements are contained, part_info->num_list_values is
returned. returned.
NOTE NOTE
...@@ -2900,17 +2893,17 @@ uint32 get_partition_id_cols_list_for_endpoint(partition_info *part_info, ...@@ -2900,17 +2893,17 @@ uint32 get_partition_id_cols_list_for_endpoint(partition_info *part_info,
uint32 nparts) uint32 nparts)
{ {
part_column_list_val *list_col_array= part_info->list_col_array; part_column_list_val *list_col_array= part_info->list_col_array;
uint no_columns= part_info->part_field_list.elements; uint num_columns= part_info->part_field_list.elements;
int list_index, cmp; int list_index, cmp;
uint min_list_index= 0; uint min_list_index= 0;
uint max_list_index= part_info->no_list_values - 1; uint max_list_index= part_info->num_list_values - 1;
bool tailf= !(left_endpoint ^ include_endpoint); bool tailf= !(left_endpoint ^ include_endpoint);
DBUG_ENTER("get_partition_id_cols_list_for_endpoint"); DBUG_ENTER("get_partition_id_cols_list_for_endpoint");
do do
{ {
list_index= (max_list_index + min_list_index) >> 1; list_index= (max_list_index + min_list_index) >> 1;
cmp= cmp_rec_and_tuple_prune(list_col_array + list_index*no_columns, cmp= cmp_rec_and_tuple_prune(list_col_array + list_index*num_columns,
nparts, tailf); nparts, tailf);
if (cmp > 0) if (cmp > 0)
min_list_index= list_index + 1; min_list_index= list_index + 1;
...@@ -2953,7 +2946,7 @@ uint32 get_list_array_idx_for_endpoint(partition_info *part_info, ...@@ -2953,7 +2946,7 @@ uint32 get_list_array_idx_for_endpoint(partition_info *part_info,
{ {
LIST_PART_ENTRY *list_array= part_info->list_array; LIST_PART_ENTRY *list_array= part_info->list_array;
uint list_index; uint list_index;
uint min_list_index= 0, max_list_index= part_info->no_list_values - 1; uint min_list_index= 0, max_list_index= part_info->num_list_values - 1;
longlong list_value; longlong list_value;
/* Get the partitioning function value for the endpoint */ /* Get the partitioning function value for the endpoint */
longlong part_func_value= longlong part_func_value=
...@@ -2967,7 +2960,7 @@ uint32 get_list_array_idx_for_endpoint(partition_info *part_info, ...@@ -2967,7 +2960,7 @@ uint32 get_list_array_idx_for_endpoint(partition_info *part_info,
} }
if (unsigned_flag) if (unsigned_flag)
part_func_value-= 0x8000000000000000ULL; part_func_value-= 0x8000000000000000ULL;
DBUG_ASSERT(part_info->no_list_values); DBUG_ASSERT(part_info->num_list_values);
do do
{ {
list_index= (max_list_index + min_list_index) >> 1; list_index= (max_list_index + min_list_index) >> 1;
...@@ -2997,8 +2990,8 @@ int get_partition_id_range_col(partition_info *part_info, ...@@ -2997,8 +2990,8 @@ int get_partition_id_range_col(partition_info *part_info,
longlong *func_value) longlong *func_value)
{ {
part_column_list_val *range_col_array= part_info->range_col_array; part_column_list_val *range_col_array= part_info->range_col_array;
uint no_columns= part_info->part_field_list.elements; uint num_columns= part_info->part_field_list.elements;
uint max_partition= part_info->no_parts - 1; uint max_partition= part_info->num_parts - 1;
uint min_part_id= 0; uint min_part_id= 0;
uint max_part_id= max_partition; uint max_part_id= max_partition;
uint loc_part_id; uint loc_part_id;
...@@ -3007,21 +3000,21 @@ int get_partition_id_range_col(partition_info *part_info, ...@@ -3007,21 +3000,21 @@ int get_partition_id_range_col(partition_info *part_info,
while (max_part_id > min_part_id) while (max_part_id > min_part_id)
{ {
loc_part_id= (max_part_id + min_part_id + 1) >> 1; loc_part_id= (max_part_id + min_part_id + 1) >> 1;
if (cmp_rec_and_tuple(range_col_array + loc_part_id*no_columns, if (cmp_rec_and_tuple(range_col_array + loc_part_id*num_columns,
no_columns) >= 0) num_columns) >= 0)
min_part_id= loc_part_id + 1; min_part_id= loc_part_id + 1;
else else
max_part_id= loc_part_id - 1; max_part_id= loc_part_id - 1;
} }
loc_part_id= max_part_id; loc_part_id= max_part_id;
if (loc_part_id != max_partition) if (loc_part_id != max_partition)
if (cmp_rec_and_tuple(range_col_array + loc_part_id*no_columns, if (cmp_rec_and_tuple(range_col_array + loc_part_id*num_columns,
no_columns) >= 0) num_columns) >= 0)
loc_part_id++; loc_part_id++;
*part_id= (uint32)loc_part_id; *part_id= (uint32)loc_part_id;
if (loc_part_id == max_partition && if (loc_part_id == max_partition &&
(cmp_rec_and_tuple(range_col_array + loc_part_id*no_columns, (cmp_rec_and_tuple(range_col_array + loc_part_id*num_columns,
no_columns) >= 0)) num_columns) >= 0))
DBUG_RETURN(HA_ERR_NO_PARTITION_FOUND); DBUG_RETURN(HA_ERR_NO_PARTITION_FOUND);
DBUG_PRINT("exit",("partition: %d", *part_id)); DBUG_PRINT("exit",("partition: %d", *part_id));
...@@ -3035,7 +3028,7 @@ int get_partition_id_range(partition_info *part_info, ...@@ -3035,7 +3028,7 @@ int get_partition_id_range(partition_info *part_info,
longlong *func_value) longlong *func_value)
{ {
longlong *range_array= part_info->range_int_array; longlong *range_array= part_info->range_int_array;
uint max_partition= part_info->no_parts - 1; uint max_partition= part_info->num_parts - 1;
uint min_part_id= 0; uint min_part_id= 0;
uint max_part_id= max_partition; uint max_part_id= max_partition;
uint loc_part_id; uint loc_part_id;
...@@ -3112,7 +3105,7 @@ int get_partition_id_range(partition_info *part_info, ...@@ -3112,7 +3105,7 @@ int get_partition_id_range(partition_info *part_info,
represented by range_int_array[idx] has EMPTY intersection with the represented by range_int_array[idx] has EMPTY intersection with the
passed interval. passed interval.
If the interval represented by the last array element has non-empty If the interval represented by the last array element has non-empty
intersection with the passed interval, part_info->no_parts is intersection with the passed interval, part_info->num_parts is
returned. returned.
RETURN RETURN
...@@ -3140,7 +3133,7 @@ uint32 get_partition_id_range_for_endpoint(partition_info *part_info, ...@@ -3140,7 +3133,7 @@ uint32 get_partition_id_range_for_endpoint(partition_info *part_info,
bool include_endpoint) bool include_endpoint)
{ {
longlong *range_array= part_info->range_int_array; longlong *range_array= part_info->range_int_array;
uint max_partition= part_info->no_parts - 1; uint max_partition= part_info->num_parts - 1;
uint min_part_id= 0, max_part_id= max_partition, loc_part_id; uint min_part_id= 0, max_part_id= max_partition, loc_part_id;
/* Get the partitioning function value for the endpoint */ /* Get the partitioning function value for the endpoint */
longlong part_func_value= longlong part_func_value=
...@@ -3205,7 +3198,7 @@ int get_partition_id_hash_nosub(partition_info *part_info, ...@@ -3205,7 +3198,7 @@ int get_partition_id_hash_nosub(partition_info *part_info,
uint32 *part_id, uint32 *part_id,
longlong *func_value) longlong *func_value)
{ {
return get_part_id_hash(part_info->no_parts, part_info->part_expr, return get_part_id_hash(part_info->num_parts, part_info->part_expr,
part_id, func_value); part_id, func_value);
} }
...@@ -3214,7 +3207,7 @@ int get_partition_id_linear_hash_nosub(partition_info *part_info, ...@@ -3214,7 +3207,7 @@ int get_partition_id_linear_hash_nosub(partition_info *part_info,
uint32 *part_id, uint32 *part_id,
longlong *func_value) longlong *func_value)
{ {
return get_part_id_linear_hash(part_info, part_info->no_parts, return get_part_id_linear_hash(part_info, part_info->num_parts,
part_info->part_expr, part_id, func_value); part_info->part_expr, part_id, func_value);
} }
...@@ -3224,7 +3217,7 @@ int get_partition_id_key_nosub(partition_info *part_info, ...@@ -3224,7 +3217,7 @@ int get_partition_id_key_nosub(partition_info *part_info,
longlong *func_value) longlong *func_value)
{ {
*part_id= get_part_id_key(part_info->part_field_array, *part_id= get_part_id_key(part_info->part_field_array,
part_info->no_parts, func_value); part_info->num_parts, func_value);
return 0; return 0;
} }
...@@ -3235,7 +3228,7 @@ int get_partition_id_linear_key_nosub(partition_info *part_info, ...@@ -3235,7 +3228,7 @@ int get_partition_id_linear_key_nosub(partition_info *part_info,
{ {
*part_id= get_part_id_linear_key(part_info, *part_id= get_part_id_linear_key(part_info,
part_info->part_field_array, part_info->part_field_array,
part_info->no_parts, func_value); part_info->num_parts, func_value);
return 0; return 0;
} }
...@@ -3245,7 +3238,7 @@ int get_partition_id_with_sub(partition_info *part_info, ...@@ -3245,7 +3238,7 @@ int get_partition_id_with_sub(partition_info *part_info,
longlong *func_value) longlong *func_value)
{ {
uint32 loc_part_id, sub_part_id; uint32 loc_part_id, sub_part_id;
uint no_subparts; uint num_subparts;
int error; int error;
DBUG_ENTER("get_partition_id_with_sub"); DBUG_ENTER("get_partition_id_with_sub");
...@@ -3255,13 +3248,13 @@ int get_partition_id_with_sub(partition_info *part_info, ...@@ -3255,13 +3248,13 @@ int get_partition_id_with_sub(partition_info *part_info,
{ {
DBUG_RETURN(error); DBUG_RETURN(error);
} }
no_subparts= part_info->no_subparts; num_subparts= part_info->num_subparts;
if (unlikely((error= part_info->get_subpartition_id(part_info, if (unlikely((error= part_info->get_subpartition_id(part_info,
&sub_part_id)))) &sub_part_id))))
{ {
DBUG_RETURN(error); DBUG_RETURN(error);
} }
*part_id= get_part_id_for_sub(loc_part_id, sub_part_id, no_subparts); *part_id= get_part_id_for_sub(loc_part_id, sub_part_id, num_subparts);
DBUG_RETURN(0); DBUG_RETURN(0);
} }
...@@ -3294,7 +3287,7 @@ int get_partition_id_hash_sub(partition_info *part_info, ...@@ -3294,7 +3287,7 @@ int get_partition_id_hash_sub(partition_info *part_info,
uint32 *part_id) uint32 *part_id)
{ {
longlong func_value; longlong func_value;
return get_part_id_hash(part_info->no_subparts, part_info->subpart_expr, return get_part_id_hash(part_info->num_subparts, part_info->subpart_expr,
part_id, &func_value); part_id, &func_value);
} }
...@@ -3303,7 +3296,7 @@ int get_partition_id_linear_hash_sub(partition_info *part_info, ...@@ -3303,7 +3296,7 @@ int get_partition_id_linear_hash_sub(partition_info *part_info,
uint32 *part_id) uint32 *part_id)
{ {
longlong func_value; longlong func_value;
return get_part_id_linear_hash(part_info, part_info->no_subparts, return get_part_id_linear_hash(part_info, part_info->num_subparts,
part_info->subpart_expr, part_id, part_info->subpart_expr, part_id,
&func_value); &func_value);
} }
...@@ -3314,7 +3307,7 @@ int get_partition_id_key_sub(partition_info *part_info, ...@@ -3314,7 +3307,7 @@ int get_partition_id_key_sub(partition_info *part_info,
{ {
longlong func_value; longlong func_value;
*part_id= get_part_id_key(part_info->subpart_field_array, *part_id= get_part_id_key(part_info->subpart_field_array,
part_info->no_subparts, &func_value); part_info->num_subparts, &func_value);
return FALSE; return FALSE;
} }
...@@ -3325,7 +3318,7 @@ int get_partition_id_linear_key_sub(partition_info *part_info, ...@@ -3325,7 +3318,7 @@ int get_partition_id_linear_key_sub(partition_info *part_info,
longlong func_value; longlong func_value;
*part_id= get_part_id_linear_key(part_info, *part_id= get_part_id_linear_key(part_info,
part_info->subpart_field_array, part_info->subpart_field_array,
part_info->no_subparts, &func_value); part_info->num_subparts, &func_value);
return FALSE; return FALSE;
} }
...@@ -3624,16 +3617,16 @@ void get_partition_set(const TABLE *table, uchar *buf, const uint index, ...@@ -3624,16 +3617,16 @@ void get_partition_set(const TABLE *table, uchar *buf, const uint index,
const key_range *key_spec, part_id_range *part_spec) const key_range *key_spec, part_id_range *part_spec)
{ {
partition_info *part_info= table->part_info; partition_info *part_info= table->part_info;
uint no_parts= part_info->get_tot_partitions(); uint num_parts= part_info->get_tot_partitions();
uint i, part_id; uint i, part_id;
uint sub_part= no_parts; uint sub_part= num_parts;
uint32 part_part= no_parts; uint32 part_part= num_parts;
KEY *key_info= NULL; KEY *key_info= NULL;
bool found_part_field= FALSE; bool found_part_field= FALSE;
DBUG_ENTER("get_partition_set"); DBUG_ENTER("get_partition_set");
part_spec->start_part= 0; part_spec->start_part= 0;
part_spec->end_part= no_parts - 1; part_spec->end_part= num_parts - 1;
if ((index < MAX_KEY) && if ((index < MAX_KEY) &&
key_spec->flag == (uint)HA_READ_KEY_EXACT && key_spec->flag == (uint)HA_READ_KEY_EXACT &&
part_info->some_fields_in_PF.is_set(index)) part_info->some_fields_in_PF.is_set(index))
...@@ -3670,7 +3663,7 @@ void get_partition_set(const TABLE *table, uchar *buf, const uint index, ...@@ -3670,7 +3663,7 @@ void get_partition_set(const TABLE *table, uchar *buf, const uint index,
{ {
if (get_sub_part_id_from_key(table, buf, key_info, key_spec, &sub_part)) if (get_sub_part_id_from_key(table, buf, key_info, key_spec, &sub_part))
{ {
part_spec->start_part= no_parts; part_spec->start_part= num_parts;
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
} }
...@@ -3684,7 +3677,7 @@ void get_partition_set(const TABLE *table, uchar *buf, const uint index, ...@@ -3684,7 +3677,7 @@ void get_partition_set(const TABLE *table, uchar *buf, const uint index,
allowed values. Thus it is certain that the result of this allowed values. Thus it is certain that the result of this
scan will be empty. scan will be empty.
*/ */
part_spec->start_part= no_parts; part_spec->start_part= num_parts;
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
} }
...@@ -3722,7 +3715,7 @@ void get_partition_set(const TABLE *table, uchar *buf, const uint index, ...@@ -3722,7 +3715,7 @@ void get_partition_set(const TABLE *table, uchar *buf, const uint index,
{ {
if (get_sub_part_id_from_key(table, buf, key_info, key_spec, &sub_part)) if (get_sub_part_id_from_key(table, buf, key_info, key_spec, &sub_part))
{ {
part_spec->start_part= no_parts; part_spec->start_part= num_parts;
clear_indicator_in_key_fields(key_info); clear_indicator_in_key_fields(key_info);
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
...@@ -3731,7 +3724,7 @@ void get_partition_set(const TABLE *table, uchar *buf, const uint index, ...@@ -3731,7 +3724,7 @@ void get_partition_set(const TABLE *table, uchar *buf, const uint index,
{ {
if (get_part_id_from_key(table,buf,key_info,key_spec,&part_part)) if (get_part_id_from_key(table,buf,key_info,key_spec,&part_part))
{ {
part_spec->start_part= no_parts; part_spec->start_part= num_parts;
clear_indicator_in_key_fields(key_info); clear_indicator_in_key_fields(key_info);
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
...@@ -3752,29 +3745,29 @@ void get_partition_set(const TABLE *table, uchar *buf, const uint index, ...@@ -3752,29 +3745,29 @@ void get_partition_set(const TABLE *table, uchar *buf, const uint index,
nothing or we have discovered a range of partitions with possible holes nothing or we have discovered a range of partitions with possible holes
in it. We need a bitvector to further the work here. in it. We need a bitvector to further the work here.
*/ */
if (!(part_part == no_parts && sub_part == no_parts)) if (!(part_part == num_parts && sub_part == num_parts))
{ {
/* /*
We can only arrive here if we are using subpartitioning. We can only arrive here if we are using subpartitioning.
*/ */
if (part_part != no_parts) if (part_part != num_parts)
{ {
/* /*
We know the top partition and need to scan all underlying We know the top partition and need to scan all underlying
subpartitions. This is a range without holes. subpartitions. This is a range without holes.
*/ */
DBUG_ASSERT(sub_part == no_parts); DBUG_ASSERT(sub_part == num_parts);
part_spec->start_part= part_part * part_info->no_subparts; part_spec->start_part= part_part * part_info->num_subparts;
part_spec->end_part= part_spec->start_part+part_info->no_subparts - 1; part_spec->end_part= part_spec->start_part+part_info->num_subparts - 1;
} }
else else
{ {
DBUG_ASSERT(sub_part != no_parts); DBUG_ASSERT(sub_part != num_parts);
part_spec->start_part= sub_part; part_spec->start_part= sub_part;
part_spec->end_part=sub_part+ part_spec->end_part=sub_part+
(part_info->no_subparts*(part_info->no_parts-1)); (part_info->num_subparts*(part_info->num_parts-1));
for (i= 0, part_id= sub_part; i < part_info->no_parts; for (i= 0, part_id= sub_part; i < part_info->num_parts;
i++, part_id+= part_info->no_subparts) i++, part_id+= part_info->num_subparts)
; //Set bit part_id in bit array ; //Set bit part_id in bit array
} }
} }
...@@ -4038,9 +4031,9 @@ set_engine_all_partitions(partition_info *part_info, ...@@ -4038,9 +4031,9 @@ set_engine_all_partitions(partition_info *part_info,
partition_element *sub_elem= sub_it++; partition_element *sub_elem= sub_it++;
sub_elem->engine_type= engine_type; sub_elem->engine_type= engine_type;
} while (++j < part_info->no_subparts); } while (++j < part_info->num_subparts);
} }
} while (++i < part_info->no_parts); } while (++i < part_info->num_parts);
} }
/* /*
SYNOPSIS SYNOPSIS
...@@ -4185,7 +4178,7 @@ uint set_part_state(Alter_info *alter_info, partition_info *tab_part_info, ...@@ -4185,7 +4178,7 @@ uint set_part_state(Alter_info *alter_info, partition_info *tab_part_info,
enum partition_state part_state) enum partition_state part_state)
{ {
uint part_count= 0; uint part_count= 0;
uint no_parts_found= 0; uint num_parts_found= 0;
List_iterator<partition_element> part_it(tab_part_info->partitions); List_iterator<partition_element> part_it(tab_part_info->partitions);
do do
...@@ -4200,13 +4193,13 @@ uint set_part_state(Alter_info *alter_info, partition_info *tab_part_info, ...@@ -4200,13 +4193,13 @@ uint set_part_state(Alter_info *alter_info, partition_info *tab_part_info,
I.e mark the partition as a partition to be "changed" by I.e mark the partition as a partition to be "changed" by
analyzing/optimizing/rebuilding/checking/repairing analyzing/optimizing/rebuilding/checking/repairing
*/ */
no_parts_found++; num_parts_found++;
part_elem->part_state= part_state; part_elem->part_state= part_state;
DBUG_PRINT("info", ("Setting part_state to %u for partition %s", DBUG_PRINT("info", ("Setting part_state to %u for partition %s",
part_state, part_elem->partition_name)); part_state, part_elem->partition_name));
} }
} while (++part_count < tab_part_info->no_parts); } while (++part_count < tab_part_info->num_parts);
return no_parts_found; return num_parts_found;
} }
...@@ -4287,13 +4280,13 @@ uint prep_alter_part_table(THD *thd, TABLE *table, Alter_info *alter_info, ...@@ -4287,13 +4280,13 @@ uint prep_alter_part_table(THD *thd, TABLE *table, Alter_info *alter_info,
{ {
uint new_part_no, curr_part_no; uint new_part_no, curr_part_no;
if (tab_part_info->part_type != HASH_PARTITION || if (tab_part_info->part_type != HASH_PARTITION ||
tab_part_info->use_default_no_partitions) tab_part_info->use_default_num_partitions)
{ {
my_error(ER_REORG_NO_PARAM_ERROR, MYF(0)); my_error(ER_REORG_NO_PARAM_ERROR, MYF(0));
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
new_part_no= table->file->get_default_no_partitions(create_info); new_part_no= table->file->get_default_no_partitions(create_info);
curr_part_no= tab_part_info->no_parts; curr_part_no= tab_part_info->num_parts;
if (new_part_no == curr_part_no) if (new_part_no == curr_part_no)
{ {
/* /*
...@@ -4311,7 +4304,7 @@ uint prep_alter_part_table(THD *thd, TABLE *table, Alter_info *alter_info, ...@@ -4311,7 +4304,7 @@ uint prep_alter_part_table(THD *thd, TABLE *table, Alter_info *alter_info,
setting the flag for no default number of partitions setting the flag for no default number of partitions
*/ */
alter_info->flags|= ALTER_ADD_PARTITION; alter_info->flags|= ALTER_ADD_PARTITION;
thd->work_part_info->no_parts= new_part_no - curr_part_no; thd->work_part_info->num_parts= new_part_no - curr_part_no;
} }
else else
{ {
...@@ -4320,7 +4313,7 @@ uint prep_alter_part_table(THD *thd, TABLE *table, Alter_info *alter_info, ...@@ -4320,7 +4313,7 @@ uint prep_alter_part_table(THD *thd, TABLE *table, Alter_info *alter_info,
without setting the flag for no default number of partitions without setting the flag for no default number of partitions
*/ */
alter_info->flags|= ALTER_COALESCE_PARTITION; alter_info->flags|= ALTER_COALESCE_PARTITION;
alter_info->no_parts= curr_part_no - new_part_no; alter_info->num_parts= curr_part_no - new_part_no;
} }
} }
if (!(flags= table->file->alter_table_flags(alter_info->flags))) if (!(flags= table->file->alter_table_flags(alter_info->flags)))
...@@ -4378,9 +4371,9 @@ uint prep_alter_part_table(THD *thd, TABLE *table, Alter_info *alter_info, ...@@ -4378,9 +4371,9 @@ uint prep_alter_part_table(THD *thd, TABLE *table, Alter_info *alter_info,
partitioning scheme as currently set-up. partitioning scheme as currently set-up.
Partitions are always added at the end in ADD PARTITION. Partitions are always added at the end in ADD PARTITION.
*/ */
uint no_new_partitions= alt_part_info->no_parts; uint num_new_partitions= alt_part_info->num_parts;
uint no_orig_partitions= tab_part_info->no_parts; uint num_orig_partitions= tab_part_info->num_parts;
uint check_total_partitions= no_new_partitions + no_orig_partitions; uint check_total_partitions= num_new_partitions + num_orig_partitions;
uint new_total_partitions= check_total_partitions; uint new_total_partitions= check_total_partitions;
/* /*
We allow quite a lot of values to be supplied by defaults, however we We allow quite a lot of values to be supplied by defaults, however we
...@@ -4397,22 +4390,22 @@ uint prep_alter_part_table(THD *thd, TABLE *table, Alter_info *alter_info, ...@@ -4397,22 +4390,22 @@ uint prep_alter_part_table(THD *thd, TABLE *table, Alter_info *alter_info,
my_error(ER_PARTITION_MAXVALUE_ERROR, MYF(0)); my_error(ER_PARTITION_MAXVALUE_ERROR, MYF(0));
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
if (no_new_partitions == 0) if (num_new_partitions == 0)
{ {
my_error(ER_ADD_PARTITION_NO_NEW_PARTITION, MYF(0)); my_error(ER_ADD_PARTITION_NO_NEW_PARTITION, MYF(0));
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
if (tab_part_info->is_sub_partitioned()) if (tab_part_info->is_sub_partitioned())
{ {
if (alt_part_info->no_subparts == 0) if (alt_part_info->num_subparts == 0)
alt_part_info->no_subparts= tab_part_info->no_subparts; alt_part_info->num_subparts= tab_part_info->num_subparts;
else if (alt_part_info->no_subparts != tab_part_info->no_subparts) else if (alt_part_info->num_subparts != tab_part_info->num_subparts)
{ {
my_error(ER_ADD_PARTITION_SUBPART_ERROR, MYF(0)); my_error(ER_ADD_PARTITION_SUBPART_ERROR, MYF(0));
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
check_total_partitions= new_total_partitions* check_total_partitions= new_total_partitions*
alt_part_info->no_subparts; alt_part_info->num_subparts;
} }
if (check_total_partitions > MAX_PARTITIONS) if (check_total_partitions > MAX_PARTITIONS)
{ {
...@@ -4422,8 +4415,8 @@ uint prep_alter_part_table(THD *thd, TABLE *table, Alter_info *alter_info, ...@@ -4422,8 +4415,8 @@ uint prep_alter_part_table(THD *thd, TABLE *table, Alter_info *alter_info,
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; 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->num_parts))
{ {
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
...@@ -4498,7 +4491,7 @@ that are reorganised. ...@@ -4498,7 +4491,7 @@ that are reorganised.
uint lower_2n= upper_2n >> 1; uint lower_2n= upper_2n >> 1;
bool all_parts= TRUE; bool all_parts= TRUE;
if (tab_part_info->linear_hash_ind && if (tab_part_info->linear_hash_ind &&
no_new_partitions < upper_2n) num_new_partitions < upper_2n)
{ {
/* /*
An analysis of which parts needs reorganisation shows that it is An analysis of which parts needs reorganisation shows that it is
...@@ -4507,7 +4500,7 @@ that are reorganised. ...@@ -4507,7 +4500,7 @@ that are reorganised.
onwards it starts again from partition 0 and goes on until onwards it starts again from partition 0 and goes on until
it reaches p(upper_2n - 1). If the last new partition reaches it reaches p(upper_2n - 1). If the last new partition reaches
beyond upper_2n - 1 then the first interval will end with beyond upper_2n - 1 then the first interval will end with
p(lower_2n - 1) and start with p(no_orig_partitions - lower_2n). p(lower_2n - 1) and start with p(num_orig_partitions - lower_2n).
If lower_2n partitions are added then p0 to p(lower_2n - 1) will If lower_2n partitions are added then p0 to p(lower_2n - 1) will
be reorganised which means that the two interval becomes one be reorganised which means that the two interval becomes one
interval at this point. Thus only when adding less than interval at this point. Thus only when adding less than
...@@ -4535,7 +4528,7 @@ that are reorganised. ...@@ -4535,7 +4528,7 @@ that are reorganised.
to TRUE. In this case we don't get into this if-part at all. to TRUE. In this case we don't get into this if-part at all.
*/ */
all_parts= FALSE; all_parts= FALSE;
if (no_new_partitions >= lower_2n) if (num_new_partitions >= lower_2n)
{ {
/* /*
In this case there is only one interval since the two intervals In this case there is only one interval since the two intervals
...@@ -4551,8 +4544,8 @@ that are reorganised. ...@@ -4551,8 +4544,8 @@ that are reorganised.
Also in this case there is only one interval since we are not Also in this case there is only one interval since we are not
going over a 2**n boundary going over a 2**n boundary
*/ */
start_part= no_orig_partitions - lower_2n; start_part= num_orig_partitions - lower_2n;
end_part= start_part + (no_new_partitions - 1); end_part= start_part + (num_new_partitions - 1);
} }
else else
{ {
...@@ -4561,7 +4554,7 @@ that are reorganised. ...@@ -4561,7 +4554,7 @@ that are reorganised.
new parts that would ensure that the intervals become new parts that would ensure that the intervals become
overlapping. overlapping.
*/ */
start_part= no_orig_partitions - lower_2n; start_part= num_orig_partitions - lower_2n;
end_part= upper_2n - 1; end_part= upper_2n - 1;
start_sec_part= 0; start_sec_part= 0;
end_sec_part= new_total_partitions - (upper_2n + 1); end_sec_part= new_total_partitions - (upper_2n + 1);
...@@ -4578,7 +4571,7 @@ that are reorganised. ...@@ -4578,7 +4571,7 @@ that are reorganised.
{ {
p_elem->part_state= PART_CHANGED; p_elem->part_state= PART_CHANGED;
} }
} while (++part_no < no_orig_partitions); } while (++part_no < num_orig_partitions);
} }
/* /*
Need to concatenate the lists here to make it possible to check the Need to concatenate the lists here to make it possible to check the
...@@ -4601,8 +4594,8 @@ that are reorganised. ...@@ -4601,8 +4594,8 @@ that are reorganised.
mem_alloc_error(1); mem_alloc_error(1);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
} while (++part_count < no_new_partitions); } while (++part_count < num_new_partitions);
tab_part_info->no_parts+= no_new_partitions; tab_part_info->num_parts+= num_new_partitions;
} }
/* /*
If we specify partitions explicitly we don't use defaults anymore. If we specify partitions explicitly we don't use defaults anymore.
...@@ -4617,7 +4610,7 @@ that are reorganised. ...@@ -4617,7 +4610,7 @@ that are reorganised.
DBUG_PRINT("info", ("part_info: 0x%lx", (long) tab_part_info)); DBUG_PRINT("info", ("part_info: 0x%lx", (long) tab_part_info));
tab_part_info->use_default_partitions= FALSE; tab_part_info->use_default_partitions= FALSE;
} }
tab_part_info->use_default_no_partitions= FALSE; tab_part_info->use_default_num_partitions= FALSE;
tab_part_info->is_auto_partitioned= FALSE; tab_part_info->is_auto_partitioned= FALSE;
} }
} }
...@@ -4631,8 +4624,8 @@ that are reorganised. ...@@ -4631,8 +4624,8 @@ that are reorganised.
command to drop the partition failed in the middle. command to drop the partition failed in the middle.
*/ */
uint part_count= 0; uint part_count= 0;
uint no_parts_dropped= alter_info->partition_names.elements; uint num_parts_dropped= alter_info->partition_names.elements;
uint no_parts_found= 0; uint num_parts_found= 0;
List_iterator<partition_element> part_it(tab_part_info->partitions); List_iterator<partition_element> part_it(tab_part_info->partitions);
tab_part_info->is_auto_partitioned= FALSE; tab_part_info->is_auto_partitioned= FALSE;
...@@ -4642,7 +4635,7 @@ that are reorganised. ...@@ -4642,7 +4635,7 @@ that are reorganised.
my_error(ER_ONLY_ON_RANGE_LIST_PARTITION, MYF(0), "DROP"); my_error(ER_ONLY_ON_RANGE_LIST_PARTITION, MYF(0), "DROP");
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
if (no_parts_dropped >= tab_part_info->no_parts) if (num_parts_dropped >= tab_part_info->num_parts)
{ {
my_error(ER_DROP_LAST_PARTITION, MYF(0)); my_error(ER_DROP_LAST_PARTITION, MYF(0));
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
...@@ -4656,11 +4649,11 @@ that are reorganised. ...@@ -4656,11 +4649,11 @@ that are reorganised.
/* /*
Set state to indicate that the partition is to be dropped. Set state to indicate that the partition is to be dropped.
*/ */
no_parts_found++; num_parts_found++;
part_elem->part_state= PART_TO_BE_DROPPED; part_elem->part_state= PART_TO_BE_DROPPED;
} }
} while (++part_count < tab_part_info->no_parts); } while (++part_count < tab_part_info->num_parts);
if (no_parts_found != no_parts_dropped) if (num_parts_found != num_parts_dropped)
{ {
my_error(ER_DROP_PARTITION_NON_EXISTENT, MYF(0), "DROP"); my_error(ER_DROP_PARTITION_NON_EXISTENT, MYF(0), "DROP");
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
...@@ -4670,14 +4663,14 @@ that are reorganised. ...@@ -4670,14 +4663,14 @@ that are reorganised.
my_error(ER_ROW_IS_REFERENCED, MYF(0)); my_error(ER_ROW_IS_REFERENCED, MYF(0));
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
tab_part_info->no_parts-= no_parts_dropped; tab_part_info->num_parts-= num_parts_dropped;
} }
else if (alter_info->flags & ALTER_REBUILD_PARTITION) else if (alter_info->flags & ALTER_REBUILD_PARTITION)
{ {
uint no_parts_found; uint num_parts_found;
uint no_parts_opt= alter_info->partition_names.elements; uint num_parts_opt= alter_info->partition_names.elements;
no_parts_found= set_part_state(alter_info, tab_part_info, PART_CHANGED); num_parts_found= set_part_state(alter_info, tab_part_info, PART_CHANGED);
if (no_parts_found != no_parts_opt && if (num_parts_found != num_parts_opt &&
(!(alter_info->flags & ALTER_ALL_PARTITION))) (!(alter_info->flags & ALTER_ALL_PARTITION)))
{ {
my_error(ER_DROP_PARTITION_NON_EXISTENT, MYF(0), "REBUILD"); my_error(ER_DROP_PARTITION_NON_EXISTENT, MYF(0), "REBUILD");
...@@ -4691,20 +4684,20 @@ that are reorganised. ...@@ -4691,20 +4684,20 @@ that are reorganised.
} }
else if (alter_info->flags & ALTER_COALESCE_PARTITION) else if (alter_info->flags & ALTER_COALESCE_PARTITION)
{ {
uint no_parts_coalesced= alter_info->no_parts; uint num_parts_coalesced= alter_info->num_parts;
uint no_parts_remain= tab_part_info->no_parts - no_parts_coalesced; uint num_parts_remain= tab_part_info->num_parts - num_parts_coalesced;
List_iterator<partition_element> part_it(tab_part_info->partitions); List_iterator<partition_element> part_it(tab_part_info->partitions);
if (tab_part_info->part_type != HASH_PARTITION) if (tab_part_info->part_type != HASH_PARTITION)
{ {
my_error(ER_COALESCE_ONLY_ON_HASH_PARTITION, MYF(0)); my_error(ER_COALESCE_ONLY_ON_HASH_PARTITION, MYF(0));
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
if (no_parts_coalesced == 0) if (num_parts_coalesced == 0)
{ {
my_error(ER_COALESCE_PARTITION_NO_PARTITION, MYF(0)); my_error(ER_COALESCE_PARTITION_NO_PARTITION, MYF(0));
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
if (no_parts_coalesced >= tab_part_info->no_parts) if (num_parts_coalesced >= tab_part_info->num_parts)
{ {
my_error(ER_DROP_LAST_PARTITION, MYF(0)); my_error(ER_DROP_LAST_PARTITION, MYF(0));
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
...@@ -4752,21 +4745,21 @@ state of p1. ...@@ -4752,21 +4745,21 @@ state of p1.
uint upper_2n= tab_part_info->linear_hash_mask + 1; uint upper_2n= tab_part_info->linear_hash_mask + 1;
uint lower_2n= upper_2n >> 1; uint lower_2n= upper_2n >> 1;
all_parts= FALSE; all_parts= FALSE;
if (no_parts_coalesced >= lower_2n) if (num_parts_coalesced >= lower_2n)
{ {
all_parts= TRUE; all_parts= TRUE;
} }
else if (no_parts_remain >= lower_2n) else if (num_parts_remain >= lower_2n)
{ {
end_part= tab_part_info->no_parts - (lower_2n + 1); end_part= tab_part_info->num_parts - (lower_2n + 1);
start_part= no_parts_remain - lower_2n; start_part= num_parts_remain - lower_2n;
} }
else else
{ {
start_part= 0; start_part= 0;
end_part= tab_part_info->no_parts - (lower_2n + 1); end_part= tab_part_info->num_parts - (lower_2n + 1);
end_sec_part= (lower_2n >> 1) - 1; end_sec_part= (lower_2n >> 1) - 1;
start_sec_part= end_sec_part - (lower_2n - (no_parts_remain + 1)); start_sec_part= end_sec_part - (lower_2n - (num_parts_remain + 1));
} }
} }
do do
...@@ -4777,19 +4770,19 @@ state of p1. ...@@ -4777,19 +4770,19 @@ state of p1.
(part_count >= start_part && part_count <= end_part) || (part_count >= start_part && part_count <= end_part) ||
(part_count >= start_sec_part && part_count <= end_sec_part))) (part_count >= start_sec_part && part_count <= end_sec_part)))
p_elem->part_state= PART_CHANGED; p_elem->part_state= PART_CHANGED;
if (++part_count > no_parts_remain) if (++part_count > num_parts_remain)
{ {
if (*fast_alter_partition) if (*fast_alter_partition)
p_elem->part_state= PART_REORGED_DROPPED; p_elem->part_state= PART_REORGED_DROPPED;
else else
part_it.remove(); part_it.remove();
} }
} while (part_count < tab_part_info->no_parts); } while (part_count < tab_part_info->num_parts);
tab_part_info->no_parts= no_parts_remain; tab_part_info->num_parts= num_parts_remain;
} }
if (!(alter_info->flags & ALTER_TABLE_REORG)) if (!(alter_info->flags & ALTER_TABLE_REORG))
{ {
tab_part_info->use_default_no_partitions= FALSE; tab_part_info->use_default_num_partitions= FALSE;
tab_part_info->is_auto_partitioned= FALSE; tab_part_info->is_auto_partitioned= FALSE;
} }
} }
...@@ -4806,32 +4799,32 @@ state of p1. ...@@ -4806,32 +4799,32 @@ state of p1.
range as those changed from. range as those changed from.
This command can be used on RANGE and LIST partitions. This command can be used on RANGE and LIST partitions.
*/ */
uint no_parts_reorged= alter_info->partition_names.elements; uint num_parts_reorged= alter_info->partition_names.elements;
uint no_parts_new= thd->work_part_info->partitions.elements; uint num_parts_new= thd->work_part_info->partitions.elements;
uint check_total_partitions; uint check_total_partitions;
tab_part_info->is_auto_partitioned= FALSE; tab_part_info->is_auto_partitioned= FALSE;
if (no_parts_reorged > tab_part_info->no_parts) if (num_parts_reorged > tab_part_info->num_parts)
{ {
my_error(ER_REORG_PARTITION_NOT_EXIST, MYF(0)); my_error(ER_REORG_PARTITION_NOT_EXIST, MYF(0));
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
if (!(tab_part_info->part_type == RANGE_PARTITION || if (!(tab_part_info->part_type == RANGE_PARTITION ||
tab_part_info->part_type == LIST_PARTITION) && tab_part_info->part_type == LIST_PARTITION) &&
(no_parts_new != no_parts_reorged)) (num_parts_new != num_parts_reorged))
{ {
my_error(ER_REORG_HASH_ONLY_ON_SAME_NO, MYF(0)); my_error(ER_REORG_HASH_ONLY_ON_SAME_NO, MYF(0));
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
if (tab_part_info->is_sub_partitioned() && if (tab_part_info->is_sub_partitioned() &&
alt_part_info->no_subparts && alt_part_info->num_subparts &&
alt_part_info->no_subparts != tab_part_info->no_subparts) alt_part_info->num_subparts != tab_part_info->num_subparts)
{ {
my_error(ER_PARTITION_WRONG_NO_SUBPART_ERROR, MYF(0)); my_error(ER_PARTITION_WRONG_NO_SUBPART_ERROR, MYF(0));
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
check_total_partitions= tab_part_info->no_parts + no_parts_new; check_total_partitions= tab_part_info->num_parts + num_parts_new;
check_total_partitions-= no_parts_reorged; check_total_partitions-= num_parts_reorged;
if (check_total_partitions > MAX_PARTITIONS) if (check_total_partitions > MAX_PARTITIONS)
{ {
my_error(ER_TOO_MANY_PARTITIONS_ERROR, MYF(0)); my_error(ER_TOO_MANY_PARTITIONS_ERROR, MYF(0));
...@@ -4839,7 +4832,7 @@ state of p1. ...@@ -4839,7 +4832,7 @@ state of p1.
} }
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; alt_part_info->subpart_type= tab_part_info->subpart_type;
alt_part_info->no_subparts= tab_part_info->no_subparts; alt_part_info->num_subparts= tab_part_info->num_subparts;
DBUG_ASSERT(!alt_part_info->use_default_partitions); DBUG_ASSERT(!alt_part_info->use_default_partitions);
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),
...@@ -4936,7 +4929,7 @@ the generated partition syntax in a correct manner. ...@@ -4936,7 +4929,7 @@ the generated partition syntax in a correct manner.
tab_it.replace(alt_part_elem); tab_it.replace(alt_part_elem);
else else
tab_it.after(alt_part_elem); tab_it.after(alt_part_elem);
} while (++alt_part_count < no_parts_new); } while (++alt_part_count < num_parts_new);
} }
else if (found_last) else if (found_last)
{ {
...@@ -4951,13 +4944,13 @@ the generated partition syntax in a correct manner. ...@@ -4951,13 +4944,13 @@ the generated partition syntax in a correct manner.
if (found_first) if (found_first)
found_last= TRUE; found_last= TRUE;
} }
} while (++part_count < tab_part_info->no_parts); } while (++part_count < tab_part_info->num_parts);
if (drop_count != no_parts_reorged) if (drop_count != num_parts_reorged)
{ {
my_error(ER_DROP_PARTITION_NON_EXISTENT, MYF(0), "REORGANIZE"); my_error(ER_DROP_PARTITION_NON_EXISTENT, MYF(0), "REORGANIZE");
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
tab_part_info->no_parts= check_total_partitions; tab_part_info->num_parts= check_total_partitions;
} }
} }
else else
...@@ -4973,7 +4966,7 @@ the generated partition syntax in a correct manner. ...@@ -4973,7 +4966,7 @@ the generated partition syntax in a correct manner.
!alt_part_info->use_default_subpartitions) !alt_part_info->use_default_subpartitions)
{ {
tab_part_info->use_default_subpartitions= FALSE; tab_part_info->use_default_subpartitions= FALSE;
tab_part_info->use_default_no_subpartitions= FALSE; tab_part_info->use_default_num_subpartitions= FALSE;
} }
if (tab_part_info->check_partition_info(thd, (handlerton**)NULL, if (tab_part_info->check_partition_info(thd, (handlerton**)NULL,
table->file, ULL(0), TRUE)) table->file, ULL(0), TRUE))
...@@ -5285,8 +5278,8 @@ static bool mysql_drop_partitions(ALTER_PARTITION_PARAM_TYPE *lpt) ...@@ -5285,8 +5278,8 @@ static bool mysql_drop_partitions(ALTER_PARTITION_PARAM_TYPE *lpt)
part_it.remove(); part_it.remove();
remove_count++; remove_count++;
} }
} while (++i < part_info->no_parts); } while (++i < part_info->num_parts);
part_info->no_parts-= remove_count; part_info->num_parts-= remove_count;
DBUG_RETURN(FALSE); DBUG_RETURN(FALSE);
} }
...@@ -5408,7 +5401,7 @@ static bool write_log_changed_partitions(ALTER_PARTITION_PARAM_TYPE *lpt, ...@@ -5408,7 +5401,7 @@ static bool write_log_changed_partitions(ALTER_PARTITION_PARAM_TYPE *lpt,
char normal_path[FN_REFLEN]; char normal_path[FN_REFLEN];
List_iterator<partition_element> part_it(part_info->partitions); List_iterator<partition_element> part_it(part_info->partitions);
uint temp_partitions= part_info->temp_partitions.elements; uint temp_partitions= part_info->temp_partitions.elements;
uint no_elements= part_info->partitions.elements; uint num_elements= part_info->partitions.elements;
uint i= 0; uint i= 0;
DBUG_ENTER("write_log_changed_partitions"); DBUG_ENTER("write_log_changed_partitions");
...@@ -5421,7 +5414,7 @@ static bool write_log_changed_partitions(ALTER_PARTITION_PARAM_TYPE *lpt, ...@@ -5421,7 +5414,7 @@ static bool write_log_changed_partitions(ALTER_PARTITION_PARAM_TYPE *lpt,
if (part_info->is_sub_partitioned()) if (part_info->is_sub_partitioned())
{ {
List_iterator<partition_element> sub_it(part_elem->subpartitions); List_iterator<partition_element> sub_it(part_elem->subpartitions);
uint no_subparts= part_info->no_subparts; uint num_subparts= part_info->num_subparts;
uint j= 0; uint j= 0;
do do
{ {
...@@ -5450,7 +5443,7 @@ static bool write_log_changed_partitions(ALTER_PARTITION_PARAM_TYPE *lpt, ...@@ -5450,7 +5443,7 @@ static bool write_log_changed_partitions(ALTER_PARTITION_PARAM_TYPE *lpt,
*next_entry= log_entry->entry_pos; *next_entry= log_entry->entry_pos;
sub_elem->log_entry= log_entry; sub_elem->log_entry= log_entry;
insert_part_info_log_entry_list(part_info, log_entry); insert_part_info_log_entry_list(part_info, log_entry);
} while (++j < no_subparts); } while (++j < num_subparts);
} }
else else
{ {
...@@ -5478,7 +5471,7 @@ static bool write_log_changed_partitions(ALTER_PARTITION_PARAM_TYPE *lpt, ...@@ -5478,7 +5471,7 @@ static bool write_log_changed_partitions(ALTER_PARTITION_PARAM_TYPE *lpt,
insert_part_info_log_entry_list(part_info, log_entry); insert_part_info_log_entry_list(part_info, log_entry);
} }
} }
} while (++i < no_elements); } while (++i < num_elements);
DBUG_RETURN(FALSE); DBUG_RETURN(FALSE);
} }
...@@ -5504,14 +5497,14 @@ static bool write_log_dropped_partitions(ALTER_PARTITION_PARAM_TYPE *lpt, ...@@ -5504,14 +5497,14 @@ static bool write_log_dropped_partitions(ALTER_PARTITION_PARAM_TYPE *lpt,
char tmp_path[FN_LEN]; char tmp_path[FN_LEN];
List_iterator<partition_element> part_it(part_info->partitions); List_iterator<partition_element> part_it(part_info->partitions);
List_iterator<partition_element> temp_it(part_info->temp_partitions); List_iterator<partition_element> temp_it(part_info->temp_partitions);
uint no_temp_partitions= part_info->temp_partitions.elements; uint num_temp_partitions= part_info->temp_partitions.elements;
uint no_elements= part_info->partitions.elements; uint num_elements= part_info->partitions.elements;
DBUG_ENTER("write_log_dropped_partitions"); DBUG_ENTER("write_log_dropped_partitions");
ddl_log_entry.action_type= DDL_LOG_DELETE_ACTION; ddl_log_entry.action_type= DDL_LOG_DELETE_ACTION;
if (temp_list) if (temp_list)
no_elements= no_temp_partitions; num_elements= num_temp_partitions;
while (no_elements--) while (num_elements--)
{ {
partition_element *part_elem; partition_element *part_elem;
if (temp_list) if (temp_list)
...@@ -5525,14 +5518,14 @@ static bool write_log_dropped_partitions(ALTER_PARTITION_PARAM_TYPE *lpt, ...@@ -5525,14 +5518,14 @@ static bool write_log_dropped_partitions(ALTER_PARTITION_PARAM_TYPE *lpt,
uint name_variant; uint name_variant;
if (part_elem->part_state == PART_CHANGED || if (part_elem->part_state == PART_CHANGED ||
(part_elem->part_state == PART_TO_BE_ADDED && (part_elem->part_state == PART_TO_BE_ADDED &&
no_temp_partitions)) num_temp_partitions))
name_variant= TEMP_PART_NAME; name_variant= TEMP_PART_NAME;
else else
name_variant= NORMAL_PART_NAME; name_variant= NORMAL_PART_NAME;
if (part_info->is_sub_partitioned()) if (part_info->is_sub_partitioned())
{ {
List_iterator<partition_element> sub_it(part_elem->subpartitions); List_iterator<partition_element> sub_it(part_elem->subpartitions);
uint no_subparts= part_info->no_subparts; uint num_subparts= part_info->num_subparts;
uint j= 0; uint j= 0;
do do
{ {
...@@ -5552,7 +5545,7 @@ static bool write_log_dropped_partitions(ALTER_PARTITION_PARAM_TYPE *lpt, ...@@ -5552,7 +5545,7 @@ static bool write_log_dropped_partitions(ALTER_PARTITION_PARAM_TYPE *lpt,
*next_entry= log_entry->entry_pos; *next_entry= log_entry->entry_pos;
sub_elem->log_entry= log_entry; sub_elem->log_entry= log_entry;
insert_part_info_log_entry_list(part_info, log_entry); insert_part_info_log_entry_list(part_info, log_entry);
} while (++j < no_subparts); } while (++j < num_subparts);
} }
else else
{ {
...@@ -6705,7 +6698,7 @@ static void set_up_range_analysis_info(partition_info *part_info) ...@@ -6705,7 +6698,7 @@ static void set_up_range_analysis_info(partition_info *part_info)
Check if get_part_iter_for_interval_via_walking() can be used for Check if get_part_iter_for_interval_via_walking() can be used for
partitioning partitioning
*/ */
if (part_info->no_part_fields == 1) if (part_info->num_part_fields == 1)
{ {
Field *field= part_info->part_field_array[0]; Field *field= part_info->part_field_array[0];
switch (field->type()) { switch (field->type()) {
...@@ -6727,7 +6720,7 @@ setup_subparts: ...@@ -6727,7 +6720,7 @@ setup_subparts:
Check if get_part_iter_for_interval_via_walking() can be used for Check if get_part_iter_for_interval_via_walking() can be used for
subpartitioning subpartitioning
*/ */
if (part_info->no_subpart_fields == 1) if (part_info->num_subpart_fields == 1)
{ {
Field *field= part_info->subpart_field_array[0]; Field *field= part_info->subpart_field_array[0];
switch (field->type()) { switch (field->type()) {
...@@ -6841,7 +6834,7 @@ typedef uint32 (*get_endpoint_func)(partition_info*, bool left_endpoint, ...@@ -6841,7 +6834,7 @@ typedef uint32 (*get_endpoint_func)(partition_info*, bool left_endpoint,
typedef uint32 (*get_col_endpoint_func)(partition_info*, bool left_endpoint, typedef uint32 (*get_col_endpoint_func)(partition_info*, bool left_endpoint,
bool include_endpoint, bool include_endpoint,
uint32 no_parts); uint32 num_parts);
/* /*
Partitioning Interval Analysis: Initialize the iterator for "mapping" case Partitioning Interval Analysis: Initialize the iterator for "mapping" case
...@@ -6883,10 +6876,10 @@ uint32 get_partition_id_cols_range_for_endpoint(partition_info *part_info, ...@@ -6883,10 +6876,10 @@ uint32 get_partition_id_cols_range_for_endpoint(partition_info *part_info,
bool include_endpoint, bool include_endpoint,
uint32 nparts) uint32 nparts)
{ {
uint max_partition= part_info->no_parts - 1; uint max_partition= part_info->num_parts - 1;
uint min_part_id= 0, max_part_id= max_partition, loc_part_id; uint min_part_id= 0, max_part_id= max_partition, loc_part_id;
part_column_list_val *range_col_array= part_info->range_col_array; part_column_list_val *range_col_array= part_info->range_col_array;
uint no_columns= part_info->part_field_list.elements; uint num_columns= part_info->part_field_list.elements;
bool tailf= !(left_endpoint ^ include_endpoint); bool tailf= !(left_endpoint ^ include_endpoint);
DBUG_ENTER("get_partition_id_cols_range_for_endpoint"); DBUG_ENTER("get_partition_id_cols_range_for_endpoint");
...@@ -6894,7 +6887,7 @@ uint32 get_partition_id_cols_range_for_endpoint(partition_info *part_info, ...@@ -6894,7 +6887,7 @@ uint32 get_partition_id_cols_range_for_endpoint(partition_info *part_info,
while (max_part_id > min_part_id) while (max_part_id > min_part_id)
{ {
loc_part_id= (max_part_id + min_part_id + 1) >> 1; loc_part_id= (max_part_id + min_part_id + 1) >> 1;
if (cmp_rec_and_tuple_prune(range_col_array + loc_part_id*no_columns, if (cmp_rec_and_tuple_prune(range_col_array + loc_part_id*num_columns,
nparts, tailf) >= 0) nparts, tailf) >= 0)
min_part_id= loc_part_id + 1; min_part_id= loc_part_id + 1;
else else
...@@ -6902,7 +6895,7 @@ uint32 get_partition_id_cols_range_for_endpoint(partition_info *part_info, ...@@ -6902,7 +6895,7 @@ uint32 get_partition_id_cols_range_for_endpoint(partition_info *part_info,
} }
loc_part_id= max_part_id; loc_part_id= max_part_id;
if (loc_part_id < max_partition && if (loc_part_id < max_partition &&
cmp_rec_and_tuple_prune(range_col_array + (loc_part_id+1)*no_columns, cmp_rec_and_tuple_prune(range_col_array + (loc_part_id+1)*num_columns,
nparts, tailf) >= 0 nparts, tailf) >= 0
) )
{ {
...@@ -6910,7 +6903,7 @@ uint32 get_partition_id_cols_range_for_endpoint(partition_info *part_info, ...@@ -6910,7 +6903,7 @@ uint32 get_partition_id_cols_range_for_endpoint(partition_info *part_info,
} }
if (left_endpoint) if (left_endpoint)
{ {
if (cmp_rec_and_tuple_prune(range_col_array + loc_part_id*no_columns, if (cmp_rec_and_tuple_prune(range_col_array + loc_part_id*num_columns,
nparts, tailf) >= 0) nparts, tailf) >= 0)
loc_part_id++; loc_part_id++;
} }
...@@ -6919,7 +6912,7 @@ uint32 get_partition_id_cols_range_for_endpoint(partition_info *part_info, ...@@ -6919,7 +6912,7 @@ uint32 get_partition_id_cols_range_for_endpoint(partition_info *part_info,
if (loc_part_id < max_partition) if (loc_part_id < max_partition)
{ {
int res= cmp_rec_and_tuple_prune(range_col_array + int res= cmp_rec_and_tuple_prune(range_col_array +
loc_part_id * no_columns, loc_part_id * num_columns,
nparts, tailf); nparts, tailf);
if (!res) if (!res)
loc_part_id += test(include_endpoint); loc_part_id += test(include_endpoint);
...@@ -6969,7 +6962,7 @@ int get_part_iter_for_interval_cols_via_map(partition_info *part_info, ...@@ -6969,7 +6962,7 @@ int get_part_iter_for_interval_cols_via_map(partition_info *part_info,
nparts); nparts);
} }
if (flags & NO_MAX_RANGE) if (flags & NO_MAX_RANGE)
part_iter->part_nums.end= part_info->no_parts; part_iter->part_nums.end= part_info->num_parts;
else else
{ {
// Copy from max_value to record // Copy from max_value to record
...@@ -7012,7 +7005,7 @@ int get_part_iter_for_interval_via_mapping(partition_info *part_info, ...@@ -7012,7 +7005,7 @@ int get_part_iter_for_interval_via_mapping(partition_info *part_info,
get_endpoint= get_partition_id_range_for_endpoint_charset; get_endpoint= get_partition_id_range_for_endpoint_charset;
else else
get_endpoint= get_partition_id_range_for_endpoint; get_endpoint= get_partition_id_range_for_endpoint;
max_endpoint_val= part_info->no_parts; max_endpoint_val= part_info->num_parts;
part_iter->get_next= get_next_partition_id_range; part_iter->get_next= get_next_partition_id_range;
} }
else if (part_info->part_type == LIST_PARTITION) else if (part_info->part_type == LIST_PARTITION)
...@@ -7022,7 +7015,7 @@ int get_part_iter_for_interval_via_mapping(partition_info *part_info, ...@@ -7022,7 +7015,7 @@ int get_part_iter_for_interval_via_mapping(partition_info *part_info,
get_endpoint= get_list_array_idx_for_endpoint_charset; get_endpoint= get_list_array_idx_for_endpoint_charset;
else else
get_endpoint= get_list_array_idx_for_endpoint; get_endpoint= get_list_array_idx_for_endpoint;
max_endpoint_val= part_info->no_list_values; max_endpoint_val= part_info->num_list_values;
part_iter->get_next= get_next_partition_id_list; part_iter->get_next= get_next_partition_id_list;
part_iter->part_info= part_info; part_iter->part_info= part_info;
if (max_endpoint_val == 0) if (max_endpoint_val == 0)
...@@ -7166,13 +7159,13 @@ int get_part_iter_for_interval_via_walking(partition_info *part_info, ...@@ -7166,13 +7159,13 @@ int get_part_iter_for_interval_via_walking(partition_info *part_info,
if (is_subpart) if (is_subpart)
{ {
field= part_info->subpart_field_array[0]; field= part_info->subpart_field_array[0];
total_parts= part_info->no_subparts; total_parts= part_info->num_subparts;
get_next_func= get_next_subpartition_via_walking; get_next_func= get_next_subpartition_via_walking;
} }
else else
{ {
field= part_info->part_field_array[0]; field= part_info->part_field_array[0];
total_parts= part_info->no_parts; total_parts= part_info->num_parts;
get_next_func= get_next_partition_via_walking; get_next_func= get_next_partition_via_walking;
} }
......
...@@ -65,7 +65,7 @@ int get_part_for_delete(const uchar *buf, const uchar *rec0, ...@@ -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); void prune_partition_set(const TABLE *table, part_id_range *part_spec);
bool check_partition_info(partition_info *part_info,handlerton **eng_type, bool check_partition_info(partition_info *part_info,handlerton **eng_type,
TABLE *table, handler *file, HA_CREATE_INFO *info); 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); bool fix_partition_func(THD *thd, TABLE *table, 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,
......
...@@ -3700,9 +3700,9 @@ bool mysql_create_table_no_lock(THD *thd, ...@@ -3700,9 +3700,9 @@ bool mysql_create_table_no_lock(THD *thd,
creates a proper .par file. The current part_info object is creates a proper .par file. The current part_info object is
only used to create the frm-file and .par-file. only used to create the frm-file and .par-file.
*/ */
if (part_info->use_default_no_partitions && if (part_info->use_default_num_partitions &&
part_info->no_parts && part_info->num_parts &&
(int)part_info->no_parts != (int)part_info->num_parts !=
file->get_default_no_partitions(create_info)) file->get_default_no_partitions(create_info))
{ {
uint i; uint i;
...@@ -3713,13 +3713,13 @@ bool mysql_create_table_no_lock(THD *thd, ...@@ -3713,13 +3713,13 @@ bool mysql_create_table_no_lock(THD *thd,
(part_it++)->part_state= PART_TO_BE_DROPPED; (part_it++)->part_state= PART_TO_BE_DROPPED;
} }
else if (part_info->is_sub_partitioned() && else if (part_info->is_sub_partitioned() &&
part_info->use_default_no_subpartitions && part_info->use_default_num_subpartitions &&
part_info->no_subparts && part_info->num_subparts &&
(int)part_info->no_subparts != (int)part_info->num_subparts !=
file->get_default_no_partitions(create_info)) file->get_default_no_partitions(create_info))
{ {
DBUG_ASSERT(thd->lex->sql_command != SQLCOM_CREATE_TABLE); 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) else if (create_info->db_type != engine_type)
...@@ -4531,11 +4531,11 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables, ...@@ -4531,11 +4531,11 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
my_error(ER_PARTITION_MGMT_ON_NONPARTITIONED, MYF(0)); my_error(ER_PARTITION_MGMT_ON_NONPARTITIONED, MYF(0));
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
uint no_parts_found; uint num_parts_found;
uint no_parts_opt= alter_info->partition_names.elements; uint num_parts_opt= alter_info->partition_names.elements;
no_parts_found= set_part_state(alter_info, table->table->part_info, num_parts_found= set_part_state(alter_info, table->table->part_info,
PART_CHANGED); PART_CHANGED);
if (no_parts_found != no_parts_opt && if (num_parts_found != num_parts_opt &&
(!(alter_info->flags & ALTER_ALL_PARTITION))) (!(alter_info->flags & ALTER_ALL_PARTITION)))
{ {
char buff[FN_REFLEN + MYSQL_ERRMSG_SIZE]; char buff[FN_REFLEN + MYSQL_ERRMSG_SIZE];
......
...@@ -3810,7 +3810,7 @@ partition_entry: ...@@ -3810,7 +3810,7 @@ partition_entry:
; ;
partition: 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: part_type_def:
...@@ -3895,20 +3895,20 @@ sub_part_func: ...@@ -3895,20 +3895,20 @@ sub_part_func:
; ;
opt_no_parts: opt_num_parts:
/* empty */ {} /* empty */ {}
| PARTITIONS_SYM real_ulong_num | PARTITIONS_SYM real_ulong_num
{ {
uint no_parts= $2; uint num_parts= $2;
partition_info *part_info= Lex->part_info; partition_info *part_info= Lex->part_info;
if (no_parts == 0) if (num_parts == 0)
{ {
my_error(ER_NO_PARTS_ERROR, MYF(0), "partitions"); my_error(ER_NO_PARTS_ERROR, MYF(0), "partitions");
MYSQL_YYABORT; MYSQL_YYABORT;
} }
part_info->no_parts= no_parts; part_info->num_parts= num_parts;
part_info->use_default_no_partitions= FALSE; part_info->use_default_num_partitions= FALSE;
} }
; ;
...@@ -3916,7 +3916,7 @@ opt_sub_part: ...@@ -3916,7 +3916,7 @@ opt_sub_part:
/* empty */ {} /* empty */ {}
| SUBPARTITION_SYM BY opt_linear HASH_SYM sub_part_func | SUBPARTITION_SYM BY opt_linear HASH_SYM sub_part_func
{ Lex->part_info->subpart_type= HASH_PARTITION; } { Lex->part_info->subpart_type= HASH_PARTITION; }
opt_no_subparts {} opt_num_subparts {}
| SUBPARTITION_SYM BY opt_linear KEY_SYM | SUBPARTITION_SYM BY opt_linear KEY_SYM
'(' sub_part_field_list ')' '(' sub_part_field_list ')'
{ {
...@@ -3924,7 +3924,7 @@ opt_sub_part: ...@@ -3924,7 +3924,7 @@ opt_sub_part:
part_info->subpart_type= HASH_PARTITION; part_info->subpart_type= HASH_PARTITION;
part_info->list_of_subpart_fields= TRUE; part_info->list_of_subpart_fields= TRUE;
} }
opt_no_subparts {} opt_num_subparts {}
; ;
sub_part_field_list: sub_part_field_list:
...@@ -3966,19 +3966,19 @@ part_func_expr: ...@@ -3966,19 +3966,19 @@ part_func_expr:
} }
; ;
opt_no_subparts: opt_num_subparts:
/* empty */ {} /* empty */ {}
| SUBPARTITIONS_SYM real_ulong_num | SUBPARTITIONS_SYM real_ulong_num
{ {
uint no_parts= $2; uint num_parts= $2;
LEX *lex= Lex; LEX *lex= Lex;
if (no_parts == 0) if (num_parts == 0)
{ {
my_error(ER_NO_PARTS_ERROR, MYF(0), "subpartitions"); my_error(ER_NO_PARTS_ERROR, MYF(0), "subpartitions");
MYSQL_YYABORT; MYSQL_YYABORT;
} }
lex->part_info->no_subparts= no_parts; lex->part_info->num_subparts= num_parts;
lex->part_info->use_default_no_subpartitions= FALSE; lex->part_info->use_default_num_subpartitions= FALSE;
} }
; ;
...@@ -3989,9 +3989,9 @@ part_defs: ...@@ -3989,9 +3989,9 @@ part_defs:
{ {
partition_info *part_info= Lex->part_info; partition_info *part_info= Lex->part_info;
uint count_curr_parts= part_info->partitions.elements; 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) count_curr_parts)
{ {
my_parse_error(ER(ER_PARTITION_WRONG_NO_PART_ERROR)); my_parse_error(ER(ER_PARTITION_WRONG_NO_PART_ERROR));
...@@ -4000,7 +4000,7 @@ part_defs: ...@@ -4000,7 +4000,7 @@ part_defs:
} }
else if (count_curr_parts > 0) 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; part_info->count_curr_subparts= 0;
} }
...@@ -4026,7 +4026,7 @@ part_definition: ...@@ -4026,7 +4026,7 @@ part_definition:
part_info->curr_part_elem= p_elem; part_info->curr_part_elem= p_elem;
part_info->current_partition= p_elem; part_info->current_partition= p_elem;
part_info->use_default_partitions= FALSE; part_info->use_default_partitions= FALSE;
part_info->use_default_no_partitions= FALSE; part_info->use_default_num_partitions= FALSE;
} }
part_name part_name
opt_part_values opt_part_values
...@@ -4338,7 +4338,7 @@ opt_sub_partition: ...@@ -4338,7 +4338,7 @@ opt_sub_partition:
/* empty */ /* empty */
{ {
partition_info *part_info= Lex->part_info; partition_info *part_info= Lex->part_info;
if (part_info->no_subparts != 0 && if (part_info->num_subparts != 0 &&
!part_info->use_default_subpartitions) !part_info->use_default_subpartitions)
{ {
/* /*
...@@ -4352,9 +4352,9 @@ opt_sub_partition: ...@@ -4352,9 +4352,9 @@ opt_sub_partition:
| '(' sub_part_list ')' | '(' sub_part_list ')'
{ {
partition_info *part_info= Lex->part_info; 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) part_info->count_curr_subparts)
{ {
my_parse_error(ER(ER_PARTITION_WRONG_NO_SUBPART_ERROR)); my_parse_error(ER(ER_PARTITION_WRONG_NO_SUBPART_ERROR));
...@@ -4368,7 +4368,7 @@ opt_sub_partition: ...@@ -4368,7 +4368,7 @@ opt_sub_partition:
my_parse_error(ER(ER_PARTITION_WRONG_NO_SUBPART_ERROR)); my_parse_error(ER(ER_PARTITION_WRONG_NO_SUBPART_ERROR));
MYSQL_YYABORT; 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; part_info->count_curr_subparts= 0;
} }
...@@ -4410,7 +4410,7 @@ sub_part_definition: ...@@ -4410,7 +4410,7 @@ sub_part_definition:
} }
part_info->curr_part_elem= sub_p_elem; part_info->curr_part_elem= sub_p_elem;
part_info->use_default_subpartitions= FALSE; 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++; part_info->count_curr_subparts++;
} }
sub_name opt_part_options {} sub_name opt_part_options {}
...@@ -5850,7 +5850,7 @@ alter_commands: ...@@ -5850,7 +5850,7 @@ alter_commands:
LEX *lex= Lex; LEX *lex= Lex;
lex->alter_info.flags|= ALTER_COALESCE_PARTITION; lex->alter_info.flags|= ALTER_COALESCE_PARTITION;
lex->no_write_to_binlog= $3; lex->no_write_to_binlog= $3;
lex->alter_info.no_parts= $4; lex->alter_info.num_parts= $4;
} }
| reorg_partition_rule | reorg_partition_rule
; ;
...@@ -5892,12 +5892,11 @@ add_part_extra: ...@@ -5892,12 +5892,11 @@ add_part_extra:
| '(' part_def_list ')' | '(' part_def_list ')'
{ {
LEX *lex= Lex; 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 | PARTITIONS_SYM real_ulong_num
{ {
LEX *lex= Lex; Lex->part_info->num_parts= $2;
lex->part_info->no_parts= $2;
} }
; ;
...@@ -5928,7 +5927,7 @@ reorg_parts_rule: ...@@ -5928,7 +5927,7 @@ reorg_parts_rule:
INTO '(' part_def_list ')' INTO '(' part_def_list ')'
{ {
partition_info *part_info= Lex->part_info; 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