Обсуждение: Propagate XLogFindNextRecord error to callers

Поиск
Список
Период
Сортировка

Propagate XLogFindNextRecord error to callers

От
Anthonin Bonnefoy
Дата:
Hi,

Currently, XLogFindNextRecord errormsg is ignored and callers will only output a generic 'could not find a valid record' message without details.
Additionally, invalid page header won't go through XLogReadRecord, leaving the error in state->errormsg_buf.

This patch propagates XLogFindNextRecord's error message to the callers and displays it. In case of an invalid page header, the errormsg is filled with errormsg_buf content.

With this patch, pg_waldump will now have the following output when reading a file with an invalid header:
pg_waldump: error: could not find a valid record after D80/5C000000: invalid magic number D116 in WAL segment 0000001400000D8000000017, LSN D80/5C000000, offset 0 

Regards,
Anthonin Bonnefoy
Вложения

Re: Propagate XLogFindNextRecord error to callers

От
Mircea Cadariu
Дата:
Hi Anthonin,

On 12/12/2025 10:39, Anthonin Bonnefoy wrote:
>
> With this patch, pg_waldump will now have the following output when 
> reading a file with an invalid header:
> pg_waldump: error: could not find a valid record after D80/5C000000: 
> invalid magic number D116 in WAL segment 0000001400000D8000000017, LSN 
> D80/5C000000, offset 0

I've picked up the review for your patch.

Attached is a failing test that reproduces the issue. Have I got it 
right? We can consider using it to validate your patch then.

-- 
Thanks,
Mircea Cadariu

Вложения