This is an automated email from the ASF dual-hosted git repository.

leborchuk pushed a commit to branch REL_2_STABLE
in repository https://gitbox.apache.org/repos/asf/cloudberry.git

commit 8a28a1e04a3618a4f1039375968d8cced3427a13
Author: Alvaro Herrera <[email protected]>
AuthorDate: Wed Nov 8 16:44:08 2023 +0100

    Call pqPipelineFlush from PQsendFlushRequest
    
    When PQsendFlushRequest() was added by commit 69cf1d5429d4, 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+8e4cyq3mj9yktn...@mail.gmail.com
    (cherry picked from commit 99fa98766fa59270083606d9386386c3e7131a7a)
---
 src/interfaces/libpq/fe-exec.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/interfaces/libpq/fe-exec.c b/src/interfaces/libpq/fe-exec.c
index eb95ffde54f..e10c312c13d 100644
--- a/src/interfaces/libpq/fe-exec.c
+++ b/src/interfaces/libpq/fe-exec.c
@@ -3306,6 +3306,14 @@ PQsendFlushRequest(PGconn *conn)
                return 0;
        }
 
+       /*
+        * Give the data a push (in pipeline mode, only if we're past the size
+        * threshold).  In nonblock mode, don't complain if we're unable to send
+        * it all; PQgetResult() will do any additional flushing needed.
+        */
+       if (pqPipelineFlush(conn) < 0)
+               return 0;
+
        return 1;
 }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to