Commit 5414d7b6 authored by Christoph Berg's avatar Christoph Berg

Document the RPM port; disable OOM killer protection; disable...

Document the RPM port; disable OOM killer protection; disable logging_collector for tests; create postgres user using the commands from the RPM packages
parent 300abbc0
......@@ -416,7 +416,7 @@ if ($action ne 'stop' && $info{'statstempdir'} && ! -d $info{'statstempdir'}) {
if ($> == 0) {
# have postgres start with increased OOM killer protection; 9.1 and
# later has builtin support for resetting the adjustment of child processes
if ($action eq 'start' && $version >= '9.1') {
if ($action eq 'start' and $version >= '9.1' and not $PgCommon::rpm) {
if (-w '/proc/self/oom_score_adj') {
open F, '>/proc/self/oom_score_adj';
print F "-900\n";
postgresql-common for RedHat
The postgresql-common framework was written for Debian/Ubuntu, but most parts
of it work as well on other operating systems. The RPM port changes little in
the original code, and even uses many files from the debian/ directory for
building the packages.
No separate PostgreSQL client/server packages are provided; the port is backed
by the PGDG RPM packages from
The filesystem layout is unchanged, /etc/postgresql, /etc/postgresql-common,
/var/lib/postgresql, and /var/run/postgresql are used as before.
Differences between the Debian and RedHat operating modes are:
* The postgres system user home is /var/lib/pgsql.
* The binroot is changed from /usr/lib/postgresql/ to /usr/pgsql-. (Note the
missing trailing slash, the idea is that the version number can just be
appended to the path, e.g. /usr/lib/postgresql/9.4/bin becomes
* The various symlinks for frontend programs in /usr/bin like psql are not
direct symlinks to pg_wrapper, but are added as high-priority alternatives to
the alternatives symlinks set up by the PostgreSQL RPM packages.
* SSL is disabled by default because there is no easily available snakeoil
certificate. Proper certificates can be configured in createcluster.conf.
* No attempt is made to setup OOM killer protection for the postmaster process.
* On Debian, the /etc/init.d/postgresql init script skips versions that have
their own /etc/init.d/postgresql-x.y init script, mostly for compatibility
with legacy packages before the advent of the postgresql-common framework.
The RPM packages provide /etc/init.d/postgresql-x.y scripts, which are
ignored by /etc/init.d/postgresql. The postgresql-x.y scripts will not do
anything as long as the user does not use them to create clusters in
/var/lib/pgsql. (In which case they continue to work as if postgresql-common
was not present.)
* Debian's pre/postinst/rm maintainer scripts are not used. Mostly this means
there is no automatic integration of tsearch with system-provided
-- Christoph Berg <> Thu, 26 Jun 2014 16:59:47 +0200
......@@ -98,12 +98,10 @@ cp debian/logrotate.template %{buildroot}/etc/logrotate.d/postgresql-common
%files -n postgresql-server-dev-all -f files-postgresql-server-dev-all
## RedHat's adduser is different, create the user here
#if ! getent passwd postgres > /dev/null; then
# adduser --system --home /var/lib/postgresql --no-create-home \
# --shell /bin/bash --comment "PostgreSQL administrator" postgres
#sh -x /usr/share/postgresql-common/postgresql-common.postinst "configure"
groupadd -g 26 -o -r postgres >/dev/null 2>&1 || :
useradd -M -n -g postgres -o -r -d /var/lib/pgsql -s /bin/bash \
-c "PostgreSQL Server" -u 26 postgres >/dev/null 2>&1 || :
version_lt () {
newest=$( ( echo "$1"; echo "$2" ) | sort -V | tail -n1)
[ "$1" != "$newest" ]
......@@ -142,7 +142,11 @@ sub check_major {
# verify that SSL is enabled (which should work for user postgres in a
# default installation)
my $ssl = config_bool (PgCommon::get_conf_value $v, 'main', 'postgresql.conf', 'ssl');
is $ssl, 1, 'SSL is enabled';
if ($PgCommon::rpm) {
is $ssl, undef, 'SSL is disabled';
} else {
is $ssl, 1, 'SSL is enabled';
# Create user nobody, a database 'nobodydb' for him, check the database list
my $outref;
......@@ -196,7 +200,7 @@ Bob|1
0, "Foo2\n", 'calling PL/Python function';
# Check PL/Python3 (untrusted)
if ($v >= '9.1') {
if ($v >= '9.1' and not $PgCommon::rpm) {
is_program_out 'postgres', 'createlang plpython3u nobodydb', 0, '', 'createlang plpython3u succeeds for user postgres';
is_program_out 'postgres', 'psql nobodydb -qc "CREATE FUNCTION capitalize3(text) RETURNS text AS \'import sys; return args[0].capitalize() + sys.version[0]\' LANGUAGE plpython3u;"',
0, '', 'creating PL/Python3 function as user postgres succeeds';
......@@ -283,10 +287,10 @@ Bob|1
$adj = <F>;
chomp $adj;
close F;
if ($v >= '9.1') {
cmp_ok $adj, '<=', -500, 'postgres >= 9.1 master has OOM killer protection';
if ($v >= '9.1' and not $PgCommon::rpm) {
cmp_ok $adj, '<=', -500, 'postgres master has OOM killer protection';
} else {
is $adj, 0, 'postgres < 9.1 master has no OOM adjustment';
is $adj, 0, 'postgres master has no OOM adjustment';
open F, "/proc/$client_pid/oom_score_adj";
......@@ -130,6 +130,10 @@ chown postgres:postgres /var/run/postgresql
chmod 2775 /var/run/postgresql
chmod 1777 /dev/shm
# the RPM packages enable the logging_collector by default, which the testsuite
# doesn't like. We disable it unconditionally here.
echo "logging_collector = off" >> /etc/postgresql-common/createcluster.conf
# reset core limit for pg_ctl tests
ulimit -S -c 0
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment