PostgreSQL Source Code  git master
rmgrdesc.c File Reference
#include "postgres.h"
#include "access/brin_xlog.h"
#include "access/clog.h"
#include "access/commit_ts.h"
#include "access/generic_xlog.h"
#include "access/ginxlog.h"
#include "access/gistxlog.h"
#include "access/hash_xlog.h"
#include "access/heapam_xlog.h"
#include "access/multixact.h"
#include "access/nbtxlog.h"
#include "access/rmgr.h"
#include "access/spgxlog.h"
#include "access/xact.h"
#include "access/xlog_internal.h"
#include "catalog/storage_xlog.h"
#include "commands/dbcommands_xlog.h"
#include "commands/sequence.h"
#include "commands/tablespace.h"
#include "replication/message.h"
#include "replication/origin.h"
#include "rmgrdesc.h"
#include "storage/standbydefs.h"
#include "utils/relmapper.h"
#include "access/rmgrlist.h"
Include dependency graph for rmgrdesc.c:

Go to the source code of this file.

Macros

#define FRONTEND   1
 
#define PG_RMGR(symname, name, redo, desc, identify, startup, cleanup, mask, decode)    { name, desc, identify},
 
#define CUSTOM_NUMERIC_NAME_LEN   sizeof("custom###")
 

Functions

static void default_desc (StringInfo buf, XLogReaderState *record)
 
static const char * default_identify (uint8 info)
 
static void initialize_custom_rmgrs (void)
 
const RmgrDescDataGetRmgrDesc (RmgrId rmid)
 

Variables

static const RmgrDescData RmgrDescTable [RM_N_BUILTIN_IDS]
 
static char CustomNumericNames [RM_N_CUSTOM_IDS][CUSTOM_NUMERIC_NAME_LEN] = {{0}}
 
static RmgrDescData CustomRmgrDesc [RM_N_CUSTOM_IDS] = {{0}}
 
static bool CustomRmgrDescInitialized = false
 

Macro Definition Documentation

◆ CUSTOM_NUMERIC_NAME_LEN

#define CUSTOM_NUMERIC_NAME_LEN   sizeof("custom###")

Definition at line 42 of file rmgrdesc.c.

◆ FRONTEND

#define FRONTEND   1

Definition at line 8 of file rmgrdesc.c.

◆ PG_RMGR

#define PG_RMGR (   symname,
  name,
  redo,
  desc,
  identify,
  startup,
  cleanup,
  mask,
  decode 
)     { name, desc, identify},

Definition at line 35 of file rmgrdesc.c.

Function Documentation

◆ default_desc()

static void default_desc ( StringInfo  buf,
XLogReaderState record 
)
static

Definition at line 52 of file rmgrdesc.c.

53 {
54  appendStringInfo(buf, "rmid: %d", XLogRecGetRmid(record));
55 }
static char * buf
Definition: pg_test_fsync.c:73
void appendStringInfo(StringInfo str, const char *fmt,...)
Definition: stringinfo.c:97
#define XLogRecGetRmid(decoder)
Definition: xlogreader.h:411

References appendStringInfo(), buf, and XLogRecGetRmid.

Referenced by initialize_custom_rmgrs().

◆ default_identify()

static const char* default_identify ( uint8  info)
static

Definition at line 62 of file rmgrdesc.c.

63 {
64  return NULL;
65 }

Referenced by initialize_custom_rmgrs().

◆ GetRmgrDesc()

const RmgrDescData* GetRmgrDesc ( RmgrId  rmid)

Definition at line 87 of file rmgrdesc.c.

88 {
89  Assert(RmgrIdIsValid(rmid));
90 
91  if (RmgrIdIsBuiltin(rmid))
92  return &RmgrDescTable[rmid];
93  else
94  {
97  return &CustomRmgrDesc[rmid - RM_MIN_CUSTOM_ID];
98  }
99 }
#define Assert(condition)
Definition: c.h:858
#define RmgrIdIsValid(rmid)
Definition: rmgr.h:53
static bool RmgrIdIsBuiltin(int rmid)
Definition: rmgr.h:42
#define RM_MIN_CUSTOM_ID
Definition: rmgr.h:35
static const RmgrDescData RmgrDescTable[RM_N_BUILTIN_IDS]
Definition: rmgrdesc.c:38
static void initialize_custom_rmgrs(void)
Definition: rmgrdesc.c:73
static bool CustomRmgrDescInitialized
Definition: rmgrdesc.c:46
static RmgrDescData CustomRmgrDesc[RM_N_CUSTOM_IDS]
Definition: rmgrdesc.c:45

References Assert, CustomRmgrDesc, CustomRmgrDescInitialized, initialize_custom_rmgrs(), RM_MIN_CUSTOM_ID, RmgrDescTable, RmgrIdIsBuiltin(), and RmgrIdIsValid.

Referenced by main(), print_rmgr_list(), XLogDumpDisplayRecord(), and XLogDumpDisplayStats().

◆ initialize_custom_rmgrs()

static void initialize_custom_rmgrs ( void  )
static

Definition at line 73 of file rmgrdesc.c.

74 {
75  for (int i = 0; i < RM_N_CUSTOM_IDS; i++)
76  {
78  "custom%03d", i + RM_MIN_CUSTOM_ID);
82  }
84 }
int i
Definition: isn.c:73
#define snprintf
Definition: port.h:238
#define RM_N_CUSTOM_IDS
Definition: rmgr.h:39
static char CustomNumericNames[RM_N_CUSTOM_IDS][CUSTOM_NUMERIC_NAME_LEN]
Definition: rmgrdesc.c:44
static void default_desc(StringInfo buf, XLogReaderState *record)
Definition: rmgrdesc.c:52
static const char * default_identify(uint8 info)
Definition: rmgrdesc.c:62
#define CUSTOM_NUMERIC_NAME_LEN
Definition: rmgrdesc.c:42
const char *(* rm_identify)(uint8 info)
Definition: rmgrdesc.h:18
const char * rm_name
Definition: rmgrdesc.h:16
void(* rm_desc)(StringInfo buf, XLogReaderState *record)
Definition: rmgrdesc.h:17

References CUSTOM_NUMERIC_NAME_LEN, CustomNumericNames, CustomRmgrDesc, CustomRmgrDescInitialized, default_desc(), default_identify(), i, RmgrDescData::rm_desc, RmgrDescData::rm_identify, RM_MIN_CUSTOM_ID, RM_N_CUSTOM_IDS, RmgrDescData::rm_name, and snprintf.

Referenced by GetRmgrDesc().

Variable Documentation

◆ CustomNumericNames

char CustomNumericNames[RM_N_CUSTOM_IDS][CUSTOM_NUMERIC_NAME_LEN] = {{0}}
static

Definition at line 44 of file rmgrdesc.c.

Referenced by initialize_custom_rmgrs().

◆ CustomRmgrDesc

RmgrDescData CustomRmgrDesc[RM_N_CUSTOM_IDS] = {{0}}
static

Definition at line 45 of file rmgrdesc.c.

Referenced by GetRmgrDesc(), and initialize_custom_rmgrs().

◆ CustomRmgrDescInitialized

bool CustomRmgrDescInitialized = false
static

Definition at line 46 of file rmgrdesc.c.

Referenced by GetRmgrDesc(), and initialize_custom_rmgrs().

◆ RmgrDescTable

const RmgrDescData RmgrDescTable[RM_N_BUILTIN_IDS]
static
Initial value:
= {
}

Definition at line 38 of file rmgrdesc.c.

Referenced by GetRmgrDesc().