Skip to content

Commit

Permalink
1
Browse files Browse the repository at this point in the history
  • Loading branch information
Zouxxyy committed Jan 19, 2024
1 parent 97d1314 commit 07e43be
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 64 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ public interface CompactStrategy {
/** Pick a compaction unit consisting of all existing files. */
static Optional<CompactUnit> pickFullCompaction(int numLevels, List<LevelSortedRun> runs) {
int maxLevel = numLevels - 1;
if (runs.size() == 1 && runs.get(0).level() == maxLevel) {
// only 1 sorted run on the max level, nothing to compact
if (runs.isEmpty() || (runs.size() == 1 && runs.get(0).level() == maxLevel)) {
// no sorted run or only 1 sorted run on the max level, no need to compact
return Optional.empty();
} else {
return Optional.of(CompactUnit.fromLevelRuns(maxLevel, runs));
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@
import org.apache.paimon.mergetree.compact.CompactRewriter;
import org.apache.paimon.mergetree.compact.CompactStrategy;
import org.apache.paimon.mergetree.compact.FirstRowMergeTreeCompactRewriter;
import org.apache.paimon.mergetree.compact.ForceUpLevel0Compaction;
import org.apache.paimon.mergetree.compact.FullChangelogMergeTreeCompactRewriter;
import org.apache.paimon.mergetree.compact.LookupCompaction;
import org.apache.paimon.mergetree.compact.LookupMergeTreeCompactRewriter;
import org.apache.paimon.mergetree.compact.MergeFunctionFactory;
import org.apache.paimon.mergetree.compact.MergeTreeCompactManager;
Expand Down Expand Up @@ -160,7 +160,7 @@ protected MergeTreeWriter createWriter(
options.optimizedCompactionInterval());
CompactStrategy compactStrategy =
options.changelogProducer() == ChangelogProducer.LOOKUP
? new LookupCompaction(universalCompaction)
? new ForceUpLevel0Compaction(universalCompaction)
: universalCompaction;
CompactManager compactManager =
createCompactManager(partition, bucket, compactStrategy, compactExecutor, levels);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,8 @@ public void testSizeRatioThreshold() {

@Test
public void testLookup() {
LookupCompaction compaction = new LookupCompaction(new UniversalCompaction(25, 1, 3));
ForceUpLevel0Compaction compaction =
new ForceUpLevel0Compaction(new UniversalCompaction(25, 1, 3));

// level 0 to max level
Optional<CompactUnit> pick = compaction.pick(3, level0(1, 2, 2, 2));
Expand Down

0 comments on commit 07e43be

Please sign in to comment.