Skip to content

Name-keyed cache eviction takes two round trips; SearchSettingsMergeUtil pins SystemRepository at class load #33538

Closed

Description

@harshach

Two independent papercuts in the same area, both found while measuring #33248.

1. An entity cached by name is evicted with two round trips

CachedEntityDao.invalidateByName and deleteByName each issue two DELs — one for the entity
alias, one for the reference alias:

String cacheKeyEntity = keys.entityByName(entityType, fqn);
String cacheKeyRef = keys.refByName(entityType, fqn);
cache.del(cacheKeyEntity);
cache.del(cacheKeyRef);

Between them a concurrent reader can see one alias evicted and the other still live, and cache a
view of the entity assembled from both halves. CacheProvider.del is already del(String... keys),
so this is one call.

2. SearchSettingsMergeUtil resolves SystemRepository at class-load time

private static final SystemRepository systemRepository = Entity.getSystemRepository();

SystemRepository's own constructor ends with Entity.setSystemRepository(this), and callers
construct one freely — OpenMetadataApplication:315, OpenMetadataOperations:3416, the
@Repository scan in Entity.initializeRepositories, and EmailUtil:440 on every use. So the
global is replaced repeatedly over a JVM's life while this field pins whichever instance was current
when the class first loaded, and it is a migration utility — loaded at whatever point the first
migration touches it.

To be accurate about severity: the instances are functionally equivalent as long as they share the
same CollectionDAO, so this is a latent correctness hazard rather than a reproducible production
failure. It is worth fixing because it is a service-locator call frozen at class-init, the failure
mode is silent, and any change to bootstrap ordering turns it into an NPE for the life of the
process. It is a concrete instance of #33523.

How we know it is fixed

  • CachedEntityDaoAliasEvictionTest: both name-keyed evictions issue exactly one del carrying both
    keys; the id-keyed eviction still carries one.
  • SearchSettingsMergeUtilTest: after the registered SystemRepository is replaced, the util reads
    and writes through the new one. Both fail on main today.

Activity

  1. added this to Shipping and removed this from Roadmapon Sep 17, 2026
  2. moved this to In Review / QA 👀 in Shippingon Sep 17, 2026
  3. moved this from In Review / QA 👀 to Done ✅ in Shippingon Sep 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    • Status
      Done ✅

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions