mirror of
https://github.com/pgsty/minio.git
synced 2026-08-08 23:33:30 +03:00
Cleanup temporary writers upon errors during putObject(), all metadata() write operations
This commit is contained in:
@@ -24,6 +24,8 @@ import (
|
||||
"sort"
|
||||
"strings"
|
||||
"unicode/utf8"
|
||||
|
||||
"github.com/minio/minio/pkg/utils/atomic"
|
||||
)
|
||||
|
||||
// IsValidBucket - verify bucket name in accordance with
|
||||
@@ -163,3 +165,10 @@ func SortU(objects []string) []string {
|
||||
sort.Strings(results)
|
||||
return results
|
||||
}
|
||||
|
||||
// CleanupWritersOnError purge writers on error
|
||||
func CleanupWritersOnError(writers []io.WriteCloser) {
|
||||
for _, writer := range writers {
|
||||
writer.(*atomic.File).CloseAndPurge()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user