Skip to content

Accessing Vertex Record through index makes OSQL delete statement fail within the same transaction #8311

@AStoopidFakeAccount

Description

@AStoopidFakeAccount

OrientDB Version: 3.0.2

Java Version: 1.8.0_161

OS: Ubuntu 16.04

Expected behavior

OSQL statement working properly

Actual behavior

OSQL statement is not executed, the transaction crashes with an error:

com.orientechnologies.orient.core.exception.OSerializationException:
Cannot read transaction record from the network. Transaction aborted
DB name="index-strange-behavior"
DB name="index-strange-behavior"
at com.mycompany.testing.StrangeIndexBehavior.testBehavior(StrangeIndexBehavior.java:38)
Caused by: java.lang.NullPointerException

The OSQL statement is not executed, the records which i asked for suppression are still there.

Steps to reproduce

I've joined a very simple DB to help reproduce the problem :
index-strange-behavior.gz

Also, here is a snippet which works to make the problem appear :

@Test
    public void testBehavior() throws BackendClosedException {

        final OrientGraphFactory factory = new OrientGraphFactory("remote:127.0.0.1/index-strange-behavior", "root", "root").setupPool(5, 1000);
        OrientBaseGraph graph = factory.getTx();
        
        // First retrieve instance of myclass using myproperty_index
        
        final OIndexManager idxManager = graph.getRawGraph().getMetadata().getIndexManager();
        OIndex<?> idx = idxManager.getIndex("myproperty_index");
        
        final OIdentifiable projectionIdentifier = (OIdentifiable) idx.get("value_1");
        final OrientVertex vertex = graph.getVertex(projectionIdentifier);
        
        graph.command(new OCommandSQL("DELETE VERTEX FROM MyClass WHERE true")).execute();

        graph.commit();
        graph.shutdown();

    }

Now, i've noticed that the problem is solved if i "reset" the transaction by closing the current OrientBaseGraph object and open a second one to perform the OSQL Statement. Here is a working example :

@Test
    public void testBehaviorWorking() throws BackendClosedException {

        final OrientGraphFactory factory = new OrientGraphFactory("remote:127.0.0.1/index-strange-behavior", "root", "root").setupPool(5, 1000);
        OrientBaseGraph graph = factory.getTx();
        
        // First retrieve instance of myclass using myproperty_index
        
        final OIndexManager idxManager = graph.getRawGraph().getMetadata().getIndexManager();
        OIndex<?> idx = idxManager.getIndex("myproperty_index");
        
        final OIdentifiable projectionIdentifier = (OIdentifiable) idx.get("value_1");
        final OrientVertex vertex = graph.getVertex(projectionIdentifier);
        
        graph.shutdown();
        graph = factory.getTx();
        
        graph.command(new OCommandSQL("DELETE VERTEX FROM MyClass WHERE true")).execute();

        graph.commit();
        graph.shutdown();

    }

I hope you have enough information with that to solve the problem. OrientDB is running with default configuration. I just added "root"/"root" for the credentials.

Thanks in advance,

Best regards.

Metadata

Metadata

Labels

buglegacy not used anymore

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions