@@ -192,6 +192,9 @@ func handleFlowSignalStateChange(
192192 // we should ContinueAsNew after the first signal in the selector, but just in case
193193 cfg .Resync = true
194194 cfg .DoInitialSnapshot = true
195+ // This is just for in-memory
196+ // Override Snapshot Parameters if request in State Change request
197+ overrideSnapshotParametersInState (val , state )
195198 state .DropFlowInput = & protos.DropFlowInput {
196199 // to be filled in just before ContinueAsNew
197200 FlowJobName : cfg .FlowJobName ,
@@ -206,6 +209,21 @@ func handleFlowSignalStateChange(
206209 }
207210}
208211
212+ func overrideSnapshotParametersInState (req * protos.FlowStateChangeRequest , state * cdc_state.CDCFlowWorkflowState ) {
213+ if req .FlowConfigUpdate != nil && req .FlowConfigUpdate .GetCdcFlowConfigUpdate () != nil {
214+ cdcConfigUpdate := req .FlowConfigUpdate .GetCdcFlowConfigUpdate ()
215+ if cdcConfigUpdate .SnapshotMaxParallelWorkers > 0 {
216+ state .SnapshotMaxParallelWorkers = cdcConfigUpdate .SnapshotMaxParallelWorkers
217+ }
218+ if cdcConfigUpdate .SnapshotNumTablesInParallel > 0 {
219+ state .SnapshotNumTablesInParallel = cdcConfigUpdate .SnapshotNumTablesInParallel
220+ }
221+ if cdcConfigUpdate .SnapshotNumRowsPerPartition > 0 {
222+ state .SnapshotNumRowsPerPartition = cdcConfigUpdate .SnapshotNumRowsPerPartition
223+ }
224+ }
225+ }
226+
209227func processTableAdditions (
210228 ctx workflow.Context ,
211229 logger log.Logger ,
@@ -494,6 +512,8 @@ func CDCFlowWorkflow(
494512 state .ActiveSignal = model .ResyncSignal
495513 cfg .Resync = true
496514 cfg .DoInitialSnapshot = true
515+ // Update State with snapshot parameters
516+ overrideSnapshotParametersInState (val , state )
497517 resyncCfg := syncStateToConfigProtoInCatalog (ctx , cfg , state )
498518 state .DropFlowInput = & protos.DropFlowInput {
499519 FlowJobName : resyncCfg .FlowJobName ,
@@ -627,6 +647,9 @@ func CDCFlowWorkflow(
627647 cfg .TableMappings = originalTableMappings
628648 // this is the only place where we can have a resync during a resync
629649 // so we need to NOT sync the tableMappings to catalog to preserve original names
650+
651+ // We still override the snapshot parameters (when resync with updated values)
652+ overrideSnapshotParametersInState (val , state )
630653 uploadConfigToCatalog (ctx , cfg )
631654 state .DropFlowInput = & protos.DropFlowInput {
632655 FlowJobName : cfg .FlowJobName ,
@@ -863,6 +886,7 @@ func CDCFlowWorkflow(
863886 state .ActiveSignal = model .ResyncSignal
864887 cfg .Resync = true
865888 cfg .DoInitialSnapshot = true
889+ overrideSnapshotParametersInState (val , state )
866890 resyncCfg := syncStateToConfigProtoInCatalog (ctx , cfg , state )
867891 state .DropFlowInput = & protos.DropFlowInput {
868892 FlowJobName : resyncCfg .FlowJobName ,
0 commit comments