#33538·OpenMetadata

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

Author: harshachCreated Sep 17, 2026Updated Sep 17, 2026

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:

java
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

java
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.

Source: open-metadata/OpenMetadata