Add log for port changed or proto unmarshal error

Signed-off-by: zhenshan.cao <zhenshan.cao@zilliz.com>
pull/4973/head^2
zhenshan.cao 2021-03-30 20:19:30 +08:00 committed by yefu.chen
parent 8f58d5641b
commit efbf4452c5
10 changed files with 19 additions and 14 deletions

View File

@ -71,7 +71,7 @@ func (meta *meta) reloadFromKV() error {
segmentInfo := &datapb.SegmentInfo{} segmentInfo := &datapb.SegmentInfo{}
err = proto.UnmarshalText(value, segmentInfo) err = proto.UnmarshalText(value, segmentInfo)
if err != nil { if err != nil {
return err return fmt.Errorf("DataService reloadFromKV UnMarshalText datapb.SegmentInfo err:%w", err)
} }
meta.segID2Info[segmentInfo.SegmentID] = segmentInfo meta.segID2Info[segmentInfo.SegmentID] = segmentInfo
} }

View File

@ -730,7 +730,7 @@ func (s *Server) GetInsertBinlogPaths(ctx context.Context, req *datapb.GetInsert
tMeta := &datapb.SegmentFieldBinlogMeta{} tMeta := &datapb.SegmentFieldBinlogMeta{}
for _, v := range values { for _, v := range values {
if err := proto.UnmarshalText(v, tMeta); err != nil { if err := proto.UnmarshalText(v, tMeta); err != nil {
resp.Status.Reason = err.Error() resp.Status.Reason = fmt.Errorf("DataService GetInsertBinlogPaths UnmarshalText datapb.SegmentFieldBinlogMeta err:%w", err).Error()
return resp, nil return resp, nil
} }
m[tMeta.FieldID] = append(m[tMeta.FieldID], tMeta.BinlogPath) m[tMeta.FieldID] = append(m[tMeta.FieldID], tMeta.BinlogPath)

View File

@ -141,6 +141,7 @@ func (s *Server) init() error {
Params.Init() Params.Init()
if !funcutil.CheckPortAvailable(Params.Port) { if !funcutil.CheckPortAvailable(Params.Port) {
Params.Port = funcutil.GetAvailablePort() Params.Port = funcutil.GetAvailablePort()
log.Warn("DataNode init", zap.Any("Port", Params.Port))
} }
Params.LoadFromEnv() Params.LoadFromEnv()
Params.LoadFromArgs() Params.LoadFromArgs()

View File

@ -88,6 +88,7 @@ func (s *Server) init() error {
Params.Init() Params.Init()
if !funcutil.CheckPortAvailable(Params.Port) { if !funcutil.CheckPortAvailable(Params.Port) {
Params.Port = funcutil.GetAvailablePort() Params.Port = funcutil.GetAvailablePort()
log.Warn("IndexNode init", zap.Any("Port", Params.Port))
} }
Params.LoadFromEnv() Params.LoadFromEnv()
Params.LoadFromArgs() Params.LoadFromArgs()

View File

@ -123,6 +123,7 @@ func (s *Server) init() error {
Params.Init() Params.Init()
if !funcutil.CheckPortAvailable(Params.Port) { if !funcutil.CheckPortAvailable(Params.Port) {
Params.Port = funcutil.GetAvailablePort() Params.Port = funcutil.GetAvailablePort()
log.Warn("ProxyNode init", zap.Any("Port", Params.Port))
} }
Params.LoadFromEnv() Params.LoadFromEnv()
Params.LoadFromArgs() Params.LoadFromArgs()

View File

@ -57,7 +57,7 @@ func (mt *metaTable) reloadFromKV() error {
indexMeta := indexpb.IndexMeta{} indexMeta := indexpb.IndexMeta{}
err = proto.UnmarshalText(value, &indexMeta) err = proto.UnmarshalText(value, &indexMeta)
if err != nil { if err != nil {
return err return fmt.Errorf("IndexService metaTable reloadFromKV UnmarshalText indexpb.IndexMeta err:%w", err)
} }
mt.indexBuildID2Meta[indexMeta.IndexBuildID] = indexMeta mt.indexBuildID2Meta[indexMeta.IndexBuildID] = indexMeta
} }

View File

@ -14,6 +14,7 @@
package log package log
import ( import (
"fmt"
"os" "os"
"sync/atomic" "sync/atomic"
@ -59,7 +60,7 @@ func InitLoggerWithWriteSyncer(cfg *Config, output zapcore.WriteSyncer, opts ...
level := zap.NewAtomicLevel() level := zap.NewAtomicLevel()
err := level.UnmarshalText([]byte(cfg.Level)) err := level.UnmarshalText([]byte(cfg.Level))
if err != nil { if err != nil {
return nil, nil, err return nil, nil, fmt.Errorf("InitLoggerWithWriteSyncer UnmarshalText cfg.Level err:%w", err)
} }
core := NewTextCore(newZapTextEncoder(cfg), output, level) core := NewTextCore(newZapTextEncoder(cfg), output, level)
opts = append(cfg.buildOptions(output), opts...) opts = append(cfg.buildOptions(output), opts...)

View File

@ -87,7 +87,7 @@ func (mt *metaTable) reloadFromKV() error {
tenantMeta := pb.TenantMeta{} tenantMeta := pb.TenantMeta{}
err := proto.UnmarshalText(value, &tenantMeta) err := proto.UnmarshalText(value, &tenantMeta)
if err != nil { if err != nil {
return err return fmt.Errorf("MasterService UnmarshalText pb.TenantMeta err:%w", err)
} }
mt.tenantID2Meta[tenantMeta.ID] = tenantMeta mt.tenantID2Meta[tenantMeta.ID] = tenantMeta
} }
@ -101,7 +101,7 @@ func (mt *metaTable) reloadFromKV() error {
proxyMeta := pb.ProxyMeta{} proxyMeta := pb.ProxyMeta{}
err = proto.UnmarshalText(value, &proxyMeta) err = proto.UnmarshalText(value, &proxyMeta)
if err != nil { if err != nil {
return err return fmt.Errorf("MasterService UnmarshalText pb.ProxyMeta err:%w", err)
} }
mt.proxyID2Meta[proxyMeta.ID] = proxyMeta mt.proxyID2Meta[proxyMeta.ID] = proxyMeta
} }
@ -115,7 +115,7 @@ func (mt *metaTable) reloadFromKV() error {
collectionInfo := pb.CollectionInfo{} collectionInfo := pb.CollectionInfo{}
err = proto.UnmarshalText(value, &collectionInfo) err = proto.UnmarshalText(value, &collectionInfo)
if err != nil { if err != nil {
return err return fmt.Errorf("MasterService UnmarshalText pb.CollectionInfo err:%w", err)
} }
mt.collID2Meta[collectionInfo.ID] = collectionInfo mt.collID2Meta[collectionInfo.ID] = collectionInfo
mt.collName2ID[collectionInfo.Schema.Name] = collectionInfo.ID mt.collName2ID[collectionInfo.Schema.Name] = collectionInfo.ID
@ -132,7 +132,7 @@ func (mt *metaTable) reloadFromKV() error {
partitionInfo := pb.PartitionInfo{} partitionInfo := pb.PartitionInfo{}
err = proto.UnmarshalText(value, &partitionInfo) err = proto.UnmarshalText(value, &partitionInfo)
if err != nil { if err != nil {
return err return fmt.Errorf("MasterService UnmarshalText PartitionInfo err:%w", err)
} }
collID, ok := mt.partitionID2CollID[partitionInfo.PartitionID] collID, ok := mt.partitionID2CollID[partitionInfo.PartitionID]
if !ok { if !ok {
@ -155,7 +155,7 @@ func (mt *metaTable) reloadFromKV() error {
segmentIndexInfo := pb.SegmentIndexInfo{} segmentIndexInfo := pb.SegmentIndexInfo{}
err = proto.UnmarshalText(value, &segmentIndexInfo) err = proto.UnmarshalText(value, &segmentIndexInfo)
if err != nil { if err != nil {
return err return fmt.Errorf("MasterService UnmarshalText pb.SegmentIndexInfo err:%w", err)
} }
idx, ok := mt.segID2IndexMeta[segmentIndexInfo.SegmentID] idx, ok := mt.segID2IndexMeta[segmentIndexInfo.SegmentID]
if ok { if ok {
@ -175,7 +175,7 @@ func (mt *metaTable) reloadFromKV() error {
meta := pb.IndexInfo{} meta := pb.IndexInfo{}
err = proto.UnmarshalText(value, &meta) err = proto.UnmarshalText(value, &meta)
if err != nil { if err != nil {
return err return fmt.Errorf("MasterService UnmarshalText pb.IndexInfo err:%w", err)
} }
mt.indexID2Meta[meta.IndexID] = meta mt.indexID2Meta[meta.IndexID] = meta
} }

View File

@ -3,6 +3,7 @@ package proxynode
import ( import (
"context" "context"
"errors" "errors"
"fmt"
"os" "os"
"strconv" "strconv"
@ -1115,7 +1116,7 @@ func (node *ProxyNode) GetPersistentSegmentInfo(ctx context.Context, req *milvus
} }
segments, err := node.getSegmentsOfCollection(ctx, req.DbName, req.CollectionName) segments, err := node.getSegmentsOfCollection(ctx, req.DbName, req.CollectionName)
if err != nil { if err != nil {
resp.Status.Reason = err.Error() resp.Status.Reason = fmt.Errorf("getSegmentsOfCollection, err:%w", err).Error()
return resp, nil return resp, nil
} }
infoResp, err := node.dataService.GetSegmentInfo(ctx, &datapb.GetSegmentInfoRequest{ infoResp, err := node.dataService.GetSegmentInfo(ctx, &datapb.GetSegmentInfoRequest{
@ -1128,7 +1129,7 @@ func (node *ProxyNode) GetPersistentSegmentInfo(ctx context.Context, req *milvus
SegmentIDs: segments, SegmentIDs: segments,
}) })
if err != nil { if err != nil {
resp.Status.Reason = err.Error() resp.Status.Reason = fmt.Errorf("dataService:GetSegmentInfo, err:%w", err).Error()
return resp, nil return resp, nil
} }
if infoResp.Status.ErrorCode != commonpb.ErrorCode_Success { if infoResp.Status.ErrorCode != commonpb.ErrorCode_Success {

View File

@ -206,7 +206,7 @@ func (mService *metaService) collectionUnmarshal(value string) *etcdpb.Collectio
col := etcdpb.CollectionInfo{} col := etcdpb.CollectionInfo{}
err := proto.UnmarshalText(value, &col) err := proto.UnmarshalText(value, &col)
if err != nil { if err != nil {
log.Error(err.Error()) log.Error(fmt.Errorf("QueryNode metaService UnmarshalText etcdpb.CollectionInfo err:%w", err).Error())
return nil return nil
} }
return &col return &col
@ -225,7 +225,7 @@ func (mService *metaService) segmentUnmarshal(value string) *datapb.SegmentInfo
seg := datapb.SegmentInfo{} seg := datapb.SegmentInfo{}
err := proto.UnmarshalText(value, &seg) err := proto.UnmarshalText(value, &seg)
if err != nil { if err != nil {
log.Error(err.Error()) log.Error(fmt.Errorf("QueryNode metaService UnmarshalText datapb.SegmentInfo err:%w", err).Error())
return nil return nil
} }
return &seg return &seg