Hackers, In src/backend/storage/ipc/barrier.c, BarrierAttach goes to the bother of storing the phase before releasing the spinlock, and then returns the phase.
In nodeHash.c, ExecHashTableCreate ignores the phase returned by BarrierAttach, and then immediately calls BarrierPhase to get the phase that it just ignored. I don't know that there is anything wrong with this, but if the phase can be retrieved after the spinlock is released, why hold the spinlock extra long in BarrierAttach? Just asking.... mark