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

Fix GetSegmentStates

Signed-off-by: Nzhenshan.cao <zhenshan.cao@zilliz.com>
上级 5de89422
......@@ -132,7 +132,7 @@ func (ddNode *ddNode) Operate(in []*Msg) []*Msg {
}
default:
log.Println(". default: do nothing ...")
//log.Println(". default: do nothing ...")
}
// generate binlog
......
......@@ -623,18 +623,28 @@ func (s *Server) GetSegmentStates(req *datapb.SegmentStatesRequest) (*datapb.Seg
return resp, nil
}
segmentInfo, err := s.meta.GetSegment(req.SegmentID)
if err != nil {
resp.Status.Reason = "get segment states error: " + err.Error()
return resp, nil
for _, segmentID := range req.SegmentIDs {
state := &datapb.SegmentStateInfo{
Status: &commonpb.Status{},
SegmentID: segmentID,
}
segmentInfo, err := s.meta.GetSegment(segmentID)
if err != nil {
state.Status.ErrorCode = commonpb.ErrorCode_UNEXPECTED_ERROR
state.Status.Reason = "get segment states error: " + err.Error()
} else {
state.Status.ErrorCode = commonpb.ErrorCode_SUCCESS
state.State = segmentInfo.State
state.CreateTime = segmentInfo.OpenTime
state.SealedTime = segmentInfo.SealedTime
state.FlushedTime = segmentInfo.FlushedTime
state.StartPositions = segmentInfo.StartPosition
state.EndPositions = segmentInfo.EndPosition
}
resp.States = append(resp.States, state)
}
resp.Status.ErrorCode = commonpb.ErrorCode_SUCCESS
resp.State = segmentInfo.State
resp.CreateTime = segmentInfo.OpenTime
resp.SealedTime = segmentInfo.SealedTime
resp.FlushedTime = segmentInfo.FlushedTime
resp.StartPositions = segmentInfo.StartPosition
resp.EndPositions = segmentInfo.EndPosition
return resp, nil
}
......
......@@ -1271,7 +1271,7 @@ func (c *Core) AllocTimestamp(in *masterpb.TsoRequest) (*masterpb.TsoResponse, e
Count: 0,
}, nil
}
log.Printf("AllocTimestamp : %d", ts)
// log.Printf("AllocTimestamp : %d", ts)
return &masterpb.TsoResponse{
Status: &commonpb.Status{
ErrorCode: commonpb.ErrorCode_SUCCESS,
......
......@@ -82,17 +82,23 @@ enum SegmentState {
message SegmentStatesRequest {
common.MsgBase base = 1;
int64 segmentID = 2;
repeated int64 segmentIDs = 2;
}
message SegmentStateInfo {
int64 segmentID = 1;
SegmentState state = 2;
uint64 create_time = 3;
uint64 sealed_time = 4;
uint64 flushed_time = 5;
repeated internal.MsgPosition start_positions = 6;
repeated internal.MsgPosition end_positions = 7;
common.Status status = 8;
}
message SegmentStatesResponse {
SegmentState state = 1;
uint64 create_time = 2;
uint64 sealed_time = 3;
uint64 flushed_time = 4;
repeated internal.MsgPosition start_positions = 5;
repeated internal.MsgPosition end_positions = 6;
common.Status status = 7;
common.Status status = 1;
repeated SegmentStateInfo states = 2;
}
message InsertBinlogPathRequest {
......@@ -128,15 +134,15 @@ message FlushSegRequest {
}
message SegmentInfo {
int64 segmentID=1;
int64 collectionID =2;
int64 partitionID=3;
int64 segmentID = 1;
int64 collectionID = 2;
int64 partitionID = 3;
repeated string insert_channels = 4;
uint64 open_time=5;
uint64 open_time = 5;
uint64 sealed_time = 6;
uint64 flushed_time = 7;
int64 num_rows=8;
int64 mem_size=9;
int64 num_rows = 8;
int64 mem_size = 9;
SegmentState state = 10;
repeated internal.MsgPosition start_position = 11;
repeated internal.MsgPosition end_position = 12;
......@@ -171,41 +177,41 @@ message PartitionStatsResponse {
}
message FieldFlushMeta {
int64 fieldID = 1;
repeated string binlog_paths = 2;
int64 fieldID = 1;
repeated string binlog_paths = 2;
}
message SegmentFlushMeta{
int64 segmentID = 1;
bool is_flushed = 2;
repeated FieldFlushMeta fields = 5;
int64 segmentID = 1;
bool is_flushed = 2;
repeated FieldFlushMeta fields = 5;
}
message DDLFlushMeta {
int64 collectionID = 1;
repeated string binlog_paths = 2;
int64 collectionID = 1;
repeated string binlog_paths = 2;
}
service DataService {
rpc RegisterNode(RegisterNodeRequest) returns (RegisterNodeResponse) {}
rpc Flush(FlushRequest) returns (common.Status) {}
rpc RegisterNode(RegisterNodeRequest) returns (RegisterNodeResponse) {}
rpc Flush(FlushRequest) returns (common.Status) {}
rpc AssignSegmentID(AssignSegIDRequest) returns (AssignSegIDResponse) {}
rpc ShowSegments(ShowSegmentRequest) returns (ShowSegmentResponse) {}
rpc AssignSegmentID(AssignSegIDRequest) returns (AssignSegIDResponse) {}
rpc ShowSegments(ShowSegmentRequest) returns (ShowSegmentResponse) {}
rpc GetSegmentStates(SegmentStatesRequest) returns (SegmentStatesResponse) {}
rpc GetInsertBinlogPaths(InsertBinlogPathRequest) returns (InsertBinlogPathsResponse) {}
rpc GetSegmentStates(SegmentStatesRequest) returns (SegmentStatesResponse) {}
rpc GetInsertBinlogPaths(InsertBinlogPathRequest) returns (InsertBinlogPathsResponse) {}
rpc GetInsertChannels(InsertChannelRequest) returns (internal.StringList) {}
rpc GetCollectionStatistics(CollectionStatsRequest) returns (CollectionStatsResponse) {}
rpc GetPartitionStatistics(PartitionStatsRequest) returns (PartitionStatsResponse) {}
rpc GetInsertChannels(InsertChannelRequest) returns (internal.StringList) {}
rpc GetCollectionStatistics(CollectionStatsRequest) returns (CollectionStatsResponse) {}
rpc GetPartitionStatistics(PartitionStatsRequest) returns (PartitionStatsResponse) {}
rpc GetComponentStates(common.Empty) returns (internal.ComponentStates) {}
rpc GetTimeTickChannel(common.Empty) returns(milvus.StringResponse) {}
rpc GetStatisticsChannel(common.Empty) returns(milvus.StringResponse){}
rpc GetComponentStates(common.Empty) returns (internal.ComponentStates) {}
rpc GetTimeTickChannel(common.Empty) returns(milvus.StringResponse) {}
rpc GetStatisticsChannel(common.Empty) returns(milvus.StringResponse){}
rpc GetSegmentInfoChannel(common.Empty) returns (milvus.StringResponse){}
rpc GetSegmentInfoChannel(common.Empty) returns (milvus.StringResponse){}
}
service DataNode {
......
......@@ -124,7 +124,7 @@ message LoadSegmentRequest {
int64 partitionID = 4;
repeated int64 segmentIDs = 5;
repeated int64 fieldIDs = 6;
data.SegmentStatesResponse last_segment_state = 7;
data.SegmentStateInfo last_segment_state = 7;
}
message ReleaseSegmentRequest {
......@@ -152,7 +152,7 @@ service QueryService {
rpc LoadCollection(LoadCollectionRequest) returns (common.Status) {}
rpc ReleaseCollection(ReleaseCollectionRequest) returns (common.Status) {}
rpc CreateQueryChannel(common.Empty ) returns (CreateQueryChannelResponse) {}
rpc CreateQueryChannel(common.Empty) returns (CreateQueryChannelResponse) {}
rpc GetTimeTickChannel(common.Empty) returns (milvus.StringResponse) {}
rpc GetStatisticsChannel(common.Empty) returns (milvus.StringResponse) {}
rpc GetPartitionStates(PartitionStatesRequest) returns (PartitionStatesResponse) {}
......
......@@ -972,16 +972,16 @@ func (m *WatchDmChannelsRequest) GetChannelIDs() []string {
}
type LoadSegmentRequest struct {
Base *commonpb.MsgBase `protobuf:"bytes,1,opt,name=base,proto3" json:"base,omitempty"`
DbID int64 `protobuf:"varint,2,opt,name=dbID,proto3" json:"dbID,omitempty"`
CollectionID int64 `protobuf:"varint,3,opt,name=collectionID,proto3" json:"collectionID,omitempty"`
PartitionID int64 `protobuf:"varint,4,opt,name=partitionID,proto3" json:"partitionID,omitempty"`
SegmentIDs []int64 `protobuf:"varint,5,rep,packed,name=segmentIDs,proto3" json:"segmentIDs,omitempty"`
FieldIDs []int64 `protobuf:"varint,6,rep,packed,name=fieldIDs,proto3" json:"fieldIDs,omitempty"`
LastSegmentState *datapb.SegmentStatesResponse `protobuf:"bytes,7,opt,name=last_segment_state,json=lastSegmentState,proto3" json:"last_segment_state,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
Base *commonpb.MsgBase `protobuf:"bytes,1,opt,name=base,proto3" json:"base,omitempty"`
DbID int64 `protobuf:"varint,2,opt,name=dbID,proto3" json:"dbID,omitempty"`
CollectionID int64 `protobuf:"varint,3,opt,name=collectionID,proto3" json:"collectionID,omitempty"`
PartitionID int64 `protobuf:"varint,4,opt,name=partitionID,proto3" json:"partitionID,omitempty"`
SegmentIDs []int64 `protobuf:"varint,5,rep,packed,name=segmentIDs,proto3" json:"segmentIDs,omitempty"`
FieldIDs []int64 `protobuf:"varint,6,rep,packed,name=fieldIDs,proto3" json:"fieldIDs,omitempty"`
LastSegmentState *datapb.SegmentStateInfo `protobuf:"bytes,7,opt,name=last_segment_state,json=lastSegmentState,proto3" json:"last_segment_state,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *LoadSegmentRequest) Reset() { *m = LoadSegmentRequest{} }
......@@ -1051,7 +1051,7 @@ func (m *LoadSegmentRequest) GetFieldIDs() []int64 {
return nil
}
func (m *LoadSegmentRequest) GetLastSegmentState() *datapb.SegmentStatesResponse {
func (m *LoadSegmentRequest) GetLastSegmentState() *datapb.SegmentStateInfo {
if m != nil {
return m.LastSegmentState
}
......@@ -1211,81 +1211,81 @@ func init() {
func init() { proto.RegisterFile("query_service.proto", fileDescriptor_5fcb6756dc1afb8d) }
var fileDescriptor_5fcb6756dc1afb8d = []byte{
// 1174 bytes of a gzipped FileDescriptorProto
// 1177 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x57, 0xdd, 0x6e, 0x1b, 0x45,
0x14, 0xf6, 0xc6, 0x4e, 0x5a, 0x9f, 0xb8, 0xb6, 0x3b, 0xf9, 0xd5, 0x82, 0xaa, 0x32, 0x40, 0x9b,
0x1f, 0x70, 0x50, 0x2a, 0x21, 0xae, 0x40, 0x49, 0x5c, 0x45, 0x96, 0x68, 0x08, 0x9b, 0x94, 0x8a,
0x40, 0x65, 0xd6, 0xbb, 0x83, 0x3d, 0xed, 0xfe, 0xb8, 0x3b, 0xe3, 0x40, 0x72, 0x03, 0x48, 0x5c,
0xc3, 0x33, 0x20, 0x10, 0x95, 0xb8, 0xe6, 0x6d, 0xb8, 0xe2, 0x11, 0x78, 0x03, 0xb4, 0xb3, 0xeb,
0xcd, 0xce, 0x7a, 0x1c,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0x29, 0xe3, 0x1e, 0xed, 0x0e, 0x39, 0x31, 0xeb, 0xa3, 0xa3, 0x53,
0x17, 0xa1, 0xea, 0x02, 0x75, 0xd0, 0xed, 0x16, 0xc4, 0xf0, 0xee, 0x7f, 0x01, 0x00, 0x00, 0xff,
0xff, 0x69, 0xea, 0xe4, 0xad, 0x06, 0x15, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
......
......@@ -80,7 +80,6 @@ func (node *NodeImpl) DropCollection(request *milvuspb.DropCollectionRequest) (*
Condition: NewTaskCondition(ctx),
DropCollectionRequest: request,
masterClient: node.masterClient,
dataServiceClient: node.dataServiceClient,
}
var cancel func()
dct.ctx, cancel = context.WithTimeout(ctx, reqTimeoutInterval)
......
......@@ -47,6 +47,7 @@ type QueryServiceClient interface {
type DataServiceClient interface {
AssignSegmentID(req *datapb.AssignSegIDRequest) (*datapb.AssignSegIDResponse, error)
GetInsertChannels(req *datapb.InsertChannelRequest) ([]string, error)
Flush(req *datapb.FlushRequest) (*commonpb.Status, error)
GetComponentStates() (*internalpb2.ComponentStates, error)
}
......
......@@ -364,10 +364,9 @@ func (cct *CreateCollectionTask) PostExecute() error {
type DropCollectionTask struct {
Condition
*milvuspb.DropCollectionRequest
masterClient MasterClient
dataServiceClient DataServiceClient
result *commonpb.Status
ctx context.Context
masterClient MasterClient
result *commonpb.Status
ctx context.Context
}
func (dct *DropCollectionTask) OnEnqueue() error {
......@@ -1376,3 +1375,70 @@ func (dipt *GetIndexStateTask) Execute() error {
func (dipt *GetIndexStateTask) PostExecute() error {
return nil
}
type FlushTask struct {
Condition
*milvuspb.FlushRequest
dataServiceClient DataServiceClient
result *commonpb.Status
ctx context.Context
}
func (ft *FlushTask) OnEnqueue() error {
ft.Base = &commonpb.MsgBase{}
return nil
}
func (ft *FlushTask) ID() UniqueID {
return ft.Base.MsgID
}
func (ft *FlushTask) SetID(uid UniqueID) {
ft.Base.MsgID = uid
}
func (ft *FlushTask) Type() commonpb.MsgType {
return ft.Base.MsgType
}
func (ft *FlushTask) BeginTs() Timestamp {
return ft.Base.Timestamp
}
func (ft *FlushTask) EndTs() Timestamp {
return ft.Base.Timestamp
}
func (ft *FlushTask) SetTs(ts Timestamp) {
ft.Base.Timestamp = ts
}
func (ft *FlushTask) PreExecute() error {
ft.Base.MsgType = commonpb.MsgType_kFlush
ft.Base.SourceID = Params.ProxyID
return nil
}
func (ft *FlushTask) Execute() error {
var err error
collID, err := globalMetaCache.GetCollectionID(ft.CollectionName)
if err != nil {
return err
}
flushReq := &datapb.FlushRequest{
Base: &commonpb.MsgBase{
MsgType: commonpb.MsgType_kFlush,
MsgID: ft.Base.MsgID,
Timestamp: ft.Base.Timestamp,
SourceID: ft.Base.SourceID,
},
DbID: 0,
CollectionID: collID,
}
ft.result, err = ft.dataServiceClient.Flush(flushReq)
return err
}
func (ft *FlushTask) PostExecute() error {
return nil
}
......@@ -67,7 +67,7 @@ func (ttBarrier *softTimeTickBarrier) GetTimeTick() (Timestamp, error) {
}
}
atomic.StoreInt64(&(ttBarrier.lastTt), int64(ts))
log.Println("current tick: ", ts)
// log.Println("current tick: ", ts)
return ts, ttBarrier.ctx.Err()
}
}
......@@ -95,8 +95,8 @@ func (ttBarrier *softTimeTickBarrier) Start() error {
log.Printf("[softTimeTickBarrier] Warning: peerID %d not exist\n", ttmsg.Base.SourceID)
continue
}
log.Println("ttmsg.Base.Timestamp: ", ttmsg.Base.Timestamp)
log.Println("oldT: ", oldT)
// log.Println("ttmsg.Base.Timestamp: ", ttmsg.Base.Timestamp)
// log.Println("oldT: ", oldT)
if ttmsg.Base.Timestamp > oldT {
ttBarrier.peer2LastTt[ttmsg.Base.SourceID] = ttmsg.Base.Timestamp
......
......@@ -269,19 +269,22 @@ func (qs *QueryService) LoadPartitions(req *querypb.LoadPartitionRequest) (*comm
log.Fatal("showSegment fail, v%", showSegmentResponse.Status.Reason)
}
segmentIDs := showSegmentResponse.SegmentIDs
segmentStates := make(map[UniqueID]*datapb.SegmentStatesResponse)
segmentStates := make(map[UniqueID]*datapb.SegmentStateInfo)
channel2id := make(map[string]int)
//id2channels := make(map[int][]string)
id2segs := make(map[int][]UniqueID)
offset := 0
for _, segmentID := range segmentIDs {
state, err := qs.dataServiceClient.GetSegmentStates(&datapb.SegmentStatesRequest{
SegmentID: segmentID,
})
if err != nil {
log.Fatal("get segment states fail")
}
resp, err := qs.dataServiceClient.GetSegmentStates(&datapb.SegmentStatesRequest{
SegmentIDs: segmentIDs,
})
if err != nil {
log.Fatal("get segment states fail")
}
for _, state := range resp.States {
segmentID := state.SegmentID
segmentStates[segmentID] = state
var flatChannelName string
channelNames := make([]string, 0)
......
......@@ -91,7 +91,7 @@ func (master *masterMock) ShowSegments(in *milvuspb.ShowSegmentRequest) (*milvus
type dataMock struct {
segmentIDs []UniqueID
segmentStates map[UniqueID]*datapb.SegmentStatesResponse
segmentStates map[UniqueID]*datapb.SegmentStateInfo
}
func newDataMock() *dataMock {
......@@ -110,23 +110,24 @@ func newDataMock() *dataMock {
segmentIDs = append(segmentIDs, 5)
segmentIDs = append(segmentIDs, 6)
fillStates := func(time uint64, position []*internalpb2.MsgPosition, state datapb.SegmentState) *datapb.SegmentStatesResponse {
return &datapb.SegmentStatesResponse{
fillStates := func(segmentID UniqueID, time uint64, position []*internalpb2.MsgPosition, state datapb.SegmentState) *datapb.SegmentStateInfo {
return &datapb.SegmentStateInfo{
Status: &commonpb.Status{
ErrorCode: commonpb.ErrorCode_SUCCESS,
},
SegmentID: segmentID,
State: state,
CreateTime: time,
StartPositions: position,
}
}
segmentStates := make(map[UniqueID]*datapb.SegmentStatesResponse)
segmentStates[1] = fillStates(1, positions1, datapb.SegmentState_SegmentFlushed)
segmentStates[2] = fillStates(2, positions2, datapb.SegmentState_SegmentFlushed)
segmentStates[3] = fillStates(3, positions1, datapb.SegmentState_SegmentFlushed)
segmentStates[4] = fillStates(4, positions2, datapb.SegmentState_SegmentFlushed)
segmentStates[5] = fillStates(5, positions1, datapb.SegmentState_SegmentGrowing)
segmentStates[6] = fillStates(6, positions2, datapb.SegmentState_SegmentGrowing)
segmentStates := make(map[UniqueID]*datapb.SegmentStateInfo)
segmentStates[1] = fillStates(1, 1, positions1, datapb.SegmentState_SegmentFlushed)
segmentStates[2] = fillStates(2, 2, positions2, datapb.SegmentState_SegmentFlushed)
segmentStates[3] = fillStates(3, 3, positions1, datapb.SegmentState_SegmentFlushed)
segmentStates[4] = fillStates(4, 4, positions2, datapb.SegmentState_SegmentFlushed)
segmentStates[5] = fillStates(5, 5, positions1, datapb.SegmentState_SegmentGrowing)
segmentStates[6] = fillStates(6, 6, positions2, datapb.SegmentState_SegmentGrowing)
return &dataMock{
segmentIDs: segmentIDs,
......@@ -135,13 +136,24 @@ func newDataMock() *dataMock {
}
func (data *dataMock) GetSegmentStates(req *datapb.SegmentStatesRequest) (*datapb.SegmentStatesResponse, error) {
segmentID := req.SegmentID
for _, id := range data.segmentIDs {
if segmentID == id {
return data.segmentStates[id], nil
ret := &datapb.SegmentStatesResponse{
Status: &commonpb.Status{
ErrorCode: commonpb.ErrorCode_SUCCESS,
},
}
for _, segID := range req.SegmentIDs {
for _, segmentID := range data.segmentIDs {
if segmentID == segID {
ret.States = append(ret.States, data.segmentStates[segmentID])
}
}
}
return nil, errors.New("segment id not found")
if ret.States == nil {
return nil, errors.New("segment id not found")
}
return ret, nil
}
func TestQueryService_Init(t *testing.T) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册