agora inbox for pgsql-hackers@postgresql.org  
help / color / mirror / Atom feed
From: Antonin Houska <ah@cybertec.at>
To: Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp>
Cc: pgsql-hackers@postgresql.org
Subject: Re: Remove page-read callback from XLogReaderState.
Date: Wed, 22 May 2019 13:53:23 +0200
Message-ID: <25494.1558526003@spoje.net> (raw)
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>

Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp> 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

Attachments:

  [text/x-diff] xlr_comment_fix.patch (568B, ../25494.1558526003@spoje.net/2-xlr_comment_fix.patch)
  download | inline diff:
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 */
 

view thread (58+ messages)  latest in thread

Message-ID: <25494.1558526003@spoje.net>
Permalink:  ../25494.1558526003@spoje.net/
Also on:    postgresql.org/message-id/25494.1558526003@spoje.net

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: ah@cybertec.at, horiguchi.kyotaro@lab.ntt.co.jp
  Subject: Re: Remove page-read callback from XLogReaderState.
  In-Reply-To: <25494.1558526003@spoje.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox