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 1lK6MO-0004IP-6C for pgsql-hackers@arkaria.postgresql.org; Wed, 10 Mar 2021 21:27:16 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lK6ML-0001uX-15 for pgsql-hackers@arkaria.postgresql.org; Wed, 10 Mar 2021 21:27:13 +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 1lK6MK-0001uP-3v for pgsql-hackers@lists.postgresql.org; Wed, 10 Mar 2021 21:27:12 +0000 Received: from [64.147.123.19] (helo=wout3-smtp.messagingengine.com) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lK6MH-0000yC-0L for pgsql-hackers@lists.postgresql.org; Wed, 10 Mar 2021 21:27:11 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.west.internal (Postfix) with ESMTP id 2D4AC30D5; Wed, 10 Mar 2021 16:26:56 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Wed, 10 Mar 2021 16:26:56 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=PNr/RVUSGIDsR8L0WrtfThtd3sOpTq72Bnih94cbvpI=; b=VHOIpKOi 6lk2z+lwF9COrtxj4qfiJe/xyhNJoVK7nqoN6GlTi6tB9IwYOwU2waphW9GNX9CP Bo1xCNo63PxxAOGxf1mSJ3+dbxIyToPVoE3L6oKmgW3HVe8vQ4C8+VnY26etVG/H y9lZRITgogqqm6lvWhyZjl30yXGv4YALsB5QMiz+mavWYU+ZycELem+EBkuOGgrf LFtPJVghNHWLJfXxBZorTOs1HCyByroNXbECd52BsYUmHntkNxHsFl+B5NCRynnu Zd+7z1vrWfb008HPYmfYHBM4xYR5APII4PxJGkh1pKUKpZ+ax2gEBt0BMW25c8u7 cJPHRtKkQJSM2A== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledruddukedgudeglecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecuogetfedtledqtdduucdlvddtmdenucfjughrpe ffhffvuffkgggtugfgjggfsehtkeertddtredunecuhfhrohhmpedfkdgrlhhvhhgvrhhr vgesrghlvhhhrdhnohdqihhprdhorhhgkddfuceorghlvhhhvghrrhgvsegrlhhvhhdrnh hoqdhiphdrohhrgheqnecuggftrfgrthhtvghrnhepheekgeeivdeuffelhedtueffteej jedtteetueekuddvgeduiefhfeffvefftddunecukfhppeduledtrdelhedrudelrdelhe enucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrlhhv hhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorhhg X-ME-Proxy: Received: from perhan.alvh.no-ip.org (unknown [190.95.19.95]) by mail.messagingengine.com (Postfix) with ESMTPA id BED991080054; Wed, 10 Mar 2021 16:26:54 -0500 (EST) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 0FB3A2A0914; Wed, 10 Mar 2021 18:26:52 -0300 (-03) Date: Wed, 10 Mar 2021 18:26:52 -0300 From: "'alvherre@alvh.no-ip.org'" To: Tom Lane Cc: "iwata.aya@fujitsu.com" , "tsunakawa.takay@fujitsu.com" , "k.jamison@fujitsu.com" , 'Kyotaro Horiguchi' , "pgsql-hackers@lists.postgresql.org" Subject: Re: libpq debug log Message-ID: <20210310212652.GA3207@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <2189612.1615406615@sss.pgh.pa.us> User-Agent: Mutt/1.10.1 (2018-07-13) X-Host-Lookup-Failed: Reverse DNS lookup failed for 64.147.123.19 (deferred) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2021-Mar-10, Tom Lane wrote: > "'alvherre@alvh.no-ip.org'" writes: > > After staring at it a couple of times, I think that the places in > > pqParseInput3() where there's a comment "... moves inStart itself" and > > then "continue;" should have a call to pqTraceOutputMsg(), since AFAIU > > those are the places where the message in question would not reach the > > "Successfully consumed this message" block that prints each message. > > Yeah, the whole business of just when a message has been "consumed" > is a stumbling block for libpq tracing. It was a real mess with the > existing code and v2 protocol, because we could actually try to parse > a message more than once, with the first few tries deciding that the > message wasn't all here yet (but nonetheless emitting partial trace > output). Hmm, that makes sense, but the issue I'm reporting is not the same, unless I misunderstand you. > Now that v2 is dead, the logic to abort because of the message not > being all arrived yet is basically useless: only the little bit of > code concerned with the message length word really needs to cope with > that. It's tempting to go through and get rid of all the now-unreachable > "return"s and such, but it seemed like it would be a lot of code churn for > not really that much gain. That sounds like an interesting exercise, and I bet it'd bring a lot of code readability improvements. > I didn't look at the new version of the patch yet, so I'm not > sure whether the issues it still has are related to this. The issues I noticed are related to separate messages rather than one message split in pieces -- for example several DataRow messages are processed internally in a loop, rather than each individually. The number of places that need to be adjusted for things to AFAICT work correctly are few enough; ISTM that the attached patch is sufficient. (The business with the "logged" boolean is necessary so that we print to the trace file any of those messages even if they are deviating from the protocol.) -- Álvaro Herrera Valdivia, Chile "La experiencia nos dice que el hombre peló millones de veces las patatas, pero era forzoso admitir la posibilidad de que en un caso entre millones, las patatas pelarían al hombre" (Ijon Tichy)