Unbreak notification response message treatment in 4.1.
authorTatsuo Ishii <ishii@sraoss.co.jp>
Mon, 13 Jan 2020 13:39:47 +0000 (22:39 +0900)
committerTatsuo Ishii <ishii@sraoss.co.jp>
Mon, 13 Jan 2020 13:39:47 +0000 (22:39 +0900)
From 4.1 for an optimization sake SimpleForwardToFrontend() does not
flush most type of messages.  However there's an oversight regarding
"notification message" handling. This should have been flushed so that
frontend is immediately notified.

Per bug 573.

src/protocol/pool_process_query.c

index 7002ff238da2b884dfafe98e230b8e4de556e6e6..a6470e15216a7b05f1b6bb9e216341a1b3930d85 100644 (file)
@@ -761,17 +761,18 @@ SimpleForwardToFrontend(char kind, POOL_CONNECTION * frontend,
 
        /*
         * Optimization for other than "Command Complete", "Ready For query",
-        * "Error response" and "Notice message" messages.  Especially, since it
-        * is too often to receive and forward "Data Row" message, we do not flush
-        * the message to frontend now. We expect that "Command Complete" message
-        * (or "Error response" or "Notice response" message) follows the stream
-        * of data row message anyway, so flushing will be done at that time.
+        * "Error response" ,"Notice message" and "Notification response"
+        * messages.  Especially, since it is too often to receive and forward
+        * "Data Row" message, we do not flush the message to frontend now. We
+        * expect that "Command Complete" message (or "Error response" or "Notice
+        * response" message) follows the stream of data row message anyway, so
+        * flushing will be done at that time.
         *
         * Same thing can be said to CopyData message. Tremendous number of
         * CopyData messages are sent to frontend (typical use case is pg_dump).
         * So eliminating per CopyData flush significantly enhances performance.
         */
-       if (kind == 'C' || kind == 'Z' || kind == 'E' || kind == 'N')
+       if (kind == 'C' || kind == 'Z' || kind == 'E' || kind == 'N' || kind == 'A')
        {
                pool_write_and_flush(frontend, p1, len1);
        }