From 406ea4f281de4acf2b37a0df685400906855e7e8 Mon Sep 17 00:00:00 2001 From: Klaus Post Date: Tue, 15 Aug 2023 07:45:25 -0700 Subject: [PATCH] Fix distributed listing not able to resume (#17855) Two fields in lifecycles made GOB encoding consistently fail with `gob: type lifecycle.Prefix has no exported fields`. This meant that in distributed systems listings would never be able to continue and would restart on every call. Fix issues and be sure to log these errors at least once per bucket. We may see some connectivity errors here, but we shouldn't hide them. --- cmd/metacache-server-pool.go | 3 ++- internal/bucket/lifecycle/expiration.go | 5 +++-- internal/bucket/lifecycle/prefix.go | 3 ++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/cmd/metacache-server-pool.go b/cmd/metacache-server-pool.go index e6a7c7f23..4c972b5f5 100644 --- a/cmd/metacache-server-pool.go +++ b/cmd/metacache-server-pool.go @@ -129,7 +129,8 @@ func (z *erasureServerPools) listPath(ctx context.Context, o *listPathOptions) ( return entries, io.EOF } if !errors.Is(err, context.DeadlineExceeded) { - o.debugln("listPath: got error", err) + // Report error once per bucket, but continue listing. + logger.LogOnceIf(ctx, err, "GetMetacacheListing:"+o.Bucket) } o.Transient = true o.Create = false diff --git a/internal/bucket/lifecycle/expiration.go b/internal/bucket/lifecycle/expiration.go index 41dbbd613..064595e1e 100644 --- a/internal/bucket/lifecycle/expiration.go +++ b/internal/bucket/lifecycle/expiration.go @@ -105,8 +105,9 @@ type ExpireDeleteMarker struct { // Boolean signifies a boolean XML struct with custom marshaling type Boolean struct { - val bool - set bool + val bool + set bool + Unused struct{} // Needed for GOB compatibility } // Expiration - expiration actions for a rule in lifecycle configuration. diff --git a/internal/bucket/lifecycle/prefix.go b/internal/bucket/lifecycle/prefix.go index 4651b9edf..a2015669e 100644 --- a/internal/bucket/lifecycle/prefix.go +++ b/internal/bucket/lifecycle/prefix.go @@ -24,7 +24,8 @@ import ( // Prefix holds the prefix xml tag in and type Prefix struct { string - set bool + set bool + Unused struct{} // Needed for GOB compatibility } // UnmarshalXML - decodes XML data.