[#12486] fix(core): version-validate user/group entity cache via updated_at - #12487
Open
lasdf1234 wants to merge 6 commits into
Open
[#12486] fix(core): version-validate user/group entity cache via updated_at#12487lasdf1234 wants to merge 6 commits into
lasdf1234 wants to merge 6 commits into
Conversation
…sed externalId mutations update/updateById now put the updated entity into the name-keyed cache so later get-by-name sees the change. Remove unused remove/update/delete-by-externalId APIs; keep get-by-externalId. Co-authored-by: Cursor <cursoragent@cursor.com>
…eThroughCache The helper only wrapped cache.put; updateById never hits a rename. Co-authored-by: Cursor <cursoragent@cursor.com>
…ty_change_log Name-keyed Caffeine cannot be updated on peers by cache.put. Write ALTER/DROP rows for user/group so EntityCacheChangeLogListener can invalidate them, and skip USER/GROUP in JCasbin so those rows do not warn. Co-authored-by: Cursor <cursoragent@cursor.com>
lasdf1234
requested review from
roryqi and
yuqi1129
and removed request for
yuqi1129
August 18, 2026 12:16
…a updated_at Name-keyed get now reloads USER/GROUP when user_meta/group_meta.updated_at has advanced, so HA peers do not serve a stale enabled flag or role list. Co-authored-by: Cursor <cursoragent@cursor.com>
…ith project conventions Move the helper under storage.relational.utils, keep private methods at the end of RelationalEntityStore, order builders with fields, and drop core Javadoc references to the JCasbin authorizer. Co-authored-by: Cursor <cursoragent@cursor.com>
Drop getFreshFromCache / isFresh / UserGroupEntityVersions. Name-keyed USER/GROUP get uses the same getUserUpdatedAt / getGroupUpdatedAt probe and id + updated_at comparison as loadUserRoles / loadGroupRoles. Co-authored-by: Cursor <cursoragent@cursor.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.
What changes were proposed in this pull request?
store.getcan use the per-node cache.user_meta.updated_at/group_meta.updated_atonUserEntity/GroupEntity(and the corresponding POs/SQL selects).get/exists/batchGet, version-validate cached USER/GROUP entries against*_meta.updated_at; invalidate and reload when the sentinel or id no longer matches (covers HA peers andupdateByIdpaths that do not emit entity change-log rows).RelationalEntityStore.updatefor USER/GROUP, invalidate the name key instead ofcache.put, so the next read reloads a fresh snapshot with the new sentinel.getUserByExternalId/getGroupByExternalIdand historicalOperationType.REMOVE_*_BY_EXTERNAL_IDfor audit log parsing.Why are the changes needed?
After
alterUserById/alterGroupById(for example SCIM PATCHactive=false), name-basedgetUser/getGroupcan keep serving a stale cached entity on peer nodes until TTL. GET-by-id is unaffected because it always hits the backend. Change-log invalidation alone is insufficient for USER/GROUP becauseupdateByIddoes not writeentity_change_log.Fix: #12486
Does this PR introduce any user-facing change?
Yes. These dispatcher/storage methods are removed:
removeUserByExternalIdremoveGroupByExternalIdSupportsExternalIdOperations.updateByExternalId/deleteByExternalId(and the corresponding JDBC/UserMetaService paths)No change to public REST APIs. Caching USER/GROUP is an internal store behavior; clients still see the same
getUser/getGroupresults, now without cross-node staleenabled/ role snapshots.How was this patch tested?
TestUserGroupEntityCacheVersionCheck(reload afterupdated_atadvances; reload after delete)TestBaseEntityCache(USER/GROUP are cacheable; ROLE remains non-cacheable)