diff --git a/weed/filer/filerstore_wrapper.go b/weed/filer/filerstore_wrapper.go index 8b5da45f1..b50c43f23 100644 --- a/weed/filer/filerstore_wrapper.go +++ b/weed/filer/filerstore_wrapper.go @@ -261,7 +261,7 @@ func (fsw *FilerStoreWrapper) ListDirectoryPrefixedEntries(ctx context.Context, if limit > math.MaxInt32-1 { limit = math.MaxInt32 - 1 } - //glog.V(4).Infof("ListDirectoryPrefixedEntries %s from %s prefix %s limit %d", dirPath, startFileName, prefix, limit) + // glog.V(4).Infof("ListDirectoryPrefixedEntries %s from %s prefix %s limit %d", dirPath, startFileName, prefix, limit) adjustedEntryFunc := func(entry *Entry) bool { fsw.maybeReadHardLink(ctx, entry) filer_pb.AfterEntryDeserialization(entry.GetChunks()) diff --git a/weed/s3api/s3api_object_handlers_list.go b/weed/s3api/s3api_object_handlers_list.go index 7a64f9d1b..0f406db18 100644 --- a/weed/s3api/s3api_object_handlers_list.go +++ b/weed/s3api/s3api_object_handlers_list.go @@ -105,7 +105,7 @@ func (s3a *S3ApiServer) ListObjectsV1Handler(w http.ResponseWriter, r *http.Requ // collect parameters bucket, _ := s3_constants.GetBucketAndObject(r) - glog.V(0).Infof("ListObjectsV1Handler %s", bucket) + glog.V(3).Infof("ListObjectsV1Handler %s", bucket) originalPrefix, marker, delimiter, encodingTypeUrl, maxKeys := getListObjectsV1Args(r.URL.Query()) @@ -177,7 +177,6 @@ func (s3a *S3ApiServer) listFilerEntries(bucket string, originalPrefix string, m doErr = s3a.doListFilerRecursiveEntries(client, reqDir, prefix, cursor, marker, delimiter, false, func(path string, entry *filer_pb.Entry) { key := path[len(bucketPrefix):] - glog.V(0).Infof("doListFilerRecursiveEntries path %s, shortDir %s, key: %+v, cursor: %+v, marker: %s[%s], nextMarker: %s, IsDirectoryKeyObject %v", path, path[len(reqDir):], key, cursor, marker, originalMarker, cursor.nextMarker, entry.IsDirectoryKeyObject()) if cursor.isTruncated { nextMarker = cursor.nextMarker return @@ -190,13 +189,11 @@ func (s3a *S3ApiServer) listFilerEntries(bucket string, originalPrefix string, m }() if delimiter == "/" { if entry.IsDirectoryKeyObject() { - // glog.V(0).Infof("append IsDirectoryKeyObject %s", key+"/") contents = append(contents, newListEntry(entry, key+"/", "", "", bucketPrefix, fetchOwner, false, encodingTypeUrl)) cursor.maxKeys-- return } if entry.IsDirectory { - // glog.V(0).Infof("append commonPrefixes %s", key+"/") var prefixKey string if encodingTypeUrl { prefixKey = urlPathEscape(key + "/") @@ -327,13 +324,6 @@ type ListingCursor struct { nextMarker string } -func (l *ListingCursor) Decrease() { - l.maxKeys-- - if l.maxKeys == 0 { - l.isTruncated = true - } -} - func getStartFileFromKey(key string) string { idx := strings.LastIndex(key, "/") if idx == -1 { diff --git a/weed/server/filer_grpc_server.go b/weed/server/filer_grpc_server.go index b909b8d96..a906d2b59 100644 --- a/weed/server/filer_grpc_server.go +++ b/weed/server/filer_grpc_server.go @@ -47,10 +47,10 @@ func (fs *FilerServer) ListEntries(req *filer_pb.ListEntriesRequest, stream file } paginationLimit := filer.PaginationSize - // Todo test_bucket_listv2_delimiter_prefix move start from prefix to SQL because in extreme cases, where there are more keys that need to be skipped than the limit - if paginationLimit > limit && !(req.Recursive && req.Delimiter && len(req.StartFromFileName) > 0) { + if paginationLimit > limit { paginationLimit = limit - if req.Recursive { + // for skipping parent folders + if req.Recursive && !req.Delimiter { paginationLimit *= 2 } }