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{}
err = proto.UnmarshalText(value, segmentInfo)
if err != nil {
return err
return fmt.Errorf("DataService reloadFromKV UnMarshalText datapb.SegmentInfo err:%w", err)
}
meta.segID2Info[segmentInfo.SegmentID] = segmentInfo
}

View File

@ -730,7 +730,7 @@ func (s *Server) GetInsertBinlogPaths(ctx context.Context, req *datapb.GetInsert
tMeta := &datapb.SegmentFieldBinlogMeta{}
for _, v := range values {
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
}
m[tMeta.FieldID] = append(m[tMeta.FieldID], tMeta.BinlogPath)

View File

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

View File

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

View File

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

View File

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

View File

@ -14,6 +14,7 @@
package log
import (
"fmt"
"os"
"sync/atomic"
@ -59,7 +60,7 @@ func InitLoggerWithWriteSyncer(cfg *Config, output zapcore.WriteSyncer, opts ...
level := zap.NewAtomicLevel()
err := level.UnmarshalText([]byte(cfg.Level))
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)
opts = append(cfg.buildOptions(output), opts...)

View File

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

View File

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

View File

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