[Pgpool-general] stopping/adding a node causes pgpool to return error to all running sqls

Toshihiro Kitagawa kitagawa at sraoss.co.jp
Mon Jul 4 10:18:36 UTC 2011


On Sat, 2 Jul 2011 14:51:21 -0700 (PDT)
ilias seperis <ilisepe1 at yahoo.com> wrote:

> Hello again,
> 
> Thanks for the info.
> Just out of curiosity, I had a quick look into the source code and noticed that the status of nodes are kept in "Req_info" (shm).
> Since all forked pgpools can access this shm, why you need to restart them?
> (I don't mean to judge you or anything, obviously there is a reason. I was just wondering what would that be.)
> I know that this is beyond the scope of this list, so please forgive me:)

The reason why pgpool need to restart them when failover occurs is written
in main.c:

/*
 * Before we tried to minimize restarting pgpool to protect existing
 * connections from clients to pgpool children. What we did here was,
 * if children other than master went down, we did not fail over.
 * This is wrong. Think about following scenario. If someone
 * accidentally plugs out the network cable, the TCP/IP stack keeps
 * retrying for long time (typically 2 hours). The only way to stop
 * the retry is restarting the process.  Bottom line is, we need to
 * restart all children in any case.  See pgpool-general list posting
 * "TCP connections are *not* closed when a backend timeout" on Jul 13
 * 2008 for more details.
 */

In addition, pgpool-II has looping of the number of backends everywhere.
So we need to increase or decrease the number of backends at a proper
timing to avoid unexpected behavior such as breaking data consistency.
At present, restarting child processes is used to put timings together.

-- 
Toshihiro Kitagawa
SRA OSS, Inc. Japan
> 
> Thanks
> ilias
> 
> 
> >________________________________
> >From: Toshihiro Kitagawa <kitagawa at sraoss.co.jp>
> >To: ilias seperis <ilisepe1 at yahoo.com>
> >Cc: "pgpool-general at pgfoundry.org" <pgpool-general at pgfoundry.org>
> >Sent: Friday, July 1, 2011 11:20 AM
> >Subject: Re: [Pgpool-general] stopping/adding a node causes pgpool to return error to all running sqls
> >
> >On Wed, 29 Jun 2011 09:57:09 -0700 (PDT)
> >ilias seperis <ilisepe1 at yahoo.com> wrote:
> >
> >> Hello,
> >> 
> >> I've just installed pgpool-II 2.3.2.1 with 2 nodes and I wanted to test what would happen if one of my backends would have failed.
> >> So I gave a few select sqls to pgpool and I checked (with top) that the select sqls were distributed to both my nodes, so I was happy:-)
> >> 
> >> But after stopping the 2nd node, I expected to get a failure result only from those sqls that were running on the 2nd node (since I had just stopped it).
> >> To my surprise I got error result from all my sqls!
> >> Is this normal?
> >> (Pgpool works fine afterwards (with node2 kicked-out of course).)
> >> I also noticed that the same thing happens (running sqls fail) while adding node2 (pcp_attach_node 1 node1 9898 ilias 1234 1).
> >> Again, is this normal?
> >
> >Both are normal.
> >pgpool-II restarts all child processes when failover or failback occurs.
> >
> >
> _______________________________________________
> Pgpool-general mailing list
> Pgpool-general at pgfoundry.org
> http://pgfoundry.org/mailman/listinfo/pgpool-general
> 



More information about the Pgpool-general mailing list