Bug 228

Summary: 'drop node' in a try block
Product: Slony-I Reporter: Steve Singer <ssinger>
Component: slonikAssignee: Steve Singer <ssinger>
Status: RESOLVED FIXED    
Severity: enhancement CC: slony1-bugs
Priority: low    
Version: devel   
Hardware: PC   
OS: Linux   
Attachments: patch for a possible fix

Description Steve Singer 2011-08-04 13:28:26 PDT
In doing some testing against the 2.1.0 beta I tried executing some 
slonik code like

try {
   drop node(id=3, event node=1);
}
on error {
   echo "node already gone";
}
store node(id=3, event node=1);

A script like this will fail in the current 2.1.0 betas and this 
shouldn't surprise anyone who has read about the new features in 2.1.0

A drop node requires that the cluster be somewhat caught up (at least to 
the extent that any events from the drop'd node that have been confirmed 
elsewhere are confirmed everywhere).  This means that drop node has an 
implicit 'wait for event' before it.   However you can't have 'wait for 
events' inside a try block.
Comment 1 Steve Singer 2011-08-04 13:41:21 PDT
Created an attachment (id=117) [details]
patch for a possible fix

This patch allows the first useful command in a try block to be a waiting
operation.  It will rollback the transaction and create a new one after the
wait.
Comment 2 Christopher Browne 2011-08-08 12:39:36 PDT
Another alternative would be for conditionals to be handled in an "abort if
{conditions} fashion", as described in bug #173.

I think you've observed that this isn't necessarily a reason to "abort," so
perhaps that should change to "conditional execution."
Comment 3 Steve Singer 2011-08-10 12:51:37 PDT
Please review
Comment 4 Jan Wieck 2011-08-12 14:07:31 PDT
Looks good to me. Please apply.
Comment 5 Steve Singer 2011-08-15 05:57:49 PDT
Patch applied

http://git.postgresql.org/gitweb/?p=slony1-engine.git;a=commit;h=b9ceb3c7694db9b516f2aca274f5d93171678109