Re: Autofail back inconsistent

From: VASUKI M <vasukim1992002(at)gmail(dot)com>
To: Tatsuo Ishii <ishii(at)postgresql(dot)org>, Bo Peng <pengbo(at)sraoss(dot)co(dot)jp>
Cc: bharatdb(at)cdac(dot)in, pgpool-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Autofail back inconsistent
Date: 2025-11-07 11:25:28
Message-ID: CACTYHzhwh+r9a2f9Jp9+SjFgLBTG0H6Mx=vzNDWtLWGN0KKz9A@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgpool-hackers

Thank you for your reply Tatsuo.

Overview:
This enhancement ensures data consistency during standby node reattachment
by automatically performing pg_rewind synchronization and WAL replay before
allowing a node to rejoin the cluster. This automation reduces manual
intervention, improves fault recovery speed, and enhances high availability.

Key Changes
- Enhanced `failover.sh` and `follow_primary.sh` scripts to trigger
automatic synchronization.
- Added a new `resync.sh` script for safe data synchronization and reattach.
- Included sample configuration files for a 3-node cluster (1 primary + 2
standbys).
- Improved recovery automation and minimized risk of inconsistent data
after failover.

Testing
The feature has been successfully tested on a **3-node local cluster
setup**:
- 1 Primary PostgreSQL node
- 2 Standby nodes managed through Pgpool-II
- Verified automatic resync and reattach after simulated failover events.

Patch Details
The patch is based on the latest Pgpool-II master branch (commit
`76a06e5af`).

Please find the attached patch file:
**0001-Add-Automatic-Resync-and-Reattach-feature-pg_rewind-.patch**

I would appreciate it if the community could review the changes and provide
feedback or suggestions for improvement.

Thank you for your time and support.

Best regards,
**Vasuki M**
CDAC Chennai
Email: bharatdbpg(at)gmail(dot)com

On Tue, 4 Nov 2025 at 17:10, Tatsuo Ishii <ishii(at)postgresql(dot)org> wrote:

> > Hi Pgpool-II Community,
>
> Thank you for the proposal.
>
> > I’ve been working with PostgreSQL for quite some time, and while managing
> > backend servers with Pgpool-II, I noticed that there’s no built-in data
> > synchronization before standby nodes are reattached.
> >
> > To address this, I’ve developed a new enhancement for Pgpool-II called
> > *“Automatic
> > Resync and Reattach”*, aimed at improving high availability and reducing
> > manual intervention after node failures.
> >
> > This feature automatically performs:
> >
> > -
> >
> > *pg_rewind synchronization* and *WAL replay* for failed or lagging
> > standby nodes
> > -
> >
> > *Automatic reattachment* of standby nodes once they are safely
> resynced
> >
> > This enhancement overcomes some limitations of existing features:
> >
> > -
> >
> > *Online Recovery* – requires manual execution of pcp_recovery_node
> > -
> >
> > *Auto Failback* – may reattach inconsistent nodes without
> synchronization
> >
> > With *Auto Resync & Reattach*, Pgpool-II ensures data safety and
> > consistency during failover recovery, providing a more robust and
> > self-healing HA environment.
> >
> > I’ve created a dedicated GitHub repository with setup instructions,
> > configuration samples, and architecture diagrams here:
> > https://github.com/BharatDBPG/pgpool2-auto-resync
> >
> > The repository includes:
> >
> > -
> >
> > Enhanced failover.sh and follow_primary.sh scripts (handling both
> > primary and standby failures)
> > -
> >
> > A new resync.sh script integrating pg_rewind + WAL replay
> > -
> >
> > Sample configuration files for a *1 Primary + 2 Standby* setup
> >
> > I would love to receive feedback or suggestions from the community
> > regarding possible improvements or integration ideas.
> >
> > I will be happy to share a patch if needed.
> > Thank you for your time and support.
> >
> > Best regards,
> >
> > *Vasuki MCDAC,CHENNAI*
> >
> > https://github.com/BharatDBPG/pgpool2-auto-resync
>
> Yes, it would be nice to share a patch. As we follow the PostgreSQL
> development model (not using GitHub), we are familiar with discussing
> on a patch base.
>
> Best regards,
> --
> Tatsuo Ishii
> SRA OSS K.K.
> English: http://www.sraoss.co.jp/index_en/
> Japanese:http://www.sraoss.co.jp
>

Attachment Content-Type Size
0001-Add-Automatic-Resync-and-Reattach-feature-pg_rewind-.patch text/x-patch 24.3 KB

In response to

Browse pgpool-hackers by date

  From Date Subject
Next Message Nadav Shatz 2025-11-18 11:37:10 Re: Proposal: recent access based routing for primary-replica setups
Previous Message Tatsuo Ishii 2025-11-06 09:24:19 Re: Proposal: recent access based routing for primary-replica setups