From 786756464d45493a005f00182505a5ac38eba3ee Mon Sep 17 00:00:00 2001 From: Ida Novindasari Date: Wed, 11 Dec 2024 13:34:12 +0100 Subject: [PATCH] Add pg17 and remove pg12 in trigger (#1059) --- delivery.yaml | 8 +- postgres-appliance/Dockerfile | 24 ++-- postgres-appliance/build_scripts/base.sh | 46 +++---- postgres-appliance/build_scripts/prepare.sh | 4 + .../major_upgrade/pg_upgrade.py | 2 +- postgres-appliance/scripts/post_init.sh | 88 ++++++++++++- postgres-appliance/scripts/spilo_commons.py | 10 +- postgres-appliance/tests/docker-compose.yml | 2 +- postgres-appliance/tests/test_spilo.sh | 120 +++++++++--------- 9 files changed, 194 insertions(+), 110 deletions(-) diff --git a/delivery.yaml b/delivery.yaml index 67366b64e..2435b0d0c 100644 --- a/delivery.yaml +++ b/delivery.yaml @@ -3,7 +3,7 @@ allow_concurrent_steps: true build_env: &BUILD_ENV BASE_IMAGE: container-registry.zalando.net/library/ubuntu-22.04 - PGVERSION: 16 + PGVERSION: 17 MULTI_ARCH_REGISTRY: container-registry-test.zalando.net/acid pipeline: @@ -33,6 +33,8 @@ pipeline: docker buildx build --platform "linux/amd64" \ --build-arg PGVERSION="$PGVERSION" \ --build-arg BASE_IMAGE="$BASE_IMAGE" \ + --build-arg PGOLDVERSIONS="14 15 16" \ + --build-arg TIMESCALEDB="2.17.2" \ -t "$ECR_TEST_IMAGE" \ --push . @@ -61,6 +63,8 @@ pipeline: docker buildx build --platform "linux/amd64,linux/arm64" \ --build-arg PGVERSION="$PGVERSION" \ --build-arg BASE_IMAGE="$BASE_IMAGE" \ + --build-arg PGOLDVERSIONS="14 15 16" \ + --build-arg TIMESCALEDB="2.17.2" \ -t "$ECR_TEST_IMAGE" \ --push . cdp-promote-image "$ECR_TEST_IMAGE" @@ -91,6 +95,8 @@ pipeline: docker buildx build --platform "linux/amd64,linux/arm64" \ --build-arg PGVERSION="$PGVERSION" \ --build-arg BASE_IMAGE="$BASE_IMAGE" \ + --build-arg PGOLDVERSIONS="14 15 16" \ + --build-arg TIMESCALEDB="2.17.2" \ -t "$ECR_TEST_IMAGE" \ --push . cdp-promote-image "$ECR_TEST_IMAGE" diff --git a/postgres-appliance/Dockerfile b/postgres-appliance/Dockerfile index 272d70041..b31603610 100644 --- a/postgres-appliance/Dockerfile +++ b/postgres-appliance/Dockerfile @@ -1,6 +1,6 @@ ARG BASE_IMAGE=ubuntu:22.04 -ARG PGVERSION=16 -ARG TIMESCALEDB="2.11.2 2.14.2" +ARG PGVERSION=17 +ARG TIMESCALEDB="2.15.3 2.17.2" ARG DEMO=false ARG COMPRESS=false ARG ADDITIONAL_LOCALES= @@ -48,21 +48,21 @@ ARG TIMESCALEDB ARG TIMESCALEDB_APACHE_ONLY=true ARG TIMESCALEDB_TOOLKIT=true ARG COMPRESS -ARG PGOLDVERSIONS="12 13 14 15" +ARG PGOLDVERSIONS="13 14 15 16" ARG WITH_PERL=false ARG DEB_PG_SUPPORTED_VERSIONS="$PGOLDVERSIONS $PGVERSION" # Install PostgreSQL, extensions and contribs ENV POSTGIS_VERSION=3.5 \ - BG_MON_COMMIT=ef60961eff92672b1e21f5260dc1211367da6f1f \ - PG_AUTH_MON_COMMIT=3d010e5959285c32b155e8064c9c9b57869aeca7 \ - PG_MON_COMMIT=a6c5982368edd876edbee01e51b91e7387071e21 \ - SET_USER=REL4_0_1 \ - PLPROFILER=REL4_2_4 \ - PG_PROFILE=4.6 \ + BG_MON_COMMIT=7f5887218790b263fe3f42f85f4ddc9c8400b154 \ + PG_AUTH_MON_COMMIT=fe099eef7662cbc85b0b79191f47f52f1e96b779 \ + PG_MON_COMMIT=ead1de70794ed62ca1e34d4022f6165ff36e9a91 \ + SET_USER=REL4_1_0 \ + PLPROFILER=REL4_2_5 \ + PG_PROFILE=4.7 \ PAM_OAUTH2=v1.0.1 \ - PG_PERMISSIONS_COMMIT=314b9359e3d77c0b2ef7dbbde97fa4be80e31925 + PG_PERMISSIONS_COMMIT=f4b7c18676fa64236a1c8e28d34a35764e4a70e2 WORKDIR /builddeps RUN bash base.sh @@ -73,7 +73,7 @@ COPY --from=dependencies-builder /builddeps/wal-g /usr/local/bin/ COPY build_scripts/patroni_wale.sh build_scripts/compress_build.sh /builddeps/ # Install patroni and wal-e -ENV PATRONIVERSION=3.3.3 +ENV PATRONIVERSION=3.3.4 ENV WALE_VERSION=1.1.1 WORKDIR / @@ -92,7 +92,6 @@ FROM builder-${COMPRESS} LABEL maintainer="Team ACID @ Zalando " ARG PGVERSION -ARG TIMESCALEDB ARG DEMO ARG COMPRESS @@ -102,7 +101,6 @@ ENV LC_ALL=en_US.utf-8 \ PATH=$PATH:/usr/lib/postgresql/$PGVERSION/bin \ PGHOME=/home/postgres \ RW_DIR=/run \ - TIMESCALEDB=$TIMESCALEDB \ DEMO=$DEMO ENV WALE_ENV_DIR=$RW_DIR/etc/wal-e.d/env \ diff --git a/postgres-appliance/build_scripts/base.sh b/postgres-appliance/build_scripts/base.sh index e0d555d8a..6af88b12a 100644 --- a/postgres-appliance/build_scripts/base.sh +++ b/postgres-appliance/build_scripts/base.sh @@ -56,7 +56,6 @@ curl -sL "https://github.com/zalando-pg/pg_auth_mon/archive/$PG_AUTH_MON_COMMIT. curl -sL "https://github.com/cybertec-postgresql/pg_permissions/archive/$PG_PERMISSIONS_COMMIT.tar.gz" | tar xz curl -sL "https://github.com/zubkov-andrei/pg_profile/archive/$PG_PROFILE.tar.gz" | tar xz git clone -b "$SET_USER" https://github.com/pgaudit/set_user.git -git clone https://github.com/timescale/timescaledb.git apt-get install -y \ postgresql-common \ @@ -81,8 +80,8 @@ for version in $DEB_PG_SUPPORTED_VERSIONS; do "postgresql-${version}-first-last-agg" "postgresql-${version}-hll" "postgresql-${version}-hypopg" - "postgresql-${version}-plproxy" "postgresql-${version}-partman" + "postgresql-${version}-plproxy" "postgresql-${version}-pgaudit" "postgresql-${version}-pldebugger" "postgresql-${version}-pglogical" @@ -105,6 +104,12 @@ for version in $DEB_PG_SUPPORTED_VERSIONS; do fi + if [ "${TIMESCALEDB_APACHE_ONLY}" = "true" ]; then + EXTRAS+=("timescaledb-2-oss-postgresql-${version}") + else + EXTRAS+=("timescaledb-2-postgresql-${version}") + fi + # Install PostgreSQL binaries, contrib, plproxy and multiple pl's apt-get install --allow-downgrades -y \ "postgresql-${version}-cron" \ @@ -116,39 +121,28 @@ for version in $DEB_PG_SUPPORTED_VERSIONS; do "postgresql-${version}-pg-stat-kcache" \ "${EXTRAS[@]}" - # Install 3rd party stuff + # Clean up timescaledb versions except the highest compatible version + exclude_patterns=() + exclude_patterns_tsl=() + for ts_version in ${TIMESCALEDB}; do + exclude_patterns+=(! -name timescaledb-"${ts_version}".so) + exclude_patterns_tsl+=(! -name timescaledb-tsl-"${ts_version}".so) + done + find /usr/lib/postgresql/"${version}"/lib/ -name 'timescaledb-2.*.so' "${exclude_patterns[@]}" -delete; - # use subshell to avoid having to cd back (SC2103) - ( - cd timescaledb - for v in $TIMESCALEDB; do - git checkout "$v" - sed -i "s/VERSION 3.11/VERSION 3.10/" CMakeLists.txt - if BUILD_FORCE_REMOVE=true ./bootstrap -DREGRESS_CHECKS=OFF -DWARNINGS_AS_ERRORS=OFF \ - -DTAP_CHECKS=OFF -DPG_CONFIG="/usr/lib/postgresql/$version/bin/pg_config" \ - -DAPACHE_ONLY="$TIMESCALEDB_APACHE_ONLY" -DSEND_TELEMETRY_DEFAULT=NO; then - make -C build install - strip /usr/lib/postgresql/"$version"/lib/timescaledb*.so - fi - git reset --hard - git clean -f -d - done - ) + if [ "${TIMESCALEDB_APACHE_ONLY}" != "true" ]; then + find /usr/lib/postgresql/"${version}"/lib/ -name 'timescaledb-tsl-2.*.so' "${exclude_patterns_tsl[@]}" -delete; + fi - if [ "${TIMESCALEDB_APACHE_ONLY}" != "true" ] && [ "${TIMESCALEDB_TOOLKIT}" = "true" ]; then - __versionCodename=$(sed /usr/share/keyrings/timescale_E7391C94080429FF.gpg + # Install 3rd party stuff + if [ "${TIMESCALEDB_APACHE_ONLY}" != "true" ] && [ "${TIMESCALEDB_TOOLKIT}" = "true" ]; then apt-get update if [ "$(apt-cache search --names-only "^timescaledb-toolkit-postgresql-${version}$" | wc -l)" -eq 1 ]; then apt-get install "timescaledb-toolkit-postgresql-$version" else echo "Skipping timescaledb-toolkit-postgresql-$version as it's not found in the repository" fi - - rm /etc/apt/sources.list.d/timescaledb.list - rm /usr/share/keyrings/timescale_E7391C94080429FF.gpg fi EXTRA_EXTENSIONS=() diff --git a/postgres-appliance/build_scripts/prepare.sh b/postgres-appliance/build_scripts/prepare.sh index 50f32db86..66c2a2cb8 100644 --- a/postgres-appliance/build_scripts/prepare.sh +++ b/postgres-appliance/build_scripts/prepare.sh @@ -40,6 +40,10 @@ for t in deb deb-src; do done curl -s -o - https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor > /etc/apt/trusted.gpg.d/apt.postgresql.org.gpg +# add TimescaleDB repository +echo "deb [signed-by=/etc/apt/keyrings/timescale_timescaledb-archive-keyring.gpg] https://packagecloud.io/timescale/timescaledb/ubuntu/ ${DISTRIB_CODENAME} main" | tee /etc/apt/sources.list.d/timescaledb.list +curl -fsSL https://packagecloud.io/timescale/timescaledb/gpgkey | gpg --dearmor | tee /etc/apt/keyrings/timescale_timescaledb-archive-keyring.gpg > /dev/null + # Clean up apt-get purge -y libcap2-bin apt-get autoremove -y diff --git a/postgres-appliance/major_upgrade/pg_upgrade.py b/postgres-appliance/major_upgrade/pg_upgrade.py index d9dafa4fc..ad1563e80 100644 --- a/postgres-appliance/major_upgrade/pg_upgrade.py +++ b/postgres-appliance/major_upgrade/pg_upgrade.py @@ -204,7 +204,7 @@ def pg_upgrade(self, check=False): def prepare_new_pgdata(self, version): from spilo_commons import append_extensions - locale = self.query('SHOW lc_collate')[0][0] + locale = self.query("SELECT datcollate FROM pg_database WHERE datname='template1';")[0][0] encoding = self.query('SHOW server_encoding')[0][0] initdb_config = [{'locale': locale}, {'encoding': encoding}] if self.query("SELECT current_setting('data_checksums')::bool")[0][0]: diff --git a/postgres-appliance/scripts/post_init.sh b/postgres-appliance/scripts/post_init.sh index 0950d04ef..c12e9c83b 100755 --- a/postgres-appliance/scripts/post_init.sh +++ b/postgres-appliance/scripts/post_init.sh @@ -5,7 +5,11 @@ cd "$(dirname "${BASH_SOURCE[0]}")" || exit 1 export PGOPTIONS="-c synchronous_commit=local -c search_path=pg_catalog" PGVER=$(psql -d "$2" -XtAc "SELECT pg_catalog.current_setting('server_version_num')::int/10000") -RESET_ARGS="oid, oid, bigint" +if [ "$PGVER" -lt 17 ]; then + RESET_ARGS="oid, oid, bigint" +else + RESET_ARGS="oid, oid, bigint, bool" +fi (echo "\set ON_ERROR_STOP on" echo "DO \$\$ @@ -213,6 +217,88 @@ while IFS= read -r db_name; do UPGRADE_TIMESCALEDB=$(echo -e "SELECT NULL;\nSELECT default_version != installed_version FROM pg_catalog.pg_available_extensions WHERE name = 'timescaledb'" | psql -tAX -d "${db_name}" 2> /dev/null | tail -n 1) if [ "$UPGRADE_TIMESCALEDB" = "t" ]; then echo "ALTER EXTENSION timescaledb UPDATE;" + IS_VERSION_BELOW_215=$(echo -e "SELECT (installed_version < '2.15')::bool FROM pg_catalog.pg_available_extensions WHERE name = 'timescaledb'" | psql -tAX -d "${db_name}" 2> /dev/null | tail -n 1) + if [ "$IS_VERSION_BELOW_215" = "t" ]; then + echo """ + -- Fix compressed hypertables with FOREIGN KEY constraints that were created with TimescaleDB versions before 2.15.0 + CREATE OR REPLACE FUNCTION pg_temp.constraint_columns(regclass, int2[]) RETURNS text[] AS + $$ + SELECT array_agg(attname) FROM unnest($2) un(attnum) LEFT JOIN pg_attribute att ON att.attrelid=$1 AND att.attnum = un.attnum; + $$ LANGUAGE SQL SET search_path TO pg_catalog, pg_temp; + DO $$ + DECLARE + ht_id int; + ht regclass; + chunk regclass; + con_oid oid; + con_frelid regclass; + con_name text; + con_columns text[]; + chunk_id int; + + BEGIN + + -- iterate over all hypertables that have foreign key constraints + FOR ht_id, ht in + SELECT + ht.id, + format('%I.%I',ht.schema_name,ht.table_name)::regclass + FROM _timescaledb_catalog.hypertable ht + WHERE + EXISTS ( + SELECT FROM pg_constraint con + WHERE + con.contype='f' AND + con.conrelid=format('%I.%I',ht.schema_name,ht.table_name)::regclass + ) + LOOP + RAISE NOTICE 'Hypertable % has foreign key constraint', ht; + + -- iterate over all foreign key constraints on the hypertable + -- and check that they are present on every chunk + FOR con_oid, con_frelid, con_name, con_columns IN + SELECT con.oid, con.confrelid, con.conname, pg_temp.constraint_columns(con.conrelid,con.conkey) + FROM pg_constraint con + WHERE + con.contype='f' AND + con.conrelid=ht + LOOP + RAISE NOTICE 'Checking constraint % %', con_name, con_columns; + -- check that the foreign key constraint is present on the chunk + + FOR chunk_id, chunk IN + SELECT + ch.id, + format('%I.%I',ch.schema_name,ch.table_name)::regclass + FROM _timescaledb_catalog.chunk ch + WHERE + ch.hypertable_id=ht_id + LOOP + RAISE NOTICE 'Checking chunk %', chunk; + IF NOT EXISTS ( + SELECT FROM pg_constraint con + WHERE + con.contype='f' AND + con.conrelid=chunk AND + con.confrelid=con_frelid AND + pg_temp.constraint_columns(con.conrelid,con.conkey) = con_columns + ) THEN + RAISE WARNING 'Restoring constraint % on chunk %', con_name, chunk; + PERFORM _timescaledb_functions.constraint_clone(con_oid, chunk); + INSERT INTO _timescaledb_catalog.chunk_constraint(chunk_id, dimension_slice_id, constraint_name, hypertable_constraint_name) VALUES (chunk_id, NULL, con_name, con_name); + END IF; + + END LOOP; + END LOOP; + + END LOOP; + + END + $$; + + DROP FUNCTION pg_temp.constraint_columns(regclass, int2[]); + """ + fi fi UPGRADE_TIMESCALEDB_TOOLKIT=$(echo -e "SELECT NULL;\nSELECT default_version != installed_version FROM pg_catalog.pg_available_extensions WHERE name = 'timescaledb_toolkit'" | psql -tAX -d "${db_name}" 2> /dev/null | tail -n 1) if [ "$UPGRADE_TIMESCALEDB_TOOLKIT" = "t" ]; then diff --git a/postgres-appliance/scripts/spilo_commons.py b/postgres-appliance/scripts/spilo_commons.py index d80a4dae9..0543bf771 100644 --- a/postgres-appliance/scripts/spilo_commons.py +++ b/postgres-appliance/scripts/spilo_commons.py @@ -12,13 +12,13 @@ # (min_version, max_version, shared_preload_libraries, extwlist.extensions) extensions = { - 'timescaledb': (9.6, 16, True, True), - 'pg_cron': (9.5, 16, True, False), - 'pg_stat_kcache': (9.4, 16, True, False), - 'pg_partman': (9.4, 16, False, True) + 'timescaledb': (9.6, 17, True, True), + 'pg_cron': (9.5, 17, True, False), + 'pg_stat_kcache': (9.4, 17, True, False), + 'pg_partman': (9.4, 17, False, True) } if os.environ.get('ENABLE_PG_MON') == 'true': - extensions['pg_mon'] = (11, 16, True, False) + extensions['pg_mon'] = (11, 17, True, False) def adjust_extensions(old, version, extwlist=False): diff --git a/postgres-appliance/tests/docker-compose.yml b/postgres-appliance/tests/docker-compose.yml index 31886dba2..f0399ecb2 100644 --- a/postgres-appliance/tests/docker-compose.yml +++ b/postgres-appliance/tests/docker-compose.yml @@ -51,7 +51,7 @@ services: postgresql: parameters: shared_buffers: 32MB - PGVERSION: '12' + PGVERSION: '13' # Just to test upgrade with clone. Without CLONE_SCOPE they don't work CLONE_WAL_S3_BUCKET: *bucket CLONE_AWS_ACCESS_KEY_ID: *access_key diff --git a/postgres-appliance/tests/test_spilo.sh b/postgres-appliance/tests/test_spilo.sh index d84bdc4a6..2570c0974 100755 --- a/postgres-appliance/tests/test_spilo.sh +++ b/postgres-appliance/tests/test_spilo.sh @@ -124,15 +124,15 @@ function drop_timescaledb() { } function test_inplace_upgrade_wrong_version() { - docker_exec "$1" "PGVERSION=12 $UPGRADE_SCRIPT 3" 2>&1 | grep 'Upgrade is not required' + docker_exec "$1" "PGVERSION=13 $UPGRADE_SCRIPT 3" 2>&1 | grep 'Upgrade is not required' } function test_inplace_upgrade_wrong_capacity() { - docker_exec "$1" "PGVERSION=13 $UPGRADE_SCRIPT 4" 2>&1 | grep 'number of replicas does not match' + docker_exec "$1" "PGVERSION=14 $UPGRADE_SCRIPT 4" 2>&1 | grep 'number of replicas does not match' } -function test_successful_inplace_upgrade_to_13() { - docker_exec "$1" "PGVERSION=13 $UPGRADE_SCRIPT 3" +function test_successful_inplace_upgrade_to_14() { + docker_exec "$1" "PGVERSION=14 $UPGRADE_SCRIPT 3" } function test_envdir_suffix() { @@ -147,15 +147,7 @@ function test_envdir_updated_to_x() { } function test_failed_inplace_upgrade_big_replication_lag() { - ! test_successful_inplace_upgrade_to_13 "$1" -} - -function test_successful_inplace_upgrade_to_13() { - docker_exec "$1" "PGVERSION=13 $UPGRADE_SCRIPT 3" -} - -function test_successful_inplace_upgrade_to_14() { - docker_exec "$1" "PGVERSION=14 $UPGRADE_SCRIPT 3" + ! test_successful_inplace_upgrade_to_14 "$1" } function test_successful_inplace_upgrade_to_15() { @@ -166,8 +158,12 @@ function test_successful_inplace_upgrade_to_16() { docker_exec "$1" "PGVERSION=16 $UPGRADE_SCRIPT 3" } -function test_pg_upgrade_to_16_check_failed() { - ! test_successful_inplace_upgrade_to_16 "$1" +function test_successful_inplace_upgrade_to_17() { + docker_exec "$1" "PGVERSION=17 $UPGRADE_SCRIPT 3" +} + +function test_pg_upgrade_to_17_check_failed() { + ! test_successful_inplace_upgrade_to_17 "$1" } function start_clone_with_wale_upgrade_container() { @@ -175,7 +171,7 @@ function start_clone_with_wale_upgrade_container() { docker-compose run \ -e SCOPE=upgrade \ - -e PGVERSION=13 \ + -e PGVERSION=14 \ -e CLONE_SCOPE=demo \ -e CLONE_METHOD=CLONE_WITH_WALE \ -e CLONE_TARGET_TIME="$(next_minute)" \ @@ -188,24 +184,24 @@ function start_clone_with_wale_upgrade_replica_container() { start_clone_with_wale_upgrade_container 2 } -function start_clone_with_wale_upgrade_to_16_container() { +function start_clone_with_wale_upgrade_to_17_container() { docker-compose run \ -e SCOPE=upgrade3 \ - -e PGVERSION=16 \ + -e PGVERSION=17 \ -e CLONE_SCOPE=demo \ - -e CLONE_PGVERSION=12 \ + -e CLONE_PGVERSION=13 \ -e CLONE_METHOD=CLONE_WITH_WALE \ -e CLONE_TARGET_TIME="$(next_minute)" \ --name "${PREFIX}upgrade4" \ -d "spilo3" } -function start_clone_with_wale_16_container() { +function start_clone_with_wale_17_container() { docker-compose run \ -e SCOPE=clone16 \ - -e PGVERSION=16 \ + -e PGVERSION=17 \ -e CLONE_SCOPE=upgrade3 \ - -e CLONE_PGVERSION=16 \ + -e CLONE_PGVERSION=17 \ -e CLONE_METHOD=CLONE_WITH_WALE \ -e CLONE_TARGET_TIME="$(next_hour)" \ --name "${PREFIX}clone16" \ @@ -216,7 +212,7 @@ function start_clone_with_basebackup_upgrade_container() { local container=$1 docker-compose run \ -e SCOPE=upgrade2 \ - -e PGVERSION=14 \ + -e PGVERSION=15 \ -e CLONE_SCOPE=upgrade \ -e CLONE_METHOD=CLONE_WITH_BASEBACKUP \ -e CLONE_HOST="$(docker_exec "$container" "hostname --ip-address")" \ @@ -230,10 +226,10 @@ function start_clone_with_basebackup_upgrade_container() { function start_clone_with_hourly_log_rotation() { docker-compose run \ -e SCOPE=hourlylogs \ - -e PGVERSION=16 \ + -e PGVERSION=17 \ -e LOG_SHIP_HOURLY="true" \ -e CLONE_SCOPE=upgrade2 \ - -e CLONE_PGVERSION=14 \ + -e CLONE_PGVERSION=15 \ -e CLONE_METHOD=CLONE_WITH_WALE \ -e CLONE_TARGET_TIME="$(next_minute)" \ --name "${PREFIX}hourlylogs" \ @@ -265,18 +261,18 @@ function verify_hourly_log_rotation() { [ "$log_rotation_age" = "1h" ] && [ "$log_filename" = "postgresql-%u-%H.log" ] && [ "$postgres_log_ftables" -eq 192 ] && [ "$postgres_log_views" -eq 8 ] && [ "$postgres_failed_auth_views" -eq 200 ] } -# TEST SUITE 1 - In-place major upgrade 12->13->...->16 -# TEST SUITE 2 - Major upgrade 12->16 after wal-e clone (with CLONE_PGVERSION set) -# TEST SUITE 3 - PITR (clone with wal-e) with unreachable target (13+) -# TEST SUITE 4 - Major upgrade 12->13 after wal-e clone (no CLONE_PGVERSION) +# TEST SUITE 1 - In-place major upgrade 13->14->...->17 +# TEST SUITE 2 - Major upgrade 13->17 after wal-e clone (with CLONE_PGVERSION set) +# TEST SUITE 3 - PITR (clone with wal-e) with unreachable target (14+) +# TEST SUITE 4 - Major upgrade 13->14 after wal-e clone (no CLONE_PGVERSION) # TEST SUITE 5 - Replica bootstrap with wal-e -# TEST SUITE 6 - Major upgrade 13->14 after clone with basebackup +# TEST SUITE 6 - Major upgrade 14->15 after clone with basebackup # TEST SUITE 7 - Hourly log rotation function test_spilo() { # TEST SUITE 1 local container=$1 - run_test test_envdir_suffix "$container" 12 + run_test test_envdir_suffix "$container" 13 log_info "[TS1] Testing wrong upgrade setups" run_test test_inplace_upgrade_wrong_version "$container" @@ -293,66 +289,66 @@ function test_spilo() { # TEST SUITE 2 local upgrade3_container - upgrade3_container=$(start_clone_with_wale_upgrade_to_16_container) # SCOPE=upgrade3 PGVERSION=16 CLONE: _SCOPE=demo _PGVERSION=12 _TARGET_TIME= - log_info "[TS2] Started $upgrade3_container for testing major upgrade 12->16 after clone with wal-e" + upgrade3_container=$(start_clone_with_wale_upgrade_to_17_container) # SCOPE=upgrade3 PGVERSION=17 CLONE: _SCOPE=demo _PGVERSION=13 _TARGET_TIME= + log_info "[TS2] Started $upgrade3_container for testing major upgrade 13->17 after clone with wal-e" # TEST SUITE 4 local upgrade_container - upgrade_container=$(start_clone_with_wale_upgrade_container) # SCOPE=upgrade PGVERSION=13 CLONE: _SCOPE=demo _TARGET_TIME= - log_info "[TS4] Started $upgrade_container for testing major upgrade 12->13 after clone with wal-e" + upgrade_container=$(start_clone_with_wale_upgrade_container) # SCOPE=upgrade PGVERSION=14 CLONE: _SCOPE=demo _TARGET_TIME= + log_info "[TS4] Started $upgrade_container for testing major upgrade 13->14 after clone with wal-e" # TEST SUITE 1 # wait clone to finish and prevent timescale installation gets cloned find_leader "$upgrade3_container" find_leader "$upgrade_container" - create_timescaledb "$container" # we don't install it at the beginning, as we do 12->16 in a clone + create_timescaledb "$container" # we don't install it at the beginning, as we do 13->17 in a clone - log_info "[TS1] Testing in-place major upgrade 12->13" + log_info "[TS1] Testing in-place major upgrade 13->14" wait_zero_lag "$container" - run_test test_successful_inplace_upgrade_to_13 "$container" + run_test test_successful_inplace_upgrade_to_14 "$container" wait_all_streaming "$container" - run_test test_envdir_updated_to_x 13 + run_test test_envdir_updated_to_x 14 # TEST SUITE 2 - log_info "[TS2] Testing in-place major upgrade 12->16 after wal-e clone" - run_test verify_clone_upgrade "$upgrade3_container" "wal-e" 12 16 + log_info "[TS2] Testing in-place major upgrade 13->17 after wal-e clone" + run_test verify_clone_upgrade "$upgrade3_container" "wal-e" 13 17 run_test verify_archive_mode_is_on "$upgrade3_container" wait_backup "$upgrade3_container" # TEST SUITE 3 - local clone16_container - clone16_container=$(start_clone_with_wale_16_container) # SCOPE=clone16 CLONE: _SCOPE=upgrade3 _PGVERSION=16 _TARGET_TIME= - log_info "[TS3] Started $clone16_container for testing point-in-time recovery (clone with wal-e) with unreachable target on 13+" + local clone17_container + clone17_container=$(start_clone_with_wale_17_container) # SCOPE=clone17 CLONE: _SCOPE=upgrade3 _PGVERSION=17 _TARGET_TIME= + log_info "[TS3] Started $clone17_container for testing point-in-time recovery (clone with wal-e) with unreachable target on 14+" # TEST SUITE 1 - log_info "[TS1] Testing in-place major upgrade 13->14" - run_test test_successful_inplace_upgrade_to_14 "$container" + log_info "[TS1] Testing in-place major upgrade 14->15" + run_test test_successful_inplace_upgrade_to_15 "$container" wait_all_streaming "$container" - run_test test_envdir_updated_to_x 14 + run_test test_envdir_updated_to_x 15 # TEST SUITE 3 - find_leader "$clone16_container" - run_test verify_archive_mode_is_on "$clone16_container" + find_leader "$clone17_container" + run_test verify_archive_mode_is_on "$clone17_container" # TEST SUITE 1 wait_backup "$container" - log_info "[TS1] Testing in-place major upgrade to 14->15" - run_test test_successful_inplace_upgrade_to_15 "$container" + log_info "[TS1] Testing in-place major upgrade to 15->16" + run_test test_successful_inplace_upgrade_to_16 "$container" wait_all_streaming "$container" - run_test test_envdir_updated_to_x 15 + run_test test_envdir_updated_to_x 16 # TEST SUITE 4 - log_info "[TS4] Testing in-place major upgrade 12->13 after clone with wal-e" - run_test verify_clone_upgrade "$upgrade_container" "wal-e" 12 13 + log_info "[TS4] Testing in-place major upgrade 13->14 after clone with wal-e" + run_test verify_clone_upgrade "$upgrade_container" "wal-e" 13 14 run_test verify_archive_mode_is_on "$upgrade_container" wait_backup "$upgrade_container" @@ -366,20 +362,20 @@ function test_spilo() { # TEST SUITE 6 local basebackup_container - basebackup_container=$(start_clone_with_basebackup_upgrade_container "$upgrade_container") # SCOPE=upgrade2 PGVERSION=14 CLONE: _SCOPE=upgrade - log_info "[TS6] Started $basebackup_container for testing major upgrade 13->14 after clone with basebackup" + basebackup_container=$(start_clone_with_basebackup_upgrade_container "$upgrade_container") # SCOPE=upgrade2 PGVERSION=15 CLONE: _SCOPE=upgrade + log_info "[TS6] Started $basebackup_container for testing major upgrade 14->15 after clone with basebackup" wait_backup "$basebackup_container" # TEST SUITE 1 - # run_test test_pg_upgrade_to_16_check_failed "$container" # pg_upgrade --check complains about timescaledb + # run_test test_pg_upgrade_to_17_check_failed "$container" # pg_upgrade --check complains about timescaledb wait_backup "$container" # drop_timescaledb "$container" - log_info "[TS1] Testing in-place major upgrade 15->16" - run_test test_successful_inplace_upgrade_to_16 "$container" + log_info "[TS1] Testing in-place major upgrade 16->17" + run_test test_successful_inplace_upgrade_to_17 "$container" wait_all_streaming "$container" - run_test test_envdir_updated_to_x 16 + run_test test_envdir_updated_to_x 17 # TEST SUITE 5 @@ -392,8 +388,8 @@ function test_spilo() { log_info "[TS7] Started $hourlylogs_container for testing hourly log rotation" # TEST SUITE 6 - log_info "[TS6] Testing in-place major upgrade 13->14 after clone with basebackup" - run_test verify_clone_upgrade "$basebackup_container" "basebackup" 13 14 + log_info "[TS6] Testing in-place major upgrade 14->15 after clone with basebackup" + run_test verify_clone_upgrade "$basebackup_container" "basebackup" 14 15 run_test verify_archive_mode_is_on "$basebackup_container" # TEST SUITE 7