Do not send the new protocol message to non-XL client.
authorPavan Deolasee <[email protected]>
Mon, 9 Apr 2018 11:35:13 +0000 (17:05 +0530)
committerPavan Deolasee <[email protected]>
Tue, 17 Apr 2018 05:10:03 +0000 (10:40 +0530)
The new message 'W' to report waited-for XIDs must not be sent to a non-XL
client since it's not capable of handling that and might just cause unpleasant
problems. In fact, we should change 'W' to something else since standard libpq
understands that message and hangs forever expecting more data. With a new
protocol message, it would have failed, thus providing a more user friend
error. But postponing that for now since we should think through implications
of protocol change carefully before doing that.

src/backend/access/transam/xact.c

index 295858f3963f3acb704159d063051bf244ff6eac..4a83f77e3f6ff15661477f24aad0977d11757031 100644 (file)
@@ -6850,8 +6850,13 @@ AtEOXact_WaitedXids(void)
         * subtransactions) had waited-for to the coordinator. The coordinator will
         * then forward the list to the GTM who ensures that the logical ordering
         * between these transactions and this transaction is correctly followed.
+        *
+        * Non XL clients are not prepared to deal with this message. So ensure we
+        * check for remote end first. It's not enough to check if we're NOT a
+        * local coordinator (as we were doing before) since one might be running
+        * pg_restore to create a new coordinator or a datanode in --restoremode.
         */
-       if (whereToSendOutput == DestRemote && !IS_PGXC_LOCAL_COORDINATOR)
+       if (whereToSendOutput == DestRemote && !IsConnFromApp())
        {
                if (s->waitedForXidsCount > 0)
                {