PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
clogdesc.c File Reference
#include "postgres.h"
#include "access/clog.h"
Include dependency graph for clogdesc.c:

Go to the source code of this file.

Functions

void clog_desc (StringInfo buf, XLogReaderState *record)
 
const char * clog_identify (uint8 info)
 

Function Documentation

void clog_desc ( StringInfo  buf,
XLogReaderState record 
)

Definition at line 21 of file clogdesc.c.

References appendStringInfo(), CLOG_TRUNCATE, CLOG_ZEROPAGE, XLogRecGetData, XLogRecGetInfo, and XLR_INFO_MASK.

22 {
23  char *rec = XLogRecGetData(record);
24  uint8 info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
25 
26  if (info == CLOG_ZEROPAGE || info == CLOG_TRUNCATE)
27  {
28  int pageno;
29 
30  memcpy(&pageno, rec, sizeof(int));
31  appendStringInfo(buf, "%d", pageno);
32  }
33 }
unsigned char uint8
Definition: c.h:263
#define CLOG_ZEROPAGE
Definition: clog.h:48
#define XLogRecGetData(decoder)
Definition: xlogreader.h:202
void appendStringInfo(StringInfo str, const char *fmt,...)
Definition: stringinfo.c:110
#define CLOG_TRUNCATE
Definition: clog.h:49
#define XLogRecGetInfo(decoder)
Definition: xlogreader.h:198
#define XLR_INFO_MASK
Definition: xlogrecord.h:62
const char* clog_identify ( uint8  info)

Definition at line 36 of file clogdesc.c.

References CLOG_TRUNCATE, CLOG_ZEROPAGE, NULL, and XLR_INFO_MASK.

37 {
38  const char *id = NULL;
39 
40  switch (info & ~XLR_INFO_MASK)
41  {
42  case CLOG_ZEROPAGE:
43  id = "ZEROPAGE";
44  break;
45  case CLOG_TRUNCATE:
46  id = "TRUNCATE";
47  break;
48  }
49 
50  return id;
51 }
#define CLOG_ZEROPAGE
Definition: clog.h:48
#define CLOG_TRUNCATE
Definition: clog.h:49
#define NULL
Definition: c.h:226
#define XLR_INFO_MASK
Definition: xlogrecord.h:62