@@ -92,13 +92,15 @@ pub async fn do_vacuum2(
92
92
93
93
let retention_policy = fuse_table. get_data_retention_policy ( ctx. as_ref ( ) ) ?;
94
94
95
+ // Indicates whether to use the current table snapshot as gc root,
96
+ // true means vacuum all the historical snapshots.
95
97
let mut is_vacuum_all = false ;
96
98
97
99
let mut respect_flash_back_with_lvt = None ;
98
100
let snapshots_before_lvt = match retention_policy {
99
101
RetentionPolicy :: ByTimePeriod ( delta_duration) => {
100
102
let retention_period = if fuse_table. is_transient ( ) {
101
- // for transient table, keep no history data
103
+ // For transient table, keep no history data
102
104
TimeDelta :: zero ( )
103
105
} else {
104
106
delta_duration
@@ -176,15 +178,14 @@ pub async fn do_vacuum2(
176
178
}
177
179
if num_snapshot_to_keep == 1 {
178
180
// Expecting only one snapshot left, which means that we can use the current snapshot
179
- // as gc root, this flag will be propagated to the select_gc_root routine later.
181
+ // as gc root, this flag will be propagated to the select_gc_root func later.
180
182
is_vacuum_all = true ;
181
183
}
182
184
183
- // Later while selecting gc root, that last one of the `snapshots` will be used as gc
184
- // candidate(which we are not sure about if it has been successfully committed) .
185
+ // When selecting the GC root later, the last snapshot in `snapshots` is a candidate,
186
+ // but its commit status is uncertain, its previous snapshot is typically used as the GC root, except in the is_vacuum_all case .
185
187
//
186
- // The previous snapshot of the candidate will be used as the GC root (expect for the is_vacuum_all scenario).
187
- // Thus while truncating the snapshots, we should keep 2 extras snapshots; see `select_gc_root` for more details.
188
+ // Therefore, during snapshot truncation, we keep 2 extra snapshots; see `select_gc_root` for details.
188
189
let num_candidates = len - num_snapshot_to_keep + 2 ;
189
190
snapshots. truncate ( num_candidates) ;
190
191
snapshots
0 commit comments