Repository navigation
fix(dynamic-entity): drop the memoized definition lists when definitions change - #2955
Merged
simonredfern merged 2 commits intoNov 3, 2026
Conversation
…ons change DynamicEntityHelper rebuilds its definitions map from NewStyle.getDynamicEntities, which keeps its list in Redis for dynamicEntity.cache.ttl.seconds. forgetDefinitions now also deletes the memoized getDynamicEntities lists, once the request's transaction has committed, so the rebuilt map reads the current rows and a new entity's record endpoints answer immediately instead of after the map's time-to-live. This node's map is still dropped at once for reads later in the same request.
…for definitions A definition change now bumps a new dynamic_entity cache namespace once its transaction has committed, instead of deleting the memoized lists by pattern. The lists NewStyle.getDynamicEntities and getDynamicEntitiesByUserId memoize carry that version in their keys, and DynamicEntityHelper keeps its definitions map (DefinitionsMapCache) only while the version is the one it was built under, so every instance reads the definitions again within a second, and a read still in flight cannot store old rows under the new version. The dynamic resource-doc caches are bumped in the same after-commit step rather than inside the request transaction. The namespace is listed on the cache info page and can be bumped through the cache namespace endpoint.
|
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.



Dynamic entity definitions now follow a new
dynamic_entitycache namespace version. When a definition is created, updated or deleted,DynamicEntityHelper.forgetDefinitionsbumps that version once the request's transaction has committed (nothing happens on rollback), then drops this instance's map and bumps the dynamic resource-doc caches in the same after-commit step. The listsNewStyle.getDynamicEntitiesandgetDynamicEntitiesByUserIdmemoize in Redis carry the version in their keys, and the definitions map is kept (DefinitionsMapCache) only while the version is the one it was built under, so a new entity's record endpoints, the management lists and/resource-docsreflect the change at once on the instance that made it and within a second on every other instance, and a read still in flight cannot store old rows under the new version. The namespace is listed on the cache info page and can be bumped throughPOST /management/cache/namespaces/invalidate.DefinitionsCacheInvalidationTestcovers the namespace registration, the after-commit and rollback behaviour of the bumps (it needs Redis, like the other Redis-backed tests), and the map cache's version, time-to-live and forget rules. The dynamic entity, resource-doc and cache suites pass locally, and on a k3s deployment with the default list cache the dynamic entity end-to-end test passes, with OBP-API logging thedynamic_entity,rd_dynamicandrd_allbumps after the commit on create and on delete.