Documentation
¶
Overview ¶
Package restorer manages the WAL restore process
Index ¶
- Variables
- type Result
- type WALRestorer
- func (restorer *WALRestorer) ClearEndOfWALStream() error
- func (restorer *WALRestorer) ConsumeEndOfWALStreamForWAL(walName string) (markerConsumed bool, err error)
- func (restorer *WALRestorer) IsEndOfWALStream() (bool, error)deprecated
- func (restorer *WALRestorer) ResetEndOfWalStream() errordeprecated
- func (restorer *WALRestorer) Restore(walName, destinationPath string, baseOptions []string) error
- func (restorer *WALRestorer) RestoreFromSpool(walName, destinationPath string) (wasInSpool bool, err error)
- func (restorer *WALRestorer) RestoreList(ctx context.Context, fetchList []string, destinationPath string, ...) (resultList []Result)
- func (restorer *WALRestorer) SetEndOfWALStream() errordeprecated
- func (restorer *WALRestorer) SetEndOfWALStreamFromResults(results []Result) (markerSet bool, err error)
Constants ¶
This section is empty.
Variables ¶
var ErrConnectivity = errors.New("connectivity failure")
ErrConnectivity is returned when barman-cloud-wal-restore fails due to a connectivity issue with the object storage
var ErrGeneric = errors.New("generic error")
ErrGeneric is returned when barman-cloud-wal-restore fails with a generic error
var ErrInvalidWALName = errors.New("invalid WAL name")
ErrInvalidWALName is returned when the WAL name is not valid
var ErrUnrecognizedExitCode = errors.New("unrecognized exit code")
ErrUnrecognizedExitCode is returned when barman-cloud-wal-restore exits with an unrecognized exit code
var ErrWALNotFound = errors.New("WAL not found")
ErrWALNotFound is returned when the WAL is not found in the cloud archive
Functions ¶
This section is empty.
Types ¶
type Result ¶
type Result struct {
// The name of the WAL file to restore
WalName string
// Where to store the restored WAL file
DestinationPath string
// If not nil, this is the error that has been detected
Err error
// The time when we started barman-cloud-wal-archive
StartTime time.Time
// The time when end barman-cloud-wal-archive ended
EndTime time.Time
}
Result is the structure filled by the restore process on completion
type WALRestorer ¶
type WALRestorer struct {
// contains filtered or unexported fields
}
WALRestorer is a structure containing every info needed to restore some WALs from the object storage
func New ¶
func New( ctx context.Context, env []string, spoolDirectory string, ) (restorer *WALRestorer, err error)
New creates a new WAL restorer
func (*WALRestorer) ClearEndOfWALStream ¶ added in v0.7.0
func (restorer *WALRestorer) ClearEndOfWALStream() error
ClearEndOfWALStream removes the end-of-wal-stream markers of every WAL timeline, including the legacy timeline-agnostic one. Unlike ConsumeEndOfWALStreamForWAL it does not depend on a WAL name, so it fits callers that must discard markers they did not set (e.g. pg_rewind).
func (*WALRestorer) ConsumeEndOfWALStreamForWAL ¶ added in v0.7.0
func (restorer *WALRestorer) ConsumeEndOfWALStreamForWAL(walName string) (markerConsumed bool, err error)
ConsumeEndOfWALStreamForWAL removes and returns whether an end-of-wal-stream marker is present for the requested WAL segment's timeline. Non-WAL names do not consume markers.
func (*WALRestorer) IsEndOfWALStream
deprecated
func (restorer *WALRestorer) IsEndOfWALStream() (bool, error)
IsEndOfWALStream check whether end-of-wal-stream flag is presents in the spool directory.
Deprecated: use ConsumeEndOfWALStreamForWAL to avoid sharing the same marker across WAL timelines.
func (*WALRestorer) ResetEndOfWalStream
deprecated
func (restorer *WALRestorer) ResetEndOfWalStream() error
ResetEndOfWalStream remove end-of-wal-stream flag from the spool directory.
Deprecated: use ConsumeEndOfWALStreamForWAL to avoid sharing the same marker across WAL timelines, or ClearEndOfWALStream to discard every marker.
func (*WALRestorer) Restore ¶
func (restorer *WALRestorer) Restore( walName, destinationPath string, baseOptions []string, ) error
Restore restores a WAL file from the object store
func (*WALRestorer) RestoreFromSpool ¶
func (restorer *WALRestorer) RestoreFromSpool(walName, destinationPath string) (wasInSpool bool, err error)
RestoreFromSpool restores a certain file from the spool, returning a boolean flag indicating is the file was in the spool or not. If the file was in the spool, it will be moved into the specified destination path
func (*WALRestorer) RestoreList ¶
func (restorer *WALRestorer) RestoreList( ctx context.Context, fetchList []string, destinationPath string, options []string, ) (resultList []Result)
RestoreList restores a list of WALs. The first WAL of the list will go directly into the destination path, the others will be adopted by the spool
func (*WALRestorer) SetEndOfWALStream
deprecated
func (restorer *WALRestorer) SetEndOfWALStream() error
SetEndOfWALStream add end-of-wal-stream in the spool directory.
Deprecated: use SetEndOfWALStreamFromResults to avoid sharing the same marker across WAL timelines.
func (*WALRestorer) SetEndOfWALStreamFromResults ¶ added in v0.7.0
func (restorer *WALRestorer) SetEndOfWALStreamFromResults(results []Result) (markerSet bool, err error)
SetEndOfWALStreamFromResults sets timeline-scoped end-of-wal-stream markers for missing regular WAL segment files in the passed restore results. It returns true if any marker was set or already present.