Remove unnecessary checks in some code path.
authorTatsuo Ishii <ishii@sraoss.co.jp>
Sun, 13 Sep 2020 23:09:18 +0000 (08:09 +0900)
committerTatsuo Ishii <ishii@sraoss.co.jp>
Sun, 13 Sep 2020 23:12:59 +0000 (08:12 +0900)
Patch contributed by Hou, Zhijie.
Discussion: https://www.pgpool.net/pipermail/pgpool-hackers/2020-September/003805.html

src/context/pool_query_context.c
src/main/pgpool_main.c

index 4dc99ea78e1812d0afc121847469b5e92087af39..d081860cb6dbe7dc5ad181238b10e6e36c65ea1a 100644 (file)
@@ -460,10 +460,7 @@ void pool_where_to_send(POOL_QUERY_CONTEXT *query_context, char *query, Node *no
                 * statement queries, but until that day we need this band
                 * aid.
                 */
-               if (query_context->is_multi_statement)
-               {
-                       pool_set_node_to_be_sent(query_context, PRIMARY_NODE_ID);
-               }
+               pool_set_node_to_be_sent(query_context, PRIMARY_NODE_ID);
        }
        else if (MASTER_SLAVE)
        {
index a1bae68bd3765c48c0d916e1be9e3d8979956f64..e47e07e7dda3db32b8f70cf4902f146576c73950 100644 (file)
@@ -2189,16 +2189,14 @@ static void failover(void)
                        sts = waitpid(pcp_pid, &status, 0);
                        if (sts != -1)
                                break;
-                       if (sts == -1)
+
+                       if (errno == EINTR)
+                               continue;
+                       else
                        {
-                               if (errno == EINTR)
-                                       continue;
-                               else
-                               {
-                                       ereport(WARNING,
-                                                       (errmsg("failover: waitpid failed. reason: %s", strerror(errno))));
-                                       continue;
-                               }
+                               ereport(WARNING,
+                                               (errmsg("failover: waitpid failed. reason: %s", strerror(errno))));
+                               continue;
                        }
                }
                if (WIFSIGNALED(status))