Skip to content

PGXAConnection: HeuristicMixedException during ROLLBACK PREPARED after PREPARE failed #3123

Description

@fladdimir

Describe the issue
When running an XA transaction via quarkus/narayana-jta and the prepare fails (e.g. due to deferred constraint violations), the subsequent abort of the transaction leads to an attempted rollback prepared, which then fails (prepared transaction does not exist), thus raising a HeuristicMixedException.

This is misleading, since the transaction was already rolled back when the prepare failed.

Driver Version?
42.6.0

Java Version?
openjdk version "17.0.10" 2024-01-16
OpenJDK Runtime Environment Temurin-17.0.10+7 (build 17.0.10+7)
OpenJDK 64-Bit Server VM Temurin-17.0.10+7 (build 17.0.10+7, mixed mode, sharing)

OS Version?
Ubuntu 22.04

PostgreSQL Version?
16.1

To Reproduce
run this test (e.g. via gradle test)

Expected behaviour
The transaction rollback (due to problems during the prepare of a participant) should not seem to cause a HeuristicMixedException.

Logs

postgres_2_1 | 2024-02-11 19:01:01.603 UTC [144] LOG: execute <unnamed>:
ROLLBACK PREPARED
'131077_AAAAAAAAAAAAAP//fwABAQAAm5NlyRltAAAAGHF1YXJrdXM=_AAAAAAAAAAAAAP//
fwABAQAAm5NlyRltAAAAIAAAAAAAAAAA'
postgres_2_1 | 2024-02-11 19:01:01.603 UTC [144] ERROR: prepared transaction
with identifier
"131077_AAAAAAAAAAAAAP//fwABAQAAm5NlyRltAAAAGHF1YXJrdXM=_AAAAAAAAAAAAAP//fwABAQAAm5NlyRltAAAAIAAAAAAAAAAA"
does not exist

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions