From 465883b0a2b4236ba6b31b648a9eabef3b7cdddb Mon Sep 17 00:00:00 2001 From: Simon Riggs Date: Tue, 28 Jun 2011 22:58:17 +0100 Subject: Introduce compact WAL record for the common case of commit (non-DDL). XLOG_XACT_COMMIT_COMPACT leaves out invalidation messages and relfilenodes, saving considerable space for the vast majority of transaction commits. XLOG_XACT_COMMIT keeps same definition as XLOG_PAGE_MAGIC 0xD067 and earlier. Leonardo Francalanci and Simon Riggs --- src/include/access/xact.h | 15 +++++++++++++-- src/include/access/xlog_internal.h | 2 +- 2 files changed, 14 insertions(+), 3 deletions(-) (limited to 'src/include/access') diff --git a/src/include/access/xact.h b/src/include/access/xact.h index cb440d41f1..c585752b00 100644 --- a/src/include/access/xact.h +++ b/src/include/access/xact.h @@ -106,6 +106,7 @@ typedef void (*SubXactCallback) (SubXactEvent event, SubTransactionId mySubid, #define XLOG_XACT_COMMIT_PREPARED 0x30 #define XLOG_XACT_ABORT_PREPARED 0x40 #define XLOG_XACT_ASSIGNMENT 0x50 +#define XLOG_XACT_COMMIT_COMPACT 0x60 typedef struct xl_xact_assignment { @@ -116,6 +117,16 @@ typedef struct xl_xact_assignment #define MinSizeOfXactAssignment offsetof(xl_xact_assignment, xsub) +typedef struct xl_xact_commit_compact +{ + TimestampTz xact_time; /* time of commit */ + int nsubxacts; /* number of subtransaction XIDs */ + /* ARRAY OF COMMITTED SUBTRANSACTION XIDs FOLLOWS */ + TransactionId subxacts[1]; /* VARIABLE LENGTH ARRAY */ +} xl_xact_commit_compact; + +#define MinSizeOfXactCommitCompact offsetof(xl_xact_commit_compact, subxacts) + typedef struct xl_xact_commit { TimestampTz xact_time; /* time of commit */ @@ -145,8 +156,8 @@ typedef struct xl_xact_commit #define XACT_COMPLETION_FORCE_SYNC_COMMIT 0x02 /* Access macros for above flags */ -#define XactCompletionRelcacheInitFileInval(xlrec) ((xlrec)->xinfo & XACT_COMPLETION_UPDATE_RELCACHE_FILE) -#define XactCompletionForceSyncCommit(xlrec) ((xlrec)->xinfo & XACT_COMPLETION_FORCE_SYNC_COMMIT) +#define XactCompletionRelcacheInitFileInval(xinfo) (xinfo & XACT_COMPLETION_UPDATE_RELCACHE_FILE) +#define XactCompletionForceSyncCommit(xinfo) (xinfo & XACT_COMPLETION_FORCE_SYNC_COMMIT) typedef struct xl_xact_abort { diff --git a/src/include/access/xlog_internal.h b/src/include/access/xlog_internal.h index 34316fffeb..4eaa243948 100644 --- a/src/include/access/xlog_internal.h +++ b/src/include/access/xlog_internal.h @@ -71,7 +71,7 @@ typedef struct XLogContRecord /* * Each page of XLOG file has a header like this: */ -#define XLOG_PAGE_MAGIC 0xD067 /* can be used as WAL version indicator */ +#define XLOG_PAGE_MAGIC 0xD068 /* can be used as WAL version indicator */ typedef struct XLogPageHeaderData { -- cgit v1.2.1