Skip to content

Commit 360fea5

Browse files
authored
HDDS-11494. Improve the duration option of freon ombg (#7246)
1 parent 10d3b21 commit 360fea5

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/BaseFreonGenerator.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,10 @@ public void init() {
290290
//replace environment variables to support multi-node execution
291291
prefix = resolvePrefix(prefix);
292292
}
293+
if (duration != null && !allowDuration()) {
294+
LOG.warn("--duration is ignored");
295+
duration = null;
296+
}
293297
if (duration != null) {
294298
durationInSecond = TimeDurationUtil.getTimeDurationHelper(
295299
"--runtime", duration, TimeUnit.SECONDS);
@@ -554,6 +558,15 @@ public String getPrefix() {
554558
return prefix;
555559
}
556560

561+
/**
562+
* Whether to enable Duration.
563+
* If enabled, the command will load the --duration option.
564+
* If not enabled, the command will not load the --duration option.
565+
*/
566+
public boolean allowDuration() {
567+
return true;
568+
}
569+
557570
public MetricRegistry getMetrics() {
558571
return metrics;
559572
}

hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/OmBucketGenerator.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@ public class OmBucketGenerator extends BaseFreonGenerator
5757

5858
private Timer bucketCreationTimer;
5959

60+
@Override
61+
public boolean allowDuration() {
62+
return false;
63+
}
64+
6065
@Override
6166
public Void call() throws Exception {
6267

0 commit comments

Comments
 (0)