diff --git a/storage/tianchi/ha_tse.cc b/storage/tianchi/ha_tse.cc index 703d903a01b89245b541d067128db1c79ee35be8..6c39f11b4ea276772213985b4a7029a620ef5dee 100644 --- a/storage/tianchi/ha_tse.cc +++ b/storage/tianchi/ha_tse.cc @@ -106,6 +106,9 @@ #include "sql/dd/upgrade/server.h" // UPGRADE_FORCE #include "sql/abstract_query_plan.h" +#include "sql/dd/properties.h" +#include "sql/dd/types/partition.h" + #include "tse_stats.h" #include "tse_error.h" #include "tse_log.h" @@ -117,6 +120,7 @@ #include "sql/mysqld.h" #include "sql/plugin_table.h" #include "sql/dd/object_id.h" +#include "sql/dd/string_type.h" #include "sql/dd/cache/dictionary_client.h" #include "sql/dd/dd_schema.h" #include "sql/sql_table.h" @@ -775,7 +779,10 @@ bool ha_tse::check_unsupported_operation(THD *thd, HA_CREATE_INFO *create_info) my_error(ER_NOT_ALLOWED_COMMAND, MYF(0)); return HA_ERR_UNSUPPORTED; } - + if (create_info->index_file_name) { + my_error(ER_ILLEGAL_HA, MYF(0), table_share->table_name.str, HA_WRONG_CREATE_OPTION); + return true; + } return false; } @@ -4948,6 +4955,15 @@ EXTER_ATTACK int ha_tse::create(const char *name, TABLE *form, HA_CREATE_INFO *c dd::Table *table_def) { THD *thd = ha_thd(); ct_errno_t ret = CT_SUCCESS; + for (const auto dd_part : *table_def->leaf_partitions()) { + dd::String_type index_file_name_val; + const dd::Properties &options = dd_part->options(); + if (options.exists(index_file_name_val_key)) + (void)options.get(index_file_name_val_key, &index_file_name_val); + if (!index_file_name_val.empty()) { + create_info->index_file_name = index_file_name_val.c_str(); + } + } if (check_unsupported_operation(thd, create_info)) { tse_log_system("Unsupported operation. sql = %s", thd->query().str); return HA_ERR_WRONG_COMMAND; diff --git a/storage/tianchi/ha_tse.h b/storage/tianchi/ha_tse.h index 9cdeedb73b2a535c6119c3f6cb761b39af3d4548..b3095cbae15c13686920675c74462f6e08095730 100644 --- a/storage/tianchi/ha_tse.h +++ b/storage/tianchi/ha_tse.h @@ -36,6 +36,7 @@ #include "sql/abstract_query_plan.h" #include "sql/dd/types/schema.h" #include "sql/dd/types/object_table_definition.h" +#include "sql/dd/string_type.h" #pragma GCC visibility push(default) @@ -141,6 +142,7 @@ again. */ #define RETURN_IF_OOM(result) \ { \ if (result == ERR_ALLOC_MEMORY) \ + return HA_ERR_SE_OUT_OF_MEMORY; \ } @@ -148,6 +150,8 @@ again. */ #define IS_PRIMARY_ROLE() (tse_get_cluster_role() == (int32_t)dis_cluster_role::PRIMARY) #define IS_STANDBY_ROLE() (tse_get_cluster_role() == (int32_t)dis_cluster_role::STANDBY) +static const dd::String_type index_file_name_val_key("index_file_name"); + static const uint ROW_ID_LENGTH = sizeof(uint64_t); static const uint TSE_START_TIMEOUT = 120; // seconds extern const char *tse_hton_name;