in reply to DBM file corruption?

That is too little information skinnymofo. DB_File comes in a variety of *versions*, and depending on which Berkley DB you have installed, yet another set of *versions*. Also, are you using DB_RECNO, DB_BTREE, or DB_HASH?

Are you sharing the "database" with a C application (or some non-perl non-DB_File thing)?

I use DB_File all the time, and I'd really like to know exactly what you're doing?

Is the "database" being shared between perl applications (race conditions)?

Are you locking the "database" somehow?

Did you perhaps interupt the application whilst it was in the midst of writing to the database?

The only size limits I've heard of are on keys/values, usually when dealing with DB_RECNO (and bigger files would decrease performance, but i've not heard of corruption).

DB_File databases, with possibly the exception of DB_RECNO, are *usually* not portable accross systems, or at least not accross versions. Did you perhaps upgrade DB_File?

The fact that you're running WinNT is not of great help. You need to give us the perl version and more importantly the DB_File version

update:
P.S. - I don't like to call DB_File a DBM file, cause it's so much better than the others ;)

Also, and I can't believe I didn't focus on this first, please define "corruption". What is going wrong?

 
______crazyinsomniac_____________________________
Of all the things I've lost, I miss my mind the most.
perl -e "$q=$_;map({chr unpack qq;H*;,$_}split(q;;,q*H*));print;$q/$q;"

  • Comment on (crazyinsomniac) Re: DBM file corruption?

Replies are listed 'Best First'.
Re: (crazyinsomniac) Re: DBM file corruption?
by skinnymofo (Scribe) on Jan 15, 2002 at 19:08 UTC
    CrazyInsomniac and others, thanks for your replies.

      I'm using Perl v5.6.0, DB_File v1.73, and DB_HASH.

      I looked at locking and race conditions in other nodes on PerlMonks, but as the file is not being shared with any other programs I don't think that's the issue.

      Sorry, corruption is rather ambiguous; I mean that at a particular point in the file (the 40,309th key) the value looks like a null to Perl. {Thanks YuckFoo for the hint} But, the step that writes the key/value gives no error, hiccup, or other indication that the write to that particular key went bad.
      One thing I didn't think about, though, you have thankfully brought to light. There's a very good chance that the program got interupted 'whilst' using the file.

    Many Thanks,
    Skinnymofo