[pybsddb] set_location semantics problem

Anton Belyaev anton.belyaev at gmail.com
Thu Sep 17 13:20:25 CEST 2009


2009/6/5 Anton Belyaev <anton.belyaev at gmail.com>:
> 2009/6/5 Anton Belyaev <anton.belyaev at gmail.com>:
>> Hello,
>>
>> 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__
>> '4.7.6'
>>>>> import bsddb
>>>>> bsddb.__version__
>> '4.4.5.3'
>>
>> Thanks.
>> Anton.
>>
>
> I've made a simple fix to solve this. Just chage set to set_range in
> _DBWithCursor._checkCursor method.
> Is it a correct solution?
>

Strange that no one cares about the problem and the proposed patch :(



More information about the pybsddb mailing list