Skip to content

Commit ef44a8f

Browse files
author
Sergey Fukanchik
committed
Resolved merge conflict
2 parents d93646b + cd388dc commit ef44a8f

36 files changed

+1661
-652
lines changed

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ env:
3636
# - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=OFF MODE=archive
3737
# - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=REL_13_STABLE MODE=backup
3838
# - 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
3940
# - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=OFF MODE=compression
4041
# - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=OFF MODE=delta
4142
# - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=OFF MODE=locking
@@ -51,7 +52,7 @@ env:
5152
jobs:
5253
allow_failures:
5354
- if: env(PG_BRANCH) = master
54-
# - 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)
5556

5657
# Only run CI for master branch commits to limit our travis usage
5758
#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: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -918,10 +918,21 @@ check_server_version(PGconn *conn, PGNodeInfo *nodeInfo)
918918
*/
919919
#ifdef PGPRO_VERSION
920920
if (!res)
921+
{
921922
/* It seems we connected to PostgreSQL (not Postgres Pro) */
922-
elog(ERROR, "%s was built with Postgres Pro %s %s, "
923-
"but connection is made with PostgreSQL %s",
924-
PROGRAM_NAME, PG_MAJORVERSION, PGPRO_EDITION, nodeInfo->server_version_str);
923+
if(strcmp(PGPRO_EDITION, "1C") != 0)
924+
{
925+
elog(ERROR, "%s was built with Postgres Pro %s %s, "
926+
"but connection is made with PostgreSQL %s",
927+
PROGRAM_NAME, PG_MAJORVERSION, PGPRO_EDITION, nodeInfo->server_version_str);
928+
}
929+
/* We have PostgresPro for 1C and connect to PostgreSQL or PostgresPro for 1C
930+
* Check the major version
931+
*/
932+
if (strcmp(nodeInfo->server_version_str, PG_MAJORVERSION) != 0)
933+
elog(ERROR, "%s was built with PostgrePro %s %s, but connection is made with %s",
934+
PROGRAM_NAME, PG_MAJORVERSION, PGPRO_EDITION, nodeInfo->server_version_str);
935+
}
925936
else
926937
{
927938
if (strcmp(nodeInfo->server_version_str, PG_MAJORVERSION) != 0 &&

src/catalog.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1075,6 +1075,7 @@ get_backup_filelist(pgBackup *backup, bool strict)
10751075
char linked[MAXPGPATH];
10761076
char compress_alg_string[MAXPGPATH];
10771077
int64 write_size,
1078+
uncompressed_size,
10781079
mode, /* bit length of mode_t depends on platforms */
10791080
is_datafile,
10801081
is_cfs,
@@ -1138,6 +1139,13 @@ get_backup_filelist(pgBackup *backup, bool strict)
11381139
if (get_control_value_int64(buf, "hdr_size", &hdr_size, false))
11391140
file->hdr_size = (int) hdr_size;
11401141

1142+
if (get_control_value_int64(buf, "full_size", &uncompressed_size, false))
1143+
file->uncompressed_size = uncompressed_size;
1144+
else
1145+
file->uncompressed_size = write_size;
1146+
if (!file->is_datafile || file->is_cfs)
1147+
file->size = file->uncompressed_size;
1148+
11411149
if (file->external_dir_num == 0 && S_ISREG(file->mode))
11421150
{
11431151
bool is_datafile = file->is_datafile;
@@ -2581,6 +2589,11 @@ write_backup_filelist(pgBackup *backup, parray *files, const char *root,
25812589
file->external_dir_num,
25822590
file->dbOid);
25832591

2592+
if (file->uncompressed_size != 0 &&
2593+
file->uncompressed_size != file->write_size)
2594+
len += sprintf(line+len, ",\"full_size\":\"" INT64_FORMAT "\"",
2595+
file->uncompressed_size);
2596+
25842597
if (file->is_datafile)
25852598
len += sprintf(line+len, ",\"segno\":\"%d\"", file->segno);
25862599

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)