summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
Diffstat (limited to 'src/include')
-rw-r--r--src/include/access/clog.h3
-rw-r--r--src/include/access/gin.h3
-rw-r--r--src/include/access/gin_private.h1
-rw-r--r--src/include/access/gist_private.h1
-rw-r--r--src/include/access/hash.h3
-rw-r--r--src/include/access/heapam_xlog.h4
-rw-r--r--src/include/access/multixact.h3
-rw-r--r--src/include/access/nbtree.h5
-rw-r--r--src/include/access/spgist.h3
-rw-r--r--src/include/access/spgist_private.h1
-rw-r--r--src/include/access/xact.h4
-rw-r--r--src/include/access/xlog.h112
-rw-r--r--src/include/access/xlog_internal.h38
-rw-r--r--src/include/access/xloginsert.h66
-rw-r--r--src/include/access/xlogrecord.h100
-rw-r--r--src/include/access/xlogutils.h8
-rw-r--r--src/include/catalog/storage_xlog.h3
-rw-r--r--src/include/commands/dbcommands.h3
-rw-r--r--src/include/commands/sequence.h3
-rw-r--r--src/include/commands/tablespace.h3
-rw-r--r--src/include/replication/decode.h1
-rw-r--r--src/include/storage/standby.h3
-rw-r--r--src/include/utils/relmapper.h3
23 files changed, 216 insertions, 158 deletions
diff --git a/src/include/access/clog.h b/src/include/access/clog.h
index 8562631b54f..04ac4ba3119 100644
--- a/src/include/access/clog.h
+++ b/src/include/access/clog.h
@@ -11,7 +11,8 @@
#ifndef CLOG_H
#define CLOG_H
-#include "access/xlog.h"
+#include "access/xlogrecord.h"
+#include "lib/stringinfo.h"
/*
* Possible transaction statuses --- note that all-zeroes is the initial
diff --git a/src/include/access/gin.h b/src/include/access/gin.h
index 0ebecb4140d..80826b843bf 100644
--- a/src/include/access/gin.h
+++ b/src/include/access/gin.h
@@ -10,7 +10,8 @@
#ifndef GIN_H
#define GIN_H
-#include "access/xlog.h"
+#include "access/xlogrecord.h"
+#include "lib/stringinfo.h"
#include "storage/block.h"
#include "utils/relcache.h"
diff --git a/src/include/access/gin_private.h b/src/include/access/gin_private.h
index ab3afb812e0..6a09dc990e4 100644
--- a/src/include/access/gin_private.h
+++ b/src/include/access/gin_private.h
@@ -13,6 +13,7 @@
#include "access/genam.h"
#include "access/gin.h"
#include "access/itup.h"
+#include "access/xloginsert.h"
#include "fmgr.h"
#include "storage/bufmgr.h"
#include "utils/rbtree.h"
diff --git a/src/include/access/gist_private.h b/src/include/access/gist_private.h
index 879f11351b0..21daf3b2b6a 100644
--- a/src/include/access/gist_private.h
+++ b/src/include/access/gist_private.h
@@ -16,6 +16,7 @@
#include "access/gist.h"
#include "access/itup.h"
+#include "access/xlogrecord.h"
#include "fmgr.h"
#include "storage/bufmgr.h"
#include "storage/buffile.h"
diff --git a/src/include/access/hash.h b/src/include/access/hash.h
index a81b9de0e61..c175a5c1822 100644
--- a/src/include/access/hash.h
+++ b/src/include/access/hash.h
@@ -20,8 +20,9 @@
#include "access/genam.h"
#include "access/itup.h"
#include "access/sdir.h"
-#include "access/xlog.h"
+#include "access/xlogrecord.h"
#include "fmgr.h"
+#include "lib/stringinfo.h"
#include "storage/bufmgr.h"
#include "storage/lock.h"
#include "utils/relcache.h"
diff --git a/src/include/access/heapam_xlog.h b/src/include/access/heapam_xlog.h
index 5ac98a5baa6..1d64264b010 100644
--- a/src/include/access/heapam_xlog.h
+++ b/src/include/access/heapam_xlog.h
@@ -15,7 +15,9 @@
#define HEAPAM_XLOG_H
#include "access/htup.h"
-#include "access/xlog.h"
+#include "access/xlogrecord.h"
+#include "lib/stringinfo.h"
+#include "storage/buf.h"
#include "storage/bufpage.h"
#include "storage/relfilenode.h"
#include "utils/relcache.h"
diff --git a/src/include/access/multixact.h b/src/include/access/multixact.h
index b331447ade5..43d737505d2 100644
--- a/src/include/access/multixact.h
+++ b/src/include/access/multixact.h
@@ -11,7 +11,8 @@
#ifndef MULTIXACT_H
#define MULTIXACT_H
-#include "access/xlog.h"
+#include "access/xlogrecord.h"
+#include "lib/stringinfo.h"
/*
diff --git a/src/include/access/nbtree.h b/src/include/access/nbtree.h
index 90fd6d0056a..c8bb3f5d668 100644
--- a/src/include/access/nbtree.h
+++ b/src/include/access/nbtree.h
@@ -17,9 +17,10 @@
#include "access/genam.h"
#include "access/itup.h"
#include "access/sdir.h"
-#include "access/xlog.h"
-#include "access/xlogutils.h"
+#include "access/xlogrecord.h"
#include "catalog/pg_index.h"
+#include "lib/stringinfo.h"
+#include "storage/bufmgr.h"
/* There's room for a 16-bit vacuum cycle ID in BTPageOpaqueData */
typedef uint16 BTCycleId;
diff --git a/src/include/access/spgist.h b/src/include/access/spgist.h
index f218a83224e..ccf1ed77869 100644
--- a/src/include/access/spgist.h
+++ b/src/include/access/spgist.h
@@ -15,8 +15,9 @@
#define SPGIST_H
#include "access/skey.h"
-#include "access/xlog.h"
+#include "access/xlogrecord.h"
#include "fmgr.h"
+#include "lib/stringinfo.h"
/* reloption parameters */
diff --git a/src/include/access/spgist_private.h b/src/include/access/spgist_private.h
index d092029d8a7..3330644651c 100644
--- a/src/include/access/spgist_private.h
+++ b/src/include/access/spgist_private.h
@@ -17,6 +17,7 @@
#include "access/itup.h"
#include "access/spgist.h"
#include "nodes/tidbitmap.h"
+#include "storage/buf.h"
#include "storage/relfilenode.h"
#include "utils/relcache.h"
diff --git a/src/include/access/xact.h b/src/include/access/xact.h
index 45376b47928..11a51b26859 100644
--- a/src/include/access/xact.h
+++ b/src/include/access/xact.h
@@ -14,9 +14,11 @@
#ifndef XACT_H
#define XACT_H
-#include "access/xlog.h"
+#include "access/xlogrecord.h"
+#include "lib/stringinfo.h"
#include "nodes/pg_list.h"
#include "storage/relfilenode.h"
+#include "utils/datetime.h"
/*
diff --git a/src/include/access/xlog.h b/src/include/access/xlog.h
index 0ae110f18b7..6f8b5f46e10 100644
--- a/src/include/access/xlog.h
+++ b/src/include/access/xlog.h
@@ -13,67 +13,11 @@
#include "access/rmgr.h"
#include "access/xlogdefs.h"
+#include "access/xloginsert.h"
+#include "access/xlogrecord.h"
#include "datatype/timestamp.h"
#include "lib/stringinfo.h"
-#include "storage/block.h"
-#include "storage/buf.h"
-#include "storage/relfilenode.h"
-#include "utils/pg_crc.h"
-/*
- * The overall layout of an XLOG record is:
- * Fixed-size header (XLogRecord struct)
- * rmgr-specific data
- * BkpBlock
- * backup block data
- * BkpBlock
- * backup block data
- * ...
- *
- * where there can be zero to four backup blocks (as signaled by xl_info flag
- * bits). XLogRecord structs always start on MAXALIGN boundaries in the WAL
- * files, and we round up SizeOfXLogRecord so that the rmgr data is also
- * guaranteed to begin on a MAXALIGN boundary. However, no padding is added
- * to align BkpBlock structs or backup block data.
- *
- * NOTE: xl_len counts only the rmgr data, not the XLogRecord header,
- * and also not any backup blocks. xl_tot_len counts everything. Neither
- * length field is rounded up to an alignment boundary.
- */
-typedef struct XLogRecord
-{
- uint32 xl_tot_len; /* total len of entire record */
- TransactionId xl_xid; /* xact id */
- uint32 xl_len; /* total len of rmgr data */
- uint8 xl_info; /* flag bits, see below */
- RmgrId xl_rmid; /* resource manager for this record */
- /* 2 bytes of padding here, initialize to zero */
- XLogRecPtr xl_prev; /* ptr to previous record in log */
- pg_crc32 xl_crc; /* CRC for this record */
-
- /* If MAXALIGN==8, there are 4 wasted bytes here */
-
- /* ACTUAL LOG DATA FOLLOWS AT END OF STRUCT */
-
-} XLogRecord;
-
-#define SizeOfXLogRecord MAXALIGN(sizeof(XLogRecord))
-
-#define XLogRecGetData(record) ((char*) (record) + SizeOfXLogRecord)
-
-/*
- * XLOG uses only low 4 bits of xl_info. High 4 bits may be used by rmgr.
- */
-#define XLR_INFO_MASK 0x0F
-
-/*
- * If we backed up any disk blocks with the XLOG record, we use flag bits in
- * xl_info to signal it. We support backup of up to 4 disk blocks per XLOG
- * record.
- */
-#define XLR_BKP_BLOCK_MASK 0x0F /* all info bits used for bkp blocks */
-#define XLR_MAX_BKP_BLOCKS 4
-#define XLR_BKP_BLOCK(iblk) (0x08 >> (iblk)) /* iblk in 0..3 */
/* Sync methods */
#define SYNC_METHOD_FSYNC 0
@@ -83,45 +27,6 @@ typedef struct XLogRecord
#define SYNC_METHOD_OPEN_DSYNC 4 /* for O_DSYNC */
extern int sync_method;
-/*
- * The rmgr data to be written by XLogInsert() is defined by a chain of
- * one or more XLogRecData structs. (Multiple structs would be used when
- * parts of the source data aren't physically adjacent in memory, or when
- * multiple associated buffers need to be specified.)
- *
- * If buffer is valid then XLOG will check if buffer must be backed up
- * (ie, whether this is first change of that page since last checkpoint).
- * If so, the whole page contents are attached to the XLOG record, and XLOG
- * sets XLR_BKP_BLOCK(N) bit in xl_info. Note that the buffer must be pinned
- * and exclusive-locked by the caller, so that it won't change under us.
- * NB: when the buffer is backed up, we DO NOT insert the data pointed to by
- * this XLogRecData struct into the XLOG record, since we assume it's present
- * in the buffer. Therefore, rmgr redo routines MUST pay attention to
- * XLR_BKP_BLOCK(N) to know what is actually stored in the XLOG record.
- * The N'th XLR_BKP_BLOCK bit corresponds to the N'th distinct buffer
- * value (ignoring InvalidBuffer) appearing in the rdata chain.
- *
- * When buffer is valid, caller must set buffer_std to indicate whether the
- * page uses standard pd_lower/pd_upper header fields. If this is true, then
- * XLOG is allowed to omit the free space between pd_lower and pd_upper from
- * the backed-up page image. Note that even when buffer_std is false, the
- * page MUST have an LSN field as its first eight bytes!
- *
- * Note: data can be NULL to indicate no rmgr data associated with this chain
- * entry. This can be sensible (ie, not a wasted entry) if buffer is valid.
- * The implication is that the buffer has been changed by the operation being
- * logged, and so may need to be backed up, but the change can be redone using
- * only information already present elsewhere in the XLOG entry.
- */
-typedef struct XLogRecData
-{
- char *data; /* start of rmgr data to include */
- uint32 len; /* length of rmgr data to include */
- Buffer buffer; /* buffer associated with data, if any */
- bool buffer_std; /* buffer has standard pd_lower/pd_upper */
- struct XLogRecData *next; /* next struct in chain, or NULL */
-} XLogRecData;
-
extern PGDLLIMPORT TimeLineID ThisTimeLineID; /* current TLI */
/*
@@ -281,28 +186,18 @@ typedef struct CheckpointStatsData
extern CheckpointStatsData CheckpointStats;
-extern XLogRecPtr XLogInsert(RmgrId rmid, uint8 info, XLogRecData *rdata);
-extern bool XLogCheckBufferNeedsBackup(Buffer buffer);
+extern XLogRecPtr XLogInsertRecord(XLogRecData *rdata, XLogRecPtr fpw_lsn);
extern void XLogFlush(XLogRecPtr RecPtr);
extern bool XLogBackgroundFlush(void);
extern bool XLogNeedsFlush(XLogRecPtr RecPtr);
extern int XLogFileInit(XLogSegNo segno, bool *use_existent, bool use_lock);
extern int XLogFileOpen(XLogSegNo segno);
-extern XLogRecPtr log_newpage(RelFileNode *rnode, ForkNumber forkNum,
- BlockNumber blk, char *page, bool page_std);
-extern XLogRecPtr log_newpage_buffer(Buffer buffer, bool page_std);
-extern XLogRecPtr XLogSaveBufferForHint(Buffer buffer, bool buffer_std);
-
extern void CheckXLogRemoved(XLogSegNo segno, TimeLineID tli);
extern XLogSegNo XLogGetLastRemovedSegno(void);
extern void XLogSetAsyncXactLSN(XLogRecPtr record);
extern void XLogSetReplicationSlotMinimumLSN(XLogRecPtr lsn);
-extern Buffer RestoreBackupBlock(XLogRecPtr lsn, XLogRecord *record,
- int block_index,
- bool get_cleanup_lock, bool keep_buffer);
-
extern void xlog_redo(XLogRecPtr lsn, XLogRecord *record);
extern void xlog_desc(StringInfo buf, XLogRecord *record);
extern const char *xlog_identify(uint8 info);
@@ -338,6 +233,7 @@ extern bool CreateRestartPoint(int flags);
extern void XLogPutNextOid(Oid nextOid);
extern XLogRecPtr XLogRestorePoint(const char *rpName);
extern void UpdateFullPageWrites(void);
+extern void GetFullPageWriteInfo(XLogRecPtr *RedoRecPtr_p, bool *doPageWrites_p);
extern XLogRecPtr GetRedoRecPtr(void);
extern XLogRecPtr GetInsertRecPtr(void);
extern XLogRecPtr GetFlushRecPtr(void);
diff --git a/src/include/access/xlog_internal.h b/src/include/access/xlog_internal.h
index eaa1f9540e2..19b2ef8d90d 100644
--- a/src/include/access/xlog_internal.h
+++ b/src/include/access/xlog_internal.h
@@ -6,7 +6,7 @@
* NOTE: this file is intended to contain declarations useful for
* manipulating the XLOG files directly, but it is not supposed to be
* needed by rmgr routines (redo support for individual record types).
- * So the XLogRecord typedef and associated stuff appear in xlog.h.
+ * So the XLogRecord typedef and associated stuff appear in xlogrecord.h.
*
* Note: This file must be includable in both frontend and backend contexts,
* to allow stand-alone tools like pg_receivexlog to deal with WAL files.
@@ -20,6 +20,7 @@
#define XLOG_INTERNAL_H
#include "access/xlogdefs.h"
+#include "access/xlogrecord.h"
#include "datatype/timestamp.h"
#include "lib/stringinfo.h"
#include "pgtime.h"
@@ -28,31 +29,6 @@
/*
- * Header info for a backup block appended to an XLOG record.
- *
- * As a trivial form of data compression, the XLOG code is aware that
- * PG data pages usually contain an unused "hole" in the middle, which
- * contains only zero bytes. If hole_length > 0 then we have removed
- * such a "hole" from the stored data (and it's not counted in the
- * XLOG record's CRC, either). Hence, the amount of block data actually
- * present following the BkpBlock struct is BLCKSZ - hole_length bytes.
- *
- * Note that we don't attempt to align either the BkpBlock struct or the
- * block's data. So, the struct must be copied to aligned local storage
- * before use.
- */
-typedef struct BkpBlock
-{
- RelFileNode node; /* relation containing block */
- ForkNumber fork; /* fork within the relation */
- BlockNumber block; /* block number */
- uint16 hole_offset; /* number of bytes before "hole" */
- uint16 hole_length; /* number of bytes in "hole" */
-
- /* ACTUAL BLOCK DATA FOLLOWS AT END OF STRUCT */
-} BkpBlock;
-
-/*
* Each page of XLOG file has a header like this:
*/
#define XLOG_PAGE_MAGIC 0xD080 /* can be used as WAL version indicator */
@@ -228,12 +204,6 @@ typedef struct xl_end_of_recovery
} xl_end_of_recovery;
/*
- * XLogRecord is defined in xlog.h, but we avoid #including that to keep
- * this file includable in stand-alone programs.
- */
-struct XLogRecord;
-
-/*
* Method table for resource managers.
*
* This struct must be kept in sync with the PG_RMGR definition in
@@ -249,8 +219,8 @@ struct XLogRecord;
typedef struct RmgrData
{
const char *rm_name;
- void (*rm_redo) (XLogRecPtr lsn, struct XLogRecord *rptr);
- void (*rm_desc) (StringInfo buf, struct XLogRecord *rptr);
+ void (*rm_redo) (XLogRecPtr lsn, XLogRecord *rptr);
+ void (*rm_desc) (StringInfo buf, XLogRecord *rptr);
const char *(*rm_identify) (uint8 info);
void (*rm_startup) (void);
void (*rm_cleanup) (void);
diff --git a/src/include/access/xloginsert.h b/src/include/access/xloginsert.h
new file mode 100644
index 00000000000..30c2e84cbc9
--- /dev/null
+++ b/src/include/access/xloginsert.h
@@ -0,0 +1,66 @@
+/*
+ * xloginsert.h
+ *
+ * Functions for generating WAL records
+ *
+ * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/access/xloginsert.h
+ */
+#ifndef XLOGINSERT_H
+#define XLOGINSERT_H
+
+#include "access/rmgr.h"
+#include "access/xlogdefs.h"
+#include "storage/block.h"
+#include "storage/buf.h"
+#include "storage/relfilenode.h"
+
+/*
+ * The rmgr data to be written by XLogInsert() is defined by a chain of
+ * one or more XLogRecData structs. (Multiple structs would be used when
+ * parts of the source data aren't physically adjacent in memory, or when
+ * multiple associated buffers need to be specified.)
+ *
+ * If buffer is valid then XLOG will check if buffer must be backed up
+ * (ie, whether this is first change of that page since last checkpoint).
+ * If so, the whole page contents are attached to the XLOG record, and XLOG
+ * sets XLR_BKP_BLOCK(N) bit in xl_info. Note that the buffer must be pinned
+ * and exclusive-locked by the caller, so that it won't change under us.
+ * NB: when the buffer is backed up, we DO NOT insert the data pointed to by
+ * this XLogRecData struct into the XLOG record, since we assume it's present
+ * in the buffer. Therefore, rmgr redo routines MUST pay attention to
+ * XLR_BKP_BLOCK(N) to know what is actually stored in the XLOG record.
+ * The N'th XLR_BKP_BLOCK bit corresponds to the N'th distinct buffer
+ * value (ignoring InvalidBuffer) appearing in the rdata chain.
+ *
+ * When buffer is valid, caller must set buffer_std to indicate whether the
+ * page uses standard pd_lower/pd_upper header fields. If this is true, then
+ * XLOG is allowed to omit the free space between pd_lower and pd_upper from
+ * the backed-up page image. Note that even when buffer_std is false, the
+ * page MUST have an LSN field as its first eight bytes!
+ *
+ * Note: data can be NULL to indicate no rmgr data associated with this chain
+ * entry. This can be sensible (ie, not a wasted entry) if buffer is valid.
+ * The implication is that the buffer has been changed by the operation being
+ * logged, and so may need to be backed up, but the change can be redone using
+ * only information already present elsewhere in the XLOG entry.
+ */
+typedef struct XLogRecData
+{
+ char *data; /* start of rmgr data to include */
+ uint32 len; /* length of rmgr data to include */
+ Buffer buffer; /* buffer associated with data, if any */
+ bool buffer_std; /* buffer has standard pd_lower/pd_upper */
+ struct XLogRecData *next; /* next struct in chain, or NULL */
+} XLogRecData;
+
+extern XLogRecPtr XLogInsert(RmgrId rmid, uint8 info, XLogRecData *rdata);
+extern XLogRecPtr log_newpage(RelFileNode *rnode, ForkNumber forkNum,
+ BlockNumber blk, char *page, bool page_std);
+extern XLogRecPtr log_newpage_buffer(Buffer buffer, bool page_std);
+extern XLogRecPtr XLogSaveBufferForHint(Buffer buffer, bool buffer_std);
+extern bool XLogCheckBufferNeedsBackup(Buffer buffer);
+
+#endif /* XLOGINSERT_H */
diff --git a/src/include/access/xlogrecord.h b/src/include/access/xlogrecord.h
new file mode 100644
index 00000000000..ab0fb1c5004
--- /dev/null
+++ b/src/include/access/xlogrecord.h
@@ -0,0 +1,100 @@
+/*
+ * xlogrecord.h
+ *
+ * Definitions for the WAL record format.
+ *
+ * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/access/xlogrecord.h
+ */
+#ifndef XLOGRECORD_H
+#define XLOGRECORD_H
+
+#include "access/rmgr.h"
+#include "access/xlogdefs.h"
+#include "storage/block.h"
+#include "storage/relfilenode.h"
+#include "utils/pg_crc.h"
+
+/*
+ * The overall layout of an XLOG record is:
+ * Fixed-size header (XLogRecord struct)
+ * rmgr-specific data
+ * BkpBlock
+ * backup block data
+ * BkpBlock
+ * backup block data
+ * ...
+ *
+ * where there can be zero to four backup blocks (as signaled by xl_info flag
+ * bits). XLogRecord structs always start on MAXALIGN boundaries in the WAL
+ * files, and we round up SizeOfXLogRecord so that the rmgr data is also
+ * guaranteed to begin on a MAXALIGN boundary. However, no padding is added
+ * to align BkpBlock structs or backup block data.
+ *
+ * NOTE: xl_len counts only the rmgr data, not the XLogRecord header,
+ * and also not any backup blocks. xl_tot_len counts everything. Neither
+ * length field is rounded up to an alignment boundary.
+ */
+typedef struct XLogRecord
+{
+ uint32 xl_tot_len; /* total len of entire record */
+ TransactionId xl_xid; /* xact id */
+ uint32 xl_len; /* total len of rmgr data */
+ uint8 xl_info; /* flag bits, see below */
+ RmgrId xl_rmid; /* resource manager for this record */
+ /* 2 bytes of padding here, initialize to zero */
+ XLogRecPtr xl_prev; /* ptr to previous record in log */
+ pg_crc32 xl_crc; /* CRC for this record */
+
+ /* If MAXALIGN==8, there are 4 wasted bytes here */
+
+ /* ACTUAL LOG DATA FOLLOWS AT END OF STRUCT */
+
+} XLogRecord;
+
+#define SizeOfXLogRecord MAXALIGN(sizeof(XLogRecord))
+
+#define XLogRecGetData(record) ((char*) (record) + SizeOfXLogRecord)
+
+/*
+ * XLOG uses only low 4 bits of xl_info. High 4 bits may be used by rmgr.
+ */
+#define XLR_INFO_MASK 0x0F
+
+/*
+ * If we backed up any disk blocks with the XLOG record, we use flag bits in
+ * xl_info to signal it. We support backup of up to 4 disk blocks per XLOG
+ * record.
+ */
+#define XLR_BKP_BLOCK_MASK 0x0F /* all info bits used for bkp blocks */
+#define XLR_MAX_BKP_BLOCKS 4
+#define XLR_BKP_BLOCK(iblk) (0x08 >> (iblk)) /* iblk in 0..3 */
+
+/*
+ * Header info for a backup block appended to an XLOG record.
+ *
+ * As a trivial form of data compression, the XLOG code is aware that
+ * PG data pages usually contain an unused "hole" in the middle, which
+ * contains only zero bytes. If hole_length > 0 then we have removed
+ * such a "hole" from the stored data (and it's not counted in the
+ * XLOG record's CRC, either). Hence, the amount of block data actually
+ * present following the BkpBlock struct is BLCKSZ - hole_length bytes.
+ *
+ * Note that we don't attempt to align either the BkpBlock struct or the
+ * block's data. So, the struct must be copied to aligned local storage
+ * before use.
+ */
+typedef struct BkpBlock
+{
+ RelFileNode node; /* relation containing block */
+ ForkNumber fork; /* fork within the relation */
+ BlockNumber block; /* block number */
+ uint16 hole_offset; /* number of bytes before "hole" */
+ uint16 hole_length; /* number of bytes in "hole" */
+
+ /* ACTUAL BLOCK DATA FOLLOWS AT END OF STRUCT */
+} BkpBlock;
+
+#endif /* XLOGRECORD_H */
diff --git a/src/include/access/xlogutils.h b/src/include/access/xlogutils.h
index ad579083ab8..8d906967232 100644
--- a/src/include/access/xlogutils.h
+++ b/src/include/access/xlogutils.h
@@ -11,7 +11,7 @@
#ifndef XLOG_UTILS_H
#define XLOG_UTILS_H
-#include "access/xlog.h"
+#include "access/xlogrecord.h"
#include "storage/bufmgr.h"
@@ -47,6 +47,12 @@ extern Buffer XLogReadBuffer(RelFileNode rnode, BlockNumber blkno, bool init);
extern Buffer XLogReadBufferExtended(RelFileNode rnode, ForkNumber forknum,
BlockNumber blkno, ReadBufferMode mode);
+extern Buffer RestoreBackupBlock(XLogRecPtr lsn, XLogRecord *record,
+ int block_index,
+ bool get_cleanup_lock, bool keep_buffer);
+extern Buffer RestoreBackupBlockContents(XLogRecPtr lsn, BkpBlock bkpb,
+ char *blk, bool get_cleanup_lock, bool keep_buffer);
+
extern Relation CreateFakeRelcacheEntry(RelFileNode rnode);
extern void FreeFakeRelcacheEntry(Relation fakerel);
diff --git a/src/include/catalog/storage_xlog.h b/src/include/catalog/storage_xlog.h
index 5fc72358284..6c687e3a827 100644
--- a/src/include/catalog/storage_xlog.h
+++ b/src/include/catalog/storage_xlog.h
@@ -14,7 +14,8 @@
#ifndef STORAGE_XLOG_H
#define STORAGE_XLOG_H
-#include "access/xlog.h"
+#include "access/xlogrecord.h"
+#include "lib/stringinfo.h"
#include "storage/block.h"
#include "storage/relfilenode.h"
diff --git a/src/include/commands/dbcommands.h b/src/include/commands/dbcommands.h
index 811713fb83e..b79d9fc8648 100644
--- a/src/include/commands/dbcommands.h
+++ b/src/include/commands/dbcommands.h
@@ -14,7 +14,8 @@
#ifndef DBCOMMANDS_H
#define DBCOMMANDS_H
-#include "access/xlog.h"
+#include "access/xlogrecord.h"
+#include "lib/stringinfo.h"
#include "nodes/parsenodes.h"
/* XLOG stuff */
diff --git a/src/include/commands/sequence.h b/src/include/commands/sequence.h
index 914d155c9f1..7cbe6f9a819 100644
--- a/src/include/commands/sequence.h
+++ b/src/include/commands/sequence.h
@@ -13,8 +13,9 @@
#ifndef SEQUENCE_H
#define SEQUENCE_H
-#include "access/xlog.h"
+#include "access/xlogrecord.h"
#include "fmgr.h"
+#include "lib/stringinfo.h"
#include "nodes/parsenodes.h"
#include "storage/relfilenode.h"
diff --git a/src/include/commands/tablespace.h b/src/include/commands/tablespace.h
index 0f16f40e3df..afd9e05cb78 100644
--- a/src/include/commands/tablespace.h
+++ b/src/include/commands/tablespace.h
@@ -14,7 +14,8 @@
#ifndef TABLESPACE_H
#define TABLESPACE_H
-#include "access/xlog.h"
+#include "access/xlogrecord.h"
+#include "lib/stringinfo.h"
#include "nodes/parsenodes.h"
/* XLOG stuff */
diff --git a/src/include/replication/decode.h b/src/include/replication/decode.h
index d9e30776af0..e4185287a1c 100644
--- a/src/include/replication/decode.h
+++ b/src/include/replication/decode.h
@@ -10,6 +10,7 @@
#define DECODE_H
#include "access/xlogreader.h"
+#include "access/xlogrecord.h"
#include "replication/reorderbuffer.h"
#include "replication/logical.h"
diff --git a/src/include/storage/standby.h b/src/include/storage/standby.h
index 1c63af521fe..c89989fd201 100644
--- a/src/include/storage/standby.h
+++ b/src/include/storage/standby.h
@@ -14,7 +14,8 @@
#ifndef STANDBY_H
#define STANDBY_H
-#include "access/xlog.h"
+#include "access/xlogrecord.h"
+#include "lib/stringinfo.h"
#include "storage/lock.h"
#include "storage/procsignal.h"
#include "storage/relfilenode.h"
diff --git a/src/include/utils/relmapper.h b/src/include/utils/relmapper.h
index 37937ddab82..bd5836b0d98 100644
--- a/src/include/utils/relmapper.h
+++ b/src/include/utils/relmapper.h
@@ -14,7 +14,8 @@
#ifndef RELMAPPER_H
#define RELMAPPER_H
-#include "access/xlog.h"
+#include "access/xlogrecord.h"
+#include "lib/stringinfo.h"
/* ----------------
* relmap-related XLOG entries