@@ -305,6 +305,7 @@ impl IndexerState {
305305 timestamp_opt,
306306 partition,
307307 num_bytes,
308+ arrival_timestamp_millis_opt,
308309 } = doc;
309310 counters. num_docs_in_workbench += 1 ;
310311 let ( indexed_split, split_created) = self . get_or_create_indexed_split (
@@ -326,6 +327,12 @@ impl IndexerState {
326327 if let Some ( timestamp) = timestamp_opt {
327328 record_timestamp ( timestamp, & mut indexed_split. split_attrs . time_range ) ;
328329 }
330+ if let Some ( arrival_timestamp_millis) = arrival_timestamp_millis_opt {
331+ record_arrival_timestamp (
332+ arrival_timestamp_millis,
333+ & mut indexed_split. split_attrs . min_arrival_timestamp_millis_opt ,
334+ ) ;
335+ }
329336 let _protect_guard = ctx. protect_zone ( ) ;
330337 indexed_split
331338 . index_writer
@@ -468,6 +475,14 @@ fn record_timestamp(timestamp: DateTime, time_range: &mut Option<RangeInclusive<
468475 * time_range = Some ( new_timestamp_range) ;
469476}
470477
478+ fn record_arrival_timestamp (
479+ arrival_timestamp_millis : u64 ,
480+ min_arrival_timestamp_millis_opt : & mut Option < u64 > ,
481+ ) {
482+ let current_min = min_arrival_timestamp_millis_opt. get_or_insert ( arrival_timestamp_millis) ;
483+ * current_min = arrival_timestamp_millis. min ( * current_min) ;
484+ }
485+
471486#[ async_trait]
472487impl Handler < CommitTimeout > for Indexer {
473488 type Reply = ( ) ;
@@ -797,6 +812,7 @@ mod tests {
797812 timestamp_opt: Some ( DateTime :: from_timestamp_secs( 1_662_529_435 ) ) ,
798813 partition: 1 ,
799814 num_bytes: 30 ,
815+ arrival_timestamp_millis_opt: None ,
800816 } ,
801817 ProcessedDoc {
802818 doc: doc!(
@@ -806,6 +822,7 @@ mod tests {
806822 timestamp_opt: Some ( DateTime :: from_timestamp_secs( 1_662_529_435 ) ) ,
807823 partition: 1 ,
808824 num_bytes: 30 ,
825+ arrival_timestamp_millis_opt: None ,
809826 } ,
810827 ] ,
811828 SourceCheckpointDelta :: from_range ( 4 ..6 ) ,
@@ -823,6 +840,7 @@ mod tests {
823840 timestamp_opt: Some ( DateTime :: from_timestamp_secs( 1_662_529_435i64 ) ) ,
824841 partition: 1 ,
825842 num_bytes: 30 ,
843+ arrival_timestamp_millis_opt: None ,
826844 } ,
827845 ProcessedDoc {
828846 doc: doc!(
@@ -832,6 +850,7 @@ mod tests {
832850 timestamp_opt: Some ( DateTime :: from_timestamp_secs( 1_662_529_435 ) ) ,
833851 partition: 1 ,
834852 num_bytes: 30 ,
853+ arrival_timestamp_millis_opt: None ,
835854 } ,
836855 ] ,
837856 SourceCheckpointDelta :: from_range ( 6 ..8 ) ,
@@ -848,6 +867,7 @@ mod tests {
848867 timestamp_opt: Some ( DateTime :: from_timestamp_secs( 1_662_529_435 ) ) ,
849868 partition: 1 ,
850869 num_bytes: 30 ,
870+ arrival_timestamp_millis_opt: None ,
851871 } ] ,
852872 SourceCheckpointDelta :: from_range ( 8 ..9 ) ,
853873 false ,
@@ -933,6 +953,7 @@ mod tests {
933953 timestamp_opt : None ,
934954 partition : 0 ,
935955 num_bytes,
956+ arrival_timestamp_millis_opt : None ,
936957 }
937958 } ;
938959 for i in 0 ..10_000 {
@@ -1011,6 +1032,7 @@ mod tests {
10111032 timestamp_opt: Some ( DateTime :: from_timestamp_secs( 1_662_529_435 ) ) ,
10121033 partition: 1 ,
10131034 num_bytes: 30 ,
1035+ arrival_timestamp_millis_opt: None ,
10141036 } ] ,
10151037 SourceCheckpointDelta :: from_range ( position..position + 1 ) ,
10161038 false ,
@@ -1089,6 +1111,7 @@ mod tests {
10891111 timestamp_opt: Some ( DateTime :: from_timestamp_secs( 1_662_529_435 ) ) ,
10901112 partition: 1 ,
10911113 num_bytes: 30 ,
1114+ arrival_timestamp_millis_opt: None ,
10921115 } ] ,
10931116 SourceCheckpointDelta :: from_range ( 8 ..9 ) ,
10941117 false ,
@@ -1176,6 +1199,7 @@ mod tests {
11761199 timestamp_opt: Some ( DateTime :: from_timestamp_secs( 1_662_529_435 ) ) ,
11771200 partition: 1 ,
11781201 num_bytes: 30 ,
1202+ arrival_timestamp_millis_opt: None ,
11791203 } ] ,
11801204 SourceCheckpointDelta :: from_range ( 8 ..9 ) ,
11811205 false ,
@@ -1260,6 +1284,7 @@ mod tests {
12601284 timestamp_opt: None ,
12611285 partition: 1 ,
12621286 num_bytes: 30 ,
1287+ arrival_timestamp_millis_opt: None ,
12631288 } ,
12641289 ProcessedDoc {
12651290 doc: doc!(
@@ -1269,6 +1294,7 @@ mod tests {
12691294 timestamp_opt: None ,
12701295 partition: 3 ,
12711296 num_bytes: 30 ,
1297+ arrival_timestamp_millis_opt: None ,
12721298 } ,
12731299 ] ,
12741300 SourceCheckpointDelta :: from_range ( 8 ..9 ) ,
@@ -1354,6 +1380,7 @@ mod tests {
13541380 timestamp_opt: None ,
13551381 partition,
13561382 num_bytes: 30 ,
1383+ arrival_timestamp_millis_opt: None ,
13571384 } ] ,
13581385 SourceCheckpointDelta :: from_range ( partition..partition + 1 ) ,
13591386 false ,
@@ -1432,6 +1459,7 @@ mod tests {
14321459 timestamp_opt: None ,
14331460 partition: 0 ,
14341461 num_bytes: 30 ,
1462+ arrival_timestamp_millis_opt: None ,
14351463 } ] ,
14361464 SourceCheckpointDelta :: from_range ( 0 ..1 ) ,
14371465 false ,
@@ -1503,6 +1531,7 @@ mod tests {
15031531 timestamp_opt: None ,
15041532 partition: 0 ,
15051533 num_bytes: 30 ,
1534+ arrival_timestamp_millis_opt: None ,
15061535 } ] ,
15071536 SourceCheckpointDelta :: from_range ( 0 ..1 ) ,
15081537 false ,
@@ -1559,6 +1588,7 @@ mod tests {
15591588 timestamp_opt: None ,
15601589 partition: 0 ,
15611590 num_bytes: 30 ,
1591+ arrival_timestamp_millis_opt: None ,
15621592 } ] ,
15631593 SourceCheckpointDelta :: from_range ( 0 ..1 ) ,
15641594 true ,
0 commit comments