config

package
v0.19.8 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	HealthPollSeconds                     = 1
	ActiveNodeExpireSeconds               = 5
	AuditPageSize                         = 20
	DebugMetricsIntervalSeconds           = 10
	StaleInstanceCoordinatesExpireSeconds = 60
	DiscoveryMaxConcurrency               = 300 // Number of goroutines doing hosts discovery
	DiscoveryQueueCapacity                = 100000
	DiscoveryQueueMaxStatisticsSize       = 120
	DiscoveryCollectionRetentionSeconds   = 120
	UnseenInstanceForgetHours             = 240 // Number of hours after which an unseen instance is forgotten
	FailureDetectionPeriodBlockMinutes    = 60  // The time for which an instance's failure discovery is kept "active", so as to avoid concurrent "discoveries" of the instance's failure; this precedes any recovery process, if any.
)
View Source
const (
	LostInRecoveryDowntimeSeconds int = 60 * 60 * 24 * 365
)

Variables

View Source
var Config = newConfiguration()

Config is *the* configuration instance, used globally to get configuration data

Functions

func ConvertTabletWithErrantGTIDs added in v0.18.0

func ConvertTabletWithErrantGTIDs() bool

ConvertTabletWithErrantGTIDs reports whether VTOrc is allowed to change the tablet type of tablets with errant GTIDs to DRAINED.

func ERSEnabled added in v0.18.0

func ERSEnabled() bool

ERSEnabled reports whether VTOrc is allowed to run ERS or not.

func LogConfigValues

func LogConfigValues()

LogConfigValues is used to log the config values.

func MarkConfigurationLoaded

func MarkConfigurationLoaded()

MarkConfigurationLoaded is called once configuration has first been loaded. Listeners on ConfigurationLoaded will get a notification

func RegisterFlags

func RegisterFlags(fs *pflag.FlagSet)

RegisterFlags registers the flags required by VTOrc

func SetConvertTabletWithErrantGTIDs added in v0.18.0

func SetConvertTabletWithErrantGTIDs(val bool)

SetConvertTabletWithErrantGTIDs sets the value for the convertTabletWithErrantGTIDs variable. This should only be used from tests.

func SetERSEnabled added in v0.18.0

func SetERSEnabled(val bool)

SetERSEnabled sets the value for the ersEnabled variable. This should only be used from tests.

func UpdateConfigValuesFromFlags

func UpdateConfigValuesFromFlags()

UpdateConfigValuesFromFlags is used to update the config values from the flags defined. This is done before we read any configuration files from the user. So the config files take precedence.

func WaitForConfigurationToBeLoaded

func WaitForConfigurationToBeLoaded()

WaitForConfigurationToBeLoaded does just that. It will return after the configuration file has been read off disk.

Types

type Configuration

type Configuration struct {
	SQLite3DataFile                       string // full path to sqlite3 datafile
	InstancePollSeconds                   uint   // Number of seconds between instance reads
	SnapshotTopologiesIntervalHours       uint   // Interval in hour between snapshot-topologies invocation. Default: 0 (disabled)
	ReasonableReplicationLagSeconds       int    // Above this value is considered a problem
	AuditLogFile                          string // Name of log file for audit operations. Disabled when empty.
	AuditToSyslog                         bool   // If true, audit messages are written to syslog
	AuditToBackendDB                      bool   // If true, audit messages are written to the backend DB's `audit` table (default: true)
	AuditPurgeDays                        uint   // Days after which audit entries are purged from the database
	RecoveryPeriodBlockSeconds            int    // (overrides `RecoveryPeriodBlockMinutes`) The time for which an instance's recovery is kept "active", so as to avoid concurrent recoveries on smae instance as well as flapping
	PreventCrossDataCenterPrimaryFailover bool   // When true (default: false), cross-DC primary failover are not allowed, vtorc will do all it can to only fail over within same DC, or else not fail over at all.
	WaitReplicasTimeoutSeconds            int    // Timeout on amount of time to wait for the replicas in case of ERS. Should be a small value because we should fail-fast. Should not be larger than LockTimeout since that is the total time we use for an ERS.
	TolerableReplicationLagSeconds        int    // Amount of replication lag that is considered acceptable for a tablet to be eligible for promotion when Vitess makes the choice of a new primary in PRS.
	TopoInformationRefreshSeconds         int    // Timer duration on which VTOrc refreshes the keyspace and vttablet records from the topo-server.
	RecoveryPollSeconds                   int    // Timer duration on which VTOrc recovery analysis runs
}

Configuration makes for vtorc configuration input, which can be provided by user via JSON formatted file. Some of the parameters have reasonable default values, and some (like database credentials) are strictly expected from user. TODO(sougou): change this to yaml parsing, and possible merge with tabletenv.

func ForceRead

func ForceRead(fileName string) *Configuration

ForceRead reads configuration from given file name or bails out if it fails

func Read

func Read(fileNames ...string) *Configuration

Read reads configuration from zero, either, some or all given files, in order of input. A file can override configuration provided in previous file.

func Reload

func Reload(extraFileNames ...string) *Configuration

Reload re-reads configuration from last used files

func (*Configuration) ToJSONString

func (config *Configuration) ToJSONString() string

ToJSONString will marshal this configuration as JSON

Jump to

Keyboard shortcuts

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