use list cache for Walk() with webUI and quota (#10814)

bring list cache optimizations for web UI
object listing, also FIFO quota enforcement
through list cache as well.
This commit is contained in:
Harshavardhana
2020-11-03 08:53:48 -08:00
committed by GitHub
parent 68de5a6f6a
commit ad382799b1
2 changed files with 33 additions and 150 deletions
+6 -7
View File
@@ -99,7 +99,8 @@ func (z *erasureServerSets) listPath(ctx context.Context, o listPathOptions) (en
if err != nil {
if errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded) {
// Context is canceled, return at once.
return entries, err
// request canceled, no entries to return
return entries, io.EOF
}
logger.LogIf(ctx, err)
cache = localMetacacheMgr.getTransient().findCache(o)
@@ -109,17 +110,14 @@ func (z *erasureServerSets) listPath(ctx context.Context, o listPathOptions) (en
}
}
if cache.fileNotFound {
return entries, errFileNotFound
// No cache found, no entries found.
return entries, io.EOF
}
// Only create if we created a new.
o.Create = o.ID == cache.id
o.ID = cache.id
}
if o.AskDisks == 0 {
o.AskDisks = globalAPIConfig.getListQuorum()
}
var mu sync.Mutex
var wg sync.WaitGroup
var errs []error
@@ -175,7 +173,8 @@ func (z *erasureServerSets) listPath(ctx context.Context, o listPathOptions) (en
cache.fileNotFound = true
_, err := o.updateMetacacheListing(cache, globalNotificationSys.restClientFromHash(o.Bucket))
logger.LogIf(ctx, err)
return entries, errFileNotFound
// cache returned not found, entries truncated.
return entries, io.EOF
}
for _, err := range errs {