Documentation ¶
Index ¶
- Constants
- Variables
- func CheckThrottler(clusterInstance *cluster.LocalProcessCluster, tablet *cluster.Vttablet, ...) (*vtctldatapb.CheckThrottlerResponse, error)
- func CheckThrottlerRaw(vtctldProcess *cluster.VtctldClientProcess, tablet *cluster.Vttablet, ...) (result string, err error)
- func EnableLagThrottlerAndWaitForStatus(t *testing.T, clusterInstance *cluster.LocalProcessCluster)
- func GetThrottlerStatus(vtctldProcess *cluster.VtctldClientProcess, tablet *cluster.Vttablet) (*tabletmanagerdatapb.GetThrottlerStatusResponse, error)
- func GetThrottlerStatusRaw(vtctldProcess *cluster.VtctldClientProcess, tablet *cluster.Vttablet) (result string, err error)
- func ThrottleApp(clusterInstance *cluster.LocalProcessCluster, throttlerApp throttlerapp.Name) (string, error)
- func ThrottleAppAndWaitUntilTabletsConfirm(t *testing.T, clusterInstance *cluster.LocalProcessCluster, ...) (string, error)
- func UnthrottleApp(clusterInstance *cluster.LocalProcessCluster, throttlerApp throttlerapp.Name) (string, error)
- func UnthrottleAppAndWaitUntilTabletsConfirm(t *testing.T, clusterInstance *cluster.LocalProcessCluster, ...) (string, error)
- func UpdateThrottlerTopoConfig(clusterInstance *cluster.LocalProcessCluster, ...) (string, error)
- func UpdateThrottlerTopoConfigRaw(vtctldProcess *cluster.VtctldClientProcess, keyspaceName string, ...) (result string, err error)
- func WaitForCheckThrottlerResult(t *testing.T, clusterInstance *cluster.LocalProcessCluster, ...) (*vtctldatapb.CheckThrottlerResponse, error)
- func WaitForSrvKeyspace(clusterInstance *cluster.LocalProcessCluster, cell, keyspace string) error
- func WaitForThrottledApp(t *testing.T, tablet *cluster.Vttablet, throttlerApp throttlerapp.Name, ...)
- func WaitForThrottlerStatusEnabled(t *testing.T, vtctldProcess *cluster.VtctldClientProcess, ...)
- func WaitForValidData(t *testing.T, tablet *cluster.Vttablet, timeout time.Duration)
- func WaitUntilTabletsConfirmThrottledApp(t *testing.T, clusterInstance *cluster.LocalProcessCluster, ...)
- type Config
Constants ¶
const ( DefaultQuery = "select unix_timestamp(now(6))-max(ts/1000000000) as replication_lag from _vt.heartbeat" DefaultThreshold = 5 * time.Second ConfigTimeout = 60 * time.Second )
Variables ¶
var DefaultConfig = &Config{ Query: DefaultQuery, Threshold: DefaultThreshold.Seconds(), }
Functions ¶
func CheckThrottler ¶ added in v0.21.0
func CheckThrottler(clusterInstance *cluster.LocalProcessCluster, tablet *cluster.Vttablet, appName throttlerapp.Name, flags *throttle.CheckFlags) (*vtctldatapb.CheckThrottlerResponse, error)
CheckThrottler runs vtctldclient CheckThrottler.
func CheckThrottlerRaw ¶ added in v0.21.0
func CheckThrottlerRaw(vtctldProcess *cluster.VtctldClientProcess, tablet *cluster.Vttablet, appName throttlerapp.Name, flags *throttle.CheckFlags) (result string, err error)
CheckThrottlerRaw runs vtctldclient CheckThrottler
func EnableLagThrottlerAndWaitForStatus ¶ added in v0.17.0
func EnableLagThrottlerAndWaitForStatus(t *testing.T, clusterInstance *cluster.LocalProcessCluster)
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 GetThrottlerStatus ¶ added in v0.21.0
func GetThrottlerStatus(vtctldProcess *cluster.VtctldClientProcess, tablet *cluster.Vttablet) (*tabletmanagerdatapb.GetThrottlerStatusResponse, error)
GetThrottlerStatus runs vtctldclient CheckThrottler.
func GetThrottlerStatusRaw ¶ added in v0.21.0
func GetThrottlerStatusRaw(vtctldProcess *cluster.VtctldClientProcess, tablet *cluster.Vttablet) (result string, err error)
GetThrottlerStatusRaw runs vtctldclient GetThrottlerStatus
func ThrottleApp ¶ added in v0.18.0
func ThrottleApp(clusterInstance *cluster.LocalProcessCluster, throttlerApp throttlerapp.Name) (string, error)
ThrottleApp throttles given app name for the next hour
func ThrottleAppAndWaitUntilTabletsConfirm ¶ added in v0.18.0
func ThrottleAppAndWaitUntilTabletsConfirm(t *testing.T, clusterInstance *cluster.LocalProcessCluster, throttlerApp throttlerapp.Name) (string, error)
ThrottleAppAndWaitUntilTabletsConfirm
func UnthrottleApp ¶ added in v0.18.0
func UnthrottleApp(clusterInstance *cluster.LocalProcessCluster, throttlerApp throttlerapp.Name) (string, error)
ThrottleApp unthrottles given app name
func UnthrottleAppAndWaitUntilTabletsConfirm ¶ added in v0.18.0
func UnthrottleAppAndWaitUntilTabletsConfirm(t *testing.T, clusterInstance *cluster.LocalProcessCluster, throttlerApp throttlerapp.Name) (string, error)
UnthrottleAppAndWaitUntilTabletsConfirm
func UpdateThrottlerTopoConfig ¶
func UpdateThrottlerTopoConfig( clusterInstance *cluster.LocalProcessCluster, opts *vtctldatapb.UpdateThrottlerConfigRequest, appRule *topodatapb.ThrottledAppRule, appCheckedMetrics map[string]*topodatapb.ThrottlerConfig_MetricNames, ) (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, opts *vtctldatapb.UpdateThrottlerConfigRequest, appRule *topodatapb.ThrottledAppRule, appCheckedMetrics map[string]*topodatapb.ThrottlerConfig_MetricNames, ) (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 WaitForCheckThrottlerResult ¶ added in v0.21.0
func WaitForCheckThrottlerResult(t *testing.T, clusterInstance *cluster.LocalProcessCluster, tablet *cluster.Vttablet, appName throttlerapp.Name, flags *throttle.CheckFlags, expect int32, timeout time.Duration) (*vtctldatapb.CheckThrottlerResponse, error)
func WaitForSrvKeyspace ¶ added in v0.18.0
func WaitForSrvKeyspace(clusterInstance *cluster.LocalProcessCluster, cell, keyspace string) error
WaitForSrvKeyspace waits until the given srvkeyspace entry is found in the given cell
func WaitForThrottledApp ¶ added in v0.18.0
func WaitForThrottledApp(t *testing.T, tablet *cluster.Vttablet, throttlerApp throttlerapp.Name, expectThrottled bool, 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 WaitForThrottlerStatusEnabled ¶
func WaitForThrottlerStatusEnabled(t *testing.T, vtctldProcess *cluster.VtctldClientProcess, 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 ¶
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.
func WaitUntilTabletsConfirmThrottledApp ¶ added in v0.18.0
func WaitUntilTabletsConfirmThrottledApp(t *testing.T, clusterInstance *cluster.LocalProcessCluster, throttlerApp throttlerapp.Name, expectThrottled bool)