Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 3be97b9

Browse files
committed
Add flag values in WAL description to all heap records
Hexadecimal is consistently used as format to not bloat too much the output but keep it readable. This information is useful mainly for debugging purposes with for example pg_waldump. Author: Michael Paquier Reviewed-by: Nathan Bossart, Dmitry Dolgov, Andres Freund, Álvaro Herrera Discussion: https://postgr.es/m/20180413034734.GE1552@paquier.xyz
1 parent b52b7dc commit 3be97b9

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

src/backend/access/rmgrdesc/heapdesc.c

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,22 +42,26 @@ heap_desc(StringInfo buf, XLogReaderState *record)
4242
{
4343
xl_heap_insert *xlrec = (xl_heap_insert *) rec;
4444

45-
appendStringInfo(buf, "off %u", xlrec->offnum);
45+
appendStringInfo(buf, "off %u flags 0x%02X", xlrec->offnum,
46+
xlrec->flags);
4647
}
4748
else if (info == XLOG_HEAP_DELETE)
4849
{
4950
xl_heap_delete *xlrec = (xl_heap_delete *) rec;
5051

51-
appendStringInfo(buf, "off %u ", xlrec->offnum);
52+
appendStringInfo(buf, "off %u flags 0x%02X ",
53+
xlrec->offnum,
54+
xlrec->flags);
5255
out_infobits(buf, xlrec->infobits_set);
5356
}
5457
else if (info == XLOG_HEAP_UPDATE)
5558
{
5659
xl_heap_update *xlrec = (xl_heap_update *) rec;
5760

58-
appendStringInfo(buf, "off %u xmax %u ",
61+
appendStringInfo(buf, "off %u xmax %u flags 0x%02X ",
5962
xlrec->old_offnum,
60-
xlrec->old_xmax);
63+
xlrec->old_xmax,
64+
xlrec->flags);
6165
out_infobits(buf, xlrec->old_infobits_set);
6266
appendStringInfo(buf, "; new off %u xmax %u",
6367
xlrec->new_offnum,
@@ -67,9 +71,10 @@ heap_desc(StringInfo buf, XLogReaderState *record)
6771
{
6872
xl_heap_update *xlrec = (xl_heap_update *) rec;
6973

70-
appendStringInfo(buf, "off %u xmax %u ",
74+
appendStringInfo(buf, "off %u xmax %u flags 0x%02X ",
7175
xlrec->old_offnum,
72-
xlrec->old_xmax);
76+
xlrec->old_xmax,
77+
xlrec->flags);
7378
out_infobits(buf, xlrec->old_infobits_set);
7479
appendStringInfo(buf, "; new off %u xmax %u",
7580
xlrec->new_offnum,
@@ -98,7 +103,7 @@ heap_desc(StringInfo buf, XLogReaderState *record)
98103
{
99104
xl_heap_lock *xlrec = (xl_heap_lock *) rec;
100105

101-
appendStringInfo(buf, "off %u: xid %u: flags %u ",
106+
appendStringInfo(buf, "off %u: xid %u: flags 0x%02X ",
102107
xlrec->offnum, xlrec->locking_xid, xlrec->flags);
103108
out_infobits(buf, xlrec->infobits_set);
104109
}
@@ -139,20 +144,21 @@ heap2_desc(StringInfo buf, XLogReaderState *record)
139144
{
140145
xl_heap_visible *xlrec = (xl_heap_visible *) rec;
141146

142-
appendStringInfo(buf, "cutoff xid %u flags %d",
147+
appendStringInfo(buf, "cutoff xid %u flags 0x%02X",
143148
xlrec->cutoff_xid, xlrec->flags);
144149
}
145150
else if (info == XLOG_HEAP2_MULTI_INSERT)
146151
{
147152
xl_heap_multi_insert *xlrec = (xl_heap_multi_insert *) rec;
148153

149-
appendStringInfo(buf, "%d tuples", xlrec->ntuples);
154+
appendStringInfo(buf, "%d tuples flags 0x%02X", xlrec->ntuples,
155+
xlrec->flags);
150156
}
151157
else if (info == XLOG_HEAP2_LOCK_UPDATED)
152158
{
153159
xl_heap_lock_updated *xlrec = (xl_heap_lock_updated *) rec;
154160

155-
appendStringInfo(buf, "off %u: xmax %u: flags %u ",
161+
appendStringInfo(buf, "off %u: xmax %u: flags 0x%02X ",
156162
xlrec->offnum, xlrec->xmax, xlrec->flags);
157163
out_infobits(buf, xlrec->infobits_set);
158164
}

0 commit comments

Comments
 (0)