On Dec 11, 2005, at 4:23 AM, Tadashi Matsumoto wrote:


I was looking into the following code of intid's __init__.py.

I think it is better to use, for example, 2**30 instead of 2**31.

Looks like a good catch to me.

Also looks like 2**31 -1 would be sufficient (typical sys.maxint), rather than 2**30...or maybe just sys.maxint (though I wouldn't be surprised if the author had consciously rejected maxint for database portability).

By the way, there is a probability (less than 1/2**31 percent) of
generating same intids, if thread switching occurs between the line
114 and 115.

At which point you should get a conflict error, which in Zope would cause one of the transactions to be retried without the user's knowledge and everything would still be good.

Zope3-dev mailing list
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com

Reply via email to