Fix COPY hangs.
authorTatsuo Ishii <[email protected]>
Mon, 11 Nov 2024 11:17:28 +0000 (20:17 +0900)
committerTatsuo Ishii <[email protected]>
Mon, 11 Nov 2024 11:17:28 +0000 (20:17 +0900)
During COPY IN state (i.e. COPY FROM STDIN), frontend can send Flush
or Sync messages.  According to the F/B protocol specification, they
should be ignored but Pgpool-II treated as an invalid message and this
causes COPY hung.

Discussion: https://.com/pgpool/pgpool2/issues/79
Back-through: v4.1

src/protocol/pool_proto_modules.c

index 4988325dcad1de1379dc45f174e6df51d6a37392..9aa0d7736acd18cc3e6917fd21cae1af574ee692 100644 (file)
@@ -3398,6 +3398,12 @@ CopyDataRows(POOL_CONNECTION * frontend,
                                        copy_count++;
                                        continue;
                                }
+                               /*
+                                * Flush (H) or Sync (S) messages should be ignored while in
+                                * the COPY IN mode.
+                                */
+                               else if (kind == 'H' || kind == 'S')
+                                       continue;
                                else
                                {
                                        if (pool_config->log_client_messages && copy_count != 0)