ext3fs slowness -- how things proceed

Greg Louis glouis at dynamicro.on.ca
Tue Feb 4 13:53:48 CET 2003


On 20030204 (Tue) at 0224:22 +0100, Matthias Andree wrote:
> There be dragons.

For folks who would prefer to avoid getting burnt, and are running db
version 4.1.x and have plenty of RAM, the following change to datastore_db.c
will improve matters:

--- datastore_db.c.orig	2003-01-30 21:46:00.000000000 -0500
+++ datastore_db.c	2003-02-03 11:52:11.000000000 -0500
@@ -54,6 +54,8 @@
 
 #if DB_AT_LEAST(4,1)
 #define	DB_OPEN(db, file, database, dbtype, flags, mode) db->open(db, NULL /*txnid*/, file, database, dbtype, flags, mode)
+#define DB_CACHE(db, gb, bytes, chunks) db->set_cachesize(db, gb, bytes, chunks)
+#define CACHEMB 25*1024*1024
 #else
 #define	DB_OPEN(db, file, database, dbtype, flags, mode) db->open(db, file, database, dbtype, flags, mode)
 #endif
@@ -126,6 +128,12 @@
 	goto open_err;
     }
 
+    if ((ret = DB_CACHE(handle->dbp, 0, CACHEMB, 1)) != 0) {
+        print_error(__FILE__, __LINE__, "(db) setcache( %s ), err: %d, %s",
+            db_file, ret, db_strerror(ret));
+        goto open_err; 
+    }
+
     /* open data base */
     if ((ret = DB_OPEN(handle->dbp, db_file, NULL, DB_BTREE, opt_flags, 0664)) != 0 &&
 	    (ret = DB_OPEN(handle->dbp, db_file, NULL, DB_BTREE, opt_flags |  DB_CREATE | DB_EXCL, 0664)) != 0) {

Note this breaks if you're not running db 4.1.x -- there's no #IF
DB_AT_LEAST around the DB_CACHE call, which means we need the pre-4.1
DB_CACHE definition, which I don't know.  If someone could supply that,
that would be a Good Thing.

This, however, is only a workaround -- not by any means a solution.

-- 
| G r e g  L o u i s          | gpg public key:      |
|   http://www.bgl.nu/~glouis |   finger greg at bgl.nu |
| Help free our mailboxes. Include                   |
|        http://wecanstopspam.org in your signature. |




More information about the bogofilter-dev mailing list