dbTalk Databases Forums  

Updating keys of secondary databases

comp.databases.berkeley-db comp.databases.berkeley-db


Discuss Updating keys of secondary databases in the comp.databases.berkeley-db forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
AT
 
Posts: n/a

Default Updating keys of secondary databases - 07-21-2006 , 12:03 PM






Hi, I'm using berkley db to store some objects and need to create
several index (as I understood, each index is a secondary database).
Well, one of these secondary databases has as key a timestamp that is
changed over time. Updating the object in the primary database doesn't
have any problem, but it generates another registry in the secondary
database, because the timestamp changed. The behaviour I would like it
to have is to update the secondary key (the timestamp) in the secondary
db. Is it possible or do I have to delete the registry and add it
again?

thanks,
Jose Tavares


Reply With Quote
  #2  
Old   
AT
 
Posts: n/a

Default Re: Updating keys of secondary databases - 08-01-2006 , 03:23 AM






Hi Jose,

Berkeley DB supports updates on secondary if you are using a DB handle.
Since your update on primary, creates a new registry in the secondary
database, is very probable that you didn't associated the primary
handle with the appropiate secondary one.

Documentation regarding secondary indices can be found here:
http://www.sleepycat.com/docs/ref/am/second.html

I think that you are interested in this paragraph: "Note that although
Berkeley DB guarantees that updates made using any DB handle with an
associated secondary will be reflected in the that secondary,
associating each primary handle with all the appropriate secondaries is
the responsibility of the application and is not enforced by Berkeley
DB. It is generally unsafe, but not forbidden by Berkeley DB, to modify
a database that has secondary indices without having those indices open
and associated. Similarly, it is generally unsafe, but not forbidden,
to modify a secondary index directly. Applications that violate these
rules face the possibility of outdated or incorrect results if the
secondary indices are later used."

If the problem persist, please provide me at least the order of methods
that you are calling, or the source code for this update, and I'll look
over. Also, please tell me what Berkeley DB product are you using (
http://www.sleepycat.com/docs/ref/intro/products.html ) and on which
platform.

Regards,
Bogdan Coman, Oracle


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.