Skip to content

Commit

Permalink
Fxies
Browse files Browse the repository at this point in the history
  • Loading branch information
reshke committed Oct 3, 2024
1 parent dd2a90c commit 0da622d
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion config/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ type Instance struct {

CryptoCnf Crypto `json:"crypto" toml:"crypto" yaml:"crypto"`

VacuumCnf Vacuum `json:"vacuum" toml:"vacuum" yaml:"vacuum`
VacuumCnf Vacuum `json:"vacuum" toml:"vacuum" yaml:"vacuum"`

LogPath string `json:"log_path" toml:"log_path" yaml:"log_path"`
LogLevel string `json:"log_level" toml:"log_level" yaml:"log_level"`
Expand Down
2 changes: 1 addition & 1 deletion pkg/mock/backups.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pkg/mock/database.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions pkg/proc/delete_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ type BasicDeleteHandler struct {
DbInterractor database.DatabaseInterractor
StorageInterractor storage.StorageInteractor

cnf *config.Vacuum
Cnf *config.Vacuum
}

func (dh *BasicDeleteHandler) HandleDeleteGarbage(msg message.DeleteMessage) error {
Expand Down Expand Up @@ -53,11 +53,11 @@ func (dh *BasicDeleteHandler) HandleDeleteGarbage(msg message.DeleteMessage) err
filePathParts := strings.Split(fileList[i], "/")

destPath := path.Join(
"trash",
"segments_005",
fmt.Sprintf("seg%d", msg.Segnum),
"basebackups_005",
"yezzey",
"trash", filePathParts[len(filePathParts)-1])
"yezzey", filePathParts[len(filePathParts)-1])

err = dh.StorageInterractor.MoveObject(fileList[i], destPath)
}
Expand Down Expand Up @@ -93,7 +93,7 @@ func (dh *BasicDeleteHandler) ListGarbageFiles(msg message.DeleteMessage) ([]str
var firstBackupLSN uint64
var err error

if dh.cnf.CheckBackup {
if dh.Cnf.CheckBackup {
firstBackupLSN, err = dh.BackupInterractor.GetFirstLSN(msg.Segnum)
if err != nil {
ylogger.Zero.Error().AnErr("err", err).Msg("failed to get first lsn") //return or just assume there are no backups?
Expand Down Expand Up @@ -136,7 +136,7 @@ func (dh *BasicDeleteHandler) ListGarbageFiles(msg message.DeleteMessage) ([]str
ylogger.Zero.Debug().Str("file", objectMetas[i].Path).
Bool("file in expire index", ok).
Bool("lsn is less than in first backup", lsn < firstBackupLSN).
Msg("file does not persisnt in virtual index, not needed for PITR, so will be deleted")
Msg("file does not persisnt in virtual index, nor needed for PITR, so will be deleted")
filesToDelete = append(filesToDelete, objectMetas[i].Path)
}
}
Expand Down
2 changes: 2 additions & 0 deletions pkg/proc/delete_handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"testing"

"github.com/stretchr/testify/assert"
"github.com/yezzey-gp/yproxy/config"
"github.com/yezzey-gp/yproxy/pkg/message"
mock "github.com/yezzey-gp/yproxy/pkg/mock"
"github.com/yezzey-gp/yproxy/pkg/object"
Expand Down Expand Up @@ -90,6 +91,7 @@ func TestFilesToDeletion(t *testing.T) {
StorageInterractor: storage,
DbInterractor: database,
BackupInterractor: backup,
Cnf: &config.Vacuum{CheckBackup: true},
}

list, err := handler.ListGarbageFiles(msg)
Expand Down
2 changes: 1 addition & 1 deletion pkg/proc/interaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ func ProcConn(s storage.StorageInteractor, cr crypt.Crypter, ycl client.YproxyCl
StorageInterractor: s,
DbInterractor: dbInterractor,
BackupInterractor: backupHandler,
cnf: cnf,
Cnf: cnf,
}

if msg.Garbage {
Expand Down

0 comments on commit 0da622d

Please sign in to comment.