From 76bfd419520ea90715838cd47f8c78b50b50c25a Mon Sep 17 00:00:00 2001 From: Bingyi Sun Date: Mon, 9 May 2022 16:25:52 +0800 Subject: [PATCH] Refine DataNode logs. (#16849) Signed-off-by: sunby Co-authored-by: sunby --- internal/util/sessionutil/session_util.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/util/sessionutil/session_util.go b/internal/util/sessionutil/session_util.go index 964f7c296f..45756218ce 100644 --- a/internal/util/sessionutil/session_util.go +++ b/internal/util/sessionutil/session_util.go @@ -197,7 +197,7 @@ func (s *Session) getServerIDWithKey(key string) (int64, error) { // it is false. Otherwise, set it to true. func (s *Session) registerService() (<-chan *clientv3.LeaseKeepAliveResponse, error) { var ch <-chan *clientv3.LeaseKeepAliveResponse - log.Debug("Session Register Begin", zap.String("ServerName", s.ServerName)) + log.Debug("DataNode begin to register to etcd", zap.String("serverName", s.ServerName)) registerFn := func() error { resp, err := s.etcdCli.Grant(s.ctx, DefaultTTL) if err != nil { @@ -223,7 +223,7 @@ func (s *Session) registerService() (<-chan *clientv3.LeaseKeepAliveResponse, er Then(clientv3.OpPut(path.Join(s.metaRoot, DefaultServiceRoot, key), string(sessionJSON), clientv3.WithLease(resp.ID))).Commit() if err != nil { - log.Warn("compare and swap error, maybe the key has ben registered", zap.Error(err)) + log.Warn("compare and swap error, maybe the key has already been registered", zap.Error(err)) return err } @@ -235,10 +235,10 @@ func (s *Session) registerService() (<-chan *clientv3.LeaseKeepAliveResponse, er s.keepAliveCancel = keepAliveCancel ch, err = s.etcdCli.KeepAlive(keepAliveCtx, resp.ID) if err != nil { - fmt.Printf("keep alive error %s\n", err) + fmt.Printf("got error during keeping alive with etcd, err: %s\n", err) return err } - log.Debug("Session register successfully", zap.Int64("ServerID", s.ServerID)) + log.Info("DataNode registered successfully", zap.Int64("serverID", s.ServerID)) return nil } err := retry.Do(s.ctx, registerFn, retry.Attempts(DefaultRetryTimes))