diff --git a/pkg/database/database.go b/pkg/database/database.go index 45c4eb7..fb215ec 100644 --- a/pkg/database/database.go +++ b/pkg/database/database.go @@ -2,7 +2,6 @@ package database import ( "fmt" - "strings" "github.com/jackc/pgx" "github.com/jackc/pgx/pgtype" @@ -81,7 +80,7 @@ func (database *DatabaseHandler) GetVirtualExpireIndexes(port uint64) (map[strin if err := rows2.Scan(&xpath); err != nil { return nil, nil, fmt.Errorf("unable to parse query output %v", err) } - p2 := ReworkFileName(xpath) + p2 := xpath c2[p2] = true ylogger.Zero.Debug().Str("file", p2).Msg("added") } @@ -170,9 +169,3 @@ func connectToDatabase(port uint64, database string) (*pgx.Conn, error) { } return conn, nil } - -func ReworkFileName(str string) string { - p1 := strings.Split(str, "/") - p2 := strings.Join(p1, "_") - return p2 -} diff --git a/pkg/proc/delete_handler.go b/pkg/proc/delete_handler.go index 72e94a9..29b8c5f 100644 --- a/pkg/proc/delete_handler.go +++ b/pkg/proc/delete_handler.go @@ -123,7 +123,7 @@ func (dh *BasicDeleteHandler) ListGarbageFiles(msg message.DeleteMessage) ([]str filesToDelete := make([]string, 0) for i := 0; i < len(objectMetas); i++ { - reworkedName := database.ReworkFileName(objectMetas[i].Path) + reworkedName := objectMetas[i].Path ylogger.Zero.Debug().Str("reworked name", reworkedName).Msg("lookup chunk") if vi[reworkedName] { diff --git a/pkg/proc/delete_handler_test.go b/pkg/proc/delete_handler_test.go index dd9f0a6..a4a535f 100644 --- a/pkg/proc/delete_handler_test.go +++ b/pkg/proc/delete_handler_test.go @@ -5,7 +5,6 @@ import ( "github.com/stretchr/testify/assert" "github.com/yezzey-gp/yproxy/config" - "github.com/yezzey-gp/yproxy/pkg/database" "github.com/yezzey-gp/yproxy/pkg/message" mock "github.com/yezzey-gp/yproxy/pkg/mock" "github.com/yezzey-gp/yproxy/pkg/object" @@ -13,45 +12,6 @@ import ( "go.uber.org/mock/gomock" ) -func TestReworkingName(t *testing.T) { - type TestCase struct { - input string - expected string - } - - testCases := []TestCase{ - { - input: "/segments_005/seg1/basebackups_005/yezzey/1663_16530_a4c5ad8305b83f07200b020694c36563_17660_1__DY_1_xlog_19649822496", - expected: "1663_16530_a4c5ad8305b83f07200b020694c36563_17660_", - }, - { - input: "1663_16530_a4c5ad8305b83f07200b020694c36563_17660_1__DY_1_xlog_19649822496", - expected: "1663_16530_a4c5ad8305b83f07200b020694c36563_17660_", - }, - { - input: "seg1/basebackups_005/yezzey/1663_16530_a4c5ad8305b83f07200b020694c36563_17660_1__DY_1_xlog_19649822496", - expected: "1663_16530_a4c5ad8305b83f07200b020694c36563_17660_", - }, - { - input: "1663_16530_a4c5ad8305b83f07200b020694c36563", - expected: "1663_16530_a4c5ad8305b83f07200b020694c36563", - }, - { - input: "1663___a4c5ad8305b83f07200b020694c36563___", - expected: "1663___a4c5ad8305b83f07200b020694c36563_", - }, - { - input: "file", - expected: "file", - }, - } - - for _, testCase := range testCases { - ans := database.ReworkFileName(testCase.input) - assert.Equal(t, testCase.expected, ans) - } -} - func TestFilesToDeletion(t *testing.T) { ctrl := gomock.NewController(t)