Skip to content

Commit

Permalink
[improvement](detailMessage) add AvailCapacity prompt in detailMessage (
Browse files Browse the repository at this point in the history
apache#26328)

Co-authored-by: xingying01 <[email protected]>
  • Loading branch information
2 people authored and 胥剑旭 committed Dec 14, 2023
1 parent e757377 commit 6bb7087
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,8 @@ public Map<Tag, List<Long>> selectBackendIdsForReplicaCreation(
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);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,11 +268,13 @@ public void testAbnormal() throws DdlException, ConfigException {

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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ public void testModifyBackendTag() throws Exception {
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));
Expand Down Expand Up @@ -151,10 +152,10 @@ public void testModifyBackendTag() throws Exception {
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"));
Expand Down

0 comments on commit 6bb7087

Please sign in to comment.