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 1v7c3k-005I3Y-Vc for pgsql-general@arkaria.postgresql.org; Sat, 11 Oct 2025 16:03:05 +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 1v7c3g-00GPRs-K0 for pgsql-general@arkaria.postgresql.org; Sat, 11 Oct 2025 16:03:01 +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 1v7c3g-00GPRk-4m for pgsql-general@lists.postgresql.org; Sat, 11 Oct 2025 16:03:01 +0000 Received: from mail-pg1-x52f.google.com ([2607:f8b0:4864:20::52f]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1v7c3c-001bcz-2o for pgsql-general@lists.postgresql.org; Sat, 11 Oct 2025 16:02:59 +0000 Received: by mail-pg1-x52f.google.com with SMTP id 41be03b00d2f7-b6093f8f71dso1804074a12.3 for ; Sat, 11 Oct 2025 09:02:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jprotech-com-vn.20230601.gappssmtp.com; s=20230601; t=1760198573; x=1760803373; 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=hXociRKEM3m2sb5/viF4eFK9Lvb6kJ+fznOM83FDzq0=; b=xqmm0TISUBBq/xLzo5CeQGIOpgC2M796tevLzzuCYdKpRmpD+iNJOYDjUvr8JS0241 r2Y1jQ05C6Vueu0xmNR125p+9XYDtpu6f7WI6GRoFngN+CSoOo85Y3x3h9eR5hQ7w8ao UGrUXa62dlRnij0Jy93+C7akor3/0+NeRIsxCF+LS3dlJUgiH/U9z0hH3d0cnp2fwaMg IzeX5j71mZWvo8+cTWRNUvOTT+Z3J2ModAGbvQvsY7w4Vc9j1fWoOH89SsmS3dLKVglm qsTBRyMm5PpYsNe3zO1xgrlPGuS6afGTLbl/PG+vtIX3Jlb2qdi05u7TQM4WoTGCvZQW UA/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760198573; x=1760803373; 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=hXociRKEM3m2sb5/viF4eFK9Lvb6kJ+fznOM83FDzq0=; b=OGUS7NIVUYHBA/XHrPq7lpHiWXWbmSy3UBfbyFrKRmSR5Q8OJN0adPParaQ96X10hA SVUy32McKc5iSOmY9+IN3Fo/Hz8LWrYxAiRKaCUfsUwCAGeTxmPto+M5pWpU3lJLwj0s G1evw8fmSqONMimwcSpGB/Vj+2HQJl6/6JiQmi+CYn5wu3zyVx8db1GJ6m1WEn2GPf5k 5eVmBhGXZkSLobPgrBzesIPsL0C69MXlAnpz/17HDFQ51mxPAgCukDEvM4Rzsb6M+xF6 QI1PcQ0LiJUcdFSgxLrW7WMRfexyIltawQQ8vYzWYaPYgBfWdhsIiSpVtJaRiL9BXqw6 Gvqw== X-Gm-Message-State: AOJu0YyOzGb3Fr2jxUV5iVZLtp0VR5X19qcRnQcyPqh4uHXR1RcfPsro 5dLx9VVripYQRarfABOQ6VAsUEJAEM1n8du5wkrkioDBsc7GXxNIKWQJ0mpvJ4ty/rg8J3tv6gz unp0h/4UECJNrP4tEK7qscZwFiH67y4LALGE2WMSvHg== X-Gm-Gg: ASbGncvBvRuTGFfYSLjCsCVnfK7U327ehV++oDCB3p/gQ25QMdlP14XYs9fhkN83l/Z vKcc/0bwqr3eFQMiFR3xWlL33lhI7oEO1ZmLd58izAmREGNemgAZIvy0qDXCOLm+RwOJhToFMxO W8Yv/txeZlqzi4ttwjZFAXaq0YKFZ0++mvK4D7WXnMD/L3kCJ5y/WHCbA6xxw3eNrNe9jXWVQMK TyFlAE43roiXF5vx3ZgiVcbWS/52p38LbufWU6SNAhLRzCmUJRDb+0aCYi4kMUyhe0= X-Google-Smtp-Source: AGHT+IHwV6ic38+R8A1UIZ4TaWa8aIXxZt5Z9gRIIFYFr5gyZVwIw0GARUxaU7D7lF+iw9PmGR8ctWJKRYd9C31pKYA= X-Received: by 2002:a17:903:3b87:b0:279:fa:30fe with SMTP id d9443c01a7336-2902739aeb6mr210575655ad.26.1760198572696; Sat, 11 Oct 2025 09:02:52 -0700 (PDT) MIME-Version: 1.0 References: <8b4a6869b1fca2d0c39777b76439e6f153ba8c76.camel@cybertec.at> In-Reply-To: <8b4a6869b1fca2d0c39777b76439e6f153ba8c76.camel@cybertec.at> From: "Vu Le (JData - HN)" Date: Sat, 11 Oct 2025 23:02:43 +0700 X-Gm-Features: AS18NWADiyVGo3inBRuqp7hXYRy-8DGz9q5xzO8Fs_SRKLyw97bL9OGiKYyfnDs Message-ID: Subject: =?UTF-8?Q?Re=3A_Upgrade_=26_Rollback_plan=3A_My_customer_requests_ro?= =?UTF-8?Q?llback_via_old=2Dversion_standby_=2813_=E2=86=94_17=29_=E2=80=94_need_communit?= =?UTF-8?Q?y_advice?= To: Laurenz Albe Cc: pgsql-general@lists.postgresql.org 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 Thank you very much, Laurenz. After reading several sources, I can confirm that this approach is indeed not feasible at all. I=E2=80=99m planning to prepare a short proposal and report to the customer= , focusing on the major risks they would face rather than trying to implement it. If possible, could you please share any additional best practices or important considerations apart from testing the new version in a staging environment? Thank you once again for your guidance. Wishing you a pleasant weekend ahead! On Fri, Oct 10, 2025 at 4:01=E2=80=AFPM Laurenz Albe wrote: > > On Fri, 2025-10-10 at 15:26 +0700, Vu Le (JData - HN) wrote: > > I'm currently planning a major version upgrade from PostgreSQL 13.x to > > 17.x in a production environment. > > > > My customer has requested the following rollback approach, and I=E2=80= =99d > > like to confirm if it=E2=80=99s technically feasible or advisable befor= e > > proceeding. > > > > Scenario: > > 1. They have a **Primary=E2=80=93Standby setup** (streaming replication= ). > > 2. Their idea is to **upgrade only the Primary** (to v17) first, while > > keeping the **Standby** on v13 (the old version). > > - The upgraded Primary will run read/write traffic for about a week > > to validate stability. > > - If any serious issue occurs, the plan is to **switch over** > > (promote the v13 Standby), adjust IPs, and resume operations there =E2= =80=94 > > minimizing downtime. > > 3. They also asked whether it=E2=80=99s possible for **data generated o= n the > > v17 Primary** to still be **replicated back to the v13 Standby**, so > > that rollback would be fast and without data loss. > > > > Constraints: > > - They **cannot use a Blue/Green or clone-based approach**, because of > > **limited storage resources**. > > - They also doesn=E2=80=99t want the old data directory to become outda= ted > > (they expects it could stay in sync with the upgraded node). > > - They only have **UAT and Production environments** (no dedicated Stag= ing). > > > > Questions: > > 1. Is there **any supported or practical method** to replicate data > > *backward* (from PostgreSQL 17 to 13) =E2=80=94 even temporarily, for r= ollback > > purposes? > > 2. If not, what are the **recommended real-world rollback strategies** > > for a low-downtime upgrade under these constraints? > > 3. Are there open-source tools or logical replication setups (e.g., > > pglogical, Bucardo, etc.) that could safely achieve something similar? > > The only way to achieve something like that is to use logical replication= . > You'd have to switch from streaming replication to logical replication: > > - create a publication for all tables on the primary > - turn off the application > - promote the standby server > - create a subscription on the former standby with "copy_data =3D off" > > Then you can upgrade the former primary with pg_upgrade --link and > restart the application. > > After that, logical replication will keep the v13 machine updated. > > Note that you cannot run any DDL statements on the database after that, > else replication will break. > > You cannot upgrade the standby server, you'll have to discard the data > directory and start with a new pg_basebackup. > > This is all pretty complicated and should be tested well. > But then, it might be a better idea to invest the testing effort into > testing the application on PostgreSQL v17, so that you are confident > that you won't need to downgrade. That would allow you to use a simpler > and less risky form of upgrade. > > Yours, > Laurenz Albe -- Best Regards, Miles Le | Vu (Mr.)