[improvement](detailMessage) add AvailCapacity prompt in detailMessage (#26328)

Co-authored-by: xingying01 <xingying01@corp.netease.com>
This commit is contained in:
xy
2023-11-17 16:54:31 +08:00
committed by GitHub
parent 593e3662b0
commit ab322eaa2b
3 changed files with 13 additions and 9 deletions

View File

@ -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);
}
}

View File

@ -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",

View File

@ -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"));