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

Inconsistent transaction beheviour w/remote: #169

Open
MartinBrugnara opened this issue Feb 24, 2020 · 2 comments
Open

Inconsistent transaction beheviour w/remote: #169

MartinBrugnara opened this issue Feb 24, 2020 · 2 comments

Comments

@MartinBrugnara
Copy link

Version: 3.0.27
Java-gremlin api
Connection mode: remote

Goal

  • 3 threads deleting 3 different nodes.

Context

  • Each threads has its own GraphTraversalSource generated as
OrientGraph g = ogFactory.getTx();
g.makeActive()
GraphTraversalSource gts = g.traversal()
  • Code (simplified)
Transaction t;
for (int retry=5; retry>=0; retry--) { 
    try {
        gts.tx().open();
        gts.V(object_id).drop().iterate();
        gts.tx().commit()
        break;
   } catch (OConcurrentModificationException ocm) {
        gts.tx().rollback();
   }  catch (Exception e) {
       // ...
   }
}

What happens

  • one thread completes
  • the other 2 raise OConcurrentModificationException
  • one of the remaining completes
  • the other raises ORecordNotFoundException

What should happen

Once the last thread tries to commit, either it succeed or it should fail with an OConcurrentModificationException.

The ORecordNotFoundException suggests that the rollback operation had not any effect, and instead the node was previously removed even tough we had an OConcurrentModificationException.

P.S.

Using plocal: the correct sequence of Exceptions is raised

@wolf4ood
Copy link
Member

Hi @MartinBrugnara

do you have a complete test to reproduce this case?

Thanks

@MartinBrugnara
Copy link
Author

MartinBrugnara commented Feb 26, 2020

Hi @wolf4ood,
the code i posted is part of a much bigger framework which I cannot share at the moment.
Nevertheless, I extracted for you all the relevant code: https://pastebin.com/9E45Z7G0 .
Then you will need just a main function, imports, and the following deps:

    <dependencies>
        <dependency>
            <groupId>org.apache.tinkerpop</groupId>
            <artifactId>gremlin-core</artifactId>
            <version>3.4.2</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/com.orientechnologies/orientdb-gremlin -->
        <dependency>
            <groupId>com.orientechnologies</groupId>
            <artifactId>orientdb-gremlin</artifactId>
            <version>3.0.27</version>
        </dependency>
        <dependency>
            <groupId>com.orientechnologies</groupId>
            <artifactId>orientdb-client</artifactId>
            <version>3.0.27</version>
        </dependency>
    </dependencies>

Cheers,
M

EDIT: GdbLogger is just a custom logger... feel free to replace it with prints, and the invocations to fatal() with System.exit(1).

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

No branches or pull requests

2 participants