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

Commit 4ac30ba

Browse files
committed
Make some xlogreader messages more accurate
When you have some invalid WAL, you often get a message like "wanted 24, got 0". This is a bit incorrect, since it really wanted *at least* 24, not exactly 24. This updates the messages to that effect, and also adds that detail to one message where it was available but not printed. Reviewed-by: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com> Reviewed-by: Jeevan Ladhe <jeevanladhe.os@gmail.com> Discussion: https://www.postgresql.org/message-id/flat/726d782b-5e45-0c3e-d775-6686afe9aa83%40enterprisedb.com
1 parent be75363 commit 4ac30ba

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/backend/access/transam/xlogreader.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -623,8 +623,9 @@ XLogDecodeNextRecord(XLogReaderState *state, bool nonblocking)
623623
}
624624
else if (targetRecOff < pageHeaderSize)
625625
{
626-
report_invalid_record(state, "invalid record offset at %X/%X",
627-
LSN_FORMAT_ARGS(RecPtr));
626+
report_invalid_record(state, "invalid record offset at %X/%X: expected at least %u, got %u",
627+
LSN_FORMAT_ARGS(RecPtr),
628+
pageHeaderSize, targetRecOff);
628629
goto err;
629630
}
630631

@@ -672,7 +673,7 @@ XLogDecodeNextRecord(XLogReaderState *state, bool nonblocking)
672673
if (total_len < SizeOfXLogRecord)
673674
{
674675
report_invalid_record(state,
675-
"invalid record length at %X/%X: wanted %u, got %u",
676+
"invalid record length at %X/%X: expected at least %u, got %u",
676677
LSN_FORMAT_ARGS(RecPtr),
677678
(uint32) SizeOfXLogRecord, total_len);
678679
goto err;
@@ -1119,7 +1120,7 @@ ValidXLogRecordHeader(XLogReaderState *state, XLogRecPtr RecPtr,
11191120
if (record->xl_tot_len < SizeOfXLogRecord)
11201121
{
11211122
report_invalid_record(state,
1122-
"invalid record length at %X/%X: wanted %u, got %u",
1123+
"invalid record length at %X/%X: expected at least %u, got %u",
11231124
LSN_FORMAT_ARGS(RecPtr),
11241125
(uint32) SizeOfXLogRecord, record->xl_tot_len);
11251126
return false;

0 commit comments

Comments
 (0)