From: | Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> |
---|---|
To: | Konstantin Knizhnik <k(dot)knizhnik(at)postgrespro(dot)ru> |
Cc: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, "Andrey M(dot) Borodin" <x4mmm(at)yandex-team(dot)ru>, Даниил Захлыстов <usernamedt(at)yandex-team(dot)ru> |
Subject: | Re: libpq compression |
Date: | 2020-10-28 19:58:10 |
Message-ID: | 20201028195810.GA6732@alvherre.pgsql |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 2020-Oct-26, Konstantin Knizhnik wrote:
> + while (bufptr < bufend || zpq_buffered(PqStream) != 0) /* has more data to flush or unsent data in internal compression buffer */
> {
> - int r;
> -
> - r = secure_write(MyProcPort, bufptr, bufend - bufptr);
> -
> - if (r <= 0)
> + int r;
> + size_t processed = 0;
> + size_t available = bufend - bufptr;
> + r = PqStream
> + ? zpq_write(PqStream, bufptr, available, &processed)
> + : secure_write(MyProcPort, bufptr, available);
> + bufptr += processed;
> + PqSendStart += processed;
This bit is surprising to me. I thought the whole zpq_write() thing
should be hidden inside secure_write, so internal_flush would continue
to call just secure_write; and it is that routine's responsibility to
call zpq_write or be_tls_write or secure_raw_write etc according to
compile-time options and socket state.
From | Date | Subject | |
---|---|---|---|
Next Message | John Naylor | 2020-10-28 19:58:33 | Re: duplicate function oid symbols |
Previous Message | Alexander Kukushkin | 2020-10-28 19:43:48 | pg_prewarm bgworker could break fast shutdown |