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 1hTPpS-00056B-To for pgsql-hackers@arkaria.postgresql.org; Wed, 22 May 2019 11:54:43 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hTPpQ-0003ui-0a for pgsql-hackers@arkaria.postgresql.org; Wed, 22 May 2019 11:54:40 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hTPpP-0003ub-DY for pgsql-hackers@lists.postgresql.org; Wed, 22 May 2019 11:54:39 +0000 Received: from mx2a.mailbox.org ([2001:67c:2050:104:0:2:25:2] helo=mx2.mailbox.org) by makus.postgresql.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hTPpH-00047K-KS for pgsql-hackers@postgresql.org; Wed, 22 May 2019 11:54:37 +0000 Received: from smtp2.mailbox.org (smtp2.mailbox.org [IPv6:2001:67c:2050:105:465:1:2: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 37706A277F; Wed, 22 May 2019 13:54:22 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp2.mailbox.org ([80.241.60.241]) by spamfilter06.heinlein-hosting.de (spamfilter06.heinlein-hosting.de [80.241.56.125]) (amavisd-new, port 10030) with ESMTP id DoxsCoS17krb; Wed, 22 May 2019 13:54:03 +0200 (CEST) From: Antonin Houska To: Kyotaro HORIGUCHI cc: pgsql-hackers@postgresql.org Subject: Re: Remove page-read callback from XLogReaderState. In-reply-to: <20190426.174034.203489629.horiguchi.kyotaro@lab.ntt.co.jp> References: <20190418.210257.43726183.horiguchi.kyotaro@lab.ntt.co.jp> <18581.1556193500@localhost> <20190426.174034.203489629.horiguchi.kyotaro@lab.ntt.co.jp> Comments: In-reply-to Kyotaro HORIGUCHI message dated "Fri, 26 Apr 2019 17:40:34 +0900." MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Date: Wed, 22 May 2019 13:53:23 +0200 Message-ID: <25494.1558526003@spoje.net> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --=-=-= Content-Type: text/plain Kyotaro HORIGUCHI wrote: > Hello. Thank you for looking this. > ... > Yeah, I'll register this, maybe the week after next week. I've checked the new version. One more thing I noticed now is that XLR_STATE.j is initialized to zero, either by XLogReaderAllocate() which zeroes the whole reader state, or later by XLREAD_RESET. This special value then needs to be handled here: #define XLR_SWITCH() \ do { \ if ((XLR_STATE).j) \ goto *((void *) (XLR_STATE).j); \ XLR_CASE(XLR_INIT_STATE); \ } while (0) I think it's better to set the label always to (&&XLR_INIT_STATE) so that XLR_SWITCH can perform the jump unconditionally. Attached is also an (unrelated) comment fix proposal. -- Antonin Houska Web: https://www.cybertec-postgresql.com --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=xlr_comment_fix.patch diff --git a/src/include/access/xlogreader.h b/src/include/access/xlogreader.h index 262bf0e77f..cb864a86d8 100644 --- a/src/include/access/xlogreader.h +++ b/src/include/access/xlogreader.h @@ -124,7 +124,7 @@ struct XLogReaderState XLogRecPtr currRecPtr; /* beginning of the WAL record being read */ /* return from page reader */ - int32 readLen; /* bytes acutually read, must be larger than + int32 readLen; /* bytes acutually read, must be at least * loadLen. -1 on error. */ TimeLineID readPageTLI; /* TLI for data currently in readBuf */ --=-=-=--