yuqi1129 commented on code in PR #9638:
URL: https://github.com/apache/gravitino/pull/9638#discussion_r2672174824
##########
core/src/main/java/org/apache/gravitino/storage/relational/RelationalEntityStore.java:
##########
@@ -264,7 +265,21 @@ public <E extends Entity & HasIdentifier> List<E>
updateEntityRelations(
NameIdentifier[] destEntitiesToAdd,
NameIdentifier[] destEntitiesToRemove)
throws IOException, NoSuchEntityException, EntityAlreadyExistsException {
+
+ // We need to clear the cache of the source entity and all destination
entities being added or
+ // removed. This ensures that any subsequent reads will fetch the updated
relations from the
+ // backend. For example, if we are adding a tag to table, we need to
invalidate the cache for
+ // that table and the tag being added or removed. Otherwise, we might
return stale data if we
+ // list all tags for that table or all tables for that tag.
cache.invalidate(srcEntityIdent, srcEntityType, relType);
+ for (NameIdentifier destToAdd : destEntitiesToAdd) {
+ cache.invalidate(destToAdd, srcEntityType, relType);
+ }
+
+ for (NameIdentifier destToRemove : destEntitiesToRemove) {
+ cache.invalidate(destToRemove, srcEntityType, relType);
Review Comment:
It's not a problem.
--
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]