From 5e02feda4b229cee0c1d482bf868ce47d186f503 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Bompard?= Date: Wed, 15 May 2024 16:13:21 +0200 Subject: [PATCH] Support in-place upgrades of PostgreSQL major versions Revert to version 2.10.3 to support upgrades from PostgreSQL 12 --- sources | 2 +- timescaledb-upgrade.env | 1 + timescaledb.spec | 55 +++++++++++++++++++++++++++++++++++------ 3 files changed, 50 insertions(+), 8 deletions(-) create mode 100644 timescaledb-upgrade.env diff --git a/sources b/sources index 4ddb006..7cf38da 100755 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (2.14.2.tar.gz) = 5a7ab4df5d89b83d423be5d6770098ab0303b22e29166afd3ab91ac2199571df20e33ec9f40bfa90ddf44829571fe696f311d81d27b46d569f2d75e75970e4f9 +SHA512 (2.10.3.tar.gz) = c94227d9aa1df36634bbf2626f580165860cab543efbfeb448f9799cf70ef6c1891af0077c2280ae22dbfb2360cf2b6012e7f05c26b0cf7aef6eb217c583b444 diff --git a/timescaledb-upgrade.env b/timescaledb-upgrade.env new file mode 100644 index 0000000..b2bcc3a --- /dev/null +++ b/timescaledb-upgrade.env @@ -0,0 +1 @@ +export PGSETUP_PGUPGRADE_OPTIONS="${PGSETUP_PGUPGRADE_OPTIONS} -O '-c shared_preload_libraries=timescaledb'" diff --git a/timescaledb.spec b/timescaledb.spec index f411ae2..c512d01 100644 --- a/timescaledb.spec +++ b/timescaledb.spec @@ -1,15 +1,21 @@ %global core_name timescale +%if 0%{?fedora} >= 30 || 0%{?epel} >= 8 +%global pg_config pg_server_config +%else +%global pg_config pg_config +%endif Name: %{core_name}db -Version: 2.14.2 +Version: 2.10.3 Release: 1%{?dist} Summary: Open-source time-series database powered by PostgreSQL License: Apache-2.0 URL: http://www.%{core_name}.com Source0: https://github.com/%{core_name}/%{name}/archive/refs/tags/%{version}.tar.gz +Source1: timescaledb-upgrade.env -BuildRequires: cmake gcc openssl-devel postgresql-server-devel +BuildRequires: cmake gcc openssl-devel postgresql-server-devel postgresql-upgrade-devel Requires(pre): postgresql-server @@ -20,6 +26,23 @@ partitioning across time and space (partitioning key), as well as full SQL support. +%package upgrade +Summary: Support for upgrading from a previous major release of PostgreSQL +Requires: %{name}%{?_isa} = %{version}-%{release} + +%description upgrade +This package contains the files needed for upgrading a PostgreSQL database from +the previous major version of PostgreSQL. + +Note that since pg_upgrade starts the updated server with a default config file, +you need to set: + PGSETUP_PGUPGRADE_OPTIONS="-O '-c shared_preload_libraries=timescaledb'" +before running postgresql-setup --upgrade. +This package sets it for you at login time, but if you don't want to login again +you can run: + source %{_sysconfdir}/profile.d/%{name}-upgrade.sh + + %prep %autosetup -n %{name}-%{version} # Remove tsl directory containing sources licensed under Timescale license @@ -27,16 +50,21 @@ rm -rf tsl %build -%if 0%{?fedora} >= 30 || 0%{?epel} >= 8 -%cmake -DPROJECT_INSTALL_METHOD=fedora -DREGRESS_CHECKS=OFF -DAPACHE_ONLY=1 -DPG_CONFIG=%_bindir/pg_server_config -%else -%cmake -DPROJECT_INSTALL_METHOD=fedora -DREGRESS_CHECKS=OFF -DAPACHE_ONLY=1 -DPG_CONFIG=%_bindir/pg_config -%endif +%cmake -DPROJECT_INSTALL_METHOD=fedora -DREGRESS_CHECKS=OFF -DAPACHE_ONLY=1 -DPG_CONFIG=%_bindir/%pg_config %cmake_build +# Build for the previous PG verison for in-place upgrades +pg_config=$(ls /usr/lib64/pgsql/postgresql-*/bin/pg_config) +%cmake -DPROJECT_INSTALL_METHOD=fedora -DREGRESS_CHECKS=OFF -DAPACHE_ONLY=1 \ + -B %{__cmake_builddir}-prev \ + -DPG_CONFIG=${pg_config} +%{__cmake} --build %{__cmake_builddir}-prev %{?_smp_mflags} --verbose + %install %cmake_install +DESTDIR="%{buildroot}" %{__cmake} --install %{__cmake_builddir}-prev +install -p -m 644 -D %{SOURCE1} %{buildroot}%{_sysconfdir}/profile.d/%{name}-upgrade.sh %files @@ -47,8 +75,21 @@ rm -rf tsl %{_datadir}/pgsql/extension/%{name}--*%{version}.sql %{_datadir}/pgsql/extension/%{name}.control +%files upgrade +%license LICENSE-APACHE +%doc README.md +%{_libdir}/pgsql/postgresql-*/lib/%{name}-%{version}.so +%{_libdir}/pgsql/postgresql-*/lib/%{name}.so +%{_libdir}/pgsql/postgresql-*/share/extension/%{name}--*%{version}.sql +%{_libdir}/pgsql/postgresql-*/share/extension/%{name}.control +%{_sysconfdir}/profile.d/%{name}-upgrade.sh + %changelog +* Tue May 14 2024 Aurelien Bompard - 2.10.3-1 +- Support in-place upgrades of PostgreSQL major versions +- Revert to version 2.10.3 to support upgrades from PostgreSQL 12 + * Wed Feb 28 2024 Ondrej Sloup - 2.14.2-1 - Rebase to the latest upstream version (rhbz#2265335)