Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[core] add commit.force-expire option #2968

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions docs/layouts/shortcodes/generated/core_configuration.html
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@
<td>Boolean</td>
<td>Whether to force create snapshot on commit.</td>
</tr>
<tr>
<td><h5>commit.force-expire</h5></td>
<td style="word-wrap: break-word;">false</td>
<td>Boolean</td>
<td>Whether to force a expiration before commit.</td>
</tr>
<tr>
<td><h5>compaction.max-size-amplification-percent</h5></td>
<td style="word-wrap: break-word;">200</td>
Expand Down
10 changes: 10 additions & 0 deletions paimon-common/src/main/java/org/apache/paimon/CoreOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,12 @@ public class CoreOptions implements Serializable {
.defaultValue(MemorySize.ofMebiBytes(128))
.withDescription("Target size of a file.");

public static final ConfigOption<Boolean> FORCE_EXPIRE =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it is better to introduce an option: write.responsible-matters, similar option, I'm not good at naming it, for reference only.

In the option, user can specific what the write does.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about commit.force.hooks or commit.force.triggers ?

key("commit.force-expire")
.booleanType()
.defaultValue(false)
.withDescription("Whether to force a expiration before commit.");

public static final ConfigOption<Integer> NUM_SORTED_RUNS_COMPACTION_TRIGGER =
key("num-sorted-run.compaction-trigger")
.intType()
Expand Down Expand Up @@ -1353,6 +1359,10 @@ public boolean commitForceCompact() {
return options.get(COMMIT_FORCE_COMPACT);
}

public boolean forceExpire() {
return options.get(FORCE_EXPIRE);
}

public int maxSizeAmplificationPercent() {
return options.get(COMPACTION_MAX_SIZE_AMPLIFICATION_PERCENT);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -320,8 +320,12 @@ public TableCommitImpl newCommit(String commitUser, String branchName) {
store().newCommit(commitUser, branchName),
createCommitCallbacks(),
snapshotExpire,
options.writeOnly() ? null : store().newPartitionExpire(commitUser),
options.writeOnly() ? null : store().newTagCreationManager(),
options.writeOnly() && !options.forceExpire()
? null
: store().newPartitionExpire(commitUser),
options.writeOnly() && !options.forceExpire()
? null
: store().newTagCreationManager(),
catalogEnvironment.lockFactory().create(),
CoreOptions.fromMap(options()).consumerExpireTime(),
new ConsumerManager(fileIO, path),
Expand Down
Loading