@ -1243,14 +1243,6 @@ RelationBuildDesc(Oid targetRelId, bool insertIt)
if ( insertIt )
RelationCacheInsert ( relation , true ) ;
/*
* For RelationNeedsWAL ( ) to answer correctly on parallel workers , restore
* rd_firstRelfilenodeSubid . No subtransactions start or end while in
* parallel mode , so the specific SubTransactionId does not matter .
*/
if ( IsParallelWorker ( ) & & RelFileNodeSkippingWAL ( relation - > rd_node ) )
relation - > rd_firstRelfilenodeSubid = TopSubTransactionId ;
/* It's fully valid */
relation - > rd_isvalid = true ;
@ -1273,6 +1265,8 @@ RelationBuildDesc(Oid targetRelId, bool insertIt)
static void
RelationInitPhysicalAddr ( Relation relation )
{
Oid oldnode = relation - > rd_node . relNode ;
/* these relations kinds never have storage */
if ( ! RELKIND_HAS_STORAGE ( relation - > rd_rel - > relkind ) )
return ;
@ -1330,6 +1324,19 @@ RelationInitPhysicalAddr(Relation relation)
elog ( ERROR , " could not find relation mapping for relation \" %s \" , OID %u " ,
RelationGetRelationName ( relation ) , relation - > rd_id ) ;
}
/*
* For RelationNeedsWAL ( ) to answer correctly on parallel workers , restore
* rd_firstRelfilenodeSubid . No subtransactions start or end while in
* parallel mode , so the specific SubTransactionId does not matter .
*/
if ( IsParallelWorker ( ) & & oldnode ! = relation - > rd_node . relNode )
{
if ( RelFileNodeSkippingWAL ( relation - > rd_node ) )
relation - > rd_firstRelfilenodeSubid = TopSubTransactionId ;
else
relation - > rd_firstRelfilenodeSubid = InvalidSubTransactionId ;
}
}
/*