swamirishi commented on code in PR #5145:
URL: https://github.com/apache/ozone/pull/5145#discussion_r1283600950
##########
hadoop-hdds/rocksdb-checkpoint-differ/src/main/java/org/apache/ozone/rocksdiff/RocksDBCheckpointDiffer.java:
##########
@@ -222,32 +222,41 @@ public class RocksDBCheckpointDiffer implements
AutoCloseable,
OZONE_OM_SNAPSHOT_COMPACTION_DAG_MAX_TIME_ALLOWED_DEFAULT,
TimeUnit.MILLISECONDS);
- long pruneCompactionDagDaemonRunIntervalInMs =
+ this.pruneCompactionDagDaemonRunIntervalInMs =
configuration.getTimeDuration(
OZONE_OM_SNAPSHOT_COMPACTION_DAG_PRUNE_DAEMON_RUN_INTERVAL,
OZONE_OM_SNAPSHOT_PRUNE_COMPACTION_DAG_DAEMON_RUN_INTERVAL_DEFAULT,
TimeUnit.MILLISECONDS);
if (pruneCompactionDagDaemonRunIntervalInMs > 0) {
- this.executor = Executors.newSingleThreadScheduledExecutor();
- this.executor.scheduleWithFixedDelay(
- this::pruneOlderSnapshotsWithCompactionHistory,
- pruneCompactionDagDaemonRunIntervalInMs,
- pruneCompactionDagDaemonRunIntervalInMs,
- TimeUnit.MILLISECONDS);
-
- this.executor.scheduleWithFixedDelay(
- this::pruneSstFiles,
- pruneCompactionDagDaemonRunIntervalInMs,
- pruneCompactionDagDaemonRunIntervalInMs,
- TimeUnit.MILLISECONDS
- );
+ this.scheduler = new Scheduler(dagPruningServiceName,
+ true, 1);
+ submitPruneJobs();
Review Comment:
it would be better to call the start method here.
##########
hadoop-hdds/rocksdb-checkpoint-differ/src/main/java/org/apache/ozone/rocksdiff/RocksDBCheckpointDiffer.java:
##########
@@ -326,18 +335,27 @@ public void setCurrentCompactionLog(long
latestSequenceNum) {
appendToCurrentCompactionLog("");
}
- @Override
- public void close() {
+ public void stop() {
synchronized (this) {
if (!closed) {
closed = true;
- if (executor != null) {
- executor.shutdown();
+ if (scheduler != null) {
+ LOG.info("Shutting down CompactionDagPruningService.");
+ scheduler.close();
}
}
}
}
+ public void start() {
+ synchronized (this) {
+ if (closed) {
+ closed = false;
+ submitPruneJobs();
+ }
+ }
+ }
Review Comment:
```
if (closed) {
synchronized (this) {
if (closed) {
closed = false;
submitPruneJobs();
}
}
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]