Database Cache: Fix full database cache rebuild dropping variant and composed property values (closes #21863, #21882)#21890
Merged
AndyButland merged 2 commits intomainfrom Feb 25, 2026
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes critical bugs in the database cache rebuild functionality that caused data loss during full cache rebuilds triggered from the Umbraco dashboard. The fix ensures that variant properties, composed properties, and the secondary published content cache are all correctly handled during rebuild operations.
Changes:
- Fixed
GetPropertyInfoByContentTypeto fetch all content type IDs when called with empty collection (full rebuild scenario), preventing variant properties from being dropped - Fixed
GetCompositionHierarchyto handle full rebuild scenario by resolving compositions for all child types when the input collection is empty - Fixed
ClearMemoryCacheAsyncin bothDocumentCacheServiceandMediaCacheServiceto clear the secondary_publishedContentCachedictionary, preventing stale content from being served - Added comprehensive integration tests covering invariant content, variant culture-specific properties, and composed properties during full rebuild
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| tests/Umbraco.Tests.Integration/Umbraco.PublishedCache.HybridCache/DocumentCacheServiceTests.cs | Added three integration tests to verify full rebuild correctly handles invariant content, variant properties, and composed properties; added IDatabaseCacheRebuilder service accessor for testing full rebuild path |
| src/Umbraco.PublishedCache.HybridCache/Services/MediaCacheService.cs | Added _publishedContentCache.Clear() call at the start of ClearMemoryCacheAsync to prevent serving stale cached content |
| src/Umbraco.PublishedCache.HybridCache/Services/DocumentCacheService.cs | Added _publishedContentCache.Clear() call at the start of ClearMemoryCacheAsync to prevent serving stale cached content |
| src/Umbraco.PublishedCache.HybridCache/Persistence/DatabaseCacheRepository.cs | Modified GetPropertyInfoByContentType to fetch all content type IDs when input is empty; updated GetCompositionHierarchy to handle empty input by using all child IDs from composition table |
src/Umbraco.PublishedCache.HybridCache/Persistence/DatabaseCacheRepository.cs
Outdated
Show resolved
Hide resolved
tests/Umbraco.Tests.Integration/Umbraco.PublishedCache.HybridCache/DocumentCacheServiceTests.cs
Outdated
Show resolved
Hide resolved
Zeegaan
approved these changes
Feb 25, 2026
Member
Zeegaan
left a comment
There was a problem hiding this comment.
Looks good and tests good, especially love the integration tests 🚀
Contributor
Author
|
Cherry-picked into |
This was referenced Feb 26, 2026
Closed
Open
alexsee
pushed a commit
to alexsee/umbraco-container
that referenced
this pull request
Mar 7, 2026
Updated [Umbraco.Cms](https://github.com/umbraco/Umbraco-CMS) from 17.2.0 to 17.2.1. <details> <summary>Release notes</summary> _Sourced from [Umbraco.Cms's releases](https://github.com/umbraco/Umbraco-CMS/releases)._ ## 17.2.1 ## What's Changed ### 🐛 Bug Fixes * URL Info: Fix invariant content URLs missing under non-default language domains (closes #21866) by @AndyButland in umbraco/Umbraco-CMS#21883 * Database Cache: Fix full database cache rebuild dropping variant and composed property values (closes #21863, #21882) by @AndyButland in umbraco/Umbraco-CMS#21890 **Full Changelog**: umbraco/Umbraco-CMS@release-17.2.0...release-17.2.1 Commits viewable in [compare view](umbraco/Umbraco-CMS@release-17.2.0...release-17.2.1). </details> Updated [Umbraco.Cms.Persistence.Sqlite](https://github.com/umbraco/Umbraco-CMS) from 17.2.0 to 17.2.1. <details> <summary>Release notes</summary> _Sourced from [Umbraco.Cms.Persistence.Sqlite's releases](https://github.com/umbraco/Umbraco-CMS/releases)._ ## 17.2.1 ## What's Changed ### 🐛 Bug Fixes * URL Info: Fix invariant content URLs missing under non-default language domains (closes #21866) by @AndyButland in umbraco/Umbraco-CMS#21883 * Database Cache: Fix full database cache rebuild dropping variant and composed property values (closes #21863, #21882) by @AndyButland in umbraco/Umbraco-CMS#21890 **Full Changelog**: umbraco/Umbraco-CMS@release-17.2.0...release-17.2.1 Commits viewable in [compare view](umbraco/Umbraco-CMS@release-17.2.0...release-17.2.1). </details> Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) </details> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This was referenced Mar 2, 2026
Open
alexsee
pushed a commit
to alexsee/umbraco-container
that referenced
this pull request
Mar 7, 2026
Updated [Umbraco.Cms](https://github.com/umbraco/Umbraco-CMS) from 17.2.0 to 17.2.1. <details> <summary>Release notes</summary> _Sourced from [Umbraco.Cms's releases](https://github.com/umbraco/Umbraco-CMS/releases)._ ## 17.2.1 ## What's Changed ### 🐛 Bug Fixes * URL Info: Fix invariant content URLs missing under non-default language domains (closes #21866) by @AndyButland in umbraco/Umbraco-CMS#21883 * Database Cache: Fix full database cache rebuild dropping variant and composed property values (closes #21863, #21882) by @AndyButland in umbraco/Umbraco-CMS#21890 **Full Changelog**: umbraco/Umbraco-CMS@release-17.2.0...release-17.2.1 Commits viewable in [compare view](umbraco/Umbraco-CMS@release-17.2.0...release-17.2.1). </details> Updated [Umbraco.Cms.Persistence.Sqlite](https://github.com/umbraco/Umbraco-CMS) from 17.2.0 to 17.2.1. <details> <summary>Release notes</summary> _Sourced from [Umbraco.Cms.Persistence.Sqlite's releases](https://github.com/umbraco/Umbraco-CMS/releases)._ ## 17.2.1 ## What's Changed ### 🐛 Bug Fixes * URL Info: Fix invariant content URLs missing under non-default language domains (closes #21866) by @AndyButland in umbraco/Umbraco-CMS#21883 * Database Cache: Fix full database cache rebuild dropping variant and composed property values (closes #21863, #21882) by @AndyButland in umbraco/Umbraco-CMS#21890 **Full Changelog**: umbraco/Umbraco-CMS@release-17.2.0...release-17.2.1 Commits viewable in [compare view](umbraco/Umbraco-CMS@release-17.2.0...release-17.2.1). </details> Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) </details> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
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.
Description
Fixes a regression introduced in 17.2 (PR #21207) where the "Rebuild Database Cache" dashboard action produces empty or incomplete property values in the
cmsContentNutable. Per-content-type rebuilds (triggered by saving a content type) were unaffected.Addresses #21882, #21863.
The problem
When "Rebuild Database Cache" is clicked in Settings > Published Status,
DatabaseCacheRebuildercallsRebuild([], [], [])with empty arrays, meaning "rebuild all content types." Two methods inDatabaseCacheRepositorymishandled this empty input affecting variant and composition properties:GetPropertyInfoByContentTypehad an early return whencontentTypeIdswas empty, returning an empty dictionary. Without property type metadata,BuildPropertyDataDictionarytreated every property as invariant (variation = 0). The downstream filterif (effectivelyVariesByCulture || string.IsNullOrEmpty(cultureCode))then dropped all culture-specific property values becauseeffectivelyVariesByCulturewas alwaysfalseand culture codes were non-empty.GetCompositionHierarchyiterated overcontentTypeIdsto resolve compositions and hence failed to load properties inherited from composition types.A secondary issue existed in
DocumentCacheServiceandMediaCacheService:ClearMemoryCacheAsync(the "Reload Memory Cache" button) cleared theHybridCachebut not the_publishedContentCacheConcurrentDictionary. This meant stale convertedIPublishedContentobjects continued to be served until an app restart.The fix
GetPropertyInfoByContentType: WhencontentTypeIdsis empty, fetch all content type IDs from the database and use those as the effective set, rather than returning early. This matches the pattern already used byGetContentTypeVariations.GetCompositionHierarchy: WhencontentTypeIdsis empty, iterate over all child IDs found in the composition table (directParents.Keys) instead of the empty input.ClearMemoryCacheAsync: Call_publishedContentCache.Clear()before clearing theHybridCachein bothDocumentCacheServiceandMediaCacheService.Testing
Existing and issue specific tests for this regression should pass.
#21882 provides a good description of the problem and sample project that can be used for manual testing.