compilation w/o partitioning

This commit is contained in:
Sergei Golubchik 2018-03-28 19:19:17 +02:00
parent ae6355f56e
commit 4c77ef36c6
4 changed files with 36 additions and 31 deletions

View file

@ -856,21 +856,6 @@ bool partition_info::has_unique_name(partition_element *element)
DBUG_RETURN(TRUE);
}
bool partition_info::vers_init_info(THD * thd)
{
part_type= VERSIONING_PARTITION;
list_of_part_fields= TRUE;
column_list= TRUE;
num_columns= 1;
vers_info= new (thd->mem_root) Vers_part_info;
if (!vers_info)
{
mem_alloc_error(sizeof(Vers_part_info));
return true;
}
return false;
}
void partition_info::vers_set_hist_part(THD *thd)
{
if (vers_info->limit)
@ -2747,6 +2732,22 @@ bool check_partition_dirs(partition_info *part_info)
#endif /* WITH_PARTITION_STORAGE_ENGINE */
bool partition_info::vers_init_info(THD * thd)
{
part_type= VERSIONING_PARTITION;
list_of_part_fields= TRUE;
column_list= TRUE;
num_columns= 1;
vers_info= new (thd->mem_root) Vers_part_info;
if (!vers_info)
{
mem_alloc_error(sizeof(Vers_part_info));
return true;
}
return false;
}
bool partition_info::error_if_requires_values() const
{
switch (part_type) {

View file

@ -1470,6 +1470,16 @@ open_table_get_mdl_lock(THD *thd, Open_table_context *ot_ctx,
return FALSE;
}
/* Set all [named] partitions as used. */
static int set_partitions_as_used(TABLE_LIST *tl, TABLE *t)
{
#ifdef WITH_PARTITION_STORAGE_ENGINE
if (t->part_info)
return t->file->change_partitions_to_open(tl->partition_names);
#endif
return 0;
}
/**
Open a base table.
@ -1612,12 +1622,7 @@ bool open_table(THD *thd, TABLE_LIST *table_list, Open_table_context *ot_ctx)
table= best_table;
table->query_id= thd->query_id;
DBUG_PRINT("info",("Using locked table"));
if (table->part_info)
{
/* Set all [named] partitions as used. */
part_names_error=
table->file->change_partitions_to_open(table_list->partition_names);
}
part_names_error= set_partitions_as_used(table_list, table);
goto reset;
}
/*
@ -1902,12 +1907,7 @@ retry_share:
{
DBUG_ASSERT(table->file != NULL);
MYSQL_REBIND_TABLE(table->file);
if (table->part_info)
{
/* Set all [named] partitions as used. */
part_names_error=
table->file->change_partitions_to_open(table_list->partition_names);
}
part_names_error= set_partitions_as_used(table_list, table);
}
else
{
@ -1921,7 +1921,7 @@ retry_share:
HA_OPEN_KEYFILE | HA_TRY_READ_ONLY,
EXTRA_RECORD,
thd->open_options, table, FALSE,
table_list->partition_names);
IF_PARTITIONING(table_list->partition_names,0));
if (error)
{

View file

@ -9204,8 +9204,8 @@ bool mysql_alter_table(THD *thd, const LEX_CSTRING *new_db, const LEX_CSTRING *n
if (table_list->table->versioned(VERS_TRX_ID) &&
alter_info->requested_algorithm ==
Alter_info::ALTER_TABLE_ALGORITHM_DEFAULT &&
!table_list->table->s->partition_info_str)
Alter_info::ALTER_TABLE_ALGORITHM_DEFAULT &&
IF_PARTITIONING(!table_list->table->s->partition_info_str, 1))
{
// Changle default ALGORITHM to COPY for INNODB
alter_info->requested_algorithm= Alter_info::ALTER_TABLE_ALGORITHM_COPY;

View file

@ -35,12 +35,16 @@ VTMD_table::create(THD *thd)
return true;
Reprepare_observer *reprepare_observer= thd->m_reprepare_observer;
partition_info *work_part_info= thd->work_part_info;
thd->m_reprepare_observer= NULL;
#ifdef WITH_PARTITION_STORAGE_ENGINE
partition_info *work_part_info= thd->work_part_info;
thd->work_part_info= NULL;
#endif
bool rc= mysql_create_like_table(thd, &table, &src_table, &create_info);
thd->m_reprepare_observer= reprepare_observer;
#ifdef WITH_PARTITION_STORAGE_ENGINE
thd->work_part_info= work_part_info;
#endif
return rc;
}