Andrey,
I built the latest revision and I am still getting the same behavior. I
tried the test code that I had used to identify the previous issue, and it
is also not creating any data in my database. Here is the test code below.
Did you need a copy of the database?
Thanks,
Odysseas
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.concurrent.Callable;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.atomic.AtomicBoolean;
import junit.framework.TestCase;
import com.orientechnologies.orient.core.metadata.schema.OType;
import com.orientechnologies.orient.core.record.impl.ODocument;
import com.orientechnologies.orient.core.sql.OCommandSQL;
import com.tinkerpop.blueprints.impls.orient.OrientGraph;
import com.tinkerpop.blueprints.impls.orient.OrientVertex;
import com.tinkerpop.blueprints.impls.orient.OrientVertexType;
public class TestOrientDbConcurrency extends TestCase
{
private final static String DB_URL = "plocal://mnt/sysnet/person-db";
private static final int THREAD_COUNT = 1;
public void testDirtyTxQuery() throws Exception {
OrientGraph graph = new OrientGraph(DB_URL);
OrientVertexType personType = graph.createVertexType("persons");
OrientVertexType addressType = graph.createVertexType("addresses");
final CountDownLatch latch = new CountDownLatch(THREAD_COUNT);
final AtomicBoolean shutdownFlag = new AtomicBoolean(false);
final ExecutorService executorService =
Executors.newCachedThreadPool();
List<Future> futures = new ArrayList<Future>();
for (int j=0; j < THREAD_COUNT; j++) {
final Future inserter = executorService.submit(new
Callable<Void>()
{
@Override
public Void call() throws Exception {
OrientGraph graph = new OrientGraph(DB_URL);
int counter = 0;
graph.getRawGraph().begin();
while (!shutdownFlag.get()) {
OrientVertex vertex =
graph.addVertex("class:persons");
vertex.setProperty("firstName", "John"+counter);
vertex.setProperty("lastName", "Orientdb" +
counter);
Set<OrientVertex> addresses = new
HashSet<OrientVertex>();
for (int i=0; i < 5; i++) {
OrientVertex aVertex =
graph.addVertex("class:addresses");
aVertex.setProperty("city", "Baltimore");
aVertex.getRecord().field("person", vertex,
com.orientechnologies.orient.core.metadata.schema.OType.LINK);
addresses.add(aVertex);
}
vertex.getRecord().field("addresses", addresses,
com.orientechnologies.orient.core.metadata.schema.OType.LINKSET);
// OrientVertex aVertex =
graph.addVertex("class:addresses");
// aVertex.setProperty("city", "Baltimore");
// aVertex.getRecord().field("person", vertex,
com.orientechnologies.orient.core.metadata.schema.OType.LINK);
// aVertex.setProperty("person", vertex);
// vertex.setProperty("addresses", aVertex);
counter++;
executorService.submit(new BlockingUpdate("John",
vertex.getIdentity().toString()));
if (counter % 100 == 0) {
System.out.println("Saved 100 records by
thread: " + Thread.currentThread().getName());
graph.commit();
}
}
graph.commit();
return null;
}
});
futures.add(inserter);
}
final Future fetcher = executorService.submit(new Callable<Void>()
{
@Override
public Void call() throws Exception {
OrientGraph graph = new OrientGraph(DB_URL);
while (!shutdownFlag.get())
graph.command(new OCommandSQL("select count(*) from
persons")).execute();
return null;
}
});
Thread.sleep(30000);
shutdownFlag.set(true);
for (Future future : futures) {
future.get();
}
fetcher.get();
}
public class BlockingUpdate implements Callable<Void> {
private String blockingKeyValue;
private String rid;
public BlockingUpdate(String blockingKeyValue, String rid) {
super();
this.blockingKeyValue = blockingKeyValue;
this.rid = rid;
}
@Override
public Void call() {
try {
OrientGraph graph = new OrientGraph(DB_URL);
graph.getRawGraph().begin();
List<ODocument> docs = graph.getRawGraph().command(new
OCommandSQL("select rids from Blockinground-0 where blockingKeyValue = " +
blockingKeyValue)).execute();
if (docs.size() == 0) {
Set<String> rids = new HashSet<String>();
rids.add(rid);
OrientVertex vertex =
graph.addVertex("class:Blockinground-0");
vertex.setProperty("blockingKeyValue",
blockingKeyValue);
vertex.getRecord().field("rids", rids,
OType.EMBEDDEDSET);
vertex.getRecord().save();
System.out.println("Vertex is now " + vertex);
} else {
ODocument doc = docs.get(0);
Set<String> rids = doc.field("rids");
rids.add(rid);
doc.save();
System.out.println("Doc is now " + doc);
}
graph.commit();
} catch (Exception e) {
System.err.println("Got an exception: " + e);
}
return null;
}
}
}
On Tuesday, March 18, 2014 8:28:19 AM UTC-4, Andrey Lomakin wrote:
>
> Odysseas,
> Could you use distribution from
> http://helios.orientechnologies.com/job/orient-maven/lastStableBuild/ it
> seems like rc2-snapshot is bit out of date.
>
> Any way I am looking forward for your test case.
>
>
> On Tue, Mar 18, 2014 at 2:23 PM, Odysseas <[email protected]<javascript:>
> > wrote:
>
>> Andrey,
>> I'll try to put a test case together and send it to you.
>> Thanks,
>> Odysseas
>>
>>
>> On Tuesday, March 18, 2014 1:08:54 AM UTC-4, Andrey Lomakin wrote:
>>
>>> Odysseas,
>>> It is because of my fail, could you send me test case here so I will fix
>>> it.
>>>
>>>
>>> On Tue, Mar 18, 2014 at 1:56 AM, Odysseas <[email protected]> wrote:
>>>
>>>> Hi,
>>>>
>>>> Using the latest version of 1.7-rc2 we save and commit vertices and
>>>> edges and although everything is successful and we are not getting any
>>>> errors, there are no records stored in the database. By switching to
>>>> 1.7-rc1 the exact same code works just fine. I suspect that this is a
>>>> local
>>>> issue since others would have complained about this already but do you
>>>> have
>>>> any suggestions as to what we may be doing wrong?
>>>>
>>>> Thanks,
>>>> Odysseas
>>>>
>>>> --
>>>>
>>>> ---
>>>> You received this message because you are subscribed to the Google
>>>> Groups "OrientDB" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to [email protected].
>>>>
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>>
>>>
>>> --
>>> Best regards,
>>> Andrey Lomakin.
>>>
>>> Orient Technologies
>>> the Company behind OrientDB
>>>
>>> --
>>
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "OrientDB" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected] <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
> Best regards,
> Andrey Lomakin.
>
> Orient Technologies
> the Company behind OrientDB
>
>
--
---
You received this message because you are subscribed to the Google Groups
"OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.