Re: Move backup-related code to xlogbackup.c/.h

From: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, Andres Freund <andres(at)anarazel(dot)de>, Nathan Bossart <nathandbossart(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Move backup-related code to xlogbackup.c/.h
Date: 2022-10-26 06:06:17
Message-ID: CALj2ACV77p86Nz=_5BoxV4hhi2jcyeq09tVZkm6N=1ZjS6EoPw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Oct 24, 2022 at 1:00 PM Michael Paquier <michael(at)paquier(dot)xyz> wrote:
>
> On Wed, Oct 19, 2022 at 09:07:04PM +0530, Bharath Rupireddy wrote:
> > XLogBackupResetRunning() seemed better. +1 for above function names.
>
> I see what you are doing here. XLogCtl would still live in xlog.c,
> but we want to have functions that are able to manipulate some of its
> fields.

Right.

> I am not sure to like that much because it introduces a
> circling dependency between xlog.c and xlogbackup.c. As of HEAD,
> xlog.c calls build_backup_content() from xlogbackup.c, which is fine
> as xlog.c is kind of a central piece that feeds on the insert and
> recovery pieces. However your patch makes some code paths of
> xlogbackup.c call routines from xlog.c, and I don't think that we
> should do that.

If you're talking about header file dependency, there's already header
file dependency between them - xlog.c includes xlogbackup.h for
build_backup_content() and xlogbackup.c includes xlog.h for
wal_segment_size. And, I think the same kind of dependency exists
between xlog.c and xlogrecovery.c.

Please note that we're trying to reduce xlog.c file size apart from
centralizing backup related code.

> > I'm okay either way.
> >
> > Please see the attached v8 patch set.
>
> Among all that, CleanupBackupHistory() is different, still it has a
> dependency with some of the archiving pieces..

Is there a problem with that? This function is used solely by backup
functions and it happens to use one of the archiving utility
functions. Please see the other archiving utility functions being used
elsewhere in the code, not only in xlog.c -
for instance, KeepFileRestoredFromArchive() and XLogArchiveNotify().

I'm attaching the v9 patch set herewith after rebasing. Please review
it further.

--
Bharath Rupireddy
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com

Attachment Content-Type Size
v9-0001-Add-functions-for-xlogbackup.c-to-call-back-into-.patch application/x-patch 9.6 KB
v9-0002-Move-backup-related-code-from-xlog.c-to-xlogbacku.patch application/x-patch 51.9 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2022-10-26 06:56:07 Re: Allow file inclusion in pg_hba and pg_ident files
Previous Message Bharath Rupireddy 2022-10-26 04:43:29 Re: Some regression tests for the pg_control_*() functions