@ -698,7 +698,10 @@ ProcArrayEndTransaction(PGPROC *proc, TransactionId latestXid)
proc - > lxid = InvalidLocalTransactionId ;
proc - > lxid = InvalidLocalTransactionId ;
proc - > xmin = InvalidTransactionId ;
proc - > xmin = InvalidTransactionId ;
proc - > delayChkpt = false ; /* be sure this is cleared in abort */
/* be sure this is cleared in abort */
proc - > delayChkpt = 0 ;
proc - > recoveryConflictPending = false ;
proc - > recoveryConflictPending = false ;
/* must be cleared with xid/xmin: */
/* must be cleared with xid/xmin: */
@ -737,7 +740,10 @@ ProcArrayEndTransactionInternal(PGPROC *proc, TransactionId latestXid)
proc - > xid = InvalidTransactionId ;
proc - > xid = InvalidTransactionId ;
proc - > lxid = InvalidLocalTransactionId ;
proc - > lxid = InvalidLocalTransactionId ;
proc - > xmin = InvalidTransactionId ;
proc - > xmin = InvalidTransactionId ;
proc - > delayChkpt = false ; /* be sure this is cleared in abort */
/* be sure this is cleared in abort */
proc - > delayChkpt = 0 ;
proc - > recoveryConflictPending = false ;
proc - > recoveryConflictPending = false ;
/* must be cleared with xid/xmin: */
/* must be cleared with xid/xmin: */
@ -3053,7 +3059,8 @@ GetOldestSafeDecodingTransactionId(bool catalogOnly)
* delaying checkpoint because they have critical actions in progress .
* delaying checkpoint because they have critical actions in progress .
*
*
* Constructs an array of VXIDs of transactions that are currently in commit
* Constructs an array of VXIDs of transactions that are currently in commit
* critical sections , as shown by having delayChkpt set in their PGPROC .
* critical sections , as shown by having specified delayChkpt bits set in their
* PGPROC .
*
*
* Returns a palloc ' d array that should be freed by the caller .
* Returns a palloc ' d array that should be freed by the caller .
* * nvxids is the number of valid entries .
* * nvxids is the number of valid entries .
@ -3067,13 +3074,15 @@ GetOldestSafeDecodingTransactionId(bool catalogOnly)
* for clearing of delayChkpt to propagate is unimportant for correctness .
* for clearing of delayChkpt to propagate is unimportant for correctness .
*/
*/
VirtualTransactionId *
VirtualTransactionId *
GetVirtualXIDsDelayingChkpt ( int * nvxids )
GetVirtualXIDsDelayingChkpt ( int * nvxids , int type )
{
{
VirtualTransactionId * vxids ;
VirtualTransactionId * vxids ;
ProcArrayStruct * arrayP = procArray ;
ProcArrayStruct * arrayP = procArray ;
int count = 0 ;
int count = 0 ;
int index ;
int index ;
Assert ( type ! = 0 ) ;
/* allocate what's certainly enough result space */
/* allocate what's certainly enough result space */
vxids = ( VirtualTransactionId * )
vxids = ( VirtualTransactionId * )
palloc ( sizeof ( VirtualTransactionId ) * arrayP - > maxProcs ) ;
palloc ( sizeof ( VirtualTransactionId ) * arrayP - > maxProcs ) ;
@ -3085,7 +3094,7 @@ GetVirtualXIDsDelayingChkpt(int *nvxids)
int pgprocno = arrayP - > pgprocnos [ index ] ;
int pgprocno = arrayP - > pgprocnos [ index ] ;
PGPROC * proc = & allProcs [ pgprocno ] ;
PGPROC * proc = & allProcs [ pgprocno ] ;
if ( proc - > delayChkpt )
if ( ( proc - > delayChkpt & type ) ! = 0 )
{
{
VirtualTransactionId vxid ;
VirtualTransactionId vxid ;
@ -3111,12 +3120,14 @@ GetVirtualXIDsDelayingChkpt(int *nvxids)
* those numbers should be small enough for it not to be a problem .
* those numbers should be small enough for it not to be a problem .
*/
*/
bool
bool
HaveVirtualXIDsDelayingChkpt ( VirtualTransactionId * vxids , int nvxids )
HaveVirtualXIDsDelayingChkpt ( VirtualTransactionId * vxids , int nvxids , int type )
{
{
bool result = false ;
bool result = false ;
ProcArrayStruct * arrayP = procArray ;
ProcArrayStruct * arrayP = procArray ;
int index ;
int index ;
Assert ( type ! = 0 ) ;
LWLockAcquire ( ProcArrayLock , LW_SHARED ) ;
LWLockAcquire ( ProcArrayLock , LW_SHARED ) ;
for ( index = 0 ; index < arrayP - > numProcs ; index + + )
for ( index = 0 ; index < arrayP - > numProcs ; index + + )
@ -3127,7 +3138,8 @@ HaveVirtualXIDsDelayingChkpt(VirtualTransactionId *vxids, int nvxids)
GET_VXID_FROM_PGPROC ( vxid , * proc ) ;
GET_VXID_FROM_PGPROC ( vxid , * proc ) ;
if ( proc - > delayChkpt & & VirtualTransactionIdIsValid ( vxid ) )
if ( ( proc - > delayChkpt & type ) ! = 0 & &
VirtualTransactionIdIsValid ( vxid ) )
{
{
int i ;
int i ;