@@ -484,19 +484,29 @@ impl Cluster for ClusterImpl {
484484 let node_name = self . node_name_by_partition ( & partition) ;
485485 let mut futures = Vec :: new ( ) ;
486486 if let Some ( name) = partition. get_row ( ) . get_full_name ( partition. get_id ( ) ) {
487- futures. push ( self . warmup_download ( & node_name, name, partition. get_row ( ) . file_size ( ) ) ) ;
487+ futures. push ( self . warmup_download_with_corruption_check (
488+ & node_name,
489+ name,
490+ partition. get_row ( ) . file_size ( ) ,
491+ & partition,
492+ None ,
493+ ) ) ;
488494 }
489495 for chunk in chunks. iter ( ) {
490496 let name = chunk. get_row ( ) . get_full_name ( chunk. get_id ( ) ) ;
491- futures. push ( self . warmup_download ( & node_name, name, chunk. get_row ( ) . file_size ( ) ) ) ;
497+ futures. push ( self . warmup_download_with_corruption_check (
498+ & node_name,
499+ name,
500+ chunk. get_row ( ) . file_size ( ) ,
501+ & partition,
502+ Some ( chunk. get_id ( ) ) ,
503+ ) ) ;
492504 }
493505 let res = join_all ( futures)
494506 . await
495507 . into_iter ( )
496508 . collect :: < Result < Vec < _ > , _ > > ( ) ;
497509
498- deactivate_table_on_corrupt_data ( self . meta_store . clone ( ) , & res, & partition) . await ;
499-
500510 res?;
501511 Ok ( ( ) )
502512 }
@@ -1404,14 +1414,20 @@ impl ClusterImpl {
14041414 let to_download = plan_node. files_to_download ( ) ;
14051415 let file_futures = to_download
14061416 . iter ( )
1407- . map ( |( partition, remote, file_size) | {
1417+ . map ( |( partition, remote, file_size, chunk_id ) | {
14081418 let meta_store = self . meta_store . clone ( ) ;
14091419 async move {
14101420 let res = self
14111421 . remote_fs
14121422 . download_file ( remote, file_size. clone ( ) )
14131423 . await ;
1414- deactivate_table_on_corrupt_data ( meta_store, & res, & partition) . await ;
1424+ deactivate_table_on_corrupt_data (
1425+ meta_store,
1426+ & res,
1427+ & partition,
1428+ chunk_id. clone ( ) ,
1429+ )
1430+ . await ;
14151431 res
14161432 }
14171433 } )
@@ -1428,12 +1444,27 @@ impl ClusterImpl {
14281444 . collect :: < Result < Vec < _ > , _ > > ( ) ?
14291445 . into_iter ( ) ,
14301446 )
1431- . map ( |( ( _, remote_path, _) , path) | ( remote_path, path) )
1447+ . map ( |( ( _, remote_path, _, _ ) , path) | ( remote_path, path) )
14321448 . collect :: < HashMap < _ , _ > > ( ) ;
14331449
14341450 Ok ( remote_to_local_names)
14351451 }
14361452
1453+ async fn warmup_download_with_corruption_check (
1454+ & self ,
1455+ node_name : & str ,
1456+ remote_path : String ,
1457+ expected_file_size : Option < u64 > ,
1458+ partition : & IdRow < Partition > ,
1459+ chunk_id : Option < u64 > ,
1460+ ) -> Result < ( ) , CubeError > {
1461+ let res = self
1462+ . warmup_download ( & node_name, remote_path, expected_file_size)
1463+ . await ;
1464+ deactivate_table_on_corrupt_data ( self . meta_store . clone ( ) , & res, partition, chunk_id) . await ;
1465+ res
1466+ }
1467+
14371468 pub async fn try_to_connect ( & mut self ) -> Result < ( ) , CubeError > {
14381469 let streams = self
14391470 . server_addresses
@@ -1669,7 +1700,8 @@ impl ClusterImpl {
16691700 c. get_row ( ) . file_size ( ) ,
16701701 )
16711702 . await ;
1672- deactivate_table_on_corrupt_data ( self . meta_store . clone ( ) , & result, & p) . await ;
1703+ // TODO: propagate 'not found' and log in debug mode. Compaction might remove files,
1704+ // so they are not errors most of the time.
16731705 ack_error ! ( result) ;
16741706 }
16751707 }
0 commit comments