Kyotaro HORIGUCHI <[email protected]> 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
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 */