Re: Fix the error message when failing to restore the snapshot
Amit Kapila <amit.kapila16@gmail.com>
From: Amit Kapila <amit.kapila16@gmail.com>
To: "Zhijie Hou (Fujitsu)" <houzj.fnst@fujitsu.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2023-08-22T13:07:44Z
Lists: pgsql-hackers
On Tue, Aug 22, 2023 at 6:09 PM Zhijie Hou (Fujitsu)
<houzj.fnst@fujitsu.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.
Commits
-
Fix the error message when failing to restore the snapshot.
- 13e2665df3d0 16.0 landed
- 27449ccc4d3a 17.0 landed