aboutsummaryrefslogtreecommitdiff
path: root/weed/filer/filer_deletion.go
diff options
context:
space:
mode:
Diffstat (limited to 'weed/filer/filer_deletion.go')
-rw-r--r--weed/filer/filer_deletion.go17
1 files changed, 9 insertions, 8 deletions
diff --git a/weed/filer/filer_deletion.go b/weed/filer/filer_deletion.go
index 362c7c51b..cc140b3ce 100644
--- a/weed/filer/filer_deletion.go
+++ b/weed/filer/filer_deletion.go
@@ -1,6 +1,7 @@
package filer
import (
+ "context"
"strings"
"time"
@@ -72,25 +73,25 @@ func (f *Filer) loopProcessingDeletion() {
}
}
-func (f *Filer) DeleteUncommittedChunks(chunks []*filer_pb.FileChunk) {
- f.doDeleteChunks(chunks)
+func (f *Filer) DeleteUncommittedChunks(ctx context.Context, chunks []*filer_pb.FileChunk) {
+ f.doDeleteChunks(ctx, chunks)
}
-func (f *Filer) DeleteChunks(fullpath util.FullPath, chunks []*filer_pb.FileChunk) {
+func (f *Filer) DeleteChunks(ctx context.Context, fullpath util.FullPath, chunks []*filer_pb.FileChunk) {
rule := f.FilerConf.MatchStorageRule(string(fullpath))
if rule.DisableChunkDeletion {
return
}
- f.doDeleteChunks(chunks)
+ f.doDeleteChunks(ctx, chunks)
}
-func (f *Filer) doDeleteChunks(chunks []*filer_pb.FileChunk) {
+func (f *Filer) doDeleteChunks(ctx context.Context, chunks []*filer_pb.FileChunk) {
for _, chunk := range chunks {
if !chunk.IsChunkManifest {
f.fileIdDeletionQueue.EnQueue(chunk.GetFileIdString())
continue
}
- dataChunks, manifestResolveErr := ResolveOneChunkManifest(f.MasterClient.LookupFileId, chunk)
+ dataChunks, manifestResolveErr := ResolveOneChunkManifest(ctx, f.MasterClient.LookupFileId, chunk)
if manifestResolveErr != nil {
glog.V(0).Infof("failed to resolve manifest %s: %v", chunk.FileId, manifestResolveErr)
}
@@ -107,7 +108,7 @@ func (f *Filer) DeleteChunksNotRecursive(chunks []*filer_pb.FileChunk) {
}
}
-func (f *Filer) deleteChunksIfNotNew(oldEntry, newEntry *Entry) {
+func (f *Filer) deleteChunksIfNotNew(ctx context.Context, oldEntry, newEntry *Entry) {
var oldChunks, newChunks []*filer_pb.FileChunk
if oldEntry != nil {
oldChunks = oldEntry.GetChunks()
@@ -116,7 +117,7 @@ func (f *Filer) deleteChunksIfNotNew(oldEntry, newEntry *Entry) {
newChunks = newEntry.GetChunks()
}
- toDelete, err := MinusChunks(f.MasterClient.GetLookupFileIdFunction(), oldChunks, newChunks)
+ toDelete, err := MinusChunks(ctx, f.MasterClient.GetLookupFileIdFunction(), oldChunks, newChunks)
if err != nil {
glog.Errorf("Failed to resolve old entry chunks when delete old entry chunks. new: %s, old: %s", newChunks, oldChunks)
return