mirror of
https://github.com/postgres/postgres.git
synced 2025-11-09 06:21:09 +03:00
Rework WAL-reading supporting structs
The state-tracking of WAL reading in various places was pretty messy, mostly because the ancient physical-replication WAL reading code wasn't using the XLogReader abstraction. This led to some untidy code. Make it prettier by creating two additional supporting structs, WALSegmentContext and WALOpenSegment which keep track of WAL-reading state. This makes code cleaner, as well as supports more future cleanup. Author: Antonin Houska Reviewed-by: Álvaro Herrera and (older versions) Robert Haas Discussion: https://postgr.es/m/14984.1554998742@spoje.net
This commit is contained in:
@@ -1377,7 +1377,6 @@ ParsePrepareRecord(uint8 info, char *xlrec, xl_xact_parsed_prepare *parsed)
|
||||
*
|
||||
* Note clearly that this function can access WAL during normal operation,
|
||||
* similarly to the way WALSender or Logical Decoding would do.
|
||||
*
|
||||
*/
|
||||
static void
|
||||
XlogReadTwoPhaseData(XLogRecPtr lsn, char **buf, int *len)
|
||||
@@ -1386,8 +1385,8 @@ XlogReadTwoPhaseData(XLogRecPtr lsn, char **buf, int *len)
|
||||
XLogReaderState *xlogreader;
|
||||
char *errormsg;
|
||||
|
||||
xlogreader = XLogReaderAllocate(wal_segment_size, &read_local_xlog_page,
|
||||
NULL);
|
||||
xlogreader = XLogReaderAllocate(wal_segment_size, NULL,
|
||||
&read_local_xlog_page, NULL);
|
||||
if (!xlogreader)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_OUT_OF_MEMORY),
|
||||
|
||||
Reference in New Issue
Block a user