No need to wait for idle-in-transaction sessions during index builds.
GetCurrentVirtualXIDs() specifically *includes* backends that have
proc->xmin == InvalidTransactionId (0), but I'm not sure why.
$SUBJECT is currently used by DefineIndex() to wait for all backends
that might be able to see index changes in phase 2 of concurrent index
build. The code comments say "we have to wait out any transactions that
might have older snapshots". If proc->xmin == 0 it is because they
haven't got any snapshots at all and therefore the index build does
*not* need to wait for them.
I'm using this routine for Hot Standby also, so patching this will allow
me to ignore idle-in-transaction sessions unless they are from
serializable transactions or have open cursors. But there's no need for
me to include this in the patch if its a general fix.
--
Simon Riggs www.2ndQuadrant.com
PostgreSQL Training, Services and Support