config

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HealthPollSeconds                     = 1
	ActiveNodeExpireSeconds               = 5
	MaintenanceOwner                      = "vtorc"
	AuditPageSize                         = 20
	MaintenancePurgeDays                  = 7
	MaintenanceExpireMinutes              = 10
	DebugMetricsIntervalSeconds           = 10
	StaleInstanceCoordinatesExpireSeconds = 60
	DiscoveryMaxConcurrency               = 300 // Number of goroutines doing hosts discovery
	DiscoveryQueueCapacity                = 100000
	DiscoveryQueueMaxStatisticsSize       = 120
	DiscoveryCollectionRetentionSeconds   = 120
	HostnameResolveMethod                 = "default"
	UnseenInstanceForgetHours             = 240 // Number of hours after which an unseen instance is forgotten
	ExpiryHostnameResolvesMinutes         = 60  // Number of minutes after which to expire hostname-resolves
	CandidateInstanceExpireMinutes        = 60  // Minutes after which a suggestion to use an instance as a candidate replica (to be preferably promoted on primary failover) is expired.
	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 preceeds 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 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 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.
	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 parameteres 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