Skip to content

Commit fec0210

Browse files
obdevwyfanxiaoPoseidon-fan
authored andcommitted
修复 Fork Table 时索引表为列存格式的 bug
Co-authored-by: wyfanxiao <wyfanxiao@163.com> Co-authored-by: Poseidon-fan <18646154381@163.com>
1 parent 89a52de commit fec0210

1 file changed

Lines changed: 25 additions & 4 deletions

File tree

src/rootserver/fork_table/ob_fork_table_helper.cpp

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ static int check_table_index_features(const ObTableSchema &table_schema,
4242
bool &has_ivf_index,
4343
bool &has_spatial_index,
4444
bool &has_global_index,
45-
bool &has_async_vec_index)
45+
bool &has_async_vec_index,
46+
bool &has_column_store_index)
4647
{
4748
int ret = OB_SUCCESS;
4849
ObSEArray<ObAuxTableMetaInfo, 16> simple_index_infos;
@@ -51,14 +52,16 @@ static int check_table_index_features(const ObTableSchema &table_schema,
5152
has_spatial_index = false;
5253
has_global_index = false;
5354
has_async_vec_index = false;
55+
has_column_store_index = false;
5456
if (OB_FAIL(table_schema.get_simple_index_infos(simple_index_infos))) {
5557
LOG_WARN("fail to get simple index infos", K(ret));
5658
} else {
5759
const uint64_t tenant_id = table_schema.get_tenant_id();
5860
const bool is_heap_table = table_schema.is_heap_organized_table();
5961
for (int64_t i = 0; OB_SUCC(ret) && i < simple_index_infos.count() &&
6062
(!has_semantic_index || !has_ivf_index ||
61-
!has_spatial_index || !has_global_index || !has_async_vec_index);
63+
!has_spatial_index || !has_global_index ||
64+
!has_async_vec_index || !has_column_store_index);
6265
++i) {
6366
const ObTableSchema *index_schema = nullptr;
6467
const uint64_t index_table_id = simple_index_infos.at(i).table_id_;
@@ -89,6 +92,15 @@ static int check_table_index_features(const ObTableSchema &table_schema,
8992
if (index_schema->is_global_index_table()) {
9093
has_global_index = true;
9194
}
95+
if (!has_column_store_index) {
96+
int64_t index_cg_cnt = 0;
97+
if (OB_FAIL(index_schema->get_store_column_group_count(index_cg_cnt))) {
98+
LOG_WARN("failed to get store column group count for index", KR(ret),
99+
K(index_table_id));
100+
} else if (index_cg_cnt > 1) {
101+
has_column_store_index = true;
102+
}
103+
}
92104
}
93105
}
94106
}
@@ -104,11 +116,13 @@ int check_has_async_vector_index(const ObTableSchema &src_table_schema,
104116
bool has_ivf_index = false;
105117
bool has_spatial_index = false;
106118
bool has_global_index = false;
119+
bool has_column_store_index = false;
107120
has_async_vec_index = false;
108121
if (OB_FAIL(check_table_index_features(src_table_schema, schema_guard,
109122
has_semantic_index, has_ivf_index,
110123
has_spatial_index, has_global_index,
111-
has_async_vec_index))) {
124+
has_async_vec_index,
125+
has_column_store_index))) {
112126
LOG_WARN("fail to check table index features", K(ret));
113127
}
114128
return ret;
@@ -124,6 +138,7 @@ int check_fork_table_supported(const ObTableSchema &src_table_schema,
124138
bool has_spatial_index = false;
125139
bool has_global_index = false;
126140
bool has_async_vec_index = false;
141+
bool has_column_store_index = false;
127142
int64_t column_group_cnt = 0;
128143
if (src_table_schema.is_tmp_table() || src_table_schema.is_ctas_tmp_table()) {
129144
ret = OB_NOT_SUPPORTED;
@@ -170,8 +185,14 @@ int check_fork_table_supported(const ObTableSchema &src_table_schema,
170185
} else if (OB_FAIL(check_table_index_features(
171186
src_table_schema, schema_guard, has_semantic_index,
172187
has_ivf_index, has_spatial_index, has_global_index,
173-
has_async_vec_index))) {
188+
has_async_vec_index, has_column_store_index))) {
174189
LOG_WARN("fail to check table index features", K(ret), K(src_table_schema));
190+
} else if (has_column_store_index) {
191+
ret = OB_NOT_SUPPORTED;
192+
LOG_WARN("fork table on table with column store index is not supported",
193+
KR(ret), K(src_table_schema));
194+
LOG_USER_ERROR(OB_NOT_SUPPORTED,
195+
"fork table on table with column store index is");
175196
} else if (has_semantic_index) {
176197
ret = OB_NOT_SUPPORTED;
177198
LOG_WARN("fork table on table with semantic index is not supported",

0 commit comments

Comments
 (0)