diff options
| author | Michael Paquier | 2023-09-08 01:00:29 +0000 |
|---|---|---|
| committer | Michael Paquier | 2023-09-08 01:00:29 +0000 |
| commit | e722846daf4a37797ee39bc8ca3e78a4ef437f51 (patch) | |
| tree | fec6d4dbb0d37bc3d3d53a672f039486a2db6f18 | |
| 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
| -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; } |
