diff options
author | Thomas Munro <tmunro@postgresql.org> | 2020-06-16 13:50:56 +1200 |
---|---|---|
committer | Thomas Munro <tmunro@postgresql.org> | 2020-06-16 17:00:06 +1200 |
commit | 3e0b08c404b2a7d799db78eb942a01534ac7926b (patch) | |
tree | 8f20031ac26b792230511e0ad4ce140430da4762 /src/backend/replication/backup_manifest.c | |
parent | a2c72851a898170ee1f2e7c21c1bf9086dec2d5c (diff) |
Fix buffile.c error handling.
Convert buffile.c error handling to use ereport. This fixes cases where
I/O errors were indistinguishable from EOF or not reported. Also remove
"%m" from error messages where errno would be bogus. While we're
modifying those strings, add block numbers and short read byte counts
where appropriate.
Back-patch to all supported releases.
Reported-by: Amit Khandekar <amitdkhan.pg@gmail.com>
Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>
Reviewed-by: Alvaro Herrera <alvherre@2ndquadrant.com>
Reviewed-by: Robert Haas <robertmhaas@gmail.com>
Reviewed-by: Ibrar Ahmed <ibrar.ahmad@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/CA%2BhUKGJE04G%3D8TLK0DLypT_27D9dR8F1RQgNp0jK6qR0tZGWOw%40mail.gmail.com
Diffstat (limited to 'src/backend/replication/backup_manifest.c')
-rw-r--r-- | src/backend/replication/backup_manifest.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/src/backend/replication/backup_manifest.c b/src/backend/replication/backup_manifest.c index 807c5f16b4f..b6260049271 100644 --- a/src/backend/replication/backup_manifest.c +++ b/src/backend/replication/backup_manifest.c @@ -319,7 +319,7 @@ SendBackupManifest(backup_manifest_info *manifest) if (BufFileSeek(manifest->buffile, 0, 0L, SEEK_SET)) ereport(ERROR, (errcode_for_file_access(), - errmsg("could not rewind temporary file: %m"))); + errmsg("could not rewind temporary file"))); /* Send CopyOutResponse message */ pq_beginmessage(&protobuf, 'H'); @@ -365,15 +365,10 @@ static void AppendStringToManifest(backup_manifest_info *manifest, char *s) { int len = strlen(s); - size_t written; Assert(manifest != NULL); if (manifest->still_checksumming) pg_sha256_update(&manifest->manifest_ctx, (uint8 *) s, len); - written = BufFileWrite(manifest->buffile, s, len); - if (written != len) - ereport(ERROR, - (errcode_for_file_access(), - errmsg("could not write to temporary file: %m"))); + BufFileWrite(manifest->buffile, s, len); manifest->manifest_size += len; } |