Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sPja1-0063Yq-DW for pgsql-hackers@arkaria.postgresql.org; Fri, 05 Jul 2024 14:06:30 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1sPjZz-00AB68-A8 for pgsql-hackers@arkaria.postgresql.org; Fri, 05 Jul 2024 14:06:28 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sPjZy-00AB60-SP for pgsql-hackers@lists.postgresql.org; Fri, 05 Jul 2024 14:06:27 +0000 Received: from mail.postgrespro.ru ([93.174.131.139]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sPjZv-000Xdk-Ss for pgsql-hackers@lists.postgresql.org; Fri, 05 Jul 2024 14:06:26 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mx2023; t=1720188380; bh=PXTXtr9t9OKXVNjG2ZgsArILDKqNX2c7NRS+dXAtJEI=; h=From:In-Reply-To:References:Date:Cc:To:Message-ID:Subject: User-Agent:From; b=tY2AC4lbvxjwtVt07VsWeZ4tkW2INWJBSsuqRaVvACQ1G5hiwJdvW7Qo4JnVtYZVh JT19pghX3M9QHt9UGvlhdygCU170FD8T4pltEs5joEl/o1w9CV5Io6xZIUqs0t9oFi jIKiPVPhzdng6Ut2b7mbA835AV3N6wNeXGUneehraIa5vuL8iE2ECO+JPtbnPcoedy +YFo5hszAzi3muOPN833iFU/ZmZqvBkM4d9jXKMjSwdFBCFS6SI26WYYl/xhU92cc0 Lh/J5PXzXfcTILBb1uxypXzTRDKubElOB1zCOa0ivjimQdaoOOaiZOd2vxp+XcaiPh Eqq58k+VV/kpQ== Received: from sogo.postgrespro.ru (unknown [192.168.2.5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (Client did not present a certificate) by mail.postgrespro.ru (Postfix/587) with ESMTPS id B6C2A6088A; Fri, 5 Jul 2024 17:06:19 +0300 (MSK) From: "Vitaly Davydov" In-Reply-To: Content-Type: multipart/alternative; boundary="----=_=-_OpenGroupware_org_NGMime-936352-1720188379.633350-9------" X-Forward: 95.139.104.78 References: <8fab8-65d74c80-1-2f28e880@39088166> <99df2-65d8d200-1-63c26880@172687752> Date: Fri, 05 Jul 2024 17:06:19 +0300 Cc: "Amit Kapila" , "Ajin Cherian" , "Heikki Linnakangas" , =?utf-8?q?pgsql-hackers=40lists=2Epostgresql=2Eorg?= To: "Hayato Kuroda (Fujitsu)" MIME-Version: 1.0 Message-ID: Subject: =?utf-8?q?RE=3A?= Slow catchup of 2PC (twophase) transactions on replica in LR User-Agent: SOGoMail 5.10.0 X-KSMG-AntiPhishing: NotDetected X-KSMG-AntiSpam-Interceptor-Info: not scanned X-KSMG-AntiSpam-Status: not scanned, disabled by settings X-KSMG-AntiVirus: Kaspersky Secure Mail Gateway, version 2.1.0.7854, bases: 2024/07/05 11:36:00 #25854547 X-KSMG-AntiVirus-Status: NotDetected, skipped X-KSMG-LinksScanning: not scanned, disabled by settings X-KSMG-Message-Action: skipped X-KSMG-Rule-ID: 1 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk ------=_=-_OpenGroupware_org_NGMime-936352-1720188379.633350-9------ Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Content-Length: 1071 Hi Kuroda-san, Thank you very much for the patch. In general, it seem to work well for= me, but there seems to be a memory access problem in libpqrcv=5Falter=5F= slot -> quote=5Fidentifier in case of NULL slot=5Fname. It happens, if = the two=5Fphase option is altered on a subscription without slot. I thi= nk, a simple check for NULL may fix the problem. I guess, the same prob= lem may be for failover option. Another possible problem is related to my use case. I haven't reproduce= d this case, just some thoughts. I guess, when two=5Fphase is ON, the P= REPARE statement may be truncated from the WAL at checkpoint, but COMMI= T PREPARED is still kept in the WAL. On catchup, I would ask the master= to send transactions from some restart LSN. I would like to get all su= ch transactions competely, with theirs bodies, not only COMMIT PREPARED= messages. One of the solutions is to have an option for the slot to ke= ep the WAL like with two=5Fphase =3D OFF independently on its two=5Fpha= se option. It is just an idea. With best regards, Vitaly ------=_=-_OpenGroupware_org_NGMime-936352-1720188379.633350-9------ Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable Content-Length: 1127 Hi Kuroda-san,

Thank you very much for the patch. In g= eneral, it seem to work well for me, but there seems to be a memory acc= ess problem in libpqrcv=5Falter=5Fslot -> quote=5Fidentifier in case= of NULL slot=5Fname. It happens, if the two=5Fphase option is altered = on a subscription without slot. I think, a simple check for NULL may fi= x the problem. I guess, the same problem may be for failover option.
Another possible problem is related to my use case. I haven't = reproduced this case, just some thoughts. I guess, when two=5Fphase is = ON, the PREPARE statement may be truncated from the WAL at checkpoint, = but COMMIT PREPARED is still kept in the WAL. On catchup, I would ask t= he master to send transactions from some restart LSN. I would like to g= et all such transactions competely, with theirs bodies, not only COMMIT= PREPARED messages. One of the solutions is to have an option for the s= lot to keep the WAL like with two=5Fphase =3D OFF independently on its = two=5Fphase option. It is just an idea.

With best regards,Vitaly ------=_=-_OpenGroupware_org_NGMime-936352-1720188379.633350-9--------