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 1u4w6H-009goF-Uk for pgsql-hackers@arkaria.postgresql.org; Wed, 16 Apr 2025 06:18:22 +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 1u4w6G-007b8Y-2Z for pgsql-hackers@arkaria.postgresql.org; Wed, 16 Apr 2025 06:18:20 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1u4w6F-007b7R-IO for pgsql-hackers@lists.postgresql.org; Wed, 16 Apr 2025 06:18:20 +0000 Received: from mail-vk1-xa2c.google.com ([2607:f8b0:4864:20::a2c]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1u4w6E-000K9z-0O for pgsql-hackers@lists.postgresql.org; Wed, 16 Apr 2025 06:18:19 +0000 Received: by mail-vk1-xa2c.google.com with SMTP id 71dfb90a1353d-523de538206so2263364e0c.2 for ; Tue, 15 Apr 2025 23:18:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1744784297; x=1745389097; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=Uj4B8dOVDFST+5AJ/5k/8brAW6a8IOKxtOJf/rYX5mw=; b=GW73E5N27zhQ0XBpV9yBRiWpPocSHWfwkiCfifsxiMZyRJQkB/Pcp1xUHrZO2sk3Ea mh8l1ZWSOJ+HKAoJKhktZu97F9l2HD0DpCXwpj9CWLjjDx2Dw4cJw3aKmJIkq48A3Qgn z1Wluns9cYWRlbbMx4kjSjF6X9QyZC4lLjUm/5JEkA51igGgQ4e//W4anBPN7aRJ6CF2 PQeWm9ZWuCE88GphVOrSRtQTzhYPgk6CGjSu9nZ1tuD4+e9eTU7wINnK0asN+N/Um072 pQ6d/PUhV+c74UMRWewLOsvnf/lOgci6hAT1sg1JCe98v69sh2X/Q3mr+rLfQcy6e/h3 flAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1744784297; x=1745389097; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Uj4B8dOVDFST+5AJ/5k/8brAW6a8IOKxtOJf/rYX5mw=; b=jjFqwKOXnmY/Rjd0R4S4+SwbrwqkMK5iRgsPWLoy1Yt5DSSiwQC2pCCvuV0KN8gOlm ThrjQKIzTjaGlr8PkDqFuoztG1TJv3spCShVwR4+6wKA2kCg0ZCWtdtV6uzugqs0nGcR H43vPdWdVOebQCeVjRvl4Pqo4DfMheaGHvqQqR6F/R7GYX1Tkf2GHTS9uNRNv4pRzHcM dQhMh8p/Pj7cfzioO+453Ec+n54qcMe03V4V13jy0nWTP+I5TjX8oc+dVxDdwmIgcu8s 80+/Vi858o3FCBIHuO56qrQhFY5bSXImQKAFmy/J0Qk0JKwl51V/Ul8f2YhHk2GVUOEL +Gpg== X-Forwarded-Encrypted: i=1; AJvYcCWAG/Ah/30VmKNo9cc909L6gJn7pATIHaJjJ8sO5PHAnOZxjutSbudJtbYrbb59mRXulT8V5h4U8HWZx8Om@lists.postgresql.org X-Gm-Message-State: AOJu0YyJLsKBIqv42pQsauSgfYcg9w766HAuZbLTyA9iD8WYYY7MECYM 1BdHD3i8ascJwE9V+ZQLk8gw81untQlFzceEN4kfd7dQtFC39DrZKrtKbp+0raiOwGlucScvgfw cxP7nqGtCdEy0ymlmacewHY7xXGE= X-Gm-Gg: ASbGncvcdaB7UsVRGvUAd6vzKGGNJdqB+DuPhAhWTY3vFTCkNrvF7S56ME/WfOV1dTi z5l7iOVKEPKbegQLOB7CeGOLzfOdIyDkUy88jqB+BXcv4za0foPX9mwHYV9GKqJ+EqvyJScFW1a ryzlv28nHRfkVeeVRFp7wU76GsqM3M5mkSFQ== X-Google-Smtp-Source: AGHT+IF138+BhcADptxalEuQaAMmdFMzCH80kvcPBfK4TJA6HLX2blY1RmWudl4Kh33PWONVnSQElL4nhESCKexnd9Y= X-Received: by 2002:a05:6102:299b:b0:4bb:dfd8:4181 with SMTP id ada2fe7eead31-4cb591b7639mr117891137.4.1744784297186; Tue, 15 Apr 2025 23:18:17 -0700 (PDT) MIME-Version: 1.0 References: <1798838.1744759182@sss.pgh.pa.us> <20FB597F-641F-48F8-8428-D8DDBA802D58@yandex-team.ru> <212D5973-FDD0-4CF5-BCD0-2760EC319DF3@yandex-team.ru> In-Reply-To: <212D5973-FDD0-4CF5-BCD0-2760EC319DF3@yandex-team.ru> From: Ashutosh Bapat Date: Wed, 16 Apr 2025 11:48:05 +0530 X-Gm-Features: ATxdqUHTrSsC3t67XCc5HL1Luh5MUfRLpH8DVXbaRSGFGyK9wCM6ACi3H-n5yqY Message-ID: Subject: Re: Built-in Raft replication To: Andrey Borodin Cc: Tom Lane , Konstantin Osipov , Greg Sabino Mullane , Nikolay Samokhvalov , PostgreSQL Hackers Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, Apr 16, 2025 at 10:29=E2=80=AFAM Andrey Borodin wrote: > > > 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 sys= tems for consensus. > Is it any better as extension than as etcd? I feel so. An extension runs from within a postgresql process, uses the same protocol as PostgreSQL whereas etcd is another process and another protocol. > > > 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 ch= oose Postgres extension over Zookeeper? By other distributed systems I mean PostgreSQL distributed systems - FDW based native sharding or native replication or a system which uses both. > > > 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? Logical replication and FDW based native sharding. > > > 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 instan= ce 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 ma= ke 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 Zookepe= r\etcd. > > If you use build-in failover you have to resort to 3 big Postgres machine= s because you need 2/3 majority. Of course, you can install MySQL-stype arb= iter - host that had no real PGDATA, only participates in voting. But this = is a solution to problem induced by built-in autofailover. Users find it a waste of resources to deploy 3 big PostgreSQL instances just for HA where 2 suffice even if they deploy 3 lightweight DCS instances. Having only some of the nodes act as DCS and others purely PostgreSQL nodes will reduce waste of resources. --=20 Best Wishes, Ashutosh Bapat