提交 c172af78 编写于 作者: C congqixia 提交者: zhenshan.cao

Add dataservice state check (#5687)

Signed-off-by: NCongqi Xia <congqi.xia@zilliz.com>
上级 1727edb5
......@@ -194,6 +194,10 @@ func (s *Server) GetInsertBinlogPaths(ctx context.Context, req *datapb.GetInsert
ErrorCode: commonpb.ErrorCode_UnexpectedError,
},
}
if s.isClosed() {
resp.Status.Reason = "server is initializing"
return resp, nil
}
p := path.Join(Params.SegmentBinlogSubPath, strconv.FormatInt(req.SegmentID, 10)) + "/" // prefix/id/ instead of prefix/id
_, values, err := s.kvClient.LoadWithPrefix(p)
if err != nil {
......@@ -237,6 +241,10 @@ func (s *Server) GetCollectionStatistics(ctx context.Context, req *datapb.GetCol
ErrorCode: commonpb.ErrorCode_UnexpectedError,
},
}
if s.isClosed() {
resp.Status.Reason = "server is initializing"
return resp, nil
}
nums, err := s.meta.GetNumRowsOfCollection(req.CollectionID)
if err != nil {
resp.Status.Reason = err.Error()
......@@ -253,6 +261,10 @@ func (s *Server) GetPartitionStatistics(ctx context.Context, req *datapb.GetPart
ErrorCode: commonpb.ErrorCode_UnexpectedError,
},
}
if s.isClosed() {
resp.Status.Reason = "server is initializing"
return resp, nil
}
nums, err := s.meta.GetNumRowsOfPartition(req.CollectionID, req.PartitionID)
if err != nil {
resp.Status.Reason = err.Error()
......@@ -380,6 +392,10 @@ func (s *Server) GetRecoveryInfo(ctx context.Context, req *datapb.GetRecoveryInf
ErrorCode: commonpb.ErrorCode_UnexpectedError,
},
}
if s.isClosed() {
resp.Status.Reason = "server is initializing"
return resp, nil
}
segmentIDs := s.meta.GetSegmentsOfPartition(collectionID, partitionID)
segment2Binlogs := make(map[UniqueID][]*datapb.FieldBinlog)
for _, id := range segmentIDs {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册