Jan Wieck JanWieck
Thu Jul 28 14:50:52 PDT 2005
On 7/28/2005 12:06 AM, cbbrowne at ca.afilias.info wrote:
>>> Implementing some form of "distributed sequence" where each node uses
>>> separate ranges is a reasonable solution to those conflicts that would
>>> arise as a result of "internal interlinkages".
>>
>> All you do is make one db use even numbers and the other use odd by
>> setting start and step values of the sequence.
> 
> How, in that scenario, does one introduce a fifth "master node"?

By having the sequence increment in 10 or 100 steps. This has even the 
side effect that you can tell by the last 1 or 2 digits which node did 
allocate the ID.

> 
> If you have one office that is an asynchronous node, that could easily be
> extended to needing five offices.  Or 37 remote salescritters, each with a
> database on their laptop...
> 
> It's not too difficult to solve the "distributed sequence" for the case of
> two nodes, as even/odd does work out quite nicely.  Generalizing is not so
> easy...

Well, with this method you have to pick some upper limit, which is then 
cemented into the increment step.

Another method would be to modify sequences as follows. When a sequence 
reaches maxval on a nextval() call, it looks up a sequence number range 
table. If there is an unused "block" assigned to this sequence, the 
sequences current and max values are adjusted to the block boundary and 
the block marked used. WARNING: there is a problem here if the 
transaction later aborts!!!

It will become the DBA's duty to monitor which nodes will run out of 
their number range and put allocations into place.


Jan

-- 
#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#================================================== JanWieck at Yahoo.com #


More information about the Slony1-general mailing list