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.
This commit is contained in:
Howard Chu 2001-11-27 12:36:52 +00:00
parent b45133c958
commit 5c7a7998a9
2 changed files with 12 additions and 1 deletions

View file

@ -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 {

View file

@ -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 );