pglogical - logical replication contrib module
Hi,
I'd like to submit the replication solution which is based on the
pglogical_output [1]https://commitfest.postgresql.org/8/418/ module (which is obviously needed for this to compile).
The pglogical contrib module provides extension which does the
master-slave logical replication based on the logical decoding.
The basic documentation is in README.md, I didn't bother making sgml
docs yet since I expect that there will be ongoing changes happening and
it's easier for me to update the markdown docs than sgml. I will do the
conversion once we start approaching committable state.
What it implements
- logical replication
- partial replication (replication sets)
- multiple sources for single subscriber
- origin filtering (so that if replication is setup both ways, there is
no cyclic replication)
It currently doesn't do multi-master or automatic DDL. I think DDL
should be relatively easy if somebody finishes the deparse extension as
the infrastructure for replicating arbitrary commands is present in this
patch.
It's rather large patch so I will just go very briefly over high level
overview of how it works, the details need to be discussed separately IMHO:
Catalogs:
- node - stores information about "nodes" (postgresql databases)
- node_interface - represents connection string(s) to nodes, we
separate interfaces to different catalog mainly to allow for setups
where different subscribers see different address of the provider server
- local_node - stores exactly one tuple which points to the nodes
catalog tuple that represents the local node of the current database
- subscription - represents subscription between two nodes, it
includes configuration of the subscription like replication set and
origin filters
Upstream:
- basically just implements the pglogical_output hooks according to
the catalogs
Downstream:
- several background workers
- supervisor is worker which manages all the other workers
- manager is per database worker which manages individual database
(node) and its subscriptions
- apply does the actual replication, one apply process is started per
subscription, connects to the walsender on the other side and applies
the changes received from there
[1]: https://commitfest.postgresql.org/8/418/
--
Petr Jelinek http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
Attachments:
0001-pglogical-v1.patch.gzapplication/gzip; name=0001-pglogical-v1.patch.gzDownload
����V 0001-pglogical-v1.patch �\{s�F��;�S��$��zK9_Y�(G�LiI��R�C1�x��>��_w�0x����U�vW&������{F{x3v��FGg�q>>��������y8j_���O�����������l�}�9c��%������-��d�<
�O��]�����������������j7F�/�m`7X��d� ��"�����3Vow��� �����}z�z���W�Oob���^:�Z���1�s��|0>���p�������5dB��5�#{�zABge���#�����^�|��f�� H�.~��������aY��9���Q
?�h�
�##�M
)���S�j[v m�5I��#�{%���EnN�y{�
<�yr\.���F������J�9VB.���7M}~��J����uK�.�,������F�m�cI����p�l��JD�i�����a;�)�oW�f��93���3#�l�r�yv������)7?k�|�vK����"�G��~C�;�Ubr�Eh����yF�,��t ���f��j��/N����M�|j�o%��p������srh�N�w'NK�e���C���E�k��S���
?%���a�F���)���f�q�����1/���� �Q�� We����q�\r��M=�s��v�^a#)xf���:M��|��]�������y"2�agG�D�^�V}|x���H�4?��_���<��i;�K@�s�U��;��3k����9h�&����'�L3����iNC7�2�Ra�k��0���Q�^��l�f�N��q<�7?)X�Q���m@�D����9���Ys1�d#�����;�
���@l��d8B�Y�/�q� �0�O_
M����Fj��&%�K��"���n��pK�LV�Q��Y����dFaIK|=)�^\$���y0�����x�x=�����~��!`��sx$�2l�?���B(^&���[���%S���J��R>�$a@�����K
R
(s���-��0M��{�9^����7A�������E����^0��CfN
w��V|�G�vC�����
aq�����>Lp#�l1�R��_�0��O��/�T'����|3�*���S��8�!P�+�+��@Up���=�mpI`k�hT�k���P��%4mT'�� T��t����B��U�-�:B�*��U�P����C�s��6�-fJ��XY�W�%%}e�����U������U�O��[�������C��U����K��P��%�v����b|[��3���U��2|Ct���K
�*�| ^���
UW���wX�����+�
�L�] '�����������
(����J��J�L�]YRaW@kev�f��1k6��e�����
�j6��W6�O:��V�����}h����N�^���z��5���3V���6����?����-����;�Cpj��;�h2��1(R%����o�|f��m�C����`P�K)���!��~�?��C���h��ad��h����q7
�z��w0�T�emMb�]
����o�����i�N����X����_��qr�QJ���h�z����Z=v�?��G�"����/,�V��d��a�B��A��������:A�(aI�e!tN�����
���N)�����U]�z������}w8�'����Z��O������}������{�\���T=�L}�}'��z��i�e�~�����Z�G��$�^��*s���^Q���Y��$I���8J�2� +�T��hOE>�?���� }�(i�'��y(�����������(����=��_�a`B��_�~���ax��������w�����,��, ^��e�������Cf9�������2���2���a��0Av_�;���d��v��y�����@�(,���`��?��bD�u�j���k:1X��=���H,1�!��`)�����M1�5�,��C\��F�4���h��7���KR`;s�G��p��dx���S��"�h�� �.�b��RA�,��^���g{�iKd^����^{��N�^���5������7x���g��K���"
(5f���4� �4�N�66Q�K�����&o�[��z�����%[�������[�SM���8����c�d���Nik/� ���U��p�OS��vb�
��H5L\pc�lw���������_��z��������A"8I���"f�h���@!����`0P�a���F�|#�-�������>r�'��4�����C��V`�Pm{���Z���3i*���xs�(��,�H~,#2����9w�����&�����#�c�N�T��ul�x�B[�%�s�C
�R��L�^a���C�($vy$
������|��FA1}M����d��r�
J�E�bH�����I:�l����1�� wM��1h|�B��������a�* ���s�������"��f1bW�E��N8��IY�n�"��u�������f����T�-��p��W$7��U����I` _j�g�o0�\Z��&�<E�#�.���#�[��tS3����v��gy3�da�CL�> �T��3L��������Bk �������(�8�
Y@�;�����:y�L@��A�`>��t�s���!���b��;���������
$l�>��)����b/!t�pn��g�q����)7,5CJv6�$NAC!��F)}�%�#�$��_a�'f��Id%J�� �s�D�@<'�-��o5X
J�$x/<��i2��9�'@?��]�iXy- �g /,�(���b2(�dL�@��prz�^�s����"���L �j�p}�����W;u�����,��@6��s>|>�<���O�v�U�!����,P�%yh��c�0��|
�������Yw
��8�M�My�a�E�����tK���VBX��&6���\�e��!��������\/�g.��L<��� !7�-�L��AN/�pfh�`Z�����*������\d3�q�N!N�y?�Is*��@:?v�~F+b���
��{xb������<2i�Z}��
:8��7�8NlfC����4�#�����%���Q�g�Hd��F!8w+
G$�t�hf�A��H����=�#C%8I_�-��� ��+{�B1*t?�1^�/���b�d�T���
.)�b�m����T���#g72
L
e� H��H�"�l*���X����_�D�xm%�O�t���v����U��XPCf�1�-�����*�rk���L�sAk�OJ�ktr�J�U�u�H���R G�:,���
������N8=����x�5��40�$��l��(��y 1(�0��cD����@������`L;��L�6���0���%"
)����d|'FCJ]X�$���ys����$$��t���OZwEi8h/��:D����"��m�C����SP��j~a��oO���5Bo���>1zNW'�9��g*y�g��Q$/��
����\��t9����0����{���n�]��W�|�3��*X{��'K]@p�,�p ��r���l�I. ��\U������9��O���_�^i��h�]Loc� ���������#�Mp���
���3r������������#�DB���CPRQ^0d�>�J�/W���fJ��b����W;��B�.�>`��'