Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e722846

Browse filesBrowse files
committed
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
1 parent 8438a3f commit e722846
Copy full SHA for e722846

File tree

Expand file treeCollapse file tree

1 file changed

+3
-3
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+3
-3
lines changed

‎src/backend/storage/ipc/procarray.c

Copy file name to clipboardExpand all lines: src/backend/storage/ipc/procarray.c
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3174,11 +3174,11 @@ BackendXidGetPid(TransactionId xid)
31743174

31753175
for (index = 0; index < arrayP->numProcs; index++)
31763176
{
3177-
int pgprocno = arrayP->pgprocnos[index];
3178-
PGPROC *proc = &allProcs[pgprocno];
3179-
31803177
if (other_xids[index] == xid)
31813178
{
3179+
int pgprocno = arrayP->pgprocnos[index];
3180+
PGPROC *proc = &allProcs[pgprocno];
3181+
31823182
result = proc->pid;
31833183
break;
31843184
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.