Re: refactoring basebackup.c

From: Jeevan Ladhe <jeevanladhe(dot)os(at)gmail(dot)com>
To: Dipesh Pandit <dipesh(dot)pandit(at)gmail(dot)com>
Cc: Abhijit Menon-Sen <ams(at)toroid(dot)org>, Robert Haas <robertmhaas(at)gmail(dot)com>, Dmitry Dolgov <9erthalion6(at)gmail(dot)com>, Jeevan Ladhe <jeevan(dot)ladhe(at)enterprisedb(dot)com>, Mark Dilger <mark(dot)dilger(at)enterprisedb(dot)com>, pgsql-hackers(at)postgresql(dot)org, tushar <tushar(dot)ahuja(at)enterprisedb(dot)com>
Subject: Re: refactoring basebackup.c
Date: 2022-02-10 14:31:50
Message-ID: CANm22Cj4qakrKy5Evkt29tnW9WqqgfB1u3O_btwYGhPp_M18pw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(dot)pandit(at)gmail(dot)com> wrote:

> Hi,
>
> > On Mon, Jan 31, 2022 at 4:41 PM Jeevan Ladhe <
> jeevan(dot)ladhe(at)enterprisedb(dot)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
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Erik Rijkers 2022-02-10 14:35:25 faulty link
Previous Message Daniel Gustafsson 2022-02-10 13:57:24 Re: Plug minor memleak in pg_dump