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.96) (envelope-from ) id 1vxpqG-00HBF0-3A for pgsql-hackers@arkaria.postgresql.org; Wed, 04 Mar 2026 17:17:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vxpqF-00DkmV-17 for pgsql-hackers@arkaria.postgresql.org; Wed, 04 Mar 2026 17:16:59 +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.96) (envelope-from ) id 1vxpqF-00Dkm7-04 for pgsql-hackers@lists.postgresql.org; Wed, 04 Mar 2026 17:16:59 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1vxpqD-00000000PG2-3Lan for pgsql-hackers@lists.postgresql.org; Wed, 04 Mar 2026 17:16:58 +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 624HGtBY1531719; Wed, 4 Mar 2026 12:16:55 -0500 From: Tom Lane To: Chao Li cc: pgsql-hackers , Robert Haas Subject: Re: astreamer_lz4: fix bug of output pointer advancement in decompressor In-reply-to: <0594CC79-1544-45DD-8AA4-26270DE777A7@gmail.com> References: <0594CC79-1544-45DD-8AA4-26270DE777A7@gmail.com> Comments: In-reply-to Chao Li message dated "Mon, 02 Mar 2026 17:17:40 +0800" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1531717.1772644615.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Wed, 04 Mar 2026 12:16:55 -0500 Message-ID: <1531718.1772644615@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Chao Li writes: > There have been a couple of LZ4-related patches recently, so I spent som= e time playing with the LZ4 path and found a bug in astreamer_lz4_decompre= ssor_content(). Yup, that's clearly wrong. I failed to reproduce a crash with the test hack you suggested, but no matter. Pushed with some cosmetic editorialization. The track record of all this client-side-compression logic is really quite awful :-(. Another thing that I'm looking askance at is the error handling, or rather lack of it: ret =3D LZ4F_decompress(mystreamer->dctx, next_out, &out_size, next_in, &read_size, NULL); if (LZ4F_isError(ret)) pg_log_error("could not decompress data: %s", LZ4F_getErrorName(ret)); ... continue on our merry way ... I suspect whoever wrote this thought pg_log_error is equivalent to elog(ERROR), but it's not; it just prints a message. It seems highly unlikely to me that continuing onwards will result in a good outcome. I'm a bit inclined to s/pg_log_error/pg_fatal/ throughout these files, at least in places where there's no visible effort to handle the error. regards, tom lane