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 1u4NPB-001HWn-0q for pgsql-hackers@arkaria.postgresql.org; Mon, 14 Apr 2025 17:15:33 +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 1u4NP6-003iye-JC for pgsql-hackers@arkaria.postgresql.org; Mon, 14 Apr 2025 17:15:29 +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 1u4NP6-003iyT-8C for pgsql-hackers@lists.postgresql.org; Mon, 14 Apr 2025 17:15:29 +0000 Received: from mail-lf1-x135.google.com ([2a00:1450:4864:20::135]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1u4NP3-000471-2R for pgsql-hackers@lists.postgresql.org; Mon, 14 Apr 2025 17:15:28 +0000 Received: by mail-lf1-x135.google.com with SMTP id 2adb3069b0e04-549963b5551so5494068e87.2 for ; Mon, 14 Apr 2025 10:15:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1744650925; x=1745255725; darn=lists.postgresql.org; h=content-disposition:mime-version:message-id:subject:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=j2r5c/8R1rNrjAiAca/heHlFQSM/KN7NU2z2vbNdbX0=; b=Def1x3QMHBbk1CSlI7TPOQQwfnYrTdUC0NXDda8Y90fKwC+uuGamwhS64+R6mzOzMY +VOmcuhvml3r4MXks0NE2kM+nhE3Pn0l4h/p4nT0ADDeG6hmB21sRCo4SJQCh9HJyy/X 6YtdvMz358tnxFmnBibpnDQc0Mi2lxYlg2L/3XyullNvH3mVziQhgEiAZNujXIPZIUWA hY7dYRv2Eh0FXw5QLMDcjVuOmfBrfIv8U9+c5R6JGmgt1V/5ULtd+JBba0cIl4gPMkZN hndTPB5zHKbDHhWWAluocPB5zz+FOl5kuTsj8EebMMaTOSxK4K08to/H4XO92I8dlldj SadQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1744650925; x=1745255725; h=content-disposition:mime-version:message-id:subject:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=j2r5c/8R1rNrjAiAca/heHlFQSM/KN7NU2z2vbNdbX0=; b=wmxJe9+N1HwKFh575X4PMpTEUO1L20MTt3lUTosDKg12v8mTCemwNq4ZZPoN4j5FZg n/9VWAcwwpC8fHtLI4HCkLeUIioSiyFL5s859WR0DmobZcQcVR9shlTeD2oqvIAMA+fd PEWkCSvgfW+EXd58PbUiQUdnKLnpFzmRMAxnkcuB4EqTfSpWBQQv6r72RKSz9nD/SxIc VfevTSvVR8i40gmew152LgwRfkvJk/oUDfpRbhV7bHL8cz+Aeu437VXt4+qz4J9e5iDM dDJoyr2iipyYER4LX8Yf24fSL62pKqPXMmroIT2gXYByTvzBziozc3SUgxWAti0+ECyi 11Hg== X-Gm-Message-State: AOJu0YzCz+SnigL8vX0VZNRqFE0TR42RqPET6AAb4QgcHQiO5hMNtm1n 0QgjL3ShO0q+TovANdsw9RiKZ7/4BxccZ4AheBVDz9q1ofb/PFTRFGv7jaY= X-Gm-Gg: ASbGncs+My0H6LjydwkIGUkDaiqlqIl2GeUuAv3zLjwgc+WTnObNF/qNwmyFwEqSRuV 6oE5hK5v21zMfVuOnJ6d6evFu/4mO5uiYZ3qGp7axoazS40EEohq8mTuj+/tWCoVO8FV6udBGor qLMnnBNpNGW5asmaghipUsEcgJfv5dZDF21TRovoKyaA8QZz0n4a8dgsdKAe6Uz09s0v9mY9hgR dPM6SWkf4t0G9GTHewwgAkc1R2SKQHrFIa1waM+e2KMkBZPFXOUnxP9Tei5UsL2KoTNwDggumfg PKLRd8zzqwW6PBuSBQ81qL4xnfwr X-Google-Smtp-Source: AGHT+IEqMRDSzELDivjwMwLRUlhuq/repnoa21jArvK57gXXRxAmU92Ri7SbCyV/6+JeNGJ2l8bD8Q== X-Received: by 2002:a05:6512:31c1:b0:549:8db6:b2dd with SMTP id 2adb3069b0e04-54d4529f2bdmr3568755e87.31.1744650925274; Mon, 14 Apr 2025 10:15:25 -0700 (PDT) Received: from ark.local ([2a09:bac5:5151:2369::387:36]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-54d3d12317fsm1177447e87.4.2025.04.14.10.15.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Apr 2025 10:15:24 -0700 (PDT) Received: by ark.local (Postfix, from userid 1000) id C11CBF20074; Mon, 14 Apr 2025 20:15:23 +0300 (MSK) Date: Mon, 14 Apr 2025 20:15:23 +0300 From: Konstantin Osipov To: pgsql-hackers@lists.postgresql.org Subject: Built-in Raft replication Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, I am considering starting work on implementing a built-in Raft replication for PostgreSQL. Raft's advantage is that it unifies log replication, cluster configuration/membership/topology management and initial state transfer into a single protocol. Currently the cluster configuration/topology is often managed by Patroni, or similar tools, however, it seems there are certain usability drawbacks with this approach: - it's a separate tool, requiring an external state provider like etcd; raft could store its configuration in system tables; this is also an observability improvement since everyone could look up cluster state the same way as everything else - same for watchdog; raft has a built-in failure detector that's configuration aware; - flexible quorums; currently quorum size is a configurable; with a built-in raft, extending the quorum could be a matter of starting a new node and pointing it to an existing cluster Going forward I can see PostgreSQL providing transparent bouncing on pg_wire level, given that Raft state is now part of the system, so drivers and all cluster nodes could easily see where the leader is. If anyone is working on Raft already I'd be happy to discuss the details. I am fairly new to the PostgreSQL hackers ecosystem so cautious of starting work in isolation/knowing there is no interest in accepting the feature into the trunk. Thanks, -- Konstantin Osipov