On 03/19/2015 06:32 AM, Dave Cramer wrote:
> Actually I think it has been fixed in bug 349 (Thanks Chris) However I'd
> like to integrate schema changes into something like flyway.
> https://github.com/flyway/
>
> Not sure how this best plays out yet.
>


I think it would be great to see slony support in some schema management 
tools such as flyway,alembic or liquibase

I see two approaches worth considering

1) Have the schema managment tool Call the slonik executable and pass in 
a slonik script.

2) Call the SQL stored procedures directly.  This would involve calling
_slonyschema.ddlCapture for each SQL statement.  Then calling 
ddlScript_complete()

I would recommend against trying to duplicate the functions in ddlScript 
capture or ddlScript_complete.  I'll describe what they do in 2.2
for interest sake but I don't see any reason why you would want to 
re-invent this code.

The advantage of just using option 1 is that we (the slony developers) 
try to keep the slonik command syntax somewhat stable between releases 
but we reserve the right to change the API of the stored functions as we 
desire.  We don't consider the stored functions a stable API.
The pg-admin folks use the stored functions directly and keeping 
pg-admin working with the various slony versions and API changes
in something they need to keep on-top of.  You would have to take on a 
similar responsibility.

If you to teach your schema management tool to do more than just DDL but 
also do things like add new tables to a
replication set then the job of doing this directly with the stored 
procedures becomes larger.  Slonik often does more than just call the 
stored functions.


Here are the major steps the ddlScript_capture stored function performs 
when submitting DDL to run on all nodes

  * Captures the values of any replicated sequences
  * Inserts the ddl into the sl_log_script table
  * Executes the DDL submitted

The ddlScript_complete call will then
  * Add a row to sl_log_script indicating the DDL is complete
  * Call the updateRelName functions to check for any table renames
  * Call repair_log_triggers to fix the kkvv encoding for the trigger 
arguments


>
>
> Dave Cramer
>
> On 19 March 2015 at 05:47, Glyn Astill <glynast...@yahoo.co.uk
> <mailto:glynast...@yahoo.co.uk>> wrote:
>
>      > From: Dave Cramer <davecra...@gmail.com
>     <mailto:davecra...@gmail.com>>
>      >To: slony <slony1-general@lists.slony.info
>     <mailto:slony1-general@lists.slony.info>>
>      >Sent: Wednesday, 18 March 2015, 13:50
>      >Subject: [Slony1-general] replicating execute script
>     >
>     >
>     >
>     >Due to the usage of capital letters in the slony cluster execute script 
> fails.
>     >
>     >
>     >I am looking to replicate execute script for DDL changes. From what I 
> can see execute script takes a lock out on sl_lock before executing the 
> script, and releases it at the end.
>     >
>     >
>     >What else am I missing ?
>     >
>
>
>     Well it looks like ddlscript_complete calls updateRelname() and
>     repair_log_triggers(true), so I guess that's part of it.
>
>
>     Wouldn't it be better to try and patch execute script to handle your
>     case sensitivity issue?
>
>
>
>
> _______________________________________________
> Slony1-general mailing list
> Slony1-general@lists.slony.info
> http://lists.slony.info/mailman/listinfo/slony1-general
>

_______________________________________________
Slony1-general mailing list
Slony1-general@lists.slony.info
http://lists.slony.info/mailman/listinfo/slony1-general

Reply via email to