Header And Logo

PostgreSQL
| The world's most advanced open source database.

Functions

smgrdesc.c File Reference

#include "postgres.h"
#include "catalog/catalog.h"
#include "catalog/storage_xlog.h"
#include "common/relpath.h"
Include dependency graph for smgrdesc.c:

Go to the source code of this file.

Functions

void smgr_desc (StringInfo buf, uint8 xl_info, char *rec)

Function Documentation

void smgr_desc ( StringInfo  buf,
uint8  xl_info,
char *  rec 
)

Definition at line 23 of file smgrdesc.c.

References appendStringInfo(), xl_smgr_truncate::blkno, xl_smgr_create::forkNum, MAIN_FORKNUM, pfree(), relpathperm, xl_smgr_truncate::rnode, xl_smgr_create::rnode, XLOG_SMGR_CREATE, and XLOG_SMGR_TRUNCATE.

{
    uint8       info = xl_info & ~XLR_INFO_MASK;

    if (info == XLOG_SMGR_CREATE)
    {
        xl_smgr_create *xlrec = (xl_smgr_create *) rec;
        char       *path = relpathperm(xlrec->rnode, xlrec->forkNum);

        appendStringInfo(buf, "file create: %s", path);
        pfree(path);
    }
    else if (info == XLOG_SMGR_TRUNCATE)
    {
        xl_smgr_truncate *xlrec = (xl_smgr_truncate *) rec;
        char       *path = relpathperm(xlrec->rnode, MAIN_FORKNUM);

        appendStringInfo(buf, "file truncate: %s to %u blocks", path,
                         xlrec->blkno);
        pfree(path);
    }
    else
        appendStringInfo(buf, "UNKNOWN");
}