Skip to content

Commit

Permalink
[core] Adjust compaction.max.file-num of bucketed append table to 5
Browse files Browse the repository at this point in the history
  • Loading branch information
JingsongLi committed Aug 6, 2024
1 parent f2bf352 commit 698927d
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 11 deletions.
2 changes: 1 addition & 1 deletion docs/content/append-table/streaming.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ control the strategy of compaction:
</tr>
<tr>
<td><h5>compaction.max.file-num</h5></td>
<td style="word-wrap: break-word;">50</td>
<td style="word-wrap: break-word;">5</td>
<td>Integer</td>
<td>For file set [f_0,...,f_N], the maximum file number to trigger a compaction for append table, even if sum(size(f_i)) &lt; targetFileSize. This value avoids pending too much small files, which slows down the performance.</td>
</tr>
Expand Down
4 changes: 2 additions & 2 deletions docs/layouts/shortcodes/generated/core_configuration.html
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,9 @@
</tr>
<tr>
<td><h5>compaction.max.file-num</h5></td>
<td style="word-wrap: break-word;">50</td>
<td style="word-wrap: break-word;">(none)</td>
<td>Integer</td>
<td>For file set [f_0,...,f_N], the maximum file number to trigger a compaction for append-only table, even if sum(size(f_i)) &lt; targetFileSize. This value avoids pending too much small files, which slows down the performance.</td>
<td>For file set [f_0,...,f_N], the maximum file number to trigger a compaction for append-only table, even if sum(size(f_i)) &lt; targetFileSize. This value avoids pending too much small files.<ul><li>Default value of Append Table is '50'.</li><li>Default value of Bucketed Append Table is '5'.</li></ul></td>
</tr>
<tr>
<td><h5>compaction.min.file-num</h5></td>
Expand Down
18 changes: 12 additions & 6 deletions paimon-common/src/main/java/org/apache/paimon/CoreOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -521,12 +521,18 @@ public class CoreOptions implements Serializable {
public static final ConfigOption<Integer> COMPACTION_MAX_FILE_NUM =
key("compaction.max.file-num")
.intType()
.defaultValue(50)
.noDefaultValue()
.withFallbackKeys("compaction.early-max.file-num")
.withDescription(
"For file set [f_0,...,f_N], the maximum file number to trigger a compaction "
+ "for append-only table, even if sum(size(f_i)) < targetFileSize. This value "
+ "avoids pending too much small files, which slows down the performance.");
Description.builder()
.text(
"For file set [f_0,...,f_N], the maximum file number to trigger a compaction "
+ "for append-only table, even if sum(size(f_i)) < targetFileSize. This value "
+ "avoids pending too much small files.")
.list(
text("Default value of Append Table is '50'."),
text("Default value of Bucketed Append Table is '5'."))
.build());

public static final ConfigOption<ChangelogProducer> CHANGELOG_PRODUCER =
key("changelog-producer")
Expand Down Expand Up @@ -1671,8 +1677,8 @@ public int compactionMinFileNum() {
return options.get(COMPACTION_MIN_FILE_NUM);
}

public int compactionMaxFileNum() {
return options.get(COMPACTION_MAX_FILE_NUM);
public Optional<Integer> compactionMaxFileNum() {
return options.getOptional(COMPACTION_MAX_FILE_NUM);
}

public long dynamicBucketTargetRowNum() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ public AppendOnlyTableCompactionCoordinator(
this.targetFileSize = coreOptions.targetFileSize(false);
this.compactionFileSize = coreOptions.compactionFileSize(false);
this.minFileNum = coreOptions.compactionMinFileNum();
this.maxFileNum = coreOptions.compactionMaxFileNum();
// this is global compaction, avoid too many compaction tasks
this.maxFileNum = coreOptions.compactionMaxFileNum().orElse(50);
}

public List<AppendOnlyCompactionTask> run() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public AppendOnlyFileStoreWrite(
this.pathFactory = pathFactory;
this.targetFileSize = options.targetFileSize(false);
this.compactionMinFileNum = options.compactionMinFileNum();
this.compactionMaxFileNum = options.compactionMaxFileNum();
this.compactionMaxFileNum = options.compactionMaxFileNum().orElse(5);
this.commitForceCompact = options.commitForceCompact();
this.skipCompaction = options.writeOnly();
this.fileCompression = options.fileCompression();
Expand Down

0 comments on commit 698927d

Please sign in to comment.