PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
clogdesc.c
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * clogdesc.c
4  * rmgr descriptor routines for access/transam/clog.c
5  *
6  * Portions Copyright (c) 1996-2017, PostgreSQL Global Development Group
7  * Portions Copyright (c) 1994, Regents of the University of California
8  *
9  *
10  * IDENTIFICATION
11  * src/backend/access/rmgrdesc/clogdesc.c
12  *
13  *-------------------------------------------------------------------------
14  */
15 #include "postgres.h"
16 
17 #include "access/clog.h"
18 
19 
20 void
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 }
34 
35 const char *
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 }
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
static char * buf
Definition: pg_test_fsync.c:65
#define CLOG_TRUNCATE
Definition: clog.h:49
#define XLogRecGetInfo(decoder)
Definition: xlogreader.h:198
#define NULL
Definition: c.h:226
#define XLR_INFO_MASK
Definition: xlogrecord.h:62
const char * clog_identify(uint8 info)
Definition: clogdesc.c:36
void clog_desc(StringInfo buf, XLogReaderState *record)
Definition: clogdesc.c:21