Abyss-lord commented on code in PR #7354:
URL: https://github.com/apache/gravitino/pull/7354#discussion_r2134976699
##########
core/src/main/java/org/apache/gravitino/storage/relational/RelationalEntityStore.java:
##########
@@ -83,46 +101,124 @@ private static RelationalBackend
createRelationalEntityBackend(Config config) {
@Override
public <E extends Entity & HasIdentifier> List<E> list(
Namespace namespace, Class<E> type, Entity.EntityType entityType) throws
IOException {
- return backend.list(namespace, entityType, false);
+ if (!cacheEnabled) {
+ return backend.list(namespace, entityType, false);
+ }
+
+ return cache.withCacheLock(
+ () -> {
+ List<E> entities = backend.list(namespace, entityType, false);
+ entities.forEach(cache::put);
+
+ return entities;
Review Comment:
No, list operations must come from the underlying store to ensure data
consistency and freshness. The cache is only used for get-by-id or name lookups.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]