Header And Logo

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

Functions

gindesc.c File Reference

#include "postgres.h"
#include "access/gin_private.h"
#include "lib/stringinfo.h"
#include "storage/relfilenode.h"
Include dependency graph for gindesc.c:

Go to the source code of this file.

Functions

static void desc_node (StringInfo buf, RelFileNode node, BlockNumber blkno)
void gin_desc (StringInfo buf, uint8 xl_info, char *rec)

Function Documentation

static void desc_node ( StringInfo  buf,
RelFileNode  node,
BlockNumber  blkno 
) [static]

Definition at line 22 of file gindesc.c.

References appendStringInfo(), RelFileNode::dbNode, RelFileNode::relNode, and RelFileNode::spcNode.

Referenced by gin_desc().

{
    appendStringInfo(buf, "node: %u/%u/%u blkno: %u",
                     node.spcNode, node.dbNode, node.relNode, blkno);
}

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

Definition at line 29 of file gindesc.c.

References appendStringInfo(), desc_node(), GIN_METAPAGE_BLKNO, GIN_ROOT_BLKNO, XLOG_GIN_CREATE_INDEX, XLOG_GIN_CREATE_PTREE, XLOG_GIN_DELETE_LISTPAGE, XLOG_GIN_DELETE_PAGE, XLOG_GIN_INSERT, XLOG_GIN_INSERT_LISTPAGE, XLOG_GIN_SPLIT, XLOG_GIN_UPDATE_META_PAGE, and XLOG_GIN_VACUUM_PAGE.

{
    uint8       info = xl_info & ~XLR_INFO_MASK;

    switch (info)
    {
        case XLOG_GIN_CREATE_INDEX:
            appendStringInfo(buf, "Create index, ");
            desc_node(buf, *(RelFileNode *) rec, GIN_ROOT_BLKNO);
            break;
        case XLOG_GIN_CREATE_PTREE:
            appendStringInfo(buf, "Create posting tree, ");
            desc_node(buf, ((ginxlogCreatePostingTree *) rec)->node, ((ginxlogCreatePostingTree *) rec)->blkno);
            break;
        case XLOG_GIN_INSERT:
            appendStringInfo(buf, "Insert item, ");
            desc_node(buf, ((ginxlogInsert *) rec)->node, ((ginxlogInsert *) rec)->blkno);
            appendStringInfo(buf, " offset: %u nitem: %u isdata: %c isleaf %c isdelete %c updateBlkno:%u",
                             ((ginxlogInsert *) rec)->offset,
                             ((ginxlogInsert *) rec)->nitem,
                             (((ginxlogInsert *) rec)->isData) ? 'T' : 'F',
                             (((ginxlogInsert *) rec)->isLeaf) ? 'T' : 'F',
                             (((ginxlogInsert *) rec)->isDelete) ? 'T' : 'F',
                             ((ginxlogInsert *) rec)->updateBlkno);
            break;
        case XLOG_GIN_SPLIT:
            appendStringInfo(buf, "Page split, ");
            desc_node(buf, ((ginxlogSplit *) rec)->node, ((ginxlogSplit *) rec)->lblkno);
            appendStringInfo(buf, " isrootsplit: %c", (((ginxlogSplit *) rec)->isRootSplit) ? 'T' : 'F');
            break;
        case XLOG_GIN_VACUUM_PAGE:
            appendStringInfo(buf, "Vacuum page, ");
            desc_node(buf, ((ginxlogVacuumPage *) rec)->node, ((ginxlogVacuumPage *) rec)->blkno);
            break;
        case XLOG_GIN_DELETE_PAGE:
            appendStringInfo(buf, "Delete page, ");
            desc_node(buf, ((ginxlogDeletePage *) rec)->node, ((ginxlogDeletePage *) rec)->blkno);
            break;
        case XLOG_GIN_UPDATE_META_PAGE:
            appendStringInfo(buf, "Update metapage, ");
            desc_node(buf, ((ginxlogUpdateMeta *) rec)->node, GIN_METAPAGE_BLKNO);
            break;
        case XLOG_GIN_INSERT_LISTPAGE:
            appendStringInfo(buf, "Insert new list page, ");
            desc_node(buf, ((ginxlogInsertListPage *) rec)->node, ((ginxlogInsertListPage *) rec)->blkno);
            break;
        case XLOG_GIN_DELETE_LISTPAGE:
            appendStringInfo(buf, "Delete list pages (%d), ", ((ginxlogDeleteListPages *) rec)->ndeleted);
            desc_node(buf, ((ginxlogDeleteListPages *) rec)->node, GIN_METAPAGE_BLKNO);
            break;
        default:
            appendStringInfo(buf, "unknown gin op code %u", info);
            break;
    }
}