Content-Length: 269695 | pFad | https://github.com/postgrespro/postgres_cluster/commit/a1480ec1d3bacb9acb08ec09f22bc25bc033115b

E1 shm_mq: Repair breakage from previous commit. · postgrespro/postgres_cluster@a1480ec · GitHub
Skip to content

Commit a1480ec

Browse files
committed
shm_mq: Repair breakage from previous commit.
If the counterparty writes some data into the queue and then detaches, it's wrong to return SHM_MQ_DETACHED right away. If we do that, we fail to read whatever was written.
1 parent 872101b commit a1480ec

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/backend/storage/ipc/shm_mq.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -501,10 +501,12 @@ shm_mq_receive(shm_mq_handle *mqh, Size *nbytesp, void **datap, bool nowait)
501501
{
502502
if (nowait)
503503
{
504-
if (shm_mq_counterparty_gone(mq, mqh->mqh_handle))
505-
return SHM_MQ_DETACHED;
506504
if (shm_mq_get_sender(mq) == NULL)
505+
{
506+
if (shm_mq_counterparty_gone(mq, mqh->mqh_handle))
507+
return SHM_MQ_DETACHED;
507508
return SHM_MQ_WOULD_BLOCK;
509+
}
508510
}
509511
else if (!shm_mq_wait_internal(mq, &mq->mq_sender, mqh->mqh_handle)
510512
&& shm_mq_get_sender(mq) == NULL)

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/postgrespro/postgres_cluster/commit/a1480ec1d3bacb9acb08ec09f22bc25bc033115b

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy