Repository navigation
Conversation
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The cache lookup refactor preserves existing behavior while adding coverage for local cache hits, misses, invalid inputs, and unchanged state.
No open issues 🎉
What changed in this PR
This pull request reduces redundant lookups in Couchbase collection-manifest caches while preserving existing behavior and adds unit coverage for local collection cache hits and misses.
Changes:
- Reuses bucket, scope, and collection iterators returned by
find(). - Uses
emplace()when adding missing local manifests. - Adds tests for cache hits, misses, invalid inputs, and unchanged cache state.
| File | Description |
|---|---|
| test/brpc_couchbase_unittest.cpp | Adds unit tests covering local collection cache hits, misses, invalid inputs, and unchanged state after misses. |
| src/brpc/couchbase.cpp | Reuses cache iterators and avoids repeated map lookups during local manifest updates and collection ID lookups. |
Review effort: Lite
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What problem does this PR solve?
Issue Number: resolve
Problem Summary:
Couchbase manifest-cache paths sometimes look up the same key multiple times.
Collection ID lookup calls
find()and thenoperator[]for both the scopeand collection. The local manifest update path similarly repeats bucket
lookups.
What is changed and the side effects?
Changed:
find()in the collection ID lookup andlocal manifest update paths.
emplace()to add a missing local manifest.after a miss.
Side effects:
Performance effects: Successful collection ID lookups avoid two repeated map
lookups. The performance impact has not been benchmarked.
Breaking backward compatibility: None. Cache lookup and update behavior
remains unchanged.
Check List:
brpc_couchbase_unittestand passed all 7CouchbaseUnitTesttests.