From feabd0430cafad95507f506da9d766db1c67e6cd Mon Sep 17 00:00:00 2001 From: Anis Elleuch Date: Mon, 18 Oct 2021 16:43:04 +0100 Subject: [PATCH] etcd: Add logs for unusual failures (#13460) etcd operations, get/put/delete, should be logged when failed with errors other than not found error. It will make it easier to see connections issues from MinIO to etcd. --- cmd/etcd.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmd/etcd.go b/cmd/etcd.go index 193c36ce5..fba11f252 100644 --- a/cmd/etcd.go +++ b/cmd/etcd.go @@ -22,6 +22,7 @@ import ( "errors" "fmt" + "github.com/minio/minio/internal/logger" etcd "go.etcd.io/etcd/client/v3" ) @@ -47,6 +48,7 @@ func saveKeyEtcdWithTTL(ctx context.Context, client *etcd.Client, key string, da return etcdErrToErr(err, client.Endpoints()) } _, err = client.Put(timeoutCtx, key, string(data), etcd.WithLease(lease.ID)) + logger.LogIf(ctx, err) return etcdErrToErr(err, client.Endpoints()) } @@ -57,6 +59,7 @@ func saveKeyEtcd(ctx context.Context, client *etcd.Client, key string, data []by return saveKeyEtcdWithTTL(ctx, client, key, data, opts[0].ttl) } _, err := client.Put(timeoutCtx, key, string(data)) + logger.LogIf(ctx, err) return etcdErrToErr(err, client.Endpoints()) } @@ -65,6 +68,7 @@ func deleteKeyEtcd(ctx context.Context, client *etcd.Client, key string) error { defer cancel() _, err := client.Delete(timeoutCtx, key) + logger.LogIf(ctx, err) return etcdErrToErr(err, client.Endpoints()) } @@ -73,6 +77,7 @@ func readKeyEtcd(ctx context.Context, client *etcd.Client, key string) ([]byte, defer cancel() resp, err := client.Get(timeoutCtx, key) if err != nil { + logger.LogIf(ctx, err) return nil, etcdErrToErr(err, client.Endpoints()) } if resp.Count == 0 {