You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Nicoletta Triolo <n....@codices.com> on 2011/09/19 11:33:30 UTC

duplicate key error using SDB

Hi all,
in the old mailing list I found this message 
(http://tech.groups.yahoo.com/group/jena-dev/message/45852) , that is 
strictly connected with what happen to me. The difference are in the 
version of library I use: jena 2.6.4, sdb 1.34 and Postgres 8.4.
The error I have on multiple concurrent writing action on different 
Model (writing on the same database) is the following:
Caused by: com.hp.hpl.jena.sdb.SDBException: Exception flushing
     at 
com.hp.hpl.jena.sdb.layout2.TupleLoaderBase.flush(TupleLoaderBase.java:220)
     at 
com.hp.hpl.jena.sdb.layout2.TupleLoaderBase.finish(TupleLoaderBase.java:155)
     at 
com.hp.hpl.jena.sdb.layout2.LoaderTuplesNodes.commitTuples(LoaderTuplesNodes.java:283)
     at 
com.hp.hpl.jena.sdb.layout2.LoaderTuplesNodes.access$100(LoaderTuplesNodes.java:31)
     at 
com.hp.hpl.jena.sdb.layout2.LoaderTuplesNodes$Commiter.run(LoaderTuplesNodes.java:318)
     at java.lang.Thread.run(Thread.java:662)
Caused by: org.postgresql.util.PSQLException: ERROR: duplicate key value 
violates unique constraint "nodes_pkey"
     at 
org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2102)
     at 
org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1835)
     at 
org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257)
     at 
org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:500)
     at 
org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:374)
     at 
org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:302)
     at 
org.jboss.resource.adapter.jdbc.WrappedStatement.executeUpdate(WrappedStatement.java:249)
     at 
com.hp.hpl.jena.sdb.sql.SDBConnection.execUpdate(SDBConnection.java:151)
     at 
com.hp.hpl.jena.sdb.layout2.TupleLoaderBase.flush(TupleLoaderBase.java:202)
     ... 5 more

I would like to know if there are updates on the fixing of this 
inconvenience.

Thanks

-- 
Nicoletta Triolo

ID Skype: nicolettatriolo

Codices s.r.l. - Soluzioni Informatiche
http://www.codices.com
Via G.Malasoma, 24
56121 Ospedaletto (PI)
Tel:	+39 050 3160136
Fax: 	+39 050 9655150


Re: duplicate key error using SDB

Posted by Damian Steer <d....@bristol.ac.uk>.
On 19 Sep 2011, at 22:01, Damian Steer wrote:
> Patch attached.

Seems I was wrong about that. Try:

<https://issues.apache.org/jira/browse/JENA-118>

Damian

Re: duplicate key error using SDB

Posted by Damian Steer <d....@bristol.ac.uk>.
On 19 Sep 2011, at 10:33, Nicoletta Triolo wrote:

> Hi all,
> in the old mailing list I found this message (http://tech.groups.yahoo.com/group/jena-dev/message/45852) , that is strictly connected with what happen to me. The difference are in the version of library I use: jena 2.6.4, sdb 1.34 and Postgres 8.4.
> The error I have on multiple concurrent writing action on different Model (writing on the same database) is the following:
> Caused by: com.hp.hpl.jena.sdb.SDBException: Exception flushing
>    at com.hp.hpl.jena.sdb.layout2.TupleLoaderBase.flush(TupleLoaderBase.java:220)
>    at com.hp.hpl.jena.sdb.layout2.TupleLoaderBase.finish(TupleLoaderBase.java:155)
>    at com.hp.hpl.jena.sdb.layout2.LoaderTuplesNodes.commitTuples(LoaderTuplesNodes.java:283)
>    at com.hp.hpl.jena.sdb.layout2.LoaderTuplesNodes.access$100(LoaderTuplesNodes.java:31)
>    at com.hp.hpl.jena.sdb.layout2.LoaderTuplesNodes$Commiter.run(LoaderTuplesNodes.java:318)
>    at java.lang.Thread.run(Thread.java:662)
> Caused by: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "nodes_pkey"
>    at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2102)
>    at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1835)
>    at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257)
>    at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:500)
>    at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:374)
>    at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:302)
>    at org.jboss.resource.adapter.jdbc.WrappedStatement.executeUpdate(WrappedStatement.java:249)
>    at com.hp.hpl.jena.sdb.sql.SDBConnection.execUpdate(SDBConnection.java:151)
>    at com.hp.hpl.jena.sdb.layout2.TupleLoaderBase.flush(TupleLoaderBase.java:202)
>    ... 5 more
> 
> I would like to know if there are updates on the fixing of this inconvenience.

Hi Nicoletta,

For postgres (and I think a few other databases) I did work out a sort-of solution, but was nervous about it.

If you're comfortable with the command line you can try it out:

$ svn co http://svn.apache.org/repos/asf/incubator/jena/Jena2/SDB/trunk SDB-trunk
$ cd SDB-trunk
$ patch -p0 < lock-pg.patch
$ mvn install

I'm interested in:

1) does it solve the problem?
2) does it slow down loading?
3) does it ever stop mid-load?

Patch attached.