LsomeYeah opened a new pull request, #10860:
URL: https://github.com/apache/paimon/pull/10860

   ### Purpose
   
   WIP: make missing branch snapshots explicit during snapshot-ID time travel 
with fallback or primary branch reads.
   
   `FallbackReadFileStoreTable` aligns the other branch to the requested 
current-branch snapshot's commit time. When no matching snapshot exists, it 
currently substitutes snapshot 1. An empty branch then fails with `There is 
currently no snapshot.`, while an existing snapshot 1 newer than the requested 
time can silently return future data. If snapshot 1 has expired, the same 
substitution fails even though another snapshot is available.
   
   This PR applies the following policy:
   
   - If the other branch has no snapshots, log a warning and treat it as empty.
   - If a snapshot exists at or before the requested time, preserve normal 
branch alignment.
   - Otherwise, fail with a descriptive error by default. The new boolean 
option `scan.fallback-branch.allow-earliest-snapshot` (default `false`) permits 
reading the earliest currently available snapshot, with a warning that includes 
the requested time and selected snapshot.
   
   The option applies to both fallback and primary branches. Enabling it can 
read data newer than the requested time. When snapshot 1 is available, it 
restores the previous selection; when snapshot 1 is unavailable, it permits the 
actual earliest snapshot instead. The default failure for nonempty branches 
with no time match is an intentional behavior change.
   
   The selected snapshot is pinned for partition listing and data planning. No 
public scan API, split routing, or ordinary-table snapshot validation is 
changed. This change is limited to snapshot-ID branch alignment, including 
numeric `scan.version`; it does not add timestamp/tag/watermark or chain-table 
time-travel support.
   
   ### Tests
   
   - Focused Core API reproductions confirmed the original empty-branch failure 
and future-data reads before the fix.
   - `FallbackReadFileStoreTableTest`: 50 parameterized/test invocations 
covering both branch priorities, empty branches with either option value, 
latest-scan controls, numeric `scan.version`, copying/serialization, default 
rejection, earliest selection with and without snapshot 1, earliest differing 
from latest, and ordinary explicit expired snapshots remaining errors.
   - A scan whose selected earliest snapshot expires must fail rather than 
reselect a newer snapshot.
   - `ChainTableFileStoreTableTest`: 57 existing regression test invocations.
   - Maven command:
   
   ```bash
   mvn -s ~/.m2/settings.xml.paimon-ali -pl paimon-core -am -Pfast-build \
     -DwildcardSuites=none -DfailIfNoTests=false \
     -Dtest=FallbackReadFileStoreTableTest,ChainTableFileStoreTableTest test
   ```
   
   - `spotless:check` for `paimon-api` and `paimon-core`, and `git diff 
--check`.
   
   Validation is on Java 8. No external engine or production integration tests 
were run.
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to