Question about initial logical decoding snapshot - Mailing list pgsql-hackers

From Chong Wang
Subject Question about initial logical decoding snapshot
Date
Msg-id SA1PR05MB8676BED58D78CB10507227F1D4F09@SA1PR05MB8676.namprd05.prod.outlook.com
Whole thread Raw
Responses Re: Question about initial logical decoding snapshot  (Amit Kapila <amit.kapila16@gmail.com>)
Re: Question about initial logical decoding snapshot  (shveta malik <shveta.malik@gmail.com>)
List pgsql-hackers

Hi hackers.

I'm studying the source code about creation of initial logical decoding snapshot. What confused me is that why must we process 3 xl_running_xacts before we get to the consistent state. I think we only need 2 xl_running_xacts.

I think we can get to consistent state when we meet the 2nd xl_running_xact with its oldestRunningXid > 1st xl_running_xact's nextXid, this means the active transactions in 1st xl_running_xact all had commited, and we have all the logs of transactions who will commit afterwards, so there is consistent state in this time point and we can export a snapshot.

I had read the discussion in [0] and the comment of commit '955a684', but I haven't got a detailed explanation about why we need 4 stages during creation of initial logical decoding snapshot but not 3 stages.

My rencent job is relevant to logical decoding so I want to figure this problem out, I'm very grateful if you can answer me, thanks.

 

[0] https://www.postgresql.org/message-id/flat/f37e975c-908f-858e-707f-058d3b1eb214%402ndquadrant.com

 

--

Best regards

Chong Wang

Greenplum DataFlow team

pgsql-hackers by date:

Previous
From: Joseph Koshakow
Date:
Subject: Re: Infinite Interval
Next
From: Nathan Bossart
Date:
Subject: Re: Simplify standby state machine a bit in WaitForWALToBecomeAvailable()