Changing the test and using StoreConnection.make ( location )
instead of TDBFactory.createDataset ( location ) does not cause
any problem:

     @Test public void test() {
         Location location = new Location ( path );
-        Dataset dataset = TDBFactory.createDataset ( location );
-        dataset.begin ( ReadWrite.WRITE );
+        StoreConnection sc = StoreConnection.make ( location );
+        Dataset dataset = sc.begin ( ReadWrite.WRITE ).toDataset();
         try {
             DatasetGraph dsg = dataset.asDatasetGraph();
             DatasetGraph dsg2 = RiotLoader.datasetFromString ( str_triple, 
Lang.TURTLE, null );


The documentation [1] says: "Transactions use a new API: the TDBFactory
API is still present. If an application simply uses the TDB 0.9 codebase,
it will work as before without transactions.".

So, my mistake was not to use the StoreConnection.make ( ... ). However,
it that is required, we should include it in the documentation otherwise
others might fall in the same trap, as I did.

Apologies for the noise...

Bernard, are you using StoreConnection or TDBFactory to create your Dataset(s)?

Paolo

 [1] http://incubator.apache.org/jena/documentation/tdb/tdb_transactions.html

Paolo Castagna wrote:
> Hi Bernard
> 
> Bernie Greenberg wrote:
>> What's more, Jena outputs, in red, no less, "*********** UNEXPECTED [1]"
>> with seeming regularity (yesterday I found it in the Jena source, but can't
>> seem to today) in this arrangement, but in any case, it is not a positive
>> sign that I have this right.  The diagnostic ..."could be clearer"...
> 
> This is what I've noticed this morning when I was investigating another issue
> which (thanks to Sam, turned out to be a Unicode - High Surrogate Area issue,
> probably). Anyway...
> 
> Are you using TDB 0.9.0-incubating? I am.
> 
> Here is how I can cause and replicate the issue:
> https://github.com/castagna/jena-examples/blob/master/src/main/java/dev/TestTDBCorruption.java
> 
> I have a WRITE transaction which fails (and I do not close the dataset).
> I run the test twice (the second time, the TDB database already exists) and I 
> see:
> 
> 14:18:54 WARN  NodeTableTrans            :: Txn[1]/W journalStartOffset not 
> zero: 109/0x6D
> ************* UNEXPECTED [1]
> 
> 
> Different ids for file:///opt/workspaces/jena/jena-examples/s: allocated: 
> expected [000000000000006D], got [0000000000000000]
> label = nodes
> txn = Transaction: 1 : Mode=WRITE : State=PREPARING : 
> /opt/workspaces/jena/jena-examples/target/tdb_corruption/
> offset = 109
> journalStartOffset = 109
> journal = nodes.dat-jrnl
> 
> com.hp.hpl.jena.tdb.TDBException: Different ids for 
> file:///opt/workspaces/jena/jena-examples/s: allocated: expected 
> [000000000000006D], got [0000000000000000]
>       at 
> com.hp.hpl.jena.tdb.transaction.NodeTableTrans.inconsistent(NodeTableTrans.java:212)
>       at 
> com.hp.hpl.jena.tdb.transaction.NodeTableTrans.append(NodeTableTrans.java:200)
>       at 
> com.hp.hpl.jena.tdb.transaction.NodeTableTrans.writeNodeJournal(NodeTableTrans.java:306)
>       at 
> com.hp.hpl.jena.tdb.transaction.NodeTableTrans.commitPrepare(NodeTableTrans.java:266)
>       at 
> com.hp.hpl.jena.tdb.transaction.Transaction.prepare(Transaction.java:131)
>       at 
> com.hp.hpl.jena.tdb.transaction.Transaction.commit(Transaction.java:112)
>       at 
> com.hp.hpl.jena.tdb.transaction.DatasetGraphTxn.commit(DatasetGraphTxn.java:40)
>       at 
> com.hp.hpl.jena.tdb.transaction.DatasetGraphTransaction._commit(DatasetGraphTransaction.java:106)
>       at 
> com.hp.hpl.jena.tdb.migrate.DatasetGraphTrackActive.commit(DatasetGraphTrackActive.java:60)
>       at com.hp.hpl.jena.sparql.core.DatasetImpl.commit(DatasetImpl.java:143)
>       at dev.TestTDBCorruption.test(TestTDBCorruption.java:39)
>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>       at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>       at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>       at java.lang.reflect.Method.invoke(Method.java:597)
>       at 
> org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
>       at 
> org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
>       at 
> org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
>       at 
> org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
>       at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
>       at 
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:69)
>       at 
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:48)
>       at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
>       at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
>       at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
>       at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
>       at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
>       at org.junit.runners.ParentRunner.run(ParentRunner.java:292)
>       at 
> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:46)
>       at 
> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
>       at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
>       at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
>       at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
>       at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
> 
> Paolo
> 

Reply via email to