Re: Consider pipeline implicit transaction as a transaction block

From: Anthonin Bonnefoy <anthonin(dot)bonnefoy(at)datadoghq(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Jelte Fennema-Nio <postgres(at)jeltef(dot)nl>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: Consider pipeline implicit transaction as a transaction block
Date: 2024-11-20 17:03:12
Message-ID: CAO6_XqoDecafPKNZCWu9PGVeR1c9QrTL-nmDL9Hf-8=grybozQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Nov 5, 2024 at 6:50 AM Michael Paquier <michael(at)paquier(dot)xyz> wrote:
> It would be nice to document all these behaviors with regression
> tests in pgbench as it is the only place where we can control that
> with error pattern checks.
It's not the first time I wanted to be able to do pipelining in psql
as relying on pgbench and tap tests is not the most flexible so I took
a stab at adding it.

0001: This is a small bug I've stumbled upon. The query buffer is not
cleared on a backslash error. For example, "SELECT 1 \parse" would
fail due to a missing statement name but would leave "SELECT 1\n" in
the query buffer which would impact the next command.

0002: This adds pipeline support to psql by adding the same
meta-commands as pgbench: \startpipeline, \endpipeline and
\syncpipeline. Once a pipeline is started, all extended protocol
queries are piped until \endpipeline is called. To keep things simple,
meta-commands like \gx, \gdesc and \gexec are forbidden inside a
pipeline. The tests are covering the existing pipelining behaviour
with the SET LOCAL, SAVEPOINTS, REINDEX CONCURRENTLY and LOCK
commands, depending if it's the first command or not. The
\syncpipeline allows us to see that this "first command" behaviour
also happens after a synchronisation point within a pipeline.

0003: The initial change to use implicit transaction block when
pipelining is detected. The tests reflect the change in behaviour like
the LOCK command working if it's the second command in the pipeline.
I've updated the pipeline documentation to provide more details about
the use of implicit transaction blocks with pipelines.

Attachment Content-Type Size
v03-0001-Reset-query-buffer-on-a-backslash-error.patch application/octet-stream 3.6 KB
v03-0003-Consider-pipeline-implicit-transaction-as-a-tran.patch application/octet-stream 10.1 KB
v03-0002-Add-pipeline-support-in-psql.patch application/octet-stream 24.9 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2024-11-20 17:06:45 Re: [PATCH] Fixed assertion issues in "pg_get_viewdef"
Previous Message Bruce Momjian 2024-11-20 17:00:28 Re: Statistics Import and Export