httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Behlendorf <br...@hyperreal.org>
Subject Re: dbmmanage & AnyDBM ordering
Date Wed, 03 Mar 1999 19:48:49 GMT

Eh, rather than change the default behavior, I'll just document existing
behavior in dbmmanage.1.  It's easy for people to change, the hard part is
helping people figure out why "dbmmanage doesn't work".  

The "right" thing is for dbmmanage to try and determine what format a
database file is in, whether it's DB_File, NDBM, GDBM, etc., and then
either locate the library for dealing with that and use it, or return an
error indicating what type of DBM file it is, rather than no response like
it gives now because it's only trying the first one it has available.
Perl folks, is there a library for this?

Hmm - looks like this should be possible, as the standard "file" utility
gives different reports for GDBM and DB_File:

taz% file foo*
(this one is DB_File)
foo1: Berkeley DB Hash file (Version 2, Little Endian, Bucket Size
8192, Bucket Shift 13, Directory Size 256, Segment Size 256, Segment Shift
8, Overflow Point 1, Last Freed 2, Max Bucket 1, High Mask 0x3, Low Mask
0x1, Fill Factor 65536, Number of Keys 1)

(this one is NDBM_File on this system)
foo2.db: Berkeley DB Hash file (Version 2, Little Endian, Bucket Size
4096, Bucket Shift 12, Directory Size 256, Segment Size 256, Segment Shift
8, Overflow Point 1, Last Freed 2, Max Bucket 1, High Mask 0x3, Low Mask
0x1, Fill Factor 40, Number of Keys 1)

foo3:     GNU dbm 1.x or ndbm database, little endian

Note that NDBM_File attached a .db to the filename it was passed, whereas
DB_File didn't, even though (at least on this FreeBSD 2.2.8 box) they
appear to be the same engine under the hood.

Sigh, what a mess.

	Brian

On Tue, 2 Mar 1999, Brian Behlendorf wrote:
> The dbmmanage in /src/support changes the preference ordering for
> selecting which DB library to use from Perl's standard
> 
>   @AnyDBM_File::ISA = qw(NDBM_File DB_File GDBM_File)
> 
> to
> 
>   @AnyDBM_File::ISA = qw(DB_File NDBM_File GDBM_File)
> 
> 
> The impact of this change is that anyone who uses AnyDBM (or just
> dbmopen/dbmclose) in other Perl tools for managing DB files also needs to
> make that same AnyDBM change (or otherwise ensure their tool and dbmmanage
> are using the same DB library).  This is a pain, and in my view a POLA
> (principle of least astonishment) violation.   While DB_File may be a
> better format (byte-order independent, and reportedly faster), I think
> there are better ways to encourage its use than slip it into dbmmanage.
> The docs for dbmmanage don't cover this issue at all.
> 
> So I'd like to remove the re-ordering done in dbmmanage, and document that
> dbmmanage follows the Perl ordering for AnyDBM selection, as well as how
> to use dbmmanage to manage "DB_File" databases even when the NDBM
> libraries are around.  And on that tip, what's the best way to accomplish
> that?  Add a flag to dbmmanage (and thus use getopts)?  Recommend people
> modify the source?  :)
> 
> 	Brian
> 
> 
> 


Mime
View raw message