Skip to content
This repository has been archived by the owner on Jan 15, 2024. It is now read-only.

Commit

Permalink
Merge pull request #28 from nixys/fix
Browse files Browse the repository at this point in the history
Fix redis backup issue
  • Loading branch information
Roman Andreev authored Jul 24, 2023
2 parents 1f75363 + f9a6f3b commit 46d56b6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
6 changes: 2 additions & 4 deletions modules/backup/redis/redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ func (j *job) DoBackup(logCh chan logger.LogRecord, tmpDir string) error {
var errs *multierror.Error

for ofsPart, tgt := range j.targets {
tmpBackupFile := misc.GetFileFullPath(tmpDir, ofsPart, "tar", "", tgt.gzip)
tmpBackupFile := misc.GetFileFullPath(tmpDir, ofsPart, "rdb", "", tgt.gzip)
err := os.MkdirAll(path.Dir(tmpBackupFile), os.ModePerm)
if err != nil {
logCh <- logger.Log(j.name, "").Errorf("Unable to create tmp dir with next error: %s", err)
Expand Down Expand Up @@ -173,12 +173,10 @@ func (j *job) DoBackup(logCh chan logger.LogRecord, tmpDir string) error {
return errs.ErrorOrNil()
}

func (j *job) createTmpBackup(logCh chan logger.LogRecord, tmpDir, tgtName string, tgt target) error {
func (j *job) createTmpBackup(logCh chan logger.LogRecord, tmpBackupFile, tgtName string, tgt target) error {

var stderr, stdout bytes.Buffer

tmpBackupFile := misc.GetFileFullPath(tmpDir, tgtName, "rdb", "", tgt.gzip)

tmpBackupRdb := strings.TrimSuffix(tmpBackupFile, ".gz")

var args []string
Expand Down
6 changes: 3 additions & 3 deletions modules/connectors/redis_connect/redis_connect.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ func GetConnectAndDSN(params Params) (rdb *redis.Client, dsn string, err error)
connUrl := url.URL{}
opts := url.Values{}

connUrl.User = url.UserPassword("", params.Passwd)

if params.Socket != "" {
connUrl.Scheme = "unix"
connUrl.Path = params.Socket
Expand Down Expand Up @@ -49,7 +47,9 @@ func GetConnectAndDSN(params Params) (rdb *redis.Client, dsn string, err error)
err = rdb.Ping(context.Background()).Err()

// this is not a bug, this is strange behavior of redis-cli uri usage
connUrl.User = url.User(params.Passwd)
if params.Passwd != "" {
connUrl.User = url.User(params.Passwd)
}
dsn = connUrl.String()

return
Expand Down

0 comments on commit 46d56b6

Please sign in to comment.