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:53 +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 694ef3ee73ff1a93ba8d0bbfba71664500122cbd..4fcd291bad8f16bf24f8ea09ebecb521f88c9366 100644 (file)
@@ -453,10 +453,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 4d69f65dffde4d83bb1a58e248a504e6a5de01c6..9152d1c06e4eed2298d8acd5e7b9478392c605a8 100644 (file)
@@ -2233,16 +2233,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))