github.com/pingcap/tiflow@v0.0.0-20240520035814-5bf52d54e205/pkg/config/debug.go (about)

     1  // Copyright 2021 PingCAP, Inc.
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // See the License for the specific language governing permissions and
    12  // limitations under the License.
    13  
    14  package config
    15  
    16  import (
    17  	"github.com/pingcap/errors"
    18  )
    19  
    20  // DebugConfig represents config for ticdc unexposed feature configurations
    21  type DebugConfig struct {
    22  	DB *DBConfig `toml:"db" json:"db"`
    23  
    24  	Messages *MessagesConfig `toml:"messages" json:"messages"`
    25  
    26  	// Scheduler is the configuration of the two-phase scheduler.
    27  	Scheduler *SchedulerConfig `toml:"scheduler" json:"scheduler"`
    28  
    29  	// CDCV2 enables ticdc version 2 implementation with new metastore
    30  	CDCV2 *CDCV2 `toml:"cdc-v2" json:"cdc-v2"`
    31  
    32  	// Puller is the configuration of the puller.
    33  	Puller *PullerConfig `toml:"puller" json:"puller"`
    34  }
    35  
    36  // ValidateAndAdjust validates and adjusts the debug configuration
    37  func (c *DebugConfig) ValidateAndAdjust() error {
    38  	if err := c.Messages.ValidateAndAdjust(); err != nil {
    39  		return errors.Trace(err)
    40  	}
    41  	if err := c.DB.ValidateAndAdjust(); err != nil {
    42  		return errors.Trace(err)
    43  	}
    44  	if err := c.Scheduler.ValidateAndAdjust(); err != nil {
    45  		return errors.Trace(err)
    46  	}
    47  	if err := c.CDCV2.ValidateAndAdjust(); err != nil {
    48  		return errors.Trace(err)
    49  	}
    50  
    51  	return nil
    52  }
    53  
    54  // PullerConfig represents config for puller
    55  type PullerConfig struct {
    56  	// EnableResolvedTsStuckDetection is used to enable resolved ts stuck detection.
    57  	EnableResolvedTsStuckDetection bool `toml:"enable-resolved-ts-stuck-detection" json:"enable-resolved-ts-stuck-detection"`
    58  	// ResolvedTsStuckInterval is the interval of checking resolved ts stuck.
    59  	ResolvedTsStuckInterval TomlDuration `toml:"resolved-ts-stuck-interval" json:"resolved-ts-stuck-interval"`
    60  	// LogRegionDetails determines whether logs Region details or not in puller and kv-client.
    61  	LogRegionDetails bool `toml:"log-region-details" json:"log-region-details"`
    62  }