diff --git a/.ci/prepare_cluster.sh b/.ci/prepare_cluster.sh index 5b0111dae789f7777d1a18e36cd672ef45ea3791..d098b4b442be7c1e77dd741638d7e2499c1b6c86 100755 --- a/.ci/prepare_cluster.sh +++ b/.ci/prepare_cluster.sh @@ -5,7 +5,7 @@ echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - apt-get update apt-get -y upgrade -apt-get -y install postgresql-${PG_VER} postgresql-contrib-${PG_VER} postgresql-client-${PG_VER} postgresql-server-dev-${PG_VER} && apt-get install -y postgresql-${PG_VER}-pg-stat-kcache +apt-get -y install postgresql-${PG_VER} postgresql-contrib-${PG_VER} postgresql-client-${PG_VER} postgresql-server-dev-${PG_VER} && apt-get install -y postgresql-${PG_VER}-pg-stat-kcache bc psql --version source ~/.profile echo "127.0.0.2 postgres.test1.node" >> /etc/hosts # replica 1 @@ -30,10 +30,14 @@ echo "shared_preload_libraries = 'pg_stat_statements,auto_explain,pg_stat_kcache ## Configure general postgres master node params echo "wal_level = hot_standby" >> /etc/postgresql/${PG_VER}/main/postgresql.conf echo "max_wal_senders = 5" >> /etc/postgresql/${PG_VER}/main/postgresql.conf -echo "wal_keep_segments = 32" >> /etc/postgresql/${PG_VER}/main/postgresql.conf echo "archive_mode = on" >> /etc/postgresql/${PG_VER}/main/postgresql.conf echo "archive_command = 'cp %p /path_to/archive/%f'" >> /etc/postgresql/${PG_VER}/main/postgresql.conf +if [ $(echo "$PG_VER < 13" | /usr/bin/bc) = "1" ]; then + # wal_keep_segments is deprecated in Postgres 12 + echo "wal_keep_segments = 32" >> /etc/postgresql/${PG_VER}/main/postgresql.conf +fi + ## Start postgres master node /etc/init.d/postgresql start psql -U postgres -c "create role replication with replication password 'rEpLpAssw' login" @@ -77,10 +81,18 @@ function add_replica() { ## Configure replica postgres settings echo "hot_standby = on" >> /var/lib/postgresql/${PG_VER}/data${num}/postgresql.conf - echo "standby_mode = 'on'" > /var/lib/postgresql/${PG_VER}/data${num}/recovery.conf - echo "primary_conninfo = 'host=127.0.0.4 port=5432 user=replication password=rEpLpAssw'" >> /var/lib/postgresql/${PG_VER}/data${num}/recovery.conf - echo "trigger_file = '/var/lib/postgresql/${PG_VER}/data${num}/trigger'" >> /var/lib/postgresql/${PG_VER}/data${num}/recovery.conf - echo "restore_command = 'cp /path_to/archive/%f "%p"'" >> /var/lib/postgresql/${PG_VER}/data${num}/recovery.conf + + if [ $(echo "$PG_VER < 13" | /usr/bin/bc) = "1" ]; then + echo "standby_mode = 'on'" > /var/lib/postgresql/${PG_VER}/data${num}/recovery.conf + echo "primary_conninfo = 'host=127.0.0.4 port=5432 user=replication password=rEpLpAssw'" >> /var/lib/postgresql/${PG_VER}/data${num}/recovery.conf + echo "trigger_file = '/var/lib/postgresql/${PG_VER}/data${num}/trigger'" >> /var/lib/postgresql/${PG_VER}/data${num}/recovery.conf + echo "restore_command = 'cp /path_to/archive/%f "%p"'" >> /var/lib/postgresql/${PG_VER}/data${num}/recovery.conf + else + touch "/var/lib/postgresql/${PG_VER}/data${num}/standby.signal" + echo "primary_conninfo = 'host=127.0.0.4 port=5432 user=replication password=rEpLpAssw'" >> /var/lib/postgresql/${PG_VER}/data${num}/postgresql.conf + echo "promote_trigger_file = '/var/lib/postgresql/${PG_VER}/data${num}/trigger'" >> /var/lib/postgresql/${PG_VER}/data${num}/postgresql.conf + echo "restore_command = 'cp /path_to/archive/%f "%p"'" >> /var/lib/postgresql/${PG_VER}/data${num}/postgresql.conf + fi ## Start replica sudo -u postgres /usr/lib/postgresql/${PG_VER}/bin/pg_ctl -D /var/lib/postgresql/${PG_VER}/data${num} -l /var/log/postgresql/secondary1.log start || cat /var/log/postgresql/replica${num}.log diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8cc85e72160e64898be271cec6751e5204aaf6ea..54d642837664c90ac8f9d7de309c7a5457ef99cf 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -187,9 +187,27 @@ test-check-12: services: - postgres:12 +test-check-13: + extends: ".test-check" + stage: "test" + services: + - postgres:13 + +test-check-14: + extends: ".test-check" + stage: "test" + services: + - postgres:14 + +test-check-15: + extends: ".test-check" + stage: "test" + services: + - postgres:15beta4 + test-check-cli: services: - - postgres:11 + - postgres:14 stage: "test" extends: ".prepare" script: | diff --git a/pghrep/internal/checkup/cfg/cfg.go b/pghrep/internal/checkup/cfg/cfg.go index 4841f1fffda342e91cdc946b34d4b222ede86be9..294936181ae092d7b78cf348d6f84fdda7dfbca8 100644 --- a/pghrep/internal/checkup/cfg/cfg.go +++ b/pghrep/internal/checkup/cfg/cfg.go @@ -30,36 +30,49 @@ const POSTGRES_RELEASES_URL string = "https://git.postgresql.org/gitweb/?p=postg const RELEASE_CODE = "REL" var versionsDefault map[string]Version = map[string]Version{ + "14": { + FirstRelease: "2021-09-30", + FinalRelease: "2026-11-12", + MinorVersions: []int{0, 1, 2, 3, 4, 5}, + }, + "13": { + FirstRelease: "2020-09-24", + FinalRelease: "2025-11-13", + MinorVersions: []int{0, 1, 2, 3, 4, 5, 6, 7, 8}, + }, "12": Version{ FirstRelease: "2019-10-03", FinalRelease: "2024-11-14", - MinorVersions: []int{0}, + MinorVersions: []int{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}, }, "11": Version{ FirstRelease: "2018-10-18", FinalRelease: "2023-11-09", - MinorVersions: []int{0, 1, 2, 3, 4}, + MinorVersions: []int{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17}, }, "10": Version{ - FirstRelease: "2017-10-05", - FinalRelease: "2022-11-10", - MinorVersions: []int{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, + FirstRelease: "2017-10-05", + FinalRelease: "2022-11-10", + MinorVersions: []int{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22}, }, "9.6": Version{ - FirstRelease: "2016-09-29", - FinalRelease: "2021-11-11", - MinorVersions: []int{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14}, + FirstRelease: "2016-09-29", + FinalRelease: "2021-11-11", + MinorVersions: []int{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24}, }, "9.5": Version{ - FirstRelease: "2016-01-07", - FinalRelease: "2021-02-11", - MinorVersions: []int{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18}, + FirstRelease: "2016-01-07", + FinalRelease: "2021-02-11", + MinorVersions: []int{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25}, }, "9.4": Version{ FirstRelease: "2014-12-18", FinalRelease: "2020-02-13", MinorVersions: []int{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - 20, 21, 22, 23}, + 20, 21, 22, 23, 24, 25, 26}, }, "9.3": Version{ FirstRelease: "2013-09-09",