imbajin commented on code in PR #3275:
URL: https://github.com/apache/hugegraph/pull/3275#discussion_r4208078195


##########
hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/GraphIndexTransaction.java:
##########
@@ -1557,13 +1557,27 @@ private static void validateIndexLabel(IndexLabel 
indexLabel) {
                         indexLabel, indexLabel.status());
     }
 
-    private static boolean hasNullableProp(HugeElement element, Id key) {
-        return element.schemaLabel().nullableKeys().contains(key);
+    private boolean hasNullableProp(HugeElement element, Id key) {
+        return 
this.currentSchemaLabel(element.schemaLabel()).nullableKeys().contains(key);
     }
 
-    private static Set<IndexLabel> relatedIndexLabels(HugeElement element) {
+    Set<Id> indexLabelIds(SchemaLabel label) {
+        return this.currentSchemaLabel(label).indexLabels();
+    }
+
+    private SchemaLabel currentSchemaLabel(SchemaLabel label) {
+        // Elements can outlive schema cache eviction. Resolve the current 
index
+        // membership rather than using the schema object retained by an 
element.
+        ISchemaTransaction schema = this.params().schemaTransaction();
+        SchemaLabel current = label.type() == HugeType.VERTEX_LABEL ?
+                              schema.getVertexLabel(label.id()) : 
schema.getEdgeLabel(label.id());
+        E.checkArgument(current != null, "Not exist schema label with id 
'%s'", label.id());

Review Comment:
   Missing-schema cleanup now falls back to the retained undefined label while 
existing labels still use current schema metadata. Three real-backend deletion 
regressions (vertex, edge, and an adjacent vertex) pass under Java 17/Maven 
3.10. Published in [8a8ead](https://github.com/apache/hugegraph/commit/8a8ead).



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

Reply via email to