Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1u4urj-009LQb-7r for pgsql-hackers@arkaria.postgresql.org; Wed, 16 Apr 2025 04:59:15 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1u4urg-006NWw-Jo for pgsql-hackers@arkaria.postgresql.org; Wed, 16 Apr 2025 04:59:13 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1u4urg-006NWX-5R for pgsql-hackers@lists.postgresql.org; Wed, 16 Apr 2025 04:59:13 +0000 Received: from forwardcorp1b.mail.yandex.net ([178.154.239.136]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1u4urd-000KqX-12 for pgsql-hackers@lists.postgresql.org; Wed, 16 Apr 2025 04:59:12 +0000 Received: from mail-nwsmtp-smtp-corp-main-34.sas.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-34.sas.yp-c.yandex.net [IPv6:2a02:6b8:c11:4195:0:640:137b:0]) by forwardcorp1b.mail.yandex.net (Yandex) with ESMTPS id F1C4560C5B; Wed, 16 Apr 2025 07:59:07 +0300 (MSK) Received: from smtpclient.apple (unknown [2a02:6b8:b081:7229::1:1]) by mail-nwsmtp-smtp-corp-main-34.sas.yp-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id 5x9xq72Fia60-gi9P8zUv; Wed, 16 Apr 2025 07:59:07 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1744779547; bh=+BvkQmRK5A40lbZYAFF+7saMAgkRiNlU6PoQ/DVz/pY=; h=Message-Id:To:Date:References:Cc:In-Reply-To:From:Subject; b=Z+IYrbFhacJnL+c16ZSIjQMWxy/OpwcHixl1PyUInaAMQfPi09xcTXfDg0lf2l2vm by9mgdH4zrED07stqxQeNk+BT40AzXd3HkoqwYcLYtlK0U+winRPDV1CXLv4MTcOdL LbVWRx7NXhO8d+Lojpx+xTuXDgUUA/n1gepP25Wo= Authentication-Results: mail-nwsmtp-smtp-corp-main-34.sas.yp-c.yandex.net; dkim=pass header.i=@yandex-team.ru Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3776.700.51\)) Subject: Re: Built-in Raft replication From: Andrey Borodin In-Reply-To: Date: Wed, 16 Apr 2025 09:58:55 +0500 Cc: Tom Lane , Konstantin Osipov , Greg Sabino Mullane , Nikolay Samokhvalov , PostgreSQL Hackers Content-Transfer-Encoding: quoted-printable Message-Id: <212D5973-FDD0-4CF5-BCD0-2760EC319DF3@yandex-team.ru> References: <1798838.1744759182@sss.pgh.pa.us> <20FB597F-641F-48F8-8428-D8DDBA802D58@yandex-team.ru> To: Ashutosh Bapat X-Mailer: Apple Mail (2.3776.700.51) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On 16 Apr 2025, at 09:33, Ashutosh Bapat = wrote: >=20 > In my experience, the load of managing hundreds of replicas which all > participate in RAFT protocol becomes more than regular transaction > load. So making every replica a RAFT participant will affect the > ability to deploy hundreds of replica. No need to make all standbys voting. And no need to make plain topology. = pg_consul is using 2/3 or 3/5 HA groups, and cascades all others from HA = group. Existing tools already solve the original problem, Konstantin is just = proposing to solve it in some standard =E2=80=9Cofficial=E2=80=9D way. > We may build an extension which > has a similar role in PostgreSQL world as zookeeper in Hadoop. Patroni, pg_consul and others already use zookeeper, etcd and similar = systems for consensus. Is it any better as extension than as etcd? > It can > be then used for other distributed systems as well - like shared > nothing clusters based on FDW. I didn=E2=80=99t get FDW analogy. Why other distributed systems should = choose Postgres extension over Zookeeper? > There's already a proposal to bring > CREATE SERVER to the world of logical replication - so I see these two > worlds uniting in future. Again, I=E2=80=99m lost here. Which two worlds? > The way I imagine it is some PostgreSQL > instances, which have this extension installed, will act as a RAFT > cluster (similar to Zookeeper ensemble or etcd cluster). That=E2=80=99s exactly what is proposed here. > The > distributed system based on logical replication or FDW or both will > use this ensemble to manage its shared state. The same ensemble can be > shared across multiple distributed clusters if it has scaling > capabilities. Yes, shared DCS are common these days. AFAIK, we use one Zookeeper = instance per hundred Postgres clusters to coordinate pg_consuls. Actually, scalability is opposite to topic of this thread. Let me = explain. Currently, Postgres automatic failover tools rely on databases with = built-in automatic failover. Konstantin is proposing to shorten this = loop and make Postgres use its build-in automatic failover. So, existing tooling allows you to have 3 hosts for DCS, with majority = of 2 hosts able to elect new leader in case of failover. And you can have only 2 hosts for Postgres - Primary and Standby. You = can have 2 big Postgres machines with 64 CPUs. And 3 one-CPU hosts for = Zookeper\etcd. If you use build-in failover you have to resort to 3 big Postgres = machines because you need 2/3 majority. Of course, you can install = MySQL-stype arbiter - host that had no real PGDATA, only participates in = voting. But this is a solution to problem induced by built-in = autofailover. Best regards, Andrey Borodin.=