aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/backend/replication/logical/snapbuild.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c
index 9e96814f370..f17cbda8a0c 100644
--- a/src/backend/replication/logical/snapbuild.c
+++ b/src/backend/replication/logical/snapbuild.c
@@ -1522,7 +1522,8 @@ SnapBuildSerialize(SnapBuild *builder, XLogRecPtr lsn)
if (ret != 0 && errno != ENOENT)
ereport(ERROR,
- (errmsg("could not stat file \"%s\": %m", path)));
+ (errcode_for_file_access(),
+ errmsg("could not stat file \"%s\": %m", path)));
else if (ret == 0)
{
@@ -1564,7 +1565,7 @@ SnapBuildSerialize(SnapBuild *builder, XLogRecPtr lsn)
if (unlink(tmppath) != 0 && errno != ENOENT)
ereport(ERROR,
(errcode_for_file_access(),
- errmsg("could not remove file \"%s\": %m", path)));
+ errmsg("could not remove file \"%s\": %m", tmppath)));
needed_length = sizeof(SnapBuildOnDisk) +
sizeof(TransactionId) * builder->committed.xcnt;
@@ -1607,7 +1608,8 @@ SnapBuildSerialize(SnapBuild *builder, XLogRecPtr lsn)
O_CREAT | O_EXCL | O_WRONLY | PG_BINARY);
if (fd < 0)
ereport(ERROR,
- (errmsg("could not open file \"%s\": %m", path)));
+ (errcode_for_file_access(),
+ errmsg("could not open file \"%s\": %m", tmppath)));
errno = 0;
pgstat_report_wait_start(WAIT_EVENT_SNAPBUILD_WRITE);
@@ -1739,12 +1741,14 @@ SnapBuildRestore(SnapBuild *builder, XLogRecPtr lsn)
if (ondisk.magic != SNAPBUILD_MAGIC)
ereport(ERROR,
- (errmsg("snapbuild state file \"%s\" has wrong magic number: %u instead of %u",
+ (errcode(ERRCODE_DATA_CORRUPTED),
+ errmsg("snapbuild state file \"%s\" has wrong magic number: %u instead of %u",
path, ondisk.magic, SNAPBUILD_MAGIC)));
if (ondisk.version != SNAPBUILD_VERSION)
ereport(ERROR,
- (errmsg("snapbuild state file \"%s\" has unsupported version: %u instead of %u",
+ (errcode(ERRCODE_DATA_CORRUPTED),
+ errmsg("snapbuild state file \"%s\" has unsupported version: %u instead of %u",
path, ondisk.version, SNAPBUILD_VERSION)));
INIT_CRC32C(checksum);
@@ -1815,7 +1819,7 @@ SnapBuildRestore(SnapBuild *builder, XLogRecPtr lsn)
/* verify checksum of what we've read */
if (!EQ_CRC32C(checksum, ondisk.checksum))
ereport(ERROR,
- (errcode_for_file_access(),
+ (errcode(ERRCODE_DATA_CORRUPTED),
errmsg("checksum mismatch for snapbuild state file \"%s\": is %u, should be %u",
path, checksum, ondisk.checksum)));