From c5f208e50ab42c2c75fc87024163ed819c006a56 Mon Sep 17 00:00:00 2001 From: Ryan Leung Date: Wed, 7 Jun 2023 16:23:42 +0800 Subject: [PATCH] *: fix some log issues (#6568) ref tikv/pd#5895, ref tikv/pd#6390 Signed-off-by: Ryan Leung --- pkg/utils/etcdutil/etcdutil.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/pkg/utils/etcdutil/etcdutil.go b/pkg/utils/etcdutil/etcdutil.go index 6cc58a20070..6e2ea801460 100644 --- a/pkg/utils/etcdutil/etcdutil.go +++ b/pkg/utils/etcdutil/etcdutil.go @@ -541,17 +541,19 @@ func (lw *LoopWatcher) watch(ctx context.Context, revision int64) (nextRevision if err := lw.putFn(event.Kv); err != nil { log.Error("put failed in watch loop", zap.String("name", lw.name), zap.String("key", lw.key), zap.Error(err)) + } else { + log.Debug("put in watch loop", zap.String("name", lw.name), + zap.ByteString("key", event.Kv.Key), + zap.ByteString("value", event.Kv.Value)) } - log.Debug("put in watch loop", zap.String("name", lw.name), - zap.ByteString("key", event.Kv.Key), - zap.ByteString("value", event.Kv.Value)) case clientv3.EventTypeDelete: if err := lw.deleteFn(event.Kv); err != nil { log.Error("delete failed in watch loop", zap.String("name", lw.name), zap.String("key", lw.key), zap.Error(err)) + } else { + log.Debug("delete in watch loop", zap.String("name", lw.name), + zap.ByteString("key", event.Kv.Key)) } - log.Debug("delete in watch loop", zap.String("name", lw.name), - zap.ByteString("key", event.Kv.Key)) } } if err := lw.postEventFn(); err != nil { @@ -602,7 +604,6 @@ func (lw *LoopWatcher) load(ctx context.Context) (nextRevision int64, err error) log.Error("run post event failed in watch loop", zap.String("name", lw.name), zap.String("key", lw.key), zap.Error(err)) } - log.Info("load finished in watch loop", zap.String("name", lw.name), zap.String("key", lw.key)) return resp.Header.Revision + 1, err } }