diff --git a/fe/fe-core/src/main/java/org/apache/doris/system/BeSelectionPolicy.java b/fe/fe-core/src/main/java/org/apache/doris/system/BeSelectionPolicy.java index acd38f14bd..d0767caff6 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/system/BeSelectionPolicy.java +++ b/fe/fe-core/src/main/java/org/apache/doris/system/BeSelectionPolicy.java @@ -172,14 +172,7 @@ public class BeSelectionPolicy { @Override public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("cluster|query|load|schedule|tags|medium: "); - sb.append(cluster).append("|"); - sb.append(needQueryAvailable).append("|"); - sb.append(needLoadAvailable).append("|"); - sb.append(needScheduleAvailable).append("|"); - sb.append(resourceTags).append("|"); - sb.append(storageMedium); - return sb.toString(); + return String.format("cluster=%s | query=%s | load=%s | schedule=%s | tags=%s | medium=%s", + cluster, needLoadAvailable, needLoadAvailable, needScheduleAvailable, resourceTags, storageMedium); } } diff --git a/fe/fe-core/src/main/java/org/apache/doris/system/SystemInfoService.java b/fe/fe-core/src/main/java/org/apache/doris/system/SystemInfoService.java index 2696f685fa..c1048adbc8 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/system/SystemInfoService.java +++ b/fe/fe-core/src/main/java/org/apache/doris/system/SystemInfoService.java @@ -865,7 +865,7 @@ public class SystemInfoService { BeSelectionPolicy policy = builder.build(); List beIds = selectBackendIdsByPolicy(policy, entry.getValue()); if (beIds.isEmpty()) { - throw new DdlException("Failed to find " + entry.getValue() + " backends for policy: " + policy); + throw new DdlException("Failed to find " + entry.getValue() + " backend(s) for policy: " + policy); } chosenBackendIds.put(entry.getKey(), beIds); totalReplicaNum += beIds.size(); diff --git a/fe/fe-core/src/test/java/org/apache/doris/catalog/CreateTableTest.java b/fe/fe-core/src/test/java/org/apache/doris/catalog/CreateTableTest.java index 09def4437d..39817e2fcd 100644 --- a/fe/fe-core/src/test/java/org/apache/doris/catalog/CreateTableTest.java +++ b/fe/fe-core/src/test/java/org/apache/doris/catalog/CreateTableTest.java @@ -266,7 +266,7 @@ public class CreateTableTest { + "properties('replication_num' = '1', 'short_key' = '4');")); ExceptionChecker - .expectThrowsWithMsg(DdlException.class, "Failed to find 3 backends for policy", + .expectThrowsWithMsg(DdlException.class, "Failed to find 3 backend(s) for policy", () -> createTable("create table test.atbl5\n" + "(k1 int, k2 int, k3 int)\n" + "duplicate key(k1, k2, k3)\n" + "distributed by hash(k1) buckets 1\n" + "properties('replication_num' = '3');")); @@ -283,7 +283,7 @@ public class CreateTableTest { ConfigBase.setMutableConfig("disable_storage_medium_check", "false"); ExceptionChecker - .expectThrowsWithMsg(DdlException.class, " Failed to find 1 backends for policy:", + .expectThrowsWithMsg(DdlException.class, " Failed to find 1 backend(s) for policy:", () -> createTable("create table test.tb7(key1 int, key2 varchar(10)) distributed by hash(key1) \n" + "buckets 1 properties('replication_num' = '1', 'storage_medium' = 'ssd');")); diff --git a/fe/fe-core/src/test/java/org/apache/doris/catalog/ModifyBackendTest.java b/fe/fe-core/src/test/java/org/apache/doris/catalog/ModifyBackendTest.java index a01c555dbb..205bf84634 100644 --- a/fe/fe-core/src/test/java/org/apache/doris/catalog/ModifyBackendTest.java +++ b/fe/fe-core/src/test/java/org/apache/doris/catalog/ModifyBackendTest.java @@ -80,7 +80,7 @@ public class ModifyBackendTest { String createStr = "create table test.tbl1(\n" + "k1 int\n" + ") distributed by hash(k1)\n" + "buckets 3 properties(\n" + "\"replication_num\" = \"1\"\n" + ");"; CreateTableStmt createStmt = (CreateTableStmt) UtFrameUtils.parseAndAnalyzeStmt(createStr, connectContext); - ExceptionChecker.expectThrowsWithMsg(DdlException.class, "Failed to find 1 backends for policy:", + ExceptionChecker.expectThrowsWithMsg(DdlException.class, "Failed to find 1 backend(s) for policy:", () -> DdlExecutor.execute(Env.getCurrentEnv(), createStmt)); createStr = "create table test.tbl1(\n" + "k1 int\n" + ") distributed by hash(k1)\n" + "buckets 3 properties(\n" @@ -100,7 +100,7 @@ public class ModifyBackendTest { + ");"; CreateTableStmt createStmt3 = (CreateTableStmt) UtFrameUtils.parseAndAnalyzeStmt(createStr, connectContext); //partition create failed, because there is no BE with "default" tag - ExceptionChecker.expectThrowsWithMsg(DdlException.class, "Failed to find 3 backends for policy", + ExceptionChecker.expectThrowsWithMsg(DdlException.class, "Failed to find 3 backend(s) for policy", () -> DdlExecutor.execute(Env.getCurrentEnv(), createStmt3)); Database db = Env.getCurrentInternalCatalog().getDbNullable("default_cluster:test");