Header And Logo

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

Functions

nbtdesc.c File Reference

#include "postgres.h"
#include "access/nbtree.h"
Include dependency graph for nbtdesc.c:

Go to the source code of this file.

Functions

static void out_target (StringInfo buf, xl_btreetid *target)
void btree_desc (StringInfo buf, uint8 xl_info, char *rec)

Function Documentation

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

Definition at line 29 of file nbtdesc.c.

References appendStringInfo(), xl_btree_delete::block, xl_btree_vacuum::block, RelFileNode::dbNode, xl_btree_delete_page::deadblk, xl_btree_split::firstright, xl_btree_delete::hnode, xl_btree_vacuum::lastBlockVacuumed, xl_btree_reuse_page::latestRemovedXid, xl_btree_delete_page::leftblk, xl_btree_split::leftsib, xl_btree_newroot::level, xl_btree_split::level, xl_btree_reuse_page::node, xl_btree_newroot::node, xl_btree_delete::node, xl_btree_vacuum::node, xl_btree_split::node, out_target(), RelFileNode::relNode, xl_btree_delete_page::rightblk, xl_btree_split::rightsib, xl_btree_split::rnext, xl_btree_newroot::rootblk, RelFileNode::spcNode, xl_btree_delete_page::target, xl_btree_insert::target, XLOG_BTREE_DELETE, XLOG_BTREE_DELETE_PAGE, XLOG_BTREE_DELETE_PAGE_HALF, XLOG_BTREE_DELETE_PAGE_META, XLOG_BTREE_INSERT_LEAF, XLOG_BTREE_INSERT_META, XLOG_BTREE_INSERT_UPPER, XLOG_BTREE_NEWROOT, XLOG_BTREE_REUSE_PAGE, XLOG_BTREE_SPLIT_L, XLOG_BTREE_SPLIT_L_ROOT, XLOG_BTREE_SPLIT_R, XLOG_BTREE_SPLIT_R_ROOT, and XLOG_BTREE_VACUUM.

{
    uint8       info = xl_info & ~XLR_INFO_MASK;

    switch (info)
    {
        case XLOG_BTREE_INSERT_LEAF:
            {
                xl_btree_insert *xlrec = (xl_btree_insert *) rec;

                appendStringInfo(buf, "insert: ");
                out_target(buf, &(xlrec->target));
                break;
            }
        case XLOG_BTREE_INSERT_UPPER:
            {
                xl_btree_insert *xlrec = (xl_btree_insert *) rec;

                appendStringInfo(buf, "insert_upper: ");
                out_target(buf, &(xlrec->target));
                break;
            }
        case XLOG_BTREE_INSERT_META:
            {
                xl_btree_insert *xlrec = (xl_btree_insert *) rec;

                appendStringInfo(buf, "insert_meta: ");
                out_target(buf, &(xlrec->target));
                break;
            }
        case XLOG_BTREE_SPLIT_L:
            {
                xl_btree_split *xlrec = (xl_btree_split *) rec;

                appendStringInfo(buf, "split_l: rel %u/%u/%u ",
                                 xlrec->node.spcNode, xlrec->node.dbNode,
                                 xlrec->node.relNode);
                appendStringInfo(buf, "left %u, right %u, next %u, level %u, firstright %d",
                               xlrec->leftsib, xlrec->rightsib, xlrec->rnext,
                                 xlrec->level, xlrec->firstright);
                break;
            }
        case XLOG_BTREE_SPLIT_R:
            {
                xl_btree_split *xlrec = (xl_btree_split *) rec;

                appendStringInfo(buf, "split_r: rel %u/%u/%u ",
                                 xlrec->node.spcNode, xlrec->node.dbNode,
                                 xlrec->node.relNode);
                appendStringInfo(buf, "left %u, right %u, next %u, level %u, firstright %d",
                               xlrec->leftsib, xlrec->rightsib, xlrec->rnext,
                                 xlrec->level, xlrec->firstright);
                break;
            }
        case XLOG_BTREE_SPLIT_L_ROOT:
            {
                xl_btree_split *xlrec = (xl_btree_split *) rec;

                appendStringInfo(buf, "split_l_root: rel %u/%u/%u ",
                                 xlrec->node.spcNode, xlrec->node.dbNode,
                                 xlrec->node.relNode);
                appendStringInfo(buf, "left %u, right %u, next %u, level %u, firstright %d",
                               xlrec->leftsib, xlrec->rightsib, xlrec->rnext,
                                 xlrec->level, xlrec->firstright);
                break;
            }
        case XLOG_BTREE_SPLIT_R_ROOT:
            {
                xl_btree_split *xlrec = (xl_btree_split *) rec;

                appendStringInfo(buf, "split_r_root: rel %u/%u/%u ",
                                 xlrec->node.spcNode, xlrec->node.dbNode,
                                 xlrec->node.relNode);
                appendStringInfo(buf, "left %u, right %u, next %u, level %u, firstright %d",
                               xlrec->leftsib, xlrec->rightsib, xlrec->rnext,
                                 xlrec->level, xlrec->firstright);
                break;
            }
        case XLOG_BTREE_VACUUM:
            {
                xl_btree_vacuum *xlrec = (xl_btree_vacuum *) rec;

                appendStringInfo(buf, "vacuum: rel %u/%u/%u; blk %u, lastBlockVacuumed %u",
                                 xlrec->node.spcNode, xlrec->node.dbNode,
                                 xlrec->node.relNode, xlrec->block,
                                 xlrec->lastBlockVacuumed);
                break;
            }
        case XLOG_BTREE_DELETE:
            {
                xl_btree_delete *xlrec = (xl_btree_delete *) rec;

                appendStringInfo(buf, "delete: index %u/%u/%u; iblk %u, heap %u/%u/%u;",
                xlrec->node.spcNode, xlrec->node.dbNode, xlrec->node.relNode,
                                 xlrec->block,
                                 xlrec->hnode.spcNode, xlrec->hnode.dbNode, xlrec->hnode.relNode);
                break;
            }
        case XLOG_BTREE_DELETE_PAGE:
        case XLOG_BTREE_DELETE_PAGE_META:
        case XLOG_BTREE_DELETE_PAGE_HALF:
            {
                xl_btree_delete_page *xlrec = (xl_btree_delete_page *) rec;

                appendStringInfo(buf, "delete_page: ");
                out_target(buf, &(xlrec->target));
                appendStringInfo(buf, "; dead %u; left %u; right %u",
                            xlrec->deadblk, xlrec->leftblk, xlrec->rightblk);
                break;
            }
        case XLOG_BTREE_NEWROOT:
            {
                xl_btree_newroot *xlrec = (xl_btree_newroot *) rec;

                appendStringInfo(buf, "newroot: rel %u/%u/%u; root %u lev %u",
                                 xlrec->node.spcNode, xlrec->node.dbNode,
                                 xlrec->node.relNode,
                                 xlrec->rootblk, xlrec->level);
                break;
            }
        case XLOG_BTREE_REUSE_PAGE:
            {
                xl_btree_reuse_page *xlrec = (xl_btree_reuse_page *) rec;

                appendStringInfo(buf, "reuse_page: rel %u/%u/%u; latestRemovedXid %u",
                                 xlrec->node.spcNode, xlrec->node.dbNode,
                               xlrec->node.relNode, xlrec->latestRemovedXid);
                break;
            }
        default:
            appendStringInfo(buf, "UNKNOWN");
            break;
    }
}

static void out_target ( StringInfo  buf,
xl_btreetid target 
) [static]