mirror of
https://github.com/minio/minio.git
synced 2026-02-05 02:10:14 -05:00
[feat] use rename instead of recursive deletes (#11641)
most of the delete calls today spend time in a blocking operation where multiple calls need to be recursively sent to delete the objects, instead we can use rename operation to atomically move the objects from the namespace to `tmp/.trash` we can schedule deletion of objects at this location once in 15, 30mins and we can also add wait times between each delete operation. this allows us to make delete's faster as well less chattier on the drives, each server runs locally a groutine which would clean this up regularly.
This commit is contained in:
@@ -340,8 +340,19 @@ func testObjectAPIPutObjectStaleFiles(obj ObjectLayer, instanceType string, disk
|
||||
|
||||
for _, disk := range disks {
|
||||
tmpMetaDir := path.Join(disk, minioMetaTmpBucket)
|
||||
if !isDirEmpty(tmpMetaDir) {
|
||||
t.Fatalf("%s: expected: empty, got: non-empty", minioMetaTmpBucket)
|
||||
files, err := ioutil.ReadDir(tmpMetaDir)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
var found bool
|
||||
for _, fi := range files {
|
||||
if fi.Name() == ".trash" {
|
||||
continue
|
||||
}
|
||||
found = true
|
||||
}
|
||||
if found {
|
||||
t.Fatalf("%s: expected: empty, got: non-empty %#v", minioMetaTmpBucket, files)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -418,8 +429,17 @@ func testObjectAPIMultipartPutObjectStaleFiles(obj ObjectLayer, instanceType str
|
||||
t.Errorf("%s", err)
|
||||
}
|
||||
|
||||
if len(files) != 0 {
|
||||
t.Fatalf("%s: expected: empty, got: non-empty. content: %s", tmpMetaDir, files)
|
||||
var found bool
|
||||
for _, fi := range files {
|
||||
if fi.Name() == ".trash" {
|
||||
continue
|
||||
}
|
||||
found = true
|
||||
break
|
||||
}
|
||||
|
||||
if found {
|
||||
t.Fatalf("%s: expected: empty, got: non-empty. content: %#v", tmpMetaDir, files)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user