junmuz commented on code in PR #11017:
URL: https://github.com/apache/paimon/pull/11017#discussion_r4566984377
##########
paimon-core/src/main/java/org/apache/paimon/table/AbstractFileStoreTable.java:
##########
@@ -747,6 +756,35 @@ public void rollbackTo(String tagName) {
}
}
+ private void validateDestructiveRollback() {
+ SnapshotManager snapshotManager = snapshotManager();
+ Snapshot latest;
+ try {
+ latest = snapshotManager.latestSnapshot();
+ } catch (RuntimeException e) {
+ if (!(e.getCause() instanceof FileNotFoundException)) {
+ throw e;
+ }
+ // Rollback can recover from a latest hint pointing to a missing
snapshot. Check the
+ // latest existing snapshot so that recovery still respects
retained guard history.
+ try {
+ latest =
+ snapshotManager.safelyGetAllSnapshots().stream()
+ .max(Comparator.comparingLong(Snapshot::id))
+ .orElse(null);
+ } catch (IOException ex) {
+ throw new UncheckedIOException(ex);
+ }
+ }
+ if (coreOptions().deleteOrderingGuardsEnabled()
+ || DeleteOrderingGuardGeneration.isTracked(latest)
+ || DeleteOrderingGuardFile.mayContainGuards(latest)) {
+ throw new UnsupportedOperationException(
Review Comment:
Fixed in `56d1206`. Fast-forward now rejects promotion when either the
source or destination branch enables capture or retains guard history,
including after capture is disabled or the table is truncated. This covers the
Java table API, direct filesystem branch manager, and Python. The regression
closes the staged writer before truncation and verifies that rejected promotion
leaves destination metadata unchanged and the same committable fenced.
##########
paimon-core/src/main/java/org/apache/paimon/table/source/snapshot/SnapshotReaderImpl.java:
##########
@@ -530,12 +614,33 @@ private Plan toIncrementalPlan(
@Nullable Snapshot afterSnapshot,
@Nullable Long afterWatermark,
Map<BinaryRow, Map<Integer, List<ManifestEntry>>> afterFiles) {
+ // Diff must resolve the complete logical state at each endpoint.
Removing a shared
+ // data file can hide a before-image needed to compare the visible
rows after guard
+ // resolution.
+ boolean resolveGuards =
+ !isStreaming ||
DeleteOrderingGuardFile.mayContainGuards(afterSnapshot);
+ Map<Pair<BinaryRow, Integer>, List<IndexFileMeta>> beforeGuards =
+ resolveGuards ? incrementalGuards(beforeSnapshot.get()) :
Collections.emptyMap();
Review Comment:
Fixed in `56d1206`. Streaming delta planning now skips predecessor-snapshot
loading when the before-file set is empty. Added a public file-monitor
streaming regression that expires the predecessor snapshots, restores at the
retained APPEND snapshot, and verifies that the stale row remains hidden while
the fresh row is emitted. Both capture-enabled and capture-disabled histories
are covered.
--
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]