Обсуждение: Logical Replication Helpers WIP for discussion
Hello, we've made few helper functions for making logical replication easier, I bundled it into contrib module as this is mainly for discussion at this time (I don't expect this to get committed any time soon, but it is good way to iron out protocol, etc). I created sample logical decoding plugin that uses those functions and which can be used for passing DML changes in platform/version independent (hopefully) format. I will post sample apply BG worker also once I get some initial feedback about this. It's hard to write tests for this as the binary changes contain transaction ids and timestamps so the data changes constantly. This is of course based on the BDR work Andres, Craig and myself have been doing. -- Petr Jelinek http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services
Вложения
On Mon, Dec 15, 2014 at 12:57 AM, Petr Jelinek <petr@2ndquadrant.com> wrote: > we've made few helper functions for making logical replication easier, I > bundled it into contrib module as this is mainly for discussion at this time > (I don't expect this to get committed any time soon, but it is good way to > iron out protocol, etc). > > I created sample logical decoding plugin that uses those functions and which > can be used for passing DML changes in platform/version independent > (hopefully) format. > > I will post sample apply BG worker also once I get some initial feedback > about this. > > It's hard to write tests for this as the binary changes contain transaction > ids and timestamps so the data changes constantly. > > This is of course based on the BDR work Andres, Craig and myself have been > doing. I can't understand, either from what you've written here or the rather sparse comments in the patch, what this might be good for. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company
On 15/12/14 19:42, Robert Haas wrote: > On Mon, Dec 15, 2014 at 12:57 AM, Petr Jelinek <petr@2ndquadrant.com> wrote: >> we've made few helper functions for making logical replication easier, I >> bundled it into contrib module as this is mainly for discussion at this time >> (I don't expect this to get committed any time soon, but it is good way to >> iron out protocol, etc). >> >> I created sample logical decoding plugin that uses those functions and which >> can be used for passing DML changes in platform/version independent >> (hopefully) format. >> >> I will post sample apply BG worker also once I get some initial feedback >> about this. >> >> It's hard to write tests for this as the binary changes contain transaction >> ids and timestamps so the data changes constantly. >> >> This is of course based on the BDR work Andres, Craig and myself have been >> doing. > > I can't understand, either from what you've written here or the rather > sparse comments in the patch, what this might be good for. > What I tried to achieve here is to provide solution to many of the common problems faced by logical replication solutions. I believe the first step in designing the logical replication (now that we have the logical decoding) is making the output plugin and the efficient protocol so I started with that. The code itself provides two main parts: First is the lrep_utils common utility functions that solve things like transporting DML statements, and more importantly the changed data in efficient manner, trying to not do any conversion if not needed (when architecture/version matches) but falling back to binary/textual IO representation of individual types so that the cross platform/version replication works too. I think those should eventually end up in core (ie not in contrib) as they are helper functions likely to be shared by multiple extensions, but for now I keep them with the rest of the contrib module as I feel better experimenting inside that module. There are also read functions that show how the other side could look like, but they are currently unused as the example apply worker is not part of the submission yet. The second part is extensible output plugin which serves both as an example of the intended use of those common utility functions and also as actual working solution that can be used as base for several replication solutions. It provides hooks for the replication solutions built on top of it that can be used for deciding if to replicate specific action on specific object and also injecting additional information to both BEGIN and COMMIT message - this can be useful for example when you are forwarding changes from another node and you wish to pass the information about the original node to the target one. What I hope to get from this is agreement on the general approach and protocol so that we can have common base which will both make it easier to create external logical replication solutions and also eventually lead to full logical replication inside core PostgreSQL. -- Petr Jelinek http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services
On Fri, Dec 19, 2014 at 8:40 AM, Petr Jelinek <petr@2ndquadrant.com> wrote: > What I hope to get from this is agreement on the general approach and > protocol so that we can have common base which will both make it easier to > create external logical replication solutions and also eventually lead to > full logical replication inside core PostgreSQL. The protocol is a really important topic which deserves its own discussion. Andres has mentioned some of the ideas he has in mind - which I think are similar to what you did here - but there hasn't really been a thread devoted to discussing that topic specifically. I think that would be a good idea: lay out what you have in mind, and why, and solicit feedback. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company
<div dir="ltr"><br /><div class="gmail_extra"><br /><div class="gmail_quote">On Mon, Dec 22, 2014 at 10:26 PM, Robert Haas<span dir="ltr"><<a href="mailto:robertmhaas@gmail.com" target="_blank">robertmhaas@gmail.com</a>></span> wrote:<br/><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">OnFri, Dec 19, 2014 at 8:40 AM, Petr Jelinek <<a href="mailto:petr@2ndquadrant.com">petr@2ndquadrant.com</a>>wrote:<br /> > What I hope to get from this is agreementon the general approach and<br /> > protocol so that we can have common base which will both make it easier to<br/> > create external logical replication solutions and also eventually lead to<br /> > full logical replicationinside core PostgreSQL.<br /><br /></span>The protocol is a really important topic which deserves its own<br />discussion. Andres has mentioned some of the ideas he has in mind -<br /> which I think are similar to what you did here- but there hasn't<br /> really been a thread devoted to discussing that topic specifically. I<br /> think that wouldbe a good idea: lay out what you have in mind, and<br /> why, and solicit feedback.<br /></blockquote></div><br /></div><divclass="gmail_extra">Looking at this patch, I don't see what we actually gain much here except a decoder pluginthat speaks a special protocol for a special background worker that has not been presented yet. What actually is thevalue of that defined as a contrib/ module in-core. Note that we have already test_decoding to basically test the logicaldecoding facility, used at least at the SQL level to get logical changes decoded.<br /><br /></div><div class="gmail_extra">Basedon those reasons I am planning to mark this as rejected (it has no documentation as well). So pleasespeak up if you think the contrary, but it seems to me that this could live happily out of core.<br /></div><div class="gmail_extra">--<br /><div class="gmail_signature">Michael<br /></div></div></div>
On 13/02/15 08:48, Michael Paquier wrote: > > > On Mon, Dec 22, 2014 at 10:26 PM, Robert Haas <robertmhaas@gmail.com > <mailto:robertmhaas@gmail.com>> wrote: > > On Fri, Dec 19, 2014 at 8:40 AM, Petr Jelinek <petr@2ndquadrant.com > <mailto:petr@2ndquadrant.com>> wrote: > > What I hope to get from this is agreement on the general approach and > > protocol so that we can have common base which will both make it easier to > > create external logical replication solutions and also eventually lead to > > full logical replication inside core PostgreSQL. > > The protocol is a really important topic which deserves its own > discussion. Andres has mentioned some of the ideas he has in mind - > which I think are similar to what you did here - but there hasn't > really been a thread devoted to discussing that topic specifically. I > think that would be a good idea: lay out what you have in mind, and > why, and solicit feedback. > > > Looking at this patch, I don't see what we actually gain much here > except a decoder plugin that speaks a special protocol for a special > background worker that has not been presented yet. What actually is the > value of that defined as a contrib/ module in-core. Note that we have > already test_decoding to basically test the logical decoding facility, > used at least at the SQL level to get logical changes decoded. > > Based on those reasons I am planning to mark this as rejected (it has no > documentation as well). So please speak up if you think the contrary, > but it seems to me that this could live happily out of core. I think you are missing point of this, it's not meant to be committed in this form at all and even less as contrib module. It was meant as basis for in-core logical replication discussion, but sadly I didn't really have time to pursue it in this CF in the end. -- Petr Jelinek http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services
On 13/02/15 14:04, Petr Jelinek wrote: > On 13/02/15 08:48, Michael Paquier wrote: >> >> Looking at this patch, I don't see what we actually gain much here >> except a decoder plugin that speaks a special protocol for a special >> background worker that has not been presented yet. What actually is the >> value of that defined as a contrib/ module in-core. Note that we have >> already test_decoding to basically test the logical decoding facility, >> used at least at the SQL level to get logical changes decoded. >> >> Based on those reasons I am planning to mark this as rejected (it has no >> documentation as well). So please speak up if you think the contrary, >> but it seems to me that this could live happily out of core. > > I think you are missing point of this, it's not meant to be committed in > this form at all and even less as contrib module. It was meant as basis > for in-core logical replication discussion, but sadly I didn't really > have time to pursue it in this CF in the end. > That being said and looking at the size of February CF, I think I am fine with dropping this in 9.5 cycle, it does not seem likely that there will be anything useful done with this fast enough to get to 9.5 so there is no point in spending committer resources on it in final CF. I will pick it up again after the CF is done. -- Petr Jelinek http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services
<div dir="ltr"><br /><div class="gmail_extra"><br /><div class="gmail_quote">On Sun, Feb 15, 2015 at 11:25 PM, Petr Jelinek<span dir="ltr"><<a href="mailto:petr@2ndquadrant.com" target="_blank">petr@2ndquadrant.com</a>></span> wrote:<br/><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On13/02/15 14:04, Petr Jelinek wrote:<br /></span><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px#ccc solid;padding-left:1ex"><span class=""> On 13/02/15 08:48, Michael Paquier wrote:<br /></span><spanclass=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br/> Looking at this patch, I don't see what we actually gain much here<br /> except a decoder pluginthat speaks a special protocol for a special<br /> background worker that has not been presented yet. What actuallyis the<br /> value of that defined as a contrib/ module in-core. Note that we have<br /> already test_decoding tobasically test the logical decoding facility,<br /> used at least at the SQL level to get logical changes decoded.<br /><br/> Based on those reasons I am planning to mark this as rejected (it has no<br /> documentation as well). So pleasespeak up if you think the contrary,<br /> but it seems to me that this could live happily out of core.<br /></blockquote><br/> I think you are missing point of this, it's not meant to be committed in<br /> this form at all andeven less as contrib module. It was meant as basis<br /> for in-core logical replication discussion, but sadly I didn'treally<br /> have time to pursue it in this CF in the end.<br /><br /></span></blockquote><br /> That being said andlooking at the size of February CF, I think I am fine with dropping this in 9.5 cycle, it does not seem likely that therewill be anything useful done with this fast enough to get to 9.5 so there is no point in spending committer resourceson it in final CF.<br /><br /> I will pick it up again after the CF is done.</blockquote></div><br /></div><divclass="gmail_extra">OK, thanks for the clarifications. Note that I am marking it as "rejected" in CF 2014-12not because it is something that is not wanted, but just not to re-add it to CF 2015-02 which is what "returned withfeedback" actually does...<br />-- <br /><div class="gmail_signature">Michael<br /></div></div></div>