Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1frfXO-0007Ji-9n for pgsql-admin@arkaria.postgresql.org; Mon, 20 Aug 2018 08:27:46 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1frfXM-0003QZ-G2 for pgsql-admin@arkaria.postgresql.org; Mon, 20 Aug 2018 08:27:44 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1frfXM-0003QS-97 for pgsql-admin@lists.postgresql.org; Mon, 20 Aug 2018 08:27:44 +0000 Received: from hermes.gatewaynet.com ([193.92.121.98]) by magus.postgresql.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1frfXI-0004pw-94 for pgsql-admin@lists.postgresql.org; Mon, 20 Aug 2018 08:27:43 +0000 Received: from smadev.internal.net (pc131.internal.net [10.9.200.131]) by hermes.gatewaynet.com (8.14.3/8.14.3/Debian-9.4) with ESMTP id w7K8RXnN017797 for ; Mon, 20 Aug 2018 11:27:38 +0300 Received: from smadev.internal.net (smadev [10.9.200.131]) by smadev.internal.net (8.15.2/8.15.2) with ESMTP id w7K8RXug055571 for ; Mon, 20 Aug 2018 11:27:33 +0300 (EEST) (envelope-from achill@matrix.gatewaynet.com) Subject: Re: logical Replication To: pgsql-admin@lists.postgresql.org References: <1534224580242-0.post@n3.nabble.com> <1534746282900-0.post@n3.nabble.com> <1534747341264-0.post@n3.nabble.com> <1534748661624-0.post@n3.nabble.com> <17b9b7a5-5377-b904-0e8a-e72e72efe1ef@matrix.gatewaynet.com> <1534750828102-0.post@n3.nabble.com> <11f06cb4-8e48-7090-76e0-438b54c70660@matrix.gatewaynet.com> <1534751989163-0.post@n3.nabble.com> From: Achilleas Mantzios Message-ID: Date: Mon, 20 Aug 2018 11:27:33 +0300 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <1534751989163-0.post@n3.nabble.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Virus-Scanned: clamav-milter 0.98.7 at hermes X-Virus-Status: Clean X-Spam-Status: No, score=-26.6 required=5.0 tests=ALL_TRUSTED,DYN_HAM_COORD, DYN_HAM_IT,DYN_HAM_NAUTICAL,DYN_HAM_SIGNAT1,DYN_SPAM_MED6,DYN_SPAM_WATCHES7 autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on hermes.gatewaynet.com List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 20/08/2018 10:59, pavan95 wrote: >> Hi Achilleas, >> >>> Now on the publisher side what does : >>> select * from pg_stat_replication ; >>> tell you? >> Please find the below output: >>> *select * from pg_stat_replication ;* >> pid | usesysid | usename | application_name | client_addr | >> client_hostname | client_port | backend_start | >> backend_xmin | state | sent_lsn | write_lsn | flush_lsn | >> replay_lsn >> | write_lag | flush_lag | replay_lag | sync_priority | sync_state >> -------+----------+----------+------------------+--------------+-----------------+-------------+----------------------------------+--------------+-----------+------------+------------+------------+------------+-----------+-----------+------------+---------------+------------ >> 32515 | 78225 | user | appn | xxx.xxx.xx.xxx | >> | 411111 | 2018-08-20 11:32:09.636622+05:30 | | >> streaming >> | 0/69BE27D0 | 0/69BE27D0 | 0/69BE27D0 | 0/69BE27D0 | | >> | | 0 | async >> >>> So here you have zero lag. How do you experience the lag? What do you > exactly measure? > > Actually there are no running transactions in the database. When I insert > the data suppose 100 records in a table and after commit connect to the > subscriber database and issue row count from that particular table, I am > finding that the data didn't got replicated. > > Later which I will proceed with : > ALTER SUBSCRIPTION my_sub_name WITH REFRESH PUBLICATION WITH( COPY_DATA) > > Even then I can't see the data replicated in the subscriber side. > > Then I will go with dropping and recreating the SUBSCRIPTION on the > subscriber side where I will see that inserted 100 records in the subscriber > side. > > Again will try inserting another 1000 records which will get replicated > within microsecond(I guess). This is far from normal. This isn't working for some reason. Now do that : a) increase the timeouts b) restart both servers c) drop / recreate the subscription d) wait till all data are synced e) start with a simple insert (1 row), and monitor the data on the subscriber. Then insert 100 rows. Always watch the LOG for ERRORs and also pg_stat_replication (publisher), pg_stat_subscription (subscriber), pg_replication_slots (publisher), pg_replication_origin_status (subscriber) > > This is what I will consider as lag. Hope I answered your question. > > Looking forward to hear from you. > > Regards, > Pavan > > > > -- > Sent from: http://www.postgresql-archive.org/PostgreSQL-admin-f2076596.html > -- Achilleas Mantzios IT DEV Lead IT DEPT Dynacom Tankers Mgmt