[Pgpool-general] saving state across pgpool restarts?

Daniel.Crespo at l-3com.com Daniel.Crespo at l-3com.com
Tue Nov 3 14:17:32 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.

That sounds like it would work. I guess that after synchronizing
databases and re-attaching the degenerated database, I would delete the
pgpool_status file for starting fresh.

Daniel


More information about the Pgpool-general mailing list