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 1gCEGg-00059W-I6 for pgsql-admin@arkaria.postgresql.org; Tue, 16 Oct 2018 01:35:30 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gCEGc-00069W-Tb for pgsql-admin@arkaria.postgresql.org; Tue, 16 Oct 2018 01:35:26 +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 1gCEGc-00069O-M5 for pgsql-admin@lists.postgresql.org; Tue, 16 Oct 2018 01:35:26 +0000 Received: from cat-porwal-prod-mail1.catalyst.net.nz ([2404:130:4080::4]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gCEGY-0001kM-2p for pgsql-admin@lists.postgresql.org; Tue, 16 Oct 2018 01:35:25 +0000 Received: from [IPv6:2406:e001:b7c:1:9193:85d9:8b71:5c47] (unknown [IPv6:2406:e001:b7c:1:9193:85d9:8b71:5c47]) (Authenticated sender: mark.kirkwood@catalyst.net.nz) by cat-porwal-prod-mail1.catalyst.net.nz (Postfix) with ESMTPSA id C5DC380C64 for ; Tue, 16 Oct 2018 14:35:10 +1300 (NZDT) Subject: Re: Hick ups in Postgresql Logical Replication To: pgsql-admin@lists.postgresql.org References: <1539447741900-0.post@n3.nabble.com> <20427d4e-98a5-0cda-bddc-070989015cca@catalyst.net.nz> <1539598263562-0.post@n3.nabble.com> From: Mark Kirkwood Message-ID: <81cfab86-c6dc-89a1-5685-7589e4f81f9d@catalyst.net.nz> Date: Tue, 16 Oct 2018 14:35:08 +1300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <1539598263562-0.post@n3.nabble.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Authentication-Results: ORIGINATING; auth=pass smtp.auth=mark.kirkwood@catalyst.net.nz smtp.mailfrom=mark.kirkwood@catalyst.net.nz List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hi On 15/10/18 23:11, pavan95 wrote: > Hi Mark, > > Thanks for your response. > >> We'd probably need to see how you actually did your set up, and also how >> you are deducing that there is a lag (e.g pg_stat_subscription)? > > *Setup*: > > *Publisher *: > > Out of n number of tables n-1 tables are opted for replication of DML > changes. > > *Subscriber *: > > Subscription is created on the subscriber for the corresponding publication. > > *At times, I find(developer complains) about difference in records between > some of the published tables.* > > For example, after successful configuration of replication, say it was > configured successfully on Oct 1'st 2018 and verified that it is > replicating. Then some n days in future, a developer complains a table named > abc is not getting replicated(meaning the data inserted/updated/deleted for > that table abc on publisher is not getting synced with subscriber). > > *Findings*: > > Here I found that for 1 of the published table the row count is not same on > both publisher and subscriber: > > Publisher : select count(*) from table_A; No.of Rows= 3598 > > Subscriber: select count(*) from table_A: No.of Rows= 3590 > I suggest trying to make a self contained test case illustrating this problem (maybe just a single table replicated). By that I mean an exact sequence of commands (so we can try it too and see if you have found a bug)! With respect to the question about wal files and LSN, see the function pg_walfile_name(), e.g: postgres=# SELECT pg_current_wal_lsn();  pg_current_wal_lsn --------------------  0/51EB3BA8 (1 row) postgres=# SELECT pg_walfile_name(pg_current_wal_lsn());      pg_walfile_name --------------------------  000000010000000000000051 (1 row) The other 2 questions will be more easily tackled when we know the exact set of commands you are using to do set things up. regards Mark