Weird bug with transactions and expanding edges

25 views
Skip to first unread message

Johan Sjöberg

unread,
Oct 29, 2015, 6:59:50 AM10/29/15
to OrientDB
@Test
public void testCreateRollback() {
   
String name = null;
       
   
try {
        name
= UUID.randomUUID();
       
MyClass newClass = new MyClass();
        myClass
.setName(name);


        db
.begin();
       
// Remove from here
         String q = "SELECT FROM (SELECT expand(out('" + RandomEdge.class.getSimpleName() + "')) FROM #21:0)";
         db
.command(new OSQLSynchQuery(q)).execute();
        // Remove to here
           
       
MyClass savedClass = db.save(newClass);
        db
.rollback();

       
List<ODocument> oDocs = db.getUnderlying().command(new OSQLSynchQuery("SELECT FROM MyClass WHERE name = '" + name + "'")).execute();
       
Assert.assertTrue(oDocs.isEmpty());
       
if (oDocs.isEmpty()) {
            name
= null;
       
}
   
} finally {
       
if (name != null) {
            db
.command(new OCommandSQL("DELETE VERTEX MyClass WHERE name = '" + name + "'")).execute();
       
}
   
}
}

Consider the test case above. I'm running an embedded plocal server using the object API.

If I run this test, it fails. If I run this test and remove the code marked by the comments, it works.

In other words, the transaction doesn't rollback when I expand a completly random edge. 
I'm not even using the result of the select (in this code), but it still cases the rollback to fail. Super weird behavior..
Am I missing something with transactions or is this a weird and severe bug?


Reply all
Reply to author
Forward
0 new messages