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 1u4zXS-00AWC1-Se for pgsql-hackers@arkaria.postgresql.org; Wed, 16 Apr 2025 09:58:39 +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 1u4zXQ-00BBoT-Op for pgsql-hackers@arkaria.postgresql.org; Wed, 16 Apr 2025 09:58:37 +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 1u4zXQ-00BBoJ-Ep for pgsql-hackers@lists.postgresql.org; Wed, 16 Apr 2025 09:58:37 +0000 Received: from mail-lf1-x134.google.com ([2a00:1450:4864:20::134]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1u4zXO-000N8n-0h for pgsql-hackers@lists.postgresql.org; Wed, 16 Apr 2025 09:58:36 +0000 Received: by mail-lf1-x134.google.com with SMTP id 2adb3069b0e04-54d3ee30af1so6423731e87.0 for ; Wed, 16 Apr 2025 02:58:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1744797514; x=1745402314; darn=lists.postgresql.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=BoXrBCzKatnH/1hMFqfkZtjO4D30lcN7ZGmJiCBxKrA=; b=dCKraiujO4cGtFxxVQ0fcdiYYLJ/hwh14TftqrgjpJ2fanVUKcvtuB/HIGFpHCy8wh qoXayqmgPlzFn/xT7THeqj61G1UITDS03oNdSOU4x81D+14PaKeZsirEa18ogMA71giS HERI6aFQoZF+bkk0wf9dV2xtfJHODCfYQUqsqYHdMy6GcabzdykLbDjqCaBO8Yz+DJ2Y R4KphyfDvHosoP8CZH0+dGCkDJCD/F9pFMWj5RXg/dI/AbvrUBi0ok0C2vcb5nmXC3F+ Fjtr4Zfy+Ny2rwcptbt3gOcNf6N2Q+VRo68KvfxlzXmkYup0IEwRjq703/vAq4Y+vYKe /arA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1744797514; x=1745402314; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=BoXrBCzKatnH/1hMFqfkZtjO4D30lcN7ZGmJiCBxKrA=; b=vJvvFeuyfg0QpMa6Y3UfpJEL6ITs6exjlC4DjyiIgMeAFfAZyF68mOBO9Ul3ov8/OG OWxmKU92gz7WOen+NEqj8d4fjO1lXatAMpjqZreaoTanvjizPmeAe2KJ9hrYuO1rHYP8 0GD7LXAPUQqK7KG1E+fPUTqwD3kMPU/BiVMJm19WbRg0XKrjbzhNe5nBgSZ29R0S44e/ juFw1e2irHHf8Pkhfu3c/QntOJalx4tCf8jklfNggEIB53kl7XWpqGXPKgt88bzXzevS EqPDVN2dwhBmpkBfo2rvDdGhG3xIKSWLTaCH0iUQqkUSwrqjPoEXyqJoc7RxIoWHHla0 BQDQ== X-Forwarded-Encrypted: i=1; AJvYcCWlE79gy2mLyFyu13NRTv1mh5fXo3TGe0B9tOWNvvHkKpW8Q9D8rG72v+VmOqUH84MW/kmtS9UpvJdtL5a0@lists.postgresql.org X-Gm-Message-State: AOJu0YyHjbq+glm6SF49NnUt2sBg/qYnVAGeMXQLsbGZgXlB65StbwLk WhaJfkhmHdAzGZhEgNcFAzuYLcnlYElXWjOES7Kmla5KN7hcp9w= X-Gm-Gg: ASbGncuXW/Or4sNGuOJo55Nxw8GOVqbhRa7XZDNxfR9gGpHGfEPnOAUfz2G2ruxNL4C 3oYO7PUieAszkubA+76EKEoqNvkUa8plqihDtBkjRBvi+3Q6DT4N81xnWDDDaf9MgoWrd0su1I+ FGrtOFvI1uBeLMkhF/dCGZRjp3Ee4LdTl7ZG9ERcUGc5YpyjkZz8gJE52SkzU978/m8ppQ5QWXA 05IAz/F4u7a0F3XbceMWAzaiaJCIQidPthit3A30THcWaenOPivnbsRz6IMOQFwb/HYTx6arMn7 u5vnWFitfs1EJXvQCuZAdBZrYYDGeUVl1yOauWkQTg== X-Google-Smtp-Source: AGHT+IEJUjUJU9GOqtRToS2EAnBxJjFTBnEu8D2JfBEwLPlm63GP8LD4cBHET6TmWMaOuURFxU5K/A== X-Received: by 2002:a05:6512:124d:b0:545:109b:a9c7 with SMTP id 2adb3069b0e04-54d64ae8596mr389152e87.35.1744797513638; Wed, 16 Apr 2025 02:58:33 -0700 (PDT) Received: from ark.local ([104.28.230.246]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-54d3d5028c6sm1624433e87.118.2025.04.16.02.58.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Apr 2025 02:58:33 -0700 (PDT) Received: by ark.local (Postfix, from userid 1000) id 7C6C6F20074; Wed, 16 Apr 2025 12:58:32 +0300 (MSK) Date: Wed, 16 Apr 2025 12:58:32 +0300 From: Konstantin Osipov To: Andrey Borodin Cc: Tom Lane , Greg Sabino Mullane , Nikolay Samokhvalov , PostgreSQL Hackers Subject: Re: Built-in Raft replication Message-ID: 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> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk * Andrey Borodin [25/04/16 11:06]: > > Andrey Borodin writes: > >> I think it's what Konstantin is proposing. To have our own Raft implementation, without dependencies. > > > > Hmm, OK. I thought that the proposal involved relying on some existing > > code, but re-reading the thread that was said nowhere. Still, that > > moves it from a large project to a really large project :-( > > > > I continue to think that it'd be best to try to implement it as > > an extension, at least up till the point of finding show-stopping > > reasons why it cannot be that. > > 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. > > My question to Konstantin is Why wouldn’t you just add Raft to Patroni? 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. Raft uses the same WAL to store configuration change records as is used for commit records. This is at the core of the correctness of the algorithm. This is also my biggest concern with correctness of Patroni - but to the best of my knowledge 's 90%+ of use cases of Patroni use a "fixed" quorum size, that's defined at start of the deployment and never/rarely changes. Contrast to that being able to a replica to the quorum at any time, and all it takes is just starting this replica and pointing it at the existing cluster. This greatly simplifies UX. -- Konstantin Osipov, Moscow, Russia