PostgreSQL Source Code  git master
committsdesc.c
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * committsdesc.c
4  * rmgr descriptor routines for access/transam/commit_ts.c
5  *
6  * Portions Copyright (c) 1996-2021, PostgreSQL Global Development Group
7  * Portions Copyright (c) 1994, Regents of the University of California
8  *
9  *
10  * IDENTIFICATION
11  * src/backend/access/rmgrdesc/committsdesc.c
12  *
13  *-------------------------------------------------------------------------
14  */
15 #include "postgres.h"
16 
17 #include "access/commit_ts.h"
18 #include "utils/timestamp.h"
19 
20 
21 void
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 }
42 
43 const char *
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
unsigned char uint8
Definition: c.h:439
void commit_ts_desc(StringInfo buf, XLogReaderState *record)
Definition: committsdesc.c:22
const char * commit_ts_identify(uint8 info)
Definition: committsdesc.c:44
#define XLogRecGetData(decoder)
Definition: xlogreader.h:310
void appendStringInfo(StringInfo str, const char *fmt,...)
Definition: stringinfo.c:91
static char * buf
Definition: pg_test_fsync.c:68
TransactionId oldestXid
Definition: commit_ts.h:68
#define XLogRecGetInfo(decoder)
Definition: xlogreader.h:305
#define COMMIT_TS_TRUNCATE
Definition: commit_ts.h:52
#define XLR_INFO_MASK
Definition: xlogrecord.h:62