| From: | Robert Haas <robertmhaas(at)gmail(dot)com> | 
|---|---|
| To: | Pavan Deolasee <pavan(dot)deolasee(at)gmail(dot)com> | 
| Cc: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Tomas Vondra <tomas(dot)vondra(at)enterprisedb(dot)com>, Dilip Kumar <dilipbalaut(at)gmail(dot)com> | 
| Subject: | Re: Shmem queue is not flushed if receiver is not yet attached | 
| Date: | 2022-05-24 15:05:23 | 
| Message-ID: | CA+TgmobTkgXcMsj1EXg=J006oeLcKHPsE-vS8eTRa6NjwfjVng@mail.gmail.com | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-hackers | 
On Thu, Mar 17, 2022 at 3:13 AM Pavan Deolasee <pavan(dot)deolasee(at)gmail(dot)com> wrote:
> While testing on the current PG master, I noticed a problem between backends communicating over a shared memory queue. I think `shm_mq_sendv()` fails to flush the queue, even if  `force_flush` is set to true, if the receiver is not yet attached to the queue. This simple fix solves the problem for me.
>
> On another note, `shm_mq.h` declares `shm_mq_flush()`, but I don't see it being implemented. Maybe just a leftover from the previous work? Though it seems useful to implement that API.
I think that this patch is basically correct, except that it's not
correct to set mqh_counterparty_attached when receiver is still NULL.
Here's a v2 where I've attempted to correct that while preserving the
essence of your proposed fix.
I'm not sure that we need a shm_mq_flush(), but we definitely don't
have one currently, so I've also adjusted your patch to remove the
dead prototype.
Please let me know your thoughts on the attached.
Thanks,
-- 
Robert Haas
EDB: http://www.enterprisedb.com
| Attachment | Content-Type | Size | 
|---|---|---|
| v2-0001-shm_mq_sendv-Fix-flushing-bug-when-receiver-not-y.patch | application/octet-stream | 2.8 KB | 
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Wood May | 2022-05-24 15:12:21 | Reference column alias for common expressions | 
| Previous Message | Robert Haas | 2022-05-24 14:38:22 | Re: PostgreSQL 15 Beta 1 release announcement draft |