Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1a5594b

Browse files
committed
Call pqPipelineFlush from PQsendFlushRequest
When PQsendFlushRequest() was added by commit 69cf1d5, we argued against adding a PQflush() call in it[1]. This is still the right decision: if the user wants a flush to occur, they can just call that. However, we failed to realize that the message bytes could still be given to the kernel for transmitting when this can be made without blocking. That's what pqPipelineFlush() does, and it is done for every single other message type sent by libpq, so do that. (When the socket is in blocking mode this may indeed block, but that's what all the other libpq message-sending routines do, too.) [1] https://www.postgresql.org/message-id/202106252352.5ca4byasfun5%40alvherre.pgsql Author: Jelte Fennema-Nio <[email protected]> Discussion: https://postgr.es/m/CAGECzQTxZRevRWkKodE-SnJk1Yfm4eKT+8E4Cyq3MJ9YKTnNew@mail.gmail.com
1 parent cd694f6 commit 1a5594b

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/interfaces/libpq/fe-exec.c

+8
Original file line numberDiff line numberDiff line change
@@ -3316,6 +3316,14 @@ PQsendFlushRequest(PGconn *conn)
33163316
return 0;
33173317
}
33183318

3319+
/*
3320+
* Give the data a push (in pipeline mode, only if we're past the size
3321+
* threshold). In nonblock mode, don't complain if we're unable to send
3322+
* it all; PQgetResult() will do any additional flushing needed.
3323+
*/
3324+
if (pqPipelineFlush(conn) < 0)
3325+
return 0;
3326+
33193327
return 1;
33203328
}
33213329

0 commit comments

Comments
 (0)