zhoujinsong commented on code in PR #4214:
URL: https://github.com/apache/amoro/pull/4214#discussion_r3257524940
##########
amoro-ams/src/main/java/org/apache/amoro/server/process/iceberg/IcebergProcessFactory.java:
##########
@@ -162,6 +178,24 @@ private Optional<TableProcess>
triggerCleanOrphans(TableRuntime tableRuntime) {
return Optional.of(new OrphanFilesCleaningProcess(tableRuntime,
localEngine));
}
+ private Optional<TableProcess> triggerCleanDanglingDelete(TableRuntime
tableRuntime) {
+ if (localEngine == null
+ ||
!tableRuntime.getTableConfiguration().isDeleteDanglingDeleteFilesEnabled()) {
+ return Optional.empty();
+ }
+
+ long lastExecuteTime =
+ tableRuntime
+ .getState(DefaultTableRuntime.CLEANUP_STATE_KEY)
+ .getLastDanglingDeleteFilesCleanTime();
+ ProcessTriggerStrategy strategy =
actions.get(IcebergActions.CLEAN_DANGLING_DELETE);
+ if (System.currentTimeMillis() - lastExecuteTime <
strategy.getTriggerInterval().toMillis()) {
Review Comment:
may return if the action was not registered (e.g., when the feature is
disabled and the action is triggered externally), which would cause a on .
Consider adding a null guard:
```java
ProcessTriggerStrategy strategy =
actions.get(IcebergActions.CLEAN_DANGLING_DELETE);
if (strategy == null
|| System.currentTimeMillis() - lastExecuteTime <
strategy.getTriggerInterval().toMillis()) {
return Optional.empty();
}
```
--
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]