Jan Wieck JanWieck at Yahoo.com
Thu Feb 3 06:44:38 PST 2011
On 2/2/2011 11:42 AM, Steve Singer wrote:
> On 10-12-22 04:30 PM, Steve Singer wrote:
>
>
> Since I haven't had much response on this maybe a plain language example
> would be useful.
>
> Consider a cluster with paths where node 1 is a provider+origin to all
> other nodes
>
> 4--1----2
> |   \  /
> |--- 3
>
> EXECUTE SCRIPT( FILE=file1.sql, EVENT NODE=1);
> wait for event(origin=1, confirmed=2, wait on=1);
> EXECUTE SCRIPT(file=file2.sql, EVENT NODE=2);
>
> Take node 3.  Does node 3 perform the SQL in file1.sql first or
> file2.sql first?  Today this is non-deterministic either could win.
>
> The two solutions I see are
> a) Require all nodes to be caught up before going to the next event
> node.  As discussed this seems somewhat limiting
> b) Make slon wait for the event with origin=1 to be applied on node 3
> before applying the event from node 2 (because the event from node 1 had
> already been processed on node 2 by the time the node 2 event was
> generated).
>
> b) is what I am proposing to implement here.
>
> I can create this type of race condition  with other event types as well
> it isn't specific to execute script.

What you are basically asking for is a guaranteed total order in which 
events from multiple nodes are processed. Very much like the total order 
guarantees provided by group communication systems.

While the example above seems to be possible, I don't know why someone 
would actually attempt such. If node 1 is the origin of everything, it 
doesn't even make sense to use node 2 as the event node unless node 2 
also is the ONLY node to execute it.

The design of EXECUTE SCRIPT expects the event node to be the origin of 
the objects modified, so that the SQL statements inside the script are 
executed at the same data SYNC point on all nodes. Since it is 
impractical to perform sanity checks against the script to ensure that 
the user is actually doing that, all we can and should do is to make 
this requirement clearer in the documentation.


Jan

-- 
Anyone who trades liberty for security deserves neither
liberty nor security. -- Benjamin Franklin


More information about the Slony1-hackers mailing list