@@ -201,6 +201,7 @@ pub(crate) async fn run(
201201 common_args : & CommonArgs ,
202202 adbc_conn : adbc_client:: AdbcConnection ,
203203 etl_pipeline : & mut ETLPipeline ,
204+ checkpoint_steps : Option < usize > ,
204205) -> anyhow:: Result < ( ) > {
205206 let metric_attributes = run_metric_attributes ( common_args) ;
206207
@@ -292,21 +293,45 @@ pub(crate) async fn run(
292293 let shutdown_token = throughput_test. cancellation_token ( ) ;
293294
294295 // --- Start the ETL pipeline (remaining batches) ---
296+ // If checkpoint_steps is set, use `.run(steps)` so the pipeline pauses
297+ // at checkpoint boundaries. Otherwise fall back to `.start()` which runs
298+ // all remaining batches without pausing.
295299 tracing:: info!( "Starting ETL pipeline (remaining batches)..." ) ;
296300 let mut etl_state_rx = etl_pipeline. state_watch ( ) ;
297- etl_pipeline. start ( ) . await ?;
301+ if let Some ( steps) = checkpoint_steps {
302+ tracing:: info!( checkpoint_steps = steps, "Using checkpoint-aware ETL mode" ) ;
303+ etl_pipeline. run ( steps) . await ?;
304+ } else {
305+ etl_pipeline. start ( ) . await ?;
306+ }
298307
299308 let test_future = throughput_test. wait ( ) ;
300309 tokio:: pin!( test_future) ;
301310
302- // Wait for ETL pipeline completion, then cancel the test.
311+ // Wait for ETL pipeline state changes, handling both pauses (checkpoint
312+ // boundaries) and stops (completion / error / cancellation).
313+ //
314+ // When the pipeline pauses at a checkpoint boundary we immediately
315+ // continue it. TODO: In the future this is where checkpoint-based query result
316+ // validation would be triggered before resuming.
317+ //
303318 // If interrupted (ctrl-c), cancel both the test and the ETL pipeline.
304319 let etl_error: Option < String > = loop {
305320 tokio:: select! {
306- // ETL state changed — check if stopped
321+ // ETL state changed — check if stopped or paused
307322 _ = etl_state_rx. changed( ) => {
308323 let state = etl_state_rx. borrow_and_update( ) . clone( ) ;
309324 match state {
325+ PipelineState :: Paused => {
326+ tracing:: info!( "ETL pipeline paused at checkpoint boundary" ) ;
327+ // TODO: run checkpoint-based query result validation here
328+ if let Err ( e) = etl_pipeline. continue_pipeline( ) {
329+ eprintln!( "Failed to continue ETL pipeline after pause: {e}" ) ;
330+ shutdown_token. cancel( ) ;
331+ break Some ( format!( "Failed to continue ETL pipeline: {e}" ) ) ;
332+ }
333+ tracing:: info!( "ETL pipeline resumed" ) ;
334+ }
310335 PipelineState :: Stopped ( StopReason :: Completed ) => {
311336 println!( "ETL pipeline completed, stopping benchmark..." ) ;
312337 shutdown_token. cancel( ) ;
0 commit comments