Hi,

thanks for the answer Andy.
couple of things I'd like to verify with you:
1. From you answer I understand this exception does not state that the database 
is inconsistent or corrupted, correct ?
2. Regarding what you said "The dataset is the unit at the storage layer so it 
gets messy if you
have many named models.",I have only one named model so is it OK to use the 
close and create at the model level, and not the dataset ?
3. should I reverse the code:
           TDB.closedown();
           model.close();
4. is there a way to prevent this from happening besides switching versions, 
can you show me the proper  template of :
  a. how to open a model
  b. Critical section with right lock
  c. do  CRUD operations (remove statements, add statements, etc...)
  d. leave critical section.
  e. close model.
5. If I switch to version
 the open and close model is for HA purpose, we have 2 servers (i.e. 2 jvms) 
that approach the DB and our current solution is to open connection from 
scratch and close it.

thanks,
________________________________________
From: Andy Seaborne [[email protected]] on behalf of Andy Seaborne 
[[email protected]]
Sent: Thursday, December 15, 2011 6:33 PM
To: [email protected]
Subject: Re: Got TDBException: Secondary index duplicate

On 15/12/11 14:24, Nadav Hoze wrote:
> I'm using jena TBD version version 0.8.5,  ARQ 2.8.3 and Jena 2.6.2.

April 2010.

I'm fairly sure this area has been cleaned up.

>
> And I think your calculated guess could be right.
>
> This is the code I use for opening connection to DB (i.e. obtaining model):
> private void doOpenModel() {
>          if (model != null) {
>              doCloseModel();
>          }
>          model = TDBFactory.createModel(connectionString);

It's always better to use a dataset.  The createModel and createGraph
operations are likely to be deprecated in the next release.

The dataset is the unit at the storage layer so it gets messy if you
have many named models.

IIRC back in 0.8.5, the model wasn't a proper database (but it's been a
awhile since that release).

>      }
> And this is the code for closing the model:
> private void doCloseModel() {
>          logger.trace("Closing model.");
>          TDB.sync(model);

"dataset" but otherwise this is the right thing to do.

>          TDB.closedown();
>          model.close();

Probably harmless but this is after the closedown.

>   }
>
> In between there are CRUD  operations and the doCloseModel() is always in 
> finally block.
>
> So maybe I'm doing something wrong  in the doCloseModel()?

Possibly age of the TDB version.  Sorry I can't remember which version
had which bugs as theer has been a lot of change - this was an area that
was fixed but I can't recall (or reconstruct) which version it was.

        Andy

>
> Thanks,
>
>
>
>
> Nadav Hoze
> Senior Software Engineer
> dbMotion Ltd.
> Direct: +972-9-7699000
> Extension number: 9037
> Mobile: 972-54-4821606
> E-mail: [email protected]
>
>
> -----Original Message-----
> From: Andy Seaborne [mailto:[email protected]] On Behalf Of Andy 
> Seaborne
> Sent: Thursday, December 15, 2011 3:46 PM
> To: [email protected]
> Subject: Re: Got TDBException: Secondary index duplicate
>
> Hi there,
>
> A possible cause is not shutting the database down cleanly sometime earlier.  
> Could that have happened?
>
> (Transactions will help a lot here).
>
>          Andy
>
> PS Which version is this?
>
> On 14/12/11 14:02, Nadav Hoze wrote:
>> Hi
>>
>> I'm working with Jena TDB and my data storage is on a clustered data server.
>>
>> I got this exception:
>>
>> *com.hp.hpl.jena.tdb.TDBException: Secondary index duplicate: SPO->OSP
>> ->  [[000000000063A94E], [0000000000000B52], [000000000063A98C]]*
>>
>> at com.hp.hpl.jena.tdb.index.TupleTable.add(TupleTable.java:60)
>>
>> at
>> com.hp.hpl.jena.tdb.nodetable.NodeTupleTable.addRow(NodeTupleTable.jav
>> a:56)
>>
>> at com.hp.hpl.jena.tdb.store.TripleTable.add(TripleTable.java:45)
>>
>> at
>> com.hp.hpl.jena.tdb.store.GraphTriplesTDB._performAdd(GraphTriplesTDB.
>> java:44)
>>
>> at
>> com.hp.hpl.jena.tdb.store.GraphTDBBase.performAdd(GraphTDBBase.java:89
>> )
>>
>> at
>> com.hp.hpl.jena.graph.impl.SimpleBulkUpdateHandler.add(SimpleBulkUpdat
>> eHandler.java:48)
>>
>> at
>> com.hp.hpl.jena.graph.impl.SimpleBulkUpdateHandler.add(SimpleBulkUpdat
>> eHandler.java:44)
>>
>> at com.hp.hpl.jena.rdf.model.impl.ModelCom.add(ModelCom.java:883)
>>
>> There is no concurrency issues because the environment we work in is
>> not federated (i.e. no multiple clients calling jena).
>>
>> I saw a post of Andy which implies that the datastore might be
>> inconsistent which worries me allot.
>>
>> Can you provide some info why would this happen even though I never
>> encountered this and here we don't deal with multiple concurrent requests.
>>
>> Could this happen let's say if data server was unavailable for a brief
>> moment ?
>>
>> Really appreciate your help.
>>
>> Thanks,
>>
>> *Nadav Hoze*
>>
>> Senior Software Engineer
>>
>> dbMotion Ltd.
>>
>> Direct: +972-9-7699000
>>
>> Extension number: 9037
>>
>> Mobile: 972-54-4821606
>>
>> E-mail: [email protected]<mailto:[email protected]>_
>>
>> Description: Logo + Tagline
>>
>> This email and any files transmitted with it are confidential and
>> intended solely for the use of the individual or entity to whom they
>> are addressed. Please note that any disclosure, copying or
>> distribution of the content of this information is strictly forbidden.
>> If you have received this email message in error please notify its
>> sender and then delete it from your files.
>
> This email and any files transmitted with it are confidential and intended 
> solely for the use of the individual or entity to whom they are addressed. 
> Please note that any disclosure, copying or distribution of the content of 
> this information is strictly forbidden. If you have received this email 
> message in error please notify its sender and then delete it from your files.

This email and any files transmitted with it are confidential and intended 
solely for the use of the individual or entity to whom they are addressed. 
Please note that any disclosure, copying or distribution of the content of this 
information is strictly forbidden. If you have received this email message in 
error please notify its sender and then delete it from your files.

Reply via email to