SDBM and Windows

H

Hal Fulton

I've narrowed down the SDBM behavior a little more.

It seems to crash when storing "long" values in the db.
The first string it happens with is 2330 chars in length.
(As opposed to the average in this db, which is more
like 300 bytes.)

A little more experimentation shows that it will accept
800 bytes OK, but not much more.

Anyone know what's going on here?


Thanks,
Hal
 
B

Bill Kelly

Hi Hal,

From: "Hal Fulton said:
I've narrowed down the SDBM behavior a little more.

It seems to crash when storing "long" values in the db.
The first string it happens with is 2330 chars in length.
(As opposed to the average in this db, which is more
like 300 bytes.)

A little more experimentation shows that it will accept
800 bytes OK, but not much more.

Anyone know what's going on here?

Sorry I can't help, just wanted to add that I tried an
SDBM experiment yesterday, on Windows, and it seems like Ruby's
SDBM exhibits the same odd behaviors as Perl's. (Last
time I tried Perl's was about 5 years ago.) I'm guessing
they maybe share the same implementation.

I've found SDBM to be remarkably inconsistent about
what size values it will accept. The smaller size
values, the "more" of them I'm likely able to stuff
into the SDBM before it gacks. The larger size
values, the fewer I seem to be able to store before
it finds one it "can't" store.

One of my tests yesterday was to try to store
1,000,000 key/values. The keys were always length 8.
The values were random, between length 1 and length
511. After several minutes it managed to store about
47,000 keys before it upchucked a "sdbm_store failed".
And the .dbm file was up to 1.7 GB.

For my upcoming project, I have need of a dbm that
can store (preferably) arbitrary length keys, and
definitely arbitrary length values. (I haven't looked
at what's available yet on RAA.) And I don't want it to
bloat up to 1.7GB when it only has 47,000 small values
stored in it! <grin>

I've done some design on paper, and it seems almost
trivial to write.... So I'm wondering if I'm overlooking
some hidden gotcha that will make it more difficult than
I'm expecting. :)

. . Guess I would do well to read the current
implementation first... But anyway, I'm seeing the
same ol' flaky behavior I remember from Perl.


Regards,

Bill
 
R

Reimer Behrends

Hal Fulton ([email protected]) wrote:
[...]
It seems to crash when storing "long" values in the db.
The first string it happens with is 2330 chars in length.
(As opposed to the average in this db, which is more
like 300 bytes.)

As it is, SDBM has an inherent limitation in that it cannot store
key/value pairs with a combined size greater than PAIRMAX (usually 1008)
bytes, a limit that is also normally checked by the ruby module. It is
surprising that it allows you to store as many as 2330 bytes in the
first place; I get an "SDBMError: sdbm_store failed" when I try it.

Reimer Behrends
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top