Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enhance: Speed up target recovery after query coord restart #31240

Merged
merged 3 commits into from
Mar 15, 2024

Conversation

weiliu1031
Copy link
Contributor

issue: #28491

after querycoord restart, it will pull a new target, which include channel and segment list. when segments loaded on querynode has reached the target, the collection could provide search/query. but if segment list changes by time, ater querycoord pull a new target, it will takes a few minutes to catch up the target's segment distribution. and before that, query/search will fail due to lack of segments.

This PR save the current loaded target to meta storein querycoord's stop progress, and recover it when query coord starts, to speed up the target recovery time.

@sre-ci-robot sre-ci-robot added the size/XL Denotes a PR that changes 500-999 lines. label Mar 13, 2024
@mergify mergify bot added dco-passed DCO check passed. kind/enhancement Issues or changes related to enhancement labels Mar 13, 2024
Copy link
Contributor

mergify bot commented Mar 13, 2024

@weiliu1031 ut workflow job failed, comment rerun ut can trigger the job again.

mgr.rwMutex.Lock()
defer mgr.rwMutex.Unlock()
if mgr.current != nil {
for id, target := range mgr.current.collectionTargetMap {
Copy link
Contributor

@jaime0815 jaime0815 Mar 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

collection target Map may be very large which is not friendly for etcd IO?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. saveTarget and recoverTarget only happens when qc restarts, the trigger frequency is low.
  2. the pbTarget only contains (channel Names, segment, cp), which won't be too larger. for example, a collection with 30w segment's target is about 3MB.
  3. use zstd to compress and decompress the pbTarget, for example, the 3MB target could be compressed to 600KB.

Copy link

codecov bot commented Mar 14, 2024

Codecov Report

Attention: Patch coverage is 85.23490% with 22 lines in your changes are missing coverage. Please review.

Project coverage is 81.08%. Comparing base (056e9f0) to head (5f725f7).
Report is 8 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #31240      +/-   ##
==========================================
+ Coverage   81.02%   81.08%   +0.05%     
==========================================
  Files         978      978              
  Lines      142852   143065     +213     
==========================================
+ Hits       115750   116004     +254     
+ Misses      23224    23188      -36     
+ Partials     3878     3873       -5     
Files Coverage Δ
internal/metastore/catalog.go 100.00% <ø> (ø)
tests/integration/minicluster_v2.go 63.42% <100.00%> (ø)
internal/distributed/querycoord/service.go 73.64% <0.00%> (-1.26%) ⬇️
internal/querycoordv2/meta/target.go 93.87% <95.52%> (+3.55%) ⬆️
internal/querycoordv2/server.go 80.95% <62.50%> (-0.52%) ⬇️
internal/metastore/kv/querycoord/kv_catalog.go 69.65% <88.23%> (+3.78%) ⬆️
internal/querycoordv2/meta/target_manager.go 84.38% <70.58%> (-0.47%) ⬇️

... and 31 files with indirect coverage changes

@mergify mergify bot added the ci-passed label Mar 14, 2024
@jaime0815
Copy link
Contributor

Do we have any testing for recovery time with a large of number write or delete requests, and checking if downtime is 0 during the rolling upgrade/restart period?

Signed-off-by: Wei Liu <wei.liu@zilliz.com>
Signed-off-by: Wei Liu <wei.liu@zilliz.com>
Signed-off-by: Wei Liu <wei.liu@zilliz.com>
@jaime0815
Copy link
Contributor

/lgtm

@congqixia
Copy link
Contributor

/approve

@sre-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: congqixia, weiliu1031

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@sre-ci-robot sre-ci-robot merged commit d79aa58 into milvus-io:master Mar 15, 2024
14 checks passed
weiliu1031 added a commit to weiliu1031/milvus that referenced this pull request Mar 15, 2024
…o#31240)

issue: milvus-io#28491

after querycoord restart, it will pull a new target, which include
channel and segment list. when segments loaded on querynode has reached
the target, the collection could provide search/query. but if segment
list changes by time, ater querycoord pull a new target, it will takes a
few minutes to catch up the target's segment distribution. and before
that, query/search will fail due to lack of segments.

This PR save the current loaded target to meta storein querycoord's stop
progress, and recover it when query coord starts, to speed up the target
recovery time.

---------

Signed-off-by: Wei Liu <wei.liu@zilliz.com>
weiliu1031 added a commit to weiliu1031/milvus that referenced this pull request Mar 20, 2024
…o#31240)

issue: milvus-io#28491

after querycoord restart, it will pull a new target, which include
channel and segment list. when segments loaded on querynode has reached
the target, the collection could provide search/query. but if segment
list changes by time, ater querycoord pull a new target, it will takes a
few minutes to catch up the target's segment distribution. and before
that, query/search will fail due to lack of segments.

This PR save the current loaded target to meta storein querycoord's stop
progress, and recover it when query coord starts, to speed up the target
recovery time.

---------

Signed-off-by: Wei Liu <wei.liu@zilliz.com>
weiliu1031 added a commit to weiliu1031/milvus that referenced this pull request Mar 21, 2024
…o#31240)

issue: milvus-io#28491

after querycoord restart, it will pull a new target, which include
channel and segment list. when segments loaded on querynode has reached
the target, the collection could provide search/query. but if segment
list changes by time, ater querycoord pull a new target, it will takes a
few minutes to catch up the target's segment distribution. and before
that, query/search will fail due to lack of segments.

This PR save the current loaded target to meta storein querycoord's stop
progress, and recover it when query coord starts, to speed up the target
recovery time.

---------

Signed-off-by: Wei Liu <wei.liu@zilliz.com>
sre-ci-robot pushed a commit that referenced this pull request Mar 22, 2024
…31449)

issue: #28491
pr: #31240

after querycoord restart, it will pull a new target, which include
channel and segment list. when segments loaded on querynode has reached
the target, the collection could provide search/query. but if segment
list changes by time, ater querycoord pull a new target, it will takes a
few minutes to catch up the target's segment distribution. and before
that, query/search will fail due to lack of segments.

This PR save the current loaded target to meta storein querycoord's stop
progress, and recover it when query coord starts, to speed up the target
recovery time.

---------

Signed-off-by: Wei Liu <wei.liu@zilliz.com>
congqixia added a commit to congqixia/milvus that referenced this pull request Mar 26, 2024
See also milvus-io#28491 milvus-io#31240

When colleciton number is large, querycoord saves collection target one
by one, which is slow and may block querycoord exits.

In local run, 500 collections scenario may lead to about 40 seconds
saving collection targets.

This PR changes the `SaveCollectionTarget` interface into batch one and
organizes the collection in 16 per bundle batches to accelerate this
procedure.

Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
sre-ci-robot pushed a commit that referenced this pull request Mar 26, 2024
See also #28491 #31240

When colleciton number is large, querycoord saves collection target one
by one, which is slow and may block querycoord exits.

In local run, 500 collections scenario may lead to about 40 seconds
saving collection targets.

This PR changes the `SaveCollectionTarget` interface into batch one and
organizes the collection in 16 per bundle batches to accelerate this
procedure.

Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
congqixia added a commit to congqixia/milvus that referenced this pull request Mar 27, 2024
See also milvus-io#28491 milvus-io#31240

When colleciton number is large, querycoord saves collection target one
by one, which is slow and may block querycoord exits.

In local run, 500 collections scenario may lead to about 40 seconds
saving collection targets.

This PR changes the `SaveCollectionTarget` interface into batch one and
organizes the collection in 16 per bundle batches to accelerate this
procedure.

Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
congqixia added a commit to congqixia/milvus that referenced this pull request Mar 27, 2024
See also milvus-io#28491 milvus-io#31240

When colleciton number is large, querycoord saves collection target one
by one, which is slow and may block querycoord exits.

In local run, 500 collections scenario may lead to about 40 seconds
saving collection targets.

This PR changes the `SaveCollectionTarget` interface into batch one and
organizes the collection in 16 per bundle batches to accelerate this
procedure.

Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
sre-ci-robot pushed a commit that referenced this pull request Mar 27, 2024
Cherry-pick from master
pr: #31616
See also #28491 #31240

When colleciton number is large, querycoord saves collection target one
by one, which is slow and may block querycoord exits.

In local run, 500 collections scenario may lead to about 40 seconds
saving collection targets.

This PR changes the `SaveCollectionTarget` interface into batch one and
organizes the collection in 16 per bundle batches to accelerate this
procedure.

Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
congqixia added a commit to congqixia/milvus that referenced this pull request Mar 27, 2024
See also milvus-io#28491 milvus-io#31240

When colleciton number is large, querycoord saves collection target one
by one, which is slow and may block querycoord exits.

In local run, 500 collections scenario may lead to about 40 seconds
saving collection targets.

This PR changes the `SaveCollectionTarget` interface into batch one and
organizes the collection in 16 per bundle batches to accelerate this
procedure.

Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
sre-ci-robot pushed a commit that referenced this pull request Mar 28, 2024
…31655)

Cherry-pick from master
pr: #31616 
See also #28491 #31240

When colleciton number is large, querycoord saves collection target one
by one, which is slow and may block querycoord exits.

In local run, 500 collections scenario may lead to about 40 seconds
saving collection targets.

This PR changes the `SaveCollectionTarget` interface into batch one and
organizes the collection in 16 per bundle batches to accelerate this
procedure.

Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved area/internal-api area/test ci-passed dco-passed DCO check passed. kind/enhancement Issues or changes related to enhancement lgtm sig/testing size/XL Denotes a PR that changes 500-999 lines. test/integration integration test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants