backup

package
v1.7.0-alpha.13 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2026 License: Apache-2.0 Imports: 38 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SeverityError  = "ERROR"
	SeverityManual = "MANUAL"
)

Variables

This section is empty.

Functions

func NewBackupManager

func NewBackupManager(deps *controller.Dependencies) backup.BackupManager

NewBackupManager return backupManager

func ParseBackupError added in v1.6.4

func ParseBackupError(data []byte) (string, error)

Types

type BackupCleaner

type BackupCleaner interface {
	Clean(backup *v1alpha1.Backup) error
}

BackupCleaner implements the logic for cleaning backup

func NewBackupCleaner

NewBackupCleaner returns a BackupCleaner

type BackupTracker added in v1.4.0

type BackupTracker interface {
	StartTrackLogBackupProgress(backup *v1alpha1.Backup) error
	GetLogBackupTC(backup *v1alpha1.Backup) (*v1alpha1.TidbCluster, error)

	// New methods for unified state management
	GetLogBackupState(backup *v1alpha1.Backup, forceRefresh ...bool) (*LogBackupState, error)
	SyncLogBackupState(backup *v1alpha1.Backup) (bool, error)
	RefreshLogBackupState(backup *v1alpha1.Backup) (*LogBackupState, error)
	StopTrackLogBackupProgress(backup *v1alpha1.Backup)
}

BackupTracker implements the logic for tracking log backup progress

func NewBackupTracker added in v1.4.0

NewBackupTracker returns a BackupTracker

type FakeBackupManager

type FakeBackupManager struct {
	// contains filtered or unexported fields
}

func NewFakeBackupManager

func NewFakeBackupManager() *FakeBackupManager

func (*FakeBackupManager) SetSyncError

func (m *FakeBackupManager) SetSyncError(err error)

func (*FakeBackupManager) Sync

func (m *FakeBackupManager) Sync(_ *v1alpha1.Backup) error

func (*FakeBackupManager) UpdateStatus added in v1.4.4

UpdateStatus updates the status for a Backup, include condition and status info.

type LogBackupKernelState added in v1.6.4

type LogBackupKernelState string

LogBackupKernelState represents the actual state of log backup in the kernel (etcd)

const (
	// LogBackupKernelRunning means the log backup is running
	LogBackupKernelRunning LogBackupKernelState = "running"
	// LogBackupKernelPaused means the log backup is paused
	LogBackupKernelPaused LogBackupKernelState = "paused"
)

type LogBackupState added in v1.6.4

type LogBackupState struct {
	// Raw data from etcd queries
	CheckpointTS uint64 // checkpoint timestamp
	IsPaused     bool   // whether the backup is paused
	PauseReason  string // pause reason (manual or error message)
	LastError    string // last error message
	InfoExists   bool   // whether the info key exists in etcd

	// Derived state information
	KernelState LogBackupKernelState // kernel state (running/paused)

	// Metadata
	LastQueryTime time.Time // last query timestamp
	QueryError    error     // non-fatal partial query error, currently used when pause state is unknown
}

LogBackupState represents the complete state of a log backup task

type ManifestFetcher added in v1.5.0

type ManifestFetcher interface {
	ListByTC(tc *v1alpha1.TidbCluster) (objects []runtime.Object, err error)
}

func NewTiDBDashboardFetcher added in v1.5.0

func NewTiDBDashboardFetcher(lister listers.TidbDashboardLister) ManifestFetcher

func NewTiDBInitializerFetcher added in v1.5.0

func NewTiDBInitializerFetcher(lister listers.TidbInitializerLister) ManifestFetcher

func NewTiDBMonitorFetcher added in v1.5.0

func NewTiDBMonitorFetcher(lister listers.TidbMonitorLister) ManifestFetcher

func NewTiDBNgMonitoringFetcher added in v1.5.0

func NewTiDBNgMonitoringFetcher(lister listers.TidbNGMonitoringLister) ManifestFetcher

type PauseStatus added in v1.6.4

type PauseStatus struct {
	IsPaused bool
	Message  string
}

type PauseV2Info added in v1.6.4

type PauseV2Info struct {
	// Severity is the severity of this pause.
	// `SeverityError`: The task encounters some fatal errors and have to be paused.
	// `SeverityManual`: The task was paused by a normal operation.
	Severity string `json:"severity"`
	// OperatorHostName is the hostname that pauses the task.
	OperatorHostName string `json:"operation_hostname"`
	// OperatorPID is the pid of the operator process.
	OperatorPID int `json:"operation_pid"`
	// OperationTime is the time when the task was paused.
	OperationTime time.Time `json:"operation_time"`
	// PayloadType is the mime type of the payload.
	// For now, only the two types are supported:
	// - application/x-protobuf?messagetype=brpb.StreamBackupError
	// - text/plain
	PayloadType string `json:"payload_type"`
	// Payload is the payload attached to the pause.
	Payload []byte `json:"payload"`
}

PauseV2Info is extra information attached to a paused task.

func NewPauseV2Info added in v1.6.4

func NewPauseV2Info(data []byte) (*PauseV2Info, error)

func (*PauseV2Info) ParseError added in v1.6.4

func (p *PauseV2Info) ParseError() (string, error)

type RFC3339Time added in v1.6.4

type RFC3339Time time.Time

RFC3339Time is a wrapper of `time.Time` that marshals to a RFC3339 JSON string when encoding to / decoding from json.

type StreamBackupError added in v1.6.4

type StreamBackupError struct {
	// the unix epoch time (in millisecs) of the time the error reported.
	HappenAt uint64 `protobuf:"varint,1,opt,name=happen_at,json=happenAt,proto3" json:"happen_at,omitempty"`
	// the unified error code of the error.
	ErrorCode string `protobuf:"bytes,2,opt,name=error_code,json=errorCode,proto3" json:"error_code,omitempty"`
	// the user-friendly error message.
	ErrorMessage string `protobuf:"bytes,3,opt,name=error_message,json=errorMessage,proto3" json:"error_message,omitempty"`
	// the store id of who issues the error.
	StoreId uint64 `protobuf:"varint,4,opt,name=store_id,json=storeId,proto3" json:"store_id,omitempty"`
}

type TiDBDashboardFetcher added in v1.5.0

type TiDBDashboardFetcher struct {
	// contains filtered or unexported fields
}

func (*TiDBDashboardFetcher) ListByTC added in v1.5.0

func (f *TiDBDashboardFetcher) ListByTC(tc *v1alpha1.TidbCluster) (objects []runtime.Object, err error)

type TiDBInitializerFetcher added in v1.5.0

type TiDBInitializerFetcher struct {
	// contains filtered or unexported fields
}

func (*TiDBInitializerFetcher) ListByTC added in v1.5.0

func (f *TiDBInitializerFetcher) ListByTC(tc *v1alpha1.TidbCluster) (objects []runtime.Object, err error)

type TiDBMonitorFetcher added in v1.5.0

type TiDBMonitorFetcher struct {
	// contains filtered or unexported fields
}

func (*TiDBMonitorFetcher) ListByTC added in v1.5.0

func (f *TiDBMonitorFetcher) ListByTC(tc *v1alpha1.TidbCluster) (objects []runtime.Object, err error)

type TiDBNgMonitoringFetcher added in v1.5.0

type TiDBNgMonitoringFetcher struct {
	// contains filtered or unexported fields
}

func (*TiDBNgMonitoringFetcher) ListByTC added in v1.5.0

func (f *TiDBNgMonitoringFetcher) ListByTC(tc *v1alpha1.TidbCluster) (objects []runtime.Object, err error)

Jump to

Keyboard shortcuts

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