public inbox for [email protected]
help / color / mirror / Atom feedFrom: Sergei Kornilov <[email protected]>
To: Олег Самойлов <[email protected]>
Cc: [email protected]
Cc: Álvaro Herrera <[email protected]>
Subject: Re: basic_archive lost archive_directory
Date: Fri, 06 Feb 2026 17:25:25 +0300
Message-ID: <1317421770387925@cea5cfd9-50d3-4d85-a924-a7cc75f8f215> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
<[email protected]>
Hello
How to reproduce:
1) configure
archive_mode = on
archive_library = 'basic_archive'
basic_archive.archive_directory = '/some/path/'
2) start postgres and verify archive works
3) make this directory temporary inaccessible. NFS will give you many ways to achieve this, here just mv /some/ /some_moved/ is enough.
4) basic_archive will complain ERROR: could not create file ... No such file or directory for new WAL archive attempts
5) restart archiver process with any reason: kill it or restart postgres
6) make archive_directory accessible again: archiver process will not check the directory's existence again and continue to complain about unconfigured archive_directory
Maybe it makes sense to move the directory existence check from check_archive_directory (guc check callback) to basic_archive_configured? (attached)
regards, Sergei
Attachments:
[text/x-diff] basic_archive_move_is_dir.patch (1.7K, 2-basic_archive_move_is_dir.patch)
download | inline diff:
diff --git a/contrib/basic_archive/basic_archive.c b/contrib/basic_archive/basic_archive.c
index 6c7f985d48b..d46aab39806 100644
--- a/contrib/basic_archive/basic_archive.c
+++ b/contrib/basic_archive/basic_archive.c
@@ -95,8 +95,6 @@ _PG_archive_module_init(void)
static bool
check_archive_directory(char **newval, void **extra, GucSource source)
{
- struct stat st;
-
/*
* The default value is an empty string, so we have to accept that value.
* Our check_configured callback also checks for this and prevents
@@ -115,17 +113,6 @@ check_archive_directory(char **newval, void **extra, GucSource source)
return false;
}
- /*
- * Do a basic sanity check that the specified archive directory exists. It
- * could be removed at some point in the future, so we still need to be
- * prepared for it not to exist in the actual archiving logic.
- */
- if (stat(*newval, &st) != 0 || !S_ISDIR(st.st_mode))
- {
- GUC_check_errdetail("Specified archive directory does not exist.");
- return false;
- }
-
return true;
}
@@ -137,12 +124,23 @@ check_archive_directory(char **newval, void **extra, GucSource source)
static bool
basic_archive_configured(ArchiveModuleState *state)
{
- if (archive_directory != NULL && archive_directory[0] != '\0')
- return true;
+ struct stat st;
- arch_module_check_errdetail("%s is not set.",
+ if (archive_directory == NULL || archive_directory[0] == '\0')
+ {
+ arch_module_check_errdetail("%s is not set.",
"basic_archive.archive_directory");
- return false;
+
+ return false;
+ }
+
+ if (stat(archive_directory, &st) != 0 || !S_ISDIR(st.st_mode))
+ {
+ arch_module_check_errdetail("Specified archive directory does not exist.");
+ return false;
+ }
+
+ return true;
}
/*
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected], [email protected]
Subject: Re: basic_archive lost archive_directory
In-Reply-To: <1317421770387925@cea5cfd9-50d3-4d85-a924-a7cc75f8f215>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox