From: Kyotaro Horiguchi Date: Fri, 1 Feb 2019 09:45:48 +0900 Subject: [PATCH 1/2] Add start timestamp to PGPROC A ProcArray element may be allocated to another session while investigating. Pid is not fully relialble for cheking that because of the possibility of reusing. Add start timestamp to resolve the issue. --- src/backend/storage/lmgr/proc.c | 2 ++ src/include/storage/proc.h | 1 + 2 files changed, 3 insertions(+) diff --git a/src/backend/storage/lmgr/proc.c b/src/backend/storage/lmgr/proc.c index 89c80fb687..a63309a432 100644 --- a/src/backend/storage/lmgr/proc.c +++ b/src/backend/storage/lmgr/proc.c @@ -373,6 +373,8 @@ InitProcess(void) MyProc->fpLocalTransactionId = InvalidLocalTransactionId; MyPgXact->xid = InvalidTransactionId; MyPgXact->xmin = InvalidTransactionId; + /* set this before pid to get rid of wrong pair with pid */ + MyProc->starttimestamp = MyStartTimestamp; MyProc->pid = MyProcPid; /* backendId, databaseId and roleId will be filled in later */ MyProc->backendId = InvalidBackendId; diff --git a/src/include/storage/proc.h b/src/include/storage/proc.h index d203acbb30..2cebdd2646 100644 --- a/src/include/storage/proc.h +++ b/src/include/storage/proc.h @@ -108,6 +108,7 @@ struct PGPROC * else InvalidLocalTransactionId */ int pid; /* Backend's process ID; 0 if prepared xact */ int pgprocno; + uint64 starttimestamp; /* Backend's start timestamp */ /* These fields are zero while a backend is still starting up: */ BackendId backendId; /* This backend's backend ID (if assigned) */ -- 2.16.3 ----Next_Part(Fri_Feb_01_17_30_12_2019_719)-- Content-Type: Text/X-Patch; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="0002-Remote-GUC-via-shmem-ALTER-SESSION-NoXact-SET-versio.patch"