未验证 提交 0306f71b 编写于 作者: Y yah01 提交者: GitHub

Remove incorrect formatting, unused conditions (#19239)

Signed-off-by: Nyah01 <yang.cen@zilliz.com>
Signed-off-by: Nyah01 <yang.cen@zilliz.com>
上级 86769e59
......@@ -66,9 +66,9 @@ func (h *ServerHandler) GetVChanPositions(channel *channel, partitionID UniqueID
zap.Any("numOfSegments", len(segments)),
)
var (
flushedIds = make(typeutil.UniqueSet)
unflushedIds = make(typeutil.UniqueSet)
droppedIds = make(typeutil.UniqueSet)
indexedIDs = make(typeutil.UniqueSet)
unIndexedIDs = make(typeutil.UniqueSet)
droppedIDs = make(typeutil.UniqueSet)
seekPosition *internalpb.MsgPosition
)
for _, s := range segments {
......@@ -78,26 +78,25 @@ func (h *ServerHandler) GetVChanPositions(channel *channel, partitionID UniqueID
}
segmentInfos[s.GetID()] = s
if s.GetState() == commonpb.SegmentState_Dropped {
droppedIds.Insert(s.GetID())
droppedIDs.Insert(s.GetID())
} else if indexed.Contain(s.GetID()) {
flushedIds.Insert(s.GetID())
indexedIDs.Insert(s.GetID())
} else {
unflushedIds.Insert(s.GetID())
unIndexedIDs.Insert(s.GetID())
}
}
for id := range unflushedIds {
for id := range unIndexedIDs {
// Indexed segments are compacted to a raw segment,
// replace it with the indexed ones
if !indexed.Contain(id) &&
len(segmentInfos[id].GetCompactionFrom()) > 0 &&
if len(segmentInfos[id].GetCompactionFrom()) > 0 &&
indexed.Contain(segmentInfos[id].GetCompactionFrom()...) {
flushedIds.Insert(segmentInfos[id].GetCompactionFrom()...)
unflushedIds.Remove(id)
droppedIds.Remove(segmentInfos[id].GetCompactionFrom()...)
unIndexedIDs.Remove(id)
indexedIDs.Insert(segmentInfos[id].GetCompactionFrom()...)
droppedIDs.Remove(segmentInfos[id].GetCompactionFrom()...)
}
}
for id := range flushedIds {
for id := range indexedIDs {
var segmentPosition *internalpb.MsgPosition
segment := segmentInfos[id]
if segment.GetDmlPosition() != nil {
......@@ -110,7 +109,7 @@ func (h *ServerHandler) GetVChanPositions(channel *channel, partitionID UniqueID
seekPosition = segmentPosition
}
}
for id := range unflushedIds {
for id := range unIndexedIDs {
var segmentPosition *internalpb.MsgPosition
segment := segmentInfos[id]
if segment.GetDmlPosition() != nil {
......@@ -141,9 +140,9 @@ func (h *ServerHandler) GetVChanPositions(channel *channel, partitionID UniqueID
CollectionID: channel.CollectionID,
ChannelName: channel.Name,
SeekPosition: seekPosition,
FlushedSegmentIds: flushedIds.Collect(),
UnflushedSegmentIds: unflushedIds.Collect(),
DroppedSegmentIds: droppedIds.Collect(),
FlushedSegmentIds: indexedIDs.Collect(),
UnflushedSegmentIds: unIndexedIDs.Collect(),
DroppedSegmentIds: droppedIDs.Collect(),
}
}
......
......@@ -591,7 +591,7 @@ func (s *Server) GetRecoveryInfo(ctx context.Context, req *datapb.GetRecoveryInf
zap.Int64("collectionID", collectionID),
zap.Int64("partitionID", partitionID),
)
log.Info("receive get recovery info request")
log.Info("get recovery info request received")
resp := &datapb.GetRecoveryInfoResponse{
Status: &commonpb.Status{
ErrorCode: commonpb.ErrorCode_UnexpectedError,
......@@ -706,7 +706,7 @@ func (s *Server) GetRecoveryInfo(ctx context.Context, req *datapb.GetRecoveryInf
return resp, nil
}
// GetFlushedSegments returns all segment matches provided criterion and in State Flushed
// GetFlushedSegments returns all segment matches provided criterion and in state Flushed or Dropped (compacted but not GCed yet)
// If requested partition id < 0, ignores the partition id filter
func (s *Server) GetFlushedSegments(ctx context.Context, req *datapb.GetFlushedSegmentsRequest) (*datapb.GetFlushedSegmentsResponse, error) {
resp := &datapb.GetFlushedSegmentsResponse{
......
......@@ -101,8 +101,7 @@ class TestCompactionParams(TestcaseBase):
start = time()
while time() - start < cost:
collection_w.load()
segment_info = self.utility_wrap.get_query_segment_info(collection_w.name)[
0]
segment_info = self.utility_wrap.get_query_segment_info(collection_w.name)[0]
if len(segment_info) == 1:
break
sleep(1.0)
......@@ -327,8 +326,7 @@ class TestCompactionParams(TestcaseBase):
collection_w.load()
replicas = collection_w.get_replicas()[0]
replica_num = len(replicas.groups)
segment_info = self.utility_wrap.get_query_segment_info(collection_w.name)[
0]
segment_info = self.utility_wrap.get_query_segment_info(collection_w.name)[0]
assert len(segment_info) == 1*replica_num
@pytest.mark.skip(reason="TODO")
......@@ -532,8 +530,7 @@ class TestCompactionOperation(TestcaseBase):
start = time()
while True:
sleep(5)
segment_info = self.utility_wrap.get_query_segment_info(collection_w.name)[
0]
segment_info = self.utility_wrap.get_query_segment_info(collection_w.name)[0]
if len(segment_info) != 0 and segment_info[0].segmentID == c_plans.plans[0].target:
log.debug(segment_info)
break
......@@ -809,8 +806,7 @@ class TestCompactionOperation(TestcaseBase):
cost = 60
while True:
sleep(5)
segments_info = self.utility_wrap.get_query_segment_info(collection_w.name)[
0]
segments_info = self.utility_wrap.get_query_segment_info(collection_w.name)[0]
# verify segments reaches threshold, auto-merge ten segments into one
if len(segments_info) == 1:
......@@ -880,8 +876,7 @@ class TestCompactionOperation(TestcaseBase):
cost = 60
while True:
sleep(5)
segments_info = self.utility_wrap.get_query_segment_info(collection_w.name)[
0]
segments_info = self.utility_wrap.get_query_segment_info(collection_w.name)[0]
# verify segments reaches threshold, auto-merge ten segments into one
if len(segments_info) == 1:
......@@ -921,8 +916,7 @@ class TestCompactionOperation(TestcaseBase):
start = time()
while True:
sleep(5)
segments_info = self.utility_wrap.get_query_segment_info(collection_w.name)[
0]
segments_info = self.utility_wrap.get_query_segment_info(collection_w.name)[0]
# verify segments reaches threshold, auto-merge ten segments into one
if len(segments_info) == 1:
......@@ -995,8 +989,7 @@ class TestCompactionOperation(TestcaseBase):
start = time()
while True:
sleep(5)
segments_info = self.utility_wrap.get_query_segment_info(collection_w.name)[
0]
segments_info = self.utility_wrap.get_query_segment_info(collection_w.name)[0]
# verify segments reaches threshold, auto-merge ten segments into one
if len(segments_info) == 1*replica_num:
......@@ -1023,8 +1016,7 @@ class TestCompactionOperation(TestcaseBase):
collection_w.load()
replicas = collection_w.get_replicas()[0]
replica_num = len(replicas.groups)
segments_info = self.utility_wrap.get_query_segment_info(collection_w.name)[
0]
segments_info = self.utility_wrap.get_query_segment_info(collection_w.name)[0]
assert len(segments_info) == less_threshold*replica_num
@pytest.mark.skip(reason="Todo")
......@@ -1206,8 +1198,7 @@ class TestCompactionOperation(TestcaseBase):
collection_w.load()
replicas = collection_w.get_replicas()[0]
replica_num = len(replicas.groups)
seg_info = self.utility_wrap.get_query_segment_info(collection_w.name)[
0]
seg_info = self.utility_wrap.get_query_segment_info(collection_w.name)[0]
assert len(seg_info) == 2*replica_num
@pytest.mark.tags(CaseLabel.L2)
......@@ -1235,8 +1226,7 @@ class TestCompactionOperation(TestcaseBase):
collection_w.load()
replicas = collection_w.get_replicas()[0]
replica_num = len(replicas.groups)
seg_info = self.utility_wrap.get_query_segment_info(collection_w.name)[
0]
seg_info = self.utility_wrap.get_query_segment_info(collection_w.name)[0]
assert len(seg_info) == 1*replica_num
@pytest.mark.tags(CaseLabel.L2)
......
......@@ -1423,13 +1423,11 @@ class TestUtilityAdvanced(TestcaseBase):
@pytest.mark.tags(CaseLabel.L1)
def test_get_sealed_query_segment_info(self):
"""
target: test getting sealed query segment info of collection with data
target: test getting sealed query segment info of collection without index
method: init a collection, insert data, flush, load, and get query segment info
expected:
1. length of segment is greater than 0
2. the sum num_rows of each segment is equal to num of entities
1. length of segment is equal to 0
"""
pytest.skip("QueryCoord treat all segments without index as growing segments")
c_name = cf.gen_unique_str(prefix)
collection_w = self.init_collection_wrap(name=c_name)
nb = 3000
......@@ -1438,15 +1436,7 @@ class TestUtilityAdvanced(TestcaseBase):
collection_w.num_entities
collection_w.load()
res, _ = self.utility_wrap.get_query_segment_info(c_name)
assert len(res) > 0
segment_ids = []
cnt = 0
for r in res:
log.info(f"segmentID {r.segmentID}: state: {r.state}; num_rows: {r.num_rows} ")
if r.segmentID not in segment_ids:
segment_ids.append(r.segmentID)
cnt += r.num_rows
assert cnt == nb
assert len(res) == 0
@pytest.mark.tags(CaseLabel.L1)
def test_get_sealed_query_segment_info_after_create_index(self):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册