config

package
v0.0.0-debug-20260702 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const CUCpuPriceDefault = 3.45e-14
View Source
const CUIOInPriceDefault = 5.67e-06
View Source
const CUIOOutPriceDefault = 6.78e-06
View Source
const CUMemPriceDefault = 4.56e-24
View Source
const CUTrafficPrice0Default = 7.89e-10
View Source
const CUTrafficPrice1Default = 7.89e-10
View Source
const CUTrafficPrice2Default = 7.89e-10
View Source
const CUUnitDefault = 1.002678e-06

Variables

View Source
var (

	// largestEntryLimit is the max size for reading file to csv buf
	LargestEntryLimit = 10 * 1024 * 1024

	CNPrimaryCheck atomic.Bool
)

Functions

This section is empty.

Types

type ConfigurationKeyType added in v0.6.0

type ConfigurationKeyType int
const (
	ParameterUnitKey ConfigurationKeyType = 1
)

type FrontendParameters added in v0.6.0

type FrontendParameters struct {
	MoVersion string

	//port defines which port the mo-server listens on and clients connect to
	Port int64 `toml:"port" user_setting:"basic"`

	//listening ip
	Host string `toml:"host" user_setting:"basic"`

	// UnixSocketAddress listening unix domain socket
	UnixSocketAddress string `toml:"unix-socket" user_setting:"advanced"`

	//guest mmu limitation. default: 1 << 40 = 1099511627776
	GuestMmuLimitation int64 `toml:"guestMmuLimitation"`

	//mempool maxsize. default: 1 << 40 = 1099511627776
	MempoolMaxSize int64 `toml:"mempoolMaxSize"`

	//mempool factor. default: 8
	MempoolFactor int64 `toml:"mempoolFactor"`

	//process.Limitation.Size. default: 10 << 32 = 42949672960
	ProcessLimitationSize int64 `toml:"processLimitationSize"`

	//process.Limitation.BatchRows. default: 10 << 32 = 42949672960
	ProcessLimitationBatchRows int64 `toml:"processLimitationBatchRows"`

	//process.Limitation.BatchSize. default: 0
	ProcessLimitationBatchSize int64 `toml:"processLimitationBatchSize"`

	//process.Limitation.PartitionRows. default: 10 << 32 = 42949672960
	ProcessLimitationPartitionRows int64 `toml:"processLimitationPartitionRows"`

	//the root directory of the storage and matrixcube's data. The actual dir is cubeDirPrefix + nodeID
	ServerVersionPrefix string `toml:"serverVersionPrefix"`

	VersionComment string `toml:"versionComment"`

	//the length of query printed into console. -1, complete string. 0, empty string. >0 , length of characters at the header of the string.
	LengthOfQueryPrinted int64 `toml:"lengthOfQueryPrinted" user_setting:"advanced"`

	//the count of rows in vector of batch in load data
	BatchSizeInLoadData int64 `toml:"batchSizeInLoadData"`

	//default is 4. The count of go routine writing batch into the storage.
	LoadDataConcurrencyCount int64 `toml:"loadDataConcurrencyCount"`

	//default is false. Skip writing batch into the storage
	LoadDataSkipWritingBatch bool `toml:"loadDataSkipWritingBatch"`

	//KB. When the number of bytes in the outbuffer exceeds it,the outbuffer will be flushed.
	MaxBytesInOutbufToFlush int64 `toml:"maxBytesInOutbufToFlush"`

	//default printLog Interval is 10s.
	PrintLogInterVal int64 `toml:"printLogInterVal"`

	//export data to csv file default flush size
	ExportDataDefaultFlushSize int64 `toml:"exportDataDefaultFlushSize"`

	//port defines which port the rpc server listens on
	PortOfRpcServerInComputationEngine int64 `toml:"portOfRpcServerInComputationEngine"`

	//default is false. With true. Server will support tls
	EnableTls bool `toml:"enableTls" user_setting:"advanced"`

	//default is ”. Path of file that contains list of trusted SSL CAs for client
	TlsCaFile string `toml:"tlsCaFile" user_setting:"advanced"`

	//default is ”. Path of file that contains X509 certificate in PEM format for client
	TlsCertFile string `toml:"tlsCertFile" user_setting:"advanced"`

	//default is ”. Path of file that contains X509 key in PEM format for client
	TlsKeyFile string `toml:"tlsKeyFile" user_setting:"advanced"`

	//default is 1
	LogShardID uint64 `toml:"logshardid"`

	//default is 1
	TNReplicaID uint64 `toml:"tnreplicalid"`

	EnableDoComQueryInProgress bool `toml:"comQueryInProgress"`

	//timeout of the session. the default is 10minutes
	SessionTimeout toml.Duration `toml:"sessionTimeout"`

	// NetReadTimeout is the timeout for reading from the network connection. Default is 0 (no timeout).
	NetReadTimeout toml.Duration `toml:"netReadTimeout"`

	// NetWriteTimeout is the timeout for writing to the network connection. Default is 60 seconds.
	NetWriteTimeout toml.Duration `toml:"netWriteTimeout"`

	// WaitTimeoutMin is the hard minimum for wait_timeout (seconds).
	WaitTimeoutMin int64 `toml:"waitTimeoutMin"`
	// WaitTimeoutMax is the hard maximum for wait_timeout (seconds).
	WaitTimeoutMax int64 `toml:"waitTimeoutMax"`
	// InteractiveTimeoutMin is the hard minimum for interactive_timeout (seconds).
	InteractiveTimeoutMin int64 `toml:"interactiveTimeoutMin"`
	// InteractiveTimeoutMax is the hard maximum for interactive_timeout (seconds).
	InteractiveTimeoutMax int64 `toml:"interactiveTimeoutMax"`

	// LoadLocalReadTimeout is the timeout for reading data from client during LOAD DATA LOCAL operations.
	// Used to detect F5/LoadBalancer idle timeout disconnections. Default is 60 seconds.
	LoadLocalReadTimeout toml.Duration `toml:"loadLocalReadTimeout"`

	// LoadLocalWriteTimeout is the timeout for writing data to client during LOAD DATA LOCAL operations.
	// Default is 60 seconds.
	LoadLocalWriteTimeout toml.Duration `toml:"loadLocalWriteTimeout"`

	// MaxMessageSize max size for read messages from dn. Default is 10M
	MaxMessageSize uint64 `toml:"max-message-size"`

	// default off
	SaveQueryResult string `toml:"saveQueryResult" user_setting:"advanced"`

	// default 24 (h)
	QueryResultTimeout uint64 `toml:"queryResultTimeout" user_setting:"advanced"`

	// default 100 (MB)
	QueryResultMaxsize uint64 `toml:"queryResultMaxsize" user_setting:"advanced"`

	AutoIncrCacheSize uint64 `toml:"autoIncrCacheSize"`

	PrintDebug bool `toml:"printDebug"`

	PrintDebugInterval int `toml:"printDebugInterval"`

	// Interval in seconds
	KillRountinesInterval int `toml:"killRountinesInterval"`

	CleanKillQueueInterval int `toml:"cleanKillQueueInterval"`

	// ProxyEnabled indicates that proxy module is enabled and something extra
	// is needed, such as update the salt.
	ProxyEnabled bool `toml:"proxy-enabled"`

	// SkipCheckPrivilege denotes the privilege check should be passed.
	SkipCheckPrivilege bool `toml:"skipCheckPrivilege"`

	// skip checking the password of the user
	SkipCheckUser bool `toml:"skipCheckUser"`

	// disable select into
	DisableSelectInto bool `toml:"disable-select-into"`

	// PubAllAccounts shows the accounts which can publish data to all accounts
	// consists of account names are separated by comma
	PubAllAccounts string `toml:"pub-all-accounts"`

	// KeyEncryptionKey is the key for encrypt key
	KeyEncryptionKey string `toml:"key-encryption-key"`

	// timeout of create txn.
	// txnclient.New
	// txnclient.RestartTxn
	// engine.New
	CreateTxnOpTimeout toml.Duration `toml:"createTxnOpTimeout" user_setting:"advanced"`

	// timeout of authenticating user. different from session timeout
	// including mysql protocol handshake, checking user, loading session variables
	ConnectTimeout toml.Duration `toml:"connectTimeout" user_setting:"advanced"`

	// SidecarURL is the DuckDB sidecar HTTP endpoint for offloading queries
	// via /*+ SIDECAR */ or /*+ SIDECAR GPU */ hints.
	// When set, this becomes the default for the sidecar_url session variable.
	// Can be overridden per-session with SET sidecar_url = '...' or
	// globally for new sessions with SET GLOBAL sidecar_url = '...'.
	SidecarURL string `toml:"sidecarUrl" user_setting:"advanced"`
}

FrontendParameters of the frontend

func (*FrontendParameters) GetUnixSocketAddress added in v0.7.0

func (fp *FrontendParameters) GetUnixSocketAddress() string

func (*FrontendParameters) SetDefaultValues added in v0.6.0

func (fp *FrontendParameters) SetDefaultValues()

func (*FrontendParameters) SetLogAndVersion added in v0.6.0

func (fp *FrontendParameters) SetLogAndVersion(log *logutil.LogConfig, version string)

func (*FrontendParameters) SetMaxMessageSize added in v0.6.0

func (fp *FrontendParameters) SetMaxMessageSize(size uint64)

type OBCUConfig added in v1.1.2

type OBCUConfig struct {
	// cu unit
	CUUnit float64 `toml:"cu_unit"`
	// price
	CpuPrice   float64 `toml:"cpu_price"`
	MemPrice   float64 `toml:"mem_price"`
	IoInPrice  float64 `toml:"io_in_price"`
	IoOutPrice float64 `toml:"io_out_price"`
	// IoListPrice default value: IoInPrice
	// NOT allow 0 value.
	IoListPrice float64 `toml:"io_list_price"`
	// IoDeletePrice default value: IoInPrice, cc SetDefaultValues
	// The only one ALLOW 0 value.
	IoDeletePrice float64 `toml:"io_delete_price"`
	TrafficPrice0 float64 `toml:"traffic_price_0"`
	TrafficPrice1 float64 `toml:"traffic_price_1"`
	TrafficPrice2 float64 `toml:"traffic_price_2"`
}

func NewOBCUConfig added in v1.1.2

func NewOBCUConfig() *OBCUConfig

func (*OBCUConfig) SetDefaultValues added in v1.1.2

func (c *OBCUConfig) SetDefaultValues()

type OBCollectorConfig added in v0.8.0

type OBCollectorConfig struct {
	ShowStatsInterval toml.Duration `toml:"showStatsInterval"`
	// BufferCnt
	BufferCnt  int32 `toml:"bufferCnt"`
	BufferSize int64 `toml:"bufferSize"`

	CollectorCntPercent int `toml:"collector_cnt_percent"`
	GeneratorCntPercent int `toml:"generator_cnt_percent"`
	ExporterCntPercent  int `toml:"exporter_cnt_percent"`
}

func NewOBCollectorConfig added in v1.0.0

func NewOBCollectorConfig() *OBCollectorConfig

func (*OBCollectorConfig) SetDefaultValues added in v0.8.0

func (c *OBCollectorConfig) SetDefaultValues()

type ObservabilityOldParameters

type ObservabilityOldParameters struct {
	StatusPortV12         int  `toml:"statusPort" user_setting:"advanced"`
	EnableMetricToPromV12 bool `toml:"enableMetricToProm"`

	// part metric
	MetricUpdateStorageUsageIntervalV12 toml.Duration `toml:"metricUpdateStorageUsageInterval"` /* tips: rename */

	// part Trace
	DisableMetricV12 bool `toml:"disableMetric" user_setting:"advanced"`
	DisableTraceV12  bool `toml:"disableTrace"`
	DisableErrorV12  bool `toml:"disableError"`
	DisableSpanV12   bool `toml:"disableSpan"`

	// part statement_info
	EnableStmtMergeV12        bool          `toml:"enableStmtMerge"`
	DisableStmtAggregationV12 bool          `toml:"disableStmtAggregation"`
	AggregationWindowV12      toml.Duration `toml:"aggregationWindow"`
	SelectAggThresholdV12     toml.Duration `toml:"selectAggrThreshold"`
	LongQueryTimeV12          float64       `toml:"longQueryTime" user_setting:"advanced"`
	SkipRunningStmtV12        bool          `toml:"skipRunningStmt"`

	// part labelSelector
	LabelSelectorV12 map[string]string `toml:"labelSelector"`
}

ObservabilityOldParameters will remove after 1.3.0 all item default false, 0, nil

type ObservabilityParameters added in v0.6.0

type ObservabilityParameters struct {
	// MoVersion, see SetDefaultValues
	MoVersion string

	// Host listening ip. normally same as FrontendParameters.Host
	Host string `toml:"host" user_setting:"advanced"`

	// StatusPort defines which port the mo status server (for metric etc.) listens on and clients connect to
	// Start listen with EnableMetricToProm is true.
	StatusPort int `toml:"status-port" user_setting:"advanced"`

	// EnableMetricToProm default is false. if true, metrics can be scraped through host:status/metrics endpoint
	EnableMetricToProm bool `toml:"enable-metric-to-prom" user_setting:"advanced"`

	// DisableMetric default is false. if false, enable metric at booting
	DisableMetric bool `toml:"disable-metric" user_setting:"advanced"`

	// DisableTrace default is false. if false, enable trace at booting
	DisableTrace bool `toml:"disable-trace" user_setting:"advanced"`

	// EnableTraceDebug default is false. With true, system will check all the children span is ended, which belong to the closing span.
	EnableTraceDebug bool `toml:"enable-trace-debug"`

	// TraceExportInterval default is 15s.
	TraceExportInterval int `toml:"trace-export-interval"`

	// LongQueryTime default is 0.0 sec. if 0.0f, record every query. Record with exec time longer than LongQueryTime.
	LongQueryTime float64 `toml:"long-query-time" user_setting:"advanced"`

	// MetricExportInterval default is 15 sec.
	MetricExportInterval int `toml:"metric-export-interval"`

	// MetricGatherInterval default is 15 sec.
	MetricGatherInterval int `toml:"metric-gather-interval"`

	// MetricInternalGatherInterval default is 1 min, handle metric.SubSystemMO metric
	MetricInternalGatherInterval toml.Duration `toml:"metric-internal-gather-interval"`

	// MetricStorageUsageUpdateInterval, default: 15 min
	// old version ObservabilityOldParameters.MetricUpdateStorageUsageIntervalV12
	// tips: diff name
	MetricStorageUsageUpdateInterval toml.Duration `toml:"metric-storage-usage-update-interval"`

	// MetricStorageUsageCheckNewInterval, default: 1 min
	MetricStorageUsageCheckNewInterval toml.Duration `toml:"metric-storage-usage-check-new-interval"`

	// MergeCycle default: 300 sec (5 minutes).
	// PS: only used while MO init.
	MergeCycle toml.Duration `toml:"merge-cycle"`

	// DisableSpan default: false. Disable span collection
	DisableSpan bool `toml:"disable-span"`

	// EnableSpanProfile default: false. Do NO profile by default.
	EnableSpanProfile bool `toml:"enable-span-profile"`

	// DisableError default: false. Disable error collection
	DisableError bool `toml:"disable-error"`

	// LongSpanTime default: 500 ms. Only record span, which duration >= LongSpanTime
	LongSpanTime toml.Duration `toml:"long-span-time"`

	// SkipRunningStmt default: false. Skip status:Running entry while collect statement_info
	SkipRunningStmt bool `toml:"skip-running-stmt"`

	// If disabled, the logs will be written to files stored in s3
	DisableSqlWriter bool `toml:"disable-sql-writer"`

	// DisableStmtAggregation ctrl statement aggregation. If disabled, the statements will not be aggregated.
	// If false, LongQueryTime is NO less than SelectAggThreshold
	DisableStmtAggregation bool `toml:"disable-stmt-aggregation"`

	// Seconds to aggregate the statements
	AggregationWindow toml.Duration `toml:"aggregation-window"`

	// SelectAggThreshold Duration to filter statements for aggregation
	SelectAggThreshold toml.Duration `toml:"select-agg-threshold"`

	// Disable merge statements
	EnableStmtMerge bool `toml:"enable-stmt-merge"`

	// LabelSelector
	LabelSelector map[string]string `toml:"label-selector"`

	// TaskLabel
	TaskLabel      map[string]string `toml:"task-label"`
	ResetTaskLabel bool              `toml:"reset-task-label"`

	// estimate tcp network packet cost
	TCPPacket bool `toml:"tcp-packet"`

	// MaxLogMessageSize truncate the reset. default: 16 KiB
	MaxLogMessageSize toml.ByteSize `toml:"max-log-message-size"`

	// for cu calculation
	CU   OBCUConfig `toml:"cu"`
	CUv1 OBCUConfig `toml:"cu_v1"`

	OBCollectorConfig

	ObservabilityOldParameters
}

ObservabilityParameters hold metric/trace switch

func NewObservabilityParameters added in v1.0.0

func NewObservabilityParameters() *ObservabilityParameters

func (*ObservabilityParameters) SetDefaultValues added in v0.6.0

func (op *ObservabilityParameters) SetDefaultValues(version string)

type ParameterUnit

type ParameterUnit struct {
	sync.RWMutex

	SV *FrontendParameters

	//Storage Engine
	StorageEngine engine.Engine

	//TxnClient
	TxnClient client.TxnClient

	//Cluster Nodes
	ClusterNodes engine.Nodes

	// FileService
	FileService fileservice.FileService

	// LockService instance
	LockService lockservice.LockService

	// QueryClient instance
	QueryClient qclient.QueryClient

	UdfService udf.Service

	// HAKeeper client, which is used to get connection ID
	// from HAKeeper currently.
	HAKeeperClient logservice.CNHAKeeperClient

	TaskService taskservice.TaskService

	CNMemoryThrottler rscthrottler.RSCThrottler
}

func GetParameterUnit added in v0.6.0

func GetParameterUnit(ctx context.Context) *ParameterUnit

GetParameterUnit gets the configuration from the context.

func NewParameterUnit

func NewParameterUnit(
	sv *FrontendParameters,
	storageEngine engine.Engine,
	txnClient client.TxnClient,
	clusterNodes engine.Nodes,
) *ParameterUnit

func (*ParameterUnit) GetTaskService

func (p *ParameterUnit) GetTaskService() taskservice.TaskService

func (*ParameterUnit) SetTaskService

func (p *ParameterUnit) SetTaskService(taskService taskservice.TaskService)

Jump to

Keyboard shortcuts

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