Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eMwQn-00034I-C7 for pgsql-general@arkaria.postgresql.org; Thu, 07 Dec 2017 13:41:41 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eMwQm-00032i-Sa for pgsql-general@arkaria.postgresql.org; Thu, 07 Dec 2017 13:41:40 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1eMwQm-00032W-Hz for pgsql-general@lists.postgresql.org; Thu, 07 Dec 2017 13:41:40 +0000 Received: from mail.hjp.at ([212.17.106.138] helo=rorschach.hjp.at) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1eMwQg-00041o-6A for pgsql-general@postgresql.org; Thu, 07 Dec 2017 13:41:39 +0000 Received: by rorschach.hjp.at (Postfix, from userid 1000) id 1B5431590; Thu, 7 Dec 2017 14:41:31 +0100 (CET) Date: Thu, 7 Dec 2017 14:41:31 +0100 From: "Peter J. Holzer" To: pgsql-general@postgresql.org Subject: Infinite replication loop with pglogical Message-ID: <20171207134131.grhh3h6udazmavb3@hjp.at> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="3ydzxmb5cau6m6on" Content-Disposition: inline User-Agent: NeoMutt/20170113 (1.7.2) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --3ydzxmb5cau6m6on Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable [I'm not sure whether this is the right list to discuss third party extensions like 2ndQuadrant's pglogical. If there is a better place, feel free to direct me to it] We are testing bidirectional replication with pglogical: Node 1:=20 postgresql-9.6 9.6.6-1.pgdg90+1 postgresql-9.6-pglogical 2.1.0-1.jessie+1 Node 2: postgresql-10 10.1-1.pgdg90+1 postgresql-10-pglogical 2.1.0-1.stretch+1 (They are on different versions because we wanted to test a staggered upgrade) We have configured bidirectional replication on several tables. In general that seems to work fine. When a row is inserted/updated/ deleted on one node, it is replicated to the other. But now I seem to have triggered a replication loop: wds=3D> select id, source_id, insert_ts, start_ts, update_ts, finished_ts, = module_id, status_id, status_msg, pid, username from qualitygate.jobs where= id =3D 19142008; id | source_id | insert_ts | start_ts | update_ts |= finished_ts | module_id | status_id | status_msg | pid | username=20 ----------+-----------+----------------------------+----------+-----------+= -------------+-----------+-----------+------------+-----+---------- 19142008 | 9 | 2017-12-07 11:39:09.904071 | | |= | 80 | 0 | | 0 | hjp (1 row) wds=3D> select id, source_id, insert_ts, start_ts, update_ts, finished_ts, = module_id, status_id, status_msg, pid, username from qualitygate.jobs where= id =3D 19142008; id | source_id | insert_ts | start_ts = | update_ts | finished_ts | module_id | status_id | s= tatus_msg | pid | username=20 ----------+-----------+----------------------------+-----------------------= -----+----------------------------+-------------+-----------+-----------+--= ----------+------+---------- 19142008 | 9 | 2017-12-07 11:39:09.904071 | 2017-12-07 11:39:09.91= 4616 | 2017-12-07 11:39:09.914616 | | 80 | 0 | = | 6863 | hjp (1 row) wds=3D> select id, source_id, insert_ts, start_ts, update_ts, finished_ts, = module_id, status_id, status_msg, pid, username from qualitygate.jobs where= id =3D 19142008; id | source_id | insert_ts | start_ts = | update_ts | finished_ts | module_id | = status_id | status_msg | pid | username=20 ----------+-----------+----------------------------+-----------------------= -----+---------------------------+---------------------------+-----------+-= ----------+------------+-----+---------- 19142008 | 9 | 2017-12-07 11:39:09.904071 | 2017-12-07 11:39:09.91= 4616 | 2017-12-07 11:39:09.95925 | 2017-12-07 11:39:09.95925 | 80 | = 0 | | -1 | hjp (1 row) Subsequent selects randomly return one of three states for this row (other rows are stable). The order above is the "logical order", i.e. the row was first inserted with the first state, then updated to the second, and finally to the third.=20 I suspect that the updates are bounced between the two nodes eternally overwriting each other and never reaching a stable state.=20 Has anybody seen this? If so, is there a way to reliably avoid this? (Maybe with a different pglogical.conflict_resolution setting, but if it was a conflict, I should see something in the logs, right?) hp --=20 _ | Peter J. Holzer | we build much bigger, better disasters now |_|_) | | because we have much more sophisticated | | | hjp@hjp.at | management tools. __/ | http://www.hjp.at/ | -- Ross Anderson --3ydzxmb5cau6m6on Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEETtJbRjyPwVTYGJ5k8g5IURL+KF0FAlopRPkACgkQ8g5IURL+ KF3lCA/+IllAkZPdmD+JW+zKkA6cAxpaEDxg9CB+ymvWovZ+I5HYCr6nXaK/AZSV Vj8Wj6TTFGFd3KoShkm0rBMJs5Oa3vcJvv5Nd7UTZG0cVQz+zX/c7sNaxZrxEU1r 2fqUeVcMeM5G7jBszX3pyS05VNq1y9/DuM6yqpu8MeKNDsEmMFIv/PoJ54J2bcf8 qErjbbfUOYUR9XH+dpTcugAld0XLM9PYMH+U2ETTbDHMWrWfg2g358eL/zhE4tjM mph1dEvT4rg4s7YlFtwUY3pKYOk3QoK2fmmm0hotVen/QS/Hv76I0xGRMvAoPSkX wtXeRz4USdqePjhsJxOCB7lgQGrLOORQlHjhw0Ia2bqRbWw3kAoaHT+C4KFlAokf YDB4Nbl/uZpRtfp+RH/9+mz+tXhP6+0dFISgawmi6oDeyOYJjPddX2mCMVBSd6pA E8L4dU5siHtctYQyhmSiWfqCReUDqKEwB5RPFjHLMJfNlu+s7DFeqGASgHfGJe4v RjBK83K9mlLVy/k2t9zXXInIF1m0jo4uxC2aPuAoVljO5Ze05Y0chz4leP7Mqw7a vqqbPLwcUYj08YigioAn0OHpWC0UGCMkEhCI8kXDRxCUzqnFn4VxwSv7tJp3uDkI 6daLP4AgK/81b3x1YCdTkMoz1DOE+V4MNtQQna2uWSmwJlryelM= =7fG8 -----END PGP SIGNATURE----- --3ydzxmb5cau6m6on--