@@ -15,7 +15,7 @@ use crate::sql::common::{CheckpointBarrier, Watermark};
1515use arrow_array:: RecordBatch ;
1616use async_trait:: async_trait;
1717use protocol:: storage:: {
18- KafkaSourceSubtaskCheckpoint , SourceCheckpointPayload , source_checkpoint_payload ,
18+ KafkaSourceSubtaskCheckpoint , SourceCheckpointInfo , source_checkpoint_info ,
1919} ;
2020
2121#[ derive( Debug , Clone , Copy , PartialEq , Eq , Default ) ]
@@ -34,17 +34,19 @@ pub enum SourceEvent {
3434 EndOfStream ,
3535}
3636
37- /// Optional metadata returned when a source completes a checkpoint barrier snapshot.
37+ /// Checkpoint metadata produced by a source subtask during a barrier snapshot.
38+ /// Sources fill this directly with [`SourceCheckpointInfo`] — the coordinator collects
39+ /// and persists these entries without any further translation step.
3840#[ derive( Debug , Default , Clone ) ]
3941pub struct SourceCheckpointReport {
40- pub payloads : Vec < SourceCheckpointPayload > ,
42+ pub infos : Vec < SourceCheckpointInfo > ,
4143}
4244
4345impl SourceCheckpointReport {
4446 pub fn from_kafka_checkpoint ( kafka : KafkaSourceSubtaskCheckpoint ) -> Self {
4547 Self {
46- payloads : vec ! [ SourceCheckpointPayload {
47- checkpoint : Some ( source_checkpoint_payload :: Checkpoint :: Kafka ( kafka) ) ,
48+ infos : vec ! [ SourceCheckpointInfo {
49+ info : Some ( source_checkpoint_info :: Info :: Kafka ( kafka) ) ,
4850 } ] ,
4951 }
5052 }
@@ -54,6 +56,11 @@ impl SourceCheckpointReport {
5456pub trait SourceOperator : Send + ' static {
5557 fn name ( & self ) -> & str ;
5658
59+ /// Inject persisted checkpoint records before the source is started.
60+ /// Called by the engine after the operator is constructed and before [`Self::on_start`].
61+ /// Default implementation is a no-op; sources with stateful recovery override this.
62+ fn set_recovery_checkpoint ( & mut self , _infos : Vec < SourceCheckpointInfo > ) { }
63+
5764 async fn on_start ( & mut self , _ctx : & mut TaskContext ) -> anyhow:: Result < ( ) > {
5865 Ok ( ( ) )
5966 }
@@ -74,15 +81,15 @@ pub trait SourceOperator: Send + 'static {
7481 /// Kafka source keeps the default: offsets are reported at the barrier in [`Self::snapshot_state`].
7582 async fn commit_checkpoint (
7683 & mut self ,
77- epoch : u32 ,
84+ epoch : u64 ,
7885 _ctx : & mut TaskContext ,
7986 ) -> anyhow:: Result < ( ) > {
8087 let _ = epoch;
8188 Ok ( ( ) )
8289 }
8390
8491 /// Same rollback hook as [`super::operator::Operator::abort_checkpoint`].
85- async fn abort_checkpoint ( & mut self , epoch : u32 , _ctx : & mut TaskContext ) -> anyhow:: Result < ( ) > {
92+ async fn abort_checkpoint ( & mut self , epoch : u64 , _ctx : & mut TaskContext ) -> anyhow:: Result < ( ) > {
8693 let _ = epoch;
8794 Ok ( ( ) )
8895 }
0 commit comments