On Sat, Feb 16, 2019 at 09:16:01PM +1300, Thomas Munro wrote:
> On Sat, Feb 16, 2019 at 5:31 PM Justin Pryzby <pryzby@telsasoft.com> wrote:
> > Thanks, will leave it spinning overnight.
No errors in ~36 hours (126 CPU-hrs), so that seems to work. Thanks.
> > Do you know if any of the others should also be changed ?
>
> Good question, let me double check...
>
> > $ grep 'refcnt == 0' src/backend/storage/ipc/dsm.c
> > if (refcnt == 0)
>
> That's dsm_cleanup_using_control_segment() and runs when starting up
> before any workers can be running to clean up after a preceding crash,
> so it's OK (if it's 1, meaning we crashed while that slot was going
> away, we'll try to destroy it again, which is correct). Good.
>
> > if (dsm_control->item[i].refcnt == 0)
>
> That's dsm_postmaster_shutdown(), similar but at shutdown time, run by
> the postmaster, and it errs on the side of trying to destroy. Good.
>
> > if (dsm_control->item[i].refcnt == 0)
>
> That's dsm_create(), and it's looking specifically for a free slot,
> and that's 0 only, it'll step over used/active (refcnt > 1) and
> used/going-away (refcnt == 1). Good.