Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a0484a2

Browse files
authored
Merge branch 'REL_2_5' into PBCKP-155
2 parents 94caeb1 + 786ccf0 commit a0484a2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+2994
-223
lines changed

.github/workflows/build.yml

+94
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+

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@
5050
/docker-compose.yml
5151
/Dockerfile
5252
/Dockerfile.in
53-
/run_tests.sh
5453
/make_dockerfile.sh
5554
/backup_restore.sh
5655

.travis.yml

+2
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,13 @@ env:
4141
# - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=OFF MODE=delta
4242
# - 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=option
4445
# - 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
4748
# - 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

+14
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

+23-13
Original file line numberDiff line numberDiff line change
@@ -3563,6 +3563,14 @@ pg_probackup catchup -b <replaceable>catchup_mode</replaceable> --source-pgdata=
35633563
of threads with the <option>--threads</option> option:
35643564
<programlisting>
35653565
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>
3566+
</programlisting>
3567+
</para>
3568+
<para>
3569+
Before cloning/synchronising a <productname>PostgreSQL</productname> instance, you can run the
3570+
<command>catchup</command> command with the <option>--dry-run</option> flag
3571+
to estimate the size of data files to be transferred, but make no changes on disk:
3572+
<programlisting>
3573+
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
35663574
</programlisting>
35673575
</para>
35683576
<para>
@@ -3576,7 +3584,7 @@ pg_probackup catchup --source-pgdata=/master-pgdata --destination-pgdata=/replic
35763584
<para>
35773585
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
35783586
on four parallel threads:
3579-
<programlisting>
3587+
<programlisting>
35803588
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
35813589
</programlisting>
35823590
</para>
@@ -4482,7 +4490,7 @@ pg_probackup archive-get -B <replaceable>backup_dir</replaceable> --instance <re
44824490
pg_probackup catchup -b <replaceable>catchup_mode</replaceable>
44834491
--source-pgdata=<replaceable>path_to_pgdata_on_remote_server</replaceable>
44844492
--destination-pgdata=<replaceable>path_to_local_dir</replaceable>
4485-
[--help] [-j | --threads=<replaceable>num_threads</replaceable>] [--stream]
4493+
[--help] [-j | --threads=<replaceable>num_threads</replaceable>] [--stream] [--dry-run]
44864494
[--temp-slot] [-P | --perm-slot] [-S | --slot=<replaceable>slot_name</replaceable>]
44874495
[--exclude-path=<replaceable>PATHNAME</replaceable>]
44884496
[-T <replaceable>OLDDIR</replaceable>=<replaceable>NEWDIR</replaceable>]
@@ -4571,6 +4579,19 @@ pg_probackup catchup -b <replaceable>catchup_mode</replaceable>
45714579
</listitem>
45724580
</varlistentry>
45734581

4582+
<varlistentry>
4583+
<term><option>--dry-run</option></term>
4584+
<listitem>
4585+
<para>
4586+
Displays the total size of the files to be transferred by <command>catchup</command>.
4587+
This flag initiates a trial run of <command>catchup</command>, which does
4588+
not actually create, delete or move files on disk. WAL streaming is skipped with <option>--dry-run</option>.
4589+
This flag also allows you to check that
4590+
all the options are correct and cloning/synchronising is ready to run.
4591+
</para>
4592+
</listitem>
4593+
</varlistentry>
4594+
45744595
<varlistentry>
45754596
<term><option>-x</option>=<replaceable>path_prefix</replaceable></term>
45764597
<term><option>--exclude-path</option>=<replaceable>path_prefix</replaceable></term>
@@ -4591,17 +4612,6 @@ pg_probackup catchup -b <replaceable>catchup_mode</replaceable>
45914612
</listitem>
45924613
</varlistentry>
45934614

4594-
<varlistentry>
4595-
<term><option>--stream</option></term>
4596-
<listitem>
4597-
<para>
4598-
Copies the instance in <link linkend="pbk-stream-mode">STREAM</link> WAL delivery mode,
4599-
including all the necessary WAL files by streaming them from
4600-
the instance server via replication protocol.
4601-
</para>
4602-
</listitem>
4603-
</varlistentry>
4604-
46054615
<varlistentry>
46064616
<term><option>--temp-slot</option></term>
46074617
<listitem>

gen_probackup_project.pl

+6-6
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

nls.mk

+6
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

+8
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

+10-1
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

packaging/test/scripts/rpm_forks.sh

+15-5
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,15 @@ 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+
if [ ${DISTRIB} = 'centos' -a ${DISTRIB_VERSION} = '8' ]; then
19+
sed -i 's|mirrorlist|#mirrorlist|g' /etc/yum.repos.d/CentOS-*.repo
20+
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*.repo
21+
fi
1822
yum update -y
23+
if [ ${DISTRIB} = 'centos' -a ${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
1927
fi
2028

2129
if [ ${PBK_EDITION} == 'ent' ]; then
@@ -80,11 +88,13 @@ if [ $PBK_EDITION == 'std' ] ; then
8088

8189
# install POSTGRESQL
8290
# rpm -ivh https://download.postgresql.org/pub/repos/yum/reporpms/EL-${DISTRIB_VERSION}-x86_64/pgdg-redhat-repo-latest.noarch.rpm
83-
if [[ ${PG_VERSION} == '11' ]] || [[ ${PG_VERSION} == '12' ]]; then
84-
rpm -ivh https://repo.postgrespro.ru/pgpro-${PG_VERSION}/keys/postgrespro-std-${PG_VERSION}.${DISTRIB}.yum-${PG_VERSION}-0.3.noarch.rpm
85-
else
86-
rpm -ivh https://repo.postgrespro.ru/pgpro-${PG_VERSION}/keys/postgrespro-std-${PG_VERSION}.${DISTRIB}.yum-${PG_VERSION}-0.3.noarch.rpm
87-
fi
91+
#if [[ ${PG_VERSION} == '11' ]] || [[ ${PG_VERSION} == '12' ]]; then
92+
# rpm -ivh https://repo.postgrespro.ru/pgpro-${PG_VERSION}/keys/postgrespro-std-${PG_VERSION}.${DISTRIB}.yum-${PG_VERSION}-0.3.noarch.rpm
93+
#else
94+
# rpm -ivh https://repo.postgrespro.ru/pgpro-${PG_VERSION}/keys/postgrespro-std-${PG_VERSION}.${DISTRIB}.yum-${PG_VERSION}-0.3.noarch.rpm
95+
#fi
96+
curl -o pgpro-repo-add.sh https://repo.postgrespro.ru/pgpro-${PG_VERSION}/keys/pgpro-repo-add.sh
97+
sh pgpro-repo-add.sh
8898

8999
if [[ ${PG_VERSION} == '9.6' ]]; then
90100
yum install -y postgrespro${PG_TOG}-server.x86_64

0 commit comments

Comments
 (0)