|
@ -30,7 +30,7 @@ func (f *Filer) DeleteEntryMetaAndData(ctx context.Context, p util.FullPath, isR |
|
|
// delete the folder children, not including the folder itself
|
|
|
// delete the folder children, not including the folder itself
|
|
|
var dirChunks []*filer_pb.FileChunk |
|
|
var dirChunks []*filer_pb.FileChunk |
|
|
var dirHardLinkIds []HardLinkId |
|
|
var dirHardLinkIds []HardLinkId |
|
|
dirChunks, dirHardLinkIds, err = f.doBatchDeleteFolderMetaAndData(ctx, entry, isRecursive, ignoreRecursiveError, shouldDeleteChunks && !isDeleteCollection, isFromOtherCluster, signatures) |
|
|
|
|
|
|
|
|
dirChunks, dirHardLinkIds, err = f.doBatchDeleteFolderMetaAndData(ctx, entry, isRecursive, ignoreRecursiveError, shouldDeleteChunks && !isDeleteCollection, isDeleteCollection, isFromOtherCluster, signatures) |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
glog.V(0).Infof("delete directory %s: %v", p, err) |
|
|
glog.V(0).Infof("delete directory %s: %v", p, err) |
|
|
return fmt.Errorf("delete directory %s: %v", p, err) |
|
|
return fmt.Errorf("delete directory %s: %v", p, err) |
|
@ -63,10 +63,11 @@ func (f *Filer) DeleteEntryMetaAndData(ctx context.Context, p util.FullPath, isR |
|
|
return nil |
|
|
return nil |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
func (f *Filer) doBatchDeleteFolderMetaAndData(ctx context.Context, entry *Entry, isRecursive, ignoreRecursiveError, shouldDeleteChunks, isFromOtherCluster bool, signatures []int32) (chunks []*filer_pb.FileChunk, hardlinkIds []HardLinkId, err error) { |
|
|
|
|
|
|
|
|
func (f *Filer) doBatchDeleteFolderMetaAndData(ctx context.Context, entry *Entry, isRecursive, ignoreRecursiveError, shouldDeleteChunks, isDeletingBucket, isFromOtherCluster bool, signatures []int32) (chunks []*filer_pb.FileChunk, hardlinkIds []HardLinkId, err error) { |
|
|
|
|
|
|
|
|
lastFileName := "" |
|
|
lastFileName := "" |
|
|
includeLastFile := false |
|
|
includeLastFile := false |
|
|
|
|
|
if !isDeletingBucket { |
|
|
for { |
|
|
for { |
|
|
entries, err := f.ListDirectoryEntries(ctx, entry.FullPath, lastFileName, includeLastFile, PaginationSize, "", "") |
|
|
entries, err := f.ListDirectoryEntries(ctx, entry.FullPath, lastFileName, includeLastFile, PaginationSize, "", "") |
|
|
if err != nil { |
|
|
if err != nil { |
|
@ -84,7 +85,8 @@ func (f *Filer) doBatchDeleteFolderMetaAndData(ctx context.Context, entry *Entry |
|
|
var dirChunks []*filer_pb.FileChunk |
|
|
var dirChunks []*filer_pb.FileChunk |
|
|
var dirHardLinkIds []HardLinkId |
|
|
var dirHardLinkIds []HardLinkId |
|
|
if sub.IsDirectory() { |
|
|
if sub.IsDirectory() { |
|
|
dirChunks, dirHardLinkIds, err = f.doBatchDeleteFolderMetaAndData(ctx, sub, isRecursive, ignoreRecursiveError, shouldDeleteChunks, false, nil) |
|
|
|
|
|
|
|
|
subIsDeletingBucket := f.isBucket(sub) |
|
|
|
|
|
dirChunks, dirHardLinkIds, err = f.doBatchDeleteFolderMetaAndData(ctx, sub, isRecursive, ignoreRecursiveError, shouldDeleteChunks, subIsDeletingBucket, false, nil) |
|
|
chunks = append(chunks, dirChunks...) |
|
|
chunks = append(chunks, dirChunks...) |
|
|
hardlinkIds = append(hardlinkIds, dirHardLinkIds...) |
|
|
hardlinkIds = append(hardlinkIds, dirHardLinkIds...) |
|
|
} else { |
|
|
} else { |
|
@ -105,6 +107,7 @@ func (f *Filer) doBatchDeleteFolderMetaAndData(ctx context.Context, entry *Entry |
|
|
break |
|
|
break |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
glog.V(3).Infof("deleting directory %v delete %d chunks: %v", entry.FullPath, len(chunks), shouldDeleteChunks) |
|
|
glog.V(3).Infof("deleting directory %v delete %d chunks: %v", entry.FullPath, len(chunks), shouldDeleteChunks) |
|
|
|
|
|
|
|
|