[pybsddb] set_location semantics problem

Anton Belyaev anton.belyaev at gmail.com
Fri Jun 5 19:14:07 CEST 2009


I've been debugging a strange problem with the library. Here is the
short (the shortest I could make) snippet, reproducing the problem:

import bsddb # or import bsddb3 as bsddb - all the same
db = bsddb.btopen("test.db", cachesize=2**20 * 64)
db.set_location('0000000001_') # DB_NOTFOUND, ok
db['0000000001_00000012442207344433'] = 'data'
db.set_location('0000000001_') # ('0000000001_00000012442207344433', 'data'), ok
db.next() # DB_NOTFOUND, ok
del db['0000000001_00000012442207344433']
db.set_location('0000000001_') # DB_NOTFOUND, ok
db['0000000001_00000012442207425114'] = 'data'
db.set_location('0000000001_') # DB_NOTFOUND, WTF?
db.set_location('0000000001_') # ('0000000001_00000012442207425114',
'data') - calling it again - ok

At the line before the last line, set_location cannot seek to the key,
while it should be able to!
Moreover, same set_location again, the seek succeeded.

Please help to solve this.

Python 2.5.2, i686.

>>> import bsddb3
>>> bsddb3.__version__
>>> import bsddb
>>> bsddb.__version__


More information about the pybsddb mailing list