| Summary: | [patch] db(3) fails with large block sizes | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | Base System | Reporter: | Peter Jeremy <peterjeremy> | ||||||||
| Component: | bin | Assignee: | Andriy Gapon <avg> | ||||||||
| Status: | Closed FIXED | ||||||||||
| Severity: | Affects Only Me | ||||||||||
| Priority: | Normal | ||||||||||
| Version: | 8.0-STABLE | ||||||||||
| Hardware: | Any | ||||||||||
| OS: | Any | ||||||||||
| Attachments: |
|
||||||||||
|
Description
Peter Jeremy
2010-03-03 11:30:01 UTC
Author: avg Date: Mon Apr 5 10:01:53 2010 New Revision: 206177 URL: http://svn.freebsd.org/changeset/base/206177 Log: hash.3: fix a factual mistake in the man page PR: bin/144446 Submitted by: Peter Jeremy <peterjeremy@acm.org> MFC after: 3 days Modified: head/lib/libc/db/man/hash.3 Modified: head/lib/libc/db/man/hash.3 ============================================================================== --- head/lib/libc/db/man/hash.3 Mon Apr 5 09:26:03 2010 (r206176) +++ head/lib/libc/db/man/hash.3 Mon Apr 5 10:01:53 2010 (r206177) @@ -78,7 +78,7 @@ The element defines the .Nm -table bucket size, and is, by default, 256 bytes. +table bucket size, and is, by default, 4096 bytes. It may be preferable to increase the page size for disk-resident tables and tables with large data items. .It Va ffactor _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" Author: avg Date: Mon Apr 5 10:12:21 2010 New Revision: 206178 URL: http://svn.freebsd.org/changeset/base/206178 Log: libc/db/hash: cap auto-tuned block size with a value that actually works This fix mostly matters after r206129 that made it possible for st_blksize to be greater than 4K. For this reason, this change should be MFC-ed before r206129. Also, it seems that all FreeBSD uitlities that use db(3) hash databases and create new databases in files, specify their own block size value and thus do not depend on block size autotuning. PR: bin/144446 Submitted by: Peter Jeremy <peterjeremy@acm.org> MFC after: 5 days Modified: head/lib/libc/db/hash/hash.c head/lib/libc/db/hash/hash.h Modified: head/lib/libc/db/hash/hash.c ============================================================================== --- head/lib/libc/db/hash/hash.c Mon Apr 5 10:01:53 2010 (r206177) +++ head/lib/libc/db/hash/hash.c Mon Apr 5 10:12:21 2010 (r206178) @@ -293,6 +293,8 @@ init_hash(HTAB *hashp, const char *file, if (stat(file, &statbuf)) return (NULL); hashp->BSIZE = statbuf.st_blksize; + if (hashp->BSIZE > MAX_BSIZE) + hashp->BSIZE = MAX_BSIZE; hashp->BSHIFT = __log2(hashp->BSIZE); } Modified: head/lib/libc/db/hash/hash.h ============================================================================== --- head/lib/libc/db/hash/hash.h Mon Apr 5 10:01:53 2010 (r206177) +++ head/lib/libc/db/hash/hash.h Mon Apr 5 10:12:21 2010 (r206178) @@ -118,7 +118,7 @@ typedef struct htab { /* Memory reside /* * Constants */ -#define MAX_BSIZE 65536 /* 2^16 */ +#define MAX_BSIZE 32768 /* 2^15 but should be 65536 */ #define MIN_BUFFERS 6 #define MINHDRSIZE 512 #define DEF_BUFSIZE 65536 /* 64 K */ _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" Following r206129, FreeBSD no longer has a hardwired st_blksize so the first problem should now be reproducable on FreeBSD. The scenario where I found the bug was the perl 5.8 DB_File test db-hash.t on a ZFS filesystem. The problem should therefore be reproducable on 9-current with r206129 as follows: 1) Set WRKDIRPREFIX to a ZFS filesystem. 2) cd /usr/ports/lang/perl5.8 3) make 4) cd $WRKDIRPREFIX/usr/ports/lang/perl5.8/work/perl-5.8.9/t 5) ../perl ../ext/DB_File/t/db-hash.t (it's possible perl will need to be installed for this to run) This should result in a core dump following test 21. -- Peter Jeremy State Changed From-To: open->patched already committed and MFC'ed Responsible Changed From-To: freebsd-bugs->avg Andriy, it seems to be already MFC'ed. Can this be closed now? State Changed From-To: patched->closed Fixed. |