<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On 19 March 2015 at 09:51, Steve Singer <span dir="ltr"><<a href="mailto:ssinger@afilias.info" target="_blank">ssinger@afilias.info</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 03/19/2015 06:32 AM, Dave Cramer wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Actually I think it has been fixed in bug 349 (Thanks Chris) However I'd<br>
like to integrate schema changes into something like flyway.<br>
<a href="https://github.com/flyway/" target="_blank">https://github.com/flyway/</a><br>
<br>
Not sure how this best plays out yet.<br>
<br>
</blockquote>
<br>
<br></span>
I think it would be great to see slony support in some schema management tools such as flyway,alembic or liquibase<br>
<br>
I see two approaches worth considering<br>
<br>
1) Have the schema managment tool Call the slonik executable and pass in a slonik script.<br></blockquote><div><br></div><div>While I see the merit in this from your POV it is rather "blocky" and sort of breaks the spirit of flyway (the only one I have seriously looked at) </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
2) Call the SQL stored procedures directly. This would involve calling<br>
_slonyschema.ddlCapture for each SQL statement. Then calling ddlScript_complete()<br></blockquote><div><br></div><div>Yes, this is where I was headed. Unfortunately flyway appears to call their hooks as a transaction. I have asked them to provide a hook without a transaction.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
I would recommend against trying to duplicate the functions in ddlScript capture or ddlScript_complete. I'll describe what they do in 2.2<br>
for interest sake but I don't see any reason why you would want to re-invent this code.<br>
<br></blockquote><div>Agreed.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
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.<br>
The pg-admin folks use the stored functions directly and keeping pg-admin working with the various slony versions and API changes<br>
in something they need to keep on-top of. You would have to take on a similar responsibility.<br></blockquote><div><br></div><div>Any reason why you couldn't have a stable API here. Somewhat higher level than the current functions which would allow you to still do whatever you wanted below this layer ?</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
If you to teach your schema management tool to do more than just DDL but also do things like add new tables to a<br>
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.<br></blockquote><div><br></div><div>One step at a time ;)</div><div><br></div><div>Dave </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<br>
Here are the major steps the ddlScript_capture stored function performs when submitting DDL to run on all nodes<br>
<br>
* Captures the values of any replicated sequences<br>
* Inserts the ddl into the sl_log_script table<br>
* Executes the DDL submitted<br>
<br>
The ddlScript_complete call will then<br>
* Add a row to sl_log_script indicating the DDL is complete<br>
* Call the updateRelName functions to check for any table renames<br>
* Call repair_log_triggers to fix the kkvv encoding for the trigger arguments<br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">
<br>
<br>
Dave Cramer<br>
<br>
On 19 March 2015 at 05:47, Glyn Astill <<a href="mailto:glynastill@yahoo.co.uk" target="_blank">glynastill@yahoo.co.uk</a><br></span><span class="">
<mailto:<a href="mailto:glynastill@yahoo.co.uk" target="_blank">glynastill@yahoo.co.uk</a><u></u>>> wrote:<br>
<br>
> From: Dave Cramer <<a href="mailto:davecramer@gmail.com" target="_blank">davecramer@gmail.com</a><br></span>
<mailto:<a href="mailto:davecramer@gmail.com" target="_blank">davecramer@gmail.com</a>>><br>
>To: slony <<a href="mailto:slony1-general@lists.slony.info" target="_blank">slony1-general@lists.slony.<u></u>info</a><br>
<mailto:<a href="mailto:slony1-general@lists.slony.info" target="_blank">slony1-general@lists.<u></u>slony.info</a>>><span class=""><br>
>Sent: Wednesday, 18 March 2015, 13:50<br>
>Subject: [Slony1-general] replicating execute script<br>
><br>
><br>
><br>
>Due to the usage of capital letters in the slony cluster execute script fails.<br>
><br>
><br>
>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.<br>
><br>
><br>
>What else am I missing ?<br>
><br>
<br>
<br>
Well it looks like ddlscript_complete calls updateRelname() and<br>
repair_log_triggers(true), so I guess that's part of it.<br>
<br>
<br>
Wouldn't it be better to try and patch execute script to handle your<br>
case sensitivity issue?<br>
<br>
<br>
<br>
<br></span>
______________________________<u></u>_________________<br>
Slony1-general mailing list<br>
<a href="mailto:Slony1-general@lists.slony.info" target="_blank">Slony1-general@lists.slony.<u></u>info</a><br>
<a href="http://lists.slony.info/mailman/listinfo/slony1-general" target="_blank">http://lists.slony.info/<u></u>mailman/listinfo/slony1-<u></u>general</a><br>
<br>
</blockquote>
<br>
</blockquote></div><br></div></div>