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

Remote OCommand update not reloading vertex (v2.1.x) #5872

Closed
crbaptiste opened this issue Mar 22, 2016 · 4 comments
Closed

Remote OCommand update not reloading vertex (v2.1.x) #5872

crbaptiste opened this issue Mar 22, 2016 · 4 comments

Comments

@crbaptiste
Copy link
Contributor

When an SQL Update command is run using the Graph API connected to a remote database, the update saves to the database but when the vertex is retrieved using getVertex(rid), a stale version is retrieved. NOTE: This issue is not seen when running against a local database.

This has been observed in v2.1.x.

Here is a example code to reproduce there error:

OrientGraph g = factory.getTx();  // Using remote OrientGraphFactory (ie. remote:localhost/testdb)

OrientVertex v = g.addVertex(null);
v.setProperties("Counter", 0);
g.commit();

System.out.println(v.getProperties() + ", version=" + v.getRecord().getVersion());
v = g.getVertex(v.getId());

String cmd = String.format("UPDATE %s SET Counter = 10", v.getId());
g.command(new OCommandSQL(cmd)).execute();

v = g.getVertex(v.getId());
//v.reload();
System.out.println(v.getProperties() + ", version=" + v.getRecord().getVersion());

factory.close();    

If run as is output looks like:

{Counter=0, @Rid=#9:29, @Class=V}, version=1
{Counter=0, @Rid=#9:29, @Class=V}, version=1

If you uncomment the //v.reload output looks like:

{Counter=0, @Rid=#9:30, @Class=V}, version=1
{Counter=10, @Rid=#9:30, @Class=V}, version=2

@luigidellaquila
Copy link
Member

Hi @crbaptiste

In current release it is a known limitation and the expected behavior.

Please check the docs here

http://orientdb.com/docs/last/Transactions.html

Thanks

Luigi

@crbaptiste
Copy link
Contributor Author

I had already read that doc, but I missed that the OCommand happens outside the transaction.

Is this something that future versions will remedy or a limitation that we just need to get used to?

@luigidellaquila
Copy link
Member

Hi @crbaptiste

We will implement server-side transactions in the future, so this problem will be eventually fixed, but in the short term I think you will have to deal with this limitation.

Thanks

Luigi

@crbaptiste
Copy link
Contributor Author

Thanks for the clarification!

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

2 participants