45#if PG_VERSION_NUM >= 150000 && !defined(PROVSQL_INPROCESS_STORE)
47#include "access/xlog.h"
48#include "access/xlog_internal.h"
49#include "access/xloginsert.h"
50#include "access/xlogreader.h"
51#include "access/xlogrecord.h"
53#include "utils/builtins.h"
64static bool in_redo =
false;
79#define RM_PROVSQL_ID 151
86#define XLOG_PROVSQL_STORE 0x10
88static void provsql_rmgr_redo(XLogReaderState *record)
90 uint8 info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
92 if(info != XLOG_PROVSQL_STORE)
93 provsql_error(
"provsql resource manager: unexpected record info %u", info);
99 XLogRecGetDataLen(record));
110static void provsql_rmgr_desc(StringInfo buf, XLogReaderState *record)
112 const char *data = XLogRecGetData(record);
113 uint32 len = XLogRecGetDataLen(record);
116 appendStringInfo(buf,
"opcode %c, %u bytes", data[0], len);
118 appendStringInfoString(buf,
"empty");
121static const char *provsql_rmgr_identify(uint8 info)
123 if((info & ~XLR_INFO_MASK) == XLOG_PROVSQL_STORE)
128static const RmgrData provsql_rmgr = {
129 .rm_name =
"provsql",
130 .rm_redo = provsql_rmgr_redo,
131 .rm_desc = provsql_rmgr_desc,
132 .rm_identify = provsql_rmgr_identify,
141 RegisterCustomRmgr(RM_PROVSQL_ID, &provsql_rmgr);
157 return !RecoveryInProgress();
167 (errmsg(
"provsql.wal_logging requires provsql.synchronous_commit"),
168 errdetail(
"WAL records for the circuit store are only complete "
169 "if the store on disk is never behind the WAL, which "
170 "is what the at-commit sync barrier guarantees."),
171 errhint(
"SET provsql.synchronous_commit = on.")));
174 XLogRegisterData((
char *) data, (uint32) len);
175 XLogInsert(RM_PROVSQL_ID, XLOG_PROVSQL_STORE);
Build-configuration switches shared across the C and C++ sources.
#define provsql_error(fmt,...)
Report a fatal ProvSQL error and abort the current transaction.
void provsql_replay_store_message(const char *data, size_t len)
Feed a logged store message back to the worker.
bool provsql_synchronous_commit
Global variable set by the provsql.synchronous_commit run-time configuration parameter: when true,...
Background worker and IPC primitives for mmap-backed circuit storage.
bool provsql_wal_logging
Global variable set by the provsql.wal_logging run-time configuration parameter: when true,...
void provsql_register_rmgr(void)
Register ProvSQL's resource manager with PostgreSQL.
void provsql_wal_log_store_message(const char *data, size_t len)
Write one store message to the WAL, if WAL logging is on.
bool provsql_store_write_allowed(void)
Whether this process may write to the circuit store.
WAL-logging the circuit store: the entry points other files use.
Shared-memory segment and inter-process pipe management.
Core types, constants, and utilities shared across ProvSQL.