Objid generation – including limits
Anyone who’s been around Clarify for a while is probably well aware of the objid (primary key) generation algorithm.
The basic algorithm
The basic algorithm looks like:
objid = (2^28 * adp_db_header.site_id) + (next_val + 1)
Additional Notes
next_val is the next unique value for the given table. next_val for an object (type_id) is obtained first from adp_tbl_oid_unused. If none are available from that table then adp_tbl_oid is used. If you’re on older versions of Clarify on Oracle, next_val comes from an Oracle sequence instead of adp_tbl_oid.
Discovery
I was recently working with a customer, and we seem to have discovered a limit to this algorithm.
It seems that if the result of the objid generation is greater than the “defined range”, then it starts over again (at the start of the range).
Defined Range
When I say defined range, I mean the range of (2^28 * adp_db_header.site_id) –> (2^28 * (adp_db_header.site_id + 1))
For a site_id of 2, the range would be 536870913 –> 805306367 Even if your next_val returns a value higher than 2^28, the code that
uses that sequence seems to subtract in order to keep the objid in the defined range.
A more complete algorithm
It seems that a more complete algorithm would look something like:
objid = (2^28 * adp_db_header.site_id) + (next_val + 1)
upperLimit = 2^28 * (adp_db_header.site_id + 1)
if objid > upperLimit
objid = objid – 2^28
end if
Usage
Normally, you wouldn’t care about any of this. But if you’ve been using Clarify for a while now, it’s possible that one or more of your tables are nearing the upper limit of a range. The act_entry table is the most common table to hit this limit.
Nearing that limit
If you’re nearing the limit, then the recommended process is to increase adp_db_header.site_id by one, and then reset all of the next_val values to 1 (either in adp_tbl_oid or in your Oracle sequences).
The customer I was working with was trying to avoid resetting all of the sequences, and we were hoping that the objid algorithm would just keep right on going. But, as discussed above, it doesn’t.
So, it seems like the recommended process is the way to go.
It seems like I’ve been knee-deep in Clarify for way too long – yet I still learn new stuff almost daily.
If anyone has any additional information or specifics on this (like maybe someone from Amdocs development – hint, hint), I’d love to know more.. Leave a comment or drop me an email.