On Wed, Aug 4, 2021 at 11:43 PM Robert Haas <robertmh...@gmail.com> wrote: > > Why do you think it's right to install the serialized *active* > snapshot as the *transaction* snapshot? I've been operating on the > presumption that we wanted the worker to install the leader's > transaction snapshot as its transaction snapshot as its transaction > snapshot and the leader's active snapshot as its active snapshot, > because in my mind the active snapshot and the transaction snapshot > are two separate things. However, there's clearly something wrong with > that line of reasoning, because apparently your proposal fixes the > problem and mine doesn't. >
In setting up the snapshot for the execution state used in command execution, GetTransactionSnapshot() is called and (possibly a copy of) the returned snapshot is pushed as the ActiveSnapshot. The way I see it is that there is essentially only one snapshot here, the last-acquired TransactionSnapshot, which the ActiveSnapshot points to (or a copy of it). Rightly or wrongly, my v2/v5 patch is basically changing the code to do the same snapshot setup in each of the parallel workers. So why (current Postgres code, no patches applied) in setting up for parallel-worker execution (in InitializeParallelDSM) does the Postgres code then acquire ANOTHER TransactionSnapshot (by calling GetTransactionSnashot(), which could return CurrentSnapshot or a new snapshot) and serialize that, as well as serializing what the ActiveSnapshot points to, and then restore those in the workers as two separate snapshots? Is it a mistake? Or if intentional and correct, how so? Regards, Greg Nancarrow Fujitsu Australia