Fix inappropriate ereport call in VALID_BACKEND.
authorTatsuo Ishii <ishii@sraoss.co.jp>
Fri, 4 Oct 2019 04:52:19 +0000 (13:52 +0900)
committerTatsuo Ishii <ishii@sraoss.co.jp>
Fri, 4 Oct 2019 04:52:19 +0000 (13:52 +0900)
VALID_BACKEND (more precisely pool_virtual_master_db_node_id) macro
emitted message if pgpool is performing failover/failback:

ereport(WARNING,
(errmsg("failover/failback is in progress"),
errdetail("executing failover or failback on backend"),
 errhint("In a moment you should be able to reconnect to the database")));

This could be called within signal handlers and
POOL_SETMASK(&BlockSig)/POOL_SETMASK(&UnBlockSig) was called to block
an interrupt because ereport is not reentrant. However it is possible
that callers have already called POOL_SETMASK, and this could result
unwanted signal unblock.

Fix is, removing ereport and POOL_SETAMASK all together. This results
in removing the message above but we have no choice.

I found the problem while investigating regression
055.backend_all_down failure but of course the bug could have bitten
users in other places.

src/context/pool_query_context.c

index 6fe6576a920d3eb85e51141ee00b07953ccab6b3..a75ea74435574de82ac66d9c2ce5fb9d707cf418 100644 (file)
@@ -317,12 +317,14 @@ pool_virtual_master_db_node_id(void)
         */
        if (Req_info->switching)
        {
+#ifdef NOT_USED
                POOL_SETMASK(&BlockSig);
                ereport(WARNING,
                                (errmsg("failover/failback is in progress"),
                                                errdetail("executing failover or failback on backend"),
                                 errhint("In a moment you should be able to reconnect to the database")));
                POOL_SETMASK(&UnBlockSig);
+#endif
                child_exit(POOL_EXIT_AND_RESTART);
        }