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 05:05:10 +0000 (14:05 +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 8a986dbd2db6e273f81be67871d6c87e79d82fe0..4dc99ea78e1812d0afc121847469b5e92087af39 100644 (file)
@@ -304,12 +304,14 @@ int 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);
        }