Skip to content

Commit

Permalink
fix e2e
Browse files Browse the repository at this point in the history
Signed-off-by: Wei Liu <[email protected]>
  • Loading branch information
weiliu1031 committed Sep 27, 2024
1 parent 1d6f3f5 commit 2e8956b
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 8 deletions.
17 changes: 12 additions & 5 deletions internal/querycoordv2/observers/target_observer.go
Original file line number Diff line number Diff line change
Expand Up @@ -403,12 +403,19 @@ func (ob *TargetObserver) shouldUpdateCurrentTarget(ctx context.Context, collect
continue
}
updateVersionAction := ob.checkNeedUpdateTargetVersion(ctx, leaderView)
if updateVersionAction != nil {
actions = append(actions, updateVersionAction)
}
if !ob.sync(ctx, replica, leaderView, actions) {
return false
if updateVersionAction == nil {
continue
}

actions = append(actions, updateVersionAction)
log.RatedInfo(10, "try to sync target version to delegator",
zap.Int64("collectionID", leaderView.CollectionID),
zap.String("channelName", leaderView.Channel),
zap.Int64("leaderID", leaderView.ID),
)
ob.sync(ctx, replica, leaderView, actions)

return false
}
}

Expand Down
17 changes: 17 additions & 0 deletions internal/querycoordv2/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import (
"github.com/milvus-io/milvus/internal/querycoordv2/meta"
"github.com/milvus-io/milvus/internal/querycoordv2/utils"
"github.com/milvus-io/milvus/internal/util/componentutil"
"github.com/milvus-io/milvus/pkg/common"
"github.com/milvus-io/milvus/pkg/log"
"github.com/milvus-io/milvus/pkg/metrics"
"github.com/milvus-io/milvus/pkg/util/merr"
Expand Down Expand Up @@ -112,6 +113,14 @@ func (s *Server) ShowCollections(ctx context.Context, req *querypb.ShowCollectio
}, nil
}

if !s.targetMgr.IsCurrentTargetExist(collectionID, common.AllPartitionsID) {
err := merr.WrapErrCollectionNotFullyLoaded(collectionID)
log.Warn("show collection failed", zap.Error(err))
return &querypb.ShowCollectionsResponse{
Status: merr.Status(err),
}, nil
}

if collection.IsRefreshed() {
refreshProgress = 100
}
Expand Down Expand Up @@ -174,6 +183,14 @@ func (s *Server) ShowPartitions(ctx context.Context, req *querypb.ShowPartitions
percentages = append(percentages, int64(percentage))
}

if !s.targetMgr.IsCurrentTargetExist(req.GetCollectionID(), common.AllPartitionsID) {
err := merr.WrapErrCollectionNotFullyLoaded(req.GetCollectionID())
log.Warn("show partitions failed", zap.Error(err))
return &querypb.ShowPartitionsResponse{
Status: merr.Status(err),
}, nil
}

collection := s.meta.GetCollection(req.GetCollectionID())
if collection != nil && collection.IsRefreshed() {
refreshProgress = 100
Expand Down
4 changes: 2 additions & 2 deletions internal/querycoordv2/utils/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@ func CheckLeaderAvailable(nodeMgr *session.NodeManager, targetMgr meta.TargetMan
// if target version hasn't been synced, delegator will get empty readable segment list
// so shard leader should be unserviceable until target version is synced
currentTargetVersion := targetMgr.GetCollectionTargetVersion(leader.CollectionID, meta.CurrentTarget)
if leader.TargetVersion <= 0 || currentTargetVersion <= 0 || leader.TargetVersion != currentTargetVersion {
if leader.TargetVersion <= 0 || currentTargetVersion <= 0 {
return merr.WrapErrServiceInternal(
fmt.Sprintf("target version mismatch, collection: %d, current target version: %v, leader version: %v",
leader.CollectionID, currentTargetVersion, leader))
leader.CollectionID, currentTargetVersion, leader.TargetVersion))
}

segmentDist := targetMgr.GetSealedSegmentsByChannel(leader.CollectionID, leader.Channel, meta.CurrentTarget)
Expand Down
2 changes: 1 addition & 1 deletion pkg/util/paramtable/component_param.go
Original file line number Diff line number Diff line change
Expand Up @@ -2107,7 +2107,7 @@ If this parameter is set false, Milvus simply searches the growing segments with
p.UpdateNextTargetInterval = ParamItem{
Key: "queryCoord.UpdateNextTargetInterval",
Version: "2.0.0",
DefaultValue: "10",
DefaultValue: "1",
PanicIfEmpty: true,
}
p.UpdateNextTargetInterval.Init(base.mgr)
Expand Down

0 comments on commit 2e8956b

Please sign in to comment.