From 401958938dbfe8ba87f146ed5dc085d59ceaa936 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Fri, 25 Mar 2022 03:41:31 -0700 Subject: [PATCH] add load balance properly restClientFromHash() bucket/prefix (#14621) spread out resuming further to other nodes --- cmd/metacache-server-pool.go | 6 +++--- cmd/metacache-set.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cmd/metacache-server-pool.go b/cmd/metacache-server-pool.go index 7d350630b..19a5cead6 100644 --- a/cmd/metacache-server-pool.go +++ b/cmd/metacache-server-pool.go @@ -111,7 +111,7 @@ func (z *erasureServerPools) listPath(ctx context.Context, o *listPathOptions) ( // If we don't have a list id we must ask the server if it has a cache or create a new. if o.ID != "" && !o.Transient { // Create or ping with handout... - rpc := globalNotificationSys.restClientFromHash(o.Bucket) + rpc := globalNotificationSys.restClientFromHash(pathJoin(o.Bucket, o.Prefix)) ctx, cancel := context.WithTimeout(ctx, 5*time.Second) defer cancel() var c *metacache @@ -199,7 +199,7 @@ func (z *erasureServerPools) listPath(ctx context.Context, o *listPathOptions) ( } entries.truncate(0) go func() { - rpc := globalNotificationSys.restClientFromHash(o.Bucket) + rpc := globalNotificationSys.restClientFromHash(pathJoin(o.Bucket, o.Prefix)) if rpc != nil { ctx, cancel := context.WithTimeout(GlobalContext, 5*time.Second) defer cancel() @@ -415,7 +415,7 @@ func (z *erasureServerPools) listAndSave(ctx context.Context, o *listPathOptions filteredResults := o.gatherResults(ctx, outCh) mc := o.newMetacache() - meta := metaCacheRPC{meta: &mc, cancel: cancel, rpc: globalNotificationSys.restClientFromHash(o.Bucket), o: *o} + meta := metaCacheRPC{meta: &mc, cancel: cancel, rpc: globalNotificationSys.restClientFromHash(pathJoin(o.Bucket, o.Prefix)), o: *o} // Save listing... go func() { diff --git a/cmd/metacache-set.go b/cmd/metacache-set.go index 3639c1888..7a03c081a 100644 --- a/cmd/metacache-set.go +++ b/cmd/metacache-set.go @@ -361,7 +361,7 @@ func (r *metacacheReader) filter(o listPathOptions) (entries metaCacheEntriesSor func (er *erasureObjects) streamMetadataParts(ctx context.Context, o listPathOptions) (entries metaCacheEntriesSorted, err error) { retries := 0 - rpc := globalNotificationSys.restClientFromHash(o.Bucket) + rpc := globalNotificationSys.restClientFromHash(pathJoin(o.Bucket, o.Prefix)) for { if contextCanceled(ctx) {