Skip to content

Commit

Permalink
enhance: clean shard location cache after collection released (#40088)
Browse files Browse the repository at this point in the history
issue: #40077

Signed-off-by: Wei Liu <[email protected]>
  • Loading branch information
weiliu1031 authored Feb 27, 2025
1 parent fc31308 commit 94f55df
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
9 changes: 9 additions & 0 deletions internal/querycoordv2/job/job_release.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ func (job *ReleaseCollectionJob) Execute() error {
},
proxyutil.SetMsgType(commonpb.MsgType_ReleaseCollection))

// try best clean shard leader cache
job.proxyManager.InvalidateShardLeaderCache(job.ctx, &proxypb.InvalidateShardLeaderCacheRequest{
CollectionIDs: []int64{req.GetCollectionID()},
})

waitCollectionReleased(job.dist, job.checkerController, req.GetCollectionID())
metrics.QueryCoordReleaseCount.WithLabelValues(metrics.TotalLabel).Inc()
metrics.QueryCoordReleaseCount.WithLabelValues(metrics.SuccessLabel).Inc()
Expand Down Expand Up @@ -190,6 +195,10 @@ func (job *ReleasePartitionJob) Execute() error {
CollectionID: req.GetCollectionID(),
},
proxyutil.SetMsgType(commonpb.MsgType_ReleaseCollection))
// try best clean shard leader cache
job.proxyManager.InvalidateShardLeaderCache(job.ctx, &proxypb.InvalidateShardLeaderCacheRequest{
CollectionIDs: []int64{req.GetCollectionID()},
})

waitCollectionReleased(job.dist, job.checkerController, req.GetCollectionID())
} else {
Expand Down
1 change: 1 addition & 0 deletions internal/querycoordv2/job/job_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ func (suite *JobSuite) SetupSuite() {

suite.proxyManager = proxyutil.NewMockProxyClientManager(suite.T())
suite.proxyManager.EXPECT().InvalidateCollectionMetaCache(mock.Anything, mock.Anything, mock.Anything).Return(nil).Maybe()
suite.proxyManager.EXPECT().InvalidateShardLeaderCache(mock.Anything, mock.Anything).Return(nil).Maybe()
}

func (suite *JobSuite) SetupTest() {
Expand Down
1 change: 1 addition & 0 deletions internal/querycoordv2/services_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ func (suite *ServiceSuite) SetupSuite() {

suite.proxyManager = proxyutil.NewMockProxyClientManager(suite.T())
suite.proxyManager.EXPECT().InvalidateCollectionMetaCache(mock.Anything, mock.Anything, mock.Anything).Return(nil).Maybe()
suite.proxyManager.EXPECT().InvalidateShardLeaderCache(mock.Anything, mock.Anything).Return(nil).Maybe()
}

func (suite *ServiceSuite) SetupTest() {
Expand Down

0 comments on commit 94f55df

Please sign in to comment.