use `proc->pgxactoff` as the value of `index` in `ProcArrayRemove()`

From: 盏一 <w(at)hidva(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Cc: andres <andres(at)anarazel(dot)de>
Subject: use `proc->pgxactoff` as the value of `index` in `ProcArrayRemove()`
Date: 2021-05-06 16:30:13
Message-ID: tencent_5624AA3B116B3D1C31CA9744@qq.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

Since we have introduced `pgxactoff` in [941697c3c1ae5d6ee153065adb96e1e63ee11224](https://github.com/postgres/postgres/commit/941697c3c1ae5d6ee153065adb96e1e63ee11224), and `pgxactoff` is always the index of `proc->pgprocno` in `procArray->pgprocnos`. So it seems that we could directly use `proc->pgxactoff` as the value of `index` in `ProcArrayRemove()`? My thought is to replace

```c
for (index = 0; index < arrayP->numProcs; index++)
{
if (arrayP->pgprocnos[index] == proc->pgprocno)
{
/* ... */
}
}
```

with

```c
index = proc->pgxactoff;
/* ... */
```

I would appreciate your help.

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Isaac Morland 2021-05-06 16:37:39 Re: COPY table_name (single_column) FROM 'unknown.txt' DELIMITER E'\n'
Previous Message Justin Pryzby 2021-05-06 16:26:51 Re: Multiple hosts in connection string failed to failover in non-hot standby mode