Browse Source

frill of excess

pull/5580/head
Konstantin Lebedev 8 months ago
parent
commit
c08fc8cdb9
  1. 12
      weed/s3api/s3api_object_handlers_list.go
  2. 6
      weed/server/filer_grpc_server.go

12
weed/s3api/s3api_object_handlers_list.go

@ -105,7 +105,7 @@ func (s3a *S3ApiServer) ListObjectsV1Handler(w http.ResponseWriter, r *http.Requ
// collect parameters // collect parameters
bucket, _ := s3_constants.GetBucketAndObject(r) 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()) 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, doErr = s3a.doListFilerRecursiveEntries(client, reqDir, prefix, cursor, marker, delimiter, false,
func(path string, entry *filer_pb.Entry) { func(path string, entry *filer_pb.Entry) {
key := path[len(bucketPrefix):] 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 { if cursor.isTruncated {
nextMarker = cursor.nextMarker nextMarker = cursor.nextMarker
return return
@ -190,13 +189,11 @@ func (s3a *S3ApiServer) listFilerEntries(bucket string, originalPrefix string, m
}() }()
if delimiter == "/" { if delimiter == "/" {
if entry.IsDirectoryKeyObject() { if entry.IsDirectoryKeyObject() {
// glog.V(0).Infof("append IsDirectoryKeyObject %s", key+"/")
contents = append(contents, newListEntry(entry, key+"/", "", "", bucketPrefix, fetchOwner, false, encodingTypeUrl)) contents = append(contents, newListEntry(entry, key+"/", "", "", bucketPrefix, fetchOwner, false, encodingTypeUrl))
cursor.maxKeys-- cursor.maxKeys--
return return
} }
if entry.IsDirectory { if entry.IsDirectory {
// glog.V(0).Infof("append commonPrefixes %s", key+"/")
var prefixKey string var prefixKey string
if encodingTypeUrl { if encodingTypeUrl {
prefixKey = urlPathEscape(key + "/") prefixKey = urlPathEscape(key + "/")
@ -327,13 +324,6 @@ type ListingCursor struct {
nextMarker string nextMarker string
} }
func (l *ListingCursor) Decrease() {
l.maxKeys--
if l.maxKeys == 0 {
l.isTruncated = true
}
}
func getStartFileFromKey(key string) string { func getStartFileFromKey(key string) string {
idx := strings.LastIndex(key, "/") idx := strings.LastIndex(key, "/")
if idx == -1 { if idx == -1 {

6
weed/server/filer_grpc_server.go

@ -47,10 +47,10 @@ func (fs *FilerServer) ListEntries(req *filer_pb.ListEntriesRequest, stream file
} }
paginationLimit := filer.PaginationSize 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 paginationLimit = limit
if req.Recursive {
// for skipping parent folders
if req.Recursive && !req.Delimiter {
paginationLimit *= 2 paginationLimit *= 2
} }
} }

Loading…
Cancel
Save