From c4f29d24daad7bcd838ea150d8e0e3b8b41c66a9 Mon Sep 17 00:00:00 2001 From: Anis Elleuch Date: Sat, 12 Dec 2020 02:54:31 +0100 Subject: [PATCH] metacache: Ask all disks when drive count is 4 (#11087) --- cmd/metacache-set.go | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/cmd/metacache-set.go b/cmd/metacache-set.go index 717db4741..045e85b3b 100644 --- a/cmd/metacache-set.go +++ b/cmd/metacache-set.go @@ -549,6 +549,10 @@ func (er *erasureObjects) streamMetadataParts(ctx context.Context, o listPathOpt } } +func (er erasureObjects) SetDriveCount() int { + return er.setDriveCount +} + // Will return io.EOF if continuing would not yield more results. func (er *erasureObjects) listPath(ctx context.Context, o listPathOptions) (entries metaCacheEntriesSorted, err error) { const debugPrint = false @@ -612,6 +616,14 @@ func (er *erasureObjects) listPath(ctx context.Context, o listPathOptions) (entr askDisks = getReadQuorum(er.SetDriveCount()) } + listingQuorum := askDisks - 1 + + // Special case: ask all disks if the drive count is 4 + if er.SetDriveCount() == 4 { + askDisks = len(disks) + listingQuorum = 2 + } + if len(disks) < askDisks { err = InsufficientReadQuorum{} logger.LogIf(ctx, fmt.Errorf("listPath: Insufficient disks, %d of %d needed are available", len(disks), askDisks)) @@ -715,8 +727,8 @@ func (er *erasureObjects) listPath(ctx context.Context, o listPathOptions) (entr // How to resolve results. resolver := metadataResolutionParams{ - dirQuorum: askDisks - 1, - objQuorum: askDisks - 1, + dirQuorum: listingQuorum, + objQuorum: listingQuorum, bucket: o.Bucket, } @@ -726,7 +738,7 @@ func (er *erasureObjects) listPath(ctx context.Context, o listPathOptions) (entr path: o.BaseDir, recursive: o.Recursive, filterPrefix: o.FilterPrefix, - minDisks: askDisks - 1, + minDisks: listingQuorum, agreed: func(entry metaCacheEntry) { cacheCh <- entry filterCh <- entry