dbTalk Databases Forums  

is a single put atomic?

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


Discuss is a single put atomic? in the comp.databases.berkeley-db forum.



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

Default is a single put atomic? - 09-01-2006 , 09:36 AM






Hi,

new to this database I wonder what happens if
I issue a kill -9 to a process that is currently writing
into the database with a put operation. Is there a
danger that the db is corrupt afterwards. How about
a power failure? Note that I am not asking for
transactions. I would just like to know if a put either
works or fails, or if it is possible that a kill -9 leaves the
db in the state of a half finished put?

A related question: How can I make sure that put-operations are not
cached in memory?

Thanks,
Harald Kirsch


Reply With Quote
  #2  
Old   
Philip Guenther
 
Posts: n/a

Default Re: is a single put atomic? - 09-01-2006 , 02:37 PM






HK wrote:
Quote:
new to this database I wonder what happens if
I issue a kill -9 to a process that is currently writing
into the database with a put operation. Is there a
danger that the db is corrupt afterwards. How about
a power failure?
Yes, that danger exists: a put can require updating multiple pages in
the database (e.g., B-tree page splits and hash table expansions). If
anything keeps all the changes from being recorded, you database will
be corrupt.


Quote:
Note that I am not asking for
transactions. I would just like to know if a put either
works or fails, or if it is possible that a kill -9 leaves the
db in the state of a half finished put?
It can leave it in a half-finished state. If that's a problem, you'll
need transactions.


Quote:
A related question: How can I make sure that put-operations are not
cached in memory?
Do you mean, how can you make sure that put-operations are flushed to
disk? That can be done using DB->sync()


Philip Guenther



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.