OnDemand Users Group

Support Forums => CMOD for Multiplatforms => Topic started by: Nils Engerby on May 31, 2024, 01:39:50 PM

Title: Unique ID format
Post by: Nils Engerby on May 31, 2024, 01:39:50 PM
Does anyone happen to know how the Unique ID values are generated by CMOD? Do they conform to any of the defined UUID versions?
We are looking into ways to create UUIDs for old documents without export/reload and it seems to be good practice to use a timestamp-first format.
Title: Re: Unique ID format
Post by: Justin Derrick on May 31, 2024, 03:46:55 PM
Hi Nils.

It's not documented, but I believe it's a 64-bit random number represented as hexadecimal that just has dashes inserted in arbitrary places.

This is different than Hash values, which are SHA-256 hashes based on the contents of the documents.

Since the change you're suggesting will make alterations to DB2 database tables, you absolutely MUST test your solution thoroughly in non-prod regions.  :)

A more supported way to do it would be to extract and load the old data into a new App Group that has the UUID configuration.

-JD.
Title: Re: Unique ID format
Post by: Nils Engerby on June 05, 2024, 03:08:20 PM
Thanks Justin,

Sorry to correct you but UUIDs are 128-bit and the dashes are in very specific positions. :) Nicely described on Wikipedia: https://en.wikipedia.org/wiki/Universally_unique_identifier (https://en.wikipedia.org/wiki/Universally_unique_identifier)

After testing the export/reload approach on some 100 thousand documents it is quite clear that the CMOD generated UUIDs are version 4 (random), indicated by the number "4" in the first position of the third group (xxxxxxxx-xxxx-4xxx-xxxx-xxxxxxxxxxxx). Version 7 would probably have been a better choice to improve the database indexes. Or you could by all means identify it as version 4 and still use a combination of timestamp and randomness, which is what we have done in our UDF tests to update existing data.

Oh well, it's never easy, is it? Heads or tails ... :-\
//Nils
Title: Re: Unique ID format
Post by: Justin Derrick on June 05, 2024, 10:31:50 PM
Please correct me without hesitation!  I didn't know that UUIDs followed specific standards, and I'm happy to learn about it.  :)

-JD.

Title: Re: Unique ID format
Post by: Nils Engerby on June 10, 2024, 06:50:39 AM
I can also add that I ran a count of the first two bytes of the CMOD generated ids and, not surprisingly, all 256 possible values between 00 and ff were represented with a fairly even distribution.
//Nils
Title: Re: Unique ID format
Post by: rjrussel on June 10, 2024, 02:07:44 PM
Version 7 UUIDS weren't a thing when the feature was added to CMOD.

Quote from: Nils Engerby on June 05, 2024, 03:08:20 PM
Thanks Justin,

Sorry to correct you but UUIDs are 128-bit and the dashes are in very specific positions. :) Nicely described on Wikipedia: https://en.wikipedia.org/wiki/Universally_unique_identifier (https://en.wikipedia.org/wiki/Universally_unique_identifier)

After testing the export/reload approach on some 100 thousand documents it is quite clear that the CMOD generated UUIDs are version 4 (random), indicated by the number "4" in the first position of the third group (xxxxxxxx-xxxx-4xxx-xxxx-xxxxxxxxxxxx). Version 7 would probably have been a better choice to improve the database indexes. Or you could by all means identify it as version 4 and still use a combination of timestamp and randomness, which is what we have done in our UDF tests to update existing data.

Oh well, it's never easy, is it? Heads or tails ... :-\
//Nils
Title: Re: Unique ID format
Post by: Nils Engerby on June 14, 2024, 09:43:58 AM
Thanks Rob, I realize that. Way back in 2017. Time flies ...

We'll submit this as a possible improvement. The version number is in a fixed position so different versions could co-exist in most cases. Or it could be a selectable choice which version to use, system wide or per application group.

Quote from: rjrussel on June 10, 2024, 02:07:44 PM
Version 7 UUIDS weren't a thing when the feature was added to CMOD.