Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1k2jMp-000448-Ou for pgsql-general@arkaria.postgresql.org; Mon, 03 Aug 2020 22:55:40 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1k2jMo-0003gG-OL for pgsql-general@arkaria.postgresql.org; Mon, 03 Aug 2020 22:55:38 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1k2jMo-0003dA-DM for pgsql-general@lists.postgresql.org; Mon, 03 Aug 2020 22:55:38 +0000 Received: from p3plsmtpa11-09.prod.phx3.secureserver.net ([68.178.252.110]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1k2jMh-0008JJ-Os for pgsql-general@postgresql.org; Mon, 03 Aug 2020 22:55:38 +0000 Received: from johns-imac-4.home ([100.11.14.6]) by :SMTPAUTH: with ESMTPA id 2jMekutE0C7Kr2jMekSyW0; Mon, 03 Aug 2020 15:55:28 -0700 X-CMAE-Analysis: v=2.3 cv=Sb+JicZu c=1 sm=1 tr=0 a=CBQM/fRm8ns2oaVrUFkZfg==:117 a=CBQM/fRm8ns2oaVrUFkZfg==:17 a=onc9sL0xAAAA:8 a=0XpIHoWQnX2x-_Ye9_QA:9 a=QEXdDO2ut3YA:10 a=7c-QrhQ318YA:10 a=0j-xl0pdmN0A:10 a=QVp75at2-OQA:10 a=wXLcwSpnUBAA:10 a=R5Usvw1eX9b0_P7cOd0A:9 a=MvdQwXMh6p0VpViX:21 a=_W_S_7VecoQA:10 a=SH8-StzDjxLIcDHCw_MA:9 a=ZVk8-NSrHBgA:10 a=D1Mt0Of_GMHOm1B_mR0f:22 X-SECURESERVER-ACCT: john.ashmead@ashmeadsoftware.com From: John Ashmead Content-Type: multipart/signed; boundary="Apple-Mail=_C644BEDE-2AD0-4CE8-BBB0-4900388FC3DF"; protocol="application/pkcs7-signature"; micalg=sha-256 Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.14\)) Subject: Re: How can you find out what point logical replication is at? -- or weird, slow, infinite loop Date: Mon, 3 Aug 2020 18:55:27 -0400 References: <1934924.1596306669@sss.pgh.pa.us> <06C3100D-2C47-4707-B426-14D00A95260B@ashmeadsoftware.com> To: pgsql-general@postgresql.org In-Reply-To: <06C3100D-2C47-4707-B426-14D00A95260B@ashmeadsoftware.com> Message-Id: X-Mailer: Apple Mail (2.3445.104.14) X-CMAE-Envelope: MS4wfCwQ4nUcKYHGQELqW4r6KefLgopDtcrSceJiUIbTJh4/t3SG7MV94QJuyH50JL+0KBUQ1k4Wzlqf8tEsoMxlXJSUnlaZ+ru9rYOmX3sXRxxhETWH5HjW eA6vCSdPDrFsUUncGWTPylAr+9m8SueNp9ma5wtV+4m0xEIwCrmwbX5m9BXlqoqPb15dBZ6aOeXahusWl8Rqv7zOeUavD1HqiFQ= List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --Apple-Mail=_C644BEDE-2AD0-4CE8-BBB0-4900388FC3DF Content-Type: multipart/alternative; boundary="Apple-Mail=_1C5A208F-E9E7-4673-9951-EF90D026591B" --Apple-Mail=_1C5A208F-E9E7-4673-9951-EF90D026591B Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 This has gotten a bit weirder. The replication is getting up to a specific LSN. =20 Then it moves the sent_lsn to a number less than that, for a WAL file = about an hour or more earlier and slowly walks forward again till it hit = the same highwater mark. So the replication seems to be stuck in some kind of a slow infinite = loop. Corrupted WAL file? Any other ideas of what to look for? TIA, John > On Aug 3, 2020, at 10:38 AM, John Ashmead = wrote: >=20 > I have logical replication setup from a factory in Zhuhai China to a = data warehouse in New Jersey. We are using postgresql 10.13 on both = sides, on Redhat Linux 7.6. >=20 > The logical replication has been in =E2=80=9Ccatchup=E2=80=9D mode for = several days now, stuck at a specific LSN (9EF/89ADF7E0). The slave side = seems to be chugging along, generating lots of WAL files =E2=80=94 but = not actually getting any new records in.=20 >=20 > The logical replication is being used to move some fairly large files: = averaging about 1 MB but with a max up to about 250 MB. (I think I want = to fix that longer term, but that=E2=80=99s not a quick fix.) >=20 > My working hypothesis is that we are stuck on a long transaction: that = we can=E2=80=99t get some abnormally large blob over before we drop the = line. In this case fixing the connection should fix the problem. >=20 > Is there a way I can see what is going on? The slave is working hard, = but what is it working on? >=20 > And are there any suggestions on how to handle this? >=20 > I could restart the logical replication with =E2=80=9Ccopy_data =3D = false=E2=80=9D, then fill in the holes by hand. But I would rather not! >=20 > Thanks in advance! >=20 > John >=20 > PS. Output of pg_stat_replication & pg_stat_subscription on master & = slave respectively. (Some proprietary information X=E2=80=99d out) >=20 > select * from pg_stat_replication; > -[ RECORD 1 ]----+------------------------------ > pid | 42451 > usesysid | 10 > usename | postgres > application_name | china_to_nj_sub > client_addr | XXX.XXX.XXX.XXX > client_hostname |=20 > client_port | 54300 > backend_start | 2020-08-03 09:07:07.257454-04 > backend_xmin | 16574498 > state | catchup > sent_lsn | 9EF/89ADF7E0 > write_lsn | 9EF/89ADF7E0 > flush_lsn | 9EF/89ADF7E0 > replay_lsn | 9EF/89ADF7E0 > write_lag |=20 > flush_lag |=20 > replay_lag |=20 > sync_priority | 0 > sync_state | async >=20 > select * from pg_stat_subscription; > -[ RECORD 1 ]---------+------------------------------ > subid | 7222699 > subname | china_to_nj_sub > pid | 14764 > relid |=20 > received_lsn | 9EF/89ADF7E0 > last_msg_send_time | 2020-08-03 10:15:48.644575-04 > last_msg_receipt_time | 2020-08-03 10:14:57.247993-04 > latest_end_lsn | 9EF/89ADF7E0 > latest_end_time | 2020-08-03 09:30:57.974223-04 >=20 >=20 > John Ashmead > 139 Montrose Avenue > Rosemont, PA, 19010-1508 > (610) 527 9560=20 > mobile (610) 247 2323 > john.ashmead@ashmeadsoftware.com = >=20 >=20 >=20 >=20 >=20 >=20 John Ashmead 139 Montrose Avenue Rosemont, PA, 19010-1508 (610) 527 9560=20 mobile (610) 247 2323 john.ashmead@ashmeadsoftware.com --Apple-Mail=_1C5A208F-E9E7-4673-9951-EF90D026591B Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8 This = has gotten a bit weirder.

The replication is getting up to a specific LSN. =  

Then it = moves the sent_lsn to a number less than that, for a WAL file about an = hour or more earlier and slowly walks forward again till it hit the same = highwater mark.

So the replication seems to be stuck in some kind of a slow = infinite loop.

Corrupted WAL file?  Any other ideas of what to look = for?

TIA,

John

On Aug 3, 2020, at 10:38 AM, = John Ashmead <john.ashmead@ASHMEADSOFTWARE.COM> wrote:

I have logical = replication setup from a factory in Zhuhai China to a data warehouse in = New Jersey. We are using postgresql 10.13 on both sides, on Redhat Linux = 7.6.

The logical replication has been in =E2=80=9Ccatchup=E2=80=9D = mode for several days now, stuck at a specific LSN (9EF/89ADF7E0). The = slave side seems to be chugging along, generating lots of WAL files =E2=80= =94 but not actually getting any new records in. 

The logical replication = is being used to move some fairly large files:  averaging about 1 = MB but with a max up to about 250 MB. (I think I want to fix that longer = term, but that=E2=80=99s not a quick fix.)

My working hypothesis is that we are = stuck on a long transaction: that we can=E2=80=99t get some abnormally = large blob over before we drop the line.  In this case fixing the = connection should fix the problem.

Is there a way I can see what is going = on?  The slave is working hard, but what is it working = on?

And are = there any suggestions on how to handle this?

I could restart the logical replication = with =E2=80=9Ccopy_data =3D false=E2=80=9D, then fill in the holes by = hand.  But I would rather not!

Thanks in advance!

John

PS. Output of = pg_stat_replication & pg_stat_subscription on master & slave = respectively.  (Some proprietary information X=E2=80=99d = out)

select * from pg_stat_replication;
-[ = RECORD 1 ]----+------------------------------
pid =              | 42451
usesysid         | 10
usename          | = postgres
application_name | = china_to_nj_sub
client_addr      | = XXX.XXX.XXX.XXX
client_hostname =  | 
client_port      | = 54300
backend_start    | 2020-08-03 = 09:07:07.257454-04
backend_xmin     | = 16574498
state           =  | catchup
sent_lsn       =   | 9EF/89ADF7E0
write_lsn     =    | 9EF/89ADF7E0
flush_lsn     =    | 9EF/89ADF7E0
replay_lsn   =     | 9EF/89ADF7E0
write_lag   =      | 
flush_lag     =    | 
replay_lag     =   | 
sync_priority    | = 0
sync_state       | async

 select * from = pg_stat_subscription;
-[ RECORD 1 = ]---------+------------------------------
subid =                 | = 7222699
subname           =     | china_to_nj_sub
pid     =               | 14764
relid                 = | 
received_lsn         =  | 9EF/89ADF7E0
last_msg_send_time   =  | 2020-08-03 10:15:48.644575-04
last_msg_receipt_time | 2020-08-03 = 10:14:57.247993-04
latest_end_lsn     =    | 9EF/89ADF7E0
latest_end_time   =     | 2020-08-03 09:30:57.974223-04


John Ashmead
139 Montrose Avenue
Rosemont, PA, = 19010-1508
(610) 527 9560 
mobile (610) 247 2323







John Ashmead
139 = Montrose Avenue
Rosemont, PA, 19010-1508
(610) 527 9560 
mobile (610) 247 = 2323






= --Apple-Mail=_1C5A208F-E9E7-4673-9951-EF90D026591B-- --Apple-Mail=_C644BEDE-2AD0-4CE8-BBB0-4900388FC3DF Content-Disposition: attachment; filename=smime.p7s Content-Type: application/pkcs7-signature; name=smime.p7s Content-Transfer-Encoding: base64 MIAGCSqGSIb3DQEHAqCAMIACAQExDzANBglghkgBZQMEAgEFADCABgkqhkiG9w0BBwEAAKCCA7Iw ggOuMIIClqADAgECAgro7pS+Rqr77WGGMA0GCSqGSIb3DQEBCwUAMIGEMRUwEwYDVQQDEwxKb2hu IEFzaG1lYWQxLTArBgNVBAoTJEFzaG1lYWQgU29mdHdhcmUgYW5kIENvbnN1bHRpbmcsIEluYzEv MC0GCSqGSIb3DQEJARYgam9obi5hc2htZWFkQGFzaG1lYWRzb2Z0d2FyZS5jb20xCzAJBgNVBAYT AlVTMB4XDTE3MDIwOTEyMDAxN1oXDTIyMDIwOTEyMDAxN1owgYQxF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