config

package
v1.1.0-beta.0...-68ac9ec Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const MB = 1024 * 1024

MB represents the MB size.

Variables

View Source
var DefaultConf = Config{
	Server: Server{
		PDAddr:      "127.0.0.1:2379",
		StoreAddr:   "127.0.0.1:9191",
		StatusAddr:  "127.0.0.1:9291",
		RegionSize:  64 * MB,
		LogLevel:    "info",
		MaxProcs:    0,
		Raft:        true,
		LogfilePath: "",
	},
	RaftStore: RaftStore{
		PdHeartbeatTickInterval:  "20s",
		RaftStoreMaxLeaderLease:  "9s",
		RaftBaseTickInterval:     "1s",
		RaftHeartbeatTicks:       2,
		RaftElectionTimeoutTicks: 10,
		CustomRaftLog:            true,
	},
	Engine: Engine{
		DBPath:             "/tmp/badger",
		ValueThreshold:     256,
		MaxMemTableSize:    64 * MB,
		MaxTableSize:       8 * MB,
		NumMemTables:       3,
		NumL0Tables:        4,
		NumL0TablesStall:   8,
		VlogFileSize:       256 * MB,
		NumCompactors:      3,
		SurfStartLevel:     8,
		L1Size:             512 * MB,
		Compression:        make([]string, 7),
		BlockCacheSize:     0,
		IndexCacheSize:     0,
		CompactL0WhenClose: true,
	},
	Coprocessor: Coprocessor{
		RegionMaxKeys:   1440000,
		RegionSplitKeys: 960000,
	},
	PessimisticTxn: PessimisticTxn{
		WaitForLockTimeout:  1000,
		WakeUpDelayDuration: 100,
	},
}

DefaultConf returns the default configuration.

Functions

func ParseCompression

func ParseCompression(s string) options.CompressionType

ParseCompression parses the string s and returns a compression type.

func ParseDuration

func ParseDuration(durationStr string) time.Duration

ParseDuration parses duration argument string.

Types

type Config

type Config struct {
	Server         Server         `toml:"server"`          // Unistore server options
	Engine         Engine         `toml:"engine"`          // Engine options.
	RaftStore      RaftStore      `toml:"raftstore"`       // RaftStore configs
	Coprocessor    Coprocessor    `toml:"coprocessor"`     // Coprocessor options
	PessimisticTxn PessimisticTxn `toml:"pessimistic-txn"` // Pessimistic txn related
}

Config contains configuration options.

type Coprocessor

type Coprocessor struct {
	RegionMaxKeys   int64 `toml:"region-max-keys"`
	RegionSplitKeys int64 `toml:"region-split-keys"`
}

Coprocessor is the config for coprocessor.

type Engine

type Engine struct {
	DBPath           string `toml:"db-path"`            // Directory to store the data in. Should exist and be writable.
	ValueThreshold   int    `toml:"value-threshold"`    // If value size >= this threshold, only store value offsets in tree.
	MaxMemTableSize  int64  `toml:"max-mem-table-size"` // Each mem table is at most this size.
	MaxTableSize     int64  `toml:"max-table-size"`     // Each table file is at most this size.
	L1Size           int64  `toml:"l1-size"`
	NumMemTables     int    `toml:"num-mem-tables"`      // Maximum number of tables to keep in memory, before stalling.
	NumL0Tables      int    `toml:"num-L0-tables"`       // Maximum number of Level 0 tables before we start compacting.
	NumL0TablesStall int    `toml:"num-L0-tables-stall"` // Maximum number of Level 0 tables before stalling.
	VlogFileSize     int64  `toml:"vlog-file-size"`      // Value log file size.

	// 	Sync all writes to disk. Setting this to true would slow down data loading significantly.")
	SyncWrite         bool     `toml:"sync-write"`
	NumCompactors     int      `toml:"num-compactors"`
	SurfStartLevel    int      `toml:"surf-start-level"`
	BlockCacheSize    int64    `toml:"block-cache-size"`
	IndexCacheSize    int64    `toml:"index-cache-size"`
	Compression       []string `toml:"compression"` // Compression types for each level
	IngestCompression string   `toml:"ingest-compression"`

	// Only used in tests.
	VolatileMode bool

	CompactL0WhenClose bool `toml:"compact-l0-when-close"`
}

Engine is the config for engine.

type PessimisticTxn

type PessimisticTxn struct {
	// The default and maximum delay in milliseconds before responding to TiDB when pessimistic
	// transactions encounter locks
	WaitForLockTimeout int64 `toml:"wait-for-lock-timeout"`

	// The duration between waking up lock waiter, in milliseconds
	WakeUpDelayDuration int64 `toml:"wake-up-delay-duration"`
}

PessimisticTxn is the config for pessimistic txn.

type RaftStore

type RaftStore struct {
	PdHeartbeatTickInterval  string `toml:"pd-heartbeat-tick-interval"`  // pd-heartbeat-tick-interval in seconds
	RaftStoreMaxLeaderLease  string `toml:"raft-store-max-leader-lease"` // raft-store-max-leader-lease in milliseconds
	RaftBaseTickInterval     string `toml:"raft-base-tick-interval"`     // raft-base-tick-interval in milliseconds
	RaftHeartbeatTicks       int    `toml:"raft-heartbeat-ticks"`        // raft-heartbeat-ticks times
	RaftElectionTimeoutTicks int    `toml:"raft-election-timeout-ticks"` // raft-election-timeout-ticks times
	CustomRaftLog            bool   `toml:"custom-raft-log"`
}

RaftStore is the config for raft store.

type Server

type Server struct {
	PDAddr      string `toml:"pd-addr"`
	StoreAddr   string `toml:"store-addr"`
	StatusAddr  string `toml:"status-addr"`
	LogLevel    string `toml:"log-level"`
	RegionSize  int64  `toml:"region-size"` // Average region size.
	MaxProcs    int    `toml:"max-procs"`   // Max CPU cores to use, set 0 to use all CPU cores in the machine.
	Raft        bool   `toml:"raft"`        // Enable raft.
	LogfilePath string `toml:"log-file"`    // Log file path for unistore server
}

Server is the config for server.

Jump to

Keyboard shortcuts

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