closes #7179
[arvados.git] / services / keepstore / trash_worker.go
index 6257f7b4700dae6c5e3972aca0ba9b7b7332ad54..7e19ba41c5d8250f0d678ea0c107972e3c077374 100644 (file)
@@ -6,18 +6,17 @@ import (
        "time"
 )
 
-/*
-       Keepstore initiates trash worker channel goroutine.
-       The channel will process trash list.
-               For each (next) trash request:
-      Delete the block indicated by the trash request Locator
-               Repeat
-*/
-
+// RunTrashWorker is used by Keepstore to initiate trash worker channel goroutine.
+//     The channel will process trash list.
+//             For each (next) trash request:
+//      Delete the block indicated by the trash request Locator
+//             Repeat
+//
 func RunTrashWorker(trashq *WorkQueue) {
        for item := range trashq.NextItem {
                trashRequest := item.(TrashRequest)
                TrashItem(trashRequest)
+               trashq.DoneItem <- struct{}{}
        }
 }
 
@@ -33,9 +32,15 @@ func TrashItem(trashRequest TrashRequest) {
                        blob_signature_ttl)
                return
        }
+
        for _, volume := range KeepVM.AllWritable() {
                mtime, err := volume.Mtime(trashRequest.Locator)
-               if err != nil || trashRequest.BlockMtime != mtime.Unix() {
+               if err != nil {
+                       log.Printf("%v Delete(%v): %v", volume, trashRequest.Locator, err)
+                       continue
+               }
+               if trashRequest.BlockMtime != mtime.Unix() {
+                       log.Printf("%v Delete(%v): mtime on volume is %v does not match trash list value %v", volume, trashRequest.Locator, mtime.Unix(), trashRequest.BlockMtime)
                        continue
                }