Re: Consider pipeline implicit transaction as a transaction block

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Jelte Fennema-Nio <postgres(at)jeltef(dot)nl>
Cc: Anthonin Bonnefoy <anthonin(dot)bonnefoy(at)datadoghq(dot)com>, 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-02 03:11:10
Message-ID: ZyWYTlseGSG9Zfq1@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Oct 31, 2024 at 03:32:39PM +0900, Michael Paquier wrote:
> @Tom added in CC: Is there a specific reason why CheckTransactionBlock()
> did not include a check based on XACT_FLAGS_PIPELINING when it got
> introduced in 20432f873140, while IsInTransactionBlock() considers it?

This also makes LOCK able to work flawlessly within pipelines as far
as I can see, as an error would be reported on HEAD. That's nice.

The behavior of the first command is interesting, still this saves
from the checks after any follow-up commands, and this is intended
from what I can see in postgres.c, because the xact flag is only set
once the first command completes.

Now, here is a fancy case: SAVEPOINT and its two brothers. An error
would be reported on HEAD if attempting a SAVEPOINT, complaining that
we are not in a transaction block. The patch causes a different, more
confusing, failure:
FATAL: DefineSavepoint: unexpected state STARTED

This is a bit user-unfriendly. I am not sure to see the point of
supporting savepoints in this context, so perhaps we should just issue
a cleaner error when we are under a XACT_FLAGS_PIPELINING? Reporting
that we are not in a transaction block, while, well, we are in an
implicit transaction block because of the use of pipelines is
confusing. The new error is actually worse.
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Laurenz Albe 2024-11-02 05:46:12 Re: proposal: schema variables
Previous Message Tatsuo Ishii 2024-11-02 03:02:12 Re: Doc: typo in config.sgml