| Author |
Message |
demon_32@163.com *nix forums beginner
Joined: 09 Nov 2005
Posts: 9
|
Posted: Thu Jun 22, 2006 2:18 pm Post subject:
Why database corrupt after application crash?
|
|
|
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
|
Posted: Tue Jun 27, 2006 11:51 am Post subject:
Re: Why database corrupt after application crash?
|
|
|
|
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
|
Posted: Tue Jun 27, 2006 1:52 pm Post subject:
Re: Why database corrupt after application crash?
|
|
|
| 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
|
Posted: Tue Jun 27, 2006 2:50 pm Post subject:
Re: Why database corrupt after application crash?
|
|
|
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
|
Posted: Wed Jun 28, 2006 12:02 am Post subject:
Re: Why database corrupt after application crash?
|
|
|
| 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
|
Posted: Thu Jun 29, 2006 2:04 pm Post subject:
Re: Why database corrupt after application crash?
|
|
|
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
|
Posted: Thu Jun 29, 2006 2:07 pm Post subject:
Re: Why database corrupt after application crash?
|
|
|
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 |
|
 |
|