Skip to content
Snippets Groups Projects
Commit 5c7a7998 authored by Howard Chu's avatar Howard Chu
Browse files

Set the id2entry database pagesize to BDB_ID2ENTRY_PAGESIZE to avoid

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.
parent b45133c9
No related branches found
No related tags found
No related merge requests found
......@@ -44,6 +44,15 @@ LDAP_BEGIN_DECL
#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 {
......
......@@ -232,10 +232,12 @@ bdb_db_open( BackendDB *be )
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 );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment