[DATA_DICT] fix obcdc exist caused by index_tablet not found in data_dict
This commit is contained in:
@ -587,7 +587,8 @@ int ObDataDictService::filter_table_(const share::schema::ObTableSchema *table_s
|
|||||||
DDLOG(WARN, "invalid table_schema", KR(ret));
|
DDLOG(WARN, "invalid table_schema", KR(ret));
|
||||||
} else {
|
} else {
|
||||||
is_filtered =
|
is_filtered =
|
||||||
! (table_schema->is_user_table()
|
! (table_schema->has_tablet()
|
||||||
|
|| table_schema->is_user_table()
|
||||||
|| table_schema->is_unique_index()
|
|| table_schema->is_unique_index()
|
||||||
|| table_schema->is_tmp_table());
|
|| table_schema->is_tmp_table());
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1071,18 +1071,8 @@ int ObDictTableMeta::build_index_info_(const schema::ObTableSchema &table_schema
|
|||||||
int ret = OB_SUCCESS;
|
int ret = OB_SUCCESS;
|
||||||
const common::ObIndexInfo &index_info = table_schema.get_index_info();
|
const common::ObIndexInfo &index_info = table_schema.get_index_info();
|
||||||
const ObIArray<ObAuxTableMetaInfo> &simple_index_infos = table_schema.get_simple_index_infos();
|
const ObIArray<ObAuxTableMetaInfo> &simple_index_infos = table_schema.get_simple_index_infos();
|
||||||
index_column_count_ = index_info.get_size();
|
|
||||||
const int64_t alloc_size = sizeof(common::ObIndexColumn) * index_column_count_;
|
|
||||||
|
|
||||||
if (OB_ISNULL(allocator_)) {
|
if (table_schema.is_user_table()) {
|
||||||
ret = OB_ERR_UNEXPECTED;
|
|
||||||
DDLOG(WARN, "invalid allocator_", KR(ret));
|
|
||||||
} else if (index_column_count_ <= 0) {
|
|
||||||
DDLOG(TRACE, "not found index_cols_, skip", KPC(this));
|
|
||||||
} else if (OB_ISNULL(index_cols_ = static_cast<ObIndexColumn*>(allocator_->alloc(alloc_size)))) {
|
|
||||||
ret = OB_ALLOCATE_MEMORY_FAILED;
|
|
||||||
DDLOG(WARN, "alloc for index_cols_ failed", KR(ret), K(alloc_size), KPC(this));
|
|
||||||
} else {
|
|
||||||
// build index_table_id_arr
|
// build index_table_id_arr
|
||||||
for (int i = 0; OB_SUCC(ret) &&i < simple_index_infos.count(); i++) {
|
for (int i = 0; OB_SUCC(ret) &&i < simple_index_infos.count(); i++) {
|
||||||
ObAuxTableMetaInfo index_table_info;
|
ObAuxTableMetaInfo index_table_info;
|
||||||
@ -1095,7 +1085,20 @@ int ObDictTableMeta::build_index_info_(const schema::ObTableSchema &table_schema
|
|||||||
KR(ret), K(i), K(simple_index_infos), K_(unique_index_tid_arr), KPC(this));
|
KR(ret), K(i), K(simple_index_infos), K_(unique_index_tid_arr), KPC(this));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (table_schema.is_unique_index()) {
|
||||||
|
// only build index column info for unique index table, cause OBCDC only use unique_index info.
|
||||||
|
index_column_count_ = index_info.get_size();
|
||||||
|
const int64_t alloc_size = sizeof(common::ObIndexColumn) * index_column_count_;
|
||||||
|
|
||||||
|
if (OB_ISNULL(allocator_)) {
|
||||||
|
ret = OB_ERR_UNEXPECTED;
|
||||||
|
DDLOG(WARN, "invalid allocator_", KR(ret));
|
||||||
|
} else if (index_column_count_ <= 0) {
|
||||||
|
DDLOG(TRACE, "not found index_cols_, skip", KPC(this));
|
||||||
|
} else if (OB_ISNULL(index_cols_ = static_cast<ObIndexColumn*>(allocator_->alloc(alloc_size)))) {
|
||||||
|
ret = OB_ALLOCATE_MEMORY_FAILED;
|
||||||
|
DDLOG(WARN, "alloc for index_cols_ failed", KR(ret), K(alloc_size), KPC(this));
|
||||||
|
} else {
|
||||||
// build index_columns
|
// build index_columns
|
||||||
for (int i = 0; OB_SUCC(ret) && i < index_column_count_; i++) {
|
for (int i = 0; OB_SUCC(ret) && i < index_column_count_; i++) {
|
||||||
ObIndexColumn *idx_col = new (index_cols_ + i) ObIndexColumn();
|
ObIndexColumn *idx_col = new (index_cols_ + i) ObIndexColumn();
|
||||||
@ -1111,6 +1114,10 @@ int ObDictTableMeta::build_index_info_(const schema::ObTableSchema &table_schema
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// ignore index info of other table type
|
||||||
|
// and other type of table exclude user table and unique index table
|
||||||
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -1159,6 +1166,10 @@ int ObDictTableMeta::build_index_info_(const ObDictTableMeta &src_table_meta)
|
|||||||
int ObDictTableMeta::build_rowkey_info_(const schema::ObTableSchema &table_schema)
|
int ObDictTableMeta::build_rowkey_info_(const schema::ObTableSchema &table_schema)
|
||||||
{
|
{
|
||||||
int ret = OB_SUCCESS;
|
int ret = OB_SUCCESS;
|
||||||
|
|
||||||
|
if (!table_schema.is_user_table()) {
|
||||||
|
// only record rowkey column info for user table.
|
||||||
|
} else {
|
||||||
const common::ObRowkeyInfo &rowkey_info = table_schema.get_rowkey_info();
|
const common::ObRowkeyInfo &rowkey_info = table_schema.get_rowkey_info();
|
||||||
rowkey_column_count_ = rowkey_info.get_size();
|
rowkey_column_count_ = rowkey_info.get_size();
|
||||||
const int64_t alloc_size = sizeof(common::ObRowkeyColumn) * rowkey_column_count_;
|
const int64_t alloc_size = sizeof(common::ObRowkeyColumn) * rowkey_column_count_;
|
||||||
@ -1183,6 +1194,7 @@ int ObDictTableMeta::build_rowkey_info_(const schema::ObTableSchema &table_schem
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -1224,7 +1236,9 @@ int ObDictTableMeta::build_column_info_(const schema::ObTableSchema &table_schem
|
|||||||
int ret = OB_SUCCESS;
|
int ret = OB_SUCCESS;
|
||||||
common::ObArray<share::schema::ObColDesc> column_ids;
|
common::ObArray<share::schema::ObColDesc> column_ids;
|
||||||
|
|
||||||
if (OB_ISNULL(allocator_)) {
|
if (!table_schema.is_user_table()) {
|
||||||
|
// only build_column_info_ for user table.
|
||||||
|
} else if (OB_ISNULL(allocator_)) {
|
||||||
ret = OB_ERR_UNEXPECTED;
|
ret = OB_ERR_UNEXPECTED;
|
||||||
DDLOG(WARN, "invalid allocator_", KR(ret));
|
DDLOG(WARN, "invalid allocator_", KR(ret));
|
||||||
} else if (OB_FAIL(table_schema.get_column_ids(column_ids))) {
|
} else if (OB_FAIL(table_schema.get_column_ids(column_ids))) {
|
||||||
|
|||||||
Reference in New Issue
Block a user