JanusGraph / JanusGraph/janusgraph
how to remove RelationshipIndex schema
- Dominant language
- Java
- Stars
- 5.8k
- Forks
- 1.2k
- Avg merge
- 13h 53m
- Merged PRs (30d)
- 6
Description
1、 delete relatioinshipindex schema
------------------------------------------------
RelationType key = ((RelationTypeIndex)index).getType();
if(key instanceof EdgeLabelVertex)
{
Iterator relationEdges = key.query().types(BaseLabel.SchemaDefinitionEdge).direction(Direction.OUT).edges().iterator();
while (relationEdges.hasNext()) {
JanusGraphEdge e = relationEdges.next();
JanusGraphSchemaVertex v = (JanusGraphSchemaVertex) e.inVertex();
//TODO
if (v != null && v.name().contains(indexName)) {
//remove the edge from index to index field
e.remove();
}
}
((EdgeLabelVertex)key).resetCache();
}
}
//remove index
indexVertex.remove();
indexVertex.resetCache();
schemaCache.expireSchemaElement(indexLongId);
mgmt.commit();
2、check relationshipIndex schema deleted or not
----------------------------------------------------------
ManagementSystem. getRelationIndex(RelationType type, String name)
3、throw exception
--------------------------------------------------------
Caused by: java.lang.IllegalArgumentException
at com.google.common.base.Preconditions.checkArgument(Preconditions.java:77)
at org.janusgraph.graphdb.database.management.RelationTypeIndexWrapper.(RelationTypeIndexWrapper.java:36)
at org.janusgraph.graphdb.database.management.ManagementSystem$2.apply(ManagementSystem.java:402)
at org.janusgraph.graphdb.database.management.ManagementSystem$2.apply(ManagementSystem.java:398)
at com.google.common.collect.Iterators$8.transform(Iterators.java:794)
at com.google.common.collect.TransformedIterator.next(TransformedIterator.java:48)
at org.visallo.web.routes.graphbase.graphindex.GraphBaseIndexList.handle(GraphBaseIndexList.java:102)
Contributor guide
Research direction
Start by tracing ManagementSystem.getRelationIndex(RelationType type, String name) and RelationTypeIndexWrapper.java:36, using the reported ManagementSystem stack frames as the entry point. Check how relationship-index schema deletion is represented and why the wrapper rejects the remaining schema. Done means deletion can be verified through getRelationIndex without the reported IllegalArgumentException.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- database
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100