mirror of https://github.com/milvus-io/milvus.git
Add dataservice state check (#5687)
Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>pull/5779/head
parent
1727edb5d3
commit
c172af78bd
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue