Skip to content
This repository was archived by the owner on Aug 16, 2021. It is now read-only.

Commit 9e56fa3

Browse files
committed
Merge branch 'postgres-12' into 'master'
Support PostgreSQL 12 See merge request postgres-ai/nancy!214
2 parents 058f4ae + 2a1ea99 commit 9e56fa3

File tree

6 files changed

+63
-27
lines changed

6 files changed

+63
-27
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Database experiments are needed when you:
4141

4242
* Works anywhere where Docker can run (checked: Linux Ubuntu/Debian, macOS)
4343
* Experiments are conducted in a Docker container with extended Postgres setup
44-
* Supported Postgres versions: 11 (default), 10, 9.6
44+
* Supported Postgres versions: 12 (default), 11, 10, 9.6
4545
* Postgres config specified via options, may be partial
4646
* Supported locations for experimental runs:
4747
* Any machine with Docker installed

docker/Dockerfile

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,44 @@
1-
FROM ubuntu:16.04
1+
FROM ubuntu:18.04
22

33
ARG PG_SERVER_VERSION
44

5-
ENV PG_SERVER_VERSION=${PG_SERVER_VERSION:-11} \
5+
ENV PG_SERVER_VERSION=${PG_SERVER_VERSION:-12} \
66
DEBIAN_FRONTEND=noninteractive
77

88
# add custom FTS dictionaries
9-
ADD ./tsearch_data /usr/share/postgresql/$PG_SERVER_VERSION/tsearch_data
9+
ADD ./tsearch_data /usr/share/postgresql/${PG_SERVER_VERSION}/tsearch_data
1010

1111
# logging ON; memory setting – for 2CPU/4096MB/SSD
1212
ADD ./postgresql_${PG_SERVER_VERSION}_tweak.conf /postgresql.tweak.conf
1313

1414
# set up apt, add Postgres repo
1515
RUN apt-get update
16-
RUN apt-get install -y wget ca-certificates
16+
RUN apt-get install -y wget ca-certificates gnupg2
1717
RUN wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
18-
RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ xenial-pgdg main $PG_SERVER_VERSION" > /etc/apt/sources.list.d/pgdg.list
18+
RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ bionic-pgdg main" >> /etc/apt/sources.list.d/pgdg.list
1919
RUN apt-get update
2020
RUN apt-get install -y apt-utils
2121

2222
# install additional utilites
2323
RUN apt-get install -y sudo git jq libjson-xs-perl vim
24-
RUN apt-get install -y sysbench s3cmd sudo bzip2 python-software-properties software-properties-common
24+
RUN apt-get install -y sysbench s3cmd sudo bzip2 software-properties-common
2525
RUN apt-get install -y sysstat iotop moreutils psmisc
2626

2727
# install Postgres and postgres-specific packages
28-
RUN apt-get install -y postgresql-$PG_SERVER_VERSION
29-
RUN apt-get install -y postgresql-contrib-$PG_SERVER_VERSION
30-
RUN apt-get install -y postgresql-plpython-$PG_SERVER_VERSION
31-
RUN apt-get install -y postgresql-server-dev-$PG_SERVER_VERSION
32-
RUN apt-get install -y postgresql-$PG_SERVER_VERSION-dbg
33-
RUN apt-get install -y postgresql-$PG_SERVER_VERSION-pg-stat-kcache
34-
RUN apt-get install -y postgresql-client-11
28+
RUN apt-get install -y postgresql-${PG_SERVER_VERSION}
29+
RUN apt-get install -y postgresql-contrib-${PG_SERVER_VERSION}
30+
RUN apt-get install -y postgresql-server-dev-${PG_SERVER_VERSION}
31+
#RUN if [ "${PG_SERVER_VERSION}" != "12" ]; then apt-get install -y postgresql-${PG_SERVER_VERSION}-dbg; fi
32+
RUN apt-get install -y postgresql-${PG_SERVER_VERSION}-pg-stat-kcache
33+
RUN apt-get install -y postgresql-client-12
34+
RUN if [ "${PG_SERVER_VERSION}" == "12" ]; then apt-get install -y postgresql-plpython3-${PG_SERVER_VERSION}; fi
35+
RUN if [ "${PG_SERVER_VERSION}" != "12" ]; then apt-get install -y postgresql-plpython-${PG_SERVER_VERSION}; fi
3536

3637
RUN apt-get install -y pgreplay
37-
RUN apt-get install -y pspg
38+
RUN apt-get update && apt-get install -y pspg
3839
RUN git clone https://github.com/NikolayS/postgres_dba.git /root/postgres_dba
39-
RUN apt-get install -y postgresql-$PG_SERVER_VERSION-repack
40-
RUN git clone https://github.com/darold/pgbadger.git /root/pgbadger && cd /root/pgbadger && git checkout "tags/v10.3"
40+
RUN apt-get install -y postgresql-${PG_SERVER_VERSION}-repack
41+
RUN git clone https://github.com/darold/pgbadger.git /root/pgbadger && cd /root/pgbadger && git checkout "tags/v11.1"
4142

4243
# install FlameGraph and generic perf
4344
RUN git clone https://github.com/brendangregg/FlameGraph /root/FlameGraph
@@ -48,30 +49,30 @@ RUN path=$(ls /usr/lib/linux-tools/*generic/perf | head -n 1) && ln -s -f "$path
4849
# configure psql, configure Postgres
4950
RUN echo "\\set dba '\\\\\\\\i /root/postgres_dba/start.psql'" >> ~/.psqlrc
5051
RUN echo "\\setenv PAGER 'pspg -bX --no-mouse'" >> ~/.psqlrc
51-
RUN echo "local all all trust" > /etc/postgresql/$PG_SERVER_VERSION/main/pg_hba.conf
52-
RUN echo "host all all 0.0.0.0/0 md5" >> /etc/postgresql/$PG_SERVER_VERSION/main/pg_hba.conf
53-
RUN echo "listen_addresses='*'" >> /etc/postgresql/$PG_SERVER_VERSION/main/postgresql.conf
54-
RUN echo "log_filename='postgresql-$PG_SERVER_VERSION-main.log'" >> /etc/postgresql/$PG_SERVER_VERSION/main/postgresql.conf
52+
RUN echo "local all all trust" > /etc/postgresql/${PG_SERVER_VERSION}/main/pg_hba.conf
53+
RUN echo "host all all 0.0.0.0/0 md5" >> /etc/postgresql/${PG_SERVER_VERSION}/main/pg_hba.conf
54+
RUN echo "listen_addresses='*'" >> /etc/postgresql/${PG_SERVER_VERSION}/main/postgresql.conf
55+
RUN echo "log_filename='postgresql-${PG_SERVER_VERSION}-main.log'" >> /etc/postgresql/${PG_SERVER_VERSION}/main/postgresql.conf
5556

5657
# prepare database 'test' with 'testuser'
5758
RUN /etc/init.d/postgresql start && psql -U postgres -c "create database test" \
5859
&& psql -U postgres -d test -c "CREATE EXTENSION pg_repack" \
5960
&& psql -U postgres -c "CREATE ROLE testuser LOGIN password 'testuser' superuser" && /etc/init.d/postgresql stop
6061

6162
# apply 'tweaked' config
62-
RUN cat /postgresql.tweak.conf >> /etc/postgresql/$PG_SERVER_VERSION/main/postgresql.conf
63+
RUN cat /postgresql.tweak.conf >> /etc/postgresql/${PG_SERVER_VERSION}/main/postgresql.conf
6364

6465
# prepare Postgres start script
6566
RUN echo "#!/bin/bash" > /pg_start.sh && chmod a+x /pg_start.sh
66-
RUN printf "sudo -u postgres /usr/lib/postgresql/$PG_SERVER_VERSION/bin/postgres -D /var/lib/postgresql/$PG_SERVER_VERSION/main -c config_file=/etc/postgresql/$PG_SERVER_VERSION/main/postgresql.conf \n" >> /pg_start.sh
67+
RUN printf "sudo -u postgres /usr/lib/postgresql/${PG_SERVER_VERSION}/bin/postgres -D /var/lib/postgresql/${PG_SERVER_VERSION}/main -c config_file=/etc/postgresql/${PG_SERVER_VERSION}/main/postgresql.conf \n" >> /pg_start.sh
6768
# infinite sleep to allow restarting Postgres
6869
RUN echo "/bin/bash -c \"trap : TERM INT; sleep infinity & wait\"" >> /pg_start.sh
6970

7071
# generate english locale for iostat + iostat-tool
7172
RUN locale-gen en_US.UTF-8
7273

7374
# install pip and iostat-tool
74-
RUN apt-get install curl
75+
RUN apt-get install -y curl
7576
RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
7677
RUN python3 get-pip.py
7778
RUN pip3 install iostat-tool

docker/postgresql_12_tweak.conf

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# IMPORTANT: on faster systems, you need to use your own memory-related settings!
2+
statement_timeout = 0
3+
4+
log_destination = 'stderr,csvlog'
5+
logging_collector = on
6+
log_directory = '/var/log/postgresql'
7+
# log_filename – to be set dynamically
8+
log_min_messages = notice
9+
log_min_error_statement = notice
10+
log_min_duration_statement = -1 # rely on "auto_explain.log_min_duration = 0", avoid duplicates
11+
log_checkpoints = on
12+
log_connections = on
13+
log_disconnections = on
14+
log_line_prefix = '%t [%p]: [%l-1] db=%d,user=%u (%a,%h) '
15+
log_lock_waits = on
16+
log_replication_commands = on
17+
log_temp_files = 0
18+
log_autovacuum_min_duration = 0
19+
20+
shared_preload_libraries = 'pg_stat_statements,auto_explain,pg_stat_kcache'
21+
22+
pg_stat_statements.max = 5000
23+
pg_stat_statements.track = all
24+
pg_stat_statements.track_utility = on
25+
pg_stat_statements.save = on
26+
27+
auto_explain.log_min_duration = 0
28+
auto_explain.log_analyze = on
29+
auto_explain.log_verbose = on
30+
auto_explain.log_buffers = on
31+
auto_explain.log_format = 'json'
32+
auto_explain.log_timing = on
33+
auto_explain.log_triggers = on
34+
auto_explain.log_nested_statements = on

docker/rebuild_push_images.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Rebuild all images and push to Docker Hub
33
set -e -u -o pipefail
44

5-
VERSIONS="9.6 10 11"
5+
VERSIONS="9.6 10 11 12"
66

77
if [[ ! -z ${1+x} ]]; then
88
VERSIONS="$1"

help/nancy_run.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@
8282

8383
* '9.6'
8484
* '10'
85-
* '11' (default)
85+
* '11'
86+
* '12' (default)
8687

8788
Currently, there is no way to specify the minor version – it is always the
8889
most recent version, available in the official PostgreSQL APT repository (see

nancy_run.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ DURATION_WRKLD=""
1919
VERBOSE_OUTPUT_REDIRECT=" > /dev/null"
2020
STDERR_DST="/dev/null"
2121
EBS_SIZE_MULTIPLIER=5
22-
POSTGRES_VERSION_DEFAULT=11
22+
POSTGRES_VERSION_DEFAULT=12
2323
AWS_BLOCK_DURATION=0
2424
MSG_PREFIX=""
2525
declare -a RUNS # i - delta_config i+1 delta_ddl_do i+2 delta_ddl_undo

0 commit comments

Comments
 (0)