提交 c9bd25e7 编写于 作者: X xf0 提交者: wangzelin.wzl

fix an index name bug in phy restore

上级 b307e664
此差异已折叠。
......@@ -608,14 +608,17 @@ struct GetTableKeyV2<ObIndexSchemaHashWrapper, ObSimpleTableSchemaV2*> {
if (OB_UNLIKELY(OB_SUCCESS != index_schema->check_if_oracle_compat_mode(is_oracle_mode))) {
ObIndexSchemaHashWrapper null_wrap;
return null_wrap;
} else if (is_oracle_mode && !index_schema->is_in_recyclebin()) {
// oracle mode and index is not in recyclebin
ObIndexSchemaHashWrapper index_schema_hash_wrapper(
index_schema->get_tenant_id(), index_schema->get_database_id(), index_schema->get_origin_index_name_str());
} else if (index_schema->is_in_recyclebin()) { // index is in recyclebin
ObIndexSchemaHashWrapper index_schema_hash_wrapper(index_schema->get_tenant_id(),
index_schema->get_database_id(),
common::OB_INVALID_ID,
index_schema->get_table_name_str());
return index_schema_hash_wrapper;
} else { // mysql mode or index is in recyclebin
ObIndexSchemaHashWrapper index_schema_hash_wrapper(
index_schema->get_tenant_id(), index_schema->get_database_id(), index_schema->get_table_name_str());
} else {
ObIndexSchemaHashWrapper index_schema_hash_wrapper(index_schema->get_tenant_id(),
index_schema->get_database_id(),
is_oracle_mode ? common::OB_INVALID_ID : index_schema->get_data_table_id(),
index_schema->get_origin_index_name_str());
return index_schema_hash_wrapper;
}
} else {
......@@ -887,7 +890,7 @@ private:
int rebuild_schema_meta_if_not_consistent();
int rebuild_table_hashmap(uint64_t& fk_cnt, uint64_t& cst_cnt);
int rebuild_db_hashmap();
uint64_t extract_data_table_id_from_index_name(const common::ObString& index_name) const;
int get_table_schema(const uint64_t tenant_id, const uint64_t database_id, const uint64_t session_id,
const common::ObString& table_name, const ObSimpleTableSchemaV2*& table_schema) const;
int get_index_schema(const uint64_t tenant_id, const uint64_t database_id, const common::ObString& table_name,
......
......@@ -3707,10 +3707,12 @@ inline uint64_t ObColumnSchemaHashWrapper::hash() const
}
class ObIndexSchemaHashWrapper {
public:
ObIndexSchemaHashWrapper() : tenant_id_(common::OB_INVALID_ID), database_id_(common::OB_INVALID_ID)
ObIndexSchemaHashWrapper()
: tenant_id_(common::OB_INVALID_ID), database_id_(common::OB_INVALID_ID), data_table_id_(common::OB_INVALID_ID)
{}
ObIndexSchemaHashWrapper(uint64_t tenant_id, const uint64_t database_id, const common::ObString& index_name)
: tenant_id_(tenant_id), database_id_(database_id), index_name_(index_name)
ObIndexSchemaHashWrapper(
uint64_t tenant_id, const uint64_t database_id, const uint64_t data_table_id, const common::ObString& index_name)
: tenant_id_(tenant_id), database_id_(database_id), data_table_id_(data_table_id), index_name_(index_name)
{}
~ObIndexSchemaHashWrapper()
{}
......@@ -3725,6 +3727,10 @@ public:
{
return database_id_;
}
inline uint64_t get_data_table_id() const
{
return data_table_id_;
}
inline const common::ObString& get_index_name() const
{
return index_name_;
......@@ -3733,6 +3739,7 @@ public:
private:
uint64_t tenant_id_;
uint64_t database_id_;
uint64_t data_table_id_; // only for mysql mode
common::ObString index_name_;
};
......@@ -3741,6 +3748,7 @@ inline uint64_t ObIndexSchemaHashWrapper::hash() const
uint64_t hash_ret = 0;
hash_ret = common::murmurhash(&tenant_id_, sizeof(uint64_t), 0);
hash_ret = common::murmurhash(&database_id_, sizeof(uint64_t), hash_ret);
hash_ret = common::murmurhash(&data_table_id_, sizeof(uint64_t), hash_ret);
// case insensitive
hash_ret = common::ObCharset::hash(common::CS_TYPE_UTF8MB4_GENERAL_CI, index_name_, hash_ret);
return hash_ret;
......@@ -3751,7 +3759,7 @@ inline bool ObIndexSchemaHashWrapper::operator==(const ObIndexSchemaHashWrapper&
// mysql case insensitive
// oracle case sensitive
ObCompareNameWithTenantID name_cmp(tenant_id_);
return (tenant_id_ == rv.tenant_id_) && (database_id_ == rv.database_id_) &&
return (tenant_id_ == rv.tenant_id_) && (database_id_ == rv.database_id_) && (data_table_id_ == rv.data_table_id_) &&
(0 == name_cmp.compare(index_name_, rv.index_name_));
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册