On 2019-06-19 04:51, Michael Paquier wrote:
> On Tue, Jun 18, 2019 at 09:13:19AM -0700, Shawn Debnath wrote:
>>> case SLRU_WRITE_FAILED:
>>> ereport(ERROR,
>>> (errcode_for_file_access(),
>>> errmsg("could not access status of transaction %u", xid),
>>> - errdetail("Could not write to file \"%s\" at offset %u: %m.",
>>> - path, offset)));
>>> + errno == 0
>>> + ? errdetail("Short write to file \"%s\" at offset %u.", path, offset)
>>> + : errdetail("Could not write to file \"%s\" at offset %u: %m.",
>>> + path, offset)));
>
> There is no point to call errcode_for_file_access() if we know that
> errno is 0. Not a big deal, still.. The last time I looked at that,
> the best way I could think of would be to replace slru_errcause with a
> proper error string generated at error time. Perhaps the partial
> read/write case does not justify this extra facility. I don't know.
> At least that would be more flexible.
Here is an updated patch set that rearranges this a bit according to
your suggestions, and also fixes some similar issues in pg_checksums.
--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services