Re: Fix the error message when failing to restore the snapshot

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: "Zhijie Hou (Fujitsu)" <houzj(dot)fnst(at)fujitsu(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Fix the error message when failing to restore the snapshot
Date: 2023-08-22 13:07:44
Message-ID: CAA4eK1+5hU9Gju-QHQqH8i0UujBUgcq2g5LtdSN4ms7B3TMGiw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Aug 22, 2023 at 6:09 PM Zhijie Hou (Fujitsu)
<houzj(dot)fnst(at)fujitsu(dot)com> wrote:
>
> While testing the logical snapshot restore functionality, I noticed the
> data size reported in the error message seems not correct.
>
> I think it's because we used a const value here:
>
> SnapBuildRestoreContents(int fd, char *dest, Size size, const char *path)
> ...
> readBytes = read(fd, dest, size);
> pgstat_report_wait_end();
> if (readBytes != size)
> ...
> ereport(ERROR,
> (errcode(ERRCODE_DATA_CORRUPTED),
> errmsg("could not read file \"%s\": read %d of %zu",
> ** path, readBytes, * sizeof(SnapBuild) *)));
>
> I think we need to pass the size here.
>

Good catch. I'll take care of this.

--
With Regards,
Amit Kapila.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2023-08-22 13:11:25 Re: Make all Perl warnings fatal
Previous Message Alvaro Herrera 2023-08-22 13:05:15 Re: list of acknowledgments for PG16