From ab322eaa2b7b153e7318cb3454141e07039a7ca7 Mon Sep 17 00:00:00 2001 From: xy Date: Fri, 17 Nov 2023 16:54:31 +0800 Subject: [PATCH] [improvement](detailMessage) add AvailCapacity prompt in detailMessage (#26328) Co-authored-by: xingying01 --- .../org/apache/doris/system/SystemInfoService.java | 3 ++- .../org/apache/doris/catalog/CreateTableTest.java | 8 +++++--- .../org/apache/doris/catalog/ModifyBackendTest.java | 11 ++++++----- 3 files changed, 13 insertions(+), 9 deletions(-) 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 666e89b392..3ccb6d6345 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 @@ -593,7 +593,8 @@ public class SystemInfoService { if (!failedEntries.isEmpty()) { String failedMsg = Joiner.on("\n").join(failedEntries); throw new DdlException("Failed to find enough backend, please check the replication num," - + "replication tag and storage medium.\n" + "Create failed replications:\n" + failedMsg); + + "replication tag and storage medium and avail capacity of backends.\n" + + "Create failed replications:\n" + failedMsg); } } 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 3bf6af35c2..d037219e96 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 @@ -268,11 +268,13 @@ public class CreateTableTest extends TestWithFeService { ConfigBase.setMutableConfig("disable_storage_medium_check", "false"); ExceptionChecker - .expectThrowsWithMsg(DdlException.class, "Failed to find enough backend, please check the replication num,replication tag and storage medium.\n" + .expectThrowsWithMsg(DdlException.class, + "Failed to find enough backend, please check the replication num,replication tag and storage medium and avail capacity of backends.\n" + "Create failed replications:\n" + "replication tag: {\"location\" : \"default\"}, replication num: 1, storage medium: SSD", - () -> createTable("create table test.tb7(key1 int, key2 varchar(10)) distributed by hash(key1) \n" - + "buckets 1 properties('replication_num' = '1', 'storage_medium' = 'ssd');")); + () -> createTable( + "create table test.tb7(key1 int, key2 varchar(10)) distributed by hash(key1) \n" + + "buckets 1 properties('replication_num' = '1', 'storage_medium' = 'ssd');")); ExceptionChecker .expectThrowsWithMsg(DdlException.class, "sequence column only support UNIQUE_KEYS", 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 2cfa4e9b90..588adf32b0 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 @@ -81,7 +81,8 @@ 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 enough backend, please check the replication num,replication tag and storage medium.\n" + ExceptionChecker.expectThrowsWithMsg(DdlException.class, + "Failed to find enough backend, please check the replication num,replication tag and storage medium and avail capacity of backends.\n" + "Create failed replications:\n" + "replication tag: {\"location\" : \"default\"}, replication num: 1, storage medium: SSD", () -> DdlExecutor.execute(Env.getCurrentEnv(), createStmt)); @@ -151,10 +152,10 @@ public class ModifyBackendTest { String wrongAlterStr = "alter table test.tbl4 modify partition " + partName + " set ('replication_allocation' = 'tag.location.zonex:1')"; ExceptionChecker.expectThrowsWithMsg(AnalysisException.class, "errCode = 2, detailMessage = " - + "errCode = 2, detailMessage = Failed to find enough backend, " - + "please check the replication num,replication tag and storage medium.\n" - + "Create failed replications:\n" - + "replication tag: {\"location\" : \"zonex\"}, replication num: 1, storage medium: null", + + "errCode = 2, detailMessage = Failed to find enough backend, " + + "please check the replication num,replication tag and storage medium and avail capacity of backends.\n" + + "Create failed replications:\n" + + "replication tag: {\"location\" : \"zonex\"}, replication num: 1, storage medium: null", () -> UtFrameUtils.parseAndAnalyzeStmt(wrongAlterStr, connectContext)); tblProperties = tableProperty.getProperties(); Assert.assertTrue(tblProperties.containsKey("default.replication_allocation"));