On 6/14/06, Gregor J. Rothfuss <[EMAIL PROTECTED]> wrote:
[EMAIL PROTECTED] wrote:
> Sequential numbers: 0001, 0002, 0003, etc.  Padded to look pretty in a
> directory.  This format is fine for the migration, but is a poor
> choice if Resources are created on multiple servers.
that pretty much guarantees problems if you have several people writing
to the repo concurrently.

No, it would not be a problem for multiple people creating Resources
on a single server; just synchronize() the function that assigns the
next number.  It is a problem when multiple servers (and clients) are
creating Resources.  With a pure sequence, every server must phone
home for the next number, or duplicates will happen.  There are
methods to resolve duplicates, but why bother?

Another method is to prefix every UNID with the server ID.  All server
#1 UNIDs begin with "A".  All server #2 UNIDs begin with "B".  Then
sequential numbering works because the UNIDs created by different
servers cannot conflict.

For a migration routine running as a batch job on a single server,
sequential numbering works great. The "New Resource" function will not
use sequential numbering, but there is little reason to change the
migration routine.  Lenya1.3 can easily mix formats.

I do not understand why this discussion is so long.  Write the code to
handle any String.  This week use UUIDs.  Next week use ServerID +
SeqNum.  The week after that, use that custom generator some developer
thinks is cool. Then later go back to UUIDs.  The code should
understand all the UNIDs without touching Resources created with a
different algorithm (unless the formats overlap).  Make it easy to
plug in different generators for getNextUNID(), and everybody will be
happy.

solprovider

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to