aboutsummaryrefslogtreecommitdiff
path: root/src/include/access/xlog_internal.h
diff options
context:
space:
mode:
authorJeff Davis <jdavis@postgresql.org>2022-04-06 22:26:43 -0700
committerJeff Davis <jdavis@postgresql.org>2022-04-06 23:06:46 -0700
commit5c279a6d350205cc98f91fb8e1d3e4442a6b25d1 (patch)
tree4165add040730afa0e116ab5be1db5dc6fa93aea /src/include/access/xlog_internal.h
parenta8cfb0c1a964ebbe830c5138d389b0d2627ec298 (diff)
downloadpostgresql-5c279a6d350205cc98f91fb8e1d3e4442a6b25d1.tar.gz
postgresql-5c279a6d350205cc98f91fb8e1d3e4442a6b25d1.zip
Custom WAL Resource Managers.
Allow extensions to specify a new custom resource manager (rmgr), which allows specialized WAL. This is meant to be used by a Table Access Method or Index Access Method. Prior to this commit, only Generic WAL was available, which offers support for recovery and physical replication but not logical replication. Reviewed-by: Julien Rouhaud, Bharath Rupireddy, Andres Freund Discussion: https://postgr.es/m/ed1fb2e22d15d3563ae0eb610f7b61bb15999c0a.camel%40j-davis.com
Diffstat (limited to 'src/include/access/xlog_internal.h')
-rw-r--r--src/include/access/xlog_internal.h23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/include/access/xlog_internal.h b/src/include/access/xlog_internal.h
index b7c375fed1c..f69ea2355da 100644
--- a/src/include/access/xlog_internal.h
+++ b/src/include/access/xlog_internal.h
@@ -304,7 +304,8 @@ struct XLogRecordBuffer;
* rm_mask takes as input a page modified by the resource manager and masks
* out bits that shouldn't be flagged by wal_consistency_checking.
*
- * RmgrTable[] is indexed by RmgrId values (see rmgrlist.h).
+ * RmgrTable[] is indexed by RmgrId values (see rmgrlist.h). If rm_name is
+ * NULL, the corresponding RmgrTable entry is considered invalid.
*/
typedef struct RmgrData
{
@@ -319,7 +320,25 @@ typedef struct RmgrData
struct XLogRecordBuffer *buf);
} RmgrData;
-extern const RmgrData RmgrTable[];
+extern RmgrData RmgrTable[];
+extern void RmgrStartup(void);
+extern void RmgrCleanup(void);
+extern void RmgrNotFound(RmgrId rmid);
+extern void RegisterCustomRmgr(RmgrId rmid, RmgrData *rmgr);
+
+static inline bool
+RmgrIdExists(RmgrId rmid)
+{
+ return RmgrTable[rmid].rm_name != NULL;
+}
+
+static inline RmgrData
+GetRmgr(RmgrId rmid)
+{
+ if (unlikely(!RmgrIdExists(rmid)))
+ RmgrNotFound(rmid);
+ return RmgrTable[rmid];
+}
/*
* Exported to support xlog switching from checkpointer