Bug in TupleQueueReaderNext() ?

Started by Rushabh Lathiaabout 10 years ago2 messages
#1Rushabh Lathia
rushabh.lathia@gmail.com
1 attachment(s)

Hi All,

TupleQueueReaderNext() always pass true for the nowait into
shm_mq_receive() call. I think here it need to pass the nowait
which is passed by the caller of TupleQueueReaderNext.

This is usefull if the caller want TupleQueueReaderNext() to wait
until it gets the tuple from the particular queue.

PFA to fix the same.

Regards,
Rushabh Lathia
www.EnterpriseDB.com

Attachments:

shm_mq_nowait.patchtext/x-patch; charset=US-ASCII; name=shm_mq_nowait.patchDownload
diff --git a/src/backend/executor/tqueue.c b/src/backend/executor/tqueue.c
index d625b0d..276956e 100644
--- a/src/backend/executor/tqueue.c
+++ b/src/backend/executor/tqueue.c
@@ -535,7 +535,7 @@ TupleQueueReaderNext(TupleQueueReader *reader, bool nowait, bool *done)
 		void	   *data;
 
 		/* Attempt to read a message. */
-		result = shm_mq_receive(reader->queue, &nbytes, &data, true);
+		result = shm_mq_receive(reader->queue, &nbytes, &data, nowait);
 
 		/* If queue is detached, set *done and return NULL. */
 		if (result == SHM_MQ_DETACHED)
#2Robert Haas
robertmhaas@gmail.com
In reply to: Rushabh Lathia (#1)
Re: Bug in TupleQueueReaderNext() ?

On Wed, Dec 16, 2015 at 1:09 AM, Rushabh Lathia
<rushabh.lathia@gmail.com> wrote:

TupleQueueReaderNext() always pass true for the nowait into
shm_mq_receive() call. I think here it need to pass the nowait
which is passed by the caller of TupleQueueReaderNext.

This is usefull if the caller want TupleQueueReaderNext() to wait
until it gets the tuple from the particular queue.

Boy, that's an embarassing mistake. *blushes*

Thanks for the report and fix. Committed.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers