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 ¶
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.
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.