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

Commit 50547a3

Browse files
Fix wal_consistency_checking enhanced desc output.
Recent enhancements to rmgr desc routines that made the output summarize certain block data (added by commits 7d8219a and 1c453cf) dealt with records that lack relevant block data (and so have nothing to give a more detailed summary of) by testing !DecodedBkpBlock.has_image. As a result, more detailed descriptions of block data were not output when wal_consistency_checking was enabled. This bug affected records with summarizable block data that also happened to have an FPI that the REDO routine isn't supposed to apply (FPIs used for consistency checking purposes only). The presence of such an FPI was incorrectly taken to indicate the absence of block data. To fix, test DecodedBkpBlock.has_data, not !DecodedBkpBlock.has_image. This is the exact condition that we care about, not an inexact proxy. Author: Peter Geoghegan <pg@bowt.ie> Discussion: https://postgr.es/m/CAH2-Wzm5Sc9cBg1qWV_cEBfLNJCrW9FjS-SoHVt8FLA7Ldn8yg@mail.gmail.com
1 parent 9e1e9d6 commit 50547a3

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

src/backend/access/rmgrdesc/heapdesc.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ heap2_desc(StringInfo buf, XLogReaderState *record)
184184
xlrec->nredirected,
185185
xlrec->ndead);
186186

187-
if (!XLogRecHasBlockImage(record, 0))
187+
if (XLogRecHasBlockData(record, 0))
188188
{
189189
OffsetNumber *end;
190190
OffsetNumber *redirected;
@@ -223,7 +223,7 @@ heap2_desc(StringInfo buf, XLogReaderState *record)
223223

224224
appendStringInfo(buf, "nunused: %u", xlrec->nunused);
225225

226-
if (!XLogRecHasBlockImage(record, 0))
226+
if (XLogRecHasBlockData(record, 0))
227227
{
228228
OffsetNumber *nowunused;
229229

@@ -241,7 +241,7 @@ heap2_desc(StringInfo buf, XLogReaderState *record)
241241
appendStringInfo(buf, "snapshotConflictHorizon: %u, nplans: %u",
242242
xlrec->snapshotConflictHorizon, xlrec->nplans);
243243

244-
if (!XLogRecHasBlockImage(record, 0))
244+
if (XLogRecHasBlockData(record, 0))
245245
{
246246
xl_heap_freeze_plan *plans;
247247
OffsetNumber *offsets;
@@ -270,7 +270,7 @@ heap2_desc(StringInfo buf, XLogReaderState *record)
270270
appendStringInfo(buf, "ntuples: %d, flags: 0x%02X", xlrec->ntuples,
271271
xlrec->flags);
272272

273-
if (!XLogRecHasBlockImage(record, 0) && !isinit)
273+
if (XLogRecHasBlockData(record, 0) && !isinit)
274274
{
275275
appendStringInfoString(buf, ", offsets:");
276276
array_desc(buf, xlrec->offsets, sizeof(OffsetNumber),

src/backend/access/rmgrdesc/nbtdesc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ btree_desc(StringInfo buf, XLogReaderState *record)
6262
appendStringInfo(buf, "ndeleted: %u, nupdated: %u",
6363
xlrec->ndeleted, xlrec->nupdated);
6464

65-
if (!XLogRecHasBlockImage(record, 0))
65+
if (XLogRecHasBlockData(record, 0))
6666
delvacuum_desc(buf, XLogRecGetBlockData(record, 0, NULL),
6767
xlrec->ndeleted, xlrec->nupdated);
6868
break;
@@ -75,7 +75,7 @@ btree_desc(StringInfo buf, XLogReaderState *record)
7575
xlrec->snapshotConflictHorizon,
7676
xlrec->ndeleted, xlrec->nupdated);
7777

78-
if (!XLogRecHasBlockImage(record, 0))
78+
if (XLogRecHasBlockData(record, 0))
7979
delvacuum_desc(buf, XLogRecGetBlockData(record, 0, NULL),
8080
xlrec->ndeleted, xlrec->nupdated);
8181
break;

src/include/access/xlogreader.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,8 @@ extern bool DecodeXLogRecord(XLogReaderState *state,
423423
((decoder)->record->blocks[block_id].has_image)
424424
#define XLogRecBlockImageApply(decoder, block_id) \
425425
((decoder)->record->blocks[block_id].apply_image)
426+
#define XLogRecHasBlockData(decoder, block_id) \
427+
((decoder)->record->blocks[block_id].has_data)
426428

427429
#ifndef FRONTEND
428430
extern FullTransactionId XLogRecGetFullXid(XLogReaderState *record);

0 commit comments

Comments
 (0)