This is an automated email from the ASF dual-hosted git repository. kxiao pushed a commit to branch branch-2.0 in repository https://gitbox.apache.org/repos/asf/doris.git
commit d363007e90dbc7496d6bf1340293ea51214237c4 Author: shee <13843187+qz...@users.noreply.github.com> AuthorDate: Mon Jul 24 09:01:16 2023 +0800 [Bug][Colocate] when adding a table to the colocate group, we should check that the number of buckets per partition is the same (#21906) for example CREATE TABLE `colocate_a` ( dt date, k1 int, v1 int ) ENGINE=OLAP DUPLICATE KEY(`k1`) PARTITION BY RANGE(`dt`) (PARTITION p1 VALUES [('2022-10-02'), ('2022-10-03')) DISTRIBUTED BY HASH(`k1`) BUCKETS 2 PROPERTIES ( "replication_num" = "3", "in_memory" = "false", "storage_format" = "V2" ); ALTER TABLE colocate_a set ("colocate_with" = "ab"); CREATE TABLE `colocate_b` ( dt date, k1 int, v1 int ) ENGINE=OLAP DUPLICATE KEY(`k1`) PARTITION BY RANGE(`dt`) (PARTITION p1 VALUES [('2022-10-02'), ('2022-10-03')) DISTRIBUTED BY HASH(`k1`) BUCKETS 2 PROPERTIES ( "replication_num" = "3", "in_memory" = "false", "storage_format" = "V2" ); ALTER TABLE colocate_b ADD PARTITION p2 VALUES [("2022-10-03"),("2022-10-04")) DISTRIBUTED BY HASH(k1) BUCKETS 10; ALTER TABLE colocate_b set ("colocate_with" = "ab"); table colocate_b partition p2 set bucket num is 10 then take it into group ab. In ColocateTableCheckerAndBalancer matchGroup occur : java.lang.IllegalStateException: 2 vs. 10 303861 at com.google.common.base.Preconditions.checkState(Preconditions.java:508) ~[guava-30.0-jre.jar:?] 303862 at org.apache.doris.clone.ColocateTableCheckerAndBalancer.matchGroup(ColocateTableCheckerAndBalancer.java:242) ~[doris-fe.jar:1.2-SNAPSHOT] 303863 at org.apache.doris.clone.ColocateTableCheckerAndBalancer.runAfterCatalogReady(ColocateTableCheckerAndBalancer.java:95) ~[doris-fe.jar:1.2-SNAPSHOT] 303864 at org.apache.doris.common.util.MasterDaemon.runOneCycle(MasterDaemon.java:58) ~[doris-fe.jar:1.2-SNAPSHOT] 303865 at org.apache.doris.common.util.Daemon.run(Daemon.java:116) ~[doris-fe.jar:1.2-SNAPSHOT] --------- Co-authored-by: shizhiqiang03 <shizhiqian...@meituan.com> --- .../src/main/java/org/apache/doris/catalog/ColocateGroupSchema.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/ColocateGroupSchema.java b/fe/fe-core/src/main/java/org/apache/doris/catalog/ColocateGroupSchema.java index 09e9437a35..b5004973c3 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/catalog/ColocateGroupSchema.java +++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/ColocateGroupSchema.java @@ -72,6 +72,11 @@ public class ColocateGroupSchema implements Writable { public void checkColocateSchema(OlapTable tbl) throws DdlException { checkDistribution(tbl.getDefaultDistributionInfo()); + // We add a table with many partitions to the colocate group, + // we need to check whether all partitions comply with the colocate group specification + for (Partition partition : tbl.getAllPartitions()) { + checkDistribution(partition.getDistributionInfo()); + } checkReplicaAllocation(tbl.getPartitionInfo()); } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org