Refine DataNode logs. (#16849)

Signed-off-by: sunby <bingyi.sun@zilliz.com>

Co-authored-by: sunby <bingyi.sun@zilliz.com>
pull/16884/head
Bingyi Sun 2022-05-09 16:25:52 +08:00 committed by GitHub
parent d1c58833a4
commit 76bfd41952
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -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))