Initialize atomic variable waitStart in PGPROC, at postmaster startup.
authorFujii Masao <fujii@postgresql.org>
Mon, 22 Feb 2021 09:25:00 +0000 (18:25 +0900)
committerFujii Masao <fujii@postgresql.org>
Mon, 22 Feb 2021 09:25:00 +0000 (18:25 +0900)
commitf05ed5a5cfa55878baa77a1e39d68cb09793b477
tree73906dc108920a54805d6d4cdf92915278cf6963
parentefbfb642414b61db1567a7a902ace3f307d7564a
Initialize atomic variable waitStart in PGPROC, at postmaster startup.

Commit 46d6e5f567 added the atomic variable "waitStart" into PGPROC struct,
to store the time at which wait for lock acquisition started. Previously
this variable was initialized every time each backend started. Instead,
this commit makes postmaster initialize it at the startup, to ensure that
the variable should be initialized before any use of it.

This commit also moves the code to initialize "waitStart" variable for
prepare transaction, from TwoPhaseGetDummyProc() to MarkAsPreparingGuts().
Because MarkAsPreparingGuts() is more proper place to do that since
it initializes other PGPROC variables.

Author: Fujii Masao
Reviewed-by: Atsushi Torikoshi
Discussion: https://postgr.es/m/1df88660-6f08-cc6e-b7e2-f85296a2bdab@oss.nttdata.com
src/backend/access/transam/twophase.c
src/backend/storage/lmgr/proc.c