preserve conflicting objects when parent object is being deleted (#19034)

a/prefix
a/prefix/1.txt

where `a/prefix` is an object which does not have `/` at the end,
we do not have to aggressively recursively delete all the sub-folders
as well. Instead convert the call into self contained to deleting
'xl.meta' and then subsequently attempting to Remove the parent.
This commit is contained in:
Harshavardhana 2024-02-12 08:30:40 -08:00 committed by GitHub
parent afd19de5a9
commit 0e177a44e0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1146,7 +1146,7 @@ func (s *xlStorage) deleteVersions(ctx context.Context, volume, path string, fis
return s.WriteAll(ctx, volume, pathJoin(path, xlStorageFormatFile), buf)
}
return s.deleteFile(volumeDir, pathJoin(volumeDir, path), true, false)
return s.deleteFile(volumeDir, pathJoin(volumeDir, path, xlStorageFormatFile), true, false)
}
// DeleteVersions deletes slice of versions, it can be same object
@ -1307,7 +1307,7 @@ func (s *xlStorage) DeleteVersion(ctx context.Context, volume, path string, fi F
return s.WriteAll(ctx, volume, pathJoin(path, xlStorageFormatFile), buf)
}
return s.deleteFile(volumeDir, filePath, true, false)
return s.deleteFile(volumeDir, pathJoin(volumeDir, path, xlStorageFormatFile), true, false)
}
// Updates only metadata for a given version.