Just to chime in, the database.c code is very clean. The only problem I have had with Berkeley is that if the code or system crashes, most of the time, the database is corrupted and recover does not help sometimes and I have to revert to a backup. The code has become a lot more stable so not as big an issue anymore for me.
I did think about making a drop in replacement for database.c using MySql. I started to play with it with the concept of key tables and having a set of tables with different sized blobs so you could store data records across multiple tables to optimize database size. Did not get to the point where I could compare performance with Berkley, but it looked promising. Optimally, not using indexes and rewriting all the code to use MySql tables and features would probably be the best, but a lot of work....