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"
79#define RM_PROVSQL_ID 151
86#define XLOG_PROVSQL_STORE 0x10
90 uint8 info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
93 provsql_error(
"provsql resource manager: unexpected record info %u", info);
99 XLogRecGetDataLen(record));
119 const char *data = XLogRecGetData(record);
120 uint32 len = XLogRecGetDataLen(record);
123 appendStringInfo(buf,
"opcode %c, %u bytes", data[0], len);
125 appendStringInfoString(buf,
"empty");
136 .rm_name =
"provsql",
148#if PG_VERSION_NUM >= 160000
170 return !RecoveryInProgress();
180 (errmsg(
"provsql.store_wal_logging requires provsql.store_synchronous_commit"),
181 errdetail(
"WAL records for the circuit store are only complete "
182 "if the store on disk is never behind the WAL, which "
183 "is what the at-commit sync barrier guarantees."),
184 errhint(
"SET provsql.store_synchronous_commit = on.")));
187 XLogRegisterData((
char *) data, (uint32) len);
Build-configuration switches shared across the C and C++ sources.
#define provsql_error(fmt,...)
Report a fatal ProvSQL error and abort the current transaction.
bool provsql_store_synchronous_commit
Global variable set by the provsql.store_synchronous_commit run-time configuration parameter: when tr...
void provsql_replay_store_message(const char *data, size_t len)
Feed a logged store message back to the worker.
void provsql_replay_spool_close(void)
Sync and close the replay spool at the end of WAL replay (the resource manager's cleanup).
Background worker and IPC primitives for mmap-backed circuit storage.
static void provsql_rmgr_desc(StringInfo buf, XLogReaderState *record)
#define RM_PROVSQL_ID
Resource-manager id.
void provsql_register_rmgr(void)
Register ProvSQL's resource manager with PostgreSQL.
bool provsql_store_wal_logging
Global variable set by the provsql.store_wal_logging run-time configuration parameter: when true,...
void provsql_wal_log_store_message(const char *data, size_t len)
Write one store message to the WAL, if WAL logging is on.
static void provsql_rmgr_cleanup(void)
End of WAL replay: the replay spool reaches the disk before the end-of-recovery checkpoint.
static void provsql_rmgr_redo(XLogReaderState *record)
bool provsql_store_write_allowed(void)
Whether this process may write to the circuit store.
static bool in_redo
True while this process is replaying a ProvSQL WAL record, which is the one case where writing to the...
static const char * provsql_rmgr_identify(uint8 info)
#define XLOG_PROVSQL_STORE
The only record kind: a store message to replay verbatim.
static const RmgrData provsql_rmgr
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.