Re: Checking MINIMUM_VERSION_FOR_WAL_SUMMARIES

From: Yugo NAGATA <nagata(at)sraoss(dot)co(dot)jp>
To: Artur Zakirov <zaartur(at)gmail(dot)com>
Cc: Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Checking MINIMUM_VERSION_FOR_WAL_SUMMARIES
Date: 2024-02-02 08:41:56
Message-ID: 20240202174156.0272031c68033037abfe4fdf@sraoss.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, 2 Feb 2024 01:11:27 +0100
Artur Zakirov <zaartur(at)gmail(dot)com> wrote:

> 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.

I also think it should be ">="
Also, if so, I don't think the check of MINIMUM_VERSION_FOR_PG_WAL
in the block is required, because the directory name is always pg_wal
in the new versions.

Regards,
Yugo Nagata

>
> --
> Artur

--
Yugo NAGATA <nagata(at)sraoss(dot)co(dot)jp>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Sutou Kouhei 2024-02-02 08:46:18 Re: Make COPY format extendable: Extract COPY TO format implementations
Previous Message Nazir Bilal Yavuz 2024-02-02 08:41:07 Re: Checking MINIMUM_VERSION_FOR_WAL_SUMMARIES