Do not cancel a query when the query resulted in an error other than in native replic...
authorTatsuo Ishii <ishii@postgresql.org>
Thu, 27 Oct 2016 08:29:53 +0000 (17:29 +0900)
committerTatsuo Ishii <ishii@postgresql.org>
Thu, 27 Oct 2016 08:30:58 +0000 (17:30 +0900)
It was intended to keep the consistency, but there's no point in other
than native replication mode.

pool_query_context.c

index a5194bfa71c37c27cb16cf7c0a2be61956c866cd..7ea20eb8c55529a1fba5590d095d8c4ac863ab40 100644 (file)
@@ -726,13 +726,16 @@ POOL_STATUS pool_send_and_wait(POOL_QUERY_CONTEXT *query_context,
 
                if (wait_for_query_response(frontend, CONNECTION(backend, i), MAJOR(backend)) != POOL_CONTINUE)
                {
-                       /* Cancel current transaction */
-                       CancelPacket cancel_packet;
+                       if (REPLICATION)
+                       {
+                               /* Cancel current transaction */
+                               CancelPacket cancel_packet;
 
-                       cancel_packet.protoVersion = htonl(PROTO_CANCEL);
-                       cancel_packet.pid = MASTER_CONNECTION(backend)->pid;
-                       cancel_packet.key= MASTER_CONNECTION(backend)->key;
-                       cancel_request(&cancel_packet);
+                               cancel_packet.protoVersion = htonl(PROTO_CANCEL);
+                               cancel_packet.pid = MASTER_CONNECTION(backend)->pid;
+                               cancel_packet.key= MASTER_CONNECTION(backend)->key;
+                               cancel_request(&cancel_packet);
+                       }
 
                        return POOL_END;
                }