backuphealth

package
v0.10.3 Latest Latest
Warning

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

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

Documentation

Overview

Package backuphealth evaluates the health of database backups by querying the primary pooler via gRPC for backup metadata and determining whether the most recent backup is within acceptable staleness thresholds.

Index

Constants

View Source
const (
	// BackupStaleThreshold is the maximum age of a completed backup before it
	// is considered stale. Set to 25h to accommodate daily backup schedules
	// with a 1-hour buffer for execution time.
	BackupStaleThreshold = 25 * time.Hour

	// ConditionHealthy is the condition type for backup health.
	ConditionHealthy = "BackupHealthy"
)

Variables

This section is empty.

Functions

func Apply

func Apply(shard *multigresv1alpha1.Shard, result *Result)

Apply updates the shard status with backup health information and sets the BackupHealthy condition.

func ParseTime

func ParseTime(backupID string) time.Time

ParseTime extracts the timestamp from a pgBackRest backup ID. Format: YYYYMMDD-HHMMSSF (F = fractional seconds suffix).

Types

type Result

type Result struct {
	Healthy        bool
	LastBackupTime *metav1.Time
	LastBackupType string
	Message        string
}

Result holds the computed backup health information.

func Evaluate

func Evaluate(
	ctx context.Context,
	store topoclient.Store,
	rpcClient rpcclient.MultiPoolerClient,
	shard *multigresv1alpha1.Shard,
) (*Result, error)

Evaluate discovers the primary pooler from the topology and queries it for backup metadata. Returns nil (no error) if no primary pooler is registered yet, which is normal during cluster bootstrap.

func EvaluateBackups

func EvaluateBackups(
	shard *multigresv1alpha1.Shard,
	backups []*multipoolermanagerdatapb.BackupMetadata,
) *Result

EvaluateBackups inspects backup metadata and produces a health result. It looks for the most recent COMPLETE backup.

Jump to

Keyboard shortcuts

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