IMO the main site (the single top-level consolidated database) should control the assignment of global autoincrement partition numbers, possibly in a single-column table that simply records partition numbers that have been assigned and therefore cannot be assigned again.
The synchronization process between the top and middle levels would then make sure that each middle level database has been assigned N values that it hasn't actually used yet (for creating bottom level databases)... a kind of key pool local to the middle level where you insert the assigned-but-unused-values, delete the values as you use them, and request more from the top level when the number drops below a threshold.
The point behind "global autoincrement" is the word "global" which implies one single point of control... and the only single point is the top level consolidated database.
All this must keep in mind that the middle levels must also have their own partition numbers, as must the top level. I like assigning partition zero to the top level because that works for DBMS's like Oracle and MSS that have autoincrement but not global autoincrement.
answered
30 Jan '10, 08:42
Breck Carter
32.5k●540●724●1050
accept rate:
20%
How do you generate the GLOBAL DATABASE ID currently for the regular remotes, i.e. the remotes of the main site? - I guess that will tell whether the additional layer will fit smoothly or must be regarded carefully.
We implemented remote sites before these options were available and as such, its a complete custom setup that uses our own db tables to hold key ranges, plus flat files at each site that indicates what its id value is.
Well, then the question is whether you custom GLOBAL DATABASE ID (or similar) management is able to guarantee the uniqueness. -- We have used a different kind of three tier setup, namely MS SQL <-> MobiLink <-> ASA main db <-> SQL Remote <-> ASA remotes. In that setup, we used GLOBAL DATABASE IDs on the ASA side and made sure that all MS SQL generated PKs were below a certain barrier (i.e. we reserved something like a ID space for the MS-SQL database). That worked well.
My thoughts were to still use a table in our database, but instead of having ranges for every single table, it would have ranges for database ids, and then I would use the sp_hook_dbxtract_begin to set the global_database_id to the next value in the range for that site.