#define DEFAULT_DBCACHE_SIZE (128 * DEFAULT_DB_PAGE_SIZE)
#define DEFAULT_DB_DIRECTORY "/usr/tmp"
+#define DEFAULT_DB_HOME "/usr/tmp"
#define DEFAULT_MODE 0600
#define SUBLEN 3
+#define BDB2_SUFFIX ".bdb2"
+
+
/*
* there is a single index for each attribute. these prefixes insure
* that there is no collision among keys.
ldap_pvt_thread_mutex_t c_mutex;
};
+#define CACHE_READ_LOCK 0
+#define CACHE_WRITE_LOCK 1
+
/* for the cache of open index files (re-used for txn) */
struct dbcache {
int dbc_refcnt;
int dbc_maxids;
int dbc_maxindirect;
- time_t dbc_lastref;
long dbc_blksize;
char *dbc_name;
LDBM dbc_db;
typedef struct _bdb2_txn_head {
- /* counter and timer to control checkpoints */
- size_t txn_cnt;
- time_t txn_chkp;
+ /* log size and timer to control checkpoints */
+ u_int32_t txn_log;
+ u_int32_t txn_time;
/* a list of all DB files in use */
BDB2_TXN_FILES *dbFiles;
- /* for performance reasons we have pointers to fixed descriptors */
- BDB2_TXN_FILES *dbFileHandle[4];
+ /* we have five fixed files */
#define BDB2_DB_DN_FILE 0
#define BDB2_DB_DN2ID_FILE 1
#define BDB2_DB_ID2ENTRY_FILE 2
#define BDB2_DB_ID2CHILDREN_FILE 3
#define BDB2_DB_OC_IDX_FILE 4
+ /* a database handle for the NEXTID file
+ (must be opened like all DB files at startup
+ and closed on shutdown */
+ LDBM nextidFile;
+
/* is the default attribute index set to non-none */
int withDefIDX;
#define BDB2_WITH_DEF_IDX 1
+ /* a handle for the backend's environment */
+ DB_ENV **dbenvH;
+
} BDB2_TXN_HEAD;
/* end of TP stuff */
+
+/* the private description of a backend type */
+struct ldbtype {
+ char *lty_dbhome;
+ size_t lty_mpsize;
+ int lty_betiming;
+};
+
+#define with_timing(bi) (((struct ldbtype *) \
+ (bi)->bi_private)->lty_betiming == 1)
+
+/* The DB environment */
+extern DB_ENV bdb2i_dbEnv;
+
+
+/* the private description of a database */
struct ldbminfo {
ID li_nextid;
#if SLAPD_NEXTID_CHUNK > 1
ID li_nextid_wrote;
#endif
char *li_nextid_file;
- ldap_pvt_thread_mutex_t li_root_mutex;
- ldap_pvt_thread_mutex_t li_add_mutex;
- ldap_pvt_thread_mutex_t li_nextid_mutex;
int li_mode;
char *li_directory;
struct cache li_cache;
Avlnode *li_attrs;
int li_dbcachesize;
int li_dbcachewsync;
- struct dbcache li_dbcache[MAXDBCACHE];
- ldap_pvt_thread_mutex_t li_dbcache_mutex;
- ldap_pvt_thread_cond_t li_dbcache_cv;
- /* Berkeley DB2 Environment */
- DB_ENV li_db_env;
- char *li_dbhome;
+ /* a list of all files of the database */
BDB2_TXN_HEAD li_txn_head;
};
-extern int bdb2i_with_dbenv;
-
#include "proto-back-bdb2.h"
LDAP_END_DECL