Skip to content

Commit 4c77ef3

Browse files
committed
compilation w/o partitioning
1 parent ae6355f commit 4c77ef3

File tree

4 files changed

+36
-31
lines changed

4 files changed

+36
-31
lines changed

sql/partition_info.cc

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -856,21 +856,6 @@ bool partition_info::has_unique_name(partition_element *element)
856856
DBUG_RETURN(TRUE);
857857
}
858858

859-
bool partition_info::vers_init_info(THD * thd)
860-
{
861-
part_type= VERSIONING_PARTITION;
862-
list_of_part_fields= TRUE;
863-
column_list= TRUE;
864-
num_columns= 1;
865-
vers_info= new (thd->mem_root) Vers_part_info;
866-
if (!vers_info)
867-
{
868-
mem_alloc_error(sizeof(Vers_part_info));
869-
return true;
870-
}
871-
return false;
872-
}
873-
874859
void partition_info::vers_set_hist_part(THD *thd)
875860
{
876861
if (vers_info->limit)
@@ -2747,6 +2732,22 @@ bool check_partition_dirs(partition_info *part_info)
27472732

27482733
#endif /* WITH_PARTITION_STORAGE_ENGINE */
27492734

2735+
bool partition_info::vers_init_info(THD * thd)
2736+
{
2737+
part_type= VERSIONING_PARTITION;
2738+
list_of_part_fields= TRUE;
2739+
column_list= TRUE;
2740+
num_columns= 1;
2741+
vers_info= new (thd->mem_root) Vers_part_info;
2742+
if (!vers_info)
2743+
{
2744+
mem_alloc_error(sizeof(Vers_part_info));
2745+
return true;
2746+
}
2747+
return false;
2748+
}
2749+
2750+
27502751
bool partition_info::error_if_requires_values() const
27512752
{
27522753
switch (part_type) {

sql/sql_base.cc

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1470,6 +1470,16 @@ open_table_get_mdl_lock(THD *thd, Open_table_context *ot_ctx,
14701470
return FALSE;
14711471
}
14721472

1473+
/* Set all [named] partitions as used. */
1474+
static int set_partitions_as_used(TABLE_LIST *tl, TABLE *t)
1475+
{
1476+
#ifdef WITH_PARTITION_STORAGE_ENGINE
1477+
if (t->part_info)
1478+
return t->file->change_partitions_to_open(tl->partition_names);
1479+
#endif
1480+
return 0;
1481+
}
1482+
14731483

14741484
/**
14751485
Open a base table.
@@ -1612,12 +1622,7 @@ bool open_table(THD *thd, TABLE_LIST *table_list, Open_table_context *ot_ctx)
16121622
table= best_table;
16131623
table->query_id= thd->query_id;
16141624
DBUG_PRINT("info",("Using locked table"));
1615-
if (table->part_info)
1616-
{
1617-
/* Set all [named] partitions as used. */
1618-
part_names_error=
1619-
table->file->change_partitions_to_open(table_list->partition_names);
1620-
}
1625+
part_names_error= set_partitions_as_used(table_list, table);
16211626
goto reset;
16221627
}
16231628
/*
@@ -1902,12 +1907,7 @@ bool open_table(THD *thd, TABLE_LIST *table_list, Open_table_context *ot_ctx)
19021907
{
19031908
DBUG_ASSERT(table->file != NULL);
19041909
MYSQL_REBIND_TABLE(table->file);
1905-
if (table->part_info)
1906-
{
1907-
/* Set all [named] partitions as used. */
1908-
part_names_error=
1909-
table->file->change_partitions_to_open(table_list->partition_names);
1910-
}
1910+
part_names_error= set_partitions_as_used(table_list, table);
19111911
}
19121912
else
19131913
{
@@ -1921,7 +1921,7 @@ bool open_table(THD *thd, TABLE_LIST *table_list, Open_table_context *ot_ctx)
19211921
HA_OPEN_KEYFILE | HA_TRY_READ_ONLY,
19221922
EXTRA_RECORD,
19231923
thd->open_options, table, FALSE,
1924-
table_list->partition_names);
1924+
IF_PARTITIONING(table_list->partition_names,0));
19251925

19261926
if (error)
19271927
{

sql/sql_table.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9204,8 +9204,8 @@ bool mysql_alter_table(THD *thd, const LEX_CSTRING *new_db, const LEX_CSTRING *n
92049204

92059205
if (table_list->table->versioned(VERS_TRX_ID) &&
92069206
alter_info->requested_algorithm ==
9207-
Alter_info::ALTER_TABLE_ALGORITHM_DEFAULT &&
9208-
!table_list->table->s->partition_info_str)
9207+
Alter_info::ALTER_TABLE_ALGORITHM_DEFAULT &&
9208+
IF_PARTITIONING(!table_list->table->s->partition_info_str, 1))
92099209
{
92109210
// Changle default ALGORITHM to COPY for INNODB
92119211
alter_info->requested_algorithm= Alter_info::ALTER_TABLE_ALGORITHM_COPY;

sql/vtmd.cc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,16 @@ VTMD_table::create(THD *thd)
3535
return true;
3636

3737
Reprepare_observer *reprepare_observer= thd->m_reprepare_observer;
38-
partition_info *work_part_info= thd->work_part_info;
3938
thd->m_reprepare_observer= NULL;
39+
#ifdef WITH_PARTITION_STORAGE_ENGINE
40+
partition_info *work_part_info= thd->work_part_info;
4041
thd->work_part_info= NULL;
42+
#endif
4143
bool rc= mysql_create_like_table(thd, &table, &src_table, &create_info);
4244
thd->m_reprepare_observer= reprepare_observer;
45+
#ifdef WITH_PARTITION_STORAGE_ENGINE
4346
thd->work_part_info= work_part_info;
47+
#endif
4448
return rc;
4549
}
4650

0 commit comments

Comments
 (0)