xushiyan commented on a change in pull request #3813:
URL: https://github.com/apache/hudi/pull/3813#discussion_r775695199
##########
File path:
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/table/action/compact/CompactionTriggerStrategy.java
##########
@@ -18,13 +18,112 @@
package org.apache.hudi.table.action.compact;
+import java.text.ParseException;
+import org.apache.hudi.common.table.timeline.HoodieActiveTimeline;
+import org.apache.hudi.common.util.collection.Pair;
+import org.apache.hudi.config.HoodieWriteConfig;
+import org.apache.hudi.exception.HoodieCompactionException;
+import org.apache.log4j.LogManager;
+import org.apache.log4j.Logger;
+
+@SuppressWarnings("checkstyle:LineLength")
public enum CompactionTriggerStrategy {
- // trigger compaction when reach N delta commits
- NUM_COMMITS,
- // trigger compaction when time elapsed > N seconds since last compaction
- TIME_ELAPSED,
- // trigger compaction when both NUM_COMMITS and TIME_ELAPSED are satisfied
- NUM_AND_TIME,
- // trigger compaction when NUM_COMMITS or TIME_ELAPSED is satisfied
- NUM_OR_TIME
+
+ // trigger compaction when reach N delta commits
+ NUM_COMMITS {
+ @Override
+ public boolean isCompactable(
+ HoodieWriteConfig config,
Review comment:
this class is only about compaction so you don't need to pass the whole
write config. would just Compaction config give you all the config needed?
##########
File path:
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/table/action/compact/ScheduleCompactionActionExecutor.java
##########
@@ -146,53 +144,14 @@ private HoodieCompactionPlan scheduleCompaction() {
}
private boolean needCompact(CompactionTriggerStrategy
compactionTriggerStrategy) {
- boolean compactable;
+
+ if (compactionTriggerStrategy == null) {
+ throw new HoodieCompactionException("Unsupported compaction trigger
strategy: {}"
+ + config.getInlineCompactTriggerStrategy());
+ }
Review comment:
don't think this check is needed.. we always expect non-null arg to be
passed in.
Also `compactionTriggerStrategy` being null does not make sense with
"Unsupported compaction trigger strategy"; it's simply being misused with null
argument.
--
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]