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

refine update partition stats mechanism(#32446) #32768

Merged

Conversation

MrPresent-Han
Copy link
Contributor

related: #32446

@sre-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: MrPresent-Han
To complete the pull request process, please assign wxyucs after the PR has been reviewed.
You can assign the PR to them by writing /assign @wxyucs in a comment when ready.

The full list of commands accepted by this bot can be found 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 size/L Denotes a PR that changes 100-499 lines. area/internal-api labels May 6, 2024
@MrPresent-Han MrPresent-Han force-pushed the refine-part-status-lru-dev-v1 branch from c6a093a to 61dbb3c Compare May 6, 2024 04:56

req := &querypb.SyncDistributionRequest{
Base: commonpbutil.NewMsgBase(
commonpbutil.WithMsgType(commonpb.MsgType_LoadSegments),
Copy link
Contributor

Choose a reason for hiding this comment

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

is thisMsgType_LoadSegments right?

}
log := log.Ctx(ctx)
for partID, newVersion := range partStatsVersions {
curStats, exist := sd.partitionStats[partID]
Copy link
Contributor

Choose a reason for hiding this comment

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

need RWLock ?

@MrPresent-Han MrPresent-Han force-pushed the refine-part-status-lru-dev-v1 branch from 61dbb3c to aa342d0 Compare May 10, 2024 02:40
@sre-ci-robot sre-ci-robot added size/XL Denotes a PR that changes 500-999 lines. and removed size/L Denotes a PR that changes 100-499 lines. labels May 10, 2024
@czs007 czs007 merged commit 2a0fa1a into milvus-io:lru-dev May 10, 2024
6 of 9 checks passed
Copy link
Contributor Author

@MrPresent-Han MrPresent-Han left a comment

Choose a reason for hiding this comment

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

review for second time

@@ -206,14 +207,35 @@ func (h *ServerHandler) GetQueryVChanPositions(channel RWChannel, partitionIDs .
// unindexed is flushed segments as well
indexedIDs.Insert(unIndexedIDs.Collect()...)

// update partition stats versions
Copy link
Contributor Author

Choose a reason for hiding this comment

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

when there are too many partitions and multiple versions of partition stats are avaiable to single partition, this part can consume loads of cpu cycles, no mentioning it includes string prefix compare

log.Info("update partition stats versions")
sd.loadPartitionStats(ctx, partVersions)
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Rlock protect get GetPartitionStatsVersions.
WLock protection is inside loadPartitionStats(ctx, partVersions)

func() {
sd.partitionStatsMut.RLock()
defer sd.partitionStatsMut.RUnlock()
partStats, exists = sd.partitionStats[partID]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

only use mutex in the last step when upgrading the underlying partition stats in the memory to avoid blocking search process for slow s3-read process

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/internal-api size/XL Denotes a PR that changes 500-999 lines.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants