pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: Konstantin Knizhnik <k.knizhnik@postgrespro.ru>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Cc: Andrey M. Borodin <x4mmm@yandex-team.ru>
Cc: Даниил Захлыстов <usernamedt@yandex-team.ru>
Subject: Re: libpq compression
Date: Wed, 28 Oct 2020 16:58:10 -0300
Message-ID: <20201028195810.GA6732@alvherre.pgsql> (raw)
In-Reply-To: <22446ba0-058d-624a-a679-edc0215a56c8@postgrespro.ru>

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.





view thread (289+ messages)  latest in thread

Message-ID: <20201028195810.GA6732@alvherre.pgsql>
Permalink:  ../20201028195810.GA6732@alvherre.pgsql/
Also on:    postgresql.org/message-id/20201028195810.GA6732@alvherre.pgsql

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: alvherre@alvh.no-ip.org, k.knizhnik@postgrespro.ru, pgsql-hackers@lists.postgresql.org, x4mmm@yandex-team.ru, usernamedt@yandex-team.ru
  Subject: Re: libpq compression
  In-Reply-To: <20201028195810.GA6732@alvherre.pgsql>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox