You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@spamassassin.apache.org by me...@animalhead.com on 2008/01/17 02:46:15 UTC

sa-learn error message

Hi again SA experts,

Note the error message in the 2nd-last line of the following transcript:

animalhead:~/sj $ sa-learn --no-rebuild --spam --mbox savejunk
The --no-rebuild option has been deprecated.  Please use --no-sync  
instead.
Learned tokens from 3025 message(s) (3047 message(s) examined)
animalhead:~/sj $ sa-learn --no-sync --spam thruJunk
bayes: bayes db version 0 is not able to be used, aborting! at /usr/ 
local/lib/perl5/site_perl/5.8.8/Mail/SpamAssassin/BayesStore/DBM.pm  
line 196.
Learned tokens from 170 message(s) (170 message(s) examined)

There are 171 messages in directory thruJunk.  The largest is 495K,  
the next largest is 137K.
$ sa-learn -V    yields "spamassassin v 3.2.1"

What should I do about this?

I still have another directory with ham to go.  It includes lots of  
large files.  Should I delete those over a certain size?

Thanks,
Craig MacKenna


Re: sa-learn error message

Posted by Steven Stern <su...@sterndata.com>.
Theo Van Dinter wrote:
> On Thu, Jan 17, 2008 at 03:28:06PM -0600, Steven Stern wrote:
>> bayes db version 0 " indicates your bayes file is corrupt. It should be
>> "version 3".  Do you have a backup?  SQL or .db?
> 
> It doesn't necessarily mean there's corruption,
> in fact, since the learning continued and seemed
> to finish ok, it's unlikely to be corruption.  See
> http://issues.apache.org/SpamAssassin/show_bug.cgi?id=3563 for a possible
> libdb issue which causes it.
> 

Thanks. I ran into this when I hosed the sa_bayes MySQL database as we 
were cloning one of our MX servers.

Re: sa-learn error message

Posted by Theo Van Dinter <fe...@apache.org>.
On Thu, Jan 17, 2008 at 07:42:30PM -0800, mackenna@animalhead.com wrote:
> Did I read something that said that the digit after "bayes db  
> version" indicated the version of Berkeley DB that's installed on the  
> system?  Like 0 means 1.x...   Google shows various messages like  
> "bayes db version 2 is not able to be used, aborting!" which would  
> seem to indicate that 0 is not indicative of the problem I saw.

The bayes version has nothing to do with the version of Berkeley DB.  It's the
version of the Bayes data.  It's been 3 for a while now.  from "man sa-learn":

 The database ’version number’ is 0 for databases from 2.5x, 1 for
 databases from certain 2.6x development releases, and 2 for all more
 recent databases.

Hrm.  Interestingly, it doesn't mention version 3, which was introduced
in 3.0 and has been used in all later versions.  I'll update the man
page in a minute. :)

> Perhaps the reason that the bug report lists 0 is that Berkeley DB  
> version 1.x does not include an integrated locking mechanism, but  
> higher versions are reputed to have such a mechanism.

The DB_File module, used to access the database files, uses the 1.x API, so no
locking from libdb.  SA does locking on its own.  If you're not using NFS, I'd
recommend using "lock_method flock", btw.

> Please, where is this DB that I should back up?

It depends what your configuration is.  Typically it's
~/.spamassassin/bayes_toks.  Otherwise, look at the bayes_path setting.

> I wrote a GP Berkeley DB rebuilding program that reads all of the key/ 
> value pairs in a DB, and writes all of those for which the key and  
> value are defined and of non-zero length, to a new DB.  I could try  
> running that and see if the new DB is significantly smaller than the  
> old, which for my DBs indicates that it's time to use the new DB.

This generally isn't needed by SA, since it's is what SA does when
an expire happens.  You should also look at 'sa-learn --backup' and
'--restore'.  You could also just use db_dump | db_restore.

> Theo, do you know if SA uses any entries with null keys or values,  
> that are needed for proper operation?  It would be easy to keep  
> entries with null values; I wrote the program to discard them because  
> my DBs don't use such entries.

There will be values with null (ascii 0) in them as the token keys are
binary values, and the values are binary packed values.  This is why
"sa-learn --backup" is a good choice, it will convert the binary into
text.

-- 
Randomly Selected Tagline:
"... then you'll excuse me, but I'm in the middle of fifteen things, all of
 them annoying."
         - Ivonova, Babylon 5 (Midnight on the Firing Line)

Re: sa-learn error message

Posted by ma...@animalhead.com.
Thank you to both responders.

Did I read something that said that the digit after "bayes db  
version" indicated the version of Berkeley DB that's installed on the  
system?  Like 0 means 1.x...   Google shows various messages like  
"bayes db version 2 is not able to be used, aborting!" which would  
seem to indicate that 0 is not indicative of the problem I saw.

Perhaps the reason that the bug report lists 0 is that Berkeley DB  
version 1.x does not include an integrated locking mechanism, but  
higher versions are reputed to have such a mechanism.

Before I got your responses, I got my courage up and went on to run

$ sa-learn --no-sync --ham ham      (ham is the name of a directory  
in the current working directory)
$ sa-learn --sync

and everything went well.  This sort of indicates that the DB isn't  
hopelessly corrupt.

Please, where is this DB that I should back up?

I wrote a GP Berkeley DB rebuilding program that reads all of the key/ 
value pairs in a DB, and writes all of those for which the key and  
value are defined and of non-zero length, to a new DB.  I could try  
running that and see if the new DB is significantly smaller than the  
old, which for my DBs indicates that it's time to use the new DB.

Theo, do you know if SA uses any entries with null keys or values,  
that are needed for proper operation?  It would be easy to keep  
entries with null values; I wrote the program to discard them because  
my DBs don't use such entries.

Thanks,
Craig MacKenna


On Jan 17, 2008, at 1:50 PM, Theo Van Dinter wrote:

> On Thu, Jan 17, 2008 at 03:28:06PM -0600, Steven Stern wrote:
>> bayes db version 0 " indicates your bayes file is corrupt. It  
>> should be
>> "version 3".  Do you have a backup?  SQL or .db?
>
> It doesn't necessarily mean there's corruption,
> in fact, since the learning continued and seemed
> to finish ok, it's unlikely to be corruption.  See
> http://issues.apache.org/SpamAssassin/show_bug.cgi?id=3563 for a  
> possible
> libdb issue which causes it.
>
> -- 
> Randomly Selected Tagline:
> "And the No. 1 response that you'll need to memorize if you plan to  
> bet
>  your business on Windows 2000: 'You want fries with that?'"
>                                  - Nicholas Petreley


Re: sa-learn error message

Posted by Theo Van Dinter <fe...@apache.org>.
On Thu, Jan 17, 2008 at 03:28:06PM -0600, Steven Stern wrote:
> bayes db version 0 " indicates your bayes file is corrupt. It should be
> "version 3".  Do you have a backup?  SQL or .db?

It doesn't necessarily mean there's corruption,
in fact, since the learning continued and seemed
to finish ok, it's unlikely to be corruption.  See
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=3563 for a possible
libdb issue which causes it.

-- 
Randomly Selected Tagline:
"And the No. 1 response that you'll need to memorize if you plan to bet
 your business on Windows 2000: 'You want fries with that?'"
                                 - Nicholas Petreley

Re: sa-learn error message

Posted by Steven Stern <su...@sterndata.com>.
merikay@animalhead.com wrote:
> Hi again SA experts,
> 
> Note the error message in the 2nd-last line of the following transcript:
> 
> animalhead:~/sj $ sa-learn --no-rebuild --spam --mbox savejunk
> The --no-rebuild option has been deprecated.  Please use --no-sync instead.
> Learned tokens from 3025 message(s) (3047 message(s) examined)
> animalhead:~/sj $ sa-learn --no-sync --spam thruJunk
> bayes: bayes db version 0 is not able to be used, aborting! at 
> /usr/local/lib/perl5/site_perl/5.8.8/Mail/SpamAssassin/BayesStore/DBM.pm 
> line 196.
> Learned tokens from 170 message(s) (170 message(s) examined)
> 
> There are 171 messages in directory thruJunk.  The largest is 495K, the 
> next largest is 137K.
> $ sa-learn -V    yields "spamassassin v 3.2.1"
> 
> What should I do about this?
> 
> I still have another directory with ham to go.  It includes lots of 
> large files.  Should I delete those over a certain size?
> 
bayes db version 0 " indicates your bayes file is corrupt. It should be
"version 3".  Do you have a backup?  SQL or .db?