Things I dislike about BDB

Aside, of course, from the fact that I’m up at 1AM, with a cold no less, trying to debug this crap:

  • You need to specify some magic arrangement of flags to a DbEnv, or else Db::open fails for no good reason.
  • DbEnv squirts files everywhere.
  • You try to: (1) create a new database; (2) write a thousand or so objects to it; (3) close the database; (4) open the database again; (5) read out all those objects again. It crashes with a SIGSEGV at stage 4, in Db::open. I get recompile the debs again, with debug info just to find out what the hell is going wrong.
  • If you tried to create a database with the DB_DIRECT_DB flag, but passed that to Db::set_flags by mistake (which will actually set DB_DUP, meaning when you put records you actually put new versions of records), then every single database you create from then on has the DB_DUP flag set. This is with brand-new files, and without an associated DbEnv. Switching your DB type from HASH to BTREE then back to HASH fixes this.
  • You apparently can’t set potentially useful options like DB_DIRECT_DB without using an environment.

And lastly, working with padded structures makes using structs for keys an extra special headache. That’s a C complaint, of course, but I’ve included it at no additional cost.