niXforums Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   PreferencesPreferences   Log in to check your private messagesLog in to check your private messages   Log inLog in 
·  nixdoc.net ·  man pages ·  Linux HOWTOs ·  FreeBSD Tips ·  Forums
navigation Forum index » Databases » Berkeley DB
Why database corrupt after application crash?
Post new topic   Reply to topic Page 1 of 1 [7 Posts] View previous topic :: View next topic
Author Message
demon_32@163.com
*nix forums beginner


Joined: 09 Nov 2005
Posts: 9

PostPosted: Thu Jun 22, 2006 2:18 pm    Post subject: Why database corrupt after application crash? Reply with quote

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.like:put、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)
Back to top
demon_32@163.com
*nix forums beginner


Joined: 09 Nov 2005
Posts: 9

PostPosted: Tue Jun 27, 2006 11:51 am    Post subject: Re: Why database corrupt after application crash? Reply with quote

can some one help me?I post this for a long time.
Back to top
Michael Cahill
*nix forums Guru Wannabe


Joined: 26 May 2005
Posts: 219

PostPosted: Tue Jun 27, 2006 1:52 pm    Post subject: Re: Why database corrupt after application crash? Reply with quote

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.
Back to top
demon_32@163.com
*nix forums beginner


Joined: 09 Nov 2005
Posts: 9

PostPosted: Tue Jun 27, 2006 2:50 pm    Post subject: Re: Why database corrupt after application crash? Reply with quote

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?
Back to top
Michael Cahill
*nix forums Guru Wannabe


Joined: 26 May 2005
Posts: 219

PostPosted: Wed Jun 28, 2006 12:02 am    Post subject: Re: Why database corrupt after application crash? Reply with quote

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.
Back to top
demon_32@163.com
*nix forums beginner


Joined: 09 Nov 2005
Posts: 9

PostPosted: Thu Jun 29, 2006 2:04 pm    Post subject: Re: Why database corrupt after application crash? Reply with quote

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 ?
Back to top
demon_32@163.com
*nix forums beginner


Joined: 09 Nov 2005
Posts: 9

PostPosted: Thu Jun 29, 2006 2:07 pm    Post subject: Re: Why database corrupt after application crash? Reply with quote

demon...@163.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
Back to top
Google

Back to top
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [7 Posts] View previous topic :: View next topic
The time now is Tue Dec 02, 2008 12:52 pm | All times are GMT
navigation Forum index » Databases » Berkeley DB
Jump to:  

Similar Topics
Topic Author Forum Replies Last Post
No new posts Move Oracle 10g database to another location Selt Server 0 Fri Jul 21, 2006 2:14 pm
No new posts database Share Memory Limit (2 GB ) in a Instance is tota... sadanjan@gmail.com IBM DB2 0 Fri Jul 21, 2006 12:57 pm
No new posts A webserver (PHP 5) with a few database server (MySQL) |J PHP 2 Fri Jul 21, 2006 1:43 am
No new posts Regular Expressions crash course elyob PHP 1 Thu Jul 20, 2006 8:07 pm
No new posts Bizarre Crash Recovery Michel Esber IBM DB2 1 Thu Jul 20, 2006 6:24 pm

Buy Anything On eBay | France Hotels | Loans | Mobile Phones | Project cars for sale
Copyright © 2004-2005 DeniX Solutions SRL
 
Other DeniX Solutions sites: Unix/Linux blog |  electronics forum |  medicine forum |  science forum | 
Privacy Policy


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.2205s ][ Queries: 16 (0.1248s) ][ GZIP on - Debug on ]