Re: refactoring basebackup.c - Mailing list pgsql-hackers

From Jeevan Ladhe
Subject Re: refactoring basebackup.c
Date
Msg-id CANm22Cj4qakrKy5Evkt29tnW9WqqgfB1u3O_btwYGhPp_M18pw@mail.gmail.com
Whole thread Raw
In response to Re: refactoring basebackup.c  (Jeevan Ladhe <jeevan.ladhe@enterprisedb.com>)
Responses Re: refactoring basebackup.c  (Dipesh Pandit <dipesh.pandit@gmail.com>)
List pgsql-hackers
Thanks for the patch, Dipesh.
With a quick look at the patch I have following observations:

----------------------------------------------------------
In bbstreamer_lz4_compressor_new(), I think this alignment is not needed
on client side:

    /* Align the output buffer length. */
    compressed_bound += compressed_bound + BLCKSZ - (compressed_bound %
BLCKSZ);
----------------------------------------------------------

bbstreamer_lz4_compressor_content(), avail_in and len variables both are
not changed. I think we can simply change the len to avail_in in the
argument list.
----------------------------------------------------------

Comment:
+        * Update the offset and capacity of output buffer based on based on number
+        * of bytes written to output buffer.

I think it is thinko:

+        * Update the offset and capacity of output buffer based on number of
+        * bytes written to output buffer.
----------------------------------------------------------

Indentation:

+       if ((mystreamer->base.bbs_buffer.maxlen - mystreamer->bytes_written) <=
+                       footer_bound)

----------------------------------------------------------
I think similar to bbstreamer_lz4_compressor_content() in
bbstreamer_lz4_decompressor_content() we can change len to avail_in.


Regards,
Jeevan Ladhe

On Thu, 10 Feb 2022 at 18:11, Dipesh Pandit <dipesh.pandit@gmail.com> wrote:
Hi,

> On Mon, Jan 31, 2022 at 4:41 PM Jeevan Ladhe <jeevan.ladhe@enterprisedb.com> wrote:
Hi Robert,

I had an offline discussion with Dipesh, and he will be working on the
lz4 client side decompression part.

Please find the attached patch to support client side compression
and decompression using lz4.

Added a new lz4 bbstreamer to compress the archive chunks at
client if user has specified --compress=clinet-lz4:[LEVEL] option
in pg_basebackup. The new streamer accepts archive chunks
compresses it and forwards it to plain-writer.

Similarly, If a user has specified a server compressed lz4 archive
with plain format (-F p) backup then it requires decompressing
the compressed archive chunks before forwarding it to tar extractor.
Added a new bbstreamer to decompress the compressed archive
and forward it to tar extractor.

Note: This patch can be applied on Jeevan Ladhe's v12 patch
for lz4 compression.

Thanks,
Dipesh

pgsql-hackers by date:

Previous
From: Daniel Gustafsson
Date:
Subject: Re: Plug minor memleak in pg_dump
Next
From: Erik Rijkers
Date:
Subject: faulty link