NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

lib/50441: db(3) doesn't work with 64k pagesize



>Number:         50441
>Category:       lib
>Synopsis:       db(3) doesn't work with 64k pagesize
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    lib-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Nov 17 16:35:00 +0000 2015
>Originator:     Manuel Bouyer
>Release:        NetBSD 7.0
>Organization:
>Environment:
System: NetBSD armandeche.soc.lip6.fr 7.0 NetBSD 7.0 (GENERIC)
Architecture: x86_64
Machine: amd64
>Description:
	while tracking down a problem with spamassassin and its bayes db,
	I found that db(3) doesn't work properly with 64k pagesize.
	It happens that my spamassassin is storign its bayes db on a
	64k-blocksize ffs, which triggers the problem. switching to a 32k ffs
	works around the issue.

	This small test program can be used to reproduce the issue.
#!/bin/sh
pagesize=$1
for i in `cat /usr/share/dict/american`; do
    db -w -P $pagesize hash test.db $i $i
done
exit 0

	and here's how to reproduce the issue:
cuba:/home/bouyer>rm test.db
cuba:/home/bouyer>./test.sh 4096
[...]
cuba:/home/bouyer>ls -l test.db 
-rw-r--r--  1 bouyer  wheel  24576 Nov 17 16:01 test.db
cuba:/home/bouyer>db hash test.db |wc
     353     706    6634
cuba:/home/bouyer>rm test.db
cuba:/home/bouyer>./test.sh 32768
[...]
cuba:/home/bouyer>ls -l test.db
-rw-r--r--  1 bouyer  wheel  131072 Nov 17 16:06 test.db
cuba:/home/bouyer>db hash test.db | wc
     353     706    6634
cuba:/home/bouyer>rm test.db
cuba:/home/bouyer>./test.sh 65536
[...]
cuba:/home/bouyer>ls -l test.db 
-rw-r--r--  1 bouyer  wheel  80019456 Nov 17 16:09 test.db
cuba:/home/bouyer>db hash test.db | wc
     219     438    4166

	notice that with 64k pagesize, the db is much, much bigger and there
	are missing keys. The size of the underlying filesystem doesn't matters
	for this test. It matters for my spamassassin usage because, I guess,
	the db pagesize defaults to the filesystem blocksize.
	The same problem happens on netbsd-7/i386 (i.e  it's not a LP64 issue).
	On netbsd-6 the database created is as big (80019456 bytes) but
	there's no missing keys.

>How-To-Repeat:
	see above
>Fix:
	none yet.



Home | Main Index | Thread Index | Old Index