overflow/fragmentation. (This is now 16K vs default 4K.) It turns out
that the entries' on-disk format is quite space-inefficient, storing
4 bytes per pointer or integer when typically >50% of those bytes are
zero. Oh well. It's about a 2:1 space increase over ldbm now, vs 4:1
before when all the entries were overflowing the 4K pages.
#define BDB_DN2ID 1
#define BDB_NDB 2
+/* The bdb on-disk entry format is pretty space-inefficient. Average
+ * sized user entries are 3-4K each. You need at least two entries to
+ * fit into a single database page, more is better. 64K is BDB's
+ * upper bound.
+ */
+#ifndef BDB_ID2ENTRY_PAGESIZE
+#define BDB_ID2ENTRY_PAGESIZE 16384
+#endif
+
#define BDB_INDICES 128
struct bdb_db_info {
if( i == BDB_ID2ENTRY ) {
rc = db->bdi_db->set_bt_compare( db->bdi_db,
bdb_bt_compare );
+ rc = db->bdi_db->set_pagesize( db->bdi_db,
+ BDB_ID2ENTRY_PAGESIZE );
}
rc = db->bdi_db->open( db->bdi_db,
bdbi_databases[i].file,
- bdbi_databases[i].name,
+ /* bdbi_databases[i].name, */ NULL,
bdbi_databases[i].type,
bdbi_databases[i].flags | flags,
bdb->bi_dbenv_mode );