diff options
author | Michael Paquier <michael@paquier.xyz> | 2023-09-08 10:00:29 +0900 |
---|---|---|
committer | Michael Paquier <michael@paquier.xyz> | 2023-09-08 10:00:29 +0900 |
commit | e722846daf4a37797ee39bc8ca3e78a4ef437f51 (patch) | |
tree | fec6d4dbb0d37bc3d3d53a672f039486a2db6f18 /src | |
parent | 8438a3ffef283d12b387eeb73616809e4c409483 (diff) |
Improve BackendXidGetPid() to only access allProcs on matching XID
Compilers are able to optimize that, but it makes the code slightly more
readable this way.
Author: Zhao Junwang
Reviewed-by: Ashutosh Bapat
Discussion: https://postgr.es/m/CAEG8a3+i9gtqF65B+g_puVaCQuf0rZC-EMqMyEjGFJYOqUUWfA@mail.gmail.com
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/storage/ipc/procarray.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/backend/storage/ipc/procarray.c b/src/backend/storage/ipc/procarray.c index bfbf7f903f5..d93475b2bdd 100644 --- a/src/backend/storage/ipc/procarray.c +++ b/src/backend/storage/ipc/procarray.c @@ -3174,11 +3174,11 @@ BackendXidGetPid(TransactionId xid) for (index = 0; index < arrayP->numProcs; index++) { - int pgprocno = arrayP->pgprocnos[index]; - PGPROC *proc = &allProcs[pgprocno]; - if (other_xids[index] == xid) { + int pgprocno = arrayP->pgprocnos[index]; + PGPROC *proc = &allProcs[pgprocno]; + result = proc->pid; break; } |