Using UUID type 4 is supposed to be completely random.  Maybe that is
a good choice.

On 1/28/11, David Wolverton <[email protected]> wrote:
> Question on the UUID created here - it looks like the 'middle' is what will
> be the 'most unique'. I'm guessing the SysID never changes, and the same PID
> could 'live' for days at a time and could even 'show up' again later, so the
> last segment could end up being used on a significant number of keys.  I
> know that we have problems where the 'last part' of the UniData key causes
> our data to 'clump up' when we have too much similarity.
>
> What has your experience with the hashing been on the UUIDs created using
> this logic?
>
> (Of course, in UniVerse, I'm guessing you just revise the hashing to make it
> 'left-most significant' - something we can't do in UniData.)
>
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of Gregor Scott
> Sent: January 27, 2011 05:25 PM
> To: U2 Users List
> Subject: Re: [U2] UUID [was Data in Dict]
>
> The use of both the @USER.NO and the current PID ensure the UUID is
> unique across the installation, and the presence of the UV system id
> makes the UUID unique between systems.
> The named common ensures the current port does not generate the same
> UUID within the same second/millisecond.
>
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of u2ug
> Sent: Thursday, 27 January 2011 11:19 PM
> To: U2 Users List
> Subject: Re: [U2] UUID [was Data in Dict]
>
> This is only guaranteed to be unique "per process" due to the usage of
> named common.
> Different processes running on the same system could generate duplicate
> values.
>
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of Gregor Scott
> Sent: January 26, 2011 07:35 PM
> To: U2 Users List
> Subject: Re: [U2] UUID [was Data in Dict]
>
> Interesting trade-off between the overhead of calculating a unique-yet
> compact sequential number and calculating a consistently long UUID.
>
> We use the "last-number-stored-in-a-file" method.
>
> We recently had need for a UUID as part of an XML exchange with a third
> party. I looked at the various options available, and eventually ended
> up writing a UV subroutine to create a UUID in v4 format.
>
> It is not overly complex - the hardest part was working out the bit
> manipulations needed.
> The result is unique across UV systems due to the use of the UV system
> id.
>
> -------------------------------------------------
>
> subroutine MAKE.UUID( UUID )
> *
> *  This subroutine generates a version 4 UUID, following the
> *  rules outlined in the RFC found here:
> *     http://tools.ietf.org/html/rfc4122.html
> *
> common /UUID$GEN/ UUID$lastgen
> if unassigned(UUID$lastgen) then UUID$lastgen = ''
> DECLARE GCI getpid
>
> time.NOW = system(12)
> date.NOW = date()
> date.BASE = iconv( "15 Oct 1582", "D")
>
> * We need to determine the accuracy of the time value
> * From this we derive the appropriate factor to apply to
> * convert our time from seconds/milliseconds to nanoseconds
> if index( time.NOW, ".", 1) then
>    * The TIME.MILLISECOND compiler option is NOT active
>     time.NOW = time.NOW * 10000
>     nano.FACTOR = 100000
>     time.PERDAY = 86400 * 10000
> end else
>    * The TIME.MILLISECOND compiler option IS active
>    nano.FACTOR = 1000000
>    time.PERDAY = 86400 * 1000
> end
>
> * We need to ensure we can cope if we create more than 1 UUID
> * in the same millisecond.
> this.STAMP = date.NOW:"-":time.NOW
>
> * Need to use 'compare' on large 'numbers'.
> * A result of 0 means they are equal
> if compare( this.STAMP, field( UUID$lastgen, ".", 1)) = 0 then
>
>    * We have already created one this (milli)second.
>     TAIL = oconv( field( UUID$lastgen, ".", 2), "MCN") + 0
>     if TAIL then
>        TAIL += 1
>        this.STAMP = fieldstore( UUID$lastgen, ".", 2, 1, TAIL)
>     end else
>        TAIL = 1
>        this.STAMP := ".1"
>     end
>     time.NOW += (TAIL / 10)
>
> end
>
> * Track our latest generation
> UUID$lastgen = this.STAMP
>
> * Now we can build our UUID
> time.UUID = ((date.NOW - date.BASE) * time.PERDAY) + time.NOW
> nano.UUID = time.UUID * nano.FACTOR
>
> port.NOW = abs(@USERNO)
> port.HEX = oconv( port.NOW, "MCDX")"R%4"
>
> ver.VAL = rnd(65535)
> ver.VAL = bitreset( ver.VAL, 12)
> ver.VAL = bitset( ver.VAL, 13)
> ver.VAL = bitreset( ver.VAL, 14)
> ver.VAL = bitreset( ver.VAL, 15)
> ver.HEX = oconv( ver.VAL, "MCDX")
>
> rnd.VAL = rnd(255)
> rsvd.VAL = bitset( rnd.VAL, 6)
> rsvd.VAL = bitreset( rsvd.VAL, 7)
> rsvd.HEX = oconv( rsvd.VAL, "MCDX")
>
> sysid.HEX = oconv( system(31), "MCDX")"R%6"
> pid.NOW = getpid()
> pid.HEX = oconv( pid.NOW, "MCDX")"R%6"
>
> * UUID Structure
> * <1> = <time-low> : 8 char hex value for time
> * <2> = <time-mid> : 4 char hex value
> * <3> = <time-hi-and_version> : 4 char hex value
> * <4> = <clock-seq-and-reserved> : 2 char hex value : <clock-seq-low> :
> 2 char hex value
> * <5> = <node> : 12 char hex value
> UUID = ''
> UUID<1> = oconv(nano.UUID, "MCDX")"R%8"
> UUID<2> = port.HEX
> UUID<3> = ver.HEX
> UUID<4> = rsvd.HEX:oconv(rnd(255), "MCDX")"R%2"
> UUID<5> = sysid.HEX:pid.HEX
>
> convert @AM to "-" in UUID
>
> return
>
> -------------------------------------------------
>
>
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of Dan McGrath
> Sent: Thursday, 27 January 2011 10:46 AM
> To: U2 Users List
> Subject: Re: [U2] UUID [was Data in Dict]
>
> We also are using a form of UUID instead of sequential numbering on most
> of our new files. A lot easier to handle and makes maintenance easier.
>
> Thanks for the Stuart, I wasn't aware of that. For those using UniData,
> you can use the VOC as follows instead:
>
> UUID
> 0001 S
> 0002 !/etc/ncs/uuid_gen
>
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of Boydell,
> Stuart
> Sent: Thursday, 27 January 2011 10:07 AM
> To: U2 Users List
> Subject: Re: [U2] UUID [was Data in Dict]
>
> Most OSs have a call available for generating a UUID (Universally Unique
> ID) or GUID (Microsoft's acronym for Globally Unique ID). By definition
> and accepted generation standards these are almost guaranteed (!) to be
> unique (the probability of a clash is extremely small) across all
> computers.
>
> In UV you could use GCI to create a UV verb to invoke the OS call. Or
> just create a VOC item which you can execute and capture. There are
> usually options which affect the format of the output.
>
> For AIX the VOC item might look like this:
>
>      UUID
> 0001 V
> 0002 /etc/ncs/uuid_gen
> 0003 U
> 0004 CGHIM
>
> For Linux use: /usr/bin/uuidgen
> For Windows (not installed by default): guidgen HTH
>
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of David
> Wolverton
> Sent: Thursday, 27 January 2011 01:55
> To: 'U2 Users List'
> Subject: Re: [U2] Data in Dict
>
> I'm curious what your logic is to generate the Unique ID -- can you
> share that without giving away a trade secret??
>
> It's too bad it's not a database function call in UniData/UniVerse - we
> can do that in D3/Pick - it's a derivation of system Date/Time with
> AlphaSequencing if more than 1 hit in a given clock cycle - but it would
> only be unique on the 'machine' since another system could generate the
> same ID.  So I am interested in the idea of generating a TRULY unique
> ID.
>
> DW
>
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of Steve Romanow
> Sent: Tuesday, January 25, 2011 7:24 PM
> To: U2 Users List
> Subject: Re: [U2] Data in Dict
>
> In some cases I am becoming a fan of UUIDs for db table keys.  A UUID
> type one uses the mac address of the host along with the current time as
> salt so you don't have to worry about key collisions between accounts
> (I.e. TEST and PROD). Generating the next key is fast because there is
> no readu, update, write.  They should hash pretty well since they are
> long and random.
>
>
>
> _______________________________________________
> U2-Users mailing list
> [email protected]
> http://listserver.u2ug.org/mailman/listinfo/u2-users
>
> ______________________________________________________________________
> This email has been scanned by the MessageLabs Email Security System.
> For more information please visit http://www.messagelabs.com/email
> ______________________________________________________________________
> ########################################################################
> ###################
> The information transmitted in this message and attachments (if any) is
> intended only
> for the person or entity to which it is addressed. The message may
> contain confidential
> and/or privileged material.  Any review, retransmission, dissemination
> or other use of
> or taking of any action in reliance upon this information by persons or
> entities other
> than the intended recipient is prohibited.  If you received this in
> error, please
> contact the sender and delete the material from any computer.
>
> The intended recipient of this e-mail may only use, reproduce, disclose
> or distribute
> the information contained in this e-mail and any attached files with the
> permission of IMB.
> ########################################################################
> ###################
> _______________________________________________
> U2-Users mailing list
> [email protected]
> http://listserver.u2ug.org/mailman/listinfo/u2-users
> --
> Message  protected by DealerGuard: e-mail anti-virus, anti-spam and
> content filtering.
> http://www.pentanasolutions.com
>
> Click here to report this message as spam:
> https://login.mailguard.com.au/report/1BAEgE3GKH/7zQqhc0y0YR7mTW04Avx4o/
> 3.053
>
>
> This email and any attachments to it are confidential.
> You must not use, disclose or act on the email if you are not the
> intended
> recipient.  Liability limited by a scheme approved under Professional
> Standards Legislation.
> _______________________________________________
> U2-Users mailing list
> [email protected]
> http://listserver.u2ug.org/mailman/listinfo/u2-users
>
>
> _______________________________________________
> U2-Users mailing list
> [email protected]
> http://listserver.u2ug.org/mailman/listinfo/u2-users
> --
> Message  protected by DealerGuard: e-mail anti-virus, anti-spam and
> content filtering.
> http://www.pentanasolutions.com
>
> Click here to report this message as spam:
> https://login.mailguard.com.au/report/1BARAEHxbY/2eF4mxsPKl9ehZXGBYMOvf/
> 3.6
>
>
> This email and any attachments to it are confidential.
> You must not use, disclose or act on the email if you are not the
> intended
> recipient.  Liability limited by a scheme approved under Professional
> Standards Legislation.
> _______________________________________________
> U2-Users mailing list
> [email protected]
> http://listserver.u2ug.org/mailman/listinfo/u2-users
>
>
> _______________________________________________
> U2-Users mailing list
> [email protected]
> http://listserver.u2ug.org/mailman/listinfo/u2-users
>
>
> _______________________________________________
> U2-Users mailing list
> [email protected]
> http://listserver.u2ug.org/mailman/listinfo/u2-users
>

-- 
Sent from my mobile device
_______________________________________________
U2-Users mailing list
[email protected]
http://listserver.u2ug.org/mailman/listinfo/u2-users

Reply via email to