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
This commit is contained in:
parent
3b29941f5d
commit
dc97402c11
@ -1,4 +1,33 @@
|
||||
drop table if exists t1;
|
||||
create table t1 (a int)
|
||||
partition by list (a)
|
||||
( partition p0 values in (1),
|
||||
partition p1 values in (1));
|
||||
ERROR HY000: Multiple definition of same constant in list partitioning
|
||||
create table t1 (a int)
|
||||
partition by list (a)
|
||||
( partition p0 values in (2, 1),
|
||||
partition p1 values in (4, NULL, 3));
|
||||
insert into t1 values (1);
|
||||
insert into t1 values (2);
|
||||
insert into t1 values (3);
|
||||
insert into t1 values (4);
|
||||
insert into t1 values (NULL);
|
||||
insert into t1 values (5);
|
||||
ERROR HY000: Table has no partition for value 5
|
||||
drop table t1;
|
||||
create table t1 (a int)
|
||||
partition by list column_list(a)
|
||||
( partition p0 values in (column_list(2), column_list(1)),
|
||||
partition p1 values in (column_list(4), column_list(NULL), column_list(3)));
|
||||
insert into t1 values (1);
|
||||
insert into t1 values (2);
|
||||
insert into t1 values (3);
|
||||
insert into t1 values (4);
|
||||
insert into t1 values (NULL);
|
||||
insert into t1 values (5);
|
||||
ERROR HY000: Table has no partition for value from column_list
|
||||
drop table t1;
|
||||
create table t1 (a int, b char(10), c varchar(25), d datetime)
|
||||
partition by range column_list(a,b,c,d)
|
||||
subpartition by hash (to_seconds(d))
|
||||
|
@ -8,6 +8,38 @@
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
|
||||
--error ER_MULTIPLE_DEF_CONST_IN_LIST_PART_ERROR
|
||||
create table t1 (a int)
|
||||
partition by list (a)
|
||||
( partition p0 values in (1),
|
||||
partition p1 values in (1));
|
||||
|
||||
create table t1 (a int)
|
||||
partition by list (a)
|
||||
( partition p0 values in (2, 1),
|
||||
partition p1 values in (4, NULL, 3));
|
||||
insert into t1 values (1);
|
||||
insert into t1 values (2);
|
||||
insert into t1 values (3);
|
||||
insert into t1 values (4);
|
||||
insert into t1 values (NULL);
|
||||
--error ER_NO_PARTITION_FOR_GIVEN_VALUE
|
||||
insert into t1 values (5);
|
||||
drop table t1;
|
||||
|
||||
create table t1 (a int)
|
||||
partition by list column_list(a)
|
||||
( partition p0 values in (column_list(2), column_list(1)),
|
||||
partition p1 values in (column_list(4), column_list(NULL), column_list(3)));
|
||||
insert into t1 values (1);
|
||||
insert into t1 values (2);
|
||||
insert into t1 values (3);
|
||||
insert into t1 values (4);
|
||||
insert into t1 values (NULL);
|
||||
--error ER_NO_PARTITION_FOR_GIVEN_VALUE
|
||||
insert into t1 values (5);
|
||||
drop table t1;
|
||||
|
||||
create table t1 (a int, b char(10), c varchar(25), d datetime)
|
||||
partition by range column_list(a,b,c,d)
|
||||
subpartition by hash (to_seconds(d))
|
||||
|
@ -244,7 +244,7 @@ void ha_partition::init_handler_variables()
|
||||
/*
|
||||
this allows blackhole to work properly
|
||||
*/
|
||||
m_no_locks= 0;
|
||||
m_num_locks= 0;
|
||||
|
||||
#ifdef DONT_HAVE_TO_BE_INITALIZED
|
||||
m_start_key.flag= 0;
|
||||
@ -579,8 +579,8 @@ int ha_partition::drop_partitions(const char *path)
|
||||
{
|
||||
List_iterator<partition_element> part_it(m_part_info->partitions);
|
||||
char part_name_buff[FN_REFLEN];
|
||||
uint no_parts= m_part_info->partitions.elements;
|
||||
uint no_subparts= m_part_info->no_subparts;
|
||||
uint num_parts= m_part_info->partitions.elements;
|
||||
uint num_subparts= m_part_info->num_subparts;
|
||||
uint i= 0;
|
||||
uint name_variant;
|
||||
int ret_error;
|
||||
@ -610,7 +610,7 @@ int ha_partition::drop_partitions(const char *path)
|
||||
do
|
||||
{
|
||||
partition_element *sub_elem= sub_it++;
|
||||
part= i * no_subparts + j;
|
||||
part= i * num_subparts + j;
|
||||
create_subpartition_name(part_name_buff, path,
|
||||
part_elem->partition_name,
|
||||
sub_elem->partition_name, name_variant);
|
||||
@ -620,7 +620,7 @@ int ha_partition::drop_partitions(const char *path)
|
||||
error= ret_error;
|
||||
if (deactivate_ddl_log_entry(sub_elem->log_entry->entry_pos))
|
||||
error= 1;
|
||||
} while (++j < no_subparts);
|
||||
} while (++j < num_subparts);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -639,7 +639,7 @@ int ha_partition::drop_partitions(const char *path)
|
||||
else
|
||||
part_elem->part_state= PART_IS_DROPPED;
|
||||
}
|
||||
} while (++i < no_parts);
|
||||
} while (++i < num_parts);
|
||||
VOID(sync_ddl_log());
|
||||
DBUG_RETURN(error);
|
||||
}
|
||||
@ -670,9 +670,9 @@ int ha_partition::rename_partitions(const char *path)
|
||||
List_iterator<partition_element> temp_it(m_part_info->temp_partitions);
|
||||
char part_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 no_subparts= m_part_info->no_subparts;
|
||||
uint num_subparts= m_part_info->num_subparts;
|
||||
uint i= 0;
|
||||
uint j= 0;
|
||||
int error= 0;
|
||||
@ -720,7 +720,7 @@ int ha_partition::rename_partitions(const char *path)
|
||||
error= 1;
|
||||
else
|
||||
sub_elem->log_entry= NULL; /* Indicate success */
|
||||
} while (++j < no_subparts);
|
||||
} while (++j < num_subparts);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -776,7 +776,7 @@ int ha_partition::rename_partitions(const char *path)
|
||||
do
|
||||
{
|
||||
sub_elem= sub_it++;
|
||||
part= i * no_subparts + j;
|
||||
part= i * num_subparts + j;
|
||||
create_subpartition_name(norm_name_buff, path,
|
||||
part_elem->partition_name,
|
||||
sub_elem->partition_name,
|
||||
@ -805,7 +805,7 @@ int ha_partition::rename_partitions(const char *path)
|
||||
error= 1;
|
||||
else
|
||||
sub_elem->log_entry= NULL;
|
||||
} while (++j < no_subparts);
|
||||
} while (++j < num_subparts);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -837,7 +837,7 @@ int ha_partition::rename_partitions(const char *path)
|
||||
part_elem->log_entry= NULL;
|
||||
}
|
||||
}
|
||||
} while (++i < no_parts);
|
||||
} while (++i < num_parts);
|
||||
VOID(sync_ddl_log());
|
||||
DBUG_RETURN(error);
|
||||
}
|
||||
@ -1047,8 +1047,8 @@ int ha_partition::handle_opt_partitions(THD *thd, HA_CHECK_OPT *check_opt,
|
||||
uint flag)
|
||||
{
|
||||
List_iterator<partition_element> part_it(m_part_info->partitions);
|
||||
uint no_parts= m_part_info->no_parts;
|
||||
uint no_subparts= m_part_info->no_subparts;
|
||||
uint num_parts= m_part_info->num_parts;
|
||||
uint num_subparts= m_part_info->num_subparts;
|
||||
uint i= 0;
|
||||
int error;
|
||||
DBUG_ENTER("ha_partition::handle_opt_partitions");
|
||||
@ -1072,7 +1072,7 @@ int ha_partition::handle_opt_partitions(THD *thd, HA_CHECK_OPT *check_opt,
|
||||
do
|
||||
{
|
||||
sub_elem= subpart_it++;
|
||||
part= i * no_subparts + j;
|
||||
part= i * num_subparts + j;
|
||||
DBUG_PRINT("info", ("Optimize subpartition %u (%s)",
|
||||
part, sub_elem->partition_name));
|
||||
#ifdef NOT_USED
|
||||
@ -1096,7 +1096,7 @@ int ha_partition::handle_opt_partitions(THD *thd, HA_CHECK_OPT *check_opt,
|
||||
}
|
||||
DBUG_RETURN(error);
|
||||
}
|
||||
} while (++j < no_subparts);
|
||||
} while (++j < num_subparts);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -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> t_it(m_part_info->temp_partitions);
|
||||
char part_name_buff[FN_REFLEN];
|
||||
uint no_parts= m_part_info->partitions.elements;
|
||||
uint no_subparts= m_part_info->no_subparts;
|
||||
uint num_parts= m_part_info->partitions.elements;
|
||||
uint num_subparts= m_part_info->num_subparts;
|
||||
uint i= 0;
|
||||
uint no_remain_partitions, part_count, orig_count;
|
||||
uint num_remain_partitions, part_count, orig_count;
|
||||
handler **new_file_array;
|
||||
int error= 1;
|
||||
bool first;
|
||||
@ -1347,7 +1347,7 @@ int ha_partition::change_partitions(HA_CREATE_INFO *create_info,
|
||||
part_name_buff)));
|
||||
m_reorged_parts= 0;
|
||||
if (!m_part_info->is_sub_partitioned())
|
||||
no_subparts= 1;
|
||||
num_subparts= 1;
|
||||
|
||||
/*
|
||||
Step 1:
|
||||
@ -1356,7 +1356,7 @@ int ha_partition::change_partitions(HA_CREATE_INFO *create_info,
|
||||
*/
|
||||
if (temp_partitions)
|
||||
{
|
||||
m_reorged_parts= temp_partitions * no_subparts;
|
||||
m_reorged_parts= temp_partitions * num_subparts;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1366,9 +1366,9 @@ int ha_partition::change_partitions(HA_CREATE_INFO *create_info,
|
||||
if (part_elem->part_state == PART_CHANGED ||
|
||||
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 &&
|
||||
!(m_reorged_file= (handler**)sql_calloc(sizeof(handler*)*
|
||||
@ -1383,10 +1383,10 @@ int ha_partition::change_partitions(HA_CREATE_INFO *create_info,
|
||||
Calculate number of partitions after change and allocate space for
|
||||
their handler references.
|
||||
*/
|
||||
no_remain_partitions= 0;
|
||||
num_remain_partitions= 0;
|
||||
if (temp_partitions)
|
||||
{
|
||||
no_remain_partitions= no_parts * no_subparts;
|
||||
num_remain_partitions= num_parts * num_subparts;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -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_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*)*
|
||||
(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);
|
||||
}
|
||||
m_added_file= &new_file_array[no_remain_partitions + 1];
|
||||
m_added_file= &new_file_array[num_remain_partitions + 1];
|
||||
|
||||
/*
|
||||
Step 3:
|
||||
@ -1428,9 +1428,9 @@ int ha_partition::change_partitions(HA_CREATE_INFO *create_info,
|
||||
part_elem->part_state == PART_REORGED_DROPPED)
|
||||
{
|
||||
memcpy((void*)&m_reorged_file[part_count],
|
||||
(void*)&m_file[i*no_subparts],
|
||||
sizeof(handler*)*no_subparts);
|
||||
part_count+= no_subparts;
|
||||
(void*)&m_file[i*num_subparts],
|
||||
sizeof(handler*)*num_subparts);
|
||||
part_count+= num_subparts;
|
||||
}
|
||||
else if (first && temp_partitions &&
|
||||
part_elem->part_state == PART_TO_BE_ADDED)
|
||||
@ -1445,11 +1445,11 @@ int ha_partition::change_partitions(HA_CREATE_INFO *create_info,
|
||||
ones used to be.
|
||||
*/
|
||||
first= FALSE;
|
||||
DBUG_ASSERT(((i*no_subparts) + m_reorged_parts) <= m_file_tot_parts);
|
||||
memcpy((void*)m_reorged_file, &m_file[i*no_subparts],
|
||||
DBUG_ASSERT(((i*num_subparts) + m_reorged_parts) <= m_file_tot_parts);
|
||||
memcpy((void*)m_reorged_file, &m_file[i*num_subparts],
|
||||
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,
|
||||
partition_element *part_elem= part_it++;
|
||||
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],
|
||||
sizeof(handler*)*no_subparts);
|
||||
part_count+= no_subparts;
|
||||
orig_count+= no_subparts;
|
||||
sizeof(handler*)*num_subparts);
|
||||
part_count+= num_subparts;
|
||||
orig_count+= num_subparts;
|
||||
}
|
||||
else if (part_elem->part_state == PART_CHANGED ||
|
||||
part_elem->part_state == PART_TO_BE_ADDED)
|
||||
@ -1487,16 +1487,16 @@ int ha_partition::change_partitions(HA_CREATE_INFO *create_info,
|
||||
mem_alloc_error(sizeof(handler));
|
||||
DBUG_RETURN(ER_OUTOFMEMORY);
|
||||
}
|
||||
} while (++j < no_subparts);
|
||||
} while (++j < num_subparts);
|
||||
if (part_elem->part_state == PART_CHANGED)
|
||||
orig_count+= no_subparts;
|
||||
orig_count+= num_subparts;
|
||||
else if (temp_partitions && first)
|
||||
{
|
||||
orig_count+= (no_subparts * temp_partitions);
|
||||
orig_count+= (num_subparts * temp_partitions);
|
||||
first= FALSE;
|
||||
}
|
||||
}
|
||||
} while (++i < no_parts);
|
||||
} while (++i < num_parts);
|
||||
first= FALSE;
|
||||
/*
|
||||
Step 5:
|
||||
@ -1533,7 +1533,7 @@ int ha_partition::change_partitions(HA_CREATE_INFO *create_info,
|
||||
part_elem->partition_name,
|
||||
sub_elem->partition_name,
|
||||
name_variant);
|
||||
part= i * no_subparts + j;
|
||||
part= i * num_subparts + j;
|
||||
DBUG_PRINT("info", ("Add subpartition %s", part_name_buff));
|
||||
if ((error= prepare_new_partition(table, create_info,
|
||||
new_file_array[part],
|
||||
@ -1544,7 +1544,7 @@ int ha_partition::change_partitions(HA_CREATE_INFO *create_info,
|
||||
DBUG_RETURN(error);
|
||||
}
|
||||
m_added_file[part_count++]= new_file_array[part];
|
||||
} while (++j < no_subparts);
|
||||
} while (++j < num_subparts);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1563,7 +1563,7 @@ int ha_partition::change_partitions(HA_CREATE_INFO *create_info,
|
||||
m_added_file[part_count++]= new_file_array[i];
|
||||
}
|
||||
}
|
||||
} while (++i < no_parts);
|
||||
} while (++i < num_parts);
|
||||
|
||||
/*
|
||||
Step 6:
|
||||
@ -1580,7 +1580,7 @@ int ha_partition::change_partitions(HA_CREATE_INFO *create_info,
|
||||
part_elem->part_state= PART_IS_CHANGED;
|
||||
else if (part_elem->part_state == PART_REORGED_DROPPED)
|
||||
part_elem->part_state= PART_TO_BE_DROPPED;
|
||||
} while (++i < no_parts);
|
||||
} while (++i < num_parts);
|
||||
for (i= 0; i < temp_partitions; i++)
|
||||
{
|
||||
partition_element *part_elem= t_it++;
|
||||
@ -1621,9 +1621,9 @@ int ha_partition::copy_partitions(ulonglong * const copied,
|
||||
if (m_part_info->linear_hash_ind)
|
||||
{
|
||||
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
|
||||
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)
|
||||
@ -1902,7 +1902,7 @@ partition_element *ha_partition::find_partition_element(uint part_id)
|
||||
uint curr_part_id= 0;
|
||||
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;
|
||||
part_elem= part_it++;
|
||||
@ -1910,7 +1910,7 @@ partition_element *ha_partition::find_partition_element(uint part_id)
|
||||
{
|
||||
uint j;
|
||||
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++;
|
||||
if (part_id == curr_part_id++)
|
||||
@ -2031,7 +2031,7 @@ bool ha_partition::create_handler_file(const char *name)
|
||||
{
|
||||
partition_element *part_elem, *subpart_elem;
|
||||
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_len_words, tot_len_byte, chksum, tot_name_words;
|
||||
char *name_buffer_ptr;
|
||||
@ -2044,11 +2044,11 @@ bool ha_partition::create_handler_file(const char *name)
|
||||
List_iterator_fast <partition_element> part_it(m_part_info->partitions);
|
||||
DBUG_ENTER("create_handler_file");
|
||||
|
||||
no_parts= m_part_info->partitions.elements;
|
||||
DBUG_PRINT("info", ("table name = %s, no_parts = %u", name,
|
||||
no_parts));
|
||||
num_parts= m_part_info->partitions.elements;
|
||||
DBUG_PRINT("info", ("table name = %s, num_parts = %u", name,
|
||||
num_parts));
|
||||
tot_name_len= 0;
|
||||
for (i= 0; i < no_parts; i++)
|
||||
for (i= 0; i < num_parts; i++)
|
||||
{
|
||||
part_elem= part_it++;
|
||||
if (part_elem->part_state != PART_NORMAL &&
|
||||
@ -2066,7 +2066,7 @@ bool ha_partition::create_handler_file(const char *name)
|
||||
else
|
||||
{
|
||||
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++;
|
||||
tablename_to_filename(subpart_elem->partition_name,
|
||||
@ -2100,7 +2100,7 @@ bool ha_partition::create_handler_file(const char *name)
|
||||
engine_array= (file_buffer + 12);
|
||||
name_buffer_ptr= (char*) (file_buffer + ((4 + tot_partition_words) * 4));
|
||||
part_it.rewind();
|
||||
for (i= 0; i < no_parts; i++)
|
||||
for (i= 0; i < num_parts; i++)
|
||||
{
|
||||
part_elem= part_it++;
|
||||
if (part_elem->part_state != PART_NORMAL &&
|
||||
@ -2118,7 +2118,7 @@ bool ha_partition::create_handler_file(const char *name)
|
||||
else
|
||||
{
|
||||
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++;
|
||||
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)
|
||||
}
|
||||
m_file_tot_parts= m_tot_parts;
|
||||
bzero((char*) m_file, alloc_len);
|
||||
DBUG_ASSERT(m_part_info->no_parts > 0);
|
||||
DBUG_ASSERT(m_part_info->num_parts > 0);
|
||||
|
||||
i= 0;
|
||||
part_count= 0;
|
||||
@ -2267,7 +2267,7 @@ bool ha_partition::new_handlers_from_part_info(MEM_ROOT *mem_root)
|
||||
part_elem= part_it++;
|
||||
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,
|
||||
part_elem->engine_type)))
|
||||
@ -2284,7 +2284,7 @@ bool ha_partition::new_handlers_from_part_info(MEM_ROOT *mem_root)
|
||||
DBUG_PRINT("info", ("engine_type: %u",
|
||||
(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)
|
||||
{
|
||||
DBUG_PRINT("info", ("MyISAM"));
|
||||
@ -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,
|
||||
test_if_locked)))
|
||||
goto err_handler;
|
||||
m_no_locks+= (*file)->lock_count();
|
||||
m_num_locks+= (*file)->lock_count();
|
||||
name_buffer_ptr+= strlen(name_buffer_ptr) + 1;
|
||||
set_if_bigger(ref_length, ((*file)->ref_length));
|
||||
/*
|
||||
@ -2820,8 +2820,8 @@ int ha_partition::start_stmt(THD *thd, thr_lock_type lock_type)
|
||||
uint ha_partition::lock_count() const
|
||||
{
|
||||
DBUG_ENTER("ha_partition::lock_count");
|
||||
DBUG_PRINT("info", ("m_no_locks %d", m_no_locks));
|
||||
DBUG_RETURN(m_no_locks);
|
||||
DBUG_PRINT("info", ("m_num_locks %d", m_num_locks));
|
||||
DBUG_RETURN(m_num_locks);
|
||||
}
|
||||
|
||||
|
||||
|
@ -112,7 +112,7 @@ private:
|
||||
|
||||
uint m_reorged_parts; // Number of reorganised parts
|
||||
uint m_tot_parts; // Total number of partitions;
|
||||
uint m_no_locks; // For engines like ha_blackhole, which needs no locks
|
||||
uint m_num_locks; // For engines like ha_blackhole, which needs no locks
|
||||
uint m_last_part; // Last file that we update,write,read
|
||||
int m_lock_type; // Remembers type of last
|
||||
// external_lock
|
||||
@ -239,10 +239,10 @@ public:
|
||||
size_t pack_frm_len);
|
||||
virtual int drop_partitions(const char *path);
|
||||
virtual int rename_partitions(const char *path);
|
||||
bool get_no_parts(const char *name, uint *no_parts)
|
||||
bool get_no_parts(const char *name, uint *num_parts)
|
||||
{
|
||||
DBUG_ENTER("ha_partition::get_no_parts");
|
||||
*no_parts= m_tot_parts;
|
||||
*num_parts= m_tot_parts;
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
virtual void change_table_ptr(TABLE *table_arg, TABLE_SHARE *share);
|
||||
|
@ -2638,7 +2638,7 @@ typedef struct st_part_prune_param
|
||||
/* Iterator to be used to obtain the "current" set of used partitions */
|
||||
PARTITION_ITERATOR part_iter;
|
||||
|
||||
/* Initialized bitmap of no_subparts size */
|
||||
/* Initialized bitmap of num_subparts size */
|
||||
MY_BITMAP subparts_bitmap;
|
||||
|
||||
uchar *cur_min_key;
|
||||
@ -2904,8 +2904,8 @@ static void mark_full_partition_used_no_parts(partition_info* part_info,
|
||||
static void mark_full_partition_used_with_parts(partition_info *part_info,
|
||||
uint32 part_id)
|
||||
{
|
||||
uint32 start= part_id * part_info->no_subparts;
|
||||
uint32 end= start + part_info->no_subparts;
|
||||
uint32 start= part_id * part_info->num_subparts;
|
||||
uint32 end= start + part_info->num_subparts;
|
||||
DBUG_ENTER("mark_full_partition_used_with_parts");
|
||||
|
||||
for (; start != end; start++)
|
||||
@ -3328,10 +3328,10 @@ int find_used_partitions(PART_PRUNE_PARAM *ppar, SEL_ARG *key_tree)
|
||||
while ((part_id= ppar->part_iter.get_next(&ppar->part_iter)) !=
|
||||
NOT_A_PARTITION_ID)
|
||||
{
|
||||
for (uint i= 0; i < ppar->part_info->no_subparts; i++)
|
||||
for (uint i= 0; i < ppar->part_info->num_subparts; i++)
|
||||
if (bitmap_is_set(&ppar->subparts_bitmap, i))
|
||||
bitmap_set_bit(&ppar->part_info->used_partitions,
|
||||
part_id * ppar->part_info->no_subparts + i);
|
||||
part_id * ppar->part_info->num_subparts + i);
|
||||
}
|
||||
goto pop_and_go_right;
|
||||
}
|
||||
@ -3393,7 +3393,7 @@ int find_used_partitions(PART_PRUNE_PARAM *ppar, SEL_ARG *key_tree)
|
||||
NOT_A_PARTITION_ID)
|
||||
{
|
||||
bitmap_set_bit(&part_info->used_partitions,
|
||||
part_id * part_info->no_subparts + subpart_id);
|
||||
part_id * part_info->num_subparts + subpart_id);
|
||||
}
|
||||
res= 1; /* Some partitions were marked as used */
|
||||
goto pop_and_go_right;
|
||||
@ -3541,10 +3541,10 @@ static bool create_partition_index_description(PART_PRUNE_PARAM *ppar)
|
||||
uint used_part_fields, used_subpart_fields;
|
||||
|
||||
used_part_fields= fields_ok_for_partition_index(part_info->part_field_array) ?
|
||||
part_info->no_part_fields : 0;
|
||||
part_info->num_part_fields : 0;
|
||||
used_subpart_fields=
|
||||
fields_ok_for_partition_index(part_info->subpart_field_array)?
|
||||
part_info->no_subpart_fields : 0;
|
||||
part_info->num_subpart_fields : 0;
|
||||
|
||||
uint total_parts= used_part_fields + used_subpart_fields;
|
||||
|
||||
@ -3583,10 +3583,10 @@ static bool create_partition_index_description(PART_PRUNE_PARAM *ppar)
|
||||
if (ppar->subpart_fields)
|
||||
{
|
||||
my_bitmap_map *buf;
|
||||
uint32 bufsize= bitmap_buffer_size(ppar->part_info->no_subparts);
|
||||
uint32 bufsize= bitmap_buffer_size(ppar->part_info->num_subparts);
|
||||
if (!(buf= (my_bitmap_map*) alloc_root(alloc, bufsize)))
|
||||
return TRUE;
|
||||
bitmap_init(&ppar->subparts_bitmap, buf, ppar->part_info->no_subparts,
|
||||
bitmap_init(&ppar->subparts_bitmap, buf, ppar->part_info->num_subparts,
|
||||
FALSE);
|
||||
}
|
||||
range_par->key_parts= key_part;
|
||||
|
@ -75,7 +75,7 @@ partition_info *partition_info::get_clone()
|
||||
SYNOPSIS
|
||||
create_default_partition_names()
|
||||
part_no Partition number for subparts
|
||||
no_parts Number of partitions
|
||||
num_parts Number of partitions
|
||||
start_no Starting partition number
|
||||
subpart Is it subpartitions
|
||||
|
||||
@ -91,10 +91,10 @@ partition_info *partition_info::get_clone()
|
||||
#define MAX_PART_NAME_SIZE 8
|
||||
|
||||
char *partition_info::create_default_partition_names(uint part_no,
|
||||
uint no_parts_arg,
|
||||
uint num_parts_arg,
|
||||
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;
|
||||
uint i= 0;
|
||||
DBUG_ENTER("create_default_partition_names");
|
||||
@ -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)));
|
||||
move_ptr+=MAX_PART_NAME_SIZE;
|
||||
} while (++i < no_parts_arg);
|
||||
} while (++i < num_parts_arg);
|
||||
}
|
||||
else
|
||||
{
|
||||
mem_alloc_error(no_parts_arg*MAX_PART_NAME_SIZE);
|
||||
mem_alloc_error(num_parts_arg*MAX_PART_NAME_SIZE);
|
||||
}
|
||||
DBUG_RETURN(ptr);
|
||||
}
|
||||
@ -189,19 +189,19 @@ bool partition_info::set_up_default_partitions(handler *file,
|
||||
goto end;
|
||||
}
|
||||
|
||||
if ((no_parts == 0) &&
|
||||
((no_parts= file->get_default_no_partitions(info)) == 0))
|
||||
if ((num_parts == 0) &&
|
||||
((num_parts= file->get_default_no_partitions(info)) == 0))
|
||||
{
|
||||
my_error(ER_PARTITION_NOT_DEFINED_ERROR, MYF(0), "partitions");
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (unlikely(no_parts > MAX_PARTITIONS))
|
||||
if (unlikely(num_parts > MAX_PARTITIONS))
|
||||
{
|
||||
my_error(ER_TOO_MANY_PARTITIONS_ERROR, MYF(0));
|
||||
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)))))
|
||||
goto end;
|
||||
i= 0;
|
||||
@ -220,7 +220,7 @@ bool partition_info::set_up_default_partitions(handler *file,
|
||||
mem_alloc_error(sizeof(partition_element));
|
||||
goto end;
|
||||
}
|
||||
} while (++i < no_parts);
|
||||
} while (++i < num_parts);
|
||||
result= FALSE;
|
||||
end:
|
||||
DBUG_RETURN(result);
|
||||
@ -259,9 +259,9 @@ bool partition_info::set_up_default_subpartitions(handler *file,
|
||||
List_iterator<partition_element> part_it(partitions);
|
||||
DBUG_ENTER("partition_info::set_up_default_subpartitions");
|
||||
|
||||
if (no_subparts == 0)
|
||||
no_subparts= file->get_default_no_partitions(info);
|
||||
if (unlikely((no_parts * no_subparts) > MAX_PARTITIONS))
|
||||
if (num_subparts == 0)
|
||||
num_subparts= file->get_default_no_partitions(info);
|
||||
if (unlikely((num_parts * num_subparts) > MAX_PARTITIONS))
|
||||
{
|
||||
my_error(ER_TOO_MANY_PARTITIONS_ERROR, MYF(0));
|
||||
goto end;
|
||||
@ -288,8 +288,8 @@ bool partition_info::set_up_default_subpartitions(handler *file,
|
||||
mem_alloc_error(sizeof(partition_element));
|
||||
goto end;
|
||||
}
|
||||
} while (++j < no_subparts);
|
||||
} while (++i < no_parts);
|
||||
} while (++j < num_subparts);
|
||||
} while (++i < num_parts);
|
||||
result= FALSE;
|
||||
end:
|
||||
DBUG_RETURN(result);
|
||||
@ -520,12 +520,12 @@ bool partition_info::check_engine_mix(handlerton *engine_type,
|
||||
{
|
||||
handlerton *old_engine_type= engine_type;
|
||||
bool first= TRUE;
|
||||
uint no_parts= partitions.elements;
|
||||
uint num_parts= partitions.elements;
|
||||
DBUG_ENTER("partition_info::check_engine_mix");
|
||||
DBUG_PRINT("info", ("in: engine_type = %s, table_engine_set = %u",
|
||||
ha_resolve_storage_engine_name(engine_type),
|
||||
table_engine_set));
|
||||
if (no_parts)
|
||||
if (num_parts)
|
||||
{
|
||||
List_iterator<partition_element> part_it(partitions);
|
||||
uint i= 0;
|
||||
@ -538,7 +538,7 @@ bool partition_info::check_engine_mix(handlerton *engine_type,
|
||||
if (is_sub_partitioned() &&
|
||||
part_elem->subpartitions.elements)
|
||||
{
|
||||
uint no_subparts= part_elem->subpartitions.elements;
|
||||
uint num_subparts= part_elem->subpartitions.elements;
|
||||
uint j= 0;
|
||||
List_iterator<partition_element> sub_it(part_elem->subpartitions);
|
||||
do
|
||||
@ -550,7 +550,7 @@ bool partition_info::check_engine_mix(handlerton *engine_type,
|
||||
if (check_engine_condition(sub_elem, table_engine_set,
|
||||
&engine_type, &first))
|
||||
goto error;
|
||||
} while (++j < no_subparts);
|
||||
} while (++j < num_subparts);
|
||||
/* ensure that the partition also has correct engine */
|
||||
if (check_engine_condition(part_elem, table_engine_set,
|
||||
&engine_type, &first))
|
||||
@ -559,7 +559,7 @@ bool partition_info::check_engine_mix(handlerton *engine_type,
|
||||
else if (check_engine_condition(part_elem, table_engine_set,
|
||||
&engine_type, &first))
|
||||
goto error;
|
||||
} while (++i < no_parts);
|
||||
} while (++i < num_parts);
|
||||
}
|
||||
DBUG_PRINT("info", ("engine_type = %s",
|
||||
ha_resolve_storage_engine_name(engine_type)));
|
||||
@ -612,21 +612,21 @@ bool partition_info::check_range_constants(THD *thd)
|
||||
List_iterator<partition_element> it(partitions);
|
||||
int result= TRUE;
|
||||
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));
|
||||
|
||||
if (column_list)
|
||||
{
|
||||
part_column_list_val* loc_range_col_array;
|
||||
part_column_list_val *current_largest_col_val;
|
||||
uint no_column_values= part_field_list.elements;
|
||||
uint size_entries= sizeof(part_column_list_val) * no_column_values;
|
||||
range_col_array= (part_column_list_val*)sql_calloc(no_parts *
|
||||
uint num_column_values= part_field_list.elements;
|
||||
uint size_entries= sizeof(part_column_list_val) * num_column_values;
|
||||
range_col_array= (part_column_list_val*)sql_calloc(num_parts *
|
||||
size_entries);
|
||||
LINT_INIT(current_largest_col_val);
|
||||
if (unlikely(range_col_array == NULL))
|
||||
{
|
||||
mem_alloc_error(no_parts * sizeof(longlong));
|
||||
mem_alloc_error(num_parts * sizeof(longlong));
|
||||
goto end;
|
||||
}
|
||||
loc_range_col_array= range_col_array;
|
||||
@ -642,7 +642,7 @@ bool partition_info::check_range_constants(THD *thd)
|
||||
if (fix_column_value_functions(thd, col_val, i))
|
||||
goto end;
|
||||
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 (compare_column_values((const void*)current_largest_col_val,
|
||||
@ -652,7 +652,7 @@ bool partition_info::check_range_constants(THD *thd)
|
||||
current_largest_col_val= col_val;
|
||||
}
|
||||
first= FALSE;
|
||||
} while (++i < no_parts);
|
||||
} while (++i < num_parts);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -663,17 +663,17 @@ bool partition_info::check_range_constants(THD *thd)
|
||||
LINT_INIT(current_largest);
|
||||
|
||||
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))
|
||||
{
|
||||
mem_alloc_error(no_parts * sizeof(longlong));
|
||||
mem_alloc_error(num_parts * sizeof(longlong));
|
||||
goto end;
|
||||
}
|
||||
i= 0;
|
||||
do
|
||||
{
|
||||
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;
|
||||
if (!signed_flag)
|
||||
@ -687,14 +687,14 @@ bool partition_info::check_range_constants(THD *thd)
|
||||
if (unlikely(current_largest > part_range_value) ||
|
||||
(unlikely(current_largest == part_range_value) &&
|
||||
(part_range_value < LONGLONG_MAX ||
|
||||
i != (no_parts - 1) ||
|
||||
i != (num_parts - 1) ||
|
||||
!defined_max_value)))
|
||||
goto range_not_increasing_error;
|
||||
}
|
||||
range_int_array[i]= part_range_value;
|
||||
current_largest= part_range_value;
|
||||
first= FALSE;
|
||||
} while (++i < no_parts);
|
||||
} while (++i < num_parts);
|
||||
}
|
||||
result= FALSE;
|
||||
end:
|
||||
@ -801,7 +801,7 @@ bool partition_info::fix_column_value_functions(THD *thd,
|
||||
part_column_list_val *col_val,
|
||||
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;
|
||||
TABLE_LIST *save_list= context->table_list;
|
||||
bool result= FALSE;
|
||||
@ -814,7 +814,7 @@ bool partition_info::fix_column_value_functions(THD *thd,
|
||||
}
|
||||
context->table_list= 0;
|
||||
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;
|
||||
Field *field= part_field_array[i];
|
||||
@ -885,7 +885,7 @@ end:
|
||||
|
||||
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;
|
||||
part_elem_value *list_value;
|
||||
bool result= TRUE;
|
||||
@ -899,7 +899,7 @@ bool partition_info::check_list_constants(THD *thd)
|
||||
DBUG_ENTER("partition_info::check_list_constants");
|
||||
|
||||
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
|
||||
defined in the first step.
|
||||
@ -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);
|
||||
while (list_val_it1++)
|
||||
no_list_values++;
|
||||
} while (++i < no_parts);
|
||||
num_list_values++;
|
||||
} while (++i < num_parts);
|
||||
list_func_it.rewind();
|
||||
no_column_values= part_field_list.elements;
|
||||
num_column_values= part_field_list.elements;
|
||||
size_entries= column_list ?
|
||||
(no_column_values * sizeof(part_column_list_val)) :
|
||||
(num_column_values * sizeof(part_column_list_val)) :
|
||||
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))
|
||||
{
|
||||
mem_alloc_error(no_list_values * size_entries);
|
||||
mem_alloc_error(num_list_values * size_entries);
|
||||
goto end;
|
||||
}
|
||||
if (column_list)
|
||||
@ -952,10 +952,6 @@ bool partition_info::check_list_constants(THD *thd)
|
||||
list_col_array= (part_column_list_val*)ptr;
|
||||
compare_func= compare_column_values;
|
||||
i= 0;
|
||||
/*
|
||||
Fix to be able to reuse signed sort functions also for unsigned
|
||||
partition functions.
|
||||
*/
|
||||
do
|
||||
{
|
||||
part_def= list_func_it++;
|
||||
@ -968,9 +964,9 @@ bool partition_info::check_list_constants(THD *thd)
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
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
|
||||
{
|
||||
@ -995,24 +991,24 @@ bool partition_info::check_list_constants(THD *thd)
|
||||
list_array[list_index].list_value= calc_value;
|
||||
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;
|
||||
/*
|
||||
list_array and list_col_array are unions, so this works for both
|
||||
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);
|
||||
|
||||
i= 0;
|
||||
LINT_INIT(prev_value);
|
||||
do
|
||||
{
|
||||
DBUG_ASSERT(i < no_list_values);
|
||||
curr_value= column_list ? (void*)&list_col_array[no_column_values * i] :
|
||||
DBUG_ASSERT(i < num_list_values);
|
||||
curr_value= column_list ? (void*)&list_col_array[num_column_values * i] :
|
||||
(void*)&list_array[i];
|
||||
if (likely(first || compare_func(curr_value, prev_value)))
|
||||
{
|
||||
@ -1024,7 +1020,7 @@ bool partition_info::check_list_constants(THD *thd)
|
||||
my_error(ER_MULTIPLE_DEF_CONST_IN_LIST_PART_ERROR, MYF(0));
|
||||
goto end;
|
||||
}
|
||||
} while (++i < no_list_values);
|
||||
} while (++i < num_list_values);
|
||||
}
|
||||
result= FALSE;
|
||||
end:
|
||||
@ -1088,7 +1084,7 @@ bool partition_info::check_partition_info(THD *thd, handlerton **eng_type,
|
||||
}
|
||||
}
|
||||
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));
|
||||
goto end;
|
||||
@ -1154,8 +1150,8 @@ bool partition_info::check_partition_info(THD *thd, handlerton **eng_type,
|
||||
i= 0;
|
||||
{
|
||||
List_iterator<partition_element> part_it(partitions);
|
||||
uint no_parts_not_set= 0;
|
||||
uint prev_no_subparts_not_set= no_subparts + 1;
|
||||
uint num_parts_not_set= 0;
|
||||
uint prev_num_subparts_not_set= num_subparts + 1;
|
||||
do
|
||||
{
|
||||
partition_element *part_elem= part_it++;
|
||||
@ -1177,7 +1173,7 @@ bool partition_info::check_partition_info(THD *thd, handlerton **eng_type,
|
||||
{
|
||||
if (part_elem->engine_type == NULL)
|
||||
{
|
||||
no_parts_not_set++;
|
||||
num_parts_not_set++;
|
||||
part_elem->engine_type= default_engine_type;
|
||||
}
|
||||
if (check_table_name(part_elem->partition_name,
|
||||
@ -1192,7 +1188,7 @@ bool partition_info::check_partition_info(THD *thd, handlerton **eng_type,
|
||||
else
|
||||
{
|
||||
uint j= 0;
|
||||
uint no_subparts_not_set= 0;
|
||||
uint num_subparts_not_set= 0;
|
||||
List_iterator<partition_element> sub_it(part_elem->subpartitions);
|
||||
partition_element *sub_elem;
|
||||
do
|
||||
@ -1211,44 +1207,45 @@ bool partition_info::check_partition_info(THD *thd, handlerton **eng_type,
|
||||
else
|
||||
{
|
||||
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,
|
||||
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) &&
|
||||
(no_subparts_not_set == 0 || no_subparts_not_set == no_subparts))
|
||||
prev_no_subparts_not_set= no_subparts_not_set;
|
||||
if (prev_num_subparts_not_set == (num_subparts + 1) &&
|
||||
(num_subparts_not_set == 0 ||
|
||||
num_subparts_not_set == num_subparts))
|
||||
prev_num_subparts_not_set= num_subparts_not_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",
|
||||
no_subparts_not_set, no_subparts));
|
||||
DBUG_PRINT("info", ("num_subparts_not_set = %u num_subparts = %u",
|
||||
num_subparts_not_set, num_subparts));
|
||||
my_error(ER_MIX_HANDLER_ERROR, MYF(0));
|
||||
goto end;
|
||||
}
|
||||
|
||||
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;
|
||||
else
|
||||
{
|
||||
no_parts_not_set++;
|
||||
num_parts_not_set++;
|
||||
part_elem->engine_type= default_engine_type;
|
||||
}
|
||||
}
|
||||
}
|
||||
} while (++i < no_parts);
|
||||
} while (++i < num_parts);
|
||||
if (!table_engine_set &&
|
||||
no_parts_not_set != 0 &&
|
||||
no_parts_not_set != no_parts)
|
||||
num_parts_not_set != 0 &&
|
||||
num_parts_not_set != num_parts)
|
||||
{
|
||||
DBUG_PRINT("info", ("no_parts_not_set = %u no_parts = %u",
|
||||
no_parts_not_set, no_subparts));
|
||||
DBUG_PRINT("info", ("num_parts_not_set = %u num_parts = %u",
|
||||
num_parts_not_set, num_subparts));
|
||||
my_error(ER_MIX_HANDLER_ERROR, MYF(0));
|
||||
goto end;
|
||||
}
|
||||
|
@ -176,17 +176,17 @@ public:
|
||||
uint part_func_len;
|
||||
uint subpart_func_len;
|
||||
|
||||
uint no_parts;
|
||||
uint no_subparts;
|
||||
uint num_parts;
|
||||
uint num_subparts;
|
||||
uint count_curr_subparts;
|
||||
|
||||
uint part_error_code;
|
||||
|
||||
uint no_list_values;
|
||||
uint num_list_values;
|
||||
|
||||
uint no_part_fields;
|
||||
uint no_subpart_fields;
|
||||
uint no_full_part_fields;
|
||||
uint num_part_fields;
|
||||
uint num_subpart_fields;
|
||||
uint num_full_part_fields;
|
||||
|
||||
uint has_null_part_id;
|
||||
/*
|
||||
@ -197,9 +197,9 @@ public:
|
||||
uint16 linear_hash_mask;
|
||||
|
||||
bool use_default_partitions;
|
||||
bool use_default_no_partitions;
|
||||
bool use_default_num_partitions;
|
||||
bool use_default_subpartitions;
|
||||
bool use_default_no_subpartitions;
|
||||
bool use_default_num_subpartitions;
|
||||
bool default_partitions_setup;
|
||||
bool defined_max_value;
|
||||
bool list_of_part_fields;
|
||||
@ -233,12 +233,12 @@ public:
|
||||
part_type(NOT_A_PARTITION), subpart_type(NOT_A_PARTITION),
|
||||
part_info_len(0), part_state_len(0),
|
||||
part_func_len(0), subpart_func_len(0),
|
||||
no_parts(0), no_subparts(0),
|
||||
num_parts(0), num_subparts(0),
|
||||
count_curr_subparts(0), part_error_code(0),
|
||||
no_list_values(0), no_part_fields(0), no_subpart_fields(0),
|
||||
no_full_part_fields(0), has_null_part_id(0), linear_hash_mask(0),
|
||||
use_default_partitions(TRUE), use_default_no_partitions(TRUE),
|
||||
use_default_subpartitions(TRUE), use_default_no_subpartitions(TRUE),
|
||||
num_list_values(0), num_part_fields(0), num_subpart_fields(0),
|
||||
num_full_part_fields(0), has_null_part_id(0), linear_hash_mask(0),
|
||||
use_default_partitions(TRUE), use_default_num_partitions(TRUE),
|
||||
use_default_subpartitions(TRUE), use_default_num_subpartitions(TRUE),
|
||||
default_partitions_setup(FALSE), defined_max_value(FALSE),
|
||||
list_of_part_fields(FALSE), list_of_subpart_fields(FALSE),
|
||||
linear_hash_ind(FALSE), fixed(FALSE),
|
||||
@ -266,7 +266,7 @@ public:
|
||||
/* Returns the total number of partitions on the leaf level */
|
||||
uint get_tot_partitions()
|
||||
{
|
||||
return no_parts * (is_sub_partitioned() ? no_subparts : 1);
|
||||
return num_parts * (is_sub_partitioned() ? num_subparts : 1);
|
||||
}
|
||||
|
||||
bool set_up_defaults_for_partitioning(handler *file, HA_CREATE_INFO *info,
|
||||
@ -289,7 +289,7 @@ private:
|
||||
bool set_up_default_partitions(handler *file, HA_CREATE_INFO *info,
|
||||
uint start_no);
|
||||
bool set_up_default_subpartitions(handler *file, HA_CREATE_INFO *info);
|
||||
char *create_default_partition_names(uint part_no, uint no_parts,
|
||||
char *create_default_partition_names(uint part_no, uint num_parts,
|
||||
uint start_no);
|
||||
char *create_subpartition_name(uint subpart_no, const char *part_name);
|
||||
bool has_unique_name(partition_element *element);
|
||||
@ -317,6 +317,6 @@ void init_all_partitions_iterator(partition_info *part_info,
|
||||
PARTITION_ITERATOR *part_iter)
|
||||
{
|
||||
part_iter->part_nums.start= part_iter->part_nums.cur= 0;
|
||||
part_iter->part_nums.end= part_info->no_parts;
|
||||
part_iter->part_nums.end= part_info->num_parts;
|
||||
part_iter->get_next= get_next_partition_id_range;
|
||||
}
|
||||
|
@ -1498,7 +1498,7 @@ Alter_info::Alter_info(const Alter_info &rhs, MEM_ROOT *mem_root)
|
||||
keys_onoff(rhs.keys_onoff),
|
||||
tablespace_op(rhs.tablespace_op),
|
||||
partition_names(rhs.partition_names, mem_root),
|
||||
no_parts(rhs.no_parts),
|
||||
num_parts(rhs.num_parts),
|
||||
change_level(rhs.change_level),
|
||||
datetime_field(rhs.datetime_field),
|
||||
error_if_not_empty(rhs.error_if_not_empty)
|
||||
|
@ -893,7 +893,7 @@ public:
|
||||
enum enum_enable_or_disable keys_onoff;
|
||||
enum tablespace_op_type tablespace_op;
|
||||
List<char> partition_names;
|
||||
uint no_parts;
|
||||
uint num_parts;
|
||||
enum_alter_table_change_level change_level;
|
||||
Create_field *datetime_field;
|
||||
bool error_if_not_empty;
|
||||
@ -903,7 +903,7 @@ public:
|
||||
flags(0),
|
||||
keys_onoff(LEAVE_AS_IS),
|
||||
tablespace_op(NO_TABLESPACE_OP),
|
||||
no_parts(0),
|
||||
num_parts(0),
|
||||
change_level(ALTER_TABLE_METADATA_ONLY),
|
||||
datetime_field(NULL),
|
||||
error_if_not_empty(FALSE)
|
||||
@ -918,7 +918,7 @@ public:
|
||||
flags= 0;
|
||||
keys_onoff= LEAVE_AS_IS;
|
||||
tablespace_op= NO_TABLESPACE_OP;
|
||||
no_parts= 0;
|
||||
num_parts= 0;
|
||||
partition_names.empty();
|
||||
change_level= ALTER_TABLE_METADATA_ONLY;
|
||||
datetime_field= 0;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -65,7 +65,7 @@ int get_part_for_delete(const uchar *buf, const uchar *rec0,
|
||||
void prune_partition_set(const TABLE *table, part_id_range *part_spec);
|
||||
bool check_partition_info(partition_info *part_info,handlerton **eng_type,
|
||||
TABLE *table, handler *file, HA_CREATE_INFO *info);
|
||||
void set_linear_hash_mask(partition_info *part_info, uint no_parts);
|
||||
void set_linear_hash_mask(partition_info *part_info, uint num_parts);
|
||||
bool fix_partition_func(THD *thd, TABLE *table, bool create_table_ind);
|
||||
char *generate_partition_syntax(partition_info *part_info,
|
||||
uint *buf_length, bool use_sql_alloc,
|
||||
|
@ -3700,9 +3700,9 @@ bool mysql_create_table_no_lock(THD *thd,
|
||||
creates a proper .par file. The current part_info object is
|
||||
only used to create the frm-file and .par-file.
|
||||
*/
|
||||
if (part_info->use_default_no_partitions &&
|
||||
part_info->no_parts &&
|
||||
(int)part_info->no_parts !=
|
||||
if (part_info->use_default_num_partitions &&
|
||||
part_info->num_parts &&
|
||||
(int)part_info->num_parts !=
|
||||
file->get_default_no_partitions(create_info))
|
||||
{
|
||||
uint i;
|
||||
@ -3713,13 +3713,13 @@ bool mysql_create_table_no_lock(THD *thd,
|
||||
(part_it++)->part_state= PART_TO_BE_DROPPED;
|
||||
}
|
||||
else if (part_info->is_sub_partitioned() &&
|
||||
part_info->use_default_no_subpartitions &&
|
||||
part_info->no_subparts &&
|
||||
(int)part_info->no_subparts !=
|
||||
part_info->use_default_num_subpartitions &&
|
||||
part_info->num_subparts &&
|
||||
(int)part_info->num_subparts !=
|
||||
file->get_default_no_partitions(create_info))
|
||||
{
|
||||
DBUG_ASSERT(thd->lex->sql_command != SQLCOM_CREATE_TABLE);
|
||||
part_info->no_subparts= file->get_default_no_partitions(create_info);
|
||||
part_info->num_subparts= file->get_default_no_partitions(create_info);
|
||||
}
|
||||
}
|
||||
else if (create_info->db_type != engine_type)
|
||||
@ -4531,11 +4531,11 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
|
||||
my_error(ER_PARTITION_MGMT_ON_NONPARTITIONED, MYF(0));
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
uint no_parts_found;
|
||||
uint no_parts_opt= alter_info->partition_names.elements;
|
||||
no_parts_found= set_part_state(alter_info, table->table->part_info,
|
||||
uint num_parts_found;
|
||||
uint num_parts_opt= alter_info->partition_names.elements;
|
||||
num_parts_found= set_part_state(alter_info, table->table->part_info,
|
||||
PART_CHANGED);
|
||||
if (no_parts_found != no_parts_opt &&
|
||||
if (num_parts_found != num_parts_opt &&
|
||||
(!(alter_info->flags & ALTER_ALL_PARTITION)))
|
||||
{
|
||||
char buff[FN_REFLEN + MYSQL_ERRMSG_SIZE];
|
||||
|
@ -3810,7 +3810,7 @@ partition_entry:
|
||||
;
|
||||
|
||||
partition:
|
||||
BY part_type_def opt_no_parts opt_sub_part part_defs
|
||||
BY part_type_def opt_num_parts opt_sub_part part_defs
|
||||
;
|
||||
|
||||
part_type_def:
|
||||
@ -3895,20 +3895,20 @@ sub_part_func:
|
||||
;
|
||||
|
||||
|
||||
opt_no_parts:
|
||||
opt_num_parts:
|
||||
/* empty */ {}
|
||||
| PARTITIONS_SYM real_ulong_num
|
||||
{
|
||||
uint no_parts= $2;
|
||||
uint num_parts= $2;
|
||||
partition_info *part_info= Lex->part_info;
|
||||
if (no_parts == 0)
|
||||
if (num_parts == 0)
|
||||
{
|
||||
my_error(ER_NO_PARTS_ERROR, MYF(0), "partitions");
|
||||
MYSQL_YYABORT;
|
||||
}
|
||||
|
||||
part_info->no_parts= no_parts;
|
||||
part_info->use_default_no_partitions= FALSE;
|
||||
part_info->num_parts= num_parts;
|
||||
part_info->use_default_num_partitions= FALSE;
|
||||
}
|
||||
;
|
||||
|
||||
@ -3916,7 +3916,7 @@ opt_sub_part:
|
||||
/* empty */ {}
|
||||
| SUBPARTITION_SYM BY opt_linear HASH_SYM sub_part_func
|
||||
{ Lex->part_info->subpart_type= HASH_PARTITION; }
|
||||
opt_no_subparts {}
|
||||
opt_num_subparts {}
|
||||
| SUBPARTITION_SYM BY opt_linear KEY_SYM
|
||||
'(' sub_part_field_list ')'
|
||||
{
|
||||
@ -3924,7 +3924,7 @@ opt_sub_part:
|
||||
part_info->subpart_type= HASH_PARTITION;
|
||||
part_info->list_of_subpart_fields= TRUE;
|
||||
}
|
||||
opt_no_subparts {}
|
||||
opt_num_subparts {}
|
||||
;
|
||||
|
||||
sub_part_field_list:
|
||||
@ -3966,19 +3966,19 @@ part_func_expr:
|
||||
}
|
||||
;
|
||||
|
||||
opt_no_subparts:
|
||||
opt_num_subparts:
|
||||
/* empty */ {}
|
||||
| SUBPARTITIONS_SYM real_ulong_num
|
||||
{
|
||||
uint no_parts= $2;
|
||||
uint num_parts= $2;
|
||||
LEX *lex= Lex;
|
||||
if (no_parts == 0)
|
||||
if (num_parts == 0)
|
||||
{
|
||||
my_error(ER_NO_PARTS_ERROR, MYF(0), "subpartitions");
|
||||
MYSQL_YYABORT;
|
||||
}
|
||||
lex->part_info->no_subparts= no_parts;
|
||||
lex->part_info->use_default_no_subpartitions= FALSE;
|
||||
lex->part_info->num_subparts= num_parts;
|
||||
lex->part_info->use_default_num_subpartitions= FALSE;
|
||||
}
|
||||
;
|
||||
|
||||
@ -3989,9 +3989,9 @@ part_defs:
|
||||
{
|
||||
partition_info *part_info= Lex->part_info;
|
||||
uint count_curr_parts= part_info->partitions.elements;
|
||||
if (part_info->no_parts != 0)
|
||||
if (part_info->num_parts != 0)
|
||||
{
|
||||
if (part_info->no_parts !=
|
||||
if (part_info->num_parts !=
|
||||
count_curr_parts)
|
||||
{
|
||||
my_parse_error(ER(ER_PARTITION_WRONG_NO_PART_ERROR));
|
||||
@ -4000,7 +4000,7 @@ part_defs:
|
||||
}
|
||||
else if (count_curr_parts > 0)
|
||||
{
|
||||
part_info->no_parts= count_curr_parts;
|
||||
part_info->num_parts= count_curr_parts;
|
||||
}
|
||||
part_info->count_curr_subparts= 0;
|
||||
}
|
||||
@ -4026,7 +4026,7 @@ part_definition:
|
||||
part_info->curr_part_elem= p_elem;
|
||||
part_info->current_partition= p_elem;
|
||||
part_info->use_default_partitions= FALSE;
|
||||
part_info->use_default_no_partitions= FALSE;
|
||||
part_info->use_default_num_partitions= FALSE;
|
||||
}
|
||||
part_name
|
||||
opt_part_values
|
||||
@ -4338,7 +4338,7 @@ opt_sub_partition:
|
||||
/* empty */
|
||||
{
|
||||
partition_info *part_info= Lex->part_info;
|
||||
if (part_info->no_subparts != 0 &&
|
||||
if (part_info->num_subparts != 0 &&
|
||||
!part_info->use_default_subpartitions)
|
||||
{
|
||||
/*
|
||||
@ -4352,9 +4352,9 @@ opt_sub_partition:
|
||||
| '(' sub_part_list ')'
|
||||
{
|
||||
partition_info *part_info= Lex->part_info;
|
||||
if (part_info->no_subparts != 0)
|
||||
if (part_info->num_subparts != 0)
|
||||
{
|
||||
if (part_info->no_subparts !=
|
||||
if (part_info->num_subparts !=
|
||||
part_info->count_curr_subparts)
|
||||
{
|
||||
my_parse_error(ER(ER_PARTITION_WRONG_NO_SUBPART_ERROR));
|
||||
@ -4368,7 +4368,7 @@ opt_sub_partition:
|
||||
my_parse_error(ER(ER_PARTITION_WRONG_NO_SUBPART_ERROR));
|
||||
MYSQL_YYABORT;
|
||||
}
|
||||
part_info->no_subparts= part_info->count_curr_subparts;
|
||||
part_info->num_subparts= part_info->count_curr_subparts;
|
||||
}
|
||||
part_info->count_curr_subparts= 0;
|
||||
}
|
||||
@ -4410,7 +4410,7 @@ sub_part_definition:
|
||||
}
|
||||
part_info->curr_part_elem= sub_p_elem;
|
||||
part_info->use_default_subpartitions= FALSE;
|
||||
part_info->use_default_no_subpartitions= FALSE;
|
||||
part_info->use_default_num_subpartitions= FALSE;
|
||||
part_info->count_curr_subparts++;
|
||||
}
|
||||
sub_name opt_part_options {}
|
||||
@ -5850,7 +5850,7 @@ alter_commands:
|
||||
LEX *lex= Lex;
|
||||
lex->alter_info.flags|= ALTER_COALESCE_PARTITION;
|
||||
lex->no_write_to_binlog= $3;
|
||||
lex->alter_info.no_parts= $4;
|
||||
lex->alter_info.num_parts= $4;
|
||||
}
|
||||
| reorg_partition_rule
|
||||
;
|
||||
@ -5892,12 +5892,11 @@ add_part_extra:
|
||||
| '(' part_def_list ')'
|
||||
{
|
||||
LEX *lex= Lex;
|
||||
lex->part_info->no_parts= lex->part_info->partitions.elements;
|
||||
lex->part_info->num_parts= lex->part_info->partitions.elements;
|
||||
}
|
||||
| PARTITIONS_SYM real_ulong_num
|
||||
{
|
||||
LEX *lex= Lex;
|
||||
lex->part_info->no_parts= $2;
|
||||
Lex->part_info->num_parts= $2;
|
||||
}
|
||||
;
|
||||
|
||||
@ -5928,7 +5927,7 @@ reorg_parts_rule:
|
||||
INTO '(' part_def_list ')'
|
||||
{
|
||||
partition_info *part_info= Lex->part_info;
|
||||
part_info->no_parts= part_info->partitions.elements;
|
||||
part_info->num_parts= part_info->partitions.elements;
|
||||
}
|
||||
;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user