Possible bug in PostgreSQL 9.2 stable: TwoPhaseGetDummyBackendId()

From: Robert Ross <rross(at)translattice(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Possible bug in PostgreSQL 9.2 stable: TwoPhaseGetDummyBackendId()
Date: 2012-08-07 22:45:38
Message-ID: BE1A65FE-5014-4FFB-9D3E-85284EAFB272@translattice.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I have looked at the Postgres 9.2 stable and Postgres 9.2 beta 3 git
archives and this bug still appears to be present.

TwoPhaseGetDummyProc returns a PGPROC*. In 9.0, it was safe for
TwoPhaseGetDummyBackendId() to cast this to a GlobalTransaction
because the GlobalTransactionData structure's first element was always
a PGPROC structure. However, in 9.2 this is no longer true. Despite
the mismatch that now exists between the structures,
TwoPhaseGetDummyBackendId() still attempts to cast a PGPROC* to a
GlobalTransaction to extract the member 'dummyBackendId'. Rewriting
this function to use the GlobalTransaction structure that is found in
TwoPhaseState->prepXacts[] appears to fix the problem. In practice
this appears to result in TwoPhaseGetDummyBackendId() returning
invalid values (such as 0) instead of the expected range above
MaxBackends. I'm not sure why this hasn't caused problems with
multixact.c's use of this function.

Is this a known bug? Would it be helpful to submit a patch?

Regards,

Robert Ross

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2012-08-07 23:08:14 Re: WIP patch for LATERAL subqueries
Previous Message Tom Lane 2012-08-07 21:11:17 Re: WIP: pg_pretty_query