pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Is this a bug in auto vacuum worker?
2+ messages / 2 participants
[nested] [flat]

* Is this a bug in auto vacuum worker?
@ 2019-01-08 18:47  CNG L <congnanluo@gmail.com>
  0 siblings, 1 reply; 2+ messages in thread

From: CNG L @ 2019-01-08 18:47 UTC (permalink / raw)
  To: pgsql-bugs@lists.postgresql.org <pgsql-bugs@lists.postgresql.org>

In AutoVacWorkerMain(), the code calls on_shmem_exit(FreeWorkInfo,0) and
then kill() to send SIGUSR2 to autovacuum launcher process. In
FreeWorkInfo() it sets AutoVacuumShmem->av_signal[AutoVacRebalance] = true.
But, is it possible that when autovacuum launcher’s SIGUSR2 handler checks
av_signal[AutoVacRebalance], FreeWorkInfo() haven’t set this flag yet and
thus autovacuum launcher will miss the AutoVacRebalance event?

^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Is this a bug in auto vacuum worker?
@ 2019-01-09 04:50  Michael Paquier <michael@paquier.xyz>
  parent: CNG L <congnanluo@gmail.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Michael Paquier @ 2019-01-09 04:50 UTC (permalink / raw)
  To: CNG L <congnanluo@gmail.com>; +Cc: pgsql-bugs@lists.postgresql.org <pgsql-bugs@lists.postgresql.org>

On Tue, Jan 08, 2019 at 10:47:01AM -0800, CNG L wrote:
> In AutoVacWorkerMain(), the code calls on_shmem_exit(FreeWorkInfo,0) and
> then kill() to send SIGUSR2 to autovacuum launcher process. In
> FreeWorkInfo() it sets AutoVacuumShmem->av_signal[AutoVacRebalance] = true.
> But, is it possible that when autovacuum launcher’s SIGUSR2 handler checks
> av_signal[AutoVacRebalance], FreeWorkInfo() haven’t set this flag yet and
> thus autovacuum launcher will miss the AutoVacRebalance event?

No, I don't think so.  There are a couple of instructions between the
moment SIGUSR2 is sent from the worker to the launcher for rebalancing
and the moment where on_shmem_exit() callbacks are called, still the
launcher gets aware of the death of the worker in ProcKill, so the
order of the events is right (double-checked manually as well):
1) Send SIGUSR2 from the worker to the launcher, asking for
rebalancing.
2) shmem callback is called.
3) launcher noticies the death of the worker, sees the signal, and
triggers the rebalancing.
--
Michael

Attachments:

  signature.asc (application/pgp-signature, 832B) download

^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2019-01-09 04:50 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-01-08 18:47 Is this a bug in auto vacuum worker? CNG L <congnanluo@gmail.com>
2019-01-09 04:50 ` Michael Paquier <michael@paquier.xyz>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox