Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable prefetch when restore_command is called for pg_rewind #495

Merged
merged 5 commits into from
Sep 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,14 @@ How to Build This Docker Image

$ cd postgres-appliance

$ ./build.sh --build-arg COMPRESS=true --tag $YOUR_TAG .
$ docker build --tag $YOUR_TAG .

Other build arguments and their default values:

There are a few build arguments defined in the Dockerfile and it is possible to change them by specifying ``--build-arg`` arguments:

- WITH_PERL=false # set to true if you want to install perl and plperl packages into image
- PGVERSION="11"
- PGOLDVERSIONS="9.3 9.4 9.5 9.6 10"
- PGVERSION="12"
- PGOLDVERSIONS="9.5 9.6 10 11"
- DEMO=false # set to true to build the smallest possible image which will work only on Kubernetes
- TIMESCALEDB_APACHE_ONLY=true # set to false to build timescaledb community version (Timescale License)

Expand Down
5 changes: 3 additions & 2 deletions postgres-appliance/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ ENV POSTGIS_VERSION=3.0 \
PG_AUTH_MON_COMMIT=902c670c9f2071b30e1d4437e7a38e2e136f9be6 \
PG_MON_COMMIT=cc028fdae8542ec3f5df3bf4c66f0895d87c127d \
DECODERBUFS=v1.2.1.Final \
SET_USER=REL1_6_2 \
SET_USER=REL2_0_0 \
PLPROFILER=REL4_1 \
PAM_OAUTH2=v1.0.1 \
PLANTUNER_COMMIT=800d81bc85da64ff3ef66e12aed1d4e1e54fc006
Expand Down Expand Up @@ -376,7 +376,7 @@ RUN export DEBIAN_FRONTEND=noninteractive \
# Install patroni, wal-e and wal-g
ENV PATRONIVERSION=2.0.0
ENV WALE_VERSION=1.1.1
ENV WALG_VERSION=v0.2.17
ENV WALG_VERSION=v0.2.15
RUN export DEBIAN_FRONTEND=noninteractive \
&& set -ex \
&& BUILD_PACKAGES="python3-pip python3-wheel python3-dev git patchutils binutils" \
Expand Down Expand Up @@ -414,6 +414,7 @@ RUN export DEBIAN_FRONTEND=noninteractive \
&& sed -i 's/^\( for i in range(0,\) num_retries):.*/\1 100):/g' /usr/lib/python3/dist-packages/boto/utils.py; \
fi \
&& pip3 install patroni[kubernetes$EXTRAS]==$PATRONIVERSION \
&& pip3 install "git+https://github.com/zalando/patroni.git@2.0/bugfixes#egg=patroni[kubernetes$EXTRAS]" \
\
&& for d in /usr/local/lib/python3.6 /usr/lib/python3; do \
cd $d/dist-packages \
Expand Down
8 changes: 7 additions & 1 deletion postgres-appliance/scripts/restore_command.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,15 @@ readonly wal_fast_source=$(dirname "$(dirname "$(realpath "$wal_dir")")")/wal_fa

[[ -f $wal_fast_source ]] && exec mv "${wal_fast_source}" "${wal_destination}"

if [[ "$wal_destination" =~ /$wal_filename$ ]]; then # Patroni fetching missing files for pg_rewind
export WALG_DOWNLOAD_CONCURRENCY=1
POOL_SIZE=0
else
POOL_SIZE=$WALG_DOWNLOAD_CONCURRENCY
fi

[[ "$USE_WALG_RESTORE" == "true" ]] && exec wal-g wal-fetch "${wal_filename}" "${wal_destination}"

POOL_SIZE=$(($(grep -c ^processor /proc/cpuinfo 2>/dev/null || 1)-1))
[[ $POOL_SIZE -gt 8 ]] && POOL_SIZE=8

if [[ -z $WALE_S3_PREFIX ]]; then # non AWS environment?
Expand Down