Re: [HACKERS] Custom compression methods (mac+lz4.h) - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [HACKERS] Custom compression methods (mac+lz4.h)
Date
Msg-id 558766.1616424108@sss.pgh.pa.us
Whole thread Raw
In response to Re: [HACKERS] Custom compression methods (mac+lz4.h)  (Dilip Kumar <dilipbalaut@gmail.com>)
Responses Re: [HACKERS] Custom compression methods (mac+lz4.h)  (Dilip Kumar <dilipbalaut@gmail.com>)
Re: [HACKERS] Custom compression methods (mac+lz4.h)  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
Dilip Kumar <dilipbalaut@gmail.com> writes:
> On Mon, Mar 22, 2021 at 5:22 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Also, after studying the documentation for LZ4_decompress_safe
>> and LZ4_decompress_safe_partial, I realized that liblz4 is also
>> counting on the *output* buffer size to not be a lie.  So we
>> cannot pass it a number larger than the chunk's true decompressed
>> size.  The attached patch resolves the issue I'm seeing.

> Okay, the fix makes sense.  In fact, IMHO, in general also this fix
> looks like an optimization, I mean when slicelength >=
> VARRAWSIZE_4B_C(value), then why do we need to allocate extra memory
> even in the case of pglz.  So shall we put this check directly in
> toast_decompress_datum_slice instead of handling it at the lz4 level?

Yeah, I thought about that too, but do we want to assume that
VARRAWSIZE_4B_C is the correct way to get the decompressed size
for all compression methods?

(If so, I think it would be better style to have a less opaque macro
name for the purpose.)

            regards, tom lane



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: [HACKERS] Custom compression methods
Next
From: "Drouvot, Bertrand"
Date:
Subject: Re: Minimal logical decoding on standbys