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

Doing a manual move Vertex on a child Vertex from an already moved Parent Vertex fails #4547

Closed
fandji opened this issue Jul 10, 2015 · 1 comment
Assignees
Labels

Comments

@fandji
Copy link

fandji commented Jul 10, 2015

OrientDB Version 2.0.12

As transactional remote sql commands arent supported, as such the move vertex command, we die create code which does move a vertex via tinkerpop. If we don't remove the edges of the vertices, which according to the documentation shouldn't be neccessary, we get the following error:

2015-07-10 15:17:47 INFO DeactivateNodeVertex:23 - Deactivating Parent_Vertex p1: v(Parent_Vertex)[#19:2]
2015-07-10 15:17:47 INFO DeactivateNodeVertex:27 - Created History_Parent_Vertex:v(Hist_Parent_Vertex)[#-1:-7]
2015-07-10 15:17:47 INFO DeactivateNodeVertex:38 - neuer Parent_Vertex in edge: e[#-1:-8][#22:0-belongsTo->#-1:-7]
2015-07-10 15:17:47 INFO DeactivateNodeVertex:51 - delete Parent_Vertex in edge: e[#27:16][#22:0-belongsTo->#19:2]
2015-07-10 15:17:47 INFO DeactivateNodeVertex:38 - neuer Parent_Vertex in edge: e[#-1:-9][#22:1-belongsTo->#-1:-7]
2015-07-10 15:17:47 INFO DeactivateNodeVertex:51 - delete Parent_Vertex in edge: e[#27:17][#22:1-belongsTo->#19:2]
2015-07-10 15:17:47 INFO DeactivateNodeVertex:38 - neuer Parent_Vertex in edge: e[#-1:-10][#22:2-belongsTo->#-1:-7]
2015-07-10 15:17:47 INFO DeactivateNodeVertex:51 - delete Parent_Vertex in edge: e[#27:18][#22:2-belongsTo->#19:2]
2015-07-10 15:17:47 INFO DeactivateNodeVertex:38 - neuer Parent_Vertex in edge: e[#-1:-11][#21:5-belongsTo->#-1:-7]
2015-07-10 15:17:47 INFO DeactivateNodeVertex:51 - delete Parent_Vertex in edge: e[#27:19][#21:5-belongsTo->#19:2]
2015-07-10 15:17:47 INFO DeactivateNodeVertex:58 - neuer Parent_Vertex out edge: e[#-1:-12][#-1:-7-belongsTo->#16:0]
2015-07-10 15:17:47 INFO DeactivateNodeVertex:71 - delete Parent_Vertex out edge: e[#27:14][#19:2-belongsTo->#16:0]
2015-07-10 15:17:47 INFO DeactivateNodeVertex:75 - Deleting Parent_Vertex: v(Parent_Vertex)[#19:2]
2015-07-10 15:17:47 INFO MergeJsonIntoGraph:171 - after NodePipe
2015-07-10 15:17:47 INFO MergeJsonIntoGraph:194 - before realPipe
2015-07-10 15:17:47 INFO DeactivateAppserverVertex:24 - Deactivating Child_Vertex c1: v(Child_Vertex)[#21:5]
2015-07-10 15:17:47 INFO DeactivateAppserverVertex:28 - Created History_Child_Vertex:v(Hist_Child_Vertex)[#-1:-13]
2015-07-10 15:17:47 INFO DeactivateAppserverVertex:59 - neuer Child_Vertex out edge: e[#-1:-14][#-1:-13-belongsTo->#-1:-7]
2015-07-10 15:17:47 INFO DeactivateAppserverVertex:59 - neuer Child_Vertex out edge: e[#-1:-15][#-1:-13-alterIch->#22:2]
2015-07-10 15:17:47 INFO DeactivateAppserverVertex:76 - Deleting Child_Vertex: v(Child_Vertex)[#21:5]
2015-07-10 15:17:47 INFO MergeJsonIntoGraph:205 - after realPipe
2015-07-10 15:17:47 ERROR ProcessGetserverdataTest:104 - Error in Test Prd_7!
com.orientechnologies.common.directmemory.ODirectMemoryViolationException: Negative offset was provided
at com.orientechnologies.common.directmemory.ODirectMemoryPointer.rangeCheck(ODirectMemoryPointer.java:209)
at com.orientechnologies.common.directmemory.ODirectMemoryPointer.getByte(ODirectMemoryPointer.java:140)
at com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OWALChangesTree.getByteValue(OWALChangesTree.java:34)
at com.orientechnologies.orient.core.storage.impl.local.paginated.base.ODurablePage.getByteValue(ODurablePage.java:136)
at com.orientechnologies.orient.core.storage.impl.local.paginated.OClusterPositionMapBucket.get(OClusterPositionMapBucket.java:74)
at com.orientechnologies.orient.core.storage.impl.local.paginated.OClusterPositionMap.get(OClusterPositionMap.java:233)
at com.orientechnologies.orient.core.storage.impl.local.paginated.OPaginatedCluster.getPhysicalPosition(OPaginatedCluster.java:952)
at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.doDeleteRecord(OAbstractPaginatedStorage.java:1604)
at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.deleteRecord(OAbstractPaginatedStorage.java:770)
at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.commitEntry(OAbstractPaginatedStorage.java:1981)
at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.commit(OAbstractPaginatedStorage.java:922)
at com.orientechnologies.orient.core.tx.OTransactionOptimistic.doCommit(OTransactionOptimistic.java:488)
at com.orientechnologies.orient.core.tx.OTransactionOptimistic.commit(OTransactionOptimistic.java:147)
at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.commit(ODatabaseDocumentTx.java:2433)
at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.commit(ODatabaseDocumentTx.java:2403)
at com.orientechnologies.orient.server.network.protocol.binary.ONetworkProtocolBinary.commit(ONetworkProtocolBinary.java:1092)
at com.orientechnologies.orient.server.network.protocol.binary.ONetworkProtocolBinary.executeRequest(ONetworkProtocolBinary.java:394)
at com.orientechnologies.orient.server.network.protocol.binary.OBinaryNetworkProtocolAbstract.execute(OBinaryNetworkProtocolAbstract.java:217)
at com.orientechnologies.common.thread.OSoftThread.run(OSoftThread.java:69)

For Comparison, the output when we remove the edges manually:

2015-07-10 15:16:46 INFO DeactivateNodeVertex:23 - Deactivating Parent_Vertex p1: v(Parent_Vertex)[#19:2]
2015-07-10 15:16:46 INFO DeactivateNodeVertex:27 - Created History_Parent_Vertex:v(Hist_Parent_Vertex)[#-1:-7]
2015-07-10 15:16:46 INFO DeactivateNodeVertex:38 - neuer Parent_Vertex in edge: e[#-1:-8][#22:0-belongsTo->#-1:-7]
2015-07-10 15:16:46 INFO DeactivateNodeVertex:51 - delete Parent_Vertex in edge: e[#27:16][#22:0-belongsTo->#19:2]
2015-07-10 15:16:46 INFO DeactivateNodeVertex:38 - neuer Parent_Vertex in edge: e[#-1:-9][#22:1-belongsTo->#-1:-7]
2015-07-10 15:16:46 INFO DeactivateNodeVertex:51 - delete Parent_Vertex in edge: e[#27:17][#22:1-belongsTo->#19:2]
2015-07-10 15:16:46 INFO DeactivateNodeVertex:38 - neuer Parent_Vertex in edge: e[#-1:-10][#22:2-belongsTo->#-1:-7]
2015-07-10 15:16:46 INFO DeactivateNodeVertex:51 - delete Parent_Vertex in edge: e[#27:18][#22:2-belongsTo->#19:2]
2015-07-10 15:16:46 INFO DeactivateNodeVertex:38 - neuer Parent_Vertex in edge: e[#-1:-11][#21:5-belongsTo->#-1:-7]
2015-07-10 15:16:46 INFO DeactivateNodeVertex:51 - delete Parent_Vertex in edge: e[#27:19][#21:5-belongsTo->#19:2]
2015-07-10 15:16:46 INFO DeactivateNodeVertex:58 - neuer Parent_Vertex out edge: e[#-1:-12][#-1:-7-belongsTo->#16:0]
2015-07-10 15:16:46 INFO DeactivateNodeVertex:71 - delete Parent_Vertex out edge: e[#27:14][#19:2-belongsTo->#16:0]
2015-07-10 15:16:46 INFO DeactivateNodeVertex:75 - Deleting Parent_Vertex: v(Parent_Vertex)[#19:2]
2015-07-10 15:16:46 INFO MergeJsonIntoGraph:171 - after NodePipe
2015-07-10 15:16:46 INFO MergeJsonIntoGraph:194 - before realPipe
2015-07-10 15:16:46 INFO DeactivateAppserverVertex:24 - Deactivating Child_Vertex c1: v(Child_Vertex)[#21:5]
2015-07-10 15:16:46 INFO DeactivateAppserverVertex:28 - Created History_Child_Vertex:v(Hist_Child_Vertex)[#-1:-13]
2015-07-10 15:16:46 INFO DeactivateAppserverVertex:59 - neuer Child_Vertex out edge: e[#-1:-14][#-1:-13-belongsTo->#-1:-7]
2015-07-10 15:16:46 INFO DeactivateAppserverVertex:72 - delete Child_Vertex out edge: e[#-1:-11][#21:5-belongsTo->#-1:-7]
2015-07-10 15:16:46 INFO DeactivateAppserverVertex:59 - neuer Child_Vertex out edge: e[#-1:-15][#-1:-13-alterIch->#22:2]
2015-07-10 15:16:46 INFO DeactivateAppserverVertex:72 - delete Child_Vertex out edge: e[#30:1][#21:5-alterIch->#22:2]
2015-07-10 15:16:46 INFO DeactivateAppserverVertex:76 - Deleting Child_Vertex: v(Child_Vertex)[#21:5]
2015-07-10 15:16:46 INFO MergeJsonIntoGraph:205 - after realPipe
2015-07-10 15:16:46 INFO ProcessGetserverdataTest:107 - leaving Prd_7

And the code:

logger.info("Deactivating Child_Vertex {}: {}", vertex.getProperty("name"), vertex);

        Vertex histVertex = graph.addVertex("class:Hist_Child_Vertex");

        logger.info("Created History_Child_Vertex:" + histVertex);

        for (String property : vertex.getPropertyKeys()) {
            histVertex.setProperty(property, vertex.getProperty(property));
        }

        Date actualDate = new Date();

        for (Edge edge : vertex.getEdges(Direction.IN)) {
            Edge neuEdge = edge.getVertex(Direction.OUT).addEdge(edge.getLabel(), histVertex);
            logger.info("neuer appserver in edge: " + neuEdge);
            neuEdge.setProperty("isActive", false);
            if (edge.getProperty("name") != null) {
                neuEdge.setProperty("name", edge.getProperty("name"));
            }
            if (edge.getProperty("from") != null) {
                neuEdge.setProperty("from", edge.getProperty("from"));
            }
            if (edge.getProperty("to") == null) {
                neuEdge.setProperty("to", actualDate);
            } else {
                neuEdge.setProperty("to", edge.getProperty("to"));
            }
            logger.info("delete appserver in edge: " + edge);
            edge.remove();
        }

        for (Edge edge : vertex.getEdges(Direction.OUT)) {
            Edge neuEdge = histVertex.addEdge(edge.getLabel(), edge.getVertex(Direction.IN));
            logger.info("neuer appserver out edge: " + neuEdge);
            neuEdge.setProperty("isActive", false);
            if (edge.getProperty("name") != null) {
                neuEdge.setProperty("name", edge.getProperty("name"));
            }
            if (edge.getProperty("from") != null) {
                neuEdge.setProperty("from", edge.getProperty("from"));
            }
            if (edge.getProperty("to") == null) {
                neuEdge.setProperty("to", actualDate);
            } else {
                neuEdge.setProperty("to", edge.getProperty("to"));
            }
            logger.info("delete appserver out edge: " + edge);
            edge.remove();
        }

        logger.info("Deleting Child_Vertex: " + vertex);

        vertex.remove();

        return histVertex;
@lvca lvca added the bug label Sep 21, 2015
@lvca lvca self-assigned this Sep 21, 2015
@lvca lvca added this to the 2.1.x (next hotfix) milestone Sep 21, 2015
@lvca lvca assigned luigidellaquila and lvca and unassigned lvca and luigidellaquila Feb 18, 2017
@lvca lvca closed this as completed Feb 18, 2017
@lvca
Copy link
Member

lvca commented Feb 18, 2017

This issue was fixed long time ago.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

3 participants