JingsongLi commented on code in PR #1221:
URL: https://github.com/apache/paimon-rust/pull/1221#discussion_r4386056252
##########
crates/paimon/src/table/branch_manager.rs:
##########
@@ -190,12 +190,23 @@ impl BranchManager {
let tag_dst = tag_manager.with_branch(branch_name).tag_path(tag_name);
self.file_io.copy_file(&tag_src, &tag_dst).await?;
- // Copy snapshot file to branch
+ // Copy the live snapshot, or restore an expired snapshot from the tag.
let snap_src = snapshot_manager.snapshot_path(snapshot.id());
let snap_dst = snapshot_manager
.with_branch(branch_name)
.snapshot_path(snapshot.id());
- self.file_io.copy_file(&snap_src, &snap_dst).await?;
+ if self.file_io.exists(&snap_src).await? {
+ self.file_io.copy_file(&snap_src, &snap_dst).await?;
+ } else {
+ let json = serde_json::to_string(&snapshot).map_err(|e|
crate::Error::DataInvalid {
Review Comment:
[P2] Preserve Java snapshot metadata when restoring from a tag
Serializing the parsed Rust `Snapshot` drops fields absent from its model.
Current Java persists `operation`, and `Tag::trimToSnapshot` preserves it. I
reproduced this with an actual truncated table and a Java-compatible tag
containing `"operation":"TRUNCATE"`: the live-copy control retains the field,
but after deleting the live snapshot this fallback creates a branch snapshot
with no operation. Java's snapshots system table then reports NULL, and
`FileStoreCommitImpl.isRtasAfterTruncate` can no longer recognize the marker
required to reset inherited manifest/index state on the subsequent RTAS append
path (apache/paimon#8469). Please preserve the complete snapshot payload from
the tag (excluding tag-only fields), or retain the established snapshot
fields/unknown fields during serialization, and cover the live-versus-expired
case.
--
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]