VGalaxies commented on code in PR #2619:
URL:
https://github.com/apache/incubator-hugegraph/pull/2619#discussion_r1723083528
##########
hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/cache/CachedSchemaTransactionV2.java:
##########
@@ -107,44 +107,11 @@ private void listenChanges() {
};
this.graphParams().loadGraphStore().provider().listen(this.storeEventListener);
- // Listen cache event: "cache"(invalid cache item)
- this.cacheEventListener = event -> {
- LOG.debug("Graph {} received schema cache event: {}",
- this.graph(), event);
- Object[] args = event.args();
- E.checkArgument(args.length > 0 && args[0] instanceof String,
- "Expect event action argument");
- if (Cache.ACTION_INVALID.equals(args[0])) {
- event.checkArgs(String.class, HugeType.class, Id.class);
- HugeType type = (HugeType) args[1];
- Id id = (Id) args[2];
- this.arrayCaches.remove(type, id);
-
- id = generateId(type, id);
- Object value = this.idCache.get(id);
- if (value != null) {
- // Invalidate id cache
- this.idCache.invalidate(id);
-
- // Invalidate name cache
- SchemaElement schema = (SchemaElement) value;
- Id prefixedName = generateId(schema.type(),
- schema.name());
- this.nameCache.invalidate(prefixedName);
- }
- this.resetCachedAll(type);
- return true;
- } else if (Cache.ACTION_CLEAR.equals(args[0])) {
- event.checkArgs(String.class, HugeType.class);
- this.clearCache(false);
- return true;
- }
- return false;
- };
- EventHub schemaEventHub = this.graphParams().schemaEventHub();
- if (!schemaEventHub.containsListener(Events.CACHE)) {
- schemaEventHub.listen(Events.CACHE, this.cacheEventListener);
- }
Review Comment:
For detailed information, see the failed test case here 👉
https://github.com/apache/incubator-hugegraph/actions/runs/10431704040/job/28891653277?pr=2619

--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]