yuqi1129 commented on code in PR #12006:
URL: https://github.com/apache/gravitino/pull/12006#discussion_r3674537093


##########
core/src/main/java/org/apache/gravitino/storage/relational/RelationalEntityStore.java:
##########
@@ -396,37 +339,12 @@ public <E extends Entity & HasIdentifier> E 
getEntityByRelation(
       Entity.EntityType srcType,
       NameIdentifier destEntityIdent)
       throws IOException, NoSuchEntityException {
-    return cache.withCacheLock(
-        EntityCacheRelationKey.of(srcIdentifier, srcType, relType),
-        () -> {
-          Optional<List<E>> entities = cache.getIfPresent(relType, 
srcIdentifier, srcType);
-          if (entities.isPresent()) {
-            return entities.get().stream()
-                .filter(e -> e.nameIdentifier().equals(destEntityIdent))
-                .findFirst()
-                .orElseThrow(
-                    () ->
-                        new NoSuchEntityException(
-                            "No such entity with ident: %s", destEntityIdent));
-          }
-
-          // Use allFields=true to cache complete entities
-          List<E> backendEntities =
-              backend.listEntitiesByRelation(relType, srcIdentifier, srcType, 
true);
-
-          E r =
-              backendEntities.stream()
-                  .filter(e -> e.nameIdentifier().equals(destEntityIdent))
-                  .findFirst()
-                  .orElseThrow(
-                      () ->
-                          new NoSuchEntityException(
-                              "No such entity with ident: %s", 
destEntityIdent));
-
-          cache.put(srcIdentifier, srcType, relType, backendEntities);
-
-          return r;
-        });
+    List<E> backendEntities = backend.listEntitiesByRelation(relType, 
srcIdentifier, srcType, true);
+    return backendEntities.stream()
+        .filter(e -> e.nameIdentifier().equals(destEntityIdent))
+        .findFirst()
+        .orElseThrow(
+            () -> new NoSuchEntityException("No such entity with ident: %s", 
destEntityIdent));
   }

Review Comment:
   Changed.



-- 
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]

Reply via email to