Re: dbm

Jaap Vermeulen (jaap@sequent.com)
Thu, 30 Mar 95 15:47:41 GMT

In <9503231400.AA06162@hchworth.demon.co.uk> Matthew Jones <matj@hchworth.demon.co.uk> writes:

>I'm trying to create a simple database using the python binding to
>dbm. It fails to enter records after a certain point. The error I get
>is:
>
>Traceback (innermost last):
> File "./createdb.py", line 29, in ?
> db[`entry_key`] = `entry`
>dbm.error: Cannot add item to database

You may be adding an item that is larger than the limit, which is
typically around 4K (may be different for your implementation).

>Why is the database growing at an alarming rate, is the inter-record
>padding an error or typical?

typical.

Dbm creates "gaps" or "holes" in the files it creates. Although the
filesystem reports a large size, the actual number of blocks used is
typically far less. Use 'ls -s' to see the blocksize (given that ls
reports the blocksize correctly).

Also, if you have manual pages for dbm, consult them; they typically explain
these kinds of things.

-- 
Jaap Vermeulen                      .   Sequent Computer Systems, Inc
        Telephone: (503) 578-4404   |   Platform Management , M/S DES2-731
        Fax      : (503) 578-3228   |   15450 SW Koll Parkway
        Email    : jaap@sequent.com |   Beaverton, Oregon  97006-6063