1 /* back-bdb.h - bdb back-end header file */
4 * Copyright 2000-2002 The OpenLDAP Foundation, All Rights Reserved.
5 * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
18 #define BDB_FILTER_INDICES 1
19 #define BDB_IDL_MULTI 1
20 /* #define BDB_HIER 1 */
22 #define DN_BASE_PREFIX SLAP_INDEX_EQUALITY_PREFIX
23 #define DN_ONE_PREFIX '%'
24 #define DN_SUBTREE_PREFIX '@'
26 #define DBTzero(t) (memset((t), 0, sizeof(DBT)))
27 #define DBT2bv(t,bv) ((bv)->bv_val = (t)->data, \
28 (bv)->bv_len = (t)->size)
29 #define bv2DBT(bv,t) ((t)->data = (bv)->bv_val, \
30 (t)->size = (bv)->bv_len )
32 #define DEFAULT_MODE 0600
34 #define BDB_TXN_RETRIES 16
37 #define BDB_DBENV_HOME LDAP_RUNDIR LDAP_DIRSEP "openldap-hdb"
39 #define BDB_DBENV_HOME LDAP_RUNDIR LDAP_DIRSEP "openldap-bdb"
43 #define BDB_TMP_SUBDIR LDAP_DIRSEP "tmp"
44 #define BDB_LG_SUBDIR LDAP_DIRSEP "log"
45 #define BDB_DATA_SUBDIR LDAP_DIRSEP "data"
48 #define BDB_SUFFIX ".bdb"
49 #define BDB_ID2ENTRY 0
51 #define BDB_ID2PARENT 1
57 /* The bdb on-disk entry format is pretty space-inefficient. Average
58 * sized user entries are 3-4K each. You need at least two entries to
59 * fit into a single database page, more is better. 64K is BDB's
60 * upper bound. The same issues arise with IDLs in the index databases,
61 * but it's nearly impossible to avoid overflows there.
63 * When using BDB_IDL_MULTI, the IDL size is no longer an issue. Smaller
64 * pages are better for concurrency.
66 #ifndef BDB_ID2ENTRY_PAGESIZE
67 #define BDB_ID2ENTRY_PAGESIZE 16384
72 #define BDB_PAGESIZE 4096 /* BDB's original default */
74 #define BDB_PAGESIZE 16384
78 #define BDB_INDICES 128
88 /* DB_ENV parameters */
89 /* The DB_ENV can be tuned via DB_CONFIG */
91 u_int32_t bi_dbenv_xflags; /* extra flags */
95 struct bdb_db_info **bi_databases;
96 ldap_pvt_thread_mutex_t bi_database_mutex;
97 int bi_db_opflags; /* db-specific flags */
99 slap_mask_t bi_defaultmask;
103 ldap_pvt_thread_rdwr_t bi_tree_rdwr;
110 u_int32_t bi_txn_cp_min;
111 u_int32_t bi_txn_cp_kbyte;
115 int bi_lock_detect_seconds;
116 ldap_pvt_thread_t bi_lock_detect_tid;
120 ldap_pvt_thread_mutex_t bi_lastid_mutex;
123 #define bi_id2entry bi_databases[BDB_ID2ENTRY]
125 #define bi_id2parent bi_databases[BDB_ID2PARENT]
127 #define bi_dn2id bi_databases[BDB_DN2ID]
136 #if DB_VERSION_MAJOR < 4
137 #define TXN_CHECKPOINT(env, k, m, f) txn_checkpoint(env, k, m, f)
138 #define TXN_ID(txn) txn_id(txn)
139 #define LOCK_DETECT(env, f, t, a) lock_detect(env, f, t, a)
140 #define LOCK_GET(env, i, f, o, m, l) lock_get(env, i, f, o, m, l)
142 #define TXN_CHECKPOINT(env, k, m, f) (env)->txn_checkpoint(env, k, m, f)
143 #define TXN_ID(txn) (txn)->id(txn)
144 #define LOCK_DETECT(env, f, t, a) (env)->lock_detect(env, f, t, a)
145 #define LOCK_GET(env, i, f, o, m, l) (env)->lock_get(env, i, f, o, m, l)
150 #include "proto-bdb.h"
152 #endif /* _BACK_BDB_H_ */