Skip to content

[core] Support snapshot sequence for write-only primary-key tables#8256

Open
Aitozi wants to merge 1 commit into
apache:masterfrom
Aitozi:mwj/write-only-pk-light-meta
Open

[core] Support snapshot sequence for write-only primary-key tables#8256
Aitozi wants to merge 1 commit into
apache:masterfrom
Aitozi:mwj/write-only-pk-light-meta

Conversation

@Aitozi

@Aitozi Aitozi commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Purpose

Primary-key table writers currently need to scan existing metadata to initialize the max sequence number. For write-only workloads this can be heavier than necessary because the writer only needs a safe starting sequence number.

What changed

This PR adds a sequence.generation.mode option with two modes:

  • scan: keep the existing behavior and scan restored files for the max sequence number.
  • snapshot: persist the max sequence number in snapshot properties and use it to initialize later write-only writers.

For write-only primary-key tables in snapshot mode, the writer can skip loading previous files once the latest snapshot carries the max sequence property. If the latest snapshot does not have the property yet, the writer scans once to bootstrap the snapshot property safely.

Tests

  • git diff --check
  • mvn -s ~/.m2/apache-community.xml -o package -Pgenerate-docs -pl paimon-docs -nsu -DskipTests -am
  • mvn -s ~/.m2/apache-community.xml -o -pl paimon-core -am -Pfast-build -DfailIfNoTests=false -Dtest=KeyValueFileStoreWriteTest test
  • mvn -s ~/.m2/apache-community.xml -o -pl paimon-flink/paimon-flink-common -am -Pfast-build -DfailIfNoTests=false -Dtest=PrimaryKeyFileStoreTableITCase#testWriteOnlySnapshotSequenceOverwritePreviousValue test

@Aitozi Aitozi force-pushed the mwj/write-only-pk-light-meta branch from 2d89e5b to 4d57ea7 Compare June 16, 2026 15:46
@Aitozi Aitozi marked this pull request as ready for review June 16, 2026 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant