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

Commit51893c8

Browse files
committed
pg_waldump: Fix bug in per-record statistics.
pg_waldump --stats=record identifies a record by a combinationof the RmgrId and the four bits of the xl_info field of the record.But XACT records use the first bit of those four bits for an optionalflag variable, and the following three bits for the opcode toidentify a record. So previously the same type of XACT recordcould have different four bits (three bits are the same but thefirst one bit is different), and which could causepg_waldump --stats=record to show two lines of per-record statisticsfor the same XACT record. This is a bug.This commit changes pg_waldump --stats=record so that it processesonly XACT record differently, i.e., filters the opcode out of xl_infoand uses a combination of the RmgrId and those three bits asthe identifier of a record, only for XACT record. For other records,the four bits of the xl_info field are still used.Back-patch to all supported branches.Author: Kyotaro HoriguchiReviewed-by: Shinya Kato, Fujii MasaoDiscussion:https://postgr.es/m/2020100913412132258847@highgo.ca
1 parent95d7714 commit51893c8

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

‎src/bin/pg_waldump/pg_waldump.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,15 @@ XLogDumpCountRecord(XLogDumpConfig *config, XLogDumpStats *stats,
438438

439439
recid=XLogRecGetInfo(record) >>4;
440440

441+
/*
442+
* XACT records need to be handled differently. Those records use the
443+
* first bit of those four bits for an optional flag variable and the
444+
* following three bits for the opcode. We filter opcode out of xl_info
445+
* and use it as the identifier of the record.
446+
*/
447+
if (rmid==RM_XACT_ID)
448+
recid &=0x07;
449+
441450
stats->record_stats[rmid][recid].count++;
442451
stats->record_stats[rmid][recid].rec_len+=rec_len;
443452
stats->record_stats[rmid][recid].fpi_len+=fpi_len;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp