Hi hackers,
during reading the source code of new incremental backup functionality
I noticed that the following condition can by unintentional:
/*
* For newer server versions, likewise create pg_wal/summaries
*/
if (PQserverVersion(conn) < MINIMUM_VERSION_FOR_WAL_SUMMARIES)
{
...
if (pg_mkdir_p(summarydir, pg_dir_create_mode) != 0 &&
errno != EEXIST)
pg_fatal("could not create directory \"%s\": %m", summarydir);
}
This is from src/bin/pg_basebackup/pg_basebackup.c.
Is the condition correct? Shouldn't it be ">=". Otherwise the function
will create "/summaries" only for older PostgreSQL versions.
I've attached a patch to fix it in case this is a typo.
--
Artur
From 24227fdcad1fbdb67e38537bc1d70f65d9bdab05 Mon Sep 17 00:00:00 2001
From: Artur Zakirov <[email protected]>
Date: Fri, 2 Feb 2024 01:04:27 +0100
Subject: [PATCH v1] Fix checking MINIMUM_VERSION_FOR_WAL_SUMMARIES for
creating pg_wal/summaries directory
---
src/bin/pg_basebackup/pg_basebackup.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/bin/pg_basebackup/pg_basebackup.c b/src/bin/pg_basebackup/pg_basebackup.c
index 77489af518..62eba4a962 100644
--- a/src/bin/pg_basebackup/pg_basebackup.c
+++ b/src/bin/pg_basebackup/pg_basebackup.c
@@ -700,7 +700,7 @@ StartLogStreamer(char *startpos, uint32 timeline, char *sysidentifier,
/*
* For newer server versions, likewise create pg_wal/summaries
*/
- if (PQserverVersion(conn) < MINIMUM_VERSION_FOR_WAL_SUMMARIES)
+ if (PQserverVersion(conn) >= MINIMUM_VERSION_FOR_WAL_SUMMARIES)
{
char summarydir[MAXPGPATH];
--
2.40.1