Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hFxuA-0000BV-Hv for pgsql-hackers@arkaria.postgresql.org; Mon, 15 Apr 2019 09:27:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hFxu7-0002zC-Ja for pgsql-hackers@arkaria.postgresql.org; Mon, 15 Apr 2019 09:27:55 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hFxu7-0002z5-Aw for pgsql-hackers@lists.postgresql.org; Mon, 15 Apr 2019 09:27:55 +0000 Received: from mx2a.mailbox.org ([2001:67c:2050:104:0:2:25:2] helo=mx2.mailbox.org) by magus.postgresql.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hFxu4-00081a-It for pgsql-hackers@postgresql.org; Mon, 15 Apr 2019 09:27:54 +0000 Received: from smtp1.mailbox.org (smtp1.mailbox.org [IPv6:2001:67c:2050:105:465:1:1:0]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by mx2.mailbox.org (Postfix) with ESMTPS id 4189EA1161; Mon, 15 Apr 2019 11:27:50 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp1.mailbox.org ([80.241.60.240]) by gerste.heinlein-support.de (gerste.heinlein-support.de [91.198.250.173]) (amavisd-new, port 10030) with ESMTP id k0aagdDKhzrl; Mon, 15 Apr 2019 11:27:38 +0200 (CEST) From: Antonin Houska To: Alvaro Herrera cc: pgsql-hackers@postgresql.org Subject: Re: Attempt to consolidate reading of XLOG page In-reply-to: <20190412164656.GA21726@alvherre.pgsql> References: <20190412164656.GA21726@alvherre.pgsql> Comments: In-reply-to Alvaro Herrera message dated "Fri, 12 Apr 2019 12:46:56 -0400." MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <14197.1555320456.1@localhost> Date: Mon, 15 Apr 2019 11:27:36 +0200 Message-ID: <14198.1555320456@localhost> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Alvaro Herrera wrote: > I agree that xlog reading is pretty messy. > > I think ifdef'ing the way XLogRead reports errors is not great. Maybe > we can pass a function pointer that is to be called in case of errors? I'll try a bit harder to evaluate the existing approaches to report the same error on both backend and frontend side. > Not sure about the walsize; maybe it can be a member in XLogReadPos, and > given to XLogReadInitPos()? (Maybe rename XLogReadPos as > XLogReadContext or something like that, indicating it's not just the > read position.) As pointed out by others, XLogReadPos is not necessary. So if XLogRead() receives XLogReaderState instead, it can get the segment size from there. Thanks. -- Antonin Houska Web: https://www.cybertec-postgresql.com