yuqi1129 commented on issue #8743:
URL: https://github.com/apache/gravitino/issues/8743#issuecomment-3384030972
Yeah, you are right. The problem lies in
```java
public void put(
NameIdentifier nameIdentifier, Entity.EntityType type,
EntityCacheRelationKey key) {
EntityCacheKey entityCacheKey = EntityCacheKey.of(nameIdentifier, type);
String strEntityCacheKey = entityCacheKey.toString();
// reverseIndex.getValuesForKeysStartingWith(strEntityCacheKey) is
time-consuming. If there is no need to measure the size //of
entityKeys, we can remove this logic. `Lists.newArrayList()` will repeatedly
call the iterator for `reverseIndex` and it
// indeed takes too much time.
List<EntityCacheKey> entityKeys =
Lists.newArrayList(reverseIndex.getValuesForKeysStartingWith(strEntityCacheKey));
String strEntityCacheKeySerialNumber =
String.format("%s-%d", strEntityCacheKey, entityKeys.size());
reverseIndex.put(strEntityCacheKeySerialNumber, key);
}
```
--
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]