Skip to content

Commit 792260b

Browse files
committed
update
1 parent 6f78c73 commit 792260b

File tree

6 files changed

+179
-253
lines changed

6 files changed

+179
-253
lines changed

fe/fe-core/src/main/java/org/apache/doris/backup/RestoreJob.java

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -336,17 +336,6 @@ public boolean isSameWithUpstream() {
336336
return RestoreCommand.STORAGE_MEDIUM_SAME_WITH_UPSTREAM.equals(storageMedium);
337337
}
338338

339-
// Get target storage medium (only valid when not same_with_upstream)
340-
public TStorageMedium getTargetStorageMedium() {
341-
if (RestoreCommand.STORAGE_MEDIUM_HDD.equals(storageMedium)) {
342-
return TStorageMedium.HDD;
343-
} else if (RestoreCommand.STORAGE_MEDIUM_SSD.equals(storageMedium)) {
344-
return TStorageMedium.SSD;
345-
}
346-
throw new IllegalStateException("getTargetStorageMedium() should not be called "
347-
+ "when storage_medium is 'same_with_upstream'");
348-
}
349-
350339
// Get target allocation mode as enum
351340
private DataProperty.MediumAllocationMode getTargetAllocationMode() {
352341
if (RestoreCommand.MEDIUM_ALLOCATION_MODE_STRICT.equals(mediumAllocationMode)) {

fe/fe-core/src/test/java/org/apache/doris/backup/RestoreJobTest.java

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -406,34 +406,4 @@ jobInfo, false, new ReplicaAllocation((short) 3), 100000, -1, false, false, fals
406406
in.close();
407407
Files.delete(path);
408408
}
409-
410-
@Test
411-
public void testGetTargetStorageMediumWithHddMode() {
412-
RestoreJob hddJob = new RestoreJob(label, "2018-01-01 01:01:01", db.getId(), db.getFullName(),
413-
jobInfo, false, new ReplicaAllocation((short) 3), 100000, -1, false, false, false, false,
414-
false, false, false, false, "hdd", "strict", env, repo.getId());
415-
416-
// In hdd mode, target storage medium should be HDD
417-
Assert.assertEquals(TStorageMedium.HDD, hddJob.getTargetStorageMedium());
418-
}
419-
420-
@Test
421-
public void testGetTargetStorageMediumWithSsdMode() {
422-
RestoreJob ssdJob = new RestoreJob(label, "2018-01-01 01:01:01", db.getId(), db.getFullName(),
423-
jobInfo, false, new ReplicaAllocation((short) 3), 100000, -1, false, false, false, false,
424-
false, false, false, false, "ssd", "strict", env, repo.getId());
425-
426-
// In ssd mode, target storage medium should be SSD
427-
Assert.assertEquals(TStorageMedium.SSD, ssdJob.getTargetStorageMedium());
428-
}
429-
430-
@Test
431-
public void testGetTargetStorageMediumWithSameWithUpstreamMode() {
432-
RestoreJob sameWithUpstreamJob = new RestoreJob(label, "2018-01-01 01:01:01", db.getId(), db.getFullName(),
433-
jobInfo, false, new ReplicaAllocation((short) 3), 100000, -1, false, false, false, false,
434-
false, false, false, false, "same_with_upstream", "strict", env, repo.getId());
435-
436-
// In same_with_upstream mode, target storage medium should be null (will use upstream's medium)
437-
Assert.assertNull(sameWithUpstreamJob.getTargetStorageMedium());
438-
}
439409
}

fe/fe-core/src/test/java/org/apache/doris/catalog/CreateTableTest.java

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -297,29 +297,10 @@ public void testAbnormal() throws DdlException, ConfigException {
297297
ConfigBase.setMutableConfig("disable_storage_medium_check", "false");
298298
ExceptionChecker
299299
.expectThrowsWithMsg(DdlException.class,
300-
"Failed to find enough backend, please check the replication num,replication tag and storage medium and avail capacity of backends "
301-
+ "or maybe all be on same host."
302-
+ Env.getCurrentSystemInfo().getDetailsForCreateReplica(new ReplicaAllocation((short) 1)) + "\n"
303-
+ "Create failed replications:\n"
304-
+ "replication tag: {\"location\" : \"default\"}, replication num: 1, storage medium: SSD",
300+
"Invalid medium_allocation_mode value: 'invalid_mode'. Valid options are: 'strict', 'adaptive'",
305301
() -> createTable(
306302
"create table test.tb7(key1 int, key2 varchar(10)) distributed by hash(key1) \n"
307-
+ "buckets 1 properties('replication_num' = '1', 'storage_medium' = 'ssd', 'medium_allocation_mode' = 'strict');"));
308-
309-
ExceptionChecker
310-
.expectThrowsWithMsg(DdlException.class,
311-
"Failed to find enough backend, please check the replication num,replication tag and storage medium and avail capacity of backends "
312-
+ "or maybe all be on same host."
313-
+ Env.getCurrentSystemInfo().getDetailsForCreateReplica(new ReplicaAllocation((short) 1)) + "\n"
314-
+ "Create failed replications:\n"
315-
+ "replication tag: {\"location\" : \"default\"}, replication num: 1, storage medium: SSD",
316-
() -> createTable("create table test.tb7_1(key1 int, key2 varchar(10))\n"
317-
+ "PARTITION BY RANGE(`key1`) (\n"
318-
+ " PARTITION `p1` VALUES LESS THAN (\"10\"),\n"
319-
+ " PARTITION `p2` VALUES LESS THAN (\"20\"),\n"
320-
+ " PARTITION `p3` VALUES LESS THAN (\"30\"))\n"
321-
+ "distributed by hash(key1)\n"
322-
+ "buckets 1 properties('replication_num' = '1', 'storage_medium' = 'ssd', 'medium_allocation_mode' = 'strict');"));
303+
+ "buckets 1 properties('replication_num' = '1', 'medium_allocation_mode' = 'invalid_mode');"));
323304

324305
ExceptionChecker
325306
.expectThrowsWithMsg(DdlException.class, "sequence column only support UNIQUE_KEYS",

fe/fe-core/src/test/java/org/apache/doris/nereids/trees/plans/CreateTableCommandTest.java

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
import org.apache.doris.catalog.Database;
2929
import org.apache.doris.catalog.Env;
3030
import org.apache.doris.catalog.OlapTable;
31-
import org.apache.doris.catalog.ReplicaAllocation;
3231
import org.apache.doris.catalog.ScalarType;
3332
import org.apache.doris.catalog.TabletMeta;
3433
import org.apache.doris.catalog.Type;
@@ -294,13 +293,9 @@ public void testAbnormal() throws ConfigException {
294293

295294
ConfigBase.setMutableConfig("disable_storage_medium_check", "false");
296295
checkThrow(org.apache.doris.common.DdlException.class,
297-
"Failed to find enough backend, please check the replication num,replication tag and storage medium and avail capacity of backends "
298-
+ "or maybe all be on same host."
299-
+ Env.getCurrentSystemInfo().getDetailsForCreateReplica(new ReplicaAllocation((short) 1)) + "\n"
300-
+ "Create failed replications:\n"
301-
+ "replication tag: {\"location\" : \"default\"}, replication num: 1, storage medium: SSD",
296+
"Invalid medium_allocation_mode value: 'invalid_mode'. Valid options are: 'strict', 'adaptive'",
302297
() -> createTable("create table test.tb7(key1 int, key2 varchar(10)) distributed by hash(key1) \n"
303-
+ "buckets 1 properties('replication_num' = '1', 'storage_medium' = 'ssd', 'medium_allocation_mode' = 'strict');"));
298+
+ "buckets 1 properties('replication_num' = '1', 'medium_allocation_mode' = 'invalid_mode');"));
304299

305300
checkThrow(org.apache.doris.common.DdlException.class, "sequence column only support UNIQUE_KEYS",
306301
() -> createTable("create table test.atbl8\n" + "(k1 varchar(40), k2 int, v1 int sum)\n"

regression-test/data/query_p0/system/test_table_properties.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
-- This file is automatically generated. You should know what you did if you want to edit this
22
-- !select_check_1 --
3-
108
3+
111
44

55
-- !select_check_2 --
66
internal test_table_properties_db duplicate_table _auto_bucket false

0 commit comments

Comments
 (0)