freebsd-skq/lib/libc/db/hash
Andriy Gapon f3c733e82b 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
2010-04-05 10:12:21 +00:00
..
extern.h
hash_bigkey.c - If (keysize+datasize)%(bsize=14)==0, insertion of a `big key' would cause 2009-03-28 06:47:05 +00:00
hash_buf.c Avoid NULL deference which causes DEBUG1 to crash, not to print useful 2009-03-28 06:40:48 +00:00
hash_func.c Minor changes from Berkeley DB 1.86 and further improvements from OpenBSD. 2009-03-28 07:31:02 +00:00
hash_log2.c Several signed/unsigned warning fixes. 2009-03-28 05:45:29 +00:00
hash_page.c Add some casts to silence compiler warning about signedness. 2009-03-28 07:44:08 +00:00
hash.c libc/db/hash: cap auto-tuned block size with a value that actually works 2010-04-05 10:12:21 +00:00
hash.h libc/db/hash: cap auto-tuned block size with a value that actually works 2010-04-05 10:12:21 +00:00
Makefile.inc
ndbm.c
page.h Style changes (including additional casts to shut up warnings). This 2009-03-04 00:58:04 +00:00
README Minor changes from Berkeley DB 1.86 and further improvements from OpenBSD. 2009-03-28 07:31:02 +00:00

#	@(#)README	8.1 (Berkeley) 6/4/93
# $FreeBSD$

This package implements a superset of the hsearch and dbm/ndbm libraries.

Test Programs:
	All test programs which need key/data pairs expect them entered
	with key and data on separate lines

	tcreat3.c	
		Takes 
			bucketsize (bsize), 
			fill factor (ffactor), and
			initial number of elements (nelem).  
		Creates a hash table named hashtest containing the 
		keys/data pairs entered from standard in.
	thash4.c
		Takes
			bucketsize (bsize), 
			fill factor (ffactor), 
			initial number of elements (nelem)
			bytes of cache (ncached), and
			file from which to read data  (fname)
		Creates a table from the key/data pairs on standard in and
		then does a read of each key/data in fname
	tdel.c
		Takes
			bucketsize (bsize), and
			fill factor (ffactor).
			file from which to read data (fname)
		Reads each key/data pair from fname and deletes the
		key from the hash table hashtest
	tseq.c
		Reads the key/data pairs in the file hashtest and writes them
		to standard out.
	tread2.c
		Takes
			butes of cache (ncached).
		Reads key/data pairs from standard in and looks them up
		in the file hashtest.
	tverify.c
		Reads key/data pairs from standard in, looks them up
		in the file hashtest, and verifies that the data is
		correct.

NOTES:

The man page ../man/db.3 explains the interface to the hashing system.
The file hash.ps is a postscript copy of a paper explaining
the history, implementation, and performance of the hash package.

"bugs" or idiosyncracies

If you have a lot of overflows, it is possible to run out of overflow
pages.  Currently, this will cause a message to be printed on stderr.
Eventually, this will be indicated by a return error code.

If you are using the ndbm interface and exit without flushing or closing the
file, you may lose updates since the package buffers all writes.  Also,
the db interface only creates a single database file.  To avoid overwriting
the user's original file, the suffix ".db" is appended to the file name
passed to dbm_open.  Additionally, if your code "knows" about the historic
.dir and .pag files, it will break.  

There is a fundamental difference between this package and the old hsearch.
Hsearch requires the user to maintain the keys and data in the application's
allocated memory while hash takes care of all storage management.  The down
side is that the byte strings passed in the ENTRY structure must be null
terminated (both the keys and the data).