Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove all tightly coupled EntityCache dependencies in the main persistence stack #1055

Merged

Conversation

dennishuo
Copy link
Contributor

@dennishuo dennishuo commented Feb 24, 2025

Remove the EntityCacheEntry wrapper since the timestamp fields were never used anyways; instead the underlying Caffeine cache transparently handles access times, and the types of entries we cache are simply the existing ResolvedPolarisEntity.

Remove interactions of business logic with explicit "cache entries", instead operating on ResolvedPolarisEntity. Fix the equals()/hashCode() behavior of PolarisEntity to be compatible with PolarisBaseEntity as intended.

Improve code comments to explain the (current) relationship between PolarisEntity and PolarisBaseEntity, and clarify the behaviors in Resolver.java.

Fully remove the PolarisRemoteCache interface and its methods. Add different methods that aren't cache-specific instead.

Add support for constructing Resolver with null EntityCache to skip all cache interactions entirely.

…stence stack

Remove the EntityCacheEntry wrapper since the timestamp fields were never used anyways;
instead the underlying Caffeine cache transparently handles access times, and the
types of entries we cache are simply the existing ResolvedPolarisEntity.

Remove interactions of business logic with explicit "cache entries", instead
operating on ResolvedPolarisEntity. Fix the equals()/hashCode() behavior of
PolarisEntity to be compatible with PolarisBaseEntity as intended.

Improve code comments to explain the (current) relationship between PolarisEntity
and PolarisBaseEntity, and clarify the behaviors in Resolver.java.

Fully remove the PolarisRemoteCache interface and its methods. Add different
methods that aren't cache-specific instead.
* Currently, code that intends to operate directly on a PolarisBaseEntity may not adhere to
* immutability semantics, and may modify the entity in-place.
*
* <p>TODO: Combine this fully into PolarisBaseEntity, refactor all callsites to use strict
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It sounds reasonnable to me to only have PolarisBaseEntity. PolarisEntity is a bit confusing at first glance.

Copy link
Contributor

@eric-maynard eric-maynard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM; I think we can fast follow on the PolarisEntity

@dennishuo dennishuo merged commit 9fc0632 into apache:main Feb 24, 2025
5 checks passed
@dennishuo dennishuo deleted the dhuo-refactor-to-remove-cache-dependency branch February 24, 2025 19:40
dimas-b added a commit to dimas-b/polaris that referenced this pull request Mar 6, 2025
Following up on apache#1055, this refactoring does not remove `EntityCache`,
but allows it to be `null` in principle, should a particular
MetaStoreManagerFactory implementation choose not to use an `EntityCache`.

* Remove bean producer for `EntityCache` (beans cannot be `null`).

* Harmonize all `PolarisEntityManager` producers (explicit and CDI)
  to go through `RealmEntityManagerFactory` (tangential to the cache
  being null, but related).
dimas-b added a commit that referenced this pull request Mar 8, 2025
Following up on #1055, this refactoring does not remove `EntityCache`,
but allows it to be `null` in principle, should a particular
MetaStoreManagerFactory implementation choose not to use an `EntityCache`.

* Remove bean producer for `EntityCache` (beans cannot be `null`).

* Harmonize all `PolarisEntityManager` producers (explicit and CDI)
  to go through `RealmEntityManagerFactory` (tangential to the cache
  being null, but related).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants