How idgenerator works

1,128 views
Skip to first unread message

Raju

unread,
Sep 13, 2010, 10:08:56 AM9/13/10
to atg_...@googlegroups.com
Hi all

 I wonder how idgenerator works, i saw the component class it is SQLIDGenerator ..

and from there i traced some code where i saw some logics to generate the id , can any one help me understand this.

Since in my userprofile, am getting the exception when creating a new user, where it tries to use the existing key.

Thanks in advance

--
Thanks and Regards

 Raju .G

Wilco Boumans

unread,
Sep 14, 2010, 2:54:35 AM9/14/10
to atg_...@googlegroups.com
Hello Raju,

ID generators work by handing out the next number in a globally scoped ID generator nucleus component.
There are ID spaces, to make different numbering possible for different purposes.

The id generator has a batch from which it hands out numbers, increasing the ID by 1 each time one is requested.
When the batch is depleted, it obtains a new batch (which is unique in the cluster) by loading from the DAS_ID_GENERATOR table.
The table is updated, so the next server in the cluster takes the next batch. More can be found in the ATG manuals.

When you see duplicate keys, the most likely cause is the copying of data to another database schema, without adjusting the DAS_ID_GENERATOR table.
When profiles are copied from a different environment (say users 1-10000), the DAS_ID_GENERATOR must contains a 'seed' value that is larger then 10000, to avoid handing out ID's that are already taken by existing profiles.

Usually, we ask a DBA to ensure this when copying data across, but another method that works is to use a prefix or suffix value in the ID definition, so ID ranges of copied profiles and newly generated profiles never overlaps.

Hope this helps

Wilco Boumans



--
You received this message because you are subscribed to the Google Groups "ATG_Tech" group.
To post to this group, send email to atg_...@googlegroups.com
To unsubscribe from this group, send email to atg_tech-u...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/atg_tech?hl=en

Raju

unread,
Sep 14, 2010, 2:59:15 AM9/14/10
to atg_...@googlegroups.com
Hello Wilco

 Thank you very much for your inputs...

Burhan Surti

unread,
Sep 15, 2010, 7:18:31 AM9/15/10
to atg_...@googlegroups.com
You can setup your own by configuring in "idspaces.xml" located at atg\dynamo\service. For all custom & OOTB you can use by overwriting in your application. Below is example on the same
 
<id-space name="priceList" seed="13000000" batch-size="1" prefix="PL"/>
 
-Burhan

Reply all
Reply to author
Forward
0 new messages