From: | Konstantin Knizhnik <k(dot)knizhnik(at)postgrespro(dot)ru> |
---|---|
To: | Dmitry Dolgov <9erthalion6(at)gmail(dot)com> |
Cc: | Andreas Karlsson <andreas(at)proxel(dot)se>, Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: libpq compression |
Date: | 2019-02-13 15:03:04 |
Message-ID: | 8da581ac-62a5-a64a-7dc4-f09ce936612a@postgrespro.ru |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 13.02.2019 17:54, Dmitry Dolgov wrote:
>> On Wed, Feb 13, 2019 at 3:52 PM Dmitry Dolgov <9erthalion6(at)gmail(dot)com> wrote:
>>
>>> On Wed, Feb 13, 2019 at 3:46 PM Konstantin Knizhnik
>>> <k(dot)knizhnik(at)postgrespro(dot)ru> wrote:
>>>
>>> Moreover, please notice that your implementation is still passing functions
>>> tx/rx functions to stream constructor and so zpq_read is still able to read
>>> data itself. So I do not understand which problem you have solved by
>>> replacing zpq_read with pair of zpq_read_drain+zpq_read.
>> Nope, I've removed the call of these functions from zlib_read/write, just
>> forgot to remove the initialization part.
> Oh, I see the source of confusion. Due to lack of time I've implemented my
> changes only for zlib part, sorry that I didn't mention that before.
And I have looked at zstd part;)
Ok, but still I think that it is better to pass tx/rx function to stream.
There are two important advantages:
1. It eliminates code duplication.
2. It allows to use (in future) this streaming compression not only for
libpq for for other streaming data.
And I do not see any disadvantages.
Concerning "layering violation" may be it is better to introduce some
other functions something like inflate_read, deflate_write and call them
instead of *secure_read.
But from my point of view it will not improve readability and modularity
of code.
--
Konstantin Knizhnik
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company
From | Date | Subject | |
---|---|---|---|
Next Message | Stephen Frost | 2019-02-13 15:31:29 | Re: WAL insert delay settings |
Previous Message | Tom Lane | 2019-02-13 14:57:27 | Re: WAL insert delay settings |