mysql

package
v0.0.0-...-e89a0ad Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2024 License: Apache-2.0 Imports: 36 Imported by: 0

Documentation

Index

Constants

View Source
const BinlogCacheFileName = ".walg_mysql_binlogs_cache"
View Source
const BinlogPath = "binlog_" + utility.VersionStr + "/"
View Source
const BinlogReadHeaderSize = 128 * 1024

128k should be enough to parse prev_gtids event

View Source
const BinlogSentinelPath = "binlog_sentinel_" + utility.VersionStr + ".json"
View Source
const TimeMysqlFormat = "2006-01-02 15:04:05"

Variables

This section is empty.

Functions

func BinlogNum

func BinlogNum(filename string) int

Mysql binlog file names looks like foobar.000001, foobar.000002 (with leading zeroes) And it looks like they can be compared lexicographically, but.. The next name after foobar.999999 is foobar.1000000 (7 digits) and it cannot be compared so.

func BinlogPrefix

func BinlogPrefix(filename string) string

func FetchBinlogSentinel

func FetchBinlogSentinel(folder storage.Folder, sentinelDto interface{}) error

func GetBinlogPreviousGTIDs

func GetBinlogPreviousGTIDs(filename string, flavor string) (mysql.GTIDSet, error)

func GetBinlogPreviousGTIDsRemote

func GetBinlogPreviousGTIDsRemote(folder storage.Folder, filename string, flavor string) (mysql.GTIDSet, error)

func GetBinlogStartTimestamp

func GetBinlogStartTimestamp(filename string, flavor string) (time.Time, error)

func GetBinlogTS

func GetBinlogTS(folder storage.Folder, binlogName string) (time.Time, error)

func HandleBackupFetch

func HandleBackupFetch(folder storage.Folder,
	targetBackupSelector internal.BackupSelector,
	restoreCmd *exec.Cmd,
	prepareCmd *exec.Cmd)

func HandleBackupPush

func HandleBackupPush(folder storage.Folder, uploader internal.Uploader,
	backupCmd *exec.Cmd, isPermanent bool, userDataRaw string)

func HandleBinlogFetch

func HandleBinlogFetch(folder storage.Folder, backupName string, untilTS string, untilBinlogLastModifiedTS string, sinceTS string)

func HandleBinlogFind

func HandleBinlogFind(folder storage.Folder, gtid string)

func HandleBinlogPush

func HandleBinlogPush(uploader internal.Uploader, untilBinlog string, checkGTIDs bool)

func HandleBinlogReplay

func HandleBinlogReplay(folder storage.Folder, backupName string, untilTS string, untilBinlogLastModifiedTS string, sinceTS string)

func HandleBinlogServer

func HandleBinlogServer(since string, until, sinceTS string)

func HandleCopyAll

func HandleCopyAll(fromConfigFile string, toConfigFile string)

HandleCopyBackup copy all backups from one storage to another

func HandleCopyBackup

func HandleCopyBackup(fromConfigFile, toConfigFile, backupName, prefix string)

HandleCopyBackup copy specific backups from one storage to another

func HandleDetailedBackupList

func HandleDetailedBackupList(folder storage.Folder, pretty, json bool)

func MarkBackup

func MarkBackup(uploader internal.Uploader, backupName string, toPermanent bool)

MarkBackup marks a backup as permanent or impermanent

func UploadBinlogSentinel

func UploadBinlogSentinel(folder storage.Folder, sentinelDto interface{}) error

func WildcardInfo

func WildcardInfo(from storage.Folder, to storage.Folder) ([]copy.InfoProvider, error)

Types

type BackupDetail

type BackupDetail struct {
	BackupName string    `json:"backup_name"`
	ModifyTime time.Time `json:"modify_time"`

	BinLogStart    string    `json:"binlog_start"`
	BinLogEnd      string    `json:"binlog_end"`
	StartLocalTime time.Time `json:"start_local_time"`
	StopLocalTime  time.Time `json:"stop_local_time"`

	// these fields were introduced recently in
	// https://github.com/apecloud/dataprotection-wal-g/pull/930
	// so it is not guaranteed that sentinel contains them
	UncompressedSize int64  `json:"uncompressed_size,omitempty"`
	CompressedSize   int64  `json:"compressed_size,omitempty"`
	Hostname         string `json:"hostname,omitempty"`

	IsPermanent bool        `json:"is_permanent"`
	UserData    interface{} `json:"user_data,omitempty"`
}

func NewBackupDetail

func NewBackupDetail(backupTime internal.BackupTime, sentinel StreamSentinelDto) BackupDetail

type BinlogSentinelDto

type BinlogSentinelDto struct {
	GTIDArchived string `json:"GtidArchived"`
}

func (*BinlogSentinelDto) String

func (dto *BinlogSentinelDto) String() string

type GenericMetaFetcher

type GenericMetaFetcher struct{}

func NewGenericMetaFetcher

func NewGenericMetaFetcher() GenericMetaFetcher

func (GenericMetaFetcher) Fetch

func (mf GenericMetaFetcher) Fetch(backupName string, backupFolder storage.Folder) (internal.GenericMetadata, error)

TODO: Unit tests

type GenericMetaInteractor

type GenericMetaInteractor struct {
	GenericMetaFetcher
	GenericMetaSetter
}

func NewGenericMetaInteractor

func NewGenericMetaInteractor() GenericMetaInteractor

type GenericMetaSetter

type GenericMetaSetter struct{}

func NewGenericMetaSetter

func NewGenericMetaSetter() GenericMetaSetter

func (GenericMetaSetter) SetIsPermanent

func (ms GenericMetaSetter) SetIsPermanent(backupName string, backupFolder storage.Folder, isPermanent bool) error

TODO: Unit tests

func (GenericMetaSetter) SetUserData

func (ms GenericMetaSetter) SetUserData(backupName string, backupFolder storage.Folder, userData interface{}) error

TODO: Unit tests

type Handler

type Handler struct {
	server.EmptyReplicationHandler
}

func (Handler) HandleBinlogDump

func (h Handler) HandleBinlogDump(pos mysql.Position) (*replication.BinlogStreamer, error)

func (Handler) HandleBinlogDumpGTID

func (h Handler) HandleBinlogDumpGTID(gtidSet *mysql.MysqlGTIDSet) (*replication.BinlogStreamer, error)

func (Handler) HandleQuery

func (h Handler) HandleQuery(query string) (*mysql.Result, error)

func (Handler) HandleRegisterSlave

func (h Handler) HandleRegisterSlave(data []byte) error

type LogsCache

type LogsCache struct {
	LastArchivedBinlog string `json:"LastArchivedBinlog"`
}

type StreamSentinelDto

type StreamSentinelDto struct {
	BinLogStart string `json:"BinLogStart,omitempty"`
	// BinLogEnd field is for debug purpose only.
	// As we can not guarantee that transactions in BinLogEnd file happened before or after backup
	BinLogEnd      string    `json:"BinLogEnd,omitempty"`
	StartLocalTime time.Time `json:"StartLocalTime,omitempty"`
	StopLocalTime  time.Time `json:"StopLocalTime,omitempty"`

	UncompressedSize int64  `json:"UncompressedSize,omitempty"`
	CompressedSize   int64  `json:"CompressedSize,omitempty"`
	Hostname         string `json:"Hostname,omitempty"`

	IsPermanent bool        `json:"IsPermanent,omitempty"`
	UserData    interface{} `json:"UserData,omitempty"`
}

func (*StreamSentinelDto) String

func (s *StreamSentinelDto) String() string

Jump to

Keyboard shortcuts

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