From 96b3c44bf9850b106751facd1e7d2d77543fe9d4 Mon Sep 17 00:00:00 2001 From: Nathan Bossart Date: Tue, 15 Feb 2022 09:53:58 -0800 Subject: [PATCH v12 2/2] minor improvements to replication code --- .../replication/logical/reorderbuffer.c | 2 +- src/backend/replication/logical/snapbuild.c | 18 ++---------------- 2 files changed, 3 insertions(+), 17 deletions(-) diff --git a/src/backend/replication/logical/reorderbuffer.c b/src/backend/replication/logical/reorderbuffer.c index 63ef55f3f7..532c3e4630 100644 --- a/src/backend/replication/logical/reorderbuffer.c +++ b/src/backend/replication/logical/reorderbuffer.c @@ -4414,7 +4414,7 @@ ReorderBufferCleanupSerializedTXNs(const char *slotname) sprintf(path, "pg_replslot/%s", slotname); spill_dir = AllocateDir(path); - while ((spill_de = ReadDirExtended(spill_dir, path, INFO)) != NULL) + while ((spill_de = ReadDir(spill_dir, path)) != NULL) { /* only look at names that can be ours */ if (strncmp(spill_de->d_name, "xid", 3) == 0) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index df50abfd98..6a60e942b7 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -1965,16 +1965,10 @@ CheckPointSnapBuild(void) * everything but are postfixed by .$pid.tmp. We can just remove them * the same as other files because there can be none that are * currently being written that are older than cutoff. - * - * We just log a message if a file doesn't fit the pattern, it's - * probably some editors lock/state file or similar... */ if (sscanf(snap_de->d_name, "%X-%X.snap", &hi, &lo) != 2) - { - ereport(LOG, + ereport(ERROR, (errmsg("could not parse file name \"%s\"", path))); - continue; - } lsn = ((uint64) hi) << 32 | lo; @@ -1983,19 +1977,11 @@ CheckPointSnapBuild(void) { elog(DEBUG1, "removing snapbuild snapshot %s", path); - /* - * It's not particularly harmful, though strange, if we can't - * remove the file here. Don't prevent the checkpoint from - * completing, that'd be a cure worse than the disease. - */ if (unlink(path) < 0) - { - ereport(LOG, + ereport(ERROR, (errcode_for_file_access(), errmsg("could not remove file \"%s\": %m", path))); - continue; - } } } FreeDir(snap_dir); -- 2.25.1