Re: fix "Success" error messages

Peter Eisentraut <peter.eisentraut@2ndquadrant.com>

From: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
To: Michael Paquier <michael@paquier.xyz>, Shawn Debnath <sdn@amazon.com>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2019-08-26T19:40:23Z
Lists: pgsql-hackers

Attachments

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

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Better error messages for short reads/writes in SLRU

  2. pg_checksums: Handle read and write returns correctly

  3. Use consistent style for checking return from system calls