aboutsummaryrefslogtreecommitdiff
path: root/src/backend/tcop/postgres.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2021-05-15 12:21:06 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2021-05-15 12:21:06 -0400
commit30d8bad494ad1f604295033e4f4de4b8f258fe74 (patch)
treef150ef5bf98f8d751e02d26faf072d2e666d1e80 /src/backend/tcop/postgres.c
parent8f72bbac3e4b1d1be9598e8edb9353fa5dc48138 (diff)
downloadpostgresql-30d8bad494ad1f604295033e4f4de4b8f258fe74.tar.gz
postgresql-30d8bad494ad1f604295033e4f4de4b8f258fe74.zip
Be more careful about barriers when releasing BackgroundWorkerSlots.
ForgetBackgroundWorker lacked any memory barrier at all, while BackgroundWorkerStateChange had one but unaccountably did additional manipulation of the slot after the barrier. AFAICS, the rule must be that the barrier is immediately before setting or clearing slot->in_use. It looks like back in 9.6 when ForgetBackgroundWorker was first written, there might have been some case for not needing a barrier there, but I'm not very convinced of that --- the fact that the load of bgw_notify_pid is in the caller doesn't seem to guarantee no memory ordering problem. So patch 9.6 too. It's likely that this doesn't fix any observable bug on Intel hardware, but machines with weaker memory ordering rules could have problems here. Discussion: https://postgr.es/m/4046084.1620244003@sss.pgh.pa.us
Diffstat (limited to 'src/backend/tcop/postgres.c')
0 files changed, 0 insertions, 0 deletions