2012-11-28 16:35:01 +01:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
*
|
|
|
|
* smgrdesc.c
|
2013-05-29 22:58:43 +02:00
|
|
|
* rmgr descriptor routines for catalog/storage.c
|
2012-11-28 16:35:01 +01:00
|
|
|
*
|
2013-01-01 23:15:01 +01:00
|
|
|
* Portions Copyright (c) 1996-2013, PostgreSQL Global Development Group
|
2012-11-28 16:35:01 +01:00
|
|
|
* Portions Copyright (c) 1994, Regents of the University of California
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* IDENTIFICATION
|
2013-05-29 22:58:43 +02:00
|
|
|
* src/backend/access/rmgrdesc/smgrdesc.c
|
2012-11-28 16:35:01 +01:00
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
#include "postgres.h"
|
|
|
|
|
|
|
|
#include "catalog/catalog.h"
|
|
|
|
#include "catalog/storage_xlog.h"
|
2013-02-22 02:46:17 +01:00
|
|
|
#include "common/relpath.h"
|
2012-11-28 16:35:01 +01:00
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
smgr_desc(StringInfo buf, uint8 xl_info, char *rec)
|
|
|
|
{
|
|
|
|
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
|
2013-10-31 15:55:59 +01:00
|
|
|
appendStringInfoString(buf, "UNKNOWN");
|
2012-11-28 16:35:01 +01:00
|
|
|
}
|