@@ -181,6 +181,7 @@ struct PrecommitOutput {
181181pub struct RowIndexer < ' a > {
182182 src_eval_ctx : & ' a SourceRowEvaluationContext < ' a > ,
183183 setup_execution_ctx : & ' a exec_ctx:: FlowSetupExecutionContext ,
184+ mode : super :: source_indexer:: UpdateMode ,
184185 update_stats : & ' a stats:: UpdateStats ,
185186 pool : & ' a PgPool ,
186187
@@ -197,8 +198,9 @@ impl<'a> RowIndexer<'a> {
197198 pub fn new (
198199 src_eval_ctx : & ' a SourceRowEvaluationContext < ' _ > ,
199200 setup_execution_ctx : & ' a exec_ctx:: FlowSetupExecutionContext ,
200- pool : & ' a PgPool ,
201+ mode : super :: source_indexer :: UpdateMode ,
201202 update_stats : & ' a stats:: UpdateStats ,
203+ pool : & ' a PgPool ,
202204 ) -> Result < Self > {
203205 Ok ( Self {
204206 source_id : setup_execution_ctx. import_ops [ src_eval_ctx. import_op_idx ] . source_id ,
@@ -207,8 +209,9 @@ impl<'a> RowIndexer<'a> {
207209
208210 src_eval_ctx,
209211 setup_execution_ctx,
210- pool ,
212+ mode ,
211213 update_stats,
214+ pool,
212215 } )
213216 }
214217
@@ -236,7 +239,9 @@ impl<'a> RowIndexer<'a> {
236239 ) ;
237240
238241 // First check ordinal-based skipping
239- if existing_version. should_skip ( source_version, Some ( self . update_stats ) ) {
242+ if self . mode == super :: source_indexer:: UpdateMode :: Normal
243+ && existing_version. should_skip ( source_version, Some ( self . update_stats ) )
244+ {
240245 return Ok ( SkippedOr :: Skipped (
241246 existing_version,
242247 info. processed_source_fp . clone ( ) ,
@@ -260,7 +265,9 @@ impl<'a> RowIndexer<'a> {
260265 ( None , interface:: SourceValue :: NonExistence ) => None ,
261266 } ;
262267
263- if let Some ( content_version_fp) = & content_version_fp {
268+ if self . mode == super :: source_indexer:: UpdateMode :: Normal
269+ && let Some ( content_version_fp) = & content_version_fp
270+ {
264271 let baseline = if tracking_setup_state. has_fast_fingerprint_column {
265272 existing_tracking_info
266273 . as_ref ( )
@@ -373,7 +380,9 @@ impl<'a> RowIndexer<'a> {
373380
374381 if let Some ( existing_version) = existing_version {
375382 if output. is_some ( ) {
376- if existing_version. kind == SourceVersionKind :: DifferentLogic {
383+ if existing_version. kind == SourceVersionKind :: DifferentLogic
384+ || self . mode == super :: source_indexer:: UpdateMode :: ReexportTargets
385+ {
377386 self . update_stats . num_reprocesses . inc ( 1 ) ;
378387 } else {
379388 self . update_stats . num_updates . inc ( 1 ) ;
@@ -398,7 +407,9 @@ impl<'a> RowIndexer<'a> {
398407 let tracking_table_setup = & self . setup_execution_ctx . setup_state . tracking_table ;
399408
400409 // Check if we can use content hash optimization
401- if existing_version. kind != SourceVersionKind :: CurrentLogic {
410+ if self . mode != super :: source_indexer:: UpdateMode :: Normal
411+ || existing_version. kind != SourceVersionKind :: CurrentLogic
412+ {
402413 return Ok ( None ) ;
403414 }
404415
@@ -509,7 +520,9 @@ impl<'a> RowIndexer<'a> {
509520 & mut * txn,
510521 )
511522 . await ?;
512- if let Some ( tracking_info) = & tracking_info {
523+ if self . mode == super :: source_indexer:: UpdateMode :: Normal
524+ && let Some ( tracking_info) = & tracking_info
525+ {
513526 let existing_source_version =
514527 SourceVersion :: from_stored_precommit_info ( & tracking_info, logic_fp) ;
515528 if existing_source_version. should_skip ( source_version, Some ( self . update_stats ) ) {
@@ -620,13 +633,12 @@ impl<'a> RowIndexer<'a> {
620633 } else {
621634 None
622635 } ;
623- if existing_target_keys
624- . as_ref ( )
625- . map ( |keys| !keys. is_empty ( ) && keys. iter ( ) . all ( |( _, fp) | fp == & curr_fp) )
626- . unwrap_or ( false )
636+ if self . mode == super :: source_indexer :: UpdateMode :: Normal
637+ && existing_target_keys . as_ref ( ) . map_or ( false , |keys| {
638+ !keys. is_empty ( ) && keys. iter ( ) . all ( |( _, fp) | fp == & curr_fp)
639+ } )
627640 && existing_staging_target_keys
628- . map ( |keys| keys. iter ( ) . all ( |( _, fp) | fp == & curr_fp) )
629- . unwrap_or ( true )
641+ . map_or ( true , |keys| keys. iter ( ) . all ( |( _, fp) | fp == & curr_fp) )
630642 {
631643 // carry over existing target keys info
632644 let ( existing_ordinal, existing_fp) = existing_target_keys
0 commit comments