dhruvarya-db commented on code in PR #2667:
URL: https://github.com/apache/iceberg-rust/pull/2667#discussion_r3463240917


##########
crates/iceberg/src/transaction/expire_snapshots.rs:
##########
@@ -321,6 +321,26 @@ impl TransactionAction for ExpireSnapshotsAction {
             .into_iter()
             .map(|ref_name| TableUpdate::RemoveSnapshotRef { ref_name })
             .collect();
+
+        // Drop the statistics metadata tied to each expired snapshot, 
mirroring Java
+        // `RemoveSnapshots.removeSnapshots`. This only rewrites metadata; the 
puffin files those
+        // entries point at are deleted by the higher-level file-cleanup 
maintenance operation.
+        for snapshot_id in &plan.ids_to_remove {
+            if metadata.statistics_for_snapshot(*snapshot_id).is_some() {

Review Comment:
   Added both in 184ea96: `test_ref_aging_expiry_drops_statistics` (snapshot 1 
kept alive only by an aged-out tag, asserting `removed_statistics == [1]` — 
reaches the loop via the ref-aging `plan()` branch) and 
`test_multiple_expired_snapshots_drop_their_statistics` (1 -> 2 -> 3 chain, two 
expire, asserting `removed_statistics == [1, 2]`).



##########
crates/iceberg/src/transaction/expire_snapshots.rs:
##########
@@ -321,6 +321,26 @@ impl TransactionAction for ExpireSnapshotsAction {
             .into_iter()
             .map(|ref_name| TableUpdate::RemoveSnapshotRef { ref_name })
             .collect();
+
+        // Drop the statistics metadata tied to each expired snapshot, 
mirroring Java
+        // `RemoveSnapshots.removeSnapshots`. This only rewrites metadata; the 
puffin files those
+        // entries point at are deleted by the higher-level file-cleanup 
maintenance operation.
+        for snapshot_id in &plan.ids_to_remove {

Review Comment:
   Done in 184ea96 — switched to `for &snapshot_id in &plan.ids_to_remove`, 
dropping the `*snapshot_id` derefs.



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to