Skip to content

Commit 46c782b

Browse files
committed
Merge branch 'REL_2_5' before PBCKP-146 into try-merge-2.6
2 parents e05a8c3 + d25a594 commit 46c782b

32 files changed

+1019
-390
lines changed

.travis.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ notifications:
2626

2727
# Default MODE is basic, i.e. all tests with PG_PROBACKUP_TEST_BASIC=ON
2828
env:
29-
- PG_VERSION=15 PG_BRANCH=master PTRACK_PATCH_PG_BRANCH=master
29+
- PG_VERSION=16 PG_BRANCH=master PTRACK_PATCH_PG_BRANCH=master
30+
- PG_VERSION=15 PG_BRANCH=REL_15_STABLE PTRACK_PATCH_PG_BRANCH=REL_15_STABLE
3031
- PG_VERSION=14 PG_BRANCH=REL_14_STABLE PTRACK_PATCH_PG_BRANCH=REL_14_STABLE
3132
- PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=REL_13_STABLE
3233
- PG_VERSION=12 PG_BRANCH=REL_12_STABLE PTRACK_PATCH_PG_BRANCH=REL_12_STABLE
@@ -35,6 +36,7 @@ env:
3536
# - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=OFF MODE=archive
3637
# - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=REL_13_STABLE MODE=backup
3738
# - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=REL_13_STABLE MODE=catchup
39+
# - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=REL_13_STABLE MODE=checkdb
3840
# - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=OFF MODE=compression
3941
# - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=OFF MODE=delta
4042
# - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=OFF MODE=locking
@@ -50,7 +52,7 @@ env:
5052
jobs:
5153
allow_failures:
5254
- if: env(PG_BRANCH) = master
53-
# - if: env(MODE) IN (archive, backup, delta, locking, merge, replica, retention, restore)
55+
# - if: env(MODE) IN (archive, backup, delta, locking, merge, replica, retention, restore)
5456

5557
# Only run CI for master branch commits to limit our travis usage
5658
#branches:

README.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
`pg_probackup` is a utility to manage backup and recovery of PostgreSQL database clusters. It is designed to perform periodic backups of the PostgreSQL instance that enable you to restore the server in case of a failure.
77

88
The utility is compatible with:
9-
* PostgreSQL 10, 11, 12, 13, 14;
9+
* PostgreSQL 10, 11, 12, 13, 14, 15;
1010

1111
As compared to other backup solutions, `pg_probackup` offers the following benefits that can help you implement different backup strategies and deal with large amounts of data:
1212
* Incremental backup: page-level incremental backup allows you to save disk space, speed up backup and restore. With three different incremental modes, you can plan the backup strategy in accordance with your data flow.
@@ -41,9 +41,9 @@ Regardless of the chosen backup type, all backups taken with `pg_probackup` supp
4141
## ptrack support
4242

4343
`PTRACK` backup support provided via following options:
44-
* vanilla PostgreSQL 11, 12, 13, 14 with [ptrack extension](https://github.com/postgrespro/ptrack)
45-
* Postgres Pro Standard 11, 12, 13
46-
* Postgres Pro Enterprise 11, 12, 13
44+
* vanilla PostgreSQL 11, 12, 13, 14, 15 with [ptrack extension](https://github.com/postgrespro/ptrack)
45+
* Postgres Pro Standard 11, 12, 13, 14
46+
* Postgres Pro Enterprise 11, 12, 13, 14
4747

4848
## Limitations
4949

@@ -137,8 +137,8 @@ sudo apt-get install pg_probackup-{14,13,12,11,10}-debuginfo
137137
#DEB Ubuntu|Debian Packages
138138
sudo sh -c 'echo "deb [arch=amd64] https://repo.postgrespro.ru/pg_probackup-forks/deb/ $(lsb_release -cs) main-$(lsb_release -cs)" > /etc/apt/sources.list.d/pg_probackup-forks.list'
139139
sudo wget -O - https://repo.postgrespro.ru/pg_probackup-forks/keys/GPG-KEY-PG_PROBACKUP | sudo apt-key add - && sudo apt-get update
140-
sudo apt-get install pg-probackup-{std,ent}-{13,12,11,10}
141-
sudo apt-get install pg-probackup-{std,ent}-{13,12,11,10}-dbg
140+
sudo apt-get install pg-probackup-{std,ent}-{14,13,12,11,10}
141+
sudo apt-get install pg-probackup-{std,ent}-{14,13,12,11,10}-dbg
142142

143143
#DEB Astra Linix Orel
144144
sudo sh -c 'echo "deb [arch=amd64] https://repo.postgrespro.ru/pg_probackup-forks/deb/ stretch main-stretch" > /etc/apt/sources.list.d/pg_probackup.list'
@@ -148,35 +148,35 @@ sudo apt-get install pg-probackup-{std,ent}-{12,11,10}{-dbg,}
148148

149149
#RPM Centos Packages
150150
rpm -ivh https://repo.postgrespro.ru/pg_probackup-forks/keys/pg_probackup-repo-forks-centos.noarch.rpm
151-
yum install pg_probackup-{std,ent}-{13,12,11,10}
152-
yum install pg_probackup-{std,ent}-{13,12,11,10}-debuginfo
151+
yum install pg_probackup-{std,ent}-{14,13,12,11,10}
152+
yum install pg_probackup-{std,ent}-{14,13,12,11,10}-debuginfo
153153

154154
#RPM RHEL Packages
155155
rpm -ivh https://repo.postgrespro.ru/pg_probackup-forks/keys/pg_probackup-repo-forks-rhel.noarch.rpm
156-
yum install pg_probackup-{std,ent}-{13,12,11,10}
157-
yum install pg_probackup-{std,ent}-{13,12,11,10}-debuginfo
156+
yum install pg_probackup-{std,ent}-{14,13,12,11,10}
157+
yum install pg_probackup-{std,ent}-{14,13,12,11,10}-debuginfo
158158

159159
#RPM Oracle Linux Packages
160160
rpm -ivh https://repo.postgrespro.ru/pg_probackup-forks/keys/pg_probackup-repo-forks-oraclelinux.noarch.rpm
161-
yum install pg_probackup-{std,ent}-{13,12,11,10}
162-
yum install pg_probackup-{std,ent}-{13,12,11,10}-debuginfo
161+
yum install pg_probackup-{std,ent}-{14,13,12,11,10}
162+
yum install pg_probackup-{std,ent}-{14,13,12,11,10}-debuginfo
163163

164164
#RPM ALT Linux 7
165165
sudo sh -c 'echo "rpm https://repo.postgrespro.ru/pg_probackup-forks/rpm/latest/altlinux-p7 x86_64 forks" > /etc/apt/sources.list.d/pg_probackup_forks.list'
166166
sudo apt-get update
167-
sudo apt-get install pg_probackup-{std,ent}-{13,12,11,10}
168-
sudo apt-get install pg_probackup-{std,ent}-{13,12,11,10}-debuginfo
167+
sudo apt-get install pg_probackup-{std,ent}-{14,13,12,11,10}
168+
sudo apt-get install pg_probackup-{std,ent}-{14,13,12,11,10}-debuginfo
169169

170170
#RPM ALT Linux 8
171171
sudo sh -c 'echo "rpm https://repo.postgrespro.ru/pg_probackup-forks/rpm/latest/altlinux-p8 x86_64 forks" > /etc/apt/sources.list.d/pg_probackup_forks.list'
172172
sudo apt-get update
173-
sudo apt-get install pg_probackup-{std,ent}-{13,12,11,10}
174-
sudo apt-get install pg_probackup-{std,ent}-{13,12,11,10}-debuginfo
173+
sudo apt-get install pg_probackup-{std,ent}-{14,13,12,11,10}
174+
sudo apt-get install pg_probackup-{std,ent}-{14,13,12,11,10}-debuginfo
175175

176176
#RPM ALT Linux 9
177177
sudo sh -c 'echo "rpm https://repo.postgrespro.ru/pg_probackup-forks/rpm/latest/altlinux-p9 x86_64 forks" > /etc/apt/sources.list.d/pg_probackup_forks.list' && sudo apt-get update
178-
sudo apt-get install pg_probackup-{std,ent}-{13,12,11,10}
179-
sudo apt-get install pg_probackup-{std,ent}-{13,12,11,10}-debuginfo
178+
sudo apt-get install pg_probackup-{std,ent}-{14,13,12,11,10}
179+
sudo apt-get install pg_probackup-{std,ent}-{14,13,12,11,10}-debuginfo
180180
```
181181

182182
Once you have `pg_probackup` installed, complete [the setup](https://postgrespro.github.io/pg_probackup/#pbk-install-and-setup).

doc/pgprobackup.xml

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,7 @@ GRANT EXECUTE ON FUNCTION pg_catalog.pg_control_checkpoint() TO backup;
618618
COMMIT;
619619
</programlisting>
620620
<para>
621-
For <productname>PostgreSQL</productname> 10 or higher:
621+
For <productname>PostgreSQL</productname> 10:
622622
</para>
623623
<programlisting>
624624
BEGIN;
@@ -637,6 +637,27 @@ GRANT EXECUTE ON FUNCTION pg_catalog.txid_current_snapshot() TO backup;
637637
GRANT EXECUTE ON FUNCTION pg_catalog.txid_snapshot_xmax(txid_snapshot) TO backup;
638638
GRANT EXECUTE ON FUNCTION pg_catalog.pg_control_checkpoint() TO backup;
639639
COMMIT;
640+
</programlisting>
641+
<para>
642+
For <productname>PostgreSQL</productname> 15 or higher:
643+
</para>
644+
<programlisting>
645+
BEGIN;
646+
CREATE ROLE backup WITH LOGIN;
647+
GRANT USAGE ON SCHEMA pg_catalog TO backup;
648+
GRANT EXECUTE ON FUNCTION pg_catalog.current_setting(text) TO backup;
649+
GRANT EXECUTE ON FUNCTION pg_catalog.set_config(text, text, boolean) TO backup;
650+
GRANT EXECUTE ON FUNCTION pg_catalog.pg_is_in_recovery() TO backup;
651+
GRANT EXECUTE ON FUNCTION pg_catalog.pg_backup_start(text, boolean) TO backup;
652+
GRANT EXECUTE ON FUNCTION pg_catalog.pg_backup_stop(boolean) TO backup;
653+
GRANT EXECUTE ON FUNCTION pg_catalog.pg_create_restore_point(text) TO backup;
654+
GRANT EXECUTE ON FUNCTION pg_catalog.pg_switch_wal() TO backup;
655+
GRANT EXECUTE ON FUNCTION pg_catalog.pg_last_wal_replay_lsn() TO backup;
656+
GRANT EXECUTE ON FUNCTION pg_catalog.txid_current() TO backup;
657+
GRANT EXECUTE ON FUNCTION pg_catalog.txid_current_snapshot() TO backup;
658+
GRANT EXECUTE ON FUNCTION pg_catalog.txid_snapshot_xmax(txid_snapshot) TO backup;
659+
GRANT EXECUTE ON FUNCTION pg_catalog.pg_control_checkpoint() TO backup;
660+
COMMIT;
640661
</programlisting>
641662
<para>
642663
In the

packaging/Makefile.test

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,10 @@ build/test_suse: build/test_suse_15.1 build/test_suse_15.2
130130
@echo Suse: done
131131

132132
build/test_suse_15.1: build/test_suse_15.1_9.6 build/test_suse_15.1_10 build/test_suse_15.1_11 build/test_suse_15.1_12 build/test_suse_15.1_13
133-
@echo Rhel 15.1: done
133+
@echo Suse 15.1: done
134134

135135
build/test_suse_15.2: build/test_suse_15.2_9.6 build/test_suse_15.2_10 build/test_suse_15.2_11 build/test_suse_15.2_12 build/test_suse_15.2_13 build/test_suse_15.2_14
136-
@echo Rhel 15.1: done
136+
@echo Suse 15.2: done
137137

138138
define test_suse
139139
docker rm -f $1_$2_probackup_$(PKG_NAME_SUFFIX)$(PBK_VERSION) >> /dev/null 2>&1 ; \

packaging/test/scripts/rpm.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,12 @@ if [ ${DISTRIB} == 'centos' ] && [ ${DISTRIB_VERSION} == '8' ]; then
7777
dnf -qy module disable postgresql
7878
fi
7979

80+
# PGDG doesn't support install of PG-9.6 from repo package anymore
81+
if [ ${PG_VERSION} == '9.6' ] && [ ${DISTRIB_VERSION} == '7' ]; then
82+
# ugly hack: use repo settings from PG10
83+
sed -i 's/10/9.6/' /etc/yum.repos.d/pgdg-redhat-all.repo
84+
fi
85+
8086
yum install -y postgresql${PG_TOG}-server.x86_64
8187
export PGDATA=/var/lib/pgsql/${PG_VERSION}/data
8288

src/backup.c

Lines changed: 63 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -923,10 +923,21 @@ check_server_version(PGconn *conn, PGNodeInfo *nodeInfo)
923923
*/
924924
#ifdef PGPRO_VERSION
925925
if (!res)
926+
{
926927
/* It seems we connected to PostgreSQL (not Postgres Pro) */
927-
elog(ERROR, "%s was built with Postgres Pro %s %s, "
928-
"but connection is made with PostgreSQL %s",
929-
PROGRAM_NAME, PG_MAJORVERSION, PGPRO_EDITION, nodeInfo->server_version_str);
928+
if(strcmp(PGPRO_EDITION, "1C") != 0)
929+
{
930+
elog(ERROR, "%s was built with Postgres Pro %s %s, "
931+
"but connection is made with PostgreSQL %s",
932+
PROGRAM_NAME, PG_MAJORVERSION, PGPRO_EDITION, nodeInfo->server_version_str);
933+
}
934+
/* We have PostgresPro for 1C and connect to PostgreSQL or PostgresPro for 1C
935+
* Check the major version
936+
*/
937+
if (strcmp(nodeInfo->server_version_str, PG_MAJORVERSION) != 0)
938+
elog(ERROR, "%s was built with PostgrePro %s %s, but connection is made with %s",
939+
PROGRAM_NAME, PG_MAJORVERSION, PGPRO_EDITION, nodeInfo->server_version_str);
940+
}
930941
else
931942
{
932943
if (strcmp(nodeInfo->server_version_str, PG_MAJORVERSION) != 0 &&
@@ -1030,12 +1041,20 @@ pg_start_backup(const char *label, bool smooth, pgBackup *backup,
10301041
uint32 lsn_lo;
10311042
params[0] = label;
10321043

1044+
#if PG_VERSION_NUM >= 150000
1045+
elog(INFO, "wait for pg_backup_start()");
1046+
#else
10331047
elog(INFO, "wait for pg_start_backup()");
1048+
#endif
10341049

10351050
/* 2nd argument is 'fast'*/
10361051
params[1] = smooth ? "false" : "true";
10371052
res = pgut_execute(conn,
1053+
#if PG_VERSION_NUM >= 150000
1054+
"SELECT pg_catalog.pg_backup_start($1, $2)",
1055+
#else
10381056
"SELECT pg_catalog.pg_start_backup($1, $2, false)",
1057+
#endif
10391058
2,
10401059
params);
10411060

@@ -1575,6 +1594,14 @@ pg_stop_backup_send(PGconn *conn, int server_version, bool is_started_on_replica
15751594
" labelfile,"
15761595
" spcmapfile"
15771596
" FROM pg_catalog.pg_stop_backup(false, false)",
1597+
stop_backup_on_master_after15_query[] =
1598+
"SELECT"
1599+
" pg_catalog.txid_snapshot_xmax(pg_catalog.txid_current_snapshot()),"
1600+
" current_timestamp(0)::timestamptz,"
1601+
" lsn,"
1602+
" labelfile,"
1603+
" spcmapfile"
1604+
" FROM pg_catalog.pg_backup_stop(false)",
15781605
/*
15791606
* In case of backup from replica we do not trust minRecPoint
15801607
* and stop_backup LSN, so we use latest replayed LSN as STOP LSN.
@@ -1586,12 +1613,26 @@ pg_stop_backup_send(PGconn *conn, int server_version, bool is_started_on_replica
15861613
" pg_catalog.pg_last_wal_replay_lsn(),"
15871614
" labelfile,"
15881615
" spcmapfile"
1589-
" FROM pg_catalog.pg_stop_backup(false, false)";
1616+
" FROM pg_catalog.pg_stop_backup(false, false)",
1617+
stop_backup_on_replica_after15_query[] =
1618+
"SELECT"
1619+
" pg_catalog.txid_snapshot_xmax(pg_catalog.txid_current_snapshot()),"
1620+
" current_timestamp(0)::timestamptz,"
1621+
" pg_catalog.pg_last_wal_replay_lsn(),"
1622+
" labelfile,"
1623+
" spcmapfile"
1624+
" FROM pg_catalog.pg_backup_stop(false)";
15901625

15911626
const char * const stop_backup_query =
1592-
is_started_on_replica ?
1627+
server_version >= 150000 ?
1628+
(is_started_on_replica ?
1629+
stop_backup_on_replica_after15_query :
1630+
stop_backup_on_master_after15_query
1631+
) :
1632+
(is_started_on_replica ?
15931633
stop_backup_on_replica_query :
1594-
stop_backup_on_master_query;
1634+
stop_backup_on_master_query
1635+
);
15951636
bool sent = false;
15961637

15971638
/* Make proper timestamp format for parse_time(recovery_time) */
@@ -1606,7 +1647,11 @@ pg_stop_backup_send(PGconn *conn, int server_version, bool is_started_on_replica
16061647
*/
16071648
sent = pgut_send(conn, stop_backup_query, 0, NULL, WARNING);
16081649
if (!sent)
1650+
#if PG_VERSION_NUM >= 150000
1651+
elog(ERROR, "Failed to send pg_backup_stop query");
1652+
#else
16091653
elog(ERROR, "Failed to send pg_stop_backup query");
1654+
#endif
16101655

16111656
/* After we have sent pg_stop_backup, we don't need this callback anymore */
16121657
pgut_atexit_pop(backup_stopbackup_callback, &stop_callback_params);
@@ -1652,7 +1697,11 @@ pg_stop_backup_consume(PGconn *conn, int server_version,
16521697
if (interrupted)
16531698
{
16541699
pgut_cancel(conn);
1700+
#if PG_VERSION_NUM >= 150000
1701+
elog(ERROR, "interrupted during waiting for pg_backup_stop");
1702+
#else
16551703
elog(ERROR, "interrupted during waiting for pg_stop_backup");
1704+
#endif
16561705
}
16571706

16581707
if (pg_stop_backup_timeout == 1)
@@ -1665,7 +1714,11 @@ pg_stop_backup_consume(PGconn *conn, int server_version,
16651714
if (pg_stop_backup_timeout > timeout)
16661715
{
16671716
pgut_cancel(conn);
1717+
#if PG_VERSION_NUM >= 150000
1718+
elog(ERROR, "pg_backup_stop doesn't answer in %d seconds, cancel it", timeout);
1719+
#else
16681720
elog(ERROR, "pg_stop_backup doesn't answer in %d seconds, cancel it", timeout);
1721+
#endif
16691722
}
16701723
}
16711724
else
@@ -1677,7 +1730,11 @@ pg_stop_backup_consume(PGconn *conn, int server_version,
16771730

16781731
/* Check successfull execution of pg_stop_backup() */
16791732
if (!query_result)
1733+
#if PG_VERSION_NUM >= 150000
1734+
elog(ERROR, "pg_backup_stop() failed");
1735+
#else
16801736
elog(ERROR, "pg_stop_backup() failed");
1737+
#endif
16811738
else
16821739
{
16831740
switch (PQresultStatus(query_result))

src/checkdb.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,9 @@ get_index_list(const char *dbname, bool first_db_with_amcheck,
461461
"LEFT JOIN pg_catalog.pg_class cls ON idx.indexrelid=cls.oid "
462462
"LEFT JOIN pg_catalog.pg_namespace nmspc ON cls.relnamespace=nmspc.oid "
463463
"LEFT JOIN pg_catalog.pg_am am ON cls.relam=am.oid "
464-
"WHERE am.amname='btree' AND cls.relpersistence != 't' "
464+
"WHERE am.amname='btree' "
465+
"AND cls.relpersistence != 't' "
466+
"AND cls.relkind != 'I' "
465467
"ORDER BY nmspc.nspname DESC",
466468
0, NULL);
467469
}
@@ -473,8 +475,10 @@ get_index_list(const char *dbname, bool first_db_with_amcheck,
473475
"LEFT JOIN pg_catalog.pg_class cls ON idx.indexrelid=cls.oid "
474476
"LEFT JOIN pg_catalog.pg_namespace nmspc ON cls.relnamespace=nmspc.oid "
475477
"LEFT JOIN pg_catalog.pg_am am ON cls.relam=am.oid "
476-
"WHERE am.amname='btree' AND cls.relpersistence != 't' AND "
477-
"(cls.reltablespace IN "
478+
"WHERE am.amname='btree' "
479+
"AND cls.relpersistence != 't' "
480+
"AND cls.relkind != 'I' "
481+
"AND (cls.reltablespace IN "
478482
"(SELECT oid from pg_catalog.pg_tablespace where spcname <> 'pg_global') "
479483
"OR cls.reltablespace = 0) "
480484
"ORDER BY nmspc.nspname DESC",

0 commit comments

Comments
 (0)