pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Refactor the syslogger pipe protocol to use a bitmask for its op
Date: Mon, 13 Sep 2021 00:04:11 +0000
Message-ID: <E1mPZSF-0006cE-K7@gemulon.postgresql.org> (raw)

Refactor the syslogger pipe protocol to use a bitmask for its options

The previous protocol expected a set of matching characters to check if
a message sent was the last one or not, that changed depending on the
destination wanted:
- 't' and 'f' tracked the last message of a log sent to stderr.
- 'T' and 'F' tracked the last message of a log sent to csvlog.

This could be extended with more characters when introducing new
destinations, but using a bitmask is much more elegant.  This commit
changes the protocol so as a bitmask is used in the header of a log
chunk message sent to the syslogger, with the following options
available for now:
- log_destination as stderr.
- log_destination as csvlog.
- if a message is the last chunk of a message.

Sehrope found this issue in a patch set to introduce JSON as an option
for log_destination, but his patch made the size of the protocol header
larger.  This commit keeps the same size as the original, and adapts the
protocol as wanted.

Thanks also to Andrew Dunstan and Greg Stark for the discussion.

Author: Michael Paquier, Sehrope Sarkuni
Discussion: https://postgr.es/m/CAH7T-aqswBM6JWe4pDehi1uOiufqe06DJWaU5=X7dDLyqUExHg@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/2d77d835403a20b51e17e59f0343ddc17f431eec

Modified Files
--------------
src/backend/postmaster/syslogger.c | 19 ++++++++++++++-----
src/backend/utils/error/elog.c     |  9 +++++++--
src/include/postmaster/syslogger.h |  8 ++++++--
3 files changed, 27 insertions(+), 9 deletions(-)



Message-ID: <E1mPZSF-0006cE-K7@gemulon.postgresql.org>
Permalink:  ../E1mPZSF-0006cE-K7@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1mPZSF-0006cE-K7@gemulon.postgresql.org

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: michael@paquier.xyz
  Subject: Re: pgsql: Refactor the syslogger pipe protocol to use a bitmask for its op
  In-Reply-To: <E1mPZSF-0006cE-K7@gemulon.postgresql.org>
  References: <E1mPZSF-0006cE-K7@gemulon.postgresql.org>

* 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