Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 783be78

Browse filesBrowse files
committed
Improve WAL record descriptions for SP-GiST records.
While tracking down the bug fixed in the preceding commit, I got quite annoyed by the low quality of spg_desc's output. Add missing fields, try to make the formatting consistent.
1 parent 9e41148 commit 783be78
Copy full SHA for 783be78

File tree

Expand file treeCollapse file tree

1 file changed

+67
-19
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+67
-19
lines changed
Open diff view settings
Collapse file

‎src/backend/access/rmgrdesc/spgdesc.c‎

Copy file name to clipboardExpand all lines: src/backend/access/rmgrdesc/spgdesc.c
+67-19Lines changed: 67 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -28,53 +28,101 @@ spg_desc(StringInfo buf, XLogReaderState *record)
2828
{
2929
spgxlogAddLeaf *xlrec = (spgxlogAddLeaf *) rec;
3030

31-
appendStringInfoString(buf, "add leaf to page");
32-
appendStringInfo(buf, "; off %u; headoff %u; parentoff %u",
31+
appendStringInfo(buf, "off: %u, headoff: %u, parentoff: %u, nodeI: %u",
3332
xlrec->offnumLeaf, xlrec->offnumHeadLeaf,
34-
xlrec->offnumParent);
33+
xlrec->offnumParent, xlrec->nodeI);
3534
if (xlrec->newPage)
3635
appendStringInfoString(buf, " (newpage)");
3736
if (xlrec->storesNulls)
3837
appendStringInfoString(buf, " (nulls)");
3938
}
4039
break;
4140
case XLOG_SPGIST_MOVE_LEAFS:
42-
appendStringInfo(buf, "%u leafs",
43-
((spgxlogMoveLeafs *) rec)->nMoves);
41+
{
42+
spgxlogMoveLeafs *xlrec = (spgxlogMoveLeafs *) rec;
43+
44+
appendStringInfo(buf, "nmoves: %u, parentoff: %u, nodeI: %u",
45+
xlrec->nMoves,
46+
xlrec->offnumParent, xlrec->nodeI);
47+
if (xlrec->newPage)
48+
appendStringInfoString(buf, " (newpage)");
49+
if (xlrec->replaceDead)
50+
appendStringInfoString(buf, " (replacedead)");
51+
if (xlrec->storesNulls)
52+
appendStringInfoString(buf, " (nulls)");
53+
}
4454
break;
4555
case XLOG_SPGIST_ADD_NODE:
46-
appendStringInfo(buf, "off %u",
47-
((spgxlogAddNode *) rec)->offnum);
56+
{
57+
spgxlogAddNode *xlrec = (spgxlogAddNode *) rec;
58+
59+
appendStringInfo(buf, "off: %u, newoff: %u, parentBlk: %d, "
60+
"parentoff: %u, nodeI: %u",
61+
xlrec->offnum,
62+
xlrec->offnumNew,
63+
xlrec->parentBlk,
64+
xlrec->offnumParent,
65+
xlrec->nodeI);
66+
if (xlrec->newPage)
67+
appendStringInfoString(buf, " (newpage)");
68+
}
4869
break;
4970
case XLOG_SPGIST_SPLIT_TUPLE:
50-
appendStringInfo(buf, "prefix off: %u, postfix off: %u (same %d, new %d)",
51-
((spgxlogSplitTuple *) rec)->offnumPrefix,
52-
((spgxlogSplitTuple *) rec)->offnumPostfix,
53-
((spgxlogSplitTuple *) rec)->postfixBlkSame,
54-
((spgxlogSplitTuple *) rec)->newPage
55-
);
71+
{
72+
spgxlogSplitTuple *xlrec = (spgxlogSplitTuple *) rec;
73+
74+
appendStringInfo(buf, "prefixoff: %u, postfixoff: %u",
75+
xlrec->offnumPrefix,
76+
xlrec->offnumPostfix);
77+
if (xlrec->newPage)
78+
appendStringInfoString(buf, " (newpage)");
79+
if (xlrec->postfixBlkSame)
80+
appendStringInfoString(buf, " (same)");
81+
}
5682
break;
5783
case XLOG_SPGIST_PICKSPLIT:
5884
{
5985
spgxlogPickSplit *xlrec = (spgxlogPickSplit *) rec;
6086

61-
appendStringInfo(buf, "ndel %u; nins %u",
62-
xlrec->nDelete, xlrec->nInsert);
87+
appendStringInfo(buf, "ndelete: %u, ninsert: %u, inneroff: %u, "
88+
"parentoff: %u, nodeI: %u",
89+
xlrec->nDelete, xlrec->nInsert,
90+
xlrec->offnumInner,
91+
xlrec->offnumParent, xlrec->nodeI);
6392
if (xlrec->innerIsParent)
6493
appendStringInfoString(buf, " (innerIsParent)");
94+
if (xlrec->storesNulls)
95+
appendStringInfoString(buf, " (nulls)");
6596
if (xlrec->isRootSplit)
6697
appendStringInfoString(buf, " (isRootSplit)");
6798
}
6899
break;
69100
case XLOG_SPGIST_VACUUM_LEAF:
70-
/* no further information */
101+
{
102+
spgxlogVacuumLeaf *xlrec = (spgxlogVacuumLeaf *) rec;
103+
104+
appendStringInfo(buf, "ndead: %u, nplaceholder: %u, nmove: %u, nchain: %u",
105+
xlrec->nDead, xlrec->nPlaceholder,
106+
xlrec->nMove, xlrec->nChain);
107+
}
71108
break;
72109
case XLOG_SPGIST_VACUUM_ROOT:
73-
/* no further information */
110+
{
111+
spgxlogVacuumRoot *xlrec = (spgxlogVacuumRoot *) rec;
112+
113+
appendStringInfo(buf, "ndelete: %u",
114+
xlrec->nDelete);
115+
}
74116
break;
75117
case XLOG_SPGIST_VACUUM_REDIRECT:
76-
appendStringInfo(buf, "newest XID %u",
77-
((spgxlogVacuumRedirect *) rec)->newestRedirectXid);
118+
{
119+
spgxlogVacuumRedirect *xlrec = (spgxlogVacuumRedirect *) rec;
120+
121+
appendStringInfo(buf, "ntoplaceholder: %u, firstplaceholder: %u, newestredirectxid: %u",
122+
xlrec->nToPlaceholder,
123+
xlrec->firstPlaceholder,
124+
xlrec->newestRedirectXid);
125+
}
78126
break;
79127
}
80128
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.