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

Cannot delete Edge because of missing in Vertex - java exceptions #7796

Closed
MartinHubinek opened this issue Oct 7, 2017 · 22 comments
Closed
Assignees
Labels

Comments

@MartinHubinek
Copy link

OrientDB Version: 2.2.26

Java Version: 1.8.0_144

OS: Ubuntu 16.04.3 LTS

Expected behavior

Edge should be deleted.

Actual behavior

Cannot delete Edge because of missing out Vertex. Throwing java exceptions. Cannot use studio graph editor. Is there any way to recreate specific rid? Or to any other way how to "force" delete edge? I still have class where Vertex was created, but when I create new it got #15:1 instead of #15:0 which I'am missing.

Somehow I'am missing out Vertex on of my edges. Probably Vertex record was deleted in studio but my application through API has created Edge. When I try to delete edge record from E class in studio, nothing happens. When i try load graph in studio it show this error:

java.lang.ClassCastException: java.lang.String cannot be cast to com.orientechnologies.orient.core.db.record.OIdentifiable

In OrientDB log I can see this:

$ANSI{green {db=nodetestdb}} Exception `7A2C9DB7` in storage `nodetestdb`
com.orientechnologies.orient.core.exception.OCommandExecutionException: Error on execution of command: sql.DELETE EDGE #12:5
        DB name="nodetestdb"
        at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.executeCommand(OAbstractPaginatedStorage.java:3234)
        at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.command(OAbstractPaginatedStorage.java:3151)
        at com.orientechnologies.orient.core.command.OCommandRequestTextAbstract.execute(OCommandRequestTextAbstract.java:69)
        at com.orientechnologies.orient.server.network.protocol.http.command.delete.OServerCommandDeleteDocument.execute(OServerCommandDeleteDocument.java:79)
        at com.orientechnologies.orient.server.network.protocol.http.ONetworkProtocolHttpAbstract.service(ONetworkProtocolHttpAbstract.java:173)
        at com.orientechnologies.orient.server.network.protocol.http.ONetworkProtocolHttpAbstract.execute(ONetworkProtocolHttpAbstract.java:625)
        at com.orientechnologies.common.thread.OSoftThread.run(OSoftThread.java:77)
Caused by: java.lang.ClassCastException: java.lang.String cannot be cast to com.orientechnologies.orient.core.db.record.OIdentifiable
        at com.tinkerpop.blueprints.impls.orient.OrientEdge.getOutVertex(OrientEdge.java:188)
        at com.tinkerpop.blueprints.impls.orient.OrientGraph.removeEdgeInternal(OrientGraph.java:392)
        at com.tinkerpop.blueprints.impls.orient.OrientEdge.remove(OrientEdge.java:382)
        at com.orientechnologies.orient.graph.sql.OCommandExecutorSQLDeleteEdge$1.call(OCommandExecutorSQLDeleteEdge.java:211)
        at com.orientechnologies.orient.graph.sql.OGraphCommandExecutorSQLFactory.runInTx(OGraphCommandExecutorSQLFactory.java:172)
        at com.orientechnologies.orient.graph.sql.OGraphCommandExecutorSQLFactory.runInConfiguredTxMode(OGraphCommandExecutorSQLFactory.java:257)
        at com.orientechnologies.orient.graph.sql.OCommandExecutorSQLDeleteEdge.execute(OCommandExecutorSQLDeleteEdge.java:205)
        at com.orientechnologies.orient.core.sql.OCommandExecutorSQLDelegate.execute(OCommandExecutorSQLDelegate.java:74)
        at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.executeCommand(OAbstractPaginatedStorage.java:3213)
        ... 6 more
$ANSI{green {db=nodetestdb}} Exception `7A2C9DB7` in storage `nodetestdb`
com.orientechnologies.orient.core.exception.OCommandExecutionException: Error on execution of command: sql.DELETE EDGE #12:5
        DB name="nodetestdb"
        at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.executeCommand(OAbstractPaginatedStorage.java:3234)
        at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.command(OAbstractPaginatedStorage.java:3151)
        at com.orientechnologies.orient.core.command.OCommandRequestTextAbstract.execute(OCommandRequestTextAbstract.java:69)
        at com.orientechnologies.orient.server.network.protocol.http.command.delete.OServerCommandDeleteDocument.execute(OServerCommandDeleteDocument.java:79)
        at com.orientechnologies.orient.server.network.protocol.http.ONetworkProtocolHttpAbstract.service(ONetworkProtocolHttpAbstract.java:173)
        at com.orientechnologies.orient.server.network.protocol.http.ONetworkProtocolHttpAbstract.execute(ONetworkProtocolHttpAbstract.java:625)
        at com.orientechnologies.common.thread.OSoftThread.run(OSoftThread.java:77)
Caused by: java.lang.ClassCastException: java.lang.String cannot be cast to com.orientechnologies.orient.core.db.record.OIdentifiable
        at com.tinkerpop.blueprints.impls.orient.OrientEdge.getOutVertex(OrientEdge.java:188)
        at com.tinkerpop.blueprints.impls.orient.OrientGraph.removeEdgeInternal(OrientGraph.java:392)
        at com.tinkerpop.blueprints.impls.orient.OrientEdge.remove(OrientEdge.java:382)
        at com.orientechnologies.orient.graph.sql.OCommandExecutorSQLDeleteEdge$1.call(OCommandExecutorSQLDeleteEdge.java:211)
        at com.orientechnologies.orient.graph.sql.OGraphCommandExecutorSQLFactory.runInTx(OGraphCommandExecutorSQLFactory.java:172)
        at com.orientechnologies.orient.graph.sql.OGraphCommandExecutorSQLFactory.runInConfiguredTxMode(OGraphCommandExecutorSQLFactory.java:257)
        at com.orientechnologies.orient.graph.sql.OCommandExecutorSQLDeleteEdge.execute(OCommandExecutorSQLDeleteEdge.java:205)
        at com.orientechnologies.orient.core.sql.OCommandExecutorSQLDelegate.execute(OCommandExecutorSQLDelegate.java:74)
        at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.executeCommand(OAbstractPaginatedStorage.java:3213)
        ... 6 more


@andrii0lomakin
Copy link
Member

@MartinHubinek just run check database command it should fix everything. But we suggest updating to 2.2.29 version https://twitter.com/Andrey_Lomakin/status/915953183129825280 . I should prevent you problems in future.

@MartinHubinek
Copy link
Author

It doesn't help. Output of check database is below. Sorry for format, cannot get it in putty to better structured output. Java exceptions are still same in log.

Connecting to database [plocal:../databases/nodetestdb] with user 'admin'...OK orientdb {db=nodetestdb}> check database -v Flashing file osequence.cpm... Start verification of content of osequence.cpmfile ...Verification of file osequence.cpm is successfully finished.Flashing file presale_1.cpm... Start verification of content of presale_1.cpmfile ...Verification of file presale_1.cpm is successfully finished.Flashing file internal.pcl... Start verification of content of internal.pclfile ...Verification of file internal.pcl is successfully finished.Flashing file manindex.pcl... Start verification of content of manindex.pclfile ...Verification of file manindex.pcl is successfully finished.Flashing file presale.cpm... Start verification of content of presale.cpmfile ...Verification of file presale.cpm is successfully finished.Flashing file OUser.name.nbt... Start verification of content of OUser.name.nbtfile ...Verification of file OUser.name.nbt is successfully finished.Flashing file default.cpm... Start verification of content of default.cpmfile ...Verification of file default.cpm is successfully finished.Flashing file vendor_1.pcl... Start verification of content of vendor_1.pclfile ...Verification of file vendor_1.pcl is successfully finished.Flashing file ORole.name.nbt... Start verification of content of ORole.name.nbtfile ...Verification of file ORole.name.nbt is successfully finished.Flashing file OFunction.name.hnb... Start verification of content of OFunction.name.hnbfile ...Verification of file OFunction.name.hnb is successfully finished.Flashing file v_1.pcl... Start verification of content of v_1.pclfile ...Verification of file v_1.pcl is successfully finished.Flashing file product_1.pcl... Start verification of content of product_1.pclfile ...Verification of file product_1.pcl is successfully finished.Flashing file ofunction.pcl... Start verification of content of ofunction.pclfile ...Verification of file ofunction.pcl is successfully finished.Flashing file engineer.pcl... Start verification of content of engineer.pclfile ...Verification of file engineer.pcl is successfully finished.Flashing file ouser.pcl... Start verification of content of ouser.pclfile ...Verification of file ouser.pcl is successfully finished.Flashing file orole.cpm... Start verification of content of orole.cpmfile ...Verification of file orole.cpm is successfully finished.Flashing file product.cpm... Start verification of content of product.cpmfile ...Verification of file product.cpm is successfully finished.Flashing file engineer_1.pcl... Start verification of content of engineer_1.pclfile ...Verification of file engineer_1.pcl is successfully finished.Flashing file vendor.cpm... Start verification of content of vendor.cpmfile ...Verification of file vendor.cpm is successfully finished.Flashing file dictionary.nbt... Start verification of content of dictionary.nbtfile ...Verification of file dictionary.nbt is successfully finished.Flashing file _studio.cpm... Start verification of content of _studio.cpmfile ...Verification of file _studio.cpm is successfully finished.Flashing file e.cpm... Start verification of content of e.cpmfile ...Verification of file e.cpm is successfully finished.Flashing file e_1.cpm... Start verification of content of e_1.cpmfile ...Verification of file e_1.cpm is successfully finished.Flashing file services.pcl... Start verification of content of services.pclfile ...Verification of file services.pcl is successfully finished.Flashing file oschedule.cpm... Start verification of content of oschedule.cpmfile ...Verification of file oschedule.cpm is successfully finished.Flashing file category_1.cpm... Start verification of content of category_1.cpmfile ...Verification of file category_1.cpm is successfully finished.Flashing file v.cpm... Start verification of content of v.cpmfile ...Verification of file v.cpm is successfully finished.Flashing file category.pcl... Start verification of content of category.pclfile ...Verification of file category.pcl is successfully finished.Flashing file category_1.pcl... Start verification of content of category_1.pclfile ...Verification of file category_1.pcl is successfully finished.Flashing file presale.pcl... Start verification of content of presale.pclfile ...Verification of file presale.pcl is successfully finished.Flashing file internal.cpm... Start verification of content of internal.cpmfile ...Verification of file internal.cpm is successfully finished.Flashing file index.cpm... Start verification of content of index.cpmfile ...Verification of file index.cpm is successfully finished.Flashing file OUser.name.sbt... Start verification of content of OUser.name.sbtfile ...Verification of file OUser.name.sbt is successfully finished.Flashing file product_1.cpm... Start verification of content of product_1.cpmfile ...Verification of file product_1.cpm is successfully finished.Flashing file presale_1.pcl... Start verification of content of presale_1.pclfile ...Verification of file presale_1.pcl is successfully finished.Flashing file manindex.cpm... Start verification of content of manindex.cpmfile ...Verification of file manindex.cpm is successfully finished.Flashing file default.pcl... Start verification of content of default.pclfile ...Verification of file default.pcl is successfully finished.Flashing file ofunction.cpm... Start verification of content of ofunction.cpmfile ...Verification of file ofunction.cpm is successfully finished.Flashing file ouser.cpm... Start verification of content of ouser.cpmfile ...Verification of file ouser.cpm is successfully finished.Flashing file vendor_1.cpm... Start verification of content of vendor_1.cpmfile ...Verification of file vendor_1.cpm is successfully finished.Flashing file services_1.cpm... Start verification of content of services_1.cpmfile ...Verification of file services_1.cpm is successfully finished.Flashing file product.pcl... Start verification of content of product.pclfile ...Verification of file product.pcl is successfully finished.Flashing file v_1.cpm... Start verification of content of v_1.cpmfile ...Verification of file v_1.cpm is successfully finished.Flashing file ORole.name.sbt... Start verification of content of ORole.name.sbtfile ...Verification of file ORole.name.sbt is successfully finished.Flashing file services.cpm... Start verification of content of services.cpmfile ...Verification of file services.cpm is successfully finished.Flashing file OFunction.name.him... Start verification of content of OFunction.name.himfile ...Verification of file OFunction.name.him is successfully finished.Flashing file vendor.pcl... Start verification of content of vendor.pclfile ...Verification of file vendor.pcl is successfully finished.Flashing file services_1.pcl... Start verification of content of services_1.pclfile ...Verification of file services_1.pcl is successfully finished.Flashing file OFunction.name.hit... Start verification of content of OFunction.name.hitfile ...Verification of file OFunction.name.hit is successfully finished.Flashing file category.cpm... Start verification of content of category.cpmfile ...Verification of file category.cpm is successfully finished.Flashing file orole.pcl... Start verification of content of orole.pclfile ...Verification of file orole.pcl is successfully finished.Flashing file engineer.cpm... Start verification of content of engineer.cpmfile ...Verification of file engineer.cpm is successfully finished.Flashing file dictionary.sbt... Start verification of content of dictionary.sbtfile ...Verification of file dictionary.sbt is successfully finished.Flashing file index.pcl... Start verification of content of index.pclfile ...Verification of file index.pcl is successfully finished.Flashing file oschedule.pcl... Start verification of content of oschedule.pclfile ...Verification of file oschedule.pcl is successfully finished.Flashing file v.pcl... Start verification of content of v.pclfile ...Verification of file v.pcl is successfully finished.Flashing file e.pcl... Start verification of content of e.pclfile ...Verification of file e.pcl is successfully finished.Flashing file _studio.pcl... Start verification of content of _studio.pclfile ...Verification of file _studio.pcl is successfully finished.Flashing file OFunction.name.hib... Start verification of content of OFunction.name.hibfile ...Verification of file OFunction.name.hib is successfully finished.Flashing file engineer_1.cpm... Start verification of content of engineer_1.cpmfile ...Verification of file engineer_1.cpm is successfully finished.Flashing file osequence.pcl... Start verification of content of osequence.pclfile ...Verification of file osequence.pcl is successfully finished.Flashing file e_1.pcl... Start verification of content of e_1.pclfile ...Verification of file e_1.pcl is successfully finished.Check of storage completed in 100ms. without errors.

@andrii0lomakin
Copy link
Member

@MartinHubinek which distribution do you use? Console command should modify graph structure too, but in your case, it only checks storage integrity. Could you download the distribution from the official site?

@MartinHubinek
Copy link
Author

I've followed this How-To . And in that time I've used latest stable community version. I suppose this is a correct way? I can try to upgrade to 2.2.29 and then run again check database.

@andrii0lomakin
Copy link
Member

yes, but it looks like you do not have graphdb console integrated into your distribution. please try 2.2.29 version.

@MartinHubinek
Copy link
Author

Upgraded to 2.2.29. In studio it looks stil the same, even in the logs - same java exceptions. But when I run check database I get this error:

orientdb {db=nodetestdb}> check database -v
Check of graph 'plocal:../databases/nodetestdb' is started...
Scanning 1 edges (skipEdges=0)...

Error: java.lang.ClassCastException: java.lang.String cannot be cast to com.orientechnologies.orient.core.db.record.OIdentifiable

@andrii0lomakin
Copy link
Member

Hm I see now, @maggiolo00 could you check that?

@wolf4ood
Copy link
Member

wolf4ood commented Oct 9, 2017

hi @MartinHubinek

can you execute this query from studio and paste here the raw json ?

select from #12:5

Thanks

@wolf4ood
Copy link
Member

wolf4ood commented Oct 9, 2017

@MartinHubinek
How did you create the edge?

@MartinHubinek
Copy link
Author

Hi, here you can see data from select:

{
    "result": [
        {
            "@type": "d",
            "@rid": "#12:5",
            "@version": 2,
            "@class": "E",
            "out": "#14:0",
            "in": "#25:0"
        }
    ]
    "notification": "Query executed in 0.014 sec. Returned 1 record(s)"
}

I'am using this Javascript code to create new edge:

    db.create('EDGE', 'E')
    .from(req.body.from).to(req.body.to).one().then(
        function(result){
        response =("#" + result['@rid']['cluster'] + ":" + result['@rid']['position']);
        db.close();

From client side I'am sending data this way:

response = { "from" : data.from , "to" : data.to };
xhttp.send(JSON.stringify(response));

Data is javascript object with from and to property.

@MartinHubinek
Copy link
Author

And I'am using orintjs driver. So far I've been creating a lot of vertices and now I'am staring creating edges for the first time but vertices works fine for me.

@wolf4ood
Copy link
Member

wolf4ood commented Oct 9, 2017

hi @MartinHubinek

from this

 db.create('EDGE', 'E')
    .from(req.body.from).to(req.body.to).one().then(
        function(result){
        response =("#" + result['@rid']['cluster'] + ":" + result['@rid']['position']);
        db.close();

can you add console.log(result) and paste it here in order to see the which fields contains the created edge?

Thanks

@wolf4ood
Copy link
Member

wolf4ood commented Oct 9, 2017

and also

.from(req.body.from).to(req.body.to)

from/to which values contains?

@MartinHubinek
Copy link
Author

My code on server side now:

db.create('EDGE', 'E')
    .from(req.body.from).to(req.body.to).one().then(
        function(result){
        response =("#" + result['@rid']['cluster'] + ":" + result['@rid']['position']);
        db.close();
        console.log(response);
        console.log(req.body.from);
        console.log(req.body.to);
        res.send(response);

And server cosole output when i create edge in my client app:

GET /stylesheets/style.css 304 4.998 ms - -
#12:6
#14:0
#20:1
POST /catalog/graph/addedge 200 28.941 ms - 5

I'am sending new RID back to my client side in response to have object with correct RID for feature edit etc.

@wolf4ood
Copy link
Member

wolf4ood commented Oct 9, 2017

hi @MartinHubinek

what about the result it self ?

console.log(result)

@MartinHubinek
Copy link
Author

Here it is:

#11:8
#24:1
#14:0
{ '@type': 'd',
  '@class': 'E',
  out: { [String: '#24:1'] cluster: 24, position: 1 },
  in: { [String: '#14:0'] cluster: 14, position: 0 },
  '@rid': { [String: '#11:8'] cluster: 11, position: 8 },
  '@version': 1 }

@wolf4ood
Copy link
Member

wolf4ood commented Oct 9, 2017

@MartinHubinek

as i see in/out are no string but RecordId which is correct. so the delete of the edge #11:8
should be fine. Can you post the result of raw JSON from studio

select from #11:8

just to be sure

Thanks

@MartinHubinek
Copy link
Author

Here is output:

{
    "result": [
        {
            "@type": "d",
            "@rid": "#11:8",
            "@version": 1,
            "@class": "E",
            "out": "#24:1",
            "in": "#14:0",
            "@fieldTypes": "out=x,in=x"
        }
    ],
    "notification": "Query executed in 0.013 sec. Returned 1 record(s)"
}

I've tried to delete #11:8 and it works fine. But the issue is still about edge #12:5 . Cannot delete this, cannot use graph visalization in studio etc. I've written about issue with #12:5 in my original post, probably create edge for non existent vertex, but could not say how it happens. The question is still same, am I able to fix #12:5 edge or delete it somehow?

@wolf4ood
Copy link
Member

wolf4ood commented Oct 9, 2017

Hi @MartinHubinek

yes you can fix this. But first can you check if this two vertices exist?

#14:0, #25:0

and post here
select from #25:0
and
select from #14:0

Thanks

@MartinHubinek
Copy link
Author

No, they do not exist, so select return nothing. When I've noticed this error the record #25:0 doesn't exist. Then I've to try delete the #14:0 in hope that it will delete edge as well.

@wolf4ood
Copy link
Member

wolf4ood commented Oct 9, 2017

Hi @MartinHubinek
if you deleted in/out vertex you can use this syntax to delete the edge

delete from #12:5 unsafe

it should work

Thanks

@MartinHubinek
Copy link
Author

Yes, it works. Great, thank you very much.

@wolf4ood wolf4ood closed this as completed Oct 9, 2017
@luigidellaquila luigidellaquila removed this from the 2.2.x (next hotfix) milestone Nov 14, 2017
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

5 participants