提交 efbf4452 编写于 作者: Z zhenshan.cao 提交者: yefu.chen

Add log for port changed or proto unmarshal error

Signed-off-by: Nzhenshan.cao <zhenshan.cao@zilliz.com>
上级 8f58d564
......@@ -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
}
......
......@@ -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)
......
......@@ -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()
......
......@@ -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()
......
......@@ -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()
......
......@@ -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
}
......
......@@ -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...)
......
......@@ -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
}
......
......@@ -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 {
......
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册