diff --git a/config/instance.go b/config/instance.go index 1bdbffc..7164e50 100644 --- a/config/instance.go +++ b/config/instance.go @@ -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"` diff --git a/pkg/mock/backups.go b/pkg/mock/backups.go index 6172b3c..3ee263f 100644 --- a/pkg/mock/backups.go +++ b/pkg/mock/backups.go @@ -3,7 +3,7 @@ // // Generated by this command: // -// mockgen -destination=./pkg/mock/backups.go -source=pkg/backups/backups.go -package mock +// mockgen -source=pkg/backups/backups.go -destination=pkg/mock/backups.go -package=mock // // Package mock is a generated GoMock package. diff --git a/pkg/mock/database.go b/pkg/mock/database.go index 93e768a..817e9f4 100644 --- a/pkg/mock/database.go +++ b/pkg/mock/database.go @@ -1,9 +1,9 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: ./pkg/database/database.go +// Source: pkg/database/database.go // // Generated by this command: // -// mockgen -destination=./pkg/mock/database.go -source=./pkg/database/database.go -package mock +// mockgen -source=pkg/database/database.go -destination=pkg/mock/database.go -package=mock // // Package mock is a generated GoMock package. diff --git a/pkg/proc/delete_handler.go b/pkg/proc/delete_handler.go index fc3ca77..5d01709 100644 --- a/pkg/proc/delete_handler.go +++ b/pkg/proc/delete_handler.go @@ -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 { @@ -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) } @@ -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? @@ -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) } } diff --git a/pkg/proc/delete_handler_test.go b/pkg/proc/delete_handler_test.go index 9f44ede..5e535df 100644 --- a/pkg/proc/delete_handler_test.go +++ b/pkg/proc/delete_handler_test.go @@ -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" @@ -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) diff --git a/pkg/proc/interaction.go b/pkg/proc/interaction.go index ec84d82..3d24881 100644 --- a/pkg/proc/interaction.go +++ b/pkg/proc/interaction.go @@ -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 {