]> git.sur5r.net Git - openldap/commitdiff
Set the id2entry database pagesize to BDB_ID2ENTRY_PAGESIZE to avoid
authorHoward Chu <hyc@openldap.org>
Tue, 27 Nov 2001 12:36:52 +0000 (12:36 +0000)
committerHoward Chu <hyc@openldap.org>
Tue, 27 Nov 2001 12:36:52 +0000 (12:36 +0000)
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.

servers/slapd/back-bdb/back-bdb.h
servers/slapd/back-bdb/init.c

index 9932bfb8bb2ad4f8fa9b0ba52ddf0695319642b2..ec7184447797f665dafe0675dc03746f825026f2 100644 (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 {
index ac97844cbe5730390b81385ae85e10a8711c73e7..8e5f5b51af4f06b711827555c30a711713e512f7 100644 (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 );