PostgreSQL Source Code git master
Loading...
Searching...
No Matches
smgrdesc.c File Reference
#include "postgres.h"
#include "catalog/storage_xlog.h"
Include dependency graph for smgrdesc.c:

Go to the source code of this file.

Functions

void smgr_desc (StringInfo buf, XLogReaderState *record)
 
const charsmgr_identify (uint8 info)
 

Function Documentation

◆ smgr_desc()

void smgr_desc ( StringInfo  buf,
XLogReaderState record 
)

Definition at line 21 of file smgrdesc.c.

22{
23 char *rec = XLogRecGetData(record);
24 uint8 info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
25
26 if (info == XLOG_SMGR_CREATE)
27 {
29
31 relpathperm(xlrec->rlocator, xlrec->forkNum).str);
32 }
33 else if (info == XLOG_SMGR_TRUNCATE)
34 {
36
37 appendStringInfo(buf, "%s to %u blocks flags %d",
38 relpathperm(xlrec->rlocator, MAIN_FORKNUM).str,
39 xlrec->blkno, xlrec->flags);
40 }
41}
uint8_t uint8
Definition c.h:544
static char buf[DEFAULT_XLOG_SEG_SIZE]
static int fb(int x)
@ MAIN_FORKNUM
Definition relpath.h:58
#define relpathperm(rlocator, forknum)
Definition relpath.h:146
#define XLOG_SMGR_CREATE
#define XLOG_SMGR_TRUNCATE
void appendStringInfo(StringInfo str, const char *fmt,...)
Definition stringinfo.c:145
void appendStringInfoString(StringInfo str, const char *s)
Definition stringinfo.c:230
#define XLogRecGetInfo(decoder)
Definition xlogreader.h:409
#define XLogRecGetData(decoder)
Definition xlogreader.h:414

References appendStringInfo(), appendStringInfoString(), buf, fb(), MAIN_FORKNUM, relpathperm, XLOG_SMGR_CREATE, XLOG_SMGR_TRUNCATE, XLogRecGetData, and XLogRecGetInfo.

◆ smgr_identify()

const char * smgr_identify ( uint8  info)

Definition at line 44 of file smgrdesc.c.

45{
46 const char *id = NULL;
47
48 switch (info & ~XLR_INFO_MASK)
49 {
51 id = "CREATE";
52 break;
54 id = "TRUNCATE";
55 break;
56 }
57
58 return id;
59}
#define XLR_INFO_MASK
Definition xlogrecord.h:62

References fb(), XLOG_SMGR_CREATE, XLOG_SMGR_TRUNCATE, and XLR_INFO_MASK.