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 1t0qxX-00DVli-9G for pgsql-general@arkaria.postgresql.org; Tue, 15 Oct 2024 23:28:11 +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 1t0qxV-00Crhc-9Y for pgsql-general@arkaria.postgresql.org; Tue, 15 Oct 2024 23:28:09 +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 1t0qxU-00CrhT-SW for pgsql-general@lists.postgresql.org; Tue, 15 Oct 2024 23:28:09 +0000 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1t0qxO-0014xy-Fv for pgsql-general@lists.postgresql.org; Tue, 15 Oct 2024 23:28:08 +0000 Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-37d4ba20075so3911249f8f.0 for ; Tue, 15 Oct 2024 16:28:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729034881; x=1729639681; darn=lists.postgresql.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=uNjSIbZWVjA88vbQ1kKYMHTVbUJ+2m0YNyYHAxw6Fvc=; b=WEc7KrWqJwcbq0FmwOKmHPRv0fJMd1iaHo25atadVqyCqoYbBKO9QBLbztxNvXzZXk GMzXtlPSuGTG+WinvtZINZknMFubyMVf9OWF7uXf8R+h9PuVYdO3UoAsg8qFj4R1Gk6C Ti54iccjJ/GmER5PK+QPtbDei3zVP3aWT+2hgAaabpzKQSNdYKMYnmsqLHq7S0wK2sZI dZXITogzOOMvY8LOQMvYuCo4uD2Ph4DmWfp2GZa1tW1HWR8AIFaIi2tGWtdvMfAa6ejs Iuo//boSGE1mLIblFuPpv50X4EnACp21koa3gdvRqzElt2O4jejplyKwIcbluQcBkRhk wxWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729034881; x=1729639681; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=uNjSIbZWVjA88vbQ1kKYMHTVbUJ+2m0YNyYHAxw6Fvc=; b=FSUbxODM5bpZMiG0z1gXcc2IQRL2lzai3bD0yBmCpGL1RjzzMM4mR6h1I6emlwdXCT roNQVGmZdiaCaRJSky5Mj3Ge4Gw8L/of37eUvcBqhVy3bPNCKpbmFDqlwJ8vfNewd0tl HPQjGuZRvSIsVfdx398etWatmIIH6Cy8zDzvPDii94zv0GcbnxaVxDMUkcMym2zp4aWw zqD3vbIOxA27FGzoPG4jCzji1e9KPAQZPvu50dQXRVk+F5GIkZoDzDU4Egolp+VnX5HM WQXtk+q7MraSHYjFByEQmAvtJrd+kXWJuY/Td67Sc8A/u0695jFA69MKyQanZzO8FwlY H8hg== X-Gm-Message-State: AOJu0Ywot2qNqFrm1SG+ZmH65bDUPrF3haZMsgKaNe35dtSFCzgaDFSN fEx1jlC/c3smegs0NaJbIcCO22OnZq4idb3hOfXc42yEnUTfic4ymzZzQA/YxhRAVvc872mDiul utW1c/h0M6wVHheK9Esl48oYqQt6Fog6u8WA= X-Google-Smtp-Source: AGHT+IGEhNOvvo9fjRowSylF8k4Vw2ESQm+fw0dk6YPoskC3Jt+nVqdFAyG3xALoYAORAHjfCw8QWzrpIxjF3C80V+A= X-Received: by 2002:a05:6000:10c6:b0:37d:47b3:7b86 with SMTP id ffacd0b85a97d-37d5529a82dmr10642549f8f.44.1729034880556; Tue, 15 Oct 2024 16:28:00 -0700 (PDT) MIME-Version: 1.0 From: Jacob Biesinger Date: Tue, 15 Oct 2024 16:27:49 -0700 Message-ID: Subject: serializable master and non-serializable hot standby: feasible set up? To: pgsql-general@lists.postgresql.org Content-Type: multipart/alternative; boundary="000000000000dc2bbf06248c4d36" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000dc2bbf06248c4d36 Content-Type: text/plain; charset="UTF-8" Howdy! I've been going back and forth with the GCP CloudSQL engineering team about the feasibility of a particular setup, and I'm pinging the list here hoping for a sanity check. They assure me that it's impossible and I think they must be mistaken, but I have limited experience administrating my own postgres instances. So I'm appealing to a higher authority :) The docs outline[1 ][2 ] that a hot standby / replica with the flag `default_transaction_isolation='serializable'` is going to cause issues -- while you can connect to such an instance, basically every query against it will fail. But! If you can somehow manage to get the replica's flags to instead use `repeatable read` or `read committed` isolation, everything seems to work well, even if the master uses `serializable` isolation. In GCP, we are having to temporarily swap the master to a lower isolation level, then stand up the replica and pin the lower isolation level flag, and then finally revert the flag change on the master. If the replica goes down, we have to repeat this process and it's a pain (not to mention data issues since our app relies on this isolation level instead of doing explicit locking in most cases). So I know this is an awkward question to post here, but as postgres admin professionals, *would you* expect to be able to stand up a `repeatable read` replica against a `serializable` master? My expectation is that you'd simply change the setting in a .conf file on the replica and be good to go; is there something that would make this process really difficult / impossible? Thanks so much! [1]: https://www.postgresql.org/docs/current/hot-standby.html [2]: https://www.postgresql.org/docs/current/applevel-consistency.html#SERIALIZABLE-CONSISTENCY -- Jake Biesinger --000000000000dc2bbf06248c4d36 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Howdy!

I've been going back and for= th with the GCP CloudSQL engineering team about the feasibility of a partic= ular setup, and I'm pinging the list here hoping=C2=A0for a sanity chec= k. They assure me that it's impossible and I think they must be mistake= n,=C2=A0but I have limited=C2=A0experience administrating my own postgres i= nstances. So I'm appealing to a higher authority :)

The docs outline[1][2] that a hot = standby / replica with the flag=C2=A0 `default_tra= nsaction_isolation=3D'serializable'` is going to cause issue= s -- while you can connect to such an instance, basically every query again= st it will fail.

But! If you can somehow manage to= get the replica's flags to instead use `repea= table read` or=C2=A0 `read committed= ` isolation, everything seems to work well, even if the master uses `serial= izable` isolation. In GCP, we are having to temporarily swap the master to = a lower isolation level, then stand up the replica and pin the lower isolat= ion level flag, and then finally revert the flag change on the master. If t= he replica goes down, we have to=C2=A0repeat this process and it's a pa= in (not to mention data issues since our app relies on this isolation level= instead of doing explicit locking in most cases).


So I know this is an awkward question to post here, b= ut as postgres admin professionals, *would you* expect to be able to stand = up a `repeatable read` replica against a `serializable` master? My expectat= ion is that you'd simply change the setting in a .conf file on the repl= ica and be good to go; is there something that would make this process real= ly difficult / impossible?

Thanks so much!

--000000000000dc2bbf06248c4d36--