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 1u4xXo-00A4Kk-IL for pgsql-hackers@arkaria.postgresql.org; Wed, 16 Apr 2025 07:50:52 +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 1u4xXm-0095tA-AE for pgsql-hackers@arkaria.postgresql.org; Wed, 16 Apr 2025 07:50:51 +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 1u4xXl-0095sA-VM for pgsql-hackers@lists.postgresql.org; Wed, 16 Apr 2025 07:50:50 +0000 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1u4xXj-000MFL-1X for pgsql-hackers@lists.postgresql.org; Wed, 16 Apr 2025 07:50:50 +0000 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-43cfdc2c8c9so35265955e9.2 for ; Wed, 16 Apr 2025 00:50:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1744789847; x=1745394647; darn=lists.postgresql.org; h=user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:subject:cc:to:from:date :sender:message-id:from:to:cc:subject:date:message-id:reply-to; bh=yDFkm1KndgUg7ST+EYHmGy4Lj6PI0CXuZjpvOmrF+M0=; b=eyfeSYBKM7llyJKf4vy7wRTuUZPDd5S08/mL2ZvY3naf3Ze4pxJRlpv1mDUKdVmZXR t7gIOcodBRf0pgIsFXeW+kxQZf9+kZlOC6kgaS6chpxE8kx3BCKuxEVtKNvxDp0a2lXT 5LH5IZxELp1ncO1V8p2euuITS/mreErswcvnlOj1q3Nl845i75dzAE5xLHqWOzcETIY0 5nOVaN/rWGRJPejEBIhaepln/qiHsy7z3jA+jb6yG/wS5xQ7toEaFZFy8q34VfU757JB SZhG5n8Ac51hvPe2Cgcq5I1Yd4x7nVZEuBkCTgCIyZvd4DBcmIB1P7iOy8zfgheUG+X7 3j3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1744789847; x=1745394647; h=user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:subject:cc:to:from:date :sender:message-id:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=yDFkm1KndgUg7ST+EYHmGy4Lj6PI0CXuZjpvOmrF+M0=; b=hD1uNF/NpJjPGvK8PN70qVJm6svyvJdYFF2xVE5K0LnnIs+ZuRx/vRjfX9gvBVFQ/h lV5sWgj2f2aKTqPVN3rLLQxiIH4s5JhspCwCrmUXsrpiIxJvR3ir0iWgVh1b7uNCM2H2 eN5N20MdGb8RntsdyD4agcmhFHWBvIB/MNZlBKVpB5r73bC7dJNnaFWUCy1UMInua0Lp Wa0Ve3c8YIKNeyhX9NM5wsuAqpiA4Fr35tjakK8AY/dhccYZ9Way+BvXO8r2MYAyVa5L AXSM3+Xn/fYy38PbwPbkQAHHxSXviWM7MtIEH7aRpzx0nZwInvpl+U1w9TZbOifpOIxj dp3A== X-Forwarded-Encrypted: i=1; AJvYcCVhWNdl0mJhjf7uVNBXDv1J8zwmb70d9wn/ntXbCvkQ9/nm2PvclA0DUdNqyxEULpNCUTerhGS+uQsML8lr@lists.postgresql.org X-Gm-Message-State: AOJu0YzOs13zaTNVMv+H8khcf4Qfsr62bKeZT8X5gmfKnEQTKvzTKOw1 Llyb0IGcbjyr829pdTyYdmDHh+jAP2ACM8xXDqsyQquJ7TGEucer X-Gm-Gg: ASbGnct9yHm3IhW1uuf1tRcomBZxmdwEN2JUHeCJ4NG0xk6PkejPFyzyMVRk8vAahsN Z4JmOROxQZXpNG25udQP7WEaTrWRfpDg4GF6fSJ7rUYodEQ9WhHTnVA1YQ1yG8kiMHH3zJ+TX9+ XdpJj7K7xVwi9MX2ur/8qr35LmysV3C/TtidGoA2epKmT4NgQslATRmKoC5ntPW3XTfLGF/Sdc7 e1uzjv46LX0VHZNp1WPtJBM6izMfearz9cZzLfNcCAaTEHG4+UWYs51XvioD62cfj/ekWEOlJwX 7VVkyncSNuL8pbagmoU0p1tHpG7mfAGsTVgSMpgu1w8OkajjST3fPEm9IeZL9OLZ7wjBJLGur8g 5 X-Google-Smtp-Source: AGHT+IFAX3cQnb3wi3ugD2znL73LuP+84aWgufKdiZDaDBYIhCnRsLCfrUyqdUoehPwAXfjO42m63g== X-Received: by 2002:a05:600c:154f:b0:43c:e467:d6ce with SMTP id 5b1f17b1804b1-4405d5fcb94mr7068155e9.4.1744789846800; Wed, 16 Apr 2025 00:50:46 -0700 (PDT) Received: from lightning.caipicrew.dd-dns.de ([2001:a61:10f8:cb01:ca40:4230:bcf6:3810]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4405b4c8209sm13366285e9.5.2025.04.16.00.50.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Apr 2025 00:50:46 -0700 (PDT) Message-ID: <67ff6156.050a0220.18223a.416b@mx.google.com> X-Google-Original-Message-ID: <20250416075045.GC23075@caipicrew.dd-dns.de;lightning.caipicrew.dd-dns.de> Sender: Michael Banck Received: from mbanck by lightning.caipicrew.dd-dns.de with local (Exim 4.92) (envelope-from ) id 1u4xXh-00040O-R5; Wed, 16 Apr 2025 09:50:45 +0200 Date: Wed, 16 Apr 2025 09:50:45 +0200 From: Michael Banck To: Andrey Borodin Cc: Tom Lane , Konstantin Osipov , Greg Sabino Mullane , Nikolay Samokhvalov , PostgreSQL Hackers Subject: Re: Built-in Raft replication References: <1798838.1744759182@sss.pgh.pa.us> <20FB597F-641F-48F8-8428-D8DDBA802D58@yandex-team.ru> <1832513.1744777613@sss.pgh.pa.us> <0ED408AD-2209-4D60-9142-B6D01DD0C46F@yandex-team.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <0ED408AD-2209-4D60-9142-B6D01DD0C46F@yandex-team.ru> User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On Wed, Apr 16, 2025 at 10:24:48AM +0500, Andrey Borodin wrote: > I think I can provide some reasons why it cannot be neither extension, > nor any part running within postmaster reign. > > 1. When joining cluster, there’s not PGDATA to run postmaster on top > of it. > > 2. After failover, old Primary node must rejoin cluster by running > pg_rewind and following timeline switch. > > The system in hand must be able to manipulate with PGDATA without > starting Postgres. Yeah, while you could maybe implement some/all of the RAFT protocol in an extension, actually building something useful on top with regards to high availability or distributed whatever does not look feasible. > My question to Konstantin is Why wouldn’t you just add Raft to > Patroni? Patroni can use pysyncobj, which is a Python implementation of RAFT, so then you do not need an external RAFT provider like etcd, consul or zookeeper. However, it is deemed deprecated by the Patroni authors due to being difficult to debug when it breaks. I guess a better Python implementation of RAFT for Patroni to use or Patroni to implement it itself would help, but I believe nobody is working on the latter right now, nor has any plans to do so. And there also does not seem to be anybody working on a better pysyncobj. > Is there a reason why something like Patroni is not in core and noone > rushes to get it in? Everyone is using it, or system like it. Well, Patroni is written in Python, for starters. It also does a lot more than just leader election / cluster config. So I think nobody seriously thought about proposing to put Patroni into core so far. I guess the current proposal tries to be a step into the "something like Patroni in core" if you tilt your head a little. It's just that the whole thing would be a really big step for Postgres, maybe similar to deciding we want in-core replication way back when. Michael