You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@fluss.apache.org by "luoyuxia (via GitHub)" <gi...@apache.org> on 2026/09/14 10:11:45 UTC

[PR] [lake][paimon] Fix DV readable snapshot and offset selection [fluss]

luoyuxia opened a new pull request, #4327:
URL: https://github.com/apache/fluss/pull/4327

   <!--
   *Thank you very much for contributing to Fluss - we are happy that you want to help us improve Fluss. To help the community review your contribution in the best possible way, please go through the checklist below, which will get the contribution into a shape in which it can be best reviewed.*
   
   ## Contribution Checklist
   
     - Make sure that the pull request corresponds to a [GitHub issue](https://github.com/apache/fluss/issues). Exceptions are made for typos in JavaDoc or documentation files, which need no issue.
   
     - Name the pull request in the format "[component] Title of the pull request", where *[component]* should be replaced by the name of the component being changed. Typically, this corresponds to the component label assigned to the issue (e.g., [kv], [log], [client], [flink], [rust], [python], [c++], [elixir]). Skip *[component]* if you are unsure about which is the best component.
   
     - Fill out the template below to describe the changes contributed by the pull request. That will give reviewers the context they need to do the review.
   
     - Make sure that the change passes the automated tests, i.e., `mvn clean verify` passes.
   
     - Each pull request should address only one issue, not mix up code from multiple issues.
   
     - **Generative AI disclosure:** Indicate whether generative AI tools were used in authoring this PR. If yes, specify the tool below.
       - [ ] No generative AI tools used
       - [x] Yes (please specify the tool below)
   
   **(The sections below can be removed for hotfixes or typos)**
   -->
   
   <!--
   Generated-by: Codex (GPT-6) following [the guidelines](https://github.com/apache/fluss/blob/main/AGENTS.md)
   -->
   
   ### Purpose
   
   <!-- Linking this pull request to the issue -->
   Linked issue: #2121 (follow-up; already closed). Related PRs: #3396 and #3519.
   
   <!-- What is the purpose of the change -->
   
   Fix **Bug 1 (scanning the wrong snapshot)** described in #3519, including keeping its offsets consistent with the selected COMPACT. The file-store scan ignores the table-level snapshot options, so it currently classifies buckets using the latest snapshot rather than the intended COMPACT.
   
   After recovery, Fluss may also have registered a newer APPEND without registering the preceding COMPACT. For example, s1 APPEND contains bucket0 up to offset 3; s2 compacts it; recovered s3 APPEND advances bucket0 to 6 and introduces bucket1. Retrieving s2 after another APPEND must return and register `{bucket0: 3}`, without taking offset 6 or bucket1 from s3.
   
   **Bug 2 (premature deletion of historical APPEND offsets) is deferred.** If a bucket receives new L0 files after its previous flush's APPEND metadata has been deleted, readable-snapshot advancement can pause while tiering continues. It can recover after the affected bucket's new L0 is flushed and all required snapshot offsets are available. APPENDs alone, or compaction of other buckets, do not guarantee recovery; a rarely flushed bucket can remain stalled for a long time. The regression test covers a pause followed by recovery after flushing the affected bucket.
   
   #3519 addresses Bug 2 by retaining historical APPENDs for buckets without L0 as well. A cold bucket or historical partition can consequently hold the table-wide retention boundary far back while its flush history remains available. Fluss retains every snapshot metadata entry from that boundary onward, so this can retain substantially more history than the individual required snapshots. This PR leaves that retention change for separate work. During a Bug 2 stall, the existing `KEEP_ALL_PREVIOUS` fallback can also accumulate metadata; this PR does not resolve that tradeoff.
   
   ### Brief change log
   
   <!-- Please describe the changes made in this pull request and explain how they address the issue -->
   
   - Select the COMPACT explicitly with `FileStoreScan.withSnapshot(snapshot)`.
   - Read no-L0 offsets from the APPEND immediately preceding that COMPACT; preserve offsets for buckets whose files were removed, and resolve buckets with L0 from their flush history.
   - Register the readable snapshot's complete offset maps without merging offsets from a newer APPEND. Ordinary tiered APPEND commits continue merging incremental bucket updates.
   - Update the existing scenario to assert Bug 2's pause and recovery, and add a regression for snapshot/offset pairing after APPEND recovery.
   
   ### Tests
   
   <!-- List UT and IT cases to verify this change -->
   
   Passed on JDK 11 (16 tests, no failures or skips):
   
   - `DvTableReadableSnapshotRetrieverTest` (3 tests): incremental offsets, Bug 2 pause/recovery, partitioned tables, and recovered APPEND offset pairing.
   - `FlussTableLakeSnapshotCommitterTest` (5 tests).
   - `TieringCommitOperatorTest` (6 tests).
   - `FlinkUnionReadDvTableITCase` (2 tests): non-partitioned and partitioned union reads.
   
   ```sh
   ./mvnw -pl fluss-lake/fluss-lake-paimon -am spotless:apply test \
     -Dtest=DvTableReadableSnapshotRetrieverTest,FlussTableLakeSnapshotCommitterTest,TieringCommitOperatorTest,FlinkUnionReadDvTableITCase \
     -Dsurefire.failIfNoSpecifiedTests=false
   ./mvnw spotless:check validate
   ```
   
   Checkstyle, Spotless, and license validation passed. The full repository `clean verify` suite was not run.
   
   ### API and Format
   
   <!-- Does this change affect API or storage format -->
   
   No public API or storage format changes. Uses the existing `ignorePreviousTableOffsets` request field for complete readable-snapshot offset maps.
   
   ### Documentation
   
   <!-- Does this change introduce a new feature -->
   
   No new feature. Updated code comments to describe snapshot-specific offsets and the existing retention limitation.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@fluss.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [lake][paimon] Fix DV readable snapshot and offset selection [fluss]

Posted by "luoyuxia (via GitHub)" <gi...@apache.org>.
luoyuxia closed pull request #4327: [lake][paimon] Fix DV readable snapshot and offset selection
URL: https://github.com/apache/fluss/pull/4327


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@fluss.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org