Re: BUG #15977: Inconsistent behavior in chained transactions

From: fn ln <emuser20140816(at)gmail(dot)com>
To: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
Cc: PostgreSQL Bugs <pgsql-bugs(at)lists(dot)postgresql(dot)org>, PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: BUG #15977: Inconsistent behavior in chained transactions
Date: 2019-08-28 19:29:26
Message-ID: CA+99BHqXfKP=vbX4DmuGY3O8NP+nv-hu-fKLV6JgYj7-COE3CQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

COMMIT AND CHAIN in implicit block leaves blockState as TBLOCK_STARTED,
which doesn't trigger the chaining.
but ROLLBACK AND CHAIN sets the blockState into TBLOCK_ABORT_PENDING, so
the chaining is triggered.

I think disabling s->chain beforehand should do the desired behavior.

2019年8月25日(日) 18:11 Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>:

>
> > The following bug has been logged on the website:
> >
> > Bug reference: 15977
> > Logged by: mtlh kdvt
> > Email address: emuser20140816(at)gmail(dot)com
> > PostgreSQL version: 12beta3
> > Operating system: Windows
> > Description:
> >
> > When a ROLLBACK AND CHAIN command is executed in the implicit transaction
> > block, a new transaction will be started:
> > db=# ROLLBACK AND CHAIN;
> > WARNING: there is no transaction in progress
> > ROLLBACK
> > db=# ROLLBACK AND CHAIN;
> > ROLLBACK
> >
> > However, a COMMIT AND CHAIN command won't start a new transaction:
> > db=# COMMIT AND CHAIN;
> > WARNING: there is no transaction in progress
> > COMMIT
> > db=# COMMIT AND CHAIN;
> > WARNING: there is no transaction in progress
> > COMMIT
>
> Thanks for the report.
>
> Indeed, I confirm, and I should have caught this one while reviewing…
>
> Doc says:
>
> "If AND CHAIN is specified, a new transaction is immediately started with
> the same transaction characteristics as the just finished one. Otherwise,
> no new transaction is started."
>
> If there is no transaction in progress, the spec is undefined. Logically,
> ITSM that there should be no tx reset if none was in progress, so ROLLBACK
> has the wrong behavior?
>
> A quick glance at the code did not yield any obvious culprit, but maybe
> I'm not looking at the right piece of code.
>
> Doc could happend ", if any" to be clearer.
>
> --
> Fabien.

Attachment Content-Type Size
disable_implicit_xact_chaining.patch application/octet-stream 864 bytes

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Jungle Boogie 2019-08-28 20:06:57 Re: BUG #15964: vacuumdb.c:187:10: error: use of undeclared identifier 'FD_SETSIZE'
Previous Message PG Bug reporting form 2019-08-28 17:30:13 BUG #15982: in v11.5, you cannot script existing views

Browse pgsql-hackers by date

  From Date Subject
Next Message Floris Van Nee 2019-08-28 19:31:51 Re: Index Skip Scan
Previous Message Andres Freund 2019-08-28 19:22:55 Re: RFC: seccomp-bpf support