@@ -26,7 +26,7 @@ type CDCFlowLimits struct {
26
26
// This is typically non-zero for testing purposes.
27
27
TotalSyncFlows int
28
28
// Maximum number of rows in a sync flow batch.
29
- MaxBatchSize int
29
+ MaxBatchSize uint32
30
30
// Rows synced after which we can say a test is done.
31
31
ExitAfterRecords int
32
32
}
@@ -48,14 +48,15 @@ type CDCFlowWorkflowState struct {
48
48
// Needed to support schema changes.
49
49
RelationMessageMapping model.RelationMessageMapping
50
50
// current workflow state
51
- CurrentFlowState protos.FlowStatus
51
+ CurrentFlowState protos.FlowStatus
52
+ // moved from config here, set by SetupFlow
52
53
SrcTableIdNameMapping map [uint32 ]string
53
54
TableNameSchemaMapping map [string ]* protos.TableSchema
54
55
}
55
56
56
57
type SignalProps struct {
57
- BatchSize int32
58
- IdleTimeout int64
58
+ BatchSize uint32
59
+ IdleTimeout uint64
59
60
}
60
61
61
62
// returns a new empty PeerFlowState
@@ -155,13 +156,12 @@ func CDCFlowWorkflowWithConfig(
155
156
limits * CDCFlowLimits ,
156
157
state * CDCFlowWorkflowState ,
157
158
) (* CDCFlowWorkflowResult , error ) {
158
- if state == nil {
159
- state = NewCDCFlowWorkflowState (len (cfg .TableMappings ))
160
- }
161
-
162
159
if cfg == nil {
163
160
return nil , fmt .Errorf ("invalid connection configs" )
164
161
}
162
+ if state == nil {
163
+ state = NewCDCFlowWorkflowState (len (cfg .TableMappings ))
164
+ }
165
165
166
166
w := NewCDCFlowWorkflowExecution (ctx )
167
167
@@ -304,7 +304,7 @@ func CDCFlowWorkflowWithConfig(
304
304
}
305
305
306
306
syncFlowOptions := & protos.SyncFlowOptions {
307
- BatchSize : int32 ( limits .MaxBatchSize ) ,
307
+ BatchSize : limits .MaxBatchSize ,
308
308
IdleTimeoutSeconds : 0 ,
309
309
SrcTableIdNameMapping : state .SrcTableIdNameMapping ,
310
310
TableNameSchemaMapping : state .TableNameSchemaMapping ,
@@ -319,14 +319,12 @@ func CDCFlowWorkflowWithConfig(
319
319
cdcPropertiesSelector .AddReceive (cdcPropertiesSignalChannel , func (c workflow.ReceiveChannel , more bool ) {
320
320
var cdcSignal SignalProps
321
321
c .Receive (ctx , & cdcSignal )
322
+ // only modify for options since SyncFlow uses it
322
323
if cdcSignal .BatchSize > 0 {
323
324
syncFlowOptions .BatchSize = cdcSignal .BatchSize
324
- cfg .MaxBatchSize = uint32 (cdcSignal .BatchSize )
325
- limits .MaxBatchSize = int (cdcSignal .BatchSize )
326
325
}
327
326
if cdcSignal .IdleTimeout > 0 {
328
327
syncFlowOptions .IdleTimeoutSeconds = cdcSignal .IdleTimeout
329
- cfg .IdleTimeoutSeconds = cdcSignal .IdleTimeout
330
328
}
331
329
332
330
slog .Info ("CDC Signal received. Parameters on signal reception:" , slog .Int ("BatchSize" , int (cfg .MaxBatchSize )),
0 commit comments