config

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2021 License: Apache-2.0 Imports: 5 Imported by: 42

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Batch

type Batch struct {
	// MaxBatchSize is the max batch size when calling batch commands API. Set 0 to
	// turn off message batch.
	MaxBatchSize uint

	// OverloadThreshold is a threshold of TiKV load. If TiKV load is greater than
	// this, TiDB will wait for a while to avoid little batch.
	OverloadThreshold uint

	// MaxWaitSize is the max wait size for batch.
	MaxWaitSize uint

	// MaxWaitTime  is the max wait time for batch.
	MaxWaitTime time.Duration
}

Batch contains configurations for message batch.

func DefaultBatch

func DefaultBatch() Batch

DefaultBatch returns the default Batch config.

type Config

type Config struct {
	RPC         RPC
	Raw         Raw
	Txn         Txn
	RegionCache RegionCache
}

Config contains configurations for tikv client.

func Default

func Default() Config

Default returns the default config.

type Latch

type Latch struct {
	// Enable it when there are lots of conflicts between transactions.
	Enable         bool
	Capacity       uint
	ExpireDuration time.Duration
	CheckInterval  time.Duration
	CheckCounter   int
	ListCount      int
	LockChanSize   int
}

Latch is the configuration for local latch.

func DefaultLatch

func DefaultLatch() Latch

DefaultLatch returns the default Latch config.

type RPC

type RPC struct {
	// MaxConnectionCount is the max gRPC connections that will be established with
	// each tikv-server.
	MaxConnectionCount uint

	// GrpcKeepAliveTime is the duration of time after which if the client doesn't see
	// any activity it pings the server to see if the transport is still alive.
	GrpcKeepAliveTime time.Duration

	// GrpcKeepAliveTimeout is the duration of time for which the client waits after having
	// pinged for keepalive check and if no activity is seen even after that the connection
	// is closed.
	GrpcKeepAliveTimeout time.Duration

	// GrpcMaxSendMsgSize set max gRPC request message size sent to server. If any request message size is larger than
	// current value, an error will be reported from gRPC.
	GrpcMaxSendMsgSize int

	// GrpcMaxCallMsgSize set max gRPC receive message size received from server. If any message size is larger than
	// current value, an error will be reported from gRPC.
	GrpcMaxCallMsgSize int

	// The value for initial window size on a gRPC stream.
	GrpcInitialWindowSize int

	// The value for initial windows size on a gRPC connection.
	GrpcInitialConnWindowSize int32

	// The max time to establish a gRPC connection.
	DialTimeout time.Duration

	// For requests that read/write several key-values.
	ReadTimeoutShort time.Duration

	// For requests that may need scan region.
	ReadTimeoutMedium time.Duration

	// For requests that may need scan region multiple times.
	ReadTimeoutLong time.Duration

	// The flag to enable open tracing.
	EnableOpenTracing bool

	// Batch system configurations.
	Batch Batch

	Security Security
}

RPC configurations.

func DefaultRPC

func DefaultRPC() RPC

DefaultRPC returns the default RPC config.

type Raw

type Raw struct {
	// MaxScanLimit is the maximum scan limit for rawkv Scan.
	MaxScanLimit int

	// MaxBatchPutSize is the maximum size limit for rawkv each batch put request.
	MaxBatchPutSize int

	// BatchPairCount is the maximum limit for rawkv each batch get/delete request.
	BatchPairCount int
}

Raw is rawkv configurations.

func DefaultRaw

func DefaultRaw() Raw

DefaultRaw returns default rawkv configuration.

type RegionCache

type RegionCache struct {
	BTreeDegree int
	CacheTTL    time.Duration
}

RegionCache contains the configurations for region cache.

func DefaultRegionCache

func DefaultRegionCache() RegionCache

DefaultRegionCache returns the default region cache config.

type Security

type Security struct {
	SSLCA   string `toml:"ssl-ca" json:"ssl-ca"`
	SSLCert string `toml:"ssl-cert" json:"ssl-cert"`
	SSLKey  string `toml:"ssl-key" json:"ssl-key"`
}

Security is SSL configuration.

func DefaultSecurity

func DefaultSecurity() Security

DefaultSecurity returns the default Security config.

func (*Security) ToTLSConfig

func (s *Security) ToTLSConfig() (*tls.Config, error)

ToTLSConfig generates tls's config based on security section of the config.

type Txn

type Txn struct {
	// EntrySizeLimit is limit of single entry size (len(key) + len(value)).
	EntrySizeLimit int

	// EntryCountLimit is a limit of the number of entries in the MemBuffer.
	EntryCountLimit int

	// TotalSizeLimit is limit of the sum of all entry size.
	TotalSizeLimit int

	// MaxTimeUse is the max time a transaction can run.
	MaxTimeUse int

	// DefaultMembufCap is the default transaction membuf capability.
	DefaultMembufCap int

	// TiKV recommends each RPC packet should be less than ~1MB. We keep each
	// packet's Key+Value size below 16KB by default.
	CommitBatchSize int

	// ScanBatchSize is the limit of an iterator's scan request.
	ScanBatchSize int

	// BatchGetSize is the max number of keys in a BatchGet request.
	BatchGetSize int

	// By default, locks after 3000ms is considered unusual (the client created the
	// lock might be dead). Other client may cleanup this kind of lock.
	// For locks created recently, we will do backoff and retry.
	DefaultLockTTL uint64

	// The maximum value of a txn's lock TTL.
	MaxLockTTL uint64

	// ttl = ttlFactor * sqrt(writeSizeInMiB)
	TTLFactor int

	// ResolveCacheSize is max number of cached txn status.
	ResolveCacheSize int

	GcSavedSafePoint               string
	GcSafePointCacheInterval       time.Duration
	GcCPUTimeInaccuracyBound       time.Duration
	GcSafePointUpdateInterval      time.Duration
	GcSafePointQuickRepeatInterval time.Duration

	GCTimeout                 time.Duration
	UnsafeDestroyRangeTimeout time.Duration

	TsoSlowThreshold     time.Duration
	OracleUpdateInterval time.Duration

	Latch Latch
}

Txn contains the configurations for transactional kv.

func DefaultTxn

func DefaultTxn() Txn

DefaultTxn returns the default txn config.

Jump to

Keyboard shortcuts

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