File tree 3 files changed +7
-5
lines changed
ee/src/storages/fuse/operations
3 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -173,8 +173,10 @@ async fn vacuum_by_duration(
173
173
Ok ( removed_total)
174
174
}
175
175
176
+ // Vacuum temporary files by query hook
177
+ // If query was killed, we still need to clean up the temporary files
176
178
async fn vacuum_query_hook (
177
- abort_checker : AbortChecker ,
179
+ _abort_checker : AbortChecker ,
178
180
temporary_dir : & str ,
179
181
nodes : & [ usize ] ,
180
182
query_id : & str ,
@@ -198,7 +200,6 @@ async fn vacuum_query_hook(
198
200
. filter_map ( |x| x. is_ok ( ) . then ( || x. unwrap ( ) ) ) ;
199
201
200
202
for ( meta_file_path, buffer) in metas {
201
- abort_checker. try_check_aborting ( ) ?;
202
203
let removed = vacuum_by_meta_buffer (
203
204
& meta_file_path,
204
205
temporary_dir,
Original file line number Diff line number Diff line change @@ -45,11 +45,12 @@ pub fn hook_vacuum_temp_files(query_ctx: &Arc<QueryContext>) -> Result<()> {
45
45
46
46
let cluster = query_ctx. get_cluster ( ) ;
47
47
let query_id = query_ctx. get_id ( ) ;
48
-
48
+ let abort_checker = query_ctx . clone ( ) . get_abort_checker ( ) ;
49
49
let mut node_files = HashMap :: new ( ) ;
50
50
for node in cluster. nodes . iter ( ) {
51
51
let stats = query_ctx. get_spill_file_stats ( Some ( node. id . clone ( ) ) ) ;
52
- if stats. file_nums != 0 {
52
+ // if query was aborted, we can't trust the stats
53
+ if stats. file_nums != 0 || abort_checker. try_check_aborting ( ) . is_err ( ) {
53
54
if let Some ( index) = cluster. index_of_nodeid ( & node. id ) {
54
55
node_files. insert ( index, stats. file_nums ) ;
55
56
}
@@ -65,7 +66,6 @@ pub fn hook_vacuum_temp_files(query_ctx: &Arc<QueryContext>) -> Result<()> {
65
66
) ;
66
67
67
68
let nodes = node_files. keys ( ) . cloned ( ) . collect :: < Vec < usize > > ( ) ;
68
- let abort_checker = query_ctx. clone ( ) . get_abort_checker ( ) ;
69
69
let _ = GlobalIORuntime :: instance ( ) . block_on :: < ( ) , ErrorCode , _ > ( async move {
70
70
let removed_files = handler
71
71
. do_vacuum_temporary_files (
Original file line number Diff line number Diff line change @@ -401,6 +401,7 @@ impl QueryContext {
401
401
pub fn get_spill_file_stats ( & self , node_id : Option < String > ) -> SpillProgress {
402
402
let r = self . shared . cluster_spill_progress . read ( ) ;
403
403
let node_id = node_id. unwrap_or ( self . get_cluster ( ) . local_id ( ) ) ;
404
+
404
405
r. get ( & node_id) . cloned ( ) . unwrap_or ( SpillProgress :: default ( ) )
405
406
}
406
407
You can’t perform that action at this time.
0 commit comments