Skip to content

Commit 9d0a679

Browse files
author
苏承祥
committed
rename class&conf
1 parent 462f777 commit 9d0a679

4 files changed

Lines changed: 31 additions & 59 deletions

File tree

hudi-client/hudi-client-common/src/main/java/org/apache/hudi/config/HoodieCompactionConfig.java

Lines changed: 23 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,10 @@ public class HoodieCompactionConfig extends HoodieConfig {
106106
.withDocumentation("Only if the log file size is greater than the threshold in bytes,"
107107
+ " the file group will be compacted.");
108108

109-
public static final ConfigProperty<Long> COMPACTION_LOG_FILE_LENGTH_THRESHOLD = ConfigProperty
110-
.key("hoodie.compaction.logfile.length.threshold")
109+
public static final ConfigProperty<Long> COMPACTION_LOG_FILE_NUM_THRESHOLD = ConfigProperty
110+
.key("hoodie.compaction.logfile.num.threshold")
111111
.defaultValue(0L)
112-
.withDocumentation("Only if the log file length is greater than the threshold,"
112+
.withDocumentation("Only if the log file num is greater than the threshold,"
113113
+ " the file group will be compacted.");
114114

115115
public static final ConfigProperty<String> COMPACTION_STRATEGY = ConfigProperty
@@ -170,24 +170,16 @@ public class HoodieCompactionConfig extends HoodieConfig {
170170
+ " This is critical in computing the insert parallelism and bin-packing inserts into small files.");
171171

172172

173-
/**
174-
* @deprecated Use {@link #INLINE_COMPACT} and its methods instead
175-
*/
173+
/** @deprecated Use {@link #INLINE_COMPACT} and its methods instead */
176174
@Deprecated
177175
public static final String INLINE_COMPACT_PROP = INLINE_COMPACT.key();
178-
/**
179-
* @deprecated Use {@link #INLINE_COMPACT_NUM_DELTA_COMMITS} and its methods instead
180-
*/
176+
/** @deprecated Use {@link #INLINE_COMPACT_NUM_DELTA_COMMITS} and its methods instead */
181177
@Deprecated
182178
public static final String INLINE_COMPACT_NUM_DELTA_COMMITS_PROP = INLINE_COMPACT_NUM_DELTA_COMMITS.key();
183-
/**
184-
* @deprecated Use {@link #INLINE_COMPACT_TIME_DELTA_SECONDS} and its methods instead
185-
*/
179+
/** @deprecated Use {@link #INLINE_COMPACT_TIME_DELTA_SECONDS} and its methods instead */
186180
@Deprecated
187181
public static final String INLINE_COMPACT_TIME_DELTA_SECONDS_PROP = INLINE_COMPACT_TIME_DELTA_SECONDS.key();
188-
/**
189-
* @deprecated Use {@link #INLINE_COMPACT_TRIGGER_STRATEGY} and its methods instead
190-
*/
182+
/** @deprecated Use {@link #INLINE_COMPACT_TRIGGER_STRATEGY} and its methods instead */
191183
@Deprecated
192184
public static final String INLINE_COMPACT_TRIGGER_STRATEGY_PROP = INLINE_COMPACT_TRIGGER_STRATEGY.key();
193185
/**
@@ -255,61 +247,41 @@ public class HoodieCompactionConfig extends HoodieConfig {
255247
*/
256248
@Deprecated
257249
public static final String COMPACTION_STRATEGY_PROP = COMPACTION_STRATEGY.key();
258-
/**
259-
* @deprecated Use {@link #COMPACTION_STRATEGY} and its methods instead
260-
*/
250+
/** @deprecated Use {@link #COMPACTION_STRATEGY} and its methods instead */
261251
@Deprecated
262252
public static final String DEFAULT_COMPACTION_STRATEGY = COMPACTION_STRATEGY.defaultValue();
263-
/**
264-
* @deprecated Use {@link #COMPACTION_LAZY_BLOCK_READ_ENABLE} and its methods instead
265-
*/
253+
/** @deprecated Use {@link #COMPACTION_LAZY_BLOCK_READ_ENABLE} and its methods instead */
266254
@Deprecated
267255
public static final String COMPACTION_LAZY_BLOCK_READ_ENABLED_PROP = COMPACTION_LAZY_BLOCK_READ_ENABLE.key();
268-
/**
269-
* @deprecated Use {@link #COMPACTION_LAZY_BLOCK_READ_ENABLE} and its methods instead
270-
*/
256+
/** @deprecated Use {@link #COMPACTION_LAZY_BLOCK_READ_ENABLE} and its methods instead */
271257
@Deprecated
272258
public static final String DEFAULT_COMPACTION_LAZY_BLOCK_READ_ENABLED = COMPACTION_REVERSE_LOG_READ_ENABLE.defaultValue();
273-
/**
274-
* @deprecated Use {@link #COMPACTION_REVERSE_LOG_READ_ENABLE} and its methods instead
275-
*/
259+
/** @deprecated Use {@link #COMPACTION_REVERSE_LOG_READ_ENABLE} and its methods instead */
276260
@Deprecated
277261
public static final String COMPACTION_REVERSE_LOG_READ_ENABLED_PROP = COMPACTION_REVERSE_LOG_READ_ENABLE.key();
278-
/**
279-
* @deprecated Use {@link #COMPACTION_REVERSE_LOG_READ_ENABLE} and its methods instead
280-
*/
262+
/** @deprecated Use {@link #COMPACTION_REVERSE_LOG_READ_ENABLE} and its methods instead */
281263
@Deprecated
282264
public static final String DEFAULT_COMPACTION_REVERSE_LOG_READ_ENABLED = COMPACTION_REVERSE_LOG_READ_ENABLE.defaultValue();
283-
/**
284-
* @deprecated Use {@link #TARGET_PARTITIONS_PER_DAYBASED_COMPACTION} and its methods instead
285-
*/
286-
@Deprecated
287-
public static final String TARGET_PARTITIONS_PER_DAYBASED_COMPACTION_PROP = TARGET_PARTITIONS_PER_DAYBASED_COMPACTION.key();
288-
/**
289-
* @deprecated Use {@link #TARGET_PARTITIONS_PER_DAYBASED_COMPACTION} and its methods instead
290-
*/
291-
@Deprecated
292-
public static final String DEFAULT_TARGET_PARTITIONS_PER_DAYBASED_COMPACTION = TARGET_PARTITIONS_PER_DAYBASED_COMPACTION.defaultValue();
293265
/**
294266
* @deprecated Use {@link #INLINE_COMPACT} and its methods instead
295267
*/
296268
@Deprecated
297269
private static final String DEFAULT_INLINE_COMPACT = INLINE_COMPACT.defaultValue();
298-
/**
299-
* @deprecated Use {@link #INLINE_COMPACT_NUM_DELTA_COMMITS} and its methods instead
300-
*/
270+
/** @deprecated Use {@link #INLINE_COMPACT_NUM_DELTA_COMMITS} and its methods instead */
301271
@Deprecated
302272
private static final String DEFAULT_INLINE_COMPACT_NUM_DELTA_COMMITS = INLINE_COMPACT_NUM_DELTA_COMMITS.defaultValue();
303-
/**
304-
* @deprecated Use {@link #INLINE_COMPACT_TIME_DELTA_SECONDS} and its methods instead
305-
*/
273+
/** @deprecated Use {@link #INLINE_COMPACT_TIME_DELTA_SECONDS} and its methods instead */
306274
@Deprecated
307275
private static final String DEFAULT_INLINE_COMPACT_TIME_DELTA_SECONDS = INLINE_COMPACT_TIME_DELTA_SECONDS.defaultValue();
308-
/**
309-
* @deprecated Use {@link #INLINE_COMPACT_TRIGGER_STRATEGY} and its methods instead
310-
*/
276+
/** @deprecated Use {@link #INLINE_COMPACT_TRIGGER_STRATEGY} and its methods instead */
311277
@Deprecated
312278
private static final String DEFAULT_INLINE_COMPACT_TRIGGER_STRATEGY = INLINE_COMPACT_TRIGGER_STRATEGY.defaultValue();
279+
/** @deprecated Use {@link #TARGET_PARTITIONS_PER_DAYBASED_COMPACTION} and its methods instead */
280+
@Deprecated
281+
public static final String TARGET_PARTITIONS_PER_DAYBASED_COMPACTION_PROP = TARGET_PARTITIONS_PER_DAYBASED_COMPACTION.key();
282+
/** @deprecated Use {@link #TARGET_PARTITIONS_PER_DAYBASED_COMPACTION} and its methods instead */
283+
@Deprecated
284+
public static final String DEFAULT_TARGET_PARTITIONS_PER_DAYBASED_COMPACTION = TARGET_PARTITIONS_PER_DAYBASED_COMPACTION.defaultValue();
313285

314286
private HoodieCompactionConfig() {
315287
super();
@@ -415,8 +387,8 @@ public Builder withLogFileSizeThresholdBasedCompaction(long logFileSizeThreshold
415387
return this;
416388
}
417389

418-
public Builder withLogFileLengthThresholdBasedCompaction(int logFileLengthThreshold) {
419-
compactionConfig.setValue(COMPACTION_LOG_FILE_LENGTH_THRESHOLD, String.valueOf(logFileLengthThreshold));
390+
public Builder withLogFileNumThresholdBasedCompaction(int logFileNumThreshold) {
391+
compactionConfig.setValue(COMPACTION_LOG_FILE_NUM_THRESHOLD, String.valueOf(logFileNumThreshold));
420392
return this;
421393
}
422394

hudi-client/hudi-client-common/src/main/java/org/apache/hudi/config/HoodieWriteConfig.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1275,8 +1275,8 @@ public Long getCompactionLogFileSizeThreshold() {
12751275
return getLong(HoodieCompactionConfig.COMPACTION_LOG_FILE_SIZE_THRESHOLD);
12761276
}
12771277

1278-
public Long getCompactionLogFileLengthThreshold() {
1279-
return getLong(HoodieCompactionConfig.COMPACTION_LOG_FILE_LENGTH_THRESHOLD);
1278+
public Long getCompactionLogFileNumThreshold() {
1279+
return getLong(HoodieCompactionConfig.COMPACTION_LOG_FILE_NUM_THRESHOLD);
12801280
}
12811281

12821282
public Boolean getCompactionLazyBlockReadEnabled() {

hudi-client/hudi-client-common/src/main/java/org/apache/hudi/table/action/compact/strategy/LogFileLengthBasedCompactionStrategy.java renamed to hudi-client/hudi-client-common/src/main/java/org/apache/hudi/table/action/compact/strategy/LogFileNumBasedCompactionStrategy.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,17 @@
2727
import java.util.stream.Collectors;
2828

2929
/**
30-
* LogFileLengthBasedCompactionStrategy orders the compactions based on the total log files length,
30+
* LogFileLengthBasedCompactionStrategy orders the compactions based on the total log files num,
3131
* filters the file group which log files length is greater than the threshold and limits the compactions within a configured IO bound.
3232
*/
33-
public class LogFileLengthBasedCompactionStrategy extends BoundedIOCompactionStrategy
33+
public class LogFileNumBasedCompactionStrategy extends BoundedIOCompactionStrategy
3434
implements Comparator<HoodieCompactionOperation> {
3535

3636
@Override
3737
public List<HoodieCompactionOperation> orderAndFilter(HoodieWriteConfig writeConfig, List<HoodieCompactionOperation> operations, List<HoodieCompactionPlan> pendingCompactionPlans) {
38-
Long lengthThreshold = writeConfig.getCompactionLogFileLengthThreshold();
38+
Long numThreshold = writeConfig.getCompactionLogFileNumThreshold();
3939
List<HoodieCompactionOperation> filterOperator = operations.stream()
40-
.filter(e -> e.getDeltaFilePaths().size() >= lengthThreshold)
40+
.filter(e -> e.getDeltaFilePaths().size() >= numThreshold)
4141
.sorted(this).collect(Collectors.toList());
4242
return super.orderAndFilter(writeConfig, filterOperator, pendingCompactionPlans);
4343
}

hudi-client/hudi-spark-client/src/test/java/org/apache/hudi/table/action/compact/strategy/TestHoodieCompactionStrategy.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,10 +250,10 @@ public void testLogFileLengthBasedCompactionStrategy() {
250250
sizesMap.put(110 * MB, new ArrayList<>());
251251
sizesMap.put(100 * MB, Collections.singletonList(2048 * MB));
252252
sizesMap.put(90 * MB, Arrays.asList(512 * MB, 512 * MB));
253-
LogFileLengthBasedCompactionStrategy strategy = new LogFileLengthBasedCompactionStrategy();
253+
LogFileNumBasedCompactionStrategy strategy = new LogFileNumBasedCompactionStrategy();
254254
HoodieWriteConfig writeConfig = HoodieWriteConfig.newBuilder().withPath("/tmp").withCompactionConfig(
255255
HoodieCompactionConfig.newBuilder().withCompactionStrategy(strategy).withTargetIOPerCompactionInMB(1024)
256-
.withLogFileLengthThresholdBasedCompaction(2).build())
256+
.withLogFileNumThresholdBasedCompaction(2).build())
257257
.build();
258258
List<HoodieCompactionOperation> operations = createCompactionOperations(writeConfig, sizesMap);
259259
List<HoodieCompactionOperation> returned = strategy.orderAndFilter(writeConfig, operations, new ArrayList<>());

0 commit comments

Comments
 (0)