config

package
v0.0.0-...-1b33b2a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 5, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultSortDir is the default value of sort-dir, it will be s sub directory of data-dir.
	DefaultSortDir = "/tmp/sorter"

	// DefaultRedoDir is the sub directory path of data-dir.
	DefaultRedoDir = "/tmp/redo"

	// DebugConfigurationItem is the name of debug configurations
	DebugConfigurationItem = "debug"
)
View Source
const DefaultMaxMessageBytes = 10 * 1024 * 1024 // 10M

DefaultMaxMessageBytes sets the default value for max-message-bytes

View Source
const (
	// ProtocolKey specifies the key of the protocol in the SinkURI.
	ProtocolKey = "protocol"
)

Variables

View Source
var ForceEnableOldValueProtocols = []string{
	ProtocolCanal.String(),
	ProtocolCanalJSON.String(),
	ProtocolMaxwell.String(),
}

ForceEnableOldValueProtocols specifies which protocols need to be forced to enable old value.

Functions

func StoreGlobalServerConfig

func StoreGlobalServerConfig(config *ServerConfig)

StoreGlobalServerConfig stores a new config to the globalServerConfig. It mostly uses in the test to avoid some data races.

Types

type ColumnSelector

type ColumnSelector struct {
	Matcher []string `toml:"matcher" json:"matcher"`
	Columns []string `toml:"columns" json:"columns"`
}

type ConsistentConfig

type ConsistentConfig struct {
	Level             string `toml:"level" json:"level"`
	MaxLogSize        int64  `toml:"max-log-size" json:"max-log-size"`
	FlushIntervalInMs int64  `toml:"flush-interval" json:"flush-interval"`
	Storage           string `toml:"storage" json:"storage"`
}

ConsistentConfig represents replication consistency config for a changefeed

type CyclicConfig

type CyclicConfig struct {
	Enable          bool     `toml:"enable" json:"enable"`
	ReplicaID       uint64   `toml:"replica-id" json:"replica-id"`
	FilterReplicaID []uint64 `toml:"filter-replica-ids" json:"filter-replica-ids"`
	IDBuckets       int      `toml:"id-buckets" json:"id-buckets"`
	SyncDDL         bool     `toml:"sync-ddl" json:"sync-ddl"`
}

CyclicConfig represents config used for cyclic replication

func (*CyclicConfig) IsEnabled

func (c *CyclicConfig) IsEnabled() bool

IsEnabled returns whether cyclic replication is enabled or not.

func (*CyclicConfig) Marshal

func (c *CyclicConfig) Marshal() (string, error)

Marshal returns the json marshal format of a ReplicationConfig

func (*CyclicConfig) Unmarshal

func (c *CyclicConfig) Unmarshal(data []byte) error

Unmarshal unmarshals into *ReplicationConfig from json marshal byte slice

type DBConfig

type DBConfig struct {
	// Count is the number of leveldb count.
	//
	// The default value is 16.
	Count int `toml:"count" json:"count"`
	// Concurrency is the maximum write and read concurrency.
	//
	// The default value is 256.
	Concurrency int `toml:"concurrency" json:"concurrency"`
	// MaxOpenFiles is the maximum number of open FD by leveldb sorter.
	//
	// The default value is 10000.
	MaxOpenFiles int `toml:"max-open-files" json:"max-open-files"`
	// BlockSize the block size of leveldb sorter.
	//
	// The default value is 65536, 64KB.
	BlockSize int `toml:"block-size" json:"block-size"`
	// BlockCacheSize is the capacity of leveldb block cache.
	//
	// The default value is 4294967296, 4GB.
	BlockCacheSize int `toml:"block-cache-size" json:"block-cache-size"`
	// WriterBufferSize is the size of memory table of leveldb.
	//
	// The default value is 8388608, 8MB.
	WriterBufferSize int `toml:"writer-buffer-size" json:"writer-buffer-size"`
	// Compression is the compression algorithm that is used by leveldb.
	// Valid values are "none" or "snappy".
	//
	// The default value is "snappy".
	Compression string `toml:"compression" json:"compression"`
	// TargetFileSizeBase limits size of leveldb sst file that compaction generates.
	//
	// The default value is 8388608, 8MB.
	TargetFileSizeBase int `toml:"target-file-size-base" json:"target-file-size-base"`
	// WriteL0SlowdownTrigger defines number of leveldb sst file at level-0 that
	// will trigger write slowdown.
	//
	// The default value is 1<<31 - 1.
	WriteL0SlowdownTrigger int `toml:"write-l0-slowdown-trigger" json:"write-l0-slowdown-trigger"`
	// WriteL0PauseTrigger defines number of leveldb sst file at level-0 that will
	// pause write.
	//
	// The default value is 1<<31 - 1.
	WriteL0PauseTrigger int `toml:"write-l0-pause-trigger" json:"write-l0-pause-trigger"`

	// CompactionL0Trigger defines number of leveldb sst file at level-0 that will
	// trigger compaction.
	//
	// The default value is 160.
	CompactionL0Trigger int `toml:"compaction-l0-trigger" json:"compaction-l0-trigger"`
	// CompactionDeletionThreshold defines the threshold of the number of deletion that
	// trigger compaction.
	//
	// The default value is 160000.
	// Iterator.First() takes about 27ms to 149ms in this case,
	// see pkg/db.BenchmarkNext.
	CompactionDeletionThreshold int `toml:"compaction-deletion-threshold" json:"compaction-deletion-threshold"`

	// IteratorMaxAliveDuration the maximum iterator alive duration in ms.
	//
	// The default value is 10000, 10s
	IteratorMaxAliveDuration int `toml:"iterator-max-alive-duration" json:"iterator-max-alive-duration"`

	// IteratorSlowReadDuration is the iterator slow read threshold.
	// A reading that exceeds the duration triggers a db compaction.
	//
	// The default value is 256, 256ms.
	IteratorSlowReadDuration int `toml:"iterator-slow-read-duration" json:"iterator-slow-read-duration"`

	// CleanupSpeedLimit limits clean up speed, based on key value entry count.
	//
	// The default value is 10000.
	CleanupSpeedLimit int `toml:"cleanup-speed-limit" json:"cleanup-speed-limit"`
}

DBConfig represents leveldb sorter config.

func (*DBConfig) ValidateAndAdjust

func (c *DBConfig) ValidateAndAdjust() error

ValidateAndAdjust validates and adjusts the db configuration

type DebugConfig

type DebugConfig struct {
	// identify if the keyspan actor is enabled for keyspan pipeline
	// TODO: turn on after GA.
	EnableKeySpanActor bool `toml:"enable-keyspan-actor" json:"enable-keyspan-actor"`

	// EnableDBSorter enables db sorter.
	//
	// The default value is false.
	// TODO: turn on after GA.
	EnableDBSorter bool      `toml:"enable-db-sorter" json:"enable-db-sorter"`
	DB             *DBConfig `toml:"db" json:"db"`
}

DebugConfig represents config for ticdc unexposed feature configurations

func (*DebugConfig) ValidateAndAdjust

func (c *DebugConfig) ValidateAndAdjust() error

ValidateAndAdjust validates and adjusts the debug configuration

type DispatchRule

type DispatchRule struct {
	Matcher    []string `toml:"matcher" json:"matcher"`
	Dispatcher string   `toml:"dispatcher" json:"dispatcher"`
}

DispatchRule represents partition rule for a table

type KVClientConfig

type KVClientConfig struct {
	// how many workers will be used for a single region worker
	WorkerConcurrent int `toml:"worker-concurrent" json:"worker-concurrent"`
	// background workerpool size, the workrpool is shared by all goroutines in cdc server
	WorkerPoolSize int `toml:"worker-pool-size" json:"worker-pool-size"`
	// region incremental scan limit for one table in a single store
	RegionScanLimit int `toml:"region-scan-limit" json:"region-scan-limit"`
	// the safe interval to move backward resolved ts
	ResolvedTsSafeInterval time.Duration `toml:"resolved-ts-safe-interval" json:"resolved-ts-safe-interval"`
}

KVClientConfig represents config for kv client

type LogConfig

type LogConfig struct {
	File              *LogFileConfig `toml:"file" json:"file"`
	InternalErrOutput string         `toml:"error-output" json:"error-output"`
}

LogConfig represents log config for server

type LogFileConfig

type LogFileConfig struct {
	MaxSize    int `toml:"max-size" json:"max-size"`
	MaxDays    int `toml:"max-days" json:"max-days"`
	MaxBackups int `toml:"max-backups" json:"max-backups"`
}

LogFileConfig represents log file config for server

type Protocol

type Protocol int

Protocol is the protocol of the mq message.

const (
	ProtocolDefault Protocol = iota
	ProtocolCanal
	ProtocolAvro
	ProtocolMaxwell
	ProtocolCanalJSON
	ProtocolCraft
	ProtocolOpen
)

Enum types of the Protocol.

func (*Protocol) FromString

func (p *Protocol) FromString(protocol string) error

FromString converts the protocol from string to Protocol enum type.

func (Protocol) String

func (p Protocol) String() string

String converts the Protocol enum type string to string.

type ReplicaConfig

type ReplicaConfig replicaConfig

ReplicaConfig represents some addition replication config for a changefeed

func GetDefaultReplicaConfig

func GetDefaultReplicaConfig() *ReplicaConfig

GetDefaultReplicaConfig returns the default replica config.

func (*ReplicaConfig) Clone

func (c *ReplicaConfig) Clone() *ReplicaConfig

Clone clones a replication

func (*ReplicaConfig) Marshal

func (c *ReplicaConfig) Marshal() (string, error)

Marshal returns the json marshal format of a ReplicationConfig

func (*ReplicaConfig) Unmarshal

func (c *ReplicaConfig) Unmarshal(data []byte) error

Unmarshal unmarshals into *ReplicationConfig from json marshal byte slice

func (*ReplicaConfig) UnmarshalJSON

func (c *ReplicaConfig) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals into *ReplicationConfig from json marshal byte slice

func (*ReplicaConfig) Validate

func (c *ReplicaConfig) Validate() error

Validate verifies that each parameter is valid.

type SchedulerConfig

type SchedulerConfig struct {
	Tp string `toml:"type" json:"type"`
	// PollingTime represents the polling cycle of checking the skewness of workload and try to do schedule if needed
	PollingTime int `toml:"polling-time" json:"polling-time"`
}

SchedulerConfig represents scheduler config for a changefeed

type SecurityConfig

type SecurityConfig = security.Credential

SecurityConfig represents security config for server

type ServerConfig

type ServerConfig struct {
	Addr          string `toml:"addr" json:"addr"`
	AdvertiseAddr string `toml:"advertise-addr" json:"advertise-addr"`

	LogFile  string     `toml:"log-file" json:"log-file"`
	LogLevel string     `toml:"log-level" json:"log-level"`
	Log      *LogConfig `toml:"log" json:"log"`

	DataDir string `toml:"data-dir" json:"data-dir"`

	GcTTL int64  `toml:"gc-ttl" json:"gc-ttl"`
	TZ    string `toml:"tz" json:"tz"`

	CaptureSessionTTL int `toml:"capture-session-ttl" json:"capture-session-ttl"`

	OwnerFlushInterval     TomlDuration `toml:"owner-flush-interval" json:"owner-flush-interval"`
	ProcessorFlushInterval TomlDuration `toml:"processor-flush-interval" json:"processor-flush-interval"`

	Sorter                   *SorterConfig   `toml:"sorter" json:"sorter"`
	Security                 *SecurityConfig `toml:"security" json:"security"`
	PerChangefeedMemoryQuota uint64          `toml:"per-changefeed-memory-quota" json:"per-changefeed-memory-quota"`
	KVClient                 *KVClientConfig `toml:"kv-client" json:"kv-client"`
	Debug                    *DebugConfig    `toml:"debug" json:"debug"`
}

ServerConfig represents a config for server

func GetDefaultServerConfig

func GetDefaultServerConfig() *ServerConfig

GetDefaultServerConfig returns the default server config

func GetGlobalServerConfig

func GetGlobalServerConfig() *ServerConfig

GetGlobalServerConfig returns the global configuration for this server. It should store configuration from command line and configuration file. Other parts of the system can read the global configuration use this function.

func (*ServerConfig) Clone

func (c *ServerConfig) Clone() *ServerConfig

Clone clones a replication

func (*ServerConfig) Marshal

func (c *ServerConfig) Marshal() (string, error)

Marshal returns the json marshal format of a ServerConfig

func (*ServerConfig) String

func (c *ServerConfig) String() string

String implements the Stringer interface

func (*ServerConfig) Unmarshal

func (c *ServerConfig) Unmarshal(data []byte) error

Unmarshal unmarshals into *ServerConfig from json marshal byte slice

func (*ServerConfig) ValidateAndAdjust

func (c *ServerConfig) ValidateAndAdjust() error

ValidateAndAdjust validates and adjusts the server configuration

type SinkConfig

type SinkConfig struct {
	DispatchRules   []*DispatchRule   `toml:"dispatchers" json:"dispatchers"`
	Protocol        string            `toml:"protocol" json:"protocol"`
	ColumnSelectors []*ColumnSelector `toml:"column-selectors" json:"column-selectors"`
}

SinkConfig represents sink config for a changefeed

type SorterConfig

type SorterConfig struct {
	// number of concurrent heap sorts
	NumConcurrentWorker int `toml:"num-concurrent-worker" json:"num-concurrent-worker"`
	// maximum size for a heap
	ChunkSizeLimit uint64 `toml:"chunk-size-limit" json:"chunk-size-limit"`
	// the maximum memory use percentage that allows in-memory sorting
	MaxMemoryPressure int `toml:"max-memory-percentage" json:"max-memory-percentage"`
	// the maximum memory consumption allowed for in-memory sorting
	MaxMemoryConsumption uint64 `toml:"max-memory-consumption" json:"max-memory-consumption"`
	// the size of workerpool
	NumWorkerPoolGoroutine int `toml:"num-workerpool-goroutine" json:"num-workerpool-goroutine"`
	// the directory used to store the temporary files generated by the sorter
	SortDir string `toml:"sort-dir" json:"sort-dir"`
}

SorterConfig represents sorter config for a changefeed

func (*SorterConfig) ValidateAndAdjust

func (c *SorterConfig) ValidateAndAdjust() error

ValidateAndAdjust validates and adjusts the sorter configuration

type TomlDuration

type TomlDuration time.Duration

TomlDuration is a duration with a custom json decoder and toml decoder

func (*TomlDuration) UnmarshalJSON

func (d *TomlDuration) UnmarshalJSON(b []byte) error

UnmarshalJSON is the json decoder

func (*TomlDuration) UnmarshalText

func (d *TomlDuration) UnmarshalText(text []byte) error

UnmarshalText is the toml decoder

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL