Skip to content

Stale data and outdated @version values are being returned after performing an Edge update operation in OrientDB version 3.2.34 and later. #10726

@arpitdd123

Description

@arpitdd123

Hello,

I am performing an update operation on an edge and then attempting to retrieve the updated value. However, after executing the SELECT query, the OrientDB API returns stale data for the edge. The returned record does not reflect the updated attribute value, and the @Version is also outdated.

When I check the same record in OrientDB Studio, the updated values and the correct version are displayed.

Below are the steps to reproduce.

Step 1 : Schema setup

CREATE CLASS VertexA EXTENDS V;
CREATE PROPERTY VertexA.StringTest STRING;
CREATE PROPERTY VertexA.IntTest INTEGER;
 
CREATE CLASS EdgeB EXTENDS E;
CREATE PROPERTY EdgeB.StringEdgeTest STRING;
CREATE PROPERTY EdgeB.IntegerEdgeTest INTEGER;
 
INSERT INTO VertexA SET StringTest = 'A', IntTest = 25;
INSERT INTO VertexA SET StringTest = 'B', IntTest = 30;

Step 2 : Create database connection using OPartitionedDatabasePool-

String databaseUrl = "url";
String userName = "username";
String password = "password";
OPartitionedDatabasePool pool = new OPartitionedDatabasePool(databaseUrl, userName, password);
ODatabaseDocument db = pool.acquire();

Step 3 : Create Edge from A to B:

db.activateOnCurrentThread();
db.command("CREATE EDGE EdgeB FROM "
    + "(SELECT FROM VertexA WHERE StringTest = 'A') TO "
    + "(SELECT FROM VertexA WHERE StringTest = 'B') "
    + "SET StringTest = 'A-B', IntTest = 3");
db.commit();

Step 4 : Update Edge A to B:

db.activateOnCurrentThread();
db.command("UPDATE EdgeB SET IntTest = 30 WHERE StringTest = 'A-B'");
db.commit();

Step 5 : Fetch Updated Edge:

db.activateOnCurrentThread();
OResultSet resultSet = db.command("SELECT StringTest, IntTest FROM EdgeB WHERE IntTest = 30");

Why is the Java API returning stale document data after executing the query while OrientDB Studio shows the correct updated version?
What is the recommended way to ensure that the latest version of the document is retrieved?

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions