purging old db logs

Matthias Andree matthias.andree at gmx.de
Mon Dec 13 18:27:28 CET 2004


Bill McClain <wmcclain at salamander.com> writes:

> (1) After careful reading of README.db I have upgraded from 0.92.8 to
> 0.93.2. All went smoothly. I notice one small glitch: the bf_compact
> script uses "db_archive -d" to delete old logs. The -d looks like a
> handy switch, but is not available for Berkeley DB 4.0.14 which I have
> with SuSE 8.2. Presumably I'll get it with a newer distribution. Until
> then, I think "rm -f `db_archive`" will accomplish the same thing.

Yup. I've committed this change to CVS, to appear in 0.93.3:

Index: src/bf_compact
===================================================================
RCS file: /cvsroot/bogofilter/bogofilter/src/bf_compact,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- src/bf_compact	7 Dec 2004 03:51:51 -0000	1.5
+++ src/bf_compact	13 Dec 2004 17:19:07 -0000	1.6
@@ -6,7 +6,7 @@
 #    replaces original directory with new one
 #    renames original directory with '.old' extension
 
-# $Id: bf_compact,v 1.5 2004/12/07 03:51:51 clint Exp $
+# $Id: bf_compact,v 1.6 2004/12/13 17:19:07 m-a Exp $
 
 set -e # die on errors
 
@@ -37,7 +37,7 @@
 
 #checkpoint and remove unneeded log files
 db_checkpoint -1h $TEMP
-db_archive    -dh $TEMP
+for i in `db_archive    -ah $TEMP` ; do rm -f "$i" ; done
 
 mv "$ORIG" "$ORIG.old"
 mv  $TEMP  "$ORIG"

> (2) set_flags DB_LOG_AUTOREMOVE looks like an interesting option. It is
> listed as "unsafe" because old logs should be backed up rather than
> immediately deleted, but if I am willing to rebuild from scratch using 
> a worldlist dump, or even from an original spam/ham corpus, is there
> anything particularly unsafe with letting the db remove its own logs?

No, there isn't. A complete backup consists of the .db file and all
active log files (usually one, but may be more until you run
db_checkpoint).

> I'm asking: do we know the feature works as advertised?

Apparently, it does not. bogofilter 0.93.3 will have a "bogoutil -P
~/.bogofilter" option to checkpoint the database and discard old logs,
and may perhaps emulate this DB_LOG_AUTOREMOVE feature - we need this
anyways to support older database library versions.

> (3) I used to be a database guy. The various db_stat informational
> switches are pretty entertaining!

For those who understand them. :-)

-- 
Matthias Andree



More information about the Bogofilter mailing list