Sami Imseih <[email protected]> wrote: > > > It seems cleaner to introduce a separate message for this case, maybe > > > "PqMsg_ParallelAborted", and keep the existing > > > "ERROR: lost connection to parallel worker" message. > > > > I'm not sure this is worth adjusting the FE/BE protocol. I'd prefer regular > > ERROR message (PqMsg_ErrorResponse), but only in some minimalistic form. The > > worker would only send the message, w/o doing any error handling itself. >
> I was thinking of PqMsg_ParallelAborted because we have precedent already > with PqMsg_Progress which was introduced in f1889729dd3a as the 'P' message > for parallel index progress reported, but later converted to a macro in > a99cc6c6b4b. I realize now that new message type for communication between background worker and the leader backend actually shouldn't need the protocol version to be bumped - see commit f1889729dd3a. However, when adding a new message type, I'd use the opportunity to stop using PqMsg_Terminate in the background worker: per documentation, this one should be sent by frontend to backend. A new message, e.g. PqMsg_WorkerExit, would contain status code. The worker would set zero status code when sending the message at the end of ParallelWorkerMain(), and non-zero in ParallelWorkerShutdown(). Does that make sense to you? -- Antonin Houska Web: https://www.cybertec-postgresql.com
