PostgreSQL Source Code  git master
committsdesc.c File Reference
#include "postgres.h"
#include "access/commit_ts.h"
#include "utils/timestamp.h"
Include dependency graph for committsdesc.c:

Go to the source code of this file.

Functions

void commit_ts_desc (StringInfo buf, XLogReaderState *record)
 
const char * commit_ts_identify (uint8 info)
 

Function Documentation

◆ commit_ts_desc()

void commit_ts_desc ( StringInfo  buf,
XLogReaderState record 
)

Definition at line 22 of file committsdesc.c.

References appendStringInfo(), COMMIT_TS_TRUNCATE, COMMIT_TS_ZEROPAGE, xl_commit_ts_truncate::oldestXid, xl_commit_ts_truncate::pageno, XLogRecGetData, XLogRecGetInfo, and XLR_INFO_MASK.

23 {
24  char *rec = XLogRecGetData(record);
25  uint8 info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
26 
27  if (info == COMMIT_TS_ZEROPAGE)
28  {
29  int pageno;
30 
31  memcpy(&pageno, rec, sizeof(int));
32  appendStringInfo(buf, "%d", pageno);
33  }
34  else if (info == COMMIT_TS_TRUNCATE)
35  {
37 
38  appendStringInfo(buf, "pageno %d, oldestXid %u",
39  trunc->pageno, trunc->oldestXid);
40  }
41 }
#define COMMIT_TS_ZEROPAGE
Definition: commit_ts.h:51
unsigned char uint8
Definition: c.h:439
#define XLogRecGetData(decoder)
Definition: xlogreader.h:382
void appendStringInfo(StringInfo str, const char *fmt,...)
Definition: stringinfo.c:91
TransactionId oldestXid
Definition: commit_ts.h:68
#define XLogRecGetInfo(decoder)
Definition: xlogreader.h:377
#define COMMIT_TS_TRUNCATE
Definition: commit_ts.h:52
#define XLR_INFO_MASK
Definition: xlogrecord.h:62

◆ commit_ts_identify()

const char* commit_ts_identify ( uint8  info)

Definition at line 44 of file committsdesc.c.

References COMMIT_TS_TRUNCATE, and COMMIT_TS_ZEROPAGE.

45 {
46  switch (info)
47  {
48  case COMMIT_TS_ZEROPAGE:
49  return "ZEROPAGE";
50  case COMMIT_TS_TRUNCATE:
51  return "TRUNCATE";
52  default:
53  return NULL;
54  }
55 }
#define COMMIT_TS_ZEROPAGE
Definition: commit_ts.h:51
#define COMMIT_TS_TRUNCATE
Definition: commit_ts.h:52