Skip to content

Commit 43a92b7

Browse files
committed
Merge branch 'master' into release_2_6
2 parents dea9368 + 8bb0a61 commit 43a92b7

34 files changed

+2978
-207
lines changed

.github/workflows/build.yml

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
name: Build Probackup
2+
3+
on:
4+
push:
5+
branches:
6+
- "**"
7+
# Runs triggered by pull requests are disabled to prevent executing potentially unsafe code from public pull requests
8+
# pull_request:
9+
# branches:
10+
# - main
11+
12+
# Allows you to run this workflow manually from the Actions tab
13+
workflow_dispatch:
14+
15+
jobs:
16+
17+
build-win2019:
18+
19+
runs-on:
20+
- windows-2019
21+
22+
env:
23+
zlib_dir: C:\dep\zlib
24+
25+
steps:
26+
27+
- uses: actions/checkout@v2
28+
29+
- name: Install pacman packages
30+
run: |
31+
$env:PATH += ";C:\msys64\usr\bin"
32+
pacman -S --noconfirm --needed bison flex
33+
34+
- name: Make zlib
35+
run: |
36+
git clone -b v1.2.11 --depth 1 https://github.com/madler/zlib.git
37+
cd zlib
38+
cmake -DCMAKE_INSTALL_PREFIX:PATH=C:\dep\zlib -G "Visual Studio 16 2019" .
39+
cmake --build . --config Release --target ALL_BUILD
40+
cmake --build . --config Release --target INSTALL
41+
copy C:\dep\zlib\lib\zlibstatic.lib C:\dep\zlib\lib\zdll.lib
42+
copy C:\dep\zlib\bin\zlib.dll C:\dep\zlib\lib
43+
44+
- name: Get Postgres sources
45+
run: git clone -b REL_14_STABLE https://github.com/postgres/postgres.git
46+
47+
# Copy ptrack to contrib to build the ptrack extension
48+
# Convert line breaks in the patch file to LF otherwise the patch doesn't apply
49+
- name: Get Ptrack sources
50+
run: |
51+
git clone -b master --depth 1 https://github.com/postgrespro/ptrack.git
52+
Copy-Item -Path ptrack -Destination postgres\contrib -Recurse
53+
(Get-Content ptrack\patches\REL_14_STABLE-ptrack-core.diff -Raw).Replace("`r`n","`n") | Set-Content ptrack\patches\REL_14_STABLE-ptrack-core.diff -Force -NoNewline
54+
cd postgres
55+
git apply -3 ../ptrack/patches/REL_14_STABLE-ptrack-core.diff
56+
57+
- name: Build Postgres
58+
run: |
59+
$env:PATH += ";C:\msys64\usr\bin"
60+
cd postgres\src\tools\msvc
61+
(Get-Content config_default.pl) -Replace "zlib *=>(.*?)(?=,? *#)", "zlib => '${{ env.zlib_dir }}'" | Set-Content config.pl
62+
cmd.exe /s /c "`"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat`" amd64 && .\build.bat"
63+
64+
- name: Build Probackup
65+
run: cmd.exe /s /c "`"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat`" amd64 && perl .\gen_probackup_project.pl `"${{ github.workspace }}`"\postgres"
66+
67+
- name: Install Postgres
68+
run: |
69+
cd postgres
70+
src\tools\msvc\install.bat postgres_install
71+
72+
- name: Install Testgres
73+
run: |
74+
git clone -b no-port-for --single-branch --depth 1 https://github.com/postgrespro/testgres.git
75+
cd testgres
76+
python setup.py install
77+
78+
# Grant the Github runner user full control of the workspace for initdb to successfully process the data folder
79+
- name: Test Probackup
80+
run: |
81+
icacls.exe "${{ github.workspace }}" /grant "${env:USERNAME}:(OI)(CI)F"
82+
$env:PATH += ";${{ github.workspace }}\postgres\postgres_install\lib;${{ env.zlib_dir }}\lib"
83+
$Env:LC_MESSAGES = "English"
84+
$Env:PG_CONFIG = "${{ github.workspace }}\postgres\postgres_install\bin\pg_config.exe"
85+
$Env:PGPROBACKUPBIN = "${{ github.workspace }}\postgres\Release\pg_probackup\pg_probackup.exe"
86+
$Env:PG_PROBACKUP_PTRACK = "ON"
87+
If (!$Env:MODE -Or $Env:MODE -Eq "basic") {
88+
$Env:PG_PROBACKUP_TEST_BASIC = "ON"
89+
python -m unittest -v tests
90+
python -m unittest -v tests.init
91+
} else {
92+
python -m unittest -v tests.$Env:MODE
93+
}
94+

.travis.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,20 @@ env:
3434
- PG_VERSION=10 PG_BRANCH=REL_10_STABLE
3535
- PG_VERSION=9.6 PG_BRANCH=REL9_6_STABLE
3636
- PG_VERSION=9.5 PG_BRANCH=REL9_5_STABLE
37-
# - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=off MODE=archive
37+
# - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=OFF MODE=archive
3838
# - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=REL_13_STABLE MODE=backup
3939
# - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=REL_13_STABLE MODE=catchup
40-
# - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=off MODE=compression
41-
# - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=off MODE=delta
42-
# - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=off MODE=locking
40+
# - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=OFF MODE=compression
41+
# - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=OFF MODE=delta
42+
# - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=OFF MODE=locking
4343
# - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=REL_13_STABLE MODE=merge
44-
# - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=off MODE=page
44+
# - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=OFF MODE=option
45+
# - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=OFF MODE=page
4546
# - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=REL_13_STABLE MODE=ptrack
4647
# - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=REL_13_STABLE MODE=replica
47-
# - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=off MODE=retention
48+
# - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=OFF MODE=retention
4849
# - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=REL_13_STABLE MODE=restore
50+
# - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=REL_13_STABLE MODE=time_consuming
4951

5052
jobs:
5153
allow_failures:

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,3 +224,17 @@ Postgres Professional, Moscow, Russia.
224224
## Credits
225225

226226
`pg_probackup` utility is based on `pg_arman`, that was originally written by NTT and then developed and maintained by Michael Paquier.
227+
228+
229+
### Localization files (*.po)
230+
231+
Description of how to add new translation languages.
232+
1. Add a flag --enable-nls in configure.
233+
2. Build postgres.
234+
3. Adding to nls.mk in folder pg_probackup required files in GETTEXT_FILES.
235+
4. In folder pg_probackup do 'make update-po'.
236+
5. As a result, the progname.pot file will be created. Copy the content and add it to the file with the desired language.
237+
6. Adding to nls.mk in folder pg_probackup required language in AVAIL_LANGUAGES.
238+
239+
For more information, follow the link below:
240+
https://postgrespro.ru/docs/postgresql/12/nls-translator

doc/pgprobackup.xml

Lines changed: 55 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -942,6 +942,7 @@ GRANT SELECT ON TABLE pg_catalog.pg_namespace TO backup;
942942
GRANT SELECT ON TABLE pg_catalog.pg_extension TO backup;
943943
GRANT EXECUTE ON FUNCTION bt_index_check(regclass) TO backup;
944944
GRANT EXECUTE ON FUNCTION bt_index_check(regclass, bool) TO backup;
945+
GRANT EXECUTE ON FUNCTION bt_index_check(regclass, bool, bool) TO backup;
945946
</programlisting>
946947
</refsect2>
947948
<refsect2 id="pbk-setting-up-partial-restore">
@@ -3527,6 +3528,14 @@ pg_probackup catchup -b <replaceable>catchup_mode</replaceable> --source-pgdata=
35273528
of threads with the <option>--threads</option> option:
35283529
<programlisting>
35293530
pg_probackup catchup -b <replaceable>catchup_mode</replaceable> --source-pgdata=<replaceable>path_to_pgdata_on_remote_server</replaceable> --destination-pgdata=<replaceable>path_to_local_dir</replaceable> --stream --threads=<replaceable>num_threads</replaceable>
3531+
</programlisting>
3532+
</para>
3533+
<para>
3534+
Before cloning/synchronising a <productname>PostgreSQL</productname> instance, you can run the
3535+
<command>catchup</command> command with the <option>--dry-run</option> flag
3536+
to estimate the size of data files to be transferred, but make no changes on disk:
3537+
<programlisting>
3538+
pg_probackup catchup -b <replaceable>catchup_mode</replaceable> --source-pgdata=<replaceable>path_to_pgdata_on_remote_server</replaceable> --destination-pgdata=<replaceable>path_to_local_dir</replaceable> --stream --dry-run
35303539
</programlisting>
35313540
</para>
35323541
<para>
@@ -3540,7 +3549,7 @@ pg_probackup catchup --source-pgdata=/master-pgdata --destination-pgdata=/replic
35403549
<para>
35413550
Another example shows how you can add a new remote standby server with the <productname>PostgreSQL</productname> data directory <filename>/replica-pgdata</filename> by running the <command>catchup</command> command in the <literal>FULL</literal> mode
35423551
on four parallel threads:
3543-
<programlisting>
3552+
<programlisting>
35443553
pg_probackup catchup --source-pgdata=/master-pgdata --destination-pgdata=/replica-pgdata -p 5432 -d postgres -U remote-postgres-user --stream --backup-mode=FULL --remote-host=remote-hostname --remote-user=remote-unix-username -j 4
35453554
</programlisting>
35463555
</para>
@@ -4141,7 +4150,7 @@ pg_probackup restore -B <replaceable>backup_dir</replaceable> --instance <replac
41414150
pg_probackup checkdb
41424151
[-B <replaceable>backup_dir</replaceable>] [--instance <replaceable>instance_name</replaceable>] [-D <replaceable>data_dir</replaceable>]
41434152
[--help] [-j <replaceable>num_threads</replaceable>] [--progress]
4144-
[--skip-block-validation] [--amcheck] [--heapallindexed]
4153+
[--amcheck [--skip-block-validation] [--checkunique] [--heapallindexed]]
41454154
[<replaceable>connection_options</replaceable>] [<replaceable>logging_options</replaceable>]
41464155
</programlisting>
41474156
<para>
@@ -4156,21 +4165,30 @@ pg_probackup checkdb
41564165
<para>
41574166
Performs logical verification of indexes for the specified
41584167
<productname>PostgreSQL</productname> instance if no corruption was found while checking
4159-
data files. You must have the <application>amcheck</application>
4168+
data files. You must have the <ulink url="https://postgrespro.com/docs/enterprise/current/amcheck.html"><application>amcheck</application></ulink>
41604169
extension or the <application>amcheck_next</application> extension
41614170
installed in the database to check its indexes. For databases
41624171
without <application>amcheck</application>, index verification will be skipped.
4172+
Additional options <option>--checkunique</option> and <option>--heapallindexed</option>
4173+
are effective depending on the version of <application>amcheck</application> installed.
41634174
</para>
41644175
</listitem>
41654176
</varlistentry>
41664177

41674178
<varlistentry>
4168-
<term><option>--skip-block-validation</option></term>
4179+
<term><option>--checkunique</option></term>
41694180
<listitem>
41704181
<para>
4171-
Skip validation of data files. You can use this flag only
4172-
together with the <option>--amcheck</option> flag, so that only logical
4173-
verification of indexes is performed.
4182+
Verifies unique constraints during logical verification of indexes.
4183+
You can use this flag only together with the <option>--amcheck</option> flag when
4184+
the <application>amcheck</application> extension is
4185+
installed in the database.
4186+
</para>
4187+
<para>
4188+
The verification of unique constraints is only possible if in the version of the
4189+
<application>amcheck</application> extension you are using, the
4190+
<function>bt_index_check</function> function takes the
4191+
<parameter>checkunique</parameter> parameter.
41744192
</para>
41754193
</listitem>
41764194
</varlistentry>
@@ -4184,12 +4202,25 @@ pg_probackup checkdb
41844202
<option>--amcheck</option> flag.
41854203
</para>
41864204
<para>
4187-
This check is only possible if you are using the
4188-
<application>amcheck</application> extension of version 2.0 or higher, or
4189-
the <application>amcheck_next</application> extension of any version.
4205+
This check is only possible if in the version of the
4206+
<application>amcheck</application>/<application>amcheck_next</application> extension
4207+
you are using, the <function>bt_index_check</function>
4208+
function takes the <parameter>heapallindexed</parameter> parameter.
4209+
</para>
4210+
</listitem>
4211+
</varlistentry>
4212+
<varlistentry>
4213+
4214+
<term><option>--skip-block-validation</option></term>
4215+
<listitem>
4216+
<para>
4217+
Skip validation of data files. You can use this flag only
4218+
together with the <option>--amcheck</option> flag, so that only logical
4219+
verification of indexes is performed.
41904220
</para>
41914221
</listitem>
41924222
</varlistentry>
4223+
41934224
</variablelist>
41944225
</para>
41954226
<para>
@@ -4424,7 +4455,7 @@ pg_probackup archive-get -B <replaceable>backup_dir</replaceable> --instance <re
44244455
pg_probackup catchup -b <replaceable>catchup_mode</replaceable>
44254456
--source-pgdata=<replaceable>path_to_pgdata_on_remote_server</replaceable>
44264457
--destination-pgdata=<replaceable>path_to_local_dir</replaceable>
4427-
[--help] [-j | --threads=<replaceable>num_threads</replaceable>] [--stream]
4458+
[--help] [-j | --threads=<replaceable>num_threads</replaceable>] [--stream] [--dry-run]
44284459
[--temp-slot] [-P | --perm-slot] [-S | --slot=<replaceable>slot_name</replaceable>]
44294460
[--exclude-path=<replaceable>PATHNAME</replaceable>]
44304461
[-T <replaceable>OLDDIR</replaceable>=<replaceable>NEWDIR</replaceable>]
@@ -4513,6 +4544,19 @@ pg_probackup catchup -b <replaceable>catchup_mode</replaceable>
45134544
</listitem>
45144545
</varlistentry>
45154546

4547+
<varlistentry>
4548+
<term><option>--dry-run</option></term>
4549+
<listitem>
4550+
<para>
4551+
Displays the total size of the files to be transferred by <command>catchup</command>.
4552+
This flag initiates a trial run of <command>catchup</command>, which does
4553+
not actually create, delete or move files on disk. WAL streaming is skipped with <option>--dry-run</option>.
4554+
This flag also allows you to check that
4555+
all the options are correct and cloning/synchronising is ready to run.
4556+
</para>
4557+
</listitem>
4558+
</varlistentry>
4559+
45164560
<varlistentry>
45174561
<term><option>-x</option>=<replaceable>path_prefix</replaceable></term>
45184562
<term><option>--exclude-path</option>=<replaceable>path_prefix</replaceable></term>
@@ -4533,17 +4577,6 @@ pg_probackup catchup -b <replaceable>catchup_mode</replaceable>
45334577
</listitem>
45344578
</varlistentry>
45354579

4536-
<varlistentry>
4537-
<term><option>--stream</option></term>
4538-
<listitem>
4539-
<para>
4540-
Copies the instance in <link linkend="pbk-stream-mode">STREAM</link> WAL delivery mode,
4541-
including all the necessary WAL files by streaming them from
4542-
the instance server via replication protocol.
4543-
</para>
4544-
</listitem>
4545-
</varlistentry>
4546-
45474580
<varlistentry>
45484581
<term><option>--temp-slot</option></term>
45494582
<listitem>

gen_probackup_project.pl

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ BEGIN
1313
{
1414
$pgsrc = shift @ARGV;
1515
if($pgsrc eq "--help"){
16-
print STDERR "Usage $0 pg-source-dir \n";
17-
print STDERR "Like this: \n";
18-
print STDERR "$0 C:/PgProject/postgresql.10dev/postgrespro \n";
19-
print STDERR "May be need input this before: \n";
20-
print STDERR "CALL \"C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\VC\\vcvarsall\" amd64\n";
16+
print STDERR "Usage $0 pg-source-dir\n";
17+
print STDERR "Like this:\n";
18+
print STDERR "$0 C:/PgProject/postgresql.10dev/postgrespro\n";
19+
print STDERR "May need to run this first:\n";
20+
print STDERR "CALL \"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Auxiliary\\Build\\vcvarsall.bat\" amd64\n";
2121
exit 1;
2222
}
2323
}
@@ -133,7 +133,7 @@ sub build_pgprobackup
133133
unless (-d 'src/tools/msvc' && -d 'src');
134134

135135
# my $vsVersion = DetermineVisualStudioVersion();
136-
my $vsVersion = '12.00';
136+
my $vsVersion = '16.00';
137137

138138
$solution = CreateSolution($vsVersion, $config);
139139

@@ -155,6 +155,7 @@ sub build_pgprobackup
155155
'archive.c',
156156
'backup.c',
157157
'catalog.c',
158+
'catchup.c',
158159
'configure.c',
159160
'data.c',
160161
'delete.c',

nls.mk

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# contrib/pg_probackup/nls.mk
2+
CATALOG_NAME = pg_probackup
3+
AVAIL_LANGUAGES = ru
4+
GETTEXT_FILES = src/help.c
5+
GETTEXT_TRIGGERS = $(FRONTEND_COMMON_GETTEXT_TRIGGERS)
6+
GETTEXT_FLAGS = $(FRONTEND_COMMON_GETTEXT_FLAGS)

packaging/pkg/scripts/rpm.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,15 @@ ulimit -n 1024
2020

2121
if [ ${DISTRIB} = 'centos' ] ; then
2222
sed -i 's|^baseurl=http://|baseurl=https://|g' /etc/yum.repos.d/*.repo
23+
if [ ${DISTRIB_VERSION} = '8' ]; then
24+
sed -i 's|mirrorlist|#mirrorlist|g' /etc/yum.repos.d/CentOS-*.repo
25+
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*.repo
26+
fi
2327
yum update -y
28+
if [ ${DISTRIB_VERSION} = '8' ]; then
29+
sed -i 's|mirrorlist|#mirrorlist|g' /etc/yum.repos.d/CentOS-*.repo
30+
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*.repo
31+
fi
2432
fi
2533

2634
# PACKAGES NEEDED

packaging/test/scripts/rpm.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,16 @@ PG_TOG=$(echo $PG_VERSION | sed 's|\.||g')
1515

1616
if [ ${DISTRIB} != 'rhel' -o ${DISTRIB_VERSION} != '7' ]; then
1717
# update of rpm package is broken in rhel-7 (26/12/2022)
18-
yum update -y
18+
#yum update -y
19+
if [ ${DISTRIB} = 'centos' -a ${DISTRIB_VERSION} = '8' ]; then
20+
sed -i 's|mirrorlist|#mirrorlist|g' /etc/yum.repos.d/CentOS-*.repo
21+
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*.repo
22+
fi
23+
yum update -y
24+
if [ ${DISTRIB} = 'centos' -a ${DISTRIB_VERSION} = '8' ]; then
25+
sed -i 's|mirrorlist|#mirrorlist|g' /etc/yum.repos.d/CentOS-*.repo
26+
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*.repo
27+
fi
1928
fi
2029
# yum upgrade -y || echo 'some packages in docker failed to upgrade'
2130
# yum install -y sudo

0 commit comments

Comments
 (0)