-
Notifications
You must be signed in to change notification settings - Fork 140
CBG-4746: Deduplicate channel set outside processEntry #7861
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR optimizes channel cache performance by changing the return type of processEntry from a channel set to a slice of channel IDs, and moving channel deduplication outside the mutex-protected section. This reduces contention and improves performance for the cache performance tool.
- Changed
AddToCacheandprocessEntrymethods to return[]channels.IDinstead ofchannels.Set - Updated all callers to convert the slice to a set using
channels.SetFromArrayNoValidatefor deduplication - Reduced delay in cache performance tool from 500ms to 100ms for faster testing
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| tools/cache_perf_tool/dcpDataGeneration.go | Reduced vBucket creation delay from 500ms to 100ms |
| db/channel_cache.go | Changed AddToCache return type and implementation to use slice instead of set |
| db/change_cache.go | Updated processEntry and related methods to return slices, with deduplication moved outside mutex |
torcolvin
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Concept seems fine, I think a quick look to see if we can hide the duplication in our our functions is reasonable, and we should definitely document which functions which could return duplicate channels in output.
CBG-4746
processEntrythen deduplicate the channel IDs outsideprocessEntrymutexBefore:

After:

Pre-review checklist
fmt.Print,log.Print, ...)base.UD(docID),base.MD(dbName))docs/apiDependencies (if applicable)
Integration Tests
GSI=true,xattrs=truehttps://jenkins.sgwdev.com/job/SyncGatewayIntegration/153/