Skip to content

Commit 21168b4

Browse files
obdevob-robot
authored andcommitted
Fork Table 禁止列存
1 parent 34e0af1 commit 21168b4

3 files changed

Lines changed: 78 additions & 2 deletions

File tree

src/rootserver/fork_table/ob_fork_table_helper.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ int check_fork_table_supported(const ObTableSchema &src_table_schema,
105105
bool has_spatial_index = false;
106106
bool has_global_index = false;
107107
bool has_async_vec_index = false;
108+
int64_t column_group_cnt = 0;
108109
if (src_table_schema.is_tmp_table() || src_table_schema.is_ctas_tmp_table()) {
109110
ret = OB_NOT_SUPPORTED;
110111
LOG_WARN("fork table on temporary table is not supported", KR(ret),
@@ -137,6 +138,16 @@ int check_fork_table_supported(const ObTableSchema &src_table_schema,
137138
KR(ret));
138139
LOG_USER_ERROR(OB_NOT_SUPPORTED,
139140
"fork table on table required by materialized view is");
141+
} else if (OB_FAIL(src_table_schema.get_store_column_group_count(column_group_cnt))) {
142+
LOG_WARN("failed to get store column group count", KR(ret), K(src_table_schema));
143+
} else if (column_group_cnt > 1) {
144+
// column_group_cnt > 1 means the table has actual column store groups
145+
// (SINGLE_COLUMN_GROUP or ALL_COLUMN_GROUP) beyond the default row store group
146+
ret = OB_NOT_SUPPORTED;
147+
LOG_WARN("fork table on column store table is not supported", KR(ret),
148+
K(src_table_schema), K(column_group_cnt));
149+
LOG_USER_ERROR(OB_NOT_SUPPORTED,
150+
"fork table on column store table is");
140151
} else if (OB_FAIL(check_table_index_features(
141152
src_table_schema, schema_guard, has_semantic_index,
142153
has_ivf_index, has_spatial_index, has_global_index,

tools/deploy/mysql_test/test_suite/fork_table/r/mysql/fork_table_error.result

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,38 @@ create index idx_c1 on t15_gidx(c1) global partition by hash(c1) partitions 4;
320320
fork table t15_gidx to t15_gidx_fork;
321321
ERROR 0A000: fork table on partitioned table with global index is not supported
322322
============================================
323-
16. 清理
323+
16. Fork列存表(不支持)
324+
============================================
325+
# 16.1 纯列存(each column)
326+
drop table if exists t16_cs;
327+
Warnings:
328+
Note 1051 Unknown table 'db_fork_error.t16_cs'
329+
drop table if exists t16_cs_fork;
330+
Warnings:
331+
Note 1051 Unknown table 'db_fork_error.t16_cs_fork'
332+
create table t16_cs (
333+
id int primary key,
334+
c1 int,
335+
c2 varchar(50)
336+
) with column group(each column);
337+
fork table t16_cs to t16_cs_fork;
338+
ERROR 0A000: fork table on column store table is not supported
339+
# 16.2 行列混存(all columns + each column)
340+
drop table if exists t16_cs2;
341+
Warnings:
342+
Note 1051 Unknown table 'db_fork_error.t16_cs2'
343+
drop table if exists t16_cs2_fork;
344+
Warnings:
345+
Note 1051 Unknown table 'db_fork_error.t16_cs2_fork'
346+
create table t16_cs2 (
347+
id int primary key,
348+
c1 int,
349+
c2 varchar(50)
350+
) with column group(all columns, each column);
351+
fork table t16_cs2 to t16_cs2_fork;
352+
ERROR 0A000: fork table on column store table is not supported
353+
============================================
354+
17. 清理
324355
============================================
325356
drop table if exists t1;
326357
drop table if exists t2;
@@ -340,4 +371,6 @@ drop table if exists t12_trig_fork;
340371
drop table if exists t13_semantic;
341372
drop table if exists t14_spatial;
342373
drop table if exists t15_gidx;
374+
drop table if exists t16_cs;
375+
drop table if exists t16_cs2;
343376
drop database if exists db_fork_error;

tools/deploy/mysql_test/test_suite/fork_table/t/fork_table_error.test

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,37 @@ create index idx_c1 on t15_gidx(c1) global partition by hash(c1) partitions 4;
319319
fork table t15_gidx to t15_gidx_fork;
320320

321321
--echo ============================================
322-
--echo 16. 清理
322+
--echo 16. Fork列存表(不支持)
323+
--echo ============================================
324+
325+
--echo # 16.1 纯列存(each column)
326+
drop table if exists t16_cs;
327+
drop table if exists t16_cs_fork;
328+
329+
create table t16_cs (
330+
id int primary key,
331+
c1 int,
332+
c2 varchar(50)
333+
) with column group(each column);
334+
335+
--error 1235
336+
fork table t16_cs to t16_cs_fork;
337+
338+
--echo # 16.2 行列混存(all columns + each column)
339+
drop table if exists t16_cs2;
340+
drop table if exists t16_cs2_fork;
341+
342+
create table t16_cs2 (
343+
id int primary key,
344+
c1 int,
345+
c2 varchar(50)
346+
) with column group(all columns, each column);
347+
348+
--error 1235
349+
fork table t16_cs2 to t16_cs2_fork;
350+
351+
--echo ============================================
352+
--echo 17. 清理
323353
--echo ============================================
324354

325355
drop table if exists t1;
@@ -340,4 +370,6 @@ drop table if exists t12_trig_fork;
340370
drop table if exists t13_semantic;
341371
drop table if exists t14_spatial;
342372
drop table if exists t15_gidx;
373+
drop table if exists t16_cs;
374+
drop table if exists t16_cs2;
343375
drop database if exists db_fork_error;

0 commit comments

Comments
 (0)