From: Tom Lane <tgl@sss.pgh.pa.us>
To: qihua wu <staywithpin@gmail.com>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: synchronized standby: committed local and waiting for remote ack
Date: Sat, 14 Jan 2023 00:31:28 -0500
Message-ID: <920090.1673674288@sss.pgh.pa.us> (raw)
In-Reply-To: <CAPoYtoJ5wCG2wE79gbqkou0EFpErpyJ=qfSzs03D1o5KXpnWjw@mail.gmail.com>
References: <CAPoYtoJ5wCG2wE79gbqkou0EFpErpyJ=qfSzs03D1o5KXpnWjw@mail.gmail.com>
qihua wu <staywithpin@gmail.com> writes:
> We are using patroni to set up 1 primary and 5 slaves, and using ANY 2 (*)
> to commit a transaction if any 2 standbys receive the WAL. If there is a
> network partitioning between the primary and the slave, then commit will
> hang from user perspective, but the commit is actually done locally, just
> waiting for remote ack which is not possible because of network split. And
> if patroni promotes a slave to primary, then we will lost data. Do you
> think of a different design: first wait for remote ACK, and then commit
> locally, this will only failed if local commit failed, but local commit
> fail is much rarer than network partitioning in a cloud env: it will only
> fail when IO issue or disk is full. So I am thinking of the possibility of
> switch the order: first wait for remote ACK, and then commit locally.
That just gives you a different set of failure modes. It'd be
particularly bad if you have more than one standby, because you could
easily get into a situation where *none* of the nodes represent truth.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: tgl@sss.pgh.pa.us, staywithpin@gmail.com
Subject: Re: synchronized standby: committed local and waiting for remote ack
In-Reply-To: <920090.1673674288@sss.pgh.pa.us>
References: <CAPoYtoJ5wCG2wE79gbqkou0EFpErpyJ=qfSzs03D1o5KXpnWjw@mail.gmail.com> <920090.1673674288@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox