Issue 1493322: bsddb: db never opened for writing forgets its size (original) (raw)
See the attached program; on my machine, its output is as described therein. That is: if a bsddb hash database is opened read-only, and has never been opened for writing (except when first created), then calling len() on the database object returns the correct value the first time, but zero on the second and later calls. Opening the database for writing once seems to eliminate the problem; even when it is opened read-only later, len() behaves as expected.
My machine runs Linux 2.6.16, glibc 2.3.4, Python 2.4.3, and Berkeley DB 4.3.28.