failover

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2026 License: Apache-2.0 Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const LockPath = "/var/lib/mysql/failover.lock"
View Source
const ResultSourceRecovered = "FAILOVER-RESULT: source-recovered"

ResultSourceRecovered is printed by the failover worker when it stood down because the source is serving again and holds transactions the candidate does not. The caller reads it off the worker's stdout to tell that outcome apart from an ordinary failure: this one is never forced past, because promoting here would leave the cluster with two writable primaries.

Variables

View Source
var ErrLocked = errors.New("another failover is in progress")

Functions

func Lock

func Lock(path string) (*os.File, error)

Lock takes the exclusive lock at path, or returns ErrLocked when another process holds it.

func LockWait

func LockWait(ctx context.Context, path string, wait, poll time.Duration) (*os.File, error)

LockWait takes the lock at path like Lock does, waiting up to wait for the holder to release it. It returns ErrLocked once the wait is spent, which with a zero wait is right after the first attempt.

The wait polls instead of blocking in flock so that it can be cancelled.

Types

This section is empty.

Jump to

Keyboard shortcuts

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