-
Notifications
You must be signed in to change notification settings - Fork 141
CBG-4542: do not add to rev cache on write unless configured to do so #8050
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
base: main
Are you sure you want to change the base?
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 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) |
Copilot
AI
Feb 2, 2026
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.
Debug logging level base.KeyAll should be removed. Use base.KeyNone for test logging unless debugging is actively needed.
Redocly previews |
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)