@@ -95,10 +95,11 @@ pub async fn do_vacuum2(
95
95
// Indicates whether to use the current table snapshot as gc root,
96
96
// true means vacuum all the historical snapshots.
97
97
let mut is_vacuum_all = false ;
98
-
99
98
let mut respect_flash_back_with_lvt = None ;
99
+
100
100
let snapshots_before_lvt = match retention_policy {
101
101
RetentionPolicy :: ByTimePeriod ( delta_duration) => {
102
+ info ! ( "using by ByTimePeriod policy {:?}" , delta_duration) ;
102
103
let retention_period = if fuse_table. is_transient ( ) {
103
104
// For transient table, keep no history data
104
105
TimeDelta :: zero ( )
@@ -123,44 +124,15 @@ pub async fn do_vacuum2(
123
124
lvt
124
125
) ) ;
125
126
126
- let elapsed = start. elapsed ( ) ;
127
127
let snapshots_before_lvt =
128
128
collect_gc_candidate_by_retention_period ( fuse_table, lvt, is_vacuum_all) . await ?;
129
- // let snapshots_before_lvt = if is_vacuum_all {
130
- // list_until_prefix(
131
- // fuse_table,
132
- // fuse_table
133
- // .meta_location_generator()
134
- // .snapshot_location_prefix(),
135
- // fuse_table.snapshot_loc().unwrap().as_str(),
136
- // true,
137
- // None,
138
- // )
139
- // .await?
140
- //} else {
141
- // list_until_timestamp(
142
- // fuse_table,
143
- // fuse_table
144
- // .meta_location_generator()
145
- // .snapshot_location_prefix(),
146
- // lvt,
147
- // true,
148
- // None,
149
- // )
150
- // .await?
151
- //};
152
-
153
- ctx. set_status_info ( & format ! (
154
- "list snapshots before lvt for table {} takes {:?}, snapshots_dir: {:?}, lvt: {:?}, snapshots: {:?}" ,
155
- fuse_table. get_table_info( ) . desc,
156
- elapsed,
157
- fuse_table. meta_location_generator( ) . snapshot_location_prefix( ) ,
158
- lvt,
159
- slice_summary( & snapshots_before_lvt)
160
- ) ) ;
161
129
snapshots_before_lvt
162
130
}
163
- RetentionPolicy :: ByNumOfSnapshotsToKeep ( num_snapshot_to_keep) => {
131
+ RetentionPolicy :: ByNumOfSnapshotsToKeep ( num_snapshots_to_keep) => {
132
+ info ! (
133
+ "using by ByNumOfSnapshotsToKeep policy {:?}" ,
134
+ num_snapshots_to_keep
135
+ ) ;
164
136
// List the snapshot order by timestamp asc, till the current snapshot(inclusively).
165
137
let need_one_more = true ;
166
138
let mut snapshots = list_until_prefix (
@@ -175,11 +147,11 @@ pub async fn do_vacuum2(
175
147
. await ?;
176
148
177
149
let len = snapshots. len ( ) ;
178
- if len <= num_snapshot_to_keep {
150
+ if len <= num_snapshots_to_keep {
179
151
// Only the current snapshot is there, done
180
152
return Ok ( vec ! [ ] ) ;
181
153
}
182
- if num_snapshot_to_keep == 1 {
154
+ if num_snapshots_to_keep == 1 {
183
155
// Expecting only one snapshot left, which means that we can use the current snapshot
184
156
// as gc root, this flag will be propagated to the select_gc_root func later.
185
157
is_vacuum_all = true ;
@@ -189,12 +161,23 @@ pub async fn do_vacuum2(
189
161
// but its commit status is uncertain, its previous snapshot is typically used as the GC root, except in the is_vacuum_all case.
190
162
//
191
163
// Therefore, during snapshot truncation, we keep 2 extra snapshots; see `select_gc_root` for details.
192
- let num_candidates = len - num_snapshot_to_keep + 2 ;
164
+ let num_candidates = len - num_snapshots_to_keep + 2 ;
193
165
snapshots. truncate ( num_candidates) ;
194
166
snapshots
195
167
}
196
168
} ;
197
169
170
+ let elapsed = start. elapsed ( ) ;
171
+ ctx. set_status_info ( & format ! (
172
+ "list snapshots for table {} takes {:?}, snapshots_dir: {:?}, snapshots: {:?}" ,
173
+ fuse_table. get_table_info( ) . desc,
174
+ elapsed,
175
+ fuse_table
176
+ . meta_location_generator( )
177
+ . snapshot_location_prefix( ) ,
178
+ slice_summary( & snapshots_before_lvt)
179
+ ) ) ;
180
+
198
181
let start = std:: time:: Instant :: now ( ) ;
199
182
let Some ( ( gc_root, snapshots_to_gc, gc_root_meta_ts) ) = select_gc_root (
200
183
fuse_table,
0 commit comments