pgsql: Initialize atomic variable waitStart in PGPROC, at postmaster st

From: Fujii Masao <fujii(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Initialize atomic variable waitStart in PGPROC, at postmaster st
Date: 2021-02-22 09:26:12
Message-ID: E1lE7To-00087c-3r@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/f05ed5a5cfa55878baa77a1e39d68cb09793b477

Modified Files
--------------
src/backend/access/transam/twophase.c | 10 ++--------
src/backend/storage/lmgr/proc.c | 5 +++--
2 files changed, 5 insertions(+), 10 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Thomas Munro 2021-02-22 11:28:52 pgsql: pg_collation_actual_version() -> pg_collation_current_version().
Previous Message Peter Eisentraut 2021-02-22 07:09:26 pgsql: Improve new hash partition bound check error messages