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

Refactor flush manager injection to reduce goroutine number #15180

Merged

Conversation

congqixia
Copy link
Contributor

Resolves #15179

/kind enhancement

Signed-off-by: Congqi Xia [email protected]

@sre-ci-robot sre-ci-robot added the kind/enhancement Issues or changes related to enhancement label Jan 12, 2022
@sre-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: congqixia

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 added approved size/M Denotes a PR that changes 30-99 lines. labels Jan 12, 2022
@mergify mergify bot added the dco-passed DCO check passed. label Jan 12, 2022
@mergify
Copy link
Contributor

mergify bot commented Jan 12, 2022

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

@mergify
Copy link
Contributor

mergify bot commented Jan 12, 2022

@congqixia E2e jenkins job failed, comment /run-checks can trigger the job again.

@codecov
Copy link

codecov bot commented Jan 12, 2022

Codecov Report

Merging #15180 (0ba28bd) into master (3254d36) will decrease coverage by 0.01%.
The diff coverage is 76.92%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #15180      +/-   ##
==========================================
- Coverage   80.12%   80.11%   -0.02%     
==========================================
  Files         443      443              
  Lines       60807    60791      -16     
==========================================
- Hits        48720    48701      -19     
- Misses       9783     9786       +3     
  Partials     2304     2304              
Impacted Files Coverage Δ
internal/datanode/flush_manager.go 92.90% <76.92%> (-1.65%) ⬇️
internal/querynode/flow_graph_delete_node.go 81.25% <0.00%> (-7.30%) ⬇️
internal/msgstream/mq_msgstream.go 74.77% <0.00%> (-0.78%) ⬇️
...ternal/util/rocksmq/server/rocksmq/rocksmq_impl.go 82.08% <0.00%> (+0.38%) ⬆️
internal/rootcoord/task.go 79.26% <0.00%> (+0.44%) ⬆️
...nternal/util/rocksmq/client/rocksmq/client_impl.go 78.15% <0.00%> (+0.84%) ⬆️
internal/querynode/query_collection.go 81.99% <0.00%> (+0.84%) ⬆️

@@ -175,9 +174,31 @@ func (q *orderFlushQueue) enqueueDelFlush(task flushDeleteTask, deltaLogs *DelDa
// send into injectCh in there is running task
// or perform injection logic here if there is no injection
func (q *orderFlushQueue) inject(inject *taskInjection) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm a little bit confused about taskInjection, maybe all we need is a barrier.

Copy link
Collaborator

Choose a reason for hiding this comment

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

The injector(compactor) start inject and find all running flush tasks, and insert a wait mark for each flusher

Compactor goroutine finish compaction, change all the target id of the affected flusher, and notify all the flusher

Copy link
Collaborator

Choose a reason for hiding this comment

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

postInjection postInjectionFunc var is not actually necessary and it shouldn't be a part of orderFlushQueue

@@ -441,7 +455,7 @@ func (m *rendezvousFlushManager) flushDelData(data *DelDataBuf, segmentID Unique
func (m *rendezvousFlushManager) injectFlush(injection *taskInjection, segments ...UniqueID) {
go injection.waitForInjected()
Copy link
Collaborator

@xiaofan-luan xiaofan-luan Jan 13, 2022

Choose a reason for hiding this comment

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

I'm wondering do we need to use such complicated way for synchronization

func (q *orderFlushQueue) handleInject(inject *taskInjection) {
// notify one injection done
inject.injectOne()
ok := <-inject.injectOver
Copy link
Collaborator

Choose a reason for hiding this comment

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

injectOver can be replaced by a barrier, if we just want to ensure all flush task reached end

@xiaofan-luan
Copy link
Collaborator

/lgtm

@sre-ci-robot sre-ci-robot merged commit 2528b68 into milvus-io:master Jan 13, 2022
@congqixia congqixia deleted the remove_injection_handler_goroutine branch February 28, 2022 08:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved ci-passed dco-passed DCO check passed. kind/enhancement Issues or changes related to enhancement lgtm size/M Denotes a PR that changes 30-99 lines.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Enhancement]: Reduce goroutine number used in flushManager for large collection
4 participants