Skip to content

Commit

Permalink
fix: mariadb 11 compatibility fix
Browse files Browse the repository at this point in the history
  • Loading branch information
sloonz committed Oct 2, 2023
1 parent 2b8ef8e commit d35dad8
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions sources/mariabackup.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,22 @@ var (
mariaBackupLocalScript []byte
)

func readBackupInfo(basePath string) ([]byte, error) {
info, err := os.ReadFile(path.Join(basePath, "xtrabackup_info"))
if err == nil {
return info, nil
}

if os.IsNotExist(err) {
info, err = os.ReadFile(path.Join(basePath, "mariadb_backup_info"))
if err == nil {
return info, nil
}
}

return nil, err
}

type mariaBackupSource struct {
options *uback.Options
snapshotsPath string
Expand Down Expand Up @@ -177,7 +193,7 @@ func (s *mariaBackupSource) CreateBackup(baseSnapshot *uback.Snapshot) (uback.Ba
mdbVersionCommand = append(mdbVersionCommand, "-BNe", "select version()")

if baseSnapshot != nil && s.versionCheck {
baseInfo, err := os.ReadFile(path.Join(s.snapshotsPath, baseSnapshot.Name(), "xtrabackup_info"))
baseInfo, err := readBackupInfo(path.Join(s.snapshotsPath, baseSnapshot.Name()))
if err != nil {
return uback.Backup{}, nil, err
}
Expand Down Expand Up @@ -288,7 +304,7 @@ func (s *mariaBackupSource) RestoreBackup(targetDir string, backup uback.Backup,

var prepareCommand []string
if s.useDocker {
info, err := os.ReadFile(path.Join(restoreDir, "xtrabackup_info"))
info, err := readBackupInfo(restoreDir)
if err != nil {
return err
}
Expand Down

0 comments on commit d35dad8

Please sign in to comment.