throttler

package
v0.17.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultQuery     = "select unix_timestamp(now(6))-max(ts/1000000000) as replication_lag from _vt.heartbeat"
	DefaultThreshold = 1 * time.Second
	ConfigTimeout    = 60 * time.Second
)

Variables

View Source
var DefaultConfig = &Config{
	Query:     DefaultQuery,
	Threshold: DefaultThreshold.Seconds(),
}

Functions

func EnableLagThrottlerAndWaitForStatus added in v0.17.0

func EnableLagThrottlerAndWaitForStatus(t *testing.T, clusterInstance *cluster.LocalProcessCluster, lag time.Duration)

EnableLagThrottlerAndWaitForStatus is a utility function to enable the throttler at the beginning of an endtoend test. The throttler is configued to use the standard replication lag metric. The function waits until the throttler is confirmed to be running on all tablets.

func UpdateThrottlerTopoConfig

func UpdateThrottlerTopoConfig(clusterInstance *cluster.LocalProcessCluster, enable bool, disable bool, threshold float64, metricsQuery string) (string, error)

UpdateThrottlerTopoConfig runs vtctlclient UpdateThrottlerConfig. This retries the command until it succeeds or times out as the SrvKeyspace record may not yet exist for a newly created Keyspace that is still initializing before it becomes serving.

func UpdateThrottlerTopoConfigRaw added in v0.17.0

func UpdateThrottlerTopoConfigRaw(vtctldProcess *cluster.VtctldClientProcess, keyspaceName string, enable bool, disable bool, threshold float64, metricsQuery string) (result string, err error)

UpdateThrottlerTopoConfig runs vtctlclient UpdateThrottlerConfig. This retries the command until it succeeds or times out as the SrvKeyspace record may not yet exist for a newly created Keyspace that is still initializing before it becomes serving.

func WaitForThrottlerStatusEnabled

func WaitForThrottlerStatusEnabled(t *testing.T, tablet *cluster.Vttablet, enabled bool, config *Config, timeout time.Duration)

WaitForThrottlerStatusEnabled waits for a tablet to report its throttler status as enabled/disabled and have the provided config (if any) until the specified timeout.

func WaitForValidData

func WaitForValidData(t *testing.T, tablet *cluster.Vttablet, timeout time.Duration)

WaitForValidData waits for a tablet's checks to return a non 500 http response which indicates that it's not able to provide valid results. This is most commonly caused by the throttler still gathering the initial results for the given configuration.

Types

type Config

type Config struct {
	Query     string
	Threshold float64
}

Jump to

Keyboard shortcuts

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