fix: remove parent dirs in RenameData upon failure (#12452)

- it is possible that during I/O failures we might
  leave partially written directories, make sure
  we purge them after.

- rename current data-dir (null) versionId only after
  the newer xl.meta has been written fully.

- attempt removal once for minioMetaTmpBucket/uuid/
  as this folder is empty if all previous operations
  were successful, this allows avoiding recursive os.Remove()
This commit is contained in:
Harshavardhana
2021-06-07 09:35:08 -07:00
committed by GitHub
parent 403f4b9c84
commit dd2831c1a0
3 changed files with 55 additions and 15 deletions

View File

@@ -966,11 +966,11 @@ func TestXLStorageDeleteFile(t *testing.T) {
expectedErr: nil,
},
// TestXLStorage case - 2.
// The file was deleted in the last case, so Delete should fail.
// The file was deleted in the last case, so Delete should not fail.
{
srcVol: "success-vol",
srcPath: "success-file",
expectedErr: errFileNotFound,
expectedErr: nil,
},
// TestXLStorage case - 3.
// TestXLStorage case with segment of the volume name > 255.