Sean O'Donnells Weblog
My blog seemed to stop accepting comments at some point tonight. The error message returned was:
DBRunRecoveryError: (-30978, 'DB_RUNRECOVERY: Fatal error, run database recovery -- PANIC: Invalid argument')
This first thing I managed to figure out by googling was that there is a db_recover tool to recover the bdb database I use for comments, however I didn't seem to have the tool on my system and couldn't find a Debian package that contained it. It turned out that the correct name on Debian is db4.2_recover. Sadly even after running it the database wasn't working.
Eventually I figured out how to dump and reload the database. I first dumped the database using
db4.2_dump dbfile > dbfile.dump
The backed up the database file (dbfile) and deleted it. Then ran
db4.2_load dbfile < dbfile.dump
And that sorted it. I'm still not clear on what caused the corruption, as there where no crashes or any other noticeable problems today. I thought I would make a note of this here, both to help me if I ever hit the problem again and to hopefully help others avoid the endless googling I had to go through to figure it all out. Thanks to Tim Kerstin for reporting the problem.
Thanks Sean for your pratical approach. I met the same problem recently. But I don't know the reason. The first time I met this problem, I thought it's because I wrote and read the DB without accurate access control / lock. So I re-created a DB, and maintain two copies, one for writing, another for reading. However, the fact is that I get the same problem again.
I use "m_db.open(NULL,fname,NULL,DB_HASH, DB_CREATE | DB_THREAD, 0644);" to open DB. But I don't do any db environment configuration. To simpify the issue, I use single process and single thread to write DB. Now this problem really upsets me. Do you know the reason of this problem and the solution?
Regards, Gerry
Sorry Gerry, I have no idea what the root cause is, it happened to me every 2 months or so and eventually I moved off bdb completely rather than put up with it.
Sean, when I use db_dump to dump the db file, I got error: "db_dump: DB->stat: DB_PAGE_NOTFOUND: Requested page not found". Seem databases have seriously corrupted. There is no chance to restore them.