diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc index 2ab036ee1a0b786f9b036b942a83d44164fe8b18..09bd48a3cd7c37769a9da4262cfe113498f36322 100644 --- a/sql/ha_ndbcluster.cc +++ b/sql/ha_ndbcluster.cc @@ -4503,18 +4503,18 @@ int ha_ndbcluster::open(const char *name, int mode, uint test_if_locked) if (!res) info(HA_STATUS_VARIABLE | HA_STATUS_CONST); - if (table->part_info) - { - m_part_info= table->part_info; - if (!(m_part_info->part_type == HASH_PARTITION && - m_part_info->list_of_part_fields && - !is_sub_partitioned(m_part_info))) - m_use_partition_function= TRUE; - } DBUG_RETURN(res); } +void ha_ndbcluster::set_part_info(partition_info *part_info) +{ + m_part_info= part_info; + if (!(m_part_info->part_type == HASH_PARTITION && + m_part_info->list_of_part_fields && + !is_sub_partitioned(m_part_info))) + m_use_partition_function= TRUE; +} /* Close the table diff --git a/sql/ha_ndbcluster.h b/sql/ha_ndbcluster.h index 1b3c717009a116e54f0d3c1c80980c32bd177730..fb50637579750ad668fa0116614b4788bb3145b9 100644 --- a/sql/ha_ndbcluster.h +++ b/sql/ha_ndbcluster.h @@ -534,6 +534,7 @@ class ha_ndbcluster: public handler return (HA_CAN_PARTITION | HA_CAN_UPDATE_PARTITION_KEY | HA_CAN_PARTITION_UNIQUE); } + void set_part_info(partition_info *part_info); ulong index_flags(uint idx, uint part, bool all_parts) const; uint max_supported_record_length() const; uint max_supported_keys() const; diff --git a/sql/ha_partition.h b/sql/ha_partition.h index 8109fec9323c1eaea50198b22900362609d55ac3..a727a2781036f251db2bc2901b598f6f2f2a1706 100644 --- a/sql/ha_partition.h +++ b/sql/ha_partition.h @@ -122,7 +122,7 @@ class ha_partition :public handler PARTITION_SHARE *share; /* Shared lock info */ public: - void set_part_info(partition_info *part_info) + virtual void set_part_info(partition_info *part_info) { m_part_info= part_info; m_is_sub_partitioned= is_sub_partitioned(part_info); diff --git a/sql/handler.h b/sql/handler.h index 14fcd226da7cec1b4ea605b8f3fea62200b0035a..dc6e3edc40cee479a38ab34dffa818b981a40367 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -1273,6 +1273,7 @@ class handler :public Sql_alloc #ifdef WITH_PARTITION_STORAGE_ENGINE virtual ulong partition_flags(void) const { return 0;} virtual int get_default_no_partitions(ulonglong max_rows) { return 1;} + virtual void set_part_info(partition_info *part_info) { return; } #endif virtual ulong index_flags(uint idx, uint part, bool all_parts) const =0; virtual ulong index_ddl_flags(KEY *wanted_index) const diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc index 2792bda1365793b1b9aafb3ae1356a1317c28d18..932877c257bed2b76e9391dc615f67b48dbe2ca7 100644 --- a/sql/sql_partition.cc +++ b/sql/sql_partition.cc @@ -3128,7 +3128,7 @@ bool mysql_unpack_partition(THD *thd, const uchar *part_buf, } part_info= lex.part_info; table->part_info= part_info; - ((ha_partition*)table->file)->set_part_info(part_info); + table->file->set_part_info(part_info); if (part_info->default_engine_type == DB_TYPE_UNKNOWN) part_info->default_engine_type= default_db_type; else