|
|
@ -3,18 +3,22 @@ package filer2 |
|
|
|
import ( |
|
|
|
"context" |
|
|
|
"fmt" |
|
|
|
"google.golang.org/grpc" |
|
|
|
"math" |
|
|
|
"os" |
|
|
|
"path/filepath" |
|
|
|
"strings" |
|
|
|
"time" |
|
|
|
|
|
|
|
"google.golang.org/grpc" |
|
|
|
|
|
|
|
"github.com/karlseguin/ccache" |
|
|
|
|
|
|
|
"github.com/chrislusf/seaweedfs/weed/glog" |
|
|
|
"github.com/chrislusf/seaweedfs/weed/wdclient" |
|
|
|
"github.com/karlseguin/ccache" |
|
|
|
) |
|
|
|
|
|
|
|
const PaginationSize = 1024 * 256 |
|
|
|
|
|
|
|
var ( |
|
|
|
OS_UID = uint32(os.Getuid()) |
|
|
|
OS_GID = uint32(os.Getgid()) |
|
|
@ -32,7 +36,7 @@ func NewFiler(masters []string, grpcDialOption grpc.DialOption) *Filer { |
|
|
|
f := &Filer{ |
|
|
|
directoryCache: ccache.New(ccache.Configure().MaxSize(1000).ItemsToPrune(100)), |
|
|
|
MasterClient: wdclient.NewMasterClient(context.Background(), grpcDialOption, "filer", masters), |
|
|
|
fileIdDeletionChan: make(chan string, 4096), |
|
|
|
fileIdDeletionChan: make(chan string, PaginationSize), |
|
|
|
GrpcDialOption: grpcDialOption, |
|
|
|
} |
|
|
|
|
|
|
@ -217,7 +221,7 @@ func (f *Filer) DeleteEntryMetaAndData(ctx context.Context, p FullPath, isRecurs |
|
|
|
lastFileName := "" |
|
|
|
includeLastFile := false |
|
|
|
for limit > 0 { |
|
|
|
entries, err := f.ListDirectoryEntries(ctx, p, lastFileName, includeLastFile, 1024) |
|
|
|
entries, err := f.ListDirectoryEntries(ctx, p, lastFileName, includeLastFile, PaginationSize) |
|
|
|
if err != nil { |
|
|
|
glog.Errorf("list folder %s: %v", p, err) |
|
|
|
return fmt.Errorf("list folder %s: %v", p, err) |
|
|
@ -241,7 +245,7 @@ func (f *Filer) DeleteEntryMetaAndData(ctx context.Context, p FullPath, isRecurs |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if len(entries) < 1024 { |
|
|
|
if len(entries) < PaginationSize { |
|
|
|
break |
|
|
|
} |
|
|
|
} |
|
|
|