Re: trying again to get incremental backup

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Dilip Kumar <dilipbalaut(at)gmail(dot)com>
Cc: Andres Freund <andres(at)anarazel(dot)de>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: trying again to get incremental backup
Date: 2023-10-03 18:21:00
Message-ID: CA+Tgmoa_Gq2Qc9dh-WiZEUyF-nk3XULuQR-zFY2vOGNWRCZjkQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Sep 12, 2023 at 5:56 AM Dilip Kumar <dilipbalaut(at)gmail(dot)com> wrote:
> + BlockNumber relative_block_numbers[RELSEG_SIZE];
>
> This is close to 400kB of memory, so I think it is better we palloc it
> instead of keeping it in the stack.

Fixed.

> Unrelated code refactoring hunk

Fixed.

> This structure is not used anywhere.

Removed.

> /If the file is to be set incrementally/If the file is to be sent incrementally

Fixed.

> I do not really like this change, because after removing this you have
> put 2 independent checks for sending the full file[1] and sending it
> incrementally[1]. Actually for sending incrementally
> 'statbuf->st_size' is computed from the 'num_incremental_blocks'
> itself so why don't we keep this breaking condition in the while loop
> itself? So that we can avoid these two separate conditions.

I don't think that would be correct. The number of bytes that need to
be read from the original file is not equal to the number of bytes
that will be written to the incremental file. Admittedly, they're
currently different by less than a block, but that could change if we
change the format of the incremental file (e.g. suppose we compressed
the blocks in the incremental file with gzip, or smushed out the holes
in the pages). I wrote the loop as I did precisely so that the two
cases could have different loop exit conditions.

> Better we add some comments for these structures.

Done.

Here's a new patch set, also addressing Jakub's observation that
MINIMUM_VERSION_FOR_WAL_SUMMARIES needed updating.

--
Robert Haas
EDB: http://www.enterprisedb.com

Attachment Content-Type Size
v3-0002-Refactor-parse_filename_for_nontemp_relation-to-p.patch application/octet-stream 11.9 KB
v3-0004-Move-src-bin-pg_verifybackup-parse_manifest.c-int.patch application/octet-stream 4.3 KB
v3-0001-Change-struct-tablespaceinfo-s-oid-member-from-ch.patch application/octet-stream 11.7 KB
v3-0003-Change-how-a-base-backup-decides-which-files-have.patch application/octet-stream 11.4 KB
v3-0005-Prototype-patch-for-incremental-and-differential-.patch application/octet-stream 307.7 KB
v3-0006-Add-new-pg_walsummary-tool.patch application/octet-stream 11.4 KB
v3-0007-Add-TAP-tests-this-is-broken-doesn-t-work.patch application/octet-stream 12.0 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeff Davis 2023-10-03 19:15:10 Re: Pre-proposal: unicode normalized text
Previous Message James Coleman 2023-10-03 18:00:11 Re: RFC: Logging plan of the running query