@@ -62,15 +62,13 @@ use super::{
62
62
writer:: Writer ,
63
63
StagingError ,
64
64
} ,
65
- LogStream ,
65
+ LogStream , ARROW_FILE_EXTENSION ,
66
66
} ;
67
67
68
68
#[ derive( Debug , thiserror:: Error ) ]
69
69
#[ error( "Stream not found: {0}" ) ]
70
70
pub struct StreamNotFound ( pub String ) ;
71
71
72
- const ARROW_FILE_EXTENSION : & str = "data.arrows" ;
73
-
74
72
pub type StreamRef = Arc < Stream > ;
75
73
76
74
/// Gets the unix timestamp for the minute as described by the `SystemTime`
@@ -165,7 +163,7 @@ impl Stream {
165
163
hostname. push_str ( id) ;
166
164
}
167
165
let filename = format ! (
168
- "{stream_hash}.date={}.hour={:02}.minute={}.{}{hostname}.{ARROW_FILE_EXTENSION}" ,
166
+ "{stream_hash}.date={}.hour={:02}.minute={}.{}{hostname}.data. {ARROW_FILE_EXTENSION}" ,
169
167
parsed_timestamp. date( ) ,
170
168
parsed_timestamp. hour( ) ,
171
169
minute_to_slot( parsed_timestamp. minute( ) , OBJECT_STORE_DATA_GRANULARITY ) . unwrap( ) ,
@@ -495,10 +493,12 @@ impl Stream {
495
493
}
496
494
writer. close ( ) ?;
497
495
498
- if part_file. metadata ( ) . unwrap ( ) . len ( ) < parquet:: file:: FOOTER_SIZE as u64 {
496
+ if part_file. metadata ( ) . expect ( "File was just created" ) . len ( )
497
+ < parquet:: file:: FOOTER_SIZE as u64
498
+ {
499
499
error ! (
500
- "Invalid parquet file {:?} detected for stream {}, removing it" ,
501
- & part_path , & self . stream_name
500
+ "Invalid parquet file {part_path :?} detected for stream {}, removing it" ,
501
+ & self . stream_name
502
502
) ;
503
503
remove_file ( part_path) . unwrap ( ) ;
504
504
} else {
@@ -510,15 +510,22 @@ impl Stream {
510
510
}
511
511
512
512
for file in arrow_files {
513
- // warn!("file-\n{file:?}\n");
514
- let file_size = file. metadata ( ) . unwrap ( ) . len ( ) ;
515
- let file_type = file. extension ( ) . unwrap ( ) . to_str ( ) . unwrap ( ) ;
516
- if remove_file ( file. clone ( ) ) . is_err ( ) {
513
+ let file_size = match file. metadata ( ) {
514
+ Ok ( meta) => meta. len ( ) ,
515
+ Err ( err) => {
516
+ warn ! (
517
+ "File ({}) not found; Error = {err}" ,
518
+ file. display( )
519
+ ) ;
520
+ continue ;
521
+ }
522
+ } ;
523
+ if remove_file ( & file) . is_err ( ) {
517
524
error ! ( "Failed to delete file. Unstable state" ) ;
518
525
process:: abort ( )
519
526
}
520
527
metrics:: STORAGE_SIZE
521
- . with_label_values ( & [ "staging" , & self . stream_name , file_type ] )
528
+ . with_label_values ( & [ "staging" , & self . stream_name , ARROW_FILE_EXTENSION ] )
522
529
. sub ( file_size as i64 ) ;
523
530
}
524
531
}
@@ -883,7 +890,7 @@ mod tests {
883
890
) ;
884
891
885
892
let expected_path = staging. data_path . join ( format ! (
886
- "{stream_hash}.date={}.hour={:02}.minute={}.{}.{ARROW_FILE_EXTENSION}" ,
893
+ "{stream_hash}.date={}.hour={:02}.minute={}.{}.data. {ARROW_FILE_EXTENSION}" ,
887
894
parsed_timestamp. date( ) ,
888
895
parsed_timestamp. hour( ) ,
889
896
minute_to_slot( parsed_timestamp. minute( ) , OBJECT_STORE_DATA_GRANULARITY ) . unwrap( ) ,
@@ -917,7 +924,7 @@ mod tests {
917
924
) ;
918
925
919
926
let expected_path = staging. data_path . join ( format ! (
920
- "{stream_hash}.date={}.hour={:02}.minute={}.key1=value1.key2=value2.{}.{ARROW_FILE_EXTENSION}" ,
927
+ "{stream_hash}.date={}.hour={:02}.minute={}.key1=value1.key2=value2.{}.data. {ARROW_FILE_EXTENSION}" ,
921
928
parsed_timestamp. date( ) ,
922
929
parsed_timestamp. hour( ) ,
923
930
minute_to_slot( parsed_timestamp. minute( ) , OBJECT_STORE_DATA_GRANULARITY ) . unwrap( ) ,
0 commit comments