Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getVertex() called with the result of getId().toString() doesn’t always find edges #1853

Closed
migru opened this issue Nov 28, 2013 · 3 comments
Assignees
Milestone

Comments

@migru
Copy link

migru commented Nov 28, 2013

We are storing the ids of vertices in an external tool and try to find a vertex later by its id.
Instead of the ORecordId returned by vertex.getId() we take the result of ORecordId’s toString() method. It looks like “#9:-3”.
It’s no problem to find a vertex by graphDB.getVertex(“#9:-3”)
But if this vertex has more than one edge and we try to remove one edge this warning is logged:

“WARNING: Edge not found in vertex's property #9:-2.out_rs01 set while removing the edge #9:-3”

Debugging this warning yields to this call stack

IdentyHashMap<K,V>.containsKey(Object) line 355
OMVRBTreeRID.remove line 201
OMVRBTreeRIDSet.remove line 123
OrientEdge.dropEdgeFromVertex line 441
OrientEdge.remove line 231
…

IdentyHashMap containsKey tests keys by “==” and not by “equals” and can therefore not find the vertex returned by graphDB.getVertex(“#9:-3”).

The behavior can be reproduced by this unit test:

public void testRemoveEdge() {
    String nameRs1 = "rs01";
    // create three vertices
    Vertex vSource = graphDB.addVertex(1);
    Vertex vTarget1 = graphDB.addVertex(2);
    Vertex vTarget2 = graphDB.addVertex(3);
    // take the string representation of ORecordId
    String id = vTarget1.getId().toString();
    // find vertex by the string representation of its id
    vTarget2 = graphDB.getVertex(id);
    Edge e1 = vSource.addEdge(nameRs1,vTarget1);
    vSource.addEdge(nameRs1,vTarget2);
    // WARNING: Edge not found….
    e1.remove();
    graphDB.commit();
}

We are using Blueprints 2.5.0-SNAPSHOT and OrientDB 1.6.1
The graph database is configure by

    setUseLightweightEdges(true)
    setUseClassForEdgeLabel(false)
    setUseClassForVertexLabel(false)
    setUseVertexFieldsForEdgeLabels(true)
@lvca
Copy link
Member

lvca commented Dec 2, 2013

Since in the next 2 months we're replacing OMVRBTreeRID with new structure this problem should be fixed automatically. Let's wait for it.

@ghost ghost assigned laa Dec 2, 2013
@migru
Copy link
Author

migru commented Dec 3, 2013

Is there a solution meanwhile?

@lvca lvca closed this as completed Aug 28, 2014
@lvca
Copy link
Member

lvca commented Aug 28, 2014

Fixed in 1.7

@lvca lvca modified the milestones: 2.0rc1, 1.7 Aug 28, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants