@@ -294,8 +294,7 @@ func (c *ReplicaConfig) ValidateAndAdjust(sinkURI *url.URL) error { // check sin
294294 if performanceMode == "" {
295295 c .PerformanceMode = util .AddressOf (PerformanceModeThroughput )
296296 } else if performanceMode != PerformanceModeThroughput && performanceMode != PerformanceModeLowLatency {
297- return cerror .ErrInvalidReplicaConfig .FastGenByArgs (
298- fmt .Sprintf ("unknown performance mode: %s" , performanceMode ))
297+ return cerror .ErrInvalidReplicaConfig .FastGen ("unknown performance mode: %s" , performanceMode )
299298 }
300299
301300 enableRedoIOCheck := true
@@ -327,21 +326,21 @@ func (c *ReplicaConfig) ValidateAndAdjust(sinkURI *url.URL) error { // check sin
327326 return cerror .ErrInvalidReplicaConfig .
328327 FastGenByArgs ("The SyncPoint must be disabled when the downstream is not tidb or mysql" )
329328 }
330- if c .SyncPointInterval != nil &&
331- * c .SyncPointInterval < minSyncPointInterval {
332- return cerror .ErrInvalidReplicaConfig .
333- FastGenByArgs (
334- fmt .Sprintf ("The SyncPointInterval:%s must be larger than %s" ,
335- c .SyncPointInterval .String (),
336- minSyncPointInterval .String ()))
329+ if c .SyncPointInterval == nil {
330+ c .SyncPointInterval = util .AddressOf (* defaultReplicaConfig .SyncPointInterval )
331+ }
332+ if * c .SyncPointInterval < minSyncPointInterval {
333+ return cerror .ErrInvalidReplicaConfig .FastGen (
334+ "The SyncPointInterval:%s must be larger than %s" ,
335+ c .SyncPointInterval .String (),
336+ minSyncPointInterval .String ())
337337 }
338338 if c .SyncPointRetention != nil &&
339339 * c .SyncPointRetention < minSyncPointRetention {
340- return cerror .ErrInvalidReplicaConfig .
341- FastGenByArgs (
342- fmt .Sprintf ("The SyncPointRetention:%s must be larger than %s" ,
343- c .SyncPointRetention .String (),
344- minSyncPointRetention .String ()))
340+ return cerror .ErrInvalidReplicaConfig .FastGen (
341+ "The SyncPointRetention:%s must be larger than %s" ,
342+ c .SyncPointRetention .String (),
343+ minSyncPointRetention .String ())
345344 }
346345 }
347346 if util .GetOrZero (c .MemoryQuota ) == uint64 (0 ) {
@@ -385,19 +384,18 @@ func (c *ReplicaConfig) ValidateAndAdjust(sinkURI *url.URL) error { // check sin
385384
386385 if c .ChangefeedErrorStuckDuration != nil &&
387386 * c .ChangefeedErrorStuckDuration < minChangeFeedErrorStuckDuration {
388- return cerror .ErrInvalidReplicaConfig .
389- FastGenByArgs (
390- fmt .Sprintf ("The ChangefeedErrorStuckDuration:%f must be larger than %f Seconds" ,
391- c .ChangefeedErrorStuckDuration .Seconds (),
392- minChangeFeedErrorStuckDuration .Seconds ()))
387+ return cerror .ErrInvalidReplicaConfig .FastGen (
388+ "The ChangefeedErrorStuckDuration:%f must be larger than %f Seconds" ,
389+ c .ChangefeedErrorStuckDuration .Seconds (),
390+ minChangeFeedErrorStuckDuration .Seconds ())
393391 }
394392
395393 // allow the batch count and batch bytes set to 0, to disable the batch mechanism
396394 if c .EventCollectorBatchCount != nil && * c .EventCollectorBatchCount < 0 {
397395 return cerror .ErrInvalidReplicaConfig .FastGenByArgs ("event-collector-batch-count must be set not smaller than 0" )
398396 }
399397 if c .EventCollectorBatchCount != nil && * c .EventCollectorBatchCount > MaxEventCollectorBatchCount {
400- return cerror .ErrInvalidReplicaConfig .FastGenByArgs (
398+ return cerror .ErrInvalidReplicaConfig .FastGen (
401399 "event-collector-batch-count must be set not larger than %d" , MaxEventCollectorBatchCount ,
402400 )
403401 }
0 commit comments