00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #include "postgres.h"
00016
00017 #include "access/gin_private.h"
00018 #include "lib/stringinfo.h"
00019 #include "storage/relfilenode.h"
00020
00021 static void
00022 desc_node(StringInfo buf, RelFileNode node, BlockNumber blkno)
00023 {
00024 appendStringInfo(buf, "node: %u/%u/%u blkno: %u",
00025 node.spcNode, node.dbNode, node.relNode, blkno);
00026 }
00027
00028 void
00029 gin_desc(StringInfo buf, uint8 xl_info, char *rec)
00030 {
00031 uint8 info = xl_info & ~XLR_INFO_MASK;
00032
00033 switch (info)
00034 {
00035 case XLOG_GIN_CREATE_INDEX:
00036 appendStringInfo(buf, "Create index, ");
00037 desc_node(buf, *(RelFileNode *) rec, GIN_ROOT_BLKNO);
00038 break;
00039 case XLOG_GIN_CREATE_PTREE:
00040 appendStringInfo(buf, "Create posting tree, ");
00041 desc_node(buf, ((ginxlogCreatePostingTree *) rec)->node, ((ginxlogCreatePostingTree *) rec)->blkno);
00042 break;
00043 case XLOG_GIN_INSERT:
00044 appendStringInfo(buf, "Insert item, ");
00045 desc_node(buf, ((ginxlogInsert *) rec)->node, ((ginxlogInsert *) rec)->blkno);
00046 appendStringInfo(buf, " offset: %u nitem: %u isdata: %c isleaf %c isdelete %c updateBlkno:%u",
00047 ((ginxlogInsert *) rec)->offset,
00048 ((ginxlogInsert *) rec)->nitem,
00049 (((ginxlogInsert *) rec)->isData) ? 'T' : 'F',
00050 (((ginxlogInsert *) rec)->isLeaf) ? 'T' : 'F',
00051 (((ginxlogInsert *) rec)->isDelete) ? 'T' : 'F',
00052 ((ginxlogInsert *) rec)->updateBlkno);
00053 break;
00054 case XLOG_GIN_SPLIT:
00055 appendStringInfo(buf, "Page split, ");
00056 desc_node(buf, ((ginxlogSplit *) rec)->node, ((ginxlogSplit *) rec)->lblkno);
00057 appendStringInfo(buf, " isrootsplit: %c", (((ginxlogSplit *) rec)->isRootSplit) ? 'T' : 'F');
00058 break;
00059 case XLOG_GIN_VACUUM_PAGE:
00060 appendStringInfo(buf, "Vacuum page, ");
00061 desc_node(buf, ((ginxlogVacuumPage *) rec)->node, ((ginxlogVacuumPage *) rec)->blkno);
00062 break;
00063 case XLOG_GIN_DELETE_PAGE:
00064 appendStringInfo(buf, "Delete page, ");
00065 desc_node(buf, ((ginxlogDeletePage *) rec)->node, ((ginxlogDeletePage *) rec)->blkno);
00066 break;
00067 case XLOG_GIN_UPDATE_META_PAGE:
00068 appendStringInfo(buf, "Update metapage, ");
00069 desc_node(buf, ((ginxlogUpdateMeta *) rec)->node, GIN_METAPAGE_BLKNO);
00070 break;
00071 case XLOG_GIN_INSERT_LISTPAGE:
00072 appendStringInfo(buf, "Insert new list page, ");
00073 desc_node(buf, ((ginxlogInsertListPage *) rec)->node, ((ginxlogInsertListPage *) rec)->blkno);
00074 break;
00075 case XLOG_GIN_DELETE_LISTPAGE:
00076 appendStringInfo(buf, "Delete list pages (%d), ", ((ginxlogDeleteListPages *) rec)->ndeleted);
00077 desc_node(buf, ((ginxlogDeleteListPages *) rec)->node, GIN_METAPAGE_BLKNO);
00078 break;
00079 default:
00080 appendStringInfo(buf, "unknown gin op code %u", info);
00081 break;
00082 }
00083 }