Skip to content

fix background sync always detecting policy inconsistency for things with policy imports#2317

Merged
thjaeckle merged 2 commits intoeclipse-ditto:masterfrom
beyonnex-io:bugfix/background-sync-missing-referenced-policies-projection
Jan 23, 2026
Merged

fix background sync always detecting policy inconsistency for things with policy imports#2317
thjaeckle merged 2 commits intoeclipse-ditto:masterfrom
beyonnex-io:bugfix/background-sync-missing-referenced-policies-projection

Conversation

@thjaeckle
Copy link
Copy Markdown
Member

The MongoDB projection in sudoStreamMetadata() was missing FIELD_REFERENCED_POLICIES, causing the indexed metadata to always have an empty set of referenced policies. This made BackgroundSyncStream.checkReferencedPoliciesForConsistency() always detect a mismatch for things whose policies have imports, triggering continuous unnecessary search index updates with invalidatePolicy=true.

…with policy imports

The MongoDB projection in sudoStreamMetadata() was missing FIELD_REFERENCED_POLICIES,
causing the indexed metadata to always have an empty set of referenced policies.
This made BackgroundSyncStream.checkReferencedPoliciesForConsistency() always detect
a mismatch for things whose policies have imports, triggering continuous unnecessary
search index updates with invalidatePolicy=true.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Thomas Jäckle <thomas.jaeckle@beyonnex.io>
@thjaeckle thjaeckle added this to the 3.9.0 milestone Jan 23, 2026
@thjaeckle thjaeckle self-assigned this Jan 23, 2026
@thjaeckle thjaeckle added the bug label Jan 23, 2026
@thjaeckle thjaeckle modified the milestones: 3.9.0, 3.8.12 Jan 23, 2026
@thjaeckle
Copy link
Copy Markdown
Member Author

I was wondering why we would have so many things loaded into memory in our Ditto installation - even if many of those are not actively used ..

Found out this is (at least one of the) reason(s).

We use policy imports a lot - and the search's BackgroundSyncStream did not query the __referencedPolicies from the search collection. Which leads to a falsely detected "inconsistency" - causing a re-sync of the thing to the search index, which would load the ThingPersistenceActor into memory.

@thjaeckle thjaeckle merged commit e24aaa6 into eclipse-ditto:master Jan 23, 2026
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants