ProvSQL C/C++ API
Adding support for provenance and uncertainty management to PostgreSQL databases
Loading...
Searching...
No Matches
provsql_rmgr.h File Reference

WAL-logging the circuit store: the entry points other files use. More...

#include "postgres.h"
Include dependency graph for provsql_rmgr.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

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.
void provsql_replay_store_message (const char *data, size_t len)
 Feed a logged store message back to the worker.

Variables

bool provsql_wal_logging
 Global variable set by the provsql.wal_logging run-time configuration parameter: when true, every mutation of the circuit store is written to the WAL before it is written to the store.

Detailed Description

WAL-logging the circuit store: the entry points other files use.

See provsql_rmgr.c for what is logged, what replay does with it, and why the feature is off by default.

Definition in file provsql_rmgr.h.

Function Documentation

◆ provsql_register_rmgr()

void provsql_register_rmgr ( void )

Register ProvSQL's resource manager with PostgreSQL.

Must be called from _PG_init under shared_preload_libraries, and is called unconditionally – registration is what lets any WAL that already contains ProvSQL records be replayed, whether or not this cluster is currently writing them. A no-op before PostgreSQL 15.

Definition at line 184 of file provsql_rmgr.c.

Here is the caller graph for this function:

◆ provsql_replay_store_message()

void provsql_replay_store_message ( const char * data,
size_t len )

Feed a logged store message back to the worker.

Implemented in provsql_mmap.c, where the IPC primitives live.

Definition at line 341 of file provsql_mmap.c.

Here is the call graph for this function:

◆ provsql_store_write_allowed()

bool provsql_store_write_allowed ( void )

Whether this process may write to the circuit store.

False in a hot-standby backend: the standby's store is maintained by replay, and a backend writing to it would make the two diverge for good. True in the startup process while it replays a ProvSQL record, which is the one write recovery is supposed to make.

Definition at line 192 of file provsql_rmgr.c.

Here is the caller graph for this function:

◆ provsql_wal_log_store_message()

void provsql_wal_log_store_message ( const char * data,
size_t len )

Write one store message to the WAL, if WAL logging is on.

Parameters
dataThe complete message, starting with its opcode byte.
lenIts length in bytes.

Definition at line 186 of file provsql_rmgr.c.

Here is the caller graph for this function:

Variable Documentation

◆ provsql_wal_logging

bool provsql_wal_logging
extern

Global variable set by the provsql.wal_logging run-time configuration parameter: when true, every mutation of the circuit store is written to the WAL before it is written to the store.

Definition at line 182 of file provsql_rmgr.c.