Added the ability to specify database page size.
[statserve.git] / dbsrc.c
diff --git a/dbsrc.c b/dbsrc.c
index fa9899c..bb239ae 100644 (file)
--- a/dbsrc.c
+++ b/dbsrc.c
@@ -15,6 +15,8 @@ struct dbsrc {
     time_t lastcp, lastar;
 };
 
+int dbpagesize = 0;
+
 static struct fileinfo dbserve(struct source *src, char *nm)
 {
     struct dbsrc *d = src->pdata;
@@ -142,6 +144,12 @@ struct source *mkdbsrc(char *path, char *envpath)
        flog(LOG_ERR, "could not create bdb database: %s", db_strerror(ret));
        exit(1);
     }
+    if(dbpagesize) {
+       if((ret = d->db->set_pagesize(d->db, dbpagesize)) != 0) {
+           flog(LOG_ERR, "could not set bdb page size (to %i): %s", dbpagesize, db_strerror(ret));
+           exit(1);
+       }
+    }
     if((ret = d->db->open(d->db, NULL, path, NULL, DB_HASH, DB_AUTO_COMMIT | DB_CREATE, 0666)) != 0) {
        flog(LOG_ERR, "could not open bdb database: %s", db_strerror(ret));
        exit(1);