@@ -100,21 +100,21 @@ pub enum Operation {
100100 files_to_overwrite : HashMap < String , Vec < String > > ,
101101 additional_summary : Option < HashMap < String , String > > ,
102102 } , // /// Remove or replace rows in existing data files
103- // NewRowDelta,
104- // /// Delete files in the table and commit
105- // NewDelete,
103+ // NewRowDelta,
104+ // /// Delete files in the table and commit
105+ // NewDelete,
106106 /// Expire snapshots in the table
107107 ExpireSnapshots {
108108 older_than : Option < i64 > ,
109109 retain_last : Option < usize > ,
110- clean_orphan_files : bool ,
110+ _clean_orphan_files : bool ,
111111 retain_ref_snapshots : bool ,
112112 dry_run : bool ,
113113 } ,
114- // /// Manage snapshots in the table
115- // ManageSnapshots,
116- // /// Read and write table data and metadata files
117- // IO,
114+ // /// Manage snapshots in the table
115+ // ManageSnapshots,
116+ // /// Read and write table data and metadata files
117+ // IO,
118118}
119119
120120impl Operation {
@@ -851,16 +851,17 @@ impl Operation {
851851 Operation :: ExpireSnapshots {
852852 older_than,
853853 retain_last,
854- clean_orphan_files : _,
854+ _clean_orphan_files : _,
855855 retain_ref_snapshots,
856856 dry_run,
857857 } => {
858858 debug ! ( "Executing ExpireSnapshots operation" ) ;
859-
859+
860860 // Validate parameters
861861 if older_than. is_none ( ) && retain_last. is_none ( ) {
862862 return Err ( Error :: InvalidFormat (
863- "Must specify either older_than or retain_last for snapshot expiration" . into ( )
863+ "Must specify either older_than or retain_last for snapshot expiration"
864+ . into ( ) ,
864865 ) ) ;
865866 }
866867
@@ -890,11 +891,9 @@ impl Operation {
890891 let mut should_retain = false ;
891892
892893 // Never expire the current snapshot
893- if Some ( snapshot_id) == current_snapshot_id {
894- should_retain = true ;
895- }
896- // Never expire snapshots referenced by branches/tags
897- else if ref_snapshot_ids. contains ( & snapshot_id) {
894+ if Some ( snapshot_id) == current_snapshot_id
895+ || ref_snapshot_ids. contains ( & snapshot_id)
896+ {
898897 should_retain = true ;
899898 }
900899 // Keep the most recent N snapshots if retain_last is specified
@@ -920,7 +919,11 @@ impl Operation {
920919
921920 // If dry run, return without making changes
922921 if dry_run {
923- debug ! ( "Dry run: would expire {} snapshots: {:?}" , snapshots_to_expire. len( ) , snapshots_to_expire) ;
922+ debug ! (
923+ "Dry run: would expire {} snapshots: {:?}" ,
924+ snapshots_to_expire. len( ) ,
925+ snapshots_to_expire
926+ ) ;
924927 return Ok ( ( None , vec ! [ ] ) ) ;
925928 }
926929
@@ -930,12 +933,19 @@ impl Operation {
930933 return Ok ( ( None , vec ! [ ] ) ) ;
931934 }
932935
933- debug ! ( "Expiring {} snapshots: {:?}" , snapshots_to_expire. len( ) , snapshots_to_expire) ;
936+ debug ! (
937+ "Expiring {} snapshots: {:?}" ,
938+ snapshots_to_expire. len( ) ,
939+ snapshots_to_expire
940+ ) ;
934941
935942 // Return the RemoveSnapshots update
936- Ok ( ( None , vec ! [ TableUpdate :: RemoveSnapshots {
937- snapshot_ids: snapshots_to_expire,
938- } ] ) )
943+ Ok ( (
944+ None ,
945+ vec ! [ TableUpdate :: RemoveSnapshots {
946+ snapshot_ids: snapshots_to_expire,
947+ } ] ,
948+ ) )
939949 }
940950 }
941951 }
@@ -1022,7 +1032,7 @@ mod tests {
10221032 let op = Operation :: ExpireSnapshots {
10231033 older_than,
10241034 retain_last,
1025- clean_orphan_files : false ,
1035+ _clean_orphan_files : false ,
10261036 retain_ref_snapshots : retain_refs,
10271037 dry_run,
10281038 } ;
@@ -1065,7 +1075,7 @@ mod tests {
10651075 let metadata = sample_metadata (
10661076 & [ ( 10 , 1_000 ) , ( 20 , 2_000 ) , ( 30 , 3_000 ) ] ,
10671077 Some ( 30 ) ,
1068- & [ ( "branch" , 20 ) ] ,
1078+ & [ ( "branch" , 20 ) ] ,
10691079 ) ;
10701080 let updates = execute_operation ( & metadata, Some ( 1_500 ) , None , true , false ) . unwrap ( ) ;
10711081 // Snapshot 10 is the only candidate because 20 is referenced and 30 is current.
0 commit comments