[pybsddb] Where is the bug tracker? Multi-threaded len() bug
Jesus Cea
jcea at argo.es
Wed Feb 17 19:20:51 CET 2010
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 12/26/2008 06:47 PM, Yong Li wrote:
> Create a dir named "db" in current dir.
>
> run writer.py
> run reader.py
> you will see that the length displayed by reader.py does not change,
> even as writer is writing to the db.
> Happy holidays and happy bug hunting :)
A year old report, finally analyzed and solved.
Checking the size of a database is potentially slow because it can
require reading the complete file, to know how many items are there. So,
pybsddb was keeping a cached version in RAM, and invalidate that version
when the database is modified.
The problem with this approach is when you have several processes
working on the same database, like your example, since one process
doesn't know the other process has done changes and so it keeps the
cached value as "current".
I have dropped all this code. Now, when you ask for the number of items
in a database, the database is scanned, as it should. This will be
SLOW!. If you need a "len" report accurate and fast, the application
must keep the counter manually in a database register.
This change will be available in pybsddb 4.8.3, to be released
inminently (days).
- --
Jesus Cea Avion _/_/ _/_/_/ _/_/_/
jcea at jcea.es - http://www.jcea.es/ _/_/ _/_/ _/_/ _/_/ _/_/
jabber / xmpp:jcea at jabber.org _/_/ _/_/ _/_/_/_/_/
. _/_/ _/_/ _/_/ _/_/ _/_/
"Things are not so easy" _/_/ _/_/ _/_/ _/_/ _/_/ _/_/
"My name is Dump, Core Dump" _/_/_/ _/_/_/ _/_/ _/_/
"El amor es poner tu felicidad en la felicidad de otro" - Leibniz
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iQCVAwUBS3wzgplgi5GaxT1NAQLlxwP/QQzftPiEuTK5UEPy1Tco8dfWt6CzOV5l
ywUjYumOB/7Dk9fE3PTPPxqS1ivCloPTF4eozCGbTOwqei70Gweq29IoRuW9B2uD
9B+KXci6k8cSOsGlu/OXNr52gwPSJPA6GXQrsCE9czBolnYfVhcv0m++kU3VSsYd
9W/daSwPWOg=
=VAAV
-----END PGP SIGNATURE-----
More information about the pybsddb
mailing list