Robert Haas <robertmh...@gmail.com> writes: > On Wed, Jun 14, 2017 at 3:33 PM, Tom Lane <t...@sss.pgh.pa.us> wrote: >> So the first problem here is the lack of supporting information for the >> 'could not map' failure.
> Hmm. I think I believed at the time I wrote dsm_attach() that > somebody might want to try to soldier on after failing to map a DSM, > but that doesn't seem very likely any more. Well, if they do, they shouldn't be passing elevel == ERROR. >> AFAICS, this must mean either that dsm_attach() >> returned without ever calling dsm_impl_op() at all, or that >> dsm_impl_op()'s Windows codepath encountered ERROR_ALREADY_EXISTS or >> ERROR_ACCESS_DENIED. It's far from clear why those cases should be >> treated as a silent fail. > There's a good reason for that, though. See > 419113dfdc4c729f6c763cc30a9b02ee68a7da94. But surely the silent treatment should only apply to DSM_OP_CREATE? We're not going to retry anything else. >> It's even less clear why dsm_attach's early >> exit cases don't produce any messages. But since we're left not knowing >> what happened, the messaging design here is clearly inadequate. > I don't know what you mean by this. The function only has one > early-exit case, the comment for which I quoted above. OK, s/cases/case/, but the problem remains. We don't know what happened. We cannot have more than one case in this code where nothing gets logged. >> It's not very clear how that happened, but my >> bet is that the postmaster incremented parallel_terminate_count more than >> once while cleaning up after the crashed worker. It looks to me like >> there's nothing stopping BackgroundWorkerStateChange from incrementing it >> and then the eventual ForgetBackgroundWorker call from incrementing it >> again. I haven't traced through things to identify why this might only >> occur in a worker-failure scenario, but surely we want to make sure that >> the counter increment happens once and only once per worker. > Yeah -- if that can happen, it's definitely a bug. My first thought about fixing it is that we should remove that code from BackgroundWorkerStateChange altogether. The parallel_terminate_count increment should happen in, and only in, ForgetBackgroundWorker. There seems little reason to risk bugs by trying to do it a bit earlier. regards, tom lane -- Sent via pgsql-hackers mailing list (firstname.lastname@example.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers