[Pgpool-general] saving state across pgpool restarts?

Tatsuo Ishii ishii at sraoss.co.jp
Tue Nov 3 09:04:07 UTC 2009


> > > If pgpool-ii is restarted, it will consider that all backends are in
> > "good"
> > > state - even if one of the backends was not up to date (and data was
> > not
> > > being replicated there).
> > >
> > > What is the best way to preserve backend state across pgpool-ii
> > restarts?
> > 
> > IMHO, making sure the PostgreSQL daemon is stopped when a failover is
> > done on a node.
> 
> It seems that there is not a good solution for this.
> 
> For example, let's say I have two backends: backend0 and backend1.
> 
> 1. Network connection error happens on backend0.
> 2. backend0 is denerated.
> 3. New data incomes into pgpool->backend1.
> 4. backend0 is now out of sync.
> 5. Network connection is re-established on backend0.
> 6. pgpool is restarted for some reason.
> 7. pgpool connects to both backends.
> 8. a client executes a query that causes to retrieve data from both
> backends, but are mismatching.
> 9. pgpool degenerate the one that is NOT the master -> backend1.
> 10. DBA gets crazy because data was lost (in the backend1, when backend0
> connection was down)
> 
> I think pgpool should keep track of which database has data with latest
> timestamp in order to degenerate the oldest one. Is it possible?
> Or any ideas as to how to solve or mitigate this?

I think it's fairly easy to implement persistent state file for
pgpool-II. The state file, possibly called "pgpool_status", is created
under logdir if it does not exist. The contents will be backend id,
its sttaus and timestamp per line. If pool_status exists, pgpool will
read the file before starting health checking and set it to shared
memeory status area. If fail over/fail back events happen, pgpool will
update the file.
--
Tatsuo Ishii
SRA OSS, Inc. Japan


More information about the Pgpool-general mailing list