Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commitebc2b68

Browse files
committed
Fix pg_xlogdump's calculation of full-page image data.
The old formula was completely bogus with the new WAL record format.
1 parent9a94629 commitebc2b68

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

‎contrib/pg_xlogdump/pg_xlogdump.c

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -351,14 +351,29 @@ XLogDumpCountRecord(XLogDumpConfig *config, XLogDumpStats *stats,
351351
uint8recid;
352352
uint32rec_len;
353353
uint32fpi_len;
354+
intblock_id;
354355

355356
stats->count++;
356357

357-
/* Update per-rmgr statistics */
358-
359358
rmid=XLogRecGetRmid(record);
360359
rec_len=XLogRecGetDataLen(record)+SizeOfXLogRecord;
361-
fpi_len=record->decoded_record->xl_tot_len-rec_len;
360+
361+
/*
362+
* Calculate the amount of FPI data in the record. Each backup block
363+
* takes up BLCKSZ bytes, minus the "hole" length.
364+
*
365+
* XXX: We peek into xlogreader's private decoded backup blocks for the
366+
* hole_length. It doesn't seem worth it to add an accessor macro for
367+
* this.
368+
*/
369+
fpi_len=0;
370+
for (block_id=0;block_id <=record->max_block_id;block_id++)
371+
{
372+
if (XLogRecHasBlockImage(record,block_id))
373+
fpi_len+=BLCKSZ-record->blocks[block_id].hole_length;
374+
}
375+
376+
/* Update per-rmgr statistics */
362377

363378
stats->rmgr_stats[rmid].count++;
364379
stats->rmgr_stats[rmid].rec_len+=rec_len;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp