As part of the 2.1 development we have hit a few issues related to try blocks that we could use some user feedback on.
1. As part of bug 196, if slonik is going to create an event as part of a transaction it needs to obtain an exclusive lock on sl_event_lock BEFORE it does anything else as part of that transaction (ie before the xid is assigned to the transaction). 2. As part of the auto-wait for work ( code available at https://github.com/ssinger/slony1-engine/commits/auto_wait_for) if slonik detects that a 'wait for' is required inside of a try block it will bail out on an error (since 'wait for event' has never worked in a try block) To solve issue 1) I see a few options A) We can require the first command submitted to each event node be the first event for that node in a try block. Ie try { restart node(id=1); store node(id=4, event node=1); } would fail because the restart node(which does not generate an event/obtain the lock) is the first command in the transaction. but try { sync(id=1); restart node(id=1); store node(id=4, event node=1); } would work fine. B) We could have all commands in a try block obtain the sl_event_lock before that node is used in the block. Since the slonik commands that don't generate events are rare this seems like a good idea. It will mean that running two slonik scripts with try blocks at the same idea will probably not work well (but that would be good advise in 1.2 or 2.0 anyway) C) We could get rid of try blocks. Some people have commented that they don't behave as expected anyway and with the additional restrictions of changes 1) and 2) they are even less useful. D) We can execute each set of commands in the try block as part of different transactions each time the event node changes. This is consistent with how the documentation describes TRY blocks but isn't how they behave in practice today. This could also mean changing the behaviour I described for 'auto wait for'. I think I like (B) the most. comments? _______________________________________________ Slony1-general mailing list [email protected] http://lists.slony.info/mailman/listinfo/slony1-general
