Hi Bertrand, > I wonder if we should pass the copied PID to ProcNumberGetTransactionIds() and > validate it under ProcArrayLock, following the same idea as > pgstat_fetch_stat_backend_by_pid()?
Yes, done in v9-0002, a new patch. pgstat_read_current_status() passes the PID it copied, and ProcNumberGetTransactionIds() reports nothing when the PGPROC entry holds another PID. It changes an exported function, so I would keep it for HEAD. > I think it would make sense to add pid at the end in the backbranches (if we > back patch it), as suggested in [1]. 0001 fixes a misreport in 18, so I think it should go there too. v9 puts the PID at the end of PgStat_Backend, and 0003 puts the user ID after it, so the existing offsets do not change. 0003 is v8-0002 with only that move.' Thanks, Shihao
v9-0002-Check-the-PID-when-reading-the-transaction-status.patch
Description: Binary data
v9-0003-Make-per-backend-statistics-functions-respect-sta.patch
Description: Binary data
v9-0001-Store-the-PID-of-a-backend-in-its-statistics-entr.patch
Description: Binary data
