aboutsummaryrefslogtreecommitdiff
path: root/src/include/access/xlog_internal.h
diff options
context:
space:
mode:
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>2014-11-06 13:52:08 +0200
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>2014-11-06 13:55:36 +0200
commit2076db2aea766c4c828dccc34ae35f614129000d (patch)
tree5004b943d2014fdf3c2d4bed820fe550c5013c96 /src/include/access/xlog_internal.h
parentd2b8a2c7ec1098e7b98160ccdc0e3a513964fb08 (diff)
downloadpostgresql-2076db2aea766c4c828dccc34ae35f614129000d.tar.gz
postgresql-2076db2aea766c4c828dccc34ae35f614129000d.zip
Move the backup-block logic from XLogInsert to a new file, xloginsert.c.
xlog.c is huge, this makes it a little bit smaller, which is nice. Functions related to putting together the WAL record are in xloginsert.c, and the lower level stuff for managing WAL buffers and such are in xlog.c. Also move the definition of XLogRecord to a separate header file. This causes churn in the #includes of all the files that write WAL records, and redo routines, but it avoids pulling in xlog.h into most places. Reviewed by Michael Paquier, Alvaro Herrera, Andres Freund and Amit Kapila.
Diffstat (limited to 'src/include/access/xlog_internal.h')
-rw-r--r--src/include/access/xlog_internal.h38
1 files changed, 4 insertions, 34 deletions
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);