00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #include "postgres.h"
00016
00017 #include "access/spgist_private.h"
00018
00019 static void
00020 out_target(StringInfo buf, RelFileNode node)
00021 {
00022 appendStringInfo(buf, "rel %u/%u/%u ",
00023 node.spcNode, node.dbNode, node.relNode);
00024 }
00025
00026 void
00027 spg_desc(StringInfo buf, uint8 xl_info, char *rec)
00028 {
00029 uint8 info = xl_info & ~XLR_INFO_MASK;
00030
00031 switch (info)
00032 {
00033 case XLOG_SPGIST_CREATE_INDEX:
00034 appendStringInfo(buf, "create_index: rel %u/%u/%u",
00035 ((RelFileNode *) rec)->spcNode,
00036 ((RelFileNode *) rec)->dbNode,
00037 ((RelFileNode *) rec)->relNode);
00038 break;
00039 case XLOG_SPGIST_ADD_LEAF:
00040 out_target(buf, ((spgxlogAddLeaf *) rec)->node);
00041 appendStringInfo(buf, "add leaf to page: %u",
00042 ((spgxlogAddLeaf *) rec)->blknoLeaf);
00043 break;
00044 case XLOG_SPGIST_MOVE_LEAFS:
00045 out_target(buf, ((spgxlogMoveLeafs *) rec)->node);
00046 appendStringInfo(buf, "move %u leafs from page %u to page %u",
00047 ((spgxlogMoveLeafs *) rec)->nMoves,
00048 ((spgxlogMoveLeafs *) rec)->blknoSrc,
00049 ((spgxlogMoveLeafs *) rec)->blknoDst);
00050 break;
00051 case XLOG_SPGIST_ADD_NODE:
00052 out_target(buf, ((spgxlogAddNode *) rec)->node);
00053 appendStringInfo(buf, "add node to %u:%u",
00054 ((spgxlogAddNode *) rec)->blkno,
00055 ((spgxlogAddNode *) rec)->offnum);
00056 break;
00057 case XLOG_SPGIST_SPLIT_TUPLE:
00058 out_target(buf, ((spgxlogSplitTuple *) rec)->node);
00059 appendStringInfo(buf, "split node %u:%u to %u:%u",
00060 ((spgxlogSplitTuple *) rec)->blknoPrefix,
00061 ((spgxlogSplitTuple *) rec)->offnumPrefix,
00062 ((spgxlogSplitTuple *) rec)->blknoPostfix,
00063 ((spgxlogSplitTuple *) rec)->offnumPostfix);
00064 break;
00065 case XLOG_SPGIST_PICKSPLIT:
00066 out_target(buf, ((spgxlogPickSplit *) rec)->node);
00067 appendStringInfo(buf, "split leaf page");
00068 break;
00069 case XLOG_SPGIST_VACUUM_LEAF:
00070 out_target(buf, ((spgxlogVacuumLeaf *) rec)->node);
00071 appendStringInfo(buf, "vacuum leaf tuples on page %u",
00072 ((spgxlogVacuumLeaf *) rec)->blkno);
00073 break;
00074 case XLOG_SPGIST_VACUUM_ROOT:
00075 out_target(buf, ((spgxlogVacuumRoot *) rec)->node);
00076 appendStringInfo(buf, "vacuum leaf tuples on root page %u",
00077 ((spgxlogVacuumRoot *) rec)->blkno);
00078 break;
00079 case XLOG_SPGIST_VACUUM_REDIRECT:
00080 out_target(buf, ((spgxlogVacuumRedirect *) rec)->node);
00081 appendStringInfo(buf, "vacuum redirect tuples on page %u, newest XID %u",
00082 ((spgxlogVacuumRedirect *) rec)->blkno,
00083 ((spgxlogVacuumRedirect *) rec)->newestRedirectXid);
00084 break;
00085 default:
00086 appendStringInfo(buf, "unknown spgist op code %u", info);
00087 break;
00088 }
00089 }