CBG-4542: do not add to rev cache on write unless configured to do so#8050
Open
CBG-4542: do not add to rev cache on write unless configured to do so#8050
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces a configurable option to control whether document revisions are inserted into the revision cache during write operations. By default, revisions will no longer be automatically cached on write, improving memory efficiency by only caching revisions when they are read from the database.
Changes:
- Added
InsertOnWriteconfiguration option toRevCacheConfigwith a default value offalse - Updated tests to accommodate the new caching behavior by either enabling
InsertOnWriteor explicitly loading revisions into the cache - Fixed test assertions to reflect the expected cache miss counts with the new default behavior
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| rest/config.go | Adds the InsertOnWrite field to the RevCacheConfig struct |
| rest/server_context.go | Propagates the InsertOnWrite configuration to revision cache options |
| db/revision_cache_interface.go | Adds InsertOnWrite field to RevisionCacheOptions |
| db/crud.go | Conditionally inserts revisions into cache based on InsertOnWrite setting |
| docs/api/components/schemas.yaml | Documents the new insert_on_write API parameter |
| rest/revocation_test.go | Enables InsertOnWrite for a test that requires revisions to be cached on write |
| rest/attachment_test.go | Adds explicit cache preload when flushCache is false |
| db/revision_cache_test.go | Updates cache miss count assertions and adds cache preloading where needed |
| rest/changestest/changes_api_test.go | Re-enables skipped test and updates expected results for pruned documents |
| func TestChangesIncludeDocs(t *testing.T) { | ||
| base.SetUpTestLogging(t, base.LevelInfo, base.KeyNone) | ||
| t.Skip("pending CBG-4542") | ||
| base.SetUpTestLogging(t, base.LevelInfo, base.KeyAll) |
There was a problem hiding this comment.
Debug logging level base.KeyAll should be removed. Use base.KeyNone for test logging unless debugging is actively needed.
Redocly previews |
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.
CBG-4542
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/262/GSI=true,xattrs=truehttps://jenkins.sgwdev.com/job/SyncGatewayIntegration/263/ (disable rev cache)