fix clean handoff event (#19903)

Signed-off-by: Wei Liu <wei.liu@zilliz.com>

Signed-off-by: Wei Liu <wei.liu@zilliz.com>
pull/19909/head
wei liu 2022-10-19 20:41:26 +08:00 committed by GitHub
parent c88113e003
commit 87248dc1a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 21 deletions

View File

@ -383,9 +383,8 @@ func (ob *HandoffObserver) isSegmentExistOnTarget(segmentInfo *querypb.SegmentIn
func (ob *HandoffObserver) isAllCompactFromReleased(segmentInfo *querypb.SegmentInfo) bool {
if !segmentInfo.CreatedByCompaction {
return !ob.isGrowingSegmentReleased(segmentInfo.SegmentID)
return ob.isGrowingSegmentReleased(segmentInfo.SegmentID)
}
for _, segment := range segmentInfo.CompactionFrom {
if !ob.isSegmentReleased(segment) {
return false

View File

@ -26,7 +26,6 @@ import (
"github.com/golang/protobuf/proto"
"github.com/stretchr/testify/suite"
clientv3 "go.etcd.io/etcd/client/v3"
"go.uber.org/zap"
"github.com/milvus-io/milvus-proto/go-api/commonpb"
etcdkv "github.com/milvus-io/milvus/internal/kv/etcd"
@ -161,10 +160,6 @@ func (suite *HandoffObserverTestSuit) TestFlushingHandoff() {
GrowingSegments: typeutil.NewUniqueSet(3),
})
suite.Eventually(func() bool {
return suite.target.ContainSegment(3)
}, 3*time.Second, 1*time.Second)
// fake release CompactFrom Segment
suite.dist.LeaderViewManager.Update(1, &meta.LeaderView{
ID: 1,
@ -208,7 +203,6 @@ func (suite *HandoffObserverTestSuit) TestCompactHandoff() {
suite.produceHandOffEvent(compactSegment)
suite.Eventually(func() bool {
log.Info("", zap.Bool("contains", suite.target.ContainSegment(3)))
return suite.target.ContainSegment(3)
}, 3*time.Second, 1*time.Second)
@ -221,7 +215,6 @@ func (suite *HandoffObserverTestSuit) TestCompactHandoff() {
})
suite.Eventually(func() bool {
log.Info("", zap.Bool("contains", suite.target.ContainSegment(1)))
return !suite.target.ContainSegment(1)
}, 3*time.Second, 1*time.Second)
@ -293,11 +286,11 @@ func (suite *HandoffObserverTestSuit) TestRecursiveHandoff() {
})
suite.Eventually(func() bool {
return !suite.target.ContainSegment(3) && !suite.target.ContainSegment(4)
return suite.target.ContainSegment(1) && suite.target.ContainSegment(2) && suite.target.ContainSegment(5)
}, 3*time.Second, 1*time.Second)
suite.Eventually(func() bool {
return suite.target.ContainSegment(1) && suite.target.ContainSegment(2) && suite.target.ContainSegment(5)
return !suite.target.ContainSegment(3) && !suite.target.ContainSegment(4)
}, 3*time.Second, 1*time.Second)
// fake release CompactFrom Segment
@ -309,11 +302,11 @@ func (suite *HandoffObserverTestSuit) TestRecursiveHandoff() {
})
suite.Eventually(func() bool {
return !suite.target.ContainSegment(3) && !suite.target.ContainSegment(4)
return suite.target.ContainSegment(1) && suite.target.ContainSegment(2) && suite.target.ContainSegment(5)
}, 3*time.Second, 1*time.Second)
suite.Eventually(func() bool {
return suite.target.ContainSegment(1) && suite.target.ContainSegment(2) && suite.target.ContainSegment(5)
return !suite.target.ContainSegment(3) && !suite.target.ContainSegment(4)
}, 3*time.Second, 1*time.Second)
suite.Eventually(func() bool {
@ -424,11 +417,11 @@ func (suite *HandoffObserverTestSuit) TestLoadHandoffEventFromStore() {
})
suite.Eventually(func() bool {
return !suite.target.ContainSegment(3) && !suite.target.ContainSegment(4)
return suite.target.ContainSegment(1) && suite.target.ContainSegment(2) && suite.target.ContainSegment(5)
}, 3*time.Second, 1*time.Second)
suite.Eventually(func() bool {
return suite.target.ContainSegment(1) && suite.target.ContainSegment(2) && suite.target.ContainSegment(5)
return !suite.target.ContainSegment(3) && !suite.target.ContainSegment(4)
}, 3*time.Second, 1*time.Second)
// fake release CompactFrom Segment
@ -440,11 +433,11 @@ func (suite *HandoffObserverTestSuit) TestLoadHandoffEventFromStore() {
})
suite.Eventually(func() bool {
return !suite.target.ContainSegment(3) && !suite.target.ContainSegment(4)
return suite.target.ContainSegment(1) && suite.target.ContainSegment(2) && suite.target.ContainSegment(5)
}, 3*time.Second, 1*time.Second)
suite.Eventually(func() bool {
return suite.target.ContainSegment(1) && suite.target.ContainSegment(2) && suite.target.ContainSegment(5)
return !suite.target.ContainSegment(3) && !suite.target.ContainSegment(4)
}, 3*time.Second, 1*time.Second)
suite.Eventually(func() bool {
@ -530,13 +523,11 @@ func (suite *HandoffObserverTestSuit) TestHandoffOnUnLoadedPartition() {
suite.produceHandOffEvent(compactSegment)
suite.Eventually(func() bool {
log.Info("", zap.Bool("contains", suite.target.ContainSegment(3)))
return !suite.target.ContainSegment(3)
return suite.target.ContainSegment(1) && suite.target.ContainSegment(2)
}, 3*time.Second, 1*time.Second)
suite.Eventually(func() bool {
log.Info("", zap.Bool("contains", suite.target.ContainSegment(1)))
return suite.target.ContainSegment(1) && suite.target.ContainSegment(2)
return !suite.target.ContainSegment(3)
}, 3*time.Second, 1*time.Second)
suite.Eventually(func() bool {