Skip to content

Commit 10f96ac

Browse files
committed
udpate test
1 parent 3cd82e1 commit 10f96ac

12 files changed

+1291
-1643
lines changed

fe/fe-core/src/main/java/org/apache/doris/catalog/DiskInfo.java

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
package org.apache.doris.catalog;
1919

2020
import org.apache.doris.common.Config;
21+
import org.apache.doris.common.util.DebugPointUtil;
2122
import org.apache.doris.thrift.TStorageMedium;
2223

2324
import com.google.gson.annotations.SerializedName;
@@ -164,8 +165,47 @@ public void setStorageMedium(TStorageMedium storageMedium) {
164165
* Check if this disk's capacity reach the limit. Return true if yes.
165166
* if floodStage is true, use floodStage threshold to check.
166167
* floodStage threshold means a loosely limit, and we use 'AND' to give a more loosely limit.
168+
*
169+
* Debug points:
170+
* - DiskInfo.exceedLimit.ssd.alwaysTrue: Force SSD disks to return true (exceed limit)
171+
* - DiskInfo.exceedLimit.hdd.alwaysTrue: Force HDD disks to return true (exceed limit)
172+
* - DiskInfo.exceedLimit.ssd.alwaysFalse: Force SSD disks to return false (available)
173+
* - DiskInfo.exceedLimit.hdd.alwaysFalse: Force HDD disks to return false (available)
167174
*/
168175
public boolean exceedLimit(boolean floodStage) {
176+
// Debug point: Force specific medium to report as exceed limit
177+
if (storageMedium == TStorageMedium.SSD) {
178+
if (DebugPointUtil.isEnable("DiskInfo.exceedLimit.ssd.alwaysTrue")) {
179+
if (LOG.isDebugEnabled()) {
180+
LOG.debug("Debug point active: DiskInfo.exceedLimit.ssd.alwaysTrue, "
181+
+ "forcing SSD disk {} to report exceed limit", rootPath);
182+
}
183+
return true;
184+
}
185+
if (DebugPointUtil.isEnable("DiskInfo.exceedLimit.ssd.alwaysFalse")) {
186+
if (LOG.isDebugEnabled()) {
187+
LOG.debug("Debug point active: DiskInfo.exceedLimit.ssd.alwaysFalse, "
188+
+ "forcing SSD disk {} to report available", rootPath);
189+
}
190+
return false;
191+
}
192+
} else if (storageMedium == TStorageMedium.HDD) {
193+
if (DebugPointUtil.isEnable("DiskInfo.exceedLimit.hdd.alwaysTrue")) {
194+
if (LOG.isDebugEnabled()) {
195+
LOG.debug("Debug point active: DiskInfo.exceedLimit.hdd.alwaysTrue, "
196+
+ "forcing HDD disk {} to report exceed limit", rootPath);
197+
}
198+
return true;
199+
}
200+
if (DebugPointUtil.isEnable("DiskInfo.exceedLimit.hdd.alwaysFalse")) {
201+
if (LOG.isDebugEnabled()) {
202+
LOG.debug("Debug point active: DiskInfo.exceedLimit.hdd.alwaysFalse, "
203+
+ "forcing HDD disk {} to report available", rootPath);
204+
}
205+
return false;
206+
}
207+
}
208+
169209
if (LOG.isDebugEnabled()) {
170210
LOG.debug("flood stage: {}, diskAvailableCapacityB: {}, totalCapacityB: {}",
171211
floodStage, diskAvailableCapacityB, totalCapacityB);

regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/Syncer.groovy

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -631,6 +631,10 @@ class Syncer {
631631
}
632632

633633
Boolean restoreSnapshot(boolean forCCR = false) {
634+
return restoreSnapshot(forCCR, null, null)
635+
}
636+
637+
Boolean restoreSnapshot(boolean forCCR, String storageMedium, String mediumAllocationMode) {
634638
logger.info("Restore snapshot ${context.labelName}")
635639
FrontendClientImpl clientImpl = context.getSourceFrontClient()
636640

@@ -648,6 +652,10 @@ class Syncer {
648652
logger.info("json map ${jsonMap}.")
649653
context.getSnapshotResult.setJobInfo(gson.toJson(jsonMap).getBytes())
650654

655+
// Set storage_medium and medium_allocation_mode for testing
656+
context.storageMedium = storageMedium
657+
context.mediumAllocationMode = mediumAllocationMode
658+
651659
// step 2: restore
652660
TRestoreSnapshotResult result = SyncerUtils.restoreSnapshot(clientImpl, context, forCCR)
653661
return checkRestoreSnapshot(result)

regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/SyncerContext.groovy

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,8 @@ class SyncerContext {
133133
public String tableName
134134
public TGetSnapshotResult getSnapshotResult
135135
public String token
136+
public String storageMedium
137+
public String mediumAllocationMode
136138

137139
public Config config
138140
public String user

regression-test/framework/src/main/groovy/org/apache/doris/regression/util/SyncerUtils.groovy

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,16 @@ class SyncerUtils {
131131
request.setProperties(properties)
132132
request.setMeta(context.getSnapshotResult.getMeta())
133133
request.setJobInfo(context.getSnapshotResult.getJobInfo())
134+
135+
// Set storage_medium and medium_allocation_mode if specified
136+
// These will test the new code in FrontendServiceImpl.restoreSnapshot
137+
if (context.storageMedium != null) {
138+
request.setStorageMedium(context.storageMedium)
139+
}
140+
if (context.mediumAllocationMode != null) {
141+
request.setMediumAllocationMode(context.mediumAllocationMode)
142+
}
143+
134144
return clientImpl.client.restoreSnapshot(request)
135145
}
136146

0 commit comments

Comments
 (0)