logo       

RE: RE: [Plone-developers] Plone 1.1 - TODO: msg#00040

web.zope.plone.archetypes.devel

Subject: RE: RE: [Plone-developers] Plone 1.1 - TODO

See responses below...

> Attempting to use time as anything other than the *seed* of a
> random number
> generator is a futile exercise. No matter what floating-point
> precision you
> use, you're assigning numbers based on a pattern that repeats
> every second.
> In a system where the assignment of an ID can take a fraction of a
> millisecond, this is obviously going to cause problems.

The current system uses time and the id; with the exception of index_html as
an id, the chance of a collision is pretty low in a well-designed CMS
deployment.

> The immediate answer (based on fewest lines of code) is to
> use the actual
> output of time.time() (floating point representation of seconds since
> epoch), which should prevent any ID conflicts unless you're
> assigning at a
> rate faster than the precision of time.time() (which is to 6
> decimal places
> on my kit, but could be only to 3 DP on systems with low-resolution
> counters). Again, this is totally CPU dependent and is a
> situation that may
> occur...

I think one naming scheme could likely involve the thread-id of the creating
thread. When the UID is created, the id of the thread that creates it gets
the first few part of the UID string, followed by a dash, followed by the
results from time.time() - which would prevent the possibility of UID name
collision between multiple threads, and also increase thread/bucket affinity
in a refs BTree, at least in the creation of objects (which is likely
biggest potential source of conflict-errors).

Sean


-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The best
thread debugger on the planet. Designed with thread debugging features
you've never dreamed of, try TotalView 6 free at www.etnus.com.


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise