Skip to content

CBG-5223: Include both MetadataStore datastores in caching feed#8226

Merged
bbrks merged 2 commits intomainfrom
CBG-5223
May 6, 2026
Merged

CBG-5223: Include both MetadataStore datastores in caching feed#8226
bbrks merged 2 commits intomainfrom
CBG-5223

Conversation

@bbrks
Copy link
Copy Markdown
Member

@bbrks bbrks commented May 5, 2026

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

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>
Copilot AI review requested due to automatic review settings May 5, 2026 15:31
Copy link
Copy Markdown
Contributor

Copilot AI left a 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 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.

Comment thread db/change_listener_dual_metadata_test.go
Comment thread db/change_listener_dual_metadata_test.go
@bbrks bbrks assigned gregns1 and unassigned gregns1 May 5, 2026
@bbrks bbrks requested review from gregns1 May 5, 2026 15:51
Copy link
Copy Markdown
Contributor

@gregns1 gregns1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@bbrks bbrks merged commit 2809904 into main May 6, 2026
48 checks passed
@bbrks bbrks deleted the CBG-5223 branch May 6, 2026 10:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants