Possible bug in PostgreSQL 9.2 stable: TwoPhaseGetDummyBackendId() - Mailing list pgsql-hackers

From Robert Ross
Subject Possible bug in PostgreSQL 9.2 stable: TwoPhaseGetDummyBackendId()
Date
Msg-id BE1A65FE-5014-4FFB-9D3E-85284EAFB272@translattice.com
Whole thread Raw
Responses Re: Possible bug in PostgreSQL 9.2 stable: TwoPhaseGetDummyBackendId()
List 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





pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: WIP fix proposal for bug #6123
Next
From: Jeff Janes
Date:
Subject: Re: Inserting heap tuples in bulk in COPY