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 1lr03O-0004NV-76 for pgsql-hackers@arkaria.postgresql.org; Wed, 09 Jun 2021 15:23:38 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lr03M-0007fn-VK for pgsql-hackers@arkaria.postgresql.org; Wed, 09 Jun 2021 15:23:36 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lr03M-0007ff-NH for pgsql-hackers@lists.postgresql.org; Wed, 09 Jun 2021 15:23:36 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lr03K-0004jL-Fe for pgsql-hackers@lists.postgresql.org; Wed, 09 Jun 2021 15:23:35 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 159FNW5v1357804; Wed, 9 Jun 2021 11:23:32 -0400 From: Tom Lane To: Mark Dilger cc: Amit Kapila , PostgreSQL Hackers , Peter Eisentraut , Simon Riggs Subject: Re: logical replication of truncate command with trigger causes Assert In-reply-to: References: <1250962.1623192946@sss.pgh.pa.us> <1254157.1623196736@sss.pgh.pa.us> <1356183.1623250358@sss.pgh.pa.us> Comments: In-reply-to Mark Dilger message dated "Wed, 09 Jun 2021 08:14:25 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1357802.1623252212.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Wed, 09 Jun 2021 11:23:32 -0400 Message-ID: <1357803.1623252212@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Mark Dilger writes: >> On Jun 9, 2021, at 7:52 AM, Tom Lane wrote: >> Somewhat unrelated, but ... am I reading the code correctly that >> apply_handle_stream_start and related routines are using Asserts >> to check that the remote sent stream-control messages in the correct >> order? That seems many degrees short of acceptable. > Even if you weren't reading that correctly, this bit: > xid =3D pq_getmsgint(s, 4); > Assert(TransactionIdIsValid(xid)); > simply asserts that the sending server didn't send an invalid subtransac= tion id. Ugh, yeah. We should never be using Asserts to validate incoming messages -- a test-and-elog is more appropriate. regards, tom lane