Conversation
Subscribe the caching DCP feed to both the primary (_system._mobile) and fallback (_default._default) datastores when the metadata store is a *base.MetadataStore, so _sync:* mutations are observed regardless of which collection currently holds the doc during metadata migration. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR updates the cache listener’s DCP subscription setup so Sync Gateway can observe _sync:* mutations from either metadata collection during dual-metadata migration, and adds focused tests around the collection-selection helper.
Changes:
- Extracts caching-feed collection selection into
cachingFeedCollections. - Includes both primary (
_system._mobile) and fallback (_default._default) metadata datastores when the metadata store is a*base.MetadataStore. - Adds tests covering dual-metadata, single-metadata, and user-scope inclusion cases.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
db/change_listener.go |
Refactors cache-feed subscription setup and expands it for dual metadata-store migration. |
db/change_listener_dual_metadata_test.go |
Adds helper-level tests for dual metadata-store collection selection. |
gregns1
left a comment
There was a problem hiding this comment.
LGTM, did some manual testing adding some user docs to both primary and fallback stores and found the mutation feed a bit broken because GetRaw inside fetchMetadataDocBody drops cas when fetching from fallback. Mistake made in earlier PR I think so any user docs in fallback get ignored because CAS doesn't match dcp event.
Not needed to fix in this PR but just so you're aware.
CBG-5223
Subscribe the caching DCP feed to both the primary (_system._mobile) and fallback (_default._default) datastores when the metadata store is a base.MetadataStore, so _sync: mutations are observed regardless of which collection currently holds the doc during metadata migration.
Integration Tests