forked from apache/doris
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[fix](dynamic partition) partition create failed after alter distribu…
…ted column (apache#20239) This pr fix following two problems: Problem1: Alter column comment make add dynamic partition failed inside issue apache#10811 create table with dynamic partition policy; restart FE; alter distribution column comment; alter dynamic_partition.end to trigger add new partition by dynamic partition scheduler; Then we got the error log, and the new partition create failed. dynamic add partition failed: errCode = 2, detailMessage = Cannot assign hash distribution with different distribution cols. default is: [id int(11) NULL COMMENT 'new_comment_of_id'], db: default_cluster:example_db, table: test_2 Problem2: rename distributed column, make old partition insert failed. inside apache#20405 The key point of the reproduce steps is restart FE. It seems all versions will be affected, include master and lts-1.1 and so on.
- Loading branch information
camby
authored
Jun 5, 2023
1 parent
d392791
commit 3c28a71
Showing
9 changed files
with
181 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -80,3 +80,5 @@ enable_struct_type=true | |
|
||
# enable mtmv | ||
enable_mtmv = true | ||
|
||
dynamic_partition_check_interval_seconds=5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
...ssion-test/suites/partition_p0/dynamic_partition/test_dynamic_partition_with_alter.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// Licensed to the Apache Software Foundation (ASF) under one | ||
// or more contributor license agreements. See the NOTICE file | ||
// distributed with this work for additional information | ||
// regarding copyright ownership. The ASF licenses this file | ||
// to you under the Apache License, Version 2.0 (the | ||
// "License"); you may not use this file except in compliance | ||
// with the License. You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, | ||
// software distributed under the License is distributed on an | ||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
// KIND, either express or implied. See the License for the | ||
// specific language governing permissions and limitations | ||
// under the License. | ||
|
||
suite("test_dynamic_partition_with_alter") { | ||
def tbl = "test_dynamic_partition_with_alter" | ||
sql "drop table if exists ${tbl}" | ||
sql """ | ||
CREATE TABLE IF NOT EXISTS ${tbl} | ||
( k1 date NOT NULL, k2 varchar(20) NOT NULL, k3 int sum NOT NULL ) | ||
AGGREGATE KEY(k1,k2) | ||
PARTITION BY RANGE(k1) ( ) | ||
DISTRIBUTED BY HASH(k1) BUCKETS 1 | ||
PROPERTIES ( | ||
"dynamic_partition.enable"="true", | ||
"dynamic_partition.end"="3", | ||
"dynamic_partition.buckets"="1", | ||
"dynamic_partition.start"="-3", | ||
"dynamic_partition.prefix"="p", | ||
"dynamic_partition.time_unit"="DAY", | ||
"dynamic_partition.create_history_partition"="true", | ||
"dynamic_partition.replication_allocation" = "tag.location.default: 1") | ||
""" | ||
result = sql "show partitions from ${tbl}" | ||
assertEquals(7, result.size()) | ||
|
||
// modify distributed column comment, then try to add too more dynamic partition | ||
sql """ alter table ${tbl} modify column k1 comment 'new_comment_for_k1' """ | ||
sql """ ADMIN SET FRONTEND CONFIG ('dynamic_partition_check_interval_seconds' = '1') """ | ||
sql """ alter table ${tbl} set('dynamic_partition.end'='5') """ | ||
result = sql "show partitions from ${tbl}" | ||
for (def retry = 0; retry < 15; retry++) { | ||
if (result.size() == 9) { | ||
break; | ||
} | ||
logger.info("wait dynamic partition scheduler, sleep 1s") | ||
sleep(1000); | ||
result = sql "show partitions from ${tbl}" | ||
} | ||
assertEquals(9, result.size()) | ||
|
||
sql "drop table ${tbl}" | ||
} |
60 changes: 60 additions & 0 deletions
60
...sion-test/suites/partition_p0/dynamic_partition/test_dynamic_partition_with_rename.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
// Licensed to the Apache Software Foundation (ASF) under one | ||
// or more contributor license agreements. See the NOTICE file | ||
// distributed with this work for additional information | ||
// regarding copyright ownership. The ASF licenses this file | ||
// to you under the Apache License, Version 2.0 (the | ||
// "License"); you may not use this file except in compliance | ||
// with the License. You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, | ||
// software distributed under the License is distributed on an | ||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
// KIND, either express or implied. See the License for the | ||
// specific language governing permissions and limitations | ||
// under the License. | ||
|
||
suite("test_dynamic_partition_with_rename") { | ||
def tbl = "test_dynamic_partition_with_rename" | ||
sql "drop table if exists ${tbl}" | ||
sql """ | ||
CREATE TABLE IF NOT EXISTS ${tbl} | ||
( k1 date NOT NULL, k2 varchar(20) NOT NULL, k3 int sum NOT NULL ) | ||
AGGREGATE KEY(k1,k2) | ||
PARTITION BY RANGE(k1) ( ) | ||
DISTRIBUTED BY HASH(k1) BUCKETS 1 | ||
PROPERTIES ( | ||
"dynamic_partition.enable"="true", | ||
"dynamic_partition.end"="3", | ||
"dynamic_partition.buckets"="1", | ||
"dynamic_partition.start"="-3", | ||
"dynamic_partition.prefix"="p", | ||
"dynamic_partition.time_unit"="DAY", | ||
"dynamic_partition.create_history_partition"="true", | ||
"dynamic_partition.replication_allocation" = "tag.location.default: 1") | ||
""" | ||
result = sql "show partitions from ${tbl}" | ||
assertEquals(7, result.size()) | ||
|
||
// rename distributed column, then try to add too more dynamic partition | ||
sql "alter table ${tbl} rename column k1 renamed_k1" | ||
sql """ ADMIN SET FRONTEND CONFIG ('dynamic_partition_check_interval_seconds' = '1') """ | ||
sql """ alter table ${tbl} set('dynamic_partition.end'='5') """ | ||
result = sql "show partitions from ${tbl}" | ||
for (def retry = 0; retry < 15; retry++) { | ||
if (result.size() == 9) { | ||
break; | ||
} | ||
logger.info("wait dynamic partition scheduler, sleep 1s") | ||
sleep(1000); | ||
result = sql "show partitions from ${tbl}" | ||
} | ||
assertEquals(9, result.size()) | ||
for (def line = 0; line < result.size(); line++) { | ||
// XXX: DistributionKey at pos(7), next maybe impl by sql meta | ||
assertEquals("renamed_k1", result.get(line).get(7)) | ||
} | ||
|
||
sql "drop table ${tbl}" | ||
} |