From 180eabaa8eb105bdfdf67f988d4bef3a8339074e Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Wed, 16 Jun 2021 16:19:18 -0700 Subject: [PATCH] fix: rename(tmp, tmp-old) is necessary previous PR incorrectly changed rename() from tmp to -> tmp/.trash/uuid, since it is self referential - to clear this up make sure its renamed to a separate folder and deleted in background - just like before. --- cmd/prepare-storage.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cmd/prepare-storage.go b/cmd/prepare-storage.go index 047c399e1..4e21fbcf5 100644 --- a/cmd/prepare-storage.go +++ b/cmd/prepare-storage.go @@ -72,16 +72,16 @@ var printEndpointError = func() func(Endpoint, error, bool) { // Cleans up tmp directory of the local disk. func formatErasureCleanupTmp(diskPath string) error { // Need to move temporary objects left behind from previous run of minio - // server to a unique directory under `minioMetaTmpBucket/.trash` to clean + // server to a unique directory under `minioMetaTmpBucket-old` to clean // up `minioMetaTmpBucket` for the current run. // - // /disk1/.minio.sys/tmp/.trash/uuid + // /disk1/.minio.sys/tmp-old/ // |__ 33a58b40-aecc-4c9f-a22f-ff17bfa33b62 // |__ e870a2c1-d09c-450c-a69c-6eaa54a89b3e // // In this example, `33a58b40-aecc-4c9f-a22f-ff17bfa33b62` directory contains // temporary objects from one of the previous runs of minio server. - tmpOld := pathJoin(diskPath, minioMetaTmpDeletedBucket, mustGetUUID()) + tmpOld := pathJoin(diskPath, minioMetaTmpBucket+"-old", mustGetUUID()) if err := renameAll(pathJoin(diskPath, minioMetaTmpBucket), tmpOld); err != nil && err != errFileNotFound { logger.LogIf(GlobalContext, fmt.Errorf("unable to rename (%s -> %s) %w, drive may be faulty please investigate", @@ -94,9 +94,9 @@ func formatErasureCleanupTmp(diskPath string) error { renameAllBucketMetacache(diskPath) // Removal of tmp-old folder is backgrounded completely. - go removeAll(tmpOld) + go removeAll(pathJoin(diskPath, minioMetaTmpBucket+"-old")) - if err := mkdirAll(pathJoin(diskPath, minioMetaTmpBucket), 0777); err != nil { + if err := mkdirAll(pathJoin(diskPath, minioMetaTmpDeletedBucket), 0777); err != nil { logger.LogIf(GlobalContext, fmt.Errorf("unable to create (%s) %w, drive may be faulty please investigate", pathJoin(diskPath, minioMetaTmpBucket), err))