Re: PG13 fails to startup even though the current transaction is equal to the target transaction - Mailing list pgsql-hackers

From Fujii Masao
Subject Re: PG13 fails to startup even though the current transaction is equal to the target transaction
Date
Msg-id 86e9abcd-a902-de62-344e-5c4336b61b58@oss.nttdata.com
Whole thread Raw
In response to Re: PG13 fails to startup even though the current transaction is equal to the target transaction  (Sean Jezewski <sjezewski@salesforce.com>)
List pgsql-hackers

On 2021/03/22 21:40, Sean Jezewski wrote:
> Hi Kyotaro -
> 
> Thanks for the response.
> 
> I think it boils down to your comment:
> 
>  > I'm not sure.  The direct cause of the "issue" is a promotion trigger
>  > that came before reaching recovery target.  That won't happen if the
>  > "someone" doesn't do that.
> 
> I think the question is 'under what conditions is it safe to do the promotion' ?
> 
> What is your recommendation in this case? The end of the archive has been reached. All transactions have been
replayed.And in fact the current transaction id is exactly equal to the target recovery transaction id.
 

I guess that the transaction with this current XID has not been committed
yet at that moment. Right? I thought that because you confirmed the XID
by SELECT pg_catalog.txid_snapshot_xmax(pg_catalog.txid_current_snapshot()).
IIUC this query doesn't return the XID of already-committed transaction.

The standby thinks that the recovery reaches the recovery target when
the XID of *committed* transaction get equal to the recovery_target_xid.
So in your case, the standby didn't reached the recovery target when you
requested the promotion. IMO this is why you got that FATAL error.

Regards,

-- 
Fujii Masao
Advanced Computing Technology Center
Research and Development Headquarters
NTT DATA CORPORATION



pgsql-hackers by date:

Previous
From: Fabrízio de Royes Mello
Date:
Subject: Re: Minimal logical decoding on standbys
Next
From: Robert Haas
Date:
Subject: Re: [HACKERS] Custom compression methods