dbTalk Databases Forums  

Why database corrupt after application crash?

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


Discuss Why database corrupt after application crash? in the comp.databases.berkeley-db forum.



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

Default Why database corrupt after application crash? - 06-22-2006 , 09:18 AM






Hello everyone here!
I have a question bother me for a long time. please help me!
The question is :
I create a db env and a db.then i access the db with
muti-thread.likeut、get、del the data in db .It work well if the
application close normally.And after the application crash.It will lose
some data when restart the application.I think it is acceptable to me.
becase berkeley db data in buffer.After the application crash, the data
in buffer no flush to the backing db file.But badly,Some time after
application crash.the database corrupt and i can't use it again after
the application restart.My question is:What make the database corrupt
after the application crash?(I think may be berkeley db do some think
make it corrupt.but i don't sure)How can fix it?(I don't want the
application can't restart after the user kill it)


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

Default Re: Why database corrupt after application crash? - 06-27-2006 , 06:51 AM






can some one help me?I post this for a long time.


Reply With Quote
  #3  
Old   
Michael Cahill
 
Posts: n/a

Default Re: Why database corrupt after application crash? - 06-27-2006 , 08:52 AM



Quote:
My question is:What make the database corrupt
after the application crash?
Berkeley DB maintains state in memory for performance reasons, and to
maintain consistency between multiple threads. So when the process is
killed, the data on disk is not complete (it is missing that data in
memory).

Quote:
How can fix it?(I don't want the
application can't restart after the user kill it)
To recover after a crash, you need to write a transactional
application. See this section of the documentation for more
information:

http://www.sleepycat.com/docs/ref/transapp/intro.html

Regards,
Michael.



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

Default Re: Why database corrupt after application crash? - 06-27-2006 , 09:50 AM




Michael Cahill wrote:
Quote:
My question is:What make the database corrupt
after the application crash?

Berkeley DB maintains state in memory for performance reasons, and to
maintain consistency between multiple threads. So when the process is
killed, the data on disk is not complete (it is missing that data in
memory).

How can fix it?(I don't want the
application can't restart after the user kill it)

To recover after a crash, you need to write a transactional
application. See this section of the documentation for more
information:

http://www.sleepycat.com/docs/ref/transapp/intro.html

Regards,
Michael.
Because the performance, I can't use a transactional protect in my
application! On the top I mean the data missing in memory is accepted
by me.But some time it can't use the db file again(lose all data in the
file i write before).How can guarantee the db file not corrupt and i
can't access the data i write before?



Reply With Quote
  #5  
Old   
Michael Cahill
 
Posts: n/a

Default Re: Why database corrupt after application crash? - 06-27-2006 , 07:02 PM



Quote:
Because the performance, I can't use a transactional protect in my
application!
What are your performance requirements? There are many ways to
configure Berkeley DB for high performance transactions.

Quote:
On the top I mean the data missing in memory is accepted
by me.But some time it can't use the db file again(lose all data in the
file i write before).How can guarantee the db file not corrupt and i
can't access the data i write before?
The only ways to ensure that files on disk are consistent when your
application starts are:

* use transactions and recovery; or
* shut down cleanly (that is, close all databases and the environment
before processes exit).

Regards,
Michael.



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

Default Re: Why database corrupt after application crash? - 06-29-2006 , 09:04 AM




Michael Cahill wrote:
Quote:
Because the performance, I can't use a transactional protect in my
application!

What are your performance requirements? There are many ways to
configure Berkeley DB for high performance transactions.

On the top I mean the data missing in memory is accepted
by me.But some time it can't use the db file again(lose all data in the
file i write before).How can guarantee the db file not corrupt and i
can't access the data i write before?

The only ways to ensure that files on disk are consistent when your
application starts are:

* use transactions and recovery; or
* shut down cleanly (that is, close all databases and the environment
before processes exit).

Regards,
Michael.
Thanks Michael!
My performance requirements is :insert or update or del 3000 items in
db.What i can do ?



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

Default Re: Why database corrupt after application crash? - 06-29-2006 , 09:07 AM




demon... (AT) 163 (DOT) com wrote:
Quote:
Michael Cahill wrote:
Because the performance, I can't use a transactional protect in my
application!

What are your performance requirements? There are many ways to
configure Berkeley DB for high performance transactions.

On the top I mean the data missing in memory is accepted
by me.But some time it can't use the db file again(lose all data in the
file i write before).How can guarantee the db file not corrupt and i
can't access the data i write before?

The only ways to ensure that files on disk are consistent when your
application starts are:

* use transactions and recovery; or
* shut down cleanly (that is, close all databases and the environment
before processes exit).

Regards,
Michael.

Thanks Michael!
My performance requirements is :insert or update or del 3000 items in
db.What i can do ?

I means insert or update or del 3000 items per second



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.